aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_getopt_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-15 10:16:42 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-15 11:14:58 +0100
commit164eed8f5171824cf27b318afeab12f8c6ba9262 (patch)
treec84580c2569579cd554bf2f1426010eadaef0f90 /src/include/gnunet_getopt_lib.h
parent30eb0faa8d4894659cc90c76cc634148df86eab9 (diff)
downloadgnunet-164eed8f5171824cf27b318afeab12f8c6ba9262.tar.gz
gnunet-164eed8f5171824cf27b318afeab12f8c6ba9262.zip
fix test case, implement base32 argument parser logic
Diffstat (limited to 'src/include/gnunet_getopt_lib.h')
-rw-r--r--src/include/gnunet_getopt_lib.h46
1 files changed, 44 insertions, 2 deletions
diff --git a/src/include/gnunet_getopt_lib.h b/src/include/gnunet_getopt_lib.h
index cd546905e..0acf15679 100644
--- a/src/include/gnunet_getopt_lib.h
+++ b/src/include/gnunet_getopt_lib.h
@@ -136,6 +136,12 @@ struct GNUNET_GETOPT_CommandLineOption
136 GNUNET_GETOPT_CommandLineOptionProcessor processor; 136 GNUNET_GETOPT_CommandLineOptionProcessor processor;
137 137
138 /** 138 /**
139 * Function to call on @e scls to clean up after processing all
140 * the arguments. Can be NULL.
141 */
142 void (*cleaner)(void *cls);
143
144 /**
139 * Specific closure to pass to the processor. 145 * Specific closure to pass to the processor.
140 */ 146 */
141 void *scls; 147 void *scls;
@@ -207,6 +213,42 @@ GNUNET_GETOPT_OPTION_FILENAME (char shortName,
207 213
208 214
209/** 215/**
216 * Allow user to specify a binary value using Crockford
217 * Base32 encoding.
218 *
219 * @param shortName short name of the option
220 * @param name long name of the option
221 * @param argumentHelp help text for the option argument
222 * @param description long help text for the option
223 * @param[out] val binary value decoded from Crockford Base32-encoded argument
224 * @param val_size size of @a val in bytes
225 */
226struct GNUNET_GETOPT_CommandLineOption
227GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE (char shortName,
228 const char *name,
229 const char *argumentHelp,
230 const char *description,
231 void *val,
232 size_t val_size);
233
234
235/**
236 * Allow user to specify a binary value using Crockford
237 * Base32 encoding where the size of the binary value is
238 * automatically determined from its type.
239 *
240 * @param shortName short name of the option
241 * @param name long name of the option
242 * @param argumentHelp help text for the option argument
243 * @param description long help text for the option
244 * @param[out] val binary value decoded from Crockford Base32-encoded argument;
245 * size is determined by type (sizeof (*val)).
246 */
247#define GNUNET_GETOPT_OPTION_SET_BASE32_AUTO(shortName,name,argumentHelp,description,val) \
248 GNUNET_GETOPT_OPTION_SET_BASE32_FIXED_SIZE(shortName,name,argumentHelp,description,val,sizeof(*val))
249
250
251/**
210 * Allow user to specify a flag (which internally means setting 252 * Allow user to specify a flag (which internally means setting
211 * an integer to 1/#GNUNET_YES/#GNUNET_OK. 253 * an integer to 1/#GNUNET_YES/#GNUNET_OK.
212 * 254 *
@@ -307,7 +349,7 @@ GNUNET_GETOPT_OPTION_LOGLEVEL (char **level);
307 * @param[out] level set to the verbosity level 349 * @param[out] level set to the verbosity level
308 */ 350 */
309struct GNUNET_GETOPT_CommandLineOption 351struct GNUNET_GETOPT_CommandLineOption
310GNUNET_GETOPT_OPTION_VERBOSE (int *level); 352GNUNET_GETOPT_OPTION_VERBOSE (unsigned int *level);
311 353
312 354
313/** 355/**
@@ -332,7 +374,7 @@ GNUNET_GETOPT_OPTION_CFG_FILE (char **fn);
332 * Marker for the end of the list of options. 374 * Marker for the end of the list of options.
333 */ 375 */
334#define GNUNET_GETOPT_OPTION_END \ 376#define GNUNET_GETOPT_OPTION_END \
335 { '\0', NULL, NULL, NULL, 0, NULL, NULL } 377 { '\0', NULL, NULL, NULL, 0, NULL, NULL, NULL }
336 378
337 379
338/** 380/**