mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-24 23:36:46 +00:00
71ed78e058
Change a test case: configuration options are now case sensitive. Fix config file load and parse logic in conf.c, always copy 'debug' flags from config.debug. The config schema 'interfaces' option is no longer MANDATORY. Introduce new CLIFLAG_PERMISSIVE_CONFIG to supress bad-config ERROR messages from the 'config set' and 'config get' commands. Refactor cli_execute() into cli_parse() and cli_invoke(). Use *const* struct command_line_option everywhere.
33 lines
1.4 KiB
C
33 lines
1.4 KiB
C
#ifndef __SERVALD_CLI_H
|
|
#define __SERVALD_CLI_H
|
|
|
|
typedef struct command_line_option {
|
|
int (*function)(int argc, const char *const *argv, const struct command_line_option *o, void *context);
|
|
const char *words[32]; // 32 words should be plenty!
|
|
unsigned long long flags;
|
|
#define CLIFLAG_NONOVERLAY (1<<0) /* Uses a legacy IPv4 DNA call instead of overlay mnetwork */
|
|
#define CLIFLAG_STANDALONE (1<<1) /* Cannot be issued to a running instance */
|
|
#define CLIFLAG_PERMISSIVE_CONFIG (1<<2) /* No error on bad configuration file */
|
|
const char *description; // describe this invocation
|
|
} command_line_option;
|
|
|
|
|
|
int cli_usage(const command_line_option *options);
|
|
int cli_parse(const int argc, const char *const *args, const struct command_line_option *options);
|
|
int cli_invoke(const struct command_line_option *option, const int argc, const char *const *args, void *context);
|
|
int cli_arg(int argc, const char *const *argv, const command_line_option *o, char *argname, const char **dst, int (*validator)(const char *arg), char *defaultvalue);
|
|
|
|
int cli_lookup_did(const char *text);
|
|
int cli_absolute_path(const char *arg);
|
|
int cli_optional_sid(const char *arg);
|
|
int cli_optional_bundle_key(const char *arg);
|
|
int cli_manifestid(const char *arg);
|
|
int cli_fileid(const char *arg);
|
|
int cli_optional_bundle_crypt_key(const char *arg);
|
|
int cli_uint(const char *arg);
|
|
int cli_optional_did(const char *text);
|
|
|
|
|
|
|
|
#endif
|