50#define MAX_ALIAS_BUCKETS 53
73 const struct cli_alias *alias0 = obj, *alias1 = arg;
104 .cli_entry.command = e->
command,
106 char *generator =
NULL;
120 line += (strlen(
alias->alias));
121 if (strncasecmp(
alias->alias,
alias->real_cmd, strlen(
alias->alias))) {
131 if (
a->argc != e->
args) {
138 for (i = e->
args + 1; i <= a->argc; i++) {
155#define FORMAT "%-50.50s %-50.50s\n"
161 e->
command =
"cli show aliases";
163 "Usage: cli show aliases\n"
164 " Displays a list of aliased CLI commands.\n";
208 if (strcmp(v->
name,
"template")) {
226 alias->alias = ((
char *)
alias) +
sizeof(*alias);
232 alias->cli_entry.usage =
"Aliased CLI Command\n";
Asterisk main include file. File version handling, generic pbx functions.
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
Standard Command Line Interface.
int ast_cli_unregister(struct ast_cli_entry *e)
Unregisters a command or an array of commands.
#define ast_cli_register(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 AST_CLI_DEFINE(fn, txt,...)
char * ast_cli_generator(const char *, const char *, int)
Readline madness Useful for readline, that's about it.
void ast_cli(int fd, const char *fmt,...)
ast_cli_command
calling arguments for new-style handlers.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Configuration File Parser.
#define ast_config_load(filename, flags)
Load a config file.
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
@ CONFIG_FLAG_FILEUNCHANGED
#define ast_verb(level,...)
Asterisk module definitions.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static int alias_cmp_cb(void *obj, void *arg, int flags)
Comparison function used for aliases.
static int alias_hash_cb(const void *obj, const int flags)
Hashing function used for aliases.
static char * alias_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI Command to display CLI Aliases.
static int reload_module(void)
Function called to reload the module.
static int alias_name_cb(void *obj, void *arg, int flags)
Callback for finding an alias based on name.
static void load_config(int reload)
Function called to load or reload the configuration file.
static struct ao2_container * cli_aliases
#define MAX_ALIAS_BUCKETS
static const char config_file[]
static int load_module(void)
Load the module.
static int unload_module(void)
Function called to unload the module.
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.
static int alias_unregister_cb(void *obj, void *arg, int flags)
Callback for unregistering an alias.
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
#define ast_str_alloca(init_len)
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
descriptor for a cli entry.
int args
This gets set in ast_cli_register()
Structure used to handle boolean flags.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
struct ast_cli_entry cli_entry