The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions | Variables
state.h File Reference

Track overarching 'state' of the authentication session over multiple packets. More...

#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/tmpl.h>
+ Include dependency graph for state.h:

Go to the source code of this file.

Data Structures

struct  fr_state_config_t
 

Typedefs

typedef struct fr_state_tree_s fr_state_tree_t
 

Functions

void fr_state_discard (fr_state_tree_t *state, request_t *request)
 Called when sending an Access-Accept/Access-Reject to discard state information.
 
void fr_state_discard_by_state (fr_state_tree_t *state, request_t *request)
 Called to discard a state which is synthesized.
 
void fr_state_discard_child (request_t *parent, void const *unique_ptr, int unique_int)
 Remove state from a child.
 
int fr_state_restore (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.
 
void fr_state_restore_from_parent (request_t *child, void const *unique_ptr, int unique_int)
 Restore subrequest data from a parent request.
 
int fr_state_store (fr_state_tree_t *state, request_t *request)
 Transfer ownership of the state fr_pair_ts and ctx, back to a state entry.
 
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.
 
fr_state_tree_tfr_state_tree_init (TALLOC_CTX *ctx, fr_dict_attr_t const *da, fr_state_config_t const *config)
 Initialise a new state tree.
 

Variables

const conf_parser_t state_session_config []
 

Detailed Description

Track overarching 'state' of the authentication session over multiple packets.

Id
3fea08be12119aa7dd0dd7bb872f9dc1e9d8775b

Definition in file state.h.


Data Structure Documentation

◆ fr_state_config_t

struct fr_state_config_t

Definition at line 40 of file state.h.

+ Collaboration diagram for fr_state_config_t:
Data Fields
uint32_t context_id internal number to help keep state trees separate
tmpl_t * dedup_key for tracking misbehaving supplicants
uint32_t max_rounds maximum number of rounds before we give up
uint32_t max_sessions maximum number of sessions
uint8_t server_id for mangling State
bool thread_safe
fr_time_delta_t timeout idle timeout

Typedef Documentation

◆ fr_state_tree_t

Definition at line 38 of file state.h.

Function Documentation

◆ fr_state_discard()

void fr_state_discard ( fr_state_tree_t state,
request_t request 
)

Called when sending an Access-Accept/Access-Reject to discard state information.

Parameters
[in]statetree to lookup state in.
[in]requestto discard state for.

Definition at line 685 of file state.c.

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

◆ fr_state_discard_by_state()

void fr_state_discard_by_state ( fr_state_tree_t state,
request_t request 
)

Called to discard a state which is synthesized.

Some protocols synthesize a state, which means that there is the possibility for conflict. i.e. an old state exists which needs to be discarded. The current request can't restore the old state, it instead needs to discard it.

Parameters
[in]statetree to lookup state in.
[in]requestto discard state for.

Definition at line 734 of file state.c.

+ Here is the call graph for this function:

◆ fr_state_discard_child()

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.

Parameters
[in]parentHolding the child's state.
[in]unique_ptrA parent may have multiple subrequests spawned by different modules. This identifies the module or other facility that spawned the subrequest.
[in]unique_intFurther identification.

Definition at line 1037 of file state.c.

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

◆ fr_state_restore()

int fr_state_restore ( 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.

Note
Does not copy the actual fr_pair_ts. The fr_pair_ts and their context are transferred between state entries as the conversation progresses.
Called with the mutex free.
Parameters
[in]statetree to lookup state in.
[in]requestto restore state for.
Returns
  • 2 if the state attribute didn't match any known states.
  • 1 if no state attribute existed.
  • 0 on success (state restored)
  • -1 if a state entry has already been thawed by a another request.

Definition at line 764 of file state.c.

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

◆ fr_state_restore_from_parent()

void fr_state_restore_from_parent ( request_t child,
void const *  unique_ptr,
int  unique_int 
)

Restore subrequest data from a parent request.

Parameters
[in]childThe child request to restore state to.
[in]unique_ptrA parent may have multiple subrequests spawned by different modules. This identifies the module or other facility that spawned the subrequest.
[in]unique_intFurther identification.

Definition at line 987 of file state.c.

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

◆ fr_state_store()

int fr_state_store ( 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 840 of file state.c.

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

◆ fr_state_store_in_parent()

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.

Parameters
[in]childThe child request to retrieve state from.
[in]unique_ptrA parent may have multiple subrequests spawned by different modules. This identifies the module or other facility that spawned the subrequest.
[in]unique_intFurther identification.

Definition at line 941 of file state.c.

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

◆ fr_state_tree_init()

fr_state_tree_t * fr_state_tree_init ( TALLOC_CTX *  ctx,
fr_dict_attr_t const *  da,
fr_state_config_t const *  config 
)

Initialise a new state tree.

Parameters
[in]ctxto link the lifecycle of the state tree to.
[in]daAttribute used to store and retrieve state from.
[in]configthe configuration data
Returns
  • A new state tree.
  • NULL on failure.

Definition at line 232 of file state.c.

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

Variable Documentation

◆ state_session_config

const conf_parser_t state_session_config[]
extern

Definition at line 59 of file state.c.