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