The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
submodule.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: 0e4e04b4ab041fadf13e2de758402b9d1a065cc7 $
20  * @file lib/eap/submodule.h
21  * @brief Submodule interface
22  *
23  * @copyright 2019 The FreeRADIUS server project
24  */
25 #include <freeradius-devel/server/dl_module.h>
26 #include <freeradius-devel/server/module.h>
27 
28 #define MAX_PROVIDED_METHODS 5
29 
30 /** Allow a module to vouch explicitly for an identity
31  *
32  * This is mainly used for EAP-SIM/EAP-AKA/EAP-AKA' where the preferred
33  * eap method is specified by the first byte of the identity.
34  *
35  * @param[in] inst Submodule instance.
36  * @param[in] id To check. Do NOT assume the identity is binary safe,
37  * it is common for some identities to be prefixed with
38  * a \0 byte.
39  * @param[in] id_len Length of the identity.
40  * @return
41  * - FR_EAP_METHOD_INVALID if we don't recognise the identity.
42  * - Another FR_EAP_METHOD_* to run as the initial EAP method.
43  */
44 typedef eap_type_t (*eap_type_identity_t)(void *inst, char const *id, size_t id_len);
45 
46 /** Interface exported by EAP submodules
47  *
48  */
49 typedef struct {
50  module_t common; //!< Common fields provided by all modules.
51 
52  eap_type_t provides[MAX_PROVIDED_METHODS]; //!< Allow the module to register itself for more
53  ///< than one EAP-Method.
54 
55  eap_type_identity_t type_identity; //!< Do we recognise this identity?
56 
57  module_method_t session_init; //!< Callback for creating a new #eap_session_t.
58 
59  fr_dict_t const **namespace; //!< Namespace children should be allocated in.
60 
61  bool clone_parent_lists; //!< HACK until all eap methods run their own sections.
63 
64 /** Private structure to hold handles and interfaces for an EAP method
65  *
66  */
67 typedef struct {
68  module_instance_t *submodule_inst; //!< Submodule's instance data
69  rlm_eap_submodule_t const *submodule; //!< Submodule's exported interface.
enum eap_type eap_type_t
unlang_action_t(* module_method_t)(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Module section callback.
Definition: module.h:68
Module instance data.
Definition: module.h:265
Struct exported by a rlm_* module.
Definition: module.h:195
eap_aka_sim_process_conf_t * inst
module_t common
Common fields provided by all modules.
Definition: submodule.h:50
module_instance_t * submodule_inst
Submodule's instance data.
Definition: submodule.h:68
#define MAX_PROVIDED_METHODS
Definition: submodule.h:28
rlm_eap_submodule_t const * submodule
Submodule's exported interface.
Definition: submodule.h:69
bool clone_parent_lists
< Namespace children should be allocated in.
Definition: submodule.h:59
eap_type_t(* eap_type_identity_t)(void *inst, char const *id, size_t id_len)
Allow a module to vouch explicitly for an identity.
Definition: submodule.h:44
eap_type_identity_t type_identity
Do we recognise this identity?
Definition: submodule.h:55
module_method_t session_init
Callback for creating a new eap_session_t.
Definition: submodule.h:57
Private structure to hold handles and interfaces for an EAP method.
Definition: submodule.h:67
Interface exported by EAP submodules.
Definition: submodule.h:49