a mechanism for registering and controlling display of commands More...
Go to the source code of this file.
Classes | |
struct | co_cmd_t |
a struct containing all the relevant information for a specific command More... | |
Macros | |
#define | CMD(N) static int cmd_##N(co_obj_t *self, co_obj_t **output, co_obj_t *params) |
#define | CMD_REGISTER(N, U, D) co_cmd_register(#N, sizeof(#N), U, sizeof(U), D, sizeof(D), cmd_##N ) |
#define | CMD_OUTPUT(K, V) if(*output == NULL) *output = co_tree16_create(); co_tree_insert(*output, K, sizeof(K), V) |
#define | HOOK(N) static int hook_##N##(co_obj_t *self, co_obj_t **output, co_obj_t *params) |
#define | HOOK_REGISTER(N, C) co_cmd_hook_str(N, sizeof(N), hook_##N) |
Typedefs | |
typedef struct co_cmd_t | co_cmd_t |
Functions | |
void | co_cmds_shutdown (void) |
int | co_cmds_init (const size_t index_size) |
struct co_cmd_t | __attribute__ ((packed)) |
int | co_cmd_register (const char *name, const size_t nlen, const char *usage, const size_t ulen, const char *desc, const size_t dlen, co_cb_t handler) |
int | co_cmd_exec (co_obj_t *key, co_obj_t **output, co_obj_t *param) |
executes a command by running the function linked to in the command struct More... | |
co_obj_t * | co_cmd_usage (co_obj_t *key) |
returns command usage format More... | |
co_obj_t * | co_cmd_desc (co_obj_t *key) |
returns command description (what the command does) More... | |
int | co_cmd_hook (const co_obj_t *key, co_obj_t *cb) |
hooks callback function into a command More... | |
int | co_cmd_hook_str (const char *key, const size_t klen, co_obj_t *cb) |
hooks callback function into a command More... | |
int | co_cmd_process (co_iter_t iter, void *context) |
process all registered commands with given iterator More... | |
Variables | |
co_obj_t | _header |
uint8_t | _exttype |
uint8_t | _len |
co_cb_t | exec |
co_obj_t * | name |
co_obj_t * | usage |
co_obj_t * | desc |
co_obj_t * | hooks |
Detailed Description
a mechanism for registering and controlling display of commands
Function Documentation
returns command description (what the command does)
- Parameters
-
key the name of the command
References co_tree_find(), and co_cmd_t::desc.
executes a command by running the function linked to in the command struct
- Parameters
-
key the name of the command output return object of command
References co_tree_find(), and co_cmd_t::exec.
Referenced by dispatcher_cb().
hooks callback function into a command
- Parameters
-
key the name of the command cb reference to callback function
References co_list_append(), and co_tree_find().
int co_cmd_hook_str | ( | const char * | key, |
const size_t | klen, | ||
co_obj_t * | cb | ||
) |
hooks callback function into a command
- Parameters
-
key the name of the command klen length of key string cb reference to callback function
References co_list_append(), and co_tree_find().
int co_cmd_process | ( | co_iter_t | iter, |
void * | context | ||
) |
process all registered commands with given iterator
- Parameters
-
iter iterator function reference context other parameters passed to iterator
References co_tree_process().
returns command usage format
- Parameters
-
key command name
References co_tree_find(), and co_cmd_t::usage.
Variable Documentation
co_obj_t* desc |
description
Referenced by serval_crypto_register().
co_cb_t exec |
pointer to the command's function
Referenced by co_process_start().
co_obj_t* name |
command name
Referenced by co_olsrd_print_conf(), co_olsrd_remove_iface(), olsrd_mdp_register(), olsrd_mdp_sign_register(), and serval_crypto_register().
co_obj_t* usage |
usage syntax
Referenced by serval_crypto_register().
Generated on Fri Jun 6 2014 13:22:05 for commotiond by 1.8.7