2 * Copyright (C) 2010 Andreas Steffen
3 * HSR 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 "tnc_imc_plugin.h"
21 METHOD(plugin_t
, destroy
, void,
22 tnc_imc_plugin_t
*this)
26 while (charon
->imcs
->remove_last(charon
->imcs
, (void**)&imc
) == SUCCESS
)
29 imc
->terminate(imc
->get_id(imc
)) != TNC_RESULT_SUCCESS
)
31 DBG1(DBG_TNC
, "IMC '%s' not terminated successfully",
42 plugin_t
*tnc_imc_plugin_create()
44 TNC_IMCID next_id
= 1;
46 char *tnc_config
, *pref_lang
, *name
, *filename
;
47 tnc_imc_plugin_t
*this;
56 pref_lang
= lib
->settings
->get_str(lib
->settings
,
57 "charon.plugins.tnc-imc.preferred_language", "en");
58 tnc_config
= lib
->settings
->get_str(lib
->settings
,
59 "charon.plugins.tnc-imc.tnc_config", "/etc/tnc_config");
62 filename
= "/usr/local/lib/libdummyimc.so";
63 imc
= tnc_imc_create(name
, filename
, next_id
);
66 /* Initialize the module */
67 if (imc
->initialize(next_id
, TNC_IFIMC_VERSION_1
, TNC_IFIMC_VERSION_1
,
68 &version
) != TNC_RESULT_SUCCESS
)
70 DBG1(DBG_TNC
, "could not initialize IMC '%s'\n",
76 charon
->imcs
->insert_last(charon
->imcs
, imc
);