summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Eitzenberger <heitzenberger@astaro.com>2009-11-01 12:04:43 +0100
committerHarald Welte <laforge@gnumonks.org>2010-10-21 19:15:39 +0200
commitea3ddda662a451539eebd635291418f701d66a4a (patch)
treec67558570679e68978312c8ec2640d34fe74062e
parente3db9bed2cdadffbc56db7cb4060d4844fc3486e (diff)
IPFIX: initial protocol definitions
Signed-off-by: Holger Eitzenberger <holger@eitzenberger.org>
-rw-r--r--output/ipfix/Makefile.am2
-rw-r--r--output/ipfix/ipfix.c13
-rw-r--r--output/ipfix/ipfix.h39
-rw-r--r--output/ipfix/ulogd_output_IPFIX.c5
4 files changed, 58 insertions, 1 deletions
diff --git a/output/ipfix/Makefile.am b/output/ipfix/Makefile.am
index 7bffd30..bf54a9c 100644
--- a/output/ipfix/Makefile.am
+++ b/output/ipfix/Makefile.am
@@ -3,6 +3,6 @@ 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_SOURCES = ulogd_output_IPFIX.c ipfix.c
ulogd_output_IPFIX_la_LDFLAGS = -module -avoid-version
diff --git a/output/ipfix/ipfix.c b/output/ipfix/ipfix.c
new file mode 100644
index 0000000..1eb814a
--- /dev/null
+++ b/output/ipfix/ipfix.c
@@ -0,0 +1,13 @@
+/*
+ * ipfix.c
+ *
+ * Holger Eitzenberger, 2009.
+ */
+#include "config.h"
+#include <ulogd/ulogd.h>
+#include <ulogd/common.h>
+#include <ulogd/plugin.h>
+
+#include "ipfix.h"
+
+
diff --git a/output/ipfix/ipfix.h b/output/ipfix/ipfix.h
new file mode 100644
index 0000000..2bf2ce2
--- /dev/null
+++ b/output/ipfix/ipfix.h
@@ -0,0 +1,39 @@
+/*
+ * ipfix.h
+ *
+ * Holger Eitzenberger <holger@eitzenberger.org>, 2009.
+ */
+#ifndef IPFIX_H
+#define IPFIX_H
+
+#include <stdint.h>
+
+
+struct ipfix_hdr {
+#define IPFIX_VERSION 0xa
+ uint16_t version;
+ uint16_t len;
+ uint32_t time;
+ uint32_t seq;
+ uint32_t odid; /* Observation Domain ID */
+ uint8_t data[];
+};
+
+/*
+ * IDs 0-255 are reserved for Template Sets. IDs of Data Sets are > 255.
+ */
+struct ipfix_templ_hdr {
+ uint16_t id;
+ uint16_t cnt;
+ uint8_t data[];
+};
+
+struct ipfix_set_hdr {
+#define IPFIX_SET_TEMPL 2
+#define IPFIX_SET_OPT_TEMPL 3
+ uint16_t id;
+ uint16_t len;
+ uint8_t data[];
+};
+
+#endif /* IPFIX_H */
diff --git a/output/ipfix/ulogd_output_IPFIX.c b/output/ipfix/ulogd_output_IPFIX.c
index 36c31b3..425cd34 100644
--- a/output/ipfix/ulogd_output_IPFIX.c
+++ b/output/ipfix/ulogd_output_IPFIX.c
@@ -23,6 +23,8 @@
#include <sys/socket.h>
#include <netdb.h>
+#include "ipfix.h"
+
enum {
HOST_CE = 0,
@@ -43,7 +45,10 @@ static const struct config_keyset ipfix_kset = {
#define port_ce(pi) ulogd_config_int(pi, PORT_CE);
#define proto_ce(pi) ulogd_config_str(pi, PROTO_CE);
+
struct ipfix_priv {
+ int fd;
+ struct ipfix_templ_hdr *templ;
};
static int