connmark: Add a plugin stub

This commit is contained in:
Martin Willi
2015-02-20 15:33:59 +01:00
parent 45ab5b0fca
commit 8c2290dcf9
5 changed files with 154 additions and 0 deletions
+7
View File
@@ -209,6 +209,13 @@ if MONOLITHIC
endif
endif
if USE_CONNMARK
SUBDIRS += plugins/connmark
if MONOLITHIC
libcharon_la_LIBADD += plugins/connmark/libstrongswan-connmark.la
endif
endif
if USE_FARP
SUBDIRS += plugins/farp
if MONOLITHIC
@@ -0,0 +1,18 @@
AM_CPPFLAGS = \
-I$(top_srcdir)/src/libstrongswan \
-I$(top_srcdir)/src/libhydra \
-I$(top_srcdir)/src/libcharon
AM_CFLAGS = \
$(PLUGIN_CFLAGS)
if MONOLITHIC
noinst_LTLIBRARIES = libstrongswan-connmark.la
else
plugin_LTLIBRARIES = libstrongswan-connmark.la
endif
libstrongswan_connmark_la_SOURCES = \
connmark_plugin.h connmark_plugin.c
libstrongswan_connmark_la_LDFLAGS = -module -avoid-version
@@ -0,0 +1,83 @@
/*
* Copyright (C) 2014 Martin Willi
* Copyright (C) 2014 revosec AG
*
* 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 "connmark_plugin.h"
#include <daemon.h>
typedef struct private_connmark_plugin_t private_connmark_plugin_t;
/**
* private data of connmark plugin
*/
struct private_connmark_plugin_t {
/**
* implements plugin interface
*/
connmark_plugin_t public;
};
METHOD(plugin_t, get_name, char*,
private_connmark_plugin_t *this)
{
return "connmark";
}
/**
* Register listener
*/
static bool plugin_cb(private_connmark_plugin_t *this,
plugin_feature_t *feature, bool reg, void *cb_data)
{
return TRUE;
}
METHOD(plugin_t, get_features, int,
private_connmark_plugin_t *this, plugin_feature_t *features[])
{
static plugin_feature_t f[] = {
PLUGIN_CALLBACK((plugin_feature_callback_t)plugin_cb, NULL),
PLUGIN_PROVIDE(CUSTOM, "connmark"),
};
*features = f;
return countof(f);
}
METHOD(plugin_t, destroy, void,
private_connmark_plugin_t *this)
{
free(this);
}
/**
* Plugin constructor
*/
plugin_t *connmark_plugin_create()
{
private_connmark_plugin_t *this;
INIT(this,
.public = {
.plugin = {
.get_name = _get_name,
.get_features = _get_features,
.destroy = _destroy,
},
},
);
return &this->public.plugin;
}
@@ -0,0 +1,42 @@
/*
* Copyright (C) 2014 Martin Willi
* Copyright (C) 2014 revosec AG
*
* 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 connmark connmark
* @ingroup cplugins
*
* @defgroup connmark_plugin connmark_plugin
* @{ @ingroup connmark
*/
#ifndef CONNMARK_PLUGIN_H_
#define CONNMARK_PLUGIN_H_
#include <plugins/plugin.h>
typedef struct connmark_plugin_t connmark_plugin_t;
/**
* Plugin using marks to select return path SA based on conntrack.
*/
struct connmark_plugin_t {
/**
* implements plugin interface
*/
plugin_t plugin;
};
#endif /** CONNMARK_PLUGIN_H_ @}*/