added x509_ac_builder plugin
[strongswan.git] / src / libstrongswan / plugins / x509 / x509_plugin.c
1 /*
2 * Copyright (C) 2008 Martin Willi
3 * 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 * $Id$
16 */
17
18 #include "x509_plugin.h"
19
20 #include <library.h>
21 #include "x509_cert.h"
22 #include "x509_ac.h"
23 #include "x509_crl.h"
24 #include "x509_ocsp_request.h"
25 #include "x509_ocsp_response.h"
26
27 typedef struct private_x509_plugin_t private_x509_plugin_t;
28
29 /**
30 * private data of x509_plugin
31 */
32 struct private_x509_plugin_t {
33
34 /**
35 * public functions
36 */
37 x509_plugin_t public;
38 };
39
40 /**
41 * Implementation of x509_plugin_t.x509troy
42 */
43 static void destroy(private_x509_plugin_t *this)
44 {
45 lib->creds->remove_builder(lib->creds,
46 (builder_constructor_t)x509_cert_builder);
47 lib->creds->remove_builder(lib->creds,
48 (builder_constructor_t)x509_ac_builder);
49 lib->creds->remove_builder(lib->creds,
50 (builder_constructor_t)x509_crl_builder);
51 lib->creds->remove_builder(lib->creds,
52 (builder_constructor_t)x509_ocsp_request_builder);
53 lib->creds->remove_builder(lib->creds,
54 (builder_constructor_t)x509_ocsp_response_builder);
55 free(this);
56 }
57
58 /*
59 * see header file
60 */
61 plugin_t *plugin_create()
62 {
63 private_x509_plugin_t *this = malloc_thing(private_x509_plugin_t);
64
65 this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
66
67 lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509,
68 (builder_constructor_t)x509_cert_builder);
69 lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_AC,
70 (builder_constructor_t)x509_ac_builder);
71 lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_CRL,
72 (builder_constructor_t)x509_crl_builder);
73 lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_REQUEST,
74 (builder_constructor_t)x509_ocsp_request_builder);
75 lib->creds->add_builder(lib->creds, CRED_CERTIFICATE, CERT_X509_OCSP_RESPONSE,
76 (builder_constructor_t)x509_ocsp_response_builder);
77
78 return &this->public.plugin;
79 }
80