The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Functions
queue.c File Reference
#include <stdint.h>
#include <string.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/io/queue.h>
+ Include dependency graph for queue.c:

Go to the source code of this file.

Data Structures

struct  fr_queue_s
 

Functions

fr_queue_tfr_queue_create (TALLOC_CTX *ctx, int size)
 Create a non-thread-safe queue. More...
 
void fr_queue_debug (fr_queue_t *fq, FILE *fp)
 Dump a queue. More...
 
int fr_queue_localize_atomic (fr_queue_t *fq, fr_atomic_queue_t *aq)
 Pull all entries from an atomic queue into our local queue. More...
 
int fr_queue_num_elements (fr_queue_t *fq)
 get the number of elements in a queue. More...
 
bool fr_queue_pop (fr_queue_t *fq, void **p_data)
 Pop a pointer from the queue. More...
 
bool fr_queue_push (fr_queue_t *fq, void *data)
 Push a pointer into the queue. More...
 
fr_queue_tfr_queue_resize (fr_queue_t *fq, int size)
 Resize a queue, and copy the entries over. More...
 
int fr_queue_size (fr_queue_t *fq)
 get the size of a queue More...
 

Data Structure Documentation

◆ fr_queue_s

struct fr_queue_s

Definition at line 33 of file queue.c.

Data Fields
void * entry[1] Array of queue data.
int head head of the queue
int num number of elements pushed into the queue
int size size of the queue
int tail tail of the queue

Function Documentation

◆ fr_queue_create()

fr_queue_t* fr_queue_create ( TALLOC_CTX *  ctx,
int  size 
)

Create a non-thread-safe queue.

Parameters
[in]ctxthe talloc ctx
[in]sizethe number of entries in the queue
Returns
  • NULL on error
  • fr_queue_t *, a pointer to the allocated and initialized queue

Definition at line 51 of file queue.c.

+ Here is the caller graph for this function:

◆ fr_queue_debug()

void fr_queue_debug ( fr_queue_t fq,
FILE *  fp 
)

Dump a queue.

Parameters
[in]fqthe queue
[in]fpwhere the debugging information will be printed.

Definition at line 258 of file queue.c.

◆ fr_queue_localize_atomic()

int fr_queue_localize_atomic ( fr_queue_t fq,
fr_atomic_queue_t aq 
)

Pull all entries from an atomic queue into our local queue.

Parameters
[in]fqthe local queue
[in]aqthe atomic queue
Returns
  • number of entries successfully moved over

Definition at line 222 of file queue.c.

+ Here is the call graph for this function:

◆ fr_queue_num_elements()

int fr_queue_num_elements ( fr_queue_t fq)

get the number of elements in a queue.

Parameters
[in]fqthe queue
Returns
  • The number of elements in the queue.

Definition at line 141 of file queue.c.

◆ fr_queue_pop()

bool fr_queue_pop ( fr_queue_t fq,
void **  p_data 
)

Pop a pointer from the queue.

Parameters
[in]fqthe queue
[in]p_datawhere to write the data
Returns
  • true on successful pop
  • false on queue empty

Definition at line 107 of file queue.c.

◆ fr_queue_push()

bool fr_queue_push ( fr_queue_t fq,
void *  data 
)

Push a pointer into the queue.

Parameters
[in]fqthe queue
[in]datathe data to push
Returns
  • true on successful push
  • false on queue full

Definition at line 85 of file queue.c.

◆ fr_queue_resize()

fr_queue_t* fr_queue_resize ( fr_queue_t fq,
int  size 
)

Resize a queue, and copy the entries over.

Parameters
[in]fqthe queue
[in]sizethe new size of the queue
Returns
  • NULL on error
  • fr_queue_t * the new queue, which MAY BE fq.

Definition at line 158 of file queue.c.

+ Here is the call graph for this function:

◆ fr_queue_size()

int fr_queue_size ( fr_queue_t fq)

get the size of a queue

Parameters
[in]fqthe queue
Returns
  • The size of the queue.

Definition at line 127 of file queue.c.