Moving charon to libcharon.
[strongswan.git] / src / libcharon / plugins / eap_identity / eap_identity_plugin.c
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 #include "eap_identity_plugin.h"
17
18 #include "eap_identity.h"
19
20 #include <daemon.h>
21
22 /**
23 * Implementation of plugin_t.destroy
24 */
25 static void destroy(eap_identity_plugin_t *this)
26 {
27 charon->eap->remove_method(charon->eap,
28 (eap_constructor_t)eap_identity_create_server);
29 charon->eap->remove_method(charon->eap,
30 (eap_constructor_t)eap_identity_create_peer);
31 free(this);
32 }
33
34 /*
35 * see header file
36 */
37 plugin_t *eap_identity_plugin_create()
38 {
39 eap_identity_plugin_t *this = malloc_thing(eap_identity_plugin_t);
40
41 this->plugin.destroy = (void(*)(plugin_t*))destroy;
42
43 charon->eap->add_method(charon->eap, EAP_IDENTITY, 0, EAP_SERVER,
44 (eap_constructor_t)eap_identity_create_server);
45 charon->eap->add_method(charon->eap, EAP_IDENTITY, 0, EAP_PEER,
46 (eap_constructor_t)eap_identity_create_peer);
47
48 return &this->plugin;
49 }
50