c40ce60ebaaa3d829c862ce5f9d0fde505ee7147
[strongswan.git] / src / libcharon / plugins / eap_gtc / eap_gtc_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_gtc_plugin.h"
17
18 #include "eap_gtc.h"
19
20 #include <daemon.h>
21
22 /* missing in cababilities.h */
23 #define CAP_AUDIT_WRITE 29
24
25 METHOD(plugin_t, get_name, char*,
26 eap_gtc_plugin_t *this)
27 {
28 return "eap-gtc";
29 }
30
31 METHOD(plugin_t, destroy, void,
32 eap_gtc_plugin_t *this)
33 {
34 charon->eap->remove_method(charon->eap,
35 (eap_constructor_t)eap_gtc_create_server);
36 charon->eap->remove_method(charon->eap,
37 (eap_constructor_t)eap_gtc_create_peer);
38 free(this);
39 }
40
41 /*
42 * see header file
43 */
44 plugin_t *eap_gtc_plugin_create()
45 {
46 eap_gtc_plugin_t *this;
47
48 INIT(this,
49 .plugin = {
50 .get_name = _get_name,
51 .reload = (void*)return_false,
52 .destroy = _destroy,
53 },
54 );
55
56 /* required for PAM authentication */
57 charon->keep_cap(charon, CAP_AUDIT_WRITE);
58
59 charon->eap->add_method(charon->eap, EAP_GTC, 0, EAP_SERVER,
60 (eap_constructor_t)eap_gtc_create_server);
61 charon->eap->add_method(charon->eap, EAP_GTC, 0, EAP_PEER,
62 (eap_constructor_t)eap_gtc_create_peer);
63
64 return &this->plugin;
65 }
66