The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Macros | Typedefs | Functions
request_data.h File Reference

Request data management functions. More...

#include <freeradius-devel/server/request.h>
+ Include dependency graph for request_data.h:

Go to the source code of this file.

Macros

#define request_data_add(_request, _unique_ptr, _unique_int, _opaque, _free_on_replace, _free_on_parent, _persist)
 Add opaque data to a request_t. More...
 
#define request_data_talloc_add(_request, _unique_ptr, _unique_int, _type, _opaque, _free_on_replace, _free_on_parent, _persist)
 Add opaque data to a request_t. More...
 

Typedefs

typedef struct request_data_s request_data_t
 

Functions

int _request_data_add (request_t *request, void const *unique_ptr, int unique_int, char const *type, void *opaque, bool free_on_replace, bool free_on_parent, bool persist, char const *file, int line)
 Add opaque data to a request_t. More...
 
int request_data_by_persistance (fr_dlist_head_t *out, request_t *request, bool persist)
 Loop over all the request data, pulling out ones matching persist state. More...
 
int request_data_by_persistance_count (request_t *request, bool persist)
 Return how many request data entries exist of a given persistence. More...
 
int request_data_by_persistance_reparent (TALLOC_CTX *ctx, fr_dlist_head_t *out, request_t *request, bool persist)
 Loop over all the request data, copying, then freeing ones matching persist state. More...
 
void request_data_dump (request_t *request)
 
void * request_data_get (request_t *request, void const *unique_ptr, int unique_int)
 Get opaque data from a request. More...
 
void request_data_list_dump (request_t *request, fr_dlist_head_t *head)
 
void request_data_list_init (fr_dlist_head_t *data)
 
void request_data_persistable_free (request_t *request)
 Used for removing data from subrequests that are about to be freed. More...
 
void * request_data_reference (request_t *request, void const *unique_ptr, int unique_int)
 Get opaque data from a request without removing it. More...
 
void request_data_restore (request_t *request, fr_dlist_head_t *in)
 Add request data back to a request. More...
 

Detailed Description

Request data management functions.

Id
236092b856548e85db31505040179c116384734a

Definition in file request_data.h.

Macro Definition Documentation

◆ request_data_add

#define request_data_add (   _request,
  _unique_ptr,
  _unique_int,
  _opaque,
  _free_on_replace,
  _free_on_parent,
  _persist 
)
Value:
_request_data_add(_request, _unique_ptr, _unique_int, NULL, _opaque, \
_free_on_replace, _free_on_parent, _persist, __FILE__, __LINE__)
int _request_data_add(request_t *request, void const *unique_ptr, int unique_int, char const *type, void *opaque, bool free_on_replace, bool free_on_parent, bool persist, char const *file, int line)
Add opaque data to a request_t.
Definition: request_data.c:183

Add opaque data to a request_t.

The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a request_t.

Parameters
[in]_requestto associate data with.
[in]_unique_ptrIdentifier for the data.
[in]_unique_intQualifier for the identifier.
[in]_opaqueData to associate with the request. May be NULL.
[in]_free_on_replaceFree opaque data if this request_data is replaced.
[in]_free_on_parentFree opaque data if the request is freed. Must not be set if the opaque data is also parented by the request or state (double free).
[in]_persistTransfer request data to an fr_state_entry_t, and add it back to the next request we receive for the session.
Returns
  • -2 on bad arguments.
  • -1 on memory allocation error.
  • 0 on success.

Definition at line 59 of file request_data.h.

◆ request_data_talloc_add

#define request_data_talloc_add (   _request,
  _unique_ptr,
  _unique_int,
  _type,
  _opaque,
  _free_on_replace,
  _free_on_parent,
  _persist 
)
Value:
_request_data_add(_request, _unique_ptr, _unique_int, STRINGIFY(_type), _opaque, \
_free_on_replace, _free_on_parent, _persist, __FILE__, __LINE__)
#define STRINGIFY(x)
Definition: build.h:195

Add opaque data to a request_t.

The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a request_t.

Parameters
[in]_requestto associate data with.
[in]_unique_ptrIdentifier for the data.
[in]_unique_intQualifier for the identifier.
[in]_typeType of data i.e. fr_pair_t.
[in]_opaqueData to associate with the request. May be NULL.
[in]_free_on_replaceFree opaque data if this request_data is replaced.
[in]_free_on_parentFree opaque data if the request is freed. Must not be set if the opaque data is also parented by the request or state (double free).
[in]_persistTransfer request data to an fr_state_entry_t, and add it back to the next request we receive for the session.
Returns
  • -2 on bad arguments.
  • -1 on memory allocation error.
  • 0 on success.

Definition at line 86 of file request_data.h.

Typedef Documentation

◆ request_data_t

Definition at line 1 of file request_data.h.

Function Documentation

◆ _request_data_add()

int _request_data_add ( request_t request,
void const *  unique_ptr,
int  unique_int,
char const *  type,
void *  opaque,
bool  free_on_replace,
bool  free_on_parent,
bool  persist,
char const *  file,
int  line 
)

Add opaque data to a request_t.

The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a request_t.

Parameters
[in]requestto associate data with.
[in]unique_ptrIdentifier for the data.
[in]unique_intQualifier for the identifier.
[in]typeType of data (if talloced)
[in]opaqueData to associate with the request. May be NULL.
[in]free_on_replaceFree opaque data if this request_data is replaced.
[in]free_on_parentFree opaque data if the request or session is freed. Must not be set if the opaque data is also parented by the request or state (double free).
[in]persistTransfer request data to an fr_state_entry_t, and add it back to the next request we receive for the session.
[in]filerequest data was added in.
[in]linerequest data was added on.
Returns
  • -2 on bad arguments.
  • -1 on memory allocation error.
  • 0 on success.

Definition at line 183 of file request_data.c.

+ Here is the call graph for this function:

◆ request_data_by_persistance()

int request_data_by_persistance ( fr_dlist_head_t out,
request_t request,
bool  persist 
)

Loop over all the request data, pulling out ones matching persist state.

Parameters
[out]outHead of result list.
[in]requestto search for request_data_t in.
[in]persistWhether to pull persistable or non-persistable data.
Returns
number of request_data_t retrieved.

Definition at line 372 of file request_data.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request_data_by_persistance_count()

int request_data_by_persistance_count ( request_t request,
bool  persist 
)

Return how many request data entries exist of a given persistence.

Parameters
[in]requestto check in.
[in]persistWhether to count persistable or non-persistable data.
Returns
number of request_data_t that exist in persistable or non-persistable form

Definition at line 439 of file request_data.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request_data_by_persistance_reparent()

int request_data_by_persistance_reparent ( TALLOC_CTX *  ctx,
fr_dlist_head_t out,
request_t request,
bool  persist 
)

Loop over all the request data, copying, then freeing ones matching persist state.

Parameters
[in]ctxTo allocate new request_data_t.
[out]outHead of result list. If NULL, data will be reparented in place.
[in]requestto search for request_data_t in.
[in]persistWhether to pull persistable or non-persistable data.
Returns
number of request_data_t retrieved.

Definition at line 397 of file request_data.c.

+ Here is the call graph for this function:

◆ request_data_dump()

void request_data_dump ( request_t request)

Definition at line 497 of file request_data.c.

+ Here is the call graph for this function:

◆ request_data_get()

void* request_data_get ( request_t request,
void const *  unique_ptr,
int  unique_int 
)

Get opaque data from a request.

Note
The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a request_t.
Parameters
[in]requestto retrieve data from.
[in]unique_ptrIdentifier for the data.
[in]unique_intQualifier for the identifier.
Returns
  • NULL if no opaque data could be found.
  • the opaque data. The entry holding the opaque data is removed from the request.

Definition at line 292 of file request_data.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request_data_list_dump()

void request_data_list_dump ( request_t request,
fr_dlist_head_t head 
)

Definition at line 482 of file request_data.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request_data_list_init()

void request_data_list_init ( fr_dlist_head_t data)

Definition at line 92 of file request_data.c.

+ Here is the caller graph for this function:

◆ request_data_persistable_free()

void request_data_persistable_free ( request_t request)

Used for removing data from subrequests that are about to be freed.

Parameters
[in]requestto remove persistable data from.

Definition at line 470 of file request_data.c.

+ Here is the call graph for this function:

◆ request_data_reference()

void* request_data_reference ( request_t request,
void const *  unique_ptr,
int  unique_int 
)

Get opaque data from a request without removing it.

Note
The unique ptr is meant to be a module configuration, and the unique integer allows the caller to have multiple opaque data associated with a request_t.
Parameters
requestto retrieve data from.
unique_ptrIdentifier for the data.
unique_intQualifier for the identifier.
Returns
  • NULL if no opaque data could be found.
  • the opaque data.

Definition at line 339 of file request_data.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ request_data_restore()

void request_data_restore ( request_t request,
fr_dlist_head_t in 
)

Add request data back to a request.

Note
May add multiple entries (if they're linked).
Will not check for duplicates.
Parameters
requestto add data to.
inData to add.

Definition at line 461 of file request_data.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: