Functions

sbufq.h File Reference

minimal overhead buffer queue in shm memory. More...

#include "../../compiler_opt.h"
#include "../../ut.h"
#include "../../mem/shm_mem.h"
#include "../../timer_ticks.h"
#include "../../timer.h"
#include "../../dprint.h"
#include <string.h>
Include dependency graph for sbufq.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions


Detailed Description

: Module: SIP-router TLS support

Definition in file sbufq.h.


Function Documentation

static int sbufq_add ( struct sbuffer_queue *  q,
const void *  data,
unsigned int  size,
unsigned int  min_buf_size 
) [inline, static]

WARNING: it does no attempt to synchronize access/lock. If needed it should be called under lock.

Parameters:
q - buffer queue
data 
size 
min_buf_size - min size to allocate for new buffer elements
Returns:
0 on success, -1 on error (mem. allocation)

Definition at line 77 of file sbufq.h.

Referenced by sbufq_insert(), and tls_ct_q_add().

Here is the caller graph for this function:

static unsigned int sbufq_destroy ( struct sbuffer_queue *  q  )  [inline, static]

Only the content is destroyed (shm_free()'d), the queue head is re-intialized. WARNING: it does no attempt to synchronize access/lock. If needed it should be called under lock.

Parameters:
q - buffer queue
Returns:
- number of bytes that used to be queued (>=0).

Definition at line 191 of file sbufq.h.

Referenced by tls_ct_q_destroy().

Here is the caller graph for this function:

static int sbufq_flush ( struct sbuffer_queue *  q,
int *  flags,
int(*)(void *p1, void *p2, const void *buf, unsigned size)  flush_f,
void *  flush_p1,
void *  flush_p2 
) [inline, static]

Tries to flush as much as possible from the given queue, using the given callback. WARNING: it does no attempt to synchronize access/lock. If needed it should be called under lock.

Parameters:
q - buffer queue
*flags - set to: F_BUFQ_EMPTY if the queued is completely flushed F_BUFQ_ERROR_FLUSH if the flush_f callback returned error.
flush_f - flush function (callback). modeled after write(): flush_f(param1, param2, const void* buf, unsigned size). It should return the number of bytes "flushed" on success, or <0 on error. If the number of bytes "flushed" is smaller then the requested size, it would be assumed that no more bytes can be flushed and sbufq_flush will exit.
flush_p1 - parameter for the flush function callback.
flush_p2 - parameter for the flush function callback.
Returns:
-1 on internal error, or the number of bytes flushed on success (>=0). Note that the flags param is always set and it should be used to check for errors, since a flush_f() failure will not result in a negative return.

Definition at line 238 of file sbufq.h.

Referenced by tls_ct_q_flush().

Here is the caller graph for this function:

static int sbufq_insert ( struct sbuffer_queue *  q,
const void *  data,
unsigned int  size,
unsigned int  min_buf_size 
) [inline, static]

Note: should never be called after sbufq_run(). WARNING: it does no attempt to synchronize access/lock. If needed it should be called under lock.

Parameters:
q - buffer queue
data 
size 
min_buf_size - min size to allocate for new buffer elements
Returns:
0 on success, -1 on error (mem. allocation)

Definition at line 146 of file sbufq.h.

References sbufq_add().

Here is the call graph for this function: