diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-11-03 21:10:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-11-03 21:10:27 +0000 |
commit | 236e47e55554310cc19b8c37c7b844d53a239f28 (patch) | |
tree | daeba73a49d600e9d7fb441fe67f32686e38415b /src/include | |
parent | f9b6dfb41e151628673595fd880318ec502ae4ed (diff) | |
download | gnunet-236e47e55554310cc19b8c37c7b844d53a239f28.tar.gz gnunet-236e47e55554310cc19b8c37c7b844d53a239f28.zip |
implementing time and size parsers for #1875
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_configuration_lib.h | 19 | ||||
-rw-r--r-- | src/include/gnunet_strings_lib.h | 13 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index 7167d8bd6..f8f302a18 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h | |||
@@ -226,6 +226,23 @@ GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle | |||
226 | struct GNUNET_TIME_Relative *time); | 226 | struct GNUNET_TIME_Relative *time); |
227 | 227 | ||
228 | 228 | ||
229 | |||
230 | /** | ||
231 | * Get a configuration value that should be a size in bytes. | ||
232 | * | ||
233 | * @param cfg configuration to inspect | ||
234 | * @param section section of interest | ||
235 | * @param option option of interest | ||
236 | * @param size set to the size in bytes as stored in the configuration | ||
237 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
238 | */ | ||
239 | int | ||
240 | GNUNET_CONFIGURATION_get_value_size (const struct GNUNET_CONFIGURATION_Handle | ||
241 | *cfg, const char *section, | ||
242 | const char *option, | ||
243 | unsigned long long *size); | ||
244 | |||
245 | |||
229 | /** | 246 | /** |
230 | * Test if we have a value for a particular option | 247 | * Test if we have a value for a particular option |
231 | * | 248 | * |
@@ -337,6 +354,7 @@ GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle | |||
337 | *cfg, const char *section, | 354 | *cfg, const char *section, |
338 | const char *option); | 355 | const char *option); |
339 | 356 | ||
357 | |||
340 | /** | 358 | /** |
341 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" | 359 | * Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" |
342 | * where either in the "PATHS" section or the environtment | 360 | * where either in the "PATHS" section or the environtment |
@@ -378,6 +396,7 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
378 | const char *section, const char *option, | 396 | const char *section, const char *option, |
379 | const char *value); | 397 | const char *value); |
380 | 398 | ||
399 | |||
381 | /** | 400 | /** |
382 | * Remove a filename from a configuration value that | 401 | * Remove a filename from a configuration value that |
383 | * represents a list of filenames | 402 | * represents a list of filenames |
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h index 6413fb102..637d4f7de 100644 --- a/src/include/gnunet_strings_lib.h +++ b/src/include/gnunet_strings_lib.h | |||
@@ -51,6 +51,18 @@ extern "C" | |||
51 | 51 | ||
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Convert a given fancy human-readable size to bytes. | ||
55 | * | ||
56 | * @param fancy_size human readable string (i.e. 1 MB) | ||
57 | * @param size set to the size in bytes | ||
58 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | ||
59 | */ | ||
60 | int | ||
61 | GNUNET_STRINGS_fancy_size_to_bytes (const char *fancy_size, | ||
62 | unsigned long long *size); | ||
63 | |||
64 | |||
65 | /** | ||
54 | * Convert a given filesize into a fancy human-readable format. | 66 | * Convert a given filesize into a fancy human-readable format. |
55 | * | 67 | * |
56 | * @param size number of bytes | 68 | * @param size number of bytes |
@@ -85,6 +97,7 @@ GNUNET_STRINGS_to_utf8 (const char *input, size_t len, const char *charset); | |||
85 | char * | 97 | char * |
86 | GNUNET_STRINGS_filename_expand (const char *fil); | 98 | GNUNET_STRINGS_filename_expand (const char *fil); |
87 | 99 | ||
100 | |||
88 | /** | 101 | /** |
89 | * Fill a buffer of the given size with | 102 | * Fill a buffer of the given size with |
90 | * count 0-terminated strings (given as varargs). | 103 | * count 0-terminated strings (given as varargs). |