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.h46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index abbfe2eec..c5ea21ed8 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -47,16 +47,27 @@ struct GNUNET_CONFIGURATION_Handle;
47 47
48/** 48/**
49 * Create a new configuration object. 49 * Create a new configuration object.
50 * 50 * @return fresh configuration object
51 * @param component name of responsible component
52 */ 51 */
53struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_create (void); 52struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_create (void);
54 53
54
55/**
56 * Duplicate an existing configuration object.
57 *
58 * @param c configuration to duplicate
59 * @return duplicate configuration
60 */
61struct GNUNET_CONFIGURATION_Handle *
62GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *c);
63
64
55/** 65/**
56 * Destroy configuration object. 66 * Destroy configuration object.
57 */ 67 */
58void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); 68void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
59 69
70
60/** 71/**
61 * Load configuration. This function will first parse the 72 * Load configuration. This function will first parse the
62 * defaults and then parse the specific configuration file 73 * defaults and then parse the specific configuration file
@@ -68,6 +79,7 @@ void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
68int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, 79int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
69 const char *filename); 80 const char *filename);
70 81
82
71/** 83/**
72 * Parse a configuration file, add all of the options in the 84 * Parse a configuration file, add all of the options in the
73 * file to the configuration environment. 85 * file to the configuration environment.
@@ -76,6 +88,7 @@ int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
76int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, 88int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
77 const char *filename); 89 const char *filename);
78 90
91
79/** 92/**
80 * Write configuration file. 93 * Write configuration file.
81 * @return GNUNET_OK on success, GNUNET_SYSERR on error 94 * @return GNUNET_OK on success, GNUNET_SYSERR on error
@@ -83,6 +96,7 @@ int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
83int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, 96int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
84 const char *filename); 97 const char *filename);
85 98
99
86/** 100/**
87 * Test if there are configuration options that were 101 * Test if there are configuration options that were
88 * changed since the last save. 102 * changed since the last save.
@@ -90,6 +104,33 @@ int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
90 */ 104 */
91int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); 105int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg);
92 106
107
108/**
109 * Function to iterate over options.
110 *
111 * @param cls closure
112 * @param section name of the section
113 * @param option name of the option
114 * @param value value of the option
115 */
116typedef void (*GNUNET_CONFIGURATION_Iterator)(void *cls,
117 const char *section,
118 const char *option,
119 const char *value);
120
121
122/**
123 * Iterate over all options in the configuration.
124 *
125 * @param cfg configuration to inspect
126 * @param iter function to call on each option
127 * @param iter_cls closure for iter
128 */
129void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
130 GNUNET_CONFIGURATION_Iterator iter,
131 void *iter_cls);
132
133
93/** 134/**
94 * Get a configuration value that should be a number. 135 * Get a configuration value that should be a number.
95 * @return GNUNET_OK on success, GNUNET_SYSERR on error 136 * @return GNUNET_OK on success, GNUNET_SYSERR on error
@@ -240,6 +281,7 @@ int GNUNET_CONFIGURATION_append_value_filename (struct
240 const char *option, 281 const char *option,
241 const char *value); 282 const char *value);
242 283
284
243#if 0 /* keep Emacsens' auto-indent happy */ 285#if 0 /* keep Emacsens' auto-indent happy */
244{ 286{
245#endif 287#endif