RTS API Documentation
1.10.11
|
Simple Console. More...
#include <switch.h>
Go to the source code of this file.
Macros | |
#define | SWITCH_CMD_CHUNK_LEN 1024 |
#define | SWITCH_STANDARD_STREAM(s) |
Simple Console.
This module implements a basic console i/o and by basic I mean, um yeah, basic Right now the primary function of this portion of the program is to keep it from exiting.
Definition in file switch_console.h.
#define SWITCH_CMD_CHUNK_LEN 1024 |
Definition at line 45 of file switch_console.h.
#define SWITCH_STANDARD_STREAM | ( | s | ) |
Definition at line 46 of file switch_console.h.
Referenced by api_hook(), do_api_on(), API::execute(), API::executeString(), parse_presence_data_cols(), preprocess_exec_set(), record_helper_post_process(), Stream::Stream(), switch_channel_build_param_string(), switch_channel_expand_variables_check(), switch_channel_get_cap_string(), switch_channel_get_flag_string(), switch_channel_set_timestamps(), switch_console_complete(), switch_console_process(), switch_console_set_complete(), switch_core_init_and_modload(), switch_core_perform_file_open(), switch_event_build_param_string(), switch_event_expand_headers_check(), switch_html_strip(), switch_ivr_parse_event(), switch_ivr_record_file_event(), switch_nat_republish(), switch_nat_status(), and switch_say_file_handle_create().
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 * | last_word, | ||
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().
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, | ||
... | |||
) |
A method akin to printf that allows you to redirect output to a specific console "channel".
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().
void 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, | ||
... | |||
) |
A method akin to printf for dealing with api streams.
switch_status_t 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.