diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-26 22:13:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-26 22:13:01 +0000 |
commit | 64d3e46cfb99a711e500fa1f114e7c44bdf10040 (patch) | |
tree | 83093d92761d5c1b8b2fded713adaa19af29274c /src/gns/gnunet-service-gns_resolver.h | |
parent | ef6f05f63769263a5201636c4b7f71eaa455cdf3 (diff) | |
download | gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.tar.gz gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.zip |
-bugfixes, code cleanup
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.h')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.h | 402 |
1 files changed, 294 insertions, 108 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index b24fd1274..e8bb74697 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -1,3 +1,27 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | /** | ||
21 | * @file gns/gnunet-service-gns_resolver.h | ||
22 | * @brief GNUnet GNS service | ||
23 | * @author Martin Schanzenbach | ||
24 | */ | ||
1 | #ifndef GNS_RESOLVER_H | 25 | #ifndef GNS_RESOLVER_H |
2 | #define GNS_RESOLVER_H | 26 | #define GNS_RESOLVER_H |
3 | 27 | ||
@@ -5,12 +29,16 @@ | |||
5 | #include "gnunet_dht_service.h" | 29 | #include "gnunet_dht_service.h" |
6 | 30 | ||
7 | #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) | 31 | #define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) |
32 | |||
8 | #define GNUNET_GNS_DEFAULT_LOOKUP_TIMEOUT \ | 33 | #define GNUNET_GNS_DEFAULT_LOOKUP_TIMEOUT \ |
9 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | 34 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) |
35 | |||
10 | #define DHT_LOOKUP_TIMEOUT DHT_OPERATION_TIMEOUT | 36 | #define DHT_LOOKUP_TIMEOUT DHT_OPERATION_TIMEOUT |
37 | |||
11 | #define DHT_GNS_REPLICATION_LEVEL 5 | 38 | #define DHT_GNS_REPLICATION_LEVEL 5 |
12 | 39 | ||
13 | #define GNUNET_GNS_MAX_PARALLEL_LOOKUPS 500 | 40 | #define GNUNET_GNS_MAX_PARALLEL_LOOKUPS 500 |
41 | |||
14 | #define GNUNET_GNS_MAX_NS_TASKS 500 | 42 | #define GNUNET_GNS_MAX_NS_TASKS 500 |
15 | 43 | ||
16 | /* | 44 | /* |
@@ -23,17 +51,26 @@ struct AuthorityChain | |||
23 | 51 | ||
24 | struct AuthorityChain *next; | 52 | struct AuthorityChain *next; |
25 | 53 | ||
26 | /* the zone hash of the authority */ | 54 | /** |
55 | * the zone hash of the authority | ||
56 | */ | ||
27 | struct GNUNET_CRYPTO_ShortHashCode zone; | 57 | struct GNUNET_CRYPTO_ShortHashCode zone; |
28 | 58 | ||
29 | /* (local) name of the authority */ | 59 | /** |
60 | * (local) name of the authority | ||
61 | */ | ||
30 | char name[MAX_DNS_LABEL_LENGTH]; | 62 | char name[MAX_DNS_LABEL_LENGTH]; |
31 | 63 | ||
32 | /* was the ns entry fresh */ | 64 | /** |
65 | * was the ns entry fresh | ||
66 | */ | ||
33 | int fresh; | 67 | int fresh; |
34 | }; | 68 | }; |
35 | 69 | ||
36 | /* handle to a resolution process */ | 70 | |
71 | /** | ||
72 | * handle to a resolution process | ||
73 | */ | ||
37 | struct ResolverHandle; | 74 | struct ResolverHandle; |
38 | 75 | ||
39 | 76 | ||
@@ -45,8 +82,8 @@ struct ResolverHandle; | |||
45 | * @param rd result data | 82 | * @param rd result data |
46 | */ | 83 | */ |
47 | typedef void (*RecordLookupProcessor) (void *cls, | 84 | typedef void (*RecordLookupProcessor) (void *cls, |
48 | uint32_t rd_count, | 85 | uint32_t rd_count, |
49 | const struct GNUNET_NAMESTORE_RecordData *rd); | 86 | const struct GNUNET_NAMESTORE_RecordData *rd); |
50 | 87 | ||
51 | 88 | ||
52 | /** | 89 | /** |
@@ -55,16 +92,18 @@ typedef void (*RecordLookupProcessor) (void *cls, | |||
55 | * @param cls the closure | 92 | * @param cls the closure |
56 | * @param name shortened name | 93 | * @param name shortened name |
57 | */ | 94 | */ |
58 | typedef void (*ShortenResultProcessor) (void *cls, const char* name); | 95 | typedef void (*ShortenResultProcessor) (void *cls, |
96 | const char* name); | ||
59 | 97 | ||
60 | 98 | ||
61 | /** | 99 | /** |
62 | * processor for an authority result | 100 | * processor for an authority result |
63 | * | 101 | * |
64 | * @param cls the closure | 102 | * @param cls the closure |
65 | * @param name name | 103 | * @param name name of the authority |
66 | */ | 104 | */ |
67 | typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name); | 105 | typedef void (*GetAuthorityResultProcessor) (void *cls, |
106 | const char* name); | ||
68 | 107 | ||
69 | /** | 108 | /** |
70 | * processor for a resolution result | 109 | * processor for a resolution result |
@@ -72,34 +111,57 @@ typedef void (*GetAuthorityResultProcessor) (void *cls, const char* name); | |||
72 | * @param cls the closure | 111 | * @param cls the closure |
73 | * @param rh the resolution handle | 112 | * @param rh the resolution handle |
74 | * @param rd_count number of results | 113 | * @param rd_count number of results |
75 | * @param rd result data | 114 | * @param rd result data (array of 'rd_count' records) |
76 | */ | 115 | */ |
77 | typedef void (*ResolutionResultProcessor) (void *cls, | 116 | typedef void (*ResolutionResultProcessor) (void *cls, |
78 | struct ResolverHandle *rh, | 117 | struct ResolverHandle *rh, |
79 | uint32_t rd_count, | 118 | uint32_t rd_count, |
80 | const struct GNUNET_NAMESTORE_RecordData *rd); | 119 | const struct GNUNET_NAMESTORE_RecordData *rd); |
81 | 120 | ||
82 | 121 | ||
83 | /** | 122 | /** |
84 | * Resolution status indicator | 123 | * Resolution status indicator |
85 | * RSL_RECORD_EXISTS: the name to lookup exists | ||
86 | * RSL_RECORD_EXPIRED: the name in the record expired | ||
87 | * RSL_TIMED_OUT: resolution timed out | ||
88 | * RSL_DELEGATE_VPN: Found VPN delegation | ||
89 | * RSL_DELEGATE_NS: Found NS delegation | ||
90 | * RSL_DELEGATE_PKEY: Found PKEY delegation | ||
91 | * RSL_CNAME_FOUND: Found CNAME record | ||
92 | * RSL_PKEY_REVOKED: Found PKEY has been revoked | ||
93 | */ | 124 | */ |
94 | enum ResolutionStatus | 125 | enum ResolutionStatus |
95 | { | 126 | { |
127 | /** | ||
128 | * the name to lookup exists | ||
129 | */ | ||
96 | RSL_RECORD_EXISTS = 1, | 130 | RSL_RECORD_EXISTS = 1, |
131 | |||
132 | /** | ||
133 | * the name in the record expired | ||
134 | */ | ||
97 | RSL_RECORD_EXPIRED = 2, | 135 | RSL_RECORD_EXPIRED = 2, |
136 | |||
137 | /** | ||
138 | * resolution timed out | ||
139 | */ | ||
98 | RSL_TIMED_OUT = 4, | 140 | RSL_TIMED_OUT = 4, |
141 | |||
142 | /** | ||
143 | * Found VPN delegation | ||
144 | */ | ||
99 | RSL_DELEGATE_VPN = 8, | 145 | RSL_DELEGATE_VPN = 8, |
146 | |||
147 | /** | ||
148 | * Found NS delegation | ||
149 | */ | ||
100 | RSL_DELEGATE_NS = 16, | 150 | RSL_DELEGATE_NS = 16, |
151 | |||
152 | /** | ||
153 | * Found PKEY delegation | ||
154 | */ | ||
101 | RSL_DELEGATE_PKEY = 32, | 155 | RSL_DELEGATE_PKEY = 32, |
156 | |||
157 | /** | ||
158 | * Found CNAME record | ||
159 | */ | ||
102 | RSL_CNAME_FOUND = 64, | 160 | RSL_CNAME_FOUND = 64, |
161 | |||
162 | /** | ||
163 | * Found PKEY has been revoked | ||
164 | */ | ||
103 | RSL_PKEY_REVOKED = 128 | 165 | RSL_PKEY_REVOKED = 128 |
104 | }; | 166 | }; |
105 | 167 | ||
@@ -116,91 +178,149 @@ enum ResolutionStatus | |||
116 | struct ResolverHandle | 178 | struct ResolverHandle |
117 | { | 179 | { |
118 | 180 | ||
119 | /* DLL */ | 181 | /** |
182 | * DLL | ||
183 | */ | ||
120 | struct ResolverHandle *next; | 184 | struct ResolverHandle *next; |
121 | 185 | ||
122 | /* DLL */ | 186 | /** |
187 | * DLL | ||
188 | */ | ||
123 | struct ResolverHandle *prev; | 189 | struct ResolverHandle *prev; |
124 | 190 | ||
125 | /* Last record data found */ | 191 | /** |
192 | * Last record data found | ||
193 | */ | ||
126 | struct GNUNET_NAMESTORE_RecordData rd; | 194 | struct GNUNET_NAMESTORE_RecordData rd; |
127 | 195 | ||
128 | /* Number of last record data found */ | 196 | /** |
197 | * Number of last record data found | ||
198 | */ | ||
129 | unsigned int rd_count; | 199 | unsigned int rd_count; |
130 | 200 | ||
131 | /* The name to resolve */ | 201 | /** |
202 | * The name to resolve | ||
203 | */ | ||
132 | char name[MAX_DNS_NAME_LENGTH]; | 204 | char name[MAX_DNS_NAME_LENGTH]; |
133 | 205 | ||
134 | /* has this query been answered? how many matches */ | 206 | /** |
207 | * has this query been answered? how many matches | ||
208 | */ | ||
135 | int answered; | 209 | int answered; |
136 | 210 | ||
137 | /* Use only cache */ | 211 | /** |
212 | * Use only cache | ||
213 | */ | ||
138 | int only_cached; | 214 | int only_cached; |
139 | 215 | ||
140 | /* the authoritative zone to query */ | 216 | /** |
217 | * the authoritative zone to query | ||
218 | */ | ||
141 | struct GNUNET_CRYPTO_ShortHashCode authority; | 219 | struct GNUNET_CRYPTO_ShortHashCode authority; |
142 | 220 | ||
143 | /* the name of the authoritative zone to query */ | 221 | /** |
222 | * the name of the authoritative zone to query | ||
223 | */ | ||
144 | char authority_name[MAX_DNS_LABEL_LENGTH]; | 224 | char authority_name[MAX_DNS_LABEL_LENGTH]; |
145 | 225 | ||
146 | /* a handle for dht lookups. should be NULL if no lookups are in progress */ | 226 | /** |
227 | * a handle for dht lookups. should be NULL if no lookups are in progress | ||
228 | */ | ||
147 | struct GNUNET_DHT_GetHandle *get_handle; | 229 | struct GNUNET_DHT_GetHandle *get_handle; |
148 | 230 | ||
149 | /* timeout set for this lookup task */ | 231 | /** |
232 | * timeout set for this lookup task | ||
233 | */ | ||
150 | struct GNUNET_TIME_Relative timeout; | 234 | struct GNUNET_TIME_Relative timeout; |
151 | 235 | ||
152 | /* a handle to a vpn request */ | 236 | /** |
237 | * a handle to a vpn request | ||
238 | */ | ||
153 | struct GNUNET_VPN_RedirectionRequest *vpn_handle; | 239 | struct GNUNET_VPN_RedirectionRequest *vpn_handle; |
154 | 240 | ||
155 | /* a socket for a dns request */ | 241 | /** |
242 | * a socket for a dns request | ||
243 | */ | ||
156 | struct GNUNET_NETWORK_Handle *dns_sock; | 244 | struct GNUNET_NETWORK_Handle *dns_sock; |
157 | 245 | ||
158 | /* a synthesized dns name */ | 246 | /** |
247 | * a synthesized dns name | ||
248 | */ | ||
159 | char dns_name[MAX_DNS_NAME_LENGTH]; | 249 | char dns_name[MAX_DNS_NAME_LENGTH]; |
160 | 250 | ||
161 | /* the authoritative dns zone */ | 251 | /** |
252 | * the authoritative dns zone | ||
253 | */ | ||
162 | char dns_zone[MAX_DNS_NAME_LENGTH]; | 254 | char dns_zone[MAX_DNS_NAME_LENGTH]; |
163 | 255 | ||
164 | /* the address of the DNS server FIXME not needed? */ | 256 | /** |
257 | * the address of the DNS server FIXME not needed? | ||
258 | */ | ||
165 | struct sockaddr_in dns_addr; | 259 | struct sockaddr_in dns_addr; |
166 | 260 | ||
167 | /* handle to the local stub resolver request */ | 261 | /** |
262 | * handle to the local stub resolver request | ||
263 | */ | ||
168 | struct GNUNET_RESOLVER_RequestHandle *dns_resolver_handle; | 264 | struct GNUNET_RESOLVER_RequestHandle *dns_resolver_handle; |
169 | 265 | ||
170 | /* select task for DNS */ | 266 | /** |
267 | * select task for DNS | ||
268 | */ | ||
171 | GNUNET_SCHEDULER_TaskIdentifier dns_read_task; | 269 | GNUNET_SCHEDULER_TaskIdentifier dns_read_task; |
172 | 270 | ||
173 | /* pointer to raw dns query payload FIXME needs to be freed/NULL */ | 271 | /** |
272 | * pointer to raw dns query payload FIXME needs to be freed/NULL | ||
273 | */ | ||
174 | char *dns_raw_packet; | 274 | char *dns_raw_packet; |
175 | 275 | ||
176 | /* size of the raw dns query */ | 276 | /** |
277 | * size of the raw dns query | ||
278 | */ | ||
177 | size_t dns_raw_packet_size; | 279 | size_t dns_raw_packet_size; |
178 | 280 | ||
179 | /* timeout task for the lookup */ | 281 | /** |
282 | * timeout task for the lookup | ||
283 | */ | ||
180 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; | 284 | GNUNET_SCHEDULER_TaskIdentifier timeout_task; |
181 | 285 | ||
182 | /* continuation to call on timeout */ | 286 | /** |
287 | * continuation to call on timeout | ||
288 | */ | ||
183 | GNUNET_SCHEDULER_Task timeout_cont; | 289 | GNUNET_SCHEDULER_Task timeout_cont; |
184 | 290 | ||
185 | /* closure for timeout cont */ | 291 | /** |
292 | * closure for timeout cont | ||
293 | */ | ||
186 | void* timeout_cont_cls; | 294 | void* timeout_cont_cls; |
187 | 295 | ||
188 | /* called when resolution phase finishes */ | 296 | /** |
297 | * called when resolution phase finishes | ||
298 | */ | ||
189 | ResolutionResultProcessor proc; | 299 | ResolutionResultProcessor proc; |
190 | 300 | ||
191 | /* closure passed to proc */ | 301 | /** |
302 | * closure passed to proc | ||
303 | */ | ||
192 | void* proc_cls; | 304 | void* proc_cls; |
193 | 305 | ||
194 | /* DLL to store the authority chain */ | 306 | /** |
307 | * DLL to store the authority chain | ||
308 | */ | ||
195 | struct AuthorityChain *authority_chain_head; | 309 | struct AuthorityChain *authority_chain_head; |
196 | 310 | ||
197 | /* DLL to store the authority chain */ | 311 | /** |
312 | * DLL to store the authority chain | ||
313 | */ | ||
198 | struct AuthorityChain *authority_chain_tail; | 314 | struct AuthorityChain *authority_chain_tail; |
199 | 315 | ||
200 | /* status of the resolution result */ | 316 | /** |
317 | * status of the resolution result | ||
318 | */ | ||
201 | enum ResolutionStatus status; | 319 | enum ResolutionStatus status; |
202 | 320 | ||
203 | /* The provate local zone of this request */ | 321 | /** |
322 | * The provate local zone of this request | ||
323 | */ | ||
204 | struct GNUNET_CRYPTO_ShortHashCode private_local_zone; | 324 | struct GNUNET_CRYPTO_ShortHashCode private_local_zone; |
205 | 325 | ||
206 | /** | 326 | /** |
@@ -233,16 +353,24 @@ struct ResolverHandle | |||
233 | */ | 353 | */ |
234 | struct RecordLookupHandle | 354 | struct RecordLookupHandle |
235 | { | 355 | { |
236 | /* the record type to look up */ | 356 | /** |
357 | * the record type to look up | ||
358 | */ | ||
237 | enum GNUNET_GNS_RecordType record_type; | 359 | enum GNUNET_GNS_RecordType record_type; |
238 | 360 | ||
239 | /* the name to look up */ | 361 | /** |
362 | * the name to look up | ||
363 | */ | ||
240 | char name[MAX_DNS_NAME_LENGTH]; | 364 | char name[MAX_DNS_NAME_LENGTH]; |
241 | 365 | ||
242 | /* Method to call on record resolution result */ | 366 | /** |
367 | * Method to call on record resolution result | ||
368 | */ | ||
243 | RecordLookupProcessor proc; | 369 | RecordLookupProcessor proc; |
244 | 370 | ||
245 | /* closure to pass to proc */ | 371 | /** |
372 | * closure to pass to proc | ||
373 | */ | ||
246 | void* proc_cls; | 374 | void* proc_cls; |
247 | 375 | ||
248 | }; | 376 | }; |
@@ -253,98 +381,150 @@ struct RecordLookupHandle | |||
253 | */ | 381 | */ |
254 | struct NameShortenHandle | 382 | struct NameShortenHandle |
255 | { | 383 | { |
256 | /* Method to call on shorten result */ | 384 | /** |
385 | * Method to call on shorten result | ||
386 | */ | ||
257 | ShortenResultProcessor proc; | 387 | ShortenResultProcessor proc; |
258 | 388 | ||
259 | /* closure to pass to proc */ | 389 | /** |
390 | * closure to pass to proc | ||
391 | */ | ||
260 | void* proc_cls; | 392 | void* proc_cls; |
261 | 393 | ||
262 | /* result of shorten */ | 394 | /** |
395 | * result of shorten | ||
396 | */ | ||
263 | char result[MAX_DNS_NAME_LENGTH]; | 397 | char result[MAX_DNS_NAME_LENGTH]; |
264 | 398 | ||
265 | /* root zone */ | 399 | /** |
400 | * root zone | ||
401 | */ | ||
266 | struct GNUNET_CRYPTO_ShortHashCode *root_zone; | 402 | struct GNUNET_CRYPTO_ShortHashCode *root_zone; |
267 | 403 | ||
268 | /* private zone */ | 404 | /** |
405 | * private zone | ||
406 | */ | ||
269 | struct GNUNET_CRYPTO_ShortHashCode *private_zone; | 407 | struct GNUNET_CRYPTO_ShortHashCode *private_zone; |
270 | 408 | ||
271 | /* name of private zone */ | 409 | /** |
410 | * name of private zone | ||
411 | */ | ||
272 | char private_zone_name[MAX_DNS_LABEL_LENGTH]; | 412 | char private_zone_name[MAX_DNS_LABEL_LENGTH]; |
273 | 413 | ||
274 | /* shorten zone */ | 414 | /** |
415 | * shorten zone | ||
416 | */ | ||
275 | struct GNUNET_CRYPTO_ShortHashCode *shorten_zone; | 417 | struct GNUNET_CRYPTO_ShortHashCode *shorten_zone; |
276 | 418 | ||
277 | /* name of shorten zone */ | 419 | /** |
420 | * name of shorten zone | ||
421 | */ | ||
278 | char shorten_zone_name[MAX_DNS_LABEL_LENGTH]; | 422 | char shorten_zone_name[MAX_DNS_LABEL_LENGTH]; |
279 | 423 | ||
280 | }; | 424 | }; |
281 | 425 | ||
426 | |||
282 | /** | 427 | /** |
283 | * Handle to a get authority context | 428 | * Handle to a get authority context |
284 | */ | 429 | */ |
285 | struct GetNameAuthorityHandle | 430 | struct GetNameAuthorityHandle |
286 | { | 431 | { |
287 | /* the name to look up authority for */ | 432 | /** |
433 | * the name to look up authority for | ||
434 | */ | ||
288 | char name[MAX_DNS_NAME_LENGTH]; | 435 | char name[MAX_DNS_NAME_LENGTH]; |
289 | 436 | ||
290 | /* the result */ | 437 | /** |
438 | * the result | ||
439 | */ | ||
291 | char result[MAX_DNS_NAME_LENGTH]; | 440 | char result[MAX_DNS_NAME_LENGTH]; |
292 | 441 | ||
293 | /* Method to call on result */ | 442 | /** |
443 | * Method to call on result | ||
444 | */ | ||
294 | GetAuthorityResultProcessor proc; | 445 | GetAuthorityResultProcessor proc; |
295 | 446 | ||
296 | /* closure to pass to proc */ | 447 | /** |
448 | * closure to pass to proc | ||
449 | */ | ||
297 | void* proc_cls; | 450 | void* proc_cls; |
298 | }; | 451 | }; |
299 | 452 | ||
453 | |||
300 | /** | 454 | /** |
301 | * Handle to a pseu lookup | 455 | * Handle to a pseu lookup |
302 | */ | 456 | */ |
303 | struct GetPseuAuthorityHandle | 457 | struct GetPseuAuthorityHandle |
304 | { | 458 | { |
305 | /* DLL */ | 459 | /** |
460 | * DLL | ||
461 | */ | ||
306 | struct GetPseuAuthorityHandle *next; | 462 | struct GetPseuAuthorityHandle *next; |
307 | 463 | ||
308 | /* DLL */ | 464 | /** |
465 | * DLL | ||
466 | */ | ||
309 | struct GetPseuAuthorityHandle *prev; | 467 | struct GetPseuAuthorityHandle *prev; |
310 | 468 | ||
311 | /* the name to store the zone under */ | 469 | /** |
470 | * the name to store the zone under | ||
471 | */ | ||
312 | char name[MAX_DNS_LABEL_LENGTH]; | 472 | char name[MAX_DNS_LABEL_LENGTH]; |
313 | 473 | ||
314 | /* test name to store the zone under */ | 474 | /** |
475 | * test name to store the zone under | ||
476 | */ | ||
315 | char test_name[MAX_DNS_LABEL_LENGTH]; | 477 | char test_name[MAX_DNS_LABEL_LENGTH]; |
316 | 478 | ||
317 | /* the zone of our authority */ | 479 | /** |
480 | * the zone of our authority | ||
481 | */ | ||
318 | struct GNUNET_CRYPTO_ShortHashCode our_zone; | 482 | struct GNUNET_CRYPTO_ShortHashCode our_zone; |
319 | 483 | ||
320 | /* the private key of the zone to store the pseu in */ | 484 | /** |
485 | * the private key of the zone to store the pseu in | ||
486 | */ | ||
321 | struct GNUNET_CRYPTO_RsaPrivateKey *key; | 487 | struct GNUNET_CRYPTO_RsaPrivateKey *key; |
322 | 488 | ||
323 | /* a handle for dht lookups. should be NULL if no lookups are in progress */ | 489 | /** |
490 | * a handle for dht lookups. should be NULL if no lookups are in progress | ||
491 | */ | ||
324 | struct GNUNET_DHT_GetHandle *get_handle; | 492 | struct GNUNET_DHT_GetHandle *get_handle; |
325 | 493 | ||
326 | /* timeout task for lookup */ | 494 | /** |
495 | * timeout task for lookup | ||
496 | */ | ||
327 | GNUNET_SCHEDULER_TaskIdentifier timeout; | 497 | GNUNET_SCHEDULER_TaskIdentifier timeout; |
328 | 498 | ||
329 | /* Authority to shorten */ | 499 | /** |
500 | * Authority to shorten | ||
501 | */ | ||
330 | struct AuthorityChain *auth; | 502 | struct AuthorityChain *auth; |
331 | 503 | ||
332 | /* handle to namestore request */ | 504 | /** |
505 | * handle to namestore request | ||
506 | */ | ||
333 | struct GNUNET_NAMESTORE_QueueEntry* namestore_task; | 507 | struct GNUNET_NAMESTORE_QueueEntry* namestore_task; |
334 | }; | 508 | }; |
335 | 509 | ||
510 | |||
336 | /** | 511 | /** |
337 | * Namestore queue entries in background | 512 | * Namestore queue entries in background |
338 | */ | 513 | */ |
339 | struct NamestoreBGTask | 514 | struct NamestoreBGTask |
340 | { | 515 | { |
341 | /* node in heap */ | 516 | /** |
517 | * node in heap | ||
518 | */ | ||
342 | struct GNUNET_CONTAINER_HeapNode *node; | 519 | struct GNUNET_CONTAINER_HeapNode *node; |
343 | 520 | ||
344 | /* queue entry */ | 521 | /** |
522 | * queue entry | ||
523 | */ | ||
345 | struct GNUNET_NAMESTORE_QueueEntry *qe; | 524 | struct GNUNET_NAMESTORE_QueueEntry *qe; |
346 | }; | 525 | }; |
347 | 526 | ||
527 | |||
348 | /** | 528 | /** |
349 | * Initialize the resolver | 529 | * Initialize the resolver |
350 | * MUST be called before other gns_resolver_* methods | 530 | * MUST be called before other gns_resolver_* methods |
@@ -359,18 +539,20 @@ struct NamestoreBGTask | |||
359 | * @returns GNUNET_OK on success | 539 | * @returns GNUNET_OK on success |
360 | */ | 540 | */ |
361 | int | 541 | int |
362 | gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, | 542 | gns_resolver_init (struct GNUNET_NAMESTORE_Handle *nh, |
363 | struct GNUNET_DHT_Handle *dh, | 543 | struct GNUNET_DHT_Handle *dh, |
364 | struct GNUNET_CRYPTO_ShortHashCode lz, | 544 | struct GNUNET_CRYPTO_ShortHashCode lz, |
365 | const struct GNUNET_CONFIGURATION_Handle *c, | 545 | const struct GNUNET_CONFIGURATION_Handle *c, |
366 | unsigned long long max_bg_queries, | 546 | unsigned long long max_bg_queries, |
367 | int ignore_pending); | 547 | int ignore_pending); |
548 | |||
368 | 549 | ||
369 | /** | 550 | /** |
370 | * Cleanup resolver: Terminate pending lookups | 551 | * Cleanup resolver: Terminate pending lookups |
371 | */ | 552 | */ |
372 | void | 553 | void |
373 | gns_resolver_cleanup(void); | 554 | gns_resolver_cleanup (void); |
555 | |||
374 | 556 | ||
375 | /** | 557 | /** |
376 | * Lookup of a record in a specific zone | 558 | * Lookup of a record in a specific zone |
@@ -387,15 +569,16 @@ gns_resolver_cleanup(void); | |||
387 | * @param cls the closure to pass to proc | 569 | * @param cls the closure to pass to proc |
388 | */ | 570 | */ |
389 | void | 571 | void |
390 | gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | 572 | gns_resolver_lookup_record (struct GNUNET_CRYPTO_ShortHashCode zone, |
391 | struct GNUNET_CRYPTO_ShortHashCode pzone, | 573 | struct GNUNET_CRYPTO_ShortHashCode pzone, |
392 | uint32_t record_type, | 574 | uint32_t record_type, |
393 | const char* name, | 575 | const char* name, |
394 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 576 | struct GNUNET_CRYPTO_RsaPrivateKey *key, |
395 | struct GNUNET_TIME_Relative timeout, | 577 | struct GNUNET_TIME_Relative timeout, |
396 | int only_cached, | 578 | int only_cached, |
397 | RecordLookupProcessor proc, | 579 | RecordLookupProcessor proc, |
398 | void* cls); | 580 | void* cls); |
581 | |||
399 | 582 | ||
400 | /** | 583 | /** |
401 | * Shortens a name if possible. If the shortening fails | 584 | * Shortens a name if possible. If the shortening fails |
@@ -414,14 +597,15 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
414 | * @param proc_cls the closure to pass to proc | 597 | * @param proc_cls the closure to pass to proc |
415 | */ | 598 | */ |
416 | void | 599 | void |
417 | gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode *zone, | 600 | gns_resolver_shorten_name (struct GNUNET_CRYPTO_ShortHashCode *zone, |
418 | struct GNUNET_CRYPTO_ShortHashCode *pzone, | 601 | struct GNUNET_CRYPTO_ShortHashCode *pzone, |
419 | struct GNUNET_CRYPTO_ShortHashCode *szone, | 602 | struct GNUNET_CRYPTO_ShortHashCode *szone, |
420 | const char* name, | 603 | const char* name, |
421 | const char* private_zone_name, | 604 | const char* private_zone_name, |
422 | const char* shorten_zone_name, | 605 | const char* shorten_zone_name, |
423 | ShortenResultProcessor proc, | 606 | ShortenResultProcessor proc, |
424 | void* proc_cls); | 607 | void* proc_cls); |
608 | |||
425 | 609 | ||
426 | /** | 610 | /** |
427 | * Tries to resolve the authority for name | 611 | * Tries to resolve the authority for name |
@@ -434,11 +618,11 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode *zone, | |||
434 | * @param proc_cls the closure to pass to the processor | 618 | * @param proc_cls the closure to pass to the processor |
435 | */ | 619 | */ |
436 | void | 620 | void |
437 | gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, | 621 | gns_resolver_get_authority (struct GNUNET_CRYPTO_ShortHashCode zone, |
438 | struct GNUNET_CRYPTO_ShortHashCode pzone, | 622 | struct GNUNET_CRYPTO_ShortHashCode pzone, |
439 | const char* name, | 623 | const char* name, |
440 | GetAuthorityResultProcessor proc, | 624 | GetAuthorityResultProcessor proc, |
441 | void* proc_cls); | 625 | void* proc_cls); |
442 | 626 | ||
443 | /** | 627 | /** |
444 | * Generic function to check for TLDs | 628 | * Generic function to check for TLDs |
@@ -448,7 +632,9 @@ gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
448 | * @return GNUNET_YES or GNUNET_NO | 632 | * @return GNUNET_YES or GNUNET_NO |
449 | */ | 633 | */ |
450 | int | 634 | int |
451 | is_tld(const char* name, const char* tld); | 635 | is_tld (const char* name, |
636 | const char* tld); | ||
637 | |||
452 | 638 | ||
453 | /** | 639 | /** |
454 | * Checks for gnunet/zkey | 640 | * Checks for gnunet/zkey |