Asterisk - The Open Source Telephony Project
18.5.0
|
CLI Aliases. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/astobj2.h"
Go to the source code of this file.
Data Structures | |
struct | cli_alias |
Macros | |
#define | FORMAT "%-50.50s %-50.50s\n" |
#define | MAX_ALIAS_BUCKETS 53 |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | alias_cmp_cb (void *obj, void *arg, int flags) |
Comparison function used for aliases. More... | |
static int | alias_hash_cb (const void *obj, const int flags) |
Hashing function used for aliases. More... | |
static int | alias_name_cb (void *obj, void *arg, int flags) |
Callback for finding an alias based on name. More... | |
static char * | alias_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI Command to display CLI Aliases. More... | |
static int | alias_unregister_cb (void *obj, void *arg, int flags) |
Callback for unregistering an alias. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
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. More... | |
static void | load_config (int reload) |
Function called to load or reload the configuration file. More... | |
static int | load_module (void) |
Load the module. More... | |
static int | reload_module (void) |
Function called to reload the module. More... | |
static int | unload_module (void) |
Function called to unload the module. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "CLI Aliases" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_alias [] |
CLI commands to interact with things. More... | |
static struct ao2_container * | cli_aliases |
static const char | config_file [] = "cli_aliases.conf" |
CLI Aliases.
This module provides the capability to create aliases to other CLI commands.
Definition in file res_clialiases.c.
#define FORMAT "%-50.50s %-50.50s\n" |
Referenced by alias_show().
#define MAX_ALIAS_BUCKETS 53 |
Maximum number of buckets for CLI aliases
Definition at line 50 of file res_clialiases.c.
Referenced by load_module().
|
static |
Definition at line 303 of file res_clialiases.c.
|
static |
Definition at line 303 of file res_clialiases.c.
|
static |
Comparison function used for aliases.
Definition at line 71 of file res_clialiases.c.
References cli_alias::cli_entry, CMP_MATCH, CMP_STOP, and ast_cli_entry::command.
Referenced by load_module().
|
static |
Hashing function used for aliases.
Definition at line 64 of file res_clialiases.c.
References cli_alias::alias, ast_str_hash(), cli_alias::cli_entry, and ast_cli_entry::command.
Referenced by load_module().
|
static |
Callback for finding an alias based on name.
Definition at line 91 of file res_clialiases.c.
References cli_alias::alias, CMP_MATCH, CMP_STOP, and name.
Referenced by load_config().
|
static |
CLI Command to display CLI Aliases.
Definition at line 153 of file res_clialiases.c.
References cli_alias::alias, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, FORMAT, NULL, cli_alias::real_cmd, and ast_cli_entry::usage.
|
static |
Callback for unregistering an alias.
Definition at line 79 of file res_clialiases.c.
References cli_alias::alias, ast_cli_unregister(), cli_alias::cli_entry, CMP_MATCH, and ast_cli_entry::command.
Referenced by load_config(), and unload_module().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 303 of file res_clialiases.c.
|
static |
Function which passes through an aliased CLI command to the real one.
Definition at line 100 of file res_clialiases.c.
References cli_alias::alias, ao2_find, ao2_ref, ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli_generator(), ast_str_alloca, ast_str_append(), ast_str_buffer(), cli_alias::cli_entry, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, generator, ast_cli_args::line, ast_cli_args::n, NULL, OBJ_POINTER, cli_alias::real_cmd, and ast_cli_args::word.
Referenced by load_config().
|
static |
Function called to load or reload the configuration file.
Definition at line 188 of file res_clialiases.c.
References cli_alias::alias, alias_name_cb(), alias_unregister_cb(), ao2_alloc, ao2_callback, ao2_link, ao2_ref, ast_cli_register, ast_config_destroy(), ast_config_load, ast_log, ast_variable_browse(), ast_verb, cli_alias_passthrough(), cli_alias::cli_entry, ast_cli_entry::command, config_file, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, ast_cli_entry::handler, LOG_ERROR, LOG_WARNING, ast_variable::name, ast_variable::next, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, cli_alias::real_cmd, ast_cli_entry::usage, and ast_variable::value.
Referenced by load_module(), and reload_module().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 283 of file res_clialiases.c.
References alias_cmp_cb(), alias_hash_cb(), AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ARRAY_LEN, ast_cli_register_multiple, AST_MODFLAG_DEFAULT, AST_MODULE_INFO(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, load_config(), MAX_ALIAS_BUCKETS, NULL, reload(), reload_module(), and unload_module().
|
static |
Function called to reload the module.
Definition at line 250 of file res_clialiases.c.
References load_config().
Referenced by load_module().
|
static |
Function called to unload the module.
Definition at line 257 of file res_clialiases.c.
References alias_unregister_cb(), ao2_callback, ao2_container_count(), ao2_ref, ARRAY_LEN, ast_cli_unregister_multiple(), ast_log, LOG_ERROR, NULL, OBJ_MULTIPLE, OBJ_NODATA, and OBJ_UNLINK.
Referenced by load_module().
|
static |
Definition at line 303 of file res_clialiases.c.
|
static |
Definition at line 303 of file res_clialiases.c.
|
static |
CLI commands to interact with things.
Definition at line 183 of file res_clialiases.c.
|
static |
Definition at line 61 of file res_clialiases.c.
|
static |
Configuration file used for this application
Definition at line 53 of file res_clialiases.c.
Referenced by load_config().