The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
base.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: 9896ce8994933dceeb0999cde94f05e298718ac3 $
20  * @file lib/eap/base.h
21  * @brief Interface into the base EAP library
22  *
23  * @copyright 2018 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
24  */
25 RCSIDH(lib_eap_base_h, "$Id: 9896ce8994933dceeb0999cde94f05e298718ac3 $")
26 
27 #include <freeradius-devel/eap/types.h>
28 
29 #include <freeradius-devel/server/module.h>
30 #include <freeradius-devel/util/debug.h>
31 
32 #include <freeradius-devel/eap/base.h>
33 #include <freeradius-devel/eap/compose.h>
34 #include <freeradius-devel/eap/types.h>
35 #include <freeradius-devel/eap/session.h>
36 #include <freeradius-devel/eap/submodule.h>
37 #include <freeradius-devel/eap/types.h>
38 
39 /* TLS configuration name */
40 #define TLS_CONFIG_SECTION "tls-config"
41 
42 #define EAP_STATE_LEN (RADIUS_AUTH_VECTOR_LENGTH)
43 
44 #define REQUEST_DATA_EAP_TUNNEL_CALLBACK FR_EAP_MESSAGE
45 #define REQUEST_DATA_EAP_MSCHAP_TUNNEL_CALLBACK ((FR_EAP_MESSAGE << 16) | FR_EAP_METHOD_MSCHAPV2)
46 
47 /*
48  * This is for tunneled callbacks
49  */
50 typedef int (*eap_tunnel_callback_t)(eap_session_t *eap_session, void *tls_session);
51 
52 typedef struct {
53  void *tls_session;
56 
57 
58 /*
59  * interfaces in base.c
60  */
61 void eap_packet_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *list, eap_packet_raw_t const *reply);
62 eap_packet_raw_t *eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_list_t *vps);
63 void eap_add_reply(request_t *request, fr_dict_attr_t const *da, uint8_t const *value, int len);
64 
65 unlang_action_t eap_virtual_server(request_t *request, eap_session_t *eap_session, CONF_SECTION *server_cs);
66 
67 int eap_base_init(void);
68 
69 void eap_base_free(void);
70 
unlang_action_t
Returned by unlang_op_t calls, determine the next action of the interpreter.
Definition: action.h:35
#define RCSIDH(h, id)
Definition: build.h:482
A section grouping multiple CONF_PAIR.
Definition: cf_priv.h:101
Test enumeration values.
Definition: dict_test.h:92
int(* eap_tunnel_callback_t)(eap_session_t *eap_session, void *tls_session)
Definition: base.h:50
int eap_base_init(void)
Initialise the lib eap base library.
Definition: base.c:449
void eap_base_free(void)
De-init the lib eap base library.
Definition: base.c:472
eap_tunnel_callback_t callback
Definition: base.h:54
void * tls_session
Definition: base.h:53
unlang_action_t eap_virtual_server(request_t *request, eap_session_t *eap_session, CONF_SECTION *server_cs)
Run a subrequest through a virtual server.
Definition: base.c:421
void eap_add_reply(request_t *request, fr_dict_attr_t const *da, uint8_t const *value, int len)
Definition: base.c:381
eap_packet_raw_t * eap_packet_from_vp(TALLOC_CTX *ctx, fr_pair_list_t *vps)
Definition: base.c:285
void eap_packet_to_vp(TALLOC_CTX *ctx, fr_pair_list_t *list, eap_packet_raw_t const *reply)
Definition: base.c:126
Structure to represent packet format of eap on wire
Definition: types.h:121
Tracks the progress of a single session of any EAP method.
Definition: session.h:40
unsigned char uint8_t
Definition: merged_model.c:30