Annotation of embedaddon/strongswan/src/libcharon/plugins/tnc_pdp/tnc_pdp_plugin.c, revision 1.1.1.1
1.1 misho 1: /*
2: * Copyright (C) 2010 Andreas Steffen
3: * HSR 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 "tnc_pdp_plugin.h"
17: #include "tnc_pdp.h"
18:
19: #include <daemon.h>
20:
21: typedef struct private_tnc_pdp_plugin_t private_tnc_pdp_plugin_t;
22:
23: /**
24: * private data of tnc_pdp plugin
25: */
26: struct private_tnc_pdp_plugin_t {
27:
28: /**
29: * implements plugin interface
30: */
31: tnc_pdp_plugin_t public;
32:
33: /**
34: * Policy Decision Point object
35: */
36: tnc_pdp_t *pdp;
37:
38: };
39:
40: METHOD(plugin_t, get_name, char*,
41: private_tnc_pdp_plugin_t *this)
42: {
43: return "tnc-pdp";
44: }
45:
46: /**
47: * Register listener
48: */
49: static bool plugin_cb(private_tnc_pdp_plugin_t *this,
50: plugin_feature_t *feature, bool reg, void *cb_data)
51: {
52: if (reg)
53: {
54: this->pdp = tnc_pdp_create();
55: if (!this->pdp)
56: {
57: return FALSE;
58: }
59: }
60: else
61: {
62: DESTROY_IF(this->pdp);
63: }
64: return TRUE;
65: }
66:
67: METHOD(plugin_t, get_features, int,
68: private_tnc_pdp_plugin_t *this, plugin_feature_t *features[])
69: {
70: static plugin_feature_t f[] = {
71: PLUGIN_CALLBACK((plugin_feature_callback_t)plugin_cb, NULL),
72: PLUGIN_PROVIDE(CUSTOM, "tnc-pdp"),
73: PLUGIN_DEPENDS(CUSTOM, "imv-manager"),
74: PLUGIN_DEPENDS(HASHER, HASH_MD5),
75: PLUGIN_DEPENDS(SIGNER, AUTH_HMAC_MD5_128),
76: PLUGIN_DEPENDS(NONCE_GEN),
77: };
78: *features = f;
79: return countof(f);
80: }
81:
82: METHOD(plugin_t, destroy, void,
83: private_tnc_pdp_plugin_t *this)
84: {
85: free(this);
86: }
87:
88: /*
89: * see header file
90: */
91: plugin_t *tnc_pdp_plugin_create()
92: {
93: private_tnc_pdp_plugin_t *this;
94:
95: INIT(this,
96: .public = {
97: .plugin = {
98: .get_name = _get_name,
99: .get_features = _get_features,
100: .destroy = _destroy,
101: },
102: },
103: );
104:
105: return &this->public.plugin;
106: }
107:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>