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.h188
1 files changed, 99 insertions, 89 deletions
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 24705f0fb..7167d8bd6 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -49,7 +49,8 @@ struct GNUNET_CONFIGURATION_Handle;
49 * Create a new configuration object. 49 * Create a new configuration object.
50 * @return fresh configuration object 50 * @return fresh configuration object
51 */ 51 */
52struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_create (void); 52struct GNUNET_CONFIGURATION_Handle *
53GNUNET_CONFIGURATION_create (void);
53 54
54 55
55/** 56/**
@@ -58,9 +59,8 @@ struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_create (void);
58 * @param cfg configuration to duplicate 59 * @param cfg configuration to duplicate
59 * @return duplicate configuration 60 * @return duplicate configuration
60 */ 61 */
61struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_dup (const struct 62struct GNUNET_CONFIGURATION_Handle *
62 GNUNET_CONFIGURATION_Handle 63GNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg);
63 *cfg);
64 64
65 65
66/** 66/**
@@ -68,7 +68,8 @@ struct GNUNET_CONFIGURATION_Handle *GNUNET_CONFIGURATION_dup (const struct
68 * 68 *
69 * @param cfg configuration to destroy 69 * @param cfg configuration to destroy
70 */ 70 */
71void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg); 71void
72GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
72 73
73 74
74/** 75/**
@@ -80,8 +81,9 @@ void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg);
80 * @param filename name of the configuration file, NULL to load defaults 81 * @param filename name of the configuration file, NULL to load defaults
81 * @return GNUNET_OK on success, GNUNET_SYSERR on error 82 * @return GNUNET_OK on success, GNUNET_SYSERR on error
82 */ 83 */
83int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg, 84int
84 const char *filename); 85GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
86 const char *filename);
85 87
86 88
87/** 89/**
@@ -92,8 +94,9 @@ int GNUNET_CONFIGURATION_load (struct GNUNET_CONFIGURATION_Handle *cfg,
92 * @param filename name of the configuration file 94 * @param filename name of the configuration file
93 * @return GNUNET_OK on success, GNUNET_SYSERR on error 95 * @return GNUNET_OK on success, GNUNET_SYSERR on error
94 */ 96 */
95int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg, 97int
96 const char *filename); 98GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
99 const char *filename);
97 100
98 101
99/** 102/**
@@ -103,8 +106,9 @@ int GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
103 * @param filename where to write the configuration 106 * @param filename where to write the configuration
104 * @return GNUNET_OK on success, GNUNET_SYSERR on error 107 * @return GNUNET_OK on success, GNUNET_SYSERR on error
105 */ 108 */
106int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, 109int
107 const char *filename); 110GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
111 const char *filename);
108 112
109/** 113/**
110 * Write only configuration entries that have been changed to configuration file 114 * Write only configuration entries that have been changed to configuration file
@@ -113,10 +117,11 @@ int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
113 * @param filename where to write the configuration diff between default and new 117 * @param filename where to write the configuration diff between default and new
114 * @return GNUNET_OK on success, GNUNET_SYSERR on error 118 * @return GNUNET_OK on success, GNUNET_SYSERR on error
115 */ 119 */
116int GNUNET_CONFIGURATION_write_diffs (const struct GNUNET_CONFIGURATION_Handle 120int
117 *cfgDefault, 121GNUNET_CONFIGURATION_write_diffs (const struct GNUNET_CONFIGURATION_Handle
118 const struct GNUNET_CONFIGURATION_Handle 122 *cfgDefault,
119 *cfgNew, const char *filename); 123 const struct GNUNET_CONFIGURATION_Handle
124 *cfgNew, const char *filename);
120 125
121/** 126/**
122 * Test if there are configuration options that were 127 * Test if there are configuration options that were
@@ -125,8 +130,8 @@ int GNUNET_CONFIGURATION_write_diffs (const struct GNUNET_CONFIGURATION_Handle
125 * @param cfg configuration to inspect 130 * @param cfg configuration to inspect
126 * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed) 131 * @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed)
127 */ 132 */
128int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle 133int
129 *cfg); 134GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg);
130 135
131 136
132/** 137/**
@@ -159,9 +164,10 @@ typedef void (*GNUNET_CONFIGURATION_Section_Iterator) (void *cls,
159 * @param iter function to call on each option 164 * @param iter function to call on each option
160 * @param iter_cls closure for iter 165 * @param iter_cls closure for iter
161 */ 166 */
162void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle 167void
163 *cfg, GNUNET_CONFIGURATION_Iterator iter, 168GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
164 void *iter_cls); 169 GNUNET_CONFIGURATION_Iterator iter,
170 void *iter_cls);
165 171
166 172
167/** 173/**
@@ -171,10 +177,11 @@ void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle
171 * @param iter function to call on each section 177 * @param iter function to call on each section
172 * @param iter_cls closure for iter 178 * @param iter_cls closure for iter
173 */ 179 */
174void GNUNET_CONFIGURATION_iterate_sections (const struct 180void
175 GNUNET_CONFIGURATION_Handle *cfg, 181GNUNET_CONFIGURATION_iterate_sections (const struct GNUNET_CONFIGURATION_Handle
176 GNUNET_CONFIGURATION_Section_Iterator 182 *cfg,
177 iter, void *iter_cls); 183 GNUNET_CONFIGURATION_Section_Iterator
184 iter, void *iter_cls);
178 185
179 186
180/** 187/**
@@ -183,8 +190,9 @@ void GNUNET_CONFIGURATION_iterate_sections (const struct
183 * @param cfg configuration to inspect 190 * @param cfg configuration to inspect
184 * @param section name of the section to remove 191 * @param section name of the section to remove
185 */ 192 */
186void GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle 193void
187 *cfg, const char *section); 194GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg,
195 const char *section);
188 196
189/** 197/**
190 * Get a configuration value that should be a number. 198 * Get a configuration value that should be a number.
@@ -195,11 +203,11 @@ void GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle
195 * @param number where to store the numeric value of the option 203 * @param number where to store the numeric value of the option
196 * @return GNUNET_OK on success, GNUNET_SYSERR on error 204 * @return GNUNET_OK on success, GNUNET_SYSERR on error
197 */ 205 */
198int GNUNET_CONFIGURATION_get_value_number (const struct 206int
199 GNUNET_CONFIGURATION_Handle *cfg, 207GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle
200 const char *section, 208 *cfg, const char *section,
201 const char *option, 209 const char *option,
202 unsigned long long *number); 210 unsigned long long *number);
203 211
204 212
205/** 213/**
@@ -211,11 +219,11 @@ int GNUNET_CONFIGURATION_get_value_number (const struct
211 * @param time set to the time value stored in the configuration 219 * @param time set to the time value stored in the configuration
212 * @return GNUNET_OK on success, GNUNET_SYSERR on error 220 * @return GNUNET_OK on success, GNUNET_SYSERR on error
213 */ 221 */
214int GNUNET_CONFIGURATION_get_value_time (const struct 222int
215 GNUNET_CONFIGURATION_Handle *cfg, 223GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
216 const char *section, 224 *cfg, const char *section,
217 const char *option, 225 const char *option,
218 struct GNUNET_TIME_Relative *time); 226 struct GNUNET_TIME_Relative *time);
219 227
220 228
221/** 229/**
@@ -226,9 +234,9 @@ int GNUNET_CONFIGURATION_get_value_time (const struct
226 * @param option option of interest 234 * @param option option of interest
227 * @return GNUNET_YES if so, GNUNET_NO if not. 235 * @return GNUNET_YES if so, GNUNET_NO if not.
228 */ 236 */
229int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle 237int
230 *cfg, const char *section, 238GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
231 const char *option); 239 const char *section, const char *option);
232 240
233 241
234/** 242/**
@@ -241,10 +249,10 @@ int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle
241 * value, or NULL if option is not specified 249 * value, or NULL if option is not specified
242 * @return GNUNET_OK on success, GNUNET_SYSERR on error 250 * @return GNUNET_OK on success, GNUNET_SYSERR on error
243 */ 251 */
244int GNUNET_CONFIGURATION_get_value_string (const struct 252int
245 GNUNET_CONFIGURATION_Handle *cfg, 253GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle
246 const char *section, 254 *cfg, const char *section,
247 const char *option, char **value); 255 const char *option, char **value);
248 256
249 257
250/** 258/**
@@ -258,10 +266,11 @@ int GNUNET_CONFIGURATION_get_value_string (const struct
258 * value, or NULL if option is not specified 266 * value, or NULL if option is not specified
259 * @return GNUNET_OK on success, GNUNET_SYSERR on error 267 * @return GNUNET_OK on success, GNUNET_SYSERR on error
260 */ 268 */
261int GNUNET_CONFIGURATION_get_value_filename (const struct 269int
262 GNUNET_CONFIGURATION_Handle *cfg, 270GNUNET_CONFIGURATION_get_value_filename (const struct
263 const char *section, 271 GNUNET_CONFIGURATION_Handle *cfg,
264 const char *option, char **value); 272 const char *section,
273 const char *option, char **value);
265 274
266/** 275/**
267 * Iterate over the set of filenames stored in a configuration value. 276 * Iterate over the set of filenames stored in a configuration value.
@@ -273,12 +282,13 @@ int GNUNET_CONFIGURATION_get_value_filename (const struct
273 * @param cb_cls closure for cb 282 * @param cb_cls closure for cb
274 * @return number of filenames iterated over, -1 on error 283 * @return number of filenames iterated over, -1 on error
275 */ 284 */
276int GNUNET_CONFIGURATION_iterate_value_filenames (const struct 285int
277 GNUNET_CONFIGURATION_Handle 286GNUNET_CONFIGURATION_iterate_value_filenames (const struct
278 *cfg, const char *section, 287 GNUNET_CONFIGURATION_Handle *cfg,
279 const char *option, 288 const char *section,
280 GNUNET_FileNameCallback cb, 289 const char *option,
281 void *cb_cls); 290 GNUNET_FileNameCallback cb,
291 void *cb_cls);
282 292
283/** 293/**
284 * Iterate over values of a section in the configuration. 294 * Iterate over values of a section in the configuration.
@@ -288,11 +298,12 @@ int GNUNET_CONFIGURATION_iterate_value_filenames (const struct
288 * @param iter function to call on each option 298 * @param iter function to call on each option
289 * @param iter_cls closure for iter 299 * @param iter_cls closure for iter
290 */ 300 */
291void GNUNET_CONFIGURATION_iterate_section_values (const struct 301void
292 GNUNET_CONFIGURATION_Handle 302GNUNET_CONFIGURATION_iterate_section_values (const struct
293 *cfg, const char *section, 303 GNUNET_CONFIGURATION_Handle *cfg,
294 GNUNET_CONFIGURATION_Iterator 304 const char *section,
295 iter, void *iter_cls); 305 GNUNET_CONFIGURATION_Iterator iter,
306 void *iter_cls);
296 307
297/** 308/**
298 * Get a configuration value that should be in a set of 309 * Get a configuration value that should be in a set of
@@ -306,12 +317,11 @@ void GNUNET_CONFIGURATION_iterate_section_values (const struct
306 * or NULL if option is not specified and no default given 317 * or NULL if option is not specified and no default given
307 * @return GNUNET_OK on success, GNUNET_SYSERR on error 318 * @return GNUNET_OK on success, GNUNET_SYSERR on error
308 */ 319 */
309int GNUNET_CONFIGURATION_get_value_choice (const struct 320int
310 GNUNET_CONFIGURATION_Handle *cfg, 321GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle
311 const char *section, 322 *cfg, const char *section,
312 const char *option, 323 const char *option, const char **choices,
313 const char **choices, 324 const char **value);
314 const char **value);
315 325
316/** 326/**
317 * Get a configuration value that should be in a set of 327 * Get a configuration value that should be in a set of
@@ -322,10 +332,10 @@ int GNUNET_CONFIGURATION_get_value_choice (const struct
322 * @param option option of interest 332 * @param option option of interest
323 * @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR 333 * @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR
324 */ 334 */
325int GNUNET_CONFIGURATION_get_value_yesno (const struct 335int
326 GNUNET_CONFIGURATION_Handle *cfg, 336GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle
327 const char *section, 337 *cfg, const char *section,
328 const char *option); 338 const char *option);
329 339
330/** 340/**
331 * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" 341 * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR"
@@ -336,9 +346,9 @@ int GNUNET_CONFIGURATION_get_value_yesno (const struct
336 * @param orig string to $-expand (will be freed!) 346 * @param orig string to $-expand (will be freed!)
337 * @return $-expanded string 347 * @return $-expanded string
338 */ 348 */
339char *GNUNET_CONFIGURATION_expand_dollar (const struct 349char *
340 GNUNET_CONFIGURATION_Handle *cfg, 350GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
341 char *orig); 351 *cfg, char *orig);
342 352
343 353
344/** 354/**
@@ -349,10 +359,10 @@ char *GNUNET_CONFIGURATION_expand_dollar (const struct
349 * @param option option of interest 359 * @param option option of interest
350 * @param number value to set 360 * @param number value to set
351 */ 361 */
352void GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle 362void
353 *cfg, const char *section, 363GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle *cfg,
354 const char *option, 364 const char *section, const char *option,
355 unsigned long long number); 365 unsigned long long number);
356 366
357 367
358/** 368/**
@@ -363,10 +373,10 @@ void GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle
363 * @param option option of interest 373 * @param option option of interest
364 * @param value value to set 374 * @param value value to set
365 */ 375 */
366void GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle 376void
367 *cfg, const char *section, 377GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg,
368 const char *option, 378 const char *section, const char *option,
369 const char *value); 379 const char *value);
370 380
371/** 381/**
372 * Remove a filename from a configuration value that 382 * Remove a filename from a configuration value that
@@ -379,11 +389,11 @@ void GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle
379 * @return GNUNET_OK on success, 389 * @return GNUNET_OK on success,
380 * GNUNET_SYSERR if the filename is not in the list 390 * GNUNET_SYSERR if the filename is not in the list
381 */ 391 */
382int GNUNET_CONFIGURATION_remove_value_filename (struct 392int
383 GNUNET_CONFIGURATION_Handle 393GNUNET_CONFIGURATION_remove_value_filename (struct GNUNET_CONFIGURATION_Handle
384 *cfg, const char *section, 394 *cfg, const char *section,
385 const char *option, 395 const char *option,
386 const char *value); 396 const char *value);
387 397
388/** 398/**
389 * Append a filename to a configuration value that 399 * Append a filename to a configuration value that
@@ -396,11 +406,11 @@ int GNUNET_CONFIGURATION_remove_value_filename (struct
396 * @return GNUNET_OK on success, 406 * @return GNUNET_OK on success,
397 * GNUNET_SYSERR if the filename already in the list 407 * GNUNET_SYSERR if the filename already in the list
398 */ 408 */
399int GNUNET_CONFIGURATION_append_value_filename (struct 409int
400 GNUNET_CONFIGURATION_Handle 410GNUNET_CONFIGURATION_append_value_filename (struct GNUNET_CONFIGURATION_Handle
401 *cfg, const char *section, 411 *cfg, const char *section,
402 const char *option, 412 const char *option,
403 const char *value); 413 const char *value);
404 414
405 415
406#if 0 /* keep Emacsens' auto-indent happy */ 416#if 0 /* keep Emacsens' auto-indent happy */