- * @param cls the closure
- * @param rh the resolution handle
- * @param rd_count number of results
- * @param rd result data
- */
-typedef void (*ResolutionResultProcessor) (void *cls,
- struct ResolverHandle *rh,
- uint32_t rd_count,
- const struct GNUNET_NAMESTORE_RecordData *rd);
-
-
-/**
- * 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
- * RSL_DELEGATE_VPN: Found VPN delegation
- * RSL_DELEGATE_NS: Found NS delegation
- * RSL_DELEGATE_PKEY: Found PKEY delegation
- * RSL_CNAME_FOUND: Found CNAME record
- * RSL_PKEY_REVOKED: Found PKEY has been revoked
- */
-enum ResolutionStatus
-{
- RSL_RECORD_EXISTS = 1,
- RSL_RECORD_EXPIRED = 2,
- RSL_TIMED_OUT = 4,
- RSL_DELEGATE_VPN = 8,
- RSL_DELEGATE_NS = 16,
- RSL_DELEGATE_PKEY = 32,
- RSL_CNAME_FOUND = 64,
- RSL_PKEY_REVOKED = 128
-};
-
-/**
- * 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
-{
-
- /* DLL */
- struct ResolverHandle *next;
-
- /* DLL */
- struct ResolverHandle *prev;
-
- /* The name to resolve */
- char name[MAX_DNS_NAME_LENGTH];
-
- /* has this query been answered? how many matches */
- int answered;
-
- /* Use only cache */
- int only_cached;
-
- /* the authoritative zone to query */
- struct GNUNET_CRYPTO_ShortHashCode authority;
-
- /* the name of the authoritative zone to query */
- char authority_name[MAX_DNS_LABEL_LENGTH];
-
- /* a handle for dht lookups. should be NULL if no lookups are in progress */
- struct GNUNET_DHT_GetHandle *get_handle;
-
- /* timeout set for this lookup task */
- struct GNUNET_TIME_Relative timeout;
-
- /* a handle to a vpn request */
- struct GNUNET_VPN_RedirectionRequest *vpn_handle;
-
- /* a socket for a dns request */
- struct GNUNET_NETWORK_Handle *dns_sock;
-
- /* a synthesized dns name */
- char dns_name[MAX_DNS_NAME_LENGTH];
-
- /* the authoritative dns zone */
- char dns_zone[MAX_DNS_NAME_LENGTH];
-
- /* the address of the DNS server FIXME not needed? */
- struct sockaddr_in dns_addr;
-
- /* handle to the local stub resolver request */
- struct GNUNET_RESOLVER_RequestHandle *dns_resolver_handle;
-
- /* select task for DNS */
- GNUNET_SCHEDULER_TaskIdentifier dns_read_task;
-
- /* pointer to raw dns query payload FIXME needs to be freed/NULL */
- char *dns_raw_packet;
-
- /* size of the raw dns query */
- size_t dns_raw_packet_size;
-
- /* timeout task for the lookup */
- GNUNET_SCHEDULER_TaskIdentifier timeout_task;
-
- /* continuation to call on timeout */
- GNUNET_SCHEDULER_Task timeout_cont;
-
- /* closure for timeout cont */
- void* timeout_cont_cls;
-
- /* called when resolution phase finishes */
- ResolutionResultProcessor proc;
-
- /* closure passed to proc */
- void* proc_cls;
-
- /* DLL to store the authority chain */
- struct AuthorityChain *authority_chain_head;
-
- /* DLL to store the authority chain */
- struct AuthorityChain *authority_chain_tail;
-
- /* status of the resolution result */
- enum ResolutionStatus status;
-
- /* The provate local zone of this request */
- struct GNUNET_CRYPTO_ShortHashCode private_local_zone;
-
- /**
- * private key of an/our authoritative zone
- * can be NULL but automatical PKEY import will not work
- */
- struct GNUNET_CRYPTO_RsaPrivateKey *priv_key;
-
- /**
- * the heap node associated with this lookup, null if timeout is set
- * used for DHT background lookups.
- */
- struct GNUNET_CONTAINER_HeapNode *dht_heap_node;
-
- /**
- * Id for resolution process
- */
- unsigned long long id;
-
- /**
- * Pending Namestore task
- */
- struct GNUNET_NAMESTORE_QueueEntry *namestore_task;
-
-};
-
-
-/**
- * Handle to a record lookup
- */
-struct RecordLookupHandle
-{
- /* the record type to look up */
- enum GNUNET_GNS_RecordType record_type;
-
- /* the name to look up */
- char name[MAX_DNS_NAME_LENGTH];
-
- /* Method to call on record resolution result */
- RecordLookupProcessor proc;
-
- /* closure to pass to proc */
- void* proc_cls;
-
-};
-
-
-/**
- * Handle to a shorten context
- */
-struct NameShortenHandle
-{
- /* Method to call on shorten result */
- ShortenResultProcessor proc;
-
- /* closure to pass to proc */
- void* proc_cls;
-
- /* result of shorten */
- char result[MAX_DNS_NAME_LENGTH];
-
- /* root zone */
- struct GNUNET_CRYPTO_ShortHashCode *root_zone;
-
- /* private zone */
- struct GNUNET_CRYPTO_ShortHashCode *private_zone;
-
- /* name of private zone */
- char private_zone_name[MAX_DNS_LABEL_LENGTH];
-
- /* shorten zone */
- struct GNUNET_CRYPTO_ShortHashCode *shorten_zone;
-
- /* name of shorten zone */
- char shorten_zone_name[MAX_DNS_LABEL_LENGTH];
-
-};
-
-/**
- * Handle to a get authority context