aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c58
-rw-r--r--src/namestore/gnunet-namestore.c78
-rw-r--r--src/namestore/gnunet-service-namestore.c128
-rw-r--r--src/namestore/namestore.h10
-rw-r--r--src/namestore/namestore_api.c116
-rw-r--r--src/namestore/namestore_api_common.c116
-rw-r--r--src/namestore/namestore_api_monitor.c8
-rw-r--r--src/namestore/plugin_namestore_postgres.c84
-rw-r--r--src/namestore/plugin_namestore_sqlite.c156
-rw-r--r--src/namestore/test_namestore_api_cache_block.c8
-rw-r--r--src/namestore/test_namestore_api_lookup_public.c10
-rw-r--r--src/namestore/test_namestore_api_monitoring.c10
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c10
-rw-r--r--src/namestore/test_namestore_api_put.c6
-rw-r--r--src/namestore/test_namestore_api_remove.c22
-rw-r--r--src/namestore/test_namestore_api_remove_not_existing_record.c2
-rw-r--r--src/namestore/test_namestore_api_store.c10
-rw-r--r--src/namestore/test_namestore_api_store_update.c18
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c6
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c2
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c2
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c2
-rw-r--r--src/namestore/test_plugin_namestore.c10
23 files changed, 436 insertions, 436 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 4b110a548..7455c0ba5 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -120,7 +120,7 @@ struct Request
120 struct MHD_PostProcessor *pp; 120 struct MHD_PostProcessor *pp;
121 121
122 /** 122 /**
123 * URL to serve in response to this POST (if this request 123 * URL to serve in response to this POST (if this request
124 * was a 'POST') 124 * was a 'POST')
125 */ 125 */
126 const char *post_url; 126 const char *post_url;
@@ -129,7 +129,7 @@ struct Request
129 * Active request with the namestore. 129 * Active request with the namestore.
130 */ 130 */
131 struct GNUNET_NAMESTORE_QueueEntry *qe; 131 struct GNUNET_NAMESTORE_QueueEntry *qe;
132 132
133 /** 133 /**
134 * Current processing phase. 134 * Current processing phase.
135 */ 135 */
@@ -171,7 +171,7 @@ struct ZoneinfoRequest
171 * Buffer length 171 * Buffer length
172 */ 172 */
173 size_t buf_len; 173 size_t buf_len;
174 174
175 /** 175 /**
176 * Buffer write offset 176 * Buffer write offset
177 */ 177 */
@@ -270,8 +270,8 @@ iterate_cb (void *cls,
270 MHD_add_response_header (response, 270 MHD_add_response_header (response,
271 MHD_HTTP_HEADER_CONTENT_TYPE, 271 MHD_HTTP_HEADER_CONTENT_TYPE,
272 MIME_HTML); 272 MIME_HTML);
273 MHD_queue_response (zr->connection, 273 MHD_queue_response (zr->connection,
274 MHD_HTTP_OK, 274 MHD_HTTP_OK,
275 response); 275 response);
276 MHD_destroy_response (response); 276 MHD_destroy_response (response);
277 GNUNET_free (zr->zoneinfo); 277 GNUNET_free (zr->zoneinfo);
@@ -305,9 +305,9 @@ iterate_cb (void *cls,
305 zr->zoneinfo = new_buf; 305 zr->zoneinfo = new_buf;
306 zr->buf_len *= 2; 306 zr->buf_len *= 2;
307 } 307 }
308 sprintf (zr->zoneinfo + zr->write_offset, 308 sprintf (zr->zoneinfo + zr->write_offset,
309 "<tr><td>%s</td><td>%s</td></tr>", 309 "<tr><td>%s</td><td>%s</td></tr>",
310 name, 310 name,
311 pkey); 311 pkey);
312 zr->write_offset = strlen (zr->zoneinfo); 312 zr->write_offset = strlen (zr->zoneinfo);
313 GNUNET_NAMESTORE_zone_iterator_next (zr->list_it); 313 GNUNET_NAMESTORE_zone_iterator_next (zr->list_it);
@@ -359,8 +359,8 @@ serve_main_page (struct MHD_Connection *connection)
359 MHD_add_response_header (response, 359 MHD_add_response_header (response,
360 MHD_HTTP_HEADER_CONTENT_TYPE, 360 MHD_HTTP_HEADER_CONTENT_TYPE,
361 MIME_HTML); 361 MIME_HTML);
362 ret = MHD_queue_response (connection, 362 ret = MHD_queue_response (connection,
363 MHD_HTTP_OK, 363 MHD_HTTP_OK,
364 response); 364 response);
365 MHD_destroy_response (response); 365 MHD_destroy_response (response);
366 return ret; 366 return ret;
@@ -394,8 +394,8 @@ fill_s_reply (const char *info,
394 MHD_add_response_header (response, 394 MHD_add_response_header (response,
395 MHD_HTTP_HEADER_CONTENT_TYPE, 395 MHD_HTTP_HEADER_CONTENT_TYPE,
396 MIME_HTML); 396 MIME_HTML);
397 ret = MHD_queue_response (connection, 397 ret = MHD_queue_response (connection,
398 MHD_HTTP_OK, 398 MHD_HTTP_OK,
399 response); 399 response);
400 MHD_destroy_response (response); 400 MHD_destroy_response (response);
401 return ret; 401 return ret;
@@ -471,7 +471,7 @@ post_iterator (void *cls,
471 * GNUNET_YES (or other positive value) on success 471 * GNUNET_YES (or other positive value) on success
472 * @param emsg NULL on success, otherwise an error message 472 * @param emsg NULL on success, otherwise an error message
473 */ 473 */
474static void 474static void
475put_continuation (void *cls, 475put_continuation (void *cls,
476 int32_t success, 476 int32_t success,
477 const char *emsg) 477 const char *emsg)
@@ -502,7 +502,7 @@ put_continuation (void *cls,
502 * @param rd_count number of entries in 'rd' array 502 * @param rd_count number of entries in 'rd' array
503 * @param rd array of records with data to store 503 * @param rd array of records with data to store
504 */ 504 */
505static void 505static void
506zone_to_name_cb (void *cls, 506zone_to_name_cb (void *cls,
507 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, 507 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
508 const char *name, 508 const char *name,
@@ -512,7 +512,7 @@ zone_to_name_cb (void *cls,
512 struct Request *request = cls; 512 struct Request *request = cls;
513 struct GNUNET_NAMESTORE_RecordData r; 513 struct GNUNET_NAMESTORE_RecordData r;
514 struct GNUNET_CRYPTO_EccPublicSignKey pub; 514 struct GNUNET_CRYPTO_EccPublicSignKey pub;
515 515
516 request->qe = NULL; 516 request->qe = NULL;
517 if (NULL != name) 517 if (NULL != name)
518 { 518 {
@@ -548,14 +548,14 @@ zone_to_name_cb (void *cls,
548 * @param rd_count number of entries in 'rd' array 548 * @param rd_count number of entries in 'rd' array
549 * @param rd array of records with data to store 549 * @param rd array of records with data to store
550 */ 550 */
551static void 551static void
552lookup_result_processor (void *cls, 552lookup_result_processor (void *cls,
553 unsigned int rd_count, 553 unsigned int rd_count,
554 const struct GNUNET_NAMESTORE_RecordData *rd) 554 const struct GNUNET_NAMESTORE_RecordData *rd)
555{ 555{
556 struct Request *request = cls; 556 struct Request *request = cls;
557 struct GNUNET_CRYPTO_EccPublicSignKey pub; 557 struct GNUNET_CRYPTO_EccPublicSignKey pub;
558 558
559 if (0 != rd_count) 559 if (0 != rd_count)
560 { 560 {
561 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 561 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -606,7 +606,7 @@ lookup_block_processor (void *cls,
606 } 606 }
607 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey, 607 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey,
608 &pub); 608 &pub);
609 if (GNUNET_OK != 609 if (GNUNET_OK !=
610 GNUNET_NAMESTORE_block_decrypt (block, 610 GNUNET_NAMESTORE_block_decrypt (block,
611 &pub, 611 &pub,
612 request->domain_name, 612 request->domain_name,
@@ -650,7 +650,7 @@ create_response (void *cls,
650 const char *url, 650 const char *url,
651 const char *method, 651 const char *method,
652 const char *version, 652 const char *version,
653 const char *upload_data, 653 const char *upload_data,
654 size_t *upload_data_size, 654 size_t *upload_data_size,
655 void **ptr) 655 void **ptr)
656{ 656{
@@ -688,7 +688,7 @@ create_response (void *cls,
688 _("Failed to setup post processor for `%s'\n"), 688 _("Failed to setup post processor for `%s'\n"),
689 url); 689 url);
690 return MHD_NO; /* internal error */ 690 return MHD_NO; /* internal error */
691 } 691 }
692 return MHD_YES; 692 return MHD_YES;
693 } 693 }
694 if (NULL != request->pp) 694 if (NULL != request->pp)
@@ -759,14 +759,14 @@ create_response (void *cls,
759 GNUNET_break (0); 759 GNUNET_break (0);
760 return MHD_NO; 760 return MHD_NO;
761 } 761 }
762 return MHD_YES; /* will have a reply later... */ 762 return MHD_YES; /* will have a reply later... */
763 } 763 }
764 /* unsupported HTTP method */ 764 /* unsupported HTTP method */
765 response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), 765 response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
766 (void *) METHOD_ERROR, 766 (void *) METHOD_ERROR,
767 MHD_RESPMEM_PERSISTENT); 767 MHD_RESPMEM_PERSISTENT);
768 ret = MHD_queue_response (connection, 768 ret = MHD_queue_response (connection,
769 MHD_HTTP_METHOD_NOT_ACCEPTABLE, 769 MHD_HTTP_METHOD_NOT_ACCEPTABLE,
770 response); 770 response);
771 MHD_destroy_response (response); 771 MHD_destroy_response (response);
772 return ret; 772 return ret;
@@ -900,7 +900,7 @@ do_shutdown (void *cls,
900} 900}
901 901
902 902
903/** 903/**
904 * Method called to inform about the egos of this peer. 904 * Method called to inform about the egos of this peer.
905 * 905 *
906 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get, 906 * When used with #GNUNET_IDENTITY_create or #GNUNET_IDENTITY_get,
@@ -908,7 +908,7 @@ do_shutdown (void *cls,
908 * @a ego does indicate an error (i.e. name is taken or no default 908 * @a ego does indicate an error (i.e. name is taken or no default
909 * value is known). If @a ego is non-NULL and if '*ctx' 909 * value is known). If @a ego is non-NULL and if '*ctx'
910 * is set in those callbacks, the value WILL be passed to a subsequent 910 * is set in those callbacks, the value WILL be passed to a subsequent
911 * call to the identity callback of #GNUNET_IDENTITY_connect (if 911 * call to the identity callback of #GNUNET_IDENTITY_connect (if
912 * that one was not NULL). 912 * that one was not NULL).
913 * 913 *
914 * @param cls closure, NULL 914 * @param cls closure, NULL
@@ -941,12 +941,12 @@ identity_cb (void *cls,
941 { 941 {
942 httpd = MHD_start_daemon (options, 942 httpd = MHD_start_daemon (options,
943 (uint16_t) port, 943 (uint16_t) port,
944 NULL, NULL, 944 NULL, NULL,
945 &create_response, NULL, 945 &create_response, NULL,
946 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, 946 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128,
947 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, 947 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1,
948 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, 948 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
949 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), 949 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024),
950 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, 950 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL,
951 MHD_OPTION_END); 951 MHD_OPTION_END);
952 if (MHD_USE_DEBUG == options) 952 if (MHD_USE_DEBUG == options)
@@ -1026,7 +1026,7 @@ main (int argc, char *const *argv)
1026 ret = 1026 ret =
1027 (GNUNET_OK == 1027 (GNUNET_OK ==
1028 GNUNET_PROGRAM_run (argc, argv, "fcfsd", 1028 GNUNET_PROGRAM_run (argc, argv, "fcfsd",
1029 _("GNU Name System First Come First Serve name registration service"), 1029 _("GNU Name System First Come First Serve name registration service"),
1030 options, 1030 options,
1031 &run, NULL)) ? 0 : 1; 1031 &run, NULL)) ? 0 : 1;
1032 GNUNET_free ((void*) argv); 1032 GNUNET_free ((void*) argv);
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 37995e8c6..ceedadc24 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -336,7 +336,7 @@ display_record (void *cls,
336 if ( (NULL == del_qe) && 336 if ( (NULL == del_qe) &&
337 (NULL == list_qe) && 337 (NULL == list_qe) &&
338 (NULL == add_qe_uri) && 338 (NULL == add_qe_uri) &&
339 (NULL == add_qe) ) 339 (NULL == add_qe) )
340 GNUNET_SCHEDULER_shutdown (); 340 GNUNET_SCHEDULER_shutdown ();
341 return; 341 return;
342 } 342 }
@@ -365,12 +365,12 @@ display_record (void *cls,
365 at.abs_value_us = rd[i].expiration_time; 365 at.abs_value_us = rd[i].expiration_time;
366 ets = GNUNET_STRINGS_absolute_time_to_string (at); 366 ets = GNUNET_STRINGS_absolute_time_to_string (at);
367 } 367 }
368 FPRINTF (stdout, 368 FPRINTF (stdout,
369 "\t%s: %s (%s)\n", 369 "\t%s: %s (%s)\n",
370 typestring, 370 typestring,
371 s, 371 s,
372 ets); 372 ets);
373 GNUNET_free (s); 373 GNUNET_free (s);
374 } 374 }
375 FPRINTF (stdout, "%s", "\n"); 375 FPRINTF (stdout, "%s", "\n");
376 GNUNET_NAMESTORE_zone_iterator_next (list_it); 376 GNUNET_NAMESTORE_zone_iterator_next (list_it);
@@ -435,7 +435,7 @@ get_existing_record (void *cls,
435 } 435 }
436 else if (GNUNET_NO == etime_is_rel) 436 else if (GNUNET_NO == etime_is_rel)
437 rde->expiration_time = etime_abs.abs_value_us; 437 rde->expiration_time = etime_abs.abs_value_us;
438 else 438 else
439 rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 439 rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
440 GNUNET_assert (NULL != name); 440 GNUNET_assert (NULL != name);
441 add_qe = GNUNET_NAMESTORE_records_store (ns, 441 add_qe = GNUNET_NAMESTORE_records_store (ns,
@@ -479,7 +479,7 @@ display_records_from_block (void *cls,
479 } 479 }
480 FPRINTF (stdout, 480 FPRINTF (stdout,
481 "%s:\n", 481 "%s:\n",
482 name); 482 name);
483 for (i=0;i<rd_len;i++) 483 for (i=0;i<rd_len;i++)
484 { 484 {
485 typestring = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type); 485 typestring = GNUNET_NAMESTORE_number_to_typename (rd[i].record_type);
@@ -492,11 +492,11 @@ display_records_from_block (void *cls,
492 (unsigned int) rd[i].record_type); 492 (unsigned int) rd[i].record_type);
493 continue; 493 continue;
494 } 494 }
495 FPRINTF (stdout, 495 FPRINTF (stdout,
496 "\t%s: %s\n", 496 "\t%s: %s\n",
497 typestring, 497 typestring,
498 s); 498 s);
499 GNUNET_free (s); 499 GNUNET_free (s);
500 } 500 }
501 FPRINTF (stdout, "%s", "\n"); 501 FPRINTF (stdout, "%s", "\n");
502} 502}
@@ -521,7 +521,7 @@ handle_block (void *cls,
521 { 521 {
522 fprintf (stderr, 522 fprintf (stderr,
523 "No matching block found\n"); 523 "No matching block found\n");
524 } 524 }
525 else if (GNUNET_OK != 525 else if (GNUNET_OK !=
526 GNUNET_NAMESTORE_block_decrypt (block, 526 GNUNET_NAMESTORE_block_decrypt (block,
527 &zone_pubkey, 527 &zone_pubkey,
@@ -535,7 +535,7 @@ handle_block (void *cls,
535 if ( (NULL == del_qe) && 535 if ( (NULL == del_qe) &&
536 (NULL == list_it) && 536 (NULL == list_it) &&
537 (NULL == add_qe_uri) && 537 (NULL == add_qe_uri) &&
538 (NULL == add_qe) ) 538 (NULL == add_qe) )
539 GNUNET_SCHEDULER_shutdown (); 539 GNUNET_SCHEDULER_shutdown ();
540} 540}
541 541
@@ -558,17 +558,17 @@ testservice_task (void *cls,
558 558
559 if (GNUNET_YES != result) 559 if (GNUNET_YES != result)
560 { 560 {
561 FPRINTF (stderr, _("Service `%s' is not running\n"), 561 FPRINTF (stderr, _("Service `%s' is not running\n"),
562 "namestore"); 562 "namestore");
563 return; 563 return;
564 } 564 }
565 if (! (add|del|list|(NULL != uri))) 565 if (! (add|del|list|(NULL != uri)))
566 { 566 {
567 /* nothing more to be done */ 567 /* nothing more to be done */
568 fprintf (stderr, 568 fprintf (stderr,
569 _("No options given\n")); 569 _("No options given\n"));
570 GNUNET_SCHEDULER_shutdown (); 570 GNUNET_SCHEDULER_shutdown ();
571 return; 571 return;
572 } 572 }
573 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey, 573 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey,
574 &pub); 574 &pub);
@@ -588,8 +588,8 @@ testservice_task (void *cls,
588 _("Missing option `%s' for operation `%s'\n"), 588 _("Missing option `%s' for operation `%s'\n"),
589 "-n", _("add")); 589 "-n", _("add"));
590 GNUNET_SCHEDULER_shutdown (); 590 GNUNET_SCHEDULER_shutdown ();
591 ret = 1; 591 ret = 1;
592 return; 592 return;
593 } 593 }
594 if (NULL == typestring) 594 if (NULL == typestring)
595 { 595 {
@@ -598,7 +598,7 @@ testservice_task (void *cls,
598 "-t", _("add")); 598 "-t", _("add"));
599 GNUNET_SCHEDULER_shutdown (); 599 GNUNET_SCHEDULER_shutdown ();
600 ret = 1; 600 ret = 1;
601 return; 601 return;
602 } 602 }
603 type = GNUNET_NAMESTORE_typename_to_number (typestring); 603 type = GNUNET_NAMESTORE_typename_to_number (typestring);
604 if (UINT32_MAX == type) 604 if (UINT32_MAX == type)
@@ -613,9 +613,9 @@ testservice_task (void *cls,
613 fprintf (stderr, 613 fprintf (stderr,
614 _("Missing option `%s' for operation `%s'\n"), 614 _("Missing option `%s' for operation `%s'\n"),
615 "-V", _("add")); 615 "-V", _("add"));
616 ret = 1; 616 ret = 1;
617 GNUNET_SCHEDULER_shutdown (); 617 GNUNET_SCHEDULER_shutdown ();
618 return; 618 return;
619 } 619 }
620 if (GNUNET_OK != 620 if (GNUNET_OK !=
621 GNUNET_NAMESTORE_string_to_value (type, 621 GNUNET_NAMESTORE_string_to_value (type,
@@ -636,8 +636,8 @@ testservice_task (void *cls,
636 _("Missing option `%s' for operation `%s'\n"), 636 _("Missing option `%s' for operation `%s'\n"),
637 "-e", _("add")); 637 "-e", _("add"));
638 GNUNET_SCHEDULER_shutdown (); 638 GNUNET_SCHEDULER_shutdown ();
639 ret = 1; 639 ret = 1;
640 return; 640 return;
641 } 641 }
642 if (0 == strcmp (expirationstring, "never")) 642 if (0 == strcmp (expirationstring, "never"))
643 { 643 {
@@ -650,7 +650,7 @@ testservice_task (void *cls,
650 { 650 {
651 etime_is_rel = GNUNET_YES; 651 etime_is_rel = GNUNET_YES;
652 } 652 }
653 else if (GNUNET_OK == 653 else if (GNUNET_OK ==
654 GNUNET_STRINGS_fancy_time_to_absolute (expirationstring, 654 GNUNET_STRINGS_fancy_time_to_absolute (expirationstring,
655 &etime_abs)) 655 &etime_abs))
656 { 656 {
@@ -663,7 +663,7 @@ testservice_task (void *cls,
663 expirationstring); 663 expirationstring);
664 GNUNET_SCHEDULER_shutdown (); 664 GNUNET_SCHEDULER_shutdown ();
665 ret = 1; 665 ret = 1;
666 return; 666 return;
667 } 667 }
668 add_zit = GNUNET_NAMESTORE_zone_iteration_start (ns, 668 add_zit = GNUNET_NAMESTORE_zone_iteration_start (ns,
669 &zone_pkey, 669 &zone_pkey,
@@ -679,7 +679,7 @@ testservice_task (void *cls,
679 "-n", _("del")); 679 "-n", _("del"));
680 GNUNET_SCHEDULER_shutdown (); 680 GNUNET_SCHEDULER_shutdown ();
681 ret = 1; 681 ret = 1;
682 return; 682 return;
683 } 683 }
684 del_qe = GNUNET_NAMESTORE_records_store (ns, 684 del_qe = GNUNET_NAMESTORE_records_store (ns,
685 &zone_pkey, 685 &zone_pkey,
@@ -726,7 +726,7 @@ testservice_task (void *cls,
726 (GNUNET_OK != 726 (GNUNET_OK !=
727 GNUNET_CRYPTO_ecc_public_sign_key_from_string (sh, strlen (sh), &pkey)) ) 727 GNUNET_CRYPTO_ecc_public_sign_key_from_string (sh, strlen (sh), &pkey)) )
728 { 728 {
729 fprintf (stderr, 729 fprintf (stderr,
730 _("Invalid URI `%s'\n"), 730 _("Invalid URI `%s'\n"),
731 uri); 731 uri);
732 GNUNET_SCHEDULER_shutdown (); 732 GNUNET_SCHEDULER_shutdown ();
@@ -744,7 +744,7 @@ testservice_task (void *cls,
744 } 744 }
745 else if (GNUNET_NO == etime_is_rel) 745 else if (GNUNET_NO == etime_is_rel)
746 rd.expiration_time = etime_abs.abs_value_us; 746 rd.expiration_time = etime_abs.abs_value_us;
747 else 747 else
748 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; 748 rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
749 if (1 != shadow) 749 if (1 != shadow)
750 rd.flags |= GNUNET_NAMESTORE_RF_SHADOW_RECORD; 750 rd.flags |= GNUNET_NAMESTORE_RF_SHADOW_RECORD;
@@ -772,7 +772,7 @@ testservice_task (void *cls,
772 * An @a ego of NULL means the ego was not found. 772 * An @a ego of NULL means the ego was not found.
773 * 773 *
774 * @param cls closure with the configuration 774 * @param cls closure with the configuration
775 * @param ego an ego known to identity service, or NULL 775 * @param ego an ego known to identity service, or NULL
776 */ 776 */
777static void 777static void
778identity_cb (void *cls, 778identity_cb (void *cls,
@@ -783,7 +783,7 @@ identity_cb (void *cls,
783 el = NULL; 783 el = NULL;
784 if (NULL == ego) 784 if (NULL == ego)
785 { 785 {
786 fprintf (stderr, 786 fprintf (stderr,
787 _("Ego `%s' not known to identity service\n"), 787 _("Ego `%s' not known to identity service\n"),
788 ego_name); 788 ego_name);
789 GNUNET_SCHEDULER_shutdown (); 789 GNUNET_SCHEDULER_shutdown ();
@@ -813,7 +813,7 @@ run (void *cls, char *const *args, const char *cfgfile,
813{ 813{
814 if (NULL == ego_name) 814 if (NULL == ego_name)
815 { 815 {
816 fprintf (stderr, 816 fprintf (stderr,
817 _("You must specify which zone should be accessed\n")); 817 _("You must specify which zone should be accessed\n"));
818 return; 818 return;
819 } 819 }
@@ -846,28 +846,28 @@ main (int argc, char *const *argv)
846 &GNUNET_GETOPT_set_one, &add}, 846 &GNUNET_GETOPT_set_one, &add},
847 {'d', "delete", NULL, 847 {'d', "delete", NULL,
848 gettext_noop ("delete record"), 0, 848 gettext_noop ("delete record"), 0,
849 &GNUNET_GETOPT_set_one, &del}, 849 &GNUNET_GETOPT_set_one, &del},
850 {'D', "display", NULL, 850 {'D', "display", NULL,
851 gettext_noop ("display records"), 0, 851 gettext_noop ("display records"), 0,
852 &GNUNET_GETOPT_set_one, &list}, 852 &GNUNET_GETOPT_set_one, &list},
853 {'e', "expiration", "TIME", 853 {'e', "expiration", "TIME",
854 gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1, 854 gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), 1,
855 &GNUNET_GETOPT_set_string, &expirationstring}, 855 &GNUNET_GETOPT_set_string, &expirationstring},
856 {'m', "monitor", NULL, 856 {'m', "monitor", NULL,
857 gettext_noop ("monitor changes in the namestore"), 0, 857 gettext_noop ("monitor changes in the namestore"), 0,
858 &GNUNET_GETOPT_set_one, &monitor}, 858 &GNUNET_GETOPT_set_one, &monitor},
859 {'n', "name", "NAME", 859 {'n', "name", "NAME",
860 gettext_noop ("name of the record to add/delete/display"), 1, 860 gettext_noop ("name of the record to add/delete/display"), 1,
861 &GNUNET_GETOPT_set_string, &name}, 861 &GNUNET_GETOPT_set_string, &name},
862 {'t', "type", "TYPE", 862 {'t', "type", "TYPE",
863 gettext_noop ("type of the record to add/delete/display"), 1, 863 gettext_noop ("type of the record to add/delete/display"), 1,
864 &GNUNET_GETOPT_set_string, &typestring}, 864 &GNUNET_GETOPT_set_string, &typestring},
865 {'u', "uri", "URI", 865 {'u', "uri", "URI",
866 gettext_noop ("URI to import into our zone"), 1, 866 gettext_noop ("URI to import into our zone"), 1,
867 &GNUNET_GETOPT_set_string, &uri}, 867 &GNUNET_GETOPT_set_string, &uri},
868 {'V', "value", "VALUE", 868 {'V', "value", "VALUE",
869 gettext_noop ("value of the record to add/delete"), 1, 869 gettext_noop ("value of the record to add/delete"), 1,
870 &GNUNET_GETOPT_set_string, &value}, 870 &GNUNET_GETOPT_set_string, &value},
871 {'p', "public", NULL, 871 {'p', "public", NULL,
872 gettext_noop ("create or list public record"), 0, 872 gettext_noop ("create or list public record"), 0,
873 &GNUNET_GETOPT_set_one, &public}, 873 &GNUNET_GETOPT_set_one, &public},
@@ -876,7 +876,7 @@ main (int argc, char *const *argv)
876 &GNUNET_GETOPT_set_one, &shadow}, 876 &GNUNET_GETOPT_set_one, &shadow},
877 {'z', "zone", "EGO", 877 {'z', "zone", "EGO",
878 gettext_noop ("name of the ego controlling the zone"), 1, 878 gettext_noop ("name of the ego controlling the zone"), 1,
879 &GNUNET_GETOPT_set_string, &ego_name}, 879 &GNUNET_GETOPT_set_string, &ego_name},
880 GNUNET_GETOPT_OPTION_END 880 GNUNET_GETOPT_OPTION_END
881 }; 881 };
882 882
@@ -886,7 +886,7 @@ main (int argc, char *const *argv)
886 GNUNET_log_setup ("gnunet-namestore", "WARNING", NULL); 886 GNUNET_log_setup ("gnunet-namestore", "WARNING", NULL);
887 if (GNUNET_OK != 887 if (GNUNET_OK !=
888 GNUNET_PROGRAM_run (argc, argv, "gnunet-namestore", 888 GNUNET_PROGRAM_run (argc, argv, "gnunet-namestore",
889 _("GNUnet zone manipulation tool"), 889 _("GNUnet zone manipulation tool"),
890 options, 890 options,
891 &run, NULL)) 891 &run, NULL))
892 { 892 {
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 8251a41fa..ef200a8f4 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -260,7 +260,7 @@ cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
260 * @param client identification of the client 260 * @param client identification of the client
261 */ 261 */
262static void 262static void
263client_disconnect_notification (void *cls, 263client_disconnect_notification (void *cls,
264 struct GNUNET_SERVER_Client *client) 264 struct GNUNET_SERVER_Client *client)
265{ 265{
266 struct ZoneIteration *no; 266 struct ZoneIteration *no;
@@ -269,8 +269,8 @@ client_disconnect_notification (void *cls,
269 269
270 if (NULL == client) 270 if (NULL == client)
271 return; 271 return;
272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 272 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
273 "Client %p disconnected\n", 273 "Client %p disconnected\n",
274 client); 274 client);
275 if (NULL == (nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient))) 275 if (NULL == (nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient)))
276 return; 276 return;
@@ -315,7 +315,7 @@ client_lookup (struct GNUNET_SERVER_Client *client)
315 nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient); 315 nc = GNUNET_SERVER_client_get_user_context (client, struct NamestoreClient);
316 if (NULL != nc) 316 if (NULL != nc)
317 return nc; 317 return nc;
318 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 318 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
319 "Client %p connected\n", 319 "Client %p connected\n",
320 client); 320 client);
321 nc = GNUNET_new (struct NamestoreClient); 321 nc = GNUNET_new (struct NamestoreClient);
@@ -361,7 +361,7 @@ handle_lookup_block_it (void *cls,
361 size_t esize; 361 size_t esize;
362 362
363 esize = ntohl (block->purpose.size) 363 esize = ntohl (block->purpose.size)
364 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) 364 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)
365 - sizeof (struct GNUNET_TIME_AbsoluteNBO); 365 - sizeof (struct GNUNET_TIME_AbsoluteNBO);
366 r = GNUNET_malloc (sizeof (struct LookupBlockResponseMessage) + esize); 366 r = GNUNET_malloc (sizeof (struct LookupBlockResponseMessage) + esize);
367 r->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); 367 r->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE);
@@ -369,15 +369,15 @@ handle_lookup_block_it (void *cls,
369 r->gns_header.r_id = htonl (lnc->request_id); 369 r->gns_header.r_id = htonl (lnc->request_id);
370 r->expire = block->expiration_time; 370 r->expire = block->expiration_time;
371 r->signature = block->signature; 371 r->signature = block->signature;
372 r->derived_key = block->derived_key; 372 r->derived_key = block->derived_key;
373 memcpy (&r[1], &block[1], esize); 373 memcpy (&r[1], &block[1], esize);
374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 374 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
375 "Sending `%s' message with expiration time %s\n", 375 "Sending `%s' message with expiration time %s\n",
376 "NAMESTORE_LOOKUP_BLOCK_RESPONSE", 376 "NAMESTORE_LOOKUP_BLOCK_RESPONSE",
377 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire))); 377 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (r->expire)));
378 GNUNET_SERVER_notification_context_unicast (snc, 378 GNUNET_SERVER_notification_context_unicast (snc,
379 lnc->nc->client, 379 lnc->nc->client,
380 &r->gns_header.header, 380 &r->gns_header.header,
381 GNUNET_NO); 381 GNUNET_NO);
382 GNUNET_free (r); 382 GNUNET_free (r);
383} 383}
@@ -401,38 +401,38 @@ handle_lookup_block (void *cls,
401 struct LookupBlockResponseMessage zir_end; 401 struct LookupBlockResponseMessage zir_end;
402 int ret; 402 int ret;
403 403
404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 404 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
405 "Received `%s' message\n", 405 "Received `%s' message\n",
406 "NAMESTORE_LOOKUP_BLOCK"); 406 "NAMESTORE_LOOKUP_BLOCK");
407 nc = client_lookup(client); 407 nc = client_lookup(client);
408 ln_msg = (const struct LookupBlockMessage *) message; 408 ln_msg = (const struct LookupBlockMessage *) message;
409 lnc.request_id = ntohl (ln_msg->gns_header.r_id); 409 lnc.request_id = ntohl (ln_msg->gns_header.r_id);
410 lnc.nc = nc; 410 lnc.nc = nc;
411 if (GNUNET_SYSERR == 411 if (GNUNET_SYSERR ==
412 (ret = GSN_database->lookup_block (GSN_database->cls, 412 (ret = GSN_database->lookup_block (GSN_database->cls,
413 &ln_msg->query, 413 &ln_msg->query,
414 &handle_lookup_block_it, &lnc))) 414 &handle_lookup_block_it, &lnc)))
415 { 415 {
416 /* internal error (in database plugin); might be best to just hang up on 416 /* internal error (in database plugin); might be best to just hang up on
417 plugin rather than to signal that there are 'no' results, which 417 plugin rather than to signal that there are 'no' results, which
418 might also be false... */ 418 might also be false... */
419 GNUNET_break (0); 419 GNUNET_break (0);
420 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 420 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
421 return; 421 return;
422 } 422 }
423 if (0 == ret) 423 if (0 == ret)
424 { 424 {
425 /* no records match at all, generate empty response */ 425 /* no records match at all, generate empty response */
426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
427 "Sending empty `%s' message\n", 427 "Sending empty `%s' message\n",
428 "NAMESTORE_LOOKUP_BLOCK_RESPONSE"); 428 "NAMESTORE_LOOKUP_BLOCK_RESPONSE");
429 memset (&zir_end, 0, sizeof (zir_end)); 429 memset (&zir_end, 0, sizeof (zir_end));
430 zir_end.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE); 430 zir_end.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE);
431 zir_end.gns_header.header.size = htons (sizeof (struct LookupBlockResponseMessage)); 431 zir_end.gns_header.header.size = htons (sizeof (struct LookupBlockResponseMessage));
432 zir_end.gns_header.r_id = ln_msg->gns_header.r_id; 432 zir_end.gns_header.r_id = ln_msg->gns_header.r_id;
433 GNUNET_SERVER_notification_context_unicast (snc, 433 GNUNET_SERVER_notification_context_unicast (snc,
434 client, 434 client,
435 &zir_end.gns_header.header, 435 &zir_end.gns_header.header,
436 GNUNET_NO); 436 GNUNET_NO);
437 437
438 } 438 }
@@ -453,7 +453,7 @@ handle_block_cache (void *cls,
453 const struct GNUNET_MessageHeader *message) 453 const struct GNUNET_MessageHeader *message)
454{ 454{
455 struct NamestoreClient *nc; 455 struct NamestoreClient *nc;
456 const struct BlockCacheMessage *rp_msg; 456 const struct BlockCacheMessage *rp_msg;
457 struct BlockCacheResponseMessage rpr_msg; 457 struct BlockCacheResponseMessage rpr_msg;
458 struct GNUNET_NAMESTORE_Block *block; 458 struct GNUNET_NAMESTORE_Block *block;
459 size_t esize; 459 size_t esize;
@@ -475,7 +475,7 @@ handle_block_cache (void *cls,
475 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 475 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
476 esize); 476 esize);
477 block->expiration_time = rp_msg->expire; 477 block->expiration_time = rp_msg->expire;
478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 478 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
479 "Received `%s' message with expiration time %s\n", 479 "Received `%s' message with expiration time %s\n",
480 "NAMESTORE_BLOCK_CACHE", 480 "NAMESTORE_BLOCK_CACHE",
481 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time))); 481 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (block->expiration_time)));
@@ -488,9 +488,9 @@ handle_block_cache (void *cls,
488 rpr_msg.gns_header.header.size = htons (sizeof (struct BlockCacheResponseMessage)); 488 rpr_msg.gns_header.header.size = htons (sizeof (struct BlockCacheResponseMessage));
489 rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id; 489 rpr_msg.gns_header.r_id = rp_msg->gns_header.r_id;
490 rpr_msg.op_result = htonl (res); 490 rpr_msg.op_result = htonl (res);
491 GNUNET_SERVER_notification_context_unicast (snc, 491 GNUNET_SERVER_notification_context_unicast (snc,
492 nc->client, 492 nc->client,
493 &rpr_msg.gns_header.header, 493 &rpr_msg.gns_header.header,
494 GNUNET_NO); 494 GNUNET_NO);
495 GNUNET_SERVER_receive_done (client, GNUNET_OK); 495 GNUNET_SERVER_receive_done (client, GNUNET_OK);
496} 496}
@@ -525,7 +525,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc,
525 char *rd_ser; 525 char *rd_ser;
526 526
527 name_len = strlen (name) + 1; 527 name_len = strlen (name) + 1;
528 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); 528 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
529 msg_size = sizeof (struct RecordResultMessage) + name_len + rd_ser_len; 529 msg_size = sizeof (struct RecordResultMessage) + name_len + rd_ser_len;
530 530
531 zir_msg = GNUNET_malloc (msg_size); 531 zir_msg = GNUNET_malloc (msg_size);
@@ -540,13 +540,13 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc,
540 memcpy (name_tmp, name, name_len); 540 memcpy (name_tmp, name, name_len);
541 rd_ser = &name_tmp[name_len]; 541 rd_ser = &name_tmp[name_len];
542 GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser); 542 GNUNET_NAMESTORE_records_serialize (rd_count, rd, rd_ser_len, rd_ser);
543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 543 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
544 "Sending `%s' message with %u records and size %u\n", 544 "Sending `%s' message with %u records and size %u\n",
545 "RECORD_RESULT", 545 "RECORD_RESULT",
546 rd_count, 546 rd_count,
547 msg_size); 547 msg_size);
548 GNUNET_SERVER_notification_context_unicast (nc, 548 GNUNET_SERVER_notification_context_unicast (nc,
549 client, 549 client,
550 &zir_msg->gns_header.header, 550 &zir_msg->gns_header.header,
551 GNUNET_NO); 551 GNUNET_NO);
552 GNUNET_free (zir_msg); 552 GNUNET_free (zir_msg);
@@ -569,7 +569,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
569 const struct GNUNET_NAMESTORE_RecordData *rd) 569 const struct GNUNET_NAMESTORE_RecordData *rd)
570{ 570{
571 struct GNUNET_NAMESTORE_Block *block; 571 struct GNUNET_NAMESTORE_Block *block;
572 572
573 if (0 == rd_count) 573 if (0 == rd_count)
574 block = GNUNET_NAMESTORE_block_create (zone_key, 574 block = GNUNET_NAMESTORE_block_create (zone_key,
575 GNUNET_TIME_UNIT_ZERO_ABS, 575 GNUNET_TIME_UNIT_ZERO_ABS,
@@ -589,7 +589,7 @@ refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
589 _("Failed to cache encrypted block of my own zone!\n")); 589 _("Failed to cache encrypted block of my own zone!\n"));
590 } 590 }
591 GNUNET_free (block); 591 GNUNET_free (block);
592} 592}
593 593
594 594
595/** 595/**
@@ -620,8 +620,8 @@ handle_record_store (void *cls,
620 struct GNUNET_CRYPTO_EccPublicSignKey pubkey; 620 struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
621 struct ZoneMonitor *zm; 621 struct ZoneMonitor *zm;
622 622
623 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 623 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
624 "Received `%s' message\n", 624 "Received `%s' message\n",
625 "NAMESTORE_RECORD_STORE"); 625 "NAMESTORE_RECORD_STORE");
626 if (ntohs (message->size) < sizeof (struct RecordStoreMessage)) 626 if (ntohs (message->size) < sizeof (struct RecordStoreMessage))
627 { 627 {
@@ -686,9 +686,9 @@ handle_record_store (void *cls,
686 conv_name, 686 conv_name,
687 GNUNET_NAMESTORE_z2s (&pubkey)); 687 GNUNET_NAMESTORE_z2s (&pubkey));
688 688
689 if ( (0 == rd_count) && 689 if ( (0 == rd_count) &&
690 (GNUNET_NO == 690 (GNUNET_NO ==
691 GSN_database->iterate_records (GSN_database->cls, 691 GSN_database->iterate_records (GSN_database->cls,
692 &rp_msg->private_key, 0, NULL, 0)) ) 692 &rp_msg->private_key, 0, NULL, 0)) )
693 { 693 {
694 /* This name does not exist, so cannot be removed */ 694 /* This name does not exist, so cannot be removed */
@@ -701,15 +701,15 @@ handle_record_store (void *cls,
701 { 701 {
702 res = GSN_database->store_records (GSN_database->cls, 702 res = GSN_database->store_records (GSN_database->cls,
703 &rp_msg->private_key, 703 &rp_msg->private_key,
704 conv_name, 704 conv_name,
705 rd_count, rd); 705 rd_count, rd);
706 if (GNUNET_OK == res) 706 if (GNUNET_OK == res)
707 { 707 {
708 refresh_block (&rp_msg->private_key, 708 refresh_block (&rp_msg->private_key,
709 conv_name, 709 conv_name,
710 rd_count, rd); 710 rd_count, rd);
711 711
712 for (zm = monitor_head; NULL != zm; zm = zm->next) 712 for (zm = monitor_head; NULL != zm; zm = zm->next)
713 if (0 == memcmp (&rp_msg->private_key, &zm->zone, 713 if (0 == memcmp (&rp_msg->private_key, &zm->zone,
714 sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) 714 sizeof (struct GNUNET_CRYPTO_EccPrivateKey)))
715 send_lookup_response (monitor_nc, 715 send_lookup_response (monitor_nc,
@@ -722,10 +722,10 @@ handle_record_store (void *cls,
722 GNUNET_free (conv_name); 722 GNUNET_free (conv_name);
723 } 723 }
724 } 724 }
725 725
726 /* Send response */ 726 /* Send response */
727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
728 "Sending `%s' message\n", 728 "Sending `%s' message\n",
729 "RECORD_STORE_RESPONSE"); 729 "RECORD_STORE_RESPONSE");
730 rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE); 730 rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE);
731 rcr_msg.gns_header.header.size = htons (sizeof (struct RecordStoreResponseMessage)); 731 rcr_msg.gns_header.header.size = htons (sizeof (struct RecordStoreResponseMessage));
@@ -788,8 +788,8 @@ handle_zone_to_name_it (void *cls,
788 char *name_tmp; 788 char *name_tmp;
789 char *rd_tmp; 789 char *rd_tmp;
790 790
791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 791 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
792 "Found result for zone-to-name lookup: `%s'\n", 792 "Found result for zone-to-name lookup: `%s'\n",
793 name); 793 name);
794 res = GNUNET_YES; 794 res = GNUNET_YES;
795 name_len = (NULL == name) ? 0 : strlen (name) + 1; 795 name_len = (NULL == name) ? 0 : strlen (name) + 1;
@@ -840,7 +840,7 @@ handle_zone_to_name (void *cls,
840 struct ZoneToNameCtx ztn_ctx; 840 struct ZoneToNameCtx ztn_ctx;
841 struct ZoneToNameResponseMessage ztnr_msg; 841 struct ZoneToNameResponseMessage ztnr_msg;
842 842
843 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 843 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
844 "Received `%s' message\n", 844 "Received `%s' message\n",
845 "ZONE_TO_NAME"); 845 "ZONE_TO_NAME");
846 ztn_msg = (const struct ZoneToNameMessage *) message; 846 ztn_msg = (const struct ZoneToNameMessage *) message;
@@ -849,7 +849,7 @@ handle_zone_to_name (void *cls,
849 ztn_ctx.nc = nc; 849 ztn_ctx.nc = nc;
850 ztn_ctx.success = GNUNET_NO; 850 ztn_ctx.success = GNUNET_NO;
851 if (GNUNET_SYSERR == 851 if (GNUNET_SYSERR ==
852 GSN_database->zone_to_name (GSN_database->cls, 852 GSN_database->zone_to_name (GSN_database->cls,
853 &ztn_msg->zone, 853 &ztn_msg->zone,
854 &ztn_msg->value_zone, 854 &ztn_msg->value_zone,
855 &handle_zone_to_name_it, &ztn_ctx)) 855 &handle_zone_to_name_it, &ztn_ctx))
@@ -858,7 +858,7 @@ handle_zone_to_name (void *cls,
858 that might be wrong */ 858 that might be wrong */
859 GNUNET_break (0); 859 GNUNET_break (0);
860 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 860 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
861 return; 861 return;
862 } 862 }
863 if (GNUNET_NO == ztn_ctx.success) 863 if (GNUNET_NO == ztn_ctx.success)
864 { 864 {
@@ -945,17 +945,17 @@ zone_iteraterate_proc (void *cls,
945 945
946 if ((NULL == zone_key) && (NULL == name)) 946 if ((NULL == zone_key) && (NULL == name))
947 { 947 {
948 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 948 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
949 "Iteration done\n"); 949 "Iteration done\n");
950 proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE; 950 proc->res_iteration_finished = IT_SUCCESS_NOT_MORE_RESULTS_AVAILABLE;
951 return; 951 return;
952 } 952 }
953 if ((NULL == zone_key) || (NULL == name)) 953 if ((NULL == zone_key) || (NULL == name))
954 { 954 {
955 /* what is this!? should never happen */ 955 /* what is this!? should never happen */
956 proc->res_iteration_finished = IT_START; 956 proc->res_iteration_finished = IT_START;
957 GNUNET_break (0); 957 GNUNET_break (0);
958 return; 958 return;
959 } 959 }
960 proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE; 960 proc->res_iteration_finished = IT_SUCCESS_MORE_AVAILABLE;
961 send_lookup_response (snc, 961 send_lookup_response (snc,
@@ -1001,11 +1001,11 @@ run_zone_iteration_round (struct ZoneIteration *zi)
1001 while (IT_START == proc.res_iteration_finished) 1001 while (IT_START == proc.res_iteration_finished)
1002 { 1002 {
1003 if (GNUNET_SYSERR == 1003 if (GNUNET_SYSERR ==
1004 (ret = GSN_database->iterate_records (GSN_database->cls, 1004 (ret = GSN_database->iterate_records (GSN_database->cls,
1005 (0 == memcmp (&zi->zone, &zero, sizeof (zero))) 1005 (0 == memcmp (&zi->zone, &zero, sizeof (zero)))
1006 ? NULL 1006 ? NULL
1007 : &zi->zone, 1007 : &zi->zone,
1008 zi->offset, 1008 zi->offset,
1009 &zone_iteraterate_proc, &proc))) 1009 &zone_iteraterate_proc, &proc)))
1010 { 1010 {
1011 GNUNET_break (0); 1011 GNUNET_break (0);
@@ -1027,10 +1027,10 @@ run_zone_iteration_round (struct ZoneIteration *zi)
1027 rrm.gns_header.header.size = htons (sizeof (rrm)); 1027 rrm.gns_header.header.size = htons (sizeof (rrm));
1028 rrm.gns_header.r_id = htonl (zi->request_id); 1028 rrm.gns_header.r_id = htonl (zi->request_id);
1029 GNUNET_SERVER_notification_context_unicast (snc, 1029 GNUNET_SERVER_notification_context_unicast (snc,
1030 zi->client->client, 1030 zi->client->client,
1031 &rrm.gns_header.header, 1031 &rrm.gns_header.header,
1032 GNUNET_NO); 1032 GNUNET_NO);
1033 GNUNET_CONTAINER_DLL_remove (zi->client->op_head, 1033 GNUNET_CONTAINER_DLL_remove (zi->client->op_head,
1034 zi->client->op_tail, 1034 zi->client->op_tail,
1035 zi); 1035 zi);
1036 GNUNET_free (zi); 1036 GNUNET_free (zi);
@@ -1159,7 +1159,7 @@ handle_iteration_next (void *cls,
1159 * Send 'sync' message to zone monitor, we're now in sync. 1159 * Send 'sync' message to zone monitor, we're now in sync.
1160 * 1160 *
1161 * @param zm monitor that is now in sync 1161 * @param zm monitor that is now in sync
1162 */ 1162 */
1163static void 1163static void
1164monitor_sync (struct ZoneMonitor *zm) 1164monitor_sync (struct ZoneMonitor *zm)
1165{ 1165{
@@ -1234,8 +1234,8 @@ handle_monitor_start (void *cls,
1234{ 1234{
1235 const struct ZoneMonitorStartMessage *zis_msg; 1235 const struct ZoneMonitorStartMessage *zis_msg;
1236 struct ZoneMonitor *zm; 1236 struct ZoneMonitor *zm;
1237 1237
1238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1238 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1239 "Received `%s' message\n", 1239 "Received `%s' message\n",
1240 "ZONE_MONITOR_START"); 1240 "ZONE_MONITOR_START");
1241 zis_msg = (const struct ZoneMonitorStartMessage *) message; 1241 zis_msg = (const struct ZoneMonitorStartMessage *) message;
@@ -1249,7 +1249,7 @@ handle_monitor_start (void *cls,
1249 GNUNET_SERVER_disable_receive_done_warning (client); 1249 GNUNET_SERVER_disable_receive_done_warning (client);
1250 GNUNET_SERVER_notification_context_add (monitor_nc, 1250 GNUNET_SERVER_notification_context_add (monitor_nc,
1251 client); 1251 client);
1252 zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm); 1252 zm->task = GNUNET_SCHEDULER_add_now (&monitor_next, zm);
1253} 1253}
1254 1254
1255 1255
@@ -1265,7 +1265,7 @@ monitor_next (void *cls,
1265{ 1265{
1266 struct ZoneMonitor *zm = cls; 1266 struct ZoneMonitor *zm = cls;
1267 int ret; 1267 int ret;
1268 1268
1269 zm->task = GNUNET_SCHEDULER_NO_TASK; 1269 zm->task = GNUNET_SCHEDULER_NO_TASK;
1270 ret = GSN_database->iterate_records (GSN_database->cls, 1270 ret = GSN_database->iterate_records (GSN_database->cls,
1271 &zm->zone, 1271 &zm->zone,
@@ -1332,7 +1332,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
1332 GNUNET_free (database); 1332 GNUNET_free (database);
1333 if (NULL == GSN_database) 1333 if (NULL == GSN_database)
1334 { 1334 {
1335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1336 "Could not load database backend `%s'\n", 1336 "Could not load database backend `%s'\n",
1337 db_lib_name); 1337 db_lib_name);
1338 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL); 1338 GNUNET_SCHEDULER_add_now (&cleanup_task, NULL);
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h
index a4b01a960..a8851e104 100644
--- a/src/namestore/namestore.h
+++ b/src/namestore/namestore.h
@@ -171,7 +171,7 @@ struct RecordStoreMessage
171 uint16_t rd_len GNUNET_PACKED; 171 uint16_t rd_len GNUNET_PACKED;
172 172
173 /** 173 /**
174 * Number of records contained 174 * Number of records contained
175 */ 175 */
176 uint16_t rd_count GNUNET_PACKED; 176 uint16_t rd_count GNUNET_PACKED;
177 177
@@ -221,12 +221,12 @@ struct ZoneToNameMessage
221 struct GNUNET_NAMESTORE_Header gns_header; 221 struct GNUNET_NAMESTORE_Header gns_header;
222 222
223 /** 223 /**
224 * The private key of the zone to look up in 224 * The private key of the zone to look up in
225 */ 225 */
226 struct GNUNET_CRYPTO_EccPrivateKey zone; 226 struct GNUNET_CRYPTO_EccPrivateKey zone;
227 227
228 /** 228 /**
229 * The public key of the target zone 229 * The public key of the target zone
230 */ 230 */
231 struct GNUNET_CRYPTO_EccPublicSignKey value_zone; 231 struct GNUNET_CRYPTO_EccPublicSignKey value_zone;
232}; 232};
@@ -259,7 +259,7 @@ struct ZoneToNameResponseMessage
259 259
260 /** 260 /**
261 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no 261 * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no
262 * results, #GNUNET_SYSERR on error 262 * results, #GNUNET_SYSERR on error
263 */ 263 */
264 int16_t res GNUNET_PACKED; 264 int16_t res GNUNET_PACKED;
265 265
@@ -297,7 +297,7 @@ struct RecordResultMessage
297 uint16_t rd_len GNUNET_PACKED; 297 uint16_t rd_len GNUNET_PACKED;
298 298
299 /** 299 /**
300 * Number of records contained 300 * Number of records contained
301 */ 301 */
302 uint16_t rd_count GNUNET_PACKED; 302 uint16_t rd_count GNUNET_PACKED;
303 303
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index a1d17835f..3df6f8210 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -272,11 +272,11 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
272 size_t size) 272 size_t size)
273{ 273{
274 struct GNUNET_NAMESTORE_Block *block; 274 struct GNUNET_NAMESTORE_Block *block;
275 char buf[size + sizeof (struct GNUNET_NAMESTORE_Block) 275 char buf[size + sizeof (struct GNUNET_NAMESTORE_Block)
276 - sizeof (struct LookupBlockResponseMessage)]; 276 - sizeof (struct LookupBlockResponseMessage)];
277 277
278 LOG (GNUNET_ERROR_TYPE_DEBUG, 278 LOG (GNUNET_ERROR_TYPE_DEBUG,
279 "Received `%s'\n", 279 "Received `%s'\n",
280 "LOOKUP_BLOCK_RESPONSE"); 280 "LOOKUP_BLOCK_RESPONSE");
281 if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us) 281 if (0 == GNUNET_TIME_absolute_ntoh (msg->expire).abs_value_us)
282 { 282 {
@@ -290,7 +290,7 @@ handle_lookup_block_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
290 block->signature = msg->signature; 290 block->signature = msg->signature;
291 block->derived_key = msg->derived_key; 291 block->derived_key = msg->derived_key;
292 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); 292 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
293 block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) + 293 block->purpose.size = htonl (size - sizeof (struct LookupBlockResponseMessage) +
294 sizeof (struct GNUNET_TIME_AbsoluteNBO) + 294 sizeof (struct GNUNET_TIME_AbsoluteNBO) +
295 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose)); 295 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
296 block->expiration_time = msg->expire; 296 block->expiration_time = msg->expire;
@@ -332,11 +332,11 @@ handle_block_cache_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
332 "BLOCK_CACHE_RESPONSE"); 332 "BLOCK_CACHE_RESPONSE");
333 res = ntohl (msg->op_result); 333 res = ntohl (msg->op_result);
334 /* TODO: add actual error message from namestore to response... */ 334 /* TODO: add actual error message from namestore to response... */
335 if (NULL != qe->cont) 335 if (NULL != qe->cont)
336 qe->cont (qe->cont_cls, 336 qe->cont (qe->cont_cls,
337 res, 337 res,
338 (GNUNET_OK == res) ? 338 (GNUNET_OK == res) ?
339 NULL 339 NULL
340 : _("Namestore failed to cache block")); 340 : _("Namestore failed to cache block"));
341 return GNUNET_OK; 341 return GNUNET_OK;
342} 342}
@@ -358,8 +358,8 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
358{ 358{
359 int res; 359 int res;
360 const char *emsg; 360 const char *emsg;
361 361
362 LOG (GNUNET_ERROR_TYPE_DEBUG, 362 LOG (GNUNET_ERROR_TYPE_DEBUG,
363 "Received `%s'\n", 363 "Received `%s'\n",
364 "RECORD_STORE_RESPONSE"); 364 "RECORD_STORE_RESPONSE");
365 /* TODO: add actual error message from namestore to response... */ 365 /* TODO: add actual error message from namestore to response... */
@@ -368,7 +368,7 @@ handle_record_store_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
368 emsg = _("Namestore failed to store record\n"); 368 emsg = _("Namestore failed to store record\n");
369 else 369 else
370 emsg = NULL; 370 emsg = NULL;
371 if (NULL != qe->cont) 371 if (NULL != qe->cont)
372 qe->cont (qe->cont_cls, res, emsg); 372 qe->cont (qe->cont_cls, res, emsg);
373 return GNUNET_OK; 373 return GNUNET_OK;
374} 374}
@@ -397,7 +397,7 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe,
397 unsigned int rd_count; 397 unsigned int rd_count;
398 398
399 LOG (GNUNET_ERROR_TYPE_DEBUG, 399 LOG (GNUNET_ERROR_TYPE_DEBUG,
400 "Received `%s'\n", 400 "Received `%s'\n",
401 "RECORD_RESULT"); 401 "RECORD_RESULT");
402 rd_len = ntohs (msg->rd_len); 402 rd_len = ntohs (msg->rd_len);
403 rd_count = ntohs (msg->rd_count); 403 rd_count = ntohs (msg->rd_count);
@@ -429,11 +429,11 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe,
429 if (0 == name_len) 429 if (0 == name_len)
430 name = NULL; 430 name = NULL;
431 if (NULL != qe->proc) 431 if (NULL != qe->proc)
432 qe->proc (qe->proc_cls, 432 qe->proc (qe->proc_cls,
433 &msg->private_key, 433 &msg->private_key,
434 name, 434 name,
435 rd_count, 435 rd_count,
436 (rd_count > 0) ? rd : NULL); 436 (rd_count > 0) ? rd : NULL);
437 } 437 }
438 return GNUNET_OK; 438 return GNUNET_OK;
439} 439}
@@ -461,7 +461,7 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
461 const char *name_tmp; 461 const char *name_tmp;
462 const char *rd_tmp; 462 const char *rd_tmp;
463 463
464 LOG (GNUNET_ERROR_TYPE_DEBUG, 464 LOG (GNUNET_ERROR_TYPE_DEBUG,
465 "Received `%s'\n", 465 "Received `%s'\n",
466 "ZONE_TO_NAME_RESPONSE"); 466 "ZONE_TO_NAME_RESPONSE");
467 res = ntohs (msg->res); 467 res = ntohs (msg->res);
@@ -472,11 +472,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
472 "An error occured during zone to name operation\n"); 472 "An error occured during zone to name operation\n");
473 break; 473 break;
474 case GNUNET_NO: 474 case GNUNET_NO:
475 LOG (GNUNET_ERROR_TYPE_DEBUG, 475 LOG (GNUNET_ERROR_TYPE_DEBUG,
476 "Namestore has no result for zone to name mapping \n"); 476 "Namestore has no result for zone to name mapping \n");
477 break; 477 break;
478 case GNUNET_YES: 478 case GNUNET_YES:
479 LOG (GNUNET_ERROR_TYPE_DEBUG, 479 LOG (GNUNET_ERROR_TYPE_DEBUG,
480 "Namestore has result for zone to name mapping \n"); 480 "Namestore has result for zone to name mapping \n");
481 name_len = ntohs (msg->name_len); 481 name_len = ntohs (msg->name_len);
482 rd_count = ntohs (msg->rd_count); 482 rd_count = ntohs (msg->rd_count);
@@ -499,10 +499,10 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
499 } 499 }
500 /* normal end, call continuation with result */ 500 /* normal end, call continuation with result */
501 if (NULL != qe->proc) 501 if (NULL != qe->proc)
502 qe->proc (qe->proc_cls, 502 qe->proc (qe->proc_cls,
503 &msg->zone, 503 &msg->zone,
504 name_tmp, 504 name_tmp,
505 rd_count, rd); 505 rd_count, rd);
506 /* return is important here: break would call continuation with error! */ 506 /* return is important here: break would call continuation with error! */
507 return GNUNET_OK; 507 return GNUNET_OK;
508 } 508 }
@@ -530,11 +530,11 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
530static int 530static int
531manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe, 531manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe,
532 const struct GNUNET_MessageHeader *msg, 532 const struct GNUNET_MessageHeader *msg,
533 uint16_t type, 533 uint16_t type,
534 size_t size) 534 size_t size)
535{ 535{
536 /* handle different message type */ 536 /* handle different message type */
537 switch (type) 537 switch (type)
538 { 538 {
539 case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE: 539 case GNUNET_MESSAGE_TYPE_NAMESTORE_LOOKUP_BLOCK_RESPONSE:
540 if (size < sizeof (struct LookupBlockResponseMessage)) 540 if (size < sizeof (struct LookupBlockResponseMessage))
@@ -601,7 +601,7 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
601 const char *name_tmp; 601 const char *name_tmp;
602 const char *rd_ser_tmp; 602 const char *rd_ser_tmp;
603 603
604 LOG (GNUNET_ERROR_TYPE_DEBUG, 604 LOG (GNUNET_ERROR_TYPE_DEBUG,
605 "Received `%s'\n", 605 "Received `%s'\n",
606 "ZONE_ITERATION_RESPONSE"); 606 "ZONE_ITERATION_RESPONSE");
607 msg_len = ntohs (msg->gns_header.header.size); 607 msg_len = ntohs (msg->gns_header.header.size);
@@ -614,8 +614,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
614 GNUNET_break (0); 614 GNUNET_break (0);
615 return GNUNET_SYSERR; 615 return GNUNET_SYSERR;
616 } 616 }
617 if ( (0 == name_len) && 617 if ( (0 == name_len) &&
618 (0 == (memcmp (&msg->private_key, 618 (0 == (memcmp (&msg->private_key,
619 &priv_dummy, 619 &priv_dummy,
620 sizeof (priv_dummy)))) ) 620 sizeof (priv_dummy)))) )
621 { 621 {
@@ -635,18 +635,18 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
635 { 635 {
636 struct GNUNET_NAMESTORE_RecordData rd[rd_count]; 636 struct GNUNET_NAMESTORE_RecordData rd[rd_count];
637 637
638 if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len, 638 if (GNUNET_OK != GNUNET_NAMESTORE_records_deserialize (rd_len,
639 rd_ser_tmp, 639 rd_ser_tmp,
640 rd_count, 640 rd_count,
641 rd)) 641 rd))
642 { 642 {
643 GNUNET_break (0); 643 GNUNET_break (0);
644 return GNUNET_SYSERR; 644 return GNUNET_SYSERR;
645 } 645 }
646 if (NULL != ze->proc) 646 if (NULL != ze->proc)
647 ze->proc (ze->proc_cls, 647 ze->proc (ze->proc_cls,
648 &msg->private_key, 648 &msg->private_key,
649 name_tmp, 649 name_tmp,
650 rd_count, rd); 650 rd_count, rd);
651 return GNUNET_YES; 651 return GNUNET_YES;
652 } 652 }
@@ -669,7 +669,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
669 int type, size_t size) 669 int type, size_t size)
670{ 670{
671 /* handle different message type */ 671 /* handle different message type */
672 switch (type) 672 switch (type)
673 { 673 {
674 case GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT: 674 case GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT:
675 if (size < sizeof (struct RecordResultMessage)) 675 if (size < sizeof (struct RecordResultMessage))
@@ -678,7 +678,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
678 return GNUNET_SYSERR; 678 return GNUNET_SYSERR;
679 } 679 }
680 return handle_zone_iteration_response (ze, 680 return handle_zone_iteration_response (ze,
681 (const struct RecordResultMessage *) msg, 681 (const struct RecordResultMessage *) msg,
682 size); 682 size);
683 default: 683 default:
684 GNUNET_break (0); 684 GNUNET_break (0);
@@ -695,7 +695,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
695 * @param msg message received, NULL on timeout or fatal error 695 * @param msg message received, NULL on timeout or fatal error
696 */ 696 */
697static void 697static void
698process_namestore_message (void *cls, 698process_namestore_message (void *cls,
699 const struct GNUNET_MessageHeader *msg) 699 const struct GNUNET_MessageHeader *msg)
700{ 700{
701 struct GNUNET_NAMESTORE_Handle *h = cls; 701 struct GNUNET_NAMESTORE_Handle *h = cls;
@@ -717,7 +717,7 @@ process_namestore_message (void *cls,
717 if (size < sizeof (struct GNUNET_NAMESTORE_Header)) 717 if (size < sizeof (struct GNUNET_NAMESTORE_Header))
718 { 718 {
719 GNUNET_break_op (0); 719 GNUNET_break_op (0);
720 GNUNET_CLIENT_receive (h->client, 720 GNUNET_CLIENT_receive (h->client,
721 &process_namestore_message, h, 721 &process_namestore_message, h,
722 GNUNET_TIME_UNIT_FOREVER_REL); 722 GNUNET_TIME_UNIT_FOREVER_REL);
723 return; 723 return;
@@ -726,9 +726,9 @@ process_namestore_message (void *cls,
726 r_id = ntohl (gm->r_id); 726 r_id = ntohl (gm->r_id);
727 727
728 LOG (GNUNET_ERROR_TYPE_DEBUG, 728 LOG (GNUNET_ERROR_TYPE_DEBUG,
729 "Received message type %u size %u op %u\n", 729 "Received message type %u size %u op %u\n",
730 (unsigned int) type, 730 (unsigned int) type,
731 (unsigned int) size, 731 (unsigned int) size,
732 (unsigned int) r_id); 732 (unsigned int) r_id);
733 733
734 /* Is it a record related operation ? */ 734 /* Is it a record related operation ? */
@@ -738,7 +738,7 @@ process_namestore_message (void *cls,
738 if (NULL != qe) 738 if (NULL != qe)
739 { 739 {
740 ret = manage_record_operations (qe, msg, type, size); 740 ret = manage_record_operations (qe, msg, type, size);
741 if (GNUNET_SYSERR == ret) 741 if (GNUNET_SYSERR == ret)
742 { 742 {
743 /* protocol error, need to reconnect */ 743 /* protocol error, need to reconnect */
744 h->reconnect = GNUNET_YES; 744 h->reconnect = GNUNET_YES;
@@ -802,8 +802,8 @@ do_transmit (struct GNUNET_NAMESTORE_Handle *h);
802 * @return number of bytes copied into @a buf 802 * @return number of bytes copied into @a buf
803 */ 803 */
804static size_t 804static size_t
805transmit_message_to_namestore (void *cls, 805transmit_message_to_namestore (void *cls,
806 size_t size, 806 size_t size,
807 void *buf) 807 void *buf)
808{ 808{
809 struct GNUNET_NAMESTORE_Handle *h = cls; 809 struct GNUNET_NAMESTORE_Handle *h = cls;
@@ -819,14 +819,14 @@ transmit_message_to_namestore (void *cls,
819 } 819 }
820 ret = 0; 820 ret = 0;
821 cbuf = buf; 821 cbuf = buf;
822 while ( (NULL != (p = h->pending_head)) && 822 while ( (NULL != (p = h->pending_head)) &&
823 (p->size <= size) ) 823 (p->size <= size) )
824 { 824 {
825 memcpy (&cbuf[ret], &p[1], p->size); 825 memcpy (&cbuf[ret], &p[1], p->size);
826 ret += p->size; 826 ret += p->size;
827 size -= p->size; 827 size -= p->size;
828 GNUNET_CONTAINER_DLL_remove (h->pending_head, 828 GNUNET_CONTAINER_DLL_remove (h->pending_head,
829 h->pending_tail, 829 h->pending_tail,
830 p); 830 p);
831 if (GNUNET_NO == h->is_receiving) 831 if (GNUNET_NO == h->is_receiving)
832 { 832 {
@@ -889,7 +889,7 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h)
889 * @param tc scheduler context 889 * @param tc scheduler context
890 */ 890 */
891static void 891static void
892reconnect_task (void *cls, 892reconnect_task (void *cls,
893 const struct GNUNET_SCHEDULER_TaskContext *tc) 893 const struct GNUNET_SCHEDULER_TaskContext *tc)
894{ 894{
895 struct GNUNET_NAMESTORE_Handle *h = cls; 895 struct GNUNET_NAMESTORE_Handle *h = cls;
@@ -1010,7 +1010,7 @@ GNUNET_NAMESTORE_disconnect (struct GNUNET_NAMESTORE_Handle *h)
1010 1010
1011/** 1011/**
1012 * Store an item in the namestore. If the item is already present, 1012 * Store an item in the namestore. If the item is already present,
1013 * it is replaced with the new record. 1013 * it is replaced with the new record.
1014 * 1014 *
1015 * @param h handle to the namestore 1015 * @param h handle to the namestore
1016 * @param block block to store 1016 * @param block block to store
@@ -1032,8 +1032,8 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h,
1032 size_t msg_size; 1032 size_t msg_size;
1033 1033
1034 GNUNET_assert (NULL != h); 1034 GNUNET_assert (NULL != h);
1035 blen = ntohl (block->purpose.size) 1035 blen = ntohl (block->purpose.size)
1036 - sizeof (struct GNUNET_TIME_AbsoluteNBO) 1036 - sizeof (struct GNUNET_TIME_AbsoluteNBO)
1037 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose); 1037 - sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose);
1038 rid = get_op_id (h); 1038 rid = get_op_id (h);
1039 qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry); 1039 qe = GNUNET_new (struct GNUNET_NAMESTORE_QueueEntry);
@@ -1055,9 +1055,9 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h,
1055 msg->signature = block->signature; 1055 msg->signature = block->signature;
1056 msg->derived_key = block->derived_key; 1056 msg->derived_key = block->derived_key;
1057 memcpy (&msg[1], &block[1], blen); 1057 memcpy (&msg[1], &block[1], blen);
1058 LOG (GNUNET_ERROR_TYPE_DEBUG, 1058 LOG (GNUNET_ERROR_TYPE_DEBUG,
1059 "Sending `%s' message with size %u and expiration %s\n", 1059 "Sending `%s' message with size %u and expiration %s\n",
1060 "NAMESTORE_BLOCK_CACHE", 1060 "NAMESTORE_BLOCK_CACHE",
1061 (unsigned int) msg_size, 1061 (unsigned int) msg_size,
1062 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (msg->expire))); 1062 GNUNET_STRINGS_absolute_time_to_string (GNUNET_TIME_absolute_ntoh (msg->expire)));
1063 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1063 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
@@ -1134,12 +1134,12 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1134 name_tmp = (char *) &msg[1]; 1134 name_tmp = (char *) &msg[1];
1135 memcpy (name_tmp, label, name_len); 1135 memcpy (name_tmp, label, name_len);
1136 rd_ser = &name_tmp[name_len]; 1136 rd_ser = &name_tmp[name_len];
1137 GNUNET_break (rd_ser_len == 1137 GNUNET_break (rd_ser_len ==
1138 GNUNET_NAMESTORE_records_serialize (rd_count, rd, 1138 GNUNET_NAMESTORE_records_serialize (rd_count, rd,
1139 rd_ser_len, 1139 rd_ser_len,
1140 rd_ser)); 1140 rd_ser));
1141 LOG (GNUNET_ERROR_TYPE_DEBUG, 1141 LOG (GNUNET_ERROR_TYPE_DEBUG,
1142 "Sending `%s' message for name `%s' with size %u and %u records\n", 1142 "Sending `%s' message for name `%s' with size %u and %u records\n",
1143 "NAMESTORE_RECORD_STORE", label, msg_size, 1143 "NAMESTORE_RECORD_STORE", label, msg_size,
1144 rd_count); 1144 rd_count);
1145 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1145 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
@@ -1150,7 +1150,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1150 1150
1151/** 1151/**
1152 * Get a result for a particular key from the namestore. The processor 1152 * Get a result for a particular key from the namestore. The processor
1153 * will only be called once. 1153 * will only be called once.
1154 * 1154 *
1155 * @param h handle to the namestore 1155 * @param h handle to the namestore
1156 * @param derived_hash hash of zone key combined with name to lookup 1156 * @param derived_hash hash of zone key combined with name to lookup
@@ -1160,7 +1160,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h,
1160 * @return a handle that can be used to cancel 1160 * @return a handle that can be used to cancel
1161 */ 1161 */
1162struct GNUNET_NAMESTORE_QueueEntry * 1162struct GNUNET_NAMESTORE_QueueEntry *
1163GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, 1163GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h,
1164 const struct GNUNET_HashCode *derived_hash, 1164 const struct GNUNET_HashCode *derived_hash,
1165 GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls) 1165 GNUNET_NAMESTORE_BlockProcessor proc, void *proc_cls)
1166{ 1166{
@@ -1328,7 +1328,7 @@ GNUNET_NAMESTORE_zone_iterator_next (struct GNUNET_NAMESTORE_ZoneIterator *it)
1328 msg->gns_header.header.size = htons (msg_size); 1328 msg->gns_header.header.size = htons (msg_size);
1329 msg->gns_header.r_id = htonl (it->op_id); 1329 msg->gns_header.r_id = htonl (it->op_id);
1330 LOG (GNUNET_ERROR_TYPE_DEBUG, 1330 LOG (GNUNET_ERROR_TYPE_DEBUG,
1331 "Sending `%s' message\n", 1331 "Sending `%s' message\n",
1332 "ZONE_ITERATION_NEXT"); 1332 "ZONE_ITERATION_NEXT");
1333 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1333 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
1334 do_transmit (h); 1334 do_transmit (h);
@@ -1360,8 +1360,8 @@ GNUNET_NAMESTORE_zone_iteration_stop (struct GNUNET_NAMESTORE_ZoneIterator *it)
1360 msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP); 1360 msg->gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP);
1361 msg->gns_header.header.size = htons (msg_size); 1361 msg->gns_header.header.size = htons (msg_size);
1362 msg->gns_header.r_id = htonl (it->op_id); 1362 msg->gns_header.r_id = htonl (it->op_id);
1363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1363 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1364 "Sending `%s' message\n", 1364 "Sending `%s' message\n",
1365 "ZONE_ITERATION_STOP"); 1365 "ZONE_ITERATION_STOP");
1366 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe); 1366 GNUNET_CONTAINER_DLL_insert_tail (h->pending_head, h->pending_tail, pe);
1367 do_transmit (h); 1367 do_transmit (h);
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c
index 5cadf8997..bf853ccdf 100644
--- a/src/namestore/namestore_api_common.c
+++ b/src/namestore/namestore_api_common.c
@@ -68,7 +68,7 @@ struct NetworkRecord
68 * Flags for the record, network byte order. 68 * Flags for the record, network byte order.
69 */ 69 */
70 uint32_t flags GNUNET_PACKED; 70 uint32_t flags GNUNET_PACKED;
71 71
72}; 72};
73 73
74GNUNET_NETWORK_STRUCT_END 74GNUNET_NETWORK_STRUCT_END
@@ -103,7 +103,7 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z)
103 static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; 103 static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8];
104 char *end; 104 char *end;
105 105
106 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, 106 end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z,
107 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 107 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
108 buf, sizeof (buf)); 108 buf, sizeof (buf));
109 if (NULL == end) 109 if (NULL == end)
@@ -137,7 +137,7 @@ GNUNET_NAMESTORE_records_get_size (unsigned int rd_count,
137 GNUNET_assert ((ret + rd[i].data_size) >= ret); 137 GNUNET_assert ((ret + rd[i].data_size) >= ret);
138 ret += rd[i].data_size; 138 ret += rd[i].data_size;
139 } 139 }
140 return ret; 140 return ret;
141} 141}
142 142
143 143
@@ -159,7 +159,7 @@ GNUNET_NAMESTORE_records_serialize (unsigned int rd_count,
159 struct NetworkRecord rec; 159 struct NetworkRecord rec;
160 unsigned int i; 160 unsigned int i;
161 size_t off; 161 size_t off;
162 162
163 off = 0; 163 off = 0;
164 for (i=0;i<rd_count;i++) 164 for (i=0;i<rd_count;i++)
165 { 165 {
@@ -211,11 +211,11 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
211 { 211 {
212 LOG (GNUNET_ERROR_TYPE_DEBUG, 212 LOG (GNUNET_ERROR_TYPE_DEBUG,
213 "Expiration time %llu != %llu\n", 213 "Expiration time %llu != %llu\n",
214 a->expiration_time, 214 a->expiration_time,
215 b->expiration_time); 215 b->expiration_time);
216 return GNUNET_NO; 216 return GNUNET_NO;
217 } 217 }
218 if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS) 218 if ((a->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)
219 != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS)) 219 != (b->flags & GNUNET_NAMESTORE_RF_RCMP_FLAGS))
220 { 220 {
221 LOG (GNUNET_ERROR_TYPE_DEBUG, 221 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -227,8 +227,8 @@ GNUNET_NAMESTORE_records_cmp (const struct GNUNET_NAMESTORE_RecordData *a,
227 if (a->data_size != b->data_size) 227 if (a->data_size != b->data_size)
228 { 228 {
229 LOG (GNUNET_ERROR_TYPE_DEBUG, 229 LOG (GNUNET_ERROR_TYPE_DEBUG,
230 "Data size %lu != %lu\n", 230 "Data size %lu != %lu\n",
231 a->data_size, 231 a->data_size,
232 b->data_size); 232 b->data_size);
233 return GNUNET_NO; 233 return GNUNET_NO;
234 } 234 }
@@ -262,7 +262,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
262 struct NetworkRecord rec; 262 struct NetworkRecord rec;
263 unsigned int i; 263 unsigned int i;
264 size_t off; 264 size_t off;
265 265
266 off = 0; 266 off = 0;
267 for (i=0;i<rd_count;i++) 267 for (i=0;i<rd_count;i++)
268 { 268 {
@@ -284,7 +284,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
284 dest[i].flags, 284 dest[i].flags,
285 (unsigned long long) dest[i].expiration_time); 285 (unsigned long long) dest[i].expiration_time);
286 } 286 }
287 return GNUNET_OK; 287 return GNUNET_OK;
288} 288}
289 289
290 290
@@ -298,7 +298,7 @@ GNUNET_NAMESTORE_records_deserialize (size_t len,
298 * @return absolute expiration time 298 * @return absolute expiration time
299 */ 299 */
300struct GNUNET_TIME_Absolute 300struct GNUNET_TIME_Absolute
301GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count, 301GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
302 const struct GNUNET_NAMESTORE_RecordData *rd) 302 const struct GNUNET_NAMESTORE_RecordData *rd)
303{ 303{
304 unsigned int c; 304 unsigned int c;
@@ -309,7 +309,7 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
309 if (NULL == rd) 309 if (NULL == rd)
310 return GNUNET_TIME_UNIT_ZERO_ABS; 310 return GNUNET_TIME_UNIT_ZERO_ABS;
311 expire = GNUNET_TIME_UNIT_FOREVER_ABS; 311 expire = GNUNET_TIME_UNIT_FOREVER_ABS;
312 for (c = 0; c < rd_count; c++) 312 for (c = 0; c < rd_count; c++)
313 { 313 {
314 if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION)) 314 if (0 != (rd[c].flags & GNUNET_NAMESTORE_RF_RELATIVE_EXPIRATION))
315 { 315 {
@@ -320,7 +320,7 @@ GNUNET_NAMESTORE_record_get_expiration_time (unsigned int rd_count,
320 { 320 {
321 at.abs_value_us = rd[c].expiration_time; 321 at.abs_value_us = rd[c].expiration_time;
322 } 322 }
323 expire = GNUNET_TIME_absolute_min (at, expire); 323 expire = GNUNET_TIME_absolute_min (at, expire);
324 } 324 }
325 LOG (GNUNET_ERROR_TYPE_DEBUG, 325 LOG (GNUNET_ERROR_TYPE_DEBUG,
326 "Determined expiration time for block with %u records to be %s\n", 326 "Determined expiration time for block with %u records to be %s\n",
@@ -392,10 +392,10 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key,
392 memcpy (payload, &rd_count_nbo, sizeof (uint32_t)); 392 memcpy (payload, &rd_count_nbo, sizeof (uint32_t));
393 GNUNET_assert (payload_len == 393 GNUNET_assert (payload_len ==
394 GNUNET_NAMESTORE_records_serialize (rd_count, rd, 394 GNUNET_NAMESTORE_records_serialize (rd_count, rd,
395 payload_len, &payload[sizeof (uint32_t)])); 395 payload_len, &payload[sizeof (uint32_t)]));
396 block = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Block) + 396 block = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_Block) +
397 sizeof (uint32_t) + payload_len); 397 sizeof (uint32_t) + payload_len);
398 block->purpose.size = htonl (sizeof (uint32_t) + payload_len + 398 block->purpose.size = htonl (sizeof (uint32_t) + payload_len +
399 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 399 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
400 sizeof (struct GNUNET_TIME_AbsoluteNBO)); 400 sizeof (struct GNUNET_TIME_AbsoluteNBO));
401 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); 401 block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN);
@@ -436,8 +436,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key,
436 */ 436 */
437int 437int
438GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) 438GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block)
439{ 439{
440 return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, 440 return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN,
441 &block->purpose, 441 &block->purpose,
442 &block->signature, 442 &block->signature,
443 &block->derived_key); 443 &block->derived_key);
@@ -452,7 +452,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block)
452 * @param label the name for the records 452 * @param label the name for the records
453 * @param proc function to call with the result 453 * @param proc function to call with the result
454 * @param proc_cls closure for proc 454 * @param proc_cls closure for proc
455 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was 455 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was
456 * not well-formed 456 * not well-formed
457 */ 457 */
458int 458int
@@ -468,7 +468,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
468 struct GNUNET_CRYPTO_SymmetricInitializationVector iv; 468 struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
469 struct GNUNET_CRYPTO_SymmetricSessionKey skey; 469 struct GNUNET_CRYPTO_SymmetricSessionKey skey;
470 470
471 if (ntohl (block->purpose.size) < 471 if (ntohl (block->purpose.size) <
472 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + 472 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
473 sizeof (struct GNUNET_TIME_AbsoluteNBO)) 473 sizeof (struct GNUNET_TIME_AbsoluteNBO))
474 { 474 {
@@ -477,7 +477,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
477 } 477 }
478 derive_block_aes_key (&iv, &skey, label, zone_key); 478 derive_block_aes_key (&iv, &skey, label, zone_key);
479 { 479 {
480 char payload[payload_len]; 480 char payload[payload_len];
481 uint32_t rd_count; 481 uint32_t rd_count;
482 482
483 GNUNET_break (payload_len == 483 GNUNET_break (payload_len ==
@@ -496,7 +496,7 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
496 } 496 }
497 { 497 {
498 struct GNUNET_NAMESTORE_RecordData rd[rd_count]; 498 struct GNUNET_NAMESTORE_RecordData rd[rd_count];
499 499
500 if (GNUNET_OK != 500 if (GNUNET_OK !=
501 GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t), 501 GNUNET_NAMESTORE_records_deserialize (payload_len - sizeof (uint32_t),
502 &payload[sizeof (uint32_t)], 502 &payload[sizeof (uint32_t)],
@@ -555,7 +555,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
555 { 555 {
556 GNUNET_break_op (0); 556 GNUNET_break_op (0);
557 return NULL; 557 return NULL;
558 } 558 }
559 return ns; 559 return ns;
560 } 560 }
561 case GNUNET_DNSPARSER_TYPE_CNAME: 561 case GNUNET_DNSPARSER_TYPE_CNAME:
@@ -572,7 +572,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
572 { 572 {
573 GNUNET_break_op (0); 573 GNUNET_break_op (0);
574 return NULL; 574 return NULL;
575 } 575 }
576 return cname; 576 return cname;
577 } 577 }
578 case GNUNET_DNSPARSER_TYPE_SOA: 578 case GNUNET_DNSPARSER_TYPE_SOA:
@@ -590,13 +590,13 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
590 GNUNET_break_op (0); 590 GNUNET_break_op (0);
591 return NULL; 591 return NULL;
592 } 592 }
593 GNUNET_asprintf (&result, 593 GNUNET_asprintf (&result,
594 "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", 594 "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu",
595 soa->rname, 595 soa->rname,
596 soa->mname, 596 soa->mname,
597 soa->serial, 597 soa->serial,
598 soa->refresh, 598 soa->refresh,
599 soa->retry, 599 soa->retry,
600 soa->expire, 600 soa->expire,
601 soa->minimum_ttl); 601 soa->minimum_ttl);
602 GNUNET_DNSPARSER_free_soa (soa); 602 GNUNET_DNSPARSER_free_soa (soa);
@@ -616,7 +616,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
616 { 616 {
617 GNUNET_break_op (0); 617 GNUNET_break_op (0);
618 return NULL; 618 return NULL;
619 } 619 }
620 return ptr; 620 return ptr;
621 } 621 }
622 case GNUNET_DNSPARSER_TYPE_MX: 622 case GNUNET_DNSPARSER_TYPE_MX:
@@ -634,8 +634,8 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
634 GNUNET_break_op (0); 634 GNUNET_break_op (0);
635 return NULL; 635 return NULL;
636 } 636 }
637 GNUNET_asprintf (&result, 637 GNUNET_asprintf (&result,
638 "%hu,%s", 638 "%hu,%s",
639 mx->preference, 639 mx->preference,
640 mx->mxhost); 640 mx->mxhost);
641 GNUNET_DNSPARSER_free_mx (mx); 641 GNUNET_DNSPARSER_free_mx (mx);
@@ -710,7 +710,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
710 { 710 {
711 GNUNET_break_op (0); 711 GNUNET_break_op (0);
712 return NULL; 712 return NULL;
713 } 713 }
714 return ns; 714 return ns;
715 } 715 }
716 case GNUNET_DNSPARSER_TYPE_SRV: 716 case GNUNET_DNSPARSER_TYPE_SRV:
@@ -729,7 +729,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
729 GNUNET_break_op (0); 729 GNUNET_break_op (0);
730 return NULL; 730 return NULL;
731 } 731 }
732 GNUNET_asprintf (&result, 732 GNUNET_asprintf (&result,
733 "%d %d %d _%s._%s.%s", 733 "%d %d %d _%s._%s.%s",
734 srv->priority, 734 srv->priority,
735 srv->weight, 735 srv->weight,
@@ -750,7 +750,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
750 ('\0' != cdata[data_size - 1]) ) 750 ('\0' != cdata[data_size - 1]) )
751 return NULL; /* malformed */ 751 return NULL; /* malformed */
752 tlsa = data; 752 tlsa = data;
753 if (0 == GNUNET_asprintf (&tlsa_str, 753 if (0 == GNUNET_asprintf (&tlsa_str,
754 "%c %c %c %s", 754 "%c %c %c %s",
755 tlsa->usage, 755 tlsa->usage,
756 tlsa->selector, 756 tlsa->selector,
@@ -794,7 +794,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
794 char s_peer[103 + 1]; 794 char s_peer[103 + 1];
795 char s_serv[253 + 1]; 795 char s_serv[253 + 1];
796 unsigned int proto; 796 unsigned int proto;
797 797
798 if (NULL == s) 798 if (NULL == s)
799 return GNUNET_SYSERR; 799 return GNUNET_SYSERR;
800 switch (type) 800 switch (type)
@@ -820,7 +820,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
820 { 820 {
821 char nsbuf[256]; 821 char nsbuf[256];
822 size_t off; 822 size_t off;
823 823
824 off = 0; 824 off = 0;
825 if (GNUNET_OK != 825 if (GNUNET_OK !=
826 GNUNET_DNSPARSER_builder_add_name (nsbuf, 826 GNUNET_DNSPARSER_builder_add_name (nsbuf,
@@ -842,7 +842,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
842 { 842 {
843 char cnamebuf[256]; 843 char cnamebuf[256];
844 size_t off; 844 size_t off;
845 845
846 off = 0; 846 off = 0;
847 if (GNUNET_OK != 847 if (GNUNET_OK !=
848 GNUNET_DNSPARSER_builder_add_name (cnamebuf, 848 GNUNET_DNSPARSER_builder_add_name (cnamebuf,
@@ -873,7 +873,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
873 unsigned int soa_min; 873 unsigned int soa_min;
874 size_t off; 874 size_t off;
875 875
876 if (7 != SSCANF (s, 876 if (7 != SSCANF (s,
877 "rname=%253s mname=%253s %u,%u,%u,%u,%u", 877 "rname=%253s mname=%253s %u,%u,%u,%u,%u",
878 soa_rname, soa_mname, 878 soa_rname, soa_mname,
879 &soa_serial, &soa_refresh, &soa_retry, &soa_expire, &soa_min)) 879 &soa_serial, &soa_refresh, &soa_retry, &soa_expire, &soa_min))
@@ -912,7 +912,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
912 { 912 {
913 char ptrbuf[256]; 913 char ptrbuf[256];
914 size_t off; 914 size_t off;
915 915
916 off = 0; 916 off = 0;
917 if (GNUNET_OK != 917 if (GNUNET_OK !=
918 GNUNET_DNSPARSER_builder_add_name (ptrbuf, 918 GNUNET_DNSPARSER_builder_add_name (ptrbuf,
@@ -970,7 +970,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
970 *data_size = strlen (s); 970 *data_size = strlen (s);
971 return GNUNET_OK; 971 return GNUNET_OK;
972 case GNUNET_DNSPARSER_TYPE_AAAA: 972 case GNUNET_DNSPARSER_TYPE_AAAA:
973 if (1 != inet_pton (AF_INET6, s, &value_aaaa)) 973 if (1 != inet_pton (AF_INET6, s, &value_aaaa))
974 { 974 {
975 LOG (GNUNET_ERROR_TYPE_ERROR, 975 LOG (GNUNET_ERROR_TYPE_ERROR,
976 _("Unable to parse IPv6 address `%s'\n"), 976 _("Unable to parse IPv6 address `%s'\n"),
@@ -1005,7 +1005,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1005 (1 != sscanf (s, "%u-", &line)) || 1005 (1 != sscanf (s, "%u-", &line)) ||
1006 (GNUNET_OK != 1006 (GNUNET_OK !=
1007 GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, 1007 GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1,
1008 strlen (dash + 1), 1008 strlen (dash + 1),
1009 &peer.public_key)) ) 1009 &peer.public_key)) )
1010 { 1010 {
1011 LOG (GNUNET_ERROR_TYPE_ERROR, 1011 LOG (GNUNET_ERROR_TYPE_ERROR,
@@ -1055,7 +1055,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1055 { 1055 {
1056 char nsbuf[256]; 1056 char nsbuf[256];
1057 size_t off; 1057 size_t off;
1058 1058
1059 off = 0; 1059 off = 0;
1060 if (GNUNET_OK != 1060 if (GNUNET_OK !=
1061 GNUNET_DNSPARSER_builder_add_name (nsbuf, 1061 GNUNET_DNSPARSER_builder_add_name (nsbuf,
@@ -1083,7 +1083,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1083 (char*)&tlsa[1])) 1083 (char*)&tlsa[1]))
1084 { 1084 {
1085 LOG (GNUNET_ERROR_TYPE_ERROR, 1085 LOG (GNUNET_ERROR_TYPE_ERROR,
1086 _("Unable to parse TLSA record string `%s'\n"), 1086 _("Unable to parse TLSA record string `%s'\n"),
1087 s); 1087 s);
1088 *data_size = 0; 1088 *data_size = 0;
1089 GNUNET_free (tlsa); 1089 GNUNET_free (tlsa);
@@ -1103,9 +1103,9 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type,
1103 * Mapping of record type numbers to human-readable 1103 * Mapping of record type numbers to human-readable
1104 * record type names. 1104 * record type names.
1105 */ 1105 */
1106static struct { 1106static struct {
1107 const char *name; 1107 const char *name;
1108 uint32_t number; 1108 uint32_t number;
1109} name_map[] = { 1109} name_map[] = {
1110 { "A", GNUNET_DNSPARSER_TYPE_A }, 1110 { "A", GNUNET_DNSPARSER_TYPE_A },
1111 { "NS", GNUNET_DNSPARSER_TYPE_NS }, 1111 { "NS", GNUNET_DNSPARSER_TYPE_NS },
@@ -1141,7 +1141,7 @@ GNUNET_NAMESTORE_typename_to_number (const char *dns_typename)
1141 while ( (name_map[i].name != NULL) && 1141 while ( (name_map[i].name != NULL) &&
1142 (0 != strcasecmp (dns_typename, name_map[i].name)) ) 1142 (0 != strcasecmp (dns_typename, name_map[i].name)) )
1143 i++; 1143 i++;
1144 return name_map[i].number; 1144 return name_map[i].number;
1145} 1145}
1146 1146
1147 1147
@@ -1160,13 +1160,13 @@ GNUNET_NAMESTORE_number_to_typename (uint32_t type)
1160 while ( (name_map[i].name != NULL) && 1160 while ( (name_map[i].name != NULL) &&
1161 (type != name_map[i].number) ) 1161 (type != name_map[i].number) )
1162 i++; 1162 i++;
1163 return name_map[i].name; 1163 return name_map[i].name;
1164} 1164}
1165 1165
1166 1166
1167/** 1167/**
1168 * Test if a given record is expired. 1168 * Test if a given record is expired.
1169 * 1169 *
1170 * @return #GNUNET_YES if the record is expired, 1170 * @return #GNUNET_YES if the record is expired,
1171 * #GNUNET_NO if not 1171 * #GNUNET_NO if not
1172 */ 1172 */
@@ -1184,7 +1184,7 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd)
1184 1184
1185/** 1185/**
1186 * Calculate the DHT query for a given @a label in a given @a zone. 1186 * Calculate the DHT query for a given @a label in a given @a zone.
1187 * 1187 *
1188 * @param zone private key of the zone 1188 * @param zone private key of the zone
1189 * @param label label of the record 1189 * @param label label of the record
1190 * @param query hash to use for the query 1190 * @param query hash to use for the query
@@ -1203,7 +1203,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe
1203 1203
1204/** 1204/**
1205 * Calculate the DHT query for a given @a label in a given @a zone. 1205 * Calculate the DHT query for a given @a label in a given @a zone.
1206 * 1206 *
1207 * @param pub public key of the zone 1207 * @param pub public key of the zone
1208 * @param label label of the record 1208 * @param label label of the record
1209 * @param query hash to use for the query 1209 * @param query hash to use for the query
@@ -1222,12 +1222,12 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign
1222 1222
1223/** 1223/**
1224 * Convert public key to the respective absolute domain name in the 1224 * Convert public key to the respective absolute domain name in the
1225 * ".zkey" pTLD. 1225 * ".zkey" pTLD.
1226 * This is one of the very few calls in the entire API that is 1226 * This is one of the very few calls in the entire API that is
1227 * NOT reentrant! 1227 * NOT reentrant!
1228 * 1228 *
1229 * @param pkey a public key with a point on the eliptic curve 1229 * @param pkey a public key with a point on the eliptic curve
1230 * @return string "X.zkey" where X is the public 1230 * @return string "X.zkey" where X is the public
1231 * key in an encoding suitable for DNS labels. 1231 * key in an encoding suitable for DNS labels.
1232 */ 1232 */
1233const char * 1233const char *
@@ -1249,10 +1249,10 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey
1249/** 1249/**
1250 * Convert an absolute domain name in the ".zkey" pTLD to the 1250 * Convert an absolute domain name in the ".zkey" pTLD to the
1251 * respective public key. 1251 * respective public key.
1252 * 1252 *
1253 * @param zkey string "X.zkey" where X is the coordinates of the public 1253 * @param zkey string "X.zkey" where X is the coordinates of the public
1254 * key in an encoding suitable for DNS labels. 1254 * key in an encoding suitable for DNS labels.
1255 * @param pkey set to a public key on the eliptic curve 1255 * @param pkey set to a public key on the eliptic curve
1256 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax 1256 * @return #GNUNET_SYSERR if @a zkey has the wrong syntax
1257 */ 1257 */
1258int 1258int
@@ -1262,13 +1262,13 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
1262 char *cpy; 1262 char *cpy;
1263 char *dot; 1263 char *dot;
1264 const char *x; 1264 const char *x;
1265 1265
1266 cpy = GNUNET_strdup (zkey); 1266 cpy = GNUNET_strdup (zkey);
1267 x = cpy; 1267 x = cpy;
1268 if (NULL == (dot = strchr (x, (int) '.'))) 1268 if (NULL == (dot = strchr (x, (int) '.')))
1269 goto error; 1269 goto error;
1270 *dot = '\0'; 1270 *dot = '\0';
1271 if (0 != strcasecmp (dot + 1, 1271 if (0 != strcasecmp (dot + 1,
1272 "zkey")) 1272 "zkey"))
1273 goto error; 1273 goto error;
1274 1274
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c
index c6509941f..ccf556abd 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -193,14 +193,14 @@ handle_updates (void *cls,
193 GNUNET_break (0); 193 GNUNET_break (0);
194 reconnect (zm); 194 reconnect (zm);
195 return; 195 return;
196 } 196 }
197 GNUNET_CLIENT_receive (zm->h, 197 GNUNET_CLIENT_receive (zm->h,
198 &handle_updates, 198 &handle_updates,
199 zm, 199 zm,
200 GNUNET_TIME_UNIT_FOREVER_REL); 200 GNUNET_TIME_UNIT_FOREVER_REL);
201 zm->monitor (zm->cls, 201 zm->monitor (zm->cls,
202 &lrm->private_key, 202 &lrm->private_key,
203 name_tmp, 203 name_tmp,
204 rd_count, rd); 204 rd_count, rd);
205 } 205 }
206} 206}
@@ -224,7 +224,7 @@ transmit_monitor_message (void *cls,
224 224
225 zm->th = NULL; 225 zm->th = NULL;
226 if (size < sizeof (struct ZoneMonitorStartMessage)) 226 if (size < sizeof (struct ZoneMonitorStartMessage))
227 { 227 {
228 reconnect (zm); 228 reconnect (zm);
229 return 0; 229 return 0;
230 } 230 }
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index b3a8f59ea..92e3a8d8a 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -91,7 +91,7 @@ create_indices (PGconn * dbh)
91 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_name_rv ON ns091records (record_name_hash,rvalue)")) || 91 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_name_rv ON ns091records (record_name_hash,rvalue)")) ||
92 (GNUNET_OK != 92 (GNUNET_OK !=
93 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_rv ON ns091records (rvalue)")) ) 93 GNUNET_POSTGRES_exec (dbh, "CREATE INDEX ir_rv ON ns091records (rvalue)")) )
94 LOG (GNUNET_ERROR_TYPE_ERROR, 94 LOG (GNUNET_ERROR_TYPE_ERROR,
95 _("Failed to create indices\n")); 95 _("Failed to create indices\n"));
96} 96}
97 97
@@ -113,7 +113,7 @@ database_setup (struct Plugin *plugin)
113 "namestore-postgres"); 113 "namestore-postgres");
114 if (NULL == plugin->dbh) 114 if (NULL == plugin->dbh)
115 return GNUNET_SYSERR; 115 return GNUNET_SYSERR;
116 if (GNUNET_YES == 116 if (GNUNET_YES ==
117 GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg, 117 GNUNET_CONFIGURATION_get_value_yesno (plugin->cfg,
118 "namestore-postgres", 118 "namestore-postgres",
119 "TEMPORARY_TABLE")) 119 "TEMPORARY_TABLE"))
@@ -121,15 +121,15 @@ database_setup (struct Plugin *plugin)
121 res = 121 res =
122 PQexec (plugin->dbh, 122 PQexec (plugin->dbh,
123 "CREATE TEMPORARY TABLE ns091records (" 123 "CREATE TEMPORARY TABLE ns091records ("
124 " zone_key BYTEA NOT NULL DEFAULT ''," 124 " zone_key BYTEA NOT NULL DEFAULT '',"
125 " zone_delegation BYTEA NOT NULL DEFAULT ''," 125 " zone_delegation BYTEA NOT NULL DEFAULT '',"
126 " zone_hash BYTEA NOT NULL DEFAULT ''," 126 " zone_hash BYTEA NOT NULL DEFAULT '',"
127 " record_count INTEGER NOT NULL DEFAULT 0," 127 " record_count INTEGER NOT NULL DEFAULT 0,"
128 " record_data BYTEA NOT NULL DEFAULT ''," 128 " record_data BYTEA NOT NULL DEFAULT '',"
129 " block_expiration_time BIGINT NOT NULL DEFAULT 0," 129 " block_expiration_time BIGINT NOT NULL DEFAULT 0,"
130 " signature BYTEA NOT NULL DEFAULT ''," 130 " signature BYTEA NOT NULL DEFAULT '',"
131 " record_name TEXT NOT NULL DEFAULT ''," 131 " record_name TEXT NOT NULL DEFAULT '',"
132 " record_name_hash BYTEA NOT NULL DEFAULT ''," 132 " record_name_hash BYTEA NOT NULL DEFAULT '',"
133 " rvalue BIGINT NOT NULL DEFAULT 0" 133 " rvalue BIGINT NOT NULL DEFAULT 0"
134 ")" "WITH OIDS"); 134 ")" "WITH OIDS");
135 } 135 }
@@ -137,15 +137,15 @@ database_setup (struct Plugin *plugin)
137 res = 137 res =
138 PQexec (plugin->dbh, 138 PQexec (plugin->dbh,
139 "CREATE TABLE ns091records (" 139 "CREATE TABLE ns091records ("
140 " zone_key BYTEA NOT NULL DEFAULT ''," 140 " zone_key BYTEA NOT NULL DEFAULT '',"
141 " zone_delegation BYTEA NOT NULL DEFAULT ''," 141 " zone_delegation BYTEA NOT NULL DEFAULT '',"
142 " zone_hash BYTEA NOT NULL DEFAULT ''," 142 " zone_hash BYTEA NOT NULL DEFAULT '',"
143 " record_count INTEGER NOT NULL DEFAULT 0," 143 " record_count INTEGER NOT NULL DEFAULT 0,"
144 " record_data BYTEA NOT NULL DEFAULT ''," 144 " record_data BYTEA NOT NULL DEFAULT '',"
145 " block_expiration_time BIGINT NOT NULL DEFAULT 0," 145 " block_expiration_time BIGINT NOT NULL DEFAULT 0,"
146 " signature BYTEA NOT NULL DEFAULT ''," 146 " signature BYTEA NOT NULL DEFAULT '',"
147 " record_name TEXT NOT NULL DEFAULT ''," 147 " record_name TEXT NOT NULL DEFAULT '',"
148 " record_name_hash BYTEA NOT NULL DEFAULT ''," 148 " record_name_hash BYTEA NOT NULL DEFAULT '',"
149 " rvalue BIGINT NOT NULL DEFAULT 0" 149 " rvalue BIGINT NOT NULL DEFAULT 0"
150 ")" "WITH OIDS"); 150 ")" "WITH OIDS");
151 151
@@ -167,7 +167,7 @@ database_setup (struct Plugin *plugin)
167 if ((GNUNET_OK != 167 if ((GNUNET_OK !=
168 GNUNET_POSTGRES_prepare (plugin->dbh, 168 GNUNET_POSTGRES_prepare (plugin->dbh,
169 "put_records", 169 "put_records",
170 "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature" 170 "INSERT INTO ns091records (zone_key, record_name, record_count, record_data, block_expiration_time, signature"
171 ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES " 171 ", zone_delegation, zone_hash, record_name_hash, rvalue) VALUES "
172 "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) || 172 "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)", 10)) ||
173 (GNUNET_OK != 173 (GNUNET_OK !=
@@ -177,22 +177,22 @@ database_setup (struct Plugin *plugin)
177 (GNUNET_OK != 177 (GNUNET_OK !=
178 GNUNET_POSTGRES_prepare (plugin->dbh, 178 GNUNET_POSTGRES_prepare (plugin->dbh,
179 "iterate_records", 179 "iterate_records",
180 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 180 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
181 " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) || 181 " FROM ns091records WHERE zone_hash=$1 AND record_name_hash=$2 ORDER BY rvalue LIMIT 1 OFFSET $3", 3)) ||
182 (GNUNET_OK != 182 (GNUNET_OK !=
183 GNUNET_POSTGRES_prepare (plugin->dbh, 183 GNUNET_POSTGRES_prepare (plugin->dbh,
184 "iterate_by_zone", 184 "iterate_by_zone",
185 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 185 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
186 " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || 186 " FROM ns091records WHERE zone_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) ||
187 (GNUNET_OK != 187 (GNUNET_OK !=
188 GNUNET_POSTGRES_prepare (plugin->dbh, 188 GNUNET_POSTGRES_prepare (plugin->dbh,
189 "iterate_by_name", 189 "iterate_by_name",
190 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 190 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
191 " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) || 191 " FROM ns091records WHERE record_name_hash=$1 ORDER BY rvalue LIMIT 1 OFFSET $2", 2)) ||
192 (GNUNET_OK != 192 (GNUNET_OK !=
193 GNUNET_POSTGRES_prepare (plugin->dbh, 193 GNUNET_POSTGRES_prepare (plugin->dbh,
194 "iterate_all", 194 "iterate_all",
195 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature" 195 "SELECT zone_key, record_name, record_count, record_data, block_expiration_time, signature"
196 " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) || 196 " FROM ns091records ORDER BY rvalue LIMIT 1 OFFSET $1", 1)) ||
197 (GNUNET_OK != 197 (GNUNET_OK !=
198 GNUNET_POSTGRES_prepare (plugin->dbh, 198 GNUNET_POSTGRES_prepare (plugin->dbh,
@@ -223,8 +223,8 @@ TODO: removed
223 * @param name name to remove (at most 255 characters long) 223 * @param name name to remove (at most 255 characters long)
224 * @return GNUNET_OK on success 224 * @return GNUNET_OK on success
225 */ 225 */
226static int 226static int
227namestore_postgres_remove_records (void *cls, 227namestore_postgres_remove_records (void *cls,
228 const struct GNUNET_CRYPTO_ShortHashCode *zone, 228 const struct GNUNET_CRYPTO_ShortHashCode *zone,
229 const char *name) 229 const char *name)
230{ 230{
@@ -267,12 +267,12 @@ namestore_postgres_remove_records (void *cls,
267 * @param name name that is being mapped (at most 255 characters long) 267 * @param name name that is being mapped (at most 255 characters long)
268 * @param rd_count number of entries in 'rd' array 268 * @param rd_count number of entries in 'rd' array
269 * @param rd array of records with data to store 269 * @param rd array of records with data to store
270 * @param signature signature of the record block, NULL if signature is unavailable (i.e. 270 * @param signature signature of the record block, NULL if signature is unavailable (i.e.
271 * because the user queried for a particular record type only) 271 * because the user queried for a particular record type only)
272 * @return GNUNET_OK on success, else GNUNET_SYSERR 272 * @return GNUNET_OK on success, else GNUNET_SYSERR
273 */ 273 */
274static int 274static int
275namestore_postgres_put_records (void *cls, 275namestore_postgres_put_records (void *cls,
276 const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, 276 const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key,
277 struct GNUNET_TIME_Absolute expire, 277 struct GNUNET_TIME_Absolute expire,
278 const char *name, 278 const char *name,
@@ -290,7 +290,7 @@ namestore_postgres_put_records (void *cls,
290 size_t data_size; 290 size_t data_size;
291 unsigned int i; 291 unsigned int i;
292 292
293 GNUNET_CRYPTO_short_hash (zone_key, 293 GNUNET_CRYPTO_short_hash (zone_key,
294 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 294 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
295 &zone); 295 &zone);
296 (void) namestore_postgres_remove_records (plugin, &zone, name); 296 (void) namestore_postgres_remove_records (plugin, &zone, name);
@@ -336,7 +336,7 @@ namestore_postgres_put_records (void *cls,
336 sizeof (uint32_t), 336 sizeof (uint32_t),
337 data_size, 337 data_size,
338 sizeof (uint64_t), 338 sizeof (uint64_t),
339 sizeof (struct GNUNET_CRYPTO_EccSignature), 339 sizeof (struct GNUNET_CRYPTO_EccSignature),
340 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 340 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
341 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 341 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
342 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 342 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
@@ -358,7 +358,7 @@ namestore_postgres_put_records (void *cls,
358 return GNUNET_SYSERR; 358 return GNUNET_SYSERR;
359 PQclear (ret); 359 PQclear (ret);
360 } 360 }
361 return GNUNET_OK; 361 return GNUNET_OK;
362} 362}
363#endif 363#endif
364 364
@@ -404,7 +404,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
404 if (0 == (cnt = PQntuples (res))) 404 if (0 == (cnt = PQntuples (res)))
405 { 405 {
406 /* no result */ 406 /* no result */
407 LOG (GNUNET_ERROR_TYPE_DEBUG, 407 LOG (GNUNET_ERROR_TYPE_DEBUG,
408 "Ending iteration (no more results)\n"); 408 "Ending iteration (no more results)\n");
409 PQclear (res); 409 PQclear (res);
410 410
@@ -412,10 +412,10 @@ get_record_and_call_iterator (struct Plugin *plugin,
412 return GNUNET_NO; 412 return GNUNET_NO;
413 } 413 }
414 GNUNET_assert (1 == cnt); 414 GNUNET_assert (1 == cnt);
415 if ((6 != PQnfields (res)) || 415 if ((6 != PQnfields (res)) ||
416 (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) || 416 (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) ||
417 (sizeof (uint32_t) != PQfsize (res, 2)) || 417 (sizeof (uint32_t) != PQfsize (res, 2)) ||
418 (sizeof (uint64_t) != PQfsize (res, 4)) || 418 (sizeof (uint64_t) != PQfsize (res, 4)) ||
419 (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5))) 419 (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5)))
420 { 420 {
421 GNUNET_break (0); 421 GNUNET_break (0);
@@ -444,7 +444,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
444 { 444 {
445 struct GNUNET_NAMESTORE_RecordData rd[record_count]; 445 struct GNUNET_NAMESTORE_RecordData rd[record_count];
446 char buf[name_len + 1]; 446 char buf[name_len + 1];
447 447
448 memcpy (buf, name, name_len); 448 memcpy (buf, name, name_len);
449 buf[name_len] = '\0'; 449 buf[name_len] = '\0';
450 if (GNUNET_OK != 450 if (GNUNET_OK !=
@@ -461,7 +461,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
461 return GNUNET_OK; 461 return GNUNET_OK;
462} 462}
463#endif 463#endif
464 464
465/** 465/**
466 * Iterate over the results for a particular key and zone in the 466 * Iterate over the results for a particular key and zone in the
467 * datastore. Will return at most one result to the iterator. 467 * datastore. Will return at most one result to the iterator.
@@ -474,8 +474,8 @@ get_record_and_call_iterator (struct Plugin *plugin,
474 * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error 474 * @return GNUNET_OK on success, GNUNET_NO if there were no results, GNUNET_SYSERR on error
475 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' 475 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR'
476 */ 476 */
477static int 477static int
478namestore_postgres_iterate_records (void *cls, 478namestore_postgres_iterate_records (void *cls,
479 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 479 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
480 uint64_t offset, 480 uint64_t offset,
481 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 481 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -537,7 +537,7 @@ namestore_postgres_iterate_records (void *cls,
537 first_param = 0; 537 first_param = 0;
538 } 538 }
539 res = 539 res =
540 PQexecPrepared (plugin->dbh, stmt_name, num_params, 540 PQexecPrepared (plugin->dbh, stmt_name, num_params,
541 &paramValues[first_param], 541 &paramValues[first_param],
542 &paramLengths[first_param], 542 &paramLengths[first_param],
543 &paramFormats[first_param], 1); 543 &paramFormats[first_param], 1);
@@ -561,7 +561,7 @@ namestore_postgres_iterate_records (void *cls,
561 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR' 561 * 'iter' will have been called unless the return value is 'GNUNET_SYSERR'
562 */ 562 */
563static int 563static int
564namestore_postgres_zone_to_name (void *cls, 564namestore_postgres_zone_to_name (void *cls,
565 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 565 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
566 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 566 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
567 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 567 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -595,7 +595,7 @@ namestore_postgres_zone_to_name (void *cls,
595 * @param cls closure (internal context for the plugin) 595 * @param cls closure (internal context for the plugin)
596 * @param zone zone to delete 596 * @param zone zone to delete
597 */ 597 */
598static void 598static void
599namestore_postgres_delete_zone (void *cls, 599namestore_postgres_delete_zone (void *cls,
600 const struct GNUNET_CRYPTO_ShortHashCode *zone) 600 const struct GNUNET_CRYPTO_ShortHashCode *zone)
601{ 601{
@@ -717,7 +717,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls)
717 if (NULL != plugin.cfg) 717 if (NULL != plugin.cfg)
718 return NULL; /* can only initialize once! */ 718 return NULL; /* can only initialize once! */
719 memset (&plugin, 0, sizeof (struct Plugin)); 719 memset (&plugin, 0, sizeof (struct Plugin));
720 plugin.cfg = cfg; 720 plugin.cfg = cfg;
721 if (GNUNET_OK != database_setup (&plugin)) 721 if (GNUNET_OK != database_setup (&plugin))
722 { 722 {
723 database_shutdown (&plugin); 723 database_shutdown (&plugin);
@@ -733,7 +733,7 @@ libgnunet_plugin_namestore_postgres_init (void *cls)
733 api->iterate_records = &namestore_postgres_iterate_records; 733 api->iterate_records = &namestore_postgres_iterate_records;
734 api->zone_to_name = &namestore_postgres_zone_to_name; 734 api->zone_to_name = &namestore_postgres_zone_to_name;
735 /* api->delete_zone = &namestore_postgres_delete_zone; */ 735 /* api->delete_zone = &namestore_postgres_delete_zone; */
736 LOG (GNUNET_ERROR_TYPE_INFO, 736 LOG (GNUNET_ERROR_TYPE_INFO,
737 _("Postgres database running\n")); 737 _("Postgres database running\n"));
738 return api; 738 return api;
739} 739}
@@ -754,7 +754,7 @@ libgnunet_plugin_namestore_postgres_done (void *cls)
754 database_shutdown (plugin); 754 database_shutdown (plugin);
755 plugin->cfg = NULL; 755 plugin->cfg = NULL;
756 GNUNET_free (api); 756 GNUNET_free (api);
757 LOG (GNUNET_ERROR_TYPE_DEBUG, 757 LOG (GNUNET_ERROR_TYPE_DEBUG,
758 "postgres plugin is finished\n"); 758 "postgres plugin is finished\n");
759 return NULL; 759 return NULL;
760} 760}
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c
index 493981c06..1acb5aff2 100644
--- a/src/namestore/plugin_namestore_sqlite.c
+++ b/src/namestore/plugin_namestore_sqlite.c
@@ -136,7 +136,7 @@ sq_prepare (sqlite3 * dbh, const char *zSql, sqlite3_stmt ** ppStmt)
136 result = 136 result =
137 sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt, 137 sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt,
138 (const char **) &dummy); 138 (const char **) &dummy);
139 LOG (GNUNET_ERROR_TYPE_DEBUG, 139 LOG (GNUNET_ERROR_TYPE_DEBUG,
140 "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result); 140 "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result);
141 return result; 141 return result;
142} 142}
@@ -166,7 +166,7 @@ create_indices (sqlite3 * dbh)
166 (SQLITE_OK != 166 (SQLITE_OK !=
167 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns096records (rvalue)", 167 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS it_iter ON ns096records (rvalue)",
168 NULL, NULL, NULL)) ) 168 NULL, NULL, NULL)) )
169 LOG (GNUNET_ERROR_TYPE_ERROR, 169 LOG (GNUNET_ERROR_TYPE_ERROR,
170 "Failed to create indices: %s\n", sqlite3_errmsg (dbh)); 170 "Failed to create indices: %s\n", sqlite3_errmsg (dbh));
171} 171}
172 172
@@ -262,11 +262,11 @@ database_setup (struct Plugin *plugin)
262 if ((sqlite3_step (stmt) == SQLITE_DONE) && 262 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
263 (sqlite3_exec 263 (sqlite3_exec
264 (plugin->dbh, 264 (plugin->dbh,
265 "CREATE TABLE ns096blocks (" 265 "CREATE TABLE ns096blocks ("
266 " query BLOB NOT NULL DEFAULT ''," 266 " query BLOB NOT NULL DEFAULT '',"
267 " block BLOB NOT NULL DEFAULT ''," 267 " block BLOB NOT NULL DEFAULT '',"
268 " expiration_time INT8 NOT NULL DEFAULT 0" 268 " expiration_time INT8 NOT NULL DEFAULT 0"
269 ")", 269 ")",
270 NULL, NULL, NULL) != SQLITE_OK)) 270 NULL, NULL, NULL) != SQLITE_OK))
271 { 271 {
272 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); 272 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
@@ -282,14 +282,14 @@ database_setup (struct Plugin *plugin)
282 if ((sqlite3_step (stmt) == SQLITE_DONE) && 282 if ((sqlite3_step (stmt) == SQLITE_DONE) &&
283 (sqlite3_exec 283 (sqlite3_exec
284 (plugin->dbh, 284 (plugin->dbh,
285 "CREATE TABLE ns096records (" 285 "CREATE TABLE ns096records ("
286 " zone_private_key BLOB NOT NULL DEFAULT ''," 286 " zone_private_key BLOB NOT NULL DEFAULT '',"
287 " pkey_hash BLOB," 287 " pkey_hash BLOB,"
288 " rvalue INT8 NOT NULL DEFAULT ''," 288 " rvalue INT8 NOT NULL DEFAULT '',"
289 " record_count INT NOT NULL DEFAULT 0," 289 " record_count INT NOT NULL DEFAULT 0,"
290 " record_data BLOB NOT NULL DEFAULT ''," 290 " record_data BLOB NOT NULL DEFAULT '',"
291 " label TEXT NOT NULL DEFAULT ''" 291 " label TEXT NOT NULL DEFAULT ''"
292 ")", 292 ")",
293 NULL, NULL, NULL) != SQLITE_OK)) 293 NULL, NULL, NULL) != SQLITE_OK))
294 { 294 {
295 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec"); 295 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite3_exec");
@@ -332,14 +332,14 @@ database_setup (struct Plugin *plugin)
332 &plugin->zone_to_name) != SQLITE_OK) || 332 &plugin->zone_to_name) != SQLITE_OK) ||
333 (sq_prepare 333 (sq_prepare
334 (plugin->dbh, 334 (plugin->dbh,
335 "SELECT record_count,record_data,label" 335 "SELECT record_count,record_data,label"
336 " FROM ns096records WHERE zone_private_key=? ORDER BY rvalue LIMIT 1 OFFSET ?", 336 " FROM ns096records WHERE zone_private_key=? ORDER BY rvalue LIMIT 1 OFFSET ?",
337 &plugin->iterate_zone) != SQLITE_OK) || 337 &plugin->iterate_zone) != SQLITE_OK) ||
338 (sq_prepare 338 (sq_prepare
339 (plugin->dbh, 339 (plugin->dbh,
340 "SELECT record_count,record_data,label,zone_private_key" 340 "SELECT record_count,record_data,label,zone_private_key"
341 " FROM ns096records ORDER BY rvalue LIMIT 1 OFFSET ?", 341 " FROM ns096records ORDER BY rvalue LIMIT 1 OFFSET ?",
342 &plugin->iterate_all_zones) != SQLITE_OK) 342 &plugin->iterate_all_zones) != SQLITE_OK)
343 ) 343 )
344 { 344 {
345 LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling"); 345 LOG_SQLITE (plugin,GNUNET_ERROR_TYPE_ERROR, "precompiling");
@@ -415,7 +415,7 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin)
415 int n; 415 int n;
416 416
417 now = GNUNET_TIME_absolute_get (); 417 now = GNUNET_TIME_absolute_get ();
418 if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks, 418 if (SQLITE_OK != sqlite3_bind_int64 (plugin->expire_blocks,
419 1, now.abs_value_us)) 419 1, now.abs_value_us))
420 { 420 {
421 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 421 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
@@ -454,8 +454,8 @@ namestore_sqlite_expire_blocks (struct Plugin *plugin)
454 * @param block block to cache 454 * @param block block to cache
455 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 455 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
456 */ 456 */
457static int 457static int
458namestore_sqlite_cache_block (void *cls, 458namestore_sqlite_cache_block (void *cls,
459 const struct GNUNET_NAMESTORE_Block *block) 459 const struct GNUNET_NAMESTORE_Block *block)
460{ 460{
461 struct Plugin *plugin = cls; 461 struct Plugin *plugin = cls;
@@ -466,16 +466,16 @@ namestore_sqlite_cache_block (void *cls,
466 int n; 466 int n;
467 467
468 namestore_sqlite_expire_blocks (plugin); 468 namestore_sqlite_expire_blocks (plugin);
469 GNUNET_CRYPTO_hash (&block->derived_key, 469 GNUNET_CRYPTO_hash (&block->derived_key,
470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
471 &query); 471 &query);
472 expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); 472 expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time);
473 dval = (int64_t) expiration.abs_value_us; 473 dval = (int64_t) expiration.abs_value_us;
474 if (dval < 0) 474 if (dval < 0)
475 dval = INT64_MAX; 475 dval = INT64_MAX;
476 block_size = ntohl (block->purpose.size) + 476 block_size = ntohl (block->purpose.size) +
477 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 477 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
478 sizeof (struct GNUNET_CRYPTO_EccSignature); 478 sizeof (struct GNUNET_CRYPTO_EccSignature);
479 if (block_size > 64 * 65536) 479 if (block_size > 64 * 65536)
480 { 480 {
481 GNUNET_break (0); 481 GNUNET_break (0);
@@ -483,11 +483,11 @@ namestore_sqlite_cache_block (void *cls,
483 } 483 }
484 484
485 /* delete old version of the block */ 485 /* delete old version of the block */
486 if ( (SQLITE_OK != 486 if ( (SQLITE_OK !=
487 sqlite3_bind_blob (plugin->delete_block, 1, 487 sqlite3_bind_blob (plugin->delete_block, 1,
488 &query, sizeof (struct GNUNET_HashCode), 488 &query, sizeof (struct GNUNET_HashCode),
489 SQLITE_STATIC)) || 489 SQLITE_STATIC)) ||
490 (SQLITE_OK != 490 (SQLITE_OK !=
491 sqlite3_bind_int64 (plugin->delete_block, 491 sqlite3_bind_int64 (plugin->delete_block,
492 2, dval)) ) 492 2, dval)) )
493 { 493 {
@@ -519,30 +519,30 @@ namestore_sqlite_cache_block (void *cls,
519 "sqlite3_reset"); 519 "sqlite3_reset");
520 520
521 /* insert new version of the block */ 521 /* insert new version of the block */
522 if ((SQLITE_OK != 522 if ((SQLITE_OK !=
523 sqlite3_bind_blob (plugin->cache_block, 1, 523 sqlite3_bind_blob (plugin->cache_block, 1,
524 &query, sizeof (struct GNUNET_HashCode), 524 &query, sizeof (struct GNUNET_HashCode),
525 SQLITE_STATIC)) || 525 SQLITE_STATIC)) ||
526 (SQLITE_OK != 526 (SQLITE_OK !=
527 sqlite3_bind_blob (plugin->cache_block, 2, 527 sqlite3_bind_blob (plugin->cache_block, 2,
528 block, block_size, 528 block, block_size,
529 SQLITE_STATIC)) || 529 SQLITE_STATIC)) ||
530 (SQLITE_OK != 530 (SQLITE_OK !=
531 sqlite3_bind_int64 (plugin->cache_block, 3, 531 sqlite3_bind_int64 (plugin->cache_block, 3,
532 dval))) 532 dval)))
533 { 533 {
534 LOG_SQLITE (plugin, 534 LOG_SQLITE (plugin,
535 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 535 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
536 "sqlite3_bind_XXXX"); 536 "sqlite3_bind_XXXX");
537 if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) 537 if (SQLITE_OK != sqlite3_reset (plugin->cache_block))
538 LOG_SQLITE (plugin, 538 LOG_SQLITE (plugin,
539 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 539 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
540 "sqlite3_reset"); 540 "sqlite3_reset");
541 return GNUNET_SYSERR; 541 return GNUNET_SYSERR;
542 542
543 } 543 }
544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 544 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
545 "Caching block under derived key `%s'\n", 545 "Caching block under derived key `%s'\n",
546 GNUNET_h2s_full (&query)); 546 GNUNET_h2s_full (&query));
547 n = sqlite3_step (plugin->cache_block); 547 n = sqlite3_step (plugin->cache_block);
548 if (SQLITE_OK != sqlite3_reset (plugin->cache_block)) 548 if (SQLITE_OK != sqlite3_reset (plugin->cache_block))
@@ -551,7 +551,7 @@ namestore_sqlite_cache_block (void *cls,
551 switch (n) 551 switch (n)
552 { 552 {
553 case SQLITE_DONE: 553 case SQLITE_DONE:
554 LOG (GNUNET_ERROR_TYPE_DEBUG, 554 LOG (GNUNET_ERROR_TYPE_DEBUG,
555 "Record stored\n"); 555 "Record stored\n");
556 return GNUNET_OK; 556 return GNUNET_OK;
557 case SQLITE_BUSY: 557 case SQLITE_BUSY:
@@ -561,7 +561,7 @@ namestore_sqlite_cache_block (void *cls,
561 default: 561 default:
562 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 562 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
563 "sqlite3_step"); 563 "sqlite3_step");
564 return GNUNET_SYSERR; 564 return GNUNET_SYSERR;
565 } 565 }
566} 566}
567 567
@@ -577,7 +577,7 @@ namestore_sqlite_cache_block (void *cls,
577 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 577 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
578 */ 578 */
579static int 579static int
580namestore_sqlite_lookup_block (void *cls, 580namestore_sqlite_lookup_block (void *cls,
581 const struct GNUNET_HashCode *query, 581 const struct GNUNET_HashCode *query,
582 GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls) 582 GNUNET_NAMESTORE_BlockCallback iter, void *iter_cls)
583{ 583{
@@ -598,26 +598,26 @@ namestore_sqlite_lookup_block (void *cls,
598 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 598 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
599 "sqlite3_reset"); 599 "sqlite3_reset");
600 return GNUNET_SYSERR; 600 return GNUNET_SYSERR;
601 } 601 }
602 ret = GNUNET_NO; 602 ret = GNUNET_NO;
603 if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block))) 603 if (SQLITE_ROW == (sret = sqlite3_step (plugin->lookup_block)))
604 { 604 {
605 block = sqlite3_column_blob (plugin->lookup_block, 0); 605 block = sqlite3_column_blob (plugin->lookup_block, 0);
606 block_size = sqlite3_column_bytes (plugin->lookup_block, 0); 606 block_size = sqlite3_column_bytes (plugin->lookup_block, 0);
607 if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || 607 if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) ||
608 (ntohl (block->purpose.size) + 608 (ntohl (block->purpose.size) +
609 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 609 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
610 sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) ) 610 sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) )
611 { 611 {
612 GNUNET_break (0); 612 GNUNET_break (0);
613 ret = GNUNET_SYSERR; 613 ret = GNUNET_SYSERR;
614 } 614 }
615 else 615 else
616 { 616 {
617 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 617 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
618 "Found block under derived key `%s'\n", 618 "Found block under derived key `%s'\n",
619 GNUNET_h2s_full (query)); 619 GNUNET_h2s_full (query));
620 iter (iter_cls, block); 620 iter (iter_cls, block);
621 ret = GNUNET_YES; 621 ret = GNUNET_YES;
622 } 622 }
623 } 623 }
@@ -625,13 +625,13 @@ namestore_sqlite_lookup_block (void *cls,
625 { 625 {
626 if (SQLITE_DONE != sret) 626 if (SQLITE_DONE != sret)
627 { 627 {
628 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step"); 628 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR, "sqlite_step");
629 ret = GNUNET_SYSERR; 629 ret = GNUNET_SYSERR;
630 } 630 }
631 else 631 else
632 { 632 {
633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
634 "No block found under derived key `%s'\n", 634 "No block found under derived key `%s'\n",
635 GNUNET_h2s_full (query)); 635 GNUNET_h2s_full (query));
636 } 636 }
637 } 637 }
@@ -654,8 +654,8 @@ namestore_sqlite_lookup_block (void *cls,
654 * @param rd array of records with data to store 654 * @param rd array of records with data to store
655 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 655 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
656 */ 656 */
657static int 657static int
658namestore_sqlite_store_records (void *cls, 658namestore_sqlite_store_records (void *cls,
659 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, 659 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
660 const char *label, 660 const char *label,
661 unsigned int rd_count, 661 unsigned int rd_count,
@@ -696,19 +696,19 @@ namestore_sqlite_store_records (void *cls,
696 } 696 }
697 697
698 /* First delete 'old' records */ 698 /* First delete 'old' records */
699 if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1, 699 if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_records, 1,
700 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || 700 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) ||
701 (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC))) 701 (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC)))
702 { 702 {
703 LOG_SQLITE (plugin, 703 LOG_SQLITE (plugin,
704 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 704 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
705 "sqlite3_bind_XXXX"); 705 "sqlite3_bind_XXXX");
706 if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) 706 if (SQLITE_OK != sqlite3_reset (plugin->delete_records))
707 LOG_SQLITE (plugin, 707 LOG_SQLITE (plugin,
708 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 708 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
709 "sqlite3_reset"); 709 "sqlite3_reset");
710 return GNUNET_SYSERR; 710 return GNUNET_SYSERR;
711 711
712 } 712 }
713 n = sqlite3_step (plugin->delete_records); 713 n = sqlite3_step (plugin->delete_records);
714 if (SQLITE_OK != sqlite3_reset (plugin->delete_records)) 714 if (SQLITE_OK != sqlite3_reset (plugin->delete_records))
@@ -717,7 +717,7 @@ namestore_sqlite_store_records (void *cls,
717 717
718 if (0 != rd_count) 718 if (0 != rd_count)
719 { 719 {
720 if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, 720 if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1,
721 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || 721 zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) ||
722 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2, 722 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2,
723 &pkey_hash, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) || 723 &pkey_hash, sizeof (struct GNUNET_HashCode), SQLITE_STATIC)) ||
@@ -726,11 +726,11 @@ namestore_sqlite_store_records (void *cls,
726 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) || 726 (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) ||
727 (SQLITE_OK != sqlite3_bind_text (plugin->store_records, 6, label, -1, SQLITE_STATIC))) 727 (SQLITE_OK != sqlite3_bind_text (plugin->store_records, 6, label, -1, SQLITE_STATIC)))
728 { 728 {
729 LOG_SQLITE (plugin, 729 LOG_SQLITE (plugin,
730 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 730 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
731 "sqlite3_bind_XXXX"); 731 "sqlite3_bind_XXXX");
732 if (SQLITE_OK != sqlite3_reset (plugin->store_records)) 732 if (SQLITE_OK != sqlite3_reset (plugin->store_records))
733 LOG_SQLITE (plugin, 733 LOG_SQLITE (plugin,
734 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 734 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
735 "sqlite3_reset"); 735 "sqlite3_reset");
736 return GNUNET_SYSERR; 736 return GNUNET_SYSERR;
@@ -756,7 +756,7 @@ namestore_sqlite_store_records (void *cls,
756 default: 756 default:
757 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 757 LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
758 "sqlite3_step"); 758 "sqlite3_step");
759 return GNUNET_SYSERR; 759 return GNUNET_SYSERR;
760 } 760 }
761} 761}
762 762
@@ -775,7 +775,7 @@ namestore_sqlite_store_records (void *cls,
775 */ 775 */
776static int 776static int
777get_record_and_call_iterator (struct Plugin *plugin, 777get_record_and_call_iterator (struct Plugin *plugin,
778 sqlite3_stmt *stmt, 778 sqlite3_stmt *stmt,
779 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, 779 const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
780 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 780 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
781{ 781{
@@ -788,7 +788,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
788 788
789 ret = GNUNET_NO; 789 ret = GNUNET_NO;
790 if (SQLITE_ROW == (sret = sqlite3_step (stmt))) 790 if (SQLITE_ROW == (sret = sqlite3_step (stmt)))
791 { 791 {
792 record_count = sqlite3_column_int (stmt, 0); 792 record_count = sqlite3_column_int (stmt, 0);
793 data_size = sqlite3_column_bytes (stmt, 1); 793 data_size = sqlite3_column_bytes (stmt, 1);
794 data = sqlite3_column_blob (stmt, 1); 794 data = sqlite3_column_blob (stmt, 1);
@@ -813,7 +813,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
813 because database might contain a large value here */ 813 because database might contain a large value here */
814 GNUNET_break (0); 814 GNUNET_break (0);
815 ret = GNUNET_SYSERR; 815 ret = GNUNET_SYSERR;
816 } 816 }
817 else 817 else
818 { 818 {
819 struct GNUNET_NAMESTORE_RecordData rd[record_count]; 819 struct GNUNET_NAMESTORE_RecordData rd[record_count];
@@ -857,8 +857,8 @@ get_record_and_call_iterator (struct Plugin *plugin,
857 * @param iter_cls closure for @a iter 857 * @param iter_cls closure for @a iter
858 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 858 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
859 */ 859 */
860static int 860static int
861namestore_sqlite_iterate_records (void *cls, 861namestore_sqlite_iterate_records (void *cls,
862 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 862 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
863 uint64_t offset, 863 uint64_t offset,
864 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 864 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -876,7 +876,7 @@ namestore_sqlite_iterate_records (void *cls,
876 else 876 else
877 { 877 {
878 stmt = plugin->iterate_zone; 878 stmt = plugin->iterate_zone;
879 err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, 879 err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1,
880 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), 880 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey),
881 SQLITE_STATIC)) || 881 SQLITE_STATIC)) ||
882 (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, 882 (SQLITE_OK != sqlite3_bind_int64 (stmt, 2,
@@ -891,7 +891,7 @@ namestore_sqlite_iterate_records (void *cls,
891 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 891 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
892 "sqlite3_reset"); 892 "sqlite3_reset");
893 return GNUNET_SYSERR; 893 return GNUNET_SYSERR;
894 } 894 }
895 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); 895 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls);
896} 896}
897 897
@@ -908,7 +908,7 @@ namestore_sqlite_iterate_records (void *cls,
908 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 908 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
909 */ 909 */
910static int 910static int
911namestore_sqlite_zone_to_name (void *cls, 911namestore_sqlite_zone_to_name (void *cls,
912 const struct GNUNET_CRYPTO_EccPrivateKey *zone, 912 const struct GNUNET_CRYPTO_EccPrivateKey *zone,
913 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, 913 const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
914 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) 914 GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
@@ -917,10 +917,10 @@ namestore_sqlite_zone_to_name (void *cls,
917 sqlite3_stmt *stmt; 917 sqlite3_stmt *stmt;
918 918
919 stmt = plugin->zone_to_name; 919 stmt = plugin->zone_to_name;
920 if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, 920 if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1,
921 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), 921 zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey),
922 SQLITE_STATIC)) || 922 SQLITE_STATIC)) ||
923 (SQLITE_OK != sqlite3_bind_blob (stmt, 2, 923 (SQLITE_OK != sqlite3_bind_blob (stmt, 2,
924 value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), 924 value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
925 SQLITE_STATIC)) ) 925 SQLITE_STATIC)) )
926 { 926 {
@@ -931,7 +931,7 @@ namestore_sqlite_zone_to_name (void *cls,
931 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, 931 GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
932 "sqlite3_reset"); 932 "sqlite3_reset");
933 return GNUNET_SYSERR; 933 return GNUNET_SYSERR;
934 } 934 }
935 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls); 935 return get_record_and_call_iterator (plugin, stmt, zone, iter, iter_cls);
936} 936}
937 937
@@ -952,7 +952,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls)
952 if (NULL != plugin.cfg) 952 if (NULL != plugin.cfg)
953 return NULL; /* can only initialize once! */ 953 return NULL; /* can only initialize once! */
954 memset (&plugin, 0, sizeof (struct Plugin)); 954 memset (&plugin, 0, sizeof (struct Plugin));
955 plugin.cfg = cfg; 955 plugin.cfg = cfg;
956 if (GNUNET_OK != database_setup (&plugin)) 956 if (GNUNET_OK != database_setup (&plugin))
957 { 957 {
958 database_shutdown (&plugin); 958 database_shutdown (&plugin);
@@ -965,7 +965,7 @@ libgnunet_plugin_namestore_sqlite_init (void *cls)
965 api->store_records = &namestore_sqlite_store_records; 965 api->store_records = &namestore_sqlite_store_records;
966 api->iterate_records = &namestore_sqlite_iterate_records; 966 api->iterate_records = &namestore_sqlite_iterate_records;
967 api->zone_to_name = &namestore_sqlite_zone_to_name; 967 api->zone_to_name = &namestore_sqlite_zone_to_name;
968 LOG (GNUNET_ERROR_TYPE_INFO, 968 LOG (GNUNET_ERROR_TYPE_INFO,
969 _("Sqlite database running\n")); 969 _("Sqlite database running\n"));
970 return api; 970 return api;
971} 971}
@@ -986,7 +986,7 @@ libgnunet_plugin_namestore_sqlite_done (void *cls)
986 database_shutdown (plugin); 986 database_shutdown (plugin);
987 plugin->cfg = NULL; 987 plugin->cfg = NULL;
988 GNUNET_free (api); 988 GNUNET_free (api);
989 LOG (GNUNET_ERROR_TYPE_DEBUG, 989 LOG (GNUNET_ERROR_TYPE_DEBUG,
990 "sqlite plugin is finished\n"); 990 "sqlite plugin is finished\n");
991 return NULL; 991 return NULL;
992} 992}
diff --git a/src/namestore/test_namestore_api_cache_block.c b/src/namestore/test_namestore_api_cache_block.c
index c3b4fb87f..8ed010abd 100644
--- a/src/namestore/test_namestore_api_cache_block.c
+++ b/src/namestore/test_namestore_api_cache_block.c
@@ -144,7 +144,7 @@ name_lookup_proc (void *cls,
144 &pubkey, name, &rd_decrypt_cb, (void *) name)); 144 &pubkey, name, &rd_decrypt_cb, (void *) name));
145} 145}
146 146
147static void 147static void
148cache_cont (void *cls, int32_t success, const char *emsg) 148cache_cont (void *cls, int32_t success, const char *emsg)
149{ 149{
150 const char *name = cls; 150 const char *name = cls;
@@ -166,7 +166,7 @@ cache_cont (void *cls, int32_t success, const char *emsg)
166 166
167 167
168static void 168static void
169run (void *cls, 169run (void *cls,
170 const struct GNUNET_CONFIGURATION_Handle *cfg, 170 const struct GNUNET_CONFIGURATION_Handle *cfg,
171 struct GNUNET_TESTING_Peer *peer) 171 struct GNUNET_TESTING_Peer *peer)
172{ 172{
@@ -175,7 +175,7 @@ run (void *cls,
175 char *hostkey_file; 175 char *hostkey_file;
176 const char * name = "dummy.dummy.gnunet"; 176 const char * name = "dummy.dummy.gnunet";
177 177
178 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 178 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
179 &endbadly, NULL); 179 &endbadly, NULL);
180 GNUNET_asprintf (&hostkey_file, 180 GNUNET_asprintf (&hostkey_file,
181 "zonefiles%s%s", 181 "zonefiles%s%s",
@@ -224,7 +224,7 @@ int
224main (int argc, char *argv[]) 224main (int argc, char *argv[])
225{ 225{
226 res = 1; 226 res = 1;
227 if (0 != 227 if (0 !=
228 GNUNET_TESTING_service_run ("test-namestore-api", 228 GNUNET_TESTING_service_run ("test-namestore-api",
229 "namestore", 229 "namestore",
230 "test_namestore_api.conf", 230 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c
index 3106c1c4f..f2b009ac5 100644
--- a/src/namestore/test_namestore_api_lookup_public.c
+++ b/src/namestore/test_namestore_api_lookup_public.c
@@ -144,7 +144,7 @@ name_lookup_proc (void *cls,
144 &pubkey, name, &rd_decrypt_cb, (void *) name)); 144 &pubkey, name, &rd_decrypt_cb, (void *) name));
145} 145}
146 146
147static void 147static void
148put_cont (void *cls, int32_t success, const char *emsg) 148put_cont (void *cls, int32_t success, const char *emsg)
149{ 149{
150 const char *name = cls; 150 const char *name = cls;
@@ -154,7 +154,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
154 GNUNET_assert (NULL != cls); 154 GNUNET_assert (NULL != cls);
155 155
156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
157 "Name store added record for `%s': %s\n", 157 "Name store added record for `%s': %s\n",
158 name, 158 name,
159 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 159 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
160 160
@@ -168,7 +168,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
168 168
169 169
170static void 170static void
171run (void *cls, 171run (void *cls,
172 const struct GNUNET_CONFIGURATION_Handle *cfg, 172 const struct GNUNET_CONFIGURATION_Handle *cfg,
173 struct GNUNET_TESTING_Peer *peer) 173 struct GNUNET_TESTING_Peer *peer)
174{ 174{
@@ -176,7 +176,7 @@ run (void *cls,
176 char *hostkey_file; 176 char *hostkey_file;
177 const char * name = "dummy.dummy.gnunet"; 177 const char * name = "dummy.dummy.gnunet";
178 178
179 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 179 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
180 &endbadly, NULL); 180 &endbadly, NULL);
181 GNUNET_asprintf (&hostkey_file, 181 GNUNET_asprintf (&hostkey_file,
182 "zonefiles%s%s", 182 "zonefiles%s%s",
@@ -213,7 +213,7 @@ int
213main (int argc, char *argv[]) 213main (int argc, char *argv[])
214{ 214{
215 res = 1; 215 res = 1;
216 if (0 != 216 if (0 !=
217 GNUNET_TESTING_service_run ("test-namestore-api", 217 GNUNET_TESTING_service_run ("test-namestore-api",
218 "namestore", 218 "namestore",
219 "test_namestore_api.conf", 219 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index bf410fe42..d0662617e 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -153,7 +153,7 @@ zone_proc (void *cls,
153 static int returned_records; 153 static int returned_records;
154 static int fail = GNUNET_NO; 154 static int fail = GNUNET_NO;
155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
156 "Comparing results name %s\n", 156 "Comparing results name %s\n",
157 name); 157 name);
158 158
159 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) 159 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)))
@@ -191,7 +191,7 @@ zone_proc (void *cls,
191 } 191 }
192 192
193 if (2 == ++returned_records) 193 if (2 == ++returned_records)
194 { 194 {
195 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 195 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
196 { 196 {
197 GNUNET_SCHEDULER_cancel (endbadly_task); 197 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -254,7 +254,7 @@ create_record (unsigned int count)
254 254
255 255
256static void 256static void
257run (void *cls, 257run (void *cls,
258 const struct GNUNET_CONFIGURATION_Handle *cfg, 258 const struct GNUNET_CONFIGURATION_Handle *cfg,
259 struct GNUNET_TESTING_Peer *peer) 259 struct GNUNET_TESTING_Peer *peer)
260{ 260{
@@ -266,7 +266,7 @@ run (void *cls,
266 "zonefiles%s%s", 266 "zonefiles%s%s",
267 DIR_SEPARATOR_STR, 267 DIR_SEPARATOR_STR,
268 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 268 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
270 "Using zonekey file `%s' \n", hostkey_file); 270 "Using zonekey file `%s' \n", hostkey_file);
271 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); 271 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
272 GNUNET_free (hostkey_file); 272 GNUNET_free (hostkey_file);
@@ -334,7 +334,7 @@ int
334main (int argc, char *argv[]) 334main (int argc, char *argv[])
335{ 335{
336 res = 1; 336 res = 1;
337 if (0 != 337 if (0 !=
338 GNUNET_TESTING_service_run ("test-namestore-api-monitoring", 338 GNUNET_TESTING_service_run ("test-namestore-api-monitoring",
339 "namestore", 339 "namestore",
340 "test_namestore_api.conf", 340 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 3958e4d6c..4db1c6d62 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -154,7 +154,7 @@ zone_proc (void *cls,
154 static int returned_records; 154 static int returned_records;
155 static int fail = GNUNET_NO; 155 static int fail = GNUNET_NO;
156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
157 "Comparing results name %s\n", 157 "Comparing results name %s\n",
158 name); 158 name);
159 159
160 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) 160 if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)))
@@ -192,7 +192,7 @@ zone_proc (void *cls,
192 } 192 }
193 193
194 if (2 == ++returned_records) 194 if (2 == ++returned_records)
195 { 195 {
196 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 196 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
197 { 197 {
198 GNUNET_SCHEDULER_cancel (endbadly_task); 198 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -272,7 +272,7 @@ create_record (unsigned int count)
272 272
273 273
274static void 274static void
275run (void *cls, 275run (void *cls,
276 const struct GNUNET_CONFIGURATION_Handle *mycfg, 276 const struct GNUNET_CONFIGURATION_Handle *mycfg,
277 struct GNUNET_TESTING_Peer *peer) 277 struct GNUNET_TESTING_Peer *peer)
278{ 278{
@@ -284,7 +284,7 @@ run (void *cls,
284 "zonefiles%s%s", 284 "zonefiles%s%s",
285 DIR_SEPARATOR_STR, 285 DIR_SEPARATOR_STR,
286 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); 286 "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey");
287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 287 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
288 "Using zonekey file `%s' \n", hostkey_file); 288 "Using zonekey file `%s' \n", hostkey_file);
289 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); 289 privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file);
290 GNUNET_free (hostkey_file); 290 GNUNET_free (hostkey_file);
@@ -339,7 +339,7 @@ int
339main (int argc, char *argv[]) 339main (int argc, char *argv[])
340{ 340{
341 res = 1; 341 res = 1;
342 if (0 != 342 if (0 !=
343 GNUNET_TESTING_service_run ("test-namestore-api-monitoring", 343 GNUNET_TESTING_service_run ("test-namestore-api-monitoring",
344 "namestore", 344 "namestore",
345 "test_namestore_api.conf", 345 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c
index 647b5e6af..e3610ccaf 100644
--- a/src/namestore/test_namestore_api_put.c
+++ b/src/namestore/test_namestore_api_put.c
@@ -100,8 +100,8 @@ put_cont (void *cls, int32_t success, const char *emsg)
100{ 100{
101 const char * name = cls; 101 const char * name = cls;
102 102
103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 103 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
104 "Name store added record for `%s': %s\n", 104 "Name store added record for `%s': %s\n",
105 name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 105 name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
106 if (success == GNUNET_OK) 106 if (success == GNUNET_OK)
107 res = 0; 107 res = 0;
@@ -131,7 +131,7 @@ create_record (unsigned int count)
131 131
132 132
133static void 133static void
134run (void *cls, 134run (void *cls,
135 const struct GNUNET_CONFIGURATION_Handle *cfg, 135 const struct GNUNET_CONFIGURATION_Handle *cfg,
136 struct GNUNET_TESTING_Peer *peer) 136 struct GNUNET_TESTING_Peer *peer)
137{ 137{
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c
index 568a0cd8b..3f3823e89 100644
--- a/src/namestore/test_namestore_api_remove.c
+++ b/src/namestore/test_namestore_api_remove.c
@@ -96,8 +96,8 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
96 96
97 97
98static void 98static void
99remove_cont (void *cls, 99remove_cont (void *cls,
100 int32_t success, 100 int32_t success,
101 const char *emsg) 101 const char *emsg)
102{ 102{
103 if (GNUNET_YES != success) 103 if (GNUNET_YES != success)
@@ -128,16 +128,16 @@ rd_decrypt_cb (void *cls,
128 128
129 GNUNET_assert (GNUNET_NO == removed); 129 GNUNET_assert (GNUNET_NO == removed);
130 GNUNET_assert (1 == rd_count); 130 GNUNET_assert (1 == rd_count);
131 GNUNET_assert (NULL != rd); 131 GNUNET_assert (NULL != rd);
132 memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN); 132 memset (rd_cmp_data, 'a', TEST_RECORD_DATALEN);
133 133
134 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); 134 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type);
135 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); 135 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size);
136 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); 136 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN));
137 137
138 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 138 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
139 "Block was decrypted successfully, removing records \n"); 139 "Block was decrypted successfully, removing records \n");
140 140
141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name,
142 0, NULL, &remove_cont, (void *) name); 142 0, NULL, &remove_cont, (void *) name);
143} 143}
@@ -178,14 +178,14 @@ name_lookup_proc (void *cls,
178 } 178 }
179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 179 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
180 "Namestore returned block, decrypting \n"); 180 "Namestore returned block, decrypting \n");
181 GNUNET_assert (GNUNET_OK == 181 GNUNET_assert (GNUNET_OK ==
182 GNUNET_NAMESTORE_block_decrypt (block, 182 GNUNET_NAMESTORE_block_decrypt (block,
183 &pubkey, name, &rd_decrypt_cb, (void *) name)); 183 &pubkey, name, &rd_decrypt_cb, (void *) name));
184} 184}
185 185
186 186
187static void 187static void
188put_cont (void *cls, int32_t success, 188put_cont (void *cls, int32_t success,
189 const char *emsg) 189 const char *emsg)
190{ 190{
191 const char *name = cls; 191 const char *name = cls;
@@ -195,7 +195,7 @@ put_cont (void *cls, int32_t success,
195 { 195 {
196 GNUNET_break (0); 196 GNUNET_break (0);
197 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 197 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
198 "Namestore could not store record: `%s'\n", 198 "Namestore could not store record: `%s'\n",
199 emsg); 199 emsg);
200 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK) 200 if (endbadly_task != GNUNET_SCHEDULER_NO_TASK)
201 GNUNET_SCHEDULER_cancel (endbadly_task); 201 GNUNET_SCHEDULER_cancel (endbadly_task);
@@ -229,7 +229,7 @@ put_cont (void *cls, int32_t success,
229 229
230 230
231static void 231static void
232run (void *cls, 232run (void *cls,
233 const struct GNUNET_CONFIGURATION_Handle *cfg, 233 const struct GNUNET_CONFIGURATION_Handle *cfg,
234 struct GNUNET_TESTING_Peer *peer) 234 struct GNUNET_TESTING_Peer *peer)
235{ 235{
@@ -274,7 +274,7 @@ int
274main (int argc, char *argv[]) 274main (int argc, char *argv[])
275{ 275{
276 res = 1; 276 res = 1;
277 if (0 != 277 if (0 !=
278 GNUNET_TESTING_service_run ("test-namestore-api", 278 GNUNET_TESTING_service_run ("test-namestore-api",
279 "namestore", 279 "namestore",
280 "test_namestore_api.conf", 280 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c
index cf1c3c3a9..86cf47e26 100644
--- a/src/namestore/test_namestore_api_remove_not_existing_record.c
+++ b/src/namestore/test_namestore_api_remove_not_existing_record.c
@@ -169,7 +169,7 @@ int
169main (int argc, char *argv[]) 169main (int argc, char *argv[])
170{ 170{
171 res = 1; 171 res = 1;
172 if (0 != 172 if (0 !=
173 GNUNET_TESTING_service_run ("test-namestore-api", 173 GNUNET_TESTING_service_run ("test-namestore-api",
174 "namestore", 174 "namestore",
175 "test_namestore_api.conf", 175 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c
index 1bb85ac47..69c47337f 100644
--- a/src/namestore/test_namestore_api_store.c
+++ b/src/namestore/test_namestore_api_store.c
@@ -144,7 +144,7 @@ name_lookup_proc (void *cls,
144 &pubkey, name, &rd_decrypt_cb, (void *) name)); 144 &pubkey, name, &rd_decrypt_cb, (void *) name));
145} 145}
146 146
147static void 147static void
148put_cont (void *cls, int32_t success, const char *emsg) 148put_cont (void *cls, int32_t success, const char *emsg)
149{ 149{
150 const char *name = cls; 150 const char *name = cls;
@@ -153,7 +153,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
153 GNUNET_assert (NULL != cls); 153 GNUNET_assert (NULL != cls);
154 154
155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
156 "Name store added record for `%s': %s\n", 156 "Name store added record for `%s': %s\n",
157 name, 157 name,
158 (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); 158 (success == GNUNET_OK) ? "SUCCESS" : "FAIL");
159 159
@@ -166,7 +166,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
166 166
167 167
168static void 168static void
169run (void *cls, 169run (void *cls,
170 const struct GNUNET_CONFIGURATION_Handle *cfg, 170 const struct GNUNET_CONFIGURATION_Handle *cfg,
171 struct GNUNET_TESTING_Peer *peer) 171 struct GNUNET_TESTING_Peer *peer)
172{ 172{
@@ -174,7 +174,7 @@ run (void *cls,
174 char *hostkey_file; 174 char *hostkey_file;
175 const char * name = "dummy.dummy.gnunet"; 175 const char * name = "dummy.dummy.gnunet";
176 176
177 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 177 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
178 &endbadly, NULL); 178 &endbadly, NULL);
179 GNUNET_asprintf (&hostkey_file, 179 GNUNET_asprintf (&hostkey_file,
180 "zonefiles%s%s", 180 "zonefiles%s%s",
@@ -211,7 +211,7 @@ int
211main (int argc, char *argv[]) 211main (int argc, char *argv[])
212{ 212{
213 res = 1; 213 res = 1;
214 if (0 != 214 if (0 !=
215 GNUNET_TESTING_service_run ("test-namestore-api", 215 GNUNET_TESTING_service_run ("test-namestore-api",
216 "namestore", 216 "namestore",
217 "test_namestore_api.conf", 217 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c
index 1a08635ed..8b10763c0 100644
--- a/src/namestore/test_namestore_api_store_update.c
+++ b/src/namestore/test_namestore_api_store_update.c
@@ -123,21 +123,21 @@ rd_decrypt_cb (void *cls,
123 { 123 {
124 char rd_cmp_data[TEST_RECORD_DATALEN]; 124 char rd_cmp_data[TEST_RECORD_DATALEN];
125 memset (rd_cmp_data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); 125 memset (rd_cmp_data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
126 126
127 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type); 127 GNUNET_assert (TEST_RECORD_TYPE == rd[0].record_type);
128 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size); 128 GNUNET_assert (TEST_RECORD_DATALEN == rd[0].data_size);
129 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN)); 129 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN));
130 130
131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 131 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
132 "Block was decrypted successfully, updating record \n"); 132 "Block was decrypted successfully, updating record \n");
133 133
134 rd_new.flags = GNUNET_NAMESTORE_RF_NONE; 134 rd_new.flags = GNUNET_NAMESTORE_RF_NONE;
135 rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; 135 rd_new.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
136 rd_new.record_type = TEST_RECORD_TYPE2; 136 rd_new.record_type = TEST_RECORD_TYPE2;
137 rd_new.data_size = TEST_RECORD_DATALEN2; 137 rd_new.data_size = TEST_RECORD_DATALEN2;
138 rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2); 138 rd_new.data = GNUNET_malloc (TEST_RECORD_DATALEN2);
139 memset ((char *) rd_new.data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); 139 memset ((char *) rd_new.data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2);
140 140
141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, 141 nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name,
142 1, &rd_new, &put_cont, (void *) name); 142 1, &rd_new, &put_cont, (void *) name);
143 update_performed = GNUNET_YES; 143 update_performed = GNUNET_YES;
@@ -146,11 +146,11 @@ rd_decrypt_cb (void *cls,
146 { 146 {
147 char rd_cmp_data[TEST_RECORD_DATALEN2]; 147 char rd_cmp_data[TEST_RECORD_DATALEN2];
148 memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2); 148 memset (rd_cmp_data, TEST_RECORD_DATA2, TEST_RECORD_DATALEN2);
149 149
150 GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type); 150 GNUNET_assert (TEST_RECORD_TYPE2 == rd[0].record_type);
151 GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size); 151 GNUNET_assert (TEST_RECORD_DATALEN2 == rd[0].data_size);
152 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2)); 152 GNUNET_assert (0 == memcmp (&rd_cmp_data, rd[0].data, TEST_RECORD_DATALEN2));
153 153
154 GNUNET_SCHEDULER_add_now (&end, NULL); 154 GNUNET_SCHEDULER_add_now (&end, NULL);
155 } 155 }
156} 156}
@@ -210,7 +210,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
210 210
211 211
212static void 212static void
213run (void *cls, 213run (void *cls,
214 const struct GNUNET_CONFIGURATION_Handle *cfg, 214 const struct GNUNET_CONFIGURATION_Handle *cfg,
215 struct GNUNET_TESTING_Peer *peer) 215 struct GNUNET_TESTING_Peer *peer)
216{ 216{
@@ -218,7 +218,7 @@ run (void *cls,
218 char *hostkey_file; 218 char *hostkey_file;
219 219
220 update_performed = GNUNET_NO; 220 update_performed = GNUNET_NO;
221 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 221 endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
222 &endbadly, NULL); 222 &endbadly, NULL);
223 GNUNET_asprintf (&hostkey_file, 223 GNUNET_asprintf (&hostkey_file,
224 "zonefiles%s%s", 224 "zonefiles%s%s",
@@ -255,7 +255,7 @@ int
255main (int argc, char *argv[]) 255main (int argc, char *argv[])
256{ 256{
257 res = 1; 257 res = 1;
258 if (0 != 258 if (0 !=
259 GNUNET_TESTING_service_run ("test-namestore-api-store-update", 259 GNUNET_TESTING_service_run ("test-namestore-api-store-update",
260 "namestore", 260 "namestore",
261 "test_namestore_api.conf", 261 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index d496fe618..94fd6d008 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -173,7 +173,7 @@ zone_proc (void *cls,
173 else 173 else
174 res = 1; 174 res = 1;
175 175
176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 176 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
177 "Received last result, iteration done after receing %u results\n", 177 "Received last result, iteration done after receing %u results\n",
178 returned_records ); 178 returned_records );
179 GNUNET_SCHEDULER_add_now (&end, NULL); 179 GNUNET_SCHEDULER_add_now (&end, NULL);
@@ -414,7 +414,7 @@ empty_zone_proc (void *cls,
414 414
415 415
416static void 416static void
417run (void *cls, 417run (void *cls,
418 const struct GNUNET_CONFIGURATION_Handle *cfg, 418 const struct GNUNET_CONFIGURATION_Handle *cfg,
419 struct GNUNET_TESTING_Peer *peer) 419 struct GNUNET_TESTING_Peer *peer)
420{ 420{
@@ -438,7 +438,7 @@ int
438main (int argc, char *argv[]) 438main (int argc, char *argv[])
439{ 439{
440 res = 1; 440 res = 1;
441 if (0 != 441 if (0 !=
442 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", 442 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration",
443 "namestore", 443 "namestore",
444 "test_namestore_api.conf", 444 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index 1f201ce46..a34e742f0 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -416,7 +416,7 @@ int
416main (int argc, char *argv[]) 416main (int argc, char *argv[])
417{ 417{
418 res = 1; 418 res = 1;
419 if (0 != 419 if (0 !=
420 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration", 420 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration",
421 "namestore", 421 "namestore",
422 "test_namestore_api.conf", 422 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 3e5014d8e..ebc26db79 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -450,7 +450,7 @@ int
450main (int argc, char *argv[]) 450main (int argc, char *argv[])
451{ 451{
452 res = 1; 452 res = 1;
453 if (0 != 453 if (0 !=
454 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration-stop", 454 GNUNET_TESTING_service_run ("test-namestore-api-zone-iteration-stop",
455 "namestore", 455 "namestore",
456 "test_namestore_api.conf", 456 "test_namestore_api.conf",
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index e3df0bd22..1eeed1001 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -207,7 +207,7 @@ int
207main (int argc, char *argv[]) 207main (int argc, char *argv[])
208{ 208{
209 res = 1; 209 res = 1;
210 if (0 != 210 if (0 !=
211 GNUNET_TESTING_service_run ("test-namestore-api-zone-to-name", 211 GNUNET_TESTING_service_run ("test-namestore-api-zone-to-name",
212 "namestore", 212 "namestore",
213 "test_namestore_api.conf", 213 "test_namestore_api.conf",
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index d7742373a..5274e8bca 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -79,7 +79,7 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg)
79} 79}
80 80
81 81
82static void 82static void
83test_record (void *cls, 83test_record (void *cls,
84 const struct GNUNET_CRYPTO_EccPrivateKey *private_key, 84 const struct GNUNET_CRYPTO_EccPrivateKey *private_key,
85 const char *label, 85 const char *label,
@@ -134,7 +134,7 @@ put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id)
134 rd[i].data_size = id % 10; 134 rd[i].data_size = id % 10;
135 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us; 135 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES).abs_value_us;
136 rd[i].record_type = 1 + (id % 13); 136 rd[i].record_type = 1 + (id % 13);
137 rd[i].flags = (id % 7); 137 rd[i].flags = (id % 7);
138 } 138 }
139 memset (&zone_private_key, (id % 241), sizeof (zone_private_key)); 139 memset (&zone_private_key, (id % 241), sizeof (zone_private_key));
140 memset (&signature, (id % 243), sizeof (signature)); 140 memset (&signature, (id % 243), sizeof (signature));
@@ -150,14 +150,14 @@ static void
150run (void *cls, char *const *args, const char *cfgfile, 150run (void *cls, char *const *args, const char *cfgfile,
151 const struct GNUNET_CONFIGURATION_Handle *cfg) 151 const struct GNUNET_CONFIGURATION_Handle *cfg)
152{ 152{
153 struct GNUNET_NAMESTORE_PluginFunctions *nsp; 153 struct GNUNET_NAMESTORE_PluginFunctions *nsp;
154 154
155 ok = 0; 155 ok = 0;
156 nsp = load_plugin (cfg); 156 nsp = load_plugin (cfg);
157 if (NULL == nsp) 157 if (NULL == nsp)
158 { 158 {
159 FPRINTF (stderr, 159 FPRINTF (stderr,
160 "%s", 160 "%s",
161 "Failed to initialize namestore. Database likely not setup, skipping test.\n"); 161 "Failed to initialize namestore. Database likely not setup, skipping test.\n");
162 return; 162 return;
163 } 163 }