RTS API Documentation
1.10.11
|
Compatability and Helper Code. More...
Go to the source code of this file.
Data Structures | |
struct | switch_network_port_range |
union | ip_t |
struct | switch_http_request_s |
struct | switch_cputime |
Macros | |
#define | SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\"" |
#define | MAX_NETWORK_PORTS 10 |
#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_split_cheap(_data, _delim, _array, _larray) switch_separate_string_cheap(_data, _delim, (const char **)_array, _larray, 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_calc_video_fps(fpsP, fps) switch_calc_fps(fpsP, fps, 90000) |
#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)(switch_assert(((ptr) = malloc((len)))),ptr) |
#define | switch_zmalloc(ptr, len) (void)(switch_assert((ptr = calloc(1, (len)))),ptr) |
#define | switch_strdup(ptr, s) (void)(switch_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_network_port_range | switch_network_port_range_t |
typedef switch_network_port_range_t * | switch_network_port_range_p |
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 char * | switch_get_hex_bytes (switch_byte_t *buf, switch_size_t datalen, char *new_buf, switch_size_t new_datalen) |
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 (const char *in, char *out, switch_size_t olen) |
char * | switch_amp_encode (char *s, char *buf, switch_size_t len) |
static char * | switch_print_bits (const unsigned char *byte, char *buf, switch_size_t buflen) |
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_uint_in_range (const char *str, unsigned int from, unsigned int to) |
Check if a 32 bit unsigned number is in a range. More... | |
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 switch_bool_t | 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, switch_bool_t ip_only) |
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 an integer (default if NULL) More... | |
static long int | switch_safe_atol (const char *nptr, long int dft) |
Turn a string into a long integer (default if NULL) More... | |
static long long int | switch_safe_atoll (const char *nptr, long long int dft) |
Turn a string into a long long integer (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) |
unsigned int | switch_separate_string_cheap (_In_ const char *buf, char delim, _Post_count_(return) const char **array, _Post_count_(return) unsigned int larray[], unsigned int arraylen) |
Separate a string into an array based on a character delimiter, no memory corruption! DOESN'T support removing quotes like what's in switch_separate_string()! More... | |
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_pool_strip_whitespace (switch_memory_pool_t *pool, const char *str) |
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, float quality, double fps) |
static void | switch_calc_fps (switch_fps_t *fpsP, float fps, int samplerate) |
static int32_t | switch_parse_bandwidth_string (const char *bwv) |
static uint32_t | switch_parse_cpu_string (const char *cpu) |
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) |
char * | switch_core_url_encode_opt (switch_memory_pool_t *pool, const char *url, switch_bool_t double_encode) |
char * | switch_core_url_encode (switch_memory_pool_t *pool, const char *url) |
char * | switch_core_session_url_encode_opt (switch_core_session_t *session, const char *url, switch_bool_t double_encode) |
char * | switch_core_session_url_encode (switch_core_session_t *session, const char *url) |
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 int | switch_filecmp (const char *a, const char *b) |
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_status_t | switch_network_list_add_cidr_port_token (switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token, switch_network_port_range_p port) |
switch_status_t | switch_network_list_add_host_port_mask (switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok, switch_network_port_range_p port) |
switch_bool_t | switch_network_list_validate_ip_port_token (switch_network_list_t *list, uint32_t ip, int port, const char **token) |
switch_bool_t | switch_network_list_validate_ip6_port_token (switch_network_list_t *list, ip_t ip, int port, const char **token) |
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... | |
void * | switch_calloc (size_t nmemb, size_t size) |
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, switch_size_t qlen) |
switch_status_t | switch_frame_buffer_push (switch_frame_buffer_t *fb, void *ptr) |
switch_status_t | switch_frame_buffer_trypush (switch_frame_buffer_t *fb, void *ptr) |
switch_status_t | switch_frame_buffer_pop (switch_frame_buffer_t *fb, void **ptr) |
switch_status_t | switch_frame_buffer_trypop (switch_frame_buffer_t *fb, void **ptr) |
int | switch_frame_buffer_size (switch_frame_buffer_t *fb) |
void | switch_getcputime (switch_cputime *t) |
char * | switch_html_strip (const char *str) |
unsigned long | switch_getpid (void) |
switch_status_t | switch_digest (const char *digest_name, unsigned char **digest, const void *input, switch_size_t inputLen, unsigned int *outputlen) |
switch_status_t | switch_digest_string (const char *digest_name, char **digest_str, const void *input, switch_size_t inputLen, unsigned int *outputlen) |
cJSON * | switch_jwt_verify (const char *secret, const char *token) |
char * | switch_jwt_sign (const char *secret, const uint8_t *payload, switch_size_t size) |
char * | switch_must_strdup (const char *_s) |
const char * | switch_memory_usage_stream (switch_stream_handle_t *stream) |
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 1431 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 685 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_channel_set_variable_strip_quotes_var_check(), switch_core_media_gen_local_sdp(), switch_core_perform_file_open(), and switch_img_write_text_img().
#define end_of_p | ( | _s | ) | (*_s == '\0' ? _s : _s + strlen(_s) - 1) |
Definition at line 686 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_core_perform_file_open(), switch_core_url_encode_opt(), 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 683 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 MAX_NETWORK_PORTS 10 |
Definition at line 49 of file switch_utils.h.
Referenced by is_port_in_node(), switch_load_network_lists(), and switch_network_port_range_to_string().
#define switch_arraylen | ( | _a | ) | (sizeof(_a) / sizeof(_a[0])) |
Definition at line 374 of file switch_utils.h.
Referenced by switch_dow_int2str(), and switch_dow_str2int().
#define switch_calc_video_fps | ( | fpsP, | |
fps | |||
) | switch_calc_fps(fpsP, fps, 90000) |
Definition at line 1135 of file switch_utils.h.
Referenced by video_bug_thread(), and video_write_thread().
#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 724 of file switch_utils.h.
Referenced by rtp_common_write(), CoreSession::setAutoHangup(), switch_core_codec_destroy(), switch_core_file_handle_dup(), switch_core_init_and_modload(), switch_core_media_bug_add(), switch_core_media_bug_clear_flag(), switch_core_media_bug_destroy(), 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_ivr_play_and_collect_input(), switch_jb_clear_flag(), switch_load_core_config(), SWITCH_MODULE_LOAD_FUNCTION(), switch_packetizer_read(), 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 717 of file switch_utils.h.
Referenced by switch_core_file_close(), switch_core_file_pre_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_event(), and unicast_thread_run().
#define switch_codec2str | ( | codec, | |
buf, | |||
len | |||
) |
Definition at line 293 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 732 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 1013 of file switch_utils.h.
#define switch_errno | ( | ) | errno |
Definition at line 647 of file switch_utils.h.
Referenced by switch_util_quote_shell_arg_pool(), switch_wait_sock(), and switch_wait_socklist().
#define switch_goto_int | ( | _n, | |
_i, | |||
_label | |||
) | _n = _i; goto _label |
Definition at line 288 of file switch_utils.h.
#define switch_goto_status | ( | _status, | |
_label | |||
) | status = _status; goto _label |
Definition at line 287 of file switch_utils.h.
Referenced by setup_ringback(), switch_core_execute_chat_app(), switch_core_file_handle_dup(), switch_core_media_proxy_remote_addr(), switch_core_media_read_frame(), switch_core_media_set_codec(), switch_core_media_set_video_codec(), switch_core_perform_file_open(), switch_core_session_execute_application_get_flags(), switch_core_session_write_text_frame(), switch_core_session_write_video_frame(), switch_event_reserve_subclass_detailed(), switch_ivr_eavesdrop_session(), switch_ivr_enterprise_originate(), switch_ivr_menu_execute(), switch_ivr_originate(), switch_ivr_park(), switch_ivr_record_session_event(), 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(), switch_memory_usage_stream(), switch_regex_match_partial(), switch_rtp_add_dtls(), switch_rtp_del_dtls(), and switch_sockaddr_new().
#define switch_inet_ntop inet_ntop |
Definition at line 1434 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 378 of file switch_utils.h.
Referenced by switch_ivr_record_file_event(), and switch_ivr_record_session_event().
#define switch_malloc | ( | ptr, | |
len | |||
) | (void)(switch_assert(((ptr) = malloc((len)))),ptr) |
Definition at line 1425 of file switch_utils.h.
Referenced by switch_msrp_msg_set_payload().
#define switch_network_list_add_cidr | ( | _list, | |
_cidr_str, | |||
_ok | |||
) | switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL) |
Definition at line 1366 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 1378 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 292 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 1097 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_detect_audio(), switch_ivr_detect_silence(), 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_event(), 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(), text_bridge_thread(), text_helper_thread(), 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 885 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(), ecd_deliver(), API::executeString(), fs_encode_cleanup(), fs_tts_cleanup(), CoreSession::getXMLCDR(), hashtable_expand(), load_mime_types(), main(), msrp_msg_serialize(), CoreSession::originate(), parse_presence_data_cols(), play_and_collect(), preprocess(), preprocess_exec_set(), preprocess_glob(), record_helper_post_process(), Event::serialize(), CoreSession::set_tts_params(), CoreSession::set_tts_parms(), setup_ringback(), speech_thread(), sql_in_thread(), Stream::Stream(), 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_set_variable_strip_quotes_var_check(), switch_channel_uninit(), switch_check_network_list_ip_port_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_close(), switch_core_asr_load_grammar(), switch_core_check_dtls_pem(), switch_core_destroy(), switch_core_file_close(), switch_core_gen_certs(), switch_core_hash_insert_alloc_destructor(), switch_core_hash_insert_auto_free(), switch_core_hash_insert_destructor(), switch_core_hash_insert_dup_auto_free(), switch_core_hash_insert_dup_destructor(), switch_core_hash_insert_pointer(), switch_core_media_bug_destroy(), switch_core_media_ext_address_lookup(), switch_core_media_gen_local_sdp(), switch_core_media_media_params(), switch_core_media_negotiate_sdp(), switch_core_media_process_sdp_filter(), switch_core_media_set_r_sdp_codec_string(), switch_core_perform_file_open(), 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_printf(), switch_core_session_reporting_state(), switch_core_speech_feed_tts(), switch_core_sqldb_start(), switch_dial_handle_list_create_json_obj(), switch_digest(), switch_digest_string(), 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_event(), switch_ivr_set_json_chan_vars(), switch_ivr_sleep(), switch_ivr_speak_text_handle(), switch_ivr_wait_for_answer(), switch_jb_pop_nack(), switch_json_add_presence_data_cols(), switch_jwt_verify(), switch_loadable_module_enumerate_available(), switch_loadable_module_get_codecs(), switch_loadable_module_load_file(), switch_log_meta_vprintf(), switch_log_node_free(), switch_log_node_to_json(), switch_msrp_destroy(), switch_msrp_msg_destroy(), switch_nat_init(), switch_nat_multicast_runtime(), switch_nat_republish(), switch_nat_shutdown(), switch_network_list_add_cidr_port_token(), switch_network_list_perform_add_cidr_token(), switch_odbc_handle_callback_exec_detailed(), switch_odbc_handle_destroy(), switch_odbc_handle_disconnect(), switch_odbc_handle_new(), 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_STANDARD_APP(), switch_stream_spawn(), 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_language(), switch_xml_locate_user_merged(), switch_xml_parse_file(), switch_xml_tohtml_ex(), switch_xml_user_cache(), task_thread_loop(), text_bridge_thread(), tone_detect_set_total_time(), and unsub_all_switch_event_channel().
#define switch_samples_per_packet | ( | rate, | |
interval | |||
) | ((uint32_t)((float)rate / (1000.0f / (float)interval))) |
Definition at line 289 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 700 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_collect_input_callback(), switch_core_asr_close(), switch_core_asr_open(), switch_core_codec_init_with_bitrate(), switch_core_destroy(), switch_core_directory_open(), switch_core_file_handle_dup(), 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_text_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_sqldb_start(), 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_play_and_collect_input(), switch_ivr_record_session_event(), 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 707 of file switch_utils.h.
Referenced by switch_core_file_pre_close(), 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 734 of file switch_utils.h.
Referenced by _switch_cache_db_get_db_handle_dsn_ex(), add_handle(), check_ice(), check_ip(), get_handle(), switch_config_open_file(), 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_loadable_module_get_codecs_sorted(), switch_log_meta_vprintf(), and switch_nat_multicast_runtime().
#define SWITCH_SMAX 32767 |
Definition at line 290 of file switch_utils.h.
Referenced by switch_core_media_bug_read().
#define SWITCH_SMIN -32768 |
Definition at line 291 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 375 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_split_cheap | ( | _data, | |
_delim, | |||
_array, | |||
_larray | |||
) | switch_separate_string_cheap(_data, _delim, (const char **)_array, _larray, switch_arraylen(_array)) |
Definition at line 376 of file switch_utils.h.
#define SWITCH_STATUS_IS_BREAK | ( | x | ) | (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR) |
Definition at line 633 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 993 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(), msrp_reply(), msrp_report(), CoreSession::print(), CoreSession::set_tts_params(), 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_media_negotiate_sdp(), 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_event(), switch_ivr_record_session_event(), switch_loadable_module_get_codecs_sorted(), switch_loadable_module_load_module_ex(), switch_loadable_module_process(), switch_loadable_module_unprocess(), switch_network_list_perform_add_cidr_token(), switch_odbc_handle_callback_exec_detailed(), switch_odbc_handle_disconnect(), switch_odbc_handle_exec(), switch_scheduler_add_task_ex(), switch_scheduler_execute(), switch_stun_host_lookup(), switch_xml_set_attr_d(), and task_thread_loop().
#define switch_strdup | ( | ptr, | |
s | |||
) | (void)(switch_assert(((ptr) = strdup((s)))),ptr) |
Definition at line 1427 of file switch_utils.h.
Referenced by switch_cache_db_execute_sql_real().
#define switch_strlen_zero | ( | x | ) | zstr(x) |
Definition at line 316 of file switch_utils.h.
Referenced by main().
#define switch_strlen_zero_buf | ( | x | ) | zstr_buf(x) |
Definition at line 317 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 693 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(), record_callback(), 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_status(), switch_cache_db_test_reactive_ex(), switch_caller_get_field_by_name(), switch_caller_profile_event_set_data(), switch_channel_clear_state_handler(), switch_channel_dequeue_dtmf(), switch_collect_input_callback(), switch_core_add_registration(), switch_core_asr_close(), switch_core_asr_open(), 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_pre_close(), 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_destroy(), 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_codec_get_cap(), 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_text_frame(), 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_destroy(), switch_core_sqldb_init(), 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_and_collect_input(), switch_ivr_play_file(), switch_ivr_process_fh(), switch_ivr_record_file_event(), switch_ivr_sound_test(), switch_ivr_speak_text_handle(), switch_ivr_wait_for_answer(), switch_jb_destroy(), switch_jb_put_packet(), switch_jb_set_session(), 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(), text_bridge_thread(), text_helper_thread(), 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 1380 of file switch_utils.h.
Referenced by switch_check_network_list_ip_port_token(), and switch_network_list_validate_ip_port_token().
#define switch_time_from_sec | ( | sec | ) | ((switch_time_t)(sec) * 1000000) |
Definition at line 1006 of file switch_utils.h.
#define switch_true_buf | ( | expr | ) |
Definition at line 536 of file switch_utils.h.
#define SWITCH_URL_UNSAFE "\r\n #%&+:;<=>?@[\\]^`{|}\"" |
Definition at line 47 of file switch_utils.h.
Referenced by switch_core_url_encode_opt(), 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 998 of file switch_utils.h.
Referenced by _switch_cache_db_get_db_handle(), audio_bridge_thread(), media_thread_run(), msrp_worker(), originate_on_consume_media_transmit(), pool_thread(), record_callback(), 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_console_save_history(), switch_core_db_exec(), switch_core_db_persistant_execute(), switch_core_db_persistant_execute_trans(), switch_core_media_end_engine_function(), switch_core_media_ext_address_lookup(), switch_core_media_read_frame(), 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_session_write_blank_video(), 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_msrp_session_destroy(), switch_msrp_session_pop_msg(), switch_nat_multicast_runtime(), switch_nat_thread_stop(), switch_odbc_handle_disconnect(), 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_STANDARD_APP(), 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)(switch_assert((ptr = calloc(1, (len)))),ptr) |
Definition at line 1426 of file switch_utils.h.
Referenced by generate_on_dtmf(), switch_channel_queue_dtmf(), switch_chromakey_create(), switch_console_push_match(), switch_core_inthash_insert(), switch_core_media_bug_add(), switch_core_media_gen_local_sdp(), switch_event_bind_removable(), switch_event_channel_broadcast(), switch_event_channel_deliver(), switch_event_channel_sub_channel(), switch_event_reserve_subclass_detailed(), switch_frame_alloc(), switch_hashtable_first_iter(), switch_img_data_url(), switch_ivr_collect_digits_count(), switch_ivr_detect_audio(), switch_ivr_detect_silence(), 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(), switch_scheduler_add_task_ex(), and text_bridge_thread().
Definition at line 328 of file switch_utils.h.
#define zstr | ( | x | ) | _zstr(x) |
Definition at line 314 of file switch_utils.h.
Referenced by __switch_xml_open_root(), _switch_core_db_handle(), add_audio_codec(), api_hook(), asr_set_json_text_params(), 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_api_on(), do_trans(), enterprise_originate_ringback_thread(), Event::Event(), EventConsumer::EventConsumer(), API::execute(), CoreSession::execute(), API::executeString(), fs_core_init(), fst_init_core_and_modload(), 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(), preprocess_stun_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_execute_on_value(), 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_log_tag(), 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_strip_quotes_var_check(), switch_channel_set_variable_var_check(), switch_channel_str2cause(), switch_channel_transfer_variable_prefix(), switch_collect_input_callback(), switch_color_set_rgb(), switch_console_complete(), switch_console_list_uuid(), switch_console_save_history(), 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_crypto(), 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_gen_local_sdp(), switch_core_media_get_codec_string(), switch_core_media_merge_sdp_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_strndup(), 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_read_text_frame(), 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_dial_handle_create_json(), switch_dial_handle_list_create_json(), 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_filecmp(), 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_and_collect_input(), switch_ivr_play_file(), switch_ivr_process_fh(), switch_ivr_read(), switch_ivr_record_session_event(), switch_ivr_say(), switch_ivr_session_transfer(), switch_ivr_set_json_chan_vars(), switch_ivr_set_user_extended(), 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_get_codecs_sorted(), switch_loadable_module_init(), switch_loadable_module_protect(), switch_log_meta_vprintf(), switch_log_node_to_json(), switch_lookup_timezone(), switch_media_bug_parse_spy_fmt(), switch_media_handle_create(), switch_msrp_do_send(), switch_network_list_perform_add_cidr_token(), switch_odbc_handle_callback_exec_detailed(), switch_odbc_handle_exec(), switch_play_and_get_digits(), switch_pool_strip_whitespace(), 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_STANDARD_API(), SWITCH_STANDARD_APP(), switch_stream_spawn(), switch_strftime_tz(), switch_strip_spaces(), switch_strip_whitespace(), switch_stun_ip_lookup(), 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(), text_callback(), and transfer_after_bridge().
#define zstr_buf | ( | s | ) | (*(s) == '\0') |
Definition at line 318 of file switch_utils.h.
Referenced by get_upnp_pubaddr(), switch_log_node_to_json(), switch_simple_email(), and switch_strftime_tz().
typedef struct switch_http_request_s switch_http_request_t |
Definition at line 58 of file switch_utils.h.
typedef struct switch_network_port_range switch_network_port_range_t |
Definition at line 57 of file switch_utils.h.
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 615 of file switch_utils.h.
|
inlinestatic |
Test for NULL or zero length string.
s | the string to test |
Definition at line 305 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 2494 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_false(), 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 2478 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_false(), and switch_get_addr().
int get_addr_int | ( | switch_sockaddr_t * | sa | ) |
Definition at line 2367 of file switch_utils.c.
Referenced by switch_false().
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 2505 of file switch_utils.c.
Referenced by switch_false().
int old_switch_tolower | ( | int | c | ) |
int old_switch_toupper | ( | int | c | ) |
char* switch_amp_encode | ( | char * | s, |
char * | buf, | ||
switch_size_t | len | ||
) |
Definition at line 939 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_string_has_escaped_data().
switch_bool_t switch_ast2regex | ( | const char * | pat, |
char * | rbuf, | ||
size_t | len | ||
) |
Definition at line 1388 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 4293 of file switch_utils.c.
Referenced by switch_ivr_process_fh().
unsigned long switch_atoul | ( | const char * | nptr | ) |
Definition at line 4300 of file switch_utils.c.
Referenced by switch_load_core_config().
switch_size_t switch_b64_decode | ( | const char * | in, |
char * | out, | ||
switch_size_t | olen | ||
) |
Definition at line 1064 of file switch_utils.c.
References b, switch_network_node::ip, and switch_b64_table.
Referenced by switch_core_media_add_crypto(), switch_jwt_verify(), and switch_string_has_escaped_data().
switch_status_t switch_b64_encode | ( | unsigned char * | in, |
switch_size_t | ilen, | ||
unsigned char * | out, | ||
switch_size_t | olen | ||
) |
Definition at line 1025 of file switch_utils.c.
References b, switch_b64_table, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_build_crypto(), switch_img_data_url(), switch_jwt_sign(), switch_rtp_add_crypto_key(), and switch_string_has_escaped_data().
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 2521 of file switch_utils.c.
References switch_snprintf(), SWITCH_URI_NO_SCOPE, SWITCH_URI_NUMERIC_HOST, and SWITCH_URI_NUMERIC_PORT.
|
inlinestatic |
|
inlinestatic |
Definition at line 1124 of file switch_utils.h.
References switch_fps_s::fps, switch_fps_s::ms, and switch_fps_s::samples.
void* switch_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Definition at line 86 of file switch_utils.c.
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 2556 of file switch_utils.c.
References RFC2833_CHARS, and switch_toupper().
Referenced by do_2833(), and switch_errno_is_break().
|
inlinestatic |
Definition at line 827 of file switch_utils.h.
|
inlinestatic |
Definition at line 813 of file switch_utils.h.
int switch_cmp_addr | ( | switch_sockaddr_t * | sa1, |
switch_sockaddr_t * | sa2, | ||
switch_bool_t | ip_only | ||
) |
Definition at line 2374 of file switch_utils.c.
Referenced by do_dtls(), handle_ice(), read_rtcp_packet(), rtp_common_read(), and switch_false().
char* switch_core_session_url_encode | ( | switch_core_session_t * | session, |
const char * | url | ||
) |
Definition at line 3550 of file switch_utils.c.
References switch_core_session_get_pool(), switch_core_url_encode_opt(), and SWITCH_FALSE.
Referenced by switch_needs_url_encode().
char* switch_core_session_url_encode_opt | ( | switch_core_session_t * | session, |
const char * | url, | ||
switch_bool_t | double_encode | ||
) |
Definition at line 3555 of file switch_utils.c.
References switch_core_session_get_pool(), and switch_core_url_encode_opt().
Referenced by switch_needs_url_encode().
char* switch_core_url_encode | ( | switch_memory_pool_t * | pool, |
const char * | url | ||
) |
Definition at line 3560 of file switch_utils.c.
References switch_core_url_encode_opt(), and SWITCH_FALSE.
Referenced by switch_needs_url_encode().
char* switch_core_url_encode_opt | ( | switch_memory_pool_t * | pool, |
const char * | url, | ||
switch_bool_t | double_encode | ||
) |
Definition at line 3565 of file switch_utils.c.
References end_of_p, switch_network_node::ok, switch_core_alloc, switch_core_strdup, switch_url_encode_opt(), and SWITCH_URL_UNSAFE.
Referenced by switch_core_session_url_encode(), switch_core_session_url_encode_opt(), switch_core_url_encode(), and switch_needs_url_encode().
int switch_cp_addr | ( | switch_sockaddr_t * | sa1, |
switch_sockaddr_t * | sa2 | ||
) |
Definition at line 2427 of file switch_utils.c.
Referenced by read_rtp_packet(), and switch_false().
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 3005 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_meta_vprintf(), and switch_simple_email().
switch_status_t switch_digest | ( | const char * | digest_name, |
unsigned char ** | digest, | ||
const void * | input, | ||
switch_size_t | inputLen, | ||
unsigned int * | outputlen | ||
) |
Definition at line 4715 of file switch_utils.c.
References switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), switch_safe_free, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_digest_string().
switch_status_t switch_digest_string | ( | const char * | digest_name, |
char ** | digest_str, | ||
const void * | input, | ||
switch_size_t | inputLen, | ||
unsigned int * | outputlen | ||
) |
Definition at line 4771 of file switch_utils.c.
References b, switch_digest(), switch_safe_free, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_bool_t switch_dow_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 4100 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 4042 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 4049 of file switch_utils.c.
References switch_arraylen.
Referenced by _dow_read_token().
|
inlinestatic |
Definition at line 463 of file switch_utils.h.
References switch_assert.
Referenced by meta_on_dtmf(), and switch_ivr_bind_dtmf_meta_session().
|
inlinestatic |
Definition at line 649 of file switch_utils.h.
References key, switch_char_to_rfc2833(), SWITCH_DECLARE, switch_priority_name(), and switch_rfc2833_to_char().
Referenced by switch_util_quote_shell_arg_pool(), 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 2571 of file switch_utils.c.
References count, 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 2680 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 551 of file switch_utils.h.
References _In_, _In_opt_, _Out_opt_bytecapcount_, buf, buflen, get_addr(), get_addr6(), get_addr_int(), get_port(), switch_cmp_addr(), switch_cp_addr(), SWITCH_DECLARE, SWITCH_FALSE, switch_find_interface_ip(), switch_find_local_ip(), switch_is_number(), switch_resolve_host(), and SWITCH_TRUE.
Referenced by check_jb(), switch_channel_var_false(), switch_core_media_gen_local_sdp(), switch_core_media_negotiate_sdp(), switch_core_media_receive_message(), switch_core_perform_file_open(), switch_core_session_parse_crypto_prefs(), switch_ivr_originate(), switch_xml_config_parse_event(), and video_helper_thread().
switch_size_t switch_fd_read_dline | ( | int | fd, |
char ** | buf, | ||
switch_size_t * | len | ||
) |
Definition at line 844 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().
Referenced by switch_known_bitrate().
switch_size_t switch_fd_read_line | ( | int | fd, |
char * | buf, | ||
switch_size_t | len | ||
) |
|
inlinestatic |
Definition at line 1306 of file switch_utils.h.
References switch_find_end_paren(), and zstr.
char* switch_find_end_paren | ( | const char * | s, |
char | open, | ||
char | close | ||
) |
Definition at line 796 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_filecmp(), switch_is_file_path(), switch_ivr_displace_session(), switch_ivr_originate(), switch_ivr_play_file(), switch_ivr_record_file_event(), switch_ivr_record_session_event(), switch_needs_url_encode(), 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) |
Referenced by switch_false().
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_false(), switch_load_network_lists(), switch_nat_init(), and switch_stun_ip_lookup().
char* switch_find_parameter | ( | const char * | str, |
const char * | param, | ||
switch_memory_pool_t * | pool | ||
) |
Definition at line 415 of file switch_utils.c.
References switch_network_node::next, switch_core_alloc, and switch_snprintf().
Referenced by switch_known_bitrate().
char* switch_format_number | ( | const char * | num | ) |
Definition at line 4256 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 892 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(), switch_known_bitrate(), and switch_stream_write_file_contents().
switch_status_t switch_frame_alloc | ( | switch_frame_t ** | frame, |
switch_size_t | size | ||
) |
Definition at line 109 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.
Referenced by switch_known_bitrate().
switch_status_t switch_frame_buffer_create | ( | switch_frame_buffer_t ** | fbP, |
switch_size_t | qlen | ||
) |
Definition at line 303 of file switch_utils.c.
References switch_frame_buffer_s::mutex, pool, switch_frame_buffer_s::pool, switch_frame_buffer_s::queue, switch_core_alloc, switch_core_new_memory_pool, switch_mutex_init(), SWITCH_MUTEX_NESTED, switch_queue_create(), and SWITCH_STATUS_SUCCESS.
Referenced by audio_write_thread().
switch_status_t switch_frame_buffer_destroy | ( | switch_frame_buffer_t ** | fbP | ) |
Definition at line 292 of file switch_utils.c.
References pool, switch_frame_buffer_s::pool, switch_core_destroy_memory_pool, and SWITCH_STATUS_SUCCESS.
Referenced by switch_media_handle_destroy().
switch_status_t switch_frame_buffer_dup | ( | switch_frame_buffer_t * | fb, |
switch_frame_t * | orig, | ||
switch_frame_t ** | clone | ||
) |
Definition at line 250 of file switch_utils.c.
References switch_frame::buflen, find_free_frame(), switch_assert, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by perform_write().
switch_status_t switch_frame_buffer_free | ( | switch_frame_buffer_t * | fb, |
switch_frame_t ** | frameP | ||
) |
Definition at line 217 of file switch_utils.c.
References switch_frame::extra_data, switch_frame_node_s::frame, switch_frame_buffer_s::head, switch_frame::img, switch_frame_node_s::inuse, switch_frame_buffer_s::mutex, switch_frame_node_s::next, switch_frame_node_s::prev, switch_assert, switch_img_free(), switch_mutex_lock(), switch_mutex_unlock(), SWITCH_STATUS_SUCCESS, and switch_frame_buffer_s::total.
Referenced by audio_write_thread().
switch_status_t switch_frame_buffer_pop | ( | switch_frame_buffer_t * | fb, |
void ** | ptr | ||
) |
Definition at line 277 of file switch_utils.c.
References switch_frame_buffer_s::queue, and switch_queue_pop().
switch_status_t switch_frame_buffer_push | ( | switch_frame_buffer_t * | fb, |
void * | ptr | ||
) |
Definition at line 267 of file switch_utils.c.
References switch_frame_buffer_s::queue, and switch_queue_push().
Referenced by perform_write(), and switch_core_media_deactivate_rtp().
int switch_frame_buffer_size | ( | switch_frame_buffer_t * | fb | ) |
Definition at line 287 of file switch_utils.c.
References switch_frame_buffer_s::queue, and switch_queue_size().
switch_status_t switch_frame_buffer_trypop | ( | switch_frame_buffer_t * | fb, |
void ** | ptr | ||
) |
Definition at line 282 of file switch_utils.c.
References switch_frame_buffer_s::queue, and switch_queue_trypop().
Referenced by audio_write_thread().
switch_status_t switch_frame_buffer_trypush | ( | switch_frame_buffer_t * | fb, |
void * | ptr | ||
) |
Definition at line 272 of file switch_utils.c.
References switch_frame_buffer_s::queue, and switch_queue_trypush().
switch_status_t switch_frame_dup | ( | switch_frame_t * | orig, |
switch_frame_t ** | clone | ||
) |
Definition at line 321 of file switch_utils.c.
References switch_frame::buflen, switch_frame::codec, switch_frame::data, switch_frame::datalen, switch_frame::img, switch_frame::packet, switch_frame::packetlen, 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.
Referenced by switch_known_bitrate().
switch_status_t switch_frame_free | ( | switch_frame_t ** | frame | ) |
Definition at line 363 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.
Referenced by switch_known_bitrate().
int switch_fulldate_cmp | ( | const char * | exp, |
switch_time_t * | ts | ||
) |
Definition at line 3739 of file switch_utils.c.
References cur, switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), switch_safe_free, and switch_str_time().
Referenced by switch_xml_std_datetime_check().
|
inlinestatic |
Definition at line 60 of file switch_utils.h.
void switch_getcputime | ( | switch_cputime * | t | ) |
/ Return used CPU time in this process for user and kernel code
Definition at line 4591 of file switch_utils.c.
References switch_cputime::kernelms, switch_cputime::userms, and switch_stream_handle::write_function.
unsigned long switch_getpid | ( | void | ) |
Definition at line 4704 of file switch_utils.c.
Referenced by fst_init_core_and_modload().
char* switch_html_strip | ( | const char * | str | ) |
Definition at line 4658 of file switch_utils.c.
References switch_stream_handle::data, SWITCH_CHANNEL_LOG, switch_log_printf(), SWITCH_LOG_WARNING, switch_safe_strdup(), and SWITCH_STANDARD_STREAM.
void switch_http_dump_request | ( | switch_http_request_t * | request | ) |
Definition at line 4561 of file switch_utils.c.
References switch_http_request_s::content_length, switch_http_request_s::content_type, switch_http_request_s::from, switch_event::headers, switch_http_request_s::headers, switch_http_request_s::host, switch_http_request_s::keepalive, switch_http_request_s::method, switch_event_header::name, switch_event_header::next, switch_http_request_s::port, switch_http_request_s::qs, switch_http_request_s::referer, switch_assert, SWITCH_SIZE_T_FMT, switch_http_request_s::uri, switch_http_request_s::user, switch_http_request_s::user_agent, and switch_event_header::value.
void switch_http_free_request | ( | switch_http_request_t * | request | ) |
Definition at line 4552 of file switch_utils.c.
References switch_http_request_s::_buffer, switch_http_request_s::_destroy_headers, switch_http_request_s::headers, and 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 4411 of file switch_utils.c.
References switch_http_request_s::_buffer, switch_http_request_s::_destroy_headers, buffer, switch_http_request_s::bytes_buffered, switch_http_request_s::bytes_header, switch_http_request_s::bytes_read, clean_uri(), switch_http_request_s::content_length, switch_http_request_s::content_type, switch_http_request_s::headers, switch_http_request_s::host, switch_http_request_s::keepalive, switch_http_request_s::method, switch_http_request_s::port, switch_http_request_s::qs, switch_http_request_s::referer, switch_assert, 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, SWITCH_TRUE, switch_http_request_s::uri, switch_http_request_s::user_agent, and value.
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 4337 of file switch_utils.c.
References switch_http_request_s::headers, name, switch_network_node::next, switch_http_request_s::qs, 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 check_ice(), switch_check_network_list_ip_port_token(), switch_find_local_ip(), switch_network_list_add_host_port_mask(), and switch_parse_cidr().
|
inlinestatic |
Definition at line 437 of file switch_utils.h.
References SWITCH_FALSE, and SWITCH_TRUE.
|
inlinestatic |
Definition at line 1281 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_check_dtls_pem(), switch_core_gen_certs(), switch_img_txt_handle_create(), switch_ivr_displace_session(), switch_ivr_play_file(), switch_ivr_record_file_event(), switch_ivr_record_session_event(), 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 1355 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 1654 of file switch_utils.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_core_media_filter_sdp(), and switch_known_bitrate().
|
inlinestatic |
Definition at line 319 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 1635 of file switch_utils.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by check_channel_status(), load_configuration(), switch_channel_perform_mark_answered(), switch_false(), switch_format_number(), switch_ivr_originate(), switch_ivr_phrase_macro_event(), switch_known_bitrate(), 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().
switch_bool_t switch_is_uint_in_range | ( | const char * | str, |
unsigned int | from, | ||
unsigned int | to | ||
) |
Check if a 32 bit unsigned number is in a range.
str | string to check. Should not contain non-digit characters. |
from | start of range including this number |
to | end of range including this number |
Definition at line 1611 of file switch_utils.c.
References number, switch_network_node::str, SWITCH_FALSE, and SWITCH_TRUE.
Referenced by check_ice(), and switch_known_bitrate().
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 | ) |
Definition at line 3998 of file switch_utils.c.
Referenced by switch_tolower_max().
int switch_islower | ( | int | c | ) |
int switch_isprint | ( | int | c | ) |
Definition at line 4008 of file switch_utils.c.
References _B, _L, _N, and _U.
Referenced by switch_tolower_max().
int switch_ispunct | ( | int | c | ) |
int switch_isspace | ( | int | c | ) |
int switch_isupper | ( | int | c | ) |
int switch_isxdigit | ( | int | c | ) |
|
inlinestatic |
Definition at line 450 of file switch_utils.h.
Referenced by switch_ivr_bind_dtmf_meta_session().
char* switch_jwt_sign | ( | const char * | secret, |
const uint8_t * | payload, | ||
switch_size_t | size | ||
) |
[in] | secret | the secret string |
[in] | payload | the payload |
[in] | size | the payload size |
Definition at line 5007 of file switch_utils.c.
References SHA256_LENGTH, switch_assert, switch_b64_encode(), switch_mprintf(), and switch_must_malloc().
cJSON* switch_jwt_verify | ( | const char * | secret, |
const char * | token | ||
) |
[in] | secret | the secret string |
[in] | token | the jwt token, only alg: HS256 is supported |
Definition at line 4943 of file switch_utils.c.
References cJSON_GetObjectCstr(), switch_network_node::ok, SHA256_LENGTH, switch_assert, switch_b64_decode(), switch_must_malloc(), and switch_safe_free.
|
inlinestatic |
Definition at line 479 of file switch_utils.h.
References buf, pool, SWITCH_DECLARE, switch_fd_read_dline(), switch_fd_read_line(), switch_find_parameter(), switch_fp_read_dline(), switch_frame_alloc(), switch_frame_dup(), switch_frame_free(), switch_is_leading_number(), switch_is_number(), switch_is_uint_in_range(), and to.
Referenced by add_audio_codec(), and switch_core_media_negotiate_sdp().
|
inlinestatic |
const char* switch_memory_usage_stream | ( | switch_stream_handle_t * | stream | ) |
Definition at line 4810 of file switch_utils.c.
References FALSE, switch_goto_status, SWITCH_SIZE_T_FMT, and switch_stream_handle::write_function.
char* switch_must_strdup | ( | const char * | _s | ) |
Definition at line 4803 of file switch_utils.c.
References switch_assert.
Referenced by preprocess_glob(), switch_xml_locate_user_merged(), switch_xml_parse_str_dynamic(), switch_xml_proc_inst(), switch_xml_set_attr(), switch_xml_set_attr_d(), and switch_xml_set_attr_d_buf().
|
inlinestatic |
Definition at line 1214 of file switch_utils.h.
References end_of_p, pool, switch_core_session_url_encode(), switch_core_session_url_encode_opt(), switch_core_url_encode(), switch_core_url_encode_opt(), SWITCH_DECLARE, switch_find_end_paren(), switch_simple_email(), switch_url_decode(), switch_url_encode(), switch_url_encode_opt(), SWITCH_URL_UNSAFE, and to.
char* switch_network_ipv4_mapped_ipv6_addr | ( | const char * | ip_str | ) |
Definition at line 582 of file switch_utils.c.
Referenced by switch_check_network_list_ip_port_token(), and switch_network_list_perform_add_cidr_token().
switch_status_t switch_network_list_add_cidr_port_token | ( | switch_network_list_t * | list, |
const char * | cidr_str, | ||
switch_bool_t | ok, | ||
const char * | token, | ||
switch_network_port_range_p | port | ||
) |
Definition at line 675 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(), and switch_network_list_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 702 of file switch_utils.c.
References switch_network_list_add_cidr_port_token().
Referenced by switch_load_network_lists(), and switch_parse_audio_col().
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 737 of file switch_utils.c.
References switch_network_list_add_host_port_mask().
Referenced by switch_load_network_lists().
switch_status_t switch_network_list_add_host_port_mask | ( | switch_network_list_t * | list, |
const char * | host, | ||
const char * | mask_str, | ||
switch_bool_t | ok, | ||
switch_network_port_range_p | port | ||
) |
Definition at line 707 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_list::node_head, switch_network_node::ok, switch_network_list::pool, switch_network_node::port_range, 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(), and switch_network_list_add_host_mask().
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 459 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(), and switch_parse_audio_col().
switch_bool_t switch_network_list_validate_ip6_port_token | ( | switch_network_list_t * | list, |
ip_t | ip, | ||
int | port, | ||
const char ** | token | ||
) |
Definition at line 497 of file switch_utils.c.
References switch_network_node::bits, switch_network_list::default_type, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_list::node_head, switch_network_node::ok, SWITCH_FALSE, switch_testv6_subnet(), SWITCH_TRUE, and switch_network_node::token.
Referenced by switch_check_network_list_ip_port_token(), and switch_network_list_validate_ip6_token().
switch_bool_t switch_network_list_validate_ip6_token | ( | switch_network_list_t * | list, |
ip_t | ip, | ||
const char ** | token | ||
) |
Definition at line 572 of file switch_utils.c.
References switch_network_list_validate_ip6_port_token().
switch_bool_t switch_network_list_validate_ip_port_token | ( | switch_network_list_t * | list, |
uint32_t | ip, | ||
int | port, | ||
const char ** | token | ||
) |
Definition at line 546 of file switch_utils.c.
References switch_network_node::bits, switch_network_list::default_type, switch_network_node::family, switch_network_node::ip, is_port_in_node(), switch_network_node::mask, switch_network_node::next, switch_network_list::node_head, 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_port_token(), and switch_network_list_validate_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 577 of file switch_utils.c.
References switch_network_list_validate_ip_port_token().
int switch_number_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 4133 of file switch_utils.c.
References b.
Referenced by switch_xml_std_datetime_check().
|
inlinestatic |
Definition at line 1332 of file switch_utils.h.
References ip, name, 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, SWITCH_AUDIO_COL_STR_TITLE, SWITCH_DECLARE, switch_network_list_add_cidr_token(), switch_network_list_create(), and switch_parse_cidr().
|
inlinestatic |
Definition at line 1137 of file switch_utils.h.
Referenced by switch_core_media_gen_local_sdp(), and switch_core_session_parse_codec_settings().
Definition at line 743 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::ip, switch_network_node::mask, switch_copy_string(), switch_inet_pton(), ip_t::v4, and ip_t::v6.
Referenced by switch_check_network_list_ip_port_token(), switch_network_list_perform_add_cidr_token(), and switch_parse_audio_col().
|
inlinestatic |
char* switch_pool_strip_whitespace | ( | switch_memory_pool_t * | pool, |
const char * | str | ||
) |
Definition at line 1439 of file switch_utils.c.
References switch_network_node::str, switch_assert, SWITCH_BLANK_STRING, switch_core_strdup, and zstr.
|
inlinestatic |
char* switch_print_host | ( | switch_sockaddr_t * | addr, |
char * | buf, | ||
switch_size_t | len | ||
) |
Definition at line 98 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 2173 of file switch_utils.c.
References SWITCH_PRIORITY_HIGH, SWITCH_PRIORITY_LOW, and SWITCH_PRIORITY_NORMAL.
Referenced by switch_errno_is_break(), and switch_event_set_priority().
char* switch_replace_char | ( | char * | str, |
char | from, | ||
char | to, | ||
switch_bool_t | dup | ||
) |
Definition at line 1419 of file switch_utils.c.
References switch_network_node::str, switch_assert, and to.
switch_status_t switch_resolve_host | ( | const char * | host, |
char * | buf, | ||
size_t | buflen | ||
) |
Definition at line 1841 of file switch_utils.c.
References get_addr(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by check_ice(), and switch_false().
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 2548 of file switch_utils.c.
References RFC2833_CHARS.
Referenced by handle_rfc2833(), and switch_errno_is_break().
|
inlinestatic |
Definition at line 81 of file switch_utils.h.
Referenced by switch_core_media_get_video_fps().
|
inlinestatic |
Turn a string into an integer (default if NULL)
nptr | the string |
dft | the default |
Definition at line 851 of file switch_utils.h.
Referenced by switch_core_media_process_udptl().
|
inlinestatic |
Turn a string into a long integer (default if NULL)
nptr | the string |
dft | the default |
Definition at line 863 of file switch_utils.h.
|
inlinestatic |
Turn a string into a long long integer (default if NULL)
nptr | the string |
dft | the default |
Definition at line 875 of file switch_utils.h.
|
inlinestatic |
Definition at line 887 of file switch_utils.h.
Referenced by switch_html_strip().
|
inlinestatic |
Definition at line 737 of file switch_utils.h.
References number, and switch_assert.
Referenced by switch_ivr_originate().
|
inlinestatic |
Definition at line 1252 of file switch_utils.h.
References switch_assert, and 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(), parse_val(), switch_channel_caller_extension_masquerade(), switch_channel_handle_cause(), switch_channel_process_export(), switch_channel_queue_dtmf_string(), switch_check_network_list_ip_port_token(), switch_console_complete(), switch_console_set_alias(), switch_console_set_complete(), switch_core_asr_load_grammar(), switch_core_media_media_params(), switch_core_media_negotiate_sdp(), 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_load_network_lists(), switch_log_str2mask(), switch_play_and_get_digits(), switch_process_import(), switch_speex_fmtp_parse(), SWITCH_STANDARD_API(), switch_stream_spawn(), and transfer_after_bridge().
unsigned int switch_separate_string_cheap | ( | _In_ const char * | buf, |
char | delim, | ||
_Post_count_(return) const char ** | array, | ||
_Post_count_(return) unsigned int | larray[], | ||
unsigned int | arraylen | ||
) |
Separate a string into an array based on a character delimiter, no memory corruption! DOESN'T support removing quotes like what's in switch_separate_string()!
buf | the string to parse |
delim | the character delimiter |
array | the array to split the values into |
larray | the array that hold the lenth of each element |
arraylen | the max number of elements in the array |
unsigned int switch_separate_string_string | ( | char * | buf, |
char * | delim, | ||
_Post_count_(return) char ** | array, | ||
unsigned int | arraylen | ||
) |
Referenced by ecd_deliver(), 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 1117 of file switch_utils.c.
References b, 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(), zstr, and zstr_buf.
Referenced by email(), and switch_needs_url_encode().
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 3541 of file switch_utils.c.
References switch_poll().
void switch_split_date | ( | const char * | exp, |
int * | year, | ||
int * | month, | ||
int * | day | ||
) |
Definition at line 3708 of file switch_utils.c.
References switch_assert, and switch_safe_free.
void switch_split_time | ( | const char * | exp, |
int * | hour, | ||
int * | min, | ||
int * | sec | ||
) |
Definition at line 3675 of file switch_utils.c.
References switch_assert, and switch_safe_free.
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 4216 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 2083 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.
Referenced by switch_fulldate_cmp().
int switch_strcasecmp_any | ( | const char * | str, |
... | |||
) |
Definition at line 394 of file switch_utils.c.
|
inlinestatic |
Definition at line 334 of file switch_utils.h.
References in, and switch_assert.
Referenced by switch_event_create_brackets().
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 |
Definition at line 4308 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 384 of file switch_utils.h.
References buf, in, switch_amp_encode(), switch_assert, switch_b64_decode(), switch_b64_encode(), and SWITCH_DECLARE.
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 3024 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 3041 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 763 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 788 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_strip_quotes_var_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 1503 of file switch_utils.c.
References switch_network_node::str, switch_assert, SWITCH_BLANK_STRING, and zstr.
Referenced by switch_core_media_add_crypto().
char* switch_strip_whitespace | ( | const char * | str | ) |
Definition at line 1471 of file switch_utils.c.
References switch_network_node::str, 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 1673 of file switch_utils.c.
References get_netmask(), switch_network_node::mask, memset(), and switch_toupper().
Referenced by audio_bridge_thread(), check_ice(), core_event_handler(), do_chat_send(), find_pt(), inherit_codec(), init_upnp(), main(), msrp_parse_buffer(), msrp_worker(), 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_media_params(), 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_perform_file_open(), switch_core_session_check_incoming_crypto(), switch_core_session_findall_matching_var(), switch_core_sqldb_start(), switch_core_video_parse_filter_string(), switch_ivr_originate(), switch_odbc_handle_exec(), 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 937 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 483 of file switch_utils.c.
References IN6_AND_MASK, SWITCH_TRUE, and ip_t::v6.
Referenced by switch_check_network_list_ip_port_token(), and switch_network_list_validate_ip6_port_token().
int switch_tod_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 4152 of file switch_utils.c.
References cur, switch_assert, and switch_safe_free.
Referenced by switch_xml_std_datetime_check().
|
inlinestatic |
Definition at line 112 of file switch_utils.h.
References b, switch_tolower_max(), switch_toupper(), and switch_toupper_max().
Referenced by switch_hash_default_ci(), and switch_tolower_max().
|
inlinestatic |
Definition at line 231 of file switch_utils.h.
References b, old_switch_tolower(), old_switch_toupper(), SWITCH_DECLARE, switch_isalnum(), switch_isalpha(), switch_iscntrl(), switch_isdigit(), switch_isgraph(), switch_islower(), switch_isprint(), switch_ispunct(), switch_isspace(), switch_isupper(), switch_isxdigit(), and switch_tolower().
Referenced by switch_lc_strdup(), and switch_tolower().
|
inlinestatic |
Definition at line 101 of file switch_utils.h.
Referenced by switch_char_to_rfc2833(), switch_stristr(), switch_strstr(), switch_tolower(), and switch_toupper_max().
|
inlinestatic |
Definition at line 203 of file switch_utils.h.
References b, and switch_toupper().
Referenced by switch_tolower(), and switch_uc_strdup().
|
inlinestatic |
Evaluate the truthfullness of a string expression.
expr | a string expression |
Definition at line 519 of file switch_utils.h.
References SWITCH_FALSE, switch_is_number(), and SWITCH_TRUE.
Referenced by audio_bridge_on_exchange_media(), audio_bridge_thread(), check_ice(), core_event_handler(), do_chat_send(), get_channels(), inherit_codec(), limit_state_handler(), load_config(), load_configuration(), record_callback(), recording_var_true(), signal_bridge_on_hangup(), speech_thread(), switch_channel_flip_cid(), 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_channel_var_true(), 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_parse_media_flags(), 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_enterprise_orig_and_bridge(), switch_ivr_intercept_session(), switch_ivr_multi_threaded_bridge(), switch_ivr_orig_and_bridge(), switch_ivr_originate(), switch_ivr_parse_event(), switch_ivr_phrase_macro_event(), switch_ivr_play_file(), switch_ivr_preprocess_session(), switch_ivr_record_file_event(), switch_ivr_record_session_event(), switch_ivr_say(), switch_ivr_say_string(), switch_ivr_set_xml_call_stats(), 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_enable_vad(), switch_speex_fmtp_parse(), switch_stream_system(), switch_system(), switch_true_byte(), switch_xml_config_parse_event(), switch_xml_std_datetime_check(), text_callback(), and uuid_bridge_on_soft_execute().
|
inlinestatic |
Definition at line 531 of file switch_utils.h.
References switch_true().
|
inlinestatic |
char* switch_url_decode | ( | char * | s | ) |
Definition at line 3654 of file switch_utils.c.
References zstr.
Referenced by switch_core_session_request_xml(), switch_http_parse_qs(), switch_img_write_text_img(), and switch_needs_url_encode().
char* switch_url_encode | ( | const char * | url, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 3649 of file switch_utils.c.
References SWITCH_FALSE, and switch_url_encode_opt().
Referenced by add_xml_header(), switch_channel_build_param_string(), switch_core_perform_file_open(), switch_event_build_param_string(), switch_event_serialize(), switch_ivr_set_json_chan_vars(), switch_ivr_set_xml_chan_var(), and switch_needs_url_encode().
char* switch_url_encode_opt | ( | const char * | url, |
char * | buf, | ||
size_t | len, | ||
switch_bool_t | double_encode | ||
) |
Definition at line 3604 of file switch_utils.c.
References buf, end_of_p, switch_network_node::ok, and SWITCH_URL_UNSAFE.
Referenced by switch_core_url_encode_opt(), switch_needs_url_encode(), and 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 3076 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 3081 of file switch_utils.c.
References switch_waitlist_s::revents, switch_waitlist_s::sock, switch_assert, switch_core_alloc, SWITCH_DECLARE, switch_errno, switch_errno_is_break(), SWITCH_POLL_ERROR, SWITCH_POLL_HUP, SWITCH_POLL_INVALID, SWITCH_POLL_PRI, SWITCH_POLL_RDBAND, SWITCH_POLL_RDNORM, SWITCH_POLL_READ, SWITCH_POLL_WRITE, SWITCH_SOCK_INVALID, switch_wait_sock(), and switch_wait_socklist().
Referenced by switch_util_quote_shell_arg().
char* switch_uuid_str | ( | char * | buf, |
switch_size_t | len | ||
) |
Definition at line 4241 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(), switch_core_session_exec(), and switch_msrp_do_send().
|
inlinestatic |
Definition at line 807 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 3333 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(), and switch_util_quote_shell_arg_pool().
int switch_wait_socklist | ( | switch_waitlist_t * | waitlist, |
uint32_t | len, | ||
uint32_t | ms | ||
) |
Definition at line 3429 of file switch_utils.c.
References switch_waitlist_s::events, switch_waitlist_s::revents, switch_waitlist_s::sock, switch_errno, switch_errno_is_break(), SWITCH_POLL_ERROR, SWITCH_POLL_READ, SWITCH_POLL_WRITE, and SWITCH_SOCK_INVALID.
Referenced by switch_util_quote_shell_arg_pool().