The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Simple ring buffer with fixed element sizes. More...
#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/talloc.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Typedefs | |
typedef struct fr_fring_buffer | fr_fring_t |
Functions | |
fr_fring_t * | fr_fring_alloc (TALLOC_CTX *ctx, uint32_t size, bool lock) |
Initialise a ring buffer with fixed element size. More... | |
int | fr_fring_insert (fr_fring_t *fring, void *obj) |
Insert a new item into the circular buffer if the buffer is not full. More... | |
void * | fr_fring_next (fr_fring_t *fring) |
Remove an item from the buffer. More... | |
int | fr_fring_overwrite (fr_fring_t *fring, void *obj) |
Insert a new item into the circular buffer, freeing the tail if we hit it. More... | |
Simple ring buffer with fixed element sizes.
Definition in file fring.h.
typedef struct fr_fring_buffer fr_fring_t |
fr_fring_t* fr_fring_alloc | ( | TALLOC_CTX * | ctx, |
uint32_t | size, | ||
bool | lock | ||
) |
Initialise a ring buffer with fixed element size.
[in] | ctx | to allocate the buffer in. |
[in] | size | of buffer to allocate. |
[in] | lock | If true, insert and next operations will lock the buffer. |
Definition at line 78 of file fring.c.
int fr_fring_insert | ( | fr_fring_t * | fring, |
void * | in | ||
) |
Insert a new item into the circular buffer if the buffer is not full.
[in] | fring | to insert item into. |
[in] | in | item to insert. |
Definition at line 149 of file fring.c.
void* fr_fring_next | ( | fr_fring_t * | fring | ) |
int fr_fring_overwrite | ( | fr_fring_t * | fring, |
void * | in | ||
) |
Insert a new item into the circular buffer, freeing the tail if we hit it.
[in] | fring | to insert item into |
[in] | in | item to insert (must have been allocated with talloc). |
Definition at line 120 of file fring.c.