aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_configuration_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_configuration_lib.h')
-rw-r--r--src/include/gnunet_configuration_lib.h145
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 */
162char * 167char *
163GNUNET_CONFIGURATION_serialize_diagnostics (const struct 168GNUNET_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 */
176enum GNUNET_GenericReturnValue 181enum 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 */
268void 273void
269GNUNET_CONFIGURATION_enable_diagnostics (struct 274GNUNET_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 */
294typedef void 299typedef 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 */
319void 324void
320GNUNET_CONFIGURATION_iterate_sections (const struct 325GNUNET_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 */
347enum GNUNET_GenericReturnValue 351enum GNUNET_GenericReturnValue
348GNUNET_CONFIGURATION_get_value_number (const struct 352GNUNET_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 */
364enum GNUNET_GenericReturnValue 368enum GNUNET_GenericReturnValue
365GNUNET_CONFIGURATION_get_value_float (const struct 369GNUNET_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 */
381enum GNUNET_GenericReturnValue 385enum GNUNET_GenericReturnValue
382GNUNET_CONFIGURATION_get_value_time (const struct 386GNUNET_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 */
398enum GNUNET_GenericReturnValue 402enum GNUNET_GenericReturnValue
399GNUNET_CONFIGURATION_get_value_size (const struct 403GNUNET_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 */
449enum GNUNET_GenericReturnValue 453enum GNUNET_GenericReturnValue
450GNUNET_CONFIGURATION_get_value_filename (const struct 454GNUNET_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 */
467int 471int
468GNUNET_CONFIGURATION_iterate_value_filenames (const struct 472GNUNET_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 */
483void 488void
484GNUNET_CONFIGURATION_iterate_section_values (const struct 489GNUNET_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 */
502enum GNUNET_GenericReturnValue 508enum GNUNET_GenericReturnValue
503GNUNET_CONFIGURATION_get_value_choice (const struct 509GNUNET_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 */
519enum GNUNET_GenericReturnValue 526enum GNUNET_GenericReturnValue
520GNUNET_CONFIGURATION_get_value_yesno (const struct 527GNUNET_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 */
609enum GNUNET_GenericReturnValue 616enum GNUNET_GenericReturnValue
610GNUNET_CONFIGURATION_remove_value_filename (struct 617GNUNET_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 */
628enum GNUNET_GenericReturnValue 635enum GNUNET_GenericReturnValue
629GNUNET_CONFIGURATION_append_value_filename (struct 636GNUNET_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 */