cbc3929bbc82e41bcb60ba1ab9b415d53229eb8e
[strongswan.git] / src / libcharon / plugins / eap_ttls / eap_ttls_plugin.c
1 /*
2 * Copyright (C) 2010 Andreas Steffen
3 * Copyright (C) 2010 HSR 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 #include "eap_ttls_plugin.h"
17
18 #include "eap_ttls.h"
19
20 #include <daemon.h>
21
22 METHOD(plugin_t, get_name, char*,
23 eap_ttls_plugin_t *this)
24 {
25 return "eap-ttls";
26 }
27
28 METHOD(plugin_t, destroy, void,
29 eap_ttls_plugin_t *this)
30 {
31 charon->eap->remove_method(charon->eap,
32 (eap_constructor_t)eap_ttls_create_server);
33 charon->eap->remove_method(charon->eap,
34 (eap_constructor_t)eap_ttls_create_peer);
35 free(this);
36 }
37
38 /*
39 * see header file
40 */
41 plugin_t *eap_ttls_plugin_create()
42 {
43 eap_ttls_plugin_t *this;
44
45 INIT(this,
46 .plugin = {
47 .get_name = _get_name,
48 .reload = (void*)return_false,
49 .destroy = _destroy,
50 },
51 );
52
53 charon->eap->add_method(charon->eap, EAP_TTLS, 0, EAP_SERVER,
54 (eap_constructor_t)eap_ttls_create_server);
55 charon->eap->add_method(charon->eap, EAP_TTLS, 0, EAP_PEER,
56 (eap_constructor_t)eap_ttls_create_peer);
57
58 return &this->plugin;
59 }