libosip 3.6.0
Classes | Typedefs | Functions

oSIP fifo Handling

The OS port modules

Classes

struct  osip_fifo

Typedefs

typedef struct osip_fifo osip_fifo_t

Functions

void osip_fifo_init (osip_fifo_t *ff)
void osip_fifo_free (osip_fifo_t *ff)
int osip_fifo_insert (osip_fifo_t *ff, void *element)
int osip_fifo_add (osip_fifo_t *ff, void *element)
int osip_fifo_size (osip_fifo_t *ff)
void * osip_fifo_get (osip_fifo_t *ff)
void * osip_fifo_tryget (osip_fifo_t *ff)

Typedef Documentation

Structure for referencing a fifo.


Function Documentation

int osip_fifo_add ( osip_fifo_t ff,
void *  element 
)

Add an element in a fifo.

Parameters:
ffThe element to work on.
elementThe pointer on the element to add.

References osip_list_add(), osip_list_size(), osip_mutex_lock(), osip_mutex_unlock(), osip_sem_post(), and osip_fifo::queue.

Referenced by osip_timers_ict_execute(), osip_timers_ist_execute(), osip_timers_nict_execute(), osip_timers_nist_execute(), and osip_transaction_add_event().

void osip_fifo_free ( osip_fifo_t ff)

Free a fifo element.

Parameters:
ffThe element to work on.

References osip_mutex_destroy(), and osip_sem_destroy().

Referenced by osip_transaction_free2().

void* osip_fifo_get ( osip_fifo_t ff)

Get an element from a fifo or block until one is added.

Parameters:
ffThe element to work on.

References osip_list_get(), osip_list_remove(), osip_list_size(), osip_mutex_lock(), osip_mutex_unlock(), osip_sem_wait(), and osip_fifo::queue.

void osip_fifo_init ( osip_fifo_t ff)

Initialise a osip_fifo_t element. NOTE: this element MUST be previously allocated with osip_malloc(). The osip_free() call on the fifo is still automatically done by osip_fifo_free(). This also means you can't use a static osip_fifo_t variable if you want to use osip_fifo_free().

Parameters:
ffThe element to initialise.

References osip_list_init(), osip_mutex_init(), osip_sem_init(), and osip_fifo::queue.

Referenced by osip_transaction_init().

int osip_fifo_insert ( osip_fifo_t ff,
void *  element 
)

Insert an element in a fifo (at the beginning).

Parameters:
ffThe element to work on.
elementThe pointer on the element to insert.

References osip_list_add(), osip_list_size(), osip_mutex_lock(), osip_mutex_unlock(), osip_sem_post(), and osip_fifo::queue.

int osip_fifo_size ( osip_fifo_t ff)

Get the number of element in a fifo.

Parameters:
ffThe element to work on.

References osip_list_size(), osip_mutex_lock(), osip_mutex_unlock(), and osip_fifo::queue.

Referenced by osip_timers_gettimeout(), and osip_timers_ict_execute().

void* osip_fifo_tryget ( osip_fifo_t ff)

Try to get an element from a fifo, but do not block if there is no element.

Parameters:
ffThe element to work on.

References osip_list_get(), osip_list_remove(), osip_list_size(), osip_mutex_lock(), osip_mutex_unlock(), osip_sem_trywait(), and osip_fifo::queue.

Referenced by osip_ict_execute(), osip_ist_execute(), osip_nict_execute(), osip_nist_execute(), and osip_transaction_free2().