FreeSWITCH API Documentation
1.7.0
|
Go to the source code of this file.
Data Structures | |
struct | switch_network_node |
struct | switch_network_list |
struct | switch_frame_node_s |
struct | switch_frame_buffer_s |
Macros | |
#define | ESCAPE_META '\\' |
#define | IN6_AND_MASK(result, ip, mask) |
#define | DLINE_BLOCK_SIZE 1024 |
#define | DLINE_MAX_SIZE 1048576 |
#define | B64BUFFLEN 1024 |
#define | SWITCH_CTYPE_NUM_CHARS 256 |
#define | _U 0x01 |
#define | _L 0x02 |
#define | _N 0x04 |
#define | _S 0x08 |
#define | _P 0x10 |
#define | _C 0x20 |
#define | _X 0x40 |
#define | _B 0x80 |
Typedefs | |
typedef struct switch_network_node | switch_network_node_t |
typedef struct switch_frame_node_s | switch_frame_node_t |
Enumerations | |
enum | dow_t { DOW_ERR = -2, DOW_EOF = -1, DOW_SUN = 1, DOW_MON, DOW_TUE, DOW_WED, DOW_THU, DOW_FRI, DOW_SAT, DOW_HYPHEN = '-', DOW_COMA = ',' } |
Functions | |
int | switch_inet_pton (int af, const char *src, void *dst) |
char * | switch_print_host (switch_sockaddr_t *addr, char *buf, switch_size_t len) |
switch_status_t | switch_frame_alloc (switch_frame_t **frame, switch_size_t size) |
static switch_frame_t * | find_free_frame (switch_frame_buffer_t *fb, switch_frame_t *orig) |
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_status_t | switch_frame_dup (switch_frame_t *orig, switch_frame_t **clone) |
switch_status_t | switch_frame_free (switch_frame_t **frame) |
int | switch_strcasecmp_any (const char *str,...) |
char * | switch_find_parameter (const char *str, const char *param, switch_memory_pool_t *pool) |
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_bool_t | switch_testv6_subnet (ip_t _ip, ip_t _net, ip_t _mask) |
switch_bool_t | switch_network_list_validate_ip6_token (switch_network_list_t *list, ip_t ip, const char **token) |
switch_bool_t | switch_network_list_validate_ip_token (switch_network_list_t *list, uint32_t ip, const char **token) |
char * | switch_network_ipv4_mapped_ipv6_addr (const char *ip_str) |
switch_status_t | switch_network_list_perform_add_cidr_token (switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *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) |
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) |
int | switch_parse_cidr (const char *string, ip_t *ip, ip_t *mask, uint32_t *bitp) |
char * | switch_find_end_paren (const char *s, char open, char close) |
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) |
char * | switch_amp_encode (char *s, char *buf, switch_size_t len) |
switch_status_t | switch_b64_encode (unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen) |
switch_size_t | switch_b64_decode (char *in, char *out, switch_size_t olen) |
static int | write_buf (int fd, const char *buf) |
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) |
switch_bool_t | switch_is_lan_addr (const char *ip) |
switch_bool_t | switch_ast2regex (const char *pat, char *rbuf, size_t len) |
char * | switch_replace_char (char *str, char from, char to, switch_bool_t dup) |
char * | switch_strip_whitespace (const char *str) |
char * | switch_strip_spaces (char *str, switch_bool_t dup) |
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) |
switch_bool_t | switch_is_number (const char *str) |
switch_bool_t | switch_is_leading_number (const char *str) |
const char * | switch_stristr (const char *instr, const char *str) |
static int | get_netmask (struct sockaddr_in *me, int *mask) |
switch_status_t | switch_resolve_host (const char *host, char *buf, size_t buflen) |
switch_status_t | switch_find_local_ip (char *buf, int len, int *mask, int family) |
switch_status_t | switch_find_interface_ip (char *buf, int len, int *mask, const char *ifname, int family) |
switch_time_t | switch_str_time (const char *in) |
Converts a string representation of a date into a switch_time_t. More... | |
const char * | switch_priority_name (switch_priority_t priority) |
Return a printable name of a switch_priority_t. More... | |
int | get_addr_int (switch_sockaddr_t *sa) |
int | switch_cmp_addr (switch_sockaddr_t *sa1, switch_sockaddr_t *sa2) |
int | switch_cp_addr (switch_sockaddr_t *sa1, switch_sockaddr_t *sa2) |
char * | get_addr6 (char *buf, switch_size_t len, struct sockaddr_in6 *sa, socklen_t salen) |
char * | get_addr (char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen) |
find the char representation of an ip adress More... | |
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... | |
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... | |
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... | |
static char | unescape_char (char escaped) |
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) |
static char * | cleanup_separated_string (char *str, char delim) |
unsigned int | switch_separate_string_string (char *buf, char *delim, char **array, unsigned int arraylen) |
static unsigned int | separate_string_char_delim (char *buf, char delim, char **array, unsigned int arraylen) |
static unsigned int | separate_string_blank_delim (char *buf, char **array, unsigned int arraylen) |
unsigned int | switch_separate_string (char *buf, char delim, char **array, unsigned int arraylen) |
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... | |
switch_status_t | switch_string_match (const char *string, size_t string_len, const char *search, size_t search_len) |
char * | switch_string_replace (const char *string, const char *search, const char *replace) |
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... | |
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) |
int | switch_socket_waitfor (switch_pollfd_t *poll, int ms) |
Wait for a socket. More... | |
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) |
void | switch_split_time (const char *exp, int *hour, int *min, int *sec) |
void | switch_split_date (const char *exp, int *year, int *month, int *day) |
int | switch_fulldate_cmp (const char *exp, switch_time_t *ts) |
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) |
const char * | switch_dow_int2str (int val) |
int | switch_dow_str2int (const char *exp) |
static dow_t | _dow_read_token (const char **s) |
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_split_user_domain (char *in, char **user, char **domain) |
Split a user string as user and domain. More... | |
char * | switch_uuid_str (char *buf, switch_size_t len) |
char * | switch_format_number (const char *num) |
unsigned int | switch_atoui (const char *nptr) |
unsigned long | switch_atoul (const char *nptr) |
char * | switch_strerror_r (int errnum, char *buf, switch_size_t buflen) |
void | switch_http_parse_qs (switch_http_request_t *request, char *qs) |
switch_status_t | clean_uri (char *uri) |
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_getcputime (switch_cputime *t) |
Variables | |
static const char | switch_b64_table [65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
static char | RFC2833_CHARS [] = "0123456789*#ABCDF" |
const short | _switch_C_toupper_ [1+SWITCH_CTYPE_NUM_CHARS] |
const short * | _switch_toupper_tab_ = _switch_C_toupper_ |
const short | _switch_C_tolower_ [1+SWITCH_CTYPE_NUM_CHARS] |
const short * | _switch_tolower_tab_ = _switch_C_tolower_ |
const int | _switch_C_ctype_ [1+SWITCH_CTYPE_NUM_CHARS] |
const int * | _switch_ctype_ = _switch_C_ctype_ |
static const char * | DOW [] |
#define _B 0x80 |
Definition at line 3568 of file switch_utils.c.
Referenced by switch_isprint().
#define _C 0x20 |
Definition at line 3566 of file switch_utils.c.
Referenced by switch_iscntrl().
#define _L 0x02 |
Definition at line 3562 of file switch_utils.c.
Referenced by switch_isalnum(), switch_isalpha(), switch_isgraph(), switch_islower(), and switch_isprint().
#define _N 0x04 |
Definition at line 3563 of file switch_utils.c.
Referenced by switch_isalnum(), switch_isdigit(), switch_isgraph(), switch_isprint(), and switch_isxdigit().
#define _P 0x10 |
Definition at line 3565 of file switch_utils.c.
Referenced by switch_isgraph(), switch_isprint(), and switch_ispunct().
#define _S 0x08 |
Definition at line 3564 of file switch_utils.c.
Referenced by switch_isspace().
#define _U 0x01 |
Definition at line 3561 of file switch_utils.c.
Referenced by switch_isalnum(), switch_isalpha(), switch_isgraph(), switch_isprint(), and switch_isupper().
#define _X 0x40 |
Definition at line 3567 of file switch_utils.c.
Referenced by switch_isxdigit().
#define B64BUFFLEN 1024 |
Definition at line 889 of file switch_utils.c.
Referenced by switch_simple_email().
#define DLINE_BLOCK_SIZE 1024 |
Definition at line 707 of file switch_utils.c.
Referenced by switch_fd_read_dline(), and switch_fp_read_dline().
#define DLINE_MAX_SIZE 1048576 |
Definition at line 708 of file switch_utils.c.
Referenced by switch_fd_read_dline(), and switch_fp_read_dline().
#define ESCAPE_META '\\' |
Definition at line 44 of file switch_utils.c.
Referenced by cleanup_separated_string(), separate_string_blank_delim(), and separate_string_char_delim().
#define IN6_AND_MASK | ( | result, | |
ip, | |||
mask | |||
) |
Definition at line 423 of file switch_utils.c.
Referenced by switch_testv6_subnet().
#define SWITCH_CTYPE_NUM_CHARS 256 |
Definition at line 3422 of file switch_utils.c.
typedef struct switch_frame_node_s switch_frame_node_t |
typedef struct switch_network_node switch_network_node_t |
Definition at line 56 of file switch_utils.c.
enum dow_t |
Enumerator | |
---|---|
DOW_ERR | |
DOW_EOF | |
DOW_SUN | |
DOW_MON | |
DOW_TUE | |
DOW_WED | |
DOW_THU | |
DOW_FRI | |
DOW_SAT | |
DOW_HYPHEN | |
DOW_COMA |
Definition at line 3694 of file switch_utils.c.
|
inlinestatic |
Definition at line 3708 of file switch_utils.c.
References DOW_COMA, DOW_EOF, DOW_ERR, DOW_HYPHEN, and switch_dow_str2int().
Referenced by switch_dow_cmp().
switch_status_t clean_uri | ( | char * | uri | ) |
Definition at line 4011 of file switch_utils.c.
References switch_separate_string(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_http_parse_header().
|
static |
Definition at line 2468 of file switch_utils.c.
References ESCAPE_META, and unescape_char().
Referenced by separate_string_blank_delim(), and separate_string_char_delim().
|
static |
Definition at line 114 of file switch_utils.c.
References switch_frame::buflen, switch_frame::channels, switch_frame::codec, switch_frame::data, switch_frame::datalen, switch_frame::extra_data, switch_frame::flags, switch_frame_node_s::frame, switch_frame_buffer_s::head, switch_frame::img, switch_frame_node_s::inuse, switch_frame::m, switch_frame_buffer_s::mutex, switch_frame_node_s::next, switch_frame::packet, switch_frame::packetlen, switch_frame::payload, switch_frame::pmap, switch_frame_buffer_s::pool, switch_frame_node_s::prev, switch_frame::rate, switch_frame::samples, switch_frame::seq, SFF_DYNAMIC, SFF_ENCODED, switch_frame::ssrc, switch_core_alloc, switch_img_copy(), switch_mutex_lock(), switch_mutex_unlock(), SWITCH_RTP_MAX_BUF_LEN, switch_set_flag, switch_test_flag, switch_frame::timestamp, and switch_frame_buffer_s::total.
Referenced by switch_frame_buffer_dup().
char* get_addr | ( | char * | buf, |
switch_size_t | len, | ||
struct sockaddr * | sa, | ||
socklen_t | salen | ||
) |
find the char representation of an ip adress
buf | the buffer to write the ip adress found into |
len | the length of the buf |
sa | the struct sockaddr * to get the adress from |
salen | the length of sa |
Definition at line 2273 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_find_local_ip(), switch_get_addr(), and switch_resolve_host().
char* get_addr6 | ( | char * | buf, |
switch_size_t | len, | ||
struct sockaddr_in6 * | sa, | ||
socklen_t | salen | ||
) |
Definition at line 2257 of file switch_utils.c.
References buf, and switch_assert.
Referenced by switch_get_addr().
int get_addr_int | ( | switch_sockaddr_t * | sa | ) |
Definition at line 2150 of file switch_utils.c.
|
static |
Definition at line 1639 of file switch_utils.c.
Referenced by switch_find_local_ip().
unsigned short get_port | ( | struct sockaddr * | sa | ) |
get the port number of an ip address
sa | the struct sockaddr * to get the port from |
Definition at line 2284 of file switch_utils.c.
int old_switch_tolower | ( | int | c | ) |
Definition at line 3509 of file switch_utils.c.
int old_switch_toupper | ( | int | c | ) |
Definition at line 3462 of file switch_utils.c.
|
static |
Definition at line 2577 of file switch_utils.c.
References buf, cleanup_separated_string(), and ESCAPE_META.
Referenced by switch_separate_string().
|
static |
Definition at line 2534 of file switch_utils.c.
References buf, cleanup_separated_string(), and ESCAPE_META.
Referenced by switch_separate_string().
char* switch_amp_encode | ( | char * | s, |
char * | buf, | ||
switch_size_t | len | ||
) |
switch_bool_t switch_ast2regex | ( | const char * | pat, |
char * | rbuf, | ||
size_t | len | ||
) |
Definition at line 1250 of file switch_utils.c.
References memset(), SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_regex_perform().
unsigned int switch_atoui | ( | const char * | nptr | ) |
Definition at line 3925 of file switch_utils.c.
Referenced by switch_ivr_process_fh().
unsigned long switch_atoul | ( | const char * | nptr | ) |
Definition at line 3932 of file switch_utils.c.
Referenced by switch_load_core_config().
switch_size_t switch_b64_decode | ( | char * | in, |
char * | out, | ||
switch_size_t | olen | ||
) |
Definition at line 929 of file switch_utils.c.
References switch_b64_table.
Referenced by switch_core_media_add_crypto().
switch_status_t switch_b64_encode | ( | unsigned char * | in, |
switch_size_t | ilen, | ||
unsigned char * | out, | ||
switch_size_t | olen | ||
) |
Definition at line 890 of file switch_utils.c.
References switch_b64_table, and SWITCH_STATUS_SUCCESS.
Referenced by switch_core_media_build_crypto(), and switch_rtp_add_crypto_key().
int switch_build_uri | ( | char * | uri, |
switch_size_t | size, | ||
const char * | scheme, | ||
const char * | user, | ||
const switch_sockaddr_t * | sa, | ||
int | flags | ||
) |
build a URI string from components
uri | output string |
size | maximum size of output string (including trailing null) |
scheme | URI scheme |
user | user part or null if none |
sa | host address |
flags | logical OR-ed combination of flags from switch_uri_flags |
Definition at line 2300 of file switch_utils.c.
References switch_snprintf(), SWITCH_URI_NO_SCOPE, SWITCH_URI_NUMERIC_HOST, and SWITCH_URI_NUMERIC_PORT.
unsigned char switch_char_to_rfc2833 | ( | char | key | ) |
Return the RFC2833 event based on an key character.
key | the charecter to encode |
Definition at line 2335 of file switch_utils.c.
References switch_toupper().
Referenced by do_2833().
int switch_cmp_addr | ( | switch_sockaddr_t * | sa1, |
switch_sockaddr_t * | sa2 | ||
) |
int switch_cp_addr | ( | switch_sockaddr_t * | sa1, |
switch_sockaddr_t * | sa2 | ||
) |
Definition at line 2206 of file switch_utils.c.
Referenced by read_rtp_packet(), and switch_rtp_set_remote_address().
const char* switch_cut_path | ( | const char * | in | ) |
Create a pointer to the file name in a given file path eliminating the directory name.
Definition at line 2658 of file switch_utils.c.
References in.
Referenced by switch_console_printf(), switch_event_prep_for_delivery_detailed(), switch_loadable_module_load_module_ex(), switch_log_vprintf(), and switch_simple_email().
switch_bool_t switch_dow_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 3732 of file switch_utils.c.
References _dow_read_token(), cur, DOW_COMA, DOW_EOF, DOW_ERR, DOW_HYPHEN, SWITCH_CHANNEL_LOG, SWITCH_FALSE, SWITCH_LOG_ERROR, switch_log_printf(), and SWITCH_TRUE.
Referenced by switch_xml_std_datetime_check().
const char* switch_dow_int2str | ( | int | val | ) |
Definition at line 3674 of file switch_utils.c.
References switch_arraylen.
Referenced by switch_xml_std_datetime_check().
int switch_dow_str2int | ( | const char * | exp | ) |
Definition at line 3681 of file switch_utils.c.
References switch_arraylen.
Referenced by _dow_read_token().
char* switch_escape_char | ( | switch_memory_pool_t * | pool, |
char * | in, | ||
const char * | delim, | ||
char | esc | ||
) |
Escape a string by prefixing a list of characters with an escape character.
pool | a memory pool to use |
in | the string |
delim | the list of characters to escape |
esc | the escape character |
Definition at line 2350 of file switch_utils.c.
References in, and switch_core_alloc.
char* switch_escape_string | ( | const char * | in, |
char * | out, | ||
switch_size_t | outlen | ||
) |
char* switch_escape_string_pool | ( | const char * | in, |
switch_memory_pool_t * | pool | ||
) |
Definition at line 2459 of file switch_utils.c.
References buf, switch_core_alloc, and switch_escape_string().
switch_size_t switch_fd_read_dline | ( | int | fd, |
char ** | buf, | ||
switch_size_t * | len | ||
) |
Definition at line 709 of file switch_utils.c.
References buf, cur, DLINE_BLOCK_SIZE, DLINE_MAX_SIZE, memset(), switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, and switch_log_printf().
switch_size_t switch_fd_read_line | ( | int | fd, |
char * | buf, | ||
switch_size_t | len | ||
) |
Definition at line 687 of file switch_utils.c.
char* switch_find_end_paren | ( | const char * | s, |
char | open, | ||
char | close | ||
) |
Definition at line 661 of file switch_utils.c.
Referenced by expand_vars(), switch_core_asr_load_grammar(), switch_core_media_process_sdp_filter(), switch_core_speech_feed_tts(), switch_event_create_brackets(), switch_is_file_path(), switch_ivr_displace_session(), switch_ivr_originate(), switch_ivr_play_file(), switch_ivr_record_file(), switch_ivr_record_session(), and switch_separate_file_params().
switch_status_t switch_find_interface_ip | ( | char * | buf, |
int | len, | ||
int * | mask, | ||
const char * | ifname, | ||
int | family | ||
) |
Definition at line 1839 of file switch_utils.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_find_local_ip | ( | char * | buf, |
int | len, | ||
int * | mask, | ||
int | family | ||
) |
Definition at line 1665 of file switch_utils.c.
References get_addr(), get_netmask(), memset(), switch_copy_string(), switch_core_get_variable_dup(), switch_inet_pton(), switch_safe_free, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
char* switch_find_parameter | ( | const char * | str, |
const char * | param, | ||
switch_memory_pool_t * | pool | ||
) |
Definition at line 360 of file switch_utils.c.
References switch_core_alloc, and switch_snprintf().
char* switch_format_number | ( | const char * | num | ) |
Definition at line 3888 of file switch_utils.c.
References switch_is_number(), switch_mprintf(), and zstr.
switch_size_t switch_fp_read_dline | ( | FILE * | fd, |
char ** | buf, | ||
switch_size_t * | len | ||
) |
Definition at line 757 of file switch_utils.c.
References buf, DLINE_BLOCK_SIZE, DLINE_MAX_SIZE, memset(), switch_assert, SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, and switch_log_printf().
Referenced by load_mime_types(), preprocess(), and switch_stream_write_file_contents().
switch_status_t switch_frame_alloc | ( | switch_frame_t ** | frame, |
switch_size_t | size | ||
) |
Definition at line 83 of file switch_utils.c.
References switch_frame::buflen, switch_frame::data, SFF_DYNAMIC, switch_assert, switch_set_flag, SWITCH_STATUS_SUCCESS, and switch_zmalloc.
switch_status_t switch_frame_buffer_create | ( | switch_frame_buffer_t ** | fbP | ) |
Definition at line 254 of file switch_utils.c.
References switch_frame_buffer_s::mutex, pool, switch_frame_buffer_s::pool, switch_core_alloc, switch_core_new_memory_pool, switch_mutex_init(), SWITCH_MUTEX_NESTED, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_buffer_destroy | ( | switch_frame_buffer_t ** | fbP | ) |
Definition at line 243 of file switch_utils.c.
References pool, switch_frame_buffer_s::pool, switch_core_destroy_memory_pool, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_buffer_dup | ( | switch_frame_buffer_t * | fb, |
switch_frame_t * | orig, | ||
switch_frame_t ** | clone | ||
) |
Definition at line 226 of file switch_utils.c.
References find_free_frame(), switch_assert, SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_buffer_free | ( | switch_frame_buffer_t * | fb, |
switch_frame_t ** | frameP | ||
) |
Definition at line 193 of file switch_utils.c.
References switch_frame::extra_data, switch_frame_node_s::frame, switch_frame::img, switch_frame_node_s::inuse, switch_frame_node_s::next, switch_frame_node_s::prev, switch_assert, switch_img_free(), switch_mutex_lock(), switch_mutex_unlock(), and SWITCH_STATUS_SUCCESS.
switch_status_t switch_frame_dup | ( | switch_frame_t * | orig, |
switch_frame_t ** | clone | ||
) |
Definition at line 269 of file switch_utils.c.
References switch_frame::buflen, switch_frame::codec, switch_frame::data, switch_frame::img, switch_frame::packet, switch_frame::pmap, SFF_DYNAMIC, SFF_ENCODED, switch_assert, switch_img_copy(), SWITCH_RTP_MAX_BUF_LEN, switch_set_flag, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_test_flag.
switch_status_t switch_frame_free | ( | switch_frame_t ** | frame | ) |
Definition at line 308 of file switch_utils.c.
References switch_frame::data, switch_frame::img, switch_frame::packet, SFF_DYNAMIC, switch_img_free(), switch_safe_free, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_test_flag.
int switch_fulldate_cmp | ( | const char * | exp, |
switch_time_t * | ts | ||
) |
Definition at line 3337 of file switch_utils.c.
References cur, memset(), switch_assert, switch_safe_free, switch_split_date(), and switch_split_time().
Referenced by switch_xml_std_datetime_check().
void switch_getcputime | ( | switch_cputime * | t | ) |
/ Return used CPU time in this process for user and kernel code
Definition at line 4225 of file switch_utils.c.
void switch_http_dump_request | ( | switch_http_request_t * | request | ) |
Definition at line 4195 of file switch_utils.c.
References switch_event_header::name, switch_event_header::next, switch_assert, SWITCH_SIZE_T_FMT, and switch_event_header::value.
void switch_http_free_request | ( | switch_http_request_t * | request | ) |
Definition at line 4186 of file switch_utils.c.
References switch_event_destroy().
Referenced by switch_http_parse_header().
switch_status_t switch_http_parse_header | ( | char * | buffer, |
uint32_t | datalen, | ||
switch_http_request_t * | request | ||
) |
parse http headers in a buffer return status of success or not
[in] | buffer | the buffer start from the very begining of the http request, e.g. 'GET ' |
[in] | datalen | the buffer length |
[out] | the | http request pointer or null, need destroy later if got non-NULL pointer |
Definition at line 4044 of file switch_utils.c.
References clean_uri(), switch_event_add_header_string(), SWITCH_EVENT_CHANNEL_DATA, switch_event_create, switch_http_free_request(), switch_http_parse_qs(), switch_separate_string(), SWITCH_STACK_BOTTOM, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and SWITCH_TRUE.
void switch_http_parse_qs | ( | switch_http_request_t * | request, |
char * | qs | ||
) |
parse http query string
[in] | request | the http request object |
[in] | qs | the query string buffer |
qs buffer will be modified, so be sure to dup the qs before passing into this function if you want to keep the original string untouched if qs is NULL, the it will parse request->qs, request->qs will be duplicated before parse to avoid being modified
Definition at line 3969 of file switch_utils.c.
References switch_assert, switch_event_add_header_string(), switch_safe_free, SWITCH_STACK_BOTTOM, and switch_url_decode().
Referenced by switch_http_parse_header().
int switch_inet_pton | ( | int | af, |
const char * | src, | ||
void * | dst | ||
) |
Definition at line 66 of file switch_utils.c.
Referenced by switch_check_network_list_ip_token(), switch_find_local_ip(), switch_network_list_add_host_mask(), and switch_parse_cidr().
switch_bool_t switch_is_lan_addr | ( | const char * | ip | ) |
Definition at line 1217 of file switch_utils.c.
References SWITCH_FALSE, SWITCH_TRUE, and zstr.
switch_bool_t switch_is_leading_number | ( | const char * | str | ) |
Definition at line 1460 of file switch_utils.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_core_media_filter_sdp().
switch_bool_t switch_is_number | ( | const char * | str | ) |
Definition at line 1441 of file switch_utils.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by load_configuration(), switch_channel_perform_mark_answered(), switch_false(), switch_format_number(), switch_log_str2level(), switch_speex_fmtp_parse(), switch_true(), switch_xml_config_parse_event(), switch_xml_locate_user_merged(), and switch_xml_std_datetime_check().
int switch_isalnum | ( | int | c | ) |
Definition at line 3610 of file switch_utils.c.
int switch_isalpha | ( | int | c | ) |
Definition at line 3615 of file switch_utils.c.
int switch_iscntrl | ( | int | c | ) |
int switch_isdigit | ( | int | c | ) |
int switch_isgraph | ( | int | c | ) |
int switch_islower | ( | int | c | ) |
int switch_isprint | ( | int | c | ) |
int switch_ispunct | ( | int | c | ) |
int switch_isspace | ( | int | c | ) |
int switch_isupper | ( | int | c | ) |
int switch_isxdigit | ( | int | c | ) |
Definition at line 3660 of file switch_utils.c.
char* switch_network_ipv4_mapped_ipv6_addr | ( | const char * | ip_str | ) |
Definition at line 494 of file switch_utils.c.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_perform_add_cidr_token().
switch_status_t switch_network_list_add_cidr_token | ( | switch_network_list_t * | list, |
const char * | cidr_str, | ||
switch_bool_t | ok, | ||
const char * | token | ||
) |
Definition at line 552 of file switch_utils.c.
References switch_assert, switch_network_list_perform_add_cidr_token(), switch_safe_free, switch_separate_string(), and SWITCH_STATUS_SUCCESS.
Referenced by switch_load_network_lists().
switch_status_t switch_network_list_add_host_mask | ( | switch_network_list_t * | list, |
const char * | host, | ||
const char * | mask_str, | ||
switch_bool_t | ok | ||
) |
Definition at line 579 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, switch_network_node::str, switch_core_alloc, switch_core_sprintf(), switch_inet_pton(), SWITCH_STATUS_SUCCESS, and ip_t::v4.
Referenced by switch_load_network_lists().
switch_status_t switch_network_list_create | ( | switch_network_list_t ** | list, |
const char * | name, | ||
switch_bool_t | default_type, | ||
switch_memory_pool_t * | pool | ||
) |
Definition at line 404 of file switch_utils.c.
References switch_network_list::default_type, switch_network_list::name, pool, switch_network_list::pool, switch_core_alloc, switch_core_new_memory_pool, switch_core_strdup, and SWITCH_STATUS_SUCCESS.
Referenced by switch_load_network_lists().
switch_status_t switch_network_list_perform_add_cidr_token | ( | switch_network_list_t * | list, |
const char * | cidr_str, | ||
switch_bool_t | ok, | ||
const char * | token | ||
) |
Definition at line 505 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, switch_network_node::str, SWITCH_CHANNEL_LOG, switch_core_alloc, switch_core_strdup, SWITCH_LOG_ERROR, SWITCH_LOG_NOTICE, switch_log_printf(), switch_network_ipv4_mapped_ipv6_addr(), switch_parse_cidr(), switch_safe_free, SWITCH_STATUS_GENERR, SWITCH_STATUS_SUCCESS, switch_str_nil, switch_network_node::token, and zstr.
Referenced by switch_network_list_add_cidr_token().
switch_bool_t switch_network_list_validate_ip6_token | ( | switch_network_list_t * | list, |
ip_t | ip, | ||
const char ** | token | ||
) |
Definition at line 441 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, SWITCH_FALSE, switch_testv6_subnet(), SWITCH_TRUE, and switch_network_node::token.
Referenced by switch_check_network_list_ip_token().
switch_bool_t switch_network_list_validate_ip_token | ( | switch_network_list_t * | list, |
uint32_t | ip, | ||
const char ** | token | ||
) |
Definition at line 468 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_node::next, switch_network_node::ok, SWITCH_FALSE, switch_test_subnet, SWITCH_TRUE, switch_network_node::token, and ip_t::v4.
Referenced by switch_check_network_list_ip_token().
int switch_number_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 607 of file switch_utils.c.
References switch_copy_string(), switch_inet_pton(), ip_t::v4, and ip_t::v6.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_perform_add_cidr_token().
char* switch_print_host | ( | switch_sockaddr_t * | addr, |
char * | buf, | ||
switch_size_t | len | ||
) |
Definition at line 72 of file switch_utils.c.
References buf, switch_get_addr(), and switch_sockaddr_get_port().
const char* switch_priority_name | ( | switch_priority_t | priority | ) |
Return a printable name of a switch_priority_t.
priority | the priority to get the name of |
Definition at line 1956 of file switch_utils.c.
References SWITCH_PRIORITY_HIGH, SWITCH_PRIORITY_LOW, and SWITCH_PRIORITY_NORMAL.
Referenced by switch_event_set_priority().
char* switch_replace_char | ( | char * | str, |
char | from, | ||
char | to, | ||
switch_bool_t | dup | ||
) |
switch_status_t switch_resolve_host | ( | const char * | host, |
char * | buf, | ||
size_t | buflen | ||
) |
Definition at line 1647 of file switch_utils.c.
References get_addr(), SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
char switch_rfc2833_to_char | ( | int | event | ) |
Return the RFC2833 character based on an event id.
event | the event id to convert |
Definition at line 2327 of file switch_utils.c.
Referenced by handle_rfc2833().
char* switch_separate_paren_args | ( | char * | str | ) |
unsigned int switch_separate_string | ( | char * | buf, |
char | delim, | ||
char ** | array, | ||
unsigned int | arraylen | ||
) |
Definition at line 2636 of file switch_utils.c.
References memset(), separate_string_blank_delim(), and separate_string_char_delim().
Referenced by clean_uri(), switch_http_parse_header(), and switch_network_list_add_cidr_token().
unsigned int switch_separate_string_string | ( | char * | buf, |
char * | delim, | ||
char ** | array, | ||
unsigned int | arraylen | ||
) |
switch_bool_t switch_simple_email | ( | const char * | to, |
const char * | from, | ||
const char * | headers, | ||
const char * | body, | ||
const char * | file, | ||
const char * | convert_cmd, | ||
const char * | convert_ext | ||
) |
Definition at line 981 of file switch_utils.c.
References B64BUFFLEN, buf, filename, in, switch_runtime::mailer_app, switch_runtime::mailer_app_args, O_BINARY, runtime, switch_b64_table, SWITCH_CHANNEL_LOG, switch_core_mime_ext2type(), switch_cut_path(), switch_epoch_time_now(), SWITCH_FALSE, SWITCH_GLOBAL_dirs, SWITCH_LOG_DEBUG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_LOG_WARNING, switch_mprintf(), SWITCH_PATH_SEPARATOR, switch_safe_free, switch_snprintf(), switch_stristr(), switch_system(), SWITCH_TRUE, switch_util_quote_shell_arg(), switch_directories::temp_dir, write_buf(), and zstr.
Referenced by email().
int switch_socket_waitfor | ( | switch_pollfd_t * | poll, |
int | ms | ||
) |
Wait for a socket.
poll | the pollfd to wait on |
ms | the number of milliseconds to wait |
Definition at line 3193 of file switch_utils.c.
References switch_poll().
void switch_split_date | ( | const char * | exp, |
int * | year, | ||
int * | month, | ||
int * | day | ||
) |
Definition at line 3306 of file switch_utils.c.
References switch_assert, and switch_safe_free.
Referenced by switch_fulldate_cmp().
void switch_split_time | ( | const char * | exp, |
int * | hour, | ||
int * | min, | ||
int * | sec | ||
) |
Definition at line 3273 of file switch_utils.c.
References switch_assert, and switch_safe_free.
Referenced by switch_fulldate_cmp().
int switch_split_user_domain | ( | char * | in, |
char ** | user, | ||
char ** | domain | ||
) |
Split a user string as user and domain.
in | the input string |
user | the string to put the user into |
domain | the string to put the domain into |
Definition at line 3848 of file switch_utils.c.
References in.
switch_time_t switch_str_time | ( | const char * | in | ) |
Converts a string representation of a date into a switch_time_t.
in | the string |
Definition at line 1890 of file switch_utils.c.
References switch_micro_time_now(), switch_regex_copy_substring(), switch_regex_perform(), switch_regex_safe_free, switch_time_exp_get(), switch_time_exp_gmt_get(), switch_time_exp_lt(), switch_time_exp_t::tm_gmtoff, switch_time_exp_t::tm_hour, switch_time_exp_t::tm_isdst, switch_time_exp_t::tm_mday, switch_time_exp_t::tm_min, switch_time_exp_t::tm_mon, switch_time_exp_t::tm_sec, switch_time_exp_t::tm_usec, and switch_time_exp_t::tm_year.
int switch_strcasecmp_any | ( | const char * | str, |
... | |||
) |
Definition at line 339 of file switch_utils.c.
char* switch_strerror_r | ( | int | errnum, |
char * | buf, | ||
switch_size_t | buflen | ||
) |
Portable version of strerror_r(), work around for the incompatible return type of GNU and XSI variants.
[in] | errnum | Error number |
both] | buf Buffer for error message | |
[in] | buflen | Size of message buffer |
Definition at line 3940 of file switch_utils.c.
References buf, switch_copy_string(), and switch_snprintf().
Referenced by reincarnate_protect(), and rtp_common_read().
switch_status_t switch_string_match | ( | const char * | string, |
size_t | string_len, | ||
const char * | search, | ||
size_t | search_len | ||
) |
Definition at line 2677 of file switch_utils.c.
References SWITCH_STATUS_FALSE, and SWITCH_STATUS_SUCCESS.
Referenced by switch_string_replace().
char* switch_string_replace | ( | const char * | string, |
const char * | search, | ||
const char * | replace | ||
) |
Definition at line 2694 of file switch_utils.c.
References switch_assert, SWITCH_STATUS_SUCCESS, and switch_string_match().
Referenced by switch_channel_set_timestamps(), switch_core_set_globals(), and switch_core_sqldb_start().
char* switch_strip_commas | ( | char * | in, |
char * | out, | ||
switch_size_t | len | ||
) |
char* switch_strip_nonnumerics | ( | char * | in, |
char * | out, | ||
switch_size_t | len | ||
) |
char* switch_strip_spaces | ( | char * | str, |
switch_bool_t | dup | ||
) |
Definition at line 1333 of file switch_utils.c.
References switch_assert, SWITCH_BLANK_STRING, and zstr.
char* switch_strip_whitespace | ( | const char * | str | ) |
Definition at line 1301 of file switch_utils.c.
References switch_assert, SWITCH_BLANK_STRING, and zstr.
Referenced by switch_api_execute().
const char* switch_stristr | ( | const char * | instr, |
const char * | str | ||
) |
Definition at line 1479 of file switch_utils.c.
References switch_toupper().
Referenced by audio_bridge_thread(), check_ice(), core_event_handler(), do_chat_send(), find_pt(), inherit_codec(), init_upnp(), main(), preprocess(), speech_thread(), switch_cache_db_execute_sql_real(), switch_core_gen_certs(), switch_core_gen_encoded_silence(), switch_core_media_check_outgoing_proxy(), switch_core_media_negotiate_sdp(), switch_core_media_parse_rtp_bugs(), switch_core_media_patch_sdp(), switch_core_media_proxy_remote_addr(), switch_core_media_toggle_hold(), switch_core_session_check_incoming_crypto(), switch_core_session_findall_matching_var(), switch_core_sqldb_start(), switch_ivr_originate(), switch_odbc_handle_exec(), switch_pgsql_finish_results_real(), switch_pgsql_handle_exec_base_detailed(), and switch_simple_email().
switch_bool_t switch_testv6_subnet | ( | ip_t | _ip, |
ip_t | _net, | ||
ip_t | _mask | ||
) |
Definition at line 428 of file switch_utils.c.
References IN6_AND_MASK, and SWITCH_TRUE.
Referenced by switch_check_network_list_ip_token(), and switch_network_list_validate_ip6_token().
int switch_tod_cmp | ( | const char * | exp, |
int | val | ||
) |
Definition at line 3784 of file switch_utils.c.
References cur, switch_assert, and switch_safe_free.
Referenced by switch_xml_std_datetime_check().
char* switch_url_decode | ( | char * | s | ) |
Definition at line 3252 of file switch_utils.c.
References zstr.
Referenced by switch_core_session_request_xml(), and switch_http_parse_qs().
char* switch_url_encode | ( | const char * | url, |
char * | buf, | ||
size_t | len | ||
) |
Definition at line 3247 of file switch_utils.c.
References SWITCH_FALSE, and switch_url_encode_opt().
Referenced by add_xml_header(), switch_channel_build_param_string(), switch_event_build_param_string(), switch_event_serialize(), switch_ivr_set_json_chan_vars(), and switch_ivr_set_xml_chan_var().
char* switch_url_encode_opt | ( | const char * | url, |
char * | buf, | ||
size_t | len, | ||
switch_bool_t | double_encode | ||
) |
Definition at line 3202 of file switch_utils.c.
References buf, end_of_p, and SWITCH_URL_UNSAFE.
Referenced by switch_url_encode().
char* switch_util_quote_shell_arg | ( | const char * | string | ) |
Quote shell argument.
string | the string to quote (example: a ' b"' c) \return the quoted string (gives: 'a '\'' b"'\'' c' for unices, "a ' b ' c" for MS Windows), should be freed |
Definition at line 2729 of file switch_utils.c.
References switch_util_quote_shell_arg_pool().
Referenced by switch_simple_email().
char* switch_util_quote_shell_arg_pool | ( | const char * | string, |
switch_memory_pool_t * | pool | ||
) |
Quote shell argument, allocating from pool if provided.
string | the string to quote (example: a ' b"' c) |
pool | a memory pool to use |
Definition at line 2734 of file switch_utils.c.
References switch_assert, and switch_core_alloc.
Referenced by switch_util_quote_shell_arg().
char* switch_uuid_str | ( | char * | buf, |
switch_size_t | len | ||
) |
Definition at line 3873 of file switch_utils.c.
References buf, switch_snprintf(), switch_uuid_format(), SWITCH_UUID_FORMATTED_LENGTH, and switch_uuid_get().
Referenced by switch_caller_profile_dup(), switch_caller_profile_new(), and switch_core_session_exec().
int switch_wait_sock | ( | switch_os_socket_t | sock, |
uint32_t | ms, | ||
switch_poll_t | flags | ||
) |
Definition at line 2985 of file switch_utils.c.
References switch_errno, switch_errno_is_break(), SWITCH_POLL_ERROR, SWITCH_POLL_READ, SWITCH_POLL_WRITE, and SWITCH_SOCK_INVALID.
Referenced by get_pmp_pubaddr().
int switch_wait_socklist | ( | switch_waitlist_t * | waitlist, |
uint32_t | len, | ||
uint32_t | ms | ||
) |
Definition at line 3081 of file switch_utils.c.
References switch_errno, switch_errno_is_break(), SWITCH_POLL_ERROR, SWITCH_POLL_READ, SWITCH_POLL_WRITE, and SWITCH_SOCK_INVALID.
|
static |
|
static |
Definition at line 969 of file switch_utils.c.
Referenced by switch_ivr_record_file(), and switch_simple_email().
const int _switch_C_ctype_[1+SWITCH_CTYPE_NUM_CHARS] |
Definition at line 3570 of file switch_utils.c.
const short _switch_C_tolower_[1+SWITCH_CTYPE_NUM_CHARS] |
Definition at line 3471 of file switch_utils.c.
const short _switch_C_toupper_[1+SWITCH_CTYPE_NUM_CHARS] |
Definition at line 3424 of file switch_utils.c.
const int* _switch_ctype_ = _switch_C_ctype_ |
Definition at line 3608 of file switch_utils.c.
const short* _switch_tolower_tab_ = _switch_C_tolower_ |
Definition at line 3507 of file switch_utils.c.
const short* _switch_toupper_tab_ = _switch_C_toupper_ |
Definition at line 3460 of file switch_utils.c.
|
static |
Definition at line 3664 of file switch_utils.c.
|
static |
Definition at line 1970 of file switch_utils.c.
|
static |
Definition at line 888 of file switch_utils.c.
Referenced by switch_b64_decode(), switch_b64_encode(), and switch_simple_email().