127 #define SWITCH_HASH_KEY_STRING (-1)
317 #define SWITCH_MUTEX_DEFAULT 0x0
318 #define SWITCH_MUTEX_NESTED 0x1
319 #define SWITCH_MUTEX_UNNESTED 0x2
540 unsigned char data[16];
545 #define SWITCH_UUID_FORMATTED_LENGTH 256
547 #define SWITCH_MD5_DIGESTSIZE 16
548 #define SWITCH_MD5_DIGEST_STRING_SIZE 33
697 #define SWITCH_SEEK_SET SEEK_SET
699 #define SWITCH_SEEK_CUR SEEK_CUR
701 #define SWITCH_SEEK_END SEEK_END
711 #define SWITCH_FPROT_USETID 0x8000
712 #define SWITCH_FPROT_UREAD 0x0400
713 #define SWITCH_FPROT_UWRITE 0x0200
714 #define SWITCH_FPROT_UEXECUTE 0x0100
716 #define SWITCH_FPROT_GSETID 0x4000
717 #define SWITCH_FPROT_GREAD 0x0040
718 #define SWITCH_FPROT_GWRITE 0x0020
719 #define SWITCH_FPROT_GEXECUTE 0x0010
721 #define SWITCH_FPROT_WSTICKY 0x2000
722 #define SWITCH_FPROT_WREAD 0x0004
723 #define SWITCH_FPROT_WWRITE 0x0002
724 #define SWITCH_FPROT_WEXECUTE 0x0001
726 #define SWITCH_FPROT_OS_DEFAULT 0x0FFF
729 #define SWITCH_FPROT_FILE_SOURCE_PERMS 0x1000
738 #define SWITCH_FLOCK_SHARED 1
744 #define SWITCH_FLOCK_EXCLUSIVE 2
749 #define SWITCH_FLOCK_TYPEMASK 0x000F
750 #define SWITCH_FLOCK_NONBLOCK 0x0010
760 #define SWITCH_FOPEN_READ 0x00001
761 #define SWITCH_FOPEN_WRITE 0x00002
762 #define SWITCH_FOPEN_CREATE 0x00004
763 #define SWITCH_FOPEN_APPEND 0x00008
764 #define SWITCH_FOPEN_TRUNCATE 0x00010
765 #define SWITCH_FOPEN_BINARY 0x00020
766 #define SWITCH_FOPEN_EXCL 0x00040
767 #define SWITCH_FOPEN_BUFFERED 0x00080
768 #define SWITCH_FOPEN_DELONCLOSE 0x00100
769 #define SWITCH_FOPEN_XTHREAD 0x00200
770 #define SWITCH_FOPEN_SHARELOCK 0x00400
771 #define SWITCH_FOPEN_NOCLEANUP 0x00800
772 #define SWITCH_FOPEN_SENDFILE_ENABLED 0x01000
773 #define SWITCH_FOPEN_LARGEFILE 0x04000
982 #define SWITCH_SO_LINGER 1
983 #define SWITCH_SO_KEEPALIVE 2
984 #define SWITCH_SO_DEBUG 4
985 #define SWITCH_SO_NONBLOCK 8
986 #define SWITCH_SO_REUSEADDR 16
987 #define SWITCH_SO_SNDBUF 64
988 #define SWITCH_SO_RCVBUF 128
989 #define SWITCH_SO_DISCONNECTED 256
990 #define SWITCH_SO_TCP_NODELAY 512
991 #define SWITCH_SO_TCP_KEEPIDLE 520
992 #define SWITCH_SO_TCP_KEEPINTVL 530
1000 #define SWITCH_INET AF_INET
1002 #define SWITCH_INET6 AF_INET6
1004 #define SWITCH_INET6 0
1011 #define SWITCH_UNSPEC AF_UNSPEC
1013 #define SWITCH_UNSPEC 0
1032 #define SWITCH_PROTO_TCP 6
1033 #define SWITCH_PROTO_UDP 17
1034 #define SWITCH_PROTO_SCTP 132
1312 #define SWITCH_POLLIN 0x001
1313 #define SWITCH_POLLPRI 0x002
1314 #define SWITCH_POLLOUT 0x004
1315 #define SWITCH_POLLERR 0x010
1316 #define SWITCH_POLLHUP 0x020
1317 #define SWITCH_POLLNVAL 0x040
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)
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)
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)
#define SWITCH_END_EXTERN_C
switch_status_t switch_mcast_hops(switch_socket_t *sock, uint8_t ttl)
void switch_sleep(switch_interval_time_t t)
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)
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)
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)
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)
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
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
SWITCH_BEGIN_EXTERN_C int switch_status_is_timeup(int status)
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)
struct switch_time_exp_t switch_time_exp_t
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)
void switch_micro_sleep(switch_interval_time_t t)
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
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_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)
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)
void switch_core_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val)
Gets the key and value of the current hash element.
void switch_pool_clear(switch_memory_pool_t *pool)
int switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap)
switch_status_t switch_socket_atmark(switch_socket_t *sock, int *atmark)
switch_hash_index_t * switch_core_hash_next(_In_ switch_hash_index_t **hi)
Gets the next element of a hashtable.
switch_status_t switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
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)
char * switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size)
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)
int switch_thread_equal(switch_thread_id_t tid1, switch_thread_id_t tid2)
Compare two thread ids.
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.
switch_status_t switch_file_trunc(switch_file_t *thefile, int64_t offset)
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 *)
switch_status_t switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how)
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)
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)
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)
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_thread_id_t switch_thread_self(void)
switch_pollset_type_t desc_type
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)
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)
switch_memory_pool_t * switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock)
#define switch_core_hash_first(_h)
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)
#define SWITCH_BEGIN_EXTERN_C
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)