The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
rb_expire.h File Reference

RB trees with expiry timers. More...

#include <freeradius-devel/util/rb.h>
#include <freeradius-devel/util/dlist.h>
+ Include dependency graph for rb_expire.h:

Go to the source code of this file.

Data Structures

struct  fr_rb_expire_node_t
 dlist for expiring old entries More...
 
struct  fr_rb_expire_t
 

Macros

#define fr_rb_expire_inline_talloc_init(_expire, _type, _field, _data_cmp, _data_free, _lifetime)
 

Functions

bool fr_rb_expire_insert (fr_rb_expire_t *expire, void *data, fr_time_t now)
 Attempt to find current data in the tree, if it does not exist insert it.
 
void fr_rb_expire_update (fr_rb_expire_t *expire, void *data, fr_time_t now)
 

Detailed Description

RB trees with expiry timers.

Definition in file rb_expire.h.


Data Structure Documentation

◆ fr_rb_expire_node_t

struct fr_rb_expire_node_t

dlist for expiring old entries

This structure should be inside of the

Definition at line 44 of file rb_expire.h.

+ Collaboration diagram for fr_rb_expire_node_t:
Data Fields
fr_dlist_t entry
fr_rb_node_t node
fr_time_t when

◆ fr_rb_expire_t

struct fr_rb_expire_t

Definition at line 33 of file rb_expire.h.

+ Collaboration diagram for fr_rb_expire_t:
Data Fields
fr_dlist_head_t head
fr_time_t last_expiry
fr_time_delta_t lifetime
fr_rb_tree_t tree

Macro Definition Documentation

◆ fr_rb_expire_inline_talloc_init

#define fr_rb_expire_inline_talloc_init (   _expire,
  _type,
  _field,
  _data_cmp,
  _data_free,
  _lifetime 
)
Value:
do { \
fr_rb_inline_talloc_init(&(_expire)->tree, _type, _field.node, _data_cmp, _data_free); \
fr_dlist_init(&(_expire)->head, _type, _field.entry); \
(_expire)->lifetime = _lifetime; \
(_expire)->last_expiry = fr_time(); \
} while (0)
#define fr_time()
Allow us to arbitrarily manipulate time.
Definition state_test.c:8
static fr_slen_t head
Definition xlat.h:422

Definition at line 50 of file rb_expire.h.

Function Documentation

◆ fr_rb_expire_insert()

bool fr_rb_expire_insert ( fr_rb_expire_t expire,
void *  data,
fr_time_t  now 
)

Attempt to find current data in the tree, if it does not exist insert it.

Any used node will be inserted into the tail of the expire list, and will expire at "now + expire->lifetime".

Parameters
[in]expireto search/insert into.
[in]datato find.
[in]nowthe current time
Returns
  • true if data was inserted.
  • false if data already existed and was not inserted.

Definition at line 39 of file rb_expire.c.

+ Here is the call graph for this function:

◆ fr_rb_expire_update()

void fr_rb_expire_update ( fr_rb_expire_t expire,
void *  data,
fr_time_t  now 
)

Definition at line 55 of file rb_expire.c.

+ Here is the call graph for this function: