The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
state.h
Go to the documentation of this file.
1#pragma once
2/*
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
16 */
17
18/**
19 * $Id: c274fdd4485d404bb33631feeb86c7994b1e3f96 $
20 *
21 * @file lib/server/state.h
22 * @brief Track overarching 'state' of the authentication session over multiple packets.
23 *
24 * @copyright 2014 The FreeRADIUS server project
25 * @copyright 2014 Alan DeKok (aland@deployingradius.com)
26 */
27RCSIDH(state_h, "$Id: c274fdd4485d404bb33631feeb86c7994b1e3f96 $")
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <freeradius-devel/util/dict.h>
34#include <freeradius-devel/server/request.h>
35#include <freeradius-devel/server/cf_parse.h>
36#include <freeradius-devel/server/tmpl.h>
37
39
40typedef struct {
41 uint32_t max_sessions; //!< maximum number of sessions
42 uint32_t max_rounds; //!< maximum number of rounds before we give up
43 uint32_t context_id; //!< internal number to help keep state trees separate
44 fr_time_delta_t timeout; //!< idle timeout
45 tmpl_t *dedup_key; //!< for tracking misbehaving supplicants
46 uint8_t server_id; //!< for mangling State
49
51
53
54void fr_state_discard(fr_state_tree_t *state, request_t *request);
55
56int fr_state_restore(fr_state_tree_t *state, request_t *request);
57int fr_state_store(fr_state_tree_t *state, request_t *request);
58
59void fr_state_store_in_parent(request_t *request, void const *unique_ptr, int unique_int);
60void fr_state_restore_from_parent(request_t *child, void const *unique_ptr, int unique_int);
61void fr_state_discard_child(request_t *parent, void const *unique_ptr, int unique_int);
62
63#ifdef __cplusplus
64}
65#endif
#define RCSIDH(h, id)
Definition build.h:488
Defines a CONF_PAIR to C data type mapping.
Definition cf_parse.h:597
unsigned int uint32_t
unsigned char uint8_t
static const conf_parser_t config[]
Definition base.c:172
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.
Definition state.c:738
void fr_state_discard_child(request_t *parent, void const *unique_ptr, int unique_int)
Remove state from a child.
Definition state.c:1011
void fr_state_discard(fr_state_tree_t *state, request_t *request)
Called when sending an Access-Accept/Access-Reject to discard state information.
Definition state.c:684
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.
Definition state.c:915
bool thread_safe
Definition state.h:47
fr_time_delta_t timeout
idle timeout
Definition state.h:44
uint32_t max_rounds
maximum number of rounds before we give up
Definition state.h:42
uint8_t server_id
for mangling State
Definition state.h:46
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.
Definition state.c:814
tmpl_t * dedup_key
for tracking misbehaving supplicants
Definition state.h:45
uint32_t context_id
internal number to help keep state trees separate
Definition state.h:43
void fr_state_restore_from_parent(request_t *child, void const *unique_ptr, int unique_int)
Restore subrequest data from a parent request.
Definition state.c:961
const conf_parser_t state_session_config[]
Definition state.c:59
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.
Definition state.c:232
uint32_t max_sessions
maximum number of sessions
Definition state.h:41
A time delta, a difference in time measured in nanoseconds.
Definition time.h:80
static fr_slen_t parent
Definition pair.h:859