The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
compose.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: 97a10aa5d7b3d010a0a6c62ab491025dcf2d3ad1 $
20  * @file lib/eap/compose.h
21  * @brief EAP packet composition.
22  *
23  * @copyright 2019 The FreeRADIUS server project
24  */
25 
26 #include <stdbool.h>
27 
28 #include "types.h"
29 
30 /** Structure to hold EAP data
31  *
32  * length = code + id + length + type + type.data
33  * = 1 + 1 + 2 + 1 + X
34  */
35 typedef struct {
38  size_t length;
40 
42 } eap_packet_t;
43 
44 /** Contains a pair of request and response packets
45  *
46  * Helps with formulating/correlating requests to responses we've received.
47  */
48 typedef struct {
49  eap_packet_t *response; //!< Packet we received from the peer.
50  eap_packet_t *request; //!< Packet we will send to the peer.
51  bool set_request_id; //!< Whether the EAP-Method already set the next request ID.
52 } eap_round_t;
53 
54 #include "session.h"
55 #include "submodule.h"
56 
57 rlm_rcode_t eap_start(request_t *request, rlm_eap_method_t const methods[], bool ignore_unknown_types) CC_HINT(nonnull);
58 rlm_rcode_t eap_continue(eap_session_t *eap_session) CC_HINT(nonnull);
59 rlm_rcode_t eap_fail(eap_session_t *eap_session) CC_HINT(nonnull);
60 rlm_rcode_t eap_success(eap_session_t *eap_session) CC_HINT(nonnull);
61 rlm_rcode_t eap_compose(eap_session_t *eap_session) CC_HINT(nonnull);
62 eap_round_t *eap_round_build(eap_session_t *eap_session, eap_packet_raw_t **eap_packet_p);
63 
eap_type_data_t type
Definition: compose.h:39
eap_round_t * eap_round_build(eap_session_t *eap_session, eap_packet_raw_t **eap_packet_p)
Definition: compose.c:548
rlm_rcode_t eap_continue(eap_session_t *eap_session)
Definition: compose.c:483
uint8_t * packet
Definition: compose.h:41
rlm_rcode_t eap_fail(eap_session_t *eap_session)
Definition: compose.c:494
size_t length
Definition: compose.h:38
rlm_rcode_t eap_success(eap_session_t *eap_session)
Definition: compose.c:513
rlm_rcode_t eap_start(request_t *request, rlm_eap_method_t const methods[], bool ignore_unknown_types)
Definition: compose.c:291
bool set_request_id
Whether the EAP-Method already set the next request ID.
Definition: compose.h:51
eap_packet_t * response
Packet we received from the peer.
Definition: compose.h:49
eap_code_t code
Definition: compose.h:36
rlm_rcode_t eap_compose(eap_session_t *eap_session)
Definition: compose.c:153
uint8_t id
Definition: compose.h:37
eap_packet_t * request
Packet we will send to the peer.
Definition: compose.h:50
Structure to hold EAP data.
Definition: compose.h:35
Contains a pair of request and response packets.
Definition: compose.h:48
enum eap_code eap_code_t
Structure to represent packet format of eap on wire
Definition: types.h:121
EAP-Type specific data.
Definition: types.h:109
Tracks the progress of a single session of any EAP method.
Definition: session.h:40
unsigned char uint8_t
Definition: merged_model.c:30
rlm_rcode_t
Return codes indicating the result of the module call.
Definition: rcode.h:40
Submodule interface.
Private structure to hold handles and interfaces for an EAP method.
Definition: submodule.h:67
Types of values contained within an fr_value_box_t.
int nonnull(2, 5))