All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
request.c File Reference

Functions for allocating requests and storing internal data in them. More...

#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/rad_assert.h>
+ Include dependency graph for request.c:

Go to the source code of this file.

Data Structures

struct  request_data_t
 Per-request opaque data, added by modules. More...
 

Functions

static int _request_data_free (request_data_t *this)
 Ensure opaque data is freed by binding its lifetime to the request_data_t. More...
 
static int _request_free (REQUEST *request)
 Callback for freeing a request struct. More...
 
REQUESTrequest_alloc (TALLOC_CTX *ctx)
 Create a new REQUEST data structure. More...
 
REQUESTrequest_alloc_coa (REQUEST *request)
 
REQUESTrequest_alloc_fake (REQUEST *request)
 
int request_data_add (REQUEST *request, void *unique_ptr, int unique_int, void *opaque, bool free_on_replace, bool free_on_parent, bool persist)
 Add opaque data to a REQUEST. More...
 
int request_data_by_persistance (request_data_t **out, REQUEST *request, bool persist)
 Loop over all the request data, pulling out ones matching persist state. More...
 
void * request_data_get (REQUEST *request, void *unique_ptr, int unique_int)
 Get opaque data from a request. More...
 
void * request_data_reference (REQUEST *request, void *unique_ptr, int unique_int)
 Get opaque data from a request without removing it. More...
 
void request_data_restore (REQUEST *request, request_data_t *entry)
 Add request data back to a request. More...
 

Detailed Description

Functions for allocating requests and storing internal data in them.

Id:
f3ad970d90a7c95cbcb1aeb6676ee8896392d187

Definition in file request.c.


Data Structure Documentation

struct request_data_t

Per-request opaque data, added by modules.

Definition at line 33 of file request.c.

+ Collaboration diagram for request_data_t:
Data Fields
bool free_on_parent Whether to talloc_free(opaque) when the parent of the request data is freed.
bool free_on_replace Whether to talloc_free(opaque) when the request data is removed.
request_data_t * next Next opaque request data struct linked to this request.
void * opaque Opaque data.
bool persist Whether this data should be transfered to a session_entry_t after we're done processing this request.
int unique_int Alternative key to lookup request data.
void * unique_ptr Key to lookup request data.

Function Documentation

static int _request_data_free ( request_data_t this)
static

Ensure opaque data is freed by binding its lifetime to the request_data_t.

Parameters
thisRequest data being freed.
Returns
0, or whatever the destructor for the opaque data returned.

Definition at line 239 of file request.c.

+ Here is the caller graph for this function:

static int _request_free ( REQUEST request)
static

Callback for freeing a request struct.

Definition at line 49 of file request.c.

+ Here is the caller graph for this function:

REQUEST* request_alloc ( TALLOC_CTX *  ctx)

Create a new REQUEST data structure.

Definition at line 85 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REQUEST* request_alloc_coa ( REQUEST request)

Definition at line 208 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

REQUEST* request_alloc_fake ( REQUEST request)

Definition at line 124 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int request_data_add ( REQUEST request,
void *  unique_ptr,
int  unique_int,
void *  opaque,
bool  free_on_replace,
bool  free_on_parent,
bool  persist 
)

Add opaque data to a REQUEST.

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.

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
[in]free_on_replaceIf true and the opaque data is replaced via a subsequent call to request_data_add, talloc_free will be called to free the opaque data pointer.
[in]free_on_parentIf True and the request data is present in the request or state when it is freed, free the opaque data too. Must not be set if the opaque data is also parented by the request or state.
[in]persistIf true, before the request is freed, the opaque data will be transferred to an fr_state_entry_t, and restored to a subsequent linked request should we receive one.
Returns
  • -2 on bad arguments.
  • -1 on memory allocation error.
  • 0 on success.

Definition at line 279 of file request.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int request_data_by_persistance ( request_data_t **  out,
REQUEST 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 413 of file request.c.

+ Here is the caller graph for this function:

void* request_data_get ( REQUEST request,
void *  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.
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 374 of file request.c.

+ Here is the caller graph for this function:

void* request_data_reference ( REQUEST request,
void *  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.
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 484 of file request.c.

+ Here is the caller graph for this function:

void request_data_restore ( REQUEST request,
request_data_t entry 
)

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.
entrythe data to add.

Definition at line 453 of file request.c.

+ Here is the caller graph for this function: