summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Eitzenberger <heitzenberger@astaro.com>2009-10-30 11:42:22 +0100
committerHarald Welte <laforge@gnumonks.org>2010-10-21 19:15:39 +0200
commite3db9bed2cdadffbc56db7cb4060d4844fc3486e (patch)
treeef71140275655ccebe75fc4c5d57bdbf75aae7bb
parentd70f3e7cc7d02ec7c191204a1c1327f8f2e536cc (diff)
IPFIX: add initial IPFIX plugin
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
-rw-r--r--configure.in3
-rw-r--r--output/Makefile.am2
-rw-r--r--output/ipfix/Makefile.am8
-rw-r--r--output/ipfix/ulogd_output_IPFIX.c103
4 files changed, 114 insertions, 2 deletions
diff --git a/configure.in b/configure.in
index 79bc49e..e70f7e8 100644
--- a/configure.in
+++ b/configure.in
@@ -83,5 +83,6 @@ AC_OUTPUT(doc/Makefile \
libipulog/Makefile \
input/Makefile input/packet/Makefile input/flow/Makefile \
filter/Makefile filter/raw2packet/Makefile filter/packet2flow/Makefile \
- output/Makefile output/pcap/Makefile output/mysql/Makefile output/pgsql/Makefile output/sqlite3/Makefile \
+ output/Makefile output/pcap/Makefile output/mysql/Makefile \
+ output/pgsql/Makefile output/sqlite3/Makefile output/ipfix/Makefile \
src/Makefile Makefile Rules.make)
diff --git a/output/Makefile.am b/output/Makefile.am
index 321ec81..b19e621 100644
--- a/output/Makefile.am
+++ b/output/Makefile.am
@@ -1,7 +1,7 @@
INCLUDES = $(all_includes) -I$(top_srcdir)/include
LIBS=""
-SUBDIRS= pcap mysql pgsql sqlite3
+SUBDIRS= pcap mysql pgsql sqlite3 ipfix
pkglib_LTLIBRARIES = ulogd_output_LOGEMU.la ulogd_output_SYSLOG.la \
ulogd_output_OPRINT.la ulogd_output_NACCT.la \
diff --git a/output/ipfix/Makefile.am b/output/ipfix/Makefile.am
new file mode 100644
index 0000000..7bffd30
--- /dev/null
+++ b/output/ipfix/Makefile.am
@@ -0,0 +1,8 @@
+
+INCLUDES = $(all_includes) -I$(top_srcdir)/include -I$(PQINCPATH)
+
+pkglib_LTLIBRARIES = ulogd_output_IPFIX.la
+
+ulogd_output_IPFIX_la_SOURCES = ulogd_output_IPFIX.c
+ulogd_output_IPFIX_la_LDFLAGS = -module -avoid-version
+
diff --git a/output/ipfix/ulogd_output_IPFIX.c b/output/ipfix/ulogd_output_IPFIX.c
new file mode 100644
index 0000000..36c31b3
--- /dev/null
+++ b/output/ipfix/ulogd_output_IPFIX.c
@@ -0,0 +1,103 @@
+/*
+ * ulogd_output_IPFIX.c
+ *
+ * ulogd IPFIX Exporter plugin.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Holger Eitzenberger <holger@eitzenberger.org> Astaro AG 2009
+ */
+#include "config.h"
+#include <ulogd/ulogd.h>
+#include <ulogd/common.h>
+#include <ulogd/plugin.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netdb.h>
+
+
+enum {
+ HOST_CE = 0,
+ PORT_CE,
+ PROTO_CE,
+};
+
+static const struct config_keyset ipfix_kset = {
+ .num_ces = 3,
+ .ces = {
+ [HOST_CE] = CONFIG_KEY_STR("host", ""),
+ [PORT_CE] = CONFIG_KEY_INT("port", 4739 ),
+ [PROTO_CE] = CONFIG_KEY_STR("proto", "udp"),
+ },
+};
+
+#define host_ce(pi) ulogd_config_str(pi, HOST_CE);
+#define port_ce(pi) ulogd_config_int(pi, PORT_CE);
+#define proto_ce(pi) ulogd_config_str(pi, PROTO_CE);
+
+struct ipfix_priv {
+};
+
+static int
+ipfix_configure(struct ulogd_pluginstance *pi)
+{
+ struct ipfix_priv *priv = upi_priv(pi);
+
+ return ulogd_wildcard_inputkeys(pi);
+}
+
+static int
+ipfix_start(struct ulogd_pluginstance *pi)
+{
+ struct ipfix_priv *priv = upi_priv(pi);
+
+ return 0;
+}
+
+static int
+ipfix_stop(struct ulogd_pluginstance *pi)
+{
+ struct ipfix_priv *priv = upi_priv(pi);
+
+ return 0;
+}
+
+static int
+ipfix_interp(struct ulogd_pluginstance *pi, unsigned *flags)
+{
+ struct ipfix_priv *priv = upi_priv(pi);
+
+ return 0;
+}
+
+static struct ulogd_plugin ipfix_plugin = {
+ .name = "IPFIX",
+ .input = {
+ .type = ULOGD_DTYPE_PACKET | ULOGD_DTYPE_FLOW,
+ },
+ .output = {
+ .type = ULOGD_DTYPE_SINK,
+ },
+ .config_kset = &ipfix_kset,
+ .priv_size = sizeof(struct ipfix_priv),
+ .configure = ipfix_configure,
+ .start = ipfix_start,
+ .stop = ipfix_stop,
+ .interp = ipfix_interp,
+ .rev = ULOGD_PLUGIN_REVISION,
+};
+
+void __upi_ctor init(void);
+
+void init(void)
+{
+ ulogd_register_plugin(&ipfix_plugin);
+}