diff options
Diffstat (limited to 'src/include/gnunet_configuration_lib.h')
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 145 |
1 files changed, 77 insertions, 68 deletions
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 570546b68..3b9be5849 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -19,6 +19,10 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @addtogroup libgnunetutil | ||
23 | * Multi-function utilities library for GNUnet programs | ||
24 | * @{ | ||
25 | * | ||
22 | * @author Christian Grothoff | 26 | * @author Christian Grothoff |
23 | * | 27 | * |
24 | * @file | 28 | * @file |
@@ -31,6 +35,7 @@ | |||
31 | #ifndef GNUNET_CONFIGURATION_LIB_H | 35 | #ifndef GNUNET_CONFIGURATION_LIB_H |
32 | #define GNUNET_CONFIGURATION_LIB_H | 36 | #define GNUNET_CONFIGURATION_LIB_H |
33 | 37 | ||
38 | |||
34 | #include "gnunet_time_lib.h" | 39 | #include "gnunet_time_lib.h" |
35 | 40 | ||
36 | #ifdef __cplusplus | 41 | #ifdef __cplusplus |
@@ -160,8 +165,8 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
160 | * present. This memory should be freed by the caller | 165 | * present. This memory should be freed by the caller |
161 | */ | 166 | */ |
162 | char * | 167 | char * |
163 | GNUNET_CONFIGURATION_serialize_diagnostics (const struct | 168 | GNUNET_CONFIGURATION_serialize_diagnostics ( |
164 | GNUNET_CONFIGURATION_Handle *cfg); | 169 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
165 | 170 | ||
166 | /** | 171 | /** |
167 | * De-serializes configuration | 172 | * De-serializes configuration |
@@ -170,7 +175,7 @@ GNUNET_CONFIGURATION_serialize_diagnostics (const struct | |||
170 | * @param mem the memory block of serialized configuration | 175 | * @param mem the memory block of serialized configuration |
171 | * @param size the size of the memory block | 176 | * @param size the size of the memory block |
172 | * @param source_filename source filename, will be used | 177 | * @param source_filename source filename, will be used |
173 | * to resolve relative @INLINE@ statements | 178 | * to resolve relative \@INLINE\@ statements |
174 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 179 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
175 | */ | 180 | */ |
176 | enum GNUNET_GenericReturnValue | 181 | enum GNUNET_GenericReturnValue |
@@ -266,8 +271,8 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename, | |||
266 | * @param cfg configuration handle | 271 | * @param cfg configuration handle |
267 | */ | 272 | */ |
268 | void | 273 | void |
269 | GNUNET_CONFIGURATION_enable_diagnostics (struct | 274 | GNUNET_CONFIGURATION_enable_diagnostics ( |
270 | GNUNET_CONFIGURATION_Handle *cfg); | 275 | struct GNUNET_CONFIGURATION_Handle *cfg); |
271 | 276 | ||
272 | 277 | ||
273 | /** | 278 | /** |
@@ -292,8 +297,8 @@ typedef void | |||
292 | * @param section name of the section | 297 | * @param section name of the section |
293 | */ | 298 | */ |
294 | typedef void | 299 | typedef void |
295 | (*GNUNET_CONFIGURATION_Section_Iterator) (void *cls, | 300 | (*GNUNET_CONFIGURATION_SectionIterator) (void *cls, |
296 | const char *section); | 301 | const char *section); |
297 | 302 | ||
298 | 303 | ||
299 | /** | 304 | /** |
@@ -317,11 +322,10 @@ GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
317 | * @param iter_cls closure for @a iter | 322 | * @param iter_cls closure for @a iter |
318 | */ | 323 | */ |
319 | void | 324 | void |
320 | GNUNET_CONFIGURATION_iterate_sections (const struct | 325 | GNUNET_CONFIGURATION_iterate_sections ( |
321 | GNUNET_CONFIGURATION_Handle *cfg, | 326 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
322 | GNUNET_CONFIGURATION_Section_Iterator | 327 | GNUNET_CONFIGURATION_SectionIterator iter, |
323 | iter, | 328 | void *iter_cls); |
324 | void *iter_cls); | ||
325 | 329 | ||
326 | 330 | ||
327 | /** | 331 | /** |
@@ -345,11 +349,11 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
345 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 349 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
346 | */ | 350 | */ |
347 | enum GNUNET_GenericReturnValue | 351 | enum GNUNET_GenericReturnValue |
348 | GNUNET_CONFIGURATION_get_value_number (const struct | 352 | GNUNET_CONFIGURATION_get_value_number ( |
349 | GNUNET_CONFIGURATION_Handle *cfg, | 353 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
350 | const char *section, | 354 | const char *section, |
351 | const char *option, | 355 | const char *option, |
352 | unsigned long long *number); | 356 | unsigned long long *number); |
353 | 357 | ||
354 | 358 | ||
355 | /** | 359 | /** |
@@ -362,11 +366,11 @@ GNUNET_CONFIGURATION_get_value_number (const struct | |||
362 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 366 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
363 | */ | 367 | */ |
364 | enum GNUNET_GenericReturnValue | 368 | enum GNUNET_GenericReturnValue |
365 | GNUNET_CONFIGURATION_get_value_float (const struct | 369 | GNUNET_CONFIGURATION_get_value_float ( |
366 | GNUNET_CONFIGURATION_Handle *cfg, | 370 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
367 | const char *section, | 371 | const char *section, |
368 | const char *option, | 372 | const char *option, |
369 | float *number); | 373 | float *number); |
370 | 374 | ||
371 | 375 | ||
372 | /** | 376 | /** |
@@ -379,11 +383,11 @@ GNUNET_CONFIGURATION_get_value_float (const struct | |||
379 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 383 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
380 | */ | 384 | */ |
381 | enum GNUNET_GenericReturnValue | 385 | enum GNUNET_GenericReturnValue |
382 | GNUNET_CONFIGURATION_get_value_time (const struct | 386 | GNUNET_CONFIGURATION_get_value_time ( |
383 | GNUNET_CONFIGURATION_Handle *cfg, | 387 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
384 | const char *section, | 388 | const char *section, |
385 | const char *option, | 389 | const char *option, |
386 | struct GNUNET_TIME_Relative *time); | 390 | struct GNUNET_TIME_Relative *time); |
387 | 391 | ||
388 | 392 | ||
389 | /** | 393 | /** |
@@ -396,11 +400,11 @@ GNUNET_CONFIGURATION_get_value_time (const struct | |||
396 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 400 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
397 | */ | 401 | */ |
398 | enum GNUNET_GenericReturnValue | 402 | enum GNUNET_GenericReturnValue |
399 | GNUNET_CONFIGURATION_get_value_size (const struct | 403 | GNUNET_CONFIGURATION_get_value_size ( |
400 | GNUNET_CONFIGURATION_Handle *cfg, | 404 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
401 | const char *section, | 405 | const char *section, |
402 | const char *option, | 406 | const char *option, |
403 | unsigned long long *size); | 407 | unsigned long long *size); |
404 | 408 | ||
405 | 409 | ||
406 | /** | 410 | /** |
@@ -447,11 +451,11 @@ GNUNET_CONFIGURATION_get_value_string ( | |||
447 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 451 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
448 | */ | 452 | */ |
449 | enum GNUNET_GenericReturnValue | 453 | enum GNUNET_GenericReturnValue |
450 | GNUNET_CONFIGURATION_get_value_filename (const struct | 454 | GNUNET_CONFIGURATION_get_value_filename ( |
451 | GNUNET_CONFIGURATION_Handle *cfg, | 455 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
452 | const char *section, | 456 | const char *section, |
453 | const char *option, | 457 | const char *option, |
454 | char **value); | 458 | char **value); |
455 | 459 | ||
456 | 460 | ||
457 | /** | 461 | /** |
@@ -465,12 +469,13 @@ GNUNET_CONFIGURATION_get_value_filename (const struct | |||
465 | * @return number of filenames iterated over, -1 on error | 469 | * @return number of filenames iterated over, -1 on error |
466 | */ | 470 | */ |
467 | int | 471 | int |
468 | GNUNET_CONFIGURATION_iterate_value_filenames (const struct | 472 | GNUNET_CONFIGURATION_iterate_value_filenames ( |
469 | GNUNET_CONFIGURATION_Handle *cfg, | 473 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
470 | const char *section, | 474 | const char *section, |
471 | const char *option, | 475 | const char *option, |
472 | GNUNET_FileNameCallback cb, | 476 | GNUNET_FileNameCallback cb, |
473 | void *cb_cls); | 477 | void *cb_cls); |
478 | |||
474 | 479 | ||
475 | /** | 480 | /** |
476 | * Iterate over values of a section in the configuration. | 481 | * Iterate over values of a section in the configuration. |
@@ -481,11 +486,12 @@ GNUNET_CONFIGURATION_iterate_value_filenames (const struct | |||
481 | * @param iter_cls closure for @a iter | 486 | * @param iter_cls closure for @a iter |
482 | */ | 487 | */ |
483 | void | 488 | void |
484 | GNUNET_CONFIGURATION_iterate_section_values (const struct | 489 | GNUNET_CONFIGURATION_iterate_section_values ( |
485 | GNUNET_CONFIGURATION_Handle *cfg, | 490 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
486 | const char *section, | 491 | const char *section, |
487 | GNUNET_CONFIGURATION_Iterator iter, | 492 | GNUNET_CONFIGURATION_Iterator iter, |
488 | void *iter_cls); | 493 | void *iter_cls); |
494 | |||
489 | 495 | ||
490 | /** | 496 | /** |
491 | * Get a configuration value that should be in a set of | 497 | * Get a configuration value that should be in a set of |
@@ -500,12 +506,13 @@ GNUNET_CONFIGURATION_iterate_section_values (const struct | |||
500 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 506 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
501 | */ | 507 | */ |
502 | enum GNUNET_GenericReturnValue | 508 | enum GNUNET_GenericReturnValue |
503 | GNUNET_CONFIGURATION_get_value_choice (const struct | 509 | GNUNET_CONFIGURATION_get_value_choice ( |
504 | GNUNET_CONFIGURATION_Handle *cfg, | 510 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
505 | const char *section, | 511 | const char *section, |
506 | const char *option, | 512 | const char *option, |
507 | const char *const *choices, | 513 | const char *const *choices, |
508 | const char **value); | 514 | const char **value); |
515 | |||
509 | 516 | ||
510 | /** | 517 | /** |
511 | * Get a configuration value that should be in a set of | 518 | * Get a configuration value that should be in a set of |
@@ -517,10 +524,10 @@ GNUNET_CONFIGURATION_get_value_choice (const struct | |||
517 | * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR | 524 | * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR |
518 | */ | 525 | */ |
519 | enum GNUNET_GenericReturnValue | 526 | enum GNUNET_GenericReturnValue |
520 | GNUNET_CONFIGURATION_get_value_yesno (const struct | 527 | GNUNET_CONFIGURATION_get_value_yesno ( |
521 | GNUNET_CONFIGURATION_Handle *cfg, | 528 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
522 | const char *section, | 529 | const char *section, |
523 | const char *option); | 530 | const char *option); |
524 | 531 | ||
525 | 532 | ||
526 | /** | 533 | /** |
@@ -607,11 +614,11 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
607 | * #GNUNET_SYSERR if the filename is not in the list | 614 | * #GNUNET_SYSERR if the filename is not in the list |
608 | */ | 615 | */ |
609 | enum GNUNET_GenericReturnValue | 616 | enum GNUNET_GenericReturnValue |
610 | GNUNET_CONFIGURATION_remove_value_filename (struct | 617 | GNUNET_CONFIGURATION_remove_value_filename ( |
611 | GNUNET_CONFIGURATION_Handle *cfg, | 618 | struct GNUNET_CONFIGURATION_Handle *cfg, |
612 | const char *section, | 619 | const char *section, |
613 | const char *option, | 620 | const char *option, |
614 | const char *value); | 621 | const char *value); |
615 | 622 | ||
616 | 623 | ||
617 | /** | 624 | /** |
@@ -626,11 +633,11 @@ GNUNET_CONFIGURATION_remove_value_filename (struct | |||
626 | * #GNUNET_SYSERR if the filename already in the list | 633 | * #GNUNET_SYSERR if the filename already in the list |
627 | */ | 634 | */ |
628 | enum GNUNET_GenericReturnValue | 635 | enum GNUNET_GenericReturnValue |
629 | GNUNET_CONFIGURATION_append_value_filename (struct | 636 | GNUNET_CONFIGURATION_append_value_filename ( |
630 | GNUNET_CONFIGURATION_Handle *cfg, | 637 | struct GNUNET_CONFIGURATION_Handle *cfg, |
631 | const char *section, | 638 | const char *section, |
632 | const char *option, | 639 | const char *option, |
633 | const char *value); | 640 | const char *value); |
634 | 641 | ||
635 | 642 | ||
636 | /** | 643 | /** |
@@ -793,3 +800,5 @@ GNUNET_CONFIGURATION_config_tool_run ( | |||
793 | #endif | 800 | #endif |
794 | 801 | ||
795 | /** @} */ /* end of group configuration */ | 802 | /** @} */ /* end of group configuration */ |
803 | |||
804 | /** @} */ /* end of group addition */ | ||