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
16 #include "uci_plugin.h"
17 #include "uci_config.h"
18 #include "uci_creds.h"
19 #include "uci_control.h"
24 * UCI package name to use for lookups
26 #define UCI_PACKAGE "strongswan"
28 typedef struct private_uci_plugin_t private_uci_plugin_t
;
31 * private data of uci plugin
33 struct private_uci_plugin_t
{
36 * implements plugin interface
41 * UCI configuration backend
46 * UCI credential set implementation
56 * UCI control interface
58 uci_control_t
*control
;
61 METHOD(plugin_t
, get_name
, char*,
62 private_uci_plugin_t
*this)
67 METHOD(plugin_t
, destroy
, void,
68 private_uci_plugin_t
*this)
70 charon
->backends
->remove_backend(charon
->backends
, &this->config
->backend
);
71 lib
->credmgr
->remove_set(lib
->credmgr
, &this->creds
->credential_set
);
72 this->config
->destroy(this->config
);
73 this->creds
->destroy(this->creds
);
74 this->parser
->destroy(this->parser
);
75 this->control
->destroy(this->control
);
82 plugin_t
*uci_plugin_create()
84 private_uci_plugin_t
*this;
89 .get_name
= _get_name
,
90 .reload
= (void*)return_false
,
94 .parser
= uci_parser_create(UCI_PACKAGE
),
95 .control
= uci_control_create(),
97 this->config
= uci_config_create(this->parser
);
98 this->creds
= uci_creds_create(this->parser
);
100 charon
->backends
->add_backend(charon
->backends
, &this->config
->backend
);
101 lib
->credmgr
->add_set(lib
->credmgr
, &this->creds
->credential_set
);
103 return &this->public.plugin
;