aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arm/gnunet-arm.c45
-rw-r--r--src/arm/gnunet-service-arm.c18
-rw-r--r--src/arm/mockup-service.c18
-rw-r--r--src/core/gnunet-service-core.c32
-rw-r--r--src/datastore/gnunet-service-datastore.c39
-rw-r--r--src/fs/gnunet-directory.c11
-rw-r--r--src/fs/gnunet-download.c63
-rw-r--r--src/fs/gnunet-pseudonym.c94
-rw-r--r--src/fs/gnunet-publish.c121
-rw-r--r--src/fs/gnunet-search.c37
-rw-r--r--src/fs/gnunet-unindex.c17
-rw-r--r--src/hostlist/gnunet-daemon-hostlist.c75
-rw-r--r--src/hostlist/hostlist-client.c4
-rw-r--r--src/peerinfo-tool/gnunet-peerinfo.c28
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c26
-rw-r--r--src/statistics/gnunet-service-statistics.c16
-rw-r--r--src/statistics/gnunet-statistics.c29
-rw-r--r--src/template/gnunet-service-template.c14
-rw-r--r--src/template/gnunet-template.c12
-rw-r--r--src/topology/gnunet-daemon-topology.c11
-rw-r--r--src/transport/gnunet-service-transport.c41
-rw-r--r--src/util/crypto_hash.c69
-rw-r--r--src/util/crypto_ksk.c176
-rw-r--r--src/util/getopt.c33
-rw-r--r--src/util/gnunet-service-resolver.c14
25 files changed, 455 insertions, 588 deletions
diff --git a/src/arm/gnunet-arm.c b/src/arm/gnunet-arm.c
index c631ec480..4e6d6f965 100644
--- a/src/arm/gnunet-arm.c
+++ b/src/arm/gnunet-arm.c
@@ -357,31 +357,6 @@ cps_loop (void *cls,
357 357
358 358
359/** 359/**
360 * gnunet-arm command line options
361 */
362static struct GNUNET_GETOPT_CommandLineOption options[] = {
363 {'e', "end", NULL, gettext_noop ("stop all GNUnet services"),
364 GNUNET_NO, &GNUNET_GETOPT_set_one, &end},
365 {'i', "init", "SERVICE", gettext_noop ("start a particular service"),
366 GNUNET_YES, &GNUNET_GETOPT_set_string, &init},
367 {'k', "kill", "SERVICE", gettext_noop ("stop a particular service"),
368 GNUNET_YES, &GNUNET_GETOPT_set_string, &term},
369 {'s', "start", NULL, gettext_noop ("start all GNUnet default services"),
370 GNUNET_NO, &GNUNET_GETOPT_set_one, &start},
371 {'r', "restart", NULL, gettext_noop ("stop and start all GNUnet default services"),
372 GNUNET_NO, &GNUNET_GETOPT_set_one, &restart},
373 {'t', "test", "SERVICE",
374 gettext_noop ("test if a particular service is running"),
375 GNUNET_YES, &GNUNET_GETOPT_set_string, &test},
376 {'d', "delete", NULL, gettext_noop ("delete config file and directory on exit"),
377 GNUNET_NO, &GNUNET_GETOPT_set_one, &delete},
378 {'q', "quiet", NULL, gettext_noop ("don't print status messages"),
379 GNUNET_NO, &GNUNET_GETOPT_set_one, &quiet},
380 GNUNET_GETOPT_OPTION_END
381};
382
383
384/**
385 * The main function to obtain arm from gnunetd. 360 * The main function to obtain arm from gnunetd.
386 * 361 *
387 * @param argc number of arguments from the command line 362 * @param argc number of arguments from the command line
@@ -391,6 +366,26 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
391int 366int
392main (int argc, char *const *argv) 367main (int argc, char *const *argv)
393{ 368{
369 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
370 {'e', "end", NULL, gettext_noop ("stop all GNUnet services"),
371 GNUNET_NO, &GNUNET_GETOPT_set_one, &end},
372 {'i', "init", "SERVICE", gettext_noop ("start a particular service"),
373 GNUNET_YES, &GNUNET_GETOPT_set_string, &init},
374 {'k', "kill", "SERVICE", gettext_noop ("stop a particular service"),
375 GNUNET_YES, &GNUNET_GETOPT_set_string, &term},
376 {'s', "start", NULL, gettext_noop ("start all GNUnet default services"),
377 GNUNET_NO, &GNUNET_GETOPT_set_one, &start},
378 {'r', "restart", NULL, gettext_noop ("stop and start all GNUnet default services"),
379 GNUNET_NO, &GNUNET_GETOPT_set_one, &restart},
380 {'t', "test", "SERVICE",
381 gettext_noop ("test if a particular service is running"),
382 GNUNET_YES, &GNUNET_GETOPT_set_string, &test},
383 {'d', "delete", NULL, gettext_noop ("delete config file and directory on exit"),
384 GNUNET_NO, &GNUNET_GETOPT_set_one, &delete},
385 {'q', "quiet", NULL, gettext_noop ("don't print status messages"),
386 GNUNET_NO, &GNUNET_GETOPT_set_one, &quiet},
387 GNUNET_GETOPT_OPTION_END
388 };
394 return (GNUNET_OK == 389 return (GNUNET_OK ==
395 GNUNET_PROGRAM_run (argc, 390 GNUNET_PROGRAM_run (argc,
396 argv, 391 argv,
diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c
index 52c7dec20..ab96906a7 100644
--- a/src/arm/gnunet-service-arm.c
+++ b/src/arm/gnunet-service-arm.c
@@ -986,17 +986,6 @@ handle_shutdown (void *cls,
986 986
987 987
988/** 988/**
989 * List of handlers for the messages understood by this service.
990 */
991static struct GNUNET_SERVER_MessageHandler handlers[] = {
992 {&handle_start, NULL, GNUNET_MESSAGE_TYPE_ARM_START, 0},
993 {&handle_stop, NULL, GNUNET_MESSAGE_TYPE_ARM_STOP, 0},
994 {&handle_shutdown, NULL, GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN,
995 sizeof (struct GNUNET_MessageHeader)},
996 {NULL, NULL, 0, 0}
997};
998
999/**
1000 * Signal handler called for SIGCHLD. Triggers the 989 * Signal handler called for SIGCHLD. Triggers the
1001 * respective handler by writing to the trigger pipe. 990 * respective handler by writing to the trigger pipe.
1002 */ 991 */
@@ -1025,6 +1014,13 @@ run (void *cls,
1025 struct GNUNET_SERVER_Handle *serv, 1014 struct GNUNET_SERVER_Handle *serv,
1026 const struct GNUNET_CONFIGURATION_Handle *c) 1015 const struct GNUNET_CONFIGURATION_Handle *c)
1027{ 1016{
1017 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
1018 {&handle_start, NULL, GNUNET_MESSAGE_TYPE_ARM_START, 0},
1019 {&handle_stop, NULL, GNUNET_MESSAGE_TYPE_ARM_STOP, 0},
1020 {&handle_shutdown, NULL, GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN,
1021 sizeof (struct GNUNET_MessageHeader)},
1022 {NULL, NULL, 0, 0}
1023 };
1028 char *defaultservices; 1024 char *defaultservices;
1029 char *pos; 1025 char *pos;
1030 1026
diff --git a/src/arm/mockup-service.c b/src/arm/mockup-service.c
index 8a4940630..2f1baab9c 100644
--- a/src/arm/mockup-service.c
+++ b/src/arm/mockup-service.c
@@ -81,25 +81,17 @@ handle_shutdown (void *cls,
81} 81}
82 82
83 83
84/**
85 * Default handlers for all services. Will be copied and the
86 * "callback_cls" fields will be replaced with the specific service
87 * struct.
88 */
89static const struct GNUNET_SERVER_MessageHandler handlers[] = {
90 {&handle_shutdown, NULL, GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN,
91 sizeof (struct GNUNET_MessageHeader)},
92 {NULL, NULL, 0, 0}
93};
94
95
96
97static void 84static void
98run (void *cls, 85run (void *cls,
99 struct GNUNET_SCHEDULER_Handle *s, 86 struct GNUNET_SCHEDULER_Handle *s,
100 struct GNUNET_SERVER_Handle *server, 87 struct GNUNET_SERVER_Handle *server,
101 const struct GNUNET_CONFIGURATION_Handle *cfg) 88 const struct GNUNET_CONFIGURATION_Handle *cfg)
102{ 89{
90 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
91 {&handle_shutdown, NULL, GNUNET_MESSAGE_TYPE_ARM_SHUTDOWN,
92 sizeof (struct GNUNET_MessageHeader)},
93 {NULL, NULL, 0, 0}
94 };
103 sched = s; 95 sched = s;
104 /* process client requests */ 96 /* process client requests */
105 GNUNET_SERVER_ignore_shutdown (server, GNUNET_YES); 97 GNUNET_SERVER_ignore_shutdown (server, GNUNET_YES);
diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c
index 97ed57360..7a2111e0e 100644
--- a/src/core/gnunet-service-core.c
+++ b/src/core/gnunet-service-core.c
@@ -2351,25 +2351,6 @@ handle_client_request_connect (void *cls,
2351 2351
2352 2352
2353/** 2353/**
2354 * List of handlers for the messages understood by this
2355 * service.
2356 */
2357static struct GNUNET_SERVER_MessageHandler handlers[] = {
2358 {&handle_client_init, NULL,
2359 GNUNET_MESSAGE_TYPE_CORE_INIT, 0},
2360 {&handle_client_request_info, NULL,
2361 GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO,
2362 sizeof (struct RequestInfoMessage)},
2363 {&handle_client_send, NULL,
2364 GNUNET_MESSAGE_TYPE_CORE_SEND, 0},
2365 {&handle_client_request_connect, NULL,
2366 GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT,
2367 sizeof (struct ConnectMessage)},
2368 {NULL, NULL, 0, 0}
2369};
2370
2371
2372/**
2373 * PEERINFO is giving us a HELLO for a peer. Add the public key to 2354 * PEERINFO is giving us a HELLO for a peer. Add the public key to
2374 * the neighbour's struct and retry send_key. Or, if we did not get a 2355 * the neighbour's struct and retry send_key. Or, if we did not get a
2375 * HELLO, just do nothing. 2356 * HELLO, just do nothing.
@@ -3834,6 +3815,19 @@ run (void *cls,
3834 struct GNUNET_SERVER_Handle *serv, 3815 struct GNUNET_SERVER_Handle *serv,
3835 const struct GNUNET_CONFIGURATION_Handle *c) 3816 const struct GNUNET_CONFIGURATION_Handle *c)
3836{ 3817{
3818 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
3819 {&handle_client_init, NULL,
3820 GNUNET_MESSAGE_TYPE_CORE_INIT, 0},
3821 {&handle_client_request_info, NULL,
3822 GNUNET_MESSAGE_TYPE_CORE_REQUEST_INFO,
3823 sizeof (struct RequestInfoMessage)},
3824 {&handle_client_send, NULL,
3825 GNUNET_MESSAGE_TYPE_CORE_SEND, 0},
3826 {&handle_client_request_connect, NULL,
3827 GNUNET_MESSAGE_TYPE_CORE_REQUEST_CONNECT,
3828 sizeof (struct ConnectMessage)},
3829 {NULL, NULL, 0, 0}
3830 };
3837 char *keyfile; 3831 char *keyfile;
3838 3832
3839 sched = s; 3833 sched = s;
diff --git a/src/datastore/gnunet-service-datastore.c b/src/datastore/gnunet-service-datastore.c
index 64d1ce363..ddab5cdf3 100644
--- a/src/datastore/gnunet-service-datastore.c
+++ b/src/datastore/gnunet-service-datastore.c
@@ -1239,29 +1239,6 @@ handle_drop (void *cls,
1239 1239
1240 1240
1241/** 1241/**
1242 * List of handlers for the messages understood by this
1243 * service.
1244 */
1245static struct GNUNET_SERVER_MessageHandler handlers[] = {
1246 {&handle_reserve, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE,
1247 sizeof(struct ReserveMessage) },
1248 {&handle_release_reserve, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE,
1249 sizeof(struct ReleaseReserveMessage) },
1250 {&handle_put, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_PUT, 0 },
1251 {&handle_update, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE,
1252 sizeof (struct UpdateMessage) },
1253 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_GET, 0 },
1254 {&handle_get_random, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_GET_RANDOM,
1255 sizeof(struct GNUNET_MessageHeader) },
1256 {&handle_remove, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE, 0 },
1257 {&handle_drop, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_DROP,
1258 sizeof(struct GNUNET_MessageHeader) },
1259 {NULL, NULL, 0, 0}
1260};
1261
1262
1263
1264/**
1265 * Load the datastore plugin. 1242 * Load the datastore plugin.
1266 */ 1243 */
1267static struct DatastorePlugin * 1244static struct DatastorePlugin *
@@ -1443,6 +1420,22 @@ run (void *cls,
1443 struct GNUNET_SERVER_Handle *server, 1420 struct GNUNET_SERVER_Handle *server,
1444 const struct GNUNET_CONFIGURATION_Handle *c) 1421 const struct GNUNET_CONFIGURATION_Handle *c)
1445{ 1422{
1423 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
1424 {&handle_reserve, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_RESERVE,
1425 sizeof(struct ReserveMessage) },
1426 {&handle_release_reserve, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_RELEASE_RESERVE,
1427 sizeof(struct ReleaseReserveMessage) },
1428 {&handle_put, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_PUT, 0 },
1429 {&handle_update, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_UPDATE,
1430 sizeof (struct UpdateMessage) },
1431 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_GET, 0 },
1432 {&handle_get_random, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_GET_RANDOM,
1433 sizeof(struct GNUNET_MessageHeader) },
1434 {&handle_remove, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_REMOVE, 0 },
1435 {&handle_drop, NULL, GNUNET_MESSAGE_TYPE_DATASTORE_DROP,
1436 sizeof(struct GNUNET_MessageHeader) },
1437 {NULL, NULL, 0, 0}
1438 };
1446 char *fn; 1439 char *fn;
1447 unsigned int bf_size; 1440 unsigned int bf_size;
1448 1441
diff --git a/src/fs/gnunet-directory.c b/src/fs/gnunet-directory.c
index c1a7c78f3..1b17f69d2 100644
--- a/src/fs/gnunet-directory.c
+++ b/src/fs/gnunet-directory.c
@@ -167,14 +167,6 @@ run (void *cls,
167} 167}
168 168
169/** 169/**
170 * gnunet-directory command line options
171 */
172static struct GNUNET_GETOPT_CommandLineOption options[] = {
173 GNUNET_GETOPT_OPTION_END
174};
175
176
177/**
178 * The main function to inspect GNUnet directories. 170 * The main function to inspect GNUnet directories.
179 * 171 *
180 * @param argc number of arguments from the command line 172 * @param argc number of arguments from the command line
@@ -184,6 +176,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
184int 176int
185main (int argc, char *const *argv) 177main (int argc, char *const *argv)
186{ 178{
179 static struct GNUNET_GETOPT_CommandLineOption options[] = {
180 GNUNET_GETOPT_OPTION_END
181 };
187 return (GNUNET_OK == 182 return (GNUNET_OK ==
188 GNUNET_PROGRAM_run (argc, 183 GNUNET_PROGRAM_run (argc,
189 argv, 184 argv,
diff --git a/src/fs/gnunet-download.c b/src/fs/gnunet-download.c
index fde254d7c..a171006cb 100644
--- a/src/fs/gnunet-download.c
+++ b/src/fs/gnunet-download.c
@@ -253,40 +253,6 @@ run (void *cls,
253 253
254 254
255/** 255/**
256 * gnunet-download command line options
257 */
258static struct GNUNET_GETOPT_CommandLineOption options[] = {
259 {'a', "anonymity", "LEVEL",
260 gettext_noop ("set the desired LEVEL of receiver-anonymity"),
261 1, &GNUNET_GETOPT_set_uint, &anonymity},
262 {'D', "delete-incomplete", NULL,
263 gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
264 0, &GNUNET_GETOPT_set_one, &delete_incomplete},
265 {'n', "no-network", NULL,
266 gettext_noop ("only search the local peer (no P2P network search)"),
267 1, &GNUNET_GETOPT_set_uint, &local_only},
268 {'o', "output", "FILENAME",
269 gettext_noop ("write the file to FILENAME"),
270 1, &GNUNET_GETOPT_set_string, &filename},
271 {'p', "parallelism", "DOWNLOADS",
272 gettext_noop
273 ("set the maximum number of parallel downloads that is allowed"),
274 1, &GNUNET_GETOPT_set_uint, &parallelism},
275 {'r', "request-parallelism", "REQUESTS",
276 gettext_noop
277 ("set the maximum number of parallel requests for blocks that is allowed"),
278 1, &GNUNET_GETOPT_set_uint, &request_parallelism},
279 {'R', "recursive", NULL,
280 gettext_noop ("download a GNUnet directory recursively"),
281 0, &GNUNET_GETOPT_set_one, &do_recursive},
282 {'V', "verbose", NULL,
283 gettext_noop ("be verbose (print progress information)"),
284 0, &GNUNET_GETOPT_set_one, &verbose},
285 GNUNET_GETOPT_OPTION_END
286};
287
288
289/**
290 * The main function to download GNUnet. 256 * The main function to download GNUnet.
291 * 257 *
292 * @param argc number of arguments from the command line 258 * @param argc number of arguments from the command line
@@ -296,6 +262,35 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
296int 262int
297main (int argc, char *const *argv) 263main (int argc, char *const *argv)
298{ 264{
265 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
266 {'a', "anonymity", "LEVEL",
267 gettext_noop ("set the desired LEVEL of receiver-anonymity"),
268 1, &GNUNET_GETOPT_set_uint, &anonymity},
269 {'D', "delete-incomplete", NULL,
270 gettext_noop ("delete incomplete downloads (when aborted with CTRL-C)"),
271 0, &GNUNET_GETOPT_set_one, &delete_incomplete},
272 {'n', "no-network", NULL,
273 gettext_noop ("only search the local peer (no P2P network search)"),
274 1, &GNUNET_GETOPT_set_uint, &local_only},
275 {'o', "output", "FILENAME",
276 gettext_noop ("write the file to FILENAME"),
277 1, &GNUNET_GETOPT_set_string, &filename},
278 {'p', "parallelism", "DOWNLOADS",
279 gettext_noop
280 ("set the maximum number of parallel downloads that is allowed"),
281 1, &GNUNET_GETOPT_set_uint, &parallelism},
282 {'r', "request-parallelism", "REQUESTS",
283 gettext_noop
284 ("set the maximum number of parallel requests for blocks that is allowed"),
285 1, &GNUNET_GETOPT_set_uint, &request_parallelism},
286 {'R', "recursive", NULL,
287 gettext_noop ("download a GNUnet directory recursively"),
288 0, &GNUNET_GETOPT_set_one, &do_recursive},
289 {'V', "verbose", NULL,
290 gettext_noop ("be verbose (print progress information)"),
291 0, &GNUNET_GETOPT_set_one, &verbose},
292 GNUNET_GETOPT_OPTION_END
293 };
299 return (GNUNET_OK == 294 return (GNUNET_OK ==
300 GNUNET_PROGRAM_run (argc, 295 GNUNET_PROGRAM_run (argc,
301 argv, 296 argv,
diff --git a/src/fs/gnunet-pseudonym.c b/src/fs/gnunet-pseudonym.c
index 9f85f0545..465cbdd68 100644
--- a/src/fs/gnunet-pseudonym.c
+++ b/src/fs/gnunet-pseudonym.c
@@ -326,55 +326,6 @@ run (void *cls,
326 post_advertising (NULL, NULL, NULL); 326 post_advertising (NULL, NULL, NULL);
327} 327}
328 328
329/**
330 * gnunet-pseudonym command line options
331 */
332static struct GNUNET_GETOPT_CommandLineOption options[] = {
333 {'a', "anonymity", "LEVEL",
334 gettext_noop ("set the desired LEVEL of sender-anonymity"),
335 1, &GNUNET_GETOPT_set_uint, &anonymity},
336 {'A', "automate", NULL,
337 gettext_noop ("start a collection"),
338 0, &GNUNET_GETOPT_set_one, &start_automate},
339 {'C', "create", "NAME",
340 gettext_noop
341 ("create or advertise namespace NAME"),
342 1, &GNUNET_GETOPT_set_string, &create_ns},
343 {'D', "delete", "NAME",
344 gettext_noop
345 ("delete namespace NAME "),
346 1, &GNUNET_GETOPT_set_string, &delete_ns},
347 {'e', "end", NULL,
348 gettext_noop ("end current collection"),
349 0, &GNUNET_GETOPT_set_one, &stop_automate},
350 {'k', "keyword", "VALUE",
351 gettext_noop
352 ("add an additional keyword for the advertisment"
353 " (this option can be specified multiple times)"),
354 1, &GNUNET_FS_getopt_set_keywords, &ksk_uri},
355 {'m', "meta", "TYPE:VALUE",
356 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
357 1, &GNUNET_FS_getopt_set_metadata, &adv_metadata},
358 {'o', "only-local", NULL,
359 gettext_noop ("print names of local namespaces"),
360 0, &GNUNET_GETOPT_set_one, &print_local_only},
361 {'p', "priority", "PRIORITY",
362 gettext_noop ("use the given PRIORITY for the advertisments"),
363 1, &GNUNET_GETOPT_set_uint, &priority},
364 {'q', "quiet", NULL,
365 gettext_noop ("do not print names of remote namespaces"),
366 0, &GNUNET_GETOPT_set_one, &no_remote_printing},
367 {'r', "root", "ID",
368 gettext_noop
369 ("specify ID of the root of the namespace"),
370 1, &GNUNET_GETOPT_set_string, &root_identifier},
371 {'s', "set-rating", "ID:VALUE",
372 gettext_noop
373 ("change rating of namespace ID by VALUE"),
374 1, &GNUNET_GETOPT_set_string, &rating_change},
375 GNUNET_GETOPT_OPTION_END
376};
377
378 329
379/** 330/**
380 * The main function to inspect GNUnet directories. 331 * The main function to inspect GNUnet directories.
@@ -386,6 +337,51 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
386int 337int
387main (int argc, char *const *argv) 338main (int argc, char *const *argv)
388{ 339{
340 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
341 {'a', "anonymity", "LEVEL",
342 gettext_noop ("set the desired LEVEL of sender-anonymity"),
343 1, &GNUNET_GETOPT_set_uint, &anonymity},
344 {'A', "automate", NULL,
345 gettext_noop ("start a collection"),
346 0, &GNUNET_GETOPT_set_one, &start_automate},
347 {'C', "create", "NAME",
348 gettext_noop
349 ("create or advertise namespace NAME"),
350 1, &GNUNET_GETOPT_set_string, &create_ns},
351 {'D', "delete", "NAME",
352 gettext_noop
353 ("delete namespace NAME "),
354 1, &GNUNET_GETOPT_set_string, &delete_ns},
355 {'e', "end", NULL,
356 gettext_noop ("end current collection"),
357 0, &GNUNET_GETOPT_set_one, &stop_automate},
358 {'k', "keyword", "VALUE",
359 gettext_noop
360 ("add an additional keyword for the advertisment"
361 " (this option can be specified multiple times)"),
362 1, &GNUNET_FS_getopt_set_keywords, &ksk_uri},
363 {'m', "meta", "TYPE:VALUE",
364 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
365 1, &GNUNET_FS_getopt_set_metadata, &adv_metadata},
366 {'o', "only-local", NULL,
367 gettext_noop ("print names of local namespaces"),
368 0, &GNUNET_GETOPT_set_one, &print_local_only},
369 {'p', "priority", "PRIORITY",
370 gettext_noop ("use the given PRIORITY for the advertisments"),
371 1, &GNUNET_GETOPT_set_uint, &priority},
372 {'q', "quiet", NULL,
373 gettext_noop ("do not print names of remote namespaces"),
374 0, &GNUNET_GETOPT_set_one, &no_remote_printing},
375 {'r', "root", "ID",
376 gettext_noop
377 ("specify ID of the root of the namespace"),
378 1, &GNUNET_GETOPT_set_string, &root_identifier},
379 {'s', "set-rating", "ID:VALUE",
380 gettext_noop
381 ("change rating of namespace ID by VALUE"),
382 1, &GNUNET_GETOPT_set_string, &rating_change},
383 GNUNET_GETOPT_OPTION_END
384 };
389 return (GNUNET_OK == 385 return (GNUNET_OK ==
390 GNUNET_PROGRAM_run (argc, 386 GNUNET_PROGRAM_run (argc,
391 argv, 387 argv,
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index 8313c2467..18c4fd78e 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -524,7 +524,7 @@ run (void *cls,
524 &ex)) 524 &ex))
525 { 525 {
526 if (strlen (ex) > 0) 526 if (strlen (ex) > 0)
527 l = EXTRACTOR_plugin_add_config (l, ex, EXTRACTOR_OPTION_DEFAULT_POLICY); 527 plugins = EXTRACTOR_plugin_add_config (plugins, ex, EXTRACTOR_OPTION_DEFAULT_POLICY);
528 GNUNET_free (ex); 528 GNUNET_free (ex);
529 } 529 }
530 } 530 }
@@ -555,7 +555,7 @@ run (void *cls,
555 meta = GNUNET_CONTAINER_meta_data_create (); 555 meta = GNUNET_CONTAINER_meta_data_create ();
556 GNUNET_FS_meta_data_extract_from_file (meta, 556 GNUNET_FS_meta_data_extract_from_file (meta,
557 args[0], 557 args[0],
558 l); 558 plugins);
559 fi = GNUNET_FS_file_information_create_from_file (ctx, 559 fi = GNUNET_FS_file_information_create_from_file (ctx,
560 NULL, 560 NULL,
561 args[0], 561 args[0],
@@ -615,66 +615,6 @@ run (void *cls,
615} 615}
616 616
617 617
618/**
619 * gnunet-publish command line options
620 */
621static struct GNUNET_GETOPT_CommandLineOption options[] = {
622 {'a', "anonymity", "LEVEL",
623 gettext_noop ("set the desired LEVEL of sender-anonymity"),
624 1, &GNUNET_GETOPT_set_uint, &anonymity},
625 {'d', "disable-creation-time", NULL,
626 gettext_noop
627 ("disable adding the creation time to the metadata of the uploaded file"),
628 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time},
629 {'D', "disable-extractor", NULL,
630 gettext_noop
631 ("do not use libextractor to add keywords or metadata"),
632 0, &GNUNET_GETOPT_set_one, &disable_extractor},
633 {'e', "extract", NULL,
634 gettext_noop
635 ("print list of extracted keywords that would be used, but do not perform upload"),
636 0, &GNUNET_GETOPT_set_one, &extract_only},
637 {'k', "key", "KEYWORD",
638 gettext_noop
639 ("add an additional keyword for the top-level file or directory"
640 " (this option can be specified multiple times)"),
641 1, &GNUNET_FS_getopt_set_keywords, &topKeywords},
642 {'m', "meta", "TYPE:VALUE",
643 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
644 1, &GNUNET_FS_getopt_set_metadata, &meta},
645 {'n', "noindex", NULL,
646 gettext_noop ("do not index, perform full insertion (stores entire "
647 "file in encrypted form in GNUnet database)"),
648 0, &GNUNET_GETOPT_set_one, &do_insert},
649 {'N', "next", "ID",
650 gettext_noop
651 ("specify ID of an updated version to be published in the future"
652 " (for namespace insertions only)"),
653 1, &GNUNET_GETOPT_set_string, &next_id},
654 {'p', "priority", "PRIORITY",
655 gettext_noop ("specify the priority of the content"),
656 1, &GNUNET_GETOPT_set_uint, &priority},
657 {'P', "pseudonym", "NAME",
658 gettext_noop
659 ("publish the files under the pseudonym NAME (place file into namespace)"),
660 1, &GNUNET_GETOPT_set_string, &pseudonym},
661 {'s', "simulate-only", NULL,
662 gettext_noop ("only simulate the process but do not do any "
663 "actual publishing (useful to compute URIs)"),
664 0, &GNUNET_GETOPT_set_one, &do_simulate},
665 {'t', "this", "ID",
666 gettext_noop ("set the ID of this version of the publication"
667 " (for namespace insertions only)"),
668 1, &GNUNET_GETOPT_set_string, &this_id},
669 {'u', "uri", "URI",
670 gettext_noop ("URI to be published (can be used instead of passing a "
671 "file to add keywords to the file with the respective URI)"),
672 1, &GNUNET_GETOPT_set_string, &uri_string},
673 {'V', "verbose", NULL,
674 gettext_noop ("be verbose (print progress information)"),
675 0, &GNUNET_GETOPT_set_one, &verbose},
676 GNUNET_GETOPT_OPTION_END
677};
678 618
679 619
680/** 620/**
@@ -687,6 +627,63 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
687int 627int
688main (int argc, char *const *argv) 628main (int argc, char *const *argv)
689{ 629{
630 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
631 {'a', "anonymity", "LEVEL",
632 gettext_noop ("set the desired LEVEL of sender-anonymity"),
633 1, &GNUNET_GETOPT_set_uint, &anonymity},
634 {'d', "disable-creation-time", NULL,
635 gettext_noop
636 ("disable adding the creation time to the metadata of the uploaded file"),
637 0, &GNUNET_GETOPT_set_one, &do_disable_creation_time},
638 {'D', "disable-extractor", NULL,
639 gettext_noop
640 ("do not use libextractor to add keywords or metadata"),
641 0, &GNUNET_GETOPT_set_one, &disable_extractor},
642 {'e', "extract", NULL,
643 gettext_noop
644 ("print list of extracted keywords that would be used, but do not perform upload"),
645 0, &GNUNET_GETOPT_set_one, &extract_only},
646 {'k', "key", "KEYWORD",
647 gettext_noop
648 ("add an additional keyword for the top-level file or directory"
649 " (this option can be specified multiple times)"),
650 1, &GNUNET_FS_getopt_set_keywords, &topKeywords},
651 {'m', "meta", "TYPE:VALUE",
652 gettext_noop ("set the meta-data for the given TYPE to the given VALUE"),
653 1, &GNUNET_FS_getopt_set_metadata, &meta},
654 {'n', "noindex", NULL,
655 gettext_noop ("do not index, perform full insertion (stores entire "
656 "file in encrypted form in GNUnet database)"),
657 0, &GNUNET_GETOPT_set_one, &do_insert},
658 {'N', "next", "ID",
659 gettext_noop
660 ("specify ID of an updated version to be published in the future"
661 " (for namespace insertions only)"),
662 1, &GNUNET_GETOPT_set_string, &next_id},
663 {'p', "priority", "PRIORITY",
664 gettext_noop ("specify the priority of the content"),
665 1, &GNUNET_GETOPT_set_uint, &priority},
666 {'P', "pseudonym", "NAME",
667 gettext_noop
668 ("publish the files under the pseudonym NAME (place file into namespace)"),
669 1, &GNUNET_GETOPT_set_string, &pseudonym},
670 {'s', "simulate-only", NULL,
671 gettext_noop ("only simulate the process but do not do any "
672 "actual publishing (useful to compute URIs)"),
673 0, &GNUNET_GETOPT_set_one, &do_simulate},
674 {'t', "this", "ID",
675 gettext_noop ("set the ID of this version of the publication"
676 " (for namespace insertions only)"),
677 1, &GNUNET_GETOPT_set_string, &this_id},
678 {'u', "uri", "URI",
679 gettext_noop ("URI to be published (can be used instead of passing a "
680 "file to add keywords to the file with the respective URI)"),
681 1, &GNUNET_GETOPT_set_string, &uri_string},
682 {'V', "verbose", NULL,
683 gettext_noop ("be verbose (print progress information)"),
684 0, &GNUNET_GETOPT_set_one, &verbose},
685 GNUNET_GETOPT_OPTION_END
686 };
690 return (GNUNET_OK == 687 return (GNUNET_OK ==
691 GNUNET_PROGRAM_run (argc, 688 GNUNET_PROGRAM_run (argc,
692 argv, 689 argv,
diff --git a/src/fs/gnunet-search.c b/src/fs/gnunet-search.c
index 6123ecfef..3fbe2a27e 100644
--- a/src/fs/gnunet-search.c
+++ b/src/fs/gnunet-search.c
@@ -293,27 +293,6 @@ run (void *cls,
293 293
294 294
295/** 295/**
296 * gnunet-search command line options
297 */
298static struct GNUNET_GETOPT_CommandLineOption options[] = {
299 {'a', "anonymity", "LEVEL",
300 gettext_noop ("set the desired LEVEL of receiver-anonymity"),
301 1, &GNUNET_GETOPT_set_uint, &anonymity},
302 {'n', "no-network", NULL,
303 gettext_noop ("only search the local peer (no P2P network search)"),
304 1, &GNUNET_GETOPT_set_uint, &local_only},
305 {'o', "output", "PREFIX",
306 gettext_noop
307 ("write search results to file starting with PREFIX"),
308 1, &GNUNET_GETOPT_set_string, &output_filename},
309 {'V', "verbose", NULL,
310 gettext_noop ("be verbose (print progress information)"),
311 0, &GNUNET_GETOPT_set_one, &verbose},
312 GNUNET_GETOPT_OPTION_END
313};
314
315
316/**
317 * The main function to search GNUnet. 296 * The main function to search GNUnet.
318 * 297 *
319 * @param argc number of arguments from the command line 298 * @param argc number of arguments from the command line
@@ -323,6 +302,22 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
323int 302int
324main (int argc, char *const *argv) 303main (int argc, char *const *argv)
325{ 304{
305 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
306 {'a', "anonymity", "LEVEL",
307 gettext_noop ("set the desired LEVEL of receiver-anonymity"),
308 1, &GNUNET_GETOPT_set_uint, &anonymity},
309 {'n', "no-network", NULL,
310 gettext_noop ("only search the local peer (no P2P network search)"),
311 1, &GNUNET_GETOPT_set_uint, &local_only},
312 {'o', "output", "PREFIX",
313 gettext_noop
314 ("write search results to file starting with PREFIX"),
315 1, &GNUNET_GETOPT_set_string, &output_filename},
316 {'V', "verbose", NULL,
317 gettext_noop ("be verbose (print progress information)"),
318 0, &GNUNET_GETOPT_set_one, &verbose},
319 GNUNET_GETOPT_OPTION_END
320 };
326 return (GNUNET_OK == 321 return (GNUNET_OK ==
327 GNUNET_PROGRAM_run (argc, 322 GNUNET_PROGRAM_run (argc,
328 argv, 323 argv,
diff --git a/src/fs/gnunet-unindex.c b/src/fs/gnunet-unindex.c
index e934bf521..bc7a2434b 100644
--- a/src/fs/gnunet-unindex.c
+++ b/src/fs/gnunet-unindex.c
@@ -185,17 +185,6 @@ run (void *cls,
185 185
186 186
187/** 187/**
188 * gnunet-unindex command line options
189 */
190static struct GNUNET_GETOPT_CommandLineOption options[] = {
191 {'V', "verbose", NULL,
192 gettext_noop ("be verbose (print progress information)"),
193 0, &GNUNET_GETOPT_set_one, &verbose},
194 GNUNET_GETOPT_OPTION_END
195};
196
197
198/**
199 * The main function to unindex content. 188 * The main function to unindex content.
200 * 189 *
201 * @param argc number of arguments from the command line 190 * @param argc number of arguments from the command line
@@ -205,6 +194,12 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
205int 194int
206main (int argc, char *const *argv) 195main (int argc, char *const *argv)
207{ 196{
197 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
198 {'V', "verbose", NULL,
199 gettext_noop ("be verbose (print progress information)"),
200 0, &GNUNET_GETOPT_set_one, &verbose},
201 GNUNET_GETOPT_OPTION_END
202 };
208 return (GNUNET_OK == 203 return (GNUNET_OK ==
209 GNUNET_PROGRAM_run (argc, 204 GNUNET_PROGRAM_run (argc,
210 argv, 205 argv,
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c
index bbc0d7e08..300a767b5 100644
--- a/src/hostlist/gnunet-daemon-hostlist.c
+++ b/src/hostlist/gnunet-daemon-hostlist.c
@@ -87,40 +87,17 @@ static struct GNUNET_CORE_Handle *core;
87/** 87/**
88 * Handle to the hostlist client's advertisement handler 88 * Handle to the hostlist client's advertisement handler
89 */ 89 */
90static GNUNET_CORE_MessageCallback client_adv_handler = NULL; 90static GNUNET_CORE_MessageCallback client_adv_handler;
91 91
92/** 92/**
93 * Handle to hostlist client's connect handler 93 * Handle to hostlist client's connect handler
94 */ 94 */
95static GNUNET_CORE_ConnectEventHandler client_ch = NULL; 95static GNUNET_CORE_ConnectEventHandler client_ch;
96 96
97/** 97/**
98 * Handle to hostlist client's disconnect handler 98 * Handle to hostlist client's disconnect handler
99 */ 99 */
100static GNUNET_CORE_DisconnectEventHandler client_dh = NULL; 100static GNUNET_CORE_DisconnectEventHandler client_dh;
101
102/**
103 * gnunet-daemon-hostlist command line options.
104 */
105static struct GNUNET_GETOPT_CommandLineOption options[] = {
106#if HAVE_MHD
107 { 'a', "advertise", NULL,
108 gettext_noop ("advertise our hostlist to other peers"),
109 GNUNET_NO, &GNUNET_GETOPT_set_one, &advertising },
110#endif
111 { 'b', "bootstrap", NULL,
112 gettext_noop ("bootstrap using hostlists (it is highly recommended that you always use this option)"),
113 GNUNET_NO, &GNUNET_GETOPT_set_one, &bootstrapping },
114 { 'e', "enable-learning", NULL,
115 gettext_noop ("enable learning about hostlist servers from other peers"),
116 GNUNET_NO, &GNUNET_GETOPT_set_one, &learning},
117#if HAVE_MHD
118 { 'p', "provide-hostlist", NULL,
119 gettext_noop ("provide a hostlist server"),
120 GNUNET_NO, &GNUNET_GETOPT_set_one, &provide_hostlist},
121#endif
122 GNUNET_GETOPT_OPTION_END
123};
124 101
125/** 102/**
126 * A HOSTLIST_ADV message is used to exchange information about 103 * A HOSTLIST_ADV message is used to exchange information about
@@ -253,22 +230,6 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
253 } 230 }
254} 231}
255 232
256/**
257 * List of handlers if we are learning.
258 */
259static struct GNUNET_CORE_MessageHandler learn_handlers[] = {
260 { &advertisement_handler, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, 0},
261 { NULL, 0, 0 }
262};
263
264
265/**
266 * List of handlers if we are not learning.
267 */
268static struct GNUNET_CORE_MessageHandler no_learn_handlers[] = {
269 { NULL, 0, 0 }
270};
271
272 233
273/** 234/**
274 * Main function that will be run. 235 * Main function that will be run.
@@ -286,6 +247,13 @@ run (void *cls,
286 const char *cfgfile, 247 const char *cfgfile,
287 const struct GNUNET_CONFIGURATION_Handle * cfg) 248 const struct GNUNET_CONFIGURATION_Handle * cfg)
288{ 249{
250 static const struct GNUNET_CORE_MessageHandler learn_handlers[] = {
251 { &advertisement_handler, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, 0},
252 { NULL, 0, 0 }
253 };
254 static const struct GNUNET_CORE_MessageHandler no_learn_handlers[] = {
255 { NULL, 0, 0 }
256 };
289 if ( (! bootstrapping) && 257 if ( (! bootstrapping) &&
290 (! learning) 258 (! learning)
291#if HAVE_MHD 259#if HAVE_MHD
@@ -348,9 +316,28 @@ run (void *cls,
348int 316int
349main (int argc, char *const *argv) 317main (int argc, char *const *argv)
350{ 318{
351 int ret; 319 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
352 GNUNET_log_setup ("hostlist","DEBUG",NULL); 320#if HAVE_MHD
321 { 'a', "advertise", NULL,
322 gettext_noop ("advertise our hostlist to other peers"),
323 GNUNET_NO, &GNUNET_GETOPT_set_one, &advertising },
324#endif
325 { 'b', "bootstrap", NULL,
326 gettext_noop ("bootstrap using hostlists (it is highly recommended that you always use this option)"),
327 GNUNET_NO, &GNUNET_GETOPT_set_one, &bootstrapping },
328 { 'e', "enable-learning", NULL,
329 gettext_noop ("enable learning about hostlist servers from other peers"),
330 GNUNET_NO, &GNUNET_GETOPT_set_one, &learning},
331#if HAVE_MHD
332 { 'p', "provide-hostlist", NULL,
333 gettext_noop ("provide a hostlist server"),
334 GNUNET_NO, &GNUNET_GETOPT_set_one, &provide_hostlist},
335#endif
336 GNUNET_GETOPT_OPTION_END
337 };
353 338
339 int ret;
340 GNUNET_log_setup ("hostlist", "WARNING", NULL);
354 ret = (GNUNET_OK == 341 ret = (GNUNET_OK ==
355 GNUNET_PROGRAM_run (argc, 342 GNUNET_PROGRAM_run (argc,
356 argv, 343 argv,
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c
index 4d006c2bd..f08bb2e5d 100644
--- a/src/hostlist/hostlist-client.c
+++ b/src/hostlist/hostlist-client.c
@@ -116,12 +116,12 @@ static struct GNUNET_SCHEDULER_Handle *sched;
116/** 116/**
117 * Statistics handle. 117 * Statistics handle.
118 */ 118 */
119struct GNUNET_STATISTICS_Handle *stats; 119static struct GNUNET_STATISTICS_Handle *stats;
120 120
121/** 121/**
122 * Transport handle. 122 * Transport handle.
123 */ 123 */
124struct GNUNET_TRANSPORT_Handle *transport; 124static struct GNUNET_TRANSPORT_Handle *transport;
125 125
126/** 126/**
127 * Proxy that we are using (can be NULL). 127 * Proxy that we are using (can be NULL).
diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c
index a3fa98fa9..ab3eff83b 100644
--- a/src/peerinfo-tool/gnunet-peerinfo.c
+++ b/src/peerinfo-tool/gnunet-peerinfo.c
@@ -305,22 +305,6 @@ run (void *cls,
305 305
306 306
307/** 307/**
308 * gnunet-peerinfo command line options
309 */
310static struct GNUNET_GETOPT_CommandLineOption options[] = {
311 {'n', "numeric", NULL,
312 gettext_noop ("don't resolve host names"),
313 0, &GNUNET_GETOPT_set_one, &no_resolve},
314 {'q', "quiet", NULL,
315 gettext_noop ("output only the identity strings"),
316 0, &GNUNET_GETOPT_set_one, &be_quiet},
317 {'s', "self", NULL,
318 gettext_noop ("output our own identity only"),
319 0, &GNUNET_GETOPT_set_one, &get_self},
320 GNUNET_GETOPT_OPTION_END
321};
322
323/**
324 * The main function to obtain peer information. 308 * The main function to obtain peer information.
325 * 309 *
326 * @param argc number of arguments from the command line 310 * @param argc number of arguments from the command line
@@ -330,6 +314,18 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
330int 314int
331main (int argc, char *const *argv) 315main (int argc, char *const *argv)
332{ 316{
317 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
318 {'n', "numeric", NULL,
319 gettext_noop ("don't resolve host names"),
320 0, &GNUNET_GETOPT_set_one, &no_resolve},
321 {'q', "quiet", NULL,
322 gettext_noop ("output only the identity strings"),
323 0, &GNUNET_GETOPT_set_one, &be_quiet},
324 {'s', "self", NULL,
325 gettext_noop ("output our own identity only"),
326 0, &GNUNET_GETOPT_set_one, &get_self},
327 GNUNET_GETOPT_OPTION_END
328 };
333 return (GNUNET_OK == 329 return (GNUNET_OK ==
334 GNUNET_PROGRAM_run (argc, 330 GNUNET_PROGRAM_run (argc,
335 argv, 331 argv,
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index 63c605705..ae8a0dfe3 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -776,22 +776,6 @@ handle_notify (void *cls,
776 776
777 777
778/** 778/**
779 * List of handlers for the messages understood by this
780 * service.
781 */
782static struct GNUNET_SERVER_MessageHandler handlers[] = {
783 {&handle_hello, NULL, GNUNET_MESSAGE_TYPE_HELLO, 0},
784 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET,
785 sizeof (struct ListPeerMessage)},
786 {&handle_get_all, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL,
787 sizeof (struct ListAllPeersMessage)},
788 {&handle_notify, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY,
789 sizeof (struct GNUNET_MessageHeader)},
790 {NULL, NULL, 0, 0}
791};
792
793
794/**
795 * Clean up our state. Called during shutdown. 779 * Clean up our state. Called during shutdown.
796 * 780 *
797 * @param cls unused 781 * @param cls unused
@@ -825,6 +809,16 @@ run (void *cls,
825 struct GNUNET_SERVER_Handle *server, 809 struct GNUNET_SERVER_Handle *server,
826 const struct GNUNET_CONFIGURATION_Handle *cfg) 810 const struct GNUNET_CONFIGURATION_Handle *cfg)
827{ 811{
812 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
813 {&handle_hello, NULL, GNUNET_MESSAGE_TYPE_HELLO, 0},
814 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET,
815 sizeof (struct ListPeerMessage)},
816 {&handle_get_all, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL,
817 sizeof (struct ListAllPeersMessage)},
818 {&handle_notify, NULL, GNUNET_MESSAGE_TYPE_PEERINFO_NOTIFY,
819 sizeof (struct GNUNET_MessageHeader)},
820 {NULL, NULL, 0, 0}
821 };
828 stats = GNUNET_STATISTICS_create (sched, "peerinfo", cfg); 822 stats = GNUNET_STATISTICS_create (sched, "peerinfo", cfg);
829 notify_list = GNUNET_SERVER_notification_context_create (server, 0); 823 notify_list = GNUNET_SERVER_notification_context_create (server, 0);
830 GNUNET_assert (GNUNET_OK == 824 GNUNET_assert (GNUNET_OK ==
diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c
index 428ce932f..efc6ce128 100644
--- a/src/statistics/gnunet-service-statistics.c
+++ b/src/statistics/gnunet-service-statistics.c
@@ -420,17 +420,6 @@ handle_set (void *cls,
420 420
421 421
422/** 422/**
423 * List of handlers for the messages understood by this
424 * service.
425 */
426static struct GNUNET_SERVER_MessageHandler handlers[] = {
427 {&handle_set, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_SET, 0},
428 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_GET, 0},
429 {NULL, NULL, 0, 0}
430};
431
432
433/**
434 * Task run during shutdown. 423 * Task run during shutdown.
435 * 424 *
436 * @param cls unused 425 * @param cls unused
@@ -458,6 +447,11 @@ run (void *cls,
458 struct GNUNET_SERVER_Handle *server, 447 struct GNUNET_SERVER_Handle *server,
459 const struct GNUNET_CONFIGURATION_Handle *c) 448 const struct GNUNET_CONFIGURATION_Handle *c)
460{ 449{
450 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
451 {&handle_set, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_SET, 0},
452 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_STATISTICS_GET, 0},
453 {NULL, NULL, 0, 0}
454 };
461 cfg = c; 455 cfg = c;
462 GNUNET_SERVER_add_handlers (server, handlers); 456 GNUNET_SERVER_add_handlers (server, handlers);
463 load (server); 457 load (server);
diff --git a/src/statistics/gnunet-statistics.c b/src/statistics/gnunet-statistics.c
index 4fc8d8435..159a7548d 100644
--- a/src/statistics/gnunet-statistics.c
+++ b/src/statistics/gnunet-statistics.c
@@ -150,23 +150,6 @@ run (void *cls,
150} 150}
151 151
152/** 152/**
153 * gnunet-statistics command line options
154 */
155static struct GNUNET_GETOPT_CommandLineOption options[] = {
156 {'n', "name", "NAME",
157 gettext_noop ("limit output to statistcs for the given NAME"), 1,
158 &GNUNET_GETOPT_set_string, &name},
159 {'p', "persistent", NULL,
160 gettext_noop ("make the value being set persistent"), 0,
161 &GNUNET_GETOPT_set_one, &persistent},
162 {'s', "subsystem", "SUBSYSTEM",
163 gettext_noop ("limit output to the given SUBSYSTEM"), 1,
164 &GNUNET_GETOPT_set_string, &subsystem},
165 GNUNET_GETOPT_OPTION_END
166};
167
168
169/**
170 * The main function to obtain statistics in GNUnet. 153 * The main function to obtain statistics in GNUnet.
171 * 154 *
172 * @param argc number of arguments from the command line 155 * @param argc number of arguments from the command line
@@ -176,6 +159,18 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
176int 159int
177main (int argc, char *const *argv) 160main (int argc, char *const *argv)
178{ 161{
162 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
163 {'n', "name", "NAME",
164 gettext_noop ("limit output to statistcs for the given NAME"), 1,
165 &GNUNET_GETOPT_set_string, &name},
166 {'p', "persistent", NULL,
167 gettext_noop ("make the value being set persistent"), 0,
168 &GNUNET_GETOPT_set_one, &persistent},
169 {'s', "subsystem", "SUBSYSTEM",
170 gettext_noop ("limit output to the given SUBSYSTEM"), 1,
171 &GNUNET_GETOPT_set_string, &subsystem},
172 GNUNET_GETOPT_OPTION_END
173 };
179 return (GNUNET_OK == 174 return (GNUNET_OK ==
180 GNUNET_PROGRAM_run (argc, 175 GNUNET_PROGRAM_run (argc,
181 argv, 176 argv,
diff --git a/src/template/gnunet-service-template.c b/src/template/gnunet-service-template.c
index 39d332226..e815398fc 100644
--- a/src/template/gnunet-service-template.c
+++ b/src/template/gnunet-service-template.c
@@ -29,16 +29,6 @@
29 29
30 30
31/** 31/**
32 * List of handlers for the messages understood by this
33 * service.
34 */
35static struct GNUNET_SERVER_MessageHandler handlers[] = {
36 /* FIXME: add handlers here! */
37 {NULL, NULL, 0, 0}
38};
39
40
41/**
42 * Task run during shutdown. 32 * Task run during shutdown.
43 * 33 *
44 * @param cls unused 34 * @param cls unused
@@ -66,6 +56,10 @@ run (void *cls,
66 struct GNUNET_SERVER_Handle *server, 56 struct GNUNET_SERVER_Handle *server,
67 const struct GNUNET_CONFIGURATION_Handle *cfg) 57 const struct GNUNET_CONFIGURATION_Handle *cfg)
68{ 58{
59 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
60 /* FIXME: add handlers here! */
61 {NULL, NULL, 0, 0}
62 };
69 /* FIXME: do setup here */ 63 /* FIXME: do setup here */
70 GNUNET_SERVER_add_handlers (server, handlers); 64 GNUNET_SERVER_add_handlers (server, handlers);
71 GNUNET_SCHEDULER_add_delayed (sched, 65 GNUNET_SCHEDULER_add_delayed (sched,
diff --git a/src/template/gnunet-template.c b/src/template/gnunet-template.c
index ad0da8159..a32b42379 100644
--- a/src/template/gnunet-template.c
+++ b/src/template/gnunet-template.c
@@ -52,14 +52,6 @@ run (void *cls,
52 /* main code here */ 52 /* main code here */
53} 53}
54 54
55/**
56 * gnunet-template command line options
57 */
58static struct GNUNET_GETOPT_CommandLineOption options[] = {
59 /* FIMXE: add options here */
60 GNUNET_GETOPT_OPTION_END
61};
62
63 55
64/** 56/**
65 * The main function to obtain template from gnunetd. 57 * The main function to obtain template from gnunetd.
@@ -71,6 +63,10 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
71int 63int
72main (int argc, char *const *argv) 64main (int argc, char *const *argv)
73{ 65{
66 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
67 /* FIMXE: add options here */
68 GNUNET_GETOPT_OPTION_END
69 };
74 return (GNUNET_OK == 70 return (GNUNET_OK ==
75 GNUNET_PROGRAM_run (argc, 71 GNUNET_PROGRAM_run (argc,
76 argv, 72 argv,
diff --git a/src/topology/gnunet-daemon-topology.c b/src/topology/gnunet-daemon-topology.c
index e1c904622..970045093 100644
--- a/src/topology/gnunet-daemon-topology.c
+++ b/src/topology/gnunet-daemon-topology.c
@@ -1431,14 +1431,6 @@ run (void *cls,
1431 1431
1432 1432
1433/** 1433/**
1434 * gnunet-daemon-topology command line options.
1435 */
1436static struct GNUNET_GETOPT_CommandLineOption options[] = {
1437 GNUNET_GETOPT_OPTION_END
1438};
1439
1440
1441/**
1442 * The main function for the topology daemon. 1434 * The main function for the topology daemon.
1443 * 1435 *
1444 * @param argc number of arguments from the command line 1436 * @param argc number of arguments from the command line
@@ -1448,6 +1440,9 @@ static struct GNUNET_GETOPT_CommandLineOption options[] = {
1448int 1440int
1449main (int argc, char *const *argv) 1441main (int argc, char *const *argv)
1450{ 1442{
1443 static const struct GNUNET_GETOPT_CommandLineOption options[] = {
1444 GNUNET_GETOPT_OPTION_END
1445 };
1451 int ret; 1446 int ret;
1452 1447
1453 ret = (GNUNET_OK == 1448 ret = (GNUNET_OK ==
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index 4ad9f2339..2d6a1cbb0 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -4656,29 +4656,6 @@ handle_address_lookup (void *cls,
4656 &transmit_address_to_client, tc); 4656 &transmit_address_to_client, tc);
4657} 4657}
4658 4658
4659/**
4660 * List of handlers for the messages understood by this
4661 * service.
4662 */
4663static struct GNUNET_SERVER_MessageHandler handlers[] = {
4664 {&handle_start, NULL,
4665 GNUNET_MESSAGE_TYPE_TRANSPORT_START, 0},
4666 {&handle_hello, NULL,
4667 GNUNET_MESSAGE_TYPE_HELLO, 0},
4668 {&handle_send, NULL,
4669 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 0},
4670 {&handle_set_quota, NULL,
4671 GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA, sizeof (struct QuotaSetMessage)},
4672 {&handle_address_lookup, NULL,
4673 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP,
4674 0},
4675 {&handle_blacklist_init, NULL,
4676 GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT, sizeof (struct GNUNET_MessageHeader)},
4677 {&handle_blacklist_reply, NULL,
4678 GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY, sizeof (struct BlacklistMessage)},
4679 {NULL, NULL, 0, 0}
4680};
4681
4682 4659
4683/** 4660/**
4684 * Setup the environment for this plugin. 4661 * Setup the environment for this plugin.
@@ -4917,6 +4894,24 @@ run (void *cls,
4917 struct GNUNET_SERVER_Handle *serv, 4894 struct GNUNET_SERVER_Handle *serv,
4918 const struct GNUNET_CONFIGURATION_Handle *c) 4895 const struct GNUNET_CONFIGURATION_Handle *c)
4919{ 4896{
4897 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
4898 {&handle_start, NULL,
4899 GNUNET_MESSAGE_TYPE_TRANSPORT_START, 0},
4900 {&handle_hello, NULL,
4901 GNUNET_MESSAGE_TYPE_HELLO, 0},
4902 {&handle_send, NULL,
4903 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND, 0},
4904 {&handle_set_quota, NULL,
4905 GNUNET_MESSAGE_TYPE_TRANSPORT_SET_QUOTA, sizeof (struct QuotaSetMessage)},
4906 {&handle_address_lookup, NULL,
4907 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP,
4908 0},
4909 {&handle_blacklist_init, NULL,
4910 GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT, sizeof (struct GNUNET_MessageHeader)},
4911 {&handle_blacklist_reply, NULL,
4912 GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_REPLY, sizeof (struct BlacklistMessage)},
4913 {NULL, NULL, 0, 0}
4914 };
4920 char *plugs; 4915 char *plugs;
4921 char *pos; 4916 char *pos;
4922 int no_transports; 4917 int no_transports;
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 73b9c9654..74ea72de4 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -63,36 +63,6 @@ RORu64 (unsigned long long x, unsigned long long y)
63 return (x >> y) | (x << (64 - y)); 63 return (x >> y) | (x << (64 - y));
64} 64}
65 65
66const unsigned long long sha512_K[80] = {
67 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
68 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
69 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
70 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
71 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
72 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
73 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
74 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
75 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
76 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
77 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
78 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
79 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
80 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
81 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
82 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
83 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
84 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
85 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
86 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
87 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
88 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
89 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
90 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
91 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
92 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
93 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
94};
95
96#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39)) 66#define e0(x) (RORu64(x,28) ^ RORu64(x,34) ^ RORu64(x,39))
97#define e1(x) (RORu64(x,14) ^ RORu64(x,18) ^ RORu64(x,41)) 67#define e1(x) (RORu64(x,14) ^ RORu64(x,18) ^ RORu64(x,41))
98#define s0(x) (RORu64(x, 1) ^ RORu64(x, 8) ^ (x >> 7)) 68#define s0(x) (RORu64(x, 1) ^ RORu64(x, 8) ^ (x >> 7))
@@ -143,6 +113,36 @@ const unsigned long long sha512_K[80] = {
143static void 113static void
144sha512_transform (unsigned long long *state, const unsigned char *input) 114sha512_transform (unsigned long long *state, const unsigned char *input)
145{ 115{
116 static const unsigned long long sha512_K[80] = {
117 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL,
118 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
119 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL,
120 0x12835b0145706fbeULL, 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
121 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, 0x9bdc06a725c71235ULL,
122 0xc19bf174cf692694ULL, 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
123 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, 0x2de92c6f592b0275ULL,
124 0x4a7484aa6ea6e483ULL, 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
125 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, 0xb00327c898fb213fULL,
126 0xbf597fc7beef0ee4ULL, 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
127 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, 0x27b70a8546d22ffcULL,
128 0x2e1b21385c26c926ULL, 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
129 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, 0x81c2c92e47edaee6ULL,
130 0x92722c851482353bULL, 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
131 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, 0xd192e819d6ef5218ULL,
132 0xd69906245565a910ULL, 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
133 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, 0x2748774cdf8eeb99ULL,
134 0x34b0bcb5e19b48a8ULL, 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
135 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, 0x748f82ee5defb2fcULL,
136 0x78a5636f43172f60ULL, 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
137 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, 0xbef9a3f7b2c67915ULL,
138 0xc67178f2e372532bULL, 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
139 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, 0x06f067aa72176fbaULL,
140 0x0a637dc5a2c898a6ULL, 0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
141 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, 0x3c9ebe0a15c9bebcULL,
142 0x431d67c49c100d4cULL, 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
143 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL,
144 };
145
146 unsigned long long a, b, c, d, e, f, g, h, t1, t2; 146 unsigned long long a, b, c, d, e, f, g, h, t1, t2;
147 unsigned long long W[80]; 147 unsigned long long W[80];
148 unsigned long long t0; 148 unsigned long long t0;
@@ -561,11 +561,6 @@ GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc)
561 561
562/* ***************** binary-ASCII encoding *************** */ 562/* ***************** binary-ASCII encoding *************** */
563 563
564/**
565 * 32 characters for encoding (GNUNET_CRYPTO_hash => 32 characters)
566 */
567static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
568
569static unsigned int 564static unsigned int
570getValue__ (unsigned char a) 565getValue__ (unsigned char a)
571{ 566{
@@ -591,6 +586,10 @@ void
591GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block, 586GNUNET_CRYPTO_hash_to_enc (const GNUNET_HashCode * block,
592 struct GNUNET_CRYPTO_HashAsciiEncoded *result) 587 struct GNUNET_CRYPTO_HashAsciiEncoded *result)
593{ 588{
589 /**
590 * 32 characters for encoding (GNUNET_CRYPTO_hash => 32 characters)
591 */
592 static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
594 unsigned int wpos; 593 unsigned int wpos;
595 unsigned int rpos; 594 unsigned int rpos;
596 unsigned int bits; 595 unsigned int bits;
diff --git a/src/util/crypto_ksk.c b/src/util/crypto_ksk.c
index 4960df9e2..888c08384 100644
--- a/src/util/crypto_ksk.c
+++ b/src/util/crypto_ksk.c
@@ -67,95 +67,6 @@ struct GNUNET_CRYPTO_RsaPrivateKey
67}; 67};
68 68
69 69
70/* Note: 2 is not included because it can be tested more easily by
71 looking at bit 0. The last entry in this list is marked by a zero */
72static uint16_t small_prime_numbers[] = {
73 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
74 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
75 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
76 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
77 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
78 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
79 331, 337, 347, 349, 353, 359, 367, 373, 379, 383,
80 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
81 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
82 509, 521, 523, 541, 547, 557, 563, 569, 571, 577,
83 587, 593, 599, 601, 607, 613, 617, 619, 631, 641,
84 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
85 709, 719, 727, 733, 739, 743, 751, 757, 761, 769,
86 773, 787, 797, 809, 811, 821, 823, 827, 829, 839,
87 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
88 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
89 991, 997, 1009, 1013, 1019, 1021, 1031, 1033,
90 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091,
91 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
92 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213,
93 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277,
94 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307,
95 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399,
96 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,
97 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493,
98 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559,
99 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609,
100 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667,
101 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,
102 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789,
103 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871,
104 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931,
105 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997,
106 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,
107 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111,
108 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161,
109 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243,
110 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297,
111 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
112 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411,
113 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473,
114 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551,
115 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633,
116 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,
117 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729,
118 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791,
119 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851,
120 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917,
121 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
122 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061,
123 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137,
124 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209,
125 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271,
126 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,
127 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391,
128 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467,
129 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533,
130 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583,
131 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,
132 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709,
133 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779,
134 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851,
135 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917,
136 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,
137 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049,
138 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111,
139 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177,
140 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243,
141 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,
142 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391,
143 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457,
144 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519,
145 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597,
146 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
147 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729,
148 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799,
149 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889,
150 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951,
151 4957, 4967, 4969, 4973, 4987, 4993, 4999,
152 0
153};
154
155#define DIM(v) (sizeof(v)/sizeof((v)[0]))
156static int no_of_small_prime_numbers = DIM (small_prime_numbers) - 1;
157
158
159static unsigned int 70static unsigned int
160get_nbits (mpz_t a) 71get_nbits (mpz_t a)
161{ 72{
@@ -258,6 +169,93 @@ leave:
258static void 169static void
259gen_prime (mpz_t ptest, unsigned int nbits, GNUNET_HashCode * hc) 170gen_prime (mpz_t ptest, unsigned int nbits, GNUNET_HashCode * hc)
260{ 171{
172 /* Note: 2 is not included because it can be tested more easily by
173 looking at bit 0. The last entry in this list is marked by a zero */
174 static const uint16_t small_prime_numbers[] = {
175 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43,
176 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
177 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
178 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
179 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
180 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
181 331, 337, 347, 349, 353, 359, 367, 373, 379, 383,
182 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,
183 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
184 509, 521, 523, 541, 547, 557, 563, 569, 571, 577,
185 587, 593, 599, 601, 607, 613, 617, 619, 631, 641,
186 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
187 709, 719, 727, 733, 739, 743, 751, 757, 761, 769,
188 773, 787, 797, 809, 811, 821, 823, 827, 829, 839,
189 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
190 919, 929, 937, 941, 947, 953, 967, 971, 977, 983,
191 991, 997, 1009, 1013, 1019, 1021, 1031, 1033,
192 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091,
193 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,
194 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213,
195 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277,
196 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307,
197 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399,
198 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,
199 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493,
200 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559,
201 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609,
202 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667,
203 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,
204 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789,
205 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871,
206 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931,
207 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997,
208 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,
209 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111,
210 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161,
211 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243,
212 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297,
213 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,
214 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411,
215 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473,
216 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551,
217 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633,
218 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,
219 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729,
220 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791,
221 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851,
222 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917,
223 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
224 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061,
225 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137,
226 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209,
227 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271,
228 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,
229 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391,
230 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467,
231 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533,
232 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583,
233 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,
234 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709,
235 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779,
236 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851,
237 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917,
238 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,
239 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049,
240 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111,
241 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177,
242 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243,
243 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,
244 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391,
245 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457,
246 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519,
247 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597,
248 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,
249 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729,
250 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799,
251 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889,
252 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951,
253 4957, 4967, 4969, 4973, 4987, 4993, 4999,
254 0
255 };
256#define DIM(v) (sizeof(v)/sizeof((v)[0]))
257 static int no_of_small_prime_numbers = DIM (small_prime_numbers) - 1;
258
261 mpz_t prime, pminus1, val_2, val_3, result; 259 mpz_t prime, pminus1, val_2, val_3, result;
262 int i; 260 int i;
263 unsigned x, step; 261 unsigned x, step;
diff --git a/src/util/getopt.c b/src/util/getopt.c
index 63caa0346..60673af08 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -135,12 +135,6 @@ static char *GNoptarg = NULL;
135/* 1003.2 says this must be 1 before any call. */ 135/* 1003.2 says this must be 1 before any call. */
136static int GNoptind = 1; 136static int GNoptind = 1;
137 137
138/* Formerly, initialization of getopt depended on GNoptind==0, which
139 causes problems with re-calling getopt as programs generally don't
140 know that. */
141
142static int __getopt_initialized = 0;
143
144/* The next char to be scanned in the option-element 138/* The next char to be scanned in the option-element
145 in which the last option character we returned was found. 139 in which the last option character we returned was found.
146 This allows us to pick up the scan where we left off. 140 This allows us to pick up the scan where we left off.
@@ -150,16 +144,6 @@ static int __getopt_initialized = 0;
150 144
151static char *nextchar; 145static char *nextchar;
152 146
153/* Callers store zero here to inhibit the error message
154 for unrecognized options. */
155
156static int GNopterr = 1;
157
158/* Set to an option character which was unrecognized.
159 This must be initialized on some systems to avoid linking in the
160 system's own getopt implementation. */
161
162static int GNoptopt = '?';
163 147
164/* Describe how to deal with options that follow non-option ARGV-elements. 148/* Describe how to deal with options that follow non-option ARGV-elements.
165 149
@@ -513,14 +497,17 @@ _getopt_initialize (argc, argv, optstring)
513 long-named options. */ 497 long-named options. */
514 498
515static int 499static int
516GN_getopt_internal (argc, argv, optstring, longopts, longind, long_only) 500GN_getopt_internal (int argc,
517 int argc; 501 char *const *argv,
518 char *const *argv; 502 const char *optstring,
519 const char *optstring; 503 const struct GNoption *longopts,
520 const struct GNoption *longopts; 504 int *longind,
521 int *longind; 505 int long_only)
522 int long_only;
523{ 506{
507 static int __getopt_initialized = 0;
508 static int GNopterr = 1;
509 static int GNoptopt = '?';
510
524 GNoptarg = NULL; 511 GNoptarg = NULL;
525 512
526 if (GNoptind == 0 || !__getopt_initialized) 513 if (GNoptind == 0 || !__getopt_initialized)
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index 59d4c1d97..5739571ae 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -473,16 +473,6 @@ handle_get (void *cls,
473 473
474 474
475/** 475/**
476 * List of handlers for the messages understood by this
477 * service.
478 */
479static struct GNUNET_SERVER_MessageHandler handlers[] = {
480 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST, 0},
481 {NULL, NULL, 0, 0}
482};
483
484
485/**
486 * Process resolver requests. 476 * Process resolver requests.
487 * 477 *
488 * @param cls closure 478 * @param cls closure
@@ -496,6 +486,10 @@ run (void *cls,
496 struct GNUNET_SERVER_Handle *server, 486 struct GNUNET_SERVER_Handle *server,
497 const struct GNUNET_CONFIGURATION_Handle *cfg) 487 const struct GNUNET_CONFIGURATION_Handle *cfg)
498{ 488{
489 static const struct GNUNET_SERVER_MessageHandler handlers[] = {
490 {&handle_get, NULL, GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST, 0},
491 {NULL, NULL, 0, 0}
492 };
499 GNUNET_SERVER_add_handlers (server, handlers); 493 GNUNET_SERVER_add_handlers (server, handlers);
500} 494}
501 495