]>
Commit | Line | Data |
---|---|---|
9ed1bb48 | 1 | /* |
fa208494 | 2 | * Copyright (C) 2010 Tobias Brunner |
9ed1bb48 | 3 | * Copyright (C) 2010 Martin Willi |
19ef2aec TB |
4 | * |
5 | * Copyright (C) secunet Security Networks AG | |
9ed1bb48 MW |
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_dynamic_plugin.h" | |
19 | ||
20 | #include "socket_dynamic_socket.h" | |
21 | ||
22 | #include <daemon.h> | |
23 | ||
24 | typedef struct private_socket_dynamic_plugin_t private_socket_dynamic_plugin_t; | |
25 | ||
26 | /** | |
27 | * Private data of socket plugin | |
28 | */ | |
29 | struct private_socket_dynamic_plugin_t { | |
30 | ||
31 | /** | |
32 | * Implements plugin interface | |
33 | */ | |
34 | socket_dynamic_plugin_t public; | |
9ed1bb48 MW |
35 | }; |
36 | ||
85d11ce9 MW |
37 | METHOD(plugin_t, get_features, int, |
38 | private_socket_dynamic_plugin_t *this, plugin_feature_t *features[]) | |
39 | { | |
40 | static plugin_feature_t f[] = { | |
41 | PLUGIN_CALLBACK(socket_register, socket_dynamic_socket_create), | |
42 | PLUGIN_PROVIDE(CUSTOM, "socket"), | |
270e425b | 43 | PLUGIN_SDEPEND(CUSTOM, "kernel-ipsec"), |
85d11ce9 MW |
44 | }; |
45 | *features = f; | |
46 | return countof(f); | |
47 | } | |
48 | ||
787b5884 MW |
49 | METHOD(plugin_t, get_name, char*, |
50 | private_socket_dynamic_plugin_t *this) | |
51 | { | |
52 | return "socket-dynamic"; | |
53 | } | |
54 | ||
9ed1bb48 MW |
55 | METHOD(plugin_t, destroy, void, |
56 | private_socket_dynamic_plugin_t *this) | |
57 | { | |
9ed1bb48 MW |
58 | free(this); |
59 | } | |
60 | ||
61 | /* | |
62 | * see header file | |
63 | */ | |
9ce567f8 | 64 | plugin_t *socket_dynamic_plugin_create() |
9ed1bb48 MW |
65 | { |
66 | private_socket_dynamic_plugin_t *this; | |
67 | ||
68 | INIT(this, | |
ba31fe1f MW |
69 | .public = { |
70 | .plugin = { | |
787b5884 | 71 | .get_name = _get_name, |
85d11ce9 | 72 | .get_features = _get_features, |
ba31fe1f MW |
73 | .destroy = _destroy, |
74 | }, | |
75 | }, | |
9ed1bb48 MW |
76 | ); |
77 | ||
9ed1bb48 MW |
78 | return &this->public.plugin; |
79 | } | |
80 |