FreeSWITCH API Documentation
1.7.0
|
Compatability and Helper Code. More...
Go to the source code of this file.
Data Structures | |
union | ip_t |
struct | switch_http_request_s |
struct | switch_cputime |
Macros | |
#define | SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\"" |
#define | switch_goto_status(_status, _label) status = _status; goto _label |
#define | switch_goto_int(_n, _i, _label) _n = _i; goto _label |
#define | switch_samples_per_packet(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval))) |
#define | SWITCH_SMAX 32767 |
#define | SWITCH_SMIN -32768 |
#define | switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX; else if (n < SWITCH_SMIN) n = SWITCH_SMIN; |
#define | switch_codec2str(codec, buf, len) |
#define | zstr(x) _zstr(x) |
#define | switch_strlen_zero(x) zstr(x) |
#define | switch_strlen_zero_buf(x) zstr_buf(x) |
#define | zstr_buf(s) (*(s) == '\0') |
#define | zset(_a, _b) if (!zstr(_b)) _a = _b |
#define | switch_arraylen(_a) (sizeof(_a) / sizeof(_a[0])) |
#define | switch_split(_data, _delim, _array) switch_separate_string(_data, _delim, _array, switch_arraylen(_array)) |
#define | switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000) |
#define | switch_true_buf(expr) |
#define | SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR) |
#define | switch_errno() errno |
#define | is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119 || key == 70 || key == 102) |
determine if a character is a valid DTMF key More... | |
#define | end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1) |
#define | end_of_p(_s) (*_s == '\0' ? _s : _s + strlen(_s) - 1) |
#define | switch_test_flag(obj, flag) ((obj)->flags & flag) |
Test for the existance of a flag on an arbitary object. More... | |
#define | switch_set_flag(obj, flag) (obj)->flags |= (flag) |
Set a flag on an arbitrary object. More... | |
#define | switch_set_flag_locked(obj, flag) |
Set a flag on an arbitrary object while locked. More... | |
#define | switch_clear_flag_locked(obj, flag) switch_mutex_lock((obj)->flag_mutex); (obj)->flags &= ~(flag); switch_mutex_unlock((obj)->flag_mutex); |
Clear a flag on an arbitrary object. More... | |
#define | switch_clear_flag(obj, flag) (obj)->flags &= ~(flag) |
Clear a flag on an arbitrary object while locked. More... | |
#define | switch_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) |
Copy flags from one arbitrary object to another. More... | |
#define | switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst)) |
#define | switch_safe_free(it) if (it) {free(it);it=NULL;} |
Free a pointer and set it to NULL unless it already is NULL. More... | |
#define | switch_str_nil(s) (s ? s : "") |
Make a null string a blank string instead. More... | |
#define | switch_yield(ms) switch_sleep(ms); |
Wait a desired number of microseconds and yield the CPU. More... | |
#define | switch_time_from_sec(sec) ((switch_time_t)(sec) * 1000000) |
#define | SWITCH_DECLARE_GLOBAL_STRING_FUNC(fname, vname) |
Declares a function designed to set a dynamic global string. More... | |
#define | SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK || status == SWITCH_STATUS_INUSE) |
#define | switch_network_list_add_cidr(_list, _cidr_str, _ok) switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL) |
#define | switch_network_list_validate_ip(_list, _ip) switch_network_list_validate_ip_token(_list, _ip, NULL); |
#define | switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1) |
#define | switch_malloc(ptr, len) (void)(assert(((ptr) = malloc((len)))),ptr) |
#define | switch_zmalloc(ptr, len) (void)(assert((ptr = calloc(1, (len)))),ptr) |
#define | switch_strdup(ptr, s) (void)(assert(((ptr) = strdup((s)))),ptr) |
#define | DUMP_EVENT(_e) {char *event_str;switch_event_serialize(_e, &event_str, SWITCH_FALSE);switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DUMP\n%s\n", event_str);free(event_str);} |
#define | switch_inet_ntop inet_ntop |
Typedefs | |
typedef struct switch_http_request_s | switch_http_request_t |
Enumerations | |
enum | switch_uri_flags { SWITCH_URI_NUMERIC_HOST = 1, SWITCH_URI_NUMERIC_PORT = 2, SWITCH_URI_NO_SCOPE = 4 } |
flags to be used with switch_build_uri() More... | |
Functions | |
static uint32_t | switch_round_to_step (uint32_t num, uint32_t step) |
static uint32_t | switch_toupper (uint32_t eax) |
static uint32_t | switch_tolower (uint32_t eax) |
static void | switch_toupper_max (char *s) |
static void | switch_tolower_max (char *s) |
int | old_switch_toupper (int c) |
int | old_switch_tolower (int c) |
int | switch_isalnum (int c) |
int | switch_isalpha (int c) |
int | switch_iscntrl (int c) |
int | switch_isdigit (int c) |
int | switch_isgraph (int c) |
int | switch_islower (int c) |
int | switch_isprint (int c) |
int | switch_ispunct (int c) |
int | switch_isspace (int c) |
int | switch_isupper (int c) |
int | switch_isxdigit (int c) |
switch_bool_t | switch_testv6_subnet (ip_t _ip, ip_t _net, ip_t _mask) |
char * | switch_print_host (switch_sockaddr_t *addr, char *buf, switch_size_t len) |
static _Check_return_ int | _zstr (_In_opt_z_ const char *s) |
Test for NULL or zero length string. More... | |
static switch_bool_t | switch_is_moh (const char *s) |
static char * | switch_strchr_strict (const char *in, char find, const char *allowed) |
static int | switch_string_has_escaped_data (const char *in) |
switch_status_t | switch_b64_encode (unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen) |
switch_size_t | switch_b64_decode (char *in, char *out, switch_size_t olen) |
char * | switch_amp_encode (char *s, char *buf, switch_size_t len) |
static switch_bool_t | switch_is_digit_string (const char *s) |
static char | switch_itodtmf (char i) |
static int | switch_dtmftoi (char *s) |
static uint32_t | switch_known_bitrate (switch_payload_t payload) |
switch_size_t | switch_fd_read_line (int fd, char *buf, switch_size_t len) |
switch_size_t | switch_fd_read_dline (int fd, char **buf, switch_size_t *len) |
switch_size_t | switch_fp_read_dline (FILE *fd, char **buf, switch_size_t *len) |
switch_status_t | switch_frame_alloc (switch_frame_t **frame, switch_size_t size) |
switch_status_t | switch_frame_dup (switch_frame_t *orig, switch_frame_t **clone) |
switch_status_t | switch_frame_free (switch_frame_t **frame) |
switch_bool_t | switch_is_number (const char *str) |
switch_bool_t | switch_is_leading_number (const char *str) |
char * | switch_find_parameter (const char *str, const char *param, switch_memory_pool_t *pool) |
static int | switch_true (const char *expr) |
Evaluate the truthfullness of a string expression. More... | |
static switch_byte_t | switch_true_byte (const char *expr) |
static int | switch_false (const char *expr) |
Evaluate the falsefullness of a string expression. More... | |
switch_status_t | switch_resolve_host (const char *host, char *buf, size_t buflen) |
switch_status_t | switch_find_local_ip (_Out_opt_bytecapcount_(len) char *buf, _In_ int len, _In_opt_ int *mask, _In_ int family) |
find local ip of the box More... | |
switch_status_t | switch_find_interface_ip (_Out_opt_bytecapcount_(len) char *buf, _In_ int len, _In_opt_ int *mask, _In_ const char *ifname, _In_ int family) |
find primary ip of the specified interface More... | |
char * | get_addr (char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen) |
find the char representation of an ip adress More... | |
char * | get_addr6 (char *buf, switch_size_t len, struct sockaddr_in6 *sa, socklen_t salen) |
int | get_addr_int (switch_sockaddr_t *sa) |
int | switch_cmp_addr (switch_sockaddr_t *sa1, switch_sockaddr_t *sa2) |
int | switch_cp_addr (switch_sockaddr_t *sa1, switch_sockaddr_t *sa2) |
unsigned short | get_port (struct sockaddr *sa) |
get the port number of an ip address More... | |
int | switch_build_uri (char *uri, switch_size_t size, const char *scheme, const char *user, const switch_sockaddr_t *sa, int flags) |
build a URI string from components More... | |
static int | switch_errno_is_break (int errcode) |
const char * | switch_priority_name (switch_priority_t priority) |
Return a printable name of a switch_priority_t. More... | |
char | switch_rfc2833_to_char (int event) |
Return the RFC2833 character based on an event id. More... | |
unsigned char | switch_char_to_rfc2833 (char key) |
Return the RFC2833 event based on an key character. More... | |
static char * | switch_sanitize_number (char *number) |
static switch_bool_t | switch_string_var_check (char *s, switch_bool_t disable) |
static switch_bool_t | switch_string_var_check_const (const char *s) |
static char * | switch_var_clean_string (char *s) |
static char * | switch_clean_string (char *s) |
static char * | switch_clean_name_string (char *s) |
static int | switch_safe_atoi (const char *nptr, int dft) |
Turn a string into a number (default if NULL) More... | |
static char * | switch_safe_strdup (const char *it) |
static char * | switch_lc_strdup (const char *it) |
static char * | switch_uc_strdup (const char *it) |
static switch_bool_t | switch_strstr (char *s, char *q) |
Test if one string is inside another with extra case checking. More... | |
switch_time_t | switch_str_time (const char *in) |
Converts a string representation of a date into a switch_time_t. More... | |
unsigned int | switch_separate_string (_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen) |
Separate a string into an array based on a character delimiter. More... | |
unsigned int | switch_separate_string_string (char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen) |
char * | switch_strip_spaces (char *str, switch_bool_t dup) |
char * | switch_strip_whitespace (const char *str) |
char * | switch_strip_commas (char *in, char *out, switch_size_t len) |
char * | switch_strip_nonnumerics (char *in, char *out, switch_size_t len) |
char * | switch_separate_paren_args (char *str) |
const char * | switch_stristr (const char *instr, const char *str) |
switch_bool_t | switch_is_lan_addr (const char *ip) |
char * | switch_replace_char (char *str, char from, char to, switch_bool_t dup) |
switch_bool_t | switch_ast2regex (const char *pat, char *rbuf, size_t len) |
char * | switch_escape_char (switch_memory_pool_t *pool, char *in, const char *delim, char esc) |
Escape a string by prefixing a list of characters with an escape character. More... | |
char * | switch_escape_string (const char *in, char *out, switch_size_t outlen) |
char * | switch_escape_string_pool (const char *in, switch_memory_pool_t *pool) |
int | switch_socket_waitfor (switch_pollfd_t *poll, int ms) |
Wait for a socket. More... | |
const char * | switch_cut_path (const char *in) |
Create a pointer to the file name in a given file path eliminating the directory name. More... | |
char * | switch_string_replace (const char *string, const char *search, const char *replace) |
switch_status_t | switch_string_match (const char *string, size_t string_len, const char *search, size_t search_len) |
int | switch_strcasecmp_any (const char *str,...) |
char * | switch_util_quote_shell_arg (const char *string) |
Quote shell argument. More... | |
char * | switch_util_quote_shell_arg_pool (const char *string, switch_memory_pool_t *pool) |
Quote shell argument, allocating from pool if provided. More... | |
static int32_t | switch_calc_bitrate (int w, int h, int quality, double fps) |
static int32_t | switch_parse_bandwidth_string (const char *bwv) |
static int | switch_needs_url_encode (const char *s) |
char * | switch_url_encode_opt (const char *url, char *buf, size_t len, switch_bool_t double_encode) |
char * | switch_url_encode (const char *url, char *buf, size_t len) |
char * | switch_url_decode (char *s) |
switch_bool_t | switch_simple_email (const char *to, const char *from, const char *headers, const char *body, const char *file, const char *convert_cmd, const char *convert_ext) |
char * | switch_find_end_paren (const char *s, char open, char close) |
static void | switch_separate_file_params (const char *file, char **file_portion, char **params_portion) |
static switch_bool_t | switch_is_file_path (const char *file) |
static const char * | switch_parse_audio_col (switch_audio_col_t col) |
int | switch_parse_cidr (const char *string, ip_t *ip, ip_t *mask, uint32_t *bitp) |
switch_status_t | switch_network_list_create (switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool) |
switch_status_t | switch_network_list_add_cidr_token (switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token) |
char * | switch_network_ipv4_mapped_ipv6_addr (const char *ip_str) |
switch_status_t | switch_network_list_add_host_mask (switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok) |
switch_bool_t | switch_network_list_validate_ip_token (switch_network_list_t *list, uint32_t ip, const char **token) |
switch_bool_t | switch_network_list_validate_ip6_token (switch_network_list_t *list, ip_t ip, const char **token) |
int | switch_inet_pton (int af, const char *src, void *dst) |
const char * | switch_dow_int2str (int val) |
int | switch_dow_str2int (const char *exp) |
switch_bool_t | switch_dow_cmp (const char *exp, int val) |
int | switch_number_cmp (const char *exp, int val) |
int | switch_tod_cmp (const char *exp, int val) |
int | switch_fulldate_cmp (const char *exp, switch_time_t *ts) |
void | switch_split_date (const char *exp, int *year, int *month, int *day) |
void | switch_split_time (const char *exp, int *hour, int *min, int *sec) |
int | switch_split_user_domain (char *in, char **user, char **domain) |
Split a user string as user and domain. More... | |
char * | switch_uuid_str (char *buf, switch_size_t len) |
char * | switch_format_number (const char *num) |
unsigned int | switch_atoui (const char *nptr) |
unsigned long | switch_atoul (const char *nptr) |
char * | switch_strerror_r (int errnum, char *buf, switch_size_t buflen) |
int | switch_wait_sock (switch_os_socket_t sock, uint32_t ms, switch_poll_t flags) |
int | switch_wait_socklist (switch_waitlist_t *waitlist, uint32_t len, uint32_t ms) |
switch_status_t | switch_http_parse_header (char *buffer, uint32_t datalen, switch_http_request_t *request) |
void | switch_http_free_request (switch_http_request_t *request) |
void | switch_http_dump_request (switch_http_request_t *request) |
void | switch_http_parse_qs (switch_http_request_t *request, char *qs) |
switch_status_t | switch_frame_buffer_free (switch_frame_buffer_t *fb, switch_frame_t **frameP) |
switch_status_t | switch_frame_buffer_dup (switch_frame_buffer_t *fb, switch_frame_t *orig, switch_frame_t **clone) |
switch_status_t | switch_frame_buffer_destroy (switch_frame_buffer_t **fbP) |
switch_status_t | switch_frame_buffer_create (switch_frame_buffer_t **fbP) |
void | switch_getcputime (switch_cputime *t) |
Compatability and Helper Code.
Just a miscelaneaous set of general utility/helper functions.
Definition in file switch_utils.h.
#define DUMP_EVENT | ( | _e | ) | {char *event_str;switch_event_serialize(_e, &event_str, SWITCH_FALSE);switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DUMP\n%s\n", event_str);free(event_str);} |
Definition at line 1211 of file switch_utils.h.
Referenced by switch_ivr_uuid_bridge().
#define end_of | ( | _s | ) | *(*_s == '\0' ? _s : _s + strlen(_s) - 1) |
Definition at line 616 of file switch_utils.h.
Referenced by generate_m(), parse_presence_data_cols(), switch_channel_get_cap_string(), switch_channel_get_flag_string(), switch_channel_set_timestamps(), switch_core_media_gen_local_sdp(), and switch_img_write_text_img().
#define end_of_p | ( | _s | ) | (*_s == '\0' ? _s : _s + strlen(_s) - 1) |
Definition at line 617 of file switch_utils.h.
Referenced by find_pt(), switch_cache_db_execute_sql_chunked(), switch_channel_expand_variables_check(), switch_console_complete(), switch_core_media_filter_sdp(), switch_event_expand_headers_check(), switch_needs_url_encode(), and switch_url_encode_opt().
#define is_dtmf | ( | key | ) | ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119 || key == 70 || key == 102) |
determine if a character is a valid DTMF key
key | the key to test |
Definition at line 614 of file switch_utils.h.
Referenced by meta_on_dtmf(), speech_thread(), switch_channel_queue_dtmf(), switch_channel_queue_dtmf_string(), switch_core_session_send_dtmf(), switch_core_session_send_dtmf_string(), and switch_ivr_bind_dtmf_meta_session().
#define switch_arraylen | ( | _a | ) | (sizeof(_a) / sizeof(_a[0])) |
Definition at line 341 of file switch_utils.h.
Referenced by switch_dow_int2str(), and switch_dow_str2int().
#define switch_clear_flag | ( | obj, | |
flag | |||
) | (obj)->flags &= ~(flag) |
Clear a flag on an arbitrary object while locked.
obj | the object to test |
flag | the or'd list of flags to clear |
Definition at line 655 of file switch_utils.h.
Referenced by rtp_common_write(), CoreSession::setAutoHangup(), switch_core_codec_destroy(), switch_core_init_and_modload(), switch_core_media_bug_add(), switch_core_media_bug_clear_flag(), switch_core_media_bug_prune(), switch_core_media_bug_remove(), switch_core_media_bug_set_flag(), switch_core_media_receive_message(), switch_core_session_ctl(), switch_core_session_perform_destroy(), switch_core_session_read_frame(), switch_core_session_read_video_frame(), switch_core_session_reset(), switch_core_session_run(), switch_core_session_thread_launch(), switch_core_session_write_frame(), switch_core_session_write_video_frame(), switch_core_speech_close(), switch_core_speech_read_tts(), switch_core_sqldb_start(), switch_ivr_eavesdrop_session(), switch_ivr_menu_execute(), switch_jb_clear_flag(), switch_load_core_config(), SWITCH_MODULE_LOAD_FUNCTION(), and switch_speex_encode().
#define switch_clear_flag_locked | ( | obj, | |
flag | |||
) | switch_mutex_lock((obj)->flag_mutex); (obj)->flags &= ~(flag); switch_mutex_unlock((obj)->flag_mutex); |
Clear a flag on an arbitrary object.
obj | the object to test |
flag | the or'd list of flags to clear |
Definition at line 648 of file switch_utils.h.
Referenced by switch_core_file_close(), switch_core_file_read(), switch_core_perform_file_open(), switch_ivr_deactivate_unicast(), switch_ivr_play_file(), switch_ivr_process_fh(), switch_ivr_record_file(), and unicast_thread_run().
#define switch_codec2str | ( | codec, | |
buf, | |||
len | |||
) |
Definition at line 262 of file switch_utils.h.
Referenced by switch_core_session_outgoing_channel().
#define switch_copy_flags | ( | dest, | |
src, | |||
flags | |||
) | (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) |
Copy flags from one arbitrary object to another.
dest | the object to copy the flags to |
src | the object to copy the flags from |
flags | the flags to copy |
Definition at line 663 of file switch_utils.h.
#define SWITCH_DECLARE_GLOBAL_STRING_FUNC | ( | fname, | |
vname | |||
) |
Declares a function designed to set a dynamic global string.
fname | the function name to declare |
vname | the name of the global pointer to modify with the new function |
Definition at line 923 of file switch_utils.h.
#define switch_errno | ( | ) | errno |
Definition at line 578 of file switch_utils.h.
Referenced by switch_wait_sock(), and switch_wait_socklist().
#define switch_goto_int | ( | _n, | |
_i, | |||
_label | |||
) | _n = _i; goto _label |
Definition at line 257 of file switch_utils.h.
#define switch_goto_status | ( | _status, | |
_label | |||
) | status = _status; goto _label |
Definition at line 256 of file switch_utils.h.
Referenced by setup_ringback(), switch_core_execute_chat_app(), switch_core_media_proxy_remote_addr(), switch_core_media_read_frame(), switch_core_media_set_codec(), switch_core_perform_file_open(), switch_core_session_execute_application_get_flags(), switch_core_session_write_video_frame(), switch_ivr_enterprise_originate(), switch_ivr_menu_execute(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_say_ip(), switch_ivr_sleep(), switch_jb_get_packet(), switch_limit_incr(), switch_limit_interval_reset(), switch_limit_release(), switch_limit_reset(), switch_limit_status(), and switch_regex_match_partial().
#define switch_inet_ntop inet_ntop |
Definition at line 1214 of file switch_utils.h.
#define switch_is_valid_rate | ( | _tmp | ) | (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000) |
Definition at line 344 of file switch_utils.h.
Referenced by switch_ivr_record_file(), and switch_ivr_record_session().
#define switch_malloc | ( | ptr, | |
len | |||
) | (void)(assert(((ptr) = malloc((len)))),ptr) |
Definition at line 1205 of file switch_utils.h.
#define switch_network_list_add_cidr | ( | _list, | |
_cidr_str, | |||
_ok | |||
) | switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL) |
Definition at line 1158 of file switch_utils.h.
Referenced by switch_load_network_lists().
#define switch_network_list_validate_ip | ( | _list, | |
_ip | |||
) | switch_network_list_validate_ip_token(_list, _ip, NULL); |
Definition at line 1164 of file switch_utils.h.
#define switch_normalize_to_16bit | ( | n | ) | if (n > SWITCH_SMAX) n = SWITCH_SMAX; else if (n < SWITCH_SMIN) n = SWITCH_SMIN; |
Definition at line 261 of file switch_utils.h.
Referenced by early_thread_run(), read_displace_callback(), switch_change_sln_volume(), switch_change_sln_volume_granular(), switch_core_media_bug_read(), switch_merge_sln(), switch_mux_channels(), and write_displace_callback().
#define SWITCH_READ_ACCEPTABLE | ( | status | ) | (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK || status == SWITCH_STATUS_INUSE) |
Definition at line 995 of file switch_utils.h.
Referenced by audio_bridge_thread(), check_engine(), early_thread_run(), switch_core_session_read_frame(), switch_core_session_wait_for_video_input_params(), switch_ivr_collect_digits_callback(), switch_ivr_collect_digits_count(), switch_ivr_delay_echo(), switch_ivr_eavesdrop_session(), switch_ivr_gentones(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_parse_event(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_session_echo(), switch_ivr_sleep(), switch_ivr_sound_test(), switch_ivr_speak_text_handle(), switch_ivr_wait_for_answer(), switch_ivr_wait_for_silence(), and video_helper_thread().
#define switch_safe_free | ( | it | ) | if (it) {free(it);it=NULL;} |
Free a pointer and set it to NULL unless it already is NULL.
it | the pointer |
Definition at line 789 of file switch_utils.h.
Referenced by _switch_hashtable_remove(), api_hook(), check_channel_status(), comp_callback(), core_event_handler(), CoreSession::destroy(), destroy_ecd(), do_chat_send(), do_flush(), do_trans(), API::executeString(), fs_encode_cleanup(), CoreSession::getXMLCDR(), hashtable_expand(), load_mime_types(), CoreSession::originate(), parse_presence_data_cols(), play_and_collect(), preprocess(), preprocess_exec_set(), preprocess_glob(), record_callback(), Event::serialize(), CoreSession::set_tts_params(), CoreSession::set_tts_parms(), setup_ringback(), speech_thread(), sql_in_thread(), switch_api_execute(), switch_buffer_destroy(), switch_cache_db_execute_sql_real(), switch_cache_db_persistant_execute(), switch_cache_db_persistant_execute_trans_full(), switch_caller_extension_add_application_printf(), switch_channel_build_param_string(), switch_channel_expand_variables_check(), switch_channel_export_variable_var_check(), switch_channel_pass_sdp(), switch_channel_set_presence_data_vals(), switch_channel_set_timestamps(), switch_channel_uninit(), switch_check_network_list_ip_token(), switch_console_complete(), switch_console_execute(), switch_console_expand_alias(), switch_console_process(), switch_console_set_alias(), switch_console_set_complete(), switch_core_asr_load_grammar(), switch_core_destroy(), switch_core_file_close(), switch_core_gen_certs(), switch_core_hash_empty(), switch_core_media_ext_address_lookup(), switch_core_media_gen_local_sdp(), switch_core_media_process_sdp_filter(), switch_core_media_set_r_sdp_codec_string(), switch_core_recovery_flush(), switch_core_recovery_recover(), switch_core_recovery_track(), switch_core_session_ctl(), switch_core_session_exec(), switch_core_session_free_message(), switch_core_session_reporting_state(), switch_core_session_reset(), switch_core_speech_feed_tts(), switch_core_sqldb_start(), switch_event_add_body(), switch_event_add_presence_data_cols(), switch_event_base_add_header(), switch_event_build_param_string(), switch_event_expand_headers_check(), switch_event_serialize(), switch_event_set_body(), switch_event_set_subclass_name(), switch_find_local_ip(), switch_frame_free(), switch_fulldate_cmp(), switch_hashtable_destroy(), switch_http_parse_qs(), switch_img_free(), switch_img_write_text_img(), switch_ivr_broadcast(), switch_ivr_collect_digits_count(), switch_ivr_digit_stream_destroy(), switch_ivr_eavesdrop_session(), switch_ivr_insert_file(), switch_ivr_multi_threaded_bridge(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_phrase_macro_event(), switch_ivr_play_file(), switch_ivr_preprocess_session(), switch_ivr_record_file(), switch_ivr_set_json_chan_vars(), switch_ivr_sleep(), switch_ivr_speak_text_handle(), switch_ivr_wait_for_answer(), switch_json_add_presence_data_cols(), switch_loadable_module_enumerate_available(), switch_loadable_module_get_codecs(), switch_loadable_module_load_file(), switch_log_node_free(), switch_log_vprintf(), switch_nat_init(), switch_nat_multicast_runtime(), switch_nat_republish(), switch_nat_shutdown(), switch_network_list_add_cidr_token(), switch_network_list_perform_add_cidr_token(), switch_odbc_handle_destroy(), switch_odbc_handle_new(), switch_pgsql_handle_callback_exec_detailed(), switch_pgsql_handle_connect(), switch_pgsql_handle_destroy(), switch_pgsql_handle_disconnect(), switch_pgsql_handle_new(), switch_pgsql_next_result_timed(), switch_pgsql_send_query(), switch_pgsql_SQLEndTran(), switch_play_and_get_digits(), switch_regex_match_partial(), switch_regex_perform(), switch_rtp_destroy(), switch_say_file_handle_destroy(), switch_simple_email(), switch_split_date(), switch_split_time(), switch_stream_write_file_contents(), switch_strstr(), switch_tod_cmp(), switch_xml_clear_user_cache(), switch_xml_config_cleanup(), switch_xml_config_parse_event(), switch_xml_free(), switch_xml_locate_user_merged(), switch_xml_parse_file(), switch_xml_tohtml(), switch_xml_user_cache(), task_thread_loop(), tone_detect_set_total_time(), and Stream::~Stream().
#define switch_samples_per_packet | ( | rate, | |
interval | |||
) | ((uint32_t)((float)rate / (1000.0f / (float)interval))) |
Definition at line 258 of file switch_utils.h.
Referenced by switch_core_speech_open().
#define switch_set_flag | ( | obj, | |
flag | |||
) | (obj)->flags |= (flag) |
Set a flag on an arbitrary object.
obj | the object to set the flags on |
flag | the or'd list of flags to set |
Definition at line 631 of file switch_utils.h.
Referenced by CoreSession::CoreSession(), find_free_frame(), perform_write(), rtp_common_write(), CoreSession::setAutoHangup(), switch_buffer_create_dynamic(), switch_buffer_create_partition(), switch_caller_profile_new(), switch_channel_queue_dtmf(), switch_core_asr_close(), switch_core_asr_open(), switch_core_codec_init_with_bitrate(), switch_core_destroy(), switch_core_directory_open(), switch_core_init(), switch_core_media_bug_add(), switch_core_media_bug_patch_video(), switch_core_media_bug_pop(), switch_core_media_bug_remove(), switch_core_media_bug_set_flag(), switch_core_media_read_frame(), switch_core_media_receive_message(), switch_core_perform_file_open(), switch_core_session_ctl(), switch_core_session_hangup_state(), switch_core_session_queue_indication(), switch_core_session_read_frame(), switch_core_session_read_video_frame(), switch_core_session_run(), switch_core_session_sync_clock(), switch_core_session_thread(), switch_core_session_thread_launch(), switch_core_session_thread_pool_launch(), switch_core_session_write_frame(), switch_core_session_write_video_frame(), switch_core_speech_open(), switch_core_speech_read_tts(), switch_core_timer_init(), switch_frame_alloc(), switch_frame_dup(), switch_ivr_activate_unicast(), switch_ivr_detect_speech(), switch_ivr_detect_speech_init(), switch_ivr_eavesdrop_session(), switch_ivr_menu_execute(), switch_ivr_menu_init(), switch_ivr_menu_stack_xml_build(), switch_ivr_originate(), switch_ivr_record_session(), switch_ivr_sleep(), switch_jb_set_flag(), switch_load_core_config(), switch_media_handle_create(), switch_rtp_enable_vad(), switch_rtp_zerocopy_read_frame(), switch_speex_encode(), switch_xml_set_root(), and video_bug_thread().
#define switch_set_flag_locked | ( | obj, | |
flag | |||
) |
Set a flag on an arbitrary object while locked.
obj | the object to set the flags on |
flag | the or'd list of flags to set |
Definition at line 638 of file switch_utils.h.
Referenced by switch_core_file_read(), switch_core_file_seek(), switch_core_perform_file_open(), switch_ivr_activate_unicast(), switch_ivr_play_file(), switch_ivr_process_fh(), unicast_thread_launch(), and video_write_thread().
#define switch_set_string | ( | _dst, | |
_src | |||
) | switch_copy_string(_dst, _src, sizeof(_dst)) |
Definition at line 665 of file switch_utils.h.
Referenced by _switch_cache_db_get_db_handle_dsn(), add_handle(), check_ice(), check_ip(), get_handle(), switch_config_open_file(), switch_core_asr_open(), switch_core_session_request_uuid(), switch_core_session_set_uuid(), switch_core_speech_open(), switch_ivr_dmachine_check_match(), switch_ivr_dmachine_ping(), switch_load_network_lists(), switch_log_vprintf(), and switch_nat_multicast_runtime().
#define SWITCH_SMAX 32767 |
Definition at line 259 of file switch_utils.h.
Referenced by switch_core_media_bug_read().
#define SWITCH_SMIN -32768 |
Definition at line 260 of file switch_utils.h.
Referenced by switch_core_media_bug_read().
#define switch_split | ( | _data, | |
_delim, | |||
_array | |||
) | switch_separate_string(_data, _delim, _array, switch_arraylen(_array)) |
Definition at line 342 of file switch_utils.h.
Referenced by check_ice(), main(), parse_presence_data_cols(), switch_channel_handle_cause(), switch_channel_set_presence_data_vals(), switch_core_media_process_sdp_filter(), switch_core_session_parse_crypto_prefs(), switch_core_session_reporting_state(), switch_event_add_presence_data_cols(), switch_img_write_text_img(), switch_json_add_presence_data_cols(), and switch_xml_locate_user_merged().
#define SWITCH_STATUS_IS_BREAK | ( | x | ) | (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR) |
Definition at line 564 of file switch_utils.h.
Referenced by rtp_common_read(), switch_ivr_menu_execute(), and switch_nat_multicast_runtime().
#define switch_str_nil | ( | s | ) | (s ? s : "") |
Make a null string a blank string instead.
s | the string to test |
Definition at line 903 of file switch_utils.h.
Referenced by api_hook(), EventConsumer::bind(), console_clean_log(), console_log(), console_log2(), CoreSession::consoleLog(), CoreSession::consoleLog2(), core_event_handler(), do_api_on(), is_valid_action(), switch_channel_flip_cid(), switch_channel_set_timestamps(), switch_console_complete(), switch_console_set_complete(), switch_core_add_registration(), switch_core_media_activate_rtp(), switch_core_recovery_track(), switch_core_session_exec(), switch_core_session_execute_application_get_flags(), switch_core_session_execute_exten(), switch_event_create_array_pair(), switch_ivr_displace_session(), switch_ivr_generate_json_cdr(), switch_ivr_originate(), switch_ivr_parse_event(), switch_ivr_phrase_macro_event(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_record_session(), switch_loadable_module_process(), switch_loadable_module_unprocess(), switch_network_list_perform_add_cidr_token(), switch_odbc_handle_callback_exec_detailed(), switch_odbc_handle_exec(), switch_pgsql_handle_callback_exec_detailed(), switch_pgsql_handle_exec_base_detailed(), switch_scheduler_add_task(), switch_scheduler_execute(), switch_stun_host_lookup(), and task_thread_loop().
#define switch_strdup | ( | ptr, | |
s | |||
) | (void)(assert(((ptr) = strdup((s)))),ptr) |
Definition at line 1207 of file switch_utils.h.
Referenced by switch_cache_db_execute_sql_real(), and switch_pgsql_handle_get_error().
#define switch_strlen_zero | ( | x | ) | zstr(x) |
Definition at line 283 of file switch_utils.h.
Referenced by main().
#define switch_strlen_zero_buf | ( | x | ) | zstr_buf(x) |
Definition at line 284 of file switch_utils.h.
#define switch_test_flag | ( | obj, | |
flag | |||
) | ((obj)->flags & flag) |
Test for the existance of a flag on an arbitary object.
obj | the object to test |
flag | the or'd list of flags to test |
Definition at line 624 of file switch_utils.h.
Referenced by audio_bridge_thread(), CoreSession::destroy(), early_thread_run(), eavesdrop_callback(), find_free_frame(), get_handle(), main(), perform_write(), recording_thread(), rtp_common_write(), setup_ringback(), speech_thread(), sql_close(), switch_buffer_destroy(), switch_buffer_freespace(), switch_buffer_reset_partition_data(), switch_buffer_set_partition_data(), switch_buffer_slide_write(), switch_buffer_write(), switch_buffer_zwrite(), switch_cache_db_create_schema(), switch_cache_db_test_reactive(), switch_caller_get_field_by_name(), switch_caller_profile_event_set_data(), switch_channel_clear_state_handler(), switch_channel_dequeue_dtmf(), switch_core_add_registration(), switch_core_asr_close(), switch_core_codec_decode(), switch_core_codec_decode_video(), switch_core_codec_destroy(), switch_core_codec_encode(), switch_core_codec_encode_video(), switch_core_db_test_reactive(), switch_core_del_registration(), switch_core_destroy(), switch_core_directory_close(), switch_core_execute_chat_app(), switch_core_expire_registration(), switch_core_file_close(), switch_core_file_command(), switch_core_file_get_string(), switch_core_file_has_video(), switch_core_file_read(), switch_core_file_read_video(), switch_core_file_seek(), switch_core_file_set_string(), switch_core_file_truncate(), switch_core_file_write(), switch_core_file_write_video(), switch_core_init(), switch_core_init_and_modload(), switch_core_media_bug_add(), switch_core_media_bug_close(), switch_core_media_bug_count(), switch_core_media_bug_exec_all(), switch_core_media_bug_inuse(), switch_core_media_bug_patch_video(), switch_core_media_bug_read(), switch_core_media_bug_remove(), switch_core_media_bug_remove_all_function(), switch_core_media_bug_test_flag(), switch_core_media_read_frame(), switch_core_media_receive_message(), switch_core_media_write_frame(), switch_core_perform_file_open(), switch_core_port_allocator_free_port(), switch_core_port_allocator_new(), switch_core_port_allocator_request_port(), switch_core_ready(), switch_core_ready_inbound(), switch_core_ready_outbound(), switch_core_session_ctl(), switch_core_session_execute_application_get_flags(), switch_core_session_free_message(), switch_core_session_hangup_state(), switch_core_session_media_handle_ready(), switch_core_session_perform_destroy(), switch_core_session_perform_force_locate(), switch_core_session_read_frame(), switch_core_session_read_lock(), switch_core_session_read_lock_hangup(), switch_core_session_read_video_frame(), switch_core_session_recv_dtmf(), switch_core_session_running(), switch_core_session_send_dtmf(), switch_core_session_started(), switch_core_session_thread_launch(), switch_core_session_thread_pool_launch(), switch_core_session_write_frame(), switch_core_session_write_video_frame(), switch_core_speech_close(), switch_core_speech_read_tts(), switch_core_sql_db_thread(), switch_core_sql_exec(), switch_core_sqldb_start(), switch_core_test_flag(), switch_core_timer_destroy(), switch_event_base_add_header(), switch_event_check_permission_list(), switch_frame_dup(), switch_frame_free(), switch_ivr_activate_unicast(), switch_ivr_deactivate_unicast(), switch_ivr_delay_echo(), switch_ivr_eavesdrop_session(), switch_ivr_insert_file(), switch_ivr_menu_execute(), switch_ivr_menu_stack_free(), switch_ivr_park(), switch_ivr_parse_event(), switch_ivr_play_file(), switch_ivr_process_fh(), switch_ivr_record_file(), switch_ivr_sound_test(), switch_ivr_speak_text_handle(), switch_ivr_wait_for_answer(), switch_jb_put_packet(), switch_loadable_module_load_file(), SWITCH_MODULE_LOAD_FUNCTION(), switch_rtp_enable_vad(), switch_rtp_write_frame(), switch_rtp_zerocopy_read_frame(), switch_scheduler_del_task_group(), switch_scheduler_del_task_id(), switch_speex_encode(), switch_system(), switch_user_sql_thread(), switch_xml_config_item_print_doc(), switch_xml_config_parse_event(), switch_xml_free(), task_thread_loop(), unicast_thread_run(), video_bug_thread(), video_helper_thread(), and video_write_thread().
#define switch_test_subnet | ( | _ip, | |
_net, | |||
_mask | |||
) | (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1) |
Definition at line 1166 of file switch_utils.h.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_validate_ip_token().
#define switch_time_from_sec | ( | sec | ) | ((switch_time_t)(sec) * 1000000) |
Definition at line 916 of file switch_utils.h.
#define switch_true_buf | ( | expr | ) |
Definition at line 467 of file switch_utils.h.
#define SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\"" |
Definition at line 47 of file switch_utils.h.
Referenced by switch_needs_url_encode(), and switch_url_encode_opt().
#define switch_yield | ( | ms | ) | switch_sleep(ms); |
Wait a desired number of microseconds and yield the CPU.
Definition at line 908 of file switch_utils.h.
Referenced by _switch_cache_db_get_db_handle(), audio_bridge_thread(), media_thread_run(), originate_on_consume_media_transmit(), pool_thread(), record_callback(), recording_thread(), rtp_common_read(), signal_bridge_on_hibernate(), switch_cache_db_persistant_execute(), switch_cache_db_persistant_execute_trans_full(), switch_channel_clear_device_record(), switch_core_db_exec(), switch_core_db_persistant_execute(), switch_core_db_persistant_execute_trans(), switch_core_media_end_video_function(), switch_core_media_ext_address_lookup(), switch_core_media_set_codec(), switch_core_media_toggle_hold(), switch_core_media_write_frame(), switch_core_runtime_loop(), switch_core_session_ctl(), switch_core_session_read_frame(), switch_core_session_run(), switch_core_session_send_dtmf(), switch_core_session_thread(), switch_core_sql_db_thread(), switch_core_standard_on_reset(), switch_event_launch_dispatch_threads(), switch_event_shutdown(), switch_ivr_3p_media(), switch_ivr_3p_nomedia(), switch_ivr_deactivate_unicast(), switch_ivr_eavesdrop_session(), switch_ivr_enterprise_originate(), switch_ivr_media(), switch_ivr_nomedia(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_play_file(), switch_ivr_sleep(), switch_ivr_speak_text_handle(), switch_ivr_wait_for_answer(), switch_loadable_module_shutdown(), switch_loadable_module_unload_module(), switch_nat_multicast_runtime(), switch_nat_thread_stop(), switch_scheduler_task_thread_stop(), switch_socket_send(), switch_sql_queue_manager_push(), switch_sql_queue_manager_push_confirm(), switch_sql_queue_manager_stop(), switch_thread_rwlock_trywrlock_timeout(), switch_user_sql_thread(), uuid_bridge_on_soft_execute(), video_helper_thread(), and wait_for_cause().
#define switch_zmalloc | ( | ptr, | |
len | |||
) | (void)(assert((ptr = calloc(1, (len)))),ptr) |
Definition at line 1206 of file switch_utils.h.
Referenced by generate_on_dtmf(), switch_channel_queue_dtmf(), switch_console_push_match(), switch_core_inthash_insert(), switch_core_media_gen_local_sdp(), switch_event_bind_removable(), switch_event_channel_broadcast(), switch_event_channel_sub_channel(), switch_event_reserve_subclass_detailed(), switch_frame_alloc(), switch_hashtable_first_iter(), switch_ivr_collect_digits_count(), switch_ivr_digit_stream_new(), switch_ivr_insert_file(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_play_file(), switch_ivr_schedule_broadcast(), switch_ivr_schedule_hangup(), switch_ivr_schedule_transfer(), switch_ivr_sleep(), switch_ivr_wait_for_answer(), switch_ivr_wait_for_silence(), switch_live_array_add(), switch_mux_channels(), switch_resample_perform_create(), and switch_scheduler_add_task().
Definition at line 295 of file switch_utils.h.
#define zstr | ( | x | ) | _zstr(x) |
Definition at line 281 of file switch_utils.h.
Referenced by __switch_xml_open_root(), _switch_core_db_handle(), add_audio_codec(), api_hook(), audio_bridge_thread(), EventConsumer::bind(), Event::chat_send(), check_channel_status(), check_dtls_reinvite(), check_ice(), check_ip(), check_jb(), collect_thread_run(), comp_callback(), core_event_handler(), Event::delHeader(), do_trans(), enterprise_originate_ringback_thread(), Event::Event(), EventConsumer::EventConsumer(), API::execute(), CoreSession::execute(), API::executeString(), fs_core_init(), gen_ice(), generate_m(), get_channels(), Event::getHeader(), globalSetVariable(), handle_ice(), inherit_codec(), ip_choose_family(), ip_possible(), is_valid_action(), IVRMenu::IVRMenu(), limit_state_handler(), load_configuration(), main(), parse_array(), parse_presence_data_cols(), play_and_collect(), play_and_detect_input_callback(), preprocess_exec_set(), record_callback(), send_display(), send_record_stop_event(), setup_ringback(), signal_bridge_on_hangup(), switch_cache_db_persistant_execute_trans_full(), switch_caller_profile_event_set_data(), switch_caller_profile_new(), switch_channel_add_variable_var_check(), switch_channel_build_param_string(), switch_channel_del_variable_prefix(), switch_channel_expand_variables_check(), switch_channel_get_hold_music(), switch_channel_get_name(), switch_channel_get_variable_dup(), switch_channel_get_variable_partner(), switch_channel_invert_cid(), switch_channel_pass_callee_id(), switch_channel_process_export(), switch_channel_queue_dtmf_string(), switch_channel_set_name(), switch_channel_set_presence_data_vals(), switch_channel_set_profile_var(), switch_channel_set_timestamps(), switch_channel_set_variable_partner_var_check(), switch_channel_set_variable_printf(), switch_channel_set_variable_var_check(), switch_channel_str2cause(), switch_channel_transfer_variable_prefix(), switch_color_set_rgb(), switch_console_complete(), switch_console_list_uuid(), switch_console_set_complete(), switch_core_add_registration(), switch_core_asr_load_grammar(), switch_core_codec_parse_fmtp(), switch_core_del_registration(), switch_core_get_switchname(), switch_core_media_activate_rtp(), switch_core_media_add_payload_map(), switch_core_media_bug_add(), switch_core_media_bug_remove_all_function(), switch_core_media_choose_port(), switch_core_media_choose_ports(), switch_core_media_deactivate_rtp(), switch_core_media_ext_address_lookup(), switch_core_media_find_zrtp_hash(), switch_core_media_gen_local_sdp(), switch_core_media_get_codec_string(), switch_core_media_negotiate_sdp(), switch_core_media_patch_sdp(), switch_core_media_process_sdp_filter(), switch_core_media_proxy_remote_addr(), switch_core_media_receive_message(), switch_core_media_recover_session(), switch_core_media_set_r_sdp_codec_string(), switch_core_perform_file_open(), switch_core_perform_permanent_strdup(), switch_core_perform_session_strdup(), switch_core_perform_strdup(), switch_core_recovery_flush(), switch_core_recovery_recover(), switch_core_session_check_incoming_crypto(), switch_core_session_ctl(), switch_core_session_exec(), switch_core_session_execute_exten(), switch_core_session_get_payload_code(), switch_core_session_outgoing_channel(), switch_core_session_parse_crypto_prefs(), switch_core_session_perform_receive_message(), switch_core_session_reporting_state(), switch_core_session_send_dtmf(), switch_core_session_send_dtmf_string(), switch_core_set_var_conditional(), switch_core_speech_feed_tts(), switch_core_speech_open(), switch_core_sqldb_start_thread(), switch_core_standard_on_routing(), switch_event_base_add_header(), switch_event_build_param_string(), switch_event_create_array_pair(), switch_event_del_header_val(), switch_event_expand_headers_check(), switch_event_xmlize(), switch_file_exists(), switch_format_number(), switch_img_txt_handle_create(), switch_img_txt_handle_render(), switch_img_write_text_img(), switch_is_file_path(), switch_is_lan_addr(), switch_is_moh(), switch_ivr_bind_dtmf_meta_session(), switch_ivr_blind_transfer_ack(), switch_ivr_check_presence_mapping(), switch_ivr_collect_digits_count(), switch_ivr_displace_session(), switch_ivr_dmachine_bind(), switch_ivr_dmachine_check_match(), switch_ivr_dmachine_clear_realm(), switch_ivr_dmachine_feed(), switch_ivr_dmachine_ping(), switch_ivr_eavesdrop_session(), switch_ivr_enterprise_originate(), switch_ivr_generate_json_cdr(), switch_ivr_generate_xml_cdr(), switch_ivr_intercept_session(), switch_ivr_kill_uuid(), switch_ivr_menu_execute(), switch_ivr_menu_init(), switch_ivr_menu_stack_xml_build(), switch_ivr_menu_str2action(), switch_ivr_originate(), switch_ivr_parse_event(), switch_ivr_phrase_macro_event(), switch_ivr_play_file(), switch_ivr_process_fh(), switch_ivr_read(), switch_ivr_say(), switch_ivr_session_transfer(), switch_ivr_set_json_chan_vars(), switch_ivr_set_user(), switch_ivr_set_user_xml(), switch_ivr_set_xml_chan_var(), switch_ivr_soft_hold(), switch_ivr_tone_detect_session(), switch_ivr_wait_for_answer(), switch_load_core_config(), switch_load_network_lists(), switch_load_timezones(), switch_loadable_module_exists(), switch_loadable_module_init(), switch_log_node_dup(), switch_log_vprintf(), switch_lookup_timezone(), switch_media_bug_parse_spy_fmt(), switch_media_handle_create(), switch_network_list_perform_add_cidr_token(), switch_odbc_handle_callback_exec_detailed(), switch_odbc_handle_exec(), switch_pgsql_finish_results_real(), switch_pgsql_handle_callback_exec_detailed(), switch_pgsql_handle_exec_base_detailed(), switch_play_and_get_digits(), switch_rtp_add_dtls(), switch_rtp_create(), switch_rtp_get_remote_host(), switch_rtp_new(), switch_rtp_set_local_address(), switch_say_file_handle_create(), switch_scheduler_del_task_group(), switch_simple_email(), switch_speex_fmtp_parse(), switch_strftime_tz(), switch_strip_spaces(), switch_strip_whitespace(), switch_time_exp_tz_name(), switch_url_decode(), switch_xml_config_parse_event(), switch_xml_locate(), switch_xml_locate_user_merged(), switch_xml_merge_user(), switch_xml_std_datetime_check(), and transfer_after_bridge().
#define zstr_buf | ( | s | ) | (*(s) == '\0') |
Definition at line 285 of file switch_utils.h.
Referenced by get_upnp_pubaddr(), and switch_strftime_tz().
typedef struct switch_http_request_s switch_http_request_t |
enum switch_uri_flags |
flags to be used with switch_build_uri()
Enumerator | |
---|---|
SWITCH_URI_NUMERIC_HOST | |
SWITCH_URI_NUMERIC_PORT | |
SWITCH_URI_NO_SCOPE |
Definition at line 546 of file switch_utils.h.
|
inlinestatic |
Test for NULL or zero length string.
s | the string to test |
Definition at line 274 of file switch_utils.h.
char* get_addr | ( | char * | buf, |
switch_size_t | len, | ||
struct sockaddr * | sa, | ||
socklen_t | salen | ||
) |
find the char representation of an ip adress
buf | the buffer to write the ip adress found into |
len | the length of the buf |
sa | the struct sockaddr * to get the adress from |
salen | the length of sa |
Definition at line 2273 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_find_local_ip(), switch_get_addr(), and switch_resolve_host().
char* get_addr6 | ( | char * | buf, |
switch_size_t | len, | ||
struct sockaddr_in6 * | sa, | ||
socklen_t | salen | ||
) |
Definition at line 2257 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_get_addr().
int get_addr_int | ( | switch_sockaddr_t * | sa | ) |
Definition at line 2150 of file switch_utils.c.
unsigned short get_port | ( | struct sockaddr * | sa | ) |
get the port number of an ip address
sa | the struct sockaddr * to get the port from |
Definition at line 2284 of file switch_utils.c.
int old_switch_tolower | ( | int | c | ) |
Definition at line 3509 of file switch_utils.c.
int old_switch_toupper | ( | int | c | ) |
Definition at line 3462 of file switch_utils.c.
char* switch_amp_encode | ( | char * | s, |
char * | buf, | ||
switch_size_t | len | ||
) |
switch_bool_t switch_ast2regex | ( | const char * | pat, |
char * | rbuf, | ||
size_t | len | ||
) |
Definition at line 1250 of file switch_utils.c.
References memset(), SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_regex_perform().
unsigned int switch_atoui | ( | const char * | nptr | ) |
Definition at line 3925 of file switch_utils.c.
Referenced by switch_ivr_process_fh().
unsigned long switch_atoul | ( | const char * | nptr | ) |
Definition at line 3932 of file switch_utils.c.
Referenced by switch_load_core_config().
switch_size_t switch_b64_decode | ( | char * | in, |
char * | out, | ||
switch_size_t | olen | ||
) |
Definition at line 929 of file switch_utils.c.
References switch_b64_table.
Referenced by switch_core_media_add_crypto().
switch_status_t switch_b64_encode | ( | unsigned char * | in, |
switch_size_t | ilen, | ||
unsigned char * | out, | ||
switch_size_t | olen | ||
) |
Definition at line 890 of file switch_utils.c.
References switch_b64_table, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_build_crypto(), and switch_rtp_add_crypto_key().
int switch_build_uri | ( | char * | uri, |
switch_size_t | size, | ||
const char * | scheme, | ||
const char * | user, | ||
const switch_sockaddr_t * | sa, | ||
int | flags | ||
) |
build a URI string from components
uri | output string |
size | maximum size of output string (including trailing null) |
scheme | URI scheme |
user | user part or null if none |
sa | host address |
flags | logical OR-ed combination of flags from switch_uri_flags |
Definition at line 2300 of file switch_utils.c.
References switch_snprintf(), SWITCH_URI_NO_SCOPE, SWITCH_URI_NUMERIC_HOST, and SWITCH_URI_NUMERIC_PORT.
|
inlinestatic |
Definition at line 998 of file switch_utils.h.
unsigned char switch_char_to_rfc2833 | ( | char | key | ) |
Return the RFC2833 event based on an key character.
key | the charecter to encode |
Definition at line 2335 of file switch_utils.c.
References switch_toupper().
Referenced by do_2833().
|
inlinestatic |
Definition at line 755 of file switch_utils.h.
|
inlinestatic |
Definition at line 741 of file switch_utils.h.
int switch_cmp_addr | ( | switch_sockaddr_t * | sa1, |
switch_sockaddr_t * | sa2 | ||
) |
int switch_cp_addr | ( | switch_sockaddr_t * | sa1, |
switch_sockaddr_t * | sa2 | ||
) |
Definition at line 2206 of file switch_utils.c.
Referenced by read_rtp_packet(), and switch_rtp_set_remote_address().
const char* switch_cut_path | ( | const char * | in | ) |
Create a pointer to the file name in a given file path eliminating the directory name.
Definition at line 2658 of file switch_utils.c.
References in.
Referenced by switch_console_printf(), switch_event_prep_for_delivery_detailed(), switch_loadable_module_load_module_ex(), switch_log_vprintf(), and switch_simple_email().
switch_bool_t switch_dow_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 3732 of file switch_utils.c.
References _dow_read_token(), cur, DOW_COMA, DOW_EOF, DOW_ERR, DOW_HYPHEN, SWITCH_CHANNEL_LOG, SWITCH_FALSE, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_TRUE.
Referenced by switch_xml_std_datetime_check().
const char* switch_dow_int2str | ( | int | val | ) |
Definition at line 3674 of file switch_utils.c.
References switch_arraylen.
Referenced by switch_xml_std_datetime_check().
int switch_dow_str2int | ( | const char * | exp | ) |
Definition at line 3681 of file switch_utils.c.
References switch_arraylen.
Referenced by _dow_read_token().
|
inlinestatic |
Definition at line 402 of file switch_utils.h.
References switch_assert.
Referenced by meta_on_dtmf(), and switch_ivr_bind_dtmf_meta_session().
|
inlinestatic |
Definition at line 580 of file switch_utils.h.
Referenced by switch_wait_sock(), and switch_wait_socklist().
char* switch_escape_char | ( | switch_memory_pool_t * | pool, |
char * | in, | ||
const char * | delim, | ||
char | esc | ||
) |
Escape a string by prefixing a list of characters with an escape character.
pool | a memory pool to use |
in | the string |
delim | the list of characters to escape |
esc | the escape character |
Definition at line 2350 of file switch_utils.c.
References in, and switch_core_alloc.
char* switch_escape_string | ( | const char * | in, |
char * | out, | ||
switch_size_t | outlen | ||
) |
char* switch_escape_string_pool | ( | const char * | in, |
switch_memory_pool_t * | pool | ||
) |
Definition at line 2459 of file switch_utils.c.
References buf, switch_core_alloc, and switch_escape_string().
|
inlinestatic |
Evaluate the falsefullness of a string expression.
expr | a string expression |
Definition at line 482 of file switch_utils.h.
References SWITCH_FALSE, switch_is_number(), and SWITCH_TRUE.
Referenced by check_jb(), switch_core_media_gen_local_sdp(), switch_core_media_negotiate_sdp(), switch_core_media_receive_message(), switch_core_session_parse_crypto_prefs(), switch_ivr_originate(), and switch_xml_config_parse_event().
switch_size_t switch_fd_read_dline | ( | int | fd, |
char ** | buf, | ||
switch_size_t * | len | ||
) |
Definition at line 709 of file switch_utils.c.
References buf, cur, DLINE_BLOCK_SIZE, DLINE_MAX_SIZE, memset(), switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, and switch_log_printf().
switch_size_t switch_fd_read_line | ( | int | fd, |
char * | buf, | ||
switch_size_t | len | ||
) |
Definition at line 687 of file switch_utils.c.
char* switch_find_end_paren | ( | const char * | s, |
char | open, | ||
char | close | ||
) |
Definition at line 661 of file switch_utils.c.
Referenced by expand_vars(), switch_core_asr_load_grammar(), switch_core_media_process_sdp_filter(), switch_core_speech_feed_tts(), switch_event_create_brackets(), switch_is_file_path(), switch_ivr_displace_session(), switch_ivr_originate(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_record_session(), and switch_separate_file_params().
switch_status_t switch_find_interface_ip | ( | _Out_opt_bytecapcount_(len) char * | buf, |
_In_ int | len, | ||
_In_opt_ int * | mask, | ||
_In_ const char * | ifname, | ||
_In_ int | family | ||
) |
find primary ip of the specified interface
buf | the buffer to write the ip address found into |
len | the length of the buf |
mask | the CIDR found (AF_INET only) |
ifname | interface name to check |
family | the address family to return (AF_INET or AF_INET6) |
switch_status_t switch_find_local_ip | ( | _Out_opt_bytecapcount_(len) char * | buf, |
_In_ int | len, | ||
_In_opt_ int * | mask, | ||
_In_ int | family | ||
) |
find local ip of the box
buf | the buffer to write the ip address found into |
len | the length of the buf |
mask | the CIDR found (AF_INET only) |
family | the address family to return (AF_INET or AF_INET6) |
Referenced by check_ip(), switch_core_init(), switch_event_init(), switch_load_network_lists(), and switch_nat_init().
char* switch_find_parameter | ( | const char * | str, |
const char * | param, | ||
switch_memory_pool_t * | pool | ||
) |
Definition at line 360 of file switch_utils.c.
References switch_core_alloc, and switch_snprintf().
char* switch_format_number | ( | const char * | num | ) |
Definition at line 3888 of file switch_utils.c.
References switch_is_number(), switch_mprintf(), and zstr.
switch_size_t switch_fp_read_dline | ( | FILE * | fd, |
char ** | buf, | ||
switch_size_t * | len | ||
) |
Definition at line 757 of file switch_utils.c.
References buf, DLINE_BLOCK_SIZE, DLINE_MAX_SIZE, memset(), switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, and switch_log_printf().
Referenced by load_mime_types(), preprocess(), and switch_stream_write_file_contents().
switch_status_t switch_frame_alloc | ( | switch_frame_t ** | frame, |
switch_size_t | size | ||
) |
Definition at line 83 of file switch_utils.c.
References switch_frame::buflen, switch_frame::data, SFF_DYNAMIC, switch_assert, switch_set_flag, SWITCH_STATUS_SUCCESS, and switch_zmalloc.
switch_status_t switch_frame_buffer_create | ( | switch_frame_buffer_t ** | fbP | ) |
Definition at line 254 of file switch_utils.c.
References switch_frame_buffer_s::mutex, pool, switch_frame_buffer_s::pool, switch_core_alloc, switch_core_new_memory_pool, switch_mutex_init(), SWITCH_MUTEX_NESTED, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_buffer_destroy | ( | switch_frame_buffer_t ** | fbP | ) |
Definition at line 243 of file switch_utils.c.
References pool, switch_frame_buffer_s::pool, switch_core_destroy_memory_pool, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_buffer_dup | ( | switch_frame_buffer_t * | fb, |
switch_frame_t * | orig, | ||
switch_frame_t ** | clone | ||
) |
Definition at line 226 of file switch_utils.c.
References find_free_frame(), switch_assert, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_buffer_free | ( | switch_frame_buffer_t * | fb, |
switch_frame_t ** | frameP | ||
) |
Definition at line 193 of file switch_utils.c.
References switch_frame::extra_data, switch_frame_node_s::frame, switch_frame::img, switch_frame_node_s::inuse, switch_frame_node_s::next, switch_frame_node_s::prev, switch_assert, switch_img_free(), switch_mutex_lock(), switch_mutex_unlock(), and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_dup | ( | switch_frame_t * | orig, |
switch_frame_t ** | clone | ||
) |
Definition at line 269 of file switch_utils.c.
References switch_frame::buflen, switch_frame::codec, switch_frame::data, switch_frame::img, switch_frame::packet, switch_frame::pmap, SFF_DYNAMIC, SFF_ENCODED, switch_assert, switch_img_copy(), SWITCH_RTP_MAX_BUF_LEN, switch_set_flag, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_test_flag.
switch_status_t switch_frame_free | ( | switch_frame_t ** | frame | ) |
Definition at line 308 of file switch_utils.c.
References switch_frame::data, switch_frame::img, switch_frame::packet, SFF_DYNAMIC, switch_img_free(), switch_safe_free, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_test_flag.
int switch_fulldate_cmp | ( | const char * | exp, |
switch_time_t * | ts | ||
) |
Definition at line 3337 of file switch_utils.c.
References cur, memset(), switch_assert, switch_safe_free, switch_split_date(), and switch_split_time().
Referenced by switch_xml_std_datetime_check().
void switch_getcputime | ( | switch_cputime * | t | ) |
/ Return used CPU time in this process for user and kernel code
Definition at line 4225 of file switch_utils.c.
void switch_http_dump_request | ( | switch_http_request_t * | request | ) |
Definition at line 4195 of file switch_utils.c.
References switch_event_header::name, switch_event_header::next, switch_assert, SWITCH_SIZE_T_FMT, and switch_event_header::value.
void switch_http_free_request | ( | switch_http_request_t * | request | ) |
Definition at line 4186 of file switch_utils.c.
References switch_event_destroy().
Referenced by switch_http_parse_header().
switch_status_t switch_http_parse_header | ( | char * | buffer, |
uint32_t | datalen, | ||
switch_http_request_t * | request | ||
) |
parse http headers in a buffer return status of success or not
[in] | buffer | the buffer start from the very begining of the http request, e.g. 'GET ' |
[in] | datalen | the buffer length |
[out] | the | http request pointer or null, need destroy later if got non-NULL pointer |
Definition at line 4044 of file switch_utils.c.
References clean_uri(), switch_event_add_header_string(), SWITCH_EVENT_CHANNEL_DATA, switch_event_create, switch_http_free_request(), switch_http_parse_qs(), switch_separate_string(), SWITCH_STACK_BOTTOM, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and SWITCH_TRUE.
void switch_http_parse_qs | ( | switch_http_request_t * | request, |
char * | qs | ||
) |
parse http query string
[in] | request | the http request object |
[in] | qs | the query string buffer |
qs buffer will be modified, so be sure to dup the qs before passing into this function if you want to keep the original string untouched if qs is NULL, the it will parse request->qs, request->qs will be duplicated before parse to avoid being modified
Definition at line 3969 of file switch_utils.c.
References switch_assert, switch_event_add_header_string(), switch_safe_free, SWITCH_STACK_BOTTOM, and switch_url_decode().
Referenced by switch_http_parse_header().
int switch_inet_pton | ( | int | af, |
const char * | src, | ||
void * | dst | ||
) |
Definition at line 74 of file inet_pton.c.
References inet_pton4().
Referenced by switch_check_network_list_ip_token(), switch_find_local_ip(), switch_network_list_add_host_mask(), and switch_parse_cidr().
|
inlinestatic |
Definition at line 376 of file switch_utils.h.
References SWITCH_FALSE, and SWITCH_TRUE.
|
inlinestatic |
Definition at line 1098 of file switch_utils.h.
References SWITCH_FALSE, switch_find_end_paren(), SWITCH_TRUE, SWITCH_URL_SEPARATOR, and zstr.
Referenced by db_pick_path(), enterprise_originate_ringback_thread(), preprocess_glob(), setup_ringback(), switch_config_open_file(), switch_core_gen_certs(), switch_img_txt_handle_create(), switch_ivr_displace_session(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_record_session(), switch_ivr_wait_for_answer(), switch_loadable_module_load_module_ex(), and switch_stream_write_file_contents().
switch_bool_t switch_is_lan_addr | ( | const char * | ip | ) |
Definition at line 1217 of file switch_utils.c.
References SWITCH_FALSE, SWITCH_TRUE, and zstr.
switch_bool_t switch_is_leading_number | ( | const char * | str | ) |
Definition at line 1460 of file switch_utils.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_core_media_filter_sdp().
|
inlinestatic |
Definition at line 286 of file switch_utils.h.
References SWITCH_FALSE, SWITCH_TRUE, and zstr.
Referenced by switch_ivr_parse_event().
switch_bool_t switch_is_number | ( | const char * | str | ) |
Definition at line 1441 of file switch_utils.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by load_configuration(), switch_channel_perform_mark_answered(), switch_false(), switch_format_number(), switch_log_str2level(), switch_speex_fmtp_parse(), switch_true(), switch_xml_config_parse_event(), switch_xml_locate_user_merged(), and switch_xml_std_datetime_check().
int switch_isalnum | ( | int | c | ) |
Definition at line 3610 of file switch_utils.c.
int switch_isalpha | ( | int | c | ) |
Definition at line 3615 of file switch_utils.c.
int switch_iscntrl | ( | int | c | ) |
int switch_isdigit | ( | int | c | ) |
int switch_isgraph | ( | int | c | ) |
int switch_islower | ( | int | c | ) |
int switch_isprint | ( | int | c | ) |
int switch_ispunct | ( | int | c | ) |
int switch_isspace | ( | int | c | ) |
int switch_isupper | ( | int | c | ) |
int switch_isxdigit | ( | int | c | ) |
Definition at line 3660 of file switch_utils.c.
|
inlinestatic |
Definition at line 389 of file switch_utils.h.
Referenced by switch_ivr_bind_dtmf_meta_session().
|
inlinestatic |
Definition at line 418 of file switch_utils.h.
Referenced by add_audio_codec(), and switch_core_media_negotiate_sdp().
|
inlinestatic |
|
inlinestatic |
char* switch_network_ipv4_mapped_ipv6_addr | ( | const char * | ip_str | ) |
Definition at line 494 of file switch_utils.c.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_perform_add_cidr_token().
switch_status_t switch_network_list_add_cidr_token | ( | switch_network_list_t * | list, |
const char * | cidr_str, | ||
switch_bool_t | ok, | ||
const char * | token | ||
) |
Definition at line 552 of file switch_utils.c.
References switch_assert, switch_network_list_perform_add_cidr_token(), switch_safe_free, switch_separate_string(), and SWITCH_STATUS_SUCCESS.
Referenced by switch_load_network_lists().
switch_status_t switch_network_list_add_host_mask | ( | switch_network_list_t * | list, |
const char * | host, | ||
const char * | mask_str, | ||
switch_bool_t | ok | ||
) |
Definition at line 579 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, switch_network_node::str, switch_core_alloc, switch_core_sprintf(), switch_inet_pton(), SWITCH_STATUS_SUCCESS, and ip_t::v4.
Referenced by switch_load_network_lists().
switch_status_t switch_network_list_create | ( | switch_network_list_t ** | list, |
const char * | name, | ||
switch_bool_t | default_type, | ||
switch_memory_pool_t * | pool | ||
) |
Definition at line 404 of file switch_utils.c.
References switch_network_list::default_type, switch_network_list::name, pool, switch_network_list::pool, switch_core_alloc, switch_core_new_memory_pool, switch_core_strdup, and SWITCH_STATUS_SUCCESS.
Referenced by switch_load_network_lists().
switch_bool_t switch_network_list_validate_ip6_token | ( | switch_network_list_t * | list, |
ip_t | ip, | ||
const char ** | token | ||
) |
Definition at line 441 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, SWITCH_FALSE, switch_testv6_subnet(), SWITCH_TRUE, and switch_network_node::token.
Referenced by switch_check_network_list_ip_token().
switch_bool_t switch_network_list_validate_ip_token | ( | switch_network_list_t * | list, |
uint32_t | ip, | ||
const char ** | token | ||
) |
Definition at line 468 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, SWITCH_FALSE, switch_test_subnet, SWITCH_TRUE, switch_network_node::token, and ip_t::v4.
Referenced by switch_check_network_list_ip_token().
int switch_number_cmp | ( | const char * | exp, |
int | val | ||
) |
|
inlinestatic |
Definition at line 1124 of file switch_utils.h.
References SWITCH_AUDIO_COL_STR_ARTIST, SWITCH_AUDIO_COL_STR_COMMENT, SWITCH_AUDIO_COL_STR_COPYRIGHT, SWITCH_AUDIO_COL_STR_DATE, SWITCH_AUDIO_COL_STR_SOFTWARE, and SWITCH_AUDIO_COL_STR_TITLE.
|
inlinestatic |
Definition at line 1014 of file switch_utils.h.
Referenced by switch_core_media_gen_local_sdp(), and switch_core_session_parse_codec_settings().
Definition at line 607 of file switch_utils.c.
References switch_copy_string(), switch_inet_pton(), ip_t::v4, and ip_t::v6.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_perform_add_cidr_token().
char* switch_print_host | ( | switch_sockaddr_t * | addr, |
char * | buf, | ||
switch_size_t | len | ||
) |
Definition at line 72 of file switch_utils.c.
References buf, switch_get_addr(), and switch_sockaddr_get_port().
const char* switch_priority_name | ( | switch_priority_t | priority | ) |
Return a printable name of a switch_priority_t.
priority | the priority to get the name of |
Definition at line 1956 of file switch_utils.c.
References SWITCH_PRIORITY_HIGH, SWITCH_PRIORITY_LOW, and SWITCH_PRIORITY_NORMAL.
Referenced by switch_event_set_priority().
char* switch_replace_char | ( | char * | str, |
char | from, | ||
char | to, | ||
switch_bool_t | dup | ||
) |
switch_status_t switch_resolve_host | ( | const char * | host, |
char * | buf, | ||
size_t | buflen | ||
) |
Definition at line 1647 of file switch_utils.c.
References get_addr(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
char switch_rfc2833_to_char | ( | int | event | ) |
Return the RFC2833 character based on an event id.
event | the event id to convert |
Definition at line 2327 of file switch_utils.c.
Referenced by handle_rfc2833().
|
inlinestatic |
Definition at line 50 of file switch_utils.h.
Referenced by switch_core_media_get_video_fps().
|
inlinestatic |
Turn a string into a number (default if NULL)
nptr | the string |
dft | the default |
Definition at line 779 of file switch_utils.h.
Referenced by switch_core_media_process_udptl().
|
inlinestatic |
Definition at line 791 of file switch_utils.h.
|
inlinestatic |
Definition at line 668 of file switch_utils.h.
References switch_assert.
Referenced by switch_ivr_originate().
|
inlinestatic |
Definition at line 1070 of file switch_utils.h.
References switch_find_end_paren().
char* switch_separate_paren_args | ( | char * | str | ) |
unsigned int switch_separate_string | ( | _In_ char * | buf, |
char | delim, | ||
_Post_count_(return) char ** | array, | ||
unsigned int | arraylen | ||
) |
Separate a string into an array based on a character delimiter.
buf | the string to parse |
delim | the character delimiter |
array | the array to split the values into |
arraylen | the max number of elements in the array |
Referenced by check_channel_status(), comp_callback(), limit_state_handler(), main(), switch_channel_caller_extension_masquerade(), switch_channel_handle_cause(), switch_channel_process_export(), switch_channel_queue_dtmf_string(), switch_check_network_list_ip_token(), switch_console_complete(), switch_console_set_alias(), switch_console_set_complete(), switch_core_asr_load_grammar(), switch_core_media_prepare_codecs(), switch_core_media_recover_session(), switch_core_media_set_r_sdp_codec_string(), switch_core_mime_add_type(), switch_core_session_execute_exten(), switch_core_session_perform_receive_message(), switch_core_session_send_dtmf_string(), switch_core_speech_feed_tts(), switch_core_standard_on_routing(), switch_event_create_brackets(), switch_ivr_eavesdrop_session(), switch_ivr_originate(), switch_ivr_play_file(), switch_ivr_preprocess_session(), switch_log_str2mask(), switch_play_and_get_digits(), switch_process_import(), switch_speex_fmtp_parse(), and transfer_after_bridge().
unsigned int switch_separate_string_string | ( | char * | buf, |
char * | delim, | ||
_Post_count_(return) char ** | array, | ||
unsigned int | arraylen | ||
) |
Referenced by switch_console_execute(), switch_event_add_array(), and switch_ivr_enterprise_originate().
switch_bool_t switch_simple_email | ( | const char * | to, |
const char * | from, | ||
const char * | headers, | ||
const char * | body, | ||
const char * | file, | ||
const char * | convert_cmd, | ||
const char * | convert_ext | ||
) |
Definition at line 981 of file switch_utils.c.
References B64BUFFLEN, buf, filename, in, switch_runtime::mailer_app, switch_runtime::mailer_app_args, O_BINARY, runtime, switch_b64_table, SWITCH_CHANNEL_LOG, switch_core_mime_ext2type(), switch_cut_path(), switch_epoch_time_now(), SWITCH_FALSE, SWITCH_GLOBAL_dirs, SWITCH_LOG_DEBUG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_LOG_WARNING, switch_mprintf(), SWITCH_PATH_SEPARATOR, switch_safe_free, switch_snprintf(), switch_stristr(), switch_system(), SWITCH_TRUE, switch_util_quote_shell_arg(), switch_directories::temp_dir, write_buf(), and zstr.
Referenced by email().
int switch_socket_waitfor | ( | switch_pollfd_t * | poll, |
int | ms | ||
) |
Wait for a socket.
poll | the pollfd to wait on |
ms | the number of milliseconds to wait |
Definition at line 3193 of file switch_utils.c.
References switch_poll().
void switch_split_date | ( | const char * | exp, |
int * | year, | ||
int * | month, | ||
int * | day | ||
) |
Definition at line 3306 of file switch_utils.c.
References switch_assert, and switch_safe_free.
Referenced by switch_fulldate_cmp().
void switch_split_time | ( | const char * | exp, |
int * | hour, | ||
int * | min, | ||
int * | sec | ||
) |
Definition at line 3273 of file switch_utils.c.
References switch_assert, and switch_safe_free.
Referenced by switch_fulldate_cmp().
int switch_split_user_domain | ( | char * | in, |
char ** | user, | ||
char ** | domain | ||
) |
Split a user string as user and domain.
in | the input string |
user | the string to put the user into |
domain | the string to put the domain into |
Definition at line 3848 of file switch_utils.c.
References in.
switch_time_t switch_str_time | ( | const char * | in | ) |
Converts a string representation of a date into a switch_time_t.
in | the string |
Definition at line 1890 of file switch_utils.c.
References switch_micro_time_now(), switch_regex_copy_substring(), switch_regex_perform(), switch_regex_safe_free, switch_time_exp_get(), switch_time_exp_gmt_get(), switch_time_exp_lt(), switch_time_exp_t::tm_gmtoff, switch_time_exp_t::tm_hour, switch_time_exp_t::tm_isdst, switch_time_exp_t::tm_mday, switch_time_exp_t::tm_min, switch_time_exp_t::tm_mon, switch_time_exp_t::tm_sec, switch_time_exp_t::tm_usec, and switch_time_exp_t::tm_year.
int switch_strcasecmp_any | ( | const char * | str, |
... | |||
) |
Definition at line 339 of file switch_utils.c.
|
inlinestatic |
Definition at line 301 of file switch_utils.h.
References in, and switch_assert.
Referenced by switch_event_create_brackets(), and switch_ivr_originate().
char* switch_strerror_r | ( | int | errnum, |
char * | buf, | ||
switch_size_t | buflen | ||
) |
Portable version of strerror_r(), work around for the incompatible return type of GNU and XSI variants.
[in] | errnum | Error number |
both] | buf Buffer for error message | |
[in] | buflen | Size of message buffer |
Definition at line 3940 of file switch_utils.c.
References buf, switch_copy_string(), and switch_snprintf().
Referenced by reincarnate_protect(), and rtp_common_read().
|
inlinestatic |
Definition at line 350 of file switch_utils.h.
References switch_assert.
Referenced by switch_channel_expand_variables_check(), and switch_event_expand_headers_check().
switch_status_t switch_string_match | ( | const char * | string, |
size_t | string_len, | ||
const char * | search, | ||
size_t | search_len | ||
) |
Definition at line 2677 of file switch_utils.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_string_replace().
char* switch_string_replace | ( | const char * | string, |
const char * | search, | ||
const char * | replace | ||
) |
Definition at line 2694 of file switch_utils.c.
References switch_assert, SWITCH_STATUS_SUCCESS, and switch_string_match().
Referenced by switch_channel_set_timestamps(), switch_core_set_globals(), and switch_core_sqldb_start().
|
inlinestatic |
Definition at line 691 of file switch_utils.h.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_core_set_var_conditional(), switch_core_set_variable(), and switch_var_clean_string().
|
inlinestatic |
Definition at line 716 of file switch_utils.h.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_channel_add_variable_var_check(), switch_channel_expand_variables_check(), switch_channel_set_variable_var_check(), and switch_event_expand_headers_check().
char* switch_strip_commas | ( | char * | in, |
char * | out, | ||
switch_size_t | len | ||
) |
char* switch_strip_nonnumerics | ( | char * | in, |
char * | out, | ||
switch_size_t | len | ||
) |
char* switch_strip_spaces | ( | char * | str, |
switch_bool_t | dup | ||
) |
Definition at line 1333 of file switch_utils.c.
References switch_assert, SWITCH_BLANK_STRING, and zstr.
char* switch_strip_whitespace | ( | const char * | str | ) |
Definition at line 1301 of file switch_utils.c.
References switch_assert, SWITCH_BLANK_STRING, and zstr.
Referenced by switch_api_execute().
const char* switch_stristr | ( | const char * | instr, |
const char * | str | ||
) |
Definition at line 1479 of file switch_utils.c.
References switch_toupper().
Referenced by audio_bridge_thread(), check_ice(), core_event_handler(), do_chat_send(), find_pt(), inherit_codec(), init_upnp(), main(), preprocess(), speech_thread(), switch_cache_db_execute_sql_real(), switch_core_gen_certs(), switch_core_gen_encoded_silence(), switch_core_media_check_outgoing_proxy(), switch_core_media_negotiate_sdp(), switch_core_media_parse_rtp_bugs(), switch_core_media_patch_sdp(), switch_core_media_proxy_remote_addr(), switch_core_media_toggle_hold(), switch_core_session_check_incoming_crypto(), switch_core_session_findall_matching_var(), switch_core_sqldb_start(), switch_ivr_originate(), switch_odbc_handle_exec(), switch_pgsql_finish_results_real(), switch_pgsql_handle_exec_base_detailed(), and switch_simple_email().
|
inlinestatic |
Test if one string is inside another with extra case checking.
s | the inner string |
q | the big string |
Definition at line 847 of file switch_utils.h.
References switch_assert, SWITCH_FALSE, switch_safe_free, switch_toupper(), and SWITCH_TRUE.
switch_bool_t switch_testv6_subnet | ( | ip_t | _ip, |
ip_t | _net, | ||
ip_t | _mask | ||
) |
Definition at line 428 of file switch_utils.c.
References IN6_AND_MASK, and SWITCH_TRUE.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_validate_ip6_token().
int switch_tod_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 3784 of file switch_utils.c.
References cur, switch_assert, and switch_safe_free.
Referenced by switch_xml_std_datetime_check().
|
inlinestatic |
Definition at line 81 of file switch_utils.h.
Referenced by switch_hash_default_ci(), switch_lc_strdup(), and switch_tolower_max().
|
inlinestatic |
|
inlinestatic |
Definition at line 70 of file switch_utils.h.
Referenced by switch_char_to_rfc2833(), switch_stristr(), switch_strstr(), switch_toupper_max(), and switch_uc_strdup().
|
inlinestatic |
|
inlinestatic |
Evaluate the truthfullness of a string expression.
expr | a string expression |
Definition at line 450 of file switch_utils.h.
References SWITCH_FALSE, switch_is_number(), and SWITCH_TRUE.
Referenced by audio_bridge_on_exchange_media(), audio_bridge_thread(), core_event_handler(), do_chat_send(), get_channels(), inherit_codec(), limit_state_handler(), load_configuration(), record_callback(), signal_bridge_on_hangup(), speech_thread(), switch_channel_handle_cause(), switch_channel_mark_hold(), switch_channel_perform_mark_answered(), switch_channel_perform_mark_pre_answered(), switch_channel_perform_presence(), switch_channel_queue_dtmf(), switch_core_media_activate_rtp(), switch_core_media_bug_add(), switch_core_media_build_crypto(), switch_core_media_check_autoadj(), switch_core_media_gen_local_sdp(), switch_core_media_negotiate_sdp(), switch_core_media_prepare_codecs(), switch_core_media_proxy_remote_addr(), switch_core_media_receive_message(), switch_core_media_set_r_sdp_codec_string(), switch_core_media_set_udptl_image_sdp(), switch_core_media_start_udptl(), switch_core_media_toggle_hold(), switch_core_perform_file_open(), switch_core_session_enable_heartbeat(), switch_core_session_exec(), switch_core_session_hangup_state(), switch_core_session_outgoing_channel(), switch_core_session_parse_codec_settings(), switch_core_session_parse_crypto_prefs(), switch_core_session_perform_receive_message(), switch_core_session_reporting_state(), switch_core_session_sched_heartbeat(), switch_core_session_thread(), switch_core_standard_on_hangup(), switch_event_channel_permission_verify(), switch_ivr_detect_speech(), switch_ivr_detect_speech_init(), switch_ivr_displace_session(), switch_ivr_eavesdrop_session(), switch_ivr_intercept_session(), switch_ivr_multi_threaded_bridge(), switch_ivr_originate(), switch_ivr_parse_event(), switch_ivr_phrase_macro_event(), switch_ivr_play_and_detect_speech(), switch_ivr_play_file(), switch_ivr_preprocess_session(), switch_ivr_record_file(), switch_ivr_record_session(), switch_ivr_say(), switch_ivr_say_string(), switch_ivr_session_echo(), switch_ivr_speak_text(), switch_load_core_config(), switch_load_network_lists(), switch_loadable_module_init(), switch_rtp_activate_jitter_buffer(), switch_rtp_add_crypto_key(), switch_rtp_create(), switch_rtp_enable_vad(), switch_rtp_init(), switch_speex_fmtp_parse(), switch_true_byte(), switch_xml_config_parse_event(), switch_xml_std_datetime_check(), and uuid_bridge_on_soft_execute().
|
inlinestatic |
Definition at line 462 of file switch_utils.h.
References switch_true().
|
inlinestatic |
char* switch_url_decode | ( | char * | s | ) |
Definition at line 3252 of file switch_utils.c.
References zstr.
Referenced by switch_core_session_request_xml(), and switch_http_parse_qs().
char* switch_url_encode | ( | const char * | url, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 3247 of file switch_utils.c.
References SWITCH_FALSE, and switch_url_encode_opt().
Referenced by add_xml_header(), switch_channel_build_param_string(), switch_event_build_param_string(), switch_event_serialize(), switch_ivr_set_json_chan_vars(), and switch_ivr_set_xml_chan_var().
char* switch_url_encode_opt | ( | const char * | url, |
char * | buf, | ||
size_t | len, | ||
switch_bool_t | double_encode | ||
) |
Definition at line 3202 of file switch_utils.c.
References buf, end_of_p, and SWITCH_URL_UNSAFE.
Referenced by switch_url_encode().
char* switch_util_quote_shell_arg | ( | const char * | string | ) |
Quote shell argument.
string | the string to quote (example: a ' b"' c) \return the quoted string (gives: 'a '\'' b"'\'' c' for unices, "a ' b ' c" for MS Windows), should be freed |
Definition at line 2729 of file switch_utils.c.
References switch_util_quote_shell_arg_pool().
Referenced by switch_simple_email().
char* switch_util_quote_shell_arg_pool | ( | const char * | string, |
switch_memory_pool_t * | pool | ||
) |
Quote shell argument, allocating from pool if provided.
string | the string to quote (example: a ' b"' c) |
pool | a memory pool to use |
Definition at line 2734 of file switch_utils.c.
References switch_assert, and switch_core_alloc.
Referenced by switch_util_quote_shell_arg().
char* switch_uuid_str | ( | char * | buf, |
switch_size_t | len | ||
) |
Definition at line 3873 of file switch_utils.c.
References buf, switch_snprintf(), switch_uuid_format(), SWITCH_UUID_FORMATTED_LENGTH, and switch_uuid_get().
Referenced by switch_caller_profile_dup(), switch_caller_profile_new(), and switch_core_session_exec().
|
inlinestatic |
Definition at line 735 of file switch_utils.h.
References switch_string_var_check(), and SWITCH_TRUE.
int switch_wait_sock | ( | switch_os_socket_t | sock, |
uint32_t | ms, | ||
switch_poll_t | flags | ||
) |
Definition at line 2985 of file switch_utils.c.
References switch_errno, switch_errno_is_break(), SWITCH_POLL_ERROR, SWITCH_POLL_READ, SWITCH_POLL_WRITE, and SWITCH_SOCK_INVALID.
Referenced by get_pmp_pubaddr().
int switch_wait_socklist | ( | switch_waitlist_t * | waitlist, |
uint32_t | len, | ||
uint32_t | ms | ||
) |
Definition at line 3081 of file switch_utils.c.
References switch_errno, switch_errno_is_break(), SWITCH_POLL_ERROR, SWITCH_POLL_READ, SWITCH_POLL_WRITE, and SWITCH_SOCK_INVALID.