Asterisk - The Open Source Telephony Project
18.5.0
|
Standard Command Line Interface. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/paths.h"
#include <signal.h>
#include <ctype.h>
#include <regex.h>
#include <pwd.h>
#include <grp.h>
#include "asterisk/cli.h"
#include "asterisk/linkedlists.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/channel.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/lock.h"
#include "asterisk/threadstorage.h"
#include "asterisk/logger_category.h"
#include "asterisk/translate.h"
#include "asterisk/bridge.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/vector.h"
#include "asterisk/stream.h"
Go to the source code of this file.
Data Structures | |
struct | channel_set_debug_args |
struct | cli_perm |
List of restrictions per user. More... | |
struct | cli_perm_head |
struct | cli_perms |
List of users and permissions. More... | |
struct | helpers |
struct | module_level |
map a debug or verbose level to a module name More... | |
struct | module_level_list |
struct | usergroup_cli_perm |
list of users to apply restrictions. More... | |
Macros | |
#define | AST_CLI_INITLEN 256 |
#define | CONCISE_FORMAT_STRING "%s!%s!%s!%d!%s!%s!%s!%s!%s!%s!%d!%s!%s!%s\n" |
#define | DAY (HOUR*24) |
#define | DEBUG_HANDLER 0 |
#define | FORMAT_STRING "%-20.20s %-20.20s %-7.7s %-30.30s\n" |
#define | FORMAT_STRING "%-25s %-20s %-20s\n" |
#define | FORMAT_STRING2 "%-20.20s %-20.20s %-7.7s %-30.30s\n" |
#define | HOUR (MINUTE*60) |
#define | MINUTE (SECOND*60) |
#define | MODLIST_FORMAT "%-30s %-40.40s %-10d %-11s %13s\n" |
#define | MODLIST_FORMAT2 "%-30s %-40.40s %-10s %-11s %13s\n" |
#define | NEEDCOMMA(x) ((x) ? ", " : "") /* define if we need a comma */ |
#define | SECOND (1) |
#define | TRACE_HANDLER 1 |
#define | VERBOSE_FORMAT_STRING "%-20.20s %-20.20s %-16.16s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
#define | VERBOSE_FORMAT_STRING2 "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
#define | VERBOSE_HANDLER 2 |
#define | WEEK (DAY*7) |
#define | YEAR (DAY*365) |
Functions | |
static char * | __ast_cli_generator (const char *text, const char *word, int state, int lock) |
int | __ast_cli_register (struct ast_cli_entry *e, struct ast_module *module) |
int | __ast_cli_register_multiple (struct ast_cli_entry *e, int len, struct ast_module *module) |
static void | __init_ast_cli_buf (void) |
static int | allowed_on_shutdown (struct ast_cli_entry *e) |
void | ast_builtins_init (void) |
initialize the _full_cmd string in * each of the builtins. More... | |
int | ast_cli_allow_at_shutdown (struct ast_cli_entry *e) |
int | ast_cli_command_full (int uid, int gid, int fd, const char *s) |
Interprets a command Interpret a command s, sending output to fd if uid:gid has permissions to run this command. uid = CLI_NO_PERMS to avoid checking user permissions gid = CLI_NO_PERMS to avoid checking group permissions. More... | |
int | ast_cli_command_multiple_full (int uid, int gid, int fd, size_t size, const char *s) |
Executes multiple CLI commands Interpret strings separated by NULL and execute each one, sending output to fd if uid has permissions, uid = CLI_NO_PERMS to avoid checking users permissions. gid = CLI_NO_PERMS to avoid checking group permissions. More... | |
char * | ast_cli_complete (const char *word, const char *const choices[], int state) |
int | ast_cli_completion_add (char *value) |
Add a result to a request for completion options. More... | |
char ** | ast_cli_completion_matches (const char *text, const char *word) |
Generates a NULL-terminated array of strings that 1) begin with the string in the second parameter, and 2) are valid in a command after the string in the first parameter. More... | |
struct ast_vector_string * | ast_cli_completion_vector (const char *text, const char *word) |
Generates a vector of strings for CLI completion. More... | |
char * | ast_cli_generator (const char *text, const char *word, int state) |
Readline madness Useful for readline, that's about it. More... | |
int | ast_cli_perms_init (int reload) |
void | ast_cli_print_timestr_fromseconds (int fd, int seconds, const char *prefix) |
Print on cli a duration in seconds in format s year(s), s week(s), s day(s), s hour(s), s second(s) More... | |
int | ast_cli_unregister (struct ast_cli_entry *e) |
Unregisters a command or an array of commands. More... | |
int | ast_cli_unregister_multiple (struct ast_cli_entry *e, int len) |
Unregister multiple commands. More... | |
char * | ast_complete_channels (const char *line, const char *word, int pos, int state, int rpos) |
Command completion for the list of active channels. More... | |
unsigned int | ast_debug_get_by_module (const char *module) |
Get the debug level for a module. More... | |
AST_THREADSTORAGE_RAW (completion_storage) | |
unsigned int | ast_trace_get_by_module (const char *module) |
Get the trace level for a module. More... | |
static | AST_VECTOR (struct ast_cli_entry *) |
static int | channel_set_debug (void *obj, void *arg, void *data, int flags) |
static int | cli_completion_vector_add (struct ast_vector_string *vec, char *value) |
static int | cli_has_permissions (int uid, int gid, const char *command) |
static int | cli_is_registered (struct ast_cli_entry *e) |
static struct ast_cli_entry * | cli_next (struct ast_cli_entry *e) |
static void | cli_shutdown (void) |
static char * | complete_number (const char *partial, unsigned int min, unsigned int max, int n) |
static void | destroy_user_perms (void) |
cleanup (free) cli_perms linkedlist. More... | |
static char * | find_best (const char *argv[]) |
static struct ast_cli_entry * | find_cli (const char *const cmds[], int match_type) |
static struct module_level * | find_module_level (const char *module, struct module_level_list *mll) |
Find the module level setting. More... | |
static char * | group_show_channels (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_chanlist (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_check_permissions (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
handles CLI command 'cli check permissions' More... | |
static char * | handle_cli_malloc_trim (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_reload_permissions (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
handles CLI command 'cli reload permissions' More... | |
static char * | handle_cli_show_permissions (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
handles CLI command 'cli show permissions' More... | |
static char * | handle_cli_wait_fullybooted (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_commandmatchesarray (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_core_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_core_set_debug_channel (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_debug_category (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_debug_or_trace (int handler, struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_help (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_load (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_logger_mute (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_modlist (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_nodebugchan_deprecated (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_showcalls (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_showchan (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_showuptime (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_softhangup (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_trace (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_unload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_verbose (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | help1 (int fd, const char *const match[], int locked) |
helper for final part of handle_help if locked = 1, assume the list is already locked More... | |
static char * | is_prefix (const char *word, const char *token, int pos, int *actual) |
if word is a valid prefix for token, returns the pos-th match as a malloced string, or NULL otherwise. Always tell in *actual how many matches we got. More... | |
static int | modlist_modentry (const char *module, const char *description, int usecnt, const char *status, const char *like, enum ast_module_support_level support_level) |
static int | more_words (const char *const *dst) |
returns true if there are more words to match More... | |
static char * | parse_args (const char *s, int *argc, const char *argv[], int max, int *trailingwhitespace) |
static void | print_uptimestr (int fd, struct timeval timeval, const char *prefix, int printsec) |
static void | remove_shutdown_command (struct ast_cli_entry *e) |
static int | set_full_cmd (struct ast_cli_entry *e) |
static void | status_debug_verbose (struct ast_cli_args *a, int handler, int old_val, int cur_val) |
static int | word_match (const char *cmd, const char *cli_word) |
Variables | |
static struct ast_threadstorage | ast_cli_buf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_ast_cli_buf , .custom_init = NULL , } |
static struct ast_cli_entry | cli_cli [] |
static int | cli_default_perm = 1 |
Default permissions value 1=Permit 0=Deny. More... | |
static struct cli_perms | cli_perms = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static const char | cli_rsvd [] = "[]{}|*%" |
static int | climodentryfd = -1 |
static ast_mutex_t | climodentrylock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static struct module_level_list | debug_modules = AST_RWLIST_HEAD_INIT_VALUE |
static struct helpers | helpers = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static const char | perms_config [] = "cli_permissions.conf" |
CLI permissions config file. More... | |
static ast_mutex_t | permsconfiglock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
mutex used to prevent a user from running the 'cli reload permissions' command while it is already running. More... | |
static ast_rwlock_t | shutdown_commands_lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } |
static struct module_level_list | trace_modules = AST_RWLIST_HEAD_INIT_VALUE |
Standard Command Line Interface.
Definition in file main/cli.c.
#define AST_CLI_INITLEN 256 |
Referenced by AST_VECTOR().
#define CONCISE_FORMAT_STRING "%s!%s!%s!%d!%s!%s!%s!%s!%s!%s!%d!%s!%s!%s\n" |
Referenced by handle_chanlist().
#define DAY (HOUR*24) |
Referenced by print_uptimestr().
#define DEBUG_HANDLER 0 |
Definition at line 403 of file main/cli.c.
Referenced by handle_debug(), handle_debug_or_trace(), and status_debug_verbose().
#define FORMAT_STRING "%-20.20s %-20.20s %-7.7s %-30.30s\n" |
Referenced by group_show_channels(), and handle_chanlist().
#define FORMAT_STRING "%-25s %-20s %-20s\n" |
#define FORMAT_STRING2 "%-20.20s %-20.20s %-7.7s %-30.30s\n" |
Referenced by handle_chanlist().
#define HOUR (MINUTE*60) |
Referenced by print_uptimestr().
#define MINUTE (SECOND*60) |
Referenced by print_uptimestr().
#define MODLIST_FORMAT "%-30s %-40.40s %-10d %-11s %13s\n" |
Definition at line 857 of file main/cli.c.
Referenced by modlist_modentry().
#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s %-11s %13s\n" |
Definition at line 858 of file main/cli.c.
Referenced by handle_modlist().
Referenced by print_uptimestr().
#define SECOND (1) |
#define TRACE_HANDLER 1 |
Definition at line 404 of file main/cli.c.
Referenced by handle_trace(), and status_debug_verbose().
#define VERBOSE_FORMAT_STRING "%-20.20s %-20.20s %-16.16s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
Referenced by handle_chanlist().
#define VERBOSE_FORMAT_STRING2 "%-20.20s %-20.20s %-16.16s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
Referenced by handle_chanlist().
#define VERBOSE_HANDLER 2 |
Definition at line 405 of file main/cli.c.
Referenced by handle_verbose(), and status_debug_verbose().
#define WEEK (DAY*7) |
Referenced by print_uptimestr().
#define YEAR (DAY*365) |
Referenced by print_uptimestr().
|
static |
Definition at line 2829 of file main/cli.c.
References ast_cli_args::argv, ARRAY_LEN, ast_free, ast_join, AST_MAX_ARGS, ast_module_running_ref, ast_module_unref, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_strlen_zero, CLI_GENERATE, cli_next(), ast_cli_entry::cmda, ast_cli_entry::command, ast_cli_entry::handler, is_prefix(), ast_cli_args::line, ast_cli_entry::module, more_words(), NULL, parse_args(), and word_match().
Referenced by ast_cli_generator(), handle_cli_check_permissions(), and handle_help().
int __ast_cli_register | ( | struct ast_cli_entry * | e, |
struct ast_module * | module | ||
) |
Definition at line 2420 of file main/cli.c.
References ast_cli_entry::_full_cmd, ast_free, ast_log, AST_MAX_CMD_LEN, AST_RWLIST_INSERT_BEFORE_CURRENT, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_skip_blanks(), ast_skip_nonblanks(), ast_strdup, ast_strlen_zero, CLI_INIT, cli_is_registered(), ast_cli_entry::cmda, ast_cli_entry::cmdlen, ast_cli_entry::command, done, find_cli(), ast_cli_entry::handler, len(), cli_perm::list, LOG_WARNING, ast_cli_entry::module, NULL, S_OR, and set_full_cmd().
Referenced by __ast_cli_register_multiple().
int __ast_cli_register_multiple | ( | struct ast_cli_entry * | e, |
int | len, | ||
struct ast_module * | module | ||
) |
Definition at line 2497 of file main/cli.c.
References __ast_cli_register(), and len().
|
static |
Definition at line 110 of file main/cli.c.
|
static |
Definition at line 2922 of file main/cli.c.
References ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, and shutdown_commands_lock.
Referenced by ast_cli_command_full().
void ast_builtins_init | ( | void | ) |
initialize the _full_cmd string in * each of the builtins.
Provided by cli.c
Definition at line 2209 of file main/cli.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), AST_VECTOR_INIT, and cli_shutdown().
Referenced by asterisk_daemon().
int ast_cli_allow_at_shutdown | ( | struct ast_cli_entry * | e | ) |
Definition at line 3026 of file main/cli.c.
References ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_APPEND, and shutdown_commands_lock.
Referenced by handle_abort_shutdown(), handle_restart_gracefully(), handle_restart_now(), handle_restart_when_convenient(), handle_show_locks(), handle_stop_gracefully(), handle_stop_now(), and handle_stop_when_convenient().
int ast_cli_command_full | ( | int | uid, |
int | gid, | ||
int | fd, | ||
const char * | s | ||
) |
Interprets a command Interpret a command s, sending output to fd if uid:gid has permissions to run this command. uid = CLI_NO_PERMS to avoid checking user permissions gid = CLI_NO_PERMS to avoid checking group permissions.
uid | User ID that is trying to run the command. |
gid | Group ID that is trying to run the command. |
fd | pipe |
s | incoming string |
0 | on success |
-1 | on failure |
Definition at line 2939 of file main/cli.c.
References allowed_on_shutdown(), args, ast_atomic_fetchadd_int(), ast_cli(), ast_free, ast_join, AST_MAX_ARGS, ast_module_running_ref, ast_module_unref, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_shutting_down(), CLI_FAILURE, CLI_HANDLER, cli_has_permissions(), CLI_SHOWUSAGE, CLI_SUCCESS, done, ast_cli_args::fd, find_best(), find_cli(), ast_cli_entry::handler, ast_cli_entry::inuse, ast_cli_entry::module, NULL, parse_args(), RESULT_FAILURE, RESULT_SUCCESS, retval, S_OR, tmp(), and ast_cli_entry::usage.
Referenced by ast_cli_command_multiple_full().
int ast_cli_command_multiple_full | ( | int | uid, |
int | gid, | ||
int | fd, | ||
size_t | size, | ||
const char * | s | ||
) |
Executes multiple CLI commands Interpret strings separated by NULL and execute each one, sending output to fd if uid has permissions, uid = CLI_NO_PERMS to avoid checking users permissions. gid = CLI_NO_PERMS to avoid checking group permissions.
uid | User ID that is trying to run the command. |
gid | Group ID that is trying to run the command. |
fd | pipe |
size | is the total size of the string |
s | incoming string |
number | of commands executed |
Definition at line 3004 of file main/cli.c.
References ast_cli_command_full().
Referenced by netconsole().
char* ast_cli_complete | ( | const char * | word, |
const char *const | choices[], | ||
int | pos | ||
) |
Helper function to generate cli entries from a NULL-terminated array. Returns the n-th matching entry from the array, or NULL if not found. Can be used to implement generate() for static entries as below (in this example we complete the word in position 2):
Definition at line 1811 of file main/cli.c.
References ast_cli_completion_add(), ast_strdup, ast_strlen_zero, len(), and NULL.
Referenced by cli_odbc_read(), cli_odbc_write(), complete_skinny_reset(), complete_skinny_show_line(), handle_bridge_kick_channel(), handle_cli_core_show_translation(), handle_cli_devstate_change(), handle_cli_iax2_prune_realtime(), handle_cli_presencestate_change(), handle_cli_rtp_drop_incoming_packets(), handle_core_set_debug_channel(), handle_orig(), handle_showcalls(), handle_softhangup(), sip_prune_realtime(), sip_qualify_peer(), sip_show_peer(), sip_show_user(), sorcery_memory_cache_stale(), test_cli_execute_registered(), test_cli_generate_results(), test_cli_show_registered(), and test_cli_show_results().
int ast_cli_completion_add | ( | char * | value | ) |
Add a result to a request for completion options.
value | A completion option text. |
0 | Success |
-1 | Failure |
This is an alternative to returning individual values from CLI_GENERATE. Instead of repeatedly being asked for the next match and having to start over, you can call this function repeatedly from your own stateful loop. When all matches have been added you can return NULL from the CLI_GENERATE function.
Definition at line 2726 of file main/cli.c.
References ast_threadstorage_get_ptr(), and cli_completion_vector_add().
Referenced by ao2_container_unregister(), ast_cli_complete(), ast_complete_applications(), ast_complete_channels(), category_complete(), cli_complete_endpoint(), cli_complete_show(), cli_complete_uri(), complete_bridge_live_search(), complete_bridge_participant(), complete_bridge_technology(), complete_channeltypes(), complete_config_module(), complete_config_option(), complete_config_type(), complete_core_id(), complete_country(), complete_indications(), complete_show_sorcery_object(), complete_test_category(), complete_test_name(), complete_trans_path_choice(), handle_cli_config_reload(), handle_cli_rtp_drop_incoming_packets(), handle_cli_sound_show(), handle_debug_category(), handle_manager_show_event(), handle_show_named_acl_cmd(), handle_showmanager(), handle_showmancmd(), module_load_helper_on_file(), stir_shaken_tab_complete_name(), topic_complete_name(), and tps_taskprocessor_tab_complete().
char** ast_cli_completion_matches | ( | const char * | , |
const char * | |||
) |
Generates a NULL-terminated array of strings that 1) begin with the string in the second parameter, and 2) are valid in a command after the string in the first parameter.
The first entry (offset 0) of the result is the longest common substring in the results, useful to extend the string that has been completed. Subsequent entries are all possible values, followed by a NULL. All strings and the array itself are malloc'ed and must be freed by the caller.
Definition at line 2670 of file main/cli.c.
References ast_cli_completion_vector(), ast_free, AST_THREADSTORAGE_RAW(), AST_VECTOR_APPEND, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_PTR_FREE, AST_VECTOR_STEAL_ELEMENTS, and NULL.
Referenced by handle_commandmatchesarray().
struct ast_vector_string* ast_cli_completion_vector | ( | const char * | text, |
const char * | word | ||
) |
Generates a vector of strings for CLI completion.
text | Complete input being matched. |
word | Current word being matched |
The results contain strings that both: 1) Begin with the string in word. 2) Are valid in a command after the string in text.
The first entry (offset 0) of the result is the longest common substring in the results, useful to extend the string that has been completed. Subsequent entries are all possible values.
Definition at line 2731 of file main/cli.c.
References ast_assert, ast_calloc, ast_cli_generator(), ast_free, ast_log, ast_strndup, ast_threadstorage_get_ptr(), ast_threadstorage_set_ptr(), AST_VECTOR_CALLBACK_VOID, AST_VECTOR_GET, AST_VECTOR_INSERT_AT, AST_VECTOR_PTR_FREE, AST_VECTOR_REMOVE, AST_VECTOR_SIZE, cli_completion_vector_add(), LOG_ERROR, and NULL.
Referenced by ast_cli_completion_matches(), AST_TEST_DEFINE(), and cli_complete().
char* ast_cli_generator | ( | const char * | , |
const char * | , | ||
int | |||
) |
Readline madness Useful for readline, that's about it.
0 | on success |
-1 | on failure |
Only call this function to proxy the CLI generator to another.
Definition at line 2917 of file main/cli.c.
References __ast_cli_generator().
Referenced by ast_cli_completion_vector(), cli_alias_passthrough(), and handle_cli_check_permissions().
int ast_cli_perms_init | ( | int | reload | ) |
Provided by cli.c
Definition at line 2081 of file main/cli.c.
References ast_calloc, ast_category_browse(), ast_config_destroy(), ast_config_load2(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log, ast_mutex_trylock, ast_mutex_unlock, AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strdup, ast_strlen_zero, ast_variable_browse(), cli_default_perm, cli_perm::command, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEUNCHANGED, destroy_user_perms(), usergroup_cli_perm::gid, cli_perm::list, LOG_NOTICE, LOG_WARNING, ast_variable::name, ast_variable::next, NULL, cli_perm::permit, usergroup_cli_perm::perms, perms_config, permsconfiglock, usergroup_cli_perm::uid, and ast_variable::value.
Referenced by asterisk_daemon(), and handle_cli_reload_permissions().
void ast_cli_print_timestr_fromseconds | ( | int | fd, |
int | seconds, | ||
const char * | prefix | ||
) |
Print on cli a duration in seconds in format s year(s), s week(s), s day(s), s hour(s), s second(s)
ast_cli_args | fd to print by ast_cli |
duration | The time (in seconds) to print |
prefix | A Prefix string to add before of duration formatted |
Definition at line 3021 of file main/cli.c.
References ast_tv(), and print_uptimestr().
Referenced by handle_cdr_pgsql_status(), handle_cli_cdr_mysql_status(), handle_cli_realtime_pgsql_status(), and realtime_ldap_status().
int ast_cli_unregister | ( | struct ast_cli_entry * | e | ) |
Unregisters a command or an array of commands.
e | which cli entry to unregister Unregister your own command. You must pass a completed ast_cli_entry structure |
Definition at line 2397 of file main/cli.c.
References ast_cli_entry::_full_cmd, ast_free, ast_log, AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_cli_entry::cmda, ast_cli_entry::command, ast_cli_entry::handler, ast_cli_entry::inuse, cli_perm::list, LOG_WARNING, NULL, remove_shutdown_command(), and ast_cli_entry::usage.
Referenced by aco_deinit(), alias_unregister_cb(), ast_cli_unregister_multiple(), unload_module(), and xmldoc_unload_documentation().
int ast_cli_unregister_multiple | ( | struct ast_cli_entry * | e, |
int | len | ||
) |
Unregister multiple commands.
e | pointer to first cli entry to unregister |
len | number of entries to unregister |
Definition at line 2508 of file main/cli.c.
References ast_cli_unregister(), and len().
Referenced by cli_shutdown().
char* ast_complete_channels | ( | const char * | line, |
const char * | word, | ||
int | pos, | ||
int | state, | ||
int | rpos | ||
) |
Command completion for the list of active channels.
This can be called from a CLI command completion function that wants to complete from the list of active channels. 'rpos' is the required position in the command. This function will return NULL immediately if 'rpos' is not the same as the current position, 'pos'.
Definition at line 1830 of file main/cli.c.
References ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_channel_cache_all(), ast_cli_completion_add(), ast_strdup, ast_channel_snapshot::base, ast_channel_snapshot_base::name, NULL, and state.
Referenced by complete_ch(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_core_set_debug_channel(), handle_redirect(), handle_remb_set(), handle_set_chanvar(), handle_show_chanvar(), handle_show_hangup_channel(), handle_showchan(), and handle_softhangup().
unsigned int ast_debug_get_by_module | ( | const char * | module | ) |
Get the debug level for a module.
module | the name of module |
Definition at line 136 of file main/cli.c.
References AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, and module_level::level.
AST_THREADSTORAGE_RAW | ( | completion_storage | ) |
Referenced by ast_cli_completion_matches().
unsigned int ast_trace_get_by_module | ( | const char * | module | ) |
Get the trace level for a module.
module | the name of module |
Definition at line 153 of file main/cli.c.
References AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, and module_level::level.
|
static |
Definition at line 113 of file main/cli.c.
References ast_carefulwrite(), ast_cli_buf, AST_CLI_INITLEN, AST_DYNSTR_BUILD_FAILED, ast_str_buffer(), ast_str_set_va(), ast_str_strlen(), ast_str_thread_get(), and buf.
|
static |
Definition at line 1452 of file main/cli.c.
References args, ast_channel_fin(), ast_channel_fin_set(), ast_channel_fout(), ast_channel_fout_set(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_cli(), DEBUGCHAN_FLAG, channel_set_debug_args::fd, and channel_set_debug_args::is_off.
Referenced by handle_core_set_debug_channel().
|
static |
Definition at line 2705 of file main/cli.c.
References ast_free, ast_threadstorage_set_ptr(), AST_VECTOR_ADD_SORTED, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, and NULL.
Referenced by ast_cli_completion_add(), and ast_cli_completion_vector().
|
static |
Definition at line 183 of file main/cli.c.
References AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, cli_default_perm, CLI_NO_PERMS, cli_perm::command, usergroup_cli_perm::gid, cli_perm::list, NULL, cli_perm::permit, usergroup_cli_perm::perms, and usergroup_cli_perm::uid.
Referenced by ast_cli_command_full(), and handle_cli_check_permissions().
|
static |
Definition at line 2378 of file main/cli.c.
References cli_next(), and NULL.
Referenced by __ast_cli_register().
|
static |
Definition at line 929 of file main/cli.c.
References AST_LIST_FIRST, AST_LIST_NEXT, and cli_perm::list.
Referenced by __ast_cli_generator(), cli_is_registered(), find_cli(), handle_cli_check_permissions(), and help1().
|
static |
Definition at line 2203 of file main/cli.c.
References ARRAY_LEN, and ast_cli_unregister_multiple().
Referenced by ast_builtins_init().
|
static |
Definition at line 363 of file main/cli.c.
References ast_strdup, ast_strlen_zero, cli_perm::next, and NULL.
Referenced by handle_debug(), handle_trace(), and handle_verbose().
|
static |
cleanup (free) cli_perms linkedlist.
Definition at line 2065 of file main/cli.c.
References ast_free, AST_LIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cli_perm::command, cli_perm::list, and usergroup_cli_perm::perms.
Referenced by ast_cli_perms_init().
|
static |
Definition at line 2360 of file main/cli.c.
References ast_join, AST_MAX_CMD_LEN, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, find_cli(), and NULL.
Referenced by ast_cli_command_full().
|
static |
Definition at line 2316 of file main/cli.c.
References ast_strlen_zero, cli_next(), NULL, and word_match().
Referenced by __ast_cli_register(), ast_cli_command_full(), find_best(), and handle_help().
|
static |
Find the module level setting.
module | Module name to look for. |
mll | List to search. |
level | struct found on success. |
NULL | not found. |
Definition at line 351 of file main/cli.c.
References AST_LIST_TRAVERSE, and NULL.
Referenced by handle_debug_or_trace().
|
static |
Definition at line 1865 of file main/cli.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_app_group_list_head(), ast_app_group_list_rdlock(), ast_app_group_list_unlock(), ast_channel_name(), ast_cli(), AST_LIST_NEXT, ast_strlen_zero, ast_group_info::category, ast_group_info::chan, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ESS, ast_cli_args::fd, FORMAT_STRING, ast_group_info::group, ast_group_info::group_list, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1067 of file main/cli.c.
References ast_channel_snapshot_peer::account, ast_channel_snapshot_base::accountcode, ast_channel_snapshot::amaflags, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_channel_snapshot_dialplan::appl, ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_active_calls(), ast_active_channels(), ast_channel_cache_by_name(), ast_cli(), ast_option_maxcalls, ast_processed_calls(), ast_state2str(), ast_strlen_zero, ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), ast_channel_snapshot::base, ast_channel_snapshot::bridge, ast_channel_snapshot::caller, channels, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, CONCISE_FORMAT_STRING, ast_channel_snapshot_dialplan::context, ast_channel_snapshot_base::creationtime, ast_channel_snapshot_dialplan::data, ast_channel_snapshot::dialplan, ESS, ast_channel_snapshot_dialplan::exten, ast_cli_args::fd, FORMAT_STRING, FORMAT_STRING2, ast_channel_snapshot_bridge::id, ast_channel_snapshot_base::name, NULL, ast_channel_snapshot_caller::number, ast_channel_snapshot::peer, ast_channel_snapshot_dialplan::priority, S_OR, ast_channel_snapshot::state, ast_channel_snapshot_base::uniqueid, ast_cli_entry::usage, VERBOSE_FORMAT_STRING, and VERBOSE_FORMAT_STRING2.
|
static |
handles CLI command 'cli check permissions'
Definition at line 1316 of file main/cli.c.
References __ast_cli_generator(), ast_cli_entry::_full_cmd, ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_cli_generator(), ast_join, AST_MAX_ARGS, ast_strdupa, ast_strlen_zero, CLI_FAILURE, CLI_GENERATE, cli_has_permissions(), CLI_INIT, cli_next(), CLI_SHOWUSAGE, CLI_SUCCESS, cli_perm::command, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, lock, ast_cli_args::n, NULL, ast_cli_args::pos, S_OR, ast_cli_entry::summary, text, tmp(), ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1956 of file main/cli.c.
References a, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, handle_help(), NULL, and ast_cli_entry::usage.
|
static |
handles CLI command 'cli reload permissions'
Definition at line 1297 of file main/cli.c.
References ast_cli_perms_init(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
handles CLI command 'cli show permissions'
Definition at line 1252 of file main/cli.c.
References ast_cli(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, cli_perm::command, ast_cli_entry::command, ast_cli_args::fd, usergroup_cli_perm::gid, cli_perm::list, NULL, cli_perm::permit, usergroup_cli_perm::perms, usergroup_cli_perm::uid, and ast_cli_entry::usage.
|
static |
Definition at line 1919 of file main/cli.c.
References ast_cli(), AST_OPT_FLAG_FULLY_BOOTED, ast_options, ast_test_flag, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1393 of file main/cli.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), AST_CLI_COMPLETE_EOF, ast_cli_completion_matches(), ast_free, ast_malloc, ast_realloc, buf, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, len(), NULL, and ast_cli_entry::usage.
|
static |
Definition at line 319 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_module_reload(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1476 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_channel_callback(), ast_channel_get_by_name(), ast_channel_unref, ast_cli(), ast_cli_complete(), ast_complete_channels(), c, channel_set_debug(), CLI_GENERATE, CLI_HANDLER, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, DEBUGCHAN_FLAG, ast_cli_args::fd, channel_set_debug_args::fd, global_fin, global_fout, channel_set_debug_args::is_off, ast_cli_args::line, ast_cli_args::n, NULL, OBJ_MULTIPLE, OBJ_NODATA, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
Referenced by handle_nodebugchan_deprecated().
|
static |
Definition at line 572 of file main/cli.c.
References ast_cli_args::argv, ast_module_helper(), AST_MODULE_HELPER_RUNNING, ast_strdup, ast_strlen_zero, CLI_GENERATE, CLI_INIT, ast_cli_entry::command, complete_number(), DEBUG_HANDLER, handle_debug_or_trace(), ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, S_OR, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1542 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli_completion_add(), ast_debug_category_complete(), ast_debug_category_set_sublevels(), AST_LOG_CATEGORY_DISABLED, AST_LOG_CATEGORY_ENABLED, ast_strdup, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::n, NULL, ast_cli_args::pos, S_OR, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 449 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_calloc, ast_clear_flag, ast_cli(), ast_free, AST_OPT_FLAG_DEBUG_MODULE, AST_OPT_FLAG_TRACE_MODULE, ast_options, AST_RWLIST_EMPTY, AST_RWLIST_INSERT_TAIL, AST_RWLIST_REMOVE, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_set_flag, ast_strdupa, CLI_FAILURE, CLI_SHOWUSAGE, CLI_SUCCESS, DEBUG_HANDLER, debug_modules, ast_cli_args::fd, find_module_level(), module_level::level, option_debug, option_trace, status_debug_verbose(), and trace_modules.
Referenced by handle_debug(), and handle_trace().
|
static |
Definition at line 2552 of file main/cli.c.
References __ast_cli_generator(), ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), ast_join, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, find_cli(), help1(), ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_entry::usage, and ast_cli_args::word.
Referenced by handle_cli_malloc_trim().
|
static |
Definition at line 240 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), ast_load_resource(), ast_module_helper(), AST_MODULE_HELPER_LOAD, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 783 of file main/cli.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_console_toggle_mute(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 971 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), ast_module_helper(), AST_MODULE_HELPER_LOADED, ast_mutex_lock, ast_mutex_unlock, ast_update_module_list(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, climodentryfd, climodentrylock, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, MODLIST_FORMAT2, modlist_modentry(), ast_cli_args::n, NULL, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1583 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, CLI_HANDLER, CLI_INIT, CLI_SHOWUSAGE, ast_cli_entry::command, handle_core_set_debug_channel(), and NULL.
|
static |
Definition at line 268 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), ast_module_helper(), AST_MODULE_HELPER_RELOAD, ast_module_reload(), AST_MODULE_RELOAD_ERROR, AST_MODULE_RELOAD_IN_PROGRESS, AST_MODULE_RELOAD_NOT_FOUND, AST_MODULE_RELOAD_NOT_IMPLEMENTED, AST_MODULE_RELOAD_QUEUED, AST_MODULE_RELOAD_SUCCESS, AST_MODULE_RELOAD_UNINITIALIZED, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 1011 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_active_calls(), ast_cli(), ast_cli_complete(), ast_option_maxcalls, ast_processed_calls(), ast_startuptime, ast_tvnow(), ast_tvsub(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, ast_cli_entry::command, ESS, ast_cli_args::fd, ast_cli_args::n, NULL, ast_cli_args::pos, print_uptimestr(), RESULT_SUCCESS, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
< Buffer for CDR variables.
< Accumulation buffer for all output.
Definition at line 1610 of file main/cli.c.
References ao2_cleanup, ast_cli_args::argc, ast_cli_args::argv, ast_callid_strnprint(), ast_cdr_serialize_variables(), AST_CHAN_TP_INTERNAL, ast_channel_appl(), ast_channel_caller(), ast_channel_callgroup(), ast_channel_callid(), ast_channel_connected(), ast_channel_connected_effective_id(), ast_channel_context(), ast_channel_creationtime(), ast_channel_data(), ast_channel_dialed(), ast_channel_exten(), ast_channel_get_bridge(), ast_channel_get_by_name(), ast_channel_get_stream_topology(), ast_channel_language(), ast_channel_linkedid(), ast_channel_lock, ast_channel_name(), ast_channel_nativeformats(), ast_channel_pickupgroup(), ast_channel_priority(), ast_channel_readformat(), ast_channel_readtrans(), ast_channel_tech(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_unref, ast_channel_varshead(), ast_channel_whentohangup(), ast_channel_writeformat(), ast_channel_writetrans(), ast_cli(), ast_codec_media_type2str(), ast_complete_channels(), ast_format_cap_get_names(), AST_FORMAT_CAP_NAMES_LEN, ast_format_get_name(), ast_free, AST_LIST_TRAVERSE, ast_state2str(), ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_strlen(), ast_str_thread_get(), ast_stream_get_formats(), ast_stream_get_group(), ast_stream_get_metadata_list(), ast_stream_get_name(), ast_stream_get_state(), ast_stream_get_type(), ast_stream_state2str(), ast_stream_topology_get_count(), ast_stream_topology_get_stream(), ast_translate_path_to_str(), ast_tvnow(), ast_tvzero(), ast_var_name(), ast_var_value(), ast_variables_destroy(), ast_bridge::callid, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, min, ast_cli_args::n, name, ast_variable::name, ast_variable::next, NULL, ast_cli_args::pos, S_COR, S_OR, type, ast_bridge::uniqueid, ast_cli_entry::usage, ast_variable::value, var, and ast_cli_args::word.
|
static |
Definition at line 938 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_lastreloadtime, ast_startuptime, ast_tvnow(), ast_tvsub(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, NULL, print_uptimestr(), and ast_cli_entry::usage.
|
static |
Definition at line 1195 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_channel_get_by_name(), ast_channel_iterator_all_new(), ast_channel_iterator_destroy(), ast_channel_iterator_next(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_cli(), ast_cli_complete(), ast_complete_channels(), ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, c, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 630 of file main/cli.c.
References ast_cli_args::argv, ast_module_helper(), AST_MODULE_HELPER_RUNNING, ast_strdup, ast_strlen_zero, CLI_GENERATE, CLI_INIT, ast_cli_entry::command, complete_number(), handle_debug_or_trace(), ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, S_OR, TRACE_HANDLER, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 808 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_cli(), AST_FORCE_FIRM, AST_FORCE_HARD, AST_FORCE_SOFT, ast_module_helper(), AST_MODULE_HELPER_UNLOAD, ast_unload_resource(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, ast_cli_args::line, ast_cli_args::n, NULL, ast_cli_args::pos, ast_cli_entry::usage, and ast_cli_args::word.
|
static |
Definition at line 683 of file main/cli.c.
References ast_cli_args::argc, ast_cli_entry::args, ast_cli_args::argv, ast_strdup, ast_strlen_zero, ast_verb_console_get(), ast_verb_console_set(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_number(), ast_cli_args::n, NULL, ast_cli_args::pos, S_OR, status_debug_verbose(), ast_cli_entry::usage, and VERBOSE_HANDLER.
|
static |
helper for final part of handle_help if locked = 1, assume the list is already locked
Definition at line 2522 of file main/cli.c.
References ast_cli_entry::_full_cmd, ast_cli(), ast_join, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, cli_next(), CLI_SUCCESS, len(), NULL, S_OR, and ast_cli_entry::summary.
Referenced by handle_help().
|
static |
if word is a valid prefix for token, returns the pos-th match as a malloced string, or NULL otherwise. Always tell in *actual how many matches we got.
Definition at line 2266 of file main/cli.c.
References ast_strdup, ast_strdupa, ast_strlen_zero, cli_rsvd, NULL, strsep(), and t1.
Referenced by __ast_cli_generator().
|
static |
Definition at line 863 of file main/cli.c.
References ast_cli(), ast_module_support_level_to_string(), climodentryfd, MODLIST_FORMAT, and strcasestr().
Referenced by handle_modlist().
|
static |
returns true if there are more words to match
Definition at line 2816 of file main/cli.c.
Referenced by __ast_cli_generator().
|
static |
Definition at line 2598 of file main/cli.c.
References ast_log, ast_strdup, dummy(), LOG_WARNING, and NULL.
Referenced by __ast_cli_generator(), and ast_cli_command_full().
|
static |
Definition at line 876 of file main/cli.c.
References ast_cli(), ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_strlen(), DAY, ESS, HOUR, MINUTE, NEEDCOMMA, out, WEEK, and YEAR.
Referenced by ast_cli_print_timestr_fromseconds(), handle_showcalls(), and handle_showuptime().
|
static |
Definition at line 2390 of file main/cli.c.
References ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_REMOVE_ELEM_UNORDERED, and shutdown_commands_lock.
Referenced by ast_cli_unregister().
|
static |
initialize the _full_cmd string and related parameters, return 0 on success, -1 on error.
Definition at line 2046 of file main/cli.c.
References ast_cli_entry::_full_cmd, ast_cli_entry::args, ast_join, ast_log, ast_strdup, buf, cli_rsvd, ast_cli_entry::cmda, ast_cli_entry::cmdlen, and LOG_WARNING.
Referenced by __ast_cli_register().
|
static |
Definition at line 407 of file main/cli.c.
References ast_cli(), DEBUG_HANDLER, ast_cli_args::fd, TRACE_HANDLER, and VERBOSE_HANDLER.
Referenced by handle_debug_or_trace(), and handle_verbose().
|
static |
match a word in the CLI entry. returns -1 on mismatch, 0 on match of an optional word, 1 on match of a full word.
The pattern can be any_word match for equal [foo|bar|baz] optionally, one of these words {foo|bar|baz} exactly, one of these words % any word
Definition at line 2227 of file main/cli.c.
References ast_strlen_zero, cli_rsvd, and strcasestr().
Referenced by __ast_cli_generator(), and find_cli().
|
static |
Definition at line 110 of file main/cli.c.
Referenced by AST_VECTOR().
|
static |
Definition at line 1984 of file main/cli.c.
|
static |
Default permissions value 1=Permit 0=Deny.
Definition at line 87 of file main/cli.c.
Referenced by ast_cli_perms_init(), and cli_has_permissions().
|
static |
|
static |
Some regexp characters in cli arguments are reserved and used as separators.
Definition at line 2040 of file main/cli.c.
Referenced by is_prefix(), set_full_cmd(), and word_match().
|
static |
Definition at line 861 of file main/cli.c.
Referenced by handle_modlist(), and modlist_modentry().
|
static |
Definition at line 860 of file main/cli.c.
Referenced by handle_modlist().
|
static |
lists of module names and their debug/trace levels
Definition at line 107 of file main/cli.c.
Referenced by handle_debug_or_trace().
|
static |
|
static |
CLI permissions config file.
Definition at line 85 of file main/cli.c.
Referenced by ast_cli_perms_init().
|
static |
mutex used to prevent a user from running the 'cli reload permissions' command while it is already running.
Definition at line 91 of file main/cli.c.
Referenced by ast_cli_perms_init().
|
static |
Definition at line 112 of file main/cli.c.
Referenced by allowed_on_shutdown(), ast_cli_allow_at_shutdown(), and remove_shutdown_command().
|
static |
Definition at line 108 of file main/cli.c.
Referenced by handle_debug_or_trace().