aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tool/gnunet-ats.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-07-17 14:28:59 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-07-17 14:28:59 +0000
commit51587c720c8265adefd30fd0949a7bb30cafa1f3 (patch)
tree5d9ba6e332362c985ad12682dba461d334fd3389 /src/ats-tool/gnunet-ats.c
parent84c1f74382a7563d79f5d48b12af01c9dc0b7505 (diff)
downloadgnunet-51587c720c8265adefd30fd0949a7bb30cafa1f3.tar.gz
gnunet-51587c720c8265adefd30fd0949a7bb30cafa1f3.zip
clean up
Diffstat (limited to 'src/ats-tool/gnunet-ats.c')
-rw-r--r--src/ats-tool/gnunet-ats.c226
1 files changed, 112 insertions, 114 deletions
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c
index 0c7b19790..0e27ee6f8 100644
--- a/src/ats-tool/gnunet-ats.c
+++ b/src/ats-tool/gnunet-ats.c
@@ -29,107 +29,105 @@
29#include "gnunet_transport_service.h" 29#include "gnunet_transport_service.h"
30 30
31/** 31/**
32 * FIXME 32 * String to respresent unlimited
33 */ 33 */
34#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5) 34#define UNLIMITED_STRING "unlimited"
35 35
36/**
37 * FIXME
38 */
39#define BIG_M_STRING "unlimited"
40 36
41/** 37/**
42 * Final status code. 38 * CLI Opt:
43 */ 39 */
44static int ret; 40static int opt_resolve_addresses_numeric;
45 41
46/** 42/**
47 * FIXME 43 * CLI Opt: Print verbose ATS information
48 */ 44 */
49static int results; 45static int opt_verbose;
50 46
51/** 47/**
52 * FIXME 48 * CLI Option: List only addresses currently used (active)
53 */ 49 */
54static int resolve_addresses_numeric; 50static int opt_list_used;
55 51
56/** 52/**
57 * FIXME 53 * CLI Option: List all addresses
58 */ 54 */
59static int receive_done; 55static int opt_list_all;
60 56
61/** 57/**
62 * For which peer should we change preference values? 58 * CLI Option: set preference
63 */ 59 */
64static char *pid_str; 60static int opt_set_pref;
65 61
66/** 62/**
67 * FIXME 63 * CLI Option: print quotas configured
68 */ 64 */
69static char *type_str; 65static int opt_print_quotas;
70 66
71/** 67/**
72 * FIXME 68 * CLI Option: Monitor addresses used
73 */ 69 */
74static unsigned int value; 70static int opt_monitor;
75 71
76/** 72/**
77 * FIXME 73 * CLI Option: use specific peer
78 */ 74 */
79static int pending; 75static char *opt_pid_str;
80 76
81/** 77/**
82 * Print verbose ATS information 78 * CLI Option: preference type to set
83 */ 79 */
84static int verbose; 80static char *opt_type_str;
85 81
86/** 82/**
87 * List only addresses currently used (active) 83 * CLI Option: preference value to set
88 */ 84 */
89static int op_list_used; 85static unsigned int opt_pref_value;
86
87
90 88
91/** 89/**
92 * List all addresses 90 * Final status code.
93 */ 91 */
94static int op_list_all; 92static int ret;
95 93
96/** 94/**
97 * List all addresses 95 * Number of results returned from service
98 */ 96 */
99static int op_set_pref; 97static int stat_results;
100 98
101/** 99/**
102 * Print quotas configured 100 * State: all pending receive operations done?
103 */ 101 */
104static int op_print_quotas; 102static int stat_receive_done;
105 103
106/** 104/**
107 * Monitor addresses used 105 * State: number of pending operations
108 */ 106 */
109static int op_monitor; 107static int stat_pending;
110 108
111/** 109/**
112 * FIXME 110 * ATS performance handle used
113 */ 111 */
114static struct GNUNET_ATS_PerformanceHandle *ph; 112static struct GNUNET_ATS_PerformanceHandle *ph;
115 113
116/** 114/**
117 * FIXME 115 * ATS address list handle used
118 */ 116 */
119static struct GNUNET_ATS_AddressListHandle *alh; 117static struct GNUNET_ATS_AddressListHandle *alh;
120 118
121/** 119/**
122 * FIXME 120 * Configuration handle
123 */ 121 */
124static struct GNUNET_CONFIGURATION_Handle *cfg; 122static struct GNUNET_CONFIGURATION_Handle *cfg;
125 123
126/** 124/**
127 * FIXME 125 * Shutdown task
128 */ 126 */
129static GNUNET_SCHEDULER_TaskIdentifier end_task; 127static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
130 128
131/** 129/**
132 * FIXME 130 * Hashmap to store addresses
133 */ 131 */
134static struct GNUNET_CONTAINER_MultiPeerMap *addresses; 132static struct GNUNET_CONTAINER_MultiPeerMap *addresses;
135 133
@@ -301,10 +299,10 @@ end (void *cls,
301 FPRINTF (stderr, 299 FPRINTF (stderr,
302 _("%u address resolutions had a timeout\n"), 300 _("%u address resolutions had a timeout\n"),
303 pending); 301 pending);
304 if (op_list_used || op_list_all) 302 if (opt_list_used || opt_list_all)
305 FPRINTF (stderr, 303 FPRINTF (stderr,
306 _("ATS returned results for %u addresses\n"), 304 _("ATS returned stat_results for %u addresses\n"),
307 results); 305 stat_results);
308 ret = 0; 306 ret = 0;
309} 307}
310 308
@@ -346,14 +344,14 @@ transport_addr_to_str_cb (void *cls,
346 GNUNET_CONTAINER_DLL_remove(head, tail, pr); 344 GNUNET_CONTAINER_DLL_remove(head, tail, pr);
347 GNUNET_free(pr->address); 345 GNUNET_free(pr->address);
348 GNUNET_free(pr); 346 GNUNET_free(pr);
349 pending--; 347 stat_pending--;
350 348
351 if ((GNUNET_YES == receive_done) && (0 == pending)) 349 if ((GNUNET_YES == stat_receive_done) && (0 == stat_pending))
352 { 350 {
353 /* All messages received and no resolutions pending*/ 351 /* All messages received and no resolutions pending*/
354 if (end_task != GNUNET_SCHEDULER_NO_TASK) 352 if (shutdown_task != GNUNET_SCHEDULER_NO_TASK)
355 GNUNET_SCHEDULER_cancel (end_task); 353 GNUNET_SCHEDULER_cancel (shutdown_task);
356 end_task = GNUNET_SCHEDULER_add_now (end, NULL); 354 shutdown_task = GNUNET_SCHEDULER_add_now (end, NULL);
357 } 355 }
358 return; 356 return;
359 } 357 }
@@ -417,7 +415,7 @@ transport_addr_to_str_cb (void *cls,
417 GNUNET_asprintf (&ats_prop_value, "%u", ats_value); 415 GNUNET_asprintf (&ats_prop_value, "%u", ats_value);
418 break; 416 break;
419 } 417 }
420 if ((verbose) && (ats_type < GNUNET_ATS_PropertyCount)) 418 if ((opt_verbose) && (ats_type < GNUNET_ATS_PropertyCount))
421 { 419 {
422 GNUNET_asprintf (&ats_str, 420 GNUNET_asprintf (&ats_str,
423 "%s%s=%s, ", 421 "%s%s=%s, ",
@@ -559,7 +557,7 @@ ats_perf_mon_cb (void *cls,
559 return; 557 return;
560 } 558 }
561 559
562 if (GNUNET_NO == verbose) 560 if (GNUNET_NO == opt_verbose)
563 { 561 {
564 struct AddressFindCtx actx; 562 struct AddressFindCtx actx;
565 struct ATSAddress *a; 563 struct ATSAddress *a;
@@ -611,13 +609,13 @@ ats_perf_mon_cb (void *cls,
611 pr->bandwidth_out = bandwidth_out; 609 pr->bandwidth_out = bandwidth_out;
612 pr->active = active; 610 pr->active = active;
613 pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address, 611 pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
614 resolve_addresses_numeric, 612 opt_resolve_addresses_numeric,
615 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), 613 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
616 &transport_addr_to_str_cb, 614 &transport_addr_to_str_cb,
617 pr); 615 pr);
618 GNUNET_CONTAINER_DLL_insert (head, tail, pr); 616 GNUNET_CONTAINER_DLL_insert (head, tail, pr);
619 results++; 617 stat_results++;
620 pending++; 618 stat_pending++;
621} 619}
622 620
623 621
@@ -647,14 +645,14 @@ ats_perf_cb (void *cls,
647 if (NULL == address) 645 if (NULL == address)
648 { 646 {
649 /* All messages received */ 647 /* All messages received */
650 receive_done = GNUNET_YES; 648 stat_receive_done = GNUNET_YES;
651 alh = NULL; 649 alh = NULL;
652 if (0 == pending) 650 if (0 == stat_pending)
653 { 651 {
654 /* All messages received and no resolutions pending*/ 652 /* All messages received and no resolutions pending*/
655 if (end_task != GNUNET_SCHEDULER_NO_TASK) 653 if (shutdown_task != GNUNET_SCHEDULER_NO_TASK)
656 GNUNET_SCHEDULER_cancel (end_task); 654 GNUNET_SCHEDULER_cancel (shutdown_task);
657 end_task = GNUNET_SCHEDULER_add_now (end, NULL); 655 shutdown_task = GNUNET_SCHEDULER_add_now (end, NULL);
658 } 656 }
659 return; 657 return;
660 } 658 }
@@ -671,12 +669,12 @@ ats_perf_cb (void *cls,
671 pr->bandwidth_out = bandwidth_out; 669 pr->bandwidth_out = bandwidth_out;
672 pr->active = active; 670 pr->active = active;
673 pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address, 671 pr->tats_ctx = GNUNET_TRANSPORT_address_to_string (cfg, address,
674 resolve_addresses_numeric, 672 opt_resolve_addresses_numeric,
675 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10), 673 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
676 &transport_addr_to_str_cb, pr); 674 &transport_addr_to_str_cb, pr);
677 GNUNET_CONTAINER_DLL_insert (head, tail, pr); 675 GNUNET_CONTAINER_DLL_insert (head, tail, pr);
678 results++; 676 stat_results++;
679 pending++; 677 stat_pending++;
680} 678}
681 679
682 680
@@ -716,7 +714,7 @@ print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg)
716 entry_out, 714 entry_out,
717 &quota_out_str)) 715 &quota_out_str))
718 { 716 {
719 if (0 == strcmp (quota_out_str, BIG_M_STRING) 717 if (0 == strcmp (quota_out_str, UNLIMITED_STRING)
720 || (GNUNET_SYSERR == 718 || (GNUNET_SYSERR ==
721 GNUNET_STRINGS_fancy_size_to_bytes (quota_out_str, 719 GNUNET_STRINGS_fancy_size_to_bytes (quota_out_str,
722 &quota_out))) 720 &quota_out)))
@@ -741,7 +739,7 @@ print_quotas (const struct GNUNET_CONFIGURATION_Handle *cfg)
741 entry_in, 739 entry_in,
742 &quota_in_str)) 740 &quota_in_str))
743 { 741 {
744 if (0 == strcmp (quota_in_str, BIG_M_STRING) 742 if (0 == strcmp (quota_in_str, UNLIMITED_STRING)
745 || (GNUNET_SYSERR == 743 || (GNUNET_SYSERR ==
746 GNUNET_STRINGS_fancy_size_to_bytes (quota_in_str, &quota_in))) 744 GNUNET_STRINGS_fancy_size_to_bytes (quota_in_str, &quota_in)))
747 quota_in = UINT32_MAX; 745 quota_in = UINT32_MAX;
@@ -795,22 +793,22 @@ testservice_ats (void *cls,
795 return; 793 return;
796 } 794 }
797 795
798 results = 0; 796 stat_results = 0;
799 797
800 if (NULL != pid_str) 798 if (NULL != opt_pid_str)
801 { 799 {
802 if (GNUNET_OK 800 if (GNUNET_OK
803 != GNUNET_CRYPTO_eddsa_public_key_from_string (pid_str, 801 != GNUNET_CRYPTO_eddsa_public_key_from_string (opt_pid_str,
804 strlen (pid_str), &pid.public_key)) 802 strlen (opt_pid_str), &pid.public_key))
805 { 803 {
806 FPRINTF (stderr, 804 FPRINTF (stderr,
807 _("Failed to parse peer identity `%s'\n"), 805 _("Failed to parse peer identity `%s'\n"),
808 pid_str); 806 opt_pid_str);
809 return; 807 return;
810 } 808 }
811 } 809 }
812 810
813 c = op_list_all + op_list_used + op_monitor + op_set_pref; 811 c = opt_list_all + opt_list_used + opt_monitor + opt_set_pref;
814 if ((1 < c)) 812 if ((1 < c))
815 { 813 {
816 FPRINTF (stderr, 814 FPRINTF (stderr,
@@ -823,13 +821,13 @@ testservice_ats (void *cls,
823 return; 821 return;
824 } 822 }
825 if ((0 == c)) 823 if ((0 == c))
826 op_list_used = GNUNET_YES; /* set default */ 824 opt_list_used = GNUNET_YES; /* set default */
827 if (op_print_quotas) 825 if (opt_print_quotas)
828 { 826 {
829 ret = print_quotas (cfg); 827 ret = print_quotas (cfg);
830 return; 828 return;
831 } 829 }
832 if (op_list_all) 830 if (opt_list_all)
833 { 831 {
834 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 832 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
835 if (NULL == ph) 833 if (NULL == ph)
@@ -841,7 +839,7 @@ testservice_ats (void *cls,
841 } 839 }
842 840
843 alh = GNUNET_ATS_performance_list_addresses (ph, 841 alh = GNUNET_ATS_performance_list_addresses (ph,
844 (NULL == pid_str) ? NULL : &pid, 842 (NULL == opt_pid_str) ? NULL : &pid,
845 GNUNET_YES, 843 GNUNET_YES,
846 &ats_perf_cb, NULL); 844 &ats_perf_cb, NULL);
847 if (NULL == alh) 845 if (NULL == alh)
@@ -849,14 +847,14 @@ testservice_ats (void *cls,
849 FPRINTF (stderr, 847 FPRINTF (stderr,
850 "%s", 848 "%s",
851 _("Cannot issue request to ATS service, exiting...\n")); 849 _("Cannot issue request to ATS service, exiting...\n"));
852 end_task = GNUNET_SCHEDULER_add_now (&end, NULL); 850 shutdown_task = GNUNET_SCHEDULER_add_now (&end, NULL);
853 return; 851 return;
854 } 852 }
855 end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 853 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
856 &end, 854 &end,
857 NULL); 855 NULL);
858 } 856 }
859 else if (op_list_used) 857 else if (opt_list_used)
860 { 858 {
861 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL); 859 ph = GNUNET_ATS_performance_init (cfg, NULL, NULL);
862 if (NULL == ph) 860 if (NULL == ph)
@@ -865,7 +863,7 @@ testservice_ats (void *cls,
865 _("Cannot connect to ATS service, exiting...\n")); 863 _("Cannot connect to ATS service, exiting...\n"));
866 864
867 alh = GNUNET_ATS_performance_list_addresses (ph, 865 alh = GNUNET_ATS_performance_list_addresses (ph,
868 (NULL == pid_str) 866 (NULL == opt_pid_str)
869 ? NULL 867 ? NULL
870 : &pid, 868 : &pid,
871 GNUNET_NO, 869 GNUNET_NO,
@@ -875,14 +873,14 @@ testservice_ats (void *cls,
875 FPRINTF (stderr, 873 FPRINTF (stderr,
876 "%s", 874 "%s",
877 _("Cannot issue request to ATS service, exiting...\n")); 875 _("Cannot issue request to ATS service, exiting...\n"));
878 end_task = GNUNET_SCHEDULER_add_now (&end, NULL); 876 shutdown_task = GNUNET_SCHEDULER_add_now (&end, NULL);
879 return; 877 return;
880 } 878 }
881 end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 879 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
882 &end, 880 &end,
883 NULL); 881 NULL);
884 } 882 }
885 else if (op_monitor) 883 else if (opt_monitor)
886 { 884 {
887 ph = GNUNET_ATS_performance_init (cfg, 885 ph = GNUNET_ATS_performance_init (cfg,
888 &ats_perf_mon_cb, 886 &ats_perf_mon_cb,
@@ -891,21 +889,21 @@ testservice_ats (void *cls,
891 FPRINTF (stderr, 889 FPRINTF (stderr,
892 "%s", 890 "%s",
893 _("Cannot connect to ATS service, exiting...\n")); 891 _("Cannot connect to ATS service, exiting...\n"));
894 end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 892 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
895 &end, 893 &end,
896 NULL); 894 NULL);
897 895
898 } 896 }
899 else if (op_set_pref) 897 else if (opt_set_pref)
900 { 898 {
901 if (NULL == type_str) 899 if (NULL == opt_type_str)
902 { 900 {
903 FPRINTF (stderr, 901 FPRINTF (stderr,
904 "%s", 902 "%s",
905 _("No preference type given!\n")); 903 _("No preference type given!\n"));
906 return; 904 return;
907 } 905 }
908 if (NULL == pid_str) 906 if (NULL == opt_pid_str)
909 { 907 {
910 FPRINTF (stderr, 908 FPRINTF (stderr,
911 "%s", 909 "%s",
@@ -913,15 +911,15 @@ testservice_ats (void *cls,
913 return; 911 return;
914 } 912 }
915 913
916 for (c = 0; c < strlen (type_str); c++) 914 for (c = 0; c < strlen (opt_type_str); c++)
917 { 915 {
918 if (isupper (type_str[c])) 916 if (isupper (opt_type_str[c]))
919 type_str[c] = tolower (type_str[c]); 917 opt_type_str[c] = tolower (opt_type_str[c]);
920 } 918 }
921 919
922 if (0 == strcasecmp ("latency", type_str)) 920 if (0 == strcasecmp ("latency", opt_type_str))
923 type = GNUNET_ATS_PREFERENCE_LATENCY; 921 type = GNUNET_ATS_PREFERENCE_LATENCY;
924 else if (0 == strcasecmp ("bandwidth", type_str)) 922 else if (0 == strcasecmp ("bandwidth", opt_type_str))
925 type = GNUNET_ATS_PREFERENCE_BANDWIDTH; 923 type = GNUNET_ATS_PREFERENCE_BANDWIDTH;
926 else 924 else
927 { 925 {
@@ -938,10 +936,10 @@ testservice_ats (void *cls,
938 "%s", 936 "%s",
939 _("Cannot connect to ATS service, exiting...\n")); 937 _("Cannot connect to ATS service, exiting...\n"));
940 938
941 GNUNET_ATS_performance_change_preference (ph, &pid, type, (double) value, 939 GNUNET_ATS_performance_change_preference (ph, &pid, type, (double) opt_pref_value,
942 GNUNET_ATS_PREFERENCE_END); 940 GNUNET_ATS_PREFERENCE_END);
943 941
944 end_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 942 shutdown_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
945 &end, 943 &end,
946 NULL); 944 NULL);
947 } 945 }
@@ -964,9 +962,9 @@ run (void *cls,
964 const struct GNUNET_CONFIGURATION_Handle *my_cfg) 962 const struct GNUNET_CONFIGURATION_Handle *my_cfg)
965{ 963{
966 cfg = (struct GNUNET_CONFIGURATION_Handle *) my_cfg; 964 cfg = (struct GNUNET_CONFIGURATION_Handle *) my_cfg;
967 GNUNET_CLIENT_service_test ("ats", cfg, TIMEOUT, 965 GNUNET_CLIENT_service_test ("ats", cfg,
968 &testservice_ats, 966 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5),
969 (void *) cfg); 967 &testservice_ats, (void *) cfg);
970} 968}
971 969
972 970
@@ -983,41 +981,41 @@ main (int argc,
983{ 981{
984 int res; 982 int res;
985 983
986 resolve_addresses_numeric = GNUNET_NO; 984 opt_resolve_addresses_numeric = GNUNET_NO;
987 op_monitor = GNUNET_NO; 985 opt_monitor = GNUNET_NO;
988 op_list_all = GNUNET_NO; 986 opt_list_all = GNUNET_NO;
989 op_list_used = GNUNET_NO; 987 opt_list_used = GNUNET_NO;
990 op_set_pref = GNUNET_NO; 988 opt_set_pref = GNUNET_NO;
991 pending = 0; 989 stat_pending = 0;
992 receive_done = GNUNET_NO; 990 stat_receive_done = GNUNET_NO;
993 type_str = NULL; 991 opt_type_str = NULL;
994 992
995 static const struct GNUNET_GETOPT_CommandLineOption options[] = 993 static const struct GNUNET_GETOPT_CommandLineOption options[] =
996 { 994 {
997 { 'u', "used", NULL, 995 { 'u', "used", NULL,
998 gettext_noop ("get list of active addresses currently used"), 0, 996 gettext_noop ("get list of active addresses currently used"), 0,
999 &GNUNET_GETOPT_set_one, &op_list_used }, 997 &GNUNET_GETOPT_set_one, &opt_list_used },
1000 { 'a', "all", NULL, gettext_noop ("get list of all active addresses"), 0, 998 { 'a', "all", NULL, gettext_noop ("get list of all active addresses"), 0,
1001 &GNUNET_GETOPT_set_one, &op_list_all }, 999 &GNUNET_GETOPT_set_one, &opt_list_all },
1002 { 'n', "numeric", NULL, 1000 { 'n', "numeric", NULL,
1003 gettext_noop ("do not resolve IP addresses to hostnames"), 0, 1001 gettext_noop ("do not resolve IP addresses to hostnames"), 0,
1004 &GNUNET_GETOPT_set_one, &resolve_addresses_numeric }, 1002 &GNUNET_GETOPT_set_one, &opt_resolve_addresses_numeric },
1005 { 'm', "monitor", NULL, gettext_noop ("monitor mode"), 0, 1003 { 'm', "monitor", NULL, gettext_noop ("monitor mode"), 0,
1006 &GNUNET_GETOPT_set_one, &op_monitor }, 1004 &GNUNET_GETOPT_set_one, &opt_monitor },
1007 { 'p', "preference", NULL, gettext_noop ("set preference for the given peer"), 1005 { 'p', "preference", NULL, gettext_noop ("set preference for the given peer"),
1008 0, &GNUNET_GETOPT_set_one, &op_set_pref }, 1006 0, &GNUNET_GETOPT_set_one, &opt_set_pref },
1009 { 'q', "quotas", NULL, gettext_noop ("print all configured quotas"), 0, 1007 { 'q', "quotas", NULL, gettext_noop ("print all configured quotas"), 0,
1010 &GNUNET_GETOPT_set_one, &op_print_quotas }, 1008 &GNUNET_GETOPT_set_one, &opt_print_quotas },
1011 { 'i', "id", "TYPE", gettext_noop ("peer id"), 1, &GNUNET_GETOPT_set_string, 1009 { 'i', "id", "TYPE", gettext_noop ("peer id"), 1, &GNUNET_GETOPT_set_string,
1012 &pid_str }, 1010 &opt_pid_str },
1013 { 't', "type", "TYPE", 1011 { 't', "type", "TYPE",
1014 gettext_noop ("preference type to set: latency | bandwidth"), 1, 1012 gettext_noop ("preference type to set: latency | bandwidth"), 1,
1015 &GNUNET_GETOPT_set_string, &type_str }, 1013 &GNUNET_GETOPT_set_string, &opt_type_str },
1016 { 'k', "value", "VALUE", gettext_noop ("preference value"), 1, 1014 { 'k', "value", "VALUE", gettext_noop ("preference value"), 1,
1017 &GNUNET_GETOPT_set_uint, &value }, 1015 &GNUNET_GETOPT_set_uint, &opt_pref_value },
1018 { 'V', "verbose", NULL, 1016 { 'V', "verbose", NULL,
1019 gettext_noop ("verbose output (include ATS address properties)"), 0, 1017 gettext_noop ("verbose output (include ATS address properties)"), 0,
1020 &GNUNET_GETOPT_set_one, &verbose }, GNUNET_GETOPT_OPTION_END }; 1018 &GNUNET_GETOPT_set_one, &opt_verbose }, GNUNET_GETOPT_OPTION_END };
1021 1019
1022 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 1020 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
1023 return 2; 1021 return 2;
@@ -1026,8 +1024,8 @@ main (int argc,
1026 gettext_noop ("Print information about ATS state"), 1024 gettext_noop ("Print information about ATS state"),
1027 options, 1025 options,
1028 &run, NULL); 1026 &run, NULL);
1029 GNUNET_free_non_null(pid_str); 1027 GNUNET_free_non_null(opt_pid_str);
1030 GNUNET_free_non_null(type_str); 1028 GNUNET_free_non_null(opt_type_str);
1031 GNUNET_free((void *) argv); 1029 GNUNET_free((void *) argv);
1032 1030
1033 if (GNUNET_OK == res) 1031 if (GNUNET_OK == res)