2 * Copyright (C) 2008 Thomas Kallenberg
3 * Hochschule fuer Technik Rapperswil
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>.
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
18 #include "uci_plugin.h"
19 #include "uci_config.h"
20 #include "uci_creds.h"
25 * UCI package name to use for lookups
27 #define UCI_PACKAGE "strongswan"
29 typedef struct private_uci_plugin_t private_uci_plugin_t
;
32 * private data of uci plugin
34 struct private_uci_plugin_t
{
37 * implements plugin interface
42 * UCI configuration backend
47 * UCI credential set implementation
58 * Implementation of plugin_t.destroy
60 static void destroy(private_uci_plugin_t
*this)
62 charon
->backends
->remove_backend(charon
->backends
, &this->config
->backend
);
63 charon
->credentials
->remove_set(charon
->credentials
, &this->creds
->credential_set
);
64 this->config
->destroy(this->config
);
65 this->creds
->destroy(this->creds
);
66 this->parser
->destroy(this->parser
);
73 plugin_t
*plugin_create()
75 private_uci_plugin_t
*this = malloc_thing(private_uci_plugin_t
);
77 this->public.plugin
.destroy
= (void(*)(plugin_t
*))destroy
;
79 this->parser
= uci_parser_create(UCI_PACKAGE
);
80 this->config
= uci_config_create(this->parser
);
81 this->creds
= uci_creds_create(this->parser
);
82 charon
->backends
->add_backend(charon
->backends
, &this->config
->backend
);
83 charon
->credentials
->add_set(charon
->credentials
, &this->creds
->credential_set
);
85 return &this->public.plugin
;