#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
#include <freeradius-devel/util/talloc.h>
Go to the source code of this file.
|
#define | fr_fifo_create(_ctx, _max_entries, _node_free) _fr_fifo_create(_ctx, NULL, _max_entries, _node_free) |
| Creates a fifo. More...
|
|
#define | fr_fifo_talloc_create(_ctx, _talloc_type, _max_entries, _node_free) _fr_fifo_create(_ctx, #_talloc_type, _max_entries, _node_free) |
| Creates a fifo that verifies elements are of a specific talloc type. More...
|
|
◆ fr_fifo_create
#define fr_fifo_create |
( |
|
_ctx, |
|
|
|
_max_entries, |
|
|
|
_node_free |
|
) |
| _fr_fifo_create(_ctx, NULL, _max_entries, _node_free) |
Creates a fifo.
- Parameters
-
[in] | _ctx | to tie fifo lifetime to. If ctx is freed, fifo will free any nodes, calling the free function if set. |
[in] | _max_entries | Maximum number of entries. |
[in] | _node_free | Optional function used to free data if tree nodes are deleted or replaced. |
- Returns
- A new fifo on success.
- NULL on failure.
Definition at line 66 of file fifo.h.
◆ fr_fifo_talloc_create
#define fr_fifo_talloc_create |
( |
|
_ctx, |
|
|
|
_talloc_type, |
|
|
|
_max_entries, |
|
|
|
_node_free |
|
) |
| _fr_fifo_create(_ctx, #_talloc_type, _max_entries, _node_free) |
Creates a fifo that verifies elements are of a specific talloc type.
- Parameters
-
[in] | _ctx | to tie fifo lifetime to. If ctx is freed, fifo will free any nodes, calling the free function if set. |
[in] | _max_entries | Maximum number of entries. |
[in] | _talloc_type | of elements. |
[in] | _node_free | Optional function used to free data if tree nodes are deleted or replaced. |
- Returns
- A new fifo on success.
- NULL on failure.
Definition at line 51 of file fifo.h.
◆ fr_fifo_free_t
typedef void(* fr_fifo_free_t) (void *) |
◆ fr_fifo_t
Definition at line 1 of file fifo.h.
◆ _fr_fifo_create()
Create a fifo queue.
The first element enqueued will be the first to be dequeued.
- Note
- The created fifo does not provide any thread synchronisation functionality such as mutexes. If multiple threads are enqueueing and dequeueing data the callers must synchronise their access.
- Parameters
-
[in] | ctx | to allocate fifo array in. |
[in] | type | Talloc type of elements (may be NULL). |
[in] | max | The maximum number of elements allowed. |
[in] | free_node | Function to use to free node data if the fifo is freed. |
- Returns
- A new fifo queue.
- NULL on error.
Definition at line 85 of file fifo.c.
◆ fr_fifo_num_elements()
unsigned int fr_fifo_num_elements |
( |
fr_fifo_t * |
fi | ) |
|
Return the number of elements in the fifo queue.
- Parameters
-
[in] | fi | FIFO to count elements in. |
- Returns
- the number of elements
Definition at line 170 of file fifo.c.
◆ fr_fifo_peek()
Examine the next element that would be popped.
- Parameters
-
- Returns
- The data at the head of the queue
- NULL if the queue is empty.
Definition at line 158 of file fifo.c.
◆ fr_fifo_pop()
Pop data off of the fifo.
- Parameters
-
[in] | fi | FIFO to pop data from. |
- Returns
- The data popped.
- NULL if the queue is empty.
Definition at line 135 of file fifo.c.
◆ fr_fifo_push()
int fr_fifo_push |
( |
fr_fifo_t * |
fi, |
|
|
void * |
data |
|
) |
| |
Push data onto the fifo.
- Parameters
-
[in] | fi | FIFO to push data onto. |
[in] | data | to push. |
- Returns
- 0 on success.
- -1 on error.
Definition at line 111 of file fifo.c.