RTS API Documentation
1.10.11
|
#include <switch.h>
#include "private/switch_apr_pvt.h"
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include "private/switch_core_pvt.h"
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 |
#define | SHA256_LENGTH 32 |
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 | |
void * | switch_calloc (size_t nmemb, size_t size) |
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_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) |
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_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_port_token (switch_network_list_t *list, ip_t ip, int port, const char **token) |
switch_bool_t | is_port_in_node (int port, switch_network_node_t *node) |
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_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) |
char * | switch_network_port_range_to_string (switch_network_port_range_p port) |
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_network_port_range_p port) |
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_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_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_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 (const 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_pool_strip_whitespace (switch_memory_pool_t *pool, const char *str) |
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_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) |
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, switch_bool_t ip_only) |
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) |
static unsigned int | separate_string_char_delim_cheap (const char *buf, char delim, const char **array, unsigned int larray[], unsigned int arraylen) |
static unsigned int | separate_string_blank_delim_cheap (const char *buf, const char **array, unsigned int larray[], unsigned int arraylen) |
unsigned int | switch_separate_string_cheap (const char *buf, char delim, const char **array, unsigned int larray[], 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_core_session_url_encode (switch_core_session_t *session, 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_url_encode (switch_memory_pool_t *pool, const char *url) |
char * | switch_core_url_encode_opt (switch_memory_pool_t *pool, const char *url, switch_bool_t double_encode) |
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) |
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) |
char * | switch_must_strdup (const char *_s) |
const char * | switch_memory_usage_stream (switch_stream_handle_t *stream) |
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) |
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 3936 of file switch_utils.c.
Referenced by switch_isprint().
#define _C 0x20 |
Definition at line 3934 of file switch_utils.c.
Referenced by switch_iscntrl().
#define _L 0x02 |
Definition at line 3930 of file switch_utils.c.
Referenced by switch_isalnum(), switch_isalpha(), switch_isgraph(), switch_islower(), and switch_isprint().
#define _N 0x04 |
Definition at line 3931 of file switch_utils.c.
Referenced by switch_isalnum(), switch_isdigit(), switch_isgraph(), switch_isprint(), and switch_isxdigit().
#define _P 0x10 |
Definition at line 3933 of file switch_utils.c.
#define _S 0x08 |
Definition at line 3932 of file switch_utils.c.
Referenced by switch_isspace().
#define _U 0x01 |
Definition at line 3929 of file switch_utils.c.
Referenced by switch_isalnum(), switch_isalpha(), switch_isgraph(), switch_isprint(), and switch_isupper().
#define _X 0x40 |
Definition at line 3935 of file switch_utils.c.
Referenced by switch_isxdigit().
#define B64BUFFLEN 1024 |
Definition at line 1024 of file switch_utils.c.
Referenced by switch_simple_email().
#define DLINE_BLOCK_SIZE 1024 |
Definition at line 842 of file switch_utils.c.
Referenced by switch_fd_read_dline(), and switch_fp_read_dline().
#define DLINE_MAX_SIZE 1048576 |
Definition at line 843 of file switch_utils.c.
Referenced by switch_fd_read_dline(), and switch_fp_read_dline().
#define ESCAPE_META '\\' |
Definition at line 51 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 | |||
) |
#define SHA256_LENGTH 32 |
Definition at line 4942 of file switch_utils.c.
Referenced by switch_jwt_sign(), and switch_jwt_verify().
#define SWITCH_CTYPE_NUM_CHARS 256 |
Definition at line 3790 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 77 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 4062 of file switch_utils.c.
|
inlinestatic |
Definition at line 4076 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 4378 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 2689 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 141 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 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().
|
static |
Definition at line 1833 of file switch_utils.c.
Referenced by switch_find_local_ip(), and switch_stristr().
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().
switch_bool_t is_port_in_node | ( | int | port, |
switch_network_node_t * | node | ||
) |
Definition at line 524 of file switch_utils.c.
References MAX_NETWORK_PORTS, switch_network_port_range::max_port, switch_network_port_range::min_port, switch_network_port_range::port, switch_network_node::port_range, switch_network_port_range::ports, SWITCH_FALSE, and SWITCH_TRUE.
Referenced by switch_network_list_validate_ip_port_token().
int old_switch_tolower | ( | int | c | ) |
int old_switch_toupper | ( | int | c | ) |
|
static |
Definition at line 2798 of file switch_utils.c.
References buf, cleanup_separated_string(), count, and ESCAPE_META.
Referenced by switch_separate_string().
|
static |
Definition at line 2923 of file switch_utils.c.
Referenced by switch_separate_string_cheap().
|
static |
Definition at line 2755 of file switch_utils.c.
References buf, cleanup_separated_string(), count, and ESCAPE_META.
Referenced by switch_separate_string().
|
static |
Definition at line 2880 of file switch_utils.c.
Referenced by switch_separate_string_cheap().
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.
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().
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().
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().
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 | ||
) |
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 | ( | char * | buf, |
int | len, | ||
int * | mask, | ||
const char * | ifname, | ||
int | family | ||
) |
Definition at line 2032 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 1858 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 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().
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 92 of file switch_utils.c.
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().
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().
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 | ) |
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.
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().
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_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_network_port_range_p | port | ||
) |
Definition at line 619 of file switch_utils.c.
References switch_network_node::bits, switch_network_node::family, switch_network_node::ip, switch_network_node::mask, switch_network_list::name, 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_CHANNEL_LOG, switch_core_alloc, switch_core_strdup, SWITCH_LOG_ERROR, SWITCH_LOG_NOTICE, switch_log_printf(), switch_network_ipv4_mapped_ipv6_addr(), switch_network_port_range_to_string(), 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_port_token().
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().
char* switch_network_port_range_to_string | ( | switch_network_port_range_p | port | ) |
Definition at line 593 of file switch_utils.c.
References buf, MAX_NETWORK_PORTS, switch_network_port_range::max_port, switch_network_port_range::min_port, switch_network_port_range::port, switch_network_port_range::ports, and switch_mprintf().
Referenced by switch_network_list_perform_add_cidr_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().
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().
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.
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().
char* switch_separate_paren_args | ( | char * | str | ) |
unsigned int switch_separate_string | ( | char * | buf, |
char | delim, | ||
char ** | array, | ||
unsigned int | arraylen | ||
) |
Definition at line 2857 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_port_token().
unsigned int switch_separate_string_cheap | ( | const char * | buf, |
char | delim, | ||
const char ** | array, | ||
unsigned int | larray[], | ||
unsigned int | arraylen | ||
) |
Definition at line 2982 of file switch_utils.c.
References memset(), separate_string_blank_delim_cheap(), and separate_string_char_delim_cheap().
unsigned int switch_separate_string_string | ( | char * | buf, |
char * | delim, | ||
char ** | array, | ||
unsigned int | arraylen | ||
) |
Definition at line 2734 of file switch_utils.c.
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.
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().
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().
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().
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().
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().
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().
|
static |
|
static |
Definition at line 1105 of file switch_utils.c.
Referenced by switch_ivr_record_file_event(), and switch_simple_email().
const int _switch_C_ctype_[1+SWITCH_CTYPE_NUM_CHARS] |
Definition at line 3938 of file switch_utils.c.
const short _switch_C_tolower_[1+SWITCH_CTYPE_NUM_CHARS] |
Definition at line 3839 of file switch_utils.c.
const short _switch_C_toupper_[1+SWITCH_CTYPE_NUM_CHARS] |
Definition at line 3792 of file switch_utils.c.
const int* _switch_ctype_ = _switch_C_ctype_ |
Definition at line 3976 of file switch_utils.c.
const short* _switch_tolower_tab_ = _switch_C_tolower_ |
Definition at line 3875 of file switch_utils.c.
const short* _switch_toupper_tab_ = _switch_C_toupper_ |
Definition at line 3828 of file switch_utils.c.
|
static |
Definition at line 4032 of file switch_utils.c.
|
static |
Definition at line 2187 of file switch_utils.c.
Referenced by switch_char_to_rfc2833(), and switch_rfc2833_to_char().
|
static |
Definition at line 1023 of file switch_utils.c.
Referenced by switch_b64_decode(), switch_b64_encode(), and switch_simple_email().