The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Track overarching 'state' of the authentication session over multiple packets. More...
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/server/request.h>
Go to the source code of this file.
Typedefs | |
typedef struct fr_state_tree_s | fr_state_tree_t |
Functions | |
int | fr_request_to_state (fr_state_tree_t *state, request_t *request) |
Transfer ownership of the state fr_pair_ts and ctx, back to a state entry. More... | |
void | fr_state_discard (fr_state_tree_t *state, request_t *request) |
Called when sending an Access-Accept/Access-Reject to discard state information. More... | |
void | fr_state_discard_child (request_t *parent, void const *unique_ptr, int unique_int) |
Remove state from a child. More... | |
uint64_t | fr_state_entries_created (fr_state_tree_t *state) |
Return number of entries created. More... | |
uint64_t | fr_state_entries_timeout (fr_state_tree_t *state) |
Return number of entries that timed out. More... | |
uint64_t | fr_state_entries_tracked (fr_state_tree_t *state) |
Return number of entries we're currently tracking. More... | |
void | fr_state_restore_to_child (request_t *child, void const *unique_ptr, int unique_int) |
Restore subrequest data from a parent request. More... | |
void | fr_state_store_in_parent (request_t *request, void const *unique_ptr, int unique_int) |
Store subrequest's session-state list and persistable request data in its parent. More... | |
int | fr_state_to_request (fr_state_tree_t *state, request_t *request) |
Copy a pointer to the head of the list of state fr_pair_ts (and their ctx) into the request. More... | |
fr_state_tree_t * | fr_state_tree_init (TALLOC_CTX *ctx, fr_dict_attr_t const *da, bool thread_safe, uint32_t max_sessions, fr_time_delta_t timeout, uint8_t server_id, uint32_t context_id) |
Initialise a new state tree. More... | |
Track overarching 'state' of the authentication session over multiple packets.
Definition in file state.h.
typedef struct fr_state_tree_s fr_state_tree_t |
int fr_request_to_state | ( | fr_state_tree_t * | state, |
request_t * | request | ||
) |
Transfer ownership of the state fr_pair_ts and ctx, back to a state entry.
Put request->session_state_pairs into the State attribute. Put the State attribute into the vps list. Delete the original entry, if it exists
Also creates a new state entry.
Definition at line 737 of file state.c.
void fr_state_discard | ( | fr_state_tree_t * | state, |
request_t * | request | ||
) |
void fr_state_discard_child | ( | request_t * | parent, |
void const * | unique_ptr, | ||
int | unique_int | ||
) |
Remove state from a child.
This is useful for modules like EAP, where we keep a persistent eap_session but may call multiple EAP method modules during negotiation, and need to discard the state between each module call.
[in] | parent | Holding the child's state. |
[in] | unique_ptr | A parent may have multiple subrequests spawned by different modules. This identifies the module or other facility that spawned the subrequest. |
[in] | unique_int | Further identification. |
Definition at line 908 of file state.c.
uint64_t fr_state_entries_created | ( | fr_state_tree_t * | state | ) |
uint64_t fr_state_entries_timeout | ( | fr_state_tree_t * | state | ) |
uint64_t fr_state_entries_tracked | ( | fr_state_tree_t * | state | ) |
void fr_state_restore_to_child | ( | request_t * | child, |
void const * | unique_ptr, | ||
int | unique_int | ||
) |
Restore subrequest data from a parent request.
[in] | child | The child request to restore state to. |
[in] | unique_ptr | A parent may have multiple subrequests spawned by different modules. This identifies the module or other facility that spawned the subrequest. |
[in] | unique_int | Further identification. |
Definition at line 858 of file state.c.
void fr_state_store_in_parent | ( | request_t * | child, |
void const * | unique_ptr, | ||
int | unique_int | ||
) |
Store subrequest's session-state list and persistable request data in its parent.
[in] | child | The child request to retrieve state from. |
[in] | unique_ptr | A parent may have multiple subrequests spawned by different modules. This identifies the module or other facility that spawned the subrequest. |
[in] | unique_int | Further identification. |
Definition at line 812 of file state.c.
int fr_state_to_request | ( | fr_state_tree_t * | state, |
request_t * | request | ||
) |
Copy a pointer to the head of the list of state fr_pair_ts (and their ctx) into the request.
[in] | state | tree to lookup state in. |
[in] | request | to restore state for. |
Definition at line 660 of file state.c.
fr_state_tree_t* fr_state_tree_init | ( | TALLOC_CTX * | ctx, |
fr_dict_attr_t const * | da, | ||
bool | thread_safe, | ||
uint32_t | max_sessions, | ||
fr_time_delta_t | timeout, | ||
uint8_t | server_id, | ||
uint32_t | context_id | ||
) |
Initialise a new state tree.
[in] | ctx | to link the lifecycle of the state tree to. |
[in] | da | Attribute used to store and retrieve state from. |
[in] | thread_safe | Whether we should mutex protect the state tree. |
[in] | max_sessions | we track state for. |
[in] | timeout | How long to wait before cleaning up entries. |
[in] | server_id | ID byte to use in load-balancing operations. |
[in] | context_id | Specifies a unique ctx id to prevent states being used in contexts for which they weren't intended. |
Definition at line 222 of file state.c.