42 #include <apr_atomic.h>
43 #include <apr_pools.h>
45 #include <apr_network_io.h>
46 #include <apr_errno.h>
47 #include <apr_thread_proc.h>
48 #include <apr_portable.h>
49 #include <apr_thread_mutex.h>
50 #include <apr_thread_cond.h>
51 #include <apr_thread_rwlock.h>
52 #include <apr_file_io.h>
54 #include <apr_strings.h>
55 #define APR_WANT_STDIO
56 #define APR_WANT_STRFUNC
58 #include <apr_file_info.h>
59 #include <apr_fnmatch.h>
60 #include <apr_tables.h>
66 #include <apr_queue.h>
74 return APR_STATUS_IS_TIMEUP(status);
82 return apr_os_thread_current();
91 return (tid1 == tid2);
93 return apr_os_thread_equal(tid1, tid2);
100 unsigned int hash = 0;
101 const unsigned char *key = (
const unsigned char *) char_key;
102 const unsigned char *p;
105 if (*klen == APR_HASH_KEY_STRING) {
106 for (p = key; *p; p++) {
107 hash = hash * 33 + tolower(*p);
111 for (p = key, i = *klen; i; i--, p++) {
112 hash = hash * 33 + tolower(*p);
122 return apr_hashfunc_default(key, klen);
129 const char *p = format;
176 return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
181 return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
188 va_start(ap, format);
189 ret = apr_vsnprintf(buf, len, format, ap);
196 return apr_vsnprintf(buf, len, format, ap);
207 return apr_cpystrn(dst, src, dst_size);
214 return apr_thread_rwlock_create(rwlock, pool);
219 return apr_thread_rwlock_destroy(rwlock);
224 return apr_thread_rwlock_pool_get(rwlock);
229 return apr_thread_rwlock_rdlock(rwlock);
234 return apr_thread_rwlock_tryrdlock(rwlock);
239 return apr_thread_rwlock_wrlock(rwlock);
244 return apr_thread_rwlock_trywrlock(rwlock);
249 int sanity = timeout * 2;
265 return apr_thread_rwlock_unlock(rwlock);
277 return apr_thread_mutex_create(lock, flags, pool);
282 return apr_thread_mutex_destroy(lock);
287 return apr_thread_mutex_lock(lock);
292 return apr_thread_mutex_unlock(lock);
297 return apr_thread_mutex_trylock(lock);
304 #if defined(HAVE_CLOCK_GETTIME) && defined(SWITCH_USE_CLOCK_FUNCS)
306 clock_gettime(CLOCK_REALTIME, &ts);
307 return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000);
315 return apr_time_exp_gmt_get((apr_time_t *) result, (apr_time_exp_t *) input);
320 return apr_time_exp_get((apr_time_t *) result, (apr_time_exp_t *) input);
325 return apr_time_exp_lt((apr_time_exp_t *) result, input);
330 return apr_time_exp_tz((apr_time_exp_t *) result, input, (apr_int32_t) offs);
335 return apr_time_exp_gmt((apr_time_exp_t *) result, input);
340 return apr_rfc822_date(date_str, t);
352 return apr_thread_cond_create(cond, pool);
357 return apr_thread_cond_wait(cond, mutex);
362 apr_status_t st = apr_thread_cond_timedwait(cond, mutex, timeout);
364 if (st == APR_TIMEUP) {
373 return apr_thread_cond_signal(cond);
378 return apr_thread_cond_broadcast(cond);
383 return apr_thread_cond_destroy(cond);
391 return apr_file_open(newf, fname, flag, perm, pool);
397 apr_off_t off = (apr_off_t) (*offset);
398 rv = apr_file_seek(thefile, where, &off);
399 *offset = (int64_t) off;
405 return apr_file_copy(from_path, to_path, perms, pool);
411 return apr_file_close(thefile);
416 return apr_file_trunc(thefile, offset);
421 return apr_file_lock(thefile, type);
426 return apr_file_rename(from_path, to_path, pool);
431 return apr_file_remove(path, pool);
436 return apr_file_read(thefile, buf, nbytes);
441 return apr_file_write(thefile, buf, nbytes);
450 va_start(ap, format);
465 return apr_file_mktemp(thefile, templ, flags, pool);
470 struct apr_finfo_t finfo;
476 apr_dir_t *dir_handle;
485 if ((status = apr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) {
486 apr_dir_close(dir_handle);
498 int32_t wanted = APR_FINFO_TYPE;
501 apr_finfo_t info = { 0 };
503 if (
zstr(filename)) {
511 apr_stat(&info, filename, wanted, pool ? pool : our_pool);
512 if (info.filetype != APR_NOFILE) {
525 return apr_dir_make(path, perm, pool);
530 return apr_dir_make_recursive(path, perm, pool);
548 memset(dir, 0,
sizeof(*dir));
549 if ((status = apr_dir_open(&(dir->
dir_handle), dirname, pool)) == APR_SUCCESS) {
570 apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
573 apr_dir_rewind(thedir->dir_handle);
577 if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) {
581 if (!(name = thedir->finfo.fname)) {
582 name = thedir->finfo.name;
590 apr_dir_rewind(thedir->dir_handle);
597 const char *fname = NULL;
598 apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
603 if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) {
607 if (!(name = thedir->finfo.fname)) {
608 name = thedir->finfo.name;
636 apr_size_t stacksize;
657 return apr_threadattr_detach_set(attr, on);
662 return apr_threadattr_stacksize_set(attr, stacksize);
668 attr->priority = priority;
679 return apr_thread_create(new_thread, attr, func, data, cont);
691 return apr_os_sock_get(thesock, sock);
696 return apr_os_sock_put(sock, thesock, pool);
701 return apr_socket_addr_get(sa, (apr_interface_e) remote, sock);
706 return apr_socket_create(new_sock, family, type, protocol, pool);
711 return apr_socket_shutdown(sock, (apr_shutdown_how_e) how);
716 return apr_socket_close(sock);
721 return apr_socket_bind(sock, sa);
726 return apr_socket_listen(sock, backlog);
731 return apr_socket_accept(new_sock, sock, pool);
736 return apr_socket_connect(sock, sa);
747 status = apr_socket_send(sock, buf + wrote, &need);
749 if (++to_count > 60000) {
766 if (!sock || !buf || !len) {
770 return apr_socket_send(sock, buf, len);
776 if (!where || !buf || !len || !*len) {
779 return apr_socket_sendto(sock, where, flags, buf, len);
786 r = apr_socket_recv(sock, buf, len);
788 if (r == 35 || r == 730035) {
798 unsigned short family = APR_INET;
800 new_sa = apr_pcalloc(pool,
sizeof(apr_sockaddr_t));
803 memset(new_sa, 0,
sizeof(*new_sa));
805 new_sa->family = family;
806 new_sa->sa.sin.sin_family = family;
808 new_sa->salen =
sizeof(
struct sockaddr_in);
809 new_sa->addr_str_len = 16;
810 new_sa->ipaddr_ptr = &(new_sa->sa.sin.sin_addr);
811 new_sa->ipaddr_len =
sizeof(
struct in_addr);
820 return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
828 #if defined(TCP_KEEPIDLE)
829 r = setsockopt(jsock->client_socket, SOL_TCP, TCP_KEEPIDLE, (
void *)&on,
sizeof(on));
842 #if defined(TCP_KEEPINTVL)
843 r = setsockopt(jsock->client_socket, SOL_TCP, TCP_KEEPINTVL, (
void *)&on,
sizeof(on));
853 return apr_socket_opt_set(sock, opt, on);
858 return apr_socket_timeout_set(sock, t);
863 return apr_sockaddr_ip_get(addr, sa);
868 return apr_sockaddr_equal(sa1, sa2);
873 return apr_mcast_join(sock, join, iface, source);
878 return apr_mcast_hops(sock, ttl);
883 return apr_mcast_loopback(sock, opt);
888 return apr_mcast_interface(sock, iface);
902 if (in->family == AF_INET) {
903 get_addr(buf, len, (
struct sockaddr *) &in->sa, in->salen);
907 get_addr6(buf, len, (
struct sockaddr_in6 *) &in->sa, in->salen);
913 return apr_socket_fd_get(sock);
928 return apr_getnameinfo(hostname, sa, flags);
933 return apr_socket_atmark(sock, atmark);
940 if (from && sock && (r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
941 from->port = ntohs(from->sa.sin.sin_port);
947 if (r == 35 || r == 730035) {
958 return apr_pollset_create(pollset, size, pool, flags);
963 if (!pollset || !descriptor) {
967 return apr_pollset_add((apr_pollset_t *) pollset, (
const apr_pollfd_t *) descriptor);
972 if (!pollset || !descriptor) {
976 return apr_pollset_remove((apr_pollset_t *) pollset, (
const apr_pollfd_t *) descriptor);
981 if (!pollfd || !sock) {
992 (*pollfd)->reqevents = flags;
993 (*pollfd)->desc.s = sock;
994 (*pollfd)->client_data = client_data;
1005 st = apr_pollset_poll((apr_pollset_t *) pollset, timeout, num, (
const apr_pollfd_t **) descriptors);
1007 if (st == APR_TIMEUP) {
1020 st = apr_poll((apr_pollfd_t *) aprset, numsock, nsds, timeout);
1022 if (numsock == 1 && ((aprset[0].rtnevents & APR_POLLERR) || (aprset[0].rtnevents & APR_POLLHUP) || (aprset[0].rtnevents & APR_POLLNVAL))) {
1024 }
else if (st == APR_TIMEUP) {
1058 apr_uuid_format(buffer, (
const apr_uuid_t *) uuid);
1061 UuidToString((
const UUID *) uuid, &buf);
1062 strcpy(buffer, (
const char *) buf);
1063 RpcStringFree(&buf);
1071 apr_uuid_get((apr_uuid_t *) uuid);
1073 UuidCreate((UUID *) uuid);
1081 return apr_uuid_parse((apr_uuid_t *) uuid, uuid_str);
1083 return UuidFromString((RPC_CSTR) uuid_str, (UUID *) uuid);
1089 return apr_md5(digest, input, inputLen);
1095 apr_status_t status = apr_md5(digest, input, inputLen);
1098 digest_str[SWITCH_MD5_DIGEST_STRING_SIZE - 1] =
'\0';
1111 return apr_queue_create(queue, queue_capacity, pool);
1116 return apr_queue_size(queue);
1121 return apr_queue_pop(queue, data);
1126 return apr_queue_pop_timeout(queue, data, timeout);
1134 s = apr_queue_push(queue, data);
1135 }
while (s == APR_EINTR);
1142 return apr_queue_trypop(queue, data);
1147 return apr_queue_interrupt_all(queue);
1152 return apr_queue_term(queue);
1160 s = apr_queue_trypush(queue, data);
1161 }
while (s == APR_EINTR);
1168 #ifdef HAVE_VASPRINTF
1169 return vasprintf(ret, fmt, ap);
1178 #if _MSC_VER >= 1500
1180 __analysis_assume(tmp);
1187 len = vsnprintf(tmp, 0, fmt, ap2);
1189 if (len > 0 && (buf = malloc((buflen = (
size_t) (len + 1)))) != NULL) {
1190 len = vsnprintf(buf, buflen, fmt, ap);
1204 return apr_match_glob(pattern, (apr_array_header_t **) result, pool);
1215 return apr_file_pipe_create((apr_file_t **) in, (apr_file_t **) out, pool);
1225 return apr_file_pipe_timeout_get((apr_file_t *) thepipe, (apr_interval_time_t *) timeout);
1236 return apr_file_pipe_timeout_set((apr_file_t *) thepipe, (apr_interval_time_t) timeout);
1247 return apr_thread_exit((apr_thread_t *) thd, retval);
1262 return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd);
1268 return apr_atomic_init((apr_pool_t *) pool);
1274 return apr_atomic_read((apr_atomic_t *)mem);
1276 return apr_atomic_read32((apr_uint32_t *)mem);
1283 apr_atomic_set((apr_atomic_t *)mem, val);
1285 apr_atomic_set32((apr_uint32_t *)mem, val);
1292 apr_atomic_add((apr_atomic_t *)mem, val);
1294 apr_atomic_add32((apr_uint32_t *)mem, val);
1301 apr_atomic_inc((apr_atomic_t *)mem);
1303 apr_atomic_inc32((apr_uint32_t *)mem);
1310 return apr_atomic_dec((apr_atomic_t *)mem);
1312 return apr_atomic_dec32((apr_uint32_t *)mem);
1318 return apr_strerror(statcode, buf, bufsize);
struct apr_queue_t switch_queue_t
switch_status_t switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa)
unsigned int switch_queue_size(switch_queue_t *queue)
#define SWITCH_MUTEX_DEFAULT
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
switch_status_t switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_directory_exists(const char *dirname, switch_memory_pool_t *pool)
switch_status_t switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
switch_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool)
uint16_t switch_sockaddr_get_port(switch_sockaddr_t *sa)
switch_status_t switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes)
switch_status_t switch_mutex_destroy(switch_mutex_t *lock)
#define SWITCH_CHANNEL_LOG
int switch_status_is_timeup(int status)
switch_status_t switch_mutex_trylock(switch_mutex_t *lock)
switch_status_t switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input)
switch_status_t switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa)
switch_status_t switch_mcast_hops(switch_socket_t *sock, uint8_t ttl)
switch_status_t switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout)
switch_status_t switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
switch_status_t switch_atomic_init(switch_memory_pool_t *pool)
char * switch_copy_string(char *dst, const char *src, switch_size_t dst_size)
switch_status_t switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
switch_status_t switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t)
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
switch_memory_pool_t * pool
void switch_atomic_inc(volatile switch_atomic_t *mem)
switch_status_t switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
#define SWITCH_SO_TCP_KEEPIDLE
switch_status_t switch_queue_trypop(switch_queue_t *queue, void **data)
int32_t switch_sockaddr_get_family(switch_sockaddr_t *sa)
switch_status_t switch_pollset_remove(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
unsigned int switch_ci_hashfunc_default(const char *char_key, switch_ssize_t *klen)
switch_status_t switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout)
switch_status_t switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset)
switch_status_t switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
switch_status_t switch_os_sock_get(switch_os_socket_t *thesock, switch_socket_t *sock)
#define SWITCH_MD5_DIGEST_STRING_SIZE
switch_status_t switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
switch_status_t switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len)
switch_status_t switch_queue_pop(switch_queue_t *queue, void **data)
int switch_socket_fd_get(switch_socket_t *sock)
switch_status_t switch_strftime_nocheck(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
struct switch_runtime runtime
switch_status_t switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock)
switch_status_t switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
struct apr_thread_cond_t switch_thread_cond_t
struct apr_pollset_t switch_pollset_t
switch_status_t switch_file_remove(const char *path, switch_memory_pool_t *pool)
int switch_atomic_dec(volatile switch_atomic_t *mem)
switch_status_t switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str)
switch_status_t switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len)
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
switch_status_t switch_thread_exit(switch_thread_t *thd, switch_status_t retval)
switch_status_t switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
switch_status_t switch_file_rename(const char *from_path, const char *to_path, switch_memory_pool_t *pool)
#define SWITCH_MUTEX_NESTED
int switch_file_printf(switch_file_t *thefile, const char *format,...)
switch_status_t switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool)
switch_status_t switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
switch_byte_t switch_byte_t * buf
#define switch_yield(ms)
Wait a desired number of microseconds and yield the CPU.
switch_status_t switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa)
switch_status_t switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len)
struct apr_sockaddr_t switch_sockaddr_t
switch_status_t switch_thread_cond_destroy(switch_thread_cond_t *cond)
switch_thread_id_t switch_thread_self(void)
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
switch_status_t switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *pool)
switch_status_t switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
switch_status_t switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool)
void switch_atomic_set(volatile switch_atomic_t *mem, uint32_t val)
switch_status_t switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout)
switch_status_t switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool)
switch_status_t switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_socket_listen(switch_socket_t *sock, int32_t backlog)
struct apr_thread_rwlock_t switch_thread_rwlock_t
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
#define SWITCH_BLANK_STRING
switch_status_t switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on)
switch_status_t switch_md5(unsigned char digest[SWITCH_MD5_DIGESTSIZE], const void *input, switch_size_t inputLen)
switch_status_t switch_socket_atmark(switch_socket_t *sock, int *atmark)
switch_status_t switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
switch_byte_t switch_byte_t uint32_t buflen
switch_status_t switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool)
switch_status_t switch_mcast_interface(switch_socket_t *sock, switch_sockaddr_t *iface)
pthread_t switch_thread_id_t
switch_status_t switch_rfc822_date(char *date_str, switch_time_t t)
int64_t switch_interval_time_t
struct apr_file_t switch_file_t
switch_status_t switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout)
int32_t switch_fileperms_t
switch_status_t switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes)
const char * switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len)
switch_status_t switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs)
switch_status_t switch_thread_cond_signal(switch_thread_cond_t *cond)
switch_status_t switch_pollset_poll(switch_pollset_t *pollset, switch_interval_time_t timeout, int32_t *num, const switch_pollfd_t **descriptors)
switch_status_t switch_mcast_loopback(switch_socket_t *sock, uint8_t opt)
switch_status_t switch_file_exists(const char *filename, switch_memory_pool_t *pool)
char * switch_strerror(switch_status_t statcode, char *buf, switch_size_t bufsize)
void switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
switch_status_t switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
struct apr_thread_mutex_t switch_mutex_t
switch_thread_rwlock_t * rwlock
switch_status_t switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool)
switch_status_t
Common return values.
#define SWITCH_SO_TCP_KEEPINTVL
switch_status_t switch_file_trunc(switch_file_t *thefile, int64_t offset)
int switch_vasprintf(char **ret, const char *fmt, va_list ap)
switch_status_t switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
switch_status_t switch_socket_create_pollset(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool)
Create a set of file descriptors to poll from a socket.
switch_status_t switch_socket_close(switch_socket_t *sock)
switch_status_t switch_queue_interrupt_all(switch_queue_t *queue)
void *SWITCH_THREAD_FUNC * switch_thread_start_t(switch_thread_t *, void *)
void switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)
switch_status_t switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how)
char * get_addr(char *buf, switch_size_t len, struct sockaddr *sa, socklen_t salen)
find the char representation of an ip adress
struct apr_thread_t switch_thread_t
switch_status_t switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool)
unsigned int switch_hashfunc_default(const char *key, switch_ssize_t *klen)
void switch_uuid_get(switch_uuid_t *uuid)
switch_status_t switch_file_lock(switch_file_t *thefile, int type)
uint32_t switch_dir_count(switch_dir_t *thedir)
switch_status_t switch_queue_trypush(switch_queue_t *queue, void *data)
switch_status_t switch_file_pipe_create(switch_file_t **in, switch_file_t **out, switch_memory_pool_t *pool)
switch_status_t switch_socket_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len)
switch_status_t switch_queue_term(switch_queue_t *queue)
char * get_addr6(char *buf, switch_size_t len, struct sockaddr_in6 *sa, socklen_t salen)
switch_status_t switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source)
switch_status_t switch_queue_push(switch_queue_t *queue, void *data)
switch_mutex_t * uuid_mutex
struct apr_pool_t switch_memory_pool_t
switch_interval_time_t switch_interval_time_from_timeval(struct timeval *tvp)
switch_status_t switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
switch_status_t switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
switch_status_t switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
switch_status_t switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr, switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
uint32_t switch_atomic_read(volatile switch_atomic_t *mem)
switch_time_t switch_time_make(switch_time_t sec, int32_t usec)
switch_status_t switch_thread_rwlock_trywrlock_timeout(switch_thread_rwlock_t *rwlock, int timeout)
switch_status_t switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm, switch_memory_pool_t *pool)
const char * switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in)
switch_status_t switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
switch_status_t switch_thread_cond_broadcast(switch_thread_cond_t *cond)
int switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap)
void switch_atomic_add(volatile switch_atomic_t *mem, uint32_t val)
int switch_thread_equal(switch_thread_id_t tid1, switch_thread_id_t tid2)
Compare two thread ids.
switch_status_t switch_socket_create_pollfd(switch_pollfd_t **pollfd, switch_socket_t *sock, int16_t flags, void *client_data, switch_memory_pool_t *pool)
Create a pollfd out of a socket.
switch_status_t switch_getnameinfo(char **hostname, switch_sockaddr_t *sa, int32_t flags)
switch_status_t switch_file_close(switch_file_t *thefile)
struct apr_socket_t switch_socket_t
switch_time_t switch_time_now(void)
switch_status_t switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool)
int switch_snprintf(char *buf, switch_size_t len, const char *format,...)
switch_memory_pool_t * switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock)
switch_status_t switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags)
#define SWITCH_MD5_DIGESTSIZE
switch_size_t switch_file_get_size(switch_file_t *thefile)
switch_status_t switch_md5_string(char digest_str[SWITCH_MD5_DIGEST_STRING_SIZE], const void *input, switch_size_t inputLen)
switch_status_t switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_dir_close(switch_dir_t *thedir)
switch_status_t switch_socket_addr_get(switch_sockaddr_t **sa, switch_bool_t remote, switch_socket_t *sock)
switch_status_t switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority)
int switch_sockaddr_equal(const switch_sockaddr_t *sa1, const switch_sockaddr_t *sa2)