diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/client.c | 14 | ||||
-rw-r--r-- | src/util/common_logging.c | 52 | ||||
-rw-r--r-- | src/util/configuration.c | 191 | ||||
-rw-r--r-- | src/util/disk.c | 8 | ||||
-rw-r--r-- | src/util/getopt.c | 3 | ||||
-rw-r--r-- | src/util/network.c | 15 | ||||
-rw-r--r-- | src/util/os_network.c | 4 | ||||
-rw-r--r-- | src/util/pseudonym.c | 2 |
8 files changed, 265 insertions, 24 deletions
diff --git a/src/util/client.c b/src/util/client.c index 82ab35d21..9a2f47678 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -303,25 +303,25 @@ receive_task (void *scls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
303 | * | 303 | * |
304 | * @param sock the service | 304 | * @param sock the service |
305 | * @param handler function to call with the message | 305 | * @param handler function to call with the message |
306 | * @param cls closure for handler | 306 | * @param handler_cls closure for handler |
307 | * @param timeout how long to wait until timing out | 307 | * @param timeout how long to wait until timing out |
308 | */ | 308 | */ |
309 | void | 309 | void |
310 | GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, | 310 | GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, |
311 | GNUNET_CLIENT_MessageHandler handler, | 311 | GNUNET_CLIENT_MessageHandler handler, |
312 | void *cls, struct GNUNET_TIME_Relative timeout) | 312 | void *handler_cls, struct GNUNET_TIME_Relative timeout) |
313 | { | 313 | { |
314 | if (sock->sock == NULL) | 314 | if (sock->sock == NULL) |
315 | { | 315 | { |
316 | /* already disconnected, fail instantly! */ | 316 | /* already disconnected, fail instantly! */ |
317 | GNUNET_break (0); /* this should not happen in well-written code! */ | 317 | GNUNET_break (0); /* this should not happen in well-written code! */ |
318 | handler (cls, NULL); | 318 | handler (handler_cls, NULL); |
319 | return; | 319 | return; |
320 | } | 320 | } |
321 | GNUNET_assert (sock->receiver_task == | 321 | GNUNET_assert (sock->receiver_task == |
322 | GNUNET_SCHEDULER_NO_TASK); | 322 | GNUNET_SCHEDULER_NO_TASK); |
323 | sock->receiver_handler = handler; | 323 | sock->receiver_handler = handler; |
324 | sock->receiver_handler_cls = cls; | 324 | sock->receiver_handler_cls = handler_cls; |
325 | sock->receive_timeout = GNUNET_TIME_relative_to_absolute (timeout); | 325 | sock->receive_timeout = GNUNET_TIME_relative_to_absolute (timeout); |
326 | if (GNUNET_YES == sock->msg_complete) | 326 | if (GNUNET_YES == sock->msg_complete) |
327 | sock->receiver_task = GNUNET_SCHEDULER_add_after (sock->sched, | 327 | sock->receiver_task = GNUNET_SCHEDULER_add_after (sock->sched, |
@@ -331,9 +331,9 @@ GNUNET_CLIENT_receive (struct GNUNET_CLIENT_Connection *sock, | |||
331 | &receive_task, sock); | 331 | &receive_task, sock); |
332 | else | 332 | else |
333 | sock->receiver_task = GNUNET_CONNECTION_receive (sock->sock, | 333 | sock->receiver_task = GNUNET_CONNECTION_receive (sock->sock, |
334 | GNUNET_SERVER_MAX_MESSAGE_SIZE, | 334 | GNUNET_SERVER_MAX_MESSAGE_SIZE, |
335 | timeout, | 335 | timeout, |
336 | &receive_helper, sock); | 336 | &receive_helper, sock); |
337 | } | 337 | } |
338 | 338 | ||
339 | 339 | ||
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 436e009ab..ea3ab4f78 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -123,12 +123,17 @@ static struct CustomLogger *loggers; | |||
123 | */ | 123 | */ |
124 | static unsigned int skip_log; | 124 | static unsigned int skip_log; |
125 | 125 | ||
126 | /** | ||
127 | * File descriptor to use for "stderr", or NULL for none. | ||
128 | */ | ||
126 | static FILE *GNUNET_stderr; | 129 | static FILE *GNUNET_stderr; |
127 | 130 | ||
128 | /** | 131 | /** |
129 | * Convert a textual description of a loglevel | 132 | * Convert a textual description of a loglevel |
130 | * to the respective GNUNET_GE_KIND. | 133 | * to the respective GNUNET_GE_KIND. |
131 | * @returns GNUNET_GE_INVALID if log does not parse | 134 | * |
135 | * @param log loglevel to parse | ||
136 | * @return GNUNET_GE_INVALID if log does not parse | ||
132 | */ | 137 | */ |
133 | static enum GNUNET_ErrorType | 138 | static enum GNUNET_ErrorType |
134 | get_type (const char *log) | 139 | get_type (const char *log) |
@@ -144,6 +149,7 @@ get_type (const char *log) | |||
144 | return GNUNET_ERROR_TYPE_INVALID; | 149 | return GNUNET_ERROR_TYPE_INVALID; |
145 | } | 150 | } |
146 | 151 | ||
152 | |||
147 | /** | 153 | /** |
148 | * Setup logging. | 154 | * Setup logging. |
149 | * | 155 | * |
@@ -219,6 +225,15 @@ GNUNET_logger_remove (GNUNET_Logger logger, void *logger_cls) | |||
219 | GNUNET_free (pos); | 225 | GNUNET_free (pos); |
220 | } | 226 | } |
221 | 227 | ||
228 | |||
229 | /** | ||
230 | * Actually output the log message. | ||
231 | * | ||
232 | * @param kind how severe was the issue | ||
233 | * @param comp component responsible | ||
234 | * @param datestr current date/time | ||
235 | * @param msg the actual message | ||
236 | */ | ||
222 | static void | 237 | static void |
223 | output_message (enum GNUNET_ErrorType kind, | 238 | output_message (enum GNUNET_ErrorType kind, |
224 | const char *comp, const char *datestr, const char *msg) | 239 | const char *comp, const char *datestr, const char *msg) |
@@ -235,6 +250,12 @@ output_message (enum GNUNET_ErrorType kind, | |||
235 | } | 250 | } |
236 | } | 251 | } |
237 | 252 | ||
253 | |||
254 | /** | ||
255 | * Flush an existing bulk report to the output. | ||
256 | * | ||
257 | * @param datastr our current timestamp | ||
258 | */ | ||
238 | static void | 259 | static void |
239 | flush_bulk (const char *datestr) | 260 | flush_bulk (const char *datestr) |
240 | { | 261 | { |
@@ -294,6 +315,14 @@ GNUNET_log_skip (unsigned int n, int check_reset) | |||
294 | } | 315 | } |
295 | 316 | ||
296 | 317 | ||
318 | /** | ||
319 | * Output a log message using the default mechanism. | ||
320 | * | ||
321 | * @param kind how severe was the issue | ||
322 | * @param comp component responsible | ||
323 | * @param message the actual message | ||
324 | * @param va arguments to the format string "message" | ||
325 | */ | ||
297 | static void | 326 | static void |
298 | mylog (enum GNUNET_ErrorType kind, | 327 | mylog (enum GNUNET_ErrorType kind, |
299 | const char *comp, const char *message, va_list va) | 328 | const char *comp, const char *message, va_list va) |
@@ -346,6 +375,13 @@ mylog (enum GNUNET_ErrorType kind, | |||
346 | } | 375 | } |
347 | 376 | ||
348 | 377 | ||
378 | /** | ||
379 | * Main log function. | ||
380 | * | ||
381 | * @param kind how serious is the error? | ||
382 | * @param message what is the message (format string) | ||
383 | * @param ... arguments for format string | ||
384 | */ | ||
349 | void | 385 | void |
350 | GNUNET_log (enum GNUNET_ErrorType kind, const char *message, ...) | 386 | GNUNET_log (enum GNUNET_ErrorType kind, const char *message, ...) |
351 | { | 387 | { |
@@ -356,6 +392,15 @@ GNUNET_log (enum GNUNET_ErrorType kind, const char *message, ...) | |||
356 | } | 392 | } |
357 | 393 | ||
358 | 394 | ||
395 | /** | ||
396 | * Log function that specifies an alternative component. | ||
397 | * This function should be used by plugins. | ||
398 | * | ||
399 | * @param kind how serious is the error? | ||
400 | * @param comp component responsible for generating the message | ||
401 | * @param message what is the message (format string) | ||
402 | * @param ... arguments for format string | ||
403 | */ | ||
359 | void | 404 | void |
360 | GNUNET_log_from (enum GNUNET_ErrorType kind, | 405 | GNUNET_log_from (enum GNUNET_ErrorType kind, |
361 | const char *comp, const char *message, ...) | 406 | const char *comp, const char *message, ...) |
@@ -368,7 +413,10 @@ GNUNET_log_from (enum GNUNET_ErrorType kind, | |||
368 | 413 | ||
369 | 414 | ||
370 | /** | 415 | /** |
371 | * Convert KIND to String | 416 | * Convert error type to string. |
417 | * | ||
418 | * @param kind type to convert | ||
419 | * @return string corresponding to the type | ||
372 | */ | 420 | */ |
373 | const char * | 421 | const char * |
374 | GNUNET_error_type_to_string (enum GNUNET_ErrorType kind) | 422 | GNUNET_error_type_to_string (enum GNUNET_ErrorType kind) |
diff --git a/src/util/configuration.c b/src/util/configuration.c index 8c32618e2..569c4adcf 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "gnunet_os_lib.h" | 33 | #include "gnunet_os_lib.h" |
34 | #include "gnunet_strings_lib.h" | 34 | #include "gnunet_strings_lib.h" |
35 | 35 | ||
36 | |||
36 | /** | 37 | /** |
37 | * @brief configuration entry | 38 | * @brief configuration entry |
38 | */ | 39 | */ |
@@ -55,6 +56,7 @@ struct ConfigEntry | |||
55 | char *val; | 56 | char *val; |
56 | }; | 57 | }; |
57 | 58 | ||
59 | |||
58 | /** | 60 | /** |
59 | * @brief configuration section | 61 | * @brief configuration section |
60 | */ | 62 | */ |
@@ -76,6 +78,7 @@ struct ConfigSection | |||
76 | char *name; | 78 | char *name; |
77 | }; | 79 | }; |
78 | 80 | ||
81 | |||
79 | /** | 82 | /** |
80 | * @brief configuration data | 83 | * @brief configuration data |
81 | */ | 84 | */ |
@@ -95,8 +98,11 @@ struct GNUNET_CONFIGURATION_Handle | |||
95 | 98 | ||
96 | }; | 99 | }; |
97 | 100 | ||
101 | |||
98 | /** | 102 | /** |
99 | * Create a GNUNET_CONFIGURATION_Configuration. | 103 | * Create a GNUNET_CONFIGURATION_Handle. |
104 | * | ||
105 | * @return fresh configuration object | ||
100 | */ | 106 | */ |
101 | struct GNUNET_CONFIGURATION_Handle * | 107 | struct GNUNET_CONFIGURATION_Handle * |
102 | GNUNET_CONFIGURATION_create () | 108 | GNUNET_CONFIGURATION_create () |
@@ -104,6 +110,12 @@ GNUNET_CONFIGURATION_create () | |||
104 | return GNUNET_malloc (sizeof (struct GNUNET_CONFIGURATION_Handle)); | 110 | return GNUNET_malloc (sizeof (struct GNUNET_CONFIGURATION_Handle)); |
105 | } | 111 | } |
106 | 112 | ||
113 | |||
114 | /** | ||
115 | * Destroy configuration object. | ||
116 | * | ||
117 | * @param cfg configuration to destroy | ||
118 | */ | ||
107 | void | 119 | void |
108 | GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) | 120 | GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) |
109 | { | 121 | { |
@@ -126,6 +138,15 @@ GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg) | |||
126 | GNUNET_free (cfg); | 138 | GNUNET_free (cfg); |
127 | } | 139 | } |
128 | 140 | ||
141 | |||
142 | /** | ||
143 | * Parse a configuration file, add all of the options in the | ||
144 | * file to the configuration environment. | ||
145 | * | ||
146 | * @param cfg configuration to update | ||
147 | * @param filename name of the configuration file | ||
148 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
149 | */ | ||
129 | int | 150 | int |
130 | GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | 151 | GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, |
131 | const char *filename) | 152 | const char *filename) |
@@ -234,12 +255,28 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
234 | return ret; | 255 | return ret; |
235 | } | 256 | } |
236 | 257 | ||
258 | |||
259 | /** | ||
260 | * Test if there are configuration options that were | ||
261 | * changed since the last save. | ||
262 | * | ||
263 | * @param cfg configuration to inspect | ||
264 | * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed) | ||
265 | */ | ||
237 | int | 266 | int |
238 | GNUNET_CONFIGURATION_test_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg) | 267 | GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg) |
239 | { | 268 | { |
240 | return cfg->dirty; | 269 | return cfg->dirty; |
241 | } | 270 | } |
242 | 271 | ||
272 | |||
273 | /** | ||
274 | * Write configuration file. | ||
275 | * | ||
276 | * @param cfg configuration to write | ||
277 | * @param filename where to write the configuration | ||
278 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
279 | */ | ||
243 | int | 280 | int |
244 | GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *data, | 281 | GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *data, |
245 | const char *filename) | 282 | const char *filename) |
@@ -315,6 +352,13 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *data, | |||
315 | } | 352 | } |
316 | 353 | ||
317 | 354 | ||
355 | /** | ||
356 | * Iterate over all options in the configuration. | ||
357 | * | ||
358 | * @param cfg configuration to inspect | ||
359 | * @param iter function to call on each option | ||
360 | * @param iter_cls closure for iter | ||
361 | */ | ||
318 | void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | 362 | void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, |
319 | GNUNET_CONFIGURATION_Iterator iter, | 363 | GNUNET_CONFIGURATION_Iterator iter, |
320 | void *iter_cls) | 364 | void *iter_cls) |
@@ -336,6 +380,14 @@ void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg | |||
336 | } | 380 | } |
337 | 381 | ||
338 | 382 | ||
383 | /** | ||
384 | * FIXME. | ||
385 | * | ||
386 | * @param cls the destination configuration (struct GNUNET_CONFIGURATION_Handle*) | ||
387 | * @param section FIXME | ||
388 | * @param option FIXME | ||
389 | * @param value FIXME | ||
390 | */ | ||
339 | static void | 391 | static void |
340 | copy_entry (void *cls, | 392 | copy_entry (void *cls, |
341 | const char *section, | 393 | const char *section, |
@@ -347,6 +399,12 @@ copy_entry (void *cls, | |||
347 | } | 399 | } |
348 | 400 | ||
349 | 401 | ||
402 | /** | ||
403 | * Duplicate an existing configuration object. | ||
404 | * | ||
405 | * @param c configuration to duplicate | ||
406 | * @return duplicate configuration | ||
407 | */ | ||
350 | struct GNUNET_CONFIGURATION_Handle * | 408 | struct GNUNET_CONFIGURATION_Handle * |
351 | GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) | 409 | GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) |
352 | { | 410 | { |
@@ -358,6 +416,13 @@ GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
358 | } | 416 | } |
359 | 417 | ||
360 | 418 | ||
419 | /** | ||
420 | * FIXME. | ||
421 | * | ||
422 | * @param data FIXME | ||
423 | * @param section FIXME | ||
424 | * @return matching entry, NULL if not found | ||
425 | */ | ||
361 | static struct ConfigSection * | 426 | static struct ConfigSection * |
362 | findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section) | 427 | findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section) |
363 | { | 428 | { |
@@ -370,6 +435,14 @@ findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section | |||
370 | } | 435 | } |
371 | 436 | ||
372 | 437 | ||
438 | /** | ||
439 | * FIXME. | ||
440 | * | ||
441 | * @param data FIXME | ||
442 | * @param section FIXME | ||
443 | * @param key FIXME | ||
444 | * @return matching entry, NULL if not found | ||
445 | */ | ||
373 | static struct ConfigEntry * | 446 | static struct ConfigEntry * |
374 | findEntry (const struct GNUNET_CONFIGURATION_Handle *data, | 447 | findEntry (const struct GNUNET_CONFIGURATION_Handle *data, |
375 | const char *section, const char *key) | 448 | const char *section, const char *key) |
@@ -386,6 +459,15 @@ findEntry (const struct GNUNET_CONFIGURATION_Handle *data, | |||
386 | return pos; | 459 | return pos; |
387 | } | 460 | } |
388 | 461 | ||
462 | |||
463 | /** | ||
464 | * Set a configuration value that should be a string. | ||
465 | * | ||
466 | * @param cfg configuration to update | ||
467 | * @param section section of interest | ||
468 | * @param option option of interest | ||
469 | * @param value value to set | ||
470 | */ | ||
389 | void | 471 | void |
390 | GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle | 472 | GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle |
391 | *data, | 473 | *data, |
@@ -417,6 +499,15 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle | |||
417 | sec->entries = e; | 499 | sec->entries = e; |
418 | } | 500 | } |
419 | 501 | ||
502 | |||
503 | /** | ||
504 | * Set a configuration value that should be a number. | ||
505 | * | ||
506 | * @param cfg configuration to update | ||
507 | * @param section section of interest | ||
508 | * @param option option of interest | ||
509 | * @param number value to set | ||
510 | */ | ||
420 | void | 511 | void |
421 | GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle | 512 | GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle |
422 | *cfg, const char *section, | 513 | *cfg, const char *section, |
@@ -428,6 +519,16 @@ GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle | |||
428 | GNUNET_CONFIGURATION_set_value_string (cfg, section, option, s); | 519 | GNUNET_CONFIGURATION_set_value_string (cfg, section, option, s); |
429 | } | 520 | } |
430 | 521 | ||
522 | |||
523 | /** | ||
524 | * Get a configuration value that should be a number. | ||
525 | * | ||
526 | * @param cfg configuration to inspect | ||
527 | * @param section section of interest | ||
528 | * @param option option of interest | ||
529 | * @param number where to store the numeric value of the option | ||
530 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
531 | */ | ||
431 | int | 532 | int |
432 | GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle | 533 | GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle |
433 | *cfg, const char *section, | 534 | *cfg, const char *section, |
@@ -444,6 +545,16 @@ GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle | |||
444 | return GNUNET_OK; | 545 | return GNUNET_OK; |
445 | } | 546 | } |
446 | 547 | ||
548 | |||
549 | /** | ||
550 | * Get a configuration value that should be a relative time. | ||
551 | * | ||
552 | * @param cfg configuration to inspect | ||
553 | * @param section section of interest | ||
554 | * @param option option of interest | ||
555 | * @param time set to the time value stored in the configuration | ||
556 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
557 | */ | ||
447 | int | 558 | int |
448 | GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle | 559 | GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle |
449 | *cfg, const char *section, | 560 | *cfg, const char *section, |
@@ -462,6 +573,17 @@ GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle | |||
462 | return ret; | 573 | return ret; |
463 | } | 574 | } |
464 | 575 | ||
576 | |||
577 | /** | ||
578 | * Get a configuration value that should be a string. | ||
579 | * | ||
580 | * @param cfg configuration to inspect | ||
581 | * @param section section of interest | ||
582 | * @param option option of interest | ||
583 | * @param value will be set to a freshly allocated configuration | ||
584 | * value, or NULL if option is not specified | ||
585 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
586 | */ | ||
465 | int | 587 | int |
466 | GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle | 588 | GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle |
467 | *cfg, const char *section, | 589 | *cfg, const char *section, |
@@ -479,6 +601,19 @@ GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle | |||
479 | return GNUNET_OK; | 601 | return GNUNET_OK; |
480 | } | 602 | } |
481 | 603 | ||
604 | |||
605 | /** | ||
606 | * Get a configuration value that should be in a set of | ||
607 | * predefined strings | ||
608 | * | ||
609 | * @param cfg configuration to inspect | ||
610 | * @param section section of interest | ||
611 | * @param option option of interest | ||
612 | * @param choices NULL-terminated list of legal values | ||
613 | * @param value will be set to an entry in the legal list, | ||
614 | * or NULL if option is not specified and no default given | ||
615 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
616 | */ | ||
482 | int | 617 | int |
483 | GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle | 618 | GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle |
484 | *cfg, const char *section, | 619 | *cfg, const char *section, |
@@ -511,8 +646,12 @@ GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle | |||
511 | return GNUNET_OK; | 646 | return GNUNET_OK; |
512 | } | 647 | } |
513 | 648 | ||
649 | |||
514 | /** | 650 | /** |
515 | * Test if we have a value for a particular option | 651 | * Test if we have a value for a particular option |
652 | * @param cfg configuration to inspect | ||
653 | * @param section section of interest | ||
654 | * @param option option of interest | ||
516 | * @return GNUNET_YES if so, GNUNET_NO if not. | 655 | * @return GNUNET_YES if so, GNUNET_NO if not. |
517 | */ | 656 | */ |
518 | int | 657 | int |
@@ -525,11 +664,13 @@ GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
525 | return GNUNET_YES; | 664 | return GNUNET_YES; |
526 | } | 665 | } |
527 | 666 | ||
667 | |||
528 | /** | 668 | /** |
529 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" | 669 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" |
530 | * where either in the "PATHS" section or the environtment | 670 | * where either in the "PATHS" section or the environtment |
531 | * "FOO" is set to "DIRECTORY". | 671 | * "FOO" is set to "DIRECTORY". |
532 | * | 672 | * |
673 | * @param cfg configuration to use for path expansion | ||
533 | * @param old string to $-expand (will be freed!) | 674 | * @param old string to $-expand (will be freed!) |
534 | * @return $-expanded string | 675 | * @return $-expanded string |
535 | */ | 676 | */ |
@@ -579,8 +720,13 @@ GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cf | |||
579 | return result; | 720 | return result; |
580 | } | 721 | } |
581 | 722 | ||
723 | |||
582 | /** | 724 | /** |
583 | * Get a configuration value that should be a string. | 725 | * Get a configuration value that should be a string. |
726 | * | ||
727 | * @param cfg configuration to inspect | ||
728 | * @param section section of interest | ||
729 | * @param option option of interest | ||
584 | * @param value will be set to a freshly allocated configuration | 730 | * @param value will be set to a freshly allocated configuration |
585 | * value, or NULL if option is not specified | 731 | * value, or NULL if option is not specified |
586 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 732 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
@@ -612,10 +758,14 @@ GNUNET_CONFIGURATION_get_value_filename (const struct GNUNET_CONFIGURATION_Handl | |||
612 | return ret; | 758 | return ret; |
613 | } | 759 | } |
614 | 760 | ||
761 | |||
615 | /** | 762 | /** |
616 | * Get a configuration value that should be in a set of | 763 | * Get a configuration value that should be in a set of |
617 | * "GNUNET_YES" or "GNUNET_NO". | 764 | * "GNUNET_YES" or "GNUNET_NO". |
618 | * | 765 | * |
766 | * @param cfg configuration to inspect | ||
767 | * @param section section of interest | ||
768 | * @param option option of interest | ||
619 | * @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR | 769 | * @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR |
620 | */ | 770 | */ |
621 | int | 771 | int |
@@ -639,15 +789,20 @@ GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle * | |||
639 | /** | 789 | /** |
640 | * Iterate over the set of filenames stored in a configuration value. | 790 | * Iterate over the set of filenames stored in a configuration value. |
641 | * | 791 | * |
792 | * @param cfg configuration to inspect | ||
793 | * @param section section of interest | ||
794 | * @param option option of interest | ||
795 | * @param cb function to call on each filename | ||
796 | * @param cb_cls closure for cb | ||
642 | * @return number of filenames iterated over, -1 on error | 797 | * @return number of filenames iterated over, -1 on error |
643 | */ | 798 | */ |
644 | int | 799 | int |
645 | GNUNET_CONFIGURATION_iterate_value_filenames (const struct | 800 | GNUNET_CONFIGURATION_iterate_value_filenames (const struct |
646 | GNUNET_CONFIGURATION_Handle | 801 | GNUNET_CONFIGURATION_Handle |
647 | *cfg, const char *section, | 802 | *cfg, const char *section, |
648 | const char *option, | 803 | const char *option, |
649 | GNUNET_FileNameCallback cb, | 804 | GNUNET_FileNameCallback cb, |
650 | void *cls) | 805 | void *cb_cls) |
651 | { | 806 | { |
652 | char *list; | 807 | char *list; |
653 | char *pos; | 808 | char *pos; |
@@ -692,7 +847,7 @@ GNUNET_CONFIGURATION_iterate_value_filenames (const struct | |||
692 | if (strlen (pos) > 0) | 847 | if (strlen (pos) > 0) |
693 | { | 848 | { |
694 | ret++; | 849 | ret++; |
695 | if ((cb != NULL) && (GNUNET_OK != cb (cls, pos))) | 850 | if ((cb != NULL) && (GNUNET_OK != cb (cb_cls, pos))) |
696 | { | 851 | { |
697 | ret = GNUNET_SYSERR; | 852 | ret = GNUNET_SYSERR; |
698 | break; | 853 | break; |
@@ -706,6 +861,13 @@ GNUNET_CONFIGURATION_iterate_value_filenames (const struct | |||
706 | return ret; | 861 | return ret; |
707 | } | 862 | } |
708 | 863 | ||
864 | |||
865 | /** | ||
866 | * FIXME. | ||
867 | * | ||
868 | * @param value FIXME | ||
869 | * @return FIXME | ||
870 | */ | ||
709 | static char * | 871 | static char * |
710 | escape_name (const char *value) | 872 | escape_name (const char *value) |
711 | { | 873 | { |
@@ -736,6 +898,14 @@ escape_name (const char *value) | |||
736 | return escaped; | 898 | return escaped; |
737 | } | 899 | } |
738 | 900 | ||
901 | |||
902 | /** | ||
903 | * FIXME. | ||
904 | * | ||
905 | * @param cls string we compare with (const char*) | ||
906 | * @param fn filename we are currently looking at | ||
907 | * @return GNUNET_OK if the names do not match, GNUNET_SYSERR if they do | ||
908 | */ | ||
739 | static int | 909 | static int |
740 | test_match (void *cls, const char *fn) | 910 | test_match (void *cls, const char *fn) |
741 | { | 911 | { |
@@ -743,10 +913,14 @@ test_match (void *cls, const char *fn) | |||
743 | return (0 == strcmp (of, fn)) ? GNUNET_SYSERR : GNUNET_OK; | 913 | return (0 == strcmp (of, fn)) ? GNUNET_SYSERR : GNUNET_OK; |
744 | } | 914 | } |
745 | 915 | ||
916 | |||
746 | /** | 917 | /** |
747 | * Append a filename to a configuration value that | 918 | * Append a filename to a configuration value that |
748 | * represents a list of filenames | 919 | * represents a list of filenames |
749 | * | 920 | * |
921 | * @param cfg configuration to update | ||
922 | * @param section section of interest | ||
923 | * @param option option of interest | ||
750 | * @param value filename to append | 924 | * @param value filename to append |
751 | * @return GNUNET_OK on success, | 925 | * @return GNUNET_OK on success, |
752 | * GNUNET_NO if the filename already in the list | 926 | * GNUNET_NO if the filename already in the list |
@@ -790,6 +964,9 @@ GNUNET_CONFIGURATION_append_value_filename (struct GNUNET_CONFIGURATION_Handle | |||
790 | * Remove a filename from a configuration value that | 964 | * Remove a filename from a configuration value that |
791 | * represents a list of filenames | 965 | * represents a list of filenames |
792 | * | 966 | * |
967 | * @param cfg configuration to update | ||
968 | * @param section section of interest | ||
969 | * @param option option of interest | ||
793 | * @param value filename to remove | 970 | * @param value filename to remove |
794 | * @return GNUNET_OK on success, | 971 | * @return GNUNET_OK on success, |
795 | * GNUNET_NO if the filename is not in the list, | 972 | * GNUNET_NO if the filename is not in the list, |
@@ -870,6 +1047,10 @@ GNUNET_CONFIGURATION_remove_value_filename (struct GNUNET_CONFIGURATION_Handle | |||
870 | /** | 1047 | /** |
871 | * Load configuration (starts with defaults, then loads | 1048 | * Load configuration (starts with defaults, then loads |
872 | * system-specific configuration). | 1049 | * system-specific configuration). |
1050 | * | ||
1051 | * @param cfg configuration to update | ||
1052 | * @param filename name of the configuration file | ||
1053 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
873 | */ | 1054 | */ |
874 | int | 1055 | int |
875 | GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, | 1056 | GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, |
diff --git a/src/util/disk.c b/src/util/disk.c index 9f2f8dcf7..a3d5db097 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -230,7 +230,7 @@ int GNUNET_DISK_file_get_identifiers (const char *filename, | |||
230 | /** | 230 | /** |
231 | * Create an (empty) temporary file on disk. | 231 | * Create an (empty) temporary file on disk. |
232 | * | 232 | * |
233 | * @param template component to use for the name; | 233 | * @param t component to use for the name; |
234 | * does NOT contain "XXXXXX" or "/tmp/". | 234 | * does NOT contain "XXXXXX" or "/tmp/". |
235 | * @return NULL on error, otherwise name of fresh | 235 | * @return NULL on error, otherwise name of fresh |
236 | * file on disk in directory for temporary files | 236 | * file on disk in directory for temporary files |
@@ -480,7 +480,7 @@ GNUNET_DISK_directory_create (const char *dir) | |||
480 | * Create the directory structure for storing | 480 | * Create the directory structure for storing |
481 | * a file. | 481 | * a file. |
482 | * | 482 | * |
483 | * @param filename name of a file in the directory | 483 | * @param dir name of a file in the directory |
484 | * @returns GNUNET_OK on success, | 484 | * @returns GNUNET_OK on success, |
485 | * GNUNET_SYSERR on failure, | 485 | * GNUNET_SYSERR on failure, |
486 | * GNUNET_NO if the directory | 486 | * GNUNET_NO if the directory |
@@ -1058,8 +1058,8 @@ GNUNET_DISK_file_lock (struct GNUNET_DISK_FileHandle *fh, off_t lockStart, | |||
1058 | /** | 1058 | /** |
1059 | * Unlock a part of a file | 1059 | * Unlock a part of a file |
1060 | * @param fh file handle | 1060 | * @param fh file handle |
1061 | * @param lockStart absolute position from where to unlock | 1061 | * @param unlockStart absolute position from where to unlock |
1062 | * @param lockEnd absolute position until where to unlock | 1062 | * @param unlockEnd absolute position until where to unlock |
1063 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 1063 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
1064 | */ | 1064 | */ |
1065 | int | 1065 | int |
diff --git a/src/util/getopt.c b/src/util/getopt.c index 799146e77..e37390a3a 100644 --- a/src/util/getopt.c +++ b/src/util/getopt.c | |||
@@ -987,8 +987,7 @@ GNgetopt_long (int argc, | |||
987 | /** | 987 | /** |
988 | * Parse the command line. | 988 | * Parse the command line. |
989 | * | 989 | * |
990 | * @param binaryName name of the binary / application with options | 990 | * @param binaryOptions name of this binary / application |
991 | * @param cfg for storing/accessing configuration data | ||
992 | * @param allOptions defined options and handlers | 991 | * @param allOptions defined options and handlers |
993 | * @param argc number of arguments | 992 | * @param argc number of arguments |
994 | * @param argv actual arguments | 993 | * @param argv actual arguments |
diff --git a/src/util/network.c b/src/util/network.c index e112d9093..4ac46fa0b 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -169,7 +169,7 @@ GNUNET_NETWORK_socket_close (struct GNUNET_NETWORK_Handle *desc) | |||
169 | * Connect a socket | 169 | * Connect a socket |
170 | * @param desc socket | 170 | * @param desc socket |
171 | * @param address peer address | 171 | * @param address peer address |
172 | * @param length of address | 172 | * @param address_len length of address |
173 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 173 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise |
174 | */ | 174 | */ |
175 | int | 175 | int |
@@ -406,6 +406,7 @@ GNUNET_NETWORK_socket_set_inheritable (const struct GNUNET_NETWORK_Handle | |||
406 | #endif | 406 | #endif |
407 | } | 407 | } |
408 | 408 | ||
409 | |||
409 | /** | 410 | /** |
410 | * Reset FD set | 411 | * Reset FD set |
411 | * @param fds fd set | 412 | * @param fds fd set |
@@ -422,6 +423,7 @@ GNUNET_NETWORK_fdset_zero (struct GNUNET_NETWORK_FDSet *fds) | |||
422 | #endif | 423 | #endif |
423 | } | 424 | } |
424 | 425 | ||
426 | |||
425 | /** | 427 | /** |
426 | * Add a socket to the FD set | 428 | * Add a socket to the FD set |
427 | * @param fds fd set | 429 | * @param fds fd set |
@@ -437,10 +439,12 @@ GNUNET_NETWORK_fdset_set (struct GNUNET_NETWORK_FDSet *fds, | |||
437 | fds->nsds = desc->fd + 1; | 439 | fds->nsds = desc->fd + 1; |
438 | } | 440 | } |
439 | 441 | ||
442 | |||
440 | /** | 443 | /** |
441 | * Check whether a socket is part of the fd set | 444 | * Check whether a socket is part of the fd set |
442 | * @param fds fd set | 445 | * @param fds fd set |
443 | * @param desc socket | 446 | * @param desc socket |
447 | * @return 0 if the FD is not set | ||
444 | */ | 448 | */ |
445 | int | 449 | int |
446 | GNUNET_NETWORK_fdset_isset (const struct GNUNET_NETWORK_FDSet *fds, | 450 | GNUNET_NETWORK_fdset_isset (const struct GNUNET_NETWORK_FDSet *fds, |
@@ -449,6 +453,7 @@ GNUNET_NETWORK_fdset_isset (const struct GNUNET_NETWORK_FDSet *fds, | |||
449 | return FD_ISSET (desc->fd, &fds->sds); | 453 | return FD_ISSET (desc->fd, &fds->sds); |
450 | } | 454 | } |
451 | 455 | ||
456 | |||
452 | /** | 457 | /** |
453 | * Add one fd set to another | 458 | * Add one fd set to another |
454 | * @param dst the fd set to add to | 459 | * @param dst the fd set to add to |
@@ -469,6 +474,7 @@ GNUNET_NETWORK_fdset_add (struct GNUNET_NETWORK_FDSet *dst, | |||
469 | } | 474 | } |
470 | } | 475 | } |
471 | 476 | ||
477 | |||
472 | /** | 478 | /** |
473 | * Copy one fd set to another | 479 | * Copy one fd set to another |
474 | * @param to destination | 480 | * @param to destination |
@@ -494,11 +500,12 @@ GNUNET_NETWORK_fdset_copy (struct GNUNET_NETWORK_FDSet *to, | |||
494 | #endif | 500 | #endif |
495 | } | 501 | } |
496 | 502 | ||
503 | |||
497 | /** | 504 | /** |
498 | * Copy a native fd set | 505 | * Copy a native fd set |
499 | * @param to destination | 506 | * @param to destination |
500 | * @param from native source set | 507 | * @param from native source set |
501 | * @param the biggest socket number in from + 1 | 508 | * @param nfds the biggest socket number in from + 1 |
502 | */ | 509 | */ |
503 | void | 510 | void |
504 | GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, | 511 | GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, |
@@ -508,6 +515,7 @@ GNUNET_NETWORK_fdset_copy_native (struct GNUNET_NETWORK_FDSet *to, | |||
508 | to->nsds = nfds; | 515 | to->nsds = nfds; |
509 | } | 516 | } |
510 | 517 | ||
518 | |||
511 | /** | 519 | /** |
512 | * Add a file handle to the fd set | 520 | * Add a file handle to the fd set |
513 | * @param fds fd set | 521 | * @param fds fd set |
@@ -591,6 +599,7 @@ GNUNET_NETWORK_fdset_create () | |||
591 | return fds; | 599 | return fds; |
592 | } | 600 | } |
593 | 601 | ||
602 | |||
594 | /** | 603 | /** |
595 | * Releases the associated memory of an fd set | 604 | * Releases the associated memory of an fd set |
596 | * @param fds fd set | 605 | * @param fds fd set |
@@ -604,6 +613,7 @@ GNUNET_NETWORK_fdset_destroy (struct GNUNET_NETWORK_FDSet *fds) | |||
604 | GNUNET_free (fds); | 613 | GNUNET_free (fds); |
605 | } | 614 | } |
606 | 615 | ||
616 | |||
607 | /** | 617 | /** |
608 | * Check if sockets meet certain conditions | 618 | * Check if sockets meet certain conditions |
609 | * @param rfds set of sockets to be checked for readability | 619 | * @param rfds set of sockets to be checked for readability |
@@ -821,4 +831,5 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds, | |||
821 | #endif | 831 | #endif |
822 | } | 832 | } |
823 | 833 | ||
834 | |||
824 | /* end of network.c */ | 835 | /* end of network.c */ |
diff --git a/src/util/os_network.c b/src/util/os_network.c index c872350c5..c78dc71c5 100644 --- a/src/util/os_network.c +++ b/src/util/os_network.c | |||
@@ -33,7 +33,9 @@ | |||
33 | 33 | ||
34 | /** | 34 | /** |
35 | * @brief Enumerate all network interfaces | 35 | * @brief Enumerate all network interfaces |
36 | * @param callback the callback function | 36 | * |
37 | * @param proc the callback function | ||
38 | * @param cls closure for proc | ||
37 | */ | 39 | */ |
38 | void | 40 | void |
39 | GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, | 41 | GNUNET_OS_network_interfaces_list (GNUNET_OS_NetworkInterfaceProcessor proc, |
diff --git a/src/util/pseudonym.c b/src/util/pseudonym.c index 5d9750f5b..8687b5c4d 100644 --- a/src/util/pseudonym.c +++ b/src/util/pseudonym.c | |||
@@ -592,7 +592,7 @@ merge_meta_helper (void *cls, | |||
592 | * | 592 | * |
593 | * @param cfg overall configuration | 593 | * @param cfg overall configuration |
594 | * @param id the pseudonym identifier | 594 | * @param id the pseudonym identifier |
595 | * @param metadata for the pseudonym | 595 | * @param meta metadata for the pseudonym |
596 | */ | 596 | */ |
597 | void | 597 | void |
598 | GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, | 598 | GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg, |