created tnc-imc and tnc-imv plugins

This commit is contained in:
Andreas Steffen
2010-10-07 23:31:23 +02:00
parent 04d000210b
commit 8dcc56dcc0
16 changed files with 365 additions and 47 deletions
+19
View File
@@ -0,0 +1,19 @@
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon `xml2-config --cflags`
AM_CFLAGS = -rdynamic
libstrongswan_tnc_imv_la_LIBADD = -ltnc
if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-tnc-imv.la
else
plugin_LTLIBRARIES = libstrongswan-tnc-imv.la
endif
libstrongswan_tnc_imv_la_SOURCES = \
tnc_imv_plugin.h tnc_imv_plugin.c
libstrongswan_tnc_imv_la_LDFLAGS = -module -avoid-version
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2010 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "tnc_imv_plugin.h"
#include <libtnctncs.h>
#include <daemon.h>
METHOD(plugin_t, destroy, void,
tnc_imv_plugin_t *this)
{
libtnc_tncs_Terminate();
free(this);
}
/*
* see header file
*/
plugin_t *tnc_imv_plugin_create()
{
char *tnc_config;
int imv_count;
tnc_imv_plugin_t *this;
INIT(this,
.plugin = {
.destroy = _destroy,
},
);
tnc_config = lib->settings->get_str(lib->settings,
"charon.plugins.tnc-imv.tnc_config", "/etc/tnc_config");
imv_count = libtnc_imv_load_config(tnc_config);
if (imv_count < 0)
{
free(this);
DBG1(DBG_IKE, "TNC IMV initialization failed");
return NULL;
}
else
{
DBG1(DBG_IKE, "loaded %d TNC IMV%s", imv_count, (imv_count > 1)? "s":"");
}
return &this->plugin;
}
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2010 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup tnc_imv tnc_imv
* @ingroup cplugins
*
* @defgroup tnc_imv_plugin tnc_imv_plugin
* @{ @ingroup tnc_imv
*/
#ifndef TNC_IMV_PLUGIN_H_
#define TNC_IMV_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct tnc_imv_plugin_t tnc_imv_plugin_t;
/**
* TNC IMV plugin
*/
struct tnc_imv_plugin_t {
/**
* implements plugin interface
*/
plugin_t plugin;
};
#endif /** TNC_IMV_PLUGIN_H_ @}*/