diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-09-11 11:47:30 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-09-11 11:47:30 +0000 |
commit | 34d2cace7259c408fdb0526dedd0d44a1a11929e (patch) | |
tree | e127d553c2532804928d5e9a667021f7343779e5 /src/include/gnunet_configuration_lib.h | |
parent | 7f0c6bd7bc74dc479e991cba667e08f66e6e2d42 (diff) | |
download | gnunet-34d2cace7259c408fdb0526dedd0d44a1a11929e.tar.gz gnunet-34d2cace7259c408fdb0526dedd0d44a1a11929e.zip |
docu
Diffstat (limited to 'src/include/gnunet_configuration_lib.h')
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index c5ea21ed8..84c20bde0 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -64,6 +64,8 @@ GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *c); | |||
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Destroy configuration object. | 66 | * Destroy configuration object. |
67 | * | ||
68 | * @param cfg configuration to destroy | ||
67 | */ | 69 | */ |
68 | void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); | 70 | void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); |
69 | 71 | ||
@@ -73,6 +75,7 @@ void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); | |||
73 | * defaults and then parse the specific configuration file | 75 | * defaults and then parse the specific configuration file |
74 | * to overwrite the defaults. | 76 | * to overwrite the defaults. |
75 | * | 77 | * |
78 | * @param cfg configuration to update | ||
76 | * @param filename name of the configuration file | 79 | * @param filename name of the configuration file |
77 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 80 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
78 | */ | 81 | */ |
@@ -83,6 +86,9 @@ int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
83 | /** | 86 | /** |
84 | * Parse a configuration file, add all of the options in the | 87 | * Parse a configuration file, add all of the options in the |
85 | * file to the configuration environment. | 88 | * file to the configuration environment. |
89 | * | ||
90 | * @param cfg configuration to update | ||
91 | * @param filename name of the configuration file | ||
86 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 92 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
87 | */ | 93 | */ |
88 | int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | 94 | int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -91,6 +97,9 @@ int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
91 | 97 | ||
92 | /** | 98 | /** |
93 | * Write configuration file. | 99 | * Write configuration file. |
100 | * | ||
101 | * @param cfg configuration to write | ||
102 | * @param filename where to write the configuration | ||
94 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 103 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
95 | */ | 104 | */ |
96 | int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | 105 | int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -100,6 +109,8 @@ int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
100 | /** | 109 | /** |
101 | * Test if there are configuration options that were | 110 | * Test if there are configuration options that were |
102 | * changed since the last save. | 111 | * changed since the last save. |
112 | * | ||
113 | * @param cfg configuration to inspect | ||
103 | * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed) | 114 | * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed) |
104 | */ | 115 | */ |
105 | int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); | 116 | int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg); |
@@ -133,6 +144,11 @@ void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg | |||
133 | 144 | ||
134 | /** | 145 | /** |
135 | * Get a configuration value that should be a number. | 146 | * Get a configuration value that should be a number. |
147 | * | ||
148 | * @param cfg configuration to inspect | ||
149 | * @param section section of interest | ||
150 | * @param option option of interest | ||
151 | * @param number where to store the numeric value of the option | ||
136 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 152 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
137 | */ | 153 | */ |
138 | int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle | 154 | int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle |
@@ -143,6 +159,9 @@ int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Han | |||
143 | /** | 159 | /** |
144 | * Get a configuration value that should be a relative time. | 160 | * Get a configuration value that should be a relative time. |
145 | * | 161 | * |
162 | * @param cfg configuration to inspect | ||
163 | * @param section section of interest | ||
164 | * @param option option of interest | ||
146 | * @param time set to the time value stored in the configuration | 165 | * @param time set to the time value stored in the configuration |
147 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 166 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
148 | */ | 167 | */ |
@@ -153,6 +172,10 @@ int GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handl | |||
153 | 172 | ||
154 | /** | 173 | /** |
155 | * Test if we have a value for a particular option | 174 | * Test if we have a value for a particular option |
175 | * | ||
176 | * @param cfg configuration to inspect | ||
177 | * @param section section of interest | ||
178 | * @param option option of interest | ||
156 | * @return GNUNET_YES if so, GNUNET_NO if not. | 179 | * @return GNUNET_YES if so, GNUNET_NO if not. |
157 | */ | 180 | */ |
158 | int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, | 181 | int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg, |
@@ -160,6 +183,10 @@ int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *c | |||
160 | 183 | ||
161 | /** | 184 | /** |
162 | * Get a configuration value that should be a string. | 185 | * Get a configuration value that should be a string. |
186 | * | ||
187 | * @param cfg configuration to inspect | ||
188 | * @param section section of interest | ||
189 | * @param option option of interest | ||
163 | * @param value will be set to a freshly allocated configuration | 190 | * @param value will be set to a freshly allocated configuration |
164 | * value, or NULL if option is not specified | 191 | * value, or NULL if option is not specified |
165 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 192 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
@@ -172,6 +199,9 @@ int GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Han | |||
172 | * Get a configuration value that should be the name of a file | 199 | * Get a configuration value that should be the name of a file |
173 | * or directory. | 200 | * or directory. |
174 | * | 201 | * |
202 | * @param cfg configuration to inspect | ||
203 | * @param section section of interest | ||
204 | * @param option option of interest | ||
175 | * @param value will be set to a freshly allocated configuration | 205 | * @param value will be set to a freshly allocated configuration |
176 | * value, or NULL if option is not specified | 206 | * value, or NULL if option is not specified |
177 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 207 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
@@ -185,6 +215,11 @@ int GNUNET_CONFIGURATION_get_value_filename (const struct | |||
185 | /** | 215 | /** |
186 | * Iterate over the set of filenames stored in a configuration value. | 216 | * Iterate over the set of filenames stored in a configuration value. |
187 | * | 217 | * |
218 | * @param cfg configuration to inspect | ||
219 | * @param section section of interest | ||
220 | * @param option option of interest | ||
221 | * @param cb function to call on each filename | ||
222 | * @param cb_cls closure for cb | ||
188 | * @return number of filenames iterated over, -1 on error | 223 | * @return number of filenames iterated over, -1 on error |
189 | */ | 224 | */ |
190 | int GNUNET_CONFIGURATION_iterate_value_filenames (const struct | 225 | int GNUNET_CONFIGURATION_iterate_value_filenames (const struct |
@@ -193,12 +228,15 @@ int GNUNET_CONFIGURATION_iterate_value_filenames (const struct | |||
193 | const char *section, | 228 | const char *section, |
194 | const char *option, | 229 | const char *option, |
195 | GNUNET_FileNameCallback | 230 | GNUNET_FileNameCallback |
196 | cb, void *cls); | 231 | cb, void *cb_cls); |
197 | 232 | ||
198 | /** | 233 | /** |
199 | * Get a configuration value that should be in a set of | 234 | * Get a configuration value that should be in a set of |
200 | * predefined strings | 235 | * predefined strings |
201 | * | 236 | * |
237 | * @param cfg configuration to inspect | ||
238 | * @param section section of interest | ||
239 | * @param option option of interest | ||
202 | * @param choices NULL-terminated list of legal values | 240 | * @param choices NULL-terminated list of legal values |
203 | * @param value will be set to an entry in the legal list, | 241 | * @param value will be set to an entry in the legal list, |
204 | * or NULL if option is not specified and no default given | 242 | * or NULL if option is not specified and no default given |
@@ -214,6 +252,9 @@ int GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Han | |||
214 | * Get a configuration value that should be in a set of | 252 | * Get a configuration value that should be in a set of |
215 | * "YES" or "NO". | 253 | * "YES" or "NO". |
216 | * | 254 | * |
255 | * @param cfg configuration to inspect | ||
256 | * @param section section of interest | ||
257 | * @param option option of interest | ||
217 | * @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR | 258 | * @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR |
218 | */ | 259 | */ |
219 | int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle | 260 | int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle |
@@ -224,7 +265,8 @@ int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Hand | |||
224 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" | 265 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" |
225 | * where either in the "PATHS" section or the environtment | 266 | * where either in the "PATHS" section or the environtment |
226 | * "FOO" is set to "DIRECTORY". | 267 | * "FOO" is set to "DIRECTORY". |
227 | 268 | * | |
269 | * @param cfg configuration to use for path expansion | ||
228 | * @param old string to $-expand (will be freed!) | 270 | * @param old string to $-expand (will be freed!) |
229 | * @return $-expanded string | 271 | * @return $-expanded string |
230 | */ | 272 | */ |
@@ -233,6 +275,11 @@ char *GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Hand | |||
233 | 275 | ||
234 | /** | 276 | /** |
235 | * Set a configuration value that should be a number. | 277 | * Set a configuration value that should be a number. |
278 | * | ||
279 | * @param cfg configuration to update | ||
280 | * @param section section of interest | ||
281 | * @param option option of interest | ||
282 | * @param number value to set | ||
236 | */ | 283 | */ |
237 | void | 284 | void |
238 | GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle | 285 | GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle |
@@ -244,7 +291,11 @@ GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle | |||
244 | 291 | ||
245 | /** | 292 | /** |
246 | * Set a configuration value that should be a string. | 293 | * Set a configuration value that should be a string. |
247 | * @param value | 294 | * |
295 | * @param cfg configuration to update | ||
296 | * @param section section of interest | ||
297 | * @param option option of interest | ||
298 | * @param value value to set | ||
248 | */ | 299 | */ |
249 | void | 300 | void |
250 | GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle | 301 | GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle |
@@ -256,6 +307,9 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle | |||
256 | * Remove a filename from a configuration value that | 307 | * Remove a filename from a configuration value that |
257 | * represents a list of filenames | 308 | * represents a list of filenames |
258 | * | 309 | * |
310 | * @param cfg configuration to update | ||
311 | * @param section section of interest | ||
312 | * @param option option of interest | ||
259 | * @param value filename to remove | 313 | * @param value filename to remove |
260 | * @return GNUNET_OK on success, | 314 | * @return GNUNET_OK on success, |
261 | * GNUNET_SYSERR if the filename is not in the list | 315 | * GNUNET_SYSERR if the filename is not in the list |
@@ -271,6 +325,9 @@ int GNUNET_CONFIGURATION_remove_value_filename (struct | |||
271 | * Append a filename to a configuration value that | 325 | * Append a filename to a configuration value that |
272 | * represents a list of filenames | 326 | * represents a list of filenames |
273 | * | 327 | * |
328 | * @param cfg configuration to update | ||
329 | * @param section section of interest | ||
330 | * @param option option of interest | ||
274 | * @param value filename to append | 331 | * @param value filename to append |
275 | * @return GNUNET_OK on success, | 332 | * @return GNUNET_OK on success, |
276 | * GNUNET_SYSERR if the filename already in the list | 333 | * GNUNET_SYSERR if the filename already in the list |