The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
session.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 (at
6 * 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: 0c5507e119e345c4c3a04fe6695ab56370d0fddc $
20 * @file lib/eap/session.h
21 * @brief EAP session management.
22 *
23 * @copyright 2019 The FreeRADIUS server project
24 */
25#include <freeradius-devel/server/request.h>
26#include <freeradius-devel/server/request_data.h>
27#include <freeradius-devel/server/module.h>
28#include <freeradius-devel/unlang/interpret.h>
29
31
32#include "compose.h"
33#include "types.h"
34
35#define REQUEST_DATA_EAP_SESSION (1)
36#define REQUEST_DATA_EAP_SESSION_PROXIED (2)
37
38/** Tracks the progress of a single session of any EAP method
39 *
40 */
42 eap_session_t *prev, *next; //!< Next/previous eap session in this doubly linked list.
43
44 uint8_t *child_state; //!< State value returned by tunneled EAP method.
45
46 request_t *subrequest; //!< Current subrequest being executed.
47 unlang_result_t submodule_result; //!< Result of last submodule call.
48
49 void const *inst; //!< Instance of the eap module this session was created by.
50 eap_type_t type; //!< EAP method number.
51
52 request_t *request; //!< Current request. Only used by OpenSSL callbacks to
53 ///< access the current request. Must be NULL if eap_session
54 ///< is not being processed by rlm_eap.
55
56 char *identity; //!< NAI (User-Name) from EAP-Identity
57
58 eap_round_t *prev_round; //!< Previous response/request pair. #this_round should contain
59 ///< the response to the request in #prev_round.
60 eap_round_t *this_round; //!< The EAP response we're processing, and the EAP request
61 ///< we're building.
62
63 void *opaque; //!< Opaque data used by EAP methods.
64
65 module_method_t process; //!< Callback that should be used to process the next round.
66 ///< Usually set to the process function of an EAP submodule.
67 int rounds; //!< How many roundtrips have occurred this session.
68
69 fr_time_t updated; //!< The last time we received a packet for this EAP session.
70
71 bool tls; //!< Whether EAP method uses TLS.
72 bool finished; //!< Whether we consider this session complete.
73};
74
75void eap_session_destroy(eap_session_t **eap_session);
76
77void eap_session_freeze(eap_session_t **eap_session);
78
80
81eap_session_t *eap_session_continue(void const *instance, eap_packet_raw_t **eap_packet, request_t *request) CC_HINT(nonnull);
82
83static inline eap_session_t *eap_session_get(request_t *request)
84{
86}
EAP packet composition.
Contains a pair of request and response packets.
Definition compose.h:48
enum eap_type eap_type_t
Structure to represent packet format of eap on wire
Definition types.h:121
eap_session_t * next
Next/previous eap session in this doubly linked list.
Definition session.h:42
char * identity
NAI (User-Name) from EAP-Identity.
Definition session.h:56
static eap_session_t * eap_session_get(request_t *request)
Definition session.h:83
void * opaque
Opaque data used by EAP methods.
Definition session.h:63
request_t * subrequest
Current subrequest being executed.
Definition session.h:46
bool tls
Whether EAP method uses TLS.
Definition session.h:71
eap_session_t * eap_session_thaw(request_t *request)
Thaw an eap_session_t so it can be continued.
Definition session.c:205
eap_session_t * prev
Definition session.h:42
eap_type_t type
EAP method number.
Definition session.h:50
module_method_t process
Callback that should be used to process the next round.
Definition session.h:65
uint8_t * child_state
State value returned by tunneled EAP method.
Definition session.h:44
unlang_result_t submodule_result
Result of last submodule call.
Definition session.h:47
request_t * request
Current request.
Definition session.h:52
void const * inst
Instance of the eap module this session was created by.
Definition session.h:49
eap_round_t * this_round
The EAP response we're processing, and the EAP request we're building.
Definition session.h:60
eap_round_t * prev_round
Previous response/request pair.
Definition session.h:58
void eap_session_freeze(eap_session_t **eap_session)
Freeze an eap_session_t so that it can continue later.
Definition session.c:173
void eap_session_destroy(eap_session_t **eap_session)
'destroy' an EAP session and disassociate it from the current request
Definition session.c:148
eap_session_t * eap_session_continue(void const *instance, eap_packet_raw_t **eap_packet, request_t *request)
Ingest an eap_packet into a thawed or newly allocated session.
Definition session.c:307
#define REQUEST_DATA_EAP_SESSION
Definition session.h:35
bool finished
Whether we consider this session complete.
Definition session.h:72
int rounds
How many roundtrips have occurred this session.
Definition session.h:67
fr_time_t updated
The last time we received a packet for this EAP session.
Definition session.h:69
Tracks the progress of a single session of any EAP method.
Definition session.h:41
unsigned char uint8_t
void * request_data_reference(request_t *request, void const *unique_ptr, int unique_int)
Get opaque data from a request without removing it.
unlang_action_t(* module_method_t)(unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request)
Module section callback.
Definition module.h:69
"server local" time.
Definition time.h:69
Types of values contained within an fr_value_box_t.
int nonnull(2, 5))