78 if ((start % 2) != 0) {
87 if ((start % 2) == 0) {
100 if (!(even && odd)) {
113 *new_allocator = alloc;
163 if (alloc->
track[index] < 0) {
171 if (tries < alloc->track_len) {
225 if (port < alloc->
start) {
229 index = port - alloc->
start;
231 if (!(even && odd)) {
236 if (alloc->
track[index] > 0) {
switch_time_t switch_micro_time_now(void)
Get the current epoch time in microseconds.
switch_status_t switch_core_port_allocator_new(const char *ip, switch_port_t start, switch_port_t end, switch_port_flag_t flags, switch_core_port_allocator_t **new_allocator)
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
switch_status_t switch_core_port_allocator_request_port(switch_core_port_allocator_t *alloc, switch_port_t *port_ptr)
#define SWITCH_CHANNEL_LOG
switch_status_t switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa)
switch_memory_pool_t * pool
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
int32_t switch_sockaddr_get_family(switch_sockaddr_t *sa)
void switch_core_port_allocator_destroy(switch_core_port_allocator_t **alloc)
struct switch_runtime runtime
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
#define SWITCH_MUTEX_NESTED
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
#define switch_core_alloc(_pool, _mem)
Allocate memory directly from a memory pool.
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
switch_status_t switch_core_port_allocator_free_port(switch_core_port_allocator_t *alloc, switch_port_t port)
struct fspr_sockaddr_t switch_sockaddr_t
struct fspr_thread_mutex_t switch_mutex_t
switch_status_t switch_sockaddr_new(switch_sockaddr_t **sa, const char *ip, switch_port_t port, switch_memory_pool_t *pool)
static switch_bool_t test_port(switch_core_port_allocator_t *alloc, int type, switch_port_t port)
switch_status_t switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
switch_status_t
Common return values.
switch_status_t switch_socket_close(switch_socket_t *sock)
uint32_t switch_port_flag_t
uint32_t port_alloc_flags
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
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.
struct fspr_pool_t switch_memory_pool_t
switch_thread_id_t switch_thread_self(void)
struct fspr_socket_t switch_socket_t