Socket plugins soft depend on the kernel-ipsec plugin feature
[strongswan.git] / src / libcharon / plugins / socket_default / socket_default_plugin.c
1 /*
2 * Copyright (C) 2010 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
4 * Copyright (C) 2010 Martin Willi
5 * Copyright (C) 2010 revosec AG
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 #include "socket_default_plugin.h"
19
20 #include "socket_default_socket.h"
21
22 #include <daemon.h>
23
24 typedef struct private_socket_default_plugin_t private_socket_default_plugin_t;
25
26 /**
27 * Private data of socket plugin
28 */
29 struct private_socket_default_plugin_t {
30
31 /**
32 * Implements plugin interface
33 */
34 socket_default_plugin_t public;
35 };
36
37 METHOD(plugin_t, get_name, char*,
38 private_socket_default_plugin_t *this)
39 {
40 return "socket-default";
41 }
42
43 METHOD(plugin_t, destroy, void,
44 private_socket_default_plugin_t *this)
45 {
46 free(this);
47 }
48
49 METHOD(plugin_t, get_features, int,
50 private_socket_default_plugin_t *this, plugin_feature_t *features[])
51 {
52 static plugin_feature_t f[] = {
53 PLUGIN_CALLBACK(socket_register, socket_default_socket_create),
54 PLUGIN_PROVIDE(CUSTOM, "socket"),
55 PLUGIN_SDEPEND(CUSTOM, "kernel-ipsec"),
56 };
57 *features = f;
58 return countof(f);
59 }
60
61 /*
62 * see header file
63 */
64 plugin_t *socket_default_plugin_create()
65 {
66 private_socket_default_plugin_t *this;
67
68 INIT(this,
69 .public = {
70 .plugin = {
71 .get_name = _get_name,
72 .get_features = _get_features,
73 .destroy = _destroy,
74 },
75 },
76 );
77
78 return &this->public.plugin;
79 }