indent pass 1

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8686 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2008-05-27 04:30:03 +00:00
1 parent 49ff246b7c
commit 3c349c274e
66 files changed
+3258 -3498

No files matched your search

+96 -99
View File
@@ -56,8 +56,6 @@ SWITCH_BEGIN_EXTERN_C
*/
/** The fundamental pool type */
/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/
/**
* Clear all memory in the pool and run all the cleanups. This also destroys all
* subpools.
@@ -93,13 +91,13 @@ SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p);
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
* is the only supported method of loading DSOs today.
*/
SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t ** res_handle, const char *path, switch_memory_pool_t *ctx);
SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, const char *path, switch_memory_pool_t *ctx);
/**
* Close a DSO library.
* @param handle handle to close.
*/
SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t * handle);
SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t *handle);
/**
* Load a symbol from a DSO handle.
@@ -107,7 +105,7 @@ SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t * handle);
* @param handle handle to load the symbol from.
* @param symname Name of the symbol to load.
*/
SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t * ressym, switch_dso_handle_t * handle, const char *symname);
SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t *ressym, switch_dso_handle_t *handle, const char *symname);
/**
* Report more information when a DSO function fails.
@@ -115,7 +113,7 @@ SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t * ressym,
* @param buf Location to store the dso error
* @param bufsize The size of the provided buffer
*/
SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *buf, size_t bufsize);
SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *buf, size_t bufsize);
/** @} */
@@ -125,11 +123,13 @@ SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *b
* @{
*/
SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len)
char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap);
SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size)
char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
/** @} */
@@ -164,7 +164,7 @@ SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z
* progress at the same time.
*/
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t * ht);
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t *ht);
/**
* Continue iterating over the entries in a hash table.
@@ -172,7 +172,7 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p,
* @return a pointer to the updated iteration state. NULL if there are no more
* entries.
*/
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht);
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *ht);
/**
* Get the current entry's details from the iteration state.
@@ -183,11 +183,11 @@ SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht)
* @remark The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
*/
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t * hi, const void **key, switch_ssize_t *klen, void **val);
SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val);
SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t * ht);
SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht);
/** @} */
@@ -258,7 +258,7 @@ SWITCH_DECLARE(switch_time_t) switch_time_now(void);
* @param result the resulting imploded time
* @param input the input exploded time
*/
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result, switch_time_exp_t * input);
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input);
/**
* formats the exploded time according to the format specified
@@ -268,7 +268,7 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result,
* @param format The format for the time string
* @param tm The time to convert
*/
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t * tm);
SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm);
/**
* switch_rfc822_date formats dates in the RFC822
@@ -285,7 +285,7 @@ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t
* @param result the exploded time
* @param input the time to explode
*/
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result, switch_time_t input);
SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input);
/**
* Convert time value from human readable format to a numeric apr_time_t
@@ -293,14 +293,14 @@ SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result,
* @param result the resulting imploded time
* @param input the input exploded time
*/
SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t * result, switch_time_exp_t * input);
SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input);
/**
* convert a time to its human readable components in local timezone
* @param result the exploded time
* @param input the time to explode
*/
SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t * result, switch_time_t input);
SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input);
/**
* Sleep for the specified number of micro-seconds.
@@ -341,27 +341,27 @@ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t);
* it will behave as either a nested or an unnested lock.
*
*/
SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool);
/**
* Destroy the mutex and free the memory associated with the lock.
* @param lock the mutex to destroy.
*/
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t * lock);
SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock);
/**
* Acquire the lock for the given mutex. If the mutex is already locked,
* the current thread will be put to sleep until the lock becomes available.
* @param lock the mutex on which to acquire the lock.
*/
SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t * lock);
SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock);
/**
* Release the lock for the given mutex.
* @param lock the mutex from which to release the lock.
*/
SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t * lock);
SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock);
/**
* Attempt to acquire the lock for the given mutex. If the mutex has already
@@ -370,7 +370,7 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t * lock);
* if the return value was APR_EBUSY, for portability reasons.
* @param lock the mutex on which to attempt the lock acquiring.
*/
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock);
SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock);
/** @} */
@@ -383,14 +383,14 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock);
/** Opaque structure used for the rwlock */
typedef struct apr_thread_rwlock_t switch_thread_rwlock_t;
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t * rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock);
SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock);
SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock);
/** @} */
@@ -416,7 +416,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock
* will be stored.
* @param pool the pool from which to allocate the mutex.
*/
SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool);
/**
* Put the active calling thread to sleep until signaled to wake up. Each
@@ -430,7 +430,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t *
* is released while the thread is asleep, and is again acquired before
* returning from this function.
*/
SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t * cond, switch_mutex_t * mutex);
SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex);
/**
* Put the active calling thread to sleep until signaled to wake up or
@@ -448,7 +448,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t * c
* will wake up before this time, otherwise the error APR_TIMEUP
* is returned.
*/
SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t * cond, switch_mutex_t * mutex, switch_interval_time_t timeout);
SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout);
/**
* Signals a single thread, if one exists, that is blocking on the given
@@ -457,7 +457,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_
* is desired, that mutex must be locked while calling this function.
* @param cond the condition variable on which to produce the signal.
*/
SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t * cond);
SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond);
/**
* Signals all threads blocking on the given condition variable.
@@ -465,13 +465,13 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *
* the associated mutex. This will happen in a serialized manner.
* @param cond the condition variable on which to produce the broadcast.
*/
SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t * cond);
SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond);
/**
* Destroy the condition variable and free the associated memory.
* @param cond the condition variable to destroy.
*/
SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t * cond);
SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond);
/** @} */
@@ -498,20 +498,20 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t
* the formatted UUID and a null terminator
* @param uuid The UUID to format
*/
SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t * uuid);
SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid);
/**
* Generate and return a (new) UUID
* @param uuid The resulting UUID
*/
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t * uuid);
SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid);
/**
* Parse a standard-format string into a UUID
* @param uuid The resulting UUID
* @param uuid_str The formatted UUID
*/
SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t * uuid, const char *uuid_str);
SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str);
/** @} */
@@ -530,7 +530,7 @@ SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t * uuid, const ch
* @param queue_capacity maximum size of the queue
* @param pool a pool to allocate queue from
*/
SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
/**
* pop/get an object from the queue, blocking if the queue is already empty
@@ -541,7 +541,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, uns
* @returns APR_EOF if the queue has been terminated
* @returns APR_SUCCESS on a successfull pop
*/
SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t * queue, void **data);
SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data);
/**
* push/add a object to the queue, blocking if the queue is already full
@@ -552,7 +552,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t * queue, void **
* @returns APR_EOF the queue has been terminated
* @returns APR_SUCCESS on a successfull push
*/
SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t * queue, void *data);
SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data);
/**
* returns the size of the queue.
@@ -562,7 +562,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t * queue, void *
* @param queue the queue
* @returns the size of the queue
*/
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue);
SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue);
/**
* pop/get an object to the queue, returning immediatly if the queue is empty
@@ -574,7 +574,7 @@ SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue);
* @returns APR_EOF the queue has been terminated
* @returns APR_SUCCESS on a successfull push
*/
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t * queue, void **data);
SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data);
/**
* push/add a object to the queue, returning immediatly if the queue is full
@@ -586,7 +586,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t * queue, void
* @returns APR_EOF the queue has been terminated
* @returns APR_SUCCESS on a successfull push
*/
SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, void *data);
SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data);
/** @} */
@@ -650,13 +650,13 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, voi
* @{
*/
#define SWITCH_FLOCK_SHARED 1 /**< Shared lock. More than one process
#define SWITCH_FLOCK_SHARED 1 /**< Shared lock. More than one process
or thread can hold a shared lock
at any given time. Essentially,
this is a "read lock", preventing
writers from establishing an
exclusive lock. */
#define SWITCH_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
#define SWITCH_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
may hold an exclusive lock at any
given time. This is analogous to
a "write lock". */
@@ -722,19 +722,19 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, voi
* @remark If perm is SWITCH_FPROT_OS_DEFAULT and the file is being created,
* appropriate default permissions will be used.
*/
SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
SWITCH_DECLARE(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);
SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t * thefile, switch_seek_where_t where, int64_t *offset);
SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset);
/**
* Close the specified file.
* @param thefile The file descriptor to close.
*/
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t * thefile);
SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile);
SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t * thefile, int type);
SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type);
/**
* Delete the specified file.
@@ -764,7 +764,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const
* @remark It is not possible for both bytes to be read and an APR_EOF
* or other error to be returned. APR_EINTR is never returned.
*/
SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t * thefile, void *buf, switch_size_t *nbytes);
SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes);
/**
* Write data to the specified file.
@@ -781,7 +781,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t * thefile, void *
* @remark It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
*/
SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t * thefile, const void *buf, switch_size_t *nbytes);
SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes);
SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...);
SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool);
@@ -798,8 +798,7 @@ SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, swi
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
*/
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
/** Creates a new directory on the file system, but behaves like
* 'mkdir -p'. Creates intermediate directories as required. No error
@@ -808,24 +807,23 @@ SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileper
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
*/
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm,
switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
typedef struct switch_dir switch_dir_t;
typedef struct switch_dir switch_dir_t;
struct switch_array_header_t {
/** The pool the array is allocated out of */
switch_memory_pool_t *pool;
/** The amount of memory allocated for each element of the array */
int elt_size;
/** The number of active elements in the array */
int nelts;
/** The number of elements allocated in the array */
int nalloc;
/** The elements in the array */
char *elts;
};
typedef struct switch_array_header_t switch_array_header_t;
struct switch_array_header_t {
/** The pool the array is allocated out of */
switch_memory_pool_t *pool;
/** The amount of memory allocated for each element of the array */
int elt_size;
/** The number of active elements in the array */
int nelts;
/** The number of elements allocated in the array */
int nalloc;
/** The elements in the array */
char *elts;
};
typedef struct switch_array_header_t switch_array_header_t;
SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir);
@@ -852,7 +850,7 @@ SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *bu
typedef void *(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *);
//APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, switch_size_t stacksize)
SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t * attr, switch_size_t stacksize);
SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize);
SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threadattr_t *attr);
@@ -862,14 +860,14 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threa
* @param new_attr The newly created threadattr.
* @param pool The pool to use
*/
SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** new_attr, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool);
/**
* Set if newly created threads should be created in detached state.
* @param attr The threadattr to affect
* @param on Non-zero if detached threads should be created.
*/
SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t * attr, int32_t on);
SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on);
/**
* Create a new thread of execution
@@ -879,7 +877,7 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t
* @param data Any data to be passed to the starting function
* @param cont The pool to use
*/
SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t * attr,
SWITCH_DECLARE(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);
/** @} */
@@ -946,7 +944,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
* @param protocol The protocol of the socket (e.g., SWITCH_PROTO_TCP).
* @param pool The pool to use
*/
SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
/**
* Shutdown either reading, writing, or both sides of a socket.
@@ -961,13 +959,13 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock
* @remark This does not actually close the socket descriptor, it just
* controls which calls are still valid on the socket.
*/
SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t * sock, switch_shutdown_how_e how);
SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how);
/**
* Close a socket.
* @param sock The socket to close
*/
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock);
SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock);
/**
* Bind the socket to its associated port
@@ -976,7 +974,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock);
* @remark This may be where we will find out if there is any other process
* using the selected port.
*/
SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t * sock, switch_sockaddr_t * sa);
SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa);
/**
* Listen to a bound socket for connections.
@@ -985,7 +983,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t * sock, switc
* listen queue. If this value is less than zero, the listen
* queue size is set to zero.
*/
SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t * sock, int32_t backlog);
SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog);
/**
* Accept a new connection request
@@ -995,7 +993,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t * sock, int
* @param sock The socket we are listening on.
* @param pool The pool for the new socket.
*/
SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t * sock, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool);
/**
* Issue a connection request to a socket either on the same machine
@@ -1003,12 +1001,12 @@ SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock
* @param sock The socket we wish to use for our side of the connection
* @param sa The address of the machine we wish to connect to.
*/
SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t * sock, switch_sockaddr_t * sa);
SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa);
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t * sa);
SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t * in);
SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t * sa);
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t * sa);
SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa);
SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in);
SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa);
SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa);
/**
@@ -1034,7 +1032,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_socka
* </PRE>
* @param pool The pool for the apr_sockaddr_t and associated storage.
*/
SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname,
SWITCH_DECLARE(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);
/**
@@ -1054,7 +1052,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa
* APR_EINTR is never returned.
* </PRE>
*/
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len);
SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len);
/**
* @param sock The socket to send from
@@ -1063,8 +1061,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const
* @param buf The data to send
* @param len The length of the data to send
*/
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf,
switch_size_t *len);
SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len);
/**
* @param from The apr_sockaddr_t to fill in the recipient info
@@ -1074,7 +1071,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, swi
* @param len The length of the available buffer
*
*/
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t * from, switch_socket_t * sock, int32_t flags, char *buf, size_t *len);
SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len);
/**
@@ -1096,7 +1093,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t * from,
* APR_EINTR is never returned.
* </PRE>
*/
SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char *buf, switch_size_t *len);
SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len);
/**
* Setup socket options for the specified socket
@@ -1120,7 +1117,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char
* </PRE>
* @param on Value for the option.
*/
SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, int32_t opt, int32_t on);
SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on);
/**
* Setup socket timeout for the specified socket
@@ -1133,7 +1130,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, in
* t < 0 -- read and write calls block
* </PRE>
*/
SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock, switch_interval_time_t t);
SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t);
/**
* Join a Multicast Group
@@ -1144,7 +1141,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock
* @param source Source Address to accept transmissions from (non-NULL
* implies Source-Specific Multicast)
*/
SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t * sock, switch_sockaddr_t * join, switch_sockaddr_t * iface, switch_sockaddr_t * source);
SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source);
@@ -1185,7 +1182,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t * sock, switch
* platforms; the apr_pollset_create() call will fail with
* APR_ENOTIMPL on platforms where it is not supported.
*/
SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
/**
* Add a socket or file descriptor to a pollset
@@ -1204,7 +1201,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollse
* allowed for implementations where option (1) is impossible
* or impractical.
*/
SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t * pollset, const switch_pollfd_t * descriptor);
SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor);
/**
* Poll the sockets in the poll structure
@@ -1219,7 +1216,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t * pollset, c
* This is a blocking call, and it will not return until either a
* socket has been signalled, or the timeout has expired.
*/
SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t * aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
/*!
\brief Create a set of file descriptors to poll
@@ -1229,7 +1226,7 @@ SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t * aprset, int32_t nu
\param pool the memory pool to use
\return SWITCH_STATUS_SUCCESS when successful
*/
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t * sock, int16_t flags, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *p);
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t **sa, switch_bool_t remote, switch_socket_t *sock);