struct option;
+/* Command handler context */
+struct ovs_cmdl_context {
+ /* number of command line arguments */
+ int argc;
+ /* array of command line arguments */
+ char **argv;
+ /* private context data defined by the API user */
+ void *pvt;
+};
+
+typedef void (*ovs_cmdl_handler)(struct ovs_cmdl_context *);
+
struct ovs_cmdl_command {
const char *name;
const char *usage;
int min_args;
int max_args;
- void (*handler)(int argc, char *argv[]);
+ ovs_cmdl_handler handler;
+ enum { OVS_RO, OVS_RW } mode; /* Does this command modify things? */
};
char *ovs_cmdl_long_options_to_short_options(const struct option *options);
+
+struct ovs_cmdl_parsed_option {
+ const struct option *o;
+ char *arg;
+};
+char *ovs_cmdl_parse_all(int argc, char *argv[], const struct option *,
+ struct ovs_cmdl_parsed_option **, size_t *)
+ OVS_WARN_UNUSED_RESULT;
+
+char **ovs_cmdl_env_parse_all(int *argcp, char *argv_[],
+ const char *env_options);
+
void ovs_cmdl_print_options(const struct option *options);
void ovs_cmdl_print_commands(const struct ovs_cmdl_command *commands);
-void ovs_cmdl_run_command(int argc, char *argv[], const struct ovs_cmdl_command[]);
+
+void ovs_cmdl_run_command(struct ovs_cmdl_context *,
+ const struct ovs_cmdl_command[]);
+void ovs_cmdl_run_command_read_only(struct ovs_cmdl_context *,
+ const struct ovs_cmdl_command[]);
void ovs_cmdl_proctitle_init(int argc, char **argv);
#if defined(__FreeBSD__) || defined(__NetBSD__)