Add features support to socket-raw plugin
[strongswan.git] / src / libcharon / plugins / socket_raw / socket_raw_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_raw_plugin.h"
19
20 #include "socket_raw_socket.h"
21
22 #include <daemon.h>
23
24 typedef struct private_socket_raw_plugin_t private_socket_raw_plugin_t;
25
26 /**
27 * Private data of socket plugin
28 */
29 struct private_socket_raw_plugin_t {
30
31 /**
32 * Implements plugin interface
33 */
34 socket_raw_plugin_t public;
35 };
36
37 METHOD(plugin_t, get_name, char*,
38 private_socket_raw_plugin_t *this)
39 {
40 return "socket-raw";
41 }
42
43 METHOD(plugin_t, get_features, int,
44 private_socket_raw_plugin_t *this, plugin_feature_t *features[])
45 {
46 static plugin_feature_t f[] = {
47 PLUGIN_CALLBACK(socket_register, socket_raw_socket_create),
48 PLUGIN_PROVIDE(CUSTOM, "socket"),
49 };
50 *features = f;
51 return countof(f);
52 }
53
54 METHOD(plugin_t, destroy, void,
55 private_socket_raw_plugin_t *this)
56 {
57 free(this);
58 }
59
60 /*
61 * see header file
62 */
63 plugin_t *socket_raw_plugin_create()
64 {
65 private_socket_raw_plugin_t *this;
66
67 INIT(this,
68 .public = {
69 .plugin = {
70 .get_name = _get_name,
71 .get_features = _get_features,
72 .destroy = _destroy,
73 },
74 },
75 );
76
77 return &this->public.plugin;
78 }
79