37 #include "asterisk/module.h"
43 #define MAX_ALIAS_BUCKETS 53
66 const struct cli_alias *alias0 = obj, *alias1 = arg;
113 line += (strlen(alias->
alias));
135 for (i = e->
args + 1; i <= a->argc; i++) {
152 #define FORMAT "%-50.50s %-50.50s\n"
158 e->
command =
"cli show aliases";
160 "Usage: cli show aliases\n"
161 " Displays a list of aliased CLI commands.\n";
189 struct cli_alias *
alias;
193 ast_log(
LOG_ERROR,
"res_clialiases configuration file '%s' not found\n", config_file);
205 if (strcmp(v->
name,
"template")) {
220 if (!(alias =
ao2_alloc((
sizeof(*alias) + strlen(v1->
name) + strlen(v1->
value) + 2), NULL))) {
223 alias->
alias = ((
char *) alias) +
sizeof(*alias);
#define AST_CLI_DEFINE(fn, txt,...)
static void load_config(int reload)
Function called to load or reload the configuration file.
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_link(arg1, arg2)
static char * alias_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI Command to display CLI Aliases.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
static int alias_name_cb(void *obj, void *arg, int flags)
Callback for finding an alias based on name.
int ast_cli_register(struct ast_cli_entry *e)
Registers a command or an array of commands.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define ao2_iterator_next(arg1)
int ast_cli_unregister(struct ast_cli_entry *e)
Unregisters a command or an array of commands.
descriptor for a cli entry.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
Goes through variables.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ao2_callback(c, flags, cb_fn, arg)
void ast_verbose(const char *fmt,...)
Structure for variables, used for configurations and for channel variables.
Configuration File Parser.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags)
Create an iterator for a container.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
#define ast_str_alloca(init_len)
void ast_cli(int fd, const char *fmt,...)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
static int unload_module(void)
Function called to unload the module.
int args
This gets set in ast_cli_register()
static const char config_file[]
static int alias_cmp_cb(void *obj, void *arg, int flags)
Comparison function used for aliases.
#define ast_config_load(filename, flags)
Load a config file.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ao2_ref(o, delta)
ast_cli_command
calling arguments for new-style handlers.
static int alias_unregister_cb(void *obj, void *arg, int flags)
Callback for unregistering an alias.
#define MAX_ALIAS_BUCKETS
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
char *(* handler)(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_generator generator
struct ast_cli_entry cli_entry
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_alloc(data_size, destructor_fn)
#define ao2_find(arg1, arg2, arg3)
static int reload_module(void)
Function called to reload the module.
static int load_module(void)
Function called to load the module.
char * ast_cli_generator(const char *, const char *, int)
Readline madness Useful for readline, that's about it.
void ao2_iterator_destroy(struct ao2_iterator *i)
Destroy a container iterator.
Structure used to handle boolean flags.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Standard Command Line Interface.
#define ao2_container_alloc(arg1, arg2, arg3)
int ast_cli_register_multiple(struct ast_cli_entry *e, int len)
Register multiple commands.
struct ast_variable * next
#define CONFIG_STATUS_FILEINVALID
#define ASTERISK_GPL_KEY
The text the key() function should return.
static int alias_hash_cb(const void *obj, const int flags)
Hashing function used for aliases.
static struct ao2_container * cli_aliases
static char * cli_alias_passthrough(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Function which passes through an aliased CLI command to the real one.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
#define CONFIG_STATUS_FILEUNCHANGED
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.