#ifndef SWITCH_H
#define SWITCH_H
-#ifdef __cplusplus\r
-#define BEGIN_EXTERN_C extern "C" {\r
-#define END_EXTERN_C }\r
-#else\r
-#define BEGIN_EXTERN_C\r
-#define END_EXTERN_C\r
-#endif\r
+#ifdef __cplusplus
+#define BEGIN_EXTERN_C extern "C" {
+#define END_EXTERN_C }
+#else
+#define BEGIN_EXTERN_C
+#define END_EXTERN_C
+#endif
BEGIN_EXTERN_C
DoxyDefine(apr_status_t switch_thread_cond_create(switch_thread_cond_t **cond, switch_pool_t *pool);)
#define switch_thread_cond_create apr_thread_cond_create
-typedef apr_os_thread_t switch_thread_id;
+typedef apr_os_thread_t switch_thread_id_t;
#define switch_thread_data_set apr_thread_data_set
#define switch_thread_data_get apr_thread_data_get
*/
/** Opaque Thread structure. */
-typedef apr_thread_t switch_thread;
+typedef apr_thread_t switch_thread_t;
/** Opaque Thread attributes structure. */
typedef apr_threadattr_t switch_threadattr_t;
* @{
*/
/** The fundamental pool type */
-typedef apr_pool_t switch_memory_pool;
+typedef apr_pool_t switch_memory_pool_t;
/**
* to re-use this memory for the next allocation.
* @see apr_pool_destroy()
*/
-DoxyDefine(void switch_pool_clear(switch_memory_pool *p);)
+DoxyDefine(void switch_pool_clear(switch_memory_pool_t *p);)
#define switch_pool_clear apr_pool_clear
/** @} */
*/
/** Abstract type for hash tables. */
-typedef apr_hash_t switch_hash;
+typedef apr_hash_t switch_hash_t;
/** Abstract type for scanning hash tables. */
typedef apr_hash_index_t switch_hash_index_t;
*
SWITCH_DECLARE(switch_status) switch_mutex_init(switch_mutex_t **lock,
switch_lock_flag flags,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
*/
#define switch_mutex_init apr_thread_mutex_create
/**
* \param max_len length required by the buffer
* \return status
*/
-SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, switch_buffer **buffer, switch_size_t max_len);
+SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool_t *pool, switch_buffer **buffer, switch_size_t max_len);
/*! \brief Get the length of a switch_buffer
* \param buffer any buffer of type switch_buffer
\param destination_number destination number
\return a new profile object allocated from the session's memory pool
*/
-SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_pool *pool,
+SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_pool_t *pool,
char *dialplan,
char *caller_id_name,
char *caller_id_number,
\param event the event to add the information to
*/
-SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event *event);
+SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix, switch_event_t *event);
END_EXTERN_C
\param pool memory_pool to use for allocation
\return SWITCH_STATUS_SUCCESS if successful
*/
-SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, switch_memory_pool_t *pool);
/*!
\brief Connect a newly allocated channel to a session object and setup it's initial state
\param channel channel to add information about
\param event event to add information to
*/
-SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel *channel, switch_event *event);
+SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel *channel, switch_event_t *event);
// These may go away
/*! array of void pointers to pass mutiple data objects */
void *objs[SWITCH_MAX_CORE_THREAD_SESSION_OBJS];
/*! a pointer to a memory pool if the thread has it's own pool */
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
};
struct switch_core_session;
\brief Create a new sub memory pool from the core's master pool
\return SWITCH_STATUS_SUCCESS on success
*/
-SWITCH_DECLARE(switch_status) switch_core_new_memory_pool(switch_memory_pool **pool);
+SWITCH_DECLARE(switch_status) switch_core_new_memory_pool(switch_memory_pool_t **pool);
/*!
\brief Returns a subpool back to the main pool
\return SWITCH_STATUS_SUCCESS on success
*/
-SWITCH_DECLARE(switch_status) switch_core_destroy_memory_pool(switch_memory_pool **pool);
+SWITCH_DECLARE(switch_status) switch_core_destroy_memory_pool(switch_memory_pool_t **pool);
/*!
\brief Start the session's state machine
\param memory the number of bytes to allocate
\return a void pointer to the allocated memory
*/
-SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, switch_size_t memory);
+SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size_t memory);
/*!
\brief Allocate memory from a session's pool
\param todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup);
+SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, char *todup);
/*!
\brief Retrieve the memory pool from a session
\return the session's pool
\note to be used sparingly
*/
-SWITCH_DECLARE(switch_memory_pool *) switch_core_session_get_pool(switch_core_session *session);
+SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_session *session);
///\}
///\defgroup sessm Session Creation / Management
\param pool the pool to use for the allocation (a new one will be used if NULL)
\return the newly created session
*/
-SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_endpoint_interface *endpoint_interface, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_endpoint_interface *endpoint_interface, switch_memory_pool_t *pool);
/*!
\brief Destroy a session and return the memory pool to the core
\param pool the pool to use
\return the newly created session
*/
-SWITCH_DECLARE(switch_core_session *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_core_session *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool_t *pool);
/*!
\brief Launch the session thread (state machine) on a given session
\param event the event to send
\return the status returned by the message handler
*/
-SWITCH_DECLARE(switch_status) switch_core_session_event_send(char *uuid_str, switch_event *event);
+SWITCH_DECLARE(switch_status) switch_core_session_event_send(char *uuid_str, switch_event_t *event);
/*!
\brief Retrieve private user data from a session
\param func a function to execute in the thread
\param obj an arguement
*/
-SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session *session, void *(*func)(switch_thread *, void *), void *obj);
+SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session *session, void *(*func)(switch_thread_t *, void *), void *obj);
/*!
\brief Signal a thread using a thread session to terminate
char *endpoint_name,
switch_caller_profile *caller_profile,
switch_core_session **new_session,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\brief Answer the channel of a given session
\param event the event to queue
\return the status returned by the message handler
*/
-SWITCH_DECLARE(switch_status) switch_core_session_queue_event(switch_core_session *session, switch_event *event);
+SWITCH_DECLARE(switch_status) switch_core_session_queue_event(switch_core_session *session, switch_event_t *event);
/*!
\brief Read a frame from a session
\param pool the pool to use for the new hash
\return SWITCH_STATUS_SUCCESS if the hash is created
*/
-SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash **hash, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash_t **hash, switch_memory_pool_t *pool);
/*!
\brief Destroy an existing hash table
\param hash the hash to destroy
\return SWITCH_STATUS_SUCCESS if the hash is destroyed
*/
-SWITCH_DECLARE(switch_status) switch_core_hash_destroy(switch_hash *hash);
+SWITCH_DECLARE(switch_status) switch_core_hash_destroy(switch_hash_t *hash);
/*!
\brief Insert data into a hash
\return SWITCH_STATUS_SUCCESS if the data is added
\note the string key must be a constant or a dynamic string
*/
-SWITCH_DECLARE(switch_status) switch_core_hash_insert(switch_hash *hash, char *key, void *data);
+SWITCH_DECLARE(switch_status) switch_core_hash_insert(switch_hash_t *hash, char *key, void *data);
/*!
\brief Insert data into a hash with dynamicly allocated key name
\param data the data to add
\return SWITCH_STATUS_SUCCESS if the data is added
*/
-SWITCH_DECLARE(switch_status) switch_core_hash_insert_dup(switch_hash *hash, char *key, void *data);
+SWITCH_DECLARE(switch_status) switch_core_hash_insert_dup(switch_hash_t *hash, char *key, void *data);
/*!
\brief Delete data from a hash based on desired key
\param key the key from which to delete the data
\return SWITCH_STATUS_SUCCESS if the data is deleted
*/
-SWITCH_DECLARE(switch_status) switch_core_hash_delete(switch_hash *hash, char *key);
+SWITCH_DECLARE(switch_status) switch_core_hash_delete(switch_hash_t *hash, char *key);
/*!
\brief Retrieve data from a given hash
\param key the key to retrieve
\return a pointer to the data held in the key
*/
-SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash *hash, char *key);
+SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t *hash, char *key);
///\}
///\defgroup timer Timer Functions
\param pool the memory pool to use for allocation
\return
*/
-SWITCH_DECLARE(switch_status) switch_core_timer_init(switch_timer *timer, char *timer_name, int interval, int samples, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_core_timer_init(switch_timer *timer, char *timer_name, int interval, int samples, switch_memory_pool_t *pool);
/*!
\brief Wait for one cycle on an existing timer
int channels,
uint32_t flags,
const switch_codec_settings *codec_settings,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\brief Encode data using a codec handle
\return SWITCH_STATUS_SUCCESS if the file is opened
\note the loadable module used is chosen based on the file extension
*/
-SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char *file_path, unsigned int flags, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char *file_path, unsigned int flags, switch_memory_pool_t *pool);
/*!
\brief Read media from a file handle
char *voice_name,
unsigned int rate,
switch_speech_flag *flags,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\brief Feed data to the ASR module
char *source,
char *dsn,
char *passwd,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\brief Query a directory handle
/*!
\brief Launch a thread
*/
-SWITCH_DECLARE(void) switch_core_launch_thread(void *(*func)(switch_thread *, void*), void *obj, switch_memory_pool *pool);
+SWITCH_DECLARE(void) switch_core_launch_thread(void *(*func)(switch_thread_t *, void*), void *obj, switch_memory_pool_t *pool);
/*!
\brief Initiate Globals
BEGIN_EXTERN_C
/*! \brief An event Header */
-struct switch_event_header {
+struct switch_event_header{
/*! the header name */
char *name;
/*! the header value */
/*! \brief Representation of an event */
struct switch_event {
/*! the event id (descriptor) */
- switch_event_t event_id;
+ switch_event_types_t event_id;
/*! the priority of the event */
switch_priority_t priority;
/*! the owner of the event */
/*! the subclass of the event */
switch_event_subclass *subclass;
/*! the event headers */
- struct switch_event_header *headers;
+ switch_event_header_t *headers;
/*! the body of the event */
char *body;
/*! user data from the subclass provider */
/*! the id of the node */
char *id;
/*! the event id enumeration to bind to */
- switch_event_t event_id;
+ switch_event_types_t event_id;
/*! the event subclass to bind to for custom events */
switch_event_subclass *subclass;
/*! a callback function to execute when the event is triggered */
\param pool the memory pool to use for the event system (creates a new one if NULL)
\return SWITCH_STATUS_SUCCESS when complete
*/
-SWITCH_DECLARE(switch_status) switch_event_init(switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_event_init(switch_memory_pool_t *pool);
/*!
\brief Stop the eventing system
\param subclass_name the subclass name for custom event (only valid when event_id is SWITCH_EVENT_CUSTOM)
\return SWITCH_STATUS_SUCCESS on success
*/
-SWITCH_DECLARE(switch_status) switch_event_create_subclass(switch_event **event, switch_event_t event_id, char *subclass_name);
+SWITCH_DECLARE(switch_status) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, char *subclass_name);
/*!
\brief Set the priority of an event
\param priority the event priority
\return SWITCH_STATUS_SUCCESS
*/
-SWITCH_DECLARE(switch_status) switch_event_set_priority(switch_event *event, switch_priority_t priority);
+SWITCH_DECLARE(switch_status) switch_event_set_priority(switch_event_t *event, switch_priority_t priority);
/*!
\brief Retrieve a header value from an event
\param header_name the name of the header to read
\return the value of the requested header
*/
-SWITCH_DECLARE(char *) switch_event_get_header(switch_event *event, char *header_name);
+SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
/*!
\brief Add a header to an event
\param fmt the value of the header (varargs see standard sprintf family)
\return SWITCH_STATUS_SUCCESS if the header was added
*/
-SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switch_stack_t stack, char *header_name, char *fmt, ...);
+SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event_t *event, switch_stack_t stack, char *header_name, char *fmt, ...);
/*!
\brief Destroy an event
\param event pointer to the pointer to event to destroy
*/
-SWITCH_DECLARE(void) switch_event_destroy(switch_event **event);
+SWITCH_DECLARE(void) switch_event_destroy(switch_event_t **event);
/*!
\brief Duplicate an event
\param todup an event to duplicate
\return SWITCH_STATUS_SUCCESS if the event was duplicated
*/
-SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_event *todup);
+SWITCH_DECLARE(switch_status) switch_event_dup(switch_event_t **event, switch_event_t *todup);
/*!
\brief Fire an event with full arguement list
\param user_data optional private data to pass to the event handlers
\return
*/
-SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event, void *user_data);
+SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event_t **event, void *user_data);
/*!
\brief Bind an event callback to a specific event
\param user_data optional user specific data to pass whenever the callback is invoked
\return SWITCH_STATUS_SUCCESS if the event was binded
*/
-SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_t event, char *subclass_name, switch_event_callback_t callback, void *user_data);
+SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_types_t event, char *subclass_name, switch_event_callback_t callback, void *user_data);
/*!
\brief Render the name of an event id enumeration
\param event the event id to render the name of
\return the rendered name
*/
-SWITCH_DECLARE(char *) switch_event_name(switch_event_t event);
+SWITCH_DECLARE(char *) switch_event_name(switch_event_types_t event);
/*!
\brief Reserve a subclass name for private use with a custom event
\return SWITCH_STATUS_SUCCESS if the operation was successful
\note the body supplied by this function will supersede an existing body the event may have
*/
-SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *buf, switch_size_t buflen, char *fmt, ...);
+SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event_t *event, char *buf, switch_size_t buflen, char *fmt, ...);
/*!
\brief Determine if the event system has been initilized
\return SWITCH_STATUS_SUCCESS if the body was added to the event
\note the body parameter can be shadowed by the switch_event_reserve_subclass_detailed function
*/
-SWITCH_DECLARE(switch_status) switch_event_add_body(switch_event *event, char *fmt, ...);
+SWITCH_DECLARE(switch_status) switch_event_add_body(switch_event_t *event, char *fmt, ...);
/*!
\param event the event to send (will be nulled)
\note normaly use switch_event_fire for delivering events (only use this when you wish to deliver the event blocking on your thread)
*/
-SWITCH_DECLARE(void) switch_event_deliver(switch_event **event);
+SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event);
/*!
\brief Fire an event filling in most of the arguements with obvious values
\param arraylen the max size in elements of the array
\return the number of elements added to the array
*/
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool *pool,
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool,
switch_codec_interface **array,
int arraylen);
\param pool the memory pool to use
\note to be called at application startup by the core
*/
-SWITCH_DECLARE(switch_status) switch_log_init(switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_log_init(switch_memory_pool_t *pool);
/*!
\brief Shut down the logging engine
/*! \brief A table of i/o routines that an endpoint interface can implement */
struct switch_io_routines {
/*! creates an outgoing session from given session, caller profile */
- switch_status (*outgoing_channel)(switch_core_session *, switch_caller_profile *, switch_core_session **, switch_memory_pool *);
+ switch_status (*outgoing_channel)(switch_core_session *, switch_caller_profile *, switch_core_session **, switch_memory_pool_t *);
/*! answers the given session's channel */
switch_status (*answer_channel)(switch_core_session *);
/*! read a frame from a session */
/*! receive a message from another session*/
switch_status (*receive_message)(switch_core_session *, switch_core_session_message *);
/*! queue a message for another session*/
- switch_status (*queue_event)(switch_core_session *, switch_event *);
+ switch_status (*queue_event)(switch_core_session *, switch_event_t *);
};
/*! \brief Abstraction of an module endpoint interface
/*! the timer interface provided from a loadable module */
struct switch_timer_interface *timer_interface;
/*! the timer's memory pool */
- switch_memory_pool *memory_pool;
+ switch_memory_pool_t *memory_pool;
/*! private data for loadable modules to store information */
void *private_info;
};
/*! the speed of the file playback*/
int speed;
/*! the handle's memory pool */
- switch_memory_pool *memory_pool;
+ switch_memory_pool_t *memory_pool;
/*! private data for the format module to store handle specific info */
void *private_info;
int64_t pos;
uint32_t flags;
/*! the handle's memory pool */
- switch_memory_pool *memory_pool;
+ switch_memory_pool_t *memory_pool;
/*! private data for the format module to store handle specific info */
void *private_info;
};
uint32_t flags;
/*! the handle's memory pool */
- switch_memory_pool *memory_pool;
+ switch_memory_pool_t *memory_pool;
/*! private data for the format module to store handle specific info */
void *private_info;
};
/*! flags to modify behaviour */
uint32_t flags;
/*! the handle's memory pool*/
- switch_memory_pool *memory_pool;
+ switch_memory_pool_t *memory_pool;
/*! private data for the codec module to store handle specific info */
void *private_info;
};
*/
/*! \brief An audio resampling handle */
-struct switch_audio_resampler {
+typedef struct {
/*! a pointer to store the resampler object */
void *resampler;
/*! the rate to resample from in hz */
uint32_t to_len;
/*! the total size of the to buffer */
uint32_t to_size;
-};
+} switch_audio_resampler_t;
/*!
\brief Prepare a new resampler handle
\param pool the memory pool to use for buffer allocation
\return SWITCH_STATUS_SUCCESS if the handle was created
*/
-SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **new_resampler,
+SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler_t **new_resampler,
int from_rate,
switch_size_t from_size,
int to_rate,
uint32_t to_size,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\brief Destroy an existing resampler handle
\param resampler the resampler handle to destroy
*/
-SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler *resampler);
+SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t *resampler);
/*!
\brief Resample one float buffer into another using specifications of a given handle
\param last parameter denoting the last sample is being resampled
\return the used size of dst
*/
-SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last);
+SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last);
/*!
\brief Convert an array of floats to an array of shorts
///\defgroup rtp RTP (RealTime Transport Protocol)
///\ingroup core1
///\{
-typedef void (*switch_rtp_invalid_handler)(switch_rtp *rtp_session,
+typedef void (*switch_rtp_invalid_handler)(switch_rtp_t *rtp_session,
switch_socket_t *sock,
void *data,
switch_size_t datalen,
\param pool the memory pool to use for long term allocations
\note Generally called by the core_init
*/
-SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool *pool);
+SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool);
/*!
\brief Request a new port to be used for media
\param pool a memory pool to use for the session
\return the new RTP session or NULL on failure
*/
-SWITCH_DECLARE(switch_status)switch_rtp_create(switch_rtp **new_rtp_session,
+SWITCH_DECLARE(switch_status)switch_rtp_create(switch_rtp_t **new_rtp_session,
switch_payload_t payload,
uint32_t packet_size,
uint32_t ms_per_packet,
switch_rtp_flag_t flags,
char *crypto_key,
const char **err,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\param pool a memory pool to use for the session
\return the new RTP session or NULL on failure
*/
-SWITCH_DECLARE(switch_rtp *)switch_rtp_new(char *rx_host,
+SWITCH_DECLARE(switch_rtp_t *)switch_rtp_new(char *rx_host,
switch_port_t rx_port,
char *tx_host,
switch_port_t tx_port,
switch_rtp_flag_t flags,
char *crypto_key,
const char **err,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
/*!
\param port the remote port
\param err pointer for error messages
*/
-SWITCH_DECLARE(switch_status) switch_rtp_set_remote_address(switch_rtp *rtp_session, char *host, switch_port_t port, const char **err);
+SWITCH_DECLARE(switch_status) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, char *host, switch_port_t port, const char **err);
/*!
\brief Assign a local address to the RTP session
\param err pointer for error messages
\note this call also binds the RTP session's socket to the new address
*/
-SWITCH_DECLARE(switch_status) switch_rtp_set_local_address(switch_rtp *rtp_session, char *host, switch_port_t port, const char **err);
+SWITCH_DECLARE(switch_status) switch_rtp_set_local_address(switch_rtp_t *rtp_session, char *host, switch_port_t port, const char **err);
/*!
\brief Kill the socket on an existing RTP session
\param rtp_session an RTP session to kill the socket of
*/
-SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp *rtp_session);
+SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session);
/*!
\brief Destroy an RTP session
\param rtp_session an RTP session to destroy
*/
-SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp **rtp_session);
+SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session);
/*!
\brief Acvite ICE on an RTP session
\return SWITCH_STATUS_SUCCESS
*/
-SWITCH_DECLARE(switch_status) switch_rtp_activate_ice(switch_rtp *rtp_session, char *login, char *rlogin);
+SWITCH_DECLARE(switch_status) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin);
/*!
\brief Set an RTP Flag
\param rtp_session the RTP session
\param flags the flags to set
*/
-SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp *rtp_session, switch_rtp_flag_t flags);
+SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
/*!
\brief Test an RTP Flag
\param flags the flags to test
\return TRUE or FALSE
*/
-SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp *rtp_session, switch_rtp_flag_t flags);
+SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
/*!
\brief Clear an RTP Flag
\param rtp_session the RTP session
\param flags the flags to clear
*/
-SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp *rtp_session, switch_rtp_flag_t flags);
+SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
/*!
\brief Retrieve the socket from an existing RTP session
\param rtp_session the RTP session to retrieve the socket from
\return the socket from the RTP session
*/
-SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp *rtp_session);
+SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session);
/*!
\brief Set the default packet size for a given RTP session
\param rtp_session the RTP session to set the packet size on
\param packet_size the new default packet size
*/
-SWITCH_DECLARE(void) switch_rtp_set_default_packet_size(switch_rtp *rtp_session, uint16_t packet_size);
+SWITCH_DECLARE(void) switch_rtp_set_default_packet_size(switch_rtp_t *rtp_session, uint16_t packet_size);
/*!
\brief Get the default packet size for a given RTP session
\param rtp_session the RTP session to get the packet size from
\return the default packet_size of the RTP session
*/
-SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp *rtp_session);
+SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp_t *rtp_session);
/*!
\brief Set the default payload number for a given RTP session
\param rtp_session the RTP session to set the payload number on
\param payload the new default payload number
*/
-SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, switch_payload_t payload);
+SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload);
/*!
\brief Get the default payload number for a given RTP session
\param rtp_session the RTP session to get the payload number from
\return the default payload of the RTP session
*/
-SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp *rtp_session);
+SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp_t *rtp_session);
/*!
\param on_invalid the function to set
\return
*/
-SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp *rtp_session, switch_rtp_invalid_handler on_invalid);
+SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp_t *rtp_session, switch_rtp_invalid_handler on_invalid);
/*!
\brief Read data from a given RTP session
\param flags flags
\return the number of bytes read
*/
-SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags);
+SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags);
/*!
\brief Read data from a given RTP session without copying
\param flags flags
\return the number of bytes read
*/
-SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags);
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags);
/*!
\brief Read data from a given RTP session without copying
\param frame a frame to populate with information
\return the number of bytes read
*/
-SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read_frame(switch_rtp *rtp_session, switch_frame *frame);
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame *frame);
/*!
\brief Write data to a given RTP session
\param flags frame flags
\return the number of bytes written
*/
-SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint32_t ts, switch_frame_flag *flags);
+SWITCH_DECLARE(int) switch_rtp_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, uint32_t ts, switch_frame_flag *flags);
/*!
\brief Enable VAD on an RTP Session
\param flags flags for control
\return SWITCH_STAUTS_SUCCESS on success
*/
-SWITCH_DECLARE(switch_status) switch_rtp_enable_vad(switch_rtp *rtp_session, switch_core_session *session, switch_codec *codec, switch_vad_flag_t flags);
+SWITCH_DECLARE(switch_status) switch_rtp_enable_vad(switch_rtp_t *rtp_session, switch_core_session *session, switch_codec *codec, switch_vad_flag_t flags);
/*!
\brief Disable VAD on an RTP Session
\param rtp_session the RTP session
\return SWITCH_STAUTS_SUCCESS on success
*/
-SWITCH_DECLARE(switch_status) switch_rtp_disable_vad(switch_rtp *rtp_session);
+SWITCH_DECLARE(switch_status) switch_rtp_disable_vad(switch_rtp_t *rtp_session);
/*!
\brief Write data to a given RTP session
\param ts then number of bytes to increment the timestamp by
\return the number of bytes written
*/
-SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp *rtp_session, switch_frame *frame, uint32_t ts);
+SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame *frame, uint32_t ts);
/*!
\brief Write data with a specified payload and sequence number to a given RTP session
\param flags frame flags
\return the number of bytes written
*/
-SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags);
+SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, void *data, uint16_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags);
/*!
\brief Retrieve the SSRC from a given RTP session
\param rtp_session the RTP session to retrieve from
\return the SSRC
*/
-SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp *rtp_session);
+SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session);
/*!
\brief Associate an arbitrary data pointer with and RTP session
\param rtp_session the RTP session to assign the pointer to
\param private_data the private data to assign
*/
-SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp *rtp_session, void *private_data);
+SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data);
/*!
\brief Retrieve the private data from a given RTP session
\param rtp_session the RTP session to retrieve the data from
\return the pointer to the private data
*/
-SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp *rtp_session);
+SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp_t *rtp_session);
/*!
\}
char *stunip,
switch_port_t stunport,
char **err,
- switch_memory_pool *pool);
+ switch_memory_pool_t *pool);
also never put any new ones before EVENT_ALL
*/
/*!
- \enum switch_event_t
+ \enum switch_event_type_t
\brief Built-in Events
<pre>
SWITCH_EVENT_NOTALK,
SWITCH_EVENT_SESSION_CRASH,
SWITCH_EVENT_ALL
-} switch_event_t;
+} switch_event_types_t;
typedef enum {
typedef uint8_t switch_payload_t;
-typedef struct switch_rtp switch_rtp;
+typedef struct switch_rtp switch_rtp_t;
typedef struct switch_core_session_message switch_core_session_message;
-typedef struct switch_audio_resampler switch_audio_resampler;
-typedef struct switch_event_header switch_event_header;
-typedef struct switch_event switch_event;
+typedef struct switch_event_header switch_event_header_t;
+typedef struct switch_event switch_event_t;
typedef struct switch_event_subclass switch_event_subclass;
typedef struct switch_event_node switch_event_node;
typedef struct switch_loadable_module switch_loadable_module;
typedef struct switch_directory_handle switch_directory_handle;
typedef struct switch_directory_interface switch_directory_interface;
typedef void (*switch_application_function)(switch_core_session *, char *);
-typedef void (*switch_event_callback_t)(switch_event *);
+typedef void (*switch_event_callback_t)(switch_event_t *);
typedef switch_caller_extension *(*switch_dialplan_hunt_function)(switch_core_session *);
typedef switch_status (*switch_state_handler)(switch_core_session *);
typedef switch_status (*switch_outgoing_channel_hook)(switch_core_session *, switch_caller_profile *, switch_core_session *);
typedef switch_status (*switch_answer_channel_hook)(switch_core_session *);
typedef switch_status (*switch_receive_message_hook)(switch_core_session *, switch_core_session_message *);
-typedef switch_status (*switch_queue_event_hook)(switch_core_session *, switch_event *);
+typedef switch_status (*switch_queue_event_hook)(switch_core_session *, switch_event_t *);
typedef switch_status (*switch_read_frame_hook)(switch_core_session *, switch_frame **, int, switch_io_flag, int);
typedef switch_status (*switch_write_frame_hook)(switch_core_session *, switch_frame *, int, switch_io_flag, int);
typedef switch_status (*switch_kill_channel_hook)(switch_core_session *, int);
\param pool the memory pool to use
\return SWITCH_STATUS_SUCCESS when successful
*/
-SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, switch_int16_t flags, switch_memory_pool *pool);
+SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, switch_int16_t flags, switch_memory_pool_t *pool);
/*!
\brief Wait for a socket
static const char modname[] = "mod_dingaling";
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
typedef enum {
TFLAG_IO = (1 << 0),
int codec_rates_last;
unsigned int flags;
unsigned int init;
- switch_hash *profile_hash;
+ switch_hash_t *profile_hash;
int running;
int handles;
} globals;
switch_codec_interface *codecs[SWITCH_MAX_CODECS];
unsigned int num_codecs;
int codec_index;
- struct switch_rtp *rtp_session;
+ switch_rtp_t *rtp_session;
ldl_session_t *dlsession;
char *remote_ip;
switch_port_t local_port;
static switch_status channel_on_loopback(switch_core_session *session);
static switch_status channel_on_transmit(switch_core_session *session);
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool);
+ switch_core_session **new_session, switch_memory_pool_t *pool);
static switch_status channel_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id);
static switch_status channel_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
-static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void *obj)
{
ldl_handle_t *handle = obj;
struct mdl_profile *profile = NULL;
static void handle_thread_launch(ldl_handle_t *handle)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
switch_threadattr_create(&thd_attr, module_pool);
return 0;
}
-static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC negotiate_thread_run(switch_thread_t *thread, void *obj)
{
switch_core_session *session = obj;
static void negotiate_thread_launch(switch_core_session *session)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session));
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool)
+ switch_core_session **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
static const char modname[] = "mod_exosip";
#define STRLEN 15
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
char *codec_string;
char *codec_order[SWITCH_MAX_CODECS];
int codec_order_last;
- switch_hash *call_hash;
- switch_hash *srtp_hash;
+ switch_hash_t *call_hash;
+ switch_hash_t *srtp_hash;
int running;
int codec_ms;
int dtmf_duration;
int32_t timestamp_recv;
int32_t timestamp_dtmf;
int payload_num;
- struct switch_rtp *rtp_session;
+ switch_rtp_t *rtp_session;
struct osip_rfc3264 *sdp_config;
sdp_message_t *remote_sdp;
sdp_message_t *local_sdp;
static switch_status exosip_on_loopback(switch_core_session *session);
static switch_status exosip_on_transmit(switch_core_session *session);
static switch_status exosip_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool);
+ switch_core_session **new_session, switch_memory_pool_t *pool);
static switch_status exosip_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id);
static switch_status exosip_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
};
static switch_status exosip_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool)
+ switch_core_session **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&exosip_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
{
eXosip_event_t *event = NULL;
- switch_event *s_event;
+ switch_event_t *s_event;
config_exosip(0);
static const char modname[] = "mod_iax";
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
static int running = 1;
static switch_status channel_on_loopback(switch_core_session *session);
static switch_status channel_on_transmit(switch_core_session *session);
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool);
+ switch_core_session **new_session, switch_memory_pool_t *pool);
static switch_status channel_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id);
static switch_status channel_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool)
+ switch_core_session **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
{
//int refresh;
struct iax_event *iaxevent = NULL;
- switch_event *s_event;
+ switch_event_t *s_event;
if (load_config() != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_TERM;
}
static const char modname[] = "mod_portaudio";
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
//static int running = 1;
#define SAMPLE_TYPE paInt16
int indev;
int outdev;
int call_id;
- switch_hash *call_hash;
+ switch_hash_t *call_hash;
switch_mutex_t *device_lock;
int sample_rate;
} globals;
static switch_status channel_on_transmit(switch_core_session *session);
static switch_status channel_outgoing_channel(switch_core_session *session,
switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool);
+ switch_core_session **new_session, switch_memory_pool_t *pool);
static switch_status channel_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id);
static switch_status channel_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
while (switch_channel_get_state(channel) == CS_TRANSMIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
if (switch_time_now() - last >= waitsec) {
char buf[512];
- switch_event *event;
+ switch_event_t *event;
snprintf(buf, sizeof(buf), "BRRRRING! BRRRRING! call %s\n", tech_pvt->call_id);
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
static switch_status channel_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool)
+ switch_core_session **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&channel_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
static const char modname[] = "mod_woomera";
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
#define STRLEN 15
#define FRAME_LEN 480
static switch_status woomerachan_on_loopback(switch_core_session *session);
static switch_status woomerachan_on_transmit(switch_core_session *session);
static switch_status woomerachan_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool);
+ switch_core_session **new_session, switch_memory_pool_t *pool);
static switch_status woomerachan_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
switch_io_flag flags, int stream_id);
static switch_status woomerachan_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
static int woomera_profile_thread_running(woomera_profile * profile, int set, int new);
static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket);
static int tech_create_read_socket(private_object * tech_pvt);
-static void *woomera_channel_thread_run(switch_thread *thread, void *obj);
+static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj);
static void *woomera_thread_run(void *obj);
static int tech_activate(private_object * tech_pvt);
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
static switch_status woomerachan_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool)
+ switch_core_session **new_session, switch_memory_pool_t *pool)
{
if ((*new_session = switch_core_session_request(&woomerachan_endpoint_interface, pool)) != 0) {
struct private_object *tech_pvt;
static int tech_create_read_socket(private_object * tech_pvt)
{
- switch_memory_pool *pool = switch_core_session_get_pool(tech_pvt->session);
+ switch_memory_pool_t *pool = switch_core_session_get_pool(tech_pvt->session);
if ((tech_pvt->port = globals.next_woomera_port++) >= WOOMERA_MAX_PORT) {
tech_pvt->port = globals.next_woomera_port = WOOMERA_MIN_PORT;
-static void *woomera_channel_thread_run(switch_thread *thread, void *obj)
+static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
{
switch_core_session *session = obj;
switch_channel *channel = NULL;
static const char modname[] = "mod_event_multicast";
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
static struct {
char *address;
}
-static void event_handler(switch_event *event)
+static void event_handler(switch_event_t *event)
{
char buf[1024];
size_t len;
SWITCH_MOD_DECLARE(switch_status) switch_module_runtime(void)
{
- switch_event *local_event;
+ switch_event_t *local_event;
char buf[1024];
globals.running = 1;
//#define TORTURE_ME
-static void event_handler(switch_event *event)
+static void event_handler(switch_event_t *event)
{
char buf[1024];
#define TTHREADS 500
static int THREADS = 0;
-static void *torture_thread(switch_thread *thread, void *obj)
+static void *torture_thread(switch_thread_t *thread, void *obj)
{
int y = 0;
int z = 0;
switch_core_thread_session *ts = obj;
- switch_event *event;
+ switch_event_t *event;
z = THREADS++;
}
if (ts->pool) {
- switch_memory_pool *pool = ts->pool;
+ switch_memory_pool_t *pool = ts->pool;
switch_core_destroy_memory_pool(&pool);
}
struct session session;
} globals;
-static void event_handler(switch_event *event)
+static void event_handler(switch_event_t *event)
{
char buf[1024];
iks *msg;
static const char modname[] = "mod_zeroconf";
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
static struct {
sw_discovery discovery;
}
-static void event_handler(switch_event *event)
+static void event_handler(switch_event_t *event)
{
sw_text_record text_record;
sw_result result;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sw_text_record_init() failed\n");
return;
} else {
- switch_event_header *hp;
+ switch_event_header_t *hp;
char *service = switch_event_get_header(event, "service");
char *port = switch_event_get_header(event, "port");
sw_port porti = 0;
switch_codec codec;
switch_buffer *audio_buffer;
switch_buffer *loop_buffer;
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
switch_timer *timer;
switch_timer timer_base;
char code_buffer[1024];
char *path;
unsigned int flags;
switch_file_t *fd;
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
char *buf;
switch_size_t buflen;
int32 bufsize;
};
struct db_obj {
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
switch_core_db *db;
switch_core_db_stmt *stmt;
char *dbname;
/*********************************************************************************/
static JSBool session_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
- switch_memory_pool *pool = NULL;
+ switch_memory_pool_t *pool = NULL;
if (argc > 2) {
struct js_session *jss = NULL;
JSObject *session_obj;
/*********************************************************************************/
static JSBool fileio_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
switch_file_t *fd;
char *path, *flags_str;
unsigned int flags = 0;
struct fileio_obj *fio = JS_GetPrivate(cx, obj);
if (fio) {
- switch_memory_pool *pool = fio->pool;
+ switch_memory_pool_t *pool = fio->pool;
switch_core_destroy_memory_pool(&pool);
pool = NULL;
}
/*********************************************************************************/
static JSBool db_construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
switch_core_db *db;
struct db_obj *dbo;
struct db_obj *dbo = JS_GetPrivate(cx, obj);
if (dbo) {
- switch_memory_pool *pool = dbo->pool;
+ switch_memory_pool_t *pool = dbo->pool;
if (dbo->stmt) {
switch_core_db_finalize(dbo->stmt);
dbo->stmt = NULL;
struct teletone_obj *tto = NULL;
struct js_session *jss = NULL;
switch_codec *read_codec;
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
char *timer_name = NULL;
if (argc > 0) {
static void teletone_destroy(JSContext *cx, JSObject *obj)
{
struct teletone_obj *tto = JS_GetPrivate(cx, obj);
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
if (tto) {
if (tto->timer) {
switch_core_timer_destroy(tto->timer);
-static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t *thread, void *obj)
{
char *input_code = obj;
}
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
static void js_thread_launch(char *text)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
if (!module_pool) {
/*.directory_interface */ NULL
};
-static switch_memory_pool *module_pool = NULL;
-static switch_hash *log_hash = NULL;
-static switch_hash *name_hash = NULL;
+static switch_memory_pool_t *module_pool = NULL;
+static switch_hash_t *log_hash = NULL;
+static switch_hash_t *name_hash = NULL;
static int8_t all_level = -1;
static void del_mapping(char *var) {
char path[256] = "";
char *ppath = NULL;
char *err = NULL;
- switch_event *event;
+ switch_event_t *event;
int bg = 0;
FILE *f;
#ifdef WIN32
*
*/
#include <switch_buffer.h>
+#include <switch.h>
static uint32_t buffer_id = 0;
uint32_t id;
};
-SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, switch_buffer **buffer, switch_size_t max_len)
+SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool_t *pool, switch_buffer **buffer, switch_size_t max_len)
{
switch_buffer *new_buffer;
*
*/
#include <switch_caller.h>
+#include <switch.h>
-SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_pool *pool,
+SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_memory_pool_t *pool,
char *dialplan,
char *caller_id_name,
char *caller_id_number,
}
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile *caller_profile, char *prefix,
- switch_event *event)
+ switch_event_t *event)
{
char header_name[1024];
*
*/
#include <switch_channel.h>
+#include <switch.h>
struct switch_cause_table {
const char *name;
switch_caller_extension *caller_extension;
const struct switch_state_handler_table *state_handlers[SWITCH_MAX_STATE_HANDLERS];
int state_handler_index;
- switch_hash *variables;
+ switch_hash_t *variables;
switch_channel_timetable_t *times;
void *private_info;
switch_call_cause_t hangup_cause;
return channel->times;
}
-SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, switch_memory_pool *pool)
+SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, switch_memory_pool_t *pool)
{
assert(pool != NULL);
SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf(switch_channel *channel, char *dtmf, switch_size_t len)
{
switch_size_t bytes;
- switch_event *event;
+ switch_event_t *event;
assert(channel != NULL);
channel->hangup_cause = SWITCH_CAUSE_NORMAL_CLEARING;
}
if (state < CS_HANGUP) {
- switch_event *event;
+ switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_STATE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
return channel->state;
}
-SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel *channel, switch_event *event)
+SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel *channel, switch_event_t *event)
{
switch_caller_profile *caller_profile, *originator_caller_profile, *originatee_caller_profile;
switch_hash_index_t *hi;
}
if (!channel->caller_profile) {
- switch_event *event;
+ switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_CREATE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
}
if (channel->state < CS_HANGUP) {
- switch_event *event;
+ switch_event_t *event;
switch_channel_state last_state = channel->state;
channel->state = CS_HANGUP;
}
if (switch_core_session_answer_channel(channel->session) == SWITCH_STATUS_SUCCESS) {
- switch_event *event;
+ switch_event_t *event;
channel->times->answered = switch_time_now();
switch_channel_set_flag(channel, CF_ANSWERED);
*
*/
#include <switch_config.h>
+#include <switch.h>
SWITCH_DECLARE(int) switch_config_open_file(switch_config *cfg, char *file_path)
{
} else {
switch_size_t retsize;
switch_time_exp_t tm;
- switch_event *event;
+ switch_event_t *event;
switch_time_exp_lt(&tm, switch_time_now());
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
uint32_t id;
char name[80];
int thread_running;
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
switch_channel *channel;
- switch_thread *thread;
+ switch_thread_t *thread;
const switch_endpoint_interface *endpoint_interface;
struct switch_io_event_hooks event_hooks;
switch_codec *read_codec;
uint8_t enc_read_buf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
- switch_audio_resampler *read_resampler;
- switch_audio_resampler *write_resampler;
+ switch_audio_resampler_t *read_resampler;
+ switch_audio_resampler_t *write_resampler;
switch_mutex_t *mutex;
switch_thread_cond_t *cond;
time_t initiated;
uint32_t session_id;
apr_pool_t *memory_pool;
- switch_hash *session_table;
- switch_hash *stack_table;
+ switch_hash_t *session_table;
+ switch_hash_t *stack_table;
switch_core_db *db;
switch_core_db *event_db;
const struct switch_state_handler_table *state_handlers[SWITCH_MAX_STATE_HANDLERS];
};
/* Prototypes */
-static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread *thread, void *obj);
+static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj);
static void switch_core_standard_on_init(switch_core_session *session);
static void switch_core_standard_on_hangup(switch_core_session *session);
static void switch_core_standard_on_ring(switch_core_session *session);
return status;
}
-SWITCH_DECLARE(switch_status) switch_core_session_event_send(char *uuid_str, switch_event *event)
+SWITCH_DECLARE(switch_status) switch_core_session_event_send(char *uuid_str, switch_event_t *event)
{
switch_core_session *session = NULL;
switch_status status = SWITCH_STATUS_FALSE;
SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, char *codec_name, uint32_t rate, int ms,
int channels, uint32_t flags,
const switch_codec_settings *codec_settings,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
const switch_codec_interface *codec_interface;
const switch_codec_implementation *iptr, *implementation = NULL;
}
SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char *file_path, unsigned int flags,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
char *ext;
switch_status status;
char *source,
char *dsn,
char *passwd,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
switch_status status;
char *voice_name,
unsigned int rate,
switch_speech_flag *flags,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
switch_status status;
}
SWITCH_DECLARE(switch_status) switch_core_timer_init(switch_timer *timer, char *timer_name, int interval, int samples,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
switch_timer_interface *timer_interface;
switch_status status;
return SWITCH_STATUS_SUCCESS;
}
-static void *switch_core_service_thread(switch_thread *thread, void *obj)
+static void *switch_core_service_thread(switch_thread_t *thread, void *obj)
{
switch_core_thread_session *data = obj;
switch_core_session *session = data->objs[0];
switch_core_session_launch_thread(session, switch_core_service_thread, thread_session);
}
-SWITCH_DECLARE(switch_memory_pool *) switch_core_session_get_pool(switch_core_session *session)
+SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(switch_core_session *session)
{
return session->pool;
}
}
-SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup)
+SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool_t *pool, char *todup)
{
char *duped = NULL;
switch_size_t len;
char *endpoint_name,
switch_caller_profile *caller_profile,
switch_core_session **new_session,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
struct switch_io_event_hook_outgoing_channel *ptr;
switch_status status = SWITCH_STATUS_FALSE;
return status;
}
-SWITCH_DECLARE(switch_status) switch_core_session_queue_event(switch_core_session *session, switch_event *event)
+SWITCH_DECLARE(switch_status) switch_core_session_queue_event(switch_core_session *session, switch_event_t *event)
{
struct switch_io_event_hook_queue_event *ptr;
}
-SWITCH_DECLARE(switch_status) switch_core_new_memory_pool(switch_memory_pool **pool)
+SWITCH_DECLARE(switch_status) switch_core_new_memory_pool(switch_memory_pool_t **pool)
{
assert(runtime.memory_pool != NULL);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_core_destroy_memory_pool(switch_memory_pool **pool)
+SWITCH_DECLARE(switch_status) switch_core_destroy_memory_pool(switch_memory_pool_t **pool)
{
apr_pool_destroy(*pool);
return SWITCH_STATUS_SUCCESS;
static void switch_core_standard_on_execute(switch_core_session *session)
{
switch_caller_extension *extension;
- switch_event *event;
+ switch_event_t *event;
const switch_application_interface *application_interface;
static int handle_fatality(int sig)
{
- switch_thread_id thread_id;
+ switch_thread_id_t thread_id;
jmp_buf *env;
if (sig && (thread_id = switch_thread_self()) && (env = (jmp_buf *) apr_hash_get(runtime.stack_table, &thread_id, sizeof(thread_id)))) {
const switch_endpoint_interface *endpoint_interface;
const switch_state_handler_table *driver_state_handler = NULL;
const switch_state_handler_table *application_state_handler = NULL;
- switch_thread_id thread_id = switch_thread_self();
+ switch_thread_id_t thread_id = switch_thread_self();
jmp_buf env;
int sig;
#endif
if ((sig = setjmp(env)) != 0) {
- switch_event *event;
+ switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_SESSION_CRASH) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session **session)
{
- switch_memory_pool *pool;
- switch_event *event;
+ switch_memory_pool_t *pool;
+ switch_event_t *event;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Close Channel %s\n", switch_channel_get_name((*session)->channel));
}
-SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash **hash, switch_memory_pool *pool)
+SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash_t **hash, switch_memory_pool_t *pool)
{
assert(pool != NULL);
return SWITCH_STATUS_GENERR;
}
-SWITCH_DECLARE(switch_status) switch_core_hash_destroy(switch_hash *hash)
+SWITCH_DECLARE(switch_status) switch_core_hash_destroy(switch_hash_t *hash)
{
assert(hash != NULL);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_core_hash_insert_dup(switch_hash *hash, char *key, void *data)
+SWITCH_DECLARE(switch_status) switch_core_hash_insert_dup(switch_hash_t *hash, char *key, void *data)
{
apr_hash_set(hash, switch_core_strdup(apr_hash_pool_get(hash), key), APR_HASH_KEY_STRING, data);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_core_hash_insert(switch_hash *hash, char *key, void *data)
+SWITCH_DECLARE(switch_status) switch_core_hash_insert(switch_hash_t *hash, char *key, void *data)
{
apr_hash_set(hash, key, APR_HASH_KEY_STRING, data);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_core_hash_delete(switch_hash *hash, char *key)
+SWITCH_DECLARE(switch_status) switch_core_hash_delete(switch_hash_t *hash, char *key)
{
apr_hash_set(hash, key, APR_HASH_KEY_STRING, NULL);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash *hash, char *key)
+SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t *hash, char *key)
{
return apr_hash_get(hash, key, APR_HASH_KEY_STRING);
}
*/
-SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool *pool)
+SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void *obj, switch_memory_pool_t *pool)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
switch_core_thread_session *ts;
int mypool;
}
-static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj)
{
switch_core_session *session = obj;
session->thread = thread;
SWITCH_DECLARE(void) switch_core_session_thread_launch(switch_core_session *session)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
switch_threadattr_create(&thd_attr, session->pool);
switch_threadattr_detach_set(thd_attr, 1);
SWITCH_DECLARE(void) switch_core_session_launch_thread(switch_core_session *session, switch_thread_start_t func,
void *obj)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
switch_threadattr_create(&thd_attr, session->pool);
switch_threadattr_detach_set(thd_attr, 1);
}
-SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, switch_size_t memory)
+SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool_t *pool, switch_size_t memory)
{
void *ptr = NULL;
assert(pool != NULL);
}
SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_endpoint_interface *endpoint_interface,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
- switch_memory_pool *usepool;
+ switch_memory_pool_t *usepool;
switch_core_session *session;
switch_uuid_t uuid;
return session;
}
-SWITCH_DECLARE(switch_core_session *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool *pool)
+SWITCH_DECLARE(switch_core_session *) switch_core_session_request_by_name(char *endpoint_name, switch_memory_pool_t *pool)
{
const switch_endpoint_interface *endpoint_interface;
return status;
}
-static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj)
{
void *pop;
uint32_t itterations = 0;
static void switch_core_sql_thread_launch(void)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
assert(runtime.memory_pool != NULL);
}
-static void core_event_handler(switch_event *event)
+static void core_event_handler(switch_event_t *event)
{
char buf[1024];
char *sql = NULL;
*
*/
#include <switch_event.h>
+#include <switch.h>
static switch_event_node *EVENT_NODES[SWITCH_EVENT_ALL + 1] = { NULL };
static switch_mutex_t *BLOCK = NULL;
static switch_mutex_t *POOL_LOCK = NULL;
-static switch_memory_pool *RUNTIME_POOL = NULL;
-//static switch_memory_pool *APOOL = NULL;
-//static switch_memory_pool *BPOOL = NULL;
-static switch_memory_pool *THRUNTIME_POOL = NULL;
+static switch_memory_pool_t *RUNTIME_POOL = NULL;
+//static switch_memory_pool_t *APOOL = NULL;
+//static switch_memory_pool_t *BPOOL = NULL;
+static switch_memory_pool_t *THRUNTIME_POOL = NULL;
static switch_queue_t *EVENT_QUEUE[3] = {0,0,0};
static int POOL_COUNT_MAX = 2000;
-static switch_hash *CUSTOM_HASH = NULL;
+static switch_hash_t *CUSTOM_HASH = NULL;
static int THREAD_RUNNING = 0;
#if 0
#define DUP(str) locked_dup(str)
#endif
+#ifndef ALLOC
#define ALLOC(size) malloc(size)
+#endif
+#ifndef DUP
#define DUP(str) strdup(str)
+#endif
+#ifndef FREE
#define FREE(ptr) if (ptr) free(ptr)
+#endif
-/* make sure this is synced with the switch_event_t enum in switch_types.h
+/* make sure this is synced with the switch_event_types_t enum in switch_types.h
also never put any new ones before EVENT_ALL
*/
static char *EVENT_NAMES[] = {
};
-static int switch_events_match(switch_event *event, switch_event_node *node)
+static int switch_events_match(switch_event_t *event, switch_event_node *node)
{
int match = 0;
return match;
}
-static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, void *obj)
{
- switch_event *out_event = NULL;
+ switch_event_t *out_event = NULL;
switch_queue_t *queue = NULL;
switch_queue_t *queues[3] = {0,0,0};
void *pop;
return NULL;
}
-SWITCH_DECLARE(void) switch_event_deliver(switch_event **event)
+SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event)
{
- switch_event_t e;
+ switch_event_types_t e;
switch_event_node *node;
for (e = (*event)->event_id;; e = SWITCH_EVENT_ALL) {
return THREAD_RUNNING ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}
-SWITCH_DECLARE(char *) switch_event_name(switch_event_t event)
+SWITCH_DECLARE(char *) switch_event_name(switch_event_types_t event)
{
assert(BLOCK != NULL);
assert(RUNTIME_POOL != NULL);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_event_init(switch_memory_pool *pool)
+SWITCH_DECLARE(switch_status) switch_event_init(switch_memory_pool_t *pool)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
switch_threadattr_create(&thd_attr, pool);
switch_threadattr_detach_set(thd_attr, 1);
}
-SWITCH_DECLARE(switch_status) switch_event_create_subclass(switch_event **event,
- switch_event_t event_id,
+SWITCH_DECLARE(switch_status) switch_event_create_subclass(switch_event_t **event,
+ switch_event_types_t event_id,
char *subclass_name)
{
return SWITCH_STATUS_GENERR;
}
- if ((*event = ALLOC(sizeof(switch_event))) == 0) {
+ if ((*event = ALLOC(sizeof(switch_event_t))) == 0) {
return SWITCH_STATUS_MEMERR;
}
- memset(*event, 0, sizeof(switch_event));
+ memset(*event, 0, sizeof(switch_event_t));
(*event)->event_id = event_id;
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_event_set_priority(switch_event *event, switch_priority_t priority)
+SWITCH_DECLARE(switch_status) switch_event_set_priority(switch_event_t *event, switch_priority_t priority)
{
event->priority = priority;
switch_event_add_header(event, SWITCH_STACK_TOP, "priority", switch_priority_name(priority));
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(char *) switch_event_get_header(switch_event *event, char *header_name)
+SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name)
{
- switch_event_header *hp;
+ switch_event_header_t *hp;
if (header_name) {
for (hp = event->headers; hp; hp = hp->next) {
if (!strcasecmp(hp->name, header_name)) {
return NULL;
}
-SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switch_stack_t stack, char *header_name,
+SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event_t *event, switch_stack_t stack, char *header_name,
char *fmt, ...)
{
int ret = 0;
if (ret == -1) {
return SWITCH_STATUS_MEMERR;
} else {
- switch_event_header *header, *hp;
+ switch_event_header_t *header, *hp;
if ((header = ALLOC(sizeof(*header))) == 0) {
return SWITCH_STATUS_MEMERR;
}
-SWITCH_DECLARE(switch_status) switch_event_add_body(switch_event *event, char *fmt, ...)
+SWITCH_DECLARE(switch_status) switch_event_add_body(switch_event_t *event, char *fmt, ...)
{
int ret = 0;
char data[2048];
}
}
-SWITCH_DECLARE(void) switch_event_destroy(switch_event **event)
+SWITCH_DECLARE(void) switch_event_destroy(switch_event_t **event)
{
- switch_event *ep = *event;
- switch_event_header *hp, *this;
+ switch_event_t *ep = *event;
+ switch_event_header_t *hp, *this;
for (hp = ep->headers; hp;) {
this = hp;
*event = NULL;
}
-SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_event *todup)
+SWITCH_DECLARE(switch_status) switch_event_dup(switch_event_t **event, switch_event_t *todup)
{
- switch_event_header *header, *hp, *hp2;
+ switch_event_header_t *header, *hp, *hp2;
if (switch_event_create_subclass(event, todup->event_id, todup->subclass->name) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_GENERR;
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event *event, char *buf, switch_size_t buflen, char *fmt, ...)
+SWITCH_DECLARE(switch_status) switch_event_serialize(switch_event_t *event, char *buf, switch_size_t buflen, char *fmt, ...)
{
switch_size_t len = 0;
- switch_event_header *hp;
+ switch_event_header_t *hp;
char *data = NULL, *body = NULL;
int ret = 0;
va_list ap;
}
-SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event **event,
+SWITCH_DECLARE(switch_status) switch_event_fire_detailed(char *file, char *func, int line, switch_event_t **event,
void *user_data)
{
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_t event, char *subclass_name,
+SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_types_t event, char *subclass_name,
switch_event_callback_t callback, void *user_data)
{
switch_event_node *event_node;
switch_timer timer;
switch_core_thread_session thread_session;
switch_codec codec;
- switch_memory_pool *pool = switch_core_session_get_pool(session);
+ switch_memory_pool_t *pool = switch_core_session_get_pool(session);
char *codec_name;
int stream_id;
switch_status status = SWITCH_STATUS_SUCCESS;
switch_timer timer;
switch_core_thread_session thread_session;
switch_codec codec;
- switch_memory_pool *pool = switch_core_session_get_pool(session);
+ switch_memory_pool_t *pool = switch_core_session_get_pool(session);
char *codec_name;
int x;
int stream_id;
int running;
};
-static void *audio_bridge_thread(switch_thread *thread, void *obj)
+static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
{
struct switch_core_thread_session *his_thread, *data = obj;
int *stream_id_p;
}
if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
- switch_event *event;
+ switch_event_t *event;
switch_core_session_message msg = {0};
switch_channel_set_state(peer_channel, CS_HOLD);
};
struct switch_loadable_module_container {
- switch_hash *module_hash;
- switch_hash *endpoint_hash;
- switch_hash *codec_hash;
- switch_hash *dialplan_hash;
- switch_hash *timer_hash;
- switch_hash *application_hash;
- switch_hash *api_hash;
- switch_hash *file_hash;
- switch_hash *speech_hash;
- switch_hash *directory_hash;
- switch_memory_pool *pool;
+ switch_hash_t *module_hash;
+ switch_hash_t *endpoint_hash;
+ switch_hash_t *codec_hash;
+ switch_hash_t *dialplan_hash;
+ switch_hash_t *timer_hash;
+ switch_hash_t *application_hash;
+ switch_hash_t *api_hash;
+ switch_hash_t *file_hash;
+ switch_hash_t *speech_hash;
+ switch_hash_t *directory_hash;
+ switch_memory_pool_t *pool;
};
static struct switch_loadable_module_container loadable_modules;
-static void *switch_loadable_module_exec(switch_thread *thread, void *obj)
+static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread ended for %s\n", module->interface->module_name);
if (ts->pool) {
- switch_memory_pool *pool = ts->pool;
+ switch_memory_pool_t *pool = ts->pool;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Pool for %s\n", module->interface->module_name);
switch_core_destroy_memory_pool(&pool);
}
return switch_core_hash_find(loadable_modules.directory_hash, name);
}
-SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool *pool, switch_codec_interface **array,
+SWITCH_DECLARE(int) switch_loadable_module_get_codecs(switch_memory_pool_t *pool, switch_codec_interface **array,
int arraylen)
{
switch_hash_index_t *hi;
{
switch_api_interface *api;
switch_status status;
- switch_event *event;
+ switch_event_t *event;
if ((api = switch_loadable_module_get_api_interface(cmd)) != 0) {
status = api->function(arg, retbuf, len);
typedef struct switch_log_binding switch_log_binding;
-static switch_memory_pool *LOG_POOL = NULL;
+static switch_memory_pool_t *LOG_POOL = NULL;
static switch_log_binding *BINDINGS = NULL;
static switch_mutex_t *BINDLOCK = NULL;
static switch_queue_t *LOG_QUEUE = NULL;
return SWITCH_STATUS_SUCCESS;
}
-static void *SWITCH_THREAD_FUNC log_thread(switch_thread *thread, void *obj)
+static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *thread, void *obj)
{
/* To Be or Not To Be */
}
if (channel == SWITCH_CHANNEL_ID_EVENT) {
- switch_event *event;
+ switch_event_t *event;
if (switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep);
}
-SWITCH_DECLARE(switch_status) switch_log_init(switch_memory_pool *pool)
+SWITCH_DECLARE(switch_status) switch_log_init(switch_memory_pool_t *pool)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
assert(pool != NULL);
*
*/
#include <switch_resample.h>
+#include <switch.h>
#include <libresample.h>
#define NORMFACT (float)0x8000
#define MAXSAMPLE (float)0x7FFF
-SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **new_resampler,
+SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler_t **new_resampler,
int from_rate,
switch_size_t from_size,
- int to_rate, uint32_t to_size, switch_memory_pool *pool)
+ int to_rate, uint32_t to_size, switch_memory_pool_t *pool)
{
- switch_audio_resampler *resampler;
+ switch_audio_resampler_t *resampler;
double lto_rate, lfrom_rate;
if ((resampler = switch_core_alloc(pool, sizeof(*resampler))) == 0) {
}
-SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler *resampler, float *src, int srclen, float *dst,
+SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler_t *resampler, float *src, int srclen, float *dst,
uint32_t dstlen, int last)
{
int o = 0, srcused = 0, srcpos = 0, out = 0;
return out;
}
-SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler *resampler)
+SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler_t *resampler)
{
resample_close(resampler->resampler);
}
uint32_t ts;
uint32_t flags;
- switch_memory_pool *pool;
+ switch_memory_pool_t *pool;
switch_sockaddr_t *from_addr;
char *ice_user;
static int global_init = 0;
-static switch_status ice_out(switch_rtp *rtp_session)
+static switch_status ice_out(switch_rtp_t *rtp_session)
{
assert(rtp_session != NULL);
return SWITCH_STATUS_SUCCESS;
}
-static void handle_ice(switch_rtp *rtp_session, void *data, switch_size_t len)
+static void handle_ice(switch_rtp_t *rtp_session, void *data, switch_size_t len)
{
switch_stun_packet_t *packet;
switch_stun_packet_attribute_t *attr;
}
-SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool *pool)
+SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
{
if (global_init) {
return;
}
-SWITCH_DECLARE(switch_status) switch_rtp_set_local_address(switch_rtp *rtp_session, char *host, switch_port_t port, const char **err)
+SWITCH_DECLARE(switch_status) switch_rtp_set_local_address(switch_rtp_t *rtp_session, char *host, switch_port_t port, const char **err)
{
*err = "Success";
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_rtp_set_remote_address(switch_rtp *rtp_session, char *host, switch_port_t port, const char **err)
+SWITCH_DECLARE(switch_status) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, char *host, switch_port_t port, const char **err)
{
*err = "Success";
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp **new_rtp_session,
+SWITCH_DECLARE(switch_status) switch_rtp_create(switch_rtp_t **new_rtp_session,
switch_payload_t payload,
uint32_t packet_size,
uint32_t ms_per_packet,
switch_rtp_flag_t flags,
char *crypto_key,
const char **err,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
- switch_rtp *rtp_session = NULL;
+ switch_rtp_t *rtp_session = NULL;
srtp_policy_t policy;
char key[MAX_KEY_LEN];
uint32_t ssrc = rand() & 0xffff;
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_rtp *)switch_rtp_new(char *rx_host,
+SWITCH_DECLARE(switch_rtp_t *)switch_rtp_new(char *rx_host,
switch_port_t rx_port,
char *tx_host,
switch_port_t tx_port,
switch_rtp_flag_t flags,
char *crypto_key,
const char **err,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
- switch_rtp *rtp_session;
+ switch_rtp_t *rtp_session;
if (switch_rtp_create(&rtp_session, payload, packet_size, ms_per_packet, flags, crypto_key, err, pool) != SWITCH_STATUS_SUCCESS) {
return NULL;
}
-SWITCH_DECLARE(switch_status) switch_rtp_activate_ice(switch_rtp *rtp_session, char *login, char *rlogin)
+SWITCH_DECLARE(switch_status) switch_rtp_activate_ice(switch_rtp_t *rtp_session, char *login, char *rlogin)
{
char ice_user[80];
char user_ice[80];
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp *rtp_session)
+SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
{
apr_socket_shutdown(rtp_session->sock, APR_SHUTDOWN_READWRITE);
switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_IO);
}
-SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp **rtp_session)
+SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session)
{
switch_rtp_kill_socket(*rtp_session);
switch_socket_close((*rtp_session)->sock);
return;
}
-SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp *rtp_session)
+SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp_t *rtp_session)
{
return rtp_session->sock;
}
-SWITCH_DECLARE(void) switch_rtp_set_default_packet_size(switch_rtp *rtp_session, uint16_t packet_size)
+SWITCH_DECLARE(void) switch_rtp_set_default_packet_size(switch_rtp_t *rtp_session, uint16_t packet_size)
{
rtp_session->packet_size = packet_size;
}
-SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp *rtp_session)
+SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp_t *rtp_session)
{
return rtp_session->packet_size;
}
-SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, switch_payload_t payload)
+SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp_t *rtp_session, switch_payload_t payload)
{
rtp_session->payload = payload;
}
-SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp *rtp_session)
+SWITCH_DECLARE(uint32_t) switch_rtp_get_default_payload(switch_rtp_t *rtp_session)
{
return rtp_session->payload;
}
-SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp *rtp_session, switch_rtp_invalid_handler on_invalid)
+SWITCH_DECLARE(void) switch_rtp_set_invald_handler(switch_rtp_t *rtp_session, switch_rtp_invalid_handler on_invalid)
{
rtp_session->invalid_handler = on_invalid;
}
-SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp *rtp_session, switch_rtp_flag_t flags)
+SWITCH_DECLARE(void) switch_rtp_set_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
{
switch_set_flag(rtp_session, flags);
}
-SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp *rtp_session, switch_rtp_flag_t flags)
+SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
{
return (uint8_t) switch_test_flag(rtp_session, flags);
}
-SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp *rtp_session, switch_rtp_flag_t flags)
+SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
{
switch_clear_flag(rtp_session, flags);
}
-static int rtp_common_read(switch_rtp *rtp_session, switch_payload_t *payload_type, switch_frame_flag *flags)
+static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_type, switch_frame_flag *flags)
{
switch_size_t bytes;
switch_status status;
return (int) bytes;
}
-SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags)
+SWITCH_DECLARE(switch_status) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags)
{
int bytes = rtp_common_read(rtp_session, payload_type, flags);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read_frame(switch_rtp *rtp_session, switch_frame *frame)
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame *frame)
{
int bytes = rtp_common_read(rtp_session, &frame->payload, &frame->flags);
}
-SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags)
+SWITCH_DECLARE(switch_status) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session, void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag *flags)
{
int bytes = rtp_common_read(rtp_session, payload_type, flags);
return SWITCH_STATUS_SUCCESS;
}
-static int rtp_common_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, switch_frame_flag *flags)
+static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, switch_frame_flag *flags)
{
switch_size_t bytes;
uint8_t packetize = (rtp_session->packet_size > datalen && (payload == rtp_session->payload)) ? 1 : 0;
send_msg->header.m = 1;
rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0;
if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_TALK)) {
- switch_event *event;
+ switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_TALK) == SWITCH_STATUS_SUCCESS) {
switch_channel *channel = switch_core_session_get_channel(rtp_session->vad_data.session);
switch_channel_event_set_data(channel, event);
switch_clear_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING);
rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0;
if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_NOTALK)) {
- switch_event *event;
+ switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_NOTALK) == SWITCH_STATUS_SUCCESS) {
switch_channel *channel = switch_core_session_get_channel(rtp_session->vad_data.session);
switch_channel_event_set_data(channel, event);
}
-SWITCH_DECLARE(switch_status) switch_rtp_disable_vad(switch_rtp *rtp_session)
+SWITCH_DECLARE(switch_status) switch_rtp_disable_vad(switch_rtp_t *rtp_session)
{
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD)) {
return SWITCH_STATUS_GENERR;
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status) switch_rtp_enable_vad(switch_rtp *rtp_session, switch_core_session *session, switch_codec *codec, switch_vad_flag_t flags)
+SWITCH_DECLARE(switch_status) switch_rtp_enable_vad(switch_rtp_t *rtp_session, switch_core_session *session, switch_codec *codec, switch_vad_flag_t flags)
{
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD)) {
return SWITCH_STATUS_GENERR;
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint32_t ts, switch_frame_flag *flags)
+SWITCH_DECLARE(int) switch_rtp_write(switch_rtp_t *rtp_session, void *data, uint32_t datalen, uint32_t ts, switch_frame_flag *flags)
{
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) {
}
-SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp *rtp_session, switch_frame *frame, uint32_t ts)
+SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_frame *frame, uint32_t ts)
{
uint8_t fwd = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) && switch_test_flag(frame, SFF_RAW_RTP)) ? 1 : 0;
uint8_t packetize = (rtp_session->packet_size > frame->datalen && (frame->payload == rtp_session->payload)) ? 1 : 0;
}
-SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t m, uint8_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags)
+SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, void *data, uint16_t datalen, uint8_t m, uint8_t payload, uint32_t ts, uint16_t mseq, switch_frame_flag *flags)
{
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) || !rtp_session->remote_addr) {
return rtp_common_write(rtp_session, data, datalen, m, payload, flags);
}
-SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp *rtp_session)
+SWITCH_DECLARE(uint32_t) switch_rtp_get_ssrc(switch_rtp_t *rtp_session)
{
return rtp_session->send_msg.header.ssrc;
}
-SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp *rtp_session, void *private_data)
+SWITCH_DECLARE(void) switch_rtp_set_private(switch_rtp_t *rtp_session, void *private_data)
{
rtp_session->private_data = private_data;
}
-SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp *rtp_session)
+SWITCH_DECLARE(void *)switch_rtp_get_private(switch_rtp_t *rtp_session)
{
return rtp_session->private_data;
}
char *stunip,
switch_port_t stunport,
char **err,
- switch_memory_pool *pool)
+ switch_memory_pool_t *pool)
{
switch_sockaddr_t *local_addr = NULL, *remote_addr = NULL, *from_addr = NULL;
}
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock,
- switch_int16_t flags, switch_memory_pool *pool)
+ switch_int16_t flags, switch_memory_pool_t *pool)
{
switch_pollset_t *pollset;