42 #define CACHED_PAYLOAD_MAX 5 86 data_payload =
ast_calloc(1,
sizeof(*data_payload));
106 buffer_space = buffer->
max - buffer->
count;
118 if (buffer_payload) {
133 if (buffer_payload) {
177 if (buffer->
max == size) {
182 if (buffer->
max > size) {
183 int remove = buffer->
max - size;
222 buffer_payload->
pos =
pos;
224 if (!buffer_payload) {
233 buffer_payload->
pos =
pos;
235 if (!buffer_payload) {
242 if (existing_payload->
pos == pos) {
243 ast_debug(3,
"Packet with position %zu is already in buffer. Not inserting.\n", pos);
248 if (existing_payload->
pos > pos) {
256 if (inserted == -1) {
276 if (buffer_payload->
pos == pos) {
277 return buffer_payload->
payload;
306 if (buffer_payload->
pos == pos) {
324 if (buffer->
count > 0) {
329 payload = buffer_payload->
payload;
360 return buffer->
count;
Asterisk main include file. File version handling, generic pbx functions.
void(* ast_data_buffer_free_callback)(void *data)
A callback function to free a data payload in a data buffer.
Data buffer containing fixed number of data payloads.
String manipulation functions.
Payload entry placed inside of the data buffer list.
void * payload
The payload for this position.
struct ast_data_buffer::@378 payloads
A linked list of data payloads.
size_t pos
The provided position for this.
struct ast_data_buffer * ast_data_buffer_alloc(ast_data_buffer_free_callback free_fn, size_t size)
Allocate a data buffer.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
size_t max
Maximum number of data payloads in the buffer.
#define CACHED_PAYLOAD_MAX
The number of payloads to increment the cache by.
static void free_fn_do_nothing(void *data)
void * ast_data_buffer_remove_head(struct ast_data_buffer *buffer)
Remove the first payload from the data buffer.
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
void * ast_data_buffer_remove(struct ast_data_buffer *buffer, size_t pos)
Remove a data payload from the data buffer.
A set of macros to manage forward-linked lists.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
void ast_data_buffer_free(struct ast_data_buffer *buffer)
Free a data buffer (and all held data payloads)
size_t ast_data_buffer_count(const struct ast_data_buffer *buffer)
Return the number of payloads in a data buffer.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
size_t cache_count
The current number of data payloads in the cache.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
void ast_data_buffer_resize(struct ast_data_buffer *buffer, size_t size)
Resize a data buffer.
struct ast_data_buffer::@379 cached_payloads
A linked list of unused cached data payloads.
#define ast_calloc(num, len)
A wrapper for calloc()
size_t count
The current number of data payloads in the buffer.
size_t ast_data_buffer_max(const struct ast_data_buffer *buffer)
Return the maximum number of payloads a data buffer can hold.
void * ast_data_buffer_get(const struct ast_data_buffer *buffer, size_t pos)
Retrieve a data payload from the data buffer.
Support for logging to various files, console and syslog Configuration in file logger.conf.
struct data_buffer_payload_entry::@377 list
Linked list information.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
int ast_data_buffer_put(struct ast_data_buffer *buffer, size_t pos, void *payload)
Place a data payload at a position in the data buffer.
static struct data_buffer_payload_entry * data_buffer_payload_alloc(void *payload, size_t pos)
Helper function to allocate a data payload.
static void data_buffer_free_buffer_payload(struct ast_data_buffer *buffer, struct data_buffer_payload_entry *buffer_payload)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
static void ast_data_buffer_cache_adjust(struct ast_data_buffer *buffer)
Helper function that sets the cache to its maximum number of payloads.
#define AST_LIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list entry before the current entry during a traversal.
ast_data_buffer_free_callback free_fn
Callback function to free a data payload.