a2bdf7460fed26746d48ecb072b57db2455c51cb
[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 #ifndef CAP_AUDIT_WRITE
23 #define CAP_AUDIT_WRITE 29
24 #endif
25
26 METHOD(plugin_t, get_name, char*,
27 eap_gtc_plugin_t *this)
28 {
29 return "eap-gtc";
30 }
31
32 METHOD(plugin_t, get_features, int,
33 eap_gtc_plugin_t *this, plugin_feature_t *features[])
34 {
35 static plugin_feature_t f[] = {
36 PLUGIN_CALLBACK(eap_method_register, eap_gtc_create_server),
37 PLUGIN_PROVIDE(EAP_SERVER, EAP_GTC),
38 PLUGIN_CALLBACK(eap_method_register, eap_gtc_create_peer),
39 PLUGIN_PROVIDE(EAP_PEER, EAP_GTC),
40 };
41 *features = f;
42 return countof(f);
43 }
44
45 METHOD(plugin_t, destroy, void,
46 eap_gtc_plugin_t *this)
47 {
48 free(this);
49 }
50
51 /*
52 * see header file
53 */
54 plugin_t *eap_gtc_plugin_create()
55 {
56 eap_gtc_plugin_t *this;
57
58 INIT(this,
59 .plugin = {
60 .get_name = _get_name,
61 .get_features = _get_features,
62 .destroy = _destroy,
63 },
64 );
65
66 /* required for PAM authentication */
67 charon->caps->keep(charon->caps, CAP_AUDIT_WRITE);
68
69 return &this->plugin;
70 }
71