Libtrap: Internal development docs  0.11.7
Functions
General API

Functions

trap_buffer_ttb_init (uint16_t nblocks, uint32_t blocksize)
 
void tb_destroy (trap_buffer_t **tb)
 
int tb_lock (trap_buffer_t *tb)
 
int tb_unlock (trap_buffer_t *tb)
 
int tb_block_lock (tb_block_t *bl)
 
int tb_block_unlock (tb_block_t *bl)
 
int tb_isblockfree (tb_block_t *bl)
 

Detailed Description

Function Documentation

◆ tb_block_lock()

int tb_block_lock ( tb_block_t bl)

Lock block before manipulation.

Parameters
[in]blPointer to the TRAP buffer.

Definition at line 222 of file trap_buffer.c.

◆ tb_block_unlock()

int tb_block_unlock ( tb_block_t bl)

Unlock block after manipulation.

Definition at line 227 of file trap_buffer.c.

◆ tb_destroy()

void tb_destroy ( trap_buffer_t **  tb)

Free memory and set the pointer to NULL.

Parameters
[in]tbPointer to the TRAP buffer.

Definition at line 191 of file trap_buffer.c.

◆ tb_init()

trap_buffer_t* tb_init ( uint16_t  nblocks,
uint32_t  blocksize 
)

Create a new buffer that will work wit nblocks of block_size.

Parameters
[in]nblocksNumber of blocks that will be stored in the ring buffer.
[in]blocksizeMaximal size of each block.
Returns
Pointer to the buffer struct, NULL on error.

Definition at line 146 of file trap_buffer.c.

◆ tb_isblockfree()

int tb_isblockfree ( tb_block_t bl)

Check if the current block is free.

Parameters
[in]blPointer to the block.
Returns
TB_SUCCESS when the current block is free, TB_FULL if it contains at least one message.

Definition at line 137 of file trap_buffer.c.

◆ tb_lock()

int tb_lock ( trap_buffer_t tb)

Lock buffer before manipulation.

Parameters
[in]tbPointer to the TRAP buffer.

Definition at line 212 of file trap_buffer.c.

◆ tb_unlock()

int tb_unlock ( trap_buffer_t tb)

Unlock buffer after manipulation.

Parameters
[in]tbPointer to the TRAP buffer.

Definition at line 217 of file trap_buffer.c.