ECB mode added to the DES plugin
[strongswan.git] / src / libstrongswan / plugins / mysql / mysql_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 "mysql_plugin.h"
19
20 #include <library.h>
21 #include <debug.h>
22 #include "mysql_database.h"
23
24 typedef struct private_mysql_plugin_t private_mysql_plugin_t;
25
26 /**
27 * private data of mysql_plugin
28 */
29 struct private_mysql_plugin_t {
30
31 /**
32 * public functions
33 */
34 mysql_plugin_t public;
35 };
36
37 /**
38 * Implementation of plugin_t.destroy
39 */
40 static void destroy(private_mysql_plugin_t *this)
41 {
42 lib->db->remove_database(lib->db,
43 (database_constructor_t)mysql_database_create);
44 mysql_database_deinit();
45 free(this);
46 }
47
48 /*
49 * see header file
50 */
51 plugin_t *plugin_create()
52 {
53 private_mysql_plugin_t *this;
54
55 if (!mysql_database_init())
56 {
57 DBG1("MySQL client library initialization failed");
58 return NULL;
59 }
60
61 this = malloc_thing(private_mysql_plugin_t);
62 this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
63
64 lib->db->add_database(lib->db,
65 (database_constructor_t)mysql_database_create);
66
67 return &this->public.plugin;
68 }
69