memcpy(&lookup_msg[1], name, strlen(name));
- GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
+ GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
pending);
process_pending_messages (handle);
memcpy(&shorten_msg[1], name, strlen(name));
- GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
+ GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
pending);
process_pending_messages (handle);
memcpy(&get_auth_msg[1], name, strlen(name));
- GNUNET_CONTAINER_DLL_insert (handle->pending_head, handle->pending_tail,
+ GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
pending);
process_pending_messages (handle);
ResolverCleanupContinuation cont = cls;
GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
- "GNS_CLEANUP-%d: Terminating background lookup for %s\n",
+ "GNS_CLEANUP-%llu: Terminating background lookup for %s\n",
rh->id, rh->name);
GNUNET_DHT_get_stop(rh->get_handle);
rh->get_handle = NULL;
if (name != NULL)
{
- rh->status |= EXISTS;
+ rh->status |= RSL_RECORD_EXISTS;
}
if (remaining_time.rel_value == 0)
{
- rh->status |= EXPIRED;
+ rh->status |= RSL_RECORD_EXPIRED;
}
if (rd_count == 0)
"GNS_PHASE_DELEGATE_DHT-%llu: dht lookup for query %s (%ds)timed out.\n",
rh->id, rh->authority_name, rh->timeout.rel_value);
- rh->status |= TIMED_OUT;
+ rh->status |= RSL_TIMED_OUT;
rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
/**
* There are 4 conditions that have to met for us to consult the DHT:
- * 1. The entry in the DHT is EXPIRED AND
+ * 1. The entry in the DHT is RSL_RECORD_EXPIRED AND
* 2. No entry in the NS existed AND
* 3. The zone queried is not the local resolver's zone AND
* 4. The name that was looked up is '+'
* the DHT for the authority in the authority lookup phase (and thus
* would already have an entry in the NS for the record)
*/
- if (rh->status & (EXPIRED | !EXISTS) &&
+ if (rh->status & (RSL_RECORD_EXPIRED | !RSL_RECORD_EXISTS) &&
GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
&local_zone) &&
(strcmp(rh->name, "+") == 0))
* and exists
* or we are authority
**/
- if ((rh->status & (EXISTS | !EXPIRED)) ||
- !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
- &rh->authority_chain_tail->zone))
+ if (((rh->status & RSL_RECORD_EXISTS) && (rh->status & !RSL_RECORD_EXPIRED))
+ || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
+ &local_zone))
{
if (is_canonical(rh->name))
{
if (name != NULL)
{
- rh->status |= EXISTS;
+ rh->status |= RSL_RECORD_EXISTS;
}
if (remaining_time.rel_value == 0)
{
- rh->status |= EXPIRED;
+ rh->status |= RSL_RECORD_EXPIRED;
}
/**
typedef void (*ResolverCleanupContinuation) (void);
/**
- * processor for a resultion result
+ * processor for a record lookup result
*
* @param cls the closure
* @param rd_count number of results
- * @param rd resukt data
+ * @param rd result data
*/
typedef void (*RecordLookupProcessor) (void *cls,
uint32_t rd_count,
typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name);
/**
- * processor for a resultion result
+ * processor for a resolution result
*
* @param cls the closure
* @param rh the resolution handle
/**
- * Resoltion status indicator
- * EXISTS: the name to lookup exists
- * EXPIRED: the name in the record expired
+ * Resolution status indicator
+ * RSL_RECORD_EXISTS: the name to lookup exists
+ * RSL_RECORD_EXPIRED: the name in the record expired
+ * RSL_TIMED_OUT: resolution timed out
*/
enum ResolutionStatus
{
- EXISTS = 1,
- EXPIRED = 2,
- TIMED_OUT = 4
+ RSL_RECORD_EXISTS = 1,
+ RSL_RECORD_EXPIRED = 2,
+ RSL_TIMED_OUT = 4
};
/**
* Handle to a currenty pending resolution
+ * a ResolverHandle is passed to, for example
+ * resolve_record_ns to resolve a record in the namestore.
+ * On result (positive or negative) the ResolutionResultProcessor
+ * is called.
+ * If a timeout is set timeout_cont will be called.
+ * If no timeout is set (ie timeout forever) then background resolutions
+ * might be triggered.
*/
struct ResolverHandle
{
/* the name of the authoritative zone to query */
char authority_name[MAX_DNS_LABEL_LENGTH];
- /**
- * we have an authority in namestore that
- * may be able to resolve
- */
- int authority_found;
-
/* a handle for dht lookups. should be NULL if no lookups are in progress */
struct GNUNET_DHT_GetHandle *get_handle;
*/
struct NameShortenHandle
{
-
-
/* Method to call on shorten result */
ShortenResultProcessor proc;
/* closure to pass to proc */
void* proc_cls;
-
};
/**
*/
struct GetNameAuthorityHandle
{
-
/* the name to look up authority for */
char name[MAX_DNS_NAME_LENGTH];
/* closure to pass to proc */
void* proc_cls;
-
};
/**
/**
* Lookup of a record in a specific zone
- * calls lookup result processor on result
+ * calls RecordLookupProcessor on result or timeout
*
* @param zone the root zone
* @param record_type the record type to look up
ok = 2;
}
- GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A,
- &on_lookup_result, TEST_DOMAIN);
/* Now lookup some non existing records */
for (i=0; i<max_parallel_lookups+TEST_ADDITIONAL_LOOKUPS; i++)
{
GNUNET_snprintf(lookup_name,
MAX_DNS_NAME_LENGTH,
- "doesnotexist-%d.bob.gnunet", i);
+ "www.doesnotexist-%d.bob.gnunet", i);
GNUNET_GNS_lookup(gns_handle, lookup_name, GNUNET_GNS_RECORD_TYPE_A,
&on_lookup_result_dummy, NULL);
}
+
+ GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A,
+ &on_lookup_result, TEST_DOMAIN);
}