Libtrap: Internal development docs  0.11.7
Macros | Functions
trap_buffer.c File Reference

TRAP ring buffer data structure. More...

#include "trap_buffer.h"
#include <stdint.h>
#include <inttypes.h>
Include dependency graph for trap_buffer.c:

Go to the source code of this file.

Macros

#define DEBUG_PRINTS   0
 
#define DBG_PRINT(...)
 
#define BLOCKSIZE_TOTAL(tb)   (tb->blocksize + sizeof(tb_block_t))
 

Functions

static void _tb_block_clear (tb_block_t *bl)
 
static int _tb_block_init (tb_block_t *b)
 
static int _tb_block_destroy (tb_block_t *b)
 
static tb_block_ttb_computenext_blockp (trap_buffer_t *tb, uint16_t curidx)
 
void tb_next_wr_block (trap_buffer_t *tb)
 
void tb_next_rd_block (trap_buffer_t *tb)
 
void tb_first_rd_block (trap_buffer_t *b)
 
void tb_first_wr_block (trap_buffer_t *b)
 
int tb_isblockfree (tb_block_t *b)
 
trap_buffer_ttb_init (uint16_t nblocks, uint32_t blocksize)
 
void tb_destroy (trap_buffer_t **b)
 
int tb_lock (trap_buffer_t *b)
 
int tb_unlock (trap_buffer_t *b)
 
int tb_block_lock (tb_block_t *bl)
 
int tb_block_unlock (tb_block_t *bl)
 
static int _tb_pushmess_checksize (trap_buffer_t *b, tb_block_t **bl, uint32_t ts)
 
int tb_pushmess (trap_buffer_t *b, const void *data, uint16_t size)
 
int tb_pushmess2 (trap_buffer_t *b, const void *d1, uint16_t s1, const void *d2, uint16_t s2)
 
int tb_getmess (trap_buffer_t *b, const void **data, uint16_t *size)
 
void tb_clear_unused (trap_buffer_t *tb)
 

Detailed Description

TRAP ring buffer data structure.

Author
Tomas Cejka cejka.nosp@m.t@ce.nosp@m.snet..nosp@m.cz
Date
2016

Definition in file trap_buffer.c.

Macro Definition Documentation

◆ BLOCKSIZE_TOTAL

#define BLOCKSIZE_TOTAL (   tb)    (tb->blocksize + sizeof(tb_block_t))

Definition at line 67 of file trap_buffer.c.

◆ DBG_PRINT

#define DBG_PRINT (   ...)

Definition at line 64 of file trap_buffer.c.

◆ DEBUG_PRINTS

#define DEBUG_PRINTS   0

Change to 1 to enable debug printing.

Definition at line 58 of file trap_buffer.c.

Function Documentation

◆ _tb_block_clear()

static void _tb_block_clear ( tb_block_t bl)
inlinestatic

Definition at line 69 of file trap_buffer.c.

◆ _tb_block_destroy()

static int _tb_block_destroy ( tb_block_t b)
static

Definition at line 88 of file trap_buffer.c.

◆ _tb_block_init()

static int _tb_block_init ( tb_block_t b)
static

Definition at line 76 of file trap_buffer.c.

◆ _tb_pushmess_checksize()

static int _tb_pushmess_checksize ( trap_buffer_t b,
tb_block_t **  bl,
uint32_t  ts 
)
inlinestatic

Definition at line 232 of file trap_buffer.c.

◆ tb_computenext_blockp()

static tb_block_t* tb_computenext_blockp ( trap_buffer_t tb,
uint16_t  curidx 
)
inlinestatic

Definition at line 97 of file trap_buffer.c.