6 #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3)
7 #define DHT_LOOKUP_TIMEOUT DHT_OPERATION_TIMEOUT
8 #define DHT_GNS_REPLICATION_LEVEL 5
9 #define MAX_DNS_LABEL_LENGTH 63
12 * DLL to hold the authority chain
13 * we had to pass in the resolution process
17 struct AuthorityChain *prev;
19 struct AuthorityChain *next;
21 /* the zone hash of the authority */
24 /* (local) name of the authority */
27 /* was the ns entry fresh */
31 /* handle to a resolution process */
32 struct ResolverHandle;
35 * processor for a resultion result
37 * @param cls the closure
38 * @param rh the resolution handle
39 * @param rd_count number of results
40 * @pram rd resukt data
42 typedef void (*RecordLookupProcessor) (void *cls,
44 const struct GNUNET_NAMESTORE_RecordData *rd);
48 * processor for a shorten result
50 * @param cls the closure
51 * @param name shortened name
53 typedef void (*ShortenResultProcessor) (void *cls, const char* name);
57 * processor for an authority result
59 * @param cls the closure
62 typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name);
65 * processor for a resultion result
67 * @param cls the closure
68 * @param rh the resolution handle
69 * @param rd_count number of results
70 * @param rd result data
72 typedef void (*ResolutionResultProcessor) (void *cls,
73 struct ResolverHandle *rh,
75 const struct GNUNET_NAMESTORE_RecordData *rd);
79 * Resoltion status indicator
80 * EXISTS: the name to lookup exists
81 * EXPIRED: the name in the record expired
90 * Handle to a currenty pending resolution
94 /* The name to resolve */
97 /* has this query been answered? how many matches */
100 /* the authoritative zone to query */
101 GNUNET_HashCode authority;
103 /* the name of the authoritative zone to query */
104 char *authority_name;
107 * we have an authority in namestore that
108 * may be able to resolve
112 /* a handle for dht lookups. should be NULL if no lookups are in progress */
113 struct GNUNET_DHT_GetHandle *get_handle;
115 /* timeout task for dht lookups */
116 GNUNET_SCHEDULER_TaskIdentifier dht_timeout_task;
118 /* called when resolution phase finishes */
119 ResolutionResultProcessor proc;
121 /* closure passed to proc */
124 /* DLL to store the authority chain */
125 struct AuthorityChain *authority_chain_head;
127 /* DLL to store the authority chain */
128 struct AuthorityChain *authority_chain_tail;
130 /* status of the resolution result */
131 enum ResolutionStatus status;
137 * Handle to a record lookup
139 struct RecordLookupHandle
141 /* the record type to look up */
142 enum GNUNET_GNS_RecordType record_type;
144 /* the name to look up */
147 /* Method to call on record resolution result */
148 RecordLookupProcessor proc;
150 /* closure to pass to proc */
157 * Handle to a shorten context
159 struct NameShortenHandle
163 /* Method to call on shorten result */
164 ShortenResultProcessor proc;
166 /* closure to pass to proc */
172 * Handle to a get authority context
174 struct GetNameAuthorityHandle
177 /* the name to look up authority for */
180 /* Method to call on result */
181 GetAuthorityResultProcessor proc;
183 /* closure to pass to proc */
190 * Lookup of a record in a specific zone
191 * calls lookup result processor on result
193 * @param zone the root zone
194 * @param record_type the record type to look up
195 * @param proc the processor to call
196 * @param cls the closure to pass to proc
199 gns_resolver_lookup_record(GNUNET_HashCode zone,
200 uint32_t record_type,
202 RecordLookupProcessor proc,
206 gns_resolver_shorten_name(GNUNET_HashCode zone,
208 ShortenResultProcessor proc,
212 * Tries to resolve the authority for name
215 * @param zone the root zone to look up for
216 * @param name the name to lookup up
217 * @param proc the processor to call when finished
218 * @param cls the closure to pass to the processor
221 gns_resolver_get_authority(GNUNET_HashCode zone,
223 GetAuthorityResultProcessor proc,