|
Asterisk - The Open Source Telephony Project GIT-master-4f2b068
|
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 <fnmatch.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 | arg_looks_like_glob(n) (strcspn(n, "?*[") < strlen(n)) |
| #define | arg_looks_like_regex(n) (*n == '/' && n[strlen(n) - 1] == '/') |
| #define | AST_CLI_INITLEN 256 |
| Initial buffer size for resulting strings in ast_cli() | |
| #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 "%-64.64s %-32.32s %-7.7s %-30.30s\n" |
| #define | FORMAT_STRING "%-25s %-20s %-20s\n" |
| #define | FORMAT_STRING2 "%-64.64s %-32.32s %-7.7s %-30.30s\n" |
| #define | HOUR (MINUTE*60) |
| #define | MAX_REGEX_ERROR_LEN 128 |
| #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 "%-80.80s %-24.24s %-24.24s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
| #define | VERBOSE_FORMAT_STRING2 "%-80.80s %-24.24s %-24.24s %-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 int | allowed_on_shutdown (struct ast_cli_entry *e) |
| void | ast_builtins_init (void) |
| initialize the _full_cmd string in * each of the builtins. | |
| void | ast_cli (int fd, const char *fmt,...) |
| int | ast_cli_allow_at_shutdown (struct ast_cli_entry *e) |
| Allow a CLI command to be executed while Asterisk is shutting down. | |
| void | ast_cli_channels_init (void) |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| struct ast_vector_string * | ast_cli_completion_vector (const char *text, const char *word) |
| Generates a vector of strings for CLI completion. | |
| char * | ast_cli_generator (const char *text, const char *word, int state) |
| Readline madness Useful for readline, that's about it. | |
| 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) | |
| int | ast_cli_unregister (struct ast_cli_entry *e) |
| Unregisters a command or an array of commands. | |
| int | ast_cli_unregister_multiple (struct ast_cli_entry *e, int len) |
| Unregister multiple commands. | |
| char * | ast_complete_channels (const char *line, const char *word, int pos, int state, int rpos) |
| Command completion for the list of active channels. | |
| unsigned int | ast_debug_get_by_module (const char *module) |
| Get the debug level for a module. | |
| AST_THREADSTORAGE_CUSTOM_SCOPE (ast_cli_buf, NULL, ast_free_ptr, static) | |
| AST_THREADSTORAGE_RAW (completion_storage) | |
| unsigned int | ast_trace_get_by_module (const char *module) |
| Get the trace level for a module. | |
| static int | channel_hangup_matches (struct ast_cli_args *a, int(*matchfn)(const char *, const void *), const void *data) |
| static int | channel_match_by_glob (const char *channel_name, const void *pattern) |
| static int | channel_match_by_regex (const char *channel_name, const void *data) |
| static int | channel_set_debug (void *obj, void *arg, void *data, int flags) |
| static void | cli_channels_shutdown (void) |
| 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. | |
| 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. | |
| 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' | |
| 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' | |
| static char * | handle_cli_show_permissions (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
| handles CLI command 'cli show permissions' | |
| 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_refresh (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 | |
| 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. | |
| 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 | |
| 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_cli_entry | cli_channels_cli [] | |
| static struct ast_cli_entry | cli_cli [] | |
| static int | cli_default_perm = 1 | |
| Default permissions value 1=Permit 0=Deny. | ||
| static struct cli_perms | cli_perms = AST_RWLIST_HEAD_INIT_VALUE | |
| static const char | cli_rsvd [] = "[]{}|*%" | |
| static int | climodentryfd = -1 | |
| static ast_mutex_t | climodentrylock = AST_MUTEX_INIT_VALUE | |
| static struct module_level_list | debug_modules = AST_RWLIST_HEAD_INIT_VALUE | |
| static struct helpers | helpers = AST_RWLIST_HEAD_INIT_VALUE | |
| static const char | perms_config [] = "cli_permissions.conf" | |
| CLI permissions config file. | ||
| static ast_mutex_t | permsconfiglock = AST_MUTEX_INIT_VALUE | |
| mutex used to prevent a user from running the 'cli reload permissions' command while it is already running. | ||
| struct { | ||
| size_t current | ||
| struct ast_cli_entry ** elems | ||
| size_t max | ||
| } | shutdown_commands | |
| static ast_rwlock_t | shutdown_commands_lock = AST_RWLOCK_INIT_VALUE | |
| static struct module_level_list | trace_modules = AST_RWLIST_HEAD_INIT_VALUE | |
Standard Command Line Interface.
Definition in file main/cli.c.
| #define arg_looks_like_glob | ( | n | ) | (strcspn(n, "?*[") < strlen(n)) |
Definition at line 1285 of file main/cli.c.
| #define arg_looks_like_regex | ( | n | ) | (*n == '/' && n[strlen(n) - 1] == '/') |
Definition at line 1282 of file main/cli.c.
| #define AST_CLI_INITLEN 256 |
Initial buffer size for resulting strings in ast_cli()
Definition at line 117 of file main/cli.c.
| #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 |
Definition at line 406 of file main/cli.c.
| #define FORMAT_STRING "%-64.64s %-32.32s %-7.7s %-30.30s\n" |
| #define FORMAT_STRING "%-25s %-20s %-20s\n" |
| #define FORMAT_STRING2 "%-64.64s %-32.32s %-7.7s %-30.30s\n" |
| #define HOUR (MINUTE*60) |
| #define MAX_REGEX_ERROR_LEN 128 |
Definition at line 119 of file main/cli.c.
| #define MINUTE (SECOND*60) |
| #define MODLIST_FORMAT "%-30s %-40.40s %-10d %-11s %13s\n" |
Definition at line 897 of file main/cli.c.
| #define MODLIST_FORMAT2 "%-30s %-40.40s %-10s %-11s %13s\n" |
Definition at line 898 of file main/cli.c.
| #define SECOND (1) |
| #define TRACE_HANDLER 1 |
Definition at line 407 of file main/cli.c.
| #define VERBOSE_FORMAT_STRING "%-80.80s %-24.24s %-24.24s %4d %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
| #define VERBOSE_FORMAT_STRING2 "%-80.80s %-24.24s %-24.24s %-4.4s %-7.7s %-12.12s %-25.25s %-15.15s %8.8s %-11.11s %-11.11s %-20.20s\n" |
| #define VERBOSE_HANDLER 2 |
Definition at line 408 of file main/cli.c.
| #define WEEK (DAY*7) |
| #define YEAR (DAY*365) |
|
static |
Definition at line 2948 of file main/cli.c.
References a, 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(), lock, more_words(), NULL, parse_args(), text, and word_match().
Referenced by ast_cli_generator(), and handle_help().
| int __ast_cli_register | ( | struct ast_cli_entry * | e, |
| struct ast_module * | module | ||
| ) |
Definition at line 2539 of file main/cli.c.
References ast_cli_entry::_full_cmd, a, 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(), LOG_WARNING, 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 2616 of file main/cli.c.
References __ast_cli_register(), and len().
|
static |
Definition at line 3041 of file main/cli.c.
References ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, shutdown_commands, 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 2322 of file main/cli.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), AST_VECTOR_INIT, cli_cli, cli_shutdown(), and shutdown_commands.
Referenced by asterisk_daemon().
| void ast_cli | ( | int | fd, |
| const char * | fmt, | ||
| ... | |||
| ) |
Definition at line 121 of file main/cli.c.
References ast_carefulwrite(), AST_CLI_INITLEN, AST_DYNSTR_BUILD_FAILED, ast_str_buffer(), ast_str_set_va(), ast_str_strlen(), ast_str_thread_get(), and buf.
Referenced by ast_cli_command_full(), channel_hangup_matches(), channel_set_debug(), group_show_channels(), handle_chanlist(), handle_cli_check_permissions(), handle_cli_malloc_trim(), handle_cli_show_permissions(), handle_cli_wait_fullybooted(), handle_commandmatchesarray(), handle_core_set_debug_channel(), handle_debug_or_trace(), handle_help(), handle_load(), handle_modlist(), handle_refresh(), handle_reload(), handle_showcalls(), handle_showchan(), handle_softhangup(), handle_unload(), help1(), modlist_modentry(), print_uptimestr(), and status_debug_verbose().
| int ast_cli_allow_at_shutdown | ( | struct ast_cli_entry * | e | ) |
Allow a CLI command to be executed while Asterisk is shutting down.
CLI commands by defeault are disabled when Asterisk is shutting down. This is to ensure the safety of the shutdown since CLI commands may attempt to access resources that have been freed as a result of the shutdown.
If a CLI command should be allowed at shutdown, then the best way to enable this is to call ast_cli_allow_at_shutdown during the CLI_INIT state of the CLI handler.
Definition at line 3145 of file main/cli.c.
References ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_APPEND, shutdown_commands, and shutdown_commands_lock.
Referenced by handle_abort_shutdown(), handle_restart_gracefully(), handle_restart_now(), handle_restart_when_convenient(), handle_stop_gracefully(), handle_stop_now(), and handle_stop_when_convenient().
| void ast_cli_channels_init | ( | void | ) |
Provided by cli.c
Definition at line 2329 of file main/cli.c.
References ARRAY_LEN, ast_cli_register_multiple, ast_register_cleanup(), cli_channels_cli, and cli_channels_shutdown().
Referenced by asterisk_daemon().
| 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 3058 of file main/cli.c.
References a, 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, NULL, parse_args(), RESULT_FAILURE, RESULT_SUCCESS, S_OR, 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 |
Definition at line 3123 of file main/cli.c.
References ast_cli_command_full(), and ast_cli_args::fd.
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 1931 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(), handle_bridge_kick_channel(), handle_cli_core_show_translation(), handle_cli_devstate_change(), handle_cli_iax2_prune_realtime(), handle_cli_presencestate_change(), handle_core_set_debug_channel(), handle_orig(), handle_refresh(), handle_showcalls(), handle_softhangup(), pjsip_set_logger(), and sorcery_memory_cache_stale().
| 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 2845 of file main/cli.c.
References ast_threadstorage_get_ptr(), cli_completion_vector_add(), and value.
Referenced by aeap_tab_complete_name(), ari_set_debug(), ast_cli_complete(), ast_complete_applications(), ast_complete_channels(), category_complete(), cli_complete_endpoint(), cli_complete_show(), cli_complete_uri(), complete_app(), 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_session(), complete_show_sorcery_object(), complete_sorcery_object(), complete_trans_path_choice(), config_object_tab_complete_name(), handle_cli_config_reload(), 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(), topic_complete_name(), and tps_taskprocessor_tab_complete().
| 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.
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 2789 of file main/cli.c.
References ast_cli_completion_vector(), ast_free, AST_VECTOR_APPEND, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_PTR_FREE, AST_VECTOR_STEAL_ELEMENTS, NULL, and text.
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 2850 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, NULL, and text.
Referenced by ast_cli_completion_matches(), AST_TEST_DEFINE(), and cli_complete().
| char * ast_cli_generator | ( | const char * | text, |
| const char * | word, | ||
| int | state | ||
| ) |
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 3036 of file main/cli.c.
References __ast_cli_generator(), and text.
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 2189 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, LOG_NOTICE, LOG_WARNING, ast_variable::name, ast_variable::next, NULL, cli_perm::permit, usergroup_cli_perm::perms, perms_config, permsconfiglock, reload(), 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)
| fd | fd to print by ast_cli |
| seconds | The time (in seconds) to print |
| prefix | A Prefix string to add before of duration formatted |
Definition at line 3140 of file main/cli.c.
References ast_tv(), ast_cli_args::fd, prefix, and print_uptimestr().
Referenced by handle_cdr_pgsql_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 2516 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, ast_cli_entry::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(), unload_module(), unload_module(), unload_module(), 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 2627 of file main/cli.c.
References ast_cli_unregister(), and len().
| 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 1950 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 ast_channel_snapshot::state.
Referenced by cli_complete_notify(), handle_cli_agi_add_cmd(), handle_cli_mixmonitor(), handle_core_set_debug_channel(), handle_dump_frames(), 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 139 of file main/cli.c.
References AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, debug_modules, module_level::entry, module_level::level, and module_level::module.
| AST_THREADSTORAGE_CUSTOM_SCOPE | ( | ast_cli_buf | , |
| NULL | , | ||
| ast_free_ptr | , | ||
| static | |||
| ) |
| AST_THREADSTORAGE_RAW | ( | completion_storage | ) |
|
static |
Definition at line 1253 of file main/cli.c.
References a, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_channel_cache_all(), ast_channel_get_by_name(), ast_channel_unref, ast_cli(), ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_channel_snapshot::base, c, ast_channel::data, ast_channel_snapshot_base::name, and ast_channel::snapshot.
Referenced by handle_softhangup().
|
static |
Definition at line 1238 of file main/cli.c.
References ast_free, ast_str_to_lower(), and ast_strdup.
Referenced by handle_softhangup().
|
static |
|
static |
Definition at line 1595 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(), and DEBUGCHAN_FLAG.
Referenced by handle_core_set_debug_channel().
|
static |
Definition at line 2316 of file main/cli.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), and cli_channels_cli.
Referenced by ast_cli_channels_init().
|
static |
Definition at line 2824 of file main/cli.c.
References ast_free, ast_threadstorage_set_ptr(), AST_VECTOR_ADD_SORTED, AST_VECTOR_CALLBACK_VOID, AST_VECTOR_FREE, NULL, and value.
Referenced by ast_cli_completion_add(), and ast_cli_completion_vector().
|
static |
Definition at line 186 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 2497 of file main/cli.c.
References cli_next(), and NULL.
Referenced by __ast_cli_register().
|
static |
Definition at line 969 of file main/cli.c.
References AST_LIST_FIRST, AST_LIST_NEXT, and ast_cli_entry::list.
Referenced by __ast_cli_generator(), cli_is_registered(), find_cli(), handle_cli_check_permissions(), and help1().
|
static |
Definition at line 2311 of file main/cli.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), and cli_cli.
Referenced by ast_builtins_init().
|
static |
Definition at line 366 of file main/cli.c.
References ast_strdup, ast_strlen_zero(), max, min, module_level::next, and NULL.
Referenced by handle_debug(), handle_trace(), and handle_verbose().
|
static |
cleanup (free) cli_perms linkedlist.
Definition at line 2173 of file main/cli.c.
References ast_free, AST_LIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cli_perm::command, usergroup_cli_perm::list, and usergroup_cli_perm::perms.
Referenced by ast_cli_perms_init().
|
static |
Definition at line 2479 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 2435 of file main/cli.c.
References ast_strlen_zero(), cli_next(), ast_cli_entry::cmda, 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 354 of file main/cli.c.
References AST_LIST_TRAVERSE, module_level::entry, module_level::module, and NULL.
Referenced by handle_debug_or_trace().
|
static |
Definition at line 1985 of file main/cli.c.
References a, 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, FORMAT_STRING, ast_group_info::group, ast_group_info::group_list, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1107 of file main/cli.c.
References a, 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_entry::args, 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, 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 1459 of file main/cli.c.
References ast_cli_entry::_full_cmd, a, 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, ast_cli_entry::command, NULL, S_OR, ast_cli_entry::summary, and ast_cli_entry::usage.
|
static |
Definition at line 2076 of file main/cli.c.
References a, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
handles CLI command 'cli reload permissions'
Definition at line 1440 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 1395 of file main/cli.c.
References a, ast_cli(), AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, cli_perm::command, usergroup_cli_perm::gid, NULL, cli_perm::permit, usergroup_cli_perm::perms, usergroup_cli_perm::uid, and ast_cli_entry::usage.
|
static |
Definition at line 2039 of file main/cli.c.
References a, ast_cli(), ast_fully_booted, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1536 of file main/cli.c.
References a, 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, len(), NULL, and ast_cli_entry::usage.
|
static |
Definition at line 322 of file main/cli.c.
References a, 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 1619 of file main/cli.c.
References a, ast_cli_entry::args, args, 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_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, DEBUGCHAN_FLAG, channel_set_debug_args::fd, global_fin, global_fout, NULL, OBJ_MULTIPLE, OBJ_NODATA, and ast_cli_entry::usage.
|
static |
Definition at line 575 of file main/cli.c.
References a, 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(), NULL, S_OR, and ast_cli_entry::usage.
|
static |
Definition at line 1682 of file main/cli.c.
References a, ast_cli_entry::args, 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, NULL, S_OR, and ast_cli_entry::usage.
|
static |
Definition at line 452 of file main/cli.c.
References a, ast_cli_entry::args, ast_calloc, ast_clear_flag64, 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_flag64, ast_strdupa, CLI_FAILURE, CLI_SHOWUSAGE, CLI_SUCCESS, DEBUG_HANDLER, debug_modules, find_module_level(), handler(), module_level::level, module_level::module, option_debug, option_trace, status_debug_verbose(), and trace_modules.
Referenced by handle_debug(), and handle_trace().
|
static |
Definition at line 2671 of file main/cli.c.
References __ast_cli_generator(), a, ast_cli_entry::args, ast_cli(), ast_join, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, find_cli(), help1(), NULL, and ast_cli_entry::usage.
|
static |
Definition at line 243 of file main/cli.c.
References a, ast_cli_entry::args, 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, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 786 of file main/cli.c.
References a, ast_console_toggle_mute(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1011 of file main/cli.c.
References a, ast_cli_entry::args, 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, MODLIST_FORMAT2, modlist_modentry(), NULL, and ast_cli_entry::usage.
|
static |
Definition at line 811 of file main/cli.c.
References a, ast_cli_entry::args, ast_cli(), ast_cli_complete(), AST_FORCE_SOFT, ast_module_helper(), AST_MODULE_HELPER_UNLOAD, ast_refresh_resource(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 271 of file main/cli.c.
References a, ast_cli_entry::args, 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, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 1051 of file main/cli.c.
References a, ast_cli_entry::args, 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, NULL, print_uptimestr(), RESULT_SUCCESS, and ast_cli_entry::usage.
|
static |
< Buffer for CDR variables.
< Accumulation buffer for all output.
Definition at line 1723 of file main/cli.c.
References a, ao2_cleanup, ast_asprintf, 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_tenantid(), 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_strlen_zero(), 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, min, name, ast_variable::name, ast_variable::next, NULL, RAII_VAR, S_COR, S_OR, type, ast_bridge::uniqueid, ast_cli_entry::usage, ast_variable::value, and var.
|
static |
Definition at line 978 of file main/cli.c.
References a, ast_cli_entry::args, ast_lastreloadtime, ast_startuptime, ast_tvnow(), ast_tvsub(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, NULL, print_uptimestr(), and ast_cli_entry::usage.
|
static |
Definition at line 1288 of file main/cli.c.
References a, arg_looks_like_glob, arg_looks_like_regex, ast_cli_entry::args, ast_channel_get_by_name(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_cli(), ast_cli_complete(), ast_complete_channels(), ast_free, ast_softhangup(), AST_SOFTHANGUP_EXPLICIT, ast_str_to_lower(), ast_strdup, c, channel_hangup_matches(), channel_match_by_glob(), channel_match_by_regex(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, MAX_REGEX_ERROR_LEN, NULL, ast_cli_entry::usage, and ast_channel::x.
|
static |
Definition at line 633 of file main/cli.c.
References a, 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(), NULL, S_OR, TRACE_HANDLER, and ast_cli_entry::usage.
|
static |
Definition at line 848 of file main/cli.c.
References a, ast_cli_entry::args, 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, NULL, and ast_cli_entry::usage.
|
static |
Definition at line 686 of file main/cli.c.
References a, ast_cli_entry::args, 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(), NULL, 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 2641 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(), match(), 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 2385 of file main/cli.c.
References ast_strdup, ast_strdupa, ast_strlen_zero(), cli_rsvd, NULL, and strsep().
Referenced by __ast_cli_generator().
|
static |
Definition at line 903 of file main/cli.c.
References ast_cli(), ast_module_support_level_to_string(), climodentryfd, MODLIST_FORMAT, status, strcasestr(), and usecnt.
Referenced by handle_modlist().
|
static |
returns true if there are more words to match
Definition at line 2935 of file main/cli.c.
Referenced by __ast_cli_generator().
|
static |
Definition at line 2717 of file main/cli.c.
References ast_log, ast_strdup, dummy(), LOG_WARNING, max, and NULL.
Referenced by __ast_cli_generator(), and ast_cli_command_full().
|
static |
Definition at line 916 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, prefix, WEEK, and YEAR.
Referenced by ast_cli_print_timestr_fromseconds(), handle_showcalls(), and handle_showuptime().
|
static |
Definition at line 2509 of file main/cli.c.
References ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_ELEM_CLEANUP_NOOP, AST_VECTOR_REMOVE_ELEM_UNORDERED, shutdown_commands, 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 2154 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 410 of file main/cli.c.
References a, ast_cli(), DEBUG_HANDLER, handler(), 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 2346 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 2136 of file main/cli.c.
Referenced by ast_cli_channels_init(), and cli_channels_shutdown().
|
static |
Definition at line 2104 of file main/cli.c.
Referenced by ast_builtins_init(), and cli_shutdown().
|
static |
Default permissions value 1=Permit 0=Deny.
Definition at line 88 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 2148 of file main/cli.c.
Referenced by is_prefix(), set_full_cmd(), and word_match().
|
static |
Definition at line 901 of file main/cli.c.
Referenced by handle_modlist(), and modlist_modentry().
|
static |
Definition at line 900 of file main/cli.c.
Referenced by handle_modlist().
| size_t current |
Definition at line 114 of file main/cli.c.
|
static |
lists of module names and their debug/trace levels
Definition at line 108 of file main/cli.c.
Referenced by ast_debug_get_by_module(), and handle_debug_or_trace().
| struct ast_cli_entry* * elems |
Definition at line 114 of file main/cli.c.
|
static |
| size_t max |
Definition at line 114 of file main/cli.c.
Referenced by complete_number(), and parse_args().
|
static |
CLI permissions config file.
Definition at line 86 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 92 of file main/cli.c.
Referenced by ast_cli_perms_init().
| struct { ... } shutdown_commands |
Referenced by allowed_on_shutdown(), ast_builtins_init(), ast_cli_allow_at_shutdown(), and remove_shutdown_command().
|
static |
Definition at line 113 of file main/cli.c.
Referenced by allowed_on_shutdown(), ast_cli_allow_at_shutdown(), and remove_shutdown_command().
|
static |
Definition at line 109 of file main/cli.c.
Referenced by ast_trace_get_by_module(), and handle_debug_or_trace().