]>
Commit | Line | Data |
---|---|---|
5ef478aa MW |
1 | /* |
2 | * Copyright (C) 2009 Martin Willi | |
19ef2aec TB |
3 | * |
4 | * Copyright (C) secunet Security Networks AG | |
5ef478aa MW |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | |
7 | * under the terms of the GNU General Public License as published by the | |
8 | * Free Software Foundation; either version 2 of the License, or (at your | |
9 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | * for more details. | |
15 | */ | |
16 | ||
17 | #include "dnskey_plugin.h" | |
18 | ||
19 | #include <library.h> | |
20 | #include "dnskey_builder.h" | |
a4ddc0bb | 21 | #include "dnskey_encoder.h" |
5ef478aa MW |
22 | |
23 | typedef struct private_dnskey_plugin_t private_dnskey_plugin_t; | |
24 | ||
25 | /** | |
26 | * private data of dnskey_plugin | |
27 | */ | |
28 | struct private_dnskey_plugin_t { | |
29 | ||
30 | /** | |
31 | * public functions | |
32 | */ | |
33 | dnskey_plugin_t public; | |
34 | }; | |
35 | ||
787b5884 MW |
36 | METHOD(plugin_t, get_name, char*, |
37 | private_dnskey_plugin_t *this) | |
38 | { | |
39 | return "dnskey"; | |
40 | } | |
41 | ||
1c2008f0 AS |
42 | METHOD(plugin_t, get_features, int, |
43 | private_dnskey_plugin_t *this, plugin_feature_t *features[]) | |
44 | { | |
45 | static plugin_feature_t f[] = { | |
46 | PLUGIN_REGISTER(PUBKEY, dnskey_public_key_load, FALSE), | |
47 | PLUGIN_PROVIDE(PUBKEY, KEY_ANY), | |
48 | PLUGIN_REGISTER(PUBKEY, dnskey_public_key_load, FALSE), | |
49 | PLUGIN_PROVIDE(PUBKEY, KEY_RSA), | |
50 | }; | |
51 | *features = f; | |
52 | return countof(f); | |
53 | } | |
54 | ||
cb458beb AS |
55 | METHOD(plugin_t, destroy, void, |
56 | private_dnskey_plugin_t *this) | |
5ef478aa | 57 | { |
a4ddc0bb AS |
58 | lib->encoding->remove_encoder(lib->encoding, dnskey_encoder_encode); |
59 | ||
5ef478aa MW |
60 | free(this); |
61 | } | |
62 | ||
63 | /* | |
64 | * see header file | |
65 | */ | |
9ce567f8 | 66 | plugin_t *dnskey_plugin_create() |
5ef478aa | 67 | { |
cb458beb AS |
68 | private_dnskey_plugin_t *this; |
69 | ||
70 | INIT(this, | |
71 | .public = { | |
72 | .plugin = { | |
787b5884 | 73 | .get_name = _get_name, |
1c2008f0 | 74 | .get_features = _get_features, |
cb458beb AS |
75 | .destroy = _destroy, |
76 | }, | |
77 | }, | |
78 | ); | |
7daf5226 | 79 | |
a4ddc0bb AS |
80 | lib->encoding->add_encoder(lib->encoding, dnskey_encoder_encode); |
81 | ||
5ef478aa MW |
82 | return &this->public.plugin; |
83 | } | |
84 |