RTS API Documentation
1.10.11
|
Go to the source code of this file.
Data Structures | |
struct | helper |
struct | match_helper |
Macros | |
#define | CMD_BUFLEN 1024 |
#define | CC_NORM 0 |
#define | CC_NEWLINE 1 |
#define | CC_EOF 2 |
#define | CC_ARGHACK 3 |
#define | CC_REFRESH 4 |
#define | CC_CURSOR 5 |
#define | CC_ERROR 6 |
#define | CC_FATAL 7 |
#define | CC_REDISPLAY 8 |
#define | CC_REFRESH_BEEP 9 |
Variables | |
static char * | console_fnkeys [12] |
static int32_t | running = 1 |
struct { | |
switch_hash_t * func_hash | |
switch_mutex_t * func_mutex | |
} | globals |
#define CC_ARGHACK 3 |
Definition at line 53 of file switch_console.c.
#define CC_CURSOR 5 |
Definition at line 55 of file switch_console.c.
#define CC_EOF 2 |
Definition at line 52 of file switch_console.c.
#define CC_ERROR 6 |
Definition at line 56 of file switch_console.c.
Referenced by switch_console_complete().
#define CC_FATAL 7 |
Definition at line 57 of file switch_console.c.
#define CC_NEWLINE 1 |
Definition at line 51 of file switch_console.c.
#define CC_NORM 0 |
Definition at line 50 of file switch_console.c.
#define CC_REDISPLAY 8 |
Definition at line 58 of file switch_console.c.
Referenced by switch_console_complete().
#define CC_REFRESH 4 |
Definition at line 54 of file switch_console.c.
#define CC_REFRESH_BEEP 9 |
Definition at line 59 of file switch_console.c.
#define CMD_BUFLEN 1024 |
Definition at line 38 of file switch_console.c.
Referenced by switch_console_loop(), and switch_console_save_history().
|
static |
Definition at line 231 of file switch_console.c.
Referenced by switch_console_expand_alias().
|
static |
Definition at line 468 of file switch_console.c.
References cur, switch_console_callback_match::head, helper::hits, helper::last, switch_console_callback_match_node::next, helper::out, helper::partial, helper::stream, switch_console_free_matches(), switch_console_run_complete_func(), switch_copy_string(), switch_safe_free, switch_separate_string(), SWITCH_STATUS_SUCCESS, switch_xml_add_child_d(), switch_xml_set_txt_d(), target, switch_console_callback_match_node::val, switch_stream_handle::write_function, helper::xml, helper::xml_off, and zstr.
Referenced by switch_console_complete().
|
static |
Definition at line 90 of file switch_console.c.
References console_fnkeys, switch_xml::next, SWITCH_CHANNEL_LOG, switch_core_permanent_strdup, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_STATUS_SUCCESS, SWITCH_STATUS_TERM, switch_xml_attr_soft(), switch_xml_child(), switch_xml_free(), and switch_xml_open_cfg().
Referenced by switch_console_loop(), and switch_console_save_history().
|
static |
Definition at line 586 of file switch_console.c.
References match_helper::my_matches, and switch_console_push_match().
Referenced by switch_console_list_available_modules(), and switch_console_list_loaded_modules().
switch_status_t switch_console_add_complete_func | ( | const char * | name, |
switch_console_complete_callback_t | cb | ||
) |
Definition at line 1679 of file switch_console.c.
References globals, switch_core_hash_insert, switch_mutex_lock(), and switch_mutex_unlock().
Referenced by switch_console_init().
unsigned char switch_console_complete | ( | const char * | line, |
const char * | cursor, | ||
FILE * | console_out, | ||
switch_stream_handle_t * | stream, | ||
switch_xml_t | xml | ||
) |
Definition at line 701 of file switch_console.c.
References buf, CC_ERROR, CC_REDISPLAY, comp_callback(), console_fnkeys, switch_stream_handle::data, end_of_p, helper::hits, helper::last, helper::len, helper::out, helper::partial, SCDB_TYPE_CORE_DB, helper::stream, switch_assert, switch_cache_db_execute_sql_callback(), switch_cache_db_get_type(), switch_cache_db_release_db_handle(), SWITCH_CHANNEL_LOG, SWITCH_CHANNEL_LOG_CLEAN, switch_console_process(), switch_core_db_handle, switch_core_get_hostname(), SWITCH_LOG_CONSOLE, SWITCH_LOG_ERROR, switch_log_printf(), switch_mprintf(), switch_safe_free, switch_separate_string(), SWITCH_STANDARD_STREAM, SWITCH_STATUS_SUCCESS, switch_str_nil, switch_xml_add_child_d(), switch_xml_set_attr_d_buf(), switch_xml_set_txt_d(), helper::words, switch_stream_handle::write_function, helper::xml, helper::xml_off, and zstr.
Referenced by switch_console_save_history().
switch_status_t switch_console_del_complete_func | ( | const char * | name | ) |
Definition at line 1690 of file switch_console.c.
References globals, switch_core_hash_insert, switch_mutex_lock(), and switch_mutex_unlock().
switch_status_t switch_console_execute | ( | char * | xcmd, |
int | rec, | ||
switch_stream_handle_t * | istream | ||
) |
Definition at line 345 of file switch_console.c.
References switch_api_execute(), SWITCH_CHANNEL_LOG, switch_console_expand_alias(), SWITCH_LOG_CRIT, switch_log_printf(), switch_safe_free, switch_separate_string_string(), SWITCH_STATUS_FALSE, and switch_stream_handle::write_function.
Referenced by switch_console_process(), and switch_core_init_and_modload().
char* switch_console_expand_alias | ( | char * | cmd, |
char * | arg | ||
) |
Definition at line 238 of file switch_console.c.
References alias_callback(), SCDB_TYPE_CORE_DB, SCF_USE_SQL, switch_cache_db_execute_sql_callback(), switch_cache_db_get_type(), switch_cache_db_release_db_handle(), SWITCH_CHANNEL_LOG, switch_core_db_handle, switch_core_flags(), SWITCH_LOG_ERROR, switch_log_printf(), switch_mprintf(), switch_safe_free, and SWITCH_STATUS_SUCCESS.
Referenced by switch_console_execute().
void switch_console_free_matches | ( | switch_console_callback_match_t ** | matches | ) |
Definition at line 1701 of file switch_console.c.
References cur, switch_console_callback_match::dynamic, switch_console_callback_match::head, switch_console_callback_match_node::next, and switch_console_callback_match_node::val.
Referenced by comp_callback().
switch_status_t switch_console_init | ( | switch_memory_pool_t * | pool | ) |
Definition at line 1663 of file switch_console.c.
References globals, switch_console_add_complete_func(), switch_console_list_available_modules(), switch_console_list_interfaces(), switch_console_list_loaded_modules(), switch_console_list_uuid(), switch_core_hash_init, switch_mutex_init(), SWITCH_MUTEX_NESTED, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_init().
switch_status_t switch_console_list_available_modules | ( | const char * | line, |
const char * | cursor, | ||
switch_console_callback_match_t ** | matches | ||
) |
Definition at line 594 of file switch_console.c.
References switch_directories::mod_dir, modulename_callback(), match_helper::my_matches, SWITCH_GLOBAL_dirs, switch_loadable_module_enumerate_available(), SWITCH_STATUS_FALSE, SWITCH_STATUS_GENERR, and SWITCH_STATUS_SUCCESS.
Referenced by switch_console_init().
switch_status_t switch_console_list_interfaces | ( | const char * | line, |
const char * | cursor, | ||
switch_console_callback_match_t ** | matches | ||
) |
Definition at line 650 of file switch_console.c.
References SWITCH_STATUS_FALSE.
Referenced by switch_console_init(), and switch_console_list_loaded_modules().
switch_status_t switch_console_list_loaded_modules | ( | const char * | line, |
const char * | cursor, | ||
switch_console_callback_match_t ** | matches | ||
) |
Definition at line 610 of file switch_console.c.
References modulename_callback(), match_helper::my_matches, switch_console_list_interfaces(), switch_console_push_match_unique(), SWITCH_DECLARE_NONSTD, switch_loadable_module_enumerate_loaded(), SWITCH_STATUS_FALSE, SWITCH_STATUS_GENERR, and SWITCH_STATUS_SUCCESS.
Referenced by switch_console_init().
switch_status_t switch_console_list_uuid | ( | const char * | line, |
const char * | cursor, | ||
switch_console_callback_match_t ** | matches | ||
) |
Definition at line 665 of file switch_console.c.
References match_helper::my_matches, switch_cache_db_execute_sql_callback(), switch_cache_db_release_db_handle(), SWITCH_CHANNEL_LOG, switch_core_db_handle, switch_core_get_switchname(), SWITCH_LOG_ERROR, switch_log_printf(), switch_mprintf(), SWITCH_STATUS_FALSE, SWITCH_STATUS_GENERR, SWITCH_STATUS_SUCCESS, uuid_callback(), and zstr.
Referenced by switch_console_init().
void switch_console_loop | ( | void | ) |
A simple comand loop that reads input from the terminal.
Definition at line 1555 of file switch_console.c.
References CMD_BUFLEN, console_xml_config(), key, memset(), running, SCSC_CHECK_RUNNING, SWITCH_CHANNEL_LOG_CLEAN, switch_console_process(), switch_core_get_switchname(), switch_core_session_ctl(), SWITCH_LOG_CONSOLE, and switch_log_printf().
Referenced by fs_console_loop(), switch_console_save_history(), and switch_core_runtime_loop().
void switch_console_printf | ( | switch_text_channel_t | channel, |
const char * | file, | ||
const char * | func, | ||
int | line, | ||
const char * | fmt, | ||
... | |||
) |
Definition at line 403 of file switch_console.c.
References SWITCH_CHANNEL_ID_EVENT, SWITCH_CHANNEL_ID_LOG, SWITCH_CHANNEL_ID_LOG_CLEAN, switch_core_data_channel(), switch_cut_path(), switch_event_add_header(), switch_event_add_header_string(), switch_event_create, switch_event_fire, SWITCH_EVENT_LOG, switch_event_running(), switch_micro_time_now(), SWITCH_STACK_BOTTOM, SWITCH_STATUS_SUCCESS, switch_strftime_nocheck(), switch_time_exp_lt(), and switch_vasprintf().
|
static |
Definition at line 311 of file switch_console.c.
References switch_stream_handle::data, switch_assert, switch_console_execute(), switch_core_get_console(), switch_safe_free, SWITCH_STANDARD_STREAM, and SWITCH_STATUS_SUCCESS.
Referenced by switch_console_complete(), switch_console_loop(), and switch_console_save_history().
void switch_console_push_match | ( | switch_console_callback_match_t ** | matches, |
const char * | new_val | ||
) |
Definition at line 1794 of file switch_console.c.
References switch_zmalloc, and switch_console_callback_match_node::val.
Referenced by modulename_callback(), switch_console_push_match_unique(), switch_core_session_findall(), switch_core_session_findall_matching_var(), switch_event_get_custom_events(), and uuid_callback().
void switch_console_push_match_unique | ( | switch_console_callback_match_t ** | matches, |
const char * | new_val | ||
) |
Definition at line 1780 of file switch_console.c.
References switch_console_callback_match_node::next, switch_console_push_match(), and switch_console_callback_match_node::val.
Referenced by switch_console_list_loaded_modules().
switch_status_t switch_console_run_complete_func | ( | const char * | func, |
const char * | line, | ||
const char * | last_word, | ||
switch_console_callback_match_t ** | matches | ||
) |
Definition at line 1817 of file switch_console.c.
References globals, switch_console_sort_matches(), switch_core_hash_find(), switch_mutex_lock(), switch_mutex_unlock(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by comp_callback().
void switch_console_save_history | ( | void | ) |
Definition at line 975 of file switch_console.c.
References buf, CMD_BUFLEN, console_xml_config(), count, FALSE, if(), key, helper::len, switch_directories::log_dir, memset(), pool, running, SCSC_CHECK_RUNNING, SWITCH_CHANNEL_LOG, switch_cond_next(), switch_console_complete(), switch_console_loop(), switch_console_process(), switch_core_destroy_memory_pool, switch_core_get_console(), switch_core_get_switchname(), switch_core_new_memory_pool, switch_core_session_ctl(), SWITCH_DECLARE, SWITCH_GLOBAL_dirs, SWITCH_LOG_CONSOLE, SWITCH_LOG_CRIT, SWITCH_LOG_DEBUG, switch_log_printf(), SWITCH_LOG_WARNING, switch_mprintf(), SWITCH_PATH_SEPARATOR, switch_snprintf(), SWITCH_STATUS_SUCCESS, switch_thread_create(), SWITCH_THREAD_FUNC, SWITCH_THREAD_STACKSIZE, switch_threadattr_create(), switch_threadattr_detach_set(), switch_threadattr_stacksize_set(), switch_yield, thread, TRUE, and zstr.
Referenced by switch_core_session_ctl().
switch_status_t switch_console_shutdown | ( | void | ) |
Definition at line 1674 of file switch_console.c.
References globals, and switch_core_hash_destroy().
Referenced by switch_core_destroy().
void switch_console_sort_matches | ( | switch_console_callback_match_t * | matches | ) |
Definition at line 1722 of file switch_console.c.
References switch_console_callback_match::count, switch_console_callback_match::end, switch_console_callback_match::head, if(), switch_console_callback_match_node::next, and switch_assert.
Referenced by switch_console_run_complete_func().
switch_status_t switch_console_stream_raw_write | ( | switch_stream_handle_t * | handle, |
uint8_t * | data, | ||
switch_size_t | datalen | ||
) |
Definition at line 126 of file switch_console.c.
References switch_stream_handle::alloc_chunk, switch_stream_handle::data, switch_stream_handle::data_len, switch_stream_handle::data_size, switch_stream_handle::end, SWITCH_STATUS_MEMERR, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_console_stream_write | ( | switch_stream_handle_t * | handle, |
const char * | fmt, | ||
... | |||
) |
Definition at line 150 of file switch_console.c.
References switch_stream_handle::alloc_chunk, switch_stream_handle::alloc_len, switch_stream_handle::data, switch_stream_handle::data_len, switch_stream_handle::data_size, switch_stream_handle::end, SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, switch_log_printf(), switch_snprintf(), SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_vmprintf().
switch_status_t switch_stream_write_file_contents | ( | switch_stream_handle_t * | stream, |
const char * | path | ||
) |
Definition at line 204 of file switch_console.c.
References switch_directories::conf_dir, switch_fp_read_dline(), SWITCH_GLOBAL_dirs, switch_is_file_path(), switch_mprintf(), SWITCH_PATH_SEPARATOR, switch_safe_free, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_stream_handle::write_function.
|
static |
Definition at line 656 of file switch_console.c.
References match_helper::my_matches, and switch_console_push_match().
Referenced by switch_console_list_uuid().
|
static |
Definition at line 82 of file switch_console.c.
Referenced by console_xml_config(), and switch_console_complete().
switch_hash_t* func_hash |
Definition at line 1659 of file switch_console.c.
switch_mutex_t* func_mutex |
Definition at line 1660 of file switch_console.c.
struct { ... } globals |
|
static |
Definition at line 454 of file switch_console.c.
Referenced by switch_cache_db_execute_sql2str(), switch_console_loop(), switch_console_save_history(), switch_ivr_enterprise_originate(), and switch_ivr_menu_execute().