2 * Copyright (C) 2012 Reto Guadagnini
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 "ipseckey_plugin.h"
19 #include "ipseckey_cred.h"
21 typedef struct private_ipseckey_plugin_t private_ipseckey_plugin_t
;
25 * private data of the ipseckey plugin
27 struct private_ipseckey_plugin_t
{
30 * implements plugin interface
32 ipseckey_plugin_t
public;
35 * DNS resolver instance
42 ipseckey_cred_t
*cred
;
45 * IPSECKEY based authentication enabled
50 METHOD(plugin_t
, get_name
, char*,
51 private_ipseckey_plugin_t
*this)
56 METHOD(plugin_t
, destroy
, void,
57 private_ipseckey_plugin_t
*this)
61 lib
->credmgr
->remove_set(lib
->credmgr
, &this->cred
->set
);
63 DESTROY_IF(this->res
);
64 DESTROY_IF(this->cred
);
71 plugin_t
*ipseckey_plugin_create()
73 private_ipseckey_plugin_t
*this;
78 .get_name
= _get_name
,
79 .reload
= (void*)return_false
,
83 .res
= lib
->resolver
->create(lib
->resolver
),
84 .enabled
= lib
->settings
->get_bool(lib
->settings
,
85 "%s.plugins.ipseckey.enable", FALSE
, charon
->name
),
90 DBG1(DBG_CFG
, "failed to create a DNS resolver instance");
97 this->cred
= ipseckey_cred_create(this->res
);
98 lib
->credmgr
->add_set(lib
->credmgr
, &this->cred
->set
);
101 return &this->public.plugin
;