diff options
author | xrs <xrs@mail36.net> | 2017-03-29 19:07:29 +0200 |
---|---|---|
committer | xrs <xrs@mail36.net> | 2017-03-29 19:07:29 +0200 |
commit | 990c536e0f1c4adce5ba49897e2084d6296fdafc (patch) | |
tree | 82152434c86c938005624703e04dd514c4181e69 /src | |
parent | 03512957fb04969d08fb7eac0952a747aa9596ae (diff) | |
parent | 2b87f173e360aaf4a3bac3fbc6e5b4dc44cf58cd (diff) | |
download | gnunet-990c536e0f1c4adce5ba49897e2084d6296fdafc.tar.gz gnunet-990c536e0f1c4adce5ba49897e2084d6296fdafc.zip |
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src')
91 files changed, 1377 insertions, 598 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c index 78c78738a..4c30985b1 100644 --- a/src/arm/gnunet-arm.c +++ b/src/arm/gnunet-arm.c | |||
@@ -764,64 +764,64 @@ main (int argc, char *const *argv) | |||
764 | { | 764 | { |
765 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 765 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
766 | 766 | ||
767 | GNUNET_GETOPT_OPTION_SET_ONE ('e', | 767 | GNUNET_GETOPT_option_flag ('e', |
768 | "end", | 768 | "end", |
769 | gettext_noop ("stop all GNUnet services"), | 769 | gettext_noop ("stop all GNUnet services"), |
770 | &end), | 770 | &end), |
771 | 771 | ||
772 | GNUNET_GETOPT_OPTION_STRING ('i', | 772 | GNUNET_GETOPT_option_string ('i', |
773 | "init", | 773 | "init", |
774 | "SERVICE", | 774 | "SERVICE", |
775 | gettext_noop ("start a particular service"), | 775 | gettext_noop ("start a particular service"), |
776 | &init), | 776 | &init), |
777 | 777 | ||
778 | GNUNET_GETOPT_OPTION_STRING ('k', | 778 | GNUNET_GETOPT_option_string ('k', |
779 | "kill", | 779 | "kill", |
780 | "SERVICE", | 780 | "SERVICE", |
781 | gettext_noop ("stop a particular service"), | 781 | gettext_noop ("stop a particular service"), |
782 | &term), | 782 | &term), |
783 | 783 | ||
784 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 784 | GNUNET_GETOPT_option_flag ('s', |
785 | "start", | 785 | "start", |
786 | gettext_noop ("start all GNUnet default services"), | 786 | gettext_noop ("start all GNUnet default services"), |
787 | &start), | 787 | &start), |
788 | 788 | ||
789 | GNUNET_GETOPT_OPTION_SET_ONE ('r', | 789 | GNUNET_GETOPT_option_flag ('r', |
790 | "restart", | 790 | "restart", |
791 | gettext_noop ("stop and start all GNUnet default services"), | 791 | gettext_noop ("stop and start all GNUnet default services"), |
792 | &restart), | 792 | &restart), |
793 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 793 | GNUNET_GETOPT_option_flag ('d', |
794 | "delete", | 794 | "delete", |
795 | gettext_noop ("delete config file and directory on exit"), | 795 | gettext_noop ("delete config file and directory on exit"), |
796 | &delete), | 796 | &delete), |
797 | 797 | ||
798 | GNUNET_GETOPT_OPTION_SET_ONE ('m', | 798 | GNUNET_GETOPT_option_flag ('m', |
799 | "monitor", | 799 | "monitor", |
800 | gettext_noop ("monitor ARM activities"), | 800 | gettext_noop ("monitor ARM activities"), |
801 | &monitor), | 801 | &monitor), |
802 | 802 | ||
803 | GNUNET_GETOPT_OPTION_SET_ONE ('q', | 803 | GNUNET_GETOPT_option_flag ('q', |
804 | "quiet", | 804 | "quiet", |
805 | gettext_noop ("don't print status messages"), | 805 | gettext_noop ("don't print status messages"), |
806 | &quiet), | 806 | &quiet), |
807 | 807 | ||
808 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T', | 808 | GNUNET_GETOPT_option_relative_time ('T', |
809 | "timeout", | 809 | "timeout", |
810 | "DELAY", | 810 | "DELAY", |
811 | gettext_noop ("exit with error status if operation does not finish after DELAY"), | 811 | gettext_noop ("exit with error status if operation does not finish after DELAY"), |
812 | &timeout), | 812 | &timeout), |
813 | 813 | ||
814 | GNUNET_GETOPT_OPTION_SET_ONE ('I', | 814 | GNUNET_GETOPT_option_flag ('I', |
815 | "info", | 815 | "info", |
816 | gettext_noop ("list currently running services"), | 816 | gettext_noop ("list currently running services"), |
817 | &list), | 817 | &list), |
818 | 818 | ||
819 | GNUNET_GETOPT_OPTION_SET_ONE ('O', | 819 | GNUNET_GETOPT_option_flag ('O', |
820 | "no-stdout", | 820 | "no-stdout", |
821 | gettext_noop ("don't let gnunet-service-arm inherit standard output"), | 821 | gettext_noop ("don't let gnunet-service-arm inherit standard output"), |
822 | &no_stdout), | 822 | &no_stdout), |
823 | 823 | ||
824 | GNUNET_GETOPT_OPTION_SET_ONE ('E', | 824 | GNUNET_GETOPT_option_flag ('E', |
825 | "no-stderr", | 825 | "no-stderr", |
826 | gettext_noop ("don't let gnunet-service-arm inherit standard error"), | 826 | gettext_noop ("don't let gnunet-service-arm inherit standard error"), |
827 | &no_stderr), | 827 | &no_stderr), |
diff --git a/src/ats-tests/gnunet-solver-eval.c b/src/ats-tests/gnunet-solver-eval.c index 1bb7fdee7..04508d1df 100644 --- a/src/ats-tests/gnunet-solver-eval.c +++ b/src/ats-tests/gnunet-solver-eval.c | |||
@@ -933,19 +933,19 @@ main (int argc, char *argv[]) | |||
933 | 933 | ||
934 | struct GNUNET_GETOPT_CommandLineOption options[] = | 934 | struct GNUNET_GETOPT_CommandLineOption options[] = |
935 | { | 935 | { |
936 | GNUNET_GETOPT_OPTION_STRING ('s', | 936 | GNUNET_GETOPT_option_string ('s', |
937 | "solver", | 937 | "solver", |
938 | NULL, | 938 | NULL, |
939 | gettext_noop ("solver to use"), | 939 | gettext_noop ("solver to use"), |
940 | &opt_solver), | 940 | &opt_solver), |
941 | 941 | ||
942 | GNUNET_GETOPT_OPTION_STRING ('e', | 942 | GNUNET_GETOPT_option_string ('e', |
943 | "experiment", | 943 | "experiment", |
944 | NULL, | 944 | NULL, |
945 | gettext_noop ("experiment to use"), | 945 | gettext_noop ("experiment to use"), |
946 | &opt_exp_file), | 946 | &opt_exp_file), |
947 | 947 | ||
948 | GNUNET_GETOPT_OPTION_SET_ONE ('e', | 948 | GNUNET_GETOPT_option_flag ('e', |
949 | "experiment", | 949 | "experiment", |
950 | gettext_noop ("experiment to use"), | 950 | gettext_noop ("experiment to use"), |
951 | &opt_verbose), | 951 | &opt_verbose), |
diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index f645ba56d..5ec7693b1 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c | |||
@@ -945,58 +945,58 @@ main (int argc, | |||
945 | opt_type_str = NULL; | 945 | opt_type_str = NULL; |
946 | 946 | ||
947 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 947 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
948 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | 948 | GNUNET_GETOPT_option_flag ('u', |
949 | "used", | 949 | "used", |
950 | gettext_noop ("get list of active addresses currently used"), | 950 | gettext_noop ("get list of active addresses currently used"), |
951 | &opt_list_used), | 951 | &opt_list_used), |
952 | GNUNET_GETOPT_OPTION_SET_ONE ('a', | 952 | GNUNET_GETOPT_option_flag ('a', |
953 | "all", | 953 | "all", |
954 | gettext_noop ("get list of all active addresses"), | 954 | gettext_noop ("get list of all active addresses"), |
955 | &opt_list_all), | 955 | &opt_list_all), |
956 | 956 | ||
957 | GNUNET_GETOPT_OPTION_STRING ('C', | 957 | GNUNET_GETOPT_option_string ('C', |
958 | "connect", | 958 | "connect", |
959 | NULL, | 959 | NULL, |
960 | gettext_noop ("connect to PEER"), | 960 | gettext_noop ("connect to PEER"), |
961 | &cpid_str), | 961 | &cpid_str), |
962 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 962 | GNUNET_GETOPT_option_flag ('n', |
963 | "numeric", | 963 | "numeric", |
964 | gettext_noop ("do not resolve IP addresses to hostnames"), | 964 | gettext_noop ("do not resolve IP addresses to hostnames"), |
965 | &opt_resolve_addresses_numeric), | 965 | &opt_resolve_addresses_numeric), |
966 | 966 | ||
967 | GNUNET_GETOPT_OPTION_SET_ONE ('m', | 967 | GNUNET_GETOPT_option_flag ('m', |
968 | "monitor", | 968 | "monitor", |
969 | gettext_noop ("monitor mode"), | 969 | gettext_noop ("monitor mode"), |
970 | &opt_monitor), | 970 | &opt_monitor), |
971 | 971 | ||
972 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 972 | GNUNET_GETOPT_option_flag ('p', |
973 | "preference", | 973 | "preference", |
974 | gettext_noop ("set preference for the given peer"), | 974 | gettext_noop ("set preference for the given peer"), |
975 | &opt_set_pref), | 975 | &opt_set_pref), |
976 | 976 | ||
977 | GNUNET_GETOPT_OPTION_SET_ONE ('q', | 977 | GNUNET_GETOPT_option_flag ('q', |
978 | "quotas", | 978 | "quotas", |
979 | gettext_noop ("print all configured quotas"), | 979 | gettext_noop ("print all configured quotas"), |
980 | &opt_print_quotas), | 980 | &opt_print_quotas), |
981 | GNUNET_GETOPT_OPTION_STRING ('i', | 981 | GNUNET_GETOPT_option_string ('i', |
982 | "id", | 982 | "id", |
983 | "TYPE", | 983 | "TYPE", |
984 | gettext_noop ("peer id"), | 984 | gettext_noop ("peer id"), |
985 | &opt_pid_str), | 985 | &opt_pid_str), |
986 | 986 | ||
987 | GNUNET_GETOPT_OPTION_STRING ('t', | 987 | GNUNET_GETOPT_option_string ('t', |
988 | "type", | 988 | "type", |
989 | "TYPE", | 989 | "TYPE", |
990 | gettext_noop ("preference type to set: latency | bandwidth"), | 990 | gettext_noop ("preference type to set: latency | bandwidth"), |
991 | &opt_type_str), | 991 | &opt_type_str), |
992 | 992 | ||
993 | GNUNET_GETOPT_OPTION_SET_UINT ('k', | 993 | GNUNET_GETOPT_option_uint ('k', |
994 | "value", | 994 | "value", |
995 | "VALUE", | 995 | "VALUE", |
996 | gettext_noop ("preference value"), | 996 | gettext_noop ("preference value"), |
997 | &opt_pref_value), | 997 | &opt_pref_value), |
998 | 998 | ||
999 | GNUNET_GETOPT_OPTION_SET_ONE ('V', | 999 | GNUNET_GETOPT_option_flag ('V', |
1000 | "verbose", | 1000 | "verbose", |
1001 | gettext_noop ("verbose output (include ATS address properties)"), | 1001 | gettext_noop ("verbose output (include ATS address properties)"), |
1002 | &opt_verbose), | 1002 | &opt_verbose), |
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 597285f5e..5af2fbce3 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -3289,29 +3289,29 @@ main (int argc, char *argv[]) | |||
3289 | 3289 | ||
3290 | static struct GNUNET_GETOPT_CommandLineOption options[] = | 3290 | static struct GNUNET_GETOPT_CommandLineOption options[] = |
3291 | { | 3291 | { |
3292 | GNUNET_GETOPT_OPTION_STRING ('s', | 3292 | GNUNET_GETOPT_option_string ('s', |
3293 | "solver", | 3293 | "solver", |
3294 | gettext_noop ("solver to use"), | 3294 | gettext_noop ("solver to use"), |
3295 | &opt_solver), | 3295 | &opt_solver), |
3296 | 3296 | ||
3297 | GNUNET_GETOPT_OPTION_STRING ('e', | 3297 | GNUNET_GETOPT_option_string ('e', |
3298 | "experiment" | 3298 | "experiment" |
3299 | gettext_noop ("experiment to use"), | 3299 | gettext_noop ("experiment to use"), |
3300 | &opt_exp_file), | 3300 | &opt_exp_file), |
3301 | 3301 | ||
3302 | GNUNET_GETOPT_OPTION_VERBOSE (&opt_verbose), | 3302 | GNUNET_GETOPT_option_verbose (&opt_verbose), |
3303 | 3303 | ||
3304 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 3304 | GNUNET_GETOPT_option_flag ('p', |
3305 | "print", | 3305 | "print", |
3306 | gettext_noop ("print logging"), | 3306 | gettext_noop ("print logging"), |
3307 | &opt_print), | 3307 | &opt_print), |
3308 | 3308 | ||
3309 | GNUNET_GETOPT_OPTION_SET_ONE ('f', | 3309 | GNUNET_GETOPT_option_flag ('f', |
3310 | "file", | 3310 | "file", |
3311 | gettext_noop ("save logging to disk"), | 3311 | gettext_noop ("save logging to disk"), |
3312 | &opt_save), | 3312 | &opt_save), |
3313 | 3313 | ||
3314 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 3314 | GNUNET_GETOPT_option_flag ('d', |
3315 | "dn", | 3315 | "dn", |
3316 | gettext_noop ("disable normalization"), | 3316 | gettext_noop ("disable normalization"), |
3317 | &opt_disable_normalization), | 3317 | &opt_disable_normalization), |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 855899b36..7fae3624f 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -1405,37 +1405,37 @@ main (int argc, char *argv[]) | |||
1405 | 1405 | ||
1406 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | 1406 | static struct GNUNET_GETOPT_CommandLineOption options[] = { |
1407 | 1407 | ||
1408 | GNUNET_GETOPT_OPTION_SET_UINT ('a', | 1408 | GNUNET_GETOPT_option_uint ('a', |
1409 | "addresses", | 1409 | "addresses", |
1410 | gettext_noop ("addresses to use"), | 1410 | gettext_noop ("addresses to use"), |
1411 | &ph.N_address), | 1411 | &ph.N_address), |
1412 | 1412 | ||
1413 | GNUNET_GETOPT_OPTION_SET_UINT ('s', | 1413 | GNUNET_GETOPT_option_uint ('s', |
1414 | "start", | 1414 | "start", |
1415 | gettext_noop ("start with peer"), | 1415 | gettext_noop ("start with peer"), |
1416 | &ph.N_peers_start), | 1416 | &ph.N_peers_start), |
1417 | 1417 | ||
1418 | GNUNET_GETOPT_OPTION_SET_UINT ('e', | 1418 | GNUNET_GETOPT_option_uint ('e', |
1419 | "end", | 1419 | "end", |
1420 | gettext_noop ("end with peer"), | 1420 | gettext_noop ("end with peer"), |
1421 | &ph.N_peers_end), | 1421 | &ph.N_peers_end), |
1422 | 1422 | ||
1423 | GNUNET_GETOPT_OPTION_SET_UINT ('i', | 1423 | GNUNET_GETOPT_option_uint ('i', |
1424 | "iterations", | 1424 | "iterations", |
1425 | gettext_noop ("number of iterations used for averaging (default: 1)"), | 1425 | gettext_noop ("number of iterations used for averaging (default: 1)"), |
1426 | &ph.total_iterations), | 1426 | &ph.total_iterations), |
1427 | 1427 | ||
1428 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 1428 | GNUNET_GETOPT_option_uint ('p', |
1429 | "percentage", | 1429 | "percentage", |
1430 | gettext_noop ("update a fix percentage of addresses"), | 1430 | gettext_noop ("update a fix percentage of addresses"), |
1431 | &ph.opt_update_percent), | 1431 | &ph.opt_update_percent), |
1432 | 1432 | ||
1433 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 1433 | GNUNET_GETOPT_option_flag ('d', |
1434 | "data", | 1434 | "data", |
1435 | gettext_noop ("create data file"), | 1435 | gettext_noop ("create data file"), |
1436 | &ph.create_datafile), | 1436 | &ph.create_datafile), |
1437 | 1437 | ||
1438 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | 1438 | GNUNET_GETOPT_option_flag ('u', |
1439 | "update", | 1439 | "update", |
1440 | gettext_noop ("measure updates"), | 1440 | gettext_noop ("measure updates"), |
1441 | &ph.measure_updates), | 1441 | &ph.measure_updates), |
diff --git a/src/auction/gnunet-auction-create.c b/src/auction/gnunet-auction-create.c index e6fcab097..9e6c23b88 100644 --- a/src/auction/gnunet-auction-create.c +++ b/src/auction/gnunet-auction-create.c | |||
@@ -157,30 +157,30 @@ main (int argc, char *const *argv) | |||
157 | { | 157 | { |
158 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 158 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
159 | 159 | ||
160 | GNUNET_GETOPT_OPTION_FILENAME ('d', | 160 | GNUNET_GETOPT_option_filename ('d', |
161 | "description", | 161 | "description", |
162 | "FILE", | 162 | "FILE", |
163 | gettext_noop ("description of the item to be sold"), | 163 | gettext_noop ("description of the item to be sold"), |
164 | &fndesc), | 164 | &fndesc), |
165 | 165 | ||
166 | GNUNET_GETOPT_OPTION_FILENAME ('p', | 166 | GNUNET_GETOPT_option_filename ('p', |
167 | "pricemap", | 167 | "pricemap", |
168 | "FILE", | 168 | "FILE", |
169 | gettext_noop ("mapping of possible prices"), | 169 | gettext_noop ("mapping of possible prices"), |
170 | &fnprices), | 170 | &fnprices), |
171 | 171 | ||
172 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('r', | 172 | GNUNET_GETOPT_option_relative_time ('r', |
173 | "roundtime", | 173 | "roundtime", |
174 | "DURATION", | 174 | "DURATION", |
175 | gettext_noop ("max duration per round"), | 175 | gettext_noop ("max duration per round"), |
176 | &dround), | 176 | &dround), |
177 | 177 | ||
178 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('s', | 178 | GNUNET_GETOPT_option_relative_time ('s', |
179 | "regtime", | 179 | "regtime", |
180 | "DURATION", | 180 | "DURATION", |
181 | gettext_noop ("duration until auction starts"), | 181 | gettext_noop ("duration until auction starts"), |
182 | &dstart), | 182 | &dstart), |
183 | GNUNET_GETOPT_OPTION_SET_UINT ('m', | 183 | GNUNET_GETOPT_option_uint ('m', |
184 | "m", | 184 | "m", |
185 | "NUMBER", | 185 | "NUMBER", |
186 | gettext_noop ("number of items to sell\n" | 186 | gettext_noop ("number of items to sell\n" |
@@ -188,12 +188,12 @@ main (int argc, char *const *argv) | |||
188 | ">0 for vickrey/M+1st price auction"), | 188 | ">0 for vickrey/M+1st price auction"), |
189 | &m), | 189 | &m), |
190 | 190 | ||
191 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | 191 | GNUNET_GETOPT_option_flag ('u', |
192 | "public", | 192 | "public", |
193 | gettext_noop ("public auction outcome"), | 193 | gettext_noop ("public auction outcome"), |
194 | &outcome), | 194 | &outcome), |
195 | 195 | ||
196 | GNUNET_GETOPT_OPTION_SET_ONE ('i', | 196 | GNUNET_GETOPT_option_flag ('i', |
197 | "interactive", | 197 | "interactive", |
198 | gettext_noop ("keep running in foreground until auction completes"), | 198 | gettext_noop ("keep running in foreground until auction completes"), |
199 | &interactive), | 199 | &interactive), |
diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index 560c186cd..de0cec5d0 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h | |||
@@ -350,9 +350,9 @@ struct GNUNET_CADET_ChannelOpenMessage | |||
350 | uint32_t opt GNUNET_PACKED; | 350 | uint32_t opt GNUNET_PACKED; |
351 | 351 | ||
352 | /** | 352 | /** |
353 | * Destination port. | 353 | * Hash of destination port and listener. |
354 | */ | 354 | */ |
355 | struct GNUNET_HashCode port; | 355 | struct GNUNET_HashCode h_port; |
356 | 356 | ||
357 | /** | 357 | /** |
358 | * ID of the channel within the tunnel. | 358 | * ID of the channel within the tunnel. |
@@ -362,15 +362,42 @@ struct GNUNET_CADET_ChannelOpenMessage | |||
362 | 362 | ||
363 | 363 | ||
364 | /** | 364 | /** |
365 | * Message to manage a Channel | 365 | * Message to acknowledge opening a channel of type |
366 | * (#GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, | 366 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK. |
367 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY). | 367 | */ |
368 | struct GNUNET_CADET_ChannelOpenAckMessage | ||
369 | { | ||
370 | /** | ||
371 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK | ||
372 | */ | ||
373 | struct GNUNET_MessageHeader header; | ||
374 | |||
375 | /** | ||
376 | * For alignment. | ||
377 | */ | ||
378 | uint32_t reserved GNUNET_PACKED; | ||
379 | |||
380 | /** | ||
381 | * ID of the channel | ||
382 | */ | ||
383 | struct GNUNET_CADET_ChannelTunnelNumber ctn; | ||
384 | |||
385 | /** | ||
386 | * Port number of the channel, used to prove to the | ||
387 | * initiator that the receiver knows the port. | ||
388 | */ | ||
389 | struct GNUNET_HashCode port; | ||
390 | }; | ||
391 | |||
392 | |||
393 | /** | ||
394 | * Message to destroy a channel of type | ||
395 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY. | ||
368 | */ | 396 | */ |
369 | struct GNUNET_CADET_ChannelManageMessage | 397 | struct GNUNET_CADET_ChannelDestroyMessage |
370 | { | 398 | { |
371 | /** | 399 | /** |
372 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK or | 400 | * Type: #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY |
373 | * #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY | ||
374 | */ | 401 | */ |
375 | struct GNUNET_MessageHeader header; | 402 | struct GNUNET_MessageHeader header; |
376 | 403 | ||
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c index 57eeac735..675e7faf0 100644 --- a/src/cadet/gnunet-cadet.c +++ b/src/cadet/gnunet-cadet.c | |||
@@ -922,49 +922,49 @@ main (int argc, | |||
922 | const char helpstr[] = "Create tunnels and retrieve info about CADET's status."; | 922 | const char helpstr[] = "Create tunnels and retrieve info about CADET's status."; |
923 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 923 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
924 | /* I would use the terminology 'circuit' here... --lynX */ | 924 | /* I would use the terminology 'circuit' here... --lynX */ |
925 | GNUNET_GETOPT_OPTION_STRING ('C', | 925 | GNUNET_GETOPT_option_string ('C', |
926 | "connection", | 926 | "connection", |
927 | "CONNECTION_ID", | 927 | "CONNECTION_ID", |
928 | gettext_noop ("Provide information about a particular connection"), | 928 | gettext_noop ("Provide information about a particular connection"), |
929 | &conn_id), | 929 | &conn_id), |
930 | 930 | ||
931 | GNUNET_GETOPT_OPTION_SET_ONE ('e', | 931 | GNUNET_GETOPT_option_flag ('e', |
932 | "echo", | 932 | "echo", |
933 | gettext_noop ("Activate echo mode"), | 933 | gettext_noop ("Activate echo mode"), |
934 | &echo), | 934 | &echo), |
935 | 935 | ||
936 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 936 | GNUNET_GETOPT_option_flag ('d', |
937 | "dump", | 937 | "dump", |
938 | gettext_noop ("Dump debug information to STDERR"), | 938 | gettext_noop ("Dump debug information to STDERR"), |
939 | &dump), | 939 | &dump), |
940 | 940 | ||
941 | GNUNET_GETOPT_OPTION_STRING ('o', | 941 | GNUNET_GETOPT_option_string ('o', |
942 | "open-port", | 942 | "open-port", |
943 | "SHARED_SECRET", | 943 | "SHARED_SECRET", |
944 | gettext_noop ("Listen for connections using a shared secret among sender and recipient"), | 944 | gettext_noop ("Listen for connections using a shared secret among sender and recipient"), |
945 | &listen_port), | 945 | &listen_port), |
946 | 946 | ||
947 | 947 | ||
948 | GNUNET_GETOPT_OPTION_STRING ('p', | 948 | GNUNET_GETOPT_option_string ('p', |
949 | "peer", | 949 | "peer", |
950 | "PEER_ID", | 950 | "PEER_ID", |
951 | gettext_noop ("Provide information about a patricular peer"), | 951 | gettext_noop ("Provide information about a patricular peer"), |
952 | &peer_id), | 952 | &peer_id), |
953 | 953 | ||
954 | 954 | ||
955 | GNUNET_GETOPT_OPTION_SET_ONE ('P', | 955 | GNUNET_GETOPT_option_flag ('P', |
956 | "peers", | 956 | "peers", |
957 | gettext_noop ("Provide information about all peers"), | 957 | gettext_noop ("Provide information about all peers"), |
958 | &request_peers), | 958 | &request_peers), |
959 | 959 | ||
960 | GNUNET_GETOPT_OPTION_STRING ('t', | 960 | GNUNET_GETOPT_option_string ('t', |
961 | "tunnel", | 961 | "tunnel", |
962 | "TUNNEL_ID", | 962 | "TUNNEL_ID", |
963 | gettext_noop ("Provide information about a particular tunnel"), | 963 | gettext_noop ("Provide information about a particular tunnel"), |
964 | &tunnel_id), | 964 | &tunnel_id), |
965 | 965 | ||
966 | 966 | ||
967 | GNUNET_GETOPT_OPTION_SET_ONE ('T', | 967 | GNUNET_GETOPT_option_flag ('T', |
968 | "tunnels", | 968 | "tunnels", |
969 | gettext_noop ("Provide information about all tunnels"), | 969 | gettext_noop ("Provide information about all tunnels"), |
970 | &request_tunnels), | 970 | &request_tunnels), |
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index a7e1fca47..af4cebfaa 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -75,7 +75,7 @@ struct CadetClient | |||
75 | * Handle to communicate with the client | 75 | * Handle to communicate with the client |
76 | */ | 76 | */ |
77 | struct GNUNET_MQ_Handle *mq; | 77 | struct GNUNET_MQ_Handle *mq; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Client handle. | 80 | * Client handle. |
81 | */ | 81 | */ |
@@ -83,7 +83,7 @@ struct CadetClient | |||
83 | 83 | ||
84 | /** | 84 | /** |
85 | * Ports that this client has declared interest in. | 85 | * Ports that this client has declared interest in. |
86 | * Indexed by port, contains *Client. | 86 | * Indexed by port, contains `struct OpenPort` |
87 | */ | 87 | */ |
88 | struct GNUNET_CONTAINER_MultiHashMap *ports; | 88 | struct GNUNET_CONTAINER_MultiHashMap *ports; |
89 | 89 | ||
@@ -99,6 +99,7 @@ struct CadetClient | |||
99 | unsigned int id; | 99 | unsigned int id; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | |||
102 | /******************************************************************************/ | 103 | /******************************************************************************/ |
103 | /*********************** GLOBAL VARIABLES ****************************/ | 104 | /*********************** GLOBAL VARIABLES ****************************/ |
104 | /******************************************************************************/ | 105 | /******************************************************************************/ |
@@ -151,14 +152,15 @@ static struct CadetClient *clients_tail; | |||
151 | static unsigned int next_client_id; | 152 | static unsigned int next_client_id; |
152 | 153 | ||
153 | /** | 154 | /** |
154 | * All ports clients of this peer have opened. | 155 | * All ports clients of this peer have opened. Maps from |
156 | * a hashed port to a `struct OpenPort`. | ||
155 | */ | 157 | */ |
156 | struct GNUNET_CONTAINER_MultiHashMap *open_ports; | 158 | struct GNUNET_CONTAINER_MultiHashMap *open_ports; |
157 | 159 | ||
158 | /** | 160 | /** |
159 | * Map from ports to channels where the ports were closed at the | 161 | * Map from ports to channels where the ports were closed at the |
160 | * time we got the inbound connection. | 162 | * time we got the inbound connection. |
161 | * Indexed by port, contains `struct CadetChannel`. | 163 | * Indexed by h_port, contains `struct CadetChannel`. |
162 | */ | 164 | */ |
163 | struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | 165 | struct GNUNET_CONTAINER_MultiHashMap *loose_channels; |
164 | 166 | ||
@@ -436,11 +438,11 @@ shutdown_task (void *cls) | |||
436 | 438 | ||
437 | 439 | ||
438 | /** | 440 | /** |
439 | * We had a remote connection @a value to port @a port before | 441 | * We had a remote connection @a value to port @a h_port before |
440 | * client @a cls opened port @a port. Bind them now. | 442 | * client @a cls opened port @a port. Bind them now. |
441 | * | 443 | * |
442 | * @param cls the `struct CadetClient` | 444 | * @param cls the `struct CadetClient` |
443 | * @param port the port | 445 | * @param h_port the hashed port |
444 | * @param value the `struct CadetChannel` | 446 | * @param value the `struct CadetChannel` |
445 | * @return #GNUNET_YES (iterate over all such channels) | 447 | * @return #GNUNET_YES (iterate over all such channels) |
446 | */ | 448 | */ |
@@ -449,15 +451,16 @@ bind_loose_channel (void *cls, | |||
449 | const struct GNUNET_HashCode *port, | 451 | const struct GNUNET_HashCode *port, |
450 | void *value) | 452 | void *value) |
451 | { | 453 | { |
452 | struct CadetClient *c = cls; | 454 | struct OpenPort *op = cls; |
453 | struct CadetChannel *ch = value; | 455 | struct CadetChannel *ch = value; |
454 | 456 | ||
455 | GCCH_bind (ch, | 457 | GCCH_bind (ch, |
456 | c); | 458 | op->c, |
459 | &op->port); | ||
457 | GNUNET_assert (GNUNET_YES == | 460 | GNUNET_assert (GNUNET_YES == |
458 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, | 461 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, |
459 | port, | 462 | &op->h_port, |
460 | value)); | 463 | ch)); |
461 | return GNUNET_YES; | 464 | return GNUNET_YES; |
462 | } | 465 | } |
463 | 466 | ||
@@ -476,6 +479,7 @@ handle_port_open (void *cls, | |||
476 | const struct GNUNET_CADET_PortMessage *pmsg) | 479 | const struct GNUNET_CADET_PortMessage *pmsg) |
477 | { | 480 | { |
478 | struct CadetClient *c = cls; | 481 | struct CadetClient *c = cls; |
482 | struct OpenPort *op; | ||
479 | 483 | ||
480 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 484 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
481 | "Open port %s requested by %s\n", | 485 | "Open port %s requested by %s\n", |
@@ -483,11 +487,17 @@ handle_port_open (void *cls, | |||
483 | GSC_2s (c)); | 487 | GSC_2s (c)); |
484 | if (NULL == c->ports) | 488 | if (NULL == c->ports) |
485 | c->ports = GNUNET_CONTAINER_multihashmap_create (4, | 489 | c->ports = GNUNET_CONTAINER_multihashmap_create (4, |
486 | GNUNET_NO); | 490 | GNUNET_NO); |
491 | op = GNUNET_new (struct OpenPort); | ||
492 | op->c = c; | ||
493 | op->port = pmsg->port; | ||
494 | GCCH_hash_port (&op->h_port, | ||
495 | &pmsg->port, | ||
496 | &my_full_id); | ||
487 | if (GNUNET_OK != | 497 | if (GNUNET_OK != |
488 | GNUNET_CONTAINER_multihashmap_put (c->ports, | 498 | GNUNET_CONTAINER_multihashmap_put (c->ports, |
489 | &pmsg->port, | 499 | &op->port, |
490 | c, | 500 | op, |
491 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 501 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
492 | { | 502 | { |
493 | GNUNET_break (0); | 503 | GNUNET_break (0); |
@@ -495,13 +505,13 @@ handle_port_open (void *cls, | |||
495 | return; | 505 | return; |
496 | } | 506 | } |
497 | (void) GNUNET_CONTAINER_multihashmap_put (open_ports, | 507 | (void) GNUNET_CONTAINER_multihashmap_put (open_ports, |
498 | &pmsg->port, | 508 | &op->h_port, |
499 | c, | 509 | op, |
500 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 510 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
501 | GNUNET_CONTAINER_multihashmap_get_multiple (loose_channels, | 511 | GNUNET_CONTAINER_multihashmap_get_multiple (loose_channels, |
502 | &pmsg->port, | 512 | &op->h_port, |
503 | &bind_loose_channel, | 513 | &bind_loose_channel, |
504 | c); | 514 | op); |
505 | GNUNET_SERVICE_client_continue (c->client); | 515 | GNUNET_SERVICE_client_continue (c->client); |
506 | } | 516 | } |
507 | 517 | ||
@@ -520,24 +530,29 @@ handle_port_close (void *cls, | |||
520 | const struct GNUNET_CADET_PortMessage *pmsg) | 530 | const struct GNUNET_CADET_PortMessage *pmsg) |
521 | { | 531 | { |
522 | struct CadetClient *c = cls; | 532 | struct CadetClient *c = cls; |
533 | struct OpenPort *op; | ||
523 | 534 | ||
524 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 535 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
525 | "Closing port %s as requested by %s\n", | 536 | "Closing port %s as requested by %s\n", |
526 | GNUNET_h2s (&pmsg->port), | 537 | GNUNET_h2s (&pmsg->port), |
527 | GSC_2s (c)); | 538 | GSC_2s (c)); |
528 | if (GNUNET_YES != | 539 | op = GNUNET_CONTAINER_multihashmap_get (c->ports, |
529 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | 540 | &pmsg->port); |
530 | &pmsg->port, | 541 | if (NULL == op) |
531 | c)) | ||
532 | { | 542 | { |
533 | GNUNET_break (0); | 543 | GNUNET_break (0); |
534 | GNUNET_SERVICE_client_drop (c->client); | 544 | GNUNET_SERVICE_client_drop (c->client); |
535 | return; | 545 | return; |
536 | } | 546 | } |
537 | GNUNET_assert (GNUNET_YES == | 547 | GNUNET_assert (GNUNET_YES == |
548 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | ||
549 | &op->port, | ||
550 | op)); | ||
551 | GNUNET_assert (GNUNET_YES == | ||
538 | GNUNET_CONTAINER_multihashmap_remove (open_ports, | 552 | GNUNET_CONTAINER_multihashmap_remove (open_ports, |
539 | &pmsg->port, | 553 | &op->h_port, |
540 | c)); | 554 | op)); |
555 | GNUNET_free (op); | ||
541 | GNUNET_SERVICE_client_continue (c->client); | 556 | GNUNET_SERVICE_client_continue (c->client); |
542 | } | 557 | } |
543 | 558 | ||
@@ -1214,16 +1229,16 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c, | |||
1214 | * A client that created a loose channel that was not bound to a port | 1229 | * A client that created a loose channel that was not bound to a port |
1215 | * disconnected, drop it from the #loose_channels list. | 1230 | * disconnected, drop it from the #loose_channels list. |
1216 | * | 1231 | * |
1217 | * @param port the port the channel was trying to bind to | 1232 | * @param h_port the hashed port the channel was trying to bind to |
1218 | * @param ch the channel that was lost | 1233 | * @param ch the channel that was lost |
1219 | */ | 1234 | */ |
1220 | void | 1235 | void |
1221 | GSC_drop_loose_channel (const struct GNUNET_HashCode *port, | 1236 | GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port, |
1222 | struct CadetChannel *ch) | 1237 | struct CadetChannel *ch) |
1223 | { | 1238 | { |
1224 | GNUNET_assert (GNUNET_YES == | 1239 | GNUNET_assert (GNUNET_YES == |
1225 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, | 1240 | GNUNET_CONTAINER_multihashmap_remove (loose_channels, |
1226 | port, | 1241 | h_port, |
1227 | ch)); | 1242 | ch)); |
1228 | } | 1243 | } |
1229 | 1244 | ||
@@ -1264,30 +1279,33 @@ channel_destroy_iterator (void *cls, | |||
1264 | /** | 1279 | /** |
1265 | * Remove client's ports from the global hashmap on disconnect. | 1280 | * Remove client's ports from the global hashmap on disconnect. |
1266 | * | 1281 | * |
1267 | * @param cls Closure (unused). | 1282 | * @param cls the `struct CadetClient` |
1268 | * @param key the port. | 1283 | * @param port the port. |
1269 | * @param value the `struct CadetClient` to remove | 1284 | * @param value the `struct OpenPort` to remove |
1270 | * @return #GNUNET_OK, keep iterating. | 1285 | * @return #GNUNET_OK, keep iterating. |
1271 | */ | 1286 | */ |
1272 | static int | 1287 | static int |
1273 | client_release_ports (void *cls, | 1288 | client_release_ports (void *cls, |
1274 | const struct GNUNET_HashCode *key, | 1289 | const struct GNUNET_HashCode *port, |
1275 | void *value) | 1290 | void *value) |
1276 | { | 1291 | { |
1277 | struct CadetClient *c = value; | 1292 | struct CadetClient *c = cls; |
1293 | struct OpenPort *op = value; | ||
1278 | 1294 | ||
1295 | GNUNET_assert (c == op->c); | ||
1279 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1296 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1280 | "Closing port %s due to %s disconnect.\n", | 1297 | "Closing port %s due to %s disconnect.\n", |
1281 | GNUNET_h2s (key), | 1298 | GNUNET_h2s (port), |
1282 | GSC_2s (c)); | 1299 | GSC_2s (c)); |
1283 | GNUNET_assert (GNUNET_YES == | 1300 | GNUNET_assert (GNUNET_YES == |
1284 | GNUNET_CONTAINER_multihashmap_remove (open_ports, | 1301 | GNUNET_CONTAINER_multihashmap_remove (open_ports, |
1285 | key, | 1302 | &op->h_port, |
1286 | value)); | 1303 | op)); |
1287 | GNUNET_assert (GNUNET_YES == | 1304 | GNUNET_assert (GNUNET_YES == |
1288 | GNUNET_CONTAINER_multihashmap_remove (c->ports, | 1305 | GNUNET_CONTAINER_multihashmap_remove (c->ports, |
1289 | key, | 1306 | port, |
1290 | value)); | 1307 | op)); |
1308 | GNUNET_free (op); | ||
1291 | return GNUNET_OK; | 1309 | return GNUNET_OK; |
1292 | } | 1310 | } |
1293 | 1311 | ||
diff --git a/src/cadet/gnunet-service-cadet.h b/src/cadet/gnunet-service-cadet.h index 2f2d7baf3..162867823 100644 --- a/src/cadet/gnunet-service-cadet.h +++ b/src/cadet/gnunet-service-cadet.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #define GNUNET_SERVICE_CADET_H | 29 | #define GNUNET_SERVICE_CADET_H |
30 | 30 | ||
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | #define NEW_CADET 1 | ||
33 | #include "cadet_protocol.h" | 32 | #include "cadet_protocol.h" |
34 | 33 | ||
35 | /** | 34 | /** |
@@ -146,6 +145,30 @@ struct CadetTConnection | |||
146 | 145 | ||
147 | 146 | ||
148 | /** | 147 | /** |
148 | * Port opened by a client. | ||
149 | */ | ||
150 | struct OpenPort | ||
151 | { | ||
152 | |||
153 | /** | ||
154 | * Client that opened the port. | ||
155 | */ | ||
156 | struct CadetClient *c; | ||
157 | |||
158 | /** | ||
159 | * Port number. | ||
160 | */ | ||
161 | struct GNUNET_HashCode port; | ||
162 | |||
163 | /** | ||
164 | * Port hashed with our PID (matches incoming OPEN messages). | ||
165 | */ | ||
166 | struct GNUNET_HashCode h_port; | ||
167 | |||
168 | }; | ||
169 | |||
170 | |||
171 | /** | ||
149 | * Active path through the network (used by a tunnel). There may | 172 | * Active path through the network (used by a tunnel). There may |
150 | * be at most one connection per path. | 173 | * be at most one connection per path. |
151 | */ | 174 | */ |
@@ -193,7 +216,8 @@ extern struct GNUNET_PeerIdentity my_full_id; | |||
193 | extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; | 216 | extern struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; |
194 | 217 | ||
195 | /** | 218 | /** |
196 | * All ports clients of this peer have opened. | 219 | * All ports clients of this peer have opened. Maps from |
220 | * a hashed port to a `struct OpenPort`. | ||
197 | */ | 221 | */ |
198 | extern struct GNUNET_CONTAINER_MultiHashMap *open_ports; | 222 | extern struct GNUNET_CONTAINER_MultiHashMap *open_ports; |
199 | 223 | ||
@@ -206,7 +230,7 @@ extern struct GNUNET_CONTAINER_MultiShortmap *connections; | |||
206 | /** | 230 | /** |
207 | * Map from ports to channels where the ports were closed at the | 231 | * Map from ports to channels where the ports were closed at the |
208 | * time we got the inbound connection. | 232 | * time we got the inbound connection. |
209 | * Indexed by port, contains `struct CadetChannel`. | 233 | * Indexed by h_port, contains `struct CadetChannel`. |
210 | */ | 234 | */ |
211 | extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels; | 235 | extern struct GNUNET_CONTAINER_MultiHashMap *loose_channels; |
212 | 236 | ||
@@ -268,11 +292,11 @@ GSC_handle_remote_channel_destroy (struct CadetClient *c, | |||
268 | * A client that created a loose channel that was not bound to a port | 292 | * A client that created a loose channel that was not bound to a port |
269 | * disconnected, drop it from the #loose_channels list. | 293 | * disconnected, drop it from the #loose_channels list. |
270 | * | 294 | * |
271 | * @param port the port the channel was trying to bind to | 295 | * @param h_port the hashed port the channel was trying to bind to |
272 | * @param ch the channel that was lost | 296 | * @param ch the channel that was lost |
273 | */ | 297 | */ |
274 | void | 298 | void |
275 | GSC_drop_loose_channel (const struct GNUNET_HashCode *port, | 299 | GSC_drop_loose_channel (const struct GNUNET_HashCode *h_port, |
276 | struct CadetChannel *ch); | 300 | struct CadetChannel *ch); |
277 | 301 | ||
278 | 302 | ||
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 68e29b66b..739b68228 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -303,6 +303,11 @@ struct CadetChannel | |||
303 | struct GNUNET_HashCode port; | 303 | struct GNUNET_HashCode port; |
304 | 304 | ||
305 | /** | 305 | /** |
306 | * Hash'ed port of the channel with initiator and destination PID. | ||
307 | */ | ||
308 | struct GNUNET_HashCode h_port; | ||
309 | |||
310 | /** | ||
306 | * Counter for exponential backoff. | 311 | * Counter for exponential backoff. |
307 | */ | 312 | */ |
308 | struct GNUNET_TIME_Relative retry_time; | 313 | struct GNUNET_TIME_Relative retry_time; |
@@ -406,6 +411,37 @@ GCCH_2s (const struct CadetChannel *ch) | |||
406 | 411 | ||
407 | 412 | ||
408 | /** | 413 | /** |
414 | * Hash the @a port and @a initiator and @a listener to | ||
415 | * calculate the "challenge" @a h_port we send to the other | ||
416 | * peer on #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN. | ||
417 | * | ||
418 | * @param[out] h_port set to the hash of @a port, @a initiator and @a listener | ||
419 | * @param port cadet port, as seen by CADET clients | ||
420 | * @param listener peer that is listining on @a port | ||
421 | */ | ||
422 | void | ||
423 | GCCH_hash_port (struct GNUNET_HashCode *h_port, | ||
424 | const struct GNUNET_HashCode *port, | ||
425 | const struct GNUNET_PeerIdentity *listener) | ||
426 | { | ||
427 | struct GNUNET_HashContext *hc; | ||
428 | |||
429 | hc = GNUNET_CRYPTO_hash_context_start (); | ||
430 | GNUNET_CRYPTO_hash_context_read (hc, | ||
431 | port, | ||
432 | sizeof (*port)); | ||
433 | GNUNET_CRYPTO_hash_context_read (hc, | ||
434 | listener, | ||
435 | sizeof (*listener)); | ||
436 | GNUNET_CRYPTO_hash_context_finish (hc, | ||
437 | h_port); | ||
438 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
439 | "Calculated port hash %s\n", | ||
440 | GNUNET_h2s (h_port)); | ||
441 | } | ||
442 | |||
443 | |||
444 | /** | ||
409 | * Get the channel's public ID. | 445 | * Get the channel's public ID. |
410 | * | 446 | * |
411 | * @param ch Channel. | 447 | * @param ch Channel. |
@@ -566,7 +602,7 @@ send_channel_open (void *cls) | |||
566 | msgcc.header.size = htons (sizeof (msgcc)); | 602 | msgcc.header.size = htons (sizeof (msgcc)); |
567 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); | 603 | msgcc.header.type = htons (GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN); |
568 | msgcc.opt = htonl (options); | 604 | msgcc.opt = htonl (options); |
569 | msgcc.port = ch->port; | 605 | msgcc.h_port = ch->h_port; |
570 | msgcc.ctn = ch->ctn; | 606 | msgcc.ctn = ch->ctn; |
571 | ch->state = CADET_CHANNEL_OPEN_SENT; | 607 | ch->state = CADET_CHANNEL_OPEN_SENT; |
572 | if (NULL != ch->last_control_qe) | 608 | if (NULL != ch->last_control_qe) |
@@ -635,21 +671,24 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
635 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ | 671 | ch->max_pending_messages = (ch->nobuffer) ? 1 : 4; /* FIXME: 4!? Do not hardcode! */ |
636 | ch->owner = ccco; | 672 | ch->owner = ccco; |
637 | ch->port = *port; | 673 | ch->port = *port; |
674 | GCCH_hash_port (&ch->h_port, | ||
675 | port, | ||
676 | GCP_get_id (destination)); | ||
638 | if (0 == memcmp (&my_full_id, | 677 | if (0 == memcmp (&my_full_id, |
639 | GCP_get_id (destination), | 678 | GCP_get_id (destination), |
640 | sizeof (struct GNUNET_PeerIdentity))) | 679 | sizeof (struct GNUNET_PeerIdentity))) |
641 | { | 680 | { |
642 | struct CadetClient *c; | 681 | struct OpenPort *op; |
643 | 682 | ||
644 | ch->is_loopback = GNUNET_YES; | 683 | ch->is_loopback = GNUNET_YES; |
645 | c = GNUNET_CONTAINER_multihashmap_get (open_ports, | 684 | op = GNUNET_CONTAINER_multihashmap_get (open_ports, |
646 | port); | 685 | &ch->h_port); |
647 | if (NULL == c) | 686 | if (NULL == op) |
648 | { | 687 | { |
649 | /* port closed, wait for it to possibly open */ | 688 | /* port closed, wait for it to possibly open */ |
650 | ch->state = CADET_CHANNEL_LOOSE; | 689 | ch->state = CADET_CHANNEL_LOOSE; |
651 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, | 690 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, |
652 | port, | 691 | &ch->h_port, |
653 | ch, | 692 | ch, |
654 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 693 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
655 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 694 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -659,7 +698,8 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
659 | else | 698 | else |
660 | { | 699 | { |
661 | GCCH_bind (ch, | 700 | GCCH_bind (ch, |
662 | c); | 701 | op->c, |
702 | &op->port); | ||
663 | } | 703 | } |
664 | } | 704 | } |
665 | else | 705 | else |
@@ -709,21 +749,21 @@ timeout_closed_cb (void *cls) | |||
709 | * | 749 | * |
710 | * @param t tunnel to the remote peer | 750 | * @param t tunnel to the remote peer |
711 | * @param ctn identifier of this channel in the tunnel | 751 | * @param ctn identifier of this channel in the tunnel |
712 | * @param port desired local port | 752 | * @param h_port desired hash of local port |
713 | * @param options options for the channel | 753 | * @param options options for the channel |
714 | * @return handle to the new channel | 754 | * @return handle to the new channel |
715 | */ | 755 | */ |
716 | struct CadetChannel * | 756 | struct CadetChannel * |
717 | GCCH_channel_incoming_new (struct CadetTunnel *t, | 757 | GCCH_channel_incoming_new (struct CadetTunnel *t, |
718 | struct GNUNET_CADET_ChannelTunnelNumber ctn, | 758 | struct GNUNET_CADET_ChannelTunnelNumber ctn, |
719 | const struct GNUNET_HashCode *port, | 759 | const struct GNUNET_HashCode *h_port, |
720 | uint32_t options) | 760 | uint32_t options) |
721 | { | 761 | { |
722 | struct CadetChannel *ch; | 762 | struct CadetChannel *ch; |
723 | struct CadetClient *c; | 763 | struct OpenPort *op; |
724 | 764 | ||
725 | ch = GNUNET_new (struct CadetChannel); | 765 | ch = GNUNET_new (struct CadetChannel); |
726 | ch->port = *port; | 766 | ch->h_port = *h_port; |
727 | ch->t = t; | 767 | ch->t = t; |
728 | ch->ctn = ctn; | 768 | ch->ctn = ctn; |
729 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; | 769 | ch->retry_time = CADET_INITIAL_RETRANSMIT_TIME; |
@@ -736,14 +776,14 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, | |||
736 | 1, | 776 | 1, |
737 | GNUNET_NO); | 777 | GNUNET_NO); |
738 | 778 | ||
739 | c = GNUNET_CONTAINER_multihashmap_get (open_ports, | 779 | op = GNUNET_CONTAINER_multihashmap_get (open_ports, |
740 | port); | 780 | h_port); |
741 | if (NULL == c) | 781 | if (NULL == op) |
742 | { | 782 | { |
743 | /* port closed, wait for it to possibly open */ | 783 | /* port closed, wait for it to possibly open */ |
744 | ch->state = CADET_CHANNEL_LOOSE; | 784 | ch->state = CADET_CHANNEL_LOOSE; |
745 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, | 785 | (void) GNUNET_CONTAINER_multihashmap_put (loose_channels, |
746 | port, | 786 | &ch->h_port, |
747 | ch, | 787 | ch, |
748 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 788 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
749 | GNUNET_assert (NULL == ch->retry_control_task); | 789 | GNUNET_assert (NULL == ch->retry_control_task); |
@@ -759,7 +799,8 @@ GCCH_channel_incoming_new (struct CadetTunnel *t, | |||
759 | else | 799 | else |
760 | { | 800 | { |
761 | GCCH_bind (ch, | 801 | GCCH_bind (ch, |
762 | c); | 802 | op->c, |
803 | &op->port); | ||
763 | } | 804 | } |
764 | GNUNET_STATISTICS_update (stats, | 805 | GNUNET_STATISTICS_update (stats, |
765 | "# channels", | 806 | "# channels", |
@@ -830,7 +871,7 @@ static void | |||
830 | send_open_ack (void *cls) | 871 | send_open_ack (void *cls) |
831 | { | 872 | { |
832 | struct CadetChannel *ch = cls; | 873 | struct CadetChannel *ch = cls; |
833 | struct GNUNET_CADET_ChannelManageMessage msg; | 874 | struct GNUNET_CADET_ChannelOpenAckMessage msg; |
834 | 875 | ||
835 | ch->retry_control_task = NULL; | 876 | ch->retry_control_task = NULL; |
836 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 877 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -840,6 +881,7 @@ send_open_ack (void *cls) | |||
840 | msg.header.size = htons (sizeof (msg)); | 881 | msg.header.size = htons (sizeof (msg)); |
841 | msg.reserved = htonl (0); | 882 | msg.reserved = htonl (0); |
842 | msg.ctn = ch->ctn; | 883 | msg.ctn = ch->ctn; |
884 | msg.port = ch->port; | ||
843 | if (NULL != ch->last_control_qe) | 885 | if (NULL != ch->last_control_qe) |
844 | GCT_send_cancel (ch->last_control_qe); | 886 | GCT_send_cancel (ch->last_control_qe); |
845 | ch->last_control_qe = GCT_send (ch->t, | 887 | ch->last_control_qe = GCT_send (ch->t, |
@@ -928,11 +970,13 @@ send_ack_to_client (struct CadetChannel *ch, | |||
928 | * request and establish the link with the client. | 970 | * request and establish the link with the client. |
929 | * | 971 | * |
930 | * @param ch open incoming channel | 972 | * @param ch open incoming channel |
931 | * @param c client listening on the respective port | 973 | * @param c client listening on the respective @a port |
974 | * @param port the port @a is listening on | ||
932 | */ | 975 | */ |
933 | void | 976 | void |
934 | GCCH_bind (struct CadetChannel *ch, | 977 | GCCH_bind (struct CadetChannel *ch, |
935 | struct CadetClient *c) | 978 | struct CadetClient *c, |
979 | const struct GNUNET_HashCode *port) | ||
936 | { | 980 | { |
937 | uint32_t options; | 981 | uint32_t options; |
938 | struct CadetChannelClient *cccd; | 982 | struct CadetChannelClient *cccd; |
@@ -959,6 +1003,7 @@ GCCH_bind (struct CadetChannel *ch, | |||
959 | cccd = GNUNET_new (struct CadetChannelClient); | 1003 | cccd = GNUNET_new (struct CadetChannelClient); |
960 | GNUNET_assert (NULL == ch->dest); | 1004 | GNUNET_assert (NULL == ch->dest); |
961 | ch->dest = cccd; | 1005 | ch->dest = cccd; |
1006 | ch->port = *port; | ||
962 | cccd->c = c; | 1007 | cccd->c = c; |
963 | cccd->client_ready = GNUNET_YES; | 1008 | cccd->client_ready = GNUNET_YES; |
964 | cccd->ccn = GSC_bind (c, | 1009 | cccd->ccn = GSC_bind (c, |
@@ -967,7 +1012,7 @@ GCCH_bind (struct CadetChannel *ch, | |||
967 | ? GCP_get (&my_full_id, | 1012 | ? GCP_get (&my_full_id, |
968 | GNUNET_YES) | 1013 | GNUNET_YES) |
969 | : GCT_get_destination (ch->t), | 1014 | : GCT_get_destination (ch->t), |
970 | &ch->port, | 1015 | port, |
971 | options); | 1016 | options); |
972 | GNUNET_assert (ntohl (cccd->ccn.channel_of_client) < | 1017 | GNUNET_assert (ntohl (cccd->ccn.channel_of_client) < |
973 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); | 1018 | GNUNET_CADET_LOCAL_CHANNEL_ID_CLI); |
@@ -976,7 +1021,8 @@ GCCH_bind (struct CadetChannel *ch, | |||
976 | { | 1021 | { |
977 | ch->state = CADET_CHANNEL_OPEN_SENT; | 1022 | ch->state = CADET_CHANNEL_OPEN_SENT; |
978 | GCCH_handle_channel_open_ack (ch, | 1023 | GCCH_handle_channel_open_ack (ch, |
979 | NULL); | 1024 | NULL, |
1025 | port); | ||
980 | } | 1026 | } |
981 | else | 1027 | else |
982 | { | 1028 | { |
@@ -1092,7 +1138,7 @@ GCCH_channel_local_destroy (struct CadetChannel *ch, | |||
1092 | target, but that never went anywhere. Nothing to do here. */ | 1138 | target, but that never went anywhere. Nothing to do here. */ |
1093 | break; | 1139 | break; |
1094 | case CADET_CHANNEL_LOOSE: | 1140 | case CADET_CHANNEL_LOOSE: |
1095 | GSC_drop_loose_channel (&ch->port, | 1141 | GSC_drop_loose_channel (&ch->h_port, |
1096 | ch); | 1142 | ch); |
1097 | break; | 1143 | break; |
1098 | default: | 1144 | default: |
@@ -1107,14 +1153,17 @@ GCCH_channel_local_destroy (struct CadetChannel *ch, | |||
1107 | 1153 | ||
1108 | /** | 1154 | /** |
1109 | * We got an acknowledgement for the creation of the channel | 1155 | * We got an acknowledgement for the creation of the channel |
1110 | * (the port is open on the other side). Begin transmissions. | 1156 | * (the port is open on the other side). Verify that the |
1157 | * other end really has the right port, and begin transmissions. | ||
1111 | * | 1158 | * |
1112 | * @param ch channel to destroy | 1159 | * @param ch channel to destroy |
1113 | * @param cti identifier of the connection that delivered the message | 1160 | * @param cti identifier of the connection that delivered the message |
1161 | * @param port port number (needed to verify receiver knows the port) | ||
1114 | */ | 1162 | */ |
1115 | void | 1163 | void |
1116 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, | 1164 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, |
1117 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti) | 1165 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, |
1166 | const struct GNUNET_HashCode *port) | ||
1118 | { | 1167 | { |
1119 | switch (ch->state) | 1168 | switch (ch->state) |
1120 | { | 1169 | { |
@@ -1133,6 +1182,15 @@ GCCH_handle_channel_open_ack (struct CadetChannel *ch, | |||
1133 | GNUNET_break_op (0); | 1182 | GNUNET_break_op (0); |
1134 | return; | 1183 | return; |
1135 | } | 1184 | } |
1185 | if (0 != memcmp (&ch->port, | ||
1186 | port, | ||
1187 | sizeof (struct GNUNET_HashCode))) | ||
1188 | { | ||
1189 | /* Other peer failed to provide the right port, | ||
1190 | refuse connection. */ | ||
1191 | GNUNET_break_op (0); | ||
1192 | return; | ||
1193 | } | ||
1136 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1194 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1137 | "Received CHANNEL_OPEN_ACK for waiting %s, entering READY state\n", | 1195 | "Received CHANNEL_OPEN_ACK for waiting %s, entering READY state\n", |
1138 | GCCH_2s (ch)); | 1196 | GCCH_2s (ch)); |
diff --git a/src/cadet/gnunet-service-cadet_channel.h b/src/cadet/gnunet-service-cadet_channel.h index a3ef9a06d..16517c457 100644 --- a/src/cadet/gnunet-service-cadet_channel.h +++ b/src/cadet/gnunet-service-cadet_channel.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
4 | Copyright (C) 2001-2017 GNUnet e.V. | 3 | Copyright (C) 2001-2017 GNUnet e.V. |
@@ -45,6 +44,21 @@ struct CadetChannel; | |||
45 | 44 | ||
46 | 45 | ||
47 | /** | 46 | /** |
47 | * Hash the @a port and @a initiator and @a listener to | ||
48 | * calculate the "challenge" @a h_port we send to the other | ||
49 | * peer on #GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN. | ||
50 | * | ||
51 | * @param[out] h_port set to the hash of @a port, @a initiator and @a listener | ||
52 | * @param port cadet port, as seen by CADET clients | ||
53 | * @param listener peer that is listining on @a port | ||
54 | */ | ||
55 | void | ||
56 | GCCH_hash_port (struct GNUNET_HashCode *h_port, | ||
57 | const struct GNUNET_HashCode *port, | ||
58 | const struct GNUNET_PeerIdentity *listener); | ||
59 | |||
60 | |||
61 | /** | ||
48 | * Get the static string for identification of the channel. | 62 | * Get the static string for identification of the channel. |
49 | * | 63 | * |
50 | * @param ch Channel. | 64 | * @param ch Channel. |
@@ -101,11 +115,13 @@ GCCH_channel_local_new (struct CadetClient *owner, | |||
101 | * request and establish the link with the client. | 115 | * request and establish the link with the client. |
102 | * | 116 | * |
103 | * @param ch open incoming channel | 117 | * @param ch open incoming channel |
104 | * @param c client listening on the respective port | 118 | * @param c client listening on the respective @a port |
119 | * @param port port number @a c is listening on | ||
105 | */ | 120 | */ |
106 | void | 121 | void |
107 | GCCH_bind (struct CadetChannel *ch, | 122 | GCCH_bind (struct CadetChannel *ch, |
108 | struct CadetClient *c); | 123 | struct CadetClient *c, |
124 | const struct GNUNET_HashCode *port); | ||
109 | 125 | ||
110 | 126 | ||
111 | /** | 127 | /** |
@@ -142,14 +158,14 @@ GCCH_tunnel_up (struct CadetChannel *ch); | |||
142 | * @param t tunnel to the remote peer | 158 | * @param t tunnel to the remote peer |
143 | * @param chid identifier of this channel in the tunnel | 159 | * @param chid identifier of this channel in the tunnel |
144 | * @param origin peer to who initiated the channel | 160 | * @param origin peer to who initiated the channel |
145 | * @param port desired local port | 161 | * @param h_port hash of desired local port |
146 | * @param options options for the channel | 162 | * @param options options for the channel |
147 | * @return handle to the new channel | 163 | * @return handle to the new channel |
148 | */ | 164 | */ |
149 | struct CadetChannel * | 165 | struct CadetChannel * |
150 | GCCH_channel_incoming_new (struct CadetTunnel *t, | 166 | GCCH_channel_incoming_new (struct CadetTunnel *t, |
151 | struct GNUNET_CADET_ChannelTunnelNumber chid, | 167 | struct GNUNET_CADET_ChannelTunnelNumber chid, |
152 | const struct GNUNET_HashCode *port, | 168 | const struct GNUNET_HashCode *h_port, |
153 | uint32_t options); | 169 | uint32_t options); |
154 | 170 | ||
155 | 171 | ||
@@ -201,10 +217,12 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch, | |||
201 | * @param ch channel to destroy | 217 | * @param ch channel to destroy |
202 | * @param cti identifier of the connection that delivered the message, | 218 | * @param cti identifier of the connection that delivered the message, |
203 | * NULL if the ACK was inferred because we got payload or are on loopback | 219 | * NULL if the ACK was inferred because we got payload or are on loopback |
220 | * @param port port number (needed to verify receiver knows the port) | ||
204 | */ | 221 | */ |
205 | void | 222 | void |
206 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, | 223 | GCCH_handle_channel_open_ack (struct CadetChannel *ch, |
207 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti); | 224 | const struct GNUNET_CADET_ConnectionTunnelIdentifier *cti, |
225 | const struct GNUNET_HashCode *port); | ||
208 | 226 | ||
209 | 227 | ||
210 | /** | 228 | /** |
diff --git a/src/cadet/gnunet-service-cadet_peer.h b/src/cadet/gnunet-service-cadet_peer.h index a2a6c6a92..baa87ea87 100644 --- a/src/cadet/gnunet-service-cadet_peer.h +++ b/src/cadet/gnunet-service-cadet_peer.h | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | /* | 1 | /* |
3 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
4 | Copyright (C) 2001-2017 GNUnet e.V. | 3 | Copyright (C) 2001-2017 GNUnet e.V. |
@@ -20,7 +19,7 @@ | |||
20 | */ | 19 | */ |
21 | 20 | ||
22 | /** | 21 | /** |
23 | * @file cadet/gnunet-service-cadet-new_peer.h | 22 | * @file cadet/gnunet-service-cadet_peer.h |
24 | * @brief Information we track per peer. | 23 | * @brief Information we track per peer. |
25 | * @author Bartlomiej Polot | 24 | * @author Bartlomiej Polot |
26 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c index bcdeeb4da..28004debc 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.c +++ b/src/cadet/gnunet-service-cadet_tunnels.c | |||
@@ -2723,8 +2723,8 @@ handle_plaintext_channel_open (void *cls, | |||
2723 | if (NULL != ch) | 2723 | if (NULL != ch) |
2724 | { | 2724 | { |
2725 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2725 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2726 | "Received duplicate channel CHANNEL_OPEN on port %s from %s (%s), resending ACK\n", | 2726 | "Received duplicate channel CHANNEL_OPEN on h_port %s from %s (%s), resending ACK\n", |
2727 | GNUNET_h2s (&copen->port), | 2727 | GNUNET_h2s (&copen->h_port), |
2728 | GCT_2s (t), | 2728 | GCT_2s (t), |
2729 | GCCH_2s (ch)); | 2729 | GCCH_2s (ch)); |
2730 | GCCH_handle_duplicate_open (ch, | 2730 | GCCH_handle_duplicate_open (ch, |
@@ -2732,12 +2732,12 @@ handle_plaintext_channel_open (void *cls, | |||
2732 | return; | 2732 | return; |
2733 | } | 2733 | } |
2734 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2734 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2735 | "Received CHANNEL_OPEN on port %s from %s\n", | 2735 | "Received CHANNEL_OPEN on h_port %s from %s\n", |
2736 | GNUNET_h2s (&copen->port), | 2736 | GNUNET_h2s (&copen->h_port), |
2737 | GCT_2s (t)); | 2737 | GCT_2s (t)); |
2738 | ch = GCCH_channel_incoming_new (t, | 2738 | ch = GCCH_channel_incoming_new (t, |
2739 | copen->ctn, | 2739 | copen->ctn, |
2740 | &copen->port, | 2740 | &copen->h_port, |
2741 | ntohl (copen->opt)); | 2741 | ntohl (copen->opt)); |
2742 | if (NULL != t->destroy_task) | 2742 | if (NULL != t->destroy_task) |
2743 | { | 2743 | { |
@@ -2762,7 +2762,7 @@ void | |||
2762 | GCT_send_channel_destroy (struct CadetTunnel *t, | 2762 | GCT_send_channel_destroy (struct CadetTunnel *t, |
2763 | struct GNUNET_CADET_ChannelTunnelNumber ctn) | 2763 | struct GNUNET_CADET_ChannelTunnelNumber ctn) |
2764 | { | 2764 | { |
2765 | struct GNUNET_CADET_ChannelManageMessage msg; | 2765 | struct GNUNET_CADET_ChannelDestroyMessage msg; |
2766 | 2766 | ||
2767 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2767 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2768 | "Sending DESTORY message for channel ID %u\n", | 2768 | "Sending DESTORY message for channel ID %u\n", |
@@ -2788,7 +2788,7 @@ GCT_send_channel_destroy (struct CadetTunnel *t, | |||
2788 | */ | 2788 | */ |
2789 | static void | 2789 | static void |
2790 | handle_plaintext_channel_open_ack (void *cls, | 2790 | handle_plaintext_channel_open_ack (void *cls, |
2791 | const struct GNUNET_CADET_ChannelManageMessage *cm) | 2791 | const struct GNUNET_CADET_ChannelOpenAckMessage *cm) |
2792 | { | 2792 | { |
2793 | struct CadetTunnel *t = cls; | 2793 | struct CadetTunnel *t = cls; |
2794 | struct CadetChannel *ch; | 2794 | struct CadetChannel *ch; |
@@ -2811,7 +2811,8 @@ handle_plaintext_channel_open_ack (void *cls, | |||
2811 | GCCH_2s (ch), | 2811 | GCCH_2s (ch), |
2812 | GCT_2s (t)); | 2812 | GCT_2s (t)); |
2813 | GCCH_handle_channel_open_ack (ch, | 2813 | GCCH_handle_channel_open_ack (ch, |
2814 | GCC_get_id (t->current_ct->cc)); | 2814 | GCC_get_id (t->current_ct->cc), |
2815 | &cm->port); | ||
2815 | } | 2816 | } |
2816 | 2817 | ||
2817 | 2818 | ||
@@ -2824,7 +2825,7 @@ handle_plaintext_channel_open_ack (void *cls, | |||
2824 | */ | 2825 | */ |
2825 | static void | 2826 | static void |
2826 | handle_plaintext_channel_destroy (void *cls, | 2827 | handle_plaintext_channel_destroy (void *cls, |
2827 | const struct GNUNET_CADET_ChannelManageMessage *cm) | 2828 | const struct GNUNET_CADET_ChannelDestroyMessage *cm) |
2828 | { | 2829 | { |
2829 | struct CadetTunnel *t = cls; | 2830 | struct CadetTunnel *t = cls; |
2830 | struct CadetChannel *ch; | 2831 | struct CadetChannel *ch; |
@@ -2915,11 +2916,11 @@ GCT_create_tunnel (struct CadetPeer *destination) | |||
2915 | t), | 2916 | t), |
2916 | GNUNET_MQ_hd_fixed_size (plaintext_channel_open_ack, | 2917 | GNUNET_MQ_hd_fixed_size (plaintext_channel_open_ack, |
2917 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, | 2918 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_OPEN_ACK, |
2918 | struct GNUNET_CADET_ChannelManageMessage, | 2919 | struct GNUNET_CADET_ChannelOpenAckMessage, |
2919 | t), | 2920 | t), |
2920 | GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, | 2921 | GNUNET_MQ_hd_fixed_size (plaintext_channel_destroy, |
2921 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, | 2922 | GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY, |
2922 | struct GNUNET_CADET_ChannelManageMessage, | 2923 | struct GNUNET_CADET_ChannelDestroyMessage, |
2923 | t), | 2924 | t), |
2924 | GNUNET_MQ_handler_end () | 2925 | GNUNET_MQ_handler_end () |
2925 | }; | 2926 | }; |
diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index 8963d97c9..72df2203c 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c | |||
@@ -959,13 +959,13 @@ main (int argc, char *argv[]) | |||
959 | const char *config_file; | 959 | const char *config_file; |
960 | char port_id[] = "test port"; | 960 | char port_id[] = "test port"; |
961 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 961 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
962 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 962 | GNUNET_GETOPT_option_relative_time ('t', |
963 | "time", | 963 | "time", |
964 | "short_time", | 964 | "short_time", |
965 | gettext_noop ("set short timeout"), | 965 | gettext_noop ("set short timeout"), |
966 | &short_time), | 966 | &short_time), |
967 | 967 | ||
968 | GNUNET_GETOPT_OPTION_SET_UINT ('m', | 968 | GNUNET_GETOPT_option_uint ('m', |
969 | "messages", | 969 | "messages", |
970 | "NUM_MESSAGES", | 970 | "NUM_MESSAGES", |
971 | gettext_noop ("set number of messages to send"), | 971 | gettext_noop ("set number of messages to send"), |
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c index 8cc1b3512..68c2ad594 100644 --- a/src/consensus/gnunet-consensus-profiler.c +++ b/src/consensus/gnunet-consensus-profiler.c | |||
@@ -517,49 +517,49 @@ main (int argc, char **argv) | |||
517 | { | 517 | { |
518 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 518 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
519 | 519 | ||
520 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 520 | GNUNET_GETOPT_option_uint ('n', |
521 | "num-peers", | 521 | "num-peers", |
522 | NULL, | 522 | NULL, |
523 | gettext_noop ("number of peers in consensus"), | 523 | gettext_noop ("number of peers in consensus"), |
524 | &num_peers), | 524 | &num_peers), |
525 | 525 | ||
526 | GNUNET_GETOPT_OPTION_SET_UINT ('k', | 526 | GNUNET_GETOPT_option_uint ('k', |
527 | "value-replication", | 527 | "value-replication", |
528 | NULL, | 528 | NULL, |
529 | gettext_noop ("how many peers (random selection without replacement) receive one value?"), | 529 | gettext_noop ("how many peers (random selection without replacement) receive one value?"), |
530 | &replication), | 530 | &replication), |
531 | 531 | ||
532 | GNUNET_GETOPT_OPTION_SET_UINT ('x', | 532 | GNUNET_GETOPT_option_uint ('x', |
533 | "num-values", | 533 | "num-values", |
534 | NULL, | 534 | NULL, |
535 | gettext_noop ("number of values"), | 535 | gettext_noop ("number of values"), |
536 | &num_values), | 536 | &num_values), |
537 | 537 | ||
538 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 538 | GNUNET_GETOPT_option_relative_time ('t', |
539 | "timeout", | 539 | "timeout", |
540 | NULL, | 540 | NULL, |
541 | gettext_noop ("consensus timeout"), | 541 | gettext_noop ("consensus timeout"), |
542 | &conclude_timeout), | 542 | &conclude_timeout), |
543 | 543 | ||
544 | 544 | ||
545 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('d', | 545 | GNUNET_GETOPT_option_relative_time ('d', |
546 | "delay", | 546 | "delay", |
547 | NULL, | 547 | NULL, |
548 | gettext_noop ("delay until consensus starts"), | 548 | gettext_noop ("delay until consensus starts"), |
549 | &consensus_delay), | 549 | &consensus_delay), |
550 | 550 | ||
551 | GNUNET_GETOPT_OPTION_FILENAME ('s', | 551 | GNUNET_GETOPT_option_filename ('s', |
552 | "statistics", | 552 | "statistics", |
553 | "FILENAME", | 553 | "FILENAME", |
554 | gettext_noop ("write statistics to file"), | 554 | gettext_noop ("write statistics to file"), |
555 | &statistics_filename), | 555 | &statistics_filename), |
556 | 556 | ||
557 | GNUNET_GETOPT_OPTION_SET_ONE ('S', | 557 | GNUNET_GETOPT_option_flag ('S', |
558 | "dist-static", | 558 | "dist-static", |
559 | gettext_noop ("distribute elements to a static subset of good peers"), | 559 | gettext_noop ("distribute elements to a static subset of good peers"), |
560 | &dist_static), | 560 | &dist_static), |
561 | 561 | ||
562 | GNUNET_GETOPT_OPTION_SET_ONE ('V', | 562 | GNUNET_GETOPT_option_flag ('V', |
563 | "verbose", | 563 | "verbose", |
564 | gettext_noop ("be more verbose (print received values)"), | 564 | gettext_noop ("be more verbose (print received values)"), |
565 | &verbose), | 565 | &verbose), |
diff --git a/src/conversation/Makefile.am b/src/conversation/Makefile.am index cc2938144..cbffc3283 100644 --- a/src/conversation/Makefile.am +++ b/src/conversation/Makefile.am | |||
@@ -138,7 +138,7 @@ gnunet_helper_audio_record_CFLAGS = \ | |||
138 | $(GST_CFLAGS) | 138 | $(GST_CFLAGS) |
139 | 139 | ||
140 | gnunet_helper_audio_playback_SOURCES = \ | 140 | gnunet_helper_audio_playback_SOURCES = \ |
141 | gnunet_gst_test.c gnunet_gst.c | 141 | gnunet-helper-audio-playback-gst.c |
142 | gnunet_helper_audio_playback_LDADD = \ | 142 | gnunet_helper_audio_playback_LDADD = \ |
143 | $(top_builddir)/src/util/libgnunetutil.la \ | 143 | $(top_builddir)/src/util/libgnunetutil.la \ |
144 | $(GST_LIBS) \ | 144 | $(GST_LIBS) \ |
diff --git a/src/conversation/gnunet-conversation.c b/src/conversation/gnunet-conversation.c index c5275c0de..8f9ddec25 100644 --- a/src/conversation/gnunet-conversation.c +++ b/src/conversation/gnunet-conversation.c | |||
@@ -1267,13 +1267,13 @@ main (int argc, char *const *argv) | |||
1267 | { | 1267 | { |
1268 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1268 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1269 | 1269 | ||
1270 | GNUNET_GETOPT_OPTION_STRING ('e', | 1270 | GNUNET_GETOPT_option_string ('e', |
1271 | "ego", | 1271 | "ego", |
1272 | "NAME", | 1272 | "NAME", |
1273 | gettext_noop ("sets the NAME of the ego to use for the phone (and name resolution)"), | 1273 | gettext_noop ("sets the NAME of the ego to use for the phone (and name resolution)"), |
1274 | &ego_name), | 1274 | &ego_name), |
1275 | 1275 | ||
1276 | GNUNET_GETOPT_OPTION_STRING ('p', | 1276 | GNUNET_GETOPT_option_string ('p', |
1277 | "phone", | 1277 | "phone", |
1278 | "LINE", | 1278 | "LINE", |
1279 | gettext_noop ("sets the LINE to use for the phone"), | 1279 | gettext_noop ("sets the LINE to use for the phone"), |
diff --git a/src/conversation/gnunet-helper-audio-playback-gst.c b/src/conversation/gnunet-helper-audio-playback-gst.c index 9307cd12e..264b14e76 100644 --- a/src/conversation/gnunet-helper-audio-playback-gst.c +++ b/src/conversation/gnunet-helper-audio-playback-gst.c | |||
@@ -56,7 +56,7 @@ | |||
56 | /** | 56 | /** |
57 | * Tokenizer for the data we get from stdin | 57 | * Tokenizer for the data we get from stdin |
58 | */ | 58 | */ |
59 | struct GNUNET_SERVER_MessageStreamTokenizer *stdin_mst; | 59 | struct GNUNET_MessageStreamTokenizer *stdin_mst; |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * Main pipeline. | 62 | * Main pipeline. |
@@ -82,20 +82,20 @@ static int abort_read; | |||
82 | 82 | ||
83 | static void | 83 | static void |
84 | sink_child_added (GstChildProxy *child_proxy, | 84 | sink_child_added (GstChildProxy *child_proxy, |
85 | GObject *object, | 85 | GObject *object, |
86 | gchar *name, | 86 | gchar *name, |
87 | gpointer user_data) | 87 | gpointer user_data) |
88 | { | 88 | { |
89 | if (GST_IS_AUDIO_BASE_SRC (object)) | 89 | if (GST_IS_AUDIO_BASE_SRC (object)) |
90 | g_object_set (object, | 90 | g_object_set (object, |
91 | "buffer-time", (gint64) BUFFER_TIME, | 91 | "buffer-time", (gint64) BUFFER_TIME, |
92 | "latency-time", (gint64) LATENCY_TIME, | 92 | "latency-time", (gint64) LATENCY_TIME, |
93 | NULL); | 93 | NULL); |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | static void | 97 | static void |
98 | ogg_pad_added (GstElement *element, | 98 | ogg_pad_added (GstElement *element, |
99 | GstPad *pad, | 99 | GstPad *pad, |
100 | gpointer data) | 100 | gpointer data) |
101 | { | 101 | { |
@@ -127,7 +127,7 @@ quit () | |||
127 | static gboolean | 127 | static gboolean |
128 | bus_call (GstBus *bus, GstMessage *msg, gpointer data) | 128 | bus_call (GstBus *bus, GstMessage *msg, gpointer data) |
129 | { | 129 | { |
130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 130 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
131 | "Bus message\n"); | 131 | "Bus message\n"); |
132 | switch (GST_MESSAGE_TYPE (msg)) | 132 | switch (GST_MESSAGE_TYPE (msg)) |
133 | { | 133 | { |
@@ -141,15 +141,15 @@ bus_call (GstBus *bus, GstMessage *msg, gpointer data) | |||
141 | { | 141 | { |
142 | gchar *debug; | 142 | gchar *debug; |
143 | GError *error; | 143 | GError *error; |
144 | 144 | ||
145 | gst_message_parse_error (msg, &error, &debug); | 145 | gst_message_parse_error (msg, &error, &debug); |
146 | g_free (debug); | 146 | g_free (debug); |
147 | 147 | ||
148 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 148 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
149 | "Error: %s\n", | 149 | "Error: %s\n", |
150 | error->message); | 150 | error->message); |
151 | g_error_free (error); | 151 | g_error_free (error); |
152 | 152 | ||
153 | quit (); | 153 | quit (); |
154 | break; | 154 | break; |
155 | } | 155 | } |
@@ -196,7 +196,7 @@ feed_buffer_to_gst (const char *audio, size_t b_len) | |||
196 | switch (flow) | 196 | switch (flow) |
197 | { | 197 | { |
198 | case GST_FLOW_OK: | 198 | case GST_FLOW_OK: |
199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 199 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
200 | "Fed %u bytes to the pipeline\n", | 200 | "Fed %u bytes to the pipeline\n", |
201 | (unsigned int) b_len); | 201 | (unsigned int) b_len); |
202 | break; | 202 | break; |
@@ -207,7 +207,7 @@ feed_buffer_to_gst (const char *audio, size_t b_len) | |||
207 | break; | 207 | break; |
208 | case GST_FLOW_EOS: | 208 | case GST_FLOW_EOS: |
209 | /* end of stream */ | 209 | /* end of stream */ |
210 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 210 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
211 | "EOS\n"); | 211 | "EOS\n"); |
212 | break; | 212 | break; |
213 | default: | 213 | default: |
@@ -224,7 +224,6 @@ feed_buffer_to_gst (const char *audio, size_t b_len) | |||
224 | */ | 224 | */ |
225 | static int | 225 | static int |
226 | stdin_receiver (void *cls, | 226 | stdin_receiver (void *cls, |
227 | void *client, | ||
228 | const struct GNUNET_MessageHeader *msg) | 227 | const struct GNUNET_MessageHeader *msg) |
229 | { | 228 | { |
230 | struct AudioMessage *audio; | 229 | struct AudioMessage *audio; |
@@ -253,21 +252,21 @@ main (int argc, char **argv) | |||
253 | uint64_t toff; | 252 | uint64_t toff; |
254 | 253 | ||
255 | typedef void (*SignalHandlerPointer) (int); | 254 | typedef void (*SignalHandlerPointer) (int); |
256 | 255 | ||
257 | SignalHandlerPointer inthandler, termhandler; | 256 | SignalHandlerPointer inthandler, termhandler; |
258 | #ifdef DEBUG_READ_PURE_OGG | 257 | #ifdef DEBUG_READ_PURE_OGG |
259 | int read_pure_ogg = getenv ("GNUNET_READ_PURE_OGG") ? 1 : 0; | 258 | int read_pure_ogg = getenv ("GNUNET_READ_PURE_OGG") ? 1 : 0; |
260 | #endif | 259 | #endif |
261 | 260 | ||
262 | inthandler = signal (SIGINT, | 261 | inthandler = signal (SIGINT, |
263 | &signalhandler); | 262 | &signalhandler); |
264 | termhandler = signal (SIGTERM, | 263 | termhandler = signal (SIGTERM, |
265 | &signalhandler); | 264 | &signalhandler); |
266 | 265 | ||
267 | #ifdef WINDOWS | 266 | #ifdef WINDOWS |
268 | setmode (0, _O_BINARY); | 267 | setmode (0, _O_BINARY); |
269 | #endif | 268 | #endif |
270 | 269 | ||
271 | /* Initialisation */ | 270 | /* Initialisation */ |
272 | gst_init (&argc, &argv); | 271 | gst_init (&argc, &argv); |
273 | 272 | ||
@@ -275,13 +274,13 @@ main (int argc, char **argv) | |||
275 | GNUNET_log_setup ("gnunet-helper-audio-playback-gst", | 274 | GNUNET_log_setup ("gnunet-helper-audio-playback-gst", |
276 | "WARNING", | 275 | "WARNING", |
277 | NULL)); | 276 | NULL)); |
278 | 277 | ||
279 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 278 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
280 | "Audio sink starts\n"); | 279 | "Audio sink starts\n"); |
281 | 280 | ||
282 | stdin_mst = GNUNET_SERVER_mst_create (&stdin_receiver, | 281 | stdin_mst = GNUNET_MST_create (&stdin_receiver, |
283 | NULL); | 282 | NULL); |
284 | 283 | ||
285 | /* Create gstreamer elements */ | 284 | /* Create gstreamer elements */ |
286 | pipeline = gst_pipeline_new ("audio-player"); | 285 | pipeline = gst_pipeline_new ("audio-player"); |
287 | source = gst_element_factory_make ("appsrc", "audio-input"); | 286 | source = gst_element_factory_make ("appsrc", "audio-input"); |
@@ -298,13 +297,13 @@ main (int argc, char **argv) | |||
298 | return -1; | 297 | return -1; |
299 | } | 298 | } |
300 | 299 | ||
301 | g_signal_connect (sink, | 300 | g_signal_connect (sink, |
302 | "child-added", | 301 | "child-added", |
303 | G_CALLBACK (sink_child_added), | 302 | G_CALLBACK (sink_child_added), |
304 | NULL); | 303 | NULL); |
305 | g_signal_connect (demuxer, | 304 | g_signal_connect (demuxer, |
306 | "pad-added", | 305 | "pad-added", |
307 | G_CALLBACK (ogg_pad_added), | 306 | G_CALLBACK (ogg_pad_added), |
308 | decoder); | 307 | decoder); |
309 | 308 | ||
310 | /* Keep a reference to it, we operate on it */ | 309 | /* Keep a reference to it, we operate on it */ |
@@ -362,7 +361,7 @@ main (int argc, char **argv) | |||
362 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 361 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
363 | "Received %d bytes of audio data (total: %llu)\n", | 362 | "Received %d bytes of audio data (total: %llu)\n", |
364 | (int) ret, | 363 | (int) ret, |
365 | toff); | 364 | (unsigned long long) toff); |
366 | if (0 == ret) | 365 | if (0 == ret) |
367 | break; | 366 | break; |
368 | #ifdef DEBUG_READ_PURE_OGG | 367 | #ifdef DEBUG_READ_PURE_OGG |
@@ -372,20 +371,22 @@ main (int argc, char **argv) | |||
372 | } | 371 | } |
373 | else | 372 | else |
374 | #endif | 373 | #endif |
375 | GNUNET_SERVER_mst_receive (stdin_mst, NULL, | 374 | GNUNET_MST_from_buffer (stdin_mst, |
376 | readbuf, ret, | 375 | readbuf, |
377 | GNUNET_NO, GNUNET_NO); | 376 | ret, |
377 | GNUNET_NO, | ||
378 | GNUNET_NO); | ||
378 | } | 379 | } |
379 | GNUNET_SERVER_mst_destroy (stdin_mst); | 380 | GNUNET_MST_destroy (stdin_mst); |
380 | 381 | ||
381 | signal (SIGINT, inthandler); | 382 | signal (SIGINT, inthandler); |
382 | signal (SIGINT, termhandler); | 383 | signal (SIGINT, termhandler); |
383 | 384 | ||
384 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 385 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
385 | "Returned, stopping playback\n"); | 386 | "Returned, stopping playback\n"); |
386 | quit (); | 387 | quit (); |
387 | 388 | ||
388 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 389 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
389 | "Deleting pipeline\n"); | 390 | "Deleting pipeline\n"); |
390 | gst_object_unref (GST_OBJECT (source)); | 391 | gst_object_unref (GST_OBJECT (source)); |
391 | source = NULL; | 392 | source = NULL; |
diff --git a/src/conversation/gnunet-helper-audio-record-gst.c b/src/conversation/gnunet-helper-audio-record-gst.c index 7f1f3368b..b9aed4ea7 100644 --- a/src/conversation/gnunet-helper-audio-record-gst.c +++ b/src/conversation/gnunet-helper-audio-record-gst.c | |||
@@ -352,9 +352,12 @@ main (int argc, char **argv) | |||
352 | { | 352 | { |
353 | if (-1 == ret) | 353 | if (-1 == ret) |
354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
355 | "Failed to write %u bytes at offset %u (total %u) in phase %d: %s\n", | 355 | "Failed to write %u bytes at offset %u (total %u) in phase %d: %s\n", |
356 | (unsigned int) to_send - offset, (unsigned int) offset, | 356 | (unsigned int) (to_send - offset), |
357 | (unsigned int) (to_send + offset), phase, strerror (errno)); | 357 | (unsigned int) offset, |
358 | (unsigned int) (to_send + offset), | ||
359 | phase, | ||
360 | strerror (errno)); | ||
358 | abort_send = 1; | 361 | abort_send = 1; |
359 | break; | 362 | break; |
360 | } | 363 | } |
diff --git a/src/conversation/gnunet_gst.c b/src/conversation/gnunet_gst.c index 91c6ddccb..52cb2ccbc 100644 --- a/src/conversation/gnunet_gst.c +++ b/src/conversation/gnunet_gst.c | |||
@@ -29,6 +29,7 @@ | |||
29 | */ | 29 | */ |
30 | static struct GNUNET_CONFIGURATION_Handle *cfg; | 30 | static struct GNUNET_CONFIGURATION_Handle *cfg; |
31 | 31 | ||
32 | |||
32 | void | 33 | void |
33 | dump_buffer(unsigned n, const unsigned char* buf) | 34 | dump_buffer(unsigned n, const unsigned char* buf) |
34 | { | 35 | { |
@@ -61,15 +62,13 @@ BREAKOUT: | |||
61 | /*** | 62 | /*** |
62 | * load gnunet configuration | 63 | * load gnunet configuration |
63 | */ | 64 | */ |
64 | void | 65 | void |
65 | gg_load_configuration(GNUNET_gstData * d) | 66 | gg_load_configuration(GNUNET_gstData * d) |
66 | { | 67 | { |
67 | char *audiobackend_string; | 68 | char *audiobackend_string; |
68 | cfg = GNUNET_CONFIGURATION_create(); | 69 | cfg = GNUNET_CONFIGURATION_create(); |
69 | GNUNET_CONFIGURATION_load(cfg, "mediahelper.conf"); | 70 | GNUNET_CONFIGURATION_load(cfg, "mediahelper.conf"); |
70 | 71 | ||
71 | char *section = "MEDIAHELPER"; | ||
72 | |||
73 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "JACK_PP_IN", &d->jack_pp_in); | 72 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "JACK_PP_IN", &d->jack_pp_in); |
74 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "JACK_PP_OUT", &d->jack_pp_out); | 73 | GNUNET_CONFIGURATION_get_value_string(cfg, "MEDIAHELPER", "JACK_PP_OUT", &d->jack_pp_out); |
75 | 74 | ||
@@ -77,19 +76,19 @@ gg_load_configuration(GNUNET_gstData * d) | |||
77 | 76 | ||
78 | // printf("abstring: %s \n", audiobackend_string); | 77 | // printf("abstring: %s \n", audiobackend_string); |
79 | 78 | ||
80 | if ( audiobackend_string == "AUTO" ) | 79 | if (0 == strcasecmp (audiobackend_string, "AUTO")) |
81 | { | 80 | { |
82 | d->audiobackend = AUTO; | 81 | d->audiobackend = AUTO; |
83 | } else if ( audiobackend_string = "JACK" ) | 82 | } else if (0 == strcasecmp (audiobackend_string, "JACK")) |
84 | { | 83 | { |
85 | d->audiobackend = JACK; | 84 | d->audiobackend = JACK; |
86 | } else if ( audiobackend_string = "ALSA" ) | 85 | } else if (0 == strcasecmp (audiobackend_string, "ALSA")) |
87 | { | 86 | { |
88 | d->audiobackend = ALSA; | 87 | d->audiobackend = ALSA; |
89 | } else if ( audiobackend_string = "FAKE" ) | 88 | } else if (0 == strcasecmp (audiobackend_string, "FAKE")) |
90 | { | 89 | { |
91 | d->audiobackend = FAKE; | 90 | d->audiobackend = FAKE; |
92 | } else if ( audiobackend_string = "TEST" ) | 91 | } else if (0 == strcasecmp (audiobackend_string, "TEST")) |
93 | { | 92 | { |
94 | d->audiobackend = TEST; | 93 | d->audiobackend = TEST; |
95 | } else | 94 | } else |
@@ -147,8 +146,6 @@ write_data (const char *ptr, size_t msg_size) | |||
147 | extern GstFlowReturn | 146 | extern GstFlowReturn |
148 | on_appsink_new_sample (GstElement * element, GNUNET_gstData * d) | 147 | on_appsink_new_sample (GstElement * element, GNUNET_gstData * d) |
149 | { | 148 | { |
150 | static unsigned long long toff; | ||
151 | |||
152 | //size of message including gnunet header | 149 | //size of message including gnunet header |
153 | size_t msg_size; | 150 | size_t msg_size; |
154 | 151 | ||
@@ -161,7 +158,6 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d) | |||
161 | GstCaps *s_caps; | 158 | GstCaps *s_caps; |
162 | char *caps_str; | 159 | char *caps_str; |
163 | */ | 160 | */ |
164 | (d->audio_message)->header.size = htons ((uint16_t) msg_size); | ||
165 | 161 | ||
166 | if (gst_app_sink_is_eos(GST_APP_SINK(element))) | 162 | if (gst_app_sink_is_eos(GST_APP_SINK(element))) |
167 | return GST_FLOW_OK; | 163 | return GST_FLOW_OK; |
@@ -197,13 +193,7 @@ on_appsink_new_sample (GstElement * element, GNUNET_gstData * d) | |||
197 | 193 | ||
198 | // copy the data into audio_message | 194 | // copy the data into audio_message |
199 | GNUNET_memcpy (((char *) &(d->audio_message)[1]), map.data, len); | 195 | GNUNET_memcpy (((char *) &(d->audio_message)[1]), map.data, len); |
200 | /* | 196 | (d->audio_message)->header.size = htons ((uint16_t) msg_size); |
201 | toff += msg_size; | ||
202 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
203 | "Sending %u bytes of audio data (total: %llu)\n", | ||
204 | (unsigned int) msg_size, | ||
205 | toff); | ||
206 | */ | ||
207 | if (d->pure_ogg) | 197 | if (d->pure_ogg) |
208 | // write the audio_message without the gnunet headers | 198 | // write the audio_message without the gnunet headers |
209 | write_data ((const char *) &(d->audio_message)[1], len); | 199 | write_data ((const char *) &(d->audio_message)[1], len); |
@@ -589,14 +579,15 @@ autoaudiosource_child_added (GstChildProxy *child_proxy, GObject *object, gchar | |||
589 | g_object_set (object, "buffer-time", (gint64) BUFFER_TIME, "latency-time", (gint64) LATENCY_TIME, NULL); | 579 | g_object_set (object, "buffer-time", (gint64) BUFFER_TIME, "latency-time", (gint64) LATENCY_TIME, NULL); |
590 | } | 580 | } |
591 | 581 | ||
582 | |||
592 | GstElement * | 583 | GstElement * |
593 | get_pipeline(GstElement *element) | 584 | get_pipeline(GstElement *element) |
594 | { | 585 | { |
595 | GstPipeline *p; | 586 | GstPipeline *p; |
596 | 587 | ||
597 | p = gst_object_get_parent(element); | 588 | p = GST_PIPELINE (gst_object_get_parent(GST_OBJECT (element))); |
598 | 589 | ||
599 | return p; | 590 | return GST_ELEMENT (p); |
600 | } | 591 | } |
601 | 592 | ||
602 | static void | 593 | static void |
@@ -617,6 +608,7 @@ decoder_ogg_pad_added (GstElement *element, | |||
617 | gst_object_unref (sinkpad); | 608 | gst_object_unref (sinkpad); |
618 | } | 609 | } |
619 | 610 | ||
611 | |||
620 | int | 612 | int |
621 | gnunet_read (GNUNET_gstData * d) | 613 | gnunet_read (GNUNET_gstData * d) |
622 | { | 614 | { |
@@ -646,10 +638,13 @@ gnunet_read (GNUNET_gstData * d) | |||
646 | else | 638 | else |
647 | { | 639 | { |
648 | //#endif | 640 | //#endif |
649 | GNUNET_SERVER_mst_receive (d->stdin_mst, NULL, | 641 | GNUNET_MST_from_buffer (d->stdin_mst, |
650 | readbuf, ret, | 642 | readbuf, |
651 | GNUNET_NO, GNUNET_NO); | 643 | ret, |
644 | GNUNET_NO, | ||
645 | GNUNET_NO); | ||
652 | } | 646 | } |
647 | return 0; | ||
653 | } | 648 | } |
654 | 649 | ||
655 | /** | 650 | /** |
@@ -657,13 +652,14 @@ gnunet_read (GNUNET_gstData * d) | |||
657 | */ | 652 | */ |
658 | static int | 653 | static int |
659 | stdin_receiver (void *cls, | 654 | stdin_receiver (void *cls, |
660 | void *client, | ||
661 | const struct GNUNET_MessageHeader *msg) | 655 | const struct GNUNET_MessageHeader *msg) |
662 | { | 656 | { |
663 | struct AudioMessage *audio; | 657 | struct AudioMessage *audio; |
664 | size_t b_len; | 658 | size_t b_len; |
659 | |||
665 | printf("stdin receiver \n "); | 660 | printf("stdin receiver \n "); |
666 | dump_buffer(sizeof(msg), msg); | 661 | dump_buffer (sizeof(msg), |
662 | (const unsigned char *) msg); | ||
667 | 663 | ||
668 | switch (ntohs (msg->type)) | 664 | switch (ntohs (msg->type)) |
669 | { | 665 | { |
@@ -711,7 +707,7 @@ get_app(GNUNET_gstData *d, int type) | |||
711 | //d->audio_message.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); | 707 | //d->audio_message.header.type = htons (GNUNET_MESSAGE_TYPE_CONVERSATION_AUDIO); |
712 | 708 | ||
713 | 709 | ||
714 | d->stdin_mst = GNUNET_SERVER_mst_create (&stdin_receiver, d); | 710 | d->stdin_mst = GNUNET_MST_create (&stdin_receiver, d); |
715 | 711 | ||
716 | if ( d->stdin_mst == NULL) | 712 | if ( d->stdin_mst == NULL) |
717 | printf("stdin_mst = NULL"); | 713 | printf("stdin_mst = NULL"); |
@@ -768,7 +764,7 @@ get_coder(GNUNET_gstData *d , int type) | |||
768 | { | 764 | { |
769 | GstBin *bin; | 765 | GstBin *bin; |
770 | GstPad *srcpad, *sinkpad, *srcghostpad, *sinkghostpad; | 766 | GstPad *srcpad, *sinkpad, *srcghostpad, *sinkghostpad; |
771 | GstCaps *caps, *rtpcaps; | 767 | GstCaps *rtpcaps; |
772 | GstElement *encoder, *muxer, *decoder, *demuxer, *jitterbuffer, *rtpcapsfilter; | 768 | GstElement *encoder, *muxer, *decoder, *demuxer, *jitterbuffer, *rtpcapsfilter; |
773 | 769 | ||
774 | if ( d->usertp == TRUE ) | 770 | if ( d->usertp == TRUE ) |
@@ -892,7 +888,9 @@ get_coder(GNUNET_gstData *d , int type) | |||
892 | 888 | ||
893 | return bin; | 889 | return bin; |
894 | } | 890 | } |
895 | extern GstBin * | 891 | |
892 | |||
893 | extern GstBin * | ||
896 | get_audiobin(GNUNET_gstData *d , int type) | 894 | get_audiobin(GNUNET_gstData *d , int type) |
897 | { | 895 | { |
898 | GstBin *bin; | 896 | GstBin *bin; |
diff --git a/src/conversation/gnunet_gst_def.h b/src/conversation/gnunet_gst_def.h index 85add54b6..980ed2f48 100644 --- a/src/conversation/gnunet_gst_def.h +++ b/src/conversation/gnunet_gst_def.h | |||
@@ -94,7 +94,7 @@ struct GNUNET_gstData { | |||
94 | 94 | ||
95 | // things | 95 | // things |
96 | struct AudioMessage *audio_message; | 96 | struct AudioMessage *audio_message; |
97 | struct GNUNET_SERVER_MessageStreamTokenizer *stdin_mst; | 97 | struct GNUNET_MessageStreamTokenizer *stdin_mst; |
98 | GstElement *appsrc; | 98 | GstElement *appsrc; |
99 | GstElement *appsink; | 99 | GstElement *appsink; |
100 | //settings | 100 | //settings |
diff --git a/src/conversation/gnunet_gst_test.c b/src/conversation/gnunet_gst_test.c index 2ea007583..03f6a4d95 100644 --- a/src/conversation/gnunet_gst_test.c +++ b/src/conversation/gnunet_gst_test.c | |||
@@ -18,7 +18,7 @@ | |||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file conversation/gnunet_gst.c | 21 | * @file conversation/gnunet_gst_test.c |
22 | * @brief FIXME | 22 | * @brief FIXME |
23 | * @author Hark | 23 | * @author Hark |
24 | */ | 24 | */ |
@@ -30,8 +30,7 @@ int | |||
30 | main (int argc, char *argv[]) | 30 | main (int argc, char *argv[]) |
31 | { | 31 | { |
32 | struct GNUNET_gstData *gst; | 32 | struct GNUNET_gstData *gst; |
33 | GstBus *bus; | 33 | // GstBus *bus; |
34 | GstMessage *msg; | ||
35 | GstElement *gnunetsrc, *gnunetsink, *source, *sink, *encoder, *decoder; | 34 | GstElement *gnunetsrc, *gnunetsink, *source, *sink, *encoder, *decoder; |
36 | 35 | ||
37 | 36 | ||
@@ -137,7 +136,7 @@ main (int argc, char *argv[]) | |||
137 | } | 136 | } |
138 | g_print ("Returned, stopping playback\n"); | 137 | g_print ("Returned, stopping playback\n"); |
139 | 138 | ||
140 | gst_object_unref (bus); | 139 | // gst_object_unref (bus); |
141 | gst_element_set_state (GST_ELEMENT(gst->pipeline), GST_STATE_NULL); | 140 | gst_element_set_state (GST_ELEMENT(gst->pipeline), GST_STATE_NULL); |
142 | gst_object_unref (gst->pipeline); | 141 | gst_object_unref (gst->pipeline); |
143 | 142 | ||
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c index ed89b1946..76b7e8ac4 100644 --- a/src/core/gnunet-core.c +++ b/src/core/gnunet-core.c | |||
@@ -172,7 +172,7 @@ main (int argc, | |||
172 | { | 172 | { |
173 | int res; | 173 | int res; |
174 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 174 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
175 | GNUNET_GETOPT_OPTION_SET_ONE ('m', | 175 | GNUNET_GETOPT_option_flag ('m', |
176 | "monitor", | 176 | "monitor", |
177 | gettext_noop ("provide information about all current connections (continuously)"), | 177 | gettext_noop ("provide information about all current connections (continuously)"), |
178 | &monitor_connections), | 178 | &monitor_connections), |
diff --git a/src/datastore/gnunet-datastore.c b/src/datastore/gnunet-datastore.c index 7caf5d175..9e0ee205e 100644 --- a/src/datastore/gnunet-datastore.c +++ b/src/datastore/gnunet-datastore.c | |||
@@ -250,7 +250,7 @@ int | |||
250 | main (int argc, char *const *argv) | 250 | main (int argc, char *const *argv) |
251 | { | 251 | { |
252 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 252 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
253 | GNUNET_GETOPT_OPTION_FILENAME ('s', | 253 | GNUNET_GETOPT_option_filename ('s', |
254 | "sourcecfg", | 254 | "sourcecfg", |
255 | "FILENAME", | 255 | "FILENAME", |
256 | gettext_noop ("specifies the configuration to use to access an alternative datastore; will merge that datastore into our current datastore"), | 256 | gettext_noop ("specifies the configuration to use to access an alternative datastore; will merge that datastore into our current datastore"), |
diff --git a/src/datastore/perf_datastore_api.c b/src/datastore/perf_datastore_api.c index 4f1f99a5c..10d9cf72e 100644 --- a/src/datastore/perf_datastore_api.c +++ b/src/datastore/perf_datastore_api.c | |||
@@ -303,6 +303,7 @@ remove_next (void *cls, | |||
303 | * @param type type of the content | 303 | * @param type type of the content |
304 | * @param priority priority of the content | 304 | * @param priority priority of the content |
305 | * @param anonymity anonymity-level for the content | 305 | * @param anonymity anonymity-level for the content |
306 | * @param replication replication-level for the content | ||
306 | * @param expiration expiration time for the content | 307 | * @param expiration expiration time for the content |
307 | * @param uid unique identifier for the datum; | 308 | * @param uid unique identifier for the datum; |
308 | * maybe 0 if no unique identifier is available | 309 | * maybe 0 if no unique identifier is available |
@@ -315,6 +316,7 @@ delete_value (void *cls, | |||
315 | enum GNUNET_BLOCK_Type type, | 316 | enum GNUNET_BLOCK_Type type, |
316 | uint32_t priority, | 317 | uint32_t priority, |
317 | uint32_t anonymity, | 318 | uint32_t anonymity, |
319 | uint32_t replication, | ||
318 | struct GNUNET_TIME_Absolute expiration, | 320 | struct GNUNET_TIME_Absolute expiration, |
319 | uint64_t uid) | 321 | uint64_t uid) |
320 | { | 322 | { |
diff --git a/src/datastore/perf_plugin_datastore.c b/src/datastore/perf_plugin_datastore.c index 1e43b74b4..2f9502989 100644 --- a/src/datastore/perf_plugin_datastore.c +++ b/src/datastore/perf_plugin_datastore.c | |||
@@ -197,13 +197,14 @@ do_put (struct CpsRunContext *crc) | |||
197 | 197 | ||
198 | static int | 198 | static int |
199 | iterate_zeros (void *cls, | 199 | iterate_zeros (void *cls, |
200 | const struct GNUNET_HashCode *key, | 200 | const struct GNUNET_HashCode *key, |
201 | uint32_t size, | 201 | uint32_t size, |
202 | const void *data, | 202 | const void *data, |
203 | enum GNUNET_BLOCK_Type type, | 203 | enum GNUNET_BLOCK_Type type, |
204 | uint32_t priority, | 204 | uint32_t priority, |
205 | uint32_t anonymity, | 205 | uint32_t anonymity, |
206 | struct GNUNET_TIME_Absolute expiration, | 206 | uint32_t replication, |
207 | struct GNUNET_TIME_Absolute expiration, | ||
207 | uint64_t uid) | 208 | uint64_t uid) |
208 | { | 209 | { |
209 | struct CpsRunContext *crc = cls; | 210 | struct CpsRunContext *crc = cls; |
@@ -253,14 +254,15 @@ iterate_zeros (void *cls, | |||
253 | 254 | ||
254 | static int | 255 | static int |
255 | expiration_get (void *cls, | 256 | expiration_get (void *cls, |
256 | const struct GNUNET_HashCode *key, | 257 | const struct GNUNET_HashCode *key, |
257 | uint32_t size, | 258 | uint32_t size, |
258 | const void *data, | 259 | const void *data, |
259 | enum GNUNET_BLOCK_Type type, | 260 | enum GNUNET_BLOCK_Type type, |
260 | uint32_t priority, | 261 | uint32_t priority, |
261 | uint32_t anonymity, | 262 | uint32_t anonymity, |
263 | uint32_t replication, | ||
262 | struct GNUNET_TIME_Absolute expiration, | 264 | struct GNUNET_TIME_Absolute expiration, |
263 | uint64_t uid) | 265 | uint64_t uid) |
264 | { | 266 | { |
265 | struct CpsRunContext *crc = cls; | 267 | struct CpsRunContext *crc = cls; |
266 | int i; | 268 | int i; |
@@ -305,14 +307,15 @@ expiration_get (void *cls, | |||
305 | 307 | ||
306 | static int | 308 | static int |
307 | replication_get (void *cls, | 309 | replication_get (void *cls, |
308 | const struct GNUNET_HashCode *key, | 310 | const struct GNUNET_HashCode *key, |
309 | uint32_t size, | 311 | uint32_t size, |
310 | const void *data, | 312 | const void *data, |
311 | enum GNUNET_BLOCK_Type type, | 313 | enum GNUNET_BLOCK_Type type, |
312 | uint32_t priority, | 314 | uint32_t priority, |
313 | uint32_t anonymity, | 315 | uint32_t anonymity, |
316 | uint32_t replication, | ||
314 | struct GNUNET_TIME_Absolute expiration, | 317 | struct GNUNET_TIME_Absolute expiration, |
315 | uint64_t uid) | 318 | uint64_t uid) |
316 | { | 319 | { |
317 | struct CpsRunContext *crc = cls; | 320 | struct CpsRunContext *crc = cls; |
318 | int i; | 321 | int i; |
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c index 67f0ce76d..e361df336 100644 --- a/src/dht/gnunet-dht-get.c +++ b/src/dht/gnunet-dht-get.c | |||
@@ -239,37 +239,37 @@ main (int argc, char *const *argv) | |||
239 | 239 | ||
240 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 240 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
241 | 241 | ||
242 | GNUNET_GETOPT_OPTION_STRING ('k', | 242 | GNUNET_GETOPT_option_string ('k', |
243 | "key", | 243 | "key", |
244 | "KEY", | 244 | "KEY", |
245 | gettext_noop ("the query key"), | 245 | gettext_noop ("the query key"), |
246 | &query_key), | 246 | &query_key), |
247 | 247 | ||
248 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | 248 | GNUNET_GETOPT_option_uint ('r', |
249 | "replication", | 249 | "replication", |
250 | "LEVEL", | 250 | "LEVEL", |
251 | gettext_noop ("how many parallel requests (replicas) to create"), | 251 | gettext_noop ("how many parallel requests (replicas) to create"), |
252 | &replication), | 252 | &replication), |
253 | 253 | ||
254 | 254 | ||
255 | GNUNET_GETOPT_OPTION_SET_UINT ('t', | 255 | GNUNET_GETOPT_option_uint ('t', |
256 | "type", | 256 | "type", |
257 | "TYPE", | 257 | "TYPE", |
258 | gettext_noop ("the type of data to look for"), | 258 | gettext_noop ("the type of data to look for"), |
259 | &query_type), | 259 | &query_type), |
260 | 260 | ||
261 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T', | 261 | GNUNET_GETOPT_option_relative_time ('T', |
262 | "timeout", | 262 | "timeout", |
263 | "TIMEOUT", | 263 | "TIMEOUT", |
264 | gettext_noop ("how long to execute this query before giving up?"), | 264 | gettext_noop ("how long to execute this query before giving up?"), |
265 | &timeout_request), | 265 | &timeout_request), |
266 | 266 | ||
267 | GNUNET_GETOPT_OPTION_SET_ONE ('x', | 267 | GNUNET_GETOPT_option_flag ('x', |
268 | "demultiplex", | 268 | "demultiplex", |
269 | gettext_noop ("use DHT's demultiplex everywhere option"), | 269 | gettext_noop ("use DHT's demultiplex everywhere option"), |
270 | &demultixplex_everywhere), | 270 | &demultixplex_everywhere), |
271 | 271 | ||
272 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 272 | GNUNET_GETOPT_option_verbose (&verbose), |
273 | GNUNET_GETOPT_OPTION_END | 273 | GNUNET_GETOPT_OPTION_END |
274 | }; | 274 | }; |
275 | 275 | ||
diff --git a/src/dht/gnunet-dht-monitor.c b/src/dht/gnunet-dht-monitor.c index e4e8c46a1..b7360bbab 100644 --- a/src/dht/gnunet-dht-monitor.c +++ b/src/dht/gnunet-dht-monitor.c | |||
@@ -292,25 +292,25 @@ main (int argc, char *const *argv) | |||
292 | { | 292 | { |
293 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 293 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
294 | 294 | ||
295 | GNUNET_GETOPT_OPTION_STRING ('k', | 295 | GNUNET_GETOPT_option_string ('k', |
296 | "key", | 296 | "key", |
297 | "KEY", | 297 | "KEY", |
298 | gettext_noop ("the query key"), | 298 | gettext_noop ("the query key"), |
299 | &query_key), | 299 | &query_key), |
300 | 300 | ||
301 | GNUNET_GETOPT_OPTION_SET_UINT ('t', | 301 | GNUNET_GETOPT_option_uint ('t', |
302 | "type", | 302 | "type", |
303 | "TYPE", | 303 | "TYPE", |
304 | gettext_noop ("the type of data to look for"), | 304 | gettext_noop ("the type of data to look for"), |
305 | &block_type), | 305 | &block_type), |
306 | 306 | ||
307 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T', | 307 | GNUNET_GETOPT_option_relative_time ('T', |
308 | "timeout", | 308 | "timeout", |
309 | "TIMEOUT", | 309 | "TIMEOUT", |
310 | gettext_noop ("how long should the monitor command run"), | 310 | gettext_noop ("how long should the monitor command run"), |
311 | &timeout_request), | 311 | &timeout_request), |
312 | 312 | ||
313 | GNUNET_GETOPT_OPTION_SET_ONE ('V', | 313 | GNUNET_GETOPT_option_flag ('V', |
314 | "verbose", | 314 | "verbose", |
315 | gettext_noop ("be verbose (print progress information)"), | 315 | gettext_noop ("be verbose (print progress information)"), |
316 | &verbose), | 316 | &verbose), |
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c index bf88e5ded..f183fe588 100644 --- a/src/dht/gnunet-dht-put.c +++ b/src/dht/gnunet-dht-put.c | |||
@@ -204,47 +204,47 @@ main (int argc, char *const *argv) | |||
204 | 204 | ||
205 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 205 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
206 | 206 | ||
207 | GNUNET_GETOPT_OPTION_STRING ('d', | 207 | GNUNET_GETOPT_option_string ('d', |
208 | "data", | 208 | "data", |
209 | "DATA", | 209 | "DATA", |
210 | gettext_noop ("the data to insert under the key"), | 210 | gettext_noop ("the data to insert under the key"), |
211 | &data), | 211 | &data), |
212 | 212 | ||
213 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('e', | 213 | GNUNET_GETOPT_option_relative_time ('e', |
214 | "expiration", | 214 | "expiration", |
215 | "EXPIRATION", | 215 | "EXPIRATION", |
216 | gettext_noop ("how long to store this entry in the dht (in seconds)"), | 216 | gettext_noop ("how long to store this entry in the dht (in seconds)"), |
217 | &expiration), | 217 | &expiration), |
218 | 218 | ||
219 | GNUNET_GETOPT_OPTION_STRING ('k', | 219 | GNUNET_GETOPT_option_string ('k', |
220 | "key", | 220 | "key", |
221 | "KEY", | 221 | "KEY", |
222 | gettext_noop ("the query key"), | 222 | gettext_noop ("the query key"), |
223 | &query_key), | 223 | &query_key), |
224 | 224 | ||
225 | GNUNET_GETOPT_OPTION_SET_ONE ('x', | 225 | GNUNET_GETOPT_option_flag ('x', |
226 | "demultiplex", | 226 | "demultiplex", |
227 | gettext_noop ("use DHT's demultiplex everywhere option"), | 227 | gettext_noop ("use DHT's demultiplex everywhere option"), |
228 | &demultixplex_everywhere), | 228 | &demultixplex_everywhere), |
229 | 229 | ||
230 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | 230 | GNUNET_GETOPT_option_uint ('r', |
231 | "replication", | 231 | "replication", |
232 | "LEVEL", | 232 | "LEVEL", |
233 | gettext_noop ("how many replicas to create"), | 233 | gettext_noop ("how many replicas to create"), |
234 | &replication), | 234 | &replication), |
235 | 235 | ||
236 | GNUNET_GETOPT_OPTION_SET_ONE ('R', | 236 | GNUNET_GETOPT_option_flag ('R', |
237 | "record", | 237 | "record", |
238 | gettext_noop ("use DHT's record route option"), | 238 | gettext_noop ("use DHT's record route option"), |
239 | &record_route), | 239 | &record_route), |
240 | 240 | ||
241 | GNUNET_GETOPT_OPTION_SET_UINT ('t', | 241 | GNUNET_GETOPT_option_uint ('t', |
242 | "type", | 242 | "type", |
243 | "TYPE", | 243 | "TYPE", |
244 | gettext_noop ("the type to insert data as"), | 244 | gettext_noop ("the type to insert data as"), |
245 | &query_type), | 245 | &query_type), |
246 | 246 | ||
247 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 247 | GNUNET_GETOPT_option_verbose (&verbose), |
248 | 248 | ||
249 | GNUNET_GETOPT_OPTION_END | 249 | GNUNET_GETOPT_OPTION_END |
250 | }; | 250 | }; |
diff --git a/src/dht/gnunet_dht_profiler.c b/src/dht/gnunet_dht_profiler.c index f65141640..a8807bea8 100644 --- a/src/dht/gnunet_dht_profiler.c +++ b/src/dht/gnunet_dht_profiler.c | |||
@@ -1182,49 +1182,49 @@ main (int argc, char *const *argv) | |||
1182 | int rc; | 1182 | int rc; |
1183 | 1183 | ||
1184 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1184 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1185 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 1185 | GNUNET_GETOPT_option_uint ('n', |
1186 | "peers", | 1186 | "peers", |
1187 | "COUNT", | 1187 | "COUNT", |
1188 | gettext_noop ("number of peers to start"), | 1188 | gettext_noop ("number of peers to start"), |
1189 | &num_peers), | 1189 | &num_peers), |
1190 | 1190 | ||
1191 | GNUNET_GETOPT_OPTION_SET_UINT ('s', | 1191 | GNUNET_GETOPT_option_uint ('s', |
1192 | "searches", | 1192 | "searches", |
1193 | "COUNT", | 1193 | "COUNT", |
1194 | gettext_noop ("maximum number of times we try to search for successor circle formation (0 for R5N)"), | 1194 | gettext_noop ("maximum number of times we try to search for successor circle formation (0 for R5N)"), |
1195 | &max_searches), | 1195 | &max_searches), |
1196 | 1196 | ||
1197 | GNUNET_GETOPT_OPTION_STRING ('H', | 1197 | GNUNET_GETOPT_option_string ('H', |
1198 | "hosts", | 1198 | "hosts", |
1199 | "FILENAME", | 1199 | "FILENAME", |
1200 | gettext_noop ("name of the file with the login information for the testbed"), | 1200 | gettext_noop ("name of the file with the login information for the testbed"), |
1201 | &hosts_file), | 1201 | &hosts_file), |
1202 | 1202 | ||
1203 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('D', | 1203 | GNUNET_GETOPT_option_relative_time ('D', |
1204 | "delay", | 1204 | "delay", |
1205 | "DELAY", | 1205 | "DELAY", |
1206 | gettext_noop ("delay between rounds for collecting statistics (default: 30 sec)"), | 1206 | gettext_noop ("delay between rounds for collecting statistics (default: 30 sec)"), |
1207 | &delay_stats), | 1207 | &delay_stats), |
1208 | 1208 | ||
1209 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('P', | 1209 | GNUNET_GETOPT_option_relative_time ('P', |
1210 | "PUT-delay", | 1210 | "PUT-delay", |
1211 | "DELAY", | 1211 | "DELAY", |
1212 | gettext_noop ("delay to start doing PUTs (default: 1 sec)"), | 1212 | gettext_noop ("delay to start doing PUTs (default: 1 sec)"), |
1213 | &delay_put), | 1213 | &delay_put), |
1214 | 1214 | ||
1215 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('G', | 1215 | GNUNET_GETOPT_option_relative_time ('G', |
1216 | "GET-delay", | 1216 | "GET-delay", |
1217 | "DELAY", | 1217 | "DELAY", |
1218 | gettext_noop ("delay to start doing GETs (default: 5 min)"), | 1218 | gettext_noop ("delay to start doing GETs (default: 5 min)"), |
1219 | &delay_get), | 1219 | &delay_get), |
1220 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | 1220 | GNUNET_GETOPT_option_uint ('r', |
1221 | "replication", | 1221 | "replication", |
1222 | "DEGREE", | 1222 | "DEGREE", |
1223 | gettext_noop ("replication degree for DHT PUTs"), | 1223 | gettext_noop ("replication degree for DHT PUTs"), |
1224 | &replication), | 1224 | &replication), |
1225 | 1225 | ||
1226 | 1226 | ||
1227 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 1227 | GNUNET_GETOPT_option_relative_time ('t', |
1228 | "timeout", | 1228 | "timeout", |
1229 | "TIMEOUT", | 1229 | "TIMEOUT", |
1230 | gettext_noop ("timeout for DHT PUT and GET requests (default: 1 min)"), | 1230 | gettext_noop ("timeout for DHT PUT and GET requests (default: 1 min)"), |
diff --git a/src/dns/gnunet-dns-monitor.c b/src/dns/gnunet-dns-monitor.c index 2436931fb..fb5c768ac 100644 --- a/src/dns/gnunet-dns-monitor.c +++ b/src/dns/gnunet-dns-monitor.c | |||
@@ -348,17 +348,17 @@ main (int argc, char *const *argv) | |||
348 | { | 348 | { |
349 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 349 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
350 | 350 | ||
351 | GNUNET_GETOPT_OPTION_SET_ONE ('i', | 351 | GNUNET_GETOPT_option_flag ('i', |
352 | "inbound-only", | 352 | "inbound-only", |
353 | gettext_noop ("only monitor DNS queries"), | 353 | gettext_noop ("only monitor DNS queries"), |
354 | &inbound_only), | 354 | &inbound_only), |
355 | 355 | ||
356 | GNUNET_GETOPT_OPTION_SET_ONE ('o', | 356 | GNUNET_GETOPT_option_flag ('o', |
357 | "outbound-only", | 357 | "outbound-only", |
358 | gettext_noop ("only monitor DNS queries"), | 358 | gettext_noop ("only monitor DNS queries"), |
359 | &outbound_only), | 359 | &outbound_only), |
360 | 360 | ||
361 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 361 | GNUNET_GETOPT_option_verbose (&verbosity), |
362 | GNUNET_GETOPT_OPTION_END | 362 | GNUNET_GETOPT_OPTION_END |
363 | }; | 363 | }; |
364 | 364 | ||
diff --git a/src/dns/gnunet-dns-redirector.c b/src/dns/gnunet-dns-redirector.c index 0469af732..44d3d0b6c 100644 --- a/src/dns/gnunet-dns-redirector.c +++ b/src/dns/gnunet-dns-redirector.c | |||
@@ -231,19 +231,19 @@ int | |||
231 | main (int argc, char *const *argv) | 231 | main (int argc, char *const *argv) |
232 | { | 232 | { |
233 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 233 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
234 | GNUNET_GETOPT_OPTION_STRING ('4', | 234 | GNUNET_GETOPT_option_string ('4', |
235 | "ipv4", | 235 | "ipv4", |
236 | "IPV4", | 236 | "IPV4", |
237 | gettext_noop ("set A records"), | 237 | gettext_noop ("set A records"), |
238 | &n4), | 238 | &n4), |
239 | 239 | ||
240 | GNUNET_GETOPT_OPTION_STRING ('6', | 240 | GNUNET_GETOPT_option_string ('6', |
241 | "ipv4", | 241 | "ipv4", |
242 | "IPV6", | 242 | "IPV6", |
243 | gettext_noop ("set AAAA records"), | 243 | gettext_noop ("set AAAA records"), |
244 | &n6), | 244 | &n6), |
245 | 245 | ||
246 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 246 | GNUNET_GETOPT_option_verbose (&verbosity), |
247 | GNUNET_GETOPT_OPTION_END | 247 | GNUNET_GETOPT_OPTION_END |
248 | }; | 248 | }; |
249 | 249 | ||
diff --git a/src/dv/gnunet-dv.c b/src/dv/gnunet-dv.c index cb40bb6d2..d99097a15 100644 --- a/src/dv/gnunet-dv.c +++ b/src/dv/gnunet-dv.c | |||
@@ -163,7 +163,7 @@ main (int argc, char *const *argv) | |||
163 | 163 | ||
164 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 164 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
165 | 165 | ||
166 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 166 | GNUNET_GETOPT_option_verbose (&verbose), |
167 | 167 | ||
168 | GNUNET_GETOPT_OPTION_END | 168 | GNUNET_GETOPT_OPTION_END |
169 | }; | 169 | }; |
diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c index 2f980520a..0976b37e4 100644 --- a/src/fs/gnunet-auto-share.c +++ b/src/fs/gnunet-auto-share.c | |||
@@ -761,35 +761,35 @@ main (int argc, char *const *argv) | |||
761 | { | 761 | { |
762 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 762 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
763 | 763 | ||
764 | GNUNET_GETOPT_OPTION_SET_UINT ('a', | 764 | GNUNET_GETOPT_option_uint ('a', |
765 | "anonymity", | 765 | "anonymity", |
766 | "LEVEL", | 766 | "LEVEL", |
767 | gettext_noop ("set the desired LEVEL of sender-anonymity"), | 767 | gettext_noop ("set the desired LEVEL of sender-anonymity"), |
768 | &anonymity_level), | 768 | &anonymity_level), |
769 | 769 | ||
770 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 770 | GNUNET_GETOPT_option_flag ('d', |
771 | "disable-creation-time", | 771 | "disable-creation-time", |
772 | gettext_noop ("disable adding the creation time to the metadata of the uploaded file"), | 772 | gettext_noop ("disable adding the creation time to the metadata of the uploaded file"), |
773 | &do_disable_creation_time), | 773 | &do_disable_creation_time), |
774 | 774 | ||
775 | GNUNET_GETOPT_OPTION_SET_ONE ('D', | 775 | GNUNET_GETOPT_option_flag ('D', |
776 | "disable-extractor", | 776 | "disable-extractor", |
777 | gettext_noop ("do not use libextractor to add keywords or metadata"), | 777 | gettext_noop ("do not use libextractor to add keywords or metadata"), |
778 | &disable_extractor), | 778 | &disable_extractor), |
779 | 779 | ||
780 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 780 | GNUNET_GETOPT_option_uint ('p', |
781 | "priority", | 781 | "priority", |
782 | "PRIORITY", | 782 | "PRIORITY", |
783 | gettext_noop ("specify the priority of the content"), | 783 | gettext_noop ("specify the priority of the content"), |
784 | &content_priority), | 784 | &content_priority), |
785 | 785 | ||
786 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | 786 | GNUNET_GETOPT_option_uint ('r', |
787 | "replication", | 787 | "replication", |
788 | "LEVEL", | 788 | "LEVEL", |
789 | gettext_noop ("set the desired replication LEVEL"), | 789 | gettext_noop ("set the desired replication LEVEL"), |
790 | &replication_level), | 790 | &replication_level), |
791 | 791 | ||
792 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 792 | GNUNET_GETOPT_option_verbose (&verbose), |
793 | 793 | ||
794 | GNUNET_GETOPT_OPTION_END | 794 | GNUNET_GETOPT_OPTION_END |
795 | }; | 795 | }; |
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 4d6f30587..83c1eb505 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -300,46 +300,46 @@ int | |||
300 | main (int argc, char *const *argv) | 300 | main (int argc, char *const *argv) |
301 | { | 301 | { |
302 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 302 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
303 | GNUNET_GETOPT_OPTION_SET_UINT ('a', | 303 | GNUNET_GETOPT_option_uint ('a', |
304 | "anonymity", | 304 | "anonymity", |
305 | "LEVEL", | 305 | "LEVEL", |
306 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), | 306 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), |
307 | &anonymity), | 307 | &anonymity), |
308 | 308 | ||
309 | GNUNET_GETOPT_OPTION_SET_ONE ('D', | 309 | GNUNET_GETOPT_option_flag ('D', |
310 | "delete-incomplete", | 310 | "delete-incomplete", |
311 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), | 311 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), |
312 | &delete_incomplete), | 312 | &delete_incomplete), |
313 | 313 | ||
314 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 314 | GNUNET_GETOPT_option_flag ('n', |
315 | "no-network", | 315 | "no-network", |
316 | gettext_noop ("only search the local peer (no P2P network search)"), | 316 | gettext_noop ("only search the local peer (no P2P network search)"), |
317 | &local_only), | 317 | &local_only), |
318 | 318 | ||
319 | GNUNET_GETOPT_OPTION_STRING ('o', | 319 | GNUNET_GETOPT_option_string ('o', |
320 | "output", | 320 | "output", |
321 | "FILENAME", | 321 | "FILENAME", |
322 | gettext_noop ("write the file to FILENAME"), | 322 | gettext_noop ("write the file to FILENAME"), |
323 | &filename), | 323 | &filename), |
324 | 324 | ||
325 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 325 | GNUNET_GETOPT_option_uint ('p', |
326 | "parallelism", | 326 | "parallelism", |
327 | "DOWNLOADS", | 327 | "DOWNLOADS", |
328 | gettext_noop ("set the maximum number of parallel downloads that is allowed"), | 328 | gettext_noop ("set the maximum number of parallel downloads that is allowed"), |
329 | ¶llelism), | 329 | ¶llelism), |
330 | 330 | ||
331 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | 331 | GNUNET_GETOPT_option_uint ('r', |
332 | "request-parallelism", | 332 | "request-parallelism", |
333 | "REQUESTS", | 333 | "REQUESTS", |
334 | gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"), | 334 | gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"), |
335 | &request_parallelism), | 335 | &request_parallelism), |
336 | 336 | ||
337 | GNUNET_GETOPT_OPTION_SET_ONE ('R', | 337 | GNUNET_GETOPT_option_flag ('R', |
338 | "recursive", | 338 | "recursive", |
339 | gettext_noop ("download a GNUnet directory recursively"), | 339 | gettext_noop ("download a GNUnet directory recursively"), |
340 | &do_recursive), | 340 | &do_recursive), |
341 | 341 | ||
342 | GNUNET_GETOPT_OPTION_INCREMENT_VALUE ('V', | 342 | GNUNET_GETOPT_option_increment_uint ('V', |
343 | "verbose", | 343 | "verbose", |
344 | gettext_noop ("be verbose (print progress information)"), | 344 | gettext_noop ("be verbose (print progress information)"), |
345 | &verbose), | 345 | &verbose), |
diff --git a/src/fs/gnunet-fs-profiler.c b/src/fs/gnunet-fs-profiler.c index fb99d8f90..ac9f6777f 100644 --- a/src/fs/gnunet-fs-profiler.c +++ b/src/fs/gnunet-fs-profiler.c | |||
@@ -205,19 +205,19 @@ main (int argc, char *const *argv) | |||
205 | { | 205 | { |
206 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 206 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
207 | 207 | ||
208 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 208 | GNUNET_GETOPT_option_uint ('n', |
209 | "num-peers", | 209 | "num-peers", |
210 | "COUNT", | 210 | "COUNT", |
211 | gettext_noop ("run the experiment with COUNT peers"), | 211 | gettext_noop ("run the experiment with COUNT peers"), |
212 | &num_peers), | 212 | &num_peers), |
213 | 213 | ||
214 | GNUNET_GETOPT_OPTION_STRING ('H', | 214 | GNUNET_GETOPT_option_string ('H', |
215 | "hosts", | 215 | "hosts", |
216 | "HOSTFILE", | 216 | "HOSTFILE", |
217 | gettext_noop ("specifies name of a file with the HOSTS the testbed should use"), | 217 | gettext_noop ("specifies name of a file with the HOSTS the testbed should use"), |
218 | &host_filename), | 218 | &host_filename), |
219 | 219 | ||
220 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 220 | GNUNET_GETOPT_option_relative_time ('t', |
221 | "timeout", | 221 | "timeout", |
222 | "DELAY", | 222 | "DELAY", |
223 | gettext_noop ("automatically terminate experiment after DELAY"), | 223 | gettext_noop ("automatically terminate experiment after DELAY"), |
diff --git a/src/fs/gnunet-fs.c b/src/fs/gnunet-fs.c index 2b24b7124..ad8f223ff 100644 --- a/src/fs/gnunet-fs.c +++ b/src/fs/gnunet-fs.c | |||
@@ -114,12 +114,12 @@ main (int argc, char *const *argv) | |||
114 | { | 114 | { |
115 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 115 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
116 | 116 | ||
117 | GNUNET_GETOPT_OPTION_SET_ONE ('i', | 117 | GNUNET_GETOPT_option_flag ('i', |
118 | "list-indexed", | 118 | "list-indexed", |
119 | gettext_noop ("print a list of all indexed files"), | 119 | gettext_noop ("print a list of all indexed files"), |
120 | &list_indexed_files), | 120 | &list_indexed_files), |
121 | 121 | ||
122 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 122 | GNUNET_GETOPT_option_verbose (&verbose), |
123 | GNUNET_GETOPT_OPTION_END | 123 | GNUNET_GETOPT_OPTION_END |
124 | }; | 124 | }; |
125 | 125 | ||
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 2229e45e7..395aad7db 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -894,24 +894,24 @@ int | |||
894 | main (int argc, char *const *argv) | 894 | main (int argc, char *const *argv) |
895 | { | 895 | { |
896 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 896 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
897 | GNUNET_GETOPT_OPTION_SET_UINT ('a', | 897 | GNUNET_GETOPT_option_uint ('a', |
898 | "anonymity", | 898 | "anonymity", |
899 | "LEVEL", | 899 | "LEVEL", |
900 | gettext_noop ("set the desired LEVEL of sender-anonymity"), | 900 | gettext_noop ("set the desired LEVEL of sender-anonymity"), |
901 | &bo.anonymity_level), | 901 | &bo.anonymity_level), |
902 | 902 | ||
903 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 903 | GNUNET_GETOPT_option_flag ('d', |
904 | "disable-creation-time", | 904 | "disable-creation-time", |
905 | gettext_noop ("disable adding the creation time to the " | 905 | gettext_noop ("disable adding the creation time to the " |
906 | "metadata of the uploaded file"), | 906 | "metadata of the uploaded file"), |
907 | &do_disable_creation_time), | 907 | &do_disable_creation_time), |
908 | 908 | ||
909 | GNUNET_GETOPT_OPTION_SET_ONE ('D', | 909 | GNUNET_GETOPT_option_flag ('D', |
910 | "disable-extractor", | 910 | "disable-extractor", |
911 | gettext_noop ("do not use libextractor to add keywords or metadata"), | 911 | gettext_noop ("do not use libextractor to add keywords or metadata"), |
912 | &disable_extractor), | 912 | &disable_extractor), |
913 | 913 | ||
914 | GNUNET_GETOPT_OPTION_SET_ONE ('e', | 914 | GNUNET_GETOPT_option_flag ('e', |
915 | "extract", | 915 | "extract", |
916 | gettext_noop ("print list of extracted keywords that would " | 916 | gettext_noop ("print list of extracted keywords that would " |
917 | "be used, but do not perform upload"), | 917 | "be used, but do not perform upload"), |
@@ -930,60 +930,60 @@ main (int argc, char *const *argv) | |||
930 | gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), | 930 | gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), |
931 | &meta), | 931 | &meta), |
932 | 932 | ||
933 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 933 | GNUNET_GETOPT_option_flag ('n', |
934 | "noindex", | 934 | "noindex", |
935 | gettext_noop ("do not index, perform full insertion (stores " | 935 | gettext_noop ("do not index, perform full insertion (stores " |
936 | "entire file in encrypted form in GNUnet database)"), | 936 | "entire file in encrypted form in GNUnet database)"), |
937 | &do_insert), | 937 | &do_insert), |
938 | 938 | ||
939 | GNUNET_GETOPT_OPTION_STRING ('N', | 939 | GNUNET_GETOPT_option_string ('N', |
940 | "next", | 940 | "next", |
941 | "ID", | 941 | "ID", |
942 | gettext_noop ("specify ID of an updated version to be " | 942 | gettext_noop ("specify ID of an updated version to be " |
943 | "published in the future (for namespace insertions only)"), | 943 | "published in the future (for namespace insertions only)"), |
944 | &next_id), | 944 | &next_id), |
945 | 945 | ||
946 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 946 | GNUNET_GETOPT_option_uint ('p', |
947 | "priority", | 947 | "priority", |
948 | "PRIORITY", | 948 | "PRIORITY", |
949 | gettext_noop ("specify the priority of the content"), | 949 | gettext_noop ("specify the priority of the content"), |
950 | &bo.content_priority), | 950 | &bo.content_priority), |
951 | 951 | ||
952 | GNUNET_GETOPT_OPTION_STRING ('P', | 952 | GNUNET_GETOPT_option_string ('P', |
953 | "pseudonym", | 953 | "pseudonym", |
954 | "NAME", | 954 | "NAME", |
955 | gettext_noop ("publish the files under the pseudonym " | 955 | gettext_noop ("publish the files under the pseudonym " |
956 | "NAME (place file into namespace)"), | 956 | "NAME (place file into namespace)"), |
957 | &pseudonym), | 957 | &pseudonym), |
958 | 958 | ||
959 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | 959 | GNUNET_GETOPT_option_uint ('r', |
960 | "replication", | 960 | "replication", |
961 | "LEVEL", | 961 | "LEVEL", |
962 | gettext_noop ("set the desired replication LEVEL"), | 962 | gettext_noop ("set the desired replication LEVEL"), |
963 | &bo.replication_level), | 963 | &bo.replication_level), |
964 | 964 | ||
965 | 965 | ||
966 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 966 | GNUNET_GETOPT_option_flag ('s', |
967 | "simulate-only", | 967 | "simulate-only", |
968 | gettext_noop ("only simulate the process but do not do " | 968 | gettext_noop ("only simulate the process but do not do " |
969 | "any actual publishing (useful to compute URIs)"), | 969 | "any actual publishing (useful to compute URIs)"), |
970 | &do_simulate), | 970 | &do_simulate), |
971 | 971 | ||
972 | GNUNET_GETOPT_OPTION_STRING ('t', | 972 | GNUNET_GETOPT_option_string ('t', |
973 | "this", | 973 | "this", |
974 | "ID", | 974 | "ID", |
975 | gettext_noop ("set the ID of this version of the publication " | 975 | gettext_noop ("set the ID of this version of the publication " |
976 | "(for namespace insertions only)"), | 976 | "(for namespace insertions only)"), |
977 | &this_id), | 977 | &this_id), |
978 | 978 | ||
979 | GNUNET_GETOPT_OPTION_STRING ('u', | 979 | GNUNET_GETOPT_option_string ('u', |
980 | "uri", | 980 | "uri", |
981 | "URI", | 981 | "URI", |
982 | gettext_noop ("URI to be published (can be used instead of passing a " | 982 | gettext_noop ("URI to be published (can be used instead of passing a " |
983 | "file to add keywords to the file with the respective URI)"), | 983 | "file to add keywords to the file with the respective URI)"), |
984 | &uri_string), | 984 | &uri_string), |
985 | 985 | ||
986 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 986 | GNUNET_GETOPT_option_verbose (&verbose), |
987 | 987 | ||
988 | GNUNET_GETOPT_OPTION_END | 988 | GNUNET_GETOPT_OPTION_END |
989 | }; | 989 | }; |
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c index 22e790cf3..ef1743436 100644 --- a/src/fs/gnunet-search.c +++ b/src/fs/gnunet-search.c | |||
@@ -307,34 +307,34 @@ main (int argc, char *const *argv) | |||
307 | { | 307 | { |
308 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 308 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
309 | 309 | ||
310 | GNUNET_GETOPT_OPTION_SET_UINT ('a', | 310 | GNUNET_GETOPT_option_uint ('a', |
311 | "anonymity", | 311 | "anonymity", |
312 | "LEVEL", | 312 | "LEVEL", |
313 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), | 313 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), |
314 | &anonymity), | 314 | &anonymity), |
315 | 315 | ||
316 | 316 | ||
317 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 317 | GNUNET_GETOPT_option_flag ('n', |
318 | "no-network", | 318 | "no-network", |
319 | gettext_noop ("only search the local peer (no P2P network search)"), | 319 | gettext_noop ("only search the local peer (no P2P network search)"), |
320 | &local_only), | 320 | &local_only), |
321 | 321 | ||
322 | GNUNET_GETOPT_OPTION_STRING ('o', | 322 | GNUNET_GETOPT_option_string ('o', |
323 | "output", | 323 | "output", |
324 | "PREFIX", | 324 | "PREFIX", |
325 | gettext_noop ("write search results to file starting with PREFIX"), | 325 | gettext_noop ("write search results to file starting with PREFIX"), |
326 | &output_filename), | 326 | &output_filename), |
327 | 327 | ||
328 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 328 | GNUNET_GETOPT_option_relative_time ('t', |
329 | "timeout", | 329 | "timeout", |
330 | "DELAY", | 330 | "DELAY", |
331 | gettext_noop ("automatically terminate search after DELAY"), | 331 | gettext_noop ("automatically terminate search after DELAY"), |
332 | &timeout), | 332 | &timeout), |
333 | 333 | ||
334 | 334 | ||
335 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 335 | GNUNET_GETOPT_option_verbose (&verbose), |
336 | 336 | ||
337 | GNUNET_GETOPT_OPTION_SET_UINT ('N', | 337 | GNUNET_GETOPT_option_uint ('N', |
338 | "results", | 338 | "results", |
339 | "VALUE", | 339 | "VALUE", |
340 | gettext_noop ("automatically terminate search " | 340 | gettext_noop ("automatically terminate search " |
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c index c53a85fb4..213d2b332 100644 --- a/src/fs/gnunet-unindex.c +++ b/src/fs/gnunet-unindex.c | |||
@@ -164,7 +164,7 @@ main (int argc, char *const *argv) | |||
164 | { | 164 | { |
165 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 165 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
166 | 166 | ||
167 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 167 | GNUNET_GETOPT_option_verbose (&verbose), |
168 | 168 | ||
169 | GNUNET_GETOPT_OPTION_END | 169 | GNUNET_GETOPT_OPTION_END |
170 | }; | 170 | }; |
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index fb7ac10c1..0746d5c57 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c | |||
@@ -516,7 +516,7 @@ main (int argc, char *const *argv) | |||
516 | { | 516 | { |
517 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 517 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
518 | 518 | ||
519 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 519 | GNUNET_GETOPT_option_uint ('p', |
520 | "port", | 520 | "port", |
521 | "PORT", | 521 | "PORT", |
522 | gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), | 522 | gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), |
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index c9b4bde9c..424677d14 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -778,31 +778,31 @@ main (int argc, | |||
778 | { | 778 | { |
779 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 779 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
780 | 780 | ||
781 | GNUNET_GETOPT_OPTION_STRING ('d', | 781 | GNUNET_GETOPT_option_string ('d', |
782 | "dns", | 782 | "dns", |
783 | "IP", | 783 | "IP", |
784 | gettext_noop ("IP of recursive DNS resolver to use (required)"), | 784 | gettext_noop ("IP of recursive DNS resolver to use (required)"), |
785 | &dns_ip), | 785 | &dns_ip), |
786 | 786 | ||
787 | GNUNET_GETOPT_OPTION_STRING ('f', | 787 | GNUNET_GETOPT_option_string ('f', |
788 | "fcfs", | 788 | "fcfs", |
789 | "NAME", | 789 | "NAME", |
790 | gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"), | 790 | gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"), |
791 | &fcfs_suffix), | 791 | &fcfs_suffix), |
792 | 792 | ||
793 | GNUNET_GETOPT_OPTION_STRING ('s', | 793 | GNUNET_GETOPT_option_string ('s', |
794 | "suffix", | 794 | "suffix", |
795 | "SUFFIX", | 795 | "SUFFIX", |
796 | gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"), | 796 | gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"), |
797 | &dns_suffix), | 797 | &dns_suffix), |
798 | 798 | ||
799 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 799 | GNUNET_GETOPT_option_uint ('p', |
800 | "port", | 800 | "port", |
801 | "UDPPORT", | 801 | "UDPPORT", |
802 | gettext_noop ("UDP port to listen on for inbound DNS requests; default: 2853"), | 802 | gettext_noop ("UDP port to listen on for inbound DNS requests; default: 2853"), |
803 | &listen_port), | 803 | &listen_port), |
804 | 804 | ||
805 | GNUNET_GETOPT_OPTION_STRING ('z', | 805 | GNUNET_GETOPT_option_string ('z', |
806 | "zone", | 806 | "zone", |
807 | "PUBLICKEY", | 807 | "PUBLICKEY", |
808 | gettext_noop ("Public key of the GNS zone to use (overrides default)"), | 808 | gettext_noop ("Public key of the GNS zone to use (overrides default)"), |
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 35f42cdec..2a6de1c30 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -3263,13 +3263,13 @@ main (int argc, char *const *argv) | |||
3263 | { | 3263 | { |
3264 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 3264 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
3265 | 3265 | ||
3266 | GNUNET_GETOPT_OPTION_SET_ULONG ('p', | 3266 | GNUNET_GETOPT_option_ulong ('p', |
3267 | "port", | 3267 | "port", |
3268 | NULL, | 3268 | NULL, |
3269 | gettext_noop ("listen on specified port (default: 7777)"), | 3269 | gettext_noop ("listen on specified port (default: 7777)"), |
3270 | &port), | 3270 | &port), |
3271 | 3271 | ||
3272 | GNUNET_GETOPT_OPTION_STRING ('a', | 3272 | GNUNET_GETOPT_option_string ('a', |
3273 | "authority", | 3273 | "authority", |
3274 | NULL, | 3274 | NULL, |
3275 | gettext_noop ("pem file to use as CA"), | 3275 | gettext_noop ("pem file to use as CA"), |
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index c85ddfe81..c0de0f30c 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -422,36 +422,36 @@ main (int argc, | |||
422 | { | 422 | { |
423 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 423 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
424 | 424 | ||
425 | GNUNET_GETOPT_OPTION_STRING ('u', | 425 | GNUNET_GETOPT_option_string ('u', |
426 | "lookup", | 426 | "lookup", |
427 | "NAME", | 427 | "NAME", |
428 | gettext_noop ("Lookup a record for the given name"), | 428 | gettext_noop ("Lookup a record for the given name"), |
429 | &lookup_name), | 429 | &lookup_name), |
430 | 430 | ||
431 | GNUNET_GETOPT_OPTION_STRING ('t', | 431 | GNUNET_GETOPT_option_string ('t', |
432 | "type", | 432 | "type", |
433 | "TYPE", | 433 | "TYPE", |
434 | gettext_noop ("Specify the type of the record to lookup"), | 434 | gettext_noop ("Specify the type of the record to lookup"), |
435 | &lookup_type), | 435 | &lookup_type), |
436 | 436 | ||
437 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T', | 437 | GNUNET_GETOPT_option_relative_time ('T', |
438 | "timeout", | 438 | "timeout", |
439 | "DELAY", | 439 | "DELAY", |
440 | gettext_noop ("Specify timeout for the lookup"), | 440 | gettext_noop ("Specify timeout for the lookup"), |
441 | &timeout), | 441 | &timeout), |
442 | 442 | ||
443 | GNUNET_GETOPT_OPTION_SET_ONE ('r', | 443 | GNUNET_GETOPT_option_flag ('r', |
444 | "raw", | 444 | "raw", |
445 | gettext_noop ("No unneeded output"), | 445 | gettext_noop ("No unneeded output"), |
446 | &raw), | 446 | &raw), |
447 | 447 | ||
448 | GNUNET_GETOPT_OPTION_STRING ('p', | 448 | GNUNET_GETOPT_option_string ('p', |
449 | "public-key", | 449 | "public-key", |
450 | "PKEY", | 450 | "PKEY", |
451 | gettext_noop ("Specify the public key of the zone to lookup the record in"), | 451 | gettext_noop ("Specify the public key of the zone to lookup the record in"), |
452 | &public_key), | 452 | &public_key), |
453 | 453 | ||
454 | GNUNET_GETOPT_OPTION_STRING ('z', | 454 | GNUNET_GETOPT_option_string ('z', |
455 | "zone", | 455 | "zone", |
456 | "NAME", | 456 | "NAME", |
457 | gettext_noop ("Specify the name of the ego of the zone to lookup the record in"), | 457 | gettext_noop ("Specify the name of the ego of the zone to lookup the record in"), |
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 5d4734d9a..b7775e4ea 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -529,6 +529,7 @@ get_gns_cont (struct GNUNET_REST_RequestHandle *conndata_handle, | |||
529 | { | 529 | { |
530 | handle->pkey_str = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, | 530 | handle->pkey_str = GNUNET_CONTAINER_multihashmap_get (conndata_handle->url_param_map, |
531 | &key); | 531 | &key); |
532 | GNUNET_assert (NULL != handle->pkey_str); | ||
532 | if (GNUNET_OK != | 533 | if (GNUNET_OK != |
533 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->pkey_str, | 534 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->pkey_str, |
534 | strlen(handle->pkey_str), | 535 | strlen(handle->pkey_str), |
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index 9b4790c32..854340d3d 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -371,21 +371,21 @@ main (int argc, char *const *argv) | |||
371 | { | 371 | { |
372 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 372 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
373 | #if HAVE_MHD | 373 | #if HAVE_MHD |
374 | GNUNET_GETOPT_OPTION_SET_ONE ('a', | 374 | GNUNET_GETOPT_option_flag ('a', |
375 | "advertise", | 375 | "advertise", |
376 | gettext_noop ("advertise our hostlist to other peers"), | 376 | gettext_noop ("advertise our hostlist to other peers"), |
377 | &advertising), | 377 | &advertising), |
378 | #endif | 378 | #endif |
379 | GNUNET_GETOPT_OPTION_SET_ONE ('b', | 379 | GNUNET_GETOPT_option_flag ('b', |
380 | "bootstrap", | 380 | "bootstrap", |
381 | gettext_noop ("bootstrap using hostlists (it is highly recommended that you always use this option)"), | 381 | gettext_noop ("bootstrap using hostlists (it is highly recommended that you always use this option)"), |
382 | &bootstrapping), | 382 | &bootstrapping), |
383 | GNUNET_GETOPT_OPTION_SET_ONE ('e', | 383 | GNUNET_GETOPT_option_flag ('e', |
384 | "enable-learning", | 384 | "enable-learning", |
385 | gettext_noop ("enable learning about hostlist servers from other peers"), | 385 | gettext_noop ("enable learning about hostlist servers from other peers"), |
386 | &learning), | 386 | &learning), |
387 | #if HAVE_MHD | 387 | #if HAVE_MHD |
388 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 388 | GNUNET_GETOPT_option_flag ('p', |
389 | "provide-hostlist", | 389 | "provide-hostlist", |
390 | gettext_noop ("provide a hostlist server"), | 390 | gettext_noop ("provide a hostlist server"), |
391 | &provide_hostlist), | 391 | &provide_hostlist), |
diff --git a/src/identity-provider/gnunet-identity-token.c b/src/identity-provider/gnunet-identity-token.c index 906899ea7..30b63bfc4 100644 --- a/src/identity-provider/gnunet-identity-token.c +++ b/src/identity-provider/gnunet-identity-token.c | |||
@@ -160,13 +160,13 @@ main(int argc, char *const argv[]) | |||
160 | { | 160 | { |
161 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 161 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
162 | 162 | ||
163 | GNUNET_GETOPT_OPTION_STRING ('t', | 163 | GNUNET_GETOPT_option_string ('t', |
164 | "token", | 164 | "token", |
165 | NULL, | 165 | NULL, |
166 | gettext_noop ("GNUid token"), | 166 | gettext_noop ("GNUid token"), |
167 | &token), | 167 | &token), |
168 | 168 | ||
169 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 169 | GNUNET_GETOPT_option_flag ('p', |
170 | "print", | 170 | "print", |
171 | gettext_noop ("Print token contents"), | 171 | gettext_noop ("Print token contents"), |
172 | &print_token), | 172 | &print_token), |
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 17c288368..53fd02c9f 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -442,6 +442,7 @@ handle_token_update (void *cls) | |||
442 | { | 442 | { |
443 | cur_value = GNUNET_CONTAINER_multihashmap_get (ego_entry->attr_map, | 443 | cur_value = GNUNET_CONTAINER_multihashmap_get (ego_entry->attr_map, |
444 | &key_hash); | 444 | &key_hash); |
445 | GNUNET_assert (NULL != cur_value); | ||
445 | GNUNET_CONTAINER_DLL_insert (new_token->attr_head, | 446 | GNUNET_CONTAINER_DLL_insert (new_token->attr_head, |
446 | new_token->attr_tail, | 447 | new_token->attr_tail, |
447 | cur_value); | 448 | cur_value); |
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c index e03f502ad..907b28ba9 100644 --- a/src/identity-provider/plugin_rest_identity_provider.c +++ b/src/identity-provider/plugin_rest_identity_provider.c | |||
@@ -580,6 +580,7 @@ issue_token_cont (struct GNUNET_REST_RequestHandle *con, | |||
580 | } | 580 | } |
581 | nonce_str = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map, | 581 | nonce_str = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map, |
582 | &key); | 582 | &key); |
583 | GNUNET_assert (NULL != nonce_str); | ||
583 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 584 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
584 | "Request nonce: %s\n", | 585 | "Request nonce: %s\n", |
585 | nonce_str); | 586 | nonce_str); |
@@ -794,6 +795,7 @@ list_token_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
794 | } | 795 | } |
795 | ego_val = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map, | 796 | ego_val = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map, |
796 | &key); | 797 | &key); |
798 | GNUNET_assert (NULL != ego_val); | ||
797 | //Remove non-matching egos | 799 | //Remove non-matching egos |
798 | for (ego_entry = handle->ego_head; | 800 | for (ego_entry = handle->ego_head; |
799 | NULL != ego_entry;) | 801 | NULL != ego_entry;) |
@@ -866,6 +868,7 @@ exchange_cont (void *cls, | |||
866 | } | 868 | } |
867 | nonce_str = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map, | 869 | nonce_str = GNUNET_CONTAINER_multihashmap_get (handle->conndata_handle->url_param_map, |
868 | &key); | 870 | &key); |
871 | GNUNET_assert (NULL != nonce_str); | ||
869 | GNUNET_assert (1 == sscanf (nonce_str, "%"SCNu64, &expected_nonce)); | 872 | GNUNET_assert (1 == sscanf (nonce_str, "%"SCNu64, &expected_nonce)); |
870 | 873 | ||
871 | if (ticket_nonce != expected_nonce) | 874 | if (ticket_nonce != expected_nonce) |
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index 5c457ef5d..9b66a1bc7 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c | |||
@@ -350,35 +350,35 @@ int | |||
350 | main (int argc, char *const *argv) | 350 | main (int argc, char *const *argv) |
351 | { | 351 | { |
352 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 352 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
353 | GNUNET_GETOPT_OPTION_STRING ('C', | 353 | GNUNET_GETOPT_option_string ('C', |
354 | "create", | 354 | "create", |
355 | "NAME", | 355 | "NAME", |
356 | gettext_noop ("create ego NAME"), | 356 | gettext_noop ("create ego NAME"), |
357 | &create_ego), | 357 | &create_ego), |
358 | 358 | ||
359 | GNUNET_GETOPT_OPTION_STRING ('D', | 359 | GNUNET_GETOPT_option_string ('D', |
360 | "delete", | 360 | "delete", |
361 | "NAME", | 361 | "NAME", |
362 | gettext_noop ("delete ego NAME "), | 362 | gettext_noop ("delete ego NAME "), |
363 | &delete_ego), | 363 | &delete_ego), |
364 | 364 | ||
365 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 365 | GNUNET_GETOPT_option_flag ('d', |
366 | "display", | 366 | "display", |
367 | gettext_noop ("display all egos"), | 367 | gettext_noop ("display all egos"), |
368 | &list), | 368 | &list), |
369 | 369 | ||
370 | GNUNET_GETOPT_OPTION_STRING ('e', | 370 | GNUNET_GETOPT_option_string ('e', |
371 | "ego", | 371 | "ego", |
372 | "NAME", | 372 | "NAME", |
373 | gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -s)"), | 373 | gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -s)"), |
374 | &set_ego), | 374 | &set_ego), |
375 | 375 | ||
376 | GNUNET_GETOPT_OPTION_SET_ONE ('m', | 376 | GNUNET_GETOPT_option_flag ('m', |
377 | "monitor", | 377 | "monitor", |
378 | gettext_noop ("run in monitor mode egos"), | 378 | gettext_noop ("run in monitor mode egos"), |
379 | &monitor), | 379 | &monitor), |
380 | 380 | ||
381 | GNUNET_GETOPT_OPTION_STRING ('s', | 381 | GNUNET_GETOPT_option_string ('s', |
382 | "set", | 382 | "set", |
383 | "SUBSYSTEM", | 383 | "SUBSYSTEM", |
384 | gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"), | 384 | gettext_noop ("set default identity to EGO for a subsystem SUBSYSTEM (use together with -e)"), |
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h index c2bd72340..f707bb091 100644 --- a/src/include/gnunet_getopt_lib.h +++ b/src/include/gnunet_getopt_lib.h | |||
@@ -161,7 +161,7 @@ struct GNUNET_GETOPT_CommandLineOption | |||
161 | * @param about string with brief description of the application | 161 | * @param about string with brief description of the application |
162 | */ | 162 | */ |
163 | struct GNUNET_GETOPT_CommandLineOption | 163 | struct GNUNET_GETOPT_CommandLineOption |
164 | GNUNET_GETOPT_OPTION_HELP (const char *about); | 164 | GNUNET_GETOPT_option_help (const char *about); |
165 | 165 | ||
166 | 166 | ||
167 | /** | 167 | /** |
@@ -171,7 +171,7 @@ GNUNET_GETOPT_OPTION_HELP (const char *about); | |||
171 | * @param version string with the version number | 171 | * @param version string with the version number |
172 | */ | 172 | */ |
173 | struct GNUNET_GETOPT_CommandLineOption | 173 | struct GNUNET_GETOPT_CommandLineOption |
174 | GNUNET_GETOPT_OPTION_VERSION (const char *version); | 174 | GNUNET_GETOPT_option_version (const char *version); |
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
@@ -181,7 +181,7 @@ GNUNET_GETOPT_OPTION_VERSION (const char *version); | |||
181 | * @param[out] logfn set to the name of the logfile | 181 | * @param[out] logfn set to the name of the logfile |
182 | */ | 182 | */ |
183 | struct GNUNET_GETOPT_CommandLineOption | 183 | struct GNUNET_GETOPT_CommandLineOption |
184 | GNUNET_GETOPT_OPTION_LOGFILE (char **logfn); | 184 | GNUNET_GETOPT_option_logfile (char **logfn); |
185 | 185 | ||
186 | 186 | ||
187 | /** | 187 | /** |
@@ -194,7 +194,7 @@ GNUNET_GETOPT_OPTION_LOGFILE (char **logfn); | |||
194 | * @param[out] str set to the string | 194 | * @param[out] str set to the string |
195 | */ | 195 | */ |
196 | struct GNUNET_GETOPT_CommandLineOption | 196 | struct GNUNET_GETOPT_CommandLineOption |
197 | GNUNET_GETOPT_OPTION_STRING (char shortName, | 197 | GNUNET_GETOPT_option_string (char shortName, |
198 | const char *name, | 198 | const char *name, |
199 | const char *argumentHelp, | 199 | const char *argumentHelp, |
200 | const char *description, | 200 | const char *description, |
@@ -210,7 +210,7 @@ GNUNET_GETOPT_OPTION_STRING (char shortName, | |||
210 | * @param[out] str set to the string | 210 | * @param[out] str set to the string |
211 | */ | 211 | */ |
212 | struct GNUNET_GETOPT_CommandLineOption | 212 | struct GNUNET_GETOPT_CommandLineOption |
213 | GNUNET_GETOPT_OPTION_FILENAME (char shortName, | 213 | GNUNET_GETOPT_option_filename (char shortName, |
214 | const char *name, | 214 | const char *name, |
215 | const char *argumentHelp, | 215 | const char *argumentHelp, |
216 | const char *description, | 216 | const char *description, |
@@ -229,7 +229,7 @@ GNUNET_GETOPT_OPTION_FILENAME (char shortName, | |||
229 | * @param val_size size of @a val in bytes | 229 | * @param val_size size of @a val in bytes |
230 | */ | 230 | */ |
231 | struct GNUNET_GETOPT_CommandLineOption | 231 | struct GNUNET_GETOPT_CommandLineOption |
232 | GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, | 232 | GNUNET_GETOPT_option_base32_fixed_size (char shortName, |
233 | const char *name, | 233 | const char *name, |
234 | const char *argumentHelp, | 234 | const char *argumentHelp, |
235 | const char *description, | 235 | const char *description, |
@@ -249,8 +249,8 @@ GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, | |||
249 | * @param[out] val binary value decoded from Crockford Base32-encoded argument; | 249 | * @param[out] val binary value decoded from Crockford Base32-encoded argument; |
250 | * size is determined by type (sizeof (*val)). | 250 | * size is determined by type (sizeof (*val)). |
251 | */ | 251 | */ |
252 | #define GNUNET_GETOPT_OPTION_SET_BASE32_AUTO(shortName,name,argumentHelp,description,val) \ | 252 | #define GNUNET_GETOPT_option_base32_auto(shortName,name,argumentHelp,description,val) \ |
253 | GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE(shortName,name,argumentHelp,description,val,sizeof(*val)) | 253 | GNUNET_GETOPT_option_base32_fixed_size(shortName,name,argumentHelp,description,val,sizeof(*val)) |
254 | 254 | ||
255 | 255 | ||
256 | /** | 256 | /** |
@@ -263,7 +263,7 @@ GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, | |||
263 | * @param[out] val set to 1 if the option is present | 263 | * @param[out] val set to 1 if the option is present |
264 | */ | 264 | */ |
265 | struct GNUNET_GETOPT_CommandLineOption | 265 | struct GNUNET_GETOPT_CommandLineOption |
266 | GNUNET_GETOPT_OPTION_SET_ONE (char shortName, | 266 | GNUNET_GETOPT_option_flag (char shortName, |
267 | const char *name, | 267 | const char *name, |
268 | const char *description, | 268 | const char *description, |
269 | int *val); | 269 | int *val); |
@@ -279,7 +279,7 @@ GNUNET_GETOPT_OPTION_SET_ONE (char shortName, | |||
279 | * @param[out] val set to the value specified at the command line | 279 | * @param[out] val set to the value specified at the command line |
280 | */ | 280 | */ |
281 | struct GNUNET_GETOPT_CommandLineOption | 281 | struct GNUNET_GETOPT_CommandLineOption |
282 | GNUNET_GETOPT_OPTION_SET_UINT (char shortName, | 282 | GNUNET_GETOPT_option_uint (char shortName, |
283 | const char *name, | 283 | const char *name, |
284 | const char *argumentHelp, | 284 | const char *argumentHelp, |
285 | const char *description, | 285 | const char *description, |
@@ -296,7 +296,7 @@ GNUNET_GETOPT_OPTION_SET_UINT (char shortName, | |||
296 | * @param[out] val set to the value specified at the command line | 296 | * @param[out] val set to the value specified at the command line |
297 | */ | 297 | */ |
298 | struct GNUNET_GETOPT_CommandLineOption | 298 | struct GNUNET_GETOPT_CommandLineOption |
299 | GNUNET_GETOPT_OPTION_SET_ULONG (char shortName, | 299 | GNUNET_GETOPT_option_ulong (char shortName, |
300 | const char *name, | 300 | const char *name, |
301 | const char *argumentHelp, | 301 | const char *argumentHelp, |
302 | const char *description, | 302 | const char *description, |
@@ -314,7 +314,7 @@ GNUNET_GETOPT_OPTION_SET_ULONG (char shortName, | |||
314 | * @param[out] val set to the time specified at the command line | 314 | * @param[out] val set to the time specified at the command line |
315 | */ | 315 | */ |
316 | struct GNUNET_GETOPT_CommandLineOption | 316 | struct GNUNET_GETOPT_CommandLineOption |
317 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME (char shortName, | 317 | GNUNET_GETOPT_option_relative_time (char shortName, |
318 | const char *name, | 318 | const char *name, |
319 | const char *argumentHelp, | 319 | const char *argumentHelp, |
320 | const char *description, | 320 | const char *description, |
@@ -332,7 +332,7 @@ GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME (char shortName, | |||
332 | * @param[out] val set to the time specified at the command line | 332 | * @param[out] val set to the time specified at the command line |
333 | */ | 333 | */ |
334 | struct GNUNET_GETOPT_CommandLineOption | 334 | struct GNUNET_GETOPT_CommandLineOption |
335 | GNUNET_GETOPT_OPTION_SET_ABSOLUTE_TIME (char shortName, | 335 | GNUNET_GETOPT_option_absolute_time (char shortName, |
336 | const char *name, | 336 | const char *name, |
337 | const char *argumentHelp, | 337 | const char *argumentHelp, |
338 | const char *description, | 338 | const char *description, |
@@ -349,7 +349,7 @@ GNUNET_GETOPT_OPTION_SET_ABSOLUTE_TIME (char shortName, | |||
349 | * @param[out] val set to 1 if the option is present | 349 | * @param[out] val set to 1 if the option is present |
350 | */ | 350 | */ |
351 | struct GNUNET_GETOPT_CommandLineOption | 351 | struct GNUNET_GETOPT_CommandLineOption |
352 | GNUNET_GETOPT_OPTION_INCREMENT_VALUE (char shortName, | 352 | GNUNET_GETOPT_option_increment_uint (char shortName, |
353 | const char *name, | 353 | const char *name, |
354 | const char *description, | 354 | const char *description, |
355 | unsigned int *val); | 355 | unsigned int *val); |
@@ -362,7 +362,7 @@ GNUNET_GETOPT_OPTION_INCREMENT_VALUE (char shortName, | |||
362 | * @param[out] level set to the log level | 362 | * @param[out] level set to the log level |
363 | */ | 363 | */ |
364 | struct GNUNET_GETOPT_CommandLineOption | 364 | struct GNUNET_GETOPT_CommandLineOption |
365 | GNUNET_GETOPT_OPTION_LOGLEVEL (char **level); | 365 | GNUNET_GETOPT_option_loglevel (char **level); |
366 | 366 | ||
367 | 367 | ||
368 | /** | 368 | /** |
@@ -372,7 +372,7 @@ GNUNET_GETOPT_OPTION_LOGLEVEL (char **level); | |||
372 | * @param[out] level set to the verbosity level | 372 | * @param[out] level set to the verbosity level |
373 | */ | 373 | */ |
374 | struct GNUNET_GETOPT_CommandLineOption | 374 | struct GNUNET_GETOPT_CommandLineOption |
375 | GNUNET_GETOPT_OPTION_VERBOSE (unsigned int *level); | 375 | GNUNET_GETOPT_option_verbose (unsigned int *level); |
376 | 376 | ||
377 | 377 | ||
378 | /** | 378 | /** |
@@ -381,7 +381,7 @@ GNUNET_GETOPT_OPTION_VERBOSE (unsigned int *level); | |||
381 | * @param[out] logfn set to the name of the logfile | 381 | * @param[out] logfn set to the name of the logfile |
382 | */ | 382 | */ |
383 | struct GNUNET_GETOPT_CommandLineOption | 383 | struct GNUNET_GETOPT_CommandLineOption |
384 | GNUNET_GETOPT_OPTION_LOGFILE (char **logfn); | 384 | GNUNET_GETOPT_option_logfile (char **logfn); |
385 | 385 | ||
386 | 386 | ||
387 | /** | 387 | /** |
@@ -390,7 +390,7 @@ GNUNET_GETOPT_OPTION_LOGFILE (char **logfn); | |||
390 | * @param[out] fn set to the name of the configuration file | 390 | * @param[out] fn set to the name of the configuration file |
391 | */ | 391 | */ |
392 | struct GNUNET_GETOPT_CommandLineOption | 392 | struct GNUNET_GETOPT_CommandLineOption |
393 | GNUNET_GETOPT_OPTION_CFG_FILE (char **fn); | 393 | GNUNET_GETOPT_option_cfgfile (char **fn); |
394 | 394 | ||
395 | 395 | ||
396 | /** | 396 | /** |
@@ -400,7 +400,7 @@ GNUNET_GETOPT_OPTION_CFG_FILE (char **fn); | |||
400 | * @return @a opt with the mandatory flag set. | 400 | * @return @a opt with the mandatory flag set. |
401 | */ | 401 | */ |
402 | struct GNUNET_GETOPT_CommandLineOption | 402 | struct GNUNET_GETOPT_CommandLineOption |
403 | GNUNET_GETOPT_OPTION_MANDATORY (struct GNUNET_GETOPT_CommandLineOption opt); | 403 | GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt); |
404 | 404 | ||
405 | 405 | ||
406 | /** | 406 | /** |
diff --git a/src/include/gnunet_network_lib.h b/src/include/gnunet_network_lib.h index beca83807..d9d3d90e7 100644 --- a/src/include/gnunet_network_lib.h +++ b/src/include/gnunet_network_lib.h | |||
@@ -588,6 +588,18 @@ void | |||
588 | GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds); | 588 | GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds); |
589 | 589 | ||
590 | 590 | ||
591 | /** | ||
592 | * Test if the given @a port is available. | ||
593 | * | ||
594 | * @param ipproto transport protocol to test (i.e. IPPROTO_TCP) | ||
595 | * @param port port number to test | ||
596 | * @return #GNUNET_OK if the port is available, #GNUNET_NO if not | ||
597 | */ | ||
598 | int | ||
599 | GNUNET_NETWORK_test_port_free (int ipproto, | ||
600 | uint16_t port); | ||
601 | |||
602 | |||
591 | #if 0 /* keep Emacsens' auto-indent happy */ | 603 | #if 0 /* keep Emacsens' auto-indent happy */ |
592 | { | 604 | { |
593 | #endif | 605 | #endif |
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 2be1858ce..a7385e31c 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -97,6 +97,84 @@ enum GNUNET_SCHEDULER_Reason | |||
97 | 97 | ||
98 | 98 | ||
99 | /** | 99 | /** |
100 | * Possible events on FDs, used as a bitmask. | ||
101 | * Modelled after GPollFD. | ||
102 | */ | ||
103 | enum GNUNET_SCHEDULER_EventType | ||
104 | { | ||
105 | |||
106 | /** | ||
107 | * No event (useful for timeout). | ||
108 | */ | ||
109 | GNUNET_SCHEDULER_ET_NONE = 0, | ||
110 | |||
111 | /** | ||
112 | * Data available for reading. | ||
113 | */ | ||
114 | GNUNET_SCHEDULER_ET_IN = 1, | ||
115 | |||
116 | /** | ||
117 | * Buffer available for writing. | ||
118 | */ | ||
119 | GNUNET_SCHEDULER_ET_OUT = 2, | ||
120 | |||
121 | /** | ||
122 | * | ||
123 | */ | ||
124 | GNUNET_SCHEDULER_ET_HUP = 4, | ||
125 | |||
126 | /** | ||
127 | * | ||
128 | */ | ||
129 | GNUNET_SCHEDULER_ET_ERR = 8, | ||
130 | |||
131 | /** | ||
132 | * | ||
133 | */ | ||
134 | GNUNET_SCHEDULER_ET_PRI = 16, | ||
135 | |||
136 | /** | ||
137 | * | ||
138 | */ | ||
139 | GNUNET_SCHEDULER_ET_NVAL = 32 | ||
140 | |||
141 | }; | ||
142 | |||
143 | |||
144 | /** | ||
145 | * Information about an event relating to a file descriptor/socket. | ||
146 | */ | ||
147 | struct GNUNET_SCHEDULER_FdInfo | ||
148 | { | ||
149 | |||
150 | /** | ||
151 | * GNUnet network socket the event is about, matches @a sock, | ||
152 | * NULL if this is about a file handle or if no network | ||
153 | * handle was given to the scheduler originally. | ||
154 | */ | ||
155 | struct GNUNET_NETWORK_Handle *fd; | ||
156 | |||
157 | /** | ||
158 | * GNUnet file handle the event is about, matches @a sock, | ||
159 | * NULL if this is about a network socket or if no network | ||
160 | * handle was given to the scheduler originally. | ||
161 | */ | ||
162 | struct GNUNET_DISK_FileHandle *fh; | ||
163 | |||
164 | /** | ||
165 | * Type of the event that was generated related to @e sock. | ||
166 | */ | ||
167 | enum GNUNET_SCHEDULER_EventType et; | ||
168 | |||
169 | /** | ||
170 | * Underlying OS handle the event was about. | ||
171 | */ | ||
172 | int sock; | ||
173 | |||
174 | }; | ||
175 | |||
176 | |||
177 | /** | ||
100 | * Context information passed to each scheduler task. | 178 | * Context information passed to each scheduler task. |
101 | */ | 179 | */ |
102 | struct GNUNET_SCHEDULER_TaskContext | 180 | struct GNUNET_SCHEDULER_TaskContext |
@@ -107,16 +185,29 @@ struct GNUNET_SCHEDULER_TaskContext | |||
107 | enum GNUNET_SCHEDULER_Reason reason; | 185 | enum GNUNET_SCHEDULER_Reason reason; |
108 | 186 | ||
109 | /** | 187 | /** |
110 | * Set of file descriptors ready for reading; | 188 | * Length of the following array. |
111 | * note that additional bits may be set | 189 | */ |
112 | * that were not in the original request | 190 | unsigned int fds_len; |
191 | |||
192 | /** | ||
193 | * Array of length @e fds_len with information about ready FDs. | ||
194 | * Note that we use the same format regardless of the internal | ||
195 | * event loop that was used. The given array should only contain | ||
196 | * information about file descriptors relevant to the current task. | ||
197 | */ | ||
198 | const struct GNUNET_SCHEDULER_FdInfo *fds; | ||
199 | |||
200 | /** | ||
201 | * Set of file descriptors ready for reading; note that additional | ||
202 | * bits may be set that were not in the original request. | ||
203 | * @deprecated | ||
113 | */ | 204 | */ |
114 | const struct GNUNET_NETWORK_FDSet *read_ready; | 205 | const struct GNUNET_NETWORK_FDSet *read_ready; |
115 | 206 | ||
116 | /** | 207 | /** |
117 | * Set of file descriptors ready for writing; | 208 | * Set of file descriptors ready for writing; note that additional |
118 | * note that additional bits may be set | 209 | * bits may be set that were not in the original request. |
119 | * that were not in the original request. | 210 | * @deprecated |
120 | */ | 211 | */ |
121 | const struct GNUNET_NETWORK_FDSet *write_ready; | 212 | const struct GNUNET_NETWORK_FDSet *write_ready; |
122 | 213 | ||
@@ -124,16 +215,155 @@ struct GNUNET_SCHEDULER_TaskContext | |||
124 | 215 | ||
125 | 216 | ||
126 | /** | 217 | /** |
218 | * Function used by event-loop implementations to signal the scheduler | ||
219 | * that a particular @a task is ready due to an event of type @a et. | ||
220 | * | ||
221 | * This function will then queue the task to notify the application | ||
222 | * that the task is ready (with the respective priority). | ||
223 | * | ||
224 | * @param task the task that is ready | ||
225 | * @param et information about why the task is ready | ||
226 | */ | ||
227 | void | ||
228 | GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task, | ||
229 | enum GNUNET_SCHEDULER_EventType et); | ||
230 | |||
231 | |||
232 | /** | ||
233 | * Handle to the scheduler's state to be used by the driver. | ||
234 | */ | ||
235 | struct GNUNET_SCHEDULER_Handle; | ||
236 | |||
237 | |||
238 | /** | ||
239 | * Function called by the driver to tell the scheduler to run some of | ||
240 | * the tasks that are ready. This function may return even though | ||
241 | * there are tasks left to run just to give other tasks a chance as | ||
242 | * well. If we return #GNUNET_YES, the driver should call this | ||
243 | * function again as soon as possible, while if we return #GNUNET_NO | ||
244 | * it must block until the operating system has more work as the | ||
245 | * scheduler has no more work to do right now. | ||
246 | * | ||
247 | * @param sh scheduler handle that was given to the `loop` | ||
248 | * @return #GNUNET_OK if there are more tasks that are ready, | ||
249 | * and thus we would like to run more (yield to avoid | ||
250 | * blocking other activities for too long) | ||
251 | * #GNUNET_NO if we are done running tasks (yield to block) | ||
252 | * #GNUNET_SYSERR on error | ||
253 | */ | ||
254 | int | ||
255 | GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh); | ||
256 | |||
257 | |||
258 | /** | ||
259 | * API a driver has to implement for | ||
260 | * #GNUNET_SCHEDULER_run_with_driver(). | ||
261 | */ | ||
262 | struct GNUNET_SCHEDULER_Driver | ||
263 | { | ||
264 | |||
265 | /** | ||
266 | * Closure to pass to the functions in this struct. | ||
267 | */ | ||
268 | void *cls; | ||
269 | |||
270 | /** | ||
271 | * Add a @a task to be run if the conditions given | ||
272 | * in @a fdi are satisfied. | ||
273 | * | ||
274 | * @param cls closure | ||
275 | * @param task task to add | ||
276 | * @param fdi conditions to watch for | ||
277 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
278 | * (i.e. @a fdi too high or invalid) | ||
279 | */ | ||
280 | int | ||
281 | (*add)(void *cls, | ||
282 | struct GNUNET_SCHEDULER_Task *task, | ||
283 | struct GNUNET_SCHEDULER_FdInfo *fdi); | ||
284 | |||
285 | /** | ||
286 | * Delete a @a task from the set of tasks to be run. | ||
287 | * | ||
288 | * @param cls closure | ||
289 | * @param task task to delete | ||
290 | * @param fdi conditions to watch for (must match @e add call) | ||
291 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
292 | * (i.e. @a task or @a fdi do not match prior @e add call) | ||
293 | */ | ||
294 | int | ||
295 | (*del)(void *cls, | ||
296 | struct GNUNET_SCHEDULER_Task *task, | ||
297 | const struct GNUNET_SCHEDULER_FdInfo *fdi); | ||
298 | |||
299 | /** | ||
300 | * Set time at which we definitively want to get a wakeup call. | ||
301 | * | ||
302 | * @param cls closure | ||
303 | * @param dt time when we want to wake up next | ||
304 | */ | ||
305 | void | ||
306 | (*set_wakeup)(void *cls, | ||
307 | struct GNUNET_TIME_Absolute dt); | ||
308 | |||
309 | /** | ||
310 | * Event loop's "main" function, to be called from | ||
311 | * #GNUNET_SCHEDULER_run_with_driver() to actually | ||
312 | * launch the loop. | ||
313 | * | ||
314 | * @param cls closure | ||
315 | * @param sh scheduler handle to pass to | ||
316 | * #GNUNET_SCHEDULER_run_from_driver() | ||
317 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
318 | */ | ||
319 | int | ||
320 | (*loop)(void *cls, | ||
321 | struct GNUNET_SCHEDULER_Handle *sh); | ||
322 | |||
323 | }; | ||
324 | |||
325 | |||
326 | /** | ||
127 | * Signature of the main function of a task. | 327 | * Signature of the main function of a task. |
128 | * | 328 | * |
129 | * @param cls closure | 329 | * @param cls closure |
130 | * @param tc context information (why was this task triggered now) | ||
131 | */ | 330 | */ |
132 | typedef void | 331 | typedef void |
133 | (*GNUNET_SCHEDULER_TaskCallback) (void *cls); | 332 | (*GNUNET_SCHEDULER_TaskCallback) (void *cls); |
134 | 333 | ||
135 | 334 | ||
136 | /** | 335 | /** |
336 | * Initialize and run scheduler. This function will return when all | ||
337 | * tasks have completed. On systems with signals, receiving a SIGTERM | ||
338 | * (and other similar signals) will cause #GNUNET_SCHEDULER_shutdown | ||
339 | * to be run after the active task is complete. As a result, SIGTERM | ||
340 | * causes all shutdown tasks to be scheduled with reason | ||
341 | * #GNUNET_SCHEDULER_REASON_SHUTDOWN. (However, tasks added | ||
342 | * afterwards will execute normally!). Note that any particular | ||
343 | * signal will only shut down one scheduler; applications should | ||
344 | * always only create a single scheduler. | ||
345 | * | ||
346 | * @param driver drive to use for the event loop | ||
347 | * @param task task to run first (and immediately) | ||
348 | * @param task_cls closure of @a task | ||
349 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
350 | */ | ||
351 | int | ||
352 | GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver, | ||
353 | GNUNET_SCHEDULER_TaskCallback task, | ||
354 | void *task_cls); | ||
355 | |||
356 | |||
357 | /** | ||
358 | * Obtain the driver for using select() as the event loop. | ||
359 | * | ||
360 | * @return NULL on error | ||
361 | */ | ||
362 | const struct GNUNET_SCHEDULER_Driver * | ||
363 | GNUNET_SCHEDULER_driver_select (void); | ||
364 | |||
365 | |||
366 | /** | ||
137 | * Signature of the select function used by the scheduler. | 367 | * Signature of the select function used by the scheduler. |
138 | * #GNUNET_NETWORK_socket_select matches it. | 368 | * #GNUNET_NETWORK_socket_select matches it. |
139 | * | 369 | * |
@@ -571,7 +801,7 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
571 | * Sets the select function to use in the scheduler (scheduler_select). | 801 | * Sets the select function to use in the scheduler (scheduler_select). |
572 | * | 802 | * |
573 | * @param new_select new select function to use (NULL to reset to default) | 803 | * @param new_select new select function to use (NULL to reset to default) |
574 | * @param new_select_cls closure for 'new_select' | 804 | * @param new_select_cls closure for @a new_select |
575 | */ | 805 | */ |
576 | void | 806 | void |
577 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, | 807 | GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, |
diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c index 2410c9b3c..d867138e4 100644 --- a/src/namecache/gnunet-namecache.c +++ b/src/namecache/gnunet-namecache.c | |||
@@ -226,13 +226,13 @@ int | |||
226 | main (int argc, char *const *argv) | 226 | main (int argc, char *const *argv) |
227 | { | 227 | { |
228 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 228 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
229 | GNUNET_GETOPT_OPTION_STRING ('n', | 229 | GNUNET_GETOPT_option_string ('n', |
230 | "name", | 230 | "name", |
231 | "NAME", | 231 | "NAME", |
232 | gettext_noop ("name of the record to add/delete/display"), | 232 | gettext_noop ("name of the record to add/delete/display"), |
233 | &name), | 233 | &name), |
234 | 234 | ||
235 | GNUNET_GETOPT_OPTION_STRING ('z', | 235 | GNUNET_GETOPT_option_string ('z', |
236 | "zone", | 236 | "zone", |
237 | "PKEY", | 237 | "PKEY", |
238 | gettext_noop ("spezifies the public key of the zone to look in"), | 238 | gettext_noop ("spezifies the public key of the zone to look in"), |
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 2ce3741f8..dcb9dd678 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -1132,45 +1132,45 @@ main (int argc, | |||
1132 | 1132 | ||
1133 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1133 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1134 | 1134 | ||
1135 | GNUNET_GETOPT_OPTION_SET_ONE ('a', | 1135 | GNUNET_GETOPT_option_flag ('a', |
1136 | "add", | 1136 | "add", |
1137 | gettext_noop ("add record"), | 1137 | gettext_noop ("add record"), |
1138 | &add), | 1138 | &add), |
1139 | 1139 | ||
1140 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 1140 | GNUNET_GETOPT_option_flag ('d', |
1141 | "delete", | 1141 | "delete", |
1142 | gettext_noop ("delete record"), | 1142 | gettext_noop ("delete record"), |
1143 | &del), | 1143 | &del), |
1144 | 1144 | ||
1145 | GNUNET_GETOPT_OPTION_SET_ONE ('D', | 1145 | GNUNET_GETOPT_option_flag ('D', |
1146 | "display", | 1146 | "display", |
1147 | gettext_noop ("display records"), | 1147 | gettext_noop ("display records"), |
1148 | &list), | 1148 | &list), |
1149 | 1149 | ||
1150 | GNUNET_GETOPT_OPTION_STRING ('e', | 1150 | GNUNET_GETOPT_option_string ('e', |
1151 | "expiration", | 1151 | "expiration", |
1152 | "TIME", | 1152 | "TIME", |
1153 | gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), | 1153 | gettext_noop ("expiration time for record to use (for adding only), \"never\" is possible"), |
1154 | &expirationstring), | 1154 | &expirationstring), |
1155 | 1155 | ||
1156 | GNUNET_GETOPT_OPTION_STRING ('i', | 1156 | GNUNET_GETOPT_option_string ('i', |
1157 | "nick", | 1157 | "nick", |
1158 | "NICKNAME", | 1158 | "NICKNAME", |
1159 | gettext_noop ("set the desired nick name for the zone"), | 1159 | gettext_noop ("set the desired nick name for the zone"), |
1160 | &nickstring), | 1160 | &nickstring), |
1161 | 1161 | ||
1162 | GNUNET_GETOPT_OPTION_SET_ONE ('m', | 1162 | GNUNET_GETOPT_option_flag ('m', |
1163 | "monitor", | 1163 | "monitor", |
1164 | gettext_noop ("monitor changes in the namestore"), | 1164 | gettext_noop ("monitor changes in the namestore"), |
1165 | &monitor), | 1165 | &monitor), |
1166 | 1166 | ||
1167 | GNUNET_GETOPT_OPTION_STRING ('n', | 1167 | GNUNET_GETOPT_option_string ('n', |
1168 | "name", | 1168 | "name", |
1169 | "NAME", | 1169 | "NAME", |
1170 | gettext_noop ("name of the record to add/delete/display"), | 1170 | gettext_noop ("name of the record to add/delete/display"), |
1171 | &name), | 1171 | &name), |
1172 | 1172 | ||
1173 | GNUNET_GETOPT_OPTION_STRING ('r', | 1173 | GNUNET_GETOPT_option_string ('r', |
1174 | "reverse", | 1174 | "reverse", |
1175 | "PKEY", | 1175 | "PKEY", |
1176 | gettext_noop ("determine our name for the given PKEY"), | 1176 | gettext_noop ("determine our name for the given PKEY"), |
@@ -1178,35 +1178,35 @@ main (int argc, | |||
1178 | 1178 | ||
1179 | 1179 | ||
1180 | 1180 | ||
1181 | GNUNET_GETOPT_OPTION_STRING ('t', | 1181 | GNUNET_GETOPT_option_string ('t', |
1182 | "type", | 1182 | "type", |
1183 | "TYPE", | 1183 | "TYPE", |
1184 | gettext_noop ("type of the record to add/delete/display"), | 1184 | gettext_noop ("type of the record to add/delete/display"), |
1185 | &typestring), | 1185 | &typestring), |
1186 | 1186 | ||
1187 | GNUNET_GETOPT_OPTION_STRING ('u', | 1187 | GNUNET_GETOPT_option_string ('u', |
1188 | "uri", | 1188 | "uri", |
1189 | "URI", | 1189 | "URI", |
1190 | gettext_noop ("URI to import into our zone"), | 1190 | gettext_noop ("URI to import into our zone"), |
1191 | &uri), | 1191 | &uri), |
1192 | 1192 | ||
1193 | GNUNET_GETOPT_OPTION_STRING ('V', | 1193 | GNUNET_GETOPT_option_string ('V', |
1194 | "value", | 1194 | "value", |
1195 | "VALUE", | 1195 | "VALUE", |
1196 | gettext_noop ("value of the record to add/delete"), | 1196 | gettext_noop ("value of the record to add/delete"), |
1197 | &value), | 1197 | &value), |
1198 | 1198 | ||
1199 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 1199 | GNUNET_GETOPT_option_flag ('p', |
1200 | "public", | 1200 | "public", |
1201 | gettext_noop ("create or list public record"), | 1201 | gettext_noop ("create or list public record"), |
1202 | &is_public), | 1202 | &is_public), |
1203 | 1203 | ||
1204 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 1204 | GNUNET_GETOPT_option_flag ('s', |
1205 | "shadow", | 1205 | "shadow", |
1206 | gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), | 1206 | gettext_noop ("create shadow record (only valid if all other records of the same type have expired"), |
1207 | &is_shadow), | 1207 | &is_shadow), |
1208 | 1208 | ||
1209 | GNUNET_GETOPT_OPTION_STRING ('z', | 1209 | GNUNET_GETOPT_option_string ('z', |
1210 | "zone", | 1210 | "zone", |
1211 | "EGO", | 1211 | "EGO", |
1212 | gettext_noop ("name of the ego controlling the zone"), | 1212 | gettext_noop ("name of the ego controlling the zone"), |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 0d36cf445..50957a5b4 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -899,10 +899,11 @@ namestore_zkey_cont (struct GNUNET_REST_RequestHandle *con, | |||
899 | } | 899 | } |
900 | handle->zkey_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, | 900 | handle->zkey_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, |
901 | &key); | 901 | &key); |
902 | if (GNUNET_OK != | 902 | if ((NULL == handle->zkey_str) || |
903 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->zkey_str, | 903 | (GNUNET_OK != |
904 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->zkey_str, | ||
904 | strlen (handle->zkey_str), | 905 | strlen (handle->zkey_str), |
905 | &pubkey)) | 906 | &pubkey))) |
906 | { | 907 | { |
907 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 908 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
908 | "Zkey invalid %s\n", handle->zkey_str); | 909 | "Zkey invalid %s\n", handle->zkey_str); |
@@ -1126,8 +1127,8 @@ rest_identity_process_request(struct GNUNET_REST_RequestHandle *rest_handle, | |||
1126 | { | 1127 | { |
1127 | type = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, | 1128 | type = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, |
1128 | &key); | 1129 | &key); |
1129 | 1130 | if (NULL != type) | |
1130 | handle->type = GNUNET_GNSRECORD_typename_to_number (type); | 1131 | handle->type = GNUNET_GNSRECORD_typename_to_number (type); |
1131 | } | 1132 | } |
1132 | name = get_name_from_url (handle->url); | 1133 | name = get_name_from_url (handle->url); |
1133 | if (NULL != ego) | 1134 | if (NULL != ego) |
diff --git a/src/nat-auto/gnunet-nat-auto.c b/src/nat-auto/gnunet-nat-auto.c index 8b281d1ab..7d09253b8 100644 --- a/src/nat-auto/gnunet-nat-auto.c +++ b/src/nat-auto/gnunet-nat-auto.c | |||
@@ -340,28 +340,28 @@ main (int argc, | |||
340 | char *const argv[]) | 340 | char *const argv[]) |
341 | { | 341 | { |
342 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 342 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
343 | GNUNET_GETOPT_OPTION_SET_ONE ('a', | 343 | GNUNET_GETOPT_option_flag ('a', |
344 | "auto", | 344 | "auto", |
345 | gettext_noop ("run autoconfiguration"), | 345 | gettext_noop ("run autoconfiguration"), |
346 | &do_auto), | 346 | &do_auto), |
347 | 347 | ||
348 | GNUNET_GETOPT_OPTION_STRING ('S', | 348 | GNUNET_GETOPT_option_string ('S', |
349 | "section", | 349 | "section", |
350 | "NAME", | 350 | "NAME", |
351 | gettext_noop ("section name providing the configuration for the adapter"), | 351 | gettext_noop ("section name providing the configuration for the adapter"), |
352 | §ion_name), | 352 | §ion_name), |
353 | 353 | ||
354 | GNUNET_GETOPT_OPTION_SET_ONE ('t', | 354 | GNUNET_GETOPT_option_flag ('t', |
355 | "tcp", | 355 | "tcp", |
356 | gettext_noop ("use TCP"), | 356 | gettext_noop ("use TCP"), |
357 | &use_tcp), | 357 | &use_tcp), |
358 | 358 | ||
359 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | 359 | GNUNET_GETOPT_option_flag ('u', |
360 | "udp", | 360 | "udp", |
361 | gettext_noop ("use UDP"), | 361 | gettext_noop ("use UDP"), |
362 | &use_udp), | 362 | &use_udp), |
363 | 363 | ||
364 | GNUNET_GETOPT_OPTION_SET_ONE ('w', | 364 | GNUNET_GETOPT_option_flag ('w', |
365 | "write", | 365 | "write", |
366 | gettext_noop ("write configuration file (for autoconfiguration)"), | 366 | gettext_noop ("write configuration file (for autoconfiguration)"), |
367 | &write_cfg), | 367 | &write_cfg), |
diff --git a/src/nat/gnunet-nat.c b/src/nat/gnunet-nat.c index 50e0dff0f..b3cf2e946 100644 --- a/src/nat/gnunet-nat.c +++ b/src/nat/gnunet-nat.c | |||
@@ -419,40 +419,40 @@ main (int argc, | |||
419 | { | 419 | { |
420 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 420 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
421 | 421 | ||
422 | GNUNET_GETOPT_OPTION_STRING ('i', | 422 | GNUNET_GETOPT_option_string ('i', |
423 | "in", | 423 | "in", |
424 | "ADDRESS", | 424 | "ADDRESS", |
425 | gettext_noop ("which IP and port are we locally using to bind/listen to"), | 425 | gettext_noop ("which IP and port are we locally using to bind/listen to"), |
426 | &local_addr), | 426 | &local_addr), |
427 | 427 | ||
428 | GNUNET_GETOPT_OPTION_STRING ('r', | 428 | GNUNET_GETOPT_option_string ('r', |
429 | "remote", | 429 | "remote", |
430 | "ADDRESS", | 430 | "ADDRESS", |
431 | gettext_noop ("which remote IP and port should be asked for connection reversal"), | 431 | gettext_noop ("which remote IP and port should be asked for connection reversal"), |
432 | &remote_addr), | 432 | &remote_addr), |
433 | 433 | ||
434 | GNUNET_GETOPT_OPTION_STRING ('S', | 434 | GNUNET_GETOPT_option_string ('S', |
435 | "section", | 435 | "section", |
436 | NULL, | 436 | NULL, |
437 | gettext_noop ("name of configuration section to find additional options, such as manual host punching data"), | 437 | gettext_noop ("name of configuration section to find additional options, such as manual host punching data"), |
438 | §ion_name), | 438 | §ion_name), |
439 | 439 | ||
440 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 440 | GNUNET_GETOPT_option_flag ('s', |
441 | "stun", | 441 | "stun", |
442 | gettext_noop ("enable STUN processing"), | 442 | gettext_noop ("enable STUN processing"), |
443 | &do_stun), | 443 | &do_stun), |
444 | 444 | ||
445 | GNUNET_GETOPT_OPTION_SET_ONE ('t', | 445 | GNUNET_GETOPT_option_flag ('t', |
446 | "tcp", | 446 | "tcp", |
447 | gettext_noop ("use TCP"), | 447 | gettext_noop ("use TCP"), |
448 | &use_tcp), | 448 | &use_tcp), |
449 | 449 | ||
450 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | 450 | GNUNET_GETOPT_option_flag ('u', |
451 | "udp", | 451 | "udp", |
452 | gettext_noop ("use UDP"), | 452 | gettext_noop ("use UDP"), |
453 | &use_udp), | 453 | &use_udp), |
454 | 454 | ||
455 | GNUNET_GETOPT_OPTION_SET_ONE ('W', | 455 | GNUNET_GETOPT_option_flag ('W', |
456 | "watch", | 456 | "watch", |
457 | gettext_noop ("watch for connection reversal requests"), | 457 | gettext_noop ("watch for connection reversal requests"), |
458 | &listen_reversal), | 458 | &listen_reversal), |
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index ea28bf610..4a10022e3 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c | |||
@@ -836,42 +836,42 @@ int | |||
836 | main (int argc, char *const *argv) | 836 | main (int argc, char *const *argv) |
837 | { | 837 | { |
838 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 838 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
839 | GNUNET_GETOPT_OPTION_SET_UINT ('C', | 839 | GNUNET_GETOPT_option_uint ('C', |
840 | "connections", | 840 | "connections", |
841 | "COUNT", | 841 | "COUNT", |
842 | gettext_noop ("limit to the number of connections to NSE services, 0 for none"), | 842 | gettext_noop ("limit to the number of connections to NSE services, 0 for none"), |
843 | &connection_limit), | 843 | &connection_limit), |
844 | GNUNET_GETOPT_OPTION_STRING ('d', | 844 | GNUNET_GETOPT_option_string ('d', |
845 | "details", | 845 | "details", |
846 | "FILENAME", | 846 | "FILENAME", |
847 | gettext_noop ("name of the file for writing connection information and statistics"), | 847 | gettext_noop ("name of the file for writing connection information and statistics"), |
848 | &data_filename), | 848 | &data_filename), |
849 | 849 | ||
850 | GNUNET_GETOPT_OPTION_STRING ('H', | 850 | GNUNET_GETOPT_option_string ('H', |
851 | "hosts", | 851 | "hosts", |
852 | "FILENAME", | 852 | "FILENAME", |
853 | gettext_noop ("name of the file with the login information for the testbed"), | 853 | gettext_noop ("name of the file with the login information for the testbed"), |
854 | &hosts_file), | 854 | &hosts_file), |
855 | 855 | ||
856 | GNUNET_GETOPT_OPTION_STRING ('o', | 856 | GNUNET_GETOPT_option_string ('o', |
857 | "output", | 857 | "output", |
858 | "FILENAME", | 858 | "FILENAME", |
859 | gettext_noop ("name of the file for writing the main results"), | 859 | gettext_noop ("name of the file for writing the main results"), |
860 | &output_filename), | 860 | &output_filename), |
861 | 861 | ||
862 | 862 | ||
863 | GNUNET_GETOPT_OPTION_STRING ('p', | 863 | GNUNET_GETOPT_option_string ('p', |
864 | "peers", | 864 | "peers", |
865 | "NETWORKSIZESPEC", | 865 | "NETWORKSIZESPEC", |
866 | gettext_noop ("Number of peers to run in each round, separated by commas"), | 866 | gettext_noop ("Number of peers to run in each round, separated by commas"), |
867 | &num_peer_spec), | 867 | &num_peer_spec), |
868 | 868 | ||
869 | GNUNET_GETOPT_OPTION_INCREMENT_VALUE ('V', | 869 | GNUNET_GETOPT_option_increment_uint ('V', |
870 | "verbose", | 870 | "verbose", |
871 | gettext_noop ("be verbose (print progress information)"), | 871 | gettext_noop ("be verbose (print progress information)"), |
872 | &verbose), | 872 | &verbose), |
873 | 873 | ||
874 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('w', | 874 | GNUNET_GETOPT_option_relative_time ('w', |
875 | "wait", | 875 | "wait", |
876 | "DELAY", | 876 | "DELAY", |
877 | gettext_noop ("delay between rounds"), | 877 | gettext_noop ("delay between rounds"), |
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 59ffe2efd..de7dcd6fa 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c | |||
@@ -838,42 +838,42 @@ int | |||
838 | main (int argc, char *const *argv) | 838 | main (int argc, char *const *argv) |
839 | { | 839 | { |
840 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 840 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
841 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 841 | GNUNET_GETOPT_option_flag ('n', |
842 | "numeric", | 842 | "numeric", |
843 | gettext_noop ("don't resolve host names"), | 843 | gettext_noop ("don't resolve host names"), |
844 | &no_resolve), | 844 | &no_resolve), |
845 | 845 | ||
846 | GNUNET_GETOPT_OPTION_SET_ONE ('q', | 846 | GNUNET_GETOPT_option_flag ('q', |
847 | "quiet", | 847 | "quiet", |
848 | gettext_noop ("output only the identity strings"), | 848 | gettext_noop ("output only the identity strings"), |
849 | &be_quiet), | 849 | &be_quiet), |
850 | GNUNET_GETOPT_OPTION_SET_ONE ('f', | 850 | GNUNET_GETOPT_option_flag ('f', |
851 | "friends", | 851 | "friends", |
852 | gettext_noop ("include friend-only information"), | 852 | gettext_noop ("include friend-only information"), |
853 | &include_friend_only), | 853 | &include_friend_only), |
854 | 854 | ||
855 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 855 | GNUNET_GETOPT_option_flag ('s', |
856 | "self", | 856 | "self", |
857 | gettext_noop ("output our own identity only"), | 857 | gettext_noop ("output our own identity only"), |
858 | &get_self), | 858 | &get_self), |
859 | 859 | ||
860 | GNUNET_GETOPT_OPTION_SET_ONE ('i', | 860 | GNUNET_GETOPT_option_flag ('i', |
861 | "info", | 861 | "info", |
862 | gettext_noop ("list all known peers"), | 862 | gettext_noop ("list all known peers"), |
863 | &get_info), | 863 | &get_info), |
864 | 864 | ||
865 | GNUNET_GETOPT_OPTION_STRING ('d', | 865 | GNUNET_GETOPT_option_string ('d', |
866 | "dump-hello", | 866 | "dump-hello", |
867 | NULL, | 867 | NULL, |
868 | gettext_noop ("dump hello to file"), | 868 | gettext_noop ("dump hello to file"), |
869 | &dump_hello), | 869 | &dump_hello), |
870 | 870 | ||
871 | GNUNET_GETOPT_OPTION_SET_ONE ('g', | 871 | GNUNET_GETOPT_option_flag ('g', |
872 | "get-hello", | 872 | "get-hello", |
873 | gettext_noop ("also output HELLO uri(s)"), | 873 | gettext_noop ("also output HELLO uri(s)"), |
874 | &get_uri), | 874 | &get_uri), |
875 | 875 | ||
876 | GNUNET_GETOPT_OPTION_STRING ('p', | 876 | GNUNET_GETOPT_option_string ('p', |
877 | "put-hello", | 877 | "put-hello", |
878 | "HELLO", | 878 | "HELLO", |
879 | gettext_noop ("add given HELLO uri to the database"), | 879 | gettext_noop ("add given HELLO uri to the database"), |
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 71f3580f8..7d907fec6 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c | |||
@@ -1479,32 +1479,32 @@ main (int argc, char *const *argv) | |||
1479 | { | 1479 | { |
1480 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1480 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1481 | 1481 | ||
1482 | GNUNET_GETOPT_OPTION_FILENAME ('o', | 1482 | GNUNET_GETOPT_option_filename ('o', |
1483 | "output-file", | 1483 | "output-file", |
1484 | "FILENAME", | 1484 | "FILENAME", |
1485 | gettext_noop ("name of the file for writing statistics"), | 1485 | gettext_noop ("name of the file for writing statistics"), |
1486 | &data_filename), | 1486 | &data_filename), |
1487 | 1487 | ||
1488 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 1488 | GNUNET_GETOPT_option_relative_time ('t', |
1489 | "matching-timeout", | 1489 | "matching-timeout", |
1490 | "TIMEOUT", | 1490 | "TIMEOUT", |
1491 | gettext_noop ("wait TIMEOUT before ending the experiment"), | 1491 | gettext_noop ("wait TIMEOUT before ending the experiment"), |
1492 | &search_timeout_time), | 1492 | &search_timeout_time), |
1493 | 1493 | ||
1494 | GNUNET_GETOPT_OPTION_FILENAME ('p', | 1494 | GNUNET_GETOPT_option_filename ('p', |
1495 | "policy-dir", | 1495 | "policy-dir", |
1496 | "DIRECTORY", | 1496 | "DIRECTORY", |
1497 | gettext_noop ("directory with policy files"), | 1497 | gettext_noop ("directory with policy files"), |
1498 | &policy_dir), | 1498 | &policy_dir), |
1499 | 1499 | ||
1500 | 1500 | ||
1501 | GNUNET_GETOPT_OPTION_FILENAME ('s', | 1501 | GNUNET_GETOPT_option_filename ('s', |
1502 | "strings-file", | 1502 | "strings-file", |
1503 | "FILENAME", | 1503 | "FILENAME", |
1504 | gettext_noop ("name of file with input strings"), | 1504 | gettext_noop ("name of file with input strings"), |
1505 | &strings_file), | 1505 | &strings_file), |
1506 | 1506 | ||
1507 | GNUNET_GETOPT_OPTION_FILENAME ('H', | 1507 | GNUNET_GETOPT_option_filename ('H', |
1508 | "hosts-file", | 1508 | "hosts-file", |
1509 | "FILENAME", | 1509 | "FILENAME", |
1510 | gettext_noop ("name of file with hosts' names"), | 1510 | gettext_noop ("name of file with hosts' names"), |
diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c index 422e45565..67c2ecfff 100644 --- a/src/regex/gnunet-regex-simulation-profiler.c +++ b/src/regex/gnunet-regex-simulation-profiler.c | |||
@@ -693,13 +693,13 @@ main (int argc, char *const *argv) | |||
693 | { | 693 | { |
694 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 694 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
695 | 695 | ||
696 | GNUNET_GETOPT_OPTION_STRING ('t', | 696 | GNUNET_GETOPT_option_string ('t', |
697 | "table", | 697 | "table", |
698 | "TABLENAME", | 698 | "TABLENAME", |
699 | gettext_noop ("name of the table to write DFAs"), | 699 | gettext_noop ("name of the table to write DFAs"), |
700 | &table_name), | 700 | &table_name), |
701 | 701 | ||
702 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 702 | GNUNET_GETOPT_option_uint ('p', |
703 | "max-path-compression", | 703 | "max-path-compression", |
704 | "MAX_PATH_COMPRESSION", | 704 | "MAX_PATH_COMPRESSION", |
705 | gettext_noop ("maximum path compression length"), | 705 | gettext_noop ("maximum path compression length"), |
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index 0b6c18267..5b92c6c43 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c | |||
@@ -784,7 +784,7 @@ int | |||
784 | main (int argc, char *const *argv) | 784 | main (int argc, char *const *argv) |
785 | { | 785 | { |
786 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 786 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
787 | GNUNET_GETOPT_OPTION_SET_ULONG ('p', | 787 | GNUNET_GETOPT_option_ulong ('p', |
788 | "port", | 788 | "port", |
789 | "PORT", | 789 | "PORT", |
790 | gettext_noop ("listen on specified port (default: 7776)"), | 790 | gettext_noop ("listen on specified port (default: 7776)"), |
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 7b40c83d7..13e6b23a5 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -529,24 +529,24 @@ main (int argc, char *const *argv) | |||
529 | { | 529 | { |
530 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 530 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
531 | 531 | ||
532 | GNUNET_GETOPT_OPTION_STRING ('f', | 532 | GNUNET_GETOPT_option_string ('f', |
533 | "filename", | 533 | "filename", |
534 | "NAME", | 534 | "NAME", |
535 | gettext_noop ("use NAME for the name of the revocation file"), | 535 | gettext_noop ("use NAME for the name of the revocation file"), |
536 | &filename), | 536 | &filename), |
537 | 537 | ||
538 | GNUNET_GETOPT_OPTION_STRING ('R', | 538 | GNUNET_GETOPT_option_string ('R', |
539 | "revoke", | 539 | "revoke", |
540 | "NAME", | 540 | "NAME", |
541 | gettext_noop ("revoke the private key associated for the the private key associated with the ego NAME "), | 541 | gettext_noop ("revoke the private key associated for the the private key associated with the ego NAME "), |
542 | &revoke_ego), | 542 | &revoke_ego), |
543 | 543 | ||
544 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 544 | GNUNET_GETOPT_option_flag ('p', |
545 | "perform", | 545 | "perform", |
546 | gettext_noop ("actually perform revocation, otherwise we just do the precomputation"), | 546 | gettext_noop ("actually perform revocation, otherwise we just do the precomputation"), |
547 | &perform), | 547 | &perform), |
548 | 548 | ||
549 | GNUNET_GETOPT_OPTION_STRING ('t', | 549 | GNUNET_GETOPT_option_string ('t', |
550 | "test", | 550 | "test", |
551 | "KEY", | 551 | "KEY", |
552 | gettext_noop ("test if the public key KEY has been revoked"), | 552 | gettext_noop ("test if the public key KEY has been revoked"), |
diff --git a/src/rps/gnunet-rps.c b/src/rps/gnunet-rps.c index e36e547fa..bbac0d634 100644 --- a/src/rps/gnunet-rps.c +++ b/src/rps/gnunet-rps.c | |||
@@ -140,7 +140,7 @@ main (int argc, char *const *argv) | |||
140 | const char helpstr[] = | 140 | const char helpstr[] = |
141 | "Get random GNUnet peers. If none is specified a single is requested."; | 141 | "Get random GNUnet peers. If none is specified a single is requested."; |
142 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 142 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
143 | GNUNET_GETOPT_OPTION_SET_BASE32_AUTO ('s', | 143 | GNUNET_GETOPT_option_base32_auto ('s', |
144 | "seed", | 144 | "seed", |
145 | "PEER_ID", | 145 | "PEER_ID", |
146 | gettext_noop ("Seed a PeerID"), | 146 | gettext_noop ("Seed a PeerID"), |
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 5d0fce2b1..4a152e09e 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c | |||
@@ -345,25 +345,25 @@ main (int argc, char *const *argv) | |||
345 | { | 345 | { |
346 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 346 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
347 | 347 | ||
348 | GNUNET_GETOPT_OPTION_STRING ('e', | 348 | GNUNET_GETOPT_option_string ('e', |
349 | "elements", | 349 | "elements", |
350 | "\"key1,val1;key2,val2;...,keyn,valn;\"", | 350 | "\"key1,val1;key2,val2;...,keyn,valn;\"", |
351 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), | 351 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), |
352 | &input_elements), | 352 | &input_elements), |
353 | 353 | ||
354 | GNUNET_GETOPT_OPTION_STRING ('e', | 354 | GNUNET_GETOPT_option_string ('e', |
355 | "elements", | 355 | "elements", |
356 | "\"key1,val1;key2,val2;...,keyn,valn;\"", | 356 | "\"key1,val1;key2,val2;...,keyn,valn;\"", |
357 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), | 357 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), |
358 | &input_elements), | 358 | &input_elements), |
359 | 359 | ||
360 | GNUNET_GETOPT_OPTION_STRING ('p', | 360 | GNUNET_GETOPT_option_string ('p', |
361 | "peer", | 361 | "peer", |
362 | "PEERID", | 362 | "PEERID", |
363 | gettext_noop ("[Optional] peer to calculate our scalarproduct with. If this parameter is not given, the service will wait for a remote peer to compute the request."), | 363 | gettext_noop ("[Optional] peer to calculate our scalarproduct with. If this parameter is not given, the service will wait for a remote peer to compute the request."), |
364 | &input_peer_id), | 364 | &input_peer_id), |
365 | 365 | ||
366 | GNUNET_GETOPT_OPTION_STRING ('k', | 366 | GNUNET_GETOPT_option_string ('k', |
367 | "key", | 367 | "key", |
368 | "TRANSACTION_ID", | 368 | "TRANSACTION_ID", |
369 | gettext_noop ("Transaction ID shared with peer."), | 369 | gettext_noop ("Transaction ID shared with peer."), |
diff --git a/src/secretsharing/gnunet-secretsharing-profiler.c b/src/secretsharing/gnunet-secretsharing-profiler.c index e66019dc6..a83dcd92a 100644 --- a/src/secretsharing/gnunet-secretsharing-profiler.c +++ b/src/secretsharing/gnunet-secretsharing-profiler.c | |||
@@ -604,37 +604,37 @@ main (int argc, char **argv) | |||
604 | { | 604 | { |
605 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 605 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
606 | 606 | ||
607 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 607 | GNUNET_GETOPT_option_uint ('n', |
608 | "num-peers", | 608 | "num-peers", |
609 | NULL, | 609 | NULL, |
610 | gettext_noop ("number of peers in consensus"), | 610 | gettext_noop ("number of peers in consensus"), |
611 | &num_peers), | 611 | &num_peers), |
612 | 612 | ||
613 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('D', | 613 | GNUNET_GETOPT_option_relative_time ('D', |
614 | "delay", | 614 | "delay", |
615 | NULL, | 615 | NULL, |
616 | gettext_noop ("dkg start delay"), | 616 | gettext_noop ("dkg start delay"), |
617 | &delay), | 617 | &delay), |
618 | 618 | ||
619 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 619 | GNUNET_GETOPT_option_relative_time ('t', |
620 | "timeout", | 620 | "timeout", |
621 | NULL, | 621 | NULL, |
622 | gettext_noop ("dkg timeout"), | 622 | gettext_noop ("dkg timeout"), |
623 | &timeout), | 623 | &timeout), |
624 | 624 | ||
625 | GNUNET_GETOPT_OPTION_SET_UINT ('k', | 625 | GNUNET_GETOPT_option_uint ('k', |
626 | "threshold", | 626 | "threshold", |
627 | NULL, | 627 | NULL, |
628 | gettext_noop ("threshold"), | 628 | gettext_noop ("threshold"), |
629 | &threshold), | 629 | &threshold), |
630 | 630 | ||
631 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 631 | GNUNET_GETOPT_option_flag ('d', |
632 | "descrypt", | 632 | "descrypt", |
633 | gettext_noop ("also profile decryption"), | 633 | gettext_noop ("also profile decryption"), |
634 | &decrypt), | 634 | &decrypt), |
635 | 635 | ||
636 | 636 | ||
637 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | 637 | GNUNET_GETOPT_option_verbose (&verbose), |
638 | 638 | ||
639 | GNUNET_GETOPT_OPTION_END | 639 | GNUNET_GETOPT_OPTION_END |
640 | }; | 640 | }; |
diff --git a/src/set/gnunet-set-ibf-profiler.c b/src/set/gnunet-set-ibf-profiler.c index ac86a900d..70fafa1e1 100644 --- a/src/set/gnunet-set-ibf-profiler.c +++ b/src/set/gnunet-set-ibf-profiler.c | |||
@@ -246,31 +246,31 @@ main (int argc, char **argv) | |||
246 | { | 246 | { |
247 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 247 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
248 | 248 | ||
249 | GNUNET_GETOPT_OPTION_SET_UINT ('A', | 249 | GNUNET_GETOPT_option_uint ('A', |
250 | "asize", | 250 | "asize", |
251 | NULL, | 251 | NULL, |
252 | gettext_noop ("number of element in set A-B"), | 252 | gettext_noop ("number of element in set A-B"), |
253 | &asize), | 253 | &asize), |
254 | 254 | ||
255 | GNUNET_GETOPT_OPTION_SET_UINT ('B', | 255 | GNUNET_GETOPT_option_uint ('B', |
256 | "bsize", | 256 | "bsize", |
257 | NULL, | 257 | NULL, |
258 | gettext_noop ("number of element in set B-A"), | 258 | gettext_noop ("number of element in set B-A"), |
259 | &bsize), | 259 | &bsize), |
260 | 260 | ||
261 | GNUNET_GETOPT_OPTION_SET_UINT ('C', | 261 | GNUNET_GETOPT_option_uint ('C', |
262 | "csize", | 262 | "csize", |
263 | NULL, | 263 | NULL, |
264 | gettext_noop ("number of common elements in A and B"), | 264 | gettext_noop ("number of common elements in A and B"), |
265 | &csize), | 265 | &csize), |
266 | 266 | ||
267 | GNUNET_GETOPT_OPTION_SET_UINT ('k', | 267 | GNUNET_GETOPT_option_uint ('k', |
268 | "hash-num", | 268 | "hash-num", |
269 | NULL, | 269 | NULL, |
270 | gettext_noop ("hash num"), | 270 | gettext_noop ("hash num"), |
271 | &hash_num), | 271 | &hash_num), |
272 | 272 | ||
273 | GNUNET_GETOPT_OPTION_SET_UINT ('s', | 273 | GNUNET_GETOPT_option_uint ('s', |
274 | "ibf-size", | 274 | "ibf-size", |
275 | NULL, | 275 | NULL, |
276 | gettext_noop ("ibf size"), | 276 | gettext_noop ("ibf size"), |
diff --git a/src/set/gnunet-set-profiler.c b/src/set/gnunet-set-profiler.c index 349bce6ea..68f7be690 100644 --- a/src/set/gnunet-set-profiler.c +++ b/src/set/gnunet-set-profiler.c | |||
@@ -427,54 +427,54 @@ int | |||
427 | main (int argc, char **argv) | 427 | main (int argc, char **argv) |
428 | { | 428 | { |
429 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 429 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
430 | GNUNET_GETOPT_OPTION_SET_UINT ('A', | 430 | GNUNET_GETOPT_option_uint ('A', |
431 | "num-first", | 431 | "num-first", |
432 | NULL, | 432 | NULL, |
433 | gettext_noop ("number of values"), | 433 | gettext_noop ("number of values"), |
434 | &num_a), | 434 | &num_a), |
435 | 435 | ||
436 | GNUNET_GETOPT_OPTION_SET_UINT ('B', | 436 | GNUNET_GETOPT_option_uint ('B', |
437 | "num-second", | 437 | "num-second", |
438 | NULL, | 438 | NULL, |
439 | gettext_noop ("number of values"), | 439 | gettext_noop ("number of values"), |
440 | &num_b), | 440 | &num_b), |
441 | 441 | ||
442 | GNUNET_GETOPT_OPTION_SET_ONE ('b', | 442 | GNUNET_GETOPT_option_flag ('b', |
443 | "byzantine", | 443 | "byzantine", |
444 | gettext_noop ("use byzantine mode"), | 444 | gettext_noop ("use byzantine mode"), |
445 | &byzantine), | 445 | &byzantine), |
446 | 446 | ||
447 | GNUNET_GETOPT_OPTION_SET_UINT ('f', | 447 | GNUNET_GETOPT_option_uint ('f', |
448 | "force-full", | 448 | "force-full", |
449 | NULL, | 449 | NULL, |
450 | gettext_noop ("force sending full set"), | 450 | gettext_noop ("force sending full set"), |
451 | &force_full), | 451 | &force_full), |
452 | 452 | ||
453 | GNUNET_GETOPT_OPTION_SET_UINT ('d', | 453 | GNUNET_GETOPT_option_uint ('d', |
454 | "force-delta", | 454 | "force-delta", |
455 | NULL, | 455 | NULL, |
456 | gettext_noop ("number delta operation"), | 456 | gettext_noop ("number delta operation"), |
457 | &force_delta), | 457 | &force_delta), |
458 | 458 | ||
459 | GNUNET_GETOPT_OPTION_SET_UINT ('C', | 459 | GNUNET_GETOPT_option_uint ('C', |
460 | "num-common", | 460 | "num-common", |
461 | NULL, | 461 | NULL, |
462 | gettext_noop ("number of values"), | 462 | gettext_noop ("number of values"), |
463 | &num_c), | 463 | &num_c), |
464 | 464 | ||
465 | GNUNET_GETOPT_OPTION_STRING ('x', | 465 | GNUNET_GETOPT_option_string ('x', |
466 | "operation", | 466 | "operation", |
467 | NULL, | 467 | NULL, |
468 | gettext_noop ("operation to execute"), | 468 | gettext_noop ("operation to execute"), |
469 | &op_str), | 469 | &op_str), |
470 | 470 | ||
471 | GNUNET_GETOPT_OPTION_SET_UINT ('w', | 471 | GNUNET_GETOPT_option_uint ('w', |
472 | "element-size", | 472 | "element-size", |
473 | NULL, | 473 | NULL, |
474 | gettext_noop ("element size"), | 474 | gettext_noop ("element size"), |
475 | &element_size), | 475 | &element_size), |
476 | 476 | ||
477 | GNUNET_GETOPT_OPTION_FILENAME ('s', | 477 | GNUNET_GETOPT_option_filename ('s', |
478 | "statistics", | 478 | "statistics", |
479 | "FILENAME", | 479 | "FILENAME", |
480 | gettext_noop ("write statistics to file"), | 480 | gettext_noop ("write statistics to file"), |
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c index 4a46fdc99..228d69d58 100644 --- a/src/social/gnunet-social.c +++ b/src/social/gnunet-social.c | |||
@@ -1212,78 +1212,78 @@ main (int argc, char *const *argv) | |||
1212 | 1212 | ||
1213 | /* operations */ | 1213 | /* operations */ |
1214 | 1214 | ||
1215 | GNUNET_GETOPT_OPTION_SET_ONE ('A', | 1215 | GNUNET_GETOPT_option_flag ('A', |
1216 | "host-assign", | 1216 | "host-assign", |
1217 | gettext_noop ("assign --name in state to --data"), | 1217 | gettext_noop ("assign --name in state to --data"), |
1218 | &op_host_assign), | 1218 | &op_host_assign), |
1219 | 1219 | ||
1220 | GNUNET_GETOPT_OPTION_SET_ONE ('B', | 1220 | GNUNET_GETOPT_option_flag ('B', |
1221 | "guest-leave", | 1221 | "guest-leave", |
1222 | gettext_noop ("say good-bye and leave somebody else's place"), | 1222 | gettext_noop ("say good-bye and leave somebody else's place"), |
1223 | &op_guest_leave), | 1223 | &op_guest_leave), |
1224 | 1224 | ||
1225 | GNUNET_GETOPT_OPTION_SET_ONE ('C', | 1225 | GNUNET_GETOPT_option_flag ('C', |
1226 | "host-enter", | 1226 | "host-enter", |
1227 | gettext_noop ("create a place"), | 1227 | gettext_noop ("create a place"), |
1228 | &op_host_enter), | 1228 | &op_host_enter), |
1229 | 1229 | ||
1230 | GNUNET_GETOPT_OPTION_SET_ONE ('C', | 1230 | GNUNET_GETOPT_option_flag ('C', |
1231 | "host-enter", | 1231 | "host-enter", |
1232 | gettext_noop ("create a place"), | 1232 | gettext_noop ("create a place"), |
1233 | &op_host_enter), | 1233 | &op_host_enter), |
1234 | 1234 | ||
1235 | GNUNET_GETOPT_OPTION_SET_ONE ('D', | 1235 | GNUNET_GETOPT_option_flag ('D', |
1236 | "host-leave", | 1236 | "host-leave", |
1237 | gettext_noop ("destroy a place we were hosting"), | 1237 | gettext_noop ("destroy a place we were hosting"), |
1238 | &op_host_leave), | 1238 | &op_host_leave), |
1239 | 1239 | ||
1240 | GNUNET_GETOPT_OPTION_SET_ONE ('E', | 1240 | GNUNET_GETOPT_option_flag ('E', |
1241 | "guest-enter", | 1241 | "guest-enter", |
1242 | gettext_noop ("enter somebody else's place"), | 1242 | gettext_noop ("enter somebody else's place"), |
1243 | &op_guest_enter), | 1243 | &op_guest_enter), |
1244 | 1244 | ||
1245 | 1245 | ||
1246 | GNUNET_GETOPT_OPTION_SET_ONE ('F', | 1246 | GNUNET_GETOPT_option_flag ('F', |
1247 | "look-for", | 1247 | "look-for", |
1248 | gettext_noop ("find state matching name prefix"), | 1248 | gettext_noop ("find state matching name prefix"), |
1249 | &op_look_for), | 1249 | &op_look_for), |
1250 | 1250 | ||
1251 | GNUNET_GETOPT_OPTION_SET_ONE ('H', | 1251 | GNUNET_GETOPT_option_flag ('H', |
1252 | "replay-latest", | 1252 | "replay-latest", |
1253 | gettext_noop ("replay history of messages up to the given --limit"), | 1253 | gettext_noop ("replay history of messages up to the given --limit"), |
1254 | &op_replay_latest), | 1254 | &op_replay_latest), |
1255 | 1255 | ||
1256 | GNUNET_GETOPT_OPTION_SET_ONE ('N', | 1256 | GNUNET_GETOPT_option_flag ('N', |
1257 | "host-reconnect", | 1257 | "host-reconnect", |
1258 | gettext_noop ("reconnect to a previously created place"), | 1258 | gettext_noop ("reconnect to a previously created place"), |
1259 | &op_host_reconnect), | 1259 | &op_host_reconnect), |
1260 | 1260 | ||
1261 | GNUNET_GETOPT_OPTION_SET_ONE ('P', | 1261 | GNUNET_GETOPT_option_flag ('P', |
1262 | "host-announce", | 1262 | "host-announce", |
1263 | gettext_noop ("publish something to a place we are hosting"), | 1263 | gettext_noop ("publish something to a place we are hosting"), |
1264 | &op_host_announce), | 1264 | &op_host_announce), |
1265 | 1265 | ||
1266 | GNUNET_GETOPT_OPTION_SET_ONE ('R', | 1266 | GNUNET_GETOPT_option_flag ('R', |
1267 | "guest-reconnect", | 1267 | "guest-reconnect", |
1268 | gettext_noop ("reconnect to a previously entered place"), | 1268 | gettext_noop ("reconnect to a previously entered place"), |
1269 | &op_guest_reconnect), | 1269 | &op_guest_reconnect), |
1270 | 1270 | ||
1271 | GNUNET_GETOPT_OPTION_SET_ONE ('S', | 1271 | GNUNET_GETOPT_option_flag ('S', |
1272 | "look-at", | 1272 | "look-at", |
1273 | gettext_noop ("search for state matching exact name"), | 1273 | gettext_noop ("search for state matching exact name"), |
1274 | &op_look_at), | 1274 | &op_look_at), |
1275 | 1275 | ||
1276 | GNUNET_GETOPT_OPTION_SET_ONE ('T', | 1276 | GNUNET_GETOPT_option_flag ('T', |
1277 | "guest-talk", | 1277 | "guest-talk", |
1278 | gettext_noop ("submit something to somebody's place"), | 1278 | gettext_noop ("submit something to somebody's place"), |
1279 | &op_guest_talk), | 1279 | &op_guest_talk), |
1280 | 1280 | ||
1281 | GNUNET_GETOPT_OPTION_SET_ONE ('U', | 1281 | GNUNET_GETOPT_option_flag ('U', |
1282 | "status", | 1282 | "status", |
1283 | gettext_noop ("list of egos and subscribed places"), | 1283 | gettext_noop ("list of egos and subscribed places"), |
1284 | &op_status), | 1284 | &op_status), |
1285 | 1285 | ||
1286 | GNUNET_GETOPT_OPTION_SET_ONE ('X', | 1286 | GNUNET_GETOPT_option_flag ('X', |
1287 | "replay", | 1287 | "replay", |
1288 | gettext_noop ("extract and replay history between message IDs --start and --until"), | 1288 | gettext_noop ("extract and replay history between message IDs --start and --until"), |
1289 | &op_replay), | 1289 | &op_replay), |
@@ -1291,83 +1291,83 @@ main (int argc, char *const *argv) | |||
1291 | 1291 | ||
1292 | /* options */ | 1292 | /* options */ |
1293 | 1293 | ||
1294 | GNUNET_GETOPT_OPTION_STRING ('a', | 1294 | GNUNET_GETOPT_option_string ('a', |
1295 | "app", | 1295 | "app", |
1296 | "APPLICATION_ID", | 1296 | "APPLICATION_ID", |
1297 | gettext_noop ("application ID to use when connecting"), | 1297 | gettext_noop ("application ID to use when connecting"), |
1298 | &opt_app), | 1298 | &opt_app), |
1299 | 1299 | ||
1300 | GNUNET_GETOPT_OPTION_STRING ('d', | 1300 | GNUNET_GETOPT_option_string ('d', |
1301 | "data", | 1301 | "data", |
1302 | "DATA", | 1302 | "DATA", |
1303 | gettext_noop ("message body or state value"), | 1303 | gettext_noop ("message body or state value"), |
1304 | &opt_data), | 1304 | &opt_data), |
1305 | 1305 | ||
1306 | GNUNET_GETOPT_OPTION_STRING ('e', | 1306 | GNUNET_GETOPT_option_string ('e', |
1307 | "ego", | 1307 | "ego", |
1308 | "NAME|PUBKEY", | 1308 | "NAME|PUBKEY", |
1309 | gettext_noop ("name or public key of ego"), | 1309 | gettext_noop ("name or public key of ego"), |
1310 | &opt_ego), | 1310 | &opt_ego), |
1311 | 1311 | ||
1312 | GNUNET_GETOPT_OPTION_SET_ONE ('f', | 1312 | GNUNET_GETOPT_option_flag ('f', |
1313 | "follow", | 1313 | "follow", |
1314 | gettext_noop ("wait for incoming messages"), | 1314 | gettext_noop ("wait for incoming messages"), |
1315 | &opt_follow), | 1315 | &opt_follow), |
1316 | 1316 | ||
1317 | GNUNET_GETOPT_OPTION_STRING ('g', | 1317 | GNUNET_GETOPT_option_string ('g', |
1318 | "gns", | 1318 | "gns", |
1319 | "GNS_NAME", | 1319 | "GNS_NAME", |
1320 | gettext_noop ("GNS name"), | 1320 | gettext_noop ("GNS name"), |
1321 | &opt_gns), | 1321 | &opt_gns), |
1322 | 1322 | ||
1323 | GNUNET_GETOPT_OPTION_STRING ('i', | 1323 | GNUNET_GETOPT_option_string ('i', |
1324 | "peer", | 1324 | "peer", |
1325 | "PEER_ID", | 1325 | "PEER_ID", |
1326 | gettext_noop ("peer ID for --guest-enter"), | 1326 | gettext_noop ("peer ID for --guest-enter"), |
1327 | &opt_peer), | 1327 | &opt_peer), |
1328 | 1328 | ||
1329 | GNUNET_GETOPT_OPTION_STRING ('k', | 1329 | GNUNET_GETOPT_option_string ('k', |
1330 | "name", | 1330 | "name", |
1331 | "VAR_NAME", | 1331 | "VAR_NAME", |
1332 | gettext_noop ("name (key) to query from state"), | 1332 | gettext_noop ("name (key) to query from state"), |
1333 | &opt_name), | 1333 | &opt_name), |
1334 | 1334 | ||
1335 | GNUNET_GETOPT_OPTION_STRING ('m', | 1335 | GNUNET_GETOPT_option_string ('m', |
1336 | "method", | 1336 | "method", |
1337 | "METHOD_NAME", | 1337 | "METHOD_NAME", |
1338 | gettext_noop ("method name"), | 1338 | gettext_noop ("method name"), |
1339 | &opt_method), | 1339 | &opt_method), |
1340 | 1340 | ||
1341 | GNUNET_GETOPT_OPTION_SET_ULONG ('n', | 1341 | GNUNET_GETOPT_option_ulong ('n', |
1342 | "limit", | 1342 | "limit", |
1343 | NULL, | 1343 | NULL, |
1344 | gettext_noop ("number of messages to replay from history"), | 1344 | gettext_noop ("number of messages to replay from history"), |
1345 | &opt_limit), | 1345 | &opt_limit), |
1346 | 1346 | ||
1347 | GNUNET_GETOPT_OPTION_STRING ('p', | 1347 | GNUNET_GETOPT_option_string ('p', |
1348 | "place", | 1348 | "place", |
1349 | "PUBKEY", | 1349 | "PUBKEY", |
1350 | gettext_noop ("key address of place"), | 1350 | gettext_noop ("key address of place"), |
1351 | &opt_place), | 1351 | &opt_place), |
1352 | 1352 | ||
1353 | GNUNET_GETOPT_OPTION_SET_ULONG ('s', | 1353 | GNUNET_GETOPT_option_ulong ('s', |
1354 | "start", | 1354 | "start", |
1355 | NULL, | 1355 | NULL, |
1356 | gettext_noop ("start message ID for history replay"), | 1356 | gettext_noop ("start message ID for history replay"), |
1357 | &opt_start), | 1357 | &opt_start), |
1358 | 1358 | ||
1359 | GNUNET_GETOPT_OPTION_SET_ONE ('w', | 1359 | GNUNET_GETOPT_option_flag ('w', |
1360 | "welcome", | 1360 | "welcome", |
1361 | gettext_noop ("respond to entry requests by admitting all guests"), | 1361 | gettext_noop ("respond to entry requests by admitting all guests"), |
1362 | &opt_welcome), | 1362 | &opt_welcome), |
1363 | 1363 | ||
1364 | GNUNET_GETOPT_OPTION_SET_ULONG ('u', | 1364 | GNUNET_GETOPT_option_ulong ('u', |
1365 | "until", | 1365 | "until", |
1366 | NULL, | 1366 | NULL, |
1367 | gettext_noop ("end message ID for history replay"), | 1367 | gettext_noop ("end message ID for history replay"), |
1368 | &opt_until), | 1368 | &opt_until), |
1369 | 1369 | ||
1370 | GNUNET_GETOPT_OPTION_SET_ONE ('y', | 1370 | GNUNET_GETOPT_option_flag ('y', |
1371 | "deny", | 1371 | "deny", |
1372 | gettext_noop ("respond to entry requests by refusing all guests"), | 1372 | gettext_noop ("respond to entry requests by refusing all guests"), |
1373 | &opt_deny), | 1373 | &opt_deny), |
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c index 6cfc56171..159afda53 100644 --- a/src/statistics/gnunet-statistics.c +++ b/src/statistics/gnunet-statistics.c | |||
@@ -379,39 +379,39 @@ int | |||
379 | main (int argc, char *const *argv) | 379 | main (int argc, char *const *argv) |
380 | { | 380 | { |
381 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 381 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
382 | GNUNET_GETOPT_OPTION_STRING ('n', | 382 | GNUNET_GETOPT_option_string ('n', |
383 | "name", | 383 | "name", |
384 | "NAME", | 384 | "NAME", |
385 | gettext_noop ("limit output to statistics for the given NAME"), | 385 | gettext_noop ("limit output to statistics for the given NAME"), |
386 | &name), | 386 | &name), |
387 | 387 | ||
388 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 388 | GNUNET_GETOPT_option_flag ('p', |
389 | "persistent", | 389 | "persistent", |
390 | gettext_noop ("make the value being set persistent"), | 390 | gettext_noop ("make the value being set persistent"), |
391 | &persistent), | 391 | &persistent), |
392 | 392 | ||
393 | GNUNET_GETOPT_OPTION_STRING ('s', | 393 | GNUNET_GETOPT_option_string ('s', |
394 | "subsystem", | 394 | "subsystem", |
395 | "SUBSYSTEM", | 395 | "SUBSYSTEM", |
396 | gettext_noop ("limit output to the given SUBSYSTEM"), | 396 | gettext_noop ("limit output to the given SUBSYSTEM"), |
397 | &subsystem), | 397 | &subsystem), |
398 | 398 | ||
399 | GNUNET_GETOPT_OPTION_SET_ONE ('q', | 399 | GNUNET_GETOPT_option_flag ('q', |
400 | "quiet", | 400 | "quiet", |
401 | gettext_noop ("just print the statistics value"), | 401 | gettext_noop ("just print the statistics value"), |
402 | &quiet), | 402 | &quiet), |
403 | 403 | ||
404 | GNUNET_GETOPT_OPTION_SET_ONE ('w', | 404 | GNUNET_GETOPT_option_flag ('w', |
405 | "watch", | 405 | "watch", |
406 | gettext_noop ("watch value continuously"), | 406 | gettext_noop ("watch value continuously"), |
407 | &watch), | 407 | &watch), |
408 | 408 | ||
409 | GNUNET_GETOPT_OPTION_STRING ('r', | 409 | GNUNET_GETOPT_option_string ('r', |
410 | "remote", | 410 | "remote", |
411 | "REMOTE", | 411 | "REMOTE", |
412 | gettext_noop ("connect to remote host"), | 412 | gettext_noop ("connect to remote host"), |
413 | &remote_host), | 413 | &remote_host), |
414 | GNUNET_GETOPT_OPTION_SET_ULONG ('o', | 414 | GNUNET_GETOPT_option_ulong ('o', |
415 | "port", | 415 | "port", |
416 | "PORT", | 416 | "PORT", |
417 | gettext_noop ("port for remote host"), | 417 | gettext_noop ("port for remote host"), |
diff --git a/src/testbed/generate-underlay-topology.c b/src/testbed/generate-underlay-topology.c index ab7d81c8b..2e78c60be 100644 --- a/src/testbed/generate-underlay-topology.c +++ b/src/testbed/generate-underlay-topology.c | |||
@@ -336,7 +336,7 @@ main (int argc, char *const argv[]) | |||
336 | { | 336 | { |
337 | struct GNUNET_GETOPT_CommandLineOption option[] = { | 337 | struct GNUNET_GETOPT_CommandLineOption option[] = { |
338 | 338 | ||
339 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 339 | GNUNET_GETOPT_option_uint ('p', |
340 | "num-peers", | 340 | "num-peers", |
341 | "COUNT", | 341 | "COUNT", |
342 | gettext_noop ("create COUNT number of peers"), | 342 | gettext_noop ("create COUNT number of peers"), |
diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 29f77193d..9829bbf0d 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c | |||
@@ -278,19 +278,19 @@ main (int argc, char *const *argv) | |||
278 | { | 278 | { |
279 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 279 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
280 | 280 | ||
281 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | 281 | GNUNET_GETOPT_option_uint ('p', |
282 | "num-peers", | 282 | "num-peers", |
283 | "COUNT", | 283 | "COUNT", |
284 | gettext_noop ("create COUNT number of peers"), | 284 | gettext_noop ("create COUNT number of peers"), |
285 | &num_peers), | 285 | &num_peers), |
286 | 286 | ||
287 | GNUNET_GETOPT_OPTION_SET_UINT ('e', | 287 | GNUNET_GETOPT_option_uint ('e', |
288 | "num-errors", | 288 | "num-errors", |
289 | "COUNT", | 289 | "COUNT", |
290 | gettext_noop ("tolerate COUNT number of continious timeout failures"), | 290 | gettext_noop ("tolerate COUNT number of continious timeout failures"), |
291 | &num_cont_fails), | 291 | &num_cont_fails), |
292 | 292 | ||
293 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 293 | GNUNET_GETOPT_option_flag ('n', |
294 | "non-interactive", | 294 | "non-interactive", |
295 | gettext_noop ("run profiler in non-interactive mode where upon " | 295 | gettext_noop ("run profiler in non-interactive mode where upon " |
296 | "testbed setup the profiler does not wait for a " | 296 | "testbed setup the profiler does not wait for a " |
@@ -299,7 +299,7 @@ main (int argc, char *const *argv) | |||
299 | &noninteractive), | 299 | &noninteractive), |
300 | 300 | ||
301 | #if !ENABLE_SUPERMUC | 301 | #if !ENABLE_SUPERMUC |
302 | GNUNET_GETOPT_OPTION_STRING ('H', | 302 | GNUNET_GETOPT_option_string ('H', |
303 | "hosts", | 303 | "hosts", |
304 | "FILENAME", | 304 | "FILENAME", |
305 | gettext_noop ("name of the file with the login information for the testbed"), | 305 | gettext_noop ("name of the file with the login information for the testbed"), |
diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index 686b38192..3dbe65883 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c | |||
@@ -349,30 +349,30 @@ int | |||
349 | main (int argc, char *const *argv) | 349 | main (int argc, char *const *argv) |
350 | { | 350 | { |
351 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 351 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
352 | GNUNET_GETOPT_OPTION_SET_ONE ('C', | 352 | GNUNET_GETOPT_option_flag ('C', |
353 | "cfg", | 353 | "cfg", |
354 | gettext_noop ("create unique configuration files"), | 354 | gettext_noop ("create unique configuration files"), |
355 | &create_cfg), | 355 | &create_cfg), |
356 | GNUNET_GETOPT_OPTION_STRING ('k', | 356 | GNUNET_GETOPT_option_string ('k', |
357 | "key", | 357 | "key", |
358 | "FILENAME", | 358 | "FILENAME", |
359 | gettext_noop ("extract hostkey file from pre-computed hostkey list"), | 359 | gettext_noop ("extract hostkey file from pre-computed hostkey list"), |
360 | &create_hostkey), | 360 | &create_hostkey), |
361 | 361 | ||
362 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 362 | GNUNET_GETOPT_option_uint ('n', |
363 | "number", | 363 | "number", |
364 | "NUMBER", | 364 | "NUMBER", |
365 | gettext_noop ("number of unique configuration files to create, or number of the hostkey to extract"), | 365 | gettext_noop ("number of unique configuration files to create, or number of the hostkey to extract"), |
366 | &create_no), | 366 | &create_no), |
367 | 367 | ||
368 | 368 | ||
369 | GNUNET_GETOPT_OPTION_STRING ('t', | 369 | GNUNET_GETOPT_option_string ('t', |
370 | "template", | 370 | "template", |
371 | "FILENAME", | 371 | "FILENAME", |
372 | gettext_noop ("configuration template"), | 372 | gettext_noop ("configuration template"), |
373 | &create_cfg_template), | 373 | &create_cfg_template), |
374 | 374 | ||
375 | GNUNET_GETOPT_OPTION_STRING ('r', | 375 | GNUNET_GETOPT_option_string ('r', |
376 | "run", | 376 | "run", |
377 | "SERVICE", | 377 | "SERVICE", |
378 | gettext_noop ("run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"), | 378 | gettext_noop ("run the given service, wait on stdin for 'r' (restart) or 'q' (quit)"), |
diff --git a/src/testing/list-keys.c b/src/testing/list-keys.c index cfb49460a..9210486d3 100644 --- a/src/testing/list-keys.c +++ b/src/testing/list-keys.c | |||
@@ -83,7 +83,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
83 | int main (int argc, char *argv[]) | 83 | int main (int argc, char *argv[]) |
84 | { | 84 | { |
85 | struct GNUNET_GETOPT_CommandLineOption option[] = { | 85 | struct GNUNET_GETOPT_CommandLineOption option[] = { |
86 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 86 | GNUNET_GETOPT_option_uint ('n', |
87 | "num-keys", | 87 | "num-keys", |
88 | "COUNT", | 88 | "COUNT", |
89 | gettext_noop ("list COUNT number of keys"), | 89 | gettext_noop ("list COUNT number of keys"), |
diff --git a/src/transport/gnunet-transport-profiler.c b/src/transport/gnunet-transport-profiler.c index 9292c42d4..d580fce08 100644 --- a/src/transport/gnunet-transport-profiler.c +++ b/src/transport/gnunet-transport-profiler.c | |||
@@ -612,35 +612,35 @@ main (int argc, char * const *argv) | |||
612 | 612 | ||
613 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 613 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
614 | 614 | ||
615 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 615 | GNUNET_GETOPT_option_flag ('s', |
616 | "send", | 616 | "send", |
617 | gettext_noop ("send data to peer"), | 617 | gettext_noop ("send data to peer"), |
618 | &benchmark_send), | 618 | &benchmark_send), |
619 | GNUNET_GETOPT_OPTION_SET_ONE ('r', | 619 | GNUNET_GETOPT_option_flag ('r', |
620 | "receive", | 620 | "receive", |
621 | gettext_noop ("receive data from peer"), | 621 | gettext_noop ("receive data from peer"), |
622 | &benchmark_receive), | 622 | &benchmark_receive), |
623 | GNUNET_GETOPT_OPTION_SET_UINT ('i', | 623 | GNUNET_GETOPT_option_uint ('i', |
624 | "iterations", | 624 | "iterations", |
625 | NULL, | 625 | NULL, |
626 | gettext_noop ("iterations"), | 626 | gettext_noop ("iterations"), |
627 | &benchmark_iterations), | 627 | &benchmark_iterations), |
628 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 628 | GNUNET_GETOPT_option_uint ('n', |
629 | "number", | 629 | "number", |
630 | NULL, | 630 | NULL, |
631 | gettext_noop ("number of messages to send"), | 631 | gettext_noop ("number of messages to send"), |
632 | &benchmark_count), | 632 | &benchmark_count), |
633 | GNUNET_GETOPT_OPTION_SET_UINT ('m', | 633 | GNUNET_GETOPT_option_uint ('m', |
634 | "messagesize", | 634 | "messagesize", |
635 | NULL, | 635 | NULL, |
636 | gettext_noop ("message size to use"), | 636 | gettext_noop ("message size to use"), |
637 | &benchmark_size), | 637 | &benchmark_size), |
638 | GNUNET_GETOPT_OPTION_STRING ('p', | 638 | GNUNET_GETOPT_option_string ('p', |
639 | "peer", | 639 | "peer", |
640 | "PEER", | 640 | "PEER", |
641 | gettext_noop ("peer identity"), | 641 | gettext_noop ("peer identity"), |
642 | &cpid), | 642 | &cpid), |
643 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 643 | GNUNET_GETOPT_option_verbose (&verbosity), |
644 | GNUNET_GETOPT_OPTION_END | 644 | GNUNET_GETOPT_OPTION_END |
645 | }; | 645 | }; |
646 | 646 | ||
diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index 8624b09b4..96d0a6a3a 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c | |||
@@ -1428,49 +1428,49 @@ main (int argc, | |||
1428 | { | 1428 | { |
1429 | int res; | 1429 | int res; |
1430 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1430 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1431 | GNUNET_GETOPT_OPTION_SET_ONE ('a', | 1431 | GNUNET_GETOPT_option_flag ('a', |
1432 | "all", | 1432 | "all", |
1433 | gettext_noop ("print information for all peers (instead of only connected peers)"), | 1433 | gettext_noop ("print information for all peers (instead of only connected peers)"), |
1434 | &iterate_all), | 1434 | &iterate_all), |
1435 | GNUNET_GETOPT_OPTION_SET_ONE ('b', | 1435 | GNUNET_GETOPT_option_flag ('b', |
1436 | "benchmark", | 1436 | "benchmark", |
1437 | gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"), | 1437 | gettext_noop ("measure how fast we are receiving data from all peers (until CTRL-C)"), |
1438 | &benchmark_receive), | 1438 | &benchmark_receive), |
1439 | GNUNET_GETOPT_OPTION_SET_ONE ('D', | 1439 | GNUNET_GETOPT_option_flag ('D', |
1440 | "disconnect", | 1440 | "disconnect", |
1441 | gettext_noop ("disconnect from a peer"), | 1441 | gettext_noop ("disconnect from a peer"), |
1442 | &do_disconnect), | 1442 | &do_disconnect), |
1443 | GNUNET_GETOPT_OPTION_SET_ONE ('i', | 1443 | GNUNET_GETOPT_option_flag ('i', |
1444 | "information", | 1444 | "information", |
1445 | gettext_noop ("provide information about all current connections (once)"), | 1445 | gettext_noop ("provide information about all current connections (once)"), |
1446 | &iterate_connections), | 1446 | &iterate_connections), |
1447 | GNUNET_GETOPT_OPTION_SET_ONE ('m', | 1447 | GNUNET_GETOPT_option_flag ('m', |
1448 | "monitor", | 1448 | "monitor", |
1449 | gettext_noop ("provide information about all current connections (continuously)"), | 1449 | gettext_noop ("provide information about all current connections (continuously)"), |
1450 | &monitor_connections), | 1450 | &monitor_connections), |
1451 | GNUNET_GETOPT_OPTION_SET_ONE ('e', | 1451 | GNUNET_GETOPT_option_flag ('e', |
1452 | "events", | 1452 | "events", |
1453 | gettext_noop ("provide information about all connects and disconnect events (continuously)"), | 1453 | gettext_noop ("provide information about all connects and disconnect events (continuously)"), |
1454 | &monitor_connects), | 1454 | &monitor_connects), |
1455 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 1455 | GNUNET_GETOPT_option_flag ('n', |
1456 | "numeric", | 1456 | "numeric", |
1457 | gettext_noop ("do not resolve hostnames"), | 1457 | gettext_noop ("do not resolve hostnames"), |
1458 | &numeric), | 1458 | &numeric), |
1459 | GNUNET_GETOPT_OPTION_SET_BASE32_AUTO ('p', | 1459 | GNUNET_GETOPT_option_base32_auto ('p', |
1460 | "peer", | 1460 | "peer", |
1461 | "PEER", | 1461 | "PEER", |
1462 | gettext_noop ("peer identity"), | 1462 | gettext_noop ("peer identity"), |
1463 | &pid), | 1463 | &pid), |
1464 | GNUNET_GETOPT_OPTION_SET_ONE ('P', | 1464 | GNUNET_GETOPT_option_flag ('P', |
1465 | "plugins", | 1465 | "plugins", |
1466 | gettext_noop ("monitor plugin sessions"), | 1466 | gettext_noop ("monitor plugin sessions"), |
1467 | &monitor_plugins), | 1467 | &monitor_plugins), |
1468 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | 1468 | GNUNET_GETOPT_option_flag ('s', |
1469 | "send", | 1469 | "send", |
1470 | gettext_noop | 1470 | gettext_noop |
1471 | ("send data for benchmarking to the other peer (until CTRL-C)"), | 1471 | ("send data for benchmarking to the other peer (until CTRL-C)"), |
1472 | &benchmark_send), | 1472 | &benchmark_send), |
1473 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 1473 | GNUNET_GETOPT_option_verbose (&verbosity), |
1474 | GNUNET_GETOPT_OPTION_END | 1474 | GNUNET_GETOPT_OPTION_END |
1475 | }; | 1475 | }; |
1476 | 1476 | ||
diff --git a/src/transport/tcp_service_legacy.c b/src/transport/tcp_service_legacy.c index 7c2d3e55a..1f1f6c063 100644 --- a/src/transport/tcp_service_legacy.c +++ b/src/transport/tcp_service_legacy.c | |||
@@ -1392,15 +1392,15 @@ LEGACY_SERVICE_run (int argc, char *const *argv, | |||
1392 | const char *xdg; | 1392 | const char *xdg; |
1393 | 1393 | ||
1394 | struct GNUNET_GETOPT_CommandLineOption service_options[] = { | 1394 | struct GNUNET_GETOPT_CommandLineOption service_options[] = { |
1395 | GNUNET_GETOPT_OPTION_CFG_FILE (&opt_cfg_fn), | 1395 | GNUNET_GETOPT_option_cfgfile (&opt_cfg_fn), |
1396 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 1396 | GNUNET_GETOPT_option_flag ('d', |
1397 | "daemonize", | 1397 | "daemonize", |
1398 | gettext_noop ("do daemonize (detach from terminal)"), | 1398 | gettext_noop ("do daemonize (detach from terminal)"), |
1399 | &do_daemonize), | 1399 | &do_daemonize), |
1400 | GNUNET_GETOPT_OPTION_HELP (NULL), | 1400 | GNUNET_GETOPT_option_help (NULL), |
1401 | GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev), | 1401 | GNUNET_GETOPT_option_loglevel (&loglev), |
1402 | GNUNET_GETOPT_OPTION_LOGFILE (&logfile), | 1402 | GNUNET_GETOPT_option_logfile (&logfile), |
1403 | GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION), | 1403 | GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION), |
1404 | GNUNET_GETOPT_OPTION_END | 1404 | GNUNET_GETOPT_OPTION_END |
1405 | }; | 1405 | }; |
1406 | err = 1; | 1406 | err = 1; |
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index 76342a6c9..c3d0e4c7c 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -60,7 +60,7 @@ print_version (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
60 | * @param version string with the version number | 60 | * @param version string with the version number |
61 | */ | 61 | */ |
62 | struct GNUNET_GETOPT_CommandLineOption | 62 | struct GNUNET_GETOPT_CommandLineOption |
63 | GNUNET_GETOPT_OPTION_VERSION (const char *version) | 63 | GNUNET_GETOPT_option_version (const char *version) |
64 | { | 64 | { |
65 | struct GNUNET_GETOPT_CommandLineOption clo = { | 65 | struct GNUNET_GETOPT_CommandLineOption clo = { |
66 | .shortName = 'v', | 66 | .shortName = 'v', |
@@ -191,7 +191,7 @@ OUTER: | |||
191 | * @param about string with brief description of the application | 191 | * @param about string with brief description of the application |
192 | */ | 192 | */ |
193 | struct GNUNET_GETOPT_CommandLineOption | 193 | struct GNUNET_GETOPT_CommandLineOption |
194 | GNUNET_GETOPT_OPTION_HELP (const char *about) | 194 | GNUNET_GETOPT_option_help (const char *about) |
195 | { | 195 | { |
196 | struct GNUNET_GETOPT_CommandLineOption clo = { | 196 | struct GNUNET_GETOPT_CommandLineOption clo = { |
197 | .shortName = 'h', | 197 | .shortName = 'h', |
@@ -242,7 +242,7 @@ increment_value (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
242 | * @param[out] val increment by 1 each time the option is present | 242 | * @param[out] val increment by 1 each time the option is present |
243 | */ | 243 | */ |
244 | struct GNUNET_GETOPT_CommandLineOption | 244 | struct GNUNET_GETOPT_CommandLineOption |
245 | GNUNET_GETOPT_OPTION_INCREMENT_VALUE (char shortName, | 245 | GNUNET_GETOPT_option_increment_uint (char shortName, |
246 | const char *name, | 246 | const char *name, |
247 | const char *description, | 247 | const char *description, |
248 | unsigned int *val) | 248 | unsigned int *val) |
@@ -266,7 +266,7 @@ GNUNET_GETOPT_OPTION_INCREMENT_VALUE (char shortName, | |||
266 | * @param[out] level set to the verbosity level | 266 | * @param[out] level set to the verbosity level |
267 | */ | 267 | */ |
268 | struct GNUNET_GETOPT_CommandLineOption | 268 | struct GNUNET_GETOPT_CommandLineOption |
269 | GNUNET_GETOPT_OPTION_VERBOSE (unsigned int *level) | 269 | GNUNET_GETOPT_option_verbose (unsigned int *level) |
270 | { | 270 | { |
271 | struct GNUNET_GETOPT_CommandLineOption clo = { | 271 | struct GNUNET_GETOPT_CommandLineOption clo = { |
272 | .shortName = 'V', | 272 | .shortName = 'V', |
@@ -318,7 +318,7 @@ set_one (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
318 | * @param[out] val set to 1 if the option is present | 318 | * @param[out] val set to 1 if the option is present |
319 | */ | 319 | */ |
320 | struct GNUNET_GETOPT_CommandLineOption | 320 | struct GNUNET_GETOPT_CommandLineOption |
321 | GNUNET_GETOPT_OPTION_SET_ONE (char shortName, | 321 | GNUNET_GETOPT_option_flag (char shortName, |
322 | const char *name, | 322 | const char *name, |
323 | const char *description, | 323 | const char *description, |
324 | int *val) | 324 | int *val) |
@@ -374,7 +374,7 @@ set_string (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
374 | * @param[out] str set to the string | 374 | * @param[out] str set to the string |
375 | */ | 375 | */ |
376 | struct GNUNET_GETOPT_CommandLineOption | 376 | struct GNUNET_GETOPT_CommandLineOption |
377 | GNUNET_GETOPT_OPTION_STRING (char shortName, | 377 | GNUNET_GETOPT_option_string (char shortName, |
378 | const char *name, | 378 | const char *name, |
379 | const char *argumentHelp, | 379 | const char *argumentHelp, |
380 | const char *description, | 380 | const char *description, |
@@ -401,7 +401,7 @@ GNUNET_GETOPT_OPTION_STRING (char shortName, | |||
401 | * @param[out] level set to the log level | 401 | * @param[out] level set to the log level |
402 | */ | 402 | */ |
403 | struct GNUNET_GETOPT_CommandLineOption | 403 | struct GNUNET_GETOPT_CommandLineOption |
404 | GNUNET_GETOPT_OPTION_LOGLEVEL (char **level) | 404 | GNUNET_GETOPT_option_loglevel (char **level) |
405 | { | 405 | { |
406 | struct GNUNET_GETOPT_CommandLineOption clo = { | 406 | struct GNUNET_GETOPT_CommandLineOption clo = { |
407 | .shortName = 'L', | 407 | .shortName = 'L', |
@@ -453,7 +453,7 @@ set_filename (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
453 | * @param[out] str set to the string | 453 | * @param[out] str set to the string |
454 | */ | 454 | */ |
455 | struct GNUNET_GETOPT_CommandLineOption | 455 | struct GNUNET_GETOPT_CommandLineOption |
456 | GNUNET_GETOPT_OPTION_FILENAME (char shortName, | 456 | GNUNET_GETOPT_option_filename (char shortName, |
457 | const char *name, | 457 | const char *name, |
458 | const char *argumentHelp, | 458 | const char *argumentHelp, |
459 | const char *description, | 459 | const char *description, |
@@ -479,7 +479,7 @@ GNUNET_GETOPT_OPTION_FILENAME (char shortName, | |||
479 | * @param[out] logfn set to the name of the logfile | 479 | * @param[out] logfn set to the name of the logfile |
480 | */ | 480 | */ |
481 | struct GNUNET_GETOPT_CommandLineOption | 481 | struct GNUNET_GETOPT_CommandLineOption |
482 | GNUNET_GETOPT_OPTION_LOGFILE (char **logfn) | 482 | GNUNET_GETOPT_option_logfile (char **logfn) |
483 | { | 483 | { |
484 | struct GNUNET_GETOPT_CommandLineOption clo = { | 484 | struct GNUNET_GETOPT_CommandLineOption clo = { |
485 | .shortName = 'l', | 485 | .shortName = 'l', |
@@ -501,7 +501,7 @@ GNUNET_GETOPT_OPTION_LOGFILE (char **logfn) | |||
501 | * @param[out] fn set to the name of the configuration file | 501 | * @param[out] fn set to the name of the configuration file |
502 | */ | 502 | */ |
503 | struct GNUNET_GETOPT_CommandLineOption | 503 | struct GNUNET_GETOPT_CommandLineOption |
504 | GNUNET_GETOPT_OPTION_CFG_FILE (char **fn) | 504 | GNUNET_GETOPT_option_cfgfile (char **fn) |
505 | { | 505 | { |
506 | struct GNUNET_GETOPT_CommandLineOption clo = { | 506 | struct GNUNET_GETOPT_CommandLineOption clo = { |
507 | .shortName = 'c', | 507 | .shortName = 'c', |
@@ -561,7 +561,7 @@ set_ulong (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
561 | * @param[out] val set to the value specified at the command line | 561 | * @param[out] val set to the value specified at the command line |
562 | */ | 562 | */ |
563 | struct GNUNET_GETOPT_CommandLineOption | 563 | struct GNUNET_GETOPT_CommandLineOption |
564 | GNUNET_GETOPT_OPTION_SET_ULONG (char shortName, | 564 | GNUNET_GETOPT_option_ulong (char shortName, |
565 | const char *name, | 565 | const char *name, |
566 | const char *argumentHelp, | 566 | const char *argumentHelp, |
567 | const char *description, | 567 | const char *description, |
@@ -626,7 +626,7 @@ set_relative_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
626 | * @param[out] val set to the time specified at the command line | 626 | * @param[out] val set to the time specified at the command line |
627 | */ | 627 | */ |
628 | struct GNUNET_GETOPT_CommandLineOption | 628 | struct GNUNET_GETOPT_CommandLineOption |
629 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME (char shortName, | 629 | GNUNET_GETOPT_option_relative_time (char shortName, |
630 | const char *name, | 630 | const char *name, |
631 | const char *argumentHelp, | 631 | const char *argumentHelp, |
632 | const char *description, | 632 | const char *description, |
@@ -691,7 +691,7 @@ set_absolute_time (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
691 | * @param[out] val set to the time specified at the command line | 691 | * @param[out] val set to the time specified at the command line |
692 | */ | 692 | */ |
693 | struct GNUNET_GETOPT_CommandLineOption | 693 | struct GNUNET_GETOPT_CommandLineOption |
694 | GNUNET_GETOPT_OPTION_SET_ABSOLUTE_TIME (char shortName, | 694 | GNUNET_GETOPT_option_absolute_time (char shortName, |
695 | const char *name, | 695 | const char *name, |
696 | const char *argumentHelp, | 696 | const char *argumentHelp, |
697 | const char *description, | 697 | const char *description, |
@@ -755,7 +755,7 @@ set_uint (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
755 | * @param[out] val set to the value specified at the command line | 755 | * @param[out] val set to the value specified at the command line |
756 | */ | 756 | */ |
757 | struct GNUNET_GETOPT_CommandLineOption | 757 | struct GNUNET_GETOPT_CommandLineOption |
758 | GNUNET_GETOPT_OPTION_SET_UINT (char shortName, | 758 | GNUNET_GETOPT_option_uint (char shortName, |
759 | const char *name, | 759 | const char *name, |
760 | const char *argumentHelp, | 760 | const char *argumentHelp, |
761 | const char *description, | 761 | const char *description, |
@@ -830,7 +830,7 @@ set_base32 (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | |||
830 | 830 | ||
831 | /** | 831 | /** |
832 | * Helper function to clean up after | 832 | * Helper function to clean up after |
833 | * #GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE. | 833 | * #GNUNET_GETOPT_option_base32_fixed_size. |
834 | * | 834 | * |
835 | * @param cls value to GNUNET_free() | 835 | * @param cls value to GNUNET_free() |
836 | */ | 836 | */ |
@@ -853,7 +853,7 @@ free_bc (void *cls) | |||
853 | * @param val_size size of @a val in bytes | 853 | * @param val_size size of @a val in bytes |
854 | */ | 854 | */ |
855 | struct GNUNET_GETOPT_CommandLineOption | 855 | struct GNUNET_GETOPT_CommandLineOption |
856 | GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, | 856 | GNUNET_GETOPT_option_base32_fixed_size (char shortName, |
857 | const char *name, | 857 | const char *name, |
858 | const char *argumentHelp, | 858 | const char *argumentHelp, |
859 | const char *description, | 859 | const char *description, |
@@ -885,7 +885,7 @@ GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName, | |||
885 | * @return @a opt with the mandatory flag set. | 885 | * @return @a opt with the mandatory flag set. |
886 | */ | 886 | */ |
887 | struct GNUNET_GETOPT_CommandLineOption | 887 | struct GNUNET_GETOPT_CommandLineOption |
888 | GNUNET_GETOPT_OPTION_MANDATORY (struct GNUNET_GETOPT_CommandLineOption opt) | 888 | GNUNET_GETOPT_option_mandatory (struct GNUNET_GETOPT_CommandLineOption opt) |
889 | { | 889 | { |
890 | opt.option_mandatory = 1; | 890 | opt.option_mandatory = 1; |
891 | return opt; | 891 | return opt; |
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c index 2beb772a9..fb3b9ebf9 100644 --- a/src/util/gnunet-config.c +++ b/src/util/gnunet-config.c | |||
@@ -224,30 +224,30 @@ int | |||
224 | main (int argc, char *const *argv) | 224 | main (int argc, char *const *argv) |
225 | { | 225 | { |
226 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 226 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
227 | GNUNET_GETOPT_OPTION_SET_ONE ('f', | 227 | GNUNET_GETOPT_option_flag ('f', |
228 | "filename", | 228 | "filename", |
229 | gettext_noop ("obtain option of value as a filename (with $-expansion)"), | 229 | gettext_noop ("obtain option of value as a filename (with $-expansion)"), |
230 | &is_filename), | 230 | &is_filename), |
231 | GNUNET_GETOPT_OPTION_STRING ('s', | 231 | GNUNET_GETOPT_option_string ('s', |
232 | "section", | 232 | "section", |
233 | "SECTION", | 233 | "SECTION", |
234 | gettext_noop ("name of the section to access"), | 234 | gettext_noop ("name of the section to access"), |
235 | §ion), | 235 | §ion), |
236 | GNUNET_GETOPT_OPTION_STRING ('o', | 236 | GNUNET_GETOPT_option_string ('o', |
237 | "option", | 237 | "option", |
238 | "OPTION", | 238 | "OPTION", |
239 | gettext_noop ("name of the option to access"), | 239 | gettext_noop ("name of the option to access"), |
240 | &option), | 240 | &option), |
241 | GNUNET_GETOPT_OPTION_STRING ('V', | 241 | GNUNET_GETOPT_option_string ('V', |
242 | "value", | 242 | "value", |
243 | "VALUE", | 243 | "VALUE", |
244 | gettext_noop ("value to set"), | 244 | gettext_noop ("value to set"), |
245 | &value), | 245 | &value), |
246 | GNUNET_GETOPT_OPTION_SET_ONE ('S', | 246 | GNUNET_GETOPT_option_flag ('S', |
247 | "list-sections", | 247 | "list-sections", |
248 | gettext_noop ("print available configuration sections"), | 248 | gettext_noop ("print available configuration sections"), |
249 | &list_sections), | 249 | &list_sections), |
250 | GNUNET_GETOPT_OPTION_SET_ONE ('w', | 250 | GNUNET_GETOPT_option_flag ('w', |
251 | "rewrite", | 251 | "rewrite", |
252 | gettext_noop ("write configuration file that only contains delta to defaults"), | 252 | gettext_noop ("write configuration file that only contains delta to defaults"), |
253 | &rewrite), | 253 | &rewrite), |
diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 732228b52..2a712f4eb 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c | |||
@@ -411,25 +411,25 @@ main (int argc, | |||
411 | { | 411 | { |
412 | list_keys_count = UINT32_MAX; | 412 | list_keys_count = UINT32_MAX; |
413 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 413 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
414 | GNUNET_GETOPT_OPTION_SET_ONE ('i', | 414 | GNUNET_GETOPT_option_flag ('i', |
415 | "iterate", | 415 | "iterate", |
416 | gettext_noop ("list keys included in a file (for testing)"), | 416 | gettext_noop ("list keys included in a file (for testing)"), |
417 | &list_keys), | 417 | &list_keys), |
418 | GNUNET_GETOPT_OPTION_SET_UINT ('e', | 418 | GNUNET_GETOPT_option_uint ('e', |
419 | "end=", | 419 | "end=", |
420 | "COUNT", | 420 | "COUNT", |
421 | gettext_noop ("number of keys to list included in a file (for testing)"), | 421 | gettext_noop ("number of keys to list included in a file (for testing)"), |
422 | &list_keys_count), | 422 | &list_keys_count), |
423 | GNUNET_GETOPT_OPTION_SET_UINT ('g', | 423 | GNUNET_GETOPT_option_uint ('g', |
424 | "generate-keys", | 424 | "generate-keys", |
425 | "COUNT", | 425 | "COUNT", |
426 | gettext_noop ("create COUNT public-private key pairs (for testing)"), | 426 | gettext_noop ("create COUNT public-private key pairs (for testing)"), |
427 | &make_keys), | 427 | &make_keys), |
428 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | 428 | GNUNET_GETOPT_option_flag ('p', |
429 | "print-public-key", | 429 | "print-public-key", |
430 | gettext_noop ("print the public key in ASCII format"), | 430 | gettext_noop ("print the public key in ASCII format"), |
431 | &print_public_key), | 431 | &print_public_key), |
432 | GNUNET_GETOPT_OPTION_SET_ONE ('E', | 432 | GNUNET_GETOPT_option_flag ('E', |
433 | "examples", | 433 | "examples", |
434 | gettext_noop ("print examples of ECC operations (used for compatibility testing)"), | 434 | gettext_noop ("print examples of ECC operations (used for compatibility testing)"), |
435 | &print_examples_flag), | 435 | &print_examples_flag), |
diff --git a/src/util/gnunet-resolver.c b/src/util/gnunet-resolver.c index 563cf9fce..7ffafee32 100644 --- a/src/util/gnunet-resolver.c +++ b/src/util/gnunet-resolver.c | |||
@@ -145,7 +145,7 @@ int | |||
145 | main (int argc, char *const *argv) | 145 | main (int argc, char *const *argv) |
146 | { | 146 | { |
147 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 147 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
148 | GNUNET_GETOPT_OPTION_SET_ONE ('r', | 148 | GNUNET_GETOPT_option_flag ('r', |
149 | "reverse", | 149 | "reverse", |
150 | gettext_noop ("perform a reverse lookup"), | 150 | gettext_noop ("perform a reverse lookup"), |
151 | &reverse), | 151 | &reverse), |
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 7c73cfe1e..3b3b7d695 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c | |||
@@ -311,22 +311,22 @@ main (int argc, | |||
311 | char *const *argv) | 311 | char *const *argv) |
312 | { | 312 | { |
313 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 313 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
314 | GNUNET_GETOPT_OPTION_SET_ULONG ('b', | 314 | GNUNET_GETOPT_option_ulong ('b', |
315 | "bits", | 315 | "bits", |
316 | "BITS", | 316 | "BITS", |
317 | gettext_noop ("number of bits to require for the proof of work"), | 317 | gettext_noop ("number of bits to require for the proof of work"), |
318 | &nse_work_required), | 318 | &nse_work_required), |
319 | GNUNET_GETOPT_OPTION_FILENAME ('k', | 319 | GNUNET_GETOPT_option_filename ('k', |
320 | "keyfile", | 320 | "keyfile", |
321 | "FILE", | 321 | "FILE", |
322 | gettext_noop ("file with private key, otherwise default is used"), | 322 | gettext_noop ("file with private key, otherwise default is used"), |
323 | &pkfn), | 323 | &pkfn), |
324 | GNUNET_GETOPT_OPTION_FILENAME ('o', | 324 | GNUNET_GETOPT_option_filename ('o', |
325 | "outfile", | 325 | "outfile", |
326 | "FILE", | 326 | "FILE", |
327 | gettext_noop ("file with proof of work, otherwise default is used"), | 327 | gettext_noop ("file with proof of work, otherwise default is used"), |
328 | &pwfn), | 328 | &pwfn), |
329 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('t', | 329 | GNUNET_GETOPT_option_relative_time ('t', |
330 | "timeout", | 330 | "timeout", |
331 | "TIME", | 331 | "TIME", |
332 | gettext_noop ("time to wait between calculations"), | 332 | gettext_noop ("time to wait between calculations"), |
diff --git a/src/util/network.c b/src/util/network.c index c82caafd9..66a468e45 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -1697,6 +1697,64 @@ initialize_select_thread () | |||
1697 | 1697 | ||
1698 | #endif | 1698 | #endif |
1699 | 1699 | ||
1700 | /** | ||
1701 | * Test if the given @a port is available. | ||
1702 | * | ||
1703 | * @param ipproto transport protocol to test (i.e. IPPROTO_TCP) | ||
1704 | * @param port port number to test | ||
1705 | * @return #GNUNET_OK if the port is available, #GNUNET_NO if not | ||
1706 | */ | ||
1707 | int | ||
1708 | GNUNET_NETWORK_test_port_free (int ipproto, | ||
1709 | uint16_t port) | ||
1710 | { | ||
1711 | struct GNUNET_NETWORK_Handle *socket; | ||
1712 | int bind_status; | ||
1713 | int socktype; | ||
1714 | char open_port_str[6]; | ||
1715 | struct addrinfo hint; | ||
1716 | struct addrinfo *ret; | ||
1717 | struct addrinfo *ai; | ||
1718 | |||
1719 | GNUNET_snprintf (open_port_str, | ||
1720 | sizeof (open_port_str), | ||
1721 | "%u", | ||
1722 | (unsigned int) port); | ||
1723 | socktype = (IPPROTO_TCP == ipproto) | ||
1724 | ? SOCK_STREAM | ||
1725 | : SOCK_DGRAM; | ||
1726 | ret = NULL; | ||
1727 | memset (&hint, 0, sizeof (hint)); | ||
1728 | hint.ai_family = AF_UNSPEC; /* IPv4 and IPv6 */ | ||
1729 | hint.ai_socktype = socktype; | ||
1730 | hint.ai_protocol = ipproto; | ||
1731 | hint.ai_addrlen = 0; | ||
1732 | hint.ai_addr = NULL; | ||
1733 | hint.ai_canonname = NULL; | ||
1734 | hint.ai_next = NULL; | ||
1735 | hint.ai_flags = AI_PASSIVE | AI_NUMERICSERV; /* Wild card address */ | ||
1736 | GNUNET_assert (0 == getaddrinfo (NULL, | ||
1737 | open_port_str, | ||
1738 | &hint, | ||
1739 | &ret)); | ||
1740 | for (ai = ret; NULL != ai; ai = ai->ai_next) | ||
1741 | { | ||
1742 | socket = GNUNET_NETWORK_socket_create (ai->ai_family, | ||
1743 | ai->ai_socktype, | ||
1744 | ai->ai_protocol); | ||
1745 | if (NULL == socket) | ||
1746 | continue; | ||
1747 | bind_status = GNUNET_NETWORK_socket_bind (socket, | ||
1748 | ai->ai_addr, | ||
1749 | ai->ai_addrlen); | ||
1750 | GNUNET_NETWORK_socket_close (socket); | ||
1751 | if (GNUNET_OK != bind_status) | ||
1752 | break; | ||
1753 | } | ||
1754 | freeaddrinfo (ret); | ||
1755 | return bind_status; | ||
1756 | } | ||
1757 | |||
1700 | 1758 | ||
1701 | #ifndef MINGW | 1759 | #ifndef MINGW |
1702 | /** | 1760 | /** |
diff --git a/src/util/program.c b/src/util/program.c index e2b356f88..92a9750f3 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -148,11 +148,11 @@ GNUNET_PROGRAM_run2 (int argc, char *const *argv, const char *binaryName, | |||
148 | struct GNUNET_CONFIGURATION_Handle *cfg; | 148 | struct GNUNET_CONFIGURATION_Handle *cfg; |
149 | 149 | ||
150 | struct GNUNET_GETOPT_CommandLineOption defoptions[] = { | 150 | struct GNUNET_GETOPT_CommandLineOption defoptions[] = { |
151 | GNUNET_GETOPT_OPTION_CFG_FILE (&cc.cfgfile), | 151 | GNUNET_GETOPT_option_cfgfile (&cc.cfgfile), |
152 | GNUNET_GETOPT_OPTION_HELP (binaryHelp), | 152 | GNUNET_GETOPT_option_help (binaryHelp), |
153 | GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev), | 153 | GNUNET_GETOPT_option_loglevel (&loglev), |
154 | GNUNET_GETOPT_OPTION_LOGFILE (&logfile), | 154 | GNUNET_GETOPT_option_logfile (&logfile), |
155 | GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION) | 155 | GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION) |
156 | }; | 156 | }; |
157 | struct GNUNET_GETOPT_CommandLineOption *allopts; | 157 | struct GNUNET_GETOPT_CommandLineOption *allopts; |
158 | const char *gargs; | 158 | const char *gargs; |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 409a0942f..a7b1d8e2a 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2009-2016 GNUnet e.V. | 3 | Copyright (C) 2009-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -17,7 +17,6 @@ | |||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file util/scheduler.c | 21 | * @file util/scheduler.c |
23 | * @brief schedule computations using continuation passing style | 22 | * @brief schedule computations using continuation passing style |
@@ -71,6 +70,35 @@ | |||
71 | 70 | ||
72 | 71 | ||
73 | /** | 72 | /** |
73 | * Argument to be passed from the driver to | ||
74 | * #GNUNET_SCHEDULER_run_from_driver(). Contains the | ||
75 | * scheduler's internal state. | ||
76 | */ | ||
77 | struct GNUNET_SCHEDULER_Handle | ||
78 | { | ||
79 | /** | ||
80 | * Passed here to avoid constantly allocating/deallocating | ||
81 | * this element, but generally we want to get rid of this. | ||
82 | * @deprecated | ||
83 | */ | ||
84 | struct GNUNET_NETWORK_FDSet *rs; | ||
85 | |||
86 | /** | ||
87 | * Passed here to avoid constantly allocating/deallocating | ||
88 | * this element, but generally we want to get rid of this. | ||
89 | * @deprecated | ||
90 | */ | ||
91 | struct GNUNET_NETWORK_FDSet *ws; | ||
92 | |||
93 | /** | ||
94 | * Driver we used for the event loop. | ||
95 | */ | ||
96 | const struct GNUNET_SCHEDULER_Driver *driver; | ||
97 | |||
98 | }; | ||
99 | |||
100 | |||
101 | /** | ||
74 | * Entry in list of pending tasks. | 102 | * Entry in list of pending tasks. |
75 | */ | 103 | */ |
76 | struct GNUNET_SCHEDULER_Task | 104 | struct GNUNET_SCHEDULER_Task |
@@ -96,6 +124,11 @@ struct GNUNET_SCHEDULER_Task | |||
96 | void *callback_cls; | 124 | void *callback_cls; |
97 | 125 | ||
98 | /** | 126 | /** |
127 | * Handle to the scheduler's state. | ||
128 | */ | ||
129 | const struct GNUNET_SCHEDULER_Handle *sh; | ||
130 | |||
131 | /** | ||
99 | * Set of file descriptors this task is waiting | 132 | * Set of file descriptors this task is waiting |
100 | * for for reading. Once ready, this is updated | 133 | * for for reading. Once ready, this is updated |
101 | * to reflect the set of file descriptors ready | 134 | * to reflect the set of file descriptors ready |
@@ -111,6 +144,18 @@ struct GNUNET_SCHEDULER_Task | |||
111 | struct GNUNET_NETWORK_FDSet *write_set; | 144 | struct GNUNET_NETWORK_FDSet *write_set; |
112 | 145 | ||
113 | /** | 146 | /** |
147 | * Information about which FDs are ready for this task (and why). | ||
148 | */ | ||
149 | const struct GNUNET_SCHEDULER_FdInfo *fds; | ||
150 | |||
151 | /** | ||
152 | * Storage location used for @e fds if we want to avoid | ||
153 | * a separate malloc() call in the common case that this | ||
154 | * task is only about a single FD. | ||
155 | */ | ||
156 | struct GNUNET_SCHEDULER_FdInfo fdx; | ||
157 | |||
158 | /** | ||
114 | * Absolute timeout value for the task, or | 159 | * Absolute timeout value for the task, or |
115 | * #GNUNET_TIME_UNIT_FOREVER_ABS for "no timeout". | 160 | * #GNUNET_TIME_UNIT_FOREVER_ABS for "no timeout". |
116 | */ | 161 | */ |
@@ -124,6 +169,11 @@ struct GNUNET_SCHEDULER_Task | |||
124 | #endif | 169 | #endif |
125 | 170 | ||
126 | /** | 171 | /** |
172 | * Size of the @e fds array. | ||
173 | */ | ||
174 | unsigned int fds_len; | ||
175 | |||
176 | /** | ||
127 | * Why is the task ready? Set after task is added to ready queue. | 177 | * Why is the task ready? Set after task is added to ready queue. |
128 | * Initially set to zero. All reasons that have already been | 178 | * Initially set to zero. All reasons that have already been |
129 | * satisfied (i.e. read or write ready) will be set over time. | 179 | * satisfied (i.e. read or write ready) will be set over time. |
@@ -1742,7 +1792,8 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
1742 | GNUNET_CONTAINER_DLL_insert (pending_head, | 1792 | GNUNET_CONTAINER_DLL_insert (pending_head, |
1743 | pending_tail, | 1793 | pending_tail, |
1744 | t); | 1794 | t); |
1745 | max_priority_added = GNUNET_MAX (max_priority_added, t->priority); | 1795 | max_priority_added = GNUNET_MAX (max_priority_added, |
1796 | t->priority); | ||
1746 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1797 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1747 | "Adding task %p\n", | 1798 | "Adding task %p\n", |
1748 | t); | 1799 | t); |
@@ -1750,4 +1801,275 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio, | |||
1750 | return t; | 1801 | return t; |
1751 | } | 1802 | } |
1752 | 1803 | ||
1804 | |||
1805 | /** | ||
1806 | * Function used by event-loop implementations to signal the scheduler | ||
1807 | * that a particular @a task is ready due to an event of type @a et. | ||
1808 | * | ||
1809 | * This function will then queue the task to notify the application | ||
1810 | * that the task is ready (with the respective priority). | ||
1811 | * | ||
1812 | * @param task the task that is ready, NULL for wake up calls | ||
1813 | * @param et information about why the task is ready | ||
1814 | */ | ||
1815 | void | ||
1816 | GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task, | ||
1817 | enum GNUNET_SCHEDULER_EventType et) | ||
1818 | { | ||
1819 | enum GNUNET_SCHEDULER_Reason reason; | ||
1820 | struct GNUNET_TIME_Absolute now; | ||
1821 | |||
1822 | now = GNUNET_TIME_absolute_get (); | ||
1823 | reason = task->reason; | ||
1824 | if (now.abs_value_us >= task->timeout.abs_value_us) | ||
1825 | reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; | ||
1826 | if ( (0 == (reason & GNUNET_SCHEDULER_REASON_READ_READY)) && | ||
1827 | (0 != (GNUNET_SCHEDULER_ET_IN & et)) ) | ||
1828 | reason |= GNUNET_SCHEDULER_REASON_READ_READY; | ||
1829 | if ( (0 == (reason & GNUNET_SCHEDULER_REASON_WRITE_READY)) && | ||
1830 | (0 != (GNUNET_SCHEDULER_ET_OUT & et)) ) | ||
1831 | reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; | ||
1832 | reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; | ||
1833 | task->reason = reason; | ||
1834 | task->fds = &task->fdx; | ||
1835 | task->fdx.et = et; | ||
1836 | task->fds_len = 1; | ||
1837 | queue_ready_task (task); | ||
1838 | } | ||
1839 | |||
1840 | |||
1841 | /** | ||
1842 | * Function called by the driver to tell the scheduler to run some of | ||
1843 | * the tasks that are ready. This function may return even though | ||
1844 | * there are tasks left to run just to give other tasks a chance as | ||
1845 | * well. If we return #GNUNET_YES, the driver should call this | ||
1846 | * function again as soon as possible, while if we return #GNUNET_NO | ||
1847 | * it must block until the operating system has more work as the | ||
1848 | * scheduler has no more work to do right now. | ||
1849 | * | ||
1850 | * @param sh scheduler handle that was given to the `loop` | ||
1851 | * @return #GNUNET_OK if there are more tasks that are ready, | ||
1852 | * and thus we would like to run more (yield to avoid | ||
1853 | * blocking other activities for too long) | ||
1854 | * #GNUNET_NO if we are done running tasks (yield to block) | ||
1855 | * #GNUNET_SYSERR on error | ||
1856 | */ | ||
1857 | int | ||
1858 | GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh) | ||
1859 | { | ||
1860 | enum GNUNET_SCHEDULER_Priority p; | ||
1861 | struct GNUNET_SCHEDULER_Task *pos; | ||
1862 | struct GNUNET_TIME_Absolute now; | ||
1863 | |||
1864 | /* check for tasks that reached the timeout! */ | ||
1865 | now = GNUNET_TIME_absolute_get (); | ||
1866 | while (NULL != (pos = pending_timeout_head)) | ||
1867 | { | ||
1868 | if (now.abs_value_us >= pos->timeout.abs_value_us) | ||
1869 | pos->reason |= GNUNET_SCHEDULER_REASON_TIMEOUT; | ||
1870 | if (0 == pos->reason) | ||
1871 | break; | ||
1872 | GNUNET_CONTAINER_DLL_remove (pending_timeout_head, | ||
1873 | pending_timeout_tail, | ||
1874 | pos); | ||
1875 | if (pending_timeout_last == pos) | ||
1876 | pending_timeout_last = NULL; | ||
1877 | queue_ready_task (pos); | ||
1878 | } | ||
1879 | |||
1880 | if (0 == ready_count) | ||
1881 | return GNUNET_NO; | ||
1882 | |||
1883 | /* find out which task priority level we are going to | ||
1884 | process this time */ | ||
1885 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; | ||
1886 | GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]); | ||
1887 | /* yes, p>0 is correct, 0 is "KEEP" which should | ||
1888 | * always be an empty queue (see assertion)! */ | ||
1889 | for (p = GNUNET_SCHEDULER_PRIORITY_COUNT - 1; p > 0; p--) | ||
1890 | { | ||
1891 | pos = ready_head[p]; | ||
1892 | if (NULL != pos) | ||
1893 | break; | ||
1894 | } | ||
1895 | GNUNET_assert (NULL != pos); /* ready_count wrong? */ | ||
1896 | |||
1897 | /* process all tasks at this priority level, then yield */ | ||
1898 | while (NULL != (pos = ready_head[p])) | ||
1899 | { | ||
1900 | GNUNET_CONTAINER_DLL_remove (ready_head[p], | ||
1901 | ready_tail[p], | ||
1902 | pos); | ||
1903 | ready_count--; | ||
1904 | current_priority = pos->priority; | ||
1905 | current_lifeness = pos->lifeness; | ||
1906 | active_task = pos; | ||
1907 | #if PROFILE_DELAYS | ||
1908 | if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us > | ||
1909 | DELAY_THRESHOLD.rel_value_us) | ||
1910 | { | ||
1911 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1912 | "Task %p took %s to be scheduled\n", | ||
1913 | pos, | ||
1914 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time), | ||
1915 | GNUNET_YES)); | ||
1916 | } | ||
1917 | #endif | ||
1918 | tc.reason = pos->reason; | ||
1919 | GNUNET_NETWORK_fdset_zero (sh->rs); | ||
1920 | GNUNET_NETWORK_fdset_zero (sh->ws); | ||
1921 | tc.fds_len = pos->fds_len; | ||
1922 | tc.fds = pos->fds; | ||
1923 | tc.read_ready = (NULL == pos->read_set) ? sh->rs : pos->read_set; | ||
1924 | if ( (-1 != pos->read_fd) && | ||
1925 | (0 != (pos->reason & GNUNET_SCHEDULER_REASON_READ_READY)) ) | ||
1926 | GNUNET_NETWORK_fdset_set_native (sh->rs, | ||
1927 | pos->read_fd); | ||
1928 | tc.write_ready = (NULL == pos->write_set) ? sh->ws : pos->write_set; | ||
1929 | if ((-1 != pos->write_fd) && | ||
1930 | (0 != (pos->reason & GNUNET_SCHEDULER_REASON_WRITE_READY))) | ||
1931 | GNUNET_NETWORK_fdset_set_native (sh->ws, | ||
1932 | pos->write_fd); | ||
1933 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1934 | "Running task: %p\n", | ||
1935 | pos); | ||
1936 | pos->callback (pos->callback_cls); | ||
1937 | active_task = NULL; | ||
1938 | dump_backtrace (pos); | ||
1939 | destroy_task (pos); | ||
1940 | tasks_run++; | ||
1941 | } | ||
1942 | if (0 == ready_count) | ||
1943 | return GNUNET_NO; | ||
1944 | return GNUNET_OK; | ||
1945 | } | ||
1946 | |||
1947 | |||
1948 | /** | ||
1949 | * Initialize and run scheduler. This function will return when all | ||
1950 | * tasks have completed. On systems with signals, receiving a SIGTERM | ||
1951 | * (and other similar signals) will cause #GNUNET_SCHEDULER_shutdown | ||
1952 | * to be run after the active task is complete. As a result, SIGTERM | ||
1953 | * causes all shutdown tasks to be scheduled with reason | ||
1954 | * #GNUNET_SCHEDULER_REASON_SHUTDOWN. (However, tasks added | ||
1955 | * afterwards will execute normally!). Note that any particular | ||
1956 | * signal will only shut down one scheduler; applications should | ||
1957 | * always only create a single scheduler. | ||
1958 | * | ||
1959 | * @param driver drive to use for the event loop | ||
1960 | * @param task task to run first (and immediately) | ||
1961 | * @param task_cls closure of @a task | ||
1962 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
1963 | */ | ||
1964 | int | ||
1965 | GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver, | ||
1966 | GNUNET_SCHEDULER_TaskCallback task, | ||
1967 | void *task_cls) | ||
1968 | { | ||
1969 | int ret; | ||
1970 | struct GNUNET_SIGNAL_Context *shc_int; | ||
1971 | struct GNUNET_SIGNAL_Context *shc_term; | ||
1972 | #if (SIGTERM != GNUNET_TERM_SIG) | ||
1973 | struct GNUNET_SIGNAL_Context *shc_gterm; | ||
1974 | #endif | ||
1975 | #ifndef MINGW | ||
1976 | struct GNUNET_SIGNAL_Context *shc_quit; | ||
1977 | struct GNUNET_SIGNAL_Context *shc_hup; | ||
1978 | struct GNUNET_SIGNAL_Context *shc_pipe; | ||
1979 | #endif | ||
1980 | struct GNUNET_SCHEDULER_Task tsk; | ||
1981 | const struct GNUNET_DISK_FileHandle *pr; | ||
1982 | struct GNUNET_SCHEDULER_Handle sh; | ||
1983 | |||
1984 | /* general set-up */ | ||
1985 | GNUNET_assert (NULL == active_task); | ||
1986 | GNUNET_assert (NULL == shutdown_pipe_handle); | ||
1987 | shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_NO, | ||
1988 | GNUNET_NO, | ||
1989 | GNUNET_NO, | ||
1990 | GNUNET_NO); | ||
1991 | GNUNET_assert (NULL != shutdown_pipe_handle); | ||
1992 | pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, | ||
1993 | GNUNET_DISK_PIPE_END_READ); | ||
1994 | GNUNET_assert (NULL != pr); | ||
1995 | my_pid = getpid (); | ||
1996 | |||
1997 | /* install signal handlers */ | ||
1998 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1999 | "Registering signal handlers\n"); | ||
2000 | shc_int = GNUNET_SIGNAL_handler_install (SIGINT, | ||
2001 | &sighandler_shutdown); | ||
2002 | shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, | ||
2003 | &sighandler_shutdown); | ||
2004 | #if (SIGTERM != GNUNET_TERM_SIG) | ||
2005 | shc_gterm = GNUNET_SIGNAL_handler_install (GNUNET_TERM_SIG, | ||
2006 | &sighandler_shutdown); | ||
2007 | #endif | ||
2008 | #ifndef MINGW | ||
2009 | shc_pipe = GNUNET_SIGNAL_handler_install (SIGPIPE, | ||
2010 | &sighandler_pipe); | ||
2011 | shc_quit = GNUNET_SIGNAL_handler_install (SIGQUIT, | ||
2012 | &sighandler_shutdown); | ||
2013 | shc_hup = GNUNET_SIGNAL_handler_install (SIGHUP, | ||
2014 | &sighandler_shutdown); | ||
2015 | #endif | ||
2016 | |||
2017 | /* Setup initial tasks */ | ||
2018 | current_priority = GNUNET_SCHEDULER_PRIORITY_DEFAULT; | ||
2019 | current_lifeness = GNUNET_YES; | ||
2020 | memset (&tsk, | ||
2021 | 0, | ||
2022 | sizeof (tsk)); | ||
2023 | active_task = &tsk; | ||
2024 | tsk.sh = &sh; | ||
2025 | GNUNET_SCHEDULER_add_with_reason_and_priority (task, | ||
2026 | task_cls, | ||
2027 | GNUNET_SCHEDULER_REASON_STARTUP, | ||
2028 | GNUNET_SCHEDULER_PRIORITY_DEFAULT); | ||
2029 | GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, | ||
2030 | &GNUNET_OS_install_parent_control_handler, | ||
2031 | NULL); | ||
2032 | active_task = NULL; | ||
2033 | driver->set_wakeup (driver->cls, | ||
2034 | GNUNET_TIME_absolute_get ()); | ||
2035 | |||
2036 | /* begin main event loop */ | ||
2037 | sh.rs = GNUNET_NETWORK_fdset_create (); | ||
2038 | sh.ws = GNUNET_NETWORK_fdset_create (); | ||
2039 | sh.driver = driver; | ||
2040 | ret = driver->loop (driver->cls, | ||
2041 | &sh); | ||
2042 | GNUNET_NETWORK_fdset_destroy (sh.rs); | ||
2043 | GNUNET_NETWORK_fdset_destroy (sh.ws); | ||
2044 | |||
2045 | /* uninstall signal handlers */ | ||
2046 | GNUNET_SIGNAL_handler_uninstall (shc_int); | ||
2047 | GNUNET_SIGNAL_handler_uninstall (shc_term); | ||
2048 | #if (SIGTERM != GNUNET_TERM_SIG) | ||
2049 | GNUNET_SIGNAL_handler_uninstall (shc_gterm); | ||
2050 | #endif | ||
2051 | #ifndef MINGW | ||
2052 | GNUNET_SIGNAL_handler_uninstall (shc_pipe); | ||
2053 | GNUNET_SIGNAL_handler_uninstall (shc_quit); | ||
2054 | GNUNET_SIGNAL_handler_uninstall (shc_hup); | ||
2055 | #endif | ||
2056 | GNUNET_DISK_pipe_close (shutdown_pipe_handle); | ||
2057 | shutdown_pipe_handle = NULL; | ||
2058 | return ret; | ||
2059 | } | ||
2060 | |||
2061 | |||
2062 | /** | ||
2063 | * Obtain the driver for using select() as the event loop. | ||
2064 | * | ||
2065 | * @return NULL on error | ||
2066 | */ | ||
2067 | const struct GNUNET_SCHEDULER_Driver * | ||
2068 | GNUNET_SCHEDULER_driver_select () | ||
2069 | { | ||
2070 | GNUNET_break (0); // not implemented | ||
2071 | return NULL; | ||
2072 | } | ||
2073 | |||
2074 | |||
1753 | /* end of scheduler.c */ | 2075 | /* end of scheduler.c */ |
diff --git a/src/util/service.c b/src/util/service.c index 800d09a42..f63737e56 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1722,15 +1722,15 @@ GNUNET_SERVICE_run_ (int argc, | |||
1722 | int err; | 1722 | int err; |
1723 | 1723 | ||
1724 | struct GNUNET_GETOPT_CommandLineOption service_options[] = { | 1724 | struct GNUNET_GETOPT_CommandLineOption service_options[] = { |
1725 | GNUNET_GETOPT_OPTION_CFG_FILE (&opt_cfg_filename), | 1725 | GNUNET_GETOPT_option_cfgfile (&opt_cfg_filename), |
1726 | GNUNET_GETOPT_OPTION_SET_ONE ('d', | 1726 | GNUNET_GETOPT_option_flag ('d', |
1727 | "daemonize", | 1727 | "daemonize", |
1728 | gettext_noop ("do daemonize (detach from terminal)"), | 1728 | gettext_noop ("do daemonize (detach from terminal)"), |
1729 | &do_daemonize), | 1729 | &do_daemonize), |
1730 | GNUNET_GETOPT_OPTION_HELP (NULL), | 1730 | GNUNET_GETOPT_option_help (NULL), |
1731 | GNUNET_GETOPT_OPTION_LOGLEVEL (&loglev), | 1731 | GNUNET_GETOPT_option_loglevel (&loglev), |
1732 | GNUNET_GETOPT_OPTION_LOGFILE (&logfile), | 1732 | GNUNET_GETOPT_option_logfile (&logfile), |
1733 | GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION), | 1733 | GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION), |
1734 | GNUNET_GETOPT_OPTION_END | 1734 | GNUNET_GETOPT_OPTION_END |
1735 | }; | 1735 | }; |
1736 | 1736 | ||
diff --git a/src/util/test_getopt.c b/src/util/test_getopt.c index 13cedd7f5..16f2df8d1 100644 --- a/src/util/test_getopt.c +++ b/src/util/test_getopt.c | |||
@@ -56,7 +56,7 @@ testVerbose () | |||
56 | unsigned int vflags = 0; | 56 | unsigned int vflags = 0; |
57 | 57 | ||
58 | const struct GNUNET_GETOPT_CommandLineOption verboseoptionlist[] = { | 58 | const struct GNUNET_GETOPT_CommandLineOption verboseoptionlist[] = { |
59 | GNUNET_GETOPT_OPTION_VERBOSE (&vflags), | 59 | GNUNET_GETOPT_option_verbose (&vflags), |
60 | GNUNET_GETOPT_OPTION_END | 60 | GNUNET_GETOPT_OPTION_END |
61 | }; | 61 | }; |
62 | 62 | ||
@@ -83,7 +83,7 @@ testVersion () | |||
83 | NULL | 83 | NULL |
84 | }; | 84 | }; |
85 | const struct GNUNET_GETOPT_CommandLineOption versionoptionlist[] = { | 85 | const struct GNUNET_GETOPT_CommandLineOption versionoptionlist[] = { |
86 | GNUNET_GETOPT_OPTION_VERSION (PACKAGE_VERSION " " VCS_VERSION), | 86 | GNUNET_GETOPT_option_version (PACKAGE_VERSION " " VCS_VERSION), |
87 | GNUNET_GETOPT_OPTION_END | 87 | GNUNET_GETOPT_OPTION_END |
88 | }; | 88 | }; |
89 | 89 | ||
@@ -105,7 +105,7 @@ testAbout () | |||
105 | NULL | 105 | NULL |
106 | }; | 106 | }; |
107 | const struct GNUNET_GETOPT_CommandLineOption aboutoptionlist[] = { | 107 | const struct GNUNET_GETOPT_CommandLineOption aboutoptionlist[] = { |
108 | GNUNET_GETOPT_OPTION_HELP ("Testing"), | 108 | GNUNET_GETOPT_option_help ("Testing"), |
109 | GNUNET_GETOPT_OPTION_END | 109 | GNUNET_GETOPT_OPTION_END |
110 | }; | 110 | }; |
111 | 111 | ||
@@ -131,8 +131,8 @@ testLogOpts () | |||
131 | char *fn = NULL; | 131 | char *fn = NULL; |
132 | 132 | ||
133 | const struct GNUNET_GETOPT_CommandLineOption logoptionlist[] = { | 133 | const struct GNUNET_GETOPT_CommandLineOption logoptionlist[] = { |
134 | GNUNET_GETOPT_OPTION_LOGFILE (&fn), | 134 | GNUNET_GETOPT_option_logfile (&fn), |
135 | GNUNET_GETOPT_OPTION_LOGLEVEL (&level), | 135 | GNUNET_GETOPT_option_loglevel (&level), |
136 | GNUNET_GETOPT_OPTION_END | 136 | GNUNET_GETOPT_OPTION_END |
137 | }; | 137 | }; |
138 | 138 | ||
@@ -173,16 +173,16 @@ testFlagNum () | |||
173 | unsigned long long lnum = 0; | 173 | unsigned long long lnum = 0; |
174 | 174 | ||
175 | const struct GNUNET_GETOPT_CommandLineOption logoptionlist[] = { | 175 | const struct GNUNET_GETOPT_CommandLineOption logoptionlist[] = { |
176 | GNUNET_GETOPT_OPTION_SET_ONE ('f', | 176 | GNUNET_GETOPT_option_flag ('f', |
177 | "--flag", | 177 | "--flag", |
178 | "helptext", | 178 | "helptext", |
179 | &flag), | 179 | &flag), |
180 | GNUNET_GETOPT_OPTION_SET_UINT ('n', | 180 | GNUNET_GETOPT_option_uint ('n', |
181 | "--num", | 181 | "--num", |
182 | "ARG", | 182 | "ARG", |
183 | "helptext", | 183 | "helptext", |
184 | &num), | 184 | &num), |
185 | GNUNET_GETOPT_OPTION_SET_ULONG ('N', | 185 | GNUNET_GETOPT_option_ulong ('N', |
186 | "--lnum", | 186 | "--lnum", |
187 | "ARG", | 187 | "ARG", |
188 | "helptext", | 188 | "helptext", |
diff --git a/src/util/test_program.c b/src/util/test_program.c index d206952af..6d51b1872 100644 --- a/src/util/test_program.c +++ b/src/util/test_program.c | |||
@@ -64,40 +64,40 @@ main (int argc, char *argv[]) | |||
64 | NULL | 64 | NULL |
65 | }; | 65 | }; |
66 | struct GNUNET_GETOPT_CommandLineOption options1[] = { | 66 | struct GNUNET_GETOPT_CommandLineOption options1[] = { |
67 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 67 | GNUNET_GETOPT_option_flag ('n', |
68 | "name", | 68 | "name", |
69 | "description", | 69 | "description", |
70 | &setme1), | 70 | &setme1), |
71 | GNUNET_GETOPT_OPTION_END | 71 | GNUNET_GETOPT_OPTION_END |
72 | }; | 72 | }; |
73 | struct GNUNET_GETOPT_CommandLineOption options2[] = { | 73 | struct GNUNET_GETOPT_CommandLineOption options2[] = { |
74 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 74 | GNUNET_GETOPT_option_flag ('n', |
75 | "name", | 75 | "name", |
76 | "description", | 76 | "description", |
77 | &setme1), | 77 | &setme1), |
78 | GNUNET_GETOPT_OPTION_SET_ONE ('N', | 78 | GNUNET_GETOPT_option_flag ('N', |
79 | "number", | 79 | "number", |
80 | "description", | 80 | "description", |
81 | &setme2), | 81 | &setme2), |
82 | GNUNET_GETOPT_OPTION_END | 82 | GNUNET_GETOPT_OPTION_END |
83 | }; | 83 | }; |
84 | struct GNUNET_GETOPT_CommandLineOption options3[] = { | 84 | struct GNUNET_GETOPT_CommandLineOption options3[] = { |
85 | GNUNET_GETOPT_OPTION_SET_ONE ('N', | 85 | GNUNET_GETOPT_option_flag ('N', |
86 | "number", | 86 | "number", |
87 | "description", | 87 | "description", |
88 | &setme1), | 88 | &setme1), |
89 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 89 | GNUNET_GETOPT_option_flag ('n', |
90 | "name", | 90 | "name", |
91 | "description", | 91 | "description", |
92 | &setme2), | 92 | &setme2), |
93 | GNUNET_GETOPT_OPTION_END | 93 | GNUNET_GETOPT_OPTION_END |
94 | }; | 94 | }; |
95 | struct GNUNET_GETOPT_CommandLineOption options4[] = { | 95 | struct GNUNET_GETOPT_CommandLineOption options4[] = { |
96 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 96 | GNUNET_GETOPT_option_flag ('n', |
97 | "name", | 97 | "name", |
98 | "description", | 98 | "description", |
99 | &setme1), | 99 | &setme1), |
100 | GNUNET_GETOPT_OPTION_SET_ONE ('n', | 100 | GNUNET_GETOPT_option_flag ('n', |
101 | "name", | 101 | "name", |
102 | "description", | 102 | "description", |
103 | &setme2), | 103 | &setme2), |
diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c index 0adbd5c96..34c545339 100644 --- a/src/vpn/gnunet-vpn.c +++ b/src/vpn/gnunet-vpn.c | |||
@@ -287,51 +287,51 @@ int | |||
287 | main (int argc, char *const *argv) | 287 | main (int argc, char *const *argv) |
288 | { | 288 | { |
289 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 289 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
290 | GNUNET_GETOPT_OPTION_SET_ONE ('4', | 290 | GNUNET_GETOPT_option_flag ('4', |
291 | "ipv4", | 291 | "ipv4", |
292 | gettext_noop ("request that result should be an IPv4 address"), | 292 | gettext_noop ("request that result should be an IPv4 address"), |
293 | &ipv4), | 293 | &ipv4), |
294 | 294 | ||
295 | GNUNET_GETOPT_OPTION_SET_ONE ('6', | 295 | GNUNET_GETOPT_option_flag ('6', |
296 | "ipv6", | 296 | "ipv6", |
297 | gettext_noop ("request that result should be an IPv6 address"), | 297 | gettext_noop ("request that result should be an IPv6 address"), |
298 | &ipv6), | 298 | &ipv6), |
299 | 299 | ||
300 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('d', | 300 | GNUNET_GETOPT_option_relative_time ('d', |
301 | "duration", | 301 | "duration", |
302 | "TIME", | 302 | "TIME", |
303 | gettext_noop ("how long should the mapping be valid for new tunnels?"), | 303 | gettext_noop ("how long should the mapping be valid for new tunnels?"), |
304 | &duration), | 304 | &duration), |
305 | 305 | ||
306 | GNUNET_GETOPT_OPTION_STRING ('i', | 306 | GNUNET_GETOPT_option_string ('i', |
307 | "ip", | 307 | "ip", |
308 | "IP", | 308 | "IP", |
309 | gettext_noop ("destination IP for the tunnel"), | 309 | gettext_noop ("destination IP for the tunnel"), |
310 | &target_ip), | 310 | &target_ip), |
311 | 311 | ||
312 | GNUNET_GETOPT_OPTION_STRING ('p', | 312 | GNUNET_GETOPT_option_string ('p', |
313 | "peer", | 313 | "peer", |
314 | "PEERID", | 314 | "PEERID", |
315 | gettext_noop ("peer offering the service we would like to access"), | 315 | gettext_noop ("peer offering the service we would like to access"), |
316 | &peer_id), | 316 | &peer_id), |
317 | 317 | ||
318 | GNUNET_GETOPT_OPTION_STRING ('s', | 318 | GNUNET_GETOPT_option_string ('s', |
319 | "service", | 319 | "service", |
320 | "NAME", | 320 | "NAME", |
321 | gettext_noop ("name of the service we would like to access"), | 321 | gettext_noop ("name of the service we would like to access"), |
322 | &service_name), | 322 | &service_name), |
323 | 323 | ||
324 | GNUNET_GETOPT_OPTION_SET_ONE ('t', | 324 | GNUNET_GETOPT_option_flag ('t', |
325 | "tcp", | 325 | "tcp", |
326 | gettext_noop ("service is offered via TCP"), | 326 | gettext_noop ("service is offered via TCP"), |
327 | &tcp), | 327 | &tcp), |
328 | 328 | ||
329 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | 329 | GNUNET_GETOPT_option_flag ('u', |
330 | "udp", | 330 | "udp", |
331 | gettext_noop ("service is offered via UDP"), | 331 | gettext_noop ("service is offered via UDP"), |
332 | &udp), | 332 | &udp), |
333 | 333 | ||
334 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 334 | GNUNET_GETOPT_option_verbose (&verbosity), |
335 | 335 | ||
336 | GNUNET_GETOPT_OPTION_END | 336 | GNUNET_GETOPT_OPTION_END |
337 | }; | 337 | }; |