FreeSWITCH API Documentation
1.7.0
|
The purpose of this module is to make a plain buffering interface that can be used for read/write buffers throughout the application. The first implementation was done to provide the functionality and the interface and I think it can be optimized under the hood as we go using bucket brigades and/or ring buffering techniques.
void switch_buffer_add_mutex | ( | _In_ switch_buffer_t * | buffer, |
_In_ switch_mutex_t * | mutex | ||
) |
Referenced by switch_ivr_eavesdrop_session().
switch_status_t switch_buffer_create | ( | _In_ switch_memory_pool_t * | pool, |
_Out_ switch_buffer_t ** | buffer, | ||
_In_ switch_size_t | max_len | ||
) |
Allocate a new switch_buffer.
pool | Pool to allocate the buffer from |
buffer | returned pointer to the new buffer |
max_len | length required by the buffer |
switch_status_t switch_buffer_create_dynamic | ( | _Out_ switch_buffer_t ** | buffer, |
_In_ switch_size_t | blocksize, | ||
_In_ switch_size_t | start_len, | ||
_In_ switch_size_t | max_len | ||
) |
Allocate a new dynamic switch_buffer.
buffer | returned pointer to the new buffer |
blocksize | length to realloc by as data is added |
start_len | ammount of memory to reserve initially |
max_len | length the buffer is allowed to grow to |
Referenced by inband_dtmf_generate_callback(), recording_thread(), setup_ringback(), switch_core_file_read(), switch_core_media_bug_add(), switch_core_perform_file_open(), switch_core_session_read_frame(), switch_core_session_write_frame(), switch_core_speech_read_tts(), switch_ivr_eavesdrop_session(), switch_ivr_gentones(), switch_ivr_originate(), switch_ivr_play_file(), and switch_ivr_wait_for_answer().
switch_status_t switch_buffer_create_partition | ( | switch_memory_pool_t * | pool, |
switch_buffer_t ** | buffer, | ||
void * | data, | ||
switch_size_t | datalen | ||
) |
Definition at line 79 of file switch_buffer.c.
References buffer_id, id, SWITCH_BUFFER_FLAG_PARTITION, switch_buffer_set_partition_data(), switch_core_alloc, switch_set_flag, SWITCH_STATUS_MEMERR, and SWITCH_STATUS_SUCCESS.
void switch_buffer_destroy | ( | switch_buffer_t ** | buffer | ) |
Destroy the buffer.
buffer | buffer to destroy |
Definition at line 381 of file switch_buffer.c.
References SWITCH_BUFFER_FLAG_DYNAMIC, switch_safe_free, and switch_test_flag.
Referenced by inband_dtmf_generate_callback(), record_callback(), setup_ringback(), switch_core_file_close(), switch_core_media_bug_destroy(), switch_core_session_perform_destroy(), switch_core_session_reset(), switch_core_speech_close(), switch_ivr_eavesdrop_session(), switch_ivr_gentones(), switch_ivr_originate(), switch_ivr_play_file(), and switch_ivr_wait_for_answer().
switch_size_t switch_buffer_freespace | ( | _In_ switch_buffer_t * | buffer | ) |
Get the freespace of a switch_buffer_t.
buffer | any buffer of type switch_buffer_t |
switch_size_t switch_buffer_inuse | ( | _In_ switch_buffer_t * | buffer | ) |
Get the in use amount of a switch_buffer_t.
buffer | any buffer of type switch_buffer_t |
Referenced by eavesdrop_callback(), generate_on_dtmf(), inband_dtmf_generate_callback(), recording_thread(), switch_core_file_close(), switch_core_file_read(), switch_core_file_write(), switch_core_media_bug_inuse(), switch_core_media_bug_read(), switch_core_session_read_frame(), switch_core_session_write_frame(), switch_core_speech_read_tts(), switch_ivr_eavesdrop_session(), switch_ivr_originate(), and switch_ivr_play_file().
switch_size_t switch_buffer_len | ( | _In_ switch_buffer_t * | buffer | ) |
Get the length of a switch_buffer_t.
buffer | any buffer of type switch_buffer_t |
void switch_buffer_lock | ( | _In_ switch_buffer_t * | buffer | ) |
Referenced by eavesdrop_callback(), and switch_ivr_eavesdrop_session().
switch_size_t switch_buffer_peek | ( | _In_ switch_buffer_t * | buffer, |
_In_ void * | data, | ||
_In_ switch_size_t | datalen | ||
) |
Read data from a switch_buffer_t up to the ammount of datalen if it is available, without removing read data from buffer.
buffer | any buffer of type switch_buffer_t |
data | pointer to the read data to be returned |
datalen | amount of data to be returned |
Referenced by switch_ivr_originate().
switch_size_t switch_buffer_peek_zerocopy | ( | _In_ switch_buffer_t * | buffer, |
_Out_ const void ** | ptr | ||
) |
switch_size_t switch_buffer_read | ( | _In_ switch_buffer_t * | buffer, |
_In_ void * | data, | ||
_In_ switch_size_t | datalen | ||
) |
Read data from a switch_buffer_t up to the ammount of datalen if it is available. Remove read data from buffer.
buffer | any buffer of type switch_buffer_t |
data | pointer to the read data to be returned |
datalen | amount of data to be returned |
Referenced by eavesdrop_callback(), inband_dtmf_generate_callback(), recording_thread(), switch_core_file_close(), switch_core_file_read(), switch_core_file_write(), switch_core_media_bug_read(), switch_core_session_read_frame(), switch_core_session_write_frame(), switch_core_speech_read_tts(), switch_ivr_eavesdrop_session(), switch_ivr_originate(), and switch_ivr_play_file().
switch_size_t switch_buffer_read_loop | ( | _In_ switch_buffer_t * | buffer, |
_In_ void * | data, | ||
_In_ switch_size_t | datalen | ||
) |
Read data endlessly from a switch_buffer_t.
buffer | any buffer of type switch_buffer_t |
data | pointer to the read data to be returned |
datalen | amount of data to be returned |
Referenced by switch_ivr_gentones(), switch_ivr_originate(), and switch_ivr_wait_for_answer().
switch_status_t switch_buffer_reset_partition_data | ( | switch_buffer_t * | buffer | ) |
Definition at line 56 of file switch_buffer.c.
References SWITCH_BUFFER_FLAG_PARTITION, SWITCH_STATUS_FALSE, SWITCH_STATUS_SUCCESS, and switch_test_flag.
Referenced by switch_buffer_set_partition_data().
void switch_buffer_set_loops | ( | _In_ switch_buffer_t * | buffer, |
_In_ int32_t | loops | ||
) |
Assign a number of loops to read.
buffer | any buffer of type switch_buffer_t |
loops | the number of loops (-1 for infinite) |
Referenced by setup_ringback(), switch_ivr_gentones(), and switch_ivr_wait_for_answer().
switch_status_t switch_buffer_set_partition_data | ( | switch_buffer_t * | buffer, |
void * | data, | ||
switch_size_t | datalen | ||
) |
Definition at line 68 of file switch_buffer.c.
References SWITCH_BUFFER_FLAG_PARTITION, switch_buffer_reset_partition_data(), SWITCH_STATUS_FALSE, and switch_test_flag.
Referenced by switch_buffer_create_partition().
switch_size_t switch_buffer_slide_write | ( | switch_buffer_t * | buffer, |
const void * | data, | ||
switch_size_t | datalen | ||
) |
Definition at line 365 of file switch_buffer.c.
References SWITCH_BUFFER_FLAG_PARTITION, switch_buffer_toss(), switch_buffer_write(), and switch_test_flag.
switch_size_t switch_buffer_toss | ( | _In_ switch_buffer_t * | buffer, |
_In_ switch_size_t | datalen | ||
) |
Remove data from the buffer.
buffer | any buffer of type switch_buffer_t |
datalen | amount of data to be removed |
Referenced by switch_core_media_bug_read(), and switch_ivr_originate().
switch_status_t switch_buffer_trylock | ( | _In_ switch_buffer_t * | buffer | ) |
void switch_buffer_unlock | ( | _In_ switch_buffer_t * | buffer | ) |
Referenced by eavesdrop_callback(), and switch_ivr_eavesdrop_session().
switch_size_t switch_buffer_write | ( | _In_ switch_buffer_t * | buffer, |
_In_bytecount_(datalen) const void * | data, | ||
_In_ switch_size_t | datalen | ||
) |
Write data into a switch_buffer_t up to the length of datalen.
buffer | any buffer of type switch_buffer_t |
data | pointer to the data to be written |
datalen | amount of data to be written |
Referenced by early_thread_run(), record_callback(), switch_core_file_read(), switch_core_file_write(), switch_core_session_read_frame(), switch_core_session_write_frame(), switch_core_speech_read_tts(), switch_ivr_play_file(), teletone_dtmf_generate_handler(), and teletone_handler().
void switch_buffer_zero | ( | _In_ switch_buffer_t * | buffer | ) |
Remove all data from the buffer.
buffer | any buffer of type switch_buffer_t |
Referenced by switch_core_file_command(), switch_core_file_seek(), switch_core_file_truncate(), switch_core_media_bug_flush(), switch_ivr_eavesdrop_session(), and switch_ivr_play_file().
switch_size_t switch_buffer_zwrite | ( | _In_ switch_buffer_t * | buffer, |
_In_bytecount_(datalen) const void * | data, | ||
_In_ switch_size_t | datalen | ||
) |
Referenced by eavesdrop_callback(), and switch_ivr_eavesdrop_session().