123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #ifndef COMMAND_H_
- #define COMMAND_H_
- #include <libvici.h>
- #include <library.h>
- #define MAX_COMMANDS 26
- #define MAX_OPTIONS 34
- #define MAX_LINES 10
- typedef struct command_t command_t;
- typedef struct command_option_t command_option_t;
- typedef enum command_format_options_t command_format_options_t;
- struct command_option_t {
-
- char *name;
-
- char op;
-
- int arg;
-
- char *desc;
- };
- struct command_t {
-
- int (*call)(vici_conn_t *conn);
-
- char op;
-
- char *cmd;
-
- char *description;
-
- char *line[MAX_LINES];
-
- command_option_t options[MAX_OPTIONS];
- };
- enum command_format_options_t {
- COMMAND_FORMAT_NONE = 0,
- COMMAND_FORMAT_RAW = (1<<0),
- COMMAND_FORMAT_PRETTY = (1<<1),
- COMMAND_FORMAT_PEM = (1<<2),
- };
- int command_getopt(char **arg);
- void command_register(command_t command);
- int command_dispatch(int argc, char *argv[]);
- int command_usage(char *error, ...);
- #endif
|