diff options
Diffstat (limited to 'src/namestore/gnunet-namestore.c')
-rw-r--r-- | src/namestore/gnunet-namestore.c | 78 |
1 files changed, 39 insertions, 39 deletions
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 | */ |
777 | static void | 777 | static void |
778 | identity_cb (void *cls, | 778 | identity_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 | { |