summaryrefslogtreecommitdiff
path: root/src/charon/plugins/sql/sql_plugin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/plugins/sql/sql_plugin.c')
-rw-r--r--src/charon/plugins/sql/sql_plugin.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/charon/plugins/sql/sql_plugin.c b/src/charon/plugins/sql/sql_plugin.c
index e5a4afd1d..e2e410a8a 100644
--- a/src/charon/plugins/sql/sql_plugin.c
+++ b/src/charon/plugins/sql/sql_plugin.c
@@ -18,7 +18,6 @@
#include <daemon.h>
#include "sql_config.h"
#include "sql_cred.h"
-#include "sql_attribute.h"
#include "sql_logger.h"
typedef struct private_sql_plugin_t private_sql_plugin_t;
@@ -32,27 +31,22 @@ struct private_sql_plugin_t {
* implements plugin interface
*/
sql_plugin_t public;
-
+
/**
* database connection instance
*/
database_t *db;
-
+
/**
* configuration backend
*/
sql_config_t *config;
-
+
/**
* credential set
*/
sql_cred_t *cred;
-
- /**
- * CFG attributes
- */
- sql_attribute_t *attribute;
-
+
/**
* bus listener/logger
*/
@@ -66,11 +60,9 @@ static void destroy(private_sql_plugin_t *this)
{
charon->backends->remove_backend(charon->backends, &this->config->backend);
charon->credentials->remove_set(charon->credentials, &this->cred->set);
- charon->attributes->remove_provider(charon->attributes, &this->attribute->provider);
charon->bus->remove_listener(charon->bus, &this->logger->listener);
this->config->destroy(this->config);
this->cred->destroy(this->cred);
- this->attribute->destroy(this->attribute);
this->logger->destroy(this->logger);
this->db->destroy(this->db);
free(this);
@@ -83,18 +75,18 @@ plugin_t *plugin_create()
{
char *uri;
private_sql_plugin_t *this;
-
+
uri = lib->settings->get_str(lib->settings, "charon.plugins.sql.database", NULL);
if (!uri)
{
DBG1(DBG_CFG, "sql plugin: database URI not set");
return NULL;
}
-
+
this = malloc_thing(private_sql_plugin_t);
-
+
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
-
+
this->db = lib->db->create(lib->db, uri);
if (!this->db)
{
@@ -104,14 +96,12 @@ plugin_t *plugin_create()
}
this->config = sql_config_create(this->db);
this->cred = sql_cred_create(this->db);
- this->attribute = sql_attribute_create(this->db);
this->logger = sql_logger_create(this->db);
-
+
charon->backends->add_backend(charon->backends, &this->config->backend);
charon->credentials->add_set(charon->credentials, &this->cred->set);
- charon->attributes->add_provider(charon->attributes, &this->attribute->provider);
charon->bus->add_listener(charon->bus, &this->logger->listener);
-
+
return &this->public.plugin;
}