1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
/*
* Copyright (C) 2012 Tobias Brunner
* Copyright (C) 2008 Martin Willi
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup eap_manager eap_manager
* @{ @ingroup eap
*/
#ifndef EAP_MANAGER_H_
#define EAP_MANAGER_H_
#include <sa/eap/eap_method.h>
typedef struct eap_manager_t eap_manager_t;
/**
* The EAP manager manages all EAP implementations and creates instances.
*
* A plugin registers it's implemented EAP method at the manager by
* providing type and a constructor function. The manager then instantiates
* eap_method_t instances through the provided constructor to handle
* EAP authentication.
*/
struct eap_manager_t {
/**
* Register a EAP method implementation.
*
* @param method vendor specific method, if vendor != 0
* @param vendor vendor ID, 0 for non-vendor (default) EAP methods
* @param role EAP role of the registered method
* @param constructor constructor function, returns an eap_method_t
*/
void (*add_method)(eap_manager_t *this, eap_type_t type, uint32_t vendor,
eap_role_t role, eap_constructor_t constructor);
/**
* Unregister a EAP method implementation using it's constructor.
*
* @param constructor constructor function to remove, as added in add_method
*/
void (*remove_method)(eap_manager_t *this, eap_constructor_t constructor);
/**
* Enumerate the registered EAP authentication methods for the given role.
*
* @note Only authentication types are enumerated (e.g. EAP-Identity is not
* even though it is registered as method with this manager).
*
* @param role EAP role of methods to enumerate
* @return enumerator over (eap_type_t type, uint32_t vendor)
*/
enumerator_t* (*create_enumerator)(eap_manager_t *this, eap_role_t role);
/**
* Create a new EAP method instance.
*
* @param type type of the EAP method
* @param vendor vendor ID, 0 for non-vendor (default) EAP methods
* @param role role of EAP method, either EAP_SERVER or EAP_PEER
* @param server identity of the server
* @param peer identity of the peer (client)
* @return EAP method instance, NULL if no constructor found
*/
eap_method_t* (*create_instance)(eap_manager_t *this, eap_type_t type,
uint32_t vendor, eap_role_t role,
identification_t *server,
identification_t *peer);
/**
* Destroy a eap_manager instance.
*/
void (*destroy)(eap_manager_t *this);
};
/**
* Create a eap_manager instance.
*/
eap_manager_t *eap_manager_create();
#endif /** EAP_MANAGER_H_ @}*/
|