diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/fs_getopt.c | 79 | ||||
-rw-r--r-- | src/fs/gnunet-auto-share.c | 54 | ||||
-rw-r--r-- | src/fs/gnunet-download.c | 74 | ||||
-rw-r--r-- | src/fs/gnunet-publish.c | 151 | ||||
-rw-r--r-- | src/gns/gnunet-bcd.c | 12 | ||||
-rw-r--r-- | src/gns/gnunet-dns2gns.c | 48 | ||||
-rw-r--r-- | src/gns/gnunet-gns-proxy.c | 25 | ||||
-rw-r--r-- | src/gns/gnunet-gns.c | 56 | ||||
-rw-r--r-- | src/include/gnunet_fs_service.h | 47 | ||||
-rw-r--r-- | src/revocation/gnunet-revocation.c | 38 | ||||
-rw-r--r-- | src/scalarproduct/gnunet-scalarproduct.c | 29 | ||||
-rw-r--r-- | src/vpn/gnunet-vpn.c | 72 |
12 files changed, 455 insertions, 230 deletions
diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c index f78e311d3..bfe45957e 100644 --- a/src/fs/fs_getopt.c +++ b/src/fs/fs_getopt.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_fs_service.h" | 27 | #include "gnunet_fs_service.h" |
28 | #include "gnunet_getopt_lib.h" | ||
28 | #include "fs_api.h" | 29 | #include "fs_api.h" |
29 | 30 | ||
30 | /* ******************** command-line option parsing API ******************** */ | 31 | /* ******************** command-line option parsing API ******************** */ |
@@ -41,10 +42,10 @@ | |||
41 | * @param value command line argument given | 42 | * @param value command line argument given |
42 | * @return GNUNET_OK on success | 43 | * @return GNUNET_OK on success |
43 | */ | 44 | */ |
44 | int | 45 | static int |
45 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext | 46 | getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext |
46 | *ctx, void *scls, const char *option, | 47 | *ctx, void *scls, const char *option, |
47 | const char *value) | 48 | const char *value) |
48 | { | 49 | { |
49 | struct GNUNET_FS_Uri **uri = scls; | 50 | struct GNUNET_FS_Uri **uri = scls; |
50 | struct GNUNET_FS_Uri *u = *uri; | 51 | struct GNUNET_FS_Uri *u = *uri; |
@@ -107,6 +108,34 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
107 | return GNUNET_OK; | 108 | return GNUNET_OK; |
108 | } | 109 | } |
109 | 110 | ||
111 | /** | ||
112 | * Allow user to specify keywords. | ||
113 | * | ||
114 | * @param shortName short name of the option | ||
115 | * @param name long name of the option | ||
116 | * @param argumentHelp help text for the option argument | ||
117 | * @param description long help text for the option | ||
118 | * @param[out] topKeywords set to the desired value | ||
119 | */ | ||
120 | struct GNUNET_GETOPT_CommandLineOption | ||
121 | GNUNET_FS_GETOPT_KEYWORDS (char shortName, | ||
122 | const char *name, | ||
123 | const char *argumentHelp, | ||
124 | const char *description, | ||
125 | struct GNUNET_FS_Uri **topKeywords) | ||
126 | { | ||
127 | struct GNUNET_GETOPT_CommandLineOption clo = { | ||
128 | .shortName = shortName, | ||
129 | .name = name, | ||
130 | .argumentHelp = argumentHelp, | ||
131 | .description = description, | ||
132 | .require_argument = 1, | ||
133 | .processor = &getopt_set_keywords, | ||
134 | .scls = (void *) topKeywords | ||
135 | }; | ||
136 | |||
137 | return clo; | ||
138 | } | ||
110 | 139 | ||
111 | /** | 140 | /** |
112 | * Command-line option parser function that allows the user to specify | 141 | * Command-line option parser function that allows the user to specify |
@@ -120,11 +149,11 @@ GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
120 | * @param value command line argument given | 149 | * @param value command line argument given |
121 | * @return #GNUNET_OK on success | 150 | * @return #GNUNET_OK on success |
122 | */ | 151 | */ |
123 | int | 152 | static int |
124 | GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 153 | getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, |
125 | void *scls, | 154 | void *scls, |
126 | const char *option, | 155 | const char *option, |
127 | const char *value) | 156 | const char *value) |
128 | { | 157 | { |
129 | struct GNUNET_CONTAINER_MetaData **mm = scls; | 158 | struct GNUNET_CONTAINER_MetaData **mm = scls; |
130 | #if HAVE_EXTRACTOR_H && HAVE_LIBEXTRACTOR | 159 | #if HAVE_EXTRACTOR_H && HAVE_LIBEXTRACTOR |
@@ -200,4 +229,36 @@ GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
200 | return GNUNET_OK; | 229 | return GNUNET_OK; |
201 | } | 230 | } |
202 | 231 | ||
232 | /** | ||
233 | * Allow user to specify metadata. | ||
234 | * | ||
235 | * @param shortName short name of the option | ||
236 | * @param name long name of the option | ||
237 | * @param argumentHelp help text for the option argument | ||
238 | * @param description long help text for the option | ||
239 | * @param[out] metadata set to the desired value | ||
240 | */ | ||
241 | struct GNUNET_GETOPT_CommandLineOption | ||
242 | GNUNET_FS_GETOPT_METADATA (char shortName, | ||
243 | const char *name, | ||
244 | const char *argumentHelp, | ||
245 | const char *description, | ||
246 | struct GNUNET_CONTAINER_MetaData **meta) | ||
247 | { | ||
248 | struct GNUNET_GETOPT_CommandLineOption clo = { | ||
249 | .shortName = shortName, | ||
250 | .name = name, | ||
251 | .argumentHelp = argumentHelp, | ||
252 | .description = description, | ||
253 | .require_argument = 1, | ||
254 | .processor = &getopt_set_metadata, | ||
255 | .scls = (void *) meta | ||
256 | }; | ||
257 | |||
258 | return clo; | ||
259 | } | ||
260 | |||
261 | |||
262 | |||
263 | |||
203 | /* end of fs_getopt.c */ | 264 | /* end of fs_getopt.c */ |
diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c index cc0111111..2f980520a 100644 --- a/src/fs/gnunet-auto-share.c +++ b/src/fs/gnunet-auto-share.c | |||
@@ -72,7 +72,7 @@ static int ret; | |||
72 | /** | 72 | /** |
73 | * Are we running 'verbosely'? | 73 | * Are we running 'verbosely'? |
74 | */ | 74 | */ |
75 | static int verbose; | 75 | static unsigned int verbose; |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Configuration to use. | 78 | * Configuration to use. |
@@ -759,26 +759,38 @@ free_item (void *cls, | |||
759 | int | 759 | int |
760 | main (int argc, char *const *argv) | 760 | main (int argc, char *const *argv) |
761 | { | 761 | { |
762 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 762 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
763 | {'a', "anonymity", "LEVEL", | 763 | |
764 | gettext_noop ("set the desired LEVEL of sender-anonymity"), | 764 | GNUNET_GETOPT_OPTION_SET_UINT ('a', |
765 | 1, &GNUNET_GETOPT_set_uint, &anonymity_level}, | 765 | "anonymity", |
766 | {'d', "disable-creation-time", NULL, | 766 | "LEVEL", |
767 | gettext_noop | 767 | gettext_noop ("set the desired LEVEL of sender-anonymity"), |
768 | ("disable adding the creation time to the metadata of the uploaded file"), | 768 | &anonymity_level), |
769 | 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time}, | 769 | |
770 | {'D', "disable-extractor", NULL, | 770 | GNUNET_GETOPT_OPTION_SET_ONE ('d', |
771 | gettext_noop ("do not use libextractor to add keywords or metadata"), | 771 | "disable-creation-time", |
772 | 0, &GNUNET_GETOPT_set_one, &disable_extractor}, | 772 | gettext_noop ("disable adding the creation time to the metadata of the uploaded file"), |
773 | {'p', "priority", "PRIORITY", | 773 | &do_disable_creation_time), |
774 | gettext_noop ("specify the priority of the content"), | 774 | |
775 | 1, &GNUNET_GETOPT_set_uint, &content_priority}, | 775 | GNUNET_GETOPT_OPTION_SET_ONE ('D', |
776 | {'r', "replication", "LEVEL", | 776 | "disable-extractor", |
777 | gettext_noop ("set the desired replication LEVEL"), | 777 | gettext_noop ("do not use libextractor to add keywords or metadata"), |
778 | 1, &GNUNET_GETOPT_set_uint, &replication_level}, | 778 | &disable_extractor), |
779 | {'V', "verbose", NULL, | 779 | |
780 | gettext_noop ("be verbose (print progress information)"), | 780 | GNUNET_GETOPT_OPTION_SET_UINT ('p', |
781 | 0, &GNUNET_GETOPT_set_one, &verbose}, | 781 | "priority", |
782 | "PRIORITY", | ||
783 | gettext_noop ("specify the priority of the content"), | ||
784 | &content_priority), | ||
785 | |||
786 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | ||
787 | "replication", | ||
788 | "LEVEL", | ||
789 | gettext_noop ("set the desired replication LEVEL"), | ||
790 | &replication_level), | ||
791 | |||
792 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | ||
793 | |||
782 | GNUNET_GETOPT_OPTION_END | 794 | GNUNET_GETOPT_OPTION_END |
783 | }; | 795 | }; |
784 | struct WorkItem *wi; | 796 | struct WorkItem *wi; |
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c index 6d9adb8ab..4d6f30587 100644 --- a/src/fs/gnunet-download.c +++ b/src/fs/gnunet-download.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | static int ret; | 31 | static int ret; |
32 | 32 | ||
33 | static int verbose; | 33 | static unsigned int verbose; |
34 | 34 | ||
35 | static int delete_incomplete; | 35 | static int delete_incomplete; |
36 | 36 | ||
@@ -299,33 +299,51 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
299 | int | 299 | int |
300 | main (int argc, char *const *argv) | 300 | main (int argc, char *const *argv) |
301 | { | 301 | { |
302 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 302 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
303 | {'a', "anonymity", "LEVEL", | 303 | GNUNET_GETOPT_OPTION_SET_UINT ('a', |
304 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), | 304 | "anonymity", |
305 | 1, &GNUNET_GETOPT_set_uint, &anonymity}, | 305 | "LEVEL", |
306 | {'D', "delete-incomplete", NULL, | 306 | gettext_noop ("set the desired LEVEL of receiver-anonymity"), |
307 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), | 307 | &anonymity), |
308 | 0, &GNUNET_GETOPT_set_one, &delete_incomplete}, | 308 | |
309 | {'n', "no-network", NULL, | 309 | GNUNET_GETOPT_OPTION_SET_ONE ('D', |
310 | gettext_noop ("only search the local peer (no P2P network search)"), | 310 | "delete-incomplete", |
311 | 0, &GNUNET_GETOPT_set_one, &local_only}, | 311 | gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"), |
312 | {'o', "output", "FILENAME", | 312 | &delete_incomplete), |
313 | gettext_noop ("write the file to FILENAME"), | 313 | |
314 | 1, &GNUNET_GETOPT_set_string, &filename}, | 314 | GNUNET_GETOPT_OPTION_SET_ONE ('n', |
315 | {'p', "parallelism", "DOWNLOADS", | 315 | "no-network", |
316 | gettext_noop | 316 | gettext_noop ("only search the local peer (no P2P network search)"), |
317 | ("set the maximum number of parallel downloads that is allowed"), | 317 | &local_only), |
318 | 1, &GNUNET_GETOPT_set_uint, ¶llelism}, | 318 | |
319 | {'r', "request-parallelism", "REQUESTS", | 319 | GNUNET_GETOPT_OPTION_STRING ('o', |
320 | gettext_noop | 320 | "output", |
321 | ("set the maximum number of parallel requests for blocks that is allowed"), | 321 | "FILENAME", |
322 | 1, &GNUNET_GETOPT_set_uint, &request_parallelism}, | 322 | gettext_noop ("write the file to FILENAME"), |
323 | {'R', "recursive", NULL, | 323 | &filename), |
324 | gettext_noop ("download a GNUnet directory recursively"), | 324 | |
325 | 0, &GNUNET_GETOPT_set_one, &do_recursive}, | 325 | GNUNET_GETOPT_OPTION_SET_UINT ('p', |
326 | {'V', "verbose", NULL, | 326 | "parallelism", |
327 | gettext_noop ("be verbose (print progress information)"), | 327 | "DOWNLOADS", |
328 | 0, &GNUNET_GETOPT_increment_value, &verbose}, | 328 | gettext_noop ("set the maximum number of parallel downloads that is allowed"), |
329 | ¶llelism), | ||
330 | |||
331 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | ||
332 | "request-parallelism", | ||
333 | "REQUESTS", | ||
334 | gettext_noop ("set the maximum number of parallel requests for blocks that is allowed"), | ||
335 | &request_parallelism), | ||
336 | |||
337 | GNUNET_GETOPT_OPTION_SET_ONE ('R', | ||
338 | "recursive", | ||
339 | gettext_noop ("download a GNUnet directory recursively"), | ||
340 | &do_recursive), | ||
341 | |||
342 | GNUNET_GETOPT_OPTION_INCREMENT_VALUE ('V', | ||
343 | "verbose", | ||
344 | gettext_noop ("be verbose (print progress information)"), | ||
345 | &verbose), | ||
346 | |||
329 | GNUNET_GETOPT_OPTION_END | 347 | GNUNET_GETOPT_OPTION_END |
330 | }; | 348 | }; |
331 | 349 | ||
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index a563d7b7a..2229e45e7 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -37,7 +37,7 @@ static int ret; | |||
37 | /** | 37 | /** |
38 | * Command line option 'verbose' set | 38 | * Command line option 'verbose' set |
39 | */ | 39 | */ |
40 | static int verbose; | 40 | static unsigned int verbose; |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * Handle to our configuration. | 43 | * Handle to our configuration. |
@@ -893,63 +893,98 @@ run (void *cls, | |||
893 | int | 893 | int |
894 | main (int argc, char *const *argv) | 894 | main (int argc, char *const *argv) |
895 | { | 895 | { |
896 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 896 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
897 | {'a', "anonymity", "LEVEL", | 897 | GNUNET_GETOPT_OPTION_SET_UINT ('a', |
898 | gettext_noop ("set the desired LEVEL of sender-anonymity"), | 898 | "anonymity", |
899 | 1, &GNUNET_GETOPT_set_uint, &bo.anonymity_level}, | 899 | "LEVEL", |
900 | {'d', "disable-creation-time", NULL, | 900 | gettext_noop ("set the desired LEVEL of sender-anonymity"), |
901 | gettext_noop | 901 | &bo.anonymity_level), |
902 | ("disable adding the creation time to the metadata of the uploaded file"), | 902 | |
903 | 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time}, | 903 | GNUNET_GETOPT_OPTION_SET_ONE ('d', |
904 | {'D', "disable-extractor", NULL, | 904 | "disable-creation-time", |
905 | gettext_noop ("do not use libextractor to add keywords or metadata"), | 905 | gettext_noop ("disable adding the creation time to the " |
906 | 0, &GNUNET_GETOPT_set_one, &disable_extractor}, | 906 | "metadata of the uploaded file"), |
907 | {'e', "extract", NULL, | 907 | &do_disable_creation_time), |
908 | gettext_noop | 908 | |
909 | ("print list of extracted keywords that would be used, but do not perform upload"), | 909 | GNUNET_GETOPT_OPTION_SET_ONE ('D', |
910 | 0, &GNUNET_GETOPT_set_one, &extract_only}, | 910 | "disable-extractor", |
911 | {'k', "key", "KEYWORD", | 911 | gettext_noop ("do not use libextractor to add keywords or metadata"), |
912 | gettext_noop | 912 | &disable_extractor), |
913 | ("add an additional keyword for the top-level file or directory" | 913 | |
914 | " (this option can be specified multiple times)"), | 914 | GNUNET_GETOPT_OPTION_SET_ONE ('e', |
915 | 1, &GNUNET_FS_getopt_set_keywords, &topKeywords}, | 915 | "extract", |
916 | {'m', "meta", "TYPE:VALUE", | 916 | gettext_noop ("print list of extracted keywords that would " |
917 | gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), | 917 | "be used, but do not perform upload"), |
918 | 1, &GNUNET_FS_getopt_set_metadata, &meta}, | 918 | &extract_only), |
919 | {'n', "noindex", NULL, | 919 | |
920 | gettext_noop ("do not index, perform full insertion (stores entire " | 920 | GNUNET_FS_GETOPT_KEYWORDS ('k', |
921 | "file in encrypted form in GNUnet database)"), | 921 | "key", |
922 | 0, &GNUNET_GETOPT_set_one, &do_insert}, | 922 | "KEYWORD", |
923 | {'N', "next", "ID", | 923 | gettext_noop ("add an additional keyword for the top-level " |
924 | gettext_noop | 924 | "file or directory (this option can be specified multiple times)"), |
925 | ("specify ID of an updated version to be published in the future" | 925 | &topKeywords), |
926 | " (for namespace insertions only)"), | 926 | |
927 | 1, &GNUNET_GETOPT_set_string, &next_id}, | 927 | GNUNET_FS_GETOPT_METADATA ('m', |
928 | {'p', "priority", "PRIORITY", | 928 | "meta", |
929 | gettext_noop ("specify the priority of the content"), | 929 | "TYPE:VALUE", |
930 | 1, &GNUNET_GETOPT_set_uint, &bo.content_priority}, | 930 | gettext_noop ("set the meta-data for the given TYPE to the given VALUE"), |
931 | {'P', "pseudonym", "NAME", | 931 | &meta), |
932 | gettext_noop | 932 | |
933 | ("publish the files under the pseudonym NAME (place file into namespace)"), | 933 | GNUNET_GETOPT_OPTION_SET_ONE ('n', |
934 | 1, &GNUNET_GETOPT_set_string, &pseudonym}, | 934 | "noindex", |
935 | {'r', "replication", "LEVEL", | 935 | gettext_noop ("do not index, perform full insertion (stores " |
936 | gettext_noop ("set the desired replication LEVEL"), | 936 | "entire file in encrypted form in GNUnet database)"), |
937 | 1, &GNUNET_GETOPT_set_uint, &bo.replication_level}, | 937 | &do_insert), |
938 | {'s', "simulate-only", NULL, | 938 | |
939 | gettext_noop ("only simulate the process but do not do any " | 939 | GNUNET_GETOPT_OPTION_STRING ('N', |
940 | "actual publishing (useful to compute URIs)"), | 940 | "next", |
941 | 0, &GNUNET_GETOPT_set_one, &do_simulate}, | 941 | "ID", |
942 | {'t', "this", "ID", | 942 | gettext_noop ("specify ID of an updated version to be " |
943 | gettext_noop ("set the ID of this version of the publication" | 943 | "published in the future (for namespace insertions only)"), |
944 | " (for namespace insertions only)"), | 944 | &next_id), |
945 | 1, &GNUNET_GETOPT_set_string, &this_id}, | 945 | |
946 | {'u', "uri", "URI", | 946 | GNUNET_GETOPT_OPTION_SET_UINT ('p', |
947 | gettext_noop ("URI to be published (can be used instead of passing a " | 947 | "priority", |
948 | "file to add keywords to the file with the respective URI)"), | 948 | "PRIORITY", |
949 | 1, &GNUNET_GETOPT_set_string, &uri_string}, | 949 | gettext_noop ("specify the priority of the content"), |
950 | {'V', "verbose", NULL, | 950 | &bo.content_priority), |
951 | gettext_noop ("be verbose (print progress information)"), | 951 | |
952 | 0, &GNUNET_GETOPT_set_one, &verbose}, | 952 | GNUNET_GETOPT_OPTION_STRING ('P', |
953 | "pseudonym", | ||
954 | "NAME", | ||
955 | gettext_noop ("publish the files under the pseudonym " | ||
956 | "NAME (place file into namespace)"), | ||
957 | &pseudonym), | ||
958 | |||
959 | GNUNET_GETOPT_OPTION_SET_UINT ('r', | ||
960 | "replication", | ||
961 | "LEVEL", | ||
962 | gettext_noop ("set the desired replication LEVEL"), | ||
963 | &bo.replication_level), | ||
964 | |||
965 | |||
966 | GNUNET_GETOPT_OPTION_SET_ONE ('s', | ||
967 | "simulate-only", | ||
968 | gettext_noop ("only simulate the process but do not do " | ||
969 | "any actual publishing (useful to compute URIs)"), | ||
970 | &do_simulate), | ||
971 | |||
972 | GNUNET_GETOPT_OPTION_STRING ('t', | ||
973 | "this", | ||
974 | "ID", | ||
975 | gettext_noop ("set the ID of this version of the publication " | ||
976 | "(for namespace insertions only)"), | ||
977 | &this_id), | ||
978 | |||
979 | GNUNET_GETOPT_OPTION_STRING ('u', | ||
980 | "uri", | ||
981 | "URI", | ||
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)"), | ||
984 | &uri_string), | ||
985 | |||
986 | GNUNET_GETOPT_OPTION_VERBOSE (&verbose), | ||
987 | |||
953 | GNUNET_GETOPT_OPTION_END | 988 | GNUNET_GETOPT_OPTION_END |
954 | }; | 989 | }; |
955 | bo.expiration_time = | 990 | bo.expiration_time = |
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index 21471350d..fb7ac10c1 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c | |||
@@ -514,10 +514,14 @@ run (void *cls, | |||
514 | int | 514 | int |
515 | main (int argc, char *const *argv) | 515 | main (int argc, char *const *argv) |
516 | { | 516 | { |
517 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 517 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
518 | {'p', "port", "PORT", | 518 | |
519 | gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), 1, | 519 | GNUNET_GETOPT_OPTION_SET_UINT ('p', |
520 | &GNUNET_GETOPT_set_uint, &port}, | 520 | "port", |
521 | "PORT", | ||
522 | gettext_noop ("Run HTTP serve on port PORT (default is 8888)"), | ||
523 | &port), | ||
524 | |||
521 | GNUNET_GETOPT_OPTION_END | 525 | GNUNET_GETOPT_OPTION_END |
522 | }; | 526 | }; |
523 | int ret; | 527 | int ret; |
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index 813ecdf8e..c9b4bde9c 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -776,22 +776,38 @@ int | |||
776 | main (int argc, | 776 | main (int argc, |
777 | char *const *argv) | 777 | char *const *argv) |
778 | { | 778 | { |
779 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 779 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
780 | {'d', "dns", "IP", | 780 | |
781 | gettext_noop ("IP of recursive DNS resolver to use (required)"), 1, | 781 | GNUNET_GETOPT_OPTION_STRING ('d', |
782 | &GNUNET_GETOPT_set_string, &dns_ip}, | 782 | "dns", |
783 | {'f', "fcfs", "NAME", | 783 | "IP", |
784 | gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"), 1, | 784 | gettext_noop ("IP of recursive DNS resolver to use (required)"), |
785 | &GNUNET_GETOPT_set_string, &fcfs_suffix}, | 785 | &dns_ip), |
786 | {'s', "suffix", "SUFFIX", | 786 | |
787 | gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"), 1, | 787 | GNUNET_GETOPT_OPTION_STRING ('f', |
788 | &GNUNET_GETOPT_set_string, &dns_suffix}, | 788 | "fcfs", |
789 | {'p', "port", "UDPPORT", | 789 | "NAME", |
790 | gettext_noop ("UDP port to listen on for inbound DNS requests; default: 2853"), 1, | 790 | gettext_noop ("Authoritative FCFS suffix to use (optional); default: fcfs.zkey.eu"), |
791 | &GNUNET_GETOPT_set_uint, &listen_port}, | 791 | &fcfs_suffix), |
792 | {'z', "zone", "PUBLICKEY", | 792 | |
793 | gettext_noop ("Public key of the GNS zone to use (overrides default)"), 1, | 793 | GNUNET_GETOPT_OPTION_STRING ('s', |
794 | &GNUNET_GETOPT_set_string, &gns_zone_str}, | 794 | "suffix", |
795 | "SUFFIX", | ||
796 | gettext_noop ("Authoritative DNS suffix to use (optional); default: zkey.eu"), | ||
797 | &dns_suffix), | ||
798 | |||
799 | GNUNET_GETOPT_OPTION_SET_UINT ('p', | ||
800 | "port", | ||
801 | "UDPPORT", | ||
802 | gettext_noop ("UDP port to listen on for inbound DNS requests; default: 2853"), | ||
803 | &listen_port), | ||
804 | |||
805 | GNUNET_GETOPT_OPTION_STRING ('z', | ||
806 | "zone", | ||
807 | "PUBLICKEY", | ||
808 | gettext_noop ("Public key of the GNS zone to use (overrides default)"), | ||
809 | &gns_zone_str), | ||
810 | |||
795 | GNUNET_GETOPT_OPTION_END | 811 | GNUNET_GETOPT_OPTION_END |
796 | }; | 812 | }; |
797 | int ret; | 813 | int ret; |
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index c336848ce..35f42cdec 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -621,7 +621,7 @@ struct Socks5Request | |||
621 | /** | 621 | /** |
622 | * The port the proxy is running on (default 7777) | 622 | * The port the proxy is running on (default 7777) |
623 | */ | 623 | */ |
624 | static unsigned long port = GNUNET_GNS_PROXY_PORT; | 624 | static unsigned long long port = GNUNET_GNS_PROXY_PORT; |
625 | 625 | ||
626 | /** | 626 | /** |
627 | * The CA file (pem) to use for the proxy CA | 627 | * The CA file (pem) to use for the proxy CA |
@@ -3108,7 +3108,7 @@ run_cont () | |||
3108 | return; | 3108 | return; |
3109 | } | 3109 | } |
3110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3111 | "Proxy listens on port %lu\n", | 3111 | "Proxy listens on port %llu\n", |
3112 | port); | 3112 | port); |
3113 | 3113 | ||
3114 | /* start MHD daemon for HTTP */ | 3114 | /* start MHD daemon for HTTP */ |
@@ -3261,13 +3261,20 @@ run (void *cls, | |||
3261 | int | 3261 | int |
3262 | main (int argc, char *const *argv) | 3262 | main (int argc, char *const *argv) |
3263 | { | 3263 | { |
3264 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 3264 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
3265 | {'p', "port", NULL, | 3265 | |
3266 | gettext_noop ("listen on specified port (default: 7777)"), 1, | 3266 | GNUNET_GETOPT_OPTION_SET_ULONG ('p', |
3267 | &GNUNET_GETOPT_set_ulong, &port}, | 3267 | "port", |
3268 | {'a', "authority", NULL, | 3268 | NULL, |
3269 | gettext_noop ("pem file to use as CA"), 1, | 3269 | gettext_noop ("listen on specified port (default: 7777)"), |
3270 | &GNUNET_GETOPT_set_string, &cafile_opt}, | 3270 | &port), |
3271 | |||
3272 | GNUNET_GETOPT_OPTION_STRING ('a', | ||
3273 | "authority", | ||
3274 | NULL, | ||
3275 | gettext_noop ("pem file to use as CA"), | ||
3276 | &cafile_opt), | ||
3277 | |||
3271 | GNUNET_GETOPT_OPTION_END | 3278 | GNUNET_GETOPT_OPTION_END |
3272 | }; | 3279 | }; |
3273 | static const char* page = | 3280 | static const char* page = |
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index a261e008b..c85ddfe81 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c | |||
@@ -420,25 +420,43 @@ int | |||
420 | main (int argc, | 420 | main (int argc, |
421 | char *const *argv) | 421 | char *const *argv) |
422 | { | 422 | { |
423 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 423 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
424 | {'u', "lookup", "NAME", | 424 | |
425 | gettext_noop ("Lookup a record for the given name"), 1, | 425 | GNUNET_GETOPT_OPTION_STRING ('u', |
426 | &GNUNET_GETOPT_set_string, &lookup_name}, | 426 | "lookup", |
427 | {'t', "type", "TYPE", | 427 | "NAME", |
428 | gettext_noop ("Specify the type of the record to lookup"), 1, | 428 | gettext_noop ("Lookup a record for the given name"), |
429 | &GNUNET_GETOPT_set_string, &lookup_type}, | 429 | &lookup_name), |
430 | { 'T', "timeout", "DELAY", | 430 | |
431 | gettext_noop ("Specify timeout for the lookup"), 1, | 431 | GNUNET_GETOPT_OPTION_STRING ('t', |
432 | &GNUNET_GETOPT_set_relative_time, &timeout }, | 432 | "type", |
433 | {'r', "raw", NULL, | 433 | "TYPE", |
434 | gettext_noop ("No unneeded output"), 0, | 434 | gettext_noop ("Specify the type of the record to lookup"), |
435 | &GNUNET_GETOPT_set_one, &raw}, | 435 | &lookup_type), |
436 | {'p', "public-key", "PKEY", | 436 | |
437 | gettext_noop ("Specify the public key of the zone to lookup the record in"), 1, | 437 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('T', |
438 | &GNUNET_GETOPT_set_string, &public_key}, | 438 | "timeout", |
439 | {'z', "zone", "NAME", | 439 | "DELAY", |
440 | gettext_noop ("Specify the name of the ego of the zone to lookup the record in"), 1, | 440 | gettext_noop ("Specify timeout for the lookup"), |
441 | &GNUNET_GETOPT_set_string, &zone_ego_name}, | 441 | &timeout), |
442 | |||
443 | GNUNET_GETOPT_OPTION_SET_ONE ('r', | ||
444 | "raw", | ||
445 | gettext_noop ("No unneeded output"), | ||
446 | &raw), | ||
447 | |||
448 | GNUNET_GETOPT_OPTION_STRING ('p', | ||
449 | "public-key", | ||
450 | "PKEY", | ||
451 | gettext_noop ("Specify the public key of the zone to lookup the record in"), | ||
452 | &public_key), | ||
453 | |||
454 | GNUNET_GETOPT_OPTION_STRING ('z', | ||
455 | "zone", | ||
456 | "NAME", | ||
457 | gettext_noop ("Specify the name of the ego of the zone to lookup the record in"), | ||
458 | &zone_ego_name), | ||
459 | |||
442 | GNUNET_GETOPT_OPTION_END | 460 | GNUNET_GETOPT_OPTION_END |
443 | }; | 461 | }; |
444 | int ret; | 462 | int ret; |
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index a9c7e8944..ac418072e 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -438,23 +438,36 @@ GNUNET_FS_uri_ksk_create_from_meta_data (const struct GNUNET_CONTAINER_MetaData | |||
438 | /* ******************** command-line option parsing API *********************** */ | 438 | /* ******************** command-line option parsing API *********************** */ |
439 | 439 | ||
440 | /** | 440 | /** |
441 | * Command-line option parser function that allows the user | 441 | * Allow user to specify keywords. |
442 | * to specify one or more '-k' options with keywords. Each | 442 | * |
443 | * specified keyword will be added to the URI. A pointer to | 443 | * @param shortName short name of the option |
444 | * the URI must be passed as the "scls" argument. | 444 | * @param name long name of the option |
445 | * | 445 | * @param argumentHelp help text for the option argument |
446 | * @param ctx command line processor context | 446 | * @param description long help text for the option |
447 | * @param scls must be of type "struct GNUNET_FS_Uri **" | 447 | * @param[out] topKeywords set to the desired value |
448 | * @param option name of the option (typically 'k') | 448 | */ |
449 | * @param value command line argument given | 449 | struct GNUNET_GETOPT_CommandLineOption |
450 | * @return #GNUNET_OK on success | 450 | GNUNET_FS_GETOPT_KEYWORDS (char shortName, |
451 | */ | 451 | const char *name, |
452 | int | 452 | const char *argumentHelp, |
453 | GNUNET_FS_getopt_set_keywords (struct GNUNET_GETOPT_CommandLineProcessorContext *ctx, | 453 | const char *description, |
454 | void *scls, | 454 | struct GNUNET_FS_Uri **topKeywords); |
455 | const char *option, | 455 | |
456 | const char *value); | 456 | /** |
457 | 457 | * Allow user to specify metadata. | |
458 | * | ||
459 | * @param shortName short name of the option | ||
460 | * @param name long name of the option | ||
461 | * @param argumentHelp help text for the option argument | ||
462 | * @param description long help text for the option | ||
463 | * @param[out] metadata set to the desired value | ||
464 | */ | ||
465 | struct GNUNET_GETOPT_CommandLineOption | ||
466 | GNUNET_FS_GETOPT_METADATA (char shortName, | ||
467 | const char *name, | ||
468 | const char *argumentHelp, | ||
469 | const char *description, | ||
470 | struct GNUNET_CONTAINER_MetaData **meta); | ||
458 | 471 | ||
459 | /** | 472 | /** |
460 | * Command-line option parser function that allows the user to specify | 473 | * Command-line option parser function that allows the user to specify |
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 133468789..7b40c83d7 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -527,19 +527,31 @@ run (void *cls, | |||
527 | int | 527 | int |
528 | main (int argc, char *const *argv) | 528 | main (int argc, char *const *argv) |
529 | { | 529 | { |
530 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 530 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
531 | {'f', "filename", "NAME", | 531 | |
532 | gettext_noop ("use NAME for the name of the revocation file"), | 532 | GNUNET_GETOPT_OPTION_STRING ('f', |
533 | 1, &GNUNET_GETOPT_set_string, &filename}, | 533 | "filename", |
534 | {'R', "revoke", "NAME", | 534 | "NAME", |
535 | gettext_noop ("revoke the private key associated for the the private key associated with the ego NAME "), | 535 | gettext_noop ("use NAME for the name of the revocation file"), |
536 | 1, &GNUNET_GETOPT_set_string, &revoke_ego}, | 536 | &filename), |
537 | {'p', "perform", NULL, | 537 | |
538 | gettext_noop ("actually perform revocation, otherwise we just do the precomputation"), | 538 | GNUNET_GETOPT_OPTION_STRING ('R', |
539 | 0, &GNUNET_GETOPT_set_one, &perform}, | 539 | "revoke", |
540 | {'t', "test", "KEY", | 540 | "NAME", |
541 | gettext_noop ("test if the public key KEY has been revoked"), | 541 | gettext_noop ("revoke the private key associated for the the private key associated with the ego NAME "), |
542 | 1, &GNUNET_GETOPT_set_string, &test_ego}, | 542 | &revoke_ego), |
543 | |||
544 | GNUNET_GETOPT_OPTION_SET_ONE ('p', | ||
545 | "perform", | ||
546 | gettext_noop ("actually perform revocation, otherwise we just do the precomputation"), | ||
547 | &perform), | ||
548 | |||
549 | GNUNET_GETOPT_OPTION_STRING ('t', | ||
550 | "test", | ||
551 | "KEY", | ||
552 | gettext_noop ("test if the public key KEY has been revoked"), | ||
553 | &test_ego), | ||
554 | |||
543 | GNUNET_GETOPT_OPTION_END | 555 | GNUNET_GETOPT_OPTION_END |
544 | }; | 556 | }; |
545 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 557 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
diff --git a/src/scalarproduct/gnunet-scalarproduct.c b/src/scalarproduct/gnunet-scalarproduct.c index 773283959..5d0fce2b1 100644 --- a/src/scalarproduct/gnunet-scalarproduct.c +++ b/src/scalarproduct/gnunet-scalarproduct.c | |||
@@ -343,7 +343,7 @@ run (void *cls, | |||
343 | int | 343 | int |
344 | main (int argc, char *const *argv) | 344 | main (int argc, char *const *argv) |
345 | { | 345 | { |
346 | static const 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", |
@@ -351,15 +351,24 @@ main (int argc, char *const *argv) | |||
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 | {'e', "elements", "\"key1,val1;key2,val2;...,keyn,valn;\"", | 354 | GNUNET_GETOPT_OPTION_STRING ('e', |
355 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), | 355 | "elements", |
356 | 1, &GNUNET_GETOPT_set_string, &input_elements}, | 356 | "\"key1,val1;key2,val2;...,keyn,valn;\"", |
357 | {'p', "peer", "PEERID", | 357 | gettext_noop ("A comma separated list of elements to compare as vector with our remote peer."), |
358 | 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."), | 358 | &input_elements), |
359 | 1, &GNUNET_GETOPT_set_string, &input_peer_id}, | 359 | |
360 | {'k', "key", "TRANSACTION_ID", | 360 | GNUNET_GETOPT_OPTION_STRING ('p', |
361 | gettext_noop ("Transaction ID shared with peer."), | 361 | "peer", |
362 | 1, &GNUNET_GETOPT_set_string, &input_session_key}, | 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."), | ||
364 | &input_peer_id), | ||
365 | |||
366 | GNUNET_GETOPT_OPTION_STRING ('k', | ||
367 | "key", | ||
368 | "TRANSACTION_ID", | ||
369 | gettext_noop ("Transaction ID shared with peer."), | ||
370 | &input_session_key), | ||
371 | |||
363 | GNUNET_GETOPT_OPTION_END | 372 | GNUNET_GETOPT_OPTION_END |
364 | }; | 373 | }; |
365 | 374 | ||
diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c index 2e7daf7f7..0adbd5c96 100644 --- a/src/vpn/gnunet-vpn.c +++ b/src/vpn/gnunet-vpn.c | |||
@@ -78,7 +78,7 @@ static int udp; | |||
78 | /** | 78 | /** |
79 | * Selected level of verbosity. | 79 | * Selected level of verbosity. |
80 | */ | 80 | */ |
81 | static int verbosity; | 81 | static unsigned int verbosity; |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Global return value. | 84 | * Global return value. |
@@ -286,33 +286,53 @@ run (void *cls, | |||
286 | int | 286 | int |
287 | main (int argc, char *const *argv) | 287 | main (int argc, char *const *argv) |
288 | { | 288 | { |
289 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { | 289 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
290 | {'4', "ipv4", NULL, | 290 | GNUNET_GETOPT_OPTION_SET_ONE ('4', |
291 | gettext_noop ("request that result should be an IPv4 address"), | 291 | "ipv4", |
292 | 0, &GNUNET_GETOPT_set_one, &ipv4}, | 292 | gettext_noop ("request that result should be an IPv4 address"), |
293 | {'6', "ipv6", NULL, | 293 | &ipv4), |
294 | gettext_noop ("request that result should be an IPv6 address"), | 294 | |
295 | 0, &GNUNET_GETOPT_set_one, &ipv6}, | 295 | GNUNET_GETOPT_OPTION_SET_ONE ('6', |
296 | {'d', "duration", "TIME", | 296 | "ipv6", |
297 | gettext_noop ("how long should the mapping be valid for new tunnels?"), | 297 | gettext_noop ("request that result should be an IPv6 address"), |
298 | 1, &GNUNET_GETOPT_set_relative_time, &duration}, | 298 | &ipv6), |
299 | {'i', "ip", "IP", | 299 | |
300 | gettext_noop ("destination IP for the tunnel"), | 300 | GNUNET_GETOPT_OPTION_SET_RELATIVE_TIME ('d', |
301 | 1, &GNUNET_GETOPT_set_string, &target_ip}, | 301 | "duration", |
302 | {'p', "peer", "PEERID", | 302 | "TIME", |
303 | gettext_noop ("peer offering the service we would like to access"), | 303 | gettext_noop ("how long should the mapping be valid for new tunnels?"), |
304 | 1, &GNUNET_GETOPT_set_string, &peer_id}, | 304 | &duration), |
305 | {'s', "service", "NAME", | 305 | |
306 | gettext_noop ("name of the service we would like to access"), | 306 | GNUNET_GETOPT_OPTION_STRING ('i', |
307 | 1, &GNUNET_GETOPT_set_string, &service_name}, | 307 | "ip", |
308 | {'t', "tcp", NULL, | 308 | "IP", |
309 | gettext_noop ("service is offered via TCP"), | 309 | gettext_noop ("destination IP for the tunnel"), |
310 | 0, &GNUNET_GETOPT_set_one, &tcp}, | 310 | &target_ip), |
311 | {'u', "udp", NULL, | 311 | |
312 | gettext_noop ("service is offered via UDP"), | 312 | GNUNET_GETOPT_OPTION_STRING ('p', |
313 | 0, &GNUNET_GETOPT_set_one, &udp}, | 313 | "peer", |
314 | "PEERID", | ||
315 | gettext_noop ("peer offering the service we would like to access"), | ||
316 | &peer_id), | ||
317 | |||
318 | GNUNET_GETOPT_OPTION_STRING ('s', | ||
319 | "service", | ||
320 | "NAME", | ||
321 | gettext_noop ("name of the service we would like to access"), | ||
322 | &service_name), | ||
323 | |||
324 | GNUNET_GETOPT_OPTION_SET_ONE ('t', | ||
325 | "tcp", | ||
326 | gettext_noop ("service is offered via TCP"), | ||
327 | &tcp), | ||
328 | |||
329 | GNUNET_GETOPT_OPTION_SET_ONE ('u', | ||
330 | "udp", | ||
331 | gettext_noop ("service is offered via UDP"), | ||
332 | &udp), | ||
314 | 333 | ||
315 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), | 334 | GNUNET_GETOPT_OPTION_VERBOSE (&verbosity), |
335 | |||
316 | GNUNET_GETOPT_OPTION_END | 336 | GNUNET_GETOPT_OPTION_END |
317 | }; | 337 | }; |
318 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 338 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |