aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-09-18 12:41:26 +0000
committerChristian Grothoff <christian@grothoff.org>2012-09-18 12:41:26 +0000
commit6dfad0abb0bb9c07741b10e679ee6db67b0d1f67 (patch)
tree2cc3851c54f1dd24adb398a8f0aa9e3c6c1f4e92
parent8c106e966096e1c671b1bab4d05bd672ae5f4ea5 (diff)
downloadgnunet-6dfad0abb0bb9c07741b10e679ee6db67b0d1f67.tar.gz
gnunet-6dfad0abb0bb9c07741b10e679ee6db67b0d1f67.zip
-peer review
-rw-r--r--src/gns/gns.h28
-rw-r--r--src/gns/gns_api.c408
-rw-r--r--src/gns/gnunet-service-gns.c12
3 files changed, 189 insertions, 259 deletions
diff --git a/src/gns/gns.h b/src/gns/gns.h
index 1dbb8b8f3..2f4ce3928 100644
--- a/src/gns/gns.h
+++ b/src/gns/gns.h
@@ -17,9 +17,6 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19 */ 19 */
20
21#include "gnunet_gns_service.h"
22
23/** 20/**
24 * @file gns/gns.h 21 * @file gns/gns.h
25 * @brief IPC messages between GNS API and GNS service 22 * @brief IPC messages between GNS API and GNS service
@@ -28,6 +25,8 @@
28#ifndef GNS_H 25#ifndef GNS_H
29#define GNS_H 26#define GNS_H
30 27
28#include "gnunet_gns_service.h"
29
31#define GNUNET_GNS_TLD "gads" 30#define GNUNET_GNS_TLD "gads"
32#define GNUNET_GNS_TLD_ZKEY "zkey" 31#define GNUNET_GNS_TLD_ZKEY "zkey"
33#define GNUNET_GNS_TLD_PLUS "+" 32#define GNUNET_GNS_TLD_PLUS "+"
@@ -54,6 +53,11 @@ struct GNUNET_GNS_ClientLookupMessage
54 uint32_t id GNUNET_PACKED; 53 uint32_t id GNUNET_PACKED;
55 54
56 /** 55 /**
56 * If use_default_zone is empty this zone is used for lookup
57 */
58 struct GNUNET_CRYPTO_ShortHashCode zone;
59
60 /**
57 * Only check cached results 61 * Only check cached results
58 */ 62 */
59 uint32_t only_cached GNUNET_PACKED; 63 uint32_t only_cached GNUNET_PACKED;
@@ -69,14 +73,9 @@ struct GNUNET_GNS_ClientLookupMessage
69 uint32_t have_key GNUNET_PACKED; 73 uint32_t have_key GNUNET_PACKED;
70 74
71 /** 75 /**
72 * If use_default_zone is empty this zone is used for lookup
73 */
74 struct GNUNET_CRYPTO_ShortHashCode zone;
75
76 /**
77 * the type of record to look up 76 * the type of record to look up
78 */ 77 */
79 enum GNUNET_GNS_RecordType type; 78 /* enum GNUNET_GNS_RecordType */ uint32_t type;
80 79
81 /* Followed by the key for shorten (optional) see have_key */ 80 /* Followed by the key for shorten (optional) see have_key */
82 81
@@ -104,7 +103,6 @@ struct GNUNET_GNS_ClientLookupResultMessage
104 */ 103 */
105 uint32_t rd_count; 104 uint32_t rd_count;
106 105
107 // FIXME: what format has a GNS_Record?
108 /* followed by rd_count GNUNET_NAMESTORE_RecordData structs*/ 106 /* followed by rd_count GNUNET_NAMESTORE_RecordData structs*/
109 107
110}; 108};
@@ -125,11 +123,6 @@ struct GNUNET_GNS_ClientShortenMessage
125 uint32_t id GNUNET_PACKED; 123 uint32_t id GNUNET_PACKED;
126 124
127 /** 125 /**
128 * Should we look up in the default zone?
129 */
130 uint32_t use_default_zone GNUNET_PACKED;
131
132 /**
133 * If use_default_zone is empty this zone is used for lookup 126 * If use_default_zone is empty this zone is used for lookup
134 */ 127 */
135 struct GNUNET_CRYPTO_ShortHashCode zone; 128 struct GNUNET_CRYPTO_ShortHashCode zone;
@@ -143,6 +136,11 @@ struct GNUNET_GNS_ClientShortenMessage
143 * Private zone 136 * Private zone
144 */ 137 */
145 struct GNUNET_CRYPTO_ShortHashCode private_zone; 138 struct GNUNET_CRYPTO_ShortHashCode private_zone;
139
140 /**
141 * Should we look up in the default zone?
142 */
143 uint32_t use_default_zone GNUNET_PACKED;
146 144
147 /* Followed by the name to shorten up */ 145 /* Followed by the name to shorten up */
148}; 146};
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 0a91afc06..ddc871409 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2010, 2012 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 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 6 it under the terms of the GNU General Public License as published
@@ -17,14 +17,12 @@
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20
21/** 20/**
22 *
23 * @file gns/gns_api.c 21 * @file gns/gns_api.c
24 * @brief library to access the GNS service 22 * @brief library to access the GNS service
25 * @author Martin Schanzenbach 23 * @author Martin Schanzenbach
24 * @author Christian Grothoff
26 */ 25 */
27
28#include "platform.h" 26#include "platform.h"
29#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
30#include "gnunet_constants.h" 28#include "gnunet_constants.h"
@@ -35,19 +33,13 @@
35#include "gns.h" 33#include "gns.h"
36#include "gnunet_gns_service.h" 34#include "gnunet_gns_service.h"
37 35
38/* TODO into gnunet_protocols */
39#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP 23
40#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT 24
41#define GNUNET_MESSAGE_TYPE_GNS_SHORTEN 25
42#define GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT 26
43#define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH 27
44#define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT 28
45 36
46/** 37/**
47 * Handle to a lookup request 38 * Handle to a lookup request
48 */ 39 */
49struct GNUNET_GNS_LookupRequest 40struct GNUNET_GNS_LookupRequest
50{ 41{
42
51 /** 43 /**
52 * DLL 44 * DLL
53 */ 45 */
@@ -57,19 +49,27 @@ struct GNUNET_GNS_LookupRequest
57 * DLL 49 * DLL
58 */ 50 */
59 struct GNUNET_GNS_LookupRequest *prev; 51 struct GNUNET_GNS_LookupRequest *prev;
60
61 /* request id */
62 uint64_t r_id;
63 52
64 /* handle to gns */ 53 /**
54 * handle to gns
55 */
65 struct GNUNET_GNS_Handle *gns_handle; 56 struct GNUNET_GNS_Handle *gns_handle;
66 57
67 /* processor to call on lookup result */ 58 /**
59 * processor to call on lookup result
60 */
68 GNUNET_GNS_LookupResultProcessor lookup_proc; 61 GNUNET_GNS_LookupResultProcessor lookup_proc;
69 62
70 /* processor closure */ 63 /**
64 * processor closure
65 */
71 void *proc_cls; 66 void *proc_cls;
72 67
68 /**
69 * request id
70 */
71 uint64_t r_id;
72
73}; 73};
74 74
75 75
@@ -88,9 +88,6 @@ struct GNUNET_GNS_ShortenRequest
88 */ 88 */
89 struct GNUNET_GNS_ShortenRequest *prev; 89 struct GNUNET_GNS_ShortenRequest *prev;
90 90
91 /* request id */
92 uint64_t r_id;
93
94 /* handle to gns */ 91 /* handle to gns */
95 struct GNUNET_GNS_Handle *gns_handle; 92 struct GNUNET_GNS_Handle *gns_handle;
96 93
@@ -99,6 +96,10 @@ struct GNUNET_GNS_ShortenRequest
99 96
100 /* processor closure */ 97 /* processor closure */
101 void *proc_cls; 98 void *proc_cls;
99
100 /* request id */
101 uint64_t r_id;
102
102 103
103}; 104};
104 105
@@ -118,9 +119,6 @@ struct GNUNET_GNS_GetAuthRequest
118 */ 119 */
119 struct GNUNET_GNS_GetAuthRequest *prev; 120 struct GNUNET_GNS_GetAuthRequest *prev;
120 121
121 /* request id */
122 uint32_t r_id;
123
124 /* handle to gns */ 122 /* handle to gns */
125 struct GNUNET_GNS_Handle *gns_handle; 123 struct GNUNET_GNS_Handle *gns_handle;
126 124
@@ -130,6 +128,9 @@ struct GNUNET_GNS_GetAuthRequest
130 /* processor closure */ 128 /* processor closure */
131 void *proc_cls; 129 void *proc_cls;
132 130
131 /* request id */
132 uint32_t r_id;
133
133}; 134};
134 135
135 136
@@ -182,8 +183,6 @@ struct GNUNET_GNS_Handle
182 */ 183 */
183 struct GNUNET_CLIENT_TransmitHandle *th; 184 struct GNUNET_CLIENT_TransmitHandle *th;
184 185
185 uint32_t r_id;
186
187 /** 186 /**
188 * Head of linked list of shorten messages we would like to transmit. 187 * Head of linked list of shorten messages we would like to transmit.
189 */ 188 */
@@ -229,17 +228,16 @@ struct GNUNET_GNS_Handle
229 */ 228 */
230 GNUNET_SCHEDULER_TaskIdentifier reconnect_task; 229 GNUNET_SCHEDULER_TaskIdentifier reconnect_task;
231 230
231 uint32_t r_id;
232
232 /** 233 /**
233 * Did we start our receive loop yet? 234 * Did we start our receive loop yet?
234 */ 235 */
235 int in_receive; 236 int in_receive;
236 237
237 /**
238 * Reconnect necessary
239 */
240 int reconnect;
241}; 238};
242 239
240
243/** 241/**
244 * Try to send messages from list of messages to send 242 * Try to send messages from list of messages to send
245 * @param handle GNS_Handle 243 * @param handle GNS_Handle
@@ -251,19 +249,20 @@ process_pending_messages (struct GNUNET_GNS_Handle *handle);
251/** 249/**
252 * Reconnect to GNS service. 250 * Reconnect to GNS service.
253 * 251 *
254 * @param h the handle to the namestore service 252 * @param h the handle to the GNS service
255 */ 253 */
256static void 254static void
257reconnect (struct GNUNET_GNS_Handle *h) 255reconnect (struct GNUNET_GNS_Handle *h)
258{ 256{
259 GNUNET_assert (NULL == h->client); 257 GNUNET_assert (NULL == h->client);
260 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 258 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
261 "Trying to connect to GNS...\n"); 259 "Trying to connect to GNS\n");
262 h->client = GNUNET_CLIENT_connect ("gns", h->cfg); 260 h->client = GNUNET_CLIENT_connect ("gns", h->cfg);
263 GNUNET_assert (NULL != h->client); 261 GNUNET_assert (NULL != h->client);
264 process_pending_messages (h); 262 process_pending_messages (h);
265} 263}
266 264
265
267/** 266/**
268 * Reconnect to GNS 267 * Reconnect to GNS
269 * 268 *
@@ -288,20 +287,25 @@ reconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
288static void 287static void
289force_reconnect (struct GNUNET_GNS_Handle *h) 288force_reconnect (struct GNUNET_GNS_Handle *h)
290{ 289{
291 h->reconnect = GNUNET_NO;
292 GNUNET_CLIENT_disconnect (h->client); 290 GNUNET_CLIENT_disconnect (h->client);
293 h->client = NULL; 291 h->client = NULL;
292 h->in_receive = GNUNET_NO;
293 /* FIXME: 1s too long, exponential-backoff, starting at 1ms! (max = 1s might be OK) */
294 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 294 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
295 &reconnect_task, 295 &reconnect_task,
296 h); 296 h);
297} 297}
298 298
299
299/** 300/**
300 * Transmit the next pending message, called by notify_transmit_ready 301 * Transmit the next pending message, called by notify_transmit_ready
302 *
303 * @param fixme
301 */ 304 */
302static size_t 305static size_t
303transmit_pending (void *cls, size_t size, void *buf); 306transmit_pending (void *cls, size_t size, void *buf);
304 307
308
305/** 309/**
306 * Handler for messages received from the GNS service 310 * Handler for messages received from the GNS service
307 * 311 *
@@ -311,71 +315,61 @@ transmit_pending (void *cls, size_t size, void *buf);
311static void 315static void
312process_message (void *cls, const struct GNUNET_MessageHeader *msg); 316process_message (void *cls, const struct GNUNET_MessageHeader *msg);
313 317
318
314/** 319/**
315 * Try to send messages from list of messages to send 320 * Try to send messages from list of messages to send
321 *
322 * @param fixme
316 */ 323 */
317static void 324static void
318process_pending_messages (struct GNUNET_GNS_Handle *handle) 325process_pending_messages (struct GNUNET_GNS_Handle *handle)
319{ 326{
320 struct PendingMessage *p; 327 struct PendingMessage *p;
321 328
322 if (handle->client == NULL) 329 if (NULL == handle->client)
323 { 330 return; /* wait for reconnect */
324 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 331 if (NULL != handle->th)
325 "process_pending_messages called, but client is null\n"); 332 return; /* transmission request already pending */
326 return;
327 }
328
329 if (handle->th != NULL)
330 return;
331
332 if (NULL == (p = handle->pending_head)) 333 if (NULL == (p = handle->pending_head))
333 return; 334 return; /* no messages pending */
334 335 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
335 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 336 "Trying to transmit %u bytes\n",
336 "Trying to transmit %d bytes...\n", p->size); 337 (unsigned int) p->size);
337
338 handle->th = 338 handle->th =
339 GNUNET_CLIENT_notify_transmit_ready (handle->client, 339 GNUNET_CLIENT_notify_transmit_ready (handle->client,
340 p->size, 340 p->size,
341 GNUNET_TIME_UNIT_FOREVER_REL, 341 GNUNET_TIME_UNIT_FOREVER_REL,
342 GNUNET_NO, &transmit_pending, 342 GNUNET_NO, &transmit_pending,
343 handle); 343 handle);
344 if (NULL != handle->th) 344 GNUNET_break (NULL != handle->th);
345 return;
346
347 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
348 "notify_transmit_ready returned NULL!\n");
349} 345}
350 346
351 347
352/** 348/**
353 * Transmit the next pending message, called by notify_transmit_ready 349 * Transmit the next pending message, called by notify_transmit_ready
350 *
351 * @param fixme
354 */ 352 */
355static size_t 353static size_t
356transmit_pending (void *cls, size_t size, void *buf) 354transmit_pending (void *cls, size_t size, void *buf)
357{ 355{
358 struct GNUNET_GNS_Handle *handle = cls; 356 struct GNUNET_GNS_Handle *handle = cls;
357 char *cbuf = buf;
359 struct PendingMessage *p; 358 struct PendingMessage *p;
360 size_t tsize; 359 size_t tsize;
361 char *cbuf;
362 360
363 handle->th = NULL; 361 handle->th = NULL;
364 362 if ((0 == size) || (NULL == buf))
365 if ((size == 0) || (buf == NULL))
366 { 363 {
367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 364 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
368 "Transmission to GNS service failed!\n"); 365 "Transmission to GNS service failed!\n");
369 force_reconnect(handle); 366 force_reconnect(handle);
370 return 0; 367 return 0;
371 } 368 }
372
373 tsize = 0;
374 cbuf = buf;
375
376 if (NULL == (p = handle->pending_head)) 369 if (NULL == (p = handle->pending_head))
377 return 0; 370 return 0;
378 371
372 tsize = 0;
379 while ((NULL != (p = handle->pending_head)) && (p->size <= size)) 373 while ((NULL != (p = handle->pending_head)) && (p->size <= size))
380 { 374 {
381 memcpy (&cbuf[tsize], &p[1], p->size); 375 memcpy (&cbuf[tsize], &p[1], p->size);
@@ -388,16 +382,16 @@ transmit_pending (void *cls, size_t size, void *buf)
388 GNUNET_TIME_UNIT_FOREVER_REL); 382 GNUNET_TIME_UNIT_FOREVER_REL);
389 handle->in_receive = GNUNET_YES; 383 handle->in_receive = GNUNET_YES;
390 } 384 }
391 GNUNET_free(p); 385 GNUNET_free (p);
392 } 386 }
393
394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 387 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
395 "Sending %d bytes\n", tsize); 388 "Sending %u bytes\n",
396 389 (unsigned int) tsize);
397 process_pending_messages(handle); 390 process_pending_messages (handle);
398 return tsize; 391 return tsize;
399} 392}
400 393
394
401/** 395/**
402 * Process a given reply that might match the given 396 * Process a given reply that might match the given
403 * request. 397 * request.
@@ -411,28 +405,27 @@ process_shorten_reply (struct GNUNET_GNS_ShortenRequest *qe,
411{ 405{
412 struct GNUNET_GNS_Handle *h = qe->gns_handle; 406 struct GNUNET_GNS_Handle *h = qe->gns_handle;
413 const char *short_name; 407 const char *short_name;
408 size_t mlen;
414 409
415 GNUNET_CONTAINER_DLL_remove (h->shorten_head, h->shorten_tail, qe); 410 GNUNET_CONTAINER_DLL_remove (h->shorten_head, h->shorten_tail, qe);
416 short_name = (char*)(&msg[1]); 411 mlen = ntohs (msg->header.size);
412 short_name = (const char *) &msg[1];
417 413
418 if (ntohs (((struct GNUNET_MessageHeader*)msg)->size) < 414 if ( (ntohs (msg->header.size) <= sizeof (struct GNUNET_GNS_ClientShortenResultMessage)) ||
419 sizeof (struct GNUNET_GNS_ClientShortenResultMessage)) 415 ('\0' != short_name[mlen - sizeof (struct GNUNET_GNS_ClientShortenResultMessage) - 1]) )
420 { 416 {
421 GNUNET_break (0); 417 GNUNET_break (0);
418 // FIXME: reconnect and queue management logic is broken...
419 qe->shorten_proc (qe->proc_cls, NULL);
420 GNUNET_free (qe);
422 force_reconnect (h); 421 force_reconnect (h);
423 GNUNET_free(qe);
424 return; 422 return;
425 } 423 }
426
427 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 424 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
428 "Received shortened reply `%s' from GNS service\n", 425 "Received shortened reply `%s' from GNS service\n",
429 short_name); 426 short_name);
430
431 GNUNET_CLIENT_receive (h->client, &process_message, h,
432 GNUNET_TIME_UNIT_FOREVER_REL);
433 qe->shorten_proc (qe->proc_cls, short_name); 427 qe->shorten_proc (qe->proc_cls, short_name);
434 GNUNET_free (qe); 428 GNUNET_free (qe);
435
436} 429}
437 430
438 431
@@ -465,13 +458,11 @@ process_get_auth_reply (struct GNUNET_GNS_GetAuthRequest *qe,
465 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 458 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
466 "Received GET_AUTH reply `%s' from GNS service\n", 459 "Received GET_AUTH reply `%s' from GNS service\n",
467 auth_name); 460 auth_name);
468
469 GNUNET_CLIENT_receive (h->client, &process_message, h,
470 GNUNET_TIME_UNIT_FOREVER_REL);
471 qe->auth_proc (qe->proc_cls, auth_name); 461 qe->auth_proc (qe->proc_cls, auth_name);
472 GNUNET_free (qe); 462 GNUNET_free (qe);
473
474} 463}
464
465
475/** 466/**
476 * Process a given reply to the lookup request 467 * Process a given reply to the lookup request
477 * 468 *
@@ -498,8 +489,6 @@ process_lookup_reply (struct GNUNET_GNS_LookupRequest *qe,
498 } 489 }
499 490
500 len -= sizeof (struct GNUNET_GNS_ClientLookupResultMessage); 491 len -= sizeof (struct GNUNET_GNS_ClientLookupResultMessage);
501 GNUNET_CLIENT_receive (h->client, &process_message, h,
502 GNUNET_TIME_UNIT_FOREVER_REL);
503 if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (len, 492 if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (len,
504 (char*)&msg[1], 493 (char*)&msg[1],
505 rd_count, 494 rd_count,
@@ -536,104 +525,76 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg)
536 const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; 525 const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg;
537 const struct GNUNET_GNS_ClientShortenResultMessage *shorten_msg; 526 const struct GNUNET_GNS_ClientShortenResultMessage *shorten_msg;
538 const struct GNUNET_GNS_ClientGetAuthResultMessage *get_auth_msg; 527 const struct GNUNET_GNS_ClientGetAuthResultMessage *get_auth_msg;
539 uint16_t type; 528 uint64_t r_id;
540 uint32_t r_id;
541 529
542 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 530 if (NULL == msg)
543 "Got message\n");
544 if (msg == NULL)
545 { 531 {
546 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
547 "Error receiving data from GNS service, reconnecting\n");
548 force_reconnect (handle); 532 force_reconnect (handle);
549 return; 533 return;
550 } 534 }
551 535 switch (ntohs (msg->type))
552 type = ntohs (msg->type);
553
554 if (type == GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT)
555 { 536 {
537 case GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT:
556 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 538 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
557 "Got lookup msg\n"); 539 "Got LOOKUP_RESULT msg\n");
540 if (ntohs (msg->size) < sizeof (struct GNUNET_GNS_ClientLookupResultMessage))
541 {
542 GNUNET_break (0);
543 force_reconnect (handle);
544 return;
545 }
558 lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg; 546 lookup_msg = (const struct GNUNET_GNS_ClientLookupResultMessage *) msg;
559 r_id = ntohl (lookup_msg->id); 547 r_id = ntohl (lookup_msg->id);
560 548 for (lr = handle->lookup_head; NULL != lr; lr = lr->next)
561 if (r_id > handle->r_id)
562 {
563 /** no request found */
564 GNUNET_break_op (0);
565 GNUNET_CLIENT_receive (handle->client, &process_message, handle,
566 GNUNET_TIME_UNIT_FOREVER_REL);
567 return;
568 }
569
570 for (lr = handle->lookup_head; NULL != lr; lr = lr->next)
571 {
572 if (lr->r_id == r_id) 549 if (lr->r_id == r_id)
573 break; 550 {
574 } 551 process_lookup_reply(lr, lookup_msg);
575 if (lr) 552 break;
576 process_lookup_reply(lr, lookup_msg); 553 }
577 554 break;
578 return; 555 case GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT:
579
580 }
581 else if (type == GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT)
582 {
583 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 556 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
584 "Got SHORTEN_RESULT msg\n"); 557 "Got SHORTEN_RESULT msg\n");
585 shorten_msg = (struct GNUNET_GNS_ClientShortenResultMessage *) msg; 558 if (ntohs (msg->size) < sizeof (struct GNUNET_GNS_ClientShortenResultMessage))
586 559 {
560 GNUNET_break (0);
561 force_reconnect (handle);
562 return;
563 }
564 shorten_msg = (const struct GNUNET_GNS_ClientShortenResultMessage *) msg;
587 r_id = ntohl (shorten_msg->id); 565 r_id = ntohl (shorten_msg->id);
588 566 for (sr = handle->shorten_head; NULL != sr; sr = sr->next)
589 if (r_id > handle->r_id)
590 {
591 /** no request found */
592 GNUNET_break_op (0);
593 GNUNET_CLIENT_receive (handle->client, &process_message, handle,
594 GNUNET_TIME_UNIT_FOREVER_REL);
595 return;
596 }
597
598 for (sr = handle->shorten_head; NULL != sr; sr = sr->next)
599 {
600 if (sr->r_id == r_id) 567 if (sr->r_id == r_id)
601 break; 568 {
602 } 569 process_shorten_reply (sr, shorten_msg);
603 if (sr) 570 break;
604 process_shorten_reply (sr, shorten_msg); 571 }
605 return; 572 break;
606 } 573 case GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT:
607 else if (type == GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT)
608 {
609 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 574 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
610 "Got GET_AUTH_RESULT msg\n"); 575 "Got GET_AUTH_RESULT msg\n");
611 get_auth_msg = (struct GNUNET_GNS_ClientGetAuthResultMessage *) msg; 576 if (ntohs (msg->size) < sizeof (struct GNUNET_GNS_ClientGetAuthResultMessage))
612 577 {
578 GNUNET_break (0);
579 force_reconnect (handle);
580 return;
581 }
582 get_auth_msg = (const struct GNUNET_GNS_ClientGetAuthResultMessage *) msg;
613 r_id = ntohl (get_auth_msg->id); 583 r_id = ntohl (get_auth_msg->id);
614
615 if (r_id > handle->r_id)
616 {
617 /** no request found */
618 GNUNET_break_op (0);
619 GNUNET_CLIENT_receive (handle->client, &process_message, handle,
620 GNUNET_TIME_UNIT_FOREVER_REL);
621 return;
622 }
623
624 for (gar = handle->get_auth_head; NULL != gar; gar = gar->next) 584 for (gar = handle->get_auth_head; NULL != gar; gar = gar->next)
625 {
626 if (gar->r_id == r_id) 585 if (gar->r_id == r_id)
627 break; 586 {
628 } 587 process_get_auth_reply (gar, get_auth_msg);
629 if (gar) 588 break;
630 process_get_auth_reply (gar, get_auth_msg); 589 }
590 break;
591 default:
592 GNUNET_break (0);
593 force_reconnect (handle);
631 return; 594 return;
632 } 595 }
633 596 GNUNET_CLIENT_receive (handle->client, &process_message, handle,
634 597 GNUNET_TIME_UNIT_FOREVER_REL);
635 if (GNUNET_YES == handle->reconnect)
636 force_reconnect (handle);
637} 598}
638 599
639 600
@@ -649,12 +610,8 @@ GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
649 struct GNUNET_GNS_Handle *handle; 610 struct GNUNET_GNS_Handle *handle;
650 611
651 handle = GNUNET_malloc (sizeof (struct GNUNET_GNS_Handle)); 612 handle = GNUNET_malloc (sizeof (struct GNUNET_GNS_Handle));
652 handle->reconnect = GNUNET_NO;
653 handle->cfg = cfg; 613 handle->cfg = cfg;
654 reconnect (handle); 614 reconnect (handle);
655 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
656 handle->r_id = 0;
657 handle->in_receive = GNUNET_NO;
658 return handle; 615 return handle;
659} 616}
660 617
@@ -673,29 +630,13 @@ GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle)
673 GNUNET_SCHEDULER_cancel (handle->reconnect_task); 630 GNUNET_SCHEDULER_cancel (handle->reconnect_task);
674 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK; 631 handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
675 } 632 }
676
677 GNUNET_assert (NULL == handle->lookup_head); 633 GNUNET_assert (NULL == handle->lookup_head);
678 GNUNET_assert (NULL == handle->shorten_head); 634 GNUNET_assert (NULL == handle->shorten_head);
679 GNUNET_assert (NULL == handle->get_auth_head); 635 GNUNET_assert (NULL == handle->get_auth_head);
680
681 GNUNET_free(handle); 636 GNUNET_free(handle);
682 /* disco from GNS */ 637 /* disco from GNS */
683} 638}
684 639
685/*
686 * Helper function to generate request ids
687 *
688 * @param h handle
689 * @return a new id
690 */
691static uint32_t
692get_request_id (struct GNUNET_GNS_Handle *h)
693{
694 uint32_t r_id = h->r_id;
695 h->r_id++;
696 return r_id;
697}
698
699 640
700/** 641/**
701 * Cancel pending lookup request 642 * Cancel pending lookup request
@@ -706,8 +647,8 @@ void
706GNUNET_GNS_cancel_lookup_request (struct GNUNET_GNS_LookupRequest *lr) 647GNUNET_GNS_cancel_lookup_request (struct GNUNET_GNS_LookupRequest *lr)
707{ 648{
708 struct PendingMessage *tmp; 649 struct PendingMessage *tmp;
709 GNUNET_assert (NULL != lr->gns_handle); 650
710 651 GNUNET_assert (NULL != lr->gns_handle);
711 for (tmp = lr->gns_handle->pending_head; 652 for (tmp = lr->gns_handle->pending_head;
712 NULL != tmp; tmp = tmp->next) 653 NULL != tmp; tmp = tmp->next)
713 { 654 {
@@ -740,8 +681,8 @@ void
740GNUNET_GNS_cancel_shorten_request (struct GNUNET_GNS_ShortenRequest *sr) 681GNUNET_GNS_cancel_shorten_request (struct GNUNET_GNS_ShortenRequest *sr)
741{ 682{
742 struct PendingMessage *tmp; 683 struct PendingMessage *tmp;
684
743 GNUNET_assert (NULL != sr->gns_handle); 685 GNUNET_assert (NULL != sr->gns_handle);
744
745 for (tmp = sr->gns_handle->pending_head; 686 for (tmp = sr->gns_handle->pending_head;
746 NULL != tmp; tmp = tmp->next) 687 NULL != tmp; tmp = tmp->next)
747 { 688 {
@@ -774,8 +715,8 @@ void
774GNUNET_GNS_cancel_get_auth_request (struct GNUNET_GNS_GetAuthRequest *gar) 715GNUNET_GNS_cancel_get_auth_request (struct GNUNET_GNS_GetAuthRequest *gar)
775{ 716{
776 struct PendingMessage *tmp; 717 struct PendingMessage *tmp;
777 GNUNET_assert (NULL != gar->gns_handle); 718
778 719 GNUNET_assert (NULL != gar->gns_handle);
779 for (tmp = gar->gns_handle->pending_head; 720 for (tmp = gar->gns_handle->pending_head;
780 NULL != tmp; tmp = tmp->next) 721 NULL != tmp; tmp = tmp->next)
781 { 722 {
@@ -798,6 +739,7 @@ GNUNET_GNS_cancel_get_auth_request (struct GNUNET_GNS_GetAuthRequest *gar)
798 GNUNET_free (gar); 739 GNUNET_free (gar);
799} 740}
800 741
742
801/** 743/**
802 * Perform an asynchronous Lookup operation on the GNS. 744 * Perform an asynchronous Lookup operation on the GNS.
803 * 745 *
@@ -826,12 +768,13 @@ GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle,
826 struct GNUNET_GNS_LookupRequest *lr; 768 struct GNUNET_GNS_LookupRequest *lr;
827 size_t msize; 769 size_t msize;
828 struct PendingMessage *pending; 770 struct PendingMessage *pending;
829 struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pkey_enc=NULL; 771 struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pkey_enc;
830 size_t key_len = 0; 772 size_t key_len;
831 char* pkey_tmp; 773 char* pkey_tmp;
832 774
833 if (NULL == name) 775 if (NULL == name)
834 { 776 {
777 GNUNET_break (0);
835 return NULL; 778 return NULL;
836 } 779 }
837 780
@@ -841,22 +784,26 @@ GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle,
841 GNUNET_assert (pkey_enc != NULL); 784 GNUNET_assert (pkey_enc != NULL);
842 key_len = ntohs (pkey_enc->len); 785 key_len = ntohs (pkey_enc->len);
843 } 786 }
787 else
788 {
789 pkey_enc = NULL;
790 key_len = 0;
791 }
844 792
845 msize = sizeof (struct GNUNET_GNS_ClientLookupMessage) 793 msize = sizeof (struct GNUNET_GNS_ClientLookupMessage)
846 + key_len + strlen(name) + 1; 794 + key_len + strlen (name) + 1;
847 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to lookup %s in GNS\n", name); 795 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
848 796 "Trying to lookup %s in GNS\n",
849 lr = GNUNET_malloc(sizeof (struct GNUNET_GNS_LookupRequest)); 797 name);
798 lr = GNUNET_malloc (sizeof (struct GNUNET_GNS_LookupRequest));
850 lr->gns_handle = handle; 799 lr->gns_handle = handle;
851 lr->lookup_proc = proc; 800 lr->lookup_proc = proc;
852 lr->proc_cls = proc_cls; 801 lr->proc_cls = proc_cls;
853 lr->r_id = get_request_id (handle); 802 lr->r_id = handle->r_id++;
854 GNUNET_CONTAINER_DLL_insert_tail (handle->lookup_head, 803 GNUNET_CONTAINER_DLL_insert_tail (handle->lookup_head,
855 handle->lookup_tail, lr); 804 handle->lookup_tail, lr);
856 805
857 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize); 806 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
858 memset (pending, 0, (sizeof (struct PendingMessage) + msize));
859
860 pending->size = msize; 807 pending->size = msize;
861 pending->r_id = lr->r_id; 808 pending->r_id = lr->r_id;
862 809
@@ -864,40 +811,37 @@ GNUNET_GNS_lookup_zone (struct GNUNET_GNS_Handle *handle,
864 lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP); 811 lookup_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_LOOKUP);
865 lookup_msg->header.size = htons (msize); 812 lookup_msg->header.size = htons (msize);
866 lookup_msg->id = htonl (lr->r_id); 813 lookup_msg->id = htonl (lr->r_id);
867 lookup_msg->only_cached = htonl(only_cached); 814 lookup_msg->only_cached = htonl (only_cached);
868
869 if (NULL != zone) 815 if (NULL != zone)
870 { 816 {
871 lookup_msg->use_default_zone = htonl (0); 817 lookup_msg->use_default_zone = htonl (GNUNET_NO);
872 memcpy (&lookup_msg->zone, zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode)); 818 memcpy (&lookup_msg->zone, zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
873 } 819 }
874 else 820 else
875 { 821 {
876 lookup_msg->use_default_zone = htonl (1); 822 lookup_msg->use_default_zone = htonl (GNUNET_YES);
877 memset (&lookup_msg->zone, 0, sizeof(struct GNUNET_CRYPTO_ShortHashCode)); 823 memset (&lookup_msg->zone, 0, sizeof(struct GNUNET_CRYPTO_ShortHashCode));
878 } 824 }
879
880 lookup_msg->type = htonl (type); 825 lookup_msg->type = htonl (type);
881 826 pkey_tmp = (char *) &lookup_msg[1];
882 pkey_tmp = (char *) &lookup_msg[1];
883
884 if (pkey_enc != NULL) 827 if (pkey_enc != NULL)
885 { 828 {
886 lookup_msg->have_key = htonl(1); 829 lookup_msg->have_key = htonl (GNUNET_YES);
887 memcpy (pkey_tmp, pkey_enc, key_len); 830 memcpy (pkey_tmp, pkey_enc, key_len);
888 } 831 }
889 else 832 else
890 lookup_msg->have_key = htonl (0); 833 lookup_msg->have_key = htonl (GNUNET_NO);
891
892 memcpy (&pkey_tmp[key_len], name, strlen (name));
893
894 GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
895 pending);
896 GNUNET_free_non_null (pkey_enc); 834 GNUNET_free_non_null (pkey_enc);
835 memcpy (&pkey_tmp[key_len], name, strlen (name) + 1);
836
837 GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head,
838 handle->pending_tail,
839 pending);
897 process_pending_messages (handle); 840 process_pending_messages (handle);
898 return lr; 841 return lr;
899} 842}
900 843
844
901/** 845/**
902 * Perform an asynchronous Lookup operation on the GNS. 846 * Perform an asynchronous Lookup operation on the GNS.
903 * 847 *
@@ -926,6 +870,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
926 proc, proc_cls); 870 proc, proc_cls);
927} 871}
928 872
873
929/** 874/**
930 * Perform a name shortening operation on the GNS. 875 * Perform a name shortening operation on the GNS.
931 * 876 *
@@ -955,23 +900,21 @@ GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle,
955 900
956 if (NULL == name) 901 if (NULL == name)
957 { 902 {
903 GNUNET_break (0);
958 return NULL; 904 return NULL;
959 } 905 }
960
961 msize = sizeof (struct GNUNET_GNS_ClientShortenMessage) + strlen(name) + 1;
962 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to shorten %s in GNS\n", name); 906 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Trying to shorten %s in GNS\n", name);
963 907
964 sr = GNUNET_malloc(sizeof (struct GNUNET_GNS_ShortenRequest)); 908 msize = sizeof (struct GNUNET_GNS_ClientShortenMessage) + strlen(name) + 1;
909 sr = GNUNET_malloc (sizeof (struct GNUNET_GNS_ShortenRequest));
965 sr->gns_handle = handle; 910 sr->gns_handle = handle;
966 sr->shorten_proc = proc; 911 sr->shorten_proc = proc;
967 sr->proc_cls = proc_cls; 912 sr->proc_cls = proc_cls;
968 sr->r_id = get_request_id (handle); 913 sr->r_id = handle->r_id++;
969 GNUNET_CONTAINER_DLL_insert_tail (handle->shorten_head, 914 GNUNET_CONTAINER_DLL_insert_tail (handle->shorten_head,
970 handle->shorten_tail, sr); 915 handle->shorten_tail, sr);
971 916
972 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize); 917 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
973 memset(pending, 0, (sizeof (struct PendingMessage) + msize));
974
975 pending->size = msize; 918 pending->size = msize;
976 pending->r_id = sr->r_id; 919 pending->r_id = sr->r_id;
977 920
@@ -984,17 +927,17 @@ GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle,
984 927
985 if (NULL != zone) 928 if (NULL != zone)
986 { 929 {
987 shorten_msg->use_default_zone = htonl (0); 930 shorten_msg->use_default_zone = htonl (GNUNET_NO);
988 memcpy (&shorten_msg->zone, zone, 931 memcpy (&shorten_msg->zone, zone,
989 sizeof (struct GNUNET_CRYPTO_ShortHashCode)); 932 sizeof (struct GNUNET_CRYPTO_ShortHashCode));
990 } 933 }
991 else 934 else
992 { 935 {
993 shorten_msg->use_default_zone = htonl (1); 936 shorten_msg->use_default_zone = htonl (GNUNET_YES);
994 memset (&shorten_msg->zone, 0, sizeof (struct GNUNET_CRYPTO_ShortHashCode)); 937 memset (&shorten_msg->zone, 0, sizeof (struct GNUNET_CRYPTO_ShortHashCode));
995 } 938 }
996 939
997 memcpy (&shorten_msg[1], name, strlen (name)); 940 memcpy (&shorten_msg[1], name, strlen (name) + 1);
998 941
999 GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail, 942 GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail,
1000 pending); 943 pending);
@@ -1003,6 +946,7 @@ GNUNET_GNS_shorten_zone (struct GNUNET_GNS_Handle *handle,
1003 return sr; 946 return sr;
1004} 947}
1005 948
949
1006/** 950/**
1007 * Perform a name shortening operation on the GNS. 951 * Perform a name shortening operation on the GNS.
1008 * 952 *
@@ -1050,37 +994,33 @@ GNUNET_GNS_get_authority (struct GNUNET_GNS_Handle *handle,
1050 994
1051 if (NULL == name) 995 if (NULL == name)
1052 { 996 {
997 GNUNET_break (0);
1053 return NULL; 998 return NULL;
1054 } 999 }
1055
1056 msize = sizeof (struct GNUNET_GNS_ClientGetAuthMessage) + strlen(name) + 1;
1057 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1000 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1058 "Trying to look up authority for %s in GNS\n", name); 1001 "Trying to look up authority for %s in GNS\n", name);
1059 1002
1003 msize = sizeof (struct GNUNET_GNS_ClientGetAuthMessage) + strlen (name) + 1;
1060 gar = GNUNET_malloc (sizeof (struct GNUNET_GNS_GetAuthRequest)); 1004 gar = GNUNET_malloc (sizeof (struct GNUNET_GNS_GetAuthRequest));
1061 gar->gns_handle = handle; 1005 gar->gns_handle = handle;
1062 gar->auth_proc = proc; 1006 gar->auth_proc = proc;
1063 gar->proc_cls = proc_cls; 1007 gar->proc_cls = proc_cls;
1064 gar->r_id = get_request_id (handle); 1008 gar->r_id = handle->r_id++;
1065 GNUNET_CONTAINER_DLL_insert_tail (handle->get_auth_head, 1009 GNUNET_CONTAINER_DLL_insert_tail (handle->get_auth_head,
1066 handle->get_auth_tail, gar); 1010 handle->get_auth_tail, gar);
1067 1011
1068 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize); 1012 pending = GNUNET_malloc (sizeof (struct PendingMessage) + msize);
1069 memset (pending, 0, (sizeof (struct PendingMessage) + msize));
1070
1071 pending->size = msize; 1013 pending->size = msize;
1072 pending->r_id = gar->r_id; 1014 pending->r_id = gar->r_id;
1073
1074 get_auth_msg = (struct GNUNET_GNS_ClientGetAuthMessage *) &pending[1]; 1015 get_auth_msg = (struct GNUNET_GNS_ClientGetAuthMessage *) &pending[1];
1075 get_auth_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_GET_AUTH); 1016 get_auth_msg->header.type = htons (GNUNET_MESSAGE_TYPE_GNS_GET_AUTH);
1076 get_auth_msg->header.size = htons (msize); 1017 get_auth_msg->header.size = htons (msize);
1077 get_auth_msg->id = htonl (gar->r_id); 1018 get_auth_msg->id = htonl (gar->r_id);
1019 memcpy (&get_auth_msg[1], name, strlen(name) + 1);
1078 1020
1079 memcpy(&get_auth_msg[1], name, strlen(name)); 1021 GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head,
1080 1022 handle->pending_tail,
1081 GNUNET_CONTAINER_DLL_insert_tail (handle->pending_head, handle->pending_tail, 1023 pending);
1082 pending);
1083
1084 process_pending_messages (handle); 1024 process_pending_messages (handle);
1085 return gar; 1025 return gar;
1086} 1026}
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 447581669..4194a1658 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -37,22 +37,14 @@
37#include "gns.h" 37#include "gns.h"
38#include "gnunet-service-gns_resolver.h" 38#include "gnunet-service-gns_resolver.h"
39#include "gnunet-service-gns_interceptor.h" 39#include "gnunet-service-gns_interceptor.h"
40 40#include "gnunet_protocols.h"
41
42/* FIXME move to proper header in include */
43#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP 23
44#define GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT 24
45#define GNUNET_MESSAGE_TYPE_GNS_SHORTEN 25
46#define GNUNET_MESSAGE_TYPE_GNS_SHORTEN_RESULT 26
47#define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH 27
48#define GNUNET_MESSAGE_TYPE_GNS_GET_AUTH_RESULT 28
49
50 41
51#define INITIAL_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS 42#define INITIAL_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_MILLISECONDS
52#define MINIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_SECONDS 43#define MINIMUM_ZONE_ITERATION_INTERVAL GNUNET_TIME_UNIT_SECONDS
53#define DEFAULT_RECORD_PUT_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4) 44#define DEFAULT_RECORD_PUT_INTERVAL GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
54#define LATE_ITERATION_SPEEDUP_FACTOR 2 45#define LATE_ITERATION_SPEEDUP_FACTOR 2
55 46
47
56/** 48/**
57 * Handle to a shorten operation from api 49 * Handle to a shorten operation from api
58 */ 50 */