2012-09-25 13:31:34 +09:30
|
|
|
#ifndef __SERVALD_CLI_H
|
|
|
|
#define __SERVALD_CLI_H
|
|
|
|
|
|
|
|
typedef struct command_line_option {
|
2012-12-04 16:52:49 +10:30
|
|
|
int (*function)(int argc, const char *const *argv, const struct command_line_option *o, void *context);
|
2012-09-25 13:31:34 +09:30
|
|
|
const char *words[32]; // 32 words should be plenty!
|
|
|
|
unsigned long long flags;
|
2012-12-04 16:52:49 +10:30
|
|
|
#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 */
|
2012-09-25 13:31:34 +09:30
|
|
|
const char *description; // describe this invocation
|
|
|
|
} command_line_option;
|
|
|
|
|
|
|
|
|
2012-12-04 16:52:49 +10:30
|
|
|
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);
|
2012-09-25 13:31:34 +09:30
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-04 16:52:49 +10:30
|
|
|
#endif
|