summaryrefslogtreecommitdiffstats
path: root/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api
diff options
context:
space:
mode:
Diffstat (limited to 'Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api')
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/Ipfix.java27
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixCollectorListener.java31
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixConnectionHandler.java35
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordReader.java37
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordSpecifier.java31
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultDataRecord.java50
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultTemplateManager.java116
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixEnterpriseNumbers.java79
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixFieldSpecifier.java234
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixHeader.java96
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIe.java48
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeCodec.java90
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeDataTypes.java181
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeSemantics.java59
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeStatus.java38
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeUnits.java68
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixMessage.java223
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixOptionsTemplateRecord.java158
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixRecord.java19
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSet.java229
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetHeader.java108
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetType.java59
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplate.java71
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateForDataReader.java79
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateManager.java102
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateRecord.java129
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecBoolean.java37
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMicroseconds.java48
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMilliseconds.java44
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeNanoseconds.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeSeconds.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat32.java42
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat64.java43
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv4Address.java57
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv6Address.java34
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecMacAddress.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecOctetArray.java48
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned16.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned32.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned64.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned8.java36
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecString.java48
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned16.java56
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned32.java58
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned64.java67
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned8.java43
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/package.html3
-rw-r--r--Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/package.html3
48 files changed, 3280 insertions, 0 deletions
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/Ipfix.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/Ipfix.java
new file mode 100644
index 0000000..b39faa4
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/Ipfix.java
@@ -0,0 +1,27 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ */
+public class Ipfix {
+ public final static short VERSION = 0x000a;
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixCollectorListener.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixCollectorListener.java
new file mode 100644
index 0000000..e5393bd
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixCollectorListener.java
@@ -0,0 +1,31 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+
+/**
+ * IPFIX Message Listener
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixCollectorListener {
+ public void onConnect( IpfixConnectionHandler handler );
+ public void onDisconnect( IpfixConnectionHandler handler );
+ public void onMessage( IpfixConnectionHandler handler, IpfixMessage msg );
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixConnectionHandler.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixConnectionHandler.java
new file mode 100644
index 0000000..e2c754d
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixConnectionHandler.java
@@ -0,0 +1,35 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.net.Socket;
+
+/**
+ * IPFIX Handler
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixConnectionHandler {
+ public boolean isConnected();
+ public Socket getSocket();
+ public Object getAttachment();
+ public void setAttachment(Object obj);
+ public long totalReceivedMessages();
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordReader.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordReader.java
new file mode 100644
index 0000000..33ba396
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordReader.java
@@ -0,0 +1,37 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixDataRecordReader {
+ /**
+ * Reads the next ipfix record and updates setBuffer position accordingly.
+ *
+ * @param setBuffer
+ * @return ipfix record or null if record could not be read.
+ */
+ public Object getRecord( IpfixMessage msg, ByteBuffer setBuffer );
+ public IpfixTemplateForDataReader getTemplate();
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordSpecifier.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordSpecifier.java
new file mode 100644
index 0000000..99d2373
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDataRecordSpecifier.java
@@ -0,0 +1,31 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+/**
+ * <p> Can be an {@link IpfixOptionsTemplateRecord} or
+ * an {@link IpfixTemplateRecord }. </p>
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixDataRecordSpecifier {
+
+ public int getTemplateId();
+ public int getDataRecordLength();
+ public boolean isVariableLength();
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultDataRecord.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultDataRecord.java
new file mode 100644
index 0000000..3c3e4a7
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultDataRecord.java
@@ -0,0 +1,50 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.util.HexDump;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixDefaultDataRecord {
+ private final ByteBuffer byteBuffer;
+ /**
+ * Slice the set buffer from the current position len bytes long.
+ *
+ * @param setBuffer Origin byte buffer.
+ * @param len Size of record in octets.
+ */
+ public IpfixDefaultDataRecord(ByteBuffer setBuffer, int len ) {
+ this.byteBuffer = setBuffer.slice();
+ this.byteBuffer.limit(len);
+ setBuffer.position(setBuffer.position()+len );
+ }
+ @Override
+ public String toString() {
+ byte [] bb = new byte[byteBuffer.remaining()];
+ byteBuffer.get(bb);
+ String hexdump = HexDump.toHexString( bb, byteBuffer.limit()*2 );
+ return String.format("drec:{ len:%d hex: %s }", byteBuffer.limit(),hexdump);
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultTemplateManager.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultTemplateManager.java
new file mode 100644
index 0000000..cc51f7c
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixDefaultTemplateManager.java
@@ -0,0 +1,116 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * IPFIX Template Manager
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixDefaultTemplateManager implements IpfixTemplateManager {
+ // -- sys --
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
+ protected final Statistics stats = new Statistics();
+ // -- management --
+ private final Map<String, IpfixIe> mapFieldIe = new ConcurrentHashMap<String, IpfixIe>();
+ private final Map<Integer, IpfixDataRecordReader> mapSetIdRecordReader = new ConcurrentHashMap<Integer, IpfixDataRecordReader>();
+ private final Map<String, IpfixDataRecordReader> mapTemplateUidRecordReader = new ConcurrentHashMap<String, IpfixDataRecordReader>();
+ private final Map<Integer, IpfixDataRecordSpecifier> mapSetId2DataRecordSpecifier = new ConcurrentHashMap<Integer, IpfixDataRecordSpecifier>();
+
+ // TODO unify this
+ @Override
+ public void registerOptionsTemplateRecord(
+ IpfixOptionsTemplateRecord ipfixOptionsTemplateRecord) {
+ stats.numberOfOptionTemplateRecords++;
+ int setId = ipfixOptionsTemplateRecord.getTemplateId();
+ IpfixDataRecordReader reader = mapTemplateUidRecordReader
+ .get(ipfixOptionsTemplateRecord.getUid());
+ mapSetId2DataRecordSpecifier.put(setId, ipfixOptionsTemplateRecord);
+ if (reader == null) {
+ logger.debug(
+ "No IPFIX (options) data record reader was found for {}.",
+ ipfixOptionsTemplateRecord.getUid());
+ return;
+ }
+ logger.debug(
+ "registering ipfix options template record: {}, reader:{}",
+ ipfixOptionsTemplateRecord, reader);
+ mapSetIdRecordReader.put(setId, reader);
+ }
+
+ @Override
+ public IpfixDataRecordSpecifier getDataRecordSpecifier(int setId) {
+ return mapSetId2DataRecordSpecifier.get(setId);
+ }
+
+ @Override
+ public IpfixDataRecordReader getDataRecordReader(int setId) {
+ IpfixDataRecordReader reader = mapSetIdRecordReader.get(setId);
+ // logger.debug("Getting data record reader:{} setId:{}",reader,setId);
+ return reader;
+ }
+
+ @Override
+ public IpfixIe getInformationElement(IpfixFieldSpecifier fieldSpecifier) {
+ return mapFieldIe.get(fieldSpecifier.toString());
+ }
+
+ @Override
+ public Statistics getStatistics() {
+ return stats;
+ }
+
+ @Override
+ public void registerDataRecordReader(IpfixDataRecordReader reader) {
+ logger.debug("registering data record reader: {}", reader.getTemplate()
+ .getUid());
+ for (IpfixIe ie : reader.getTemplate().getInformationElements()) {
+ logger.debug(" +-registering ie: {}, {}", ie.getName(), ie
+ .getFieldSpecifier());
+ mapFieldIe.put(ie.getFieldSpecifier().toString(), ie);
+ }
+ mapTemplateUidRecordReader.put(reader.getTemplate().getUid(), reader);
+
+ }
+
+ @Override
+ public void registerTemplateRecord(IpfixTemplateRecord ipfixTemplateRecord) {
+ stats.numberOfTemplateRecords++;
+ IpfixDataRecordReader reader = mapTemplateUidRecordReader
+ .get(ipfixTemplateRecord.getUid());
+ int setId = ipfixTemplateRecord.getTemplateId();
+ mapSetId2DataRecordSpecifier.put(setId, ipfixTemplateRecord);
+ if (reader == null) {
+ logger.debug("No IPFIX data record reader was found for {}.",
+ ipfixTemplateRecord.getUid());
+ return;
+ }
+ logger.debug("registering ipfix template record: {}, reader:{}",
+ ipfixTemplateRecord, reader);
+ mapSetIdRecordReader.put(setId, reader);
+
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixEnterpriseNumbers.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixEnterpriseNumbers.java
new file mode 100644
index 0000000..7ffa0b1
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixEnterpriseNumbers.java
@@ -0,0 +1,79 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+/**
+ * TODO auto generate from
+ * http://www.iana.org/assignments/enterprise-numbers
+
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public enum IpfixEnterpriseNumbers {
+ /**
+ * <pre>
+ * { Decimal:12325,
+ * Organization:"Fraunhofer FOKUS",
+ * Contact:"Hartmut Brandt",
+ * Email:"brandt&fokus.gmd.de" }
+ * </pre>
+ */
+ FRAUNHOFER_FOKUS(12325, "Fraunhofer FOKUS", "Hartmut Brandt",
+ "brandt&fokus.gmd.de"),
+ /**
+ * <pre>
+ * { Decimal:29305,
+ * Organization:"IPFIX Reverse Information Element Private Enterprise",
+ * Contact:"RFC5103 Authors",
+ * Email:"ipfix-biflow&cert.org" }
+ * </pre>
+ */
+ IPFIX_REVERSE_INFORMATION_ELEMENT_PRIVATE_ENTERPRISE(29305,
+ "IPFIX Reverse Information Element Private Enterprise",
+ "RFC5103 Authors", "ipfix-biflow&cert.org");
+ private final int decimal;
+ private final String organization;
+ private final String contact;
+ private final String email;
+
+ private IpfixEnterpriseNumbers(int decimal, String organization,
+ String contact, String email) {
+ this.decimal = decimal;
+ this.organization = organization;
+ this.contact = contact;
+ this.email = email;
+ }
+
+ public int getDecimal() {
+ return decimal;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
+
+ public String getContact() {
+ return contact;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixFieldSpecifier.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixFieldSpecifier.java
new file mode 100644
index 0000000..ee7f258
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixFieldSpecifier.java
@@ -0,0 +1,234 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+ package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ * <pre>
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |E| Information Element ident. | Field Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Enterprise Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * </pre>
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixFieldSpecifier implements Comparable<IpfixFieldSpecifier> {
+ // -- sys --
+ private final static Logger logger = LoggerFactory
+ .getLogger(IpfixFieldSpecifier.class);
+ // -- constants --
+ private static final int IDX_E_ID = 0;
+ private static final int IDX_FIELD_LENGTH = 2;
+ private static final int IDX_ENTERPRISE_NUMBER = 4;
+ private static final int LENGTH_IN_OCTETS = 4;
+ private static final int LENGTH_ENTERPRISE_IN_OCTETS = 8;
+ private static final int RFC_NON_ENTERPRISE=0;
+ // -- model --
+ private final ByteBuffer bytebuffer;
+ private IpfixIe informationElement;
+ private boolean isScope = false;
+
+ @Override
+ public String toString() {
+ if (informationElement != null) {
+ return String.format("%s", informationElement.getName());
+ }
+ return getUid();
+ }
+
+ public String getUid() {
+ String scope = this.isScope?", scope:true":"";
+ return String.format("{id:%d, len:%d, en:%d%s}", getId(),
+ getIeLength(), getEnterpriseNumber(), scope);
+ }
+ /**
+ * Interpret next bytes as an ipfix field specifier. The record buffer position
+ * is incremented accordingly.
+ *
+ * @param recordBuffer
+ */
+ public IpfixFieldSpecifier(ByteBuffer recordBuffer) {
+ this.bytebuffer = recordBuffer.slice();
+ if (isEnterprise()) {
+ recordBuffer.position(recordBuffer.position()
+ + LENGTH_ENTERPRISE_IN_OCTETS);
+ this.bytebuffer.limit(LENGTH_ENTERPRISE_IN_OCTETS);
+ } else {
+ recordBuffer.position(recordBuffer.position() + LENGTH_IN_OCTETS);
+ this.bytebuffer.limit(LENGTH_IN_OCTETS);
+ }
+ }
+ /**
+ * Creates an IETF information element.
+ */
+ public IpfixFieldSpecifier() {
+ this(RFC_NON_ENTERPRISE);
+ }
+ /**
+ * Creates an IETF or Enterprise information element.
+ *
+ * @param isEnterprise
+ */
+ public IpfixFieldSpecifier(long enterpriseNumber) {
+
+ if (enterpriseNumber!=0) {
+ this.bytebuffer = ByteBuffer.allocate(LENGTH_ENTERPRISE_IN_OCTETS);
+ setEnterpriseNumber(enterpriseNumber);
+ } else {
+ this.bytebuffer = ByteBuffer.allocate(LENGTH_IN_OCTETS);
+ }
+ }
+
+ public short getId() {
+ return (short) (0x7FFF & bytebuffer.getShort(IDX_E_ID));
+ }
+
+ public IpfixFieldSpecifier setId(int id) {
+ bytebuffer.putShort(IDX_E_ID,
+ (short) (id | (bytebuffer.getShort(IDX_E_ID) & 0x8000)));
+ return this;
+ }
+
+ public long getEnterpriseNumber() {
+ if (isEnterprise() && bytebuffer.limit() >= LENGTH_ENTERPRISE_IN_OCTETS) {
+ return ByteBufferUtil.getUnsignedInt(bytebuffer,
+ IDX_ENTERPRISE_NUMBER);
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * Set enterprise number. Enterprise bit is also set if en != 0.
+ *
+ * @param en
+ * @return itself
+ */
+ public IpfixFieldSpecifier setEnterpriseNumber(long en) {
+ if (bytebuffer.limit() >= LENGTH_ENTERPRISE_IN_OCTETS) {
+ ByteBufferUtil.putUnsignedInt(bytebuffer, IDX_ENTERPRISE_NUMBER , en);
+ setEnterprise(en != 0);
+ } else {
+ logger
+ .warn("Trying to set enterprise number on a too small field specifier buffer.");
+ }
+ return this;
+ }
+
+ /**
+ * <p> The length of the corresponding encoded Information Element, in octets.
+ * Refer to [RFC5102]. The field length may be smaller than the definition
+ * in [RFC5102] if the reduced size encoding is used (see Section 6.2). The
+ * value 65535 is reserved for variable- length Information Elements (see
+ * Section 7).</p>
+ *
+ * @return length in octets
+ */
+ public int getIeLength() {
+ return ByteBufferUtil.getUnsignedShort(bytebuffer, IDX_FIELD_LENGTH);
+ }
+
+ /**
+ *
+ * @return Length in octets required to store this field specifier, i.e. 4
+ * (standard) or 8 (enterprise) octets.
+ */
+ public int getFieldSpecifierLength() {
+ return isEnterprise() ? LENGTH_ENTERPRISE_IN_OCTETS : LENGTH_IN_OCTETS;
+ }
+
+ public IpfixFieldSpecifier setFieldLength(int fieldLength) {
+ ByteBufferUtil
+ .putUnsignedShort(bytebuffer, IDX_FIELD_LENGTH, fieldLength);
+ return this;
+ }
+
+ public boolean isEnterprise() {
+ return (bytebuffer.getShort(IDX_E_ID) & 0x8000) > 0;
+ }
+
+ public IpfixFieldSpecifier setEnterprise(boolean isEnterprise) {
+ if (isEnterprise) {
+ bytebuffer.putShort(IDX_E_ID, (short) (bytebuffer.getShort(IDX_E_ID) | 0x8000));
+ } else {
+ bytebuffer.putShort(IDX_E_ID, (short) (bytebuffer.getShort(IDX_E_ID) & 0x7FFF));
+ }
+ return this;
+ }
+
+ /**
+ * Get underlying byte buffer
+ *
+ * @return
+ */
+ public ByteBuffer getBytebuffer() {
+ return bytebuffer;
+ }
+
+ @Override
+ public int hashCode() {
+ return bytebuffer.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof IpfixFieldSpecifier) {
+ IpfixFieldSpecifier that = (IpfixFieldSpecifier) obj;
+ return bytebuffer.equals(that.getBytebuffer());
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public int compareTo(IpfixFieldSpecifier that) {
+ return bytebuffer.compareTo(that.getBytebuffer());
+ }
+
+ public IpfixIe getInformationElement() {
+ return informationElement;
+ }
+
+ public void setInformationElement(IpfixIe informationElement) {
+ this.informationElement = informationElement;
+ }
+
+ public boolean isScope() {
+ return isScope;
+ }
+
+ public IpfixFieldSpecifier setScope(boolean isScope) {
+ this.isScope = isScope;
+ return this;
+ }
+
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixHeader.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixHeader.java
new file mode 100644
index 0000000..ba988ee
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixHeader.java
@@ -0,0 +1,96 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ *
+ * <pre>
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Version Number | Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Export Time |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Sequence Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Observation Domain ID |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * </pre>
+ *
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixHeader {
+ // private final static Logger logger =
+ // LoggerFactory.getLogger(IpfixHeader.class);
+ // -- constants --
+ public static final int IDX_VERSION = 0;
+ public static final int IDX_LENGTH = 2;
+ public static final int IDX_EXPORT_TIME = 4;
+ public static final int IDX_SEQUENCE_NUMBER = 8;
+ public static final int IDX_OBSERVATION_DOMAIN_ID = 12;
+
+ /**
+ * IPFIX header size in octets
+ */
+ public static final int SIZE_IN_OCTETS = 16;
+
+ public static int getVersion(ByteBuffer byteBuffer ) {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, IDX_VERSION);
+ }
+ /**
+ * Get IPFIX message length from position, buffer state won't be changed.
+ *
+ * @param byteBuffer
+ * @param pos
+ * @return ipfix message length from reference message starting position
+ */
+ public static int getLength(ByteBuffer byteBuffer, int pos ) {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, pos+IDX_LENGTH);
+ }
+
+ public static int getLength(ByteBuffer byteBuffer ) {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, IDX_LENGTH);
+ }
+
+ public static long getExportTime(ByteBuffer byteBuffer) {
+ return ByteBufferUtil.getUnsignedInt(byteBuffer, IDX_EXPORT_TIME);
+
+ }
+ public static long getSequenceNumber(ByteBuffer byteBuffer) {
+ return ByteBufferUtil.getUnsignedInt(byteBuffer, IDX_SEQUENCE_NUMBER);
+
+ }
+ public static long getObservationDomainID(ByteBuffer byteBuffer) {
+ return ByteBufferUtil.getUnsignedInt(byteBuffer,
+ IDX_OBSERVATION_DOMAIN_ID);
+ }
+ public static String toString( ByteBuffer byteBuffer ) {
+ return String.format("hdr:{v:%d, len:%d, et:%d, sn:%d, oid:%d}",
+ getVersion(byteBuffer), getLength(byteBuffer), getExportTime(byteBuffer),
+ getSequenceNumber(byteBuffer), getObservationDomainID(byteBuffer));
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIe.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIe.java
new file mode 100644
index 0000000..4adb08b
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIe.java
@@ -0,0 +1,48 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixIe {
+ /**
+ * Value reserved for variable-length Information Elements.
+ */
+ public int VARIABLE_LENGTH = 65535;
+ public String getName();
+ public IpfixIeDataTypes getDataType();
+ public IpfixIeSemantics getSemantics();
+ public IpfixIeStatus getStatus();
+ public IpfixIeUnits getUnits();
+ public IpfixFieldSpecifier getFieldSpecifier();
+
+ /**
+ * Number of octets used for encoding this IPFIX IE.
+ * @return length or {@link IpfixIe#VARIABLE_LENGTH}
+ */
+ public int getLength();
+
+ public static class Util{
+ public static String toString(IpfixIe ie) {
+ return String.format("%s:%d", ie.getName(),ie.getLength());
+ }
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeCodec.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeCodec.java
new file mode 100644
index 0000000..380e847
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeCodec.java
@@ -0,0 +1,90 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixIeCodec {
+ public static final Logger logger = LoggerFactory.getLogger(VariableLength.class);
+
+ public IpfixIeDataTypes getDataType();
+
+ /**
+ * Deals with variable length Information Elements. There are two cases, as
+ * shown in the figures below. <h3>1. Length < 255 octets</h3>
+ *
+ * <pre>
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Length (< 255)| Information Element |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | ... continuing as needed |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * Figure R: Variable-Length Information Element (length < 255 octets)
+ *
+ * </pre>
+ *
+ * <h3>2. Length > 255</h3>
+ *
+ * <pre>
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | 255 | Length (0 to 65535) | IE |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | ... continuing as needed |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * </pre>
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+ public static class VariableLength {
+
+ /**
+ * Reads variable length information elements.
+ *
+ * @param setBuffer
+ * @return
+ */
+ public static ByteBuffer getByteBuffer(ByteBuffer setBuffer) {
+ int len = ByteBufferUtil.getUnsignedByte(setBuffer, setBuffer.position());
+ setBuffer.position(setBuffer.position()+1);
+ if( len == 0xff ){
+ len = ByteBufferUtil.getUnsignedShort(setBuffer, setBuffer.position());
+ setBuffer.position(setBuffer.position()+2);
+
+ }
+ return ByteBufferUtil.sliceAndSkip(setBuffer, len);
+ }
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeDataTypes.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeDataTypes.java
new file mode 100644
index 0000000..b7d24a8
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeDataTypes.java
@@ -0,0 +1,181 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+/**
+ * <p>
+ * References
+ * <ul>
+ * <li><a href="http://www.iana.org/go/rfc5610">RFC 5102 Exporting Type
+ * Information for IP Flow Information Export (IPFIX) Information Elements</a></li>
+ * <li><a href="http://tools.ietf.org/html/rfc5102">RFC 5102 - Information Model
+ * for IP Flow Information Export </a></li>
+ * </ul>
+ * </p>
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public enum IpfixIeDataTypes {
+ /**
+ * The type "octetArray" represents a finite-length string of octets.
+ */
+ OCTETARRAY(0, IpfixIe.VARIABLE_LENGTH),
+ /**
+ * The type "unsigned8" represents a non-negative integer value in the range
+ * of 0 to 255.
+ */
+ UNSIGNED8(1, 1),
+ /**
+ * The type "unsigned16" represents a non-negative integer value in the
+ * range of 0 to 65535.
+ */
+ UNSIGNED16(2, 2),
+ /**
+ * The type "unsigned32" represents a non-negative integer value in the
+ * range of 0 to 4294967295.
+ */
+ UNSIGNED32(3, 4),
+ /**
+ * The type "unsigned64" represents a non-negative integer value in the
+ * range of 0 to 18446744073709551615.
+ */
+ UNSIGNED64(4, 8),
+ /**
+ * The type "signed8" represents an integer value in the range of -128 to
+ * 127.
+ */
+ SIGNED8(5, 1),
+ /**
+ * The type "signed16" represents an integer value in the range of -32768 to
+ * 32767.
+ */
+ SIGNED16(6, 2),
+ /**
+ * The type "signed32" represents an integer value in the range of
+ * -2147483648 to 2147483647.
+ */
+ SIGNED32(7, 4),
+ /**
+ * The type "signed64" represents an integer value in the range of
+ * -9223372036854775808 to 9223372036854775807.
+ */
+ SIGNED64(8, 8),
+ /**
+ * The type "float32" corresponds to an IEEE single-precision 32-bit
+ * floating point type as defined in [IEEE.754.1985].
+ */
+ FLOAT32(9, 4),
+ /**
+ * The type "float64" corresponds to an IEEE double-precision 64-bit
+ * floating point type as defined in [IEEE.754.1985].
+ */
+ FLOAT64(10, 8),
+ /**
+ * The type "boolean" represents a binary value. The only allowed values are
+ * "true" and "false".
+ */
+ BOOLEAN(11, 1),
+ /**
+ * The type "macAddress" represents a string of 6 octets.
+ */
+ MACADDRESS(12, 6),
+ /**
+ * The type "string" represents a finite-length string of valid characters
+ * from the Unicode character encoding set [ISO.10646- 1.1993]. Unicode
+ * allows for ASCII [ISO.646.1991] and many other international character
+ * sets to be used.
+ */
+ STRING(13, IpfixIe.VARIABLE_LENGTH),
+ /**
+ * The type "dateTimeSeconds" represents a time value in units of seconds
+ * based on coordinated universal time (UTC). The choice of an epoch, for
+ * example, 00:00 UTC, January 1, 1970, is left to corresponding encoding
+ * specifications for this type, for example, the IPFIX protocol
+ * specification. Leap seconds are excluded. Note that transformation of
+ * values might be required between different encodings if different epoch
+ * values are used.
+ */
+ // TODO check this
+ DATETIMESECONDS(14, IpfixIe.VARIABLE_LENGTH),
+ /**
+ * The type "dateTimeMilliseconds" represents a time value in units of
+ * milliseconds based on coordinated universal time (UTC). The choice of an
+ * epoch, for example, 00:00 UTC, January 1, 1970, is left to corresponding
+ * encoding specifications for this type, for example, the IPFIX protocol
+ * specification. Leap seconds are excluded. Note that transformation of
+ * values might be required between different encodings if different epoch
+ * values are used.
+ */
+ DATETIMEMILLISECONDS(15, IpfixIe.VARIABLE_LENGTH),
+ /**
+ * The type "dateTimeMicroseconds" represents a time value in units of
+ * microseconds based on coordinated universal time (UTC). The choice of an
+ * epoch, for example, 00:00 UTC, January 1, 1970, is left to corresponding
+ * encoding specifications for this type, for example, the IPFIX protocol
+ * specification. Leap seconds are excluded. Note that transformation of
+ * values might be required between different encodings if different epoch
+ * values are used.
+ */
+ DATETIMEMICROSECONDS(16, IpfixIe.VARIABLE_LENGTH),
+ /**
+ * The type "dateTimeNanoseconds" represents a time value in units of
+ * nanoseconds based on coordinated universal time (UTC). The choice of an
+ * epoch, for example, 00:00 UTC, January 1, 1970, is left to corresponding
+ * encoding specifications for this type, for example, the IPFIX protocol
+ * specification. Leap seconds are excluded. Note that transformation of
+ * values might be required between different encodings if different epoch
+ * values are used.
+ */
+ DATETIMENANOSECONDS(17, IpfixIe.VARIABLE_LENGTH),
+ /**
+ * The type "ipv4Address" represents a value of an IPv4 address.
+ */
+ IPV4ADDRESS(18, 4),
+ /**
+ * The type "ipv6Address" represents a value of an IPv6 address.
+ */
+ IPV6ADDRESS(19, 16);
+ private final int encondingValue;
+ private final int defaultLength;
+
+ private IpfixIeDataTypes(int value, int length) {
+ this.encondingValue = value;
+ this.defaultLength = length;
+ }
+
+ /**
+ * Get encoding value.
+ *
+ * @return
+ */
+ public int getEncodingValue() {
+ return encondingValue;
+ }
+
+ /**
+ * Get default length in octets.
+ *
+ * @return Length in octets or {@link IpfixIe#VARIABLE_LENGTH}.
+ */
+ public int getDefaultLength() {
+ return defaultLength;
+ }
+
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeSemantics.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeSemantics.java
new file mode 100644
index 0000000..9cb6792
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeSemantics.java
@@ -0,0 +1,59 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public enum IpfixIeSemantics {
+ DEFAULT(0),
+ QUANTITY(1),
+ TOTALCOUNTER(2),
+ DELTACOUNTER(3),
+ IDENTIFIER(4),
+ FLAGS(5),
+ UNASSIGNED(6);
+
+ private final int value;
+ private static final Logger logger = LoggerFactory.getLogger(IpfixIeSemantics.class);
+
+ IpfixIeSemantics(int value) {
+ this.value = value;
+ }
+
+ public int getValue() {
+ return value;
+ }
+ public static IpfixIeSemantics getFromModelName( String name ){
+ if( name==null){
+ return DEFAULT;
+ }
+ try {
+ return IpfixIeSemantics.valueOf(name.toUpperCase());
+ }catch (Exception e) {
+ logger.debug("No ie semantics matched for \"{}\"",name);
+ return IpfixIeSemantics.DEFAULT;
+ }
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeStatus.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeStatus.java
new file mode 100644
index 0000000..7324b53
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeStatus.java
@@ -0,0 +1,38 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public enum IpfixIeStatus {
+ CURRENT("current"),
+ DEPRECATED("deprecated"),
+ OBSOLETE("obsolete");
+ // TODO review: should we call it stringValue instead?
+ private final String value;
+ IpfixIeStatus( String value){
+ this.value = value;
+ }
+ public String getValue() {
+ return value;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeUnits.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeUnits.java
new file mode 100644
index 0000000..409822a
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixIeUnits.java
@@ -0,0 +1,68 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public enum IpfixIeUnits {
+ NONE(0),
+ BITS(1),
+ OCTETS(2),
+ PACKETS(3),
+ FLOWS(4),
+ SECONDS(5),
+ MILLISECONDS(6),
+ MICROSECONDS(7),
+ NANOSECONDS(8),
+ FOUR_OCTET_WORDS(9),
+ MESSAGES(10),
+ HOPS(11),
+ ENTRIES(12),
+ UNASSIGNED(13);
+ private final static Logger logger = LoggerFactory.getLogger(IpfixIeUnits.class);
+ private final int value;
+ IpfixIeUnits(int value){
+ this.value = value;
+ }
+ public int getValue() {
+ return value;
+ }
+ public static IpfixIeUnits getFromModelName( String name ){
+ if( name==null){
+ return NONE;
+ }
+ try {
+ String upper = name.toUpperCase();
+ if(upper.contentEquals("4-OCTET WORDS")){
+ return FOUR_OCTET_WORDS;
+ }
+ return IpfixIeUnits.valueOf(name.toUpperCase());
+ }catch (Exception e) {
+ logger.debug("No units matched for \"{}\"",name);
+ return IpfixIeUnits.NONE;
+ }
+ }
+
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixMessage.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixMessage.java
new file mode 100644
index 0000000..c8d242f
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixMessage.java
@@ -0,0 +1,223 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.api.IpfixTemplateManager.Statistics;
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public final class IpfixMessage implements Iterable<IpfixSet> {
+ // -- sys --
+ private final static Logger logger = LoggerFactory
+ .getLogger(IpfixMessage.class);
+ // -- model --
+ private ByteBuffer messageBuffer;
+ private short numberOfunknownSets = 0;
+
+ // -- management --
+ private final IpfixTemplateManager templateManager;
+ private final Statistics stats;
+
+ public IpfixMessage(IpfixTemplateManager templateManager,
+ ByteBuffer byteBuffer) {
+ this.templateManager = templateManager;
+ this.stats = templateManager.getStatistics();
+ // slicing
+ this.messageBuffer = ByteBufferUtil.sliceAndSkip(byteBuffer, IpfixHeader.getLength(byteBuffer, byteBuffer.position()));
+// byteBuffer.position(byteBuffer.position()+getLength());
+
+ stats.globalBufferPosition = byteBuffer.position();
+
+ }
+ public void incNumberOfunknownSets(){
+ numberOfunknownSets++;
+ }
+ public short getNumberOfunknownSets() {
+ return numberOfunknownSets;
+ }
+
+ /**
+ * @return a sliced byte buffer of this message. Contents are shared,
+ * position and limit are not.
+ */
+ public ByteBuffer getMessageBuffer() {
+ return messageBuffer.slice();
+ }
+
+ public Iterator<IpfixSet> iterator() {
+ return new Iterator<IpfixSet>() {
+
+ private final ByteBuffer setsBuffer =ByteBufferUtil.skipAndSlice(IpfixHeader.SIZE_IN_OCTETS,messageBuffer);
+ private IpfixSetHeader currentSetHeader;
+ private IpfixSet last = null, next = null;
+
+ public boolean hasNext() {
+ if (next != null) {
+ return true;
+ }
+ if (setsBuffer.hasRemaining()) {
+ try {
+ currentSetHeader = new IpfixSetHeader(setsBuffer);
+ next = new IpfixSet(IpfixMessage.this, templateManager,
+ currentSetHeader, setsBuffer);
+
+ return true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ System.exit(-1);
+ logger.error(e.getMessage());
+ }
+ }
+ return false;
+ }
+
+ public IpfixSet next() {
+ if (next == null && !hasNext()) {
+ throw new NoSuchElementException();
+ }
+ last = next;
+ next = null;
+ return last;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException("Cannot remove sets!");
+ }
+
+ };
+ }
+
+ @Override
+ public String toString() {
+ return String.format("msg:[ %s ]", IpfixHeader.toString(messageBuffer));
+ }
+
+ public long getObservationDomainID() {
+ return IpfixHeader.getObservationDomainID(messageBuffer);
+ }
+
+ public int getVersion() {
+ return IpfixHeader.getVersion(messageBuffer);
+ }
+
+ public int getLength() {
+ return IpfixHeader.getLength(messageBuffer);
+ }
+
+ public long getExportTime() {
+ return IpfixHeader.getExportTime(messageBuffer);
+ }
+
+ public long getSequenceNumber() {
+ return IpfixHeader.getSequenceNumber(messageBuffer);
+ }
+
+ /**
+ * This currently performs the same function as aligned without logging
+ * messages. The intent is to use in IPFIX collector for buffering data in
+ * case not enough message is available for decoding.
+ *
+ * @param byteBuffer
+ * @return whether buffer contains a complete IPFIX message
+ */
+ public static boolean enoughData(ByteBuffer byteBuffer) {
+ if( byteBuffer.remaining() <= IpfixHeader.SIZE_IN_OCTETS ){
+ return false;
+ }
+ // two fingers alignment
+ int pos = byteBuffer.position();
+ int msg1_version = ByteBufferUtil.getUnsignedShort(byteBuffer, pos
+ + IpfixHeader.IDX_VERSION);
+ // first finger
+ if (msg1_version == Ipfix.VERSION) {
+ int msg1_length = ByteBufferUtil.getUnsignedShort(byteBuffer, pos
+ + IpfixHeader.IDX_LENGTH);
+ if (msg1_length == 0) {
+ // message length must not be 0;
+ return false;
+ }
+ int limit = byteBuffer.limit();
+ if (msg1_length > limit) {
+ // message length bigger than available data
+ return false;
+ }
+ if (limit > pos + msg1_length + IpfixHeader.SIZE_IN_OCTETS) {
+ // second finger
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, pos
+ + msg1_length + IpfixHeader.IDX_VERSION) == Ipfix.VERSION;
+ }
+ return true;
+ }
+ return false;
+
+ }
+
+ /**
+ * Align byte buffer containing IPFIX messages. It skips invalid data
+ * positioning the buffer on a valid message. The current implementation
+ * uses two finger alignment.
+ *
+ */
+ public static boolean align(ByteBuffer byteBuffer) {
+ // two fingers alignment
+ if( byteBuffer.remaining() <= IpfixHeader.SIZE_IN_OCTETS ){
+ return false;
+ }
+ int pos = byteBuffer.position();
+ int msg1_version = ByteBufferUtil.getUnsignedShort(byteBuffer, pos
+ + IpfixHeader.IDX_VERSION);
+ // first finger
+ if (msg1_version == Ipfix.VERSION) {
+ int limit = byteBuffer.limit();
+ int msg1_length = ByteBufferUtil.getUnsignedShort(byteBuffer, pos
+ + IpfixHeader.IDX_LENGTH);
+ if (msg1_length == 0) {
+ logger.warn("Strange, message length is 0! I'll skip this "
+ + "and to continue searching for a valid ipfix header.");
+ return false;
+ }
+ if (msg1_length > limit) {
+// logger.debug("Message length ({}) bigger than buffer limit({}), I'll skip this "
+// + "and to continue searching for a valid ipfix header.",msg1_length,limit);
+ return false;
+ }
+ if (limit > pos + msg1_length
+ + IpfixHeader.SIZE_IN_OCTETS) {
+ // second finger
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, pos
+ + msg1_length + IpfixHeader.IDX_VERSION) == Ipfix.VERSION;
+ }
+ return true;
+ }
+
+ return false;
+
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixOptionsTemplateRecord.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixOptionsTemplateRecord.java
new file mode 100644
index 0000000..e91bafc
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixOptionsTemplateRecord.java
@@ -0,0 +1,158 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ * IPFIX Options Template Record.
+ *
+ * <h2>Header</h2>
+ * <pre>
+ *
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Template ID (> 255) | Field Count |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Scope Field Count |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * </pre>
+ *
+ * <h2>Field Specifier </h2>
+ * <pre>
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * |E| Information Element ident. | Field Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Enterprise Number |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * </pre>
+ * <h2> Record Format </h2>
+ * <pre>
+ * +--------------------------------------------------+
+ * | Options Template Record Header |
+ * +--------------------------------------------------+
+ * | Field Specifier |
+ * +--------------------------------------------------+
+ * | Field Specifier |
+ * +--------------------------------------------------+
+ * ...
+ * +--------------------------------------------------+
+ * | Field Specifier |
+ * +--------------------------------------------------+
+ *
+ * </pre>
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixOptionsTemplateRecord implements IpfixDataRecordSpecifier {
+ // -- constants --
+ private static final int IDX_TEMPLATE_ID = 0;
+ private static final int IDX_FIELD_COUNT = 2;
+ private static final int IDX_SCOPE_FIELD_COUNT = 4;
+ private static final int HEADER_SIZE_IN_OCTETS = 6;
+ // -- model --
+ private final ByteBuffer byteBuffer;
+ private final List<IpfixFieldSpecifier> fieldSpecifiers;
+ private final String uid;
+ private final int dataRecordLength;
+ private boolean isVariableLength = false;
+ /**
+ * Reads an IPFIX options template format.
+ *
+ * @param templateManager
+ * @param setBuffer
+ */
+ public IpfixOptionsTemplateRecord(IpfixTemplateManager templateManager,
+ ByteBuffer setBuffer) {
+ // We need to linearly read the templates so the limit of sliced buffer
+ // will encompasses at first the whole set. This is fixed at the end.
+ this.byteBuffer = setBuffer.slice();
+ this.byteBuffer.position(HEADER_SIZE_IN_OCTETS);
+ int fieldCount = getFieldCount();
+ // TODO handle errors (check this value)
+ int scopeThreshold = fieldCount - getScopeFieldCount();
+ this.fieldSpecifiers = new ArrayList<IpfixFieldSpecifier>();
+ StringBuffer uidSbuf = new StringBuffer();
+ int dataRecordLength = 0;
+ for( int i=0; i < fieldCount; i++ ){
+ IpfixFieldSpecifier fs = new IpfixFieldSpecifier(byteBuffer);
+ if( i >= scopeThreshold ){
+ fs.setScope(true);
+ }
+ int ieLength = fs.getIeLength();
+ if (ieLength == IpfixIe.VARIABLE_LENGTH) {
+ this.isVariableLength = true;
+ }
+ uidSbuf.append(fs.getUid());
+ dataRecordLength+=ieLength;
+ this.fieldSpecifiers.add(fs);
+ }
+ this.dataRecordLength = dataRecordLength;
+ this.uid = uidSbuf.toString();
+ int limit = this.byteBuffer.position();
+ this.byteBuffer.limit(limit);
+ setBuffer.position(setBuffer.position()+limit);
+
+ // TODO handle errors
+ templateManager.registerOptionsTemplateRecord(this);
+
+ }
+ @Override
+ public int getTemplateId() {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, IDX_TEMPLATE_ID);
+ }
+
+ public int getFieldCount() {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, IDX_FIELD_COUNT);
+ }
+
+ public int getScopeFieldCount() {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer,
+ IDX_SCOPE_FIELD_COUNT);
+ }
+ @Override
+ public String toString() {
+ return String.format("otrec:{tid:%d, fcnt:%d, sfcnt:%d, len:%d, dlen:%d, flds:%s }",
+ getTemplateId(), getFieldCount(), getScopeFieldCount(),
+ byteBuffer.limit(), isVariableLength ? IpfixIe.VARIABLE_LENGTH:dataRecordLength,
+ fieldSpecifiers );
+ }
+ /**
+ *
+ * @return Length in octets of respective data record.
+ */
+ @Override
+ public int getDataRecordLength() {
+ return dataRecordLength;
+ }
+ @Override
+ public boolean isVariableLength() {
+ return isVariableLength;
+ }
+ public String getUid() {
+ return uid;
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixRecord.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixRecord.java
new file mode 100644
index 0000000..b472217
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixRecord.java
@@ -0,0 +1,19 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSet.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSet.java
new file mode 100644
index 0000000..ab52b59
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSet.java
@@ -0,0 +1,229 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.api.IpfixTemplateManager.Statistics;
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+import de.fhg.fokus.net.ipfix.util.HexDump;
+
+/**
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixSet implements Iterable<Object> {
+ // -- sys --
+ private static final Logger logger = LoggerFactory
+ .getLogger(IpfixSet.class);
+ // -- model --
+ private final IpfixSetHeader header;
+ private ByteBuffer setBuffer;
+ private IpfixSetType type;
+ private final IpfixMessage msg; // won't be used here, just passed through to delegated decoding
+ // -- management --
+ private final IpfixTemplateManager templateManager;
+ private final Statistics stats;
+ private Iterator<Object> iterator = new Iterator<Object>() {
+ @Override
+ public void remove() {
+ }
+
+ @Override
+ public Object next() {
+ throw new NoSuchElementException();
+ }
+
+ @Override
+ public boolean hasNext() {
+ logger.warn("Trying to iterate over an invalid set: {}",
+ IpfixSet.this.toString());
+ return false;
+ }
+ };
+ public IpfixSet(IpfixMessage msg, IpfixTemplateManager templateManager,
+ IpfixSetHeader header, ByteBuffer setsBuffer) {
+ this.msg = msg;
+ this.header = header;
+ this.templateManager = templateManager;
+ this.stats = templateManager.getStatistics();
+ if(this.header.getLength()==0){
+ throw new RuntimeException("Set length is 0! At "+this.stats.globalBufferPosition);
+ }
+
+ this.setBuffer = ByteBufferUtil.sliceAndSkip(setsBuffer, this.header.getLength() -IpfixSetHeader.SIZE_IN_OCTETS);
+ stats.setBufferPosition = setsBuffer.position();
+ //
+ this.type = IpfixSetType.getSetType(this.header.getSetId());
+ // Setting up record iterator
+ switch (type) {
+ // -------------------------------------------------------------------
+ // Reading data records
+ // -------------------------------------------------------------------
+ case DATA:
+ stats.numberOfDataSets++;
+ final int setId = this.header.getSetId();
+ logger.debug("set id: " + setId);
+ final IpfixDataRecordReader recordReader = templateManager
+ .getDataRecordReader(setId);
+ logger.debug("reader: "+recordReader);
+ final IpfixDataRecordSpecifier recordSpecifier = templateManager
+ .getDataRecordSpecifier(setId);
+ logger.debug("record spec: " + recordSpecifier);
+ iterator = new RecordIterator() {
+
+ @Override
+ public boolean hasNext() {
+ if (next != null) {
+ return true;
+ }
+ if (setBuffer.hasRemaining()) {
+ if (recordReader == null) {
+ if( recordSpecifier==null){
+ IpfixSet.this.msg.incNumberOfunknownSets();
+ // Skipping unknown set
+ logger.debug("Got unknown set, did the exporter " +
+ "send all template records? setid: {}, hexdump:{}",
+ setId,
+ HexDump.toHexString(setBuffer.slice()));
+
+ return false;
+ }
+ if ( !recordSpecifier.isVariableLength()) {
+ next = new IpfixDefaultDataRecord(setBuffer,
+ recordSpecifier.getDataRecordLength());
+ } else {
+ logger
+ .debug("Skipping unknown variable length set.");
+ return false;
+ }
+ } else {
+ next = recordReader.getRecord(IpfixSet.this.msg, setBuffer);
+ stats.numberOfDataRecords++;
+ return true;
+ }
+ }
+ return false;
+ }
+ };
+ break;
+ // -------------------------------------------------------------------
+ // Reading template records
+ // -------------------------------------------------------------------
+ case TEMPLATE:
+ stats.numberOfTemplateSets++;
+ iterator = new RecordIterator() {
+
+ @Override
+ public boolean hasNext() {
+ if (next != null) {
+ return true;
+ }
+ if (setBuffer.hasRemaining()) {
+ try {
+ next = new IpfixTemplateRecord(
+ IpfixSet.this.templateManager, setBuffer);
+ return true;
+ } catch (Exception e) {
+ logger.debug(e.getMessage());
+ }
+ }
+ return false;
+ }
+
+ };
+
+ break;
+ // -------------------------------------------------------------------
+ // Reading option template records
+ // -------------------------------------------------------------------
+
+ case OPTIONS_TEMPLATE:
+ stats.numberOfOptionTemplateSets++;
+ iterator = new RecordIterator() {
+ @Override
+ public boolean hasNext() {
+ if (next != null) {
+ return true;
+ }
+ if (setBuffer.hasRemaining()) {
+ try {
+ next = new IpfixOptionsTemplateRecord(
+ IpfixSet.this.templateManager, setBuffer);
+ return true;
+ } catch (Exception e) {
+ logger.debug(e.getMessage());
+ }
+ }
+ return false;
+ }
+ };
+ break;
+ default:
+ break;
+ }
+ }
+
+ public IpfixSetType getType() {
+ return type;
+ }
+
+ @Override
+ public Iterator<Object> iterator() {
+ return iterator;
+ }
+
+ public IpfixSetHeader getHeader() {
+ return header;
+ }
+
+ /**
+ * Generic abstract ipfix record iterator
+ */
+ private static abstract class RecordIterator implements Iterator<Object> {
+ protected Object last = null, next = null;
+
+ @Override
+ public final Object next() {
+ if (next == null && !hasNext()) {
+ throw new NoSuchElementException();
+ }
+ last = next;
+ next = null;
+ return last;
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException(
+ "Cannot remove records from set!");
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s:{id:%d, len:%d}", type.getShortName(), header
+ .getSetId(), header.getLength());
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetHeader.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetHeader.java
new file mode 100644
index 0000000..7950234
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetHeader.java
@@ -0,0 +1,108 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * <pre>
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Set ID | Length |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * </pre>
+ *
+ * @author FhG-FOKUS NETwork Research
+ */
+public class IpfixSetHeader {
+ // -- sys --
+// private final static Logger logger = LoggerFactory
+// .getLogger(IpfixSetHeader.class);
+ // -- constants --
+ private static final int IDX_SETID = 0;
+ private static final int IDX_LENGTH = 2;
+ public static final int SIZE_IN_OCTETS = 4;
+ // -- model --
+ private int setId;
+ private int length;
+
+ /**
+ * Read an IPFIX set header from byte buffer. Byte buffer position is
+ * updated accordingly;
+ *
+ * @param messageBuffer
+ */
+ public IpfixSetHeader(ByteBuffer messageBuffer) {
+ // slicing
+ ByteBuffer bbuf = ByteBufferUtil.sliceAndSkip(messageBuffer, SIZE_IN_OCTETS);
+// messageBuffer.limit(messageBuffer.position() + SIZE_IN_OCTETS);
+// ByteBuffer bbuf = messageBuffer.slice();
+// messageBuffer.position(messageBuffer.limit()).limit(
+// messageBuffer.capacity());
+ // reading
+ this.setId = ByteBufferUtil.getUnsignedShort(bbuf, IDX_SETID);
+ this.length = ByteBufferUtil.getUnsignedShort(bbuf, IDX_LENGTH);
+
+ }
+ /**
+ * <p>
+ * Set ID value identifies the Set. A value of 2 is reserved for the
+ * Template Set. A value of 3 is reserved for the Option Template Set. All
+ * other values from 4 to 255 are reserved for future use. Values above 255
+ * are used for Data Sets. The Set ID values of 0 and 1 are not used for
+ * historical reasons [RFC3954].
+ * </p>
+ *
+ * @return Set id
+ */
+
+ public int getSetId() {
+ return setId;
+ }
+
+ public void setSetId(int setId) {
+ this.setId = setId;
+ }
+
+ /**
+ * <p>
+ * Total length of the Set, in octets, including the Set Header, all
+ * records, and the optional padding. Because an individual Set MAY contain
+ * multiple records, the Length value MUST be used to determine the position
+ * of the next Set.
+ * </p>
+ *
+ * @return total set length in octets
+ */
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("sethdr:{id:%d, len:%d}", setId, length);
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetType.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetType.java
new file mode 100644
index 0000000..44df9ab
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixSetType.java
@@ -0,0 +1,59 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public enum IpfixSetType {
+ INVALID(0,"invalidset"),
+ TEMPLATE(2, "tset"),
+ OPTIONS_TEMPLATE(3, "otset"),
+ DATA(256, "dset");
+ private final int value;
+ private final String shortname;
+ IpfixSetType(int value, String name) {
+ this.value = value;
+ this.shortname = name;
+ }
+ public int getValue() {
+ return value;
+ }
+ public String getShortName() {
+ return shortname;
+ }
+ /**
+ * Return respective set type.
+ *
+ * @param setId
+ * @return
+ */
+ public static IpfixSetType getSetType( int setId ){
+ if( setId >= IpfixSetType.DATA.value){
+ return IpfixSetType.DATA;
+ }
+ if( setId== IpfixSetType.TEMPLATE.value ){
+ return IpfixSetType.TEMPLATE;
+ } else if(setId == IpfixSetType.OPTIONS_TEMPLATE.value) {
+ return IpfixSetType.OPTIONS_TEMPLATE;
+ }
+ return IpfixSetType.INVALID;
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplate.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplate.java
new file mode 100644
index 0000000..e05182b
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplate.java
@@ -0,0 +1,71 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixTemplate {
+ // -- model --
+ private final ByteBuffer bbuf;
+ private final IpfixIe [] ies;
+ private final String uid;
+ /**
+ *
+ * @param ies
+ */
+ public IpfixTemplate(IpfixIe ... ies ) {
+ int capacity =0;
+ this.ies = ies;
+ for( IpfixIe ie: this.ies ){
+ IpfixFieldSpecifier fld = ie.getFieldSpecifier();
+ capacity+=fld.getFieldSpecifierLength();
+ }
+ StringBuffer uidSbuf = new StringBuffer();
+ this.bbuf = ByteBuffer.allocate(capacity);
+ // copying field specifiers to buffer
+ for( IpfixIe ie: this.ies ){
+ IpfixFieldSpecifier fld = ie.getFieldSpecifier();
+ ByteBuffer fldBuf = fld.getBytebuffer();
+ fldBuf.limit(fld.getFieldSpecifierLength());
+ fldBuf.rewind();
+ this.bbuf.put(fldBuf);
+ uidSbuf.append(fld.getUid());
+ }
+ this.uid = uidSbuf.toString();
+
+ }
+ public IpfixIe [] getInformationElements(){
+ return ies;
+ }
+
+ public ByteBuffer getByteBuffer(){
+ return bbuf;
+ }
+ /**
+ * Used to match uid in {@link IpfixTemplateRecord}
+ * @return
+ */
+ public String getUid() {
+ return uid;
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateForDataReader.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateForDataReader.java
new file mode 100644
index 0000000..c3e1e4c
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateForDataReader.java
@@ -0,0 +1,79 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ * FIXME rename-me please
+ *
+ */
+public class IpfixTemplateForDataReader {
+ // -- model --
+ private final ByteBuffer bbuf;
+ private final IpfixIe [] ies;
+ private final String uid;
+ private final int recordSize; // used for slicing record buffers
+ /**
+ *
+ * @param ies
+ */
+ public IpfixTemplateForDataReader(IpfixIe ... ies ) {
+ int capacity =0;
+ this.ies = ies;
+ for( IpfixIe ie: this.ies ){
+ IpfixFieldSpecifier fld = ie.getFieldSpecifier();
+ capacity+=fld.getFieldSpecifierLength();
+ }
+ this.recordSize = capacity;
+ StringBuffer uidSbuf = new StringBuffer();
+ this.bbuf = ByteBuffer.allocate(capacity);
+ // copying field specifiers to buffer
+ for( IpfixIe ie: this.ies ){
+ IpfixFieldSpecifier fld = ie.getFieldSpecifier();
+ ByteBuffer fldBuf = fld.getBytebuffer();
+ fldBuf.limit(fld.getFieldSpecifierLength());
+ fldBuf.rewind();
+ this.bbuf.put(fldBuf);
+ uidSbuf.append(fld.getUid());
+ }
+ this.uid = uidSbuf.toString();
+
+ }
+ public IpfixIe [] getInformationElements(){
+ return ies;
+ }
+
+ public ByteBuffer getByteBuffer(){
+ return bbuf;
+ }
+ /**
+ * Used to match uid in {@link IpfixTemplateRecord}
+ * @return
+ */
+ public String getUid() {
+ return uid;
+ }
+ public int getRecordSize() {
+ return recordSize;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateManager.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateManager.java
new file mode 100644
index 0000000..0bf18cd
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateManager.java
@@ -0,0 +1,102 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+
+/**
+ * Manages IPFIX template state.
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public interface IpfixTemplateManager {
+ public class Statistics {
+ public long numberOfMessages = 0;
+ public long numberOfDataSets = 0;
+ public long numberOfDataRecords = 0;
+ public long numberOfTemplateSets = 0;
+ public long numberOfTemplateRecords = 0;
+ public long numberOfOptionTemplateSets = 0;
+ public long numberOfOptionTemplateRecords = 0;
+ // TODO review this in the context of a collector
+ public long globalBufferPosition = 0;
+ public long invalidBytes = 0;
+ public int setBufferPosition = 0;
+
+ @Override
+ public String toString() {
+ return String
+ .format(
+ "stats:{msgs:%d, data:{nsets:%d, nrecs:%d}, tmpl:{nsets:%d, nrecs:%d}, otmpl:{nsets:%d, nrecs:%d}, pos:{file:%d, set:%d}, invalidbytes:%d}",
+ numberOfMessages, numberOfDataSets,
+ numberOfDataRecords, numberOfTemplateSets,
+ numberOfTemplateRecords,
+ numberOfOptionTemplateSets,
+ numberOfOptionTemplateRecords,
+ globalBufferPosition,
+ setBufferPosition,
+ invalidBytes
+ );
+ }
+ }
+
+ /**
+ * Register template record so that subsequently data records can be
+ * decoded.
+ *
+ * @param ipfixTemplateRecord
+ */
+ public void registerTemplateRecord(IpfixTemplateRecord ipfixTemplateRecord);
+
+ /**
+ * Register option template record so that subsequently records can be
+ * decoded.
+ *
+ * @param ipfixOptionsTemplateRecord
+ */
+ public void registerOptionsTemplateRecord(
+ IpfixOptionsTemplateRecord ipfixOptionsTemplateRecord);
+
+ /**
+ * Data record reader are responsible for interpreting IPFIX data sets.
+ * Information elements are also registered by this call;
+ *
+ * @param reader
+ */
+ public void registerDataRecordReader(IpfixDataRecordReader reader);
+
+ /**
+ *
+ * @param templateId
+ * @return the respective ipfix data record reader or null if setId is
+ * unknown
+ */
+ public IpfixDataRecordReader getDataRecordReader(int setId);
+
+ public IpfixDataRecordSpecifier getDataRecordSpecifier(int setId);
+
+ /**
+ *
+ * @param fieldSpecifier
+ * @return information element
+ */
+ public IpfixIe getInformationElement(IpfixFieldSpecifier fieldSpecifier);
+
+ public Statistics getStatistics();
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateRecord.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateRecord.java
new file mode 100644
index 0000000..0466d55
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/IpfixTemplateRecord.java
@@ -0,0 +1,129 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ * Template Record Header
+ *
+ * <pre>
+ * 0 1 2 3
+ * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ * | Template ID (> 255) | Field Count |
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *
+ * </pre>
+ *
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public final class IpfixTemplateRecord implements IpfixDataRecordSpecifier {
+ // -- sys --
+ // private final static Logger logger =
+ // LoggerFactory.getLogger(IpfixTemplateRecord.class);
+ // -- constants --
+ private static final int IDX_TEMPLATE_ID = 0;
+ private static final int IDX_FIELD_COUNT = 2;
+ private static final int HEADER_SIZE_IN_OCTETS = 4;
+ // -- model --
+ private final List<IpfixFieldSpecifier> fieldSpecifiers;
+ private final String uid;
+ private final ByteBuffer byteBuffer;
+ private final int dataRecordLength;
+ private boolean isVariableLength = false;
+
+ public IpfixTemplateRecord(IpfixTemplateManager templateManager,
+ ByteBuffer setBuffer) {
+ // We need to linearly read the templates so the limit of sliced buffer
+ // will encompasses at first the whole set. This will be fixed at the
+ // end.
+ this.byteBuffer = setBuffer.slice();
+ this.byteBuffer.position(HEADER_SIZE_IN_OCTETS);
+ int fieldCount = getFieldCount();
+
+ this.fieldSpecifiers = new ArrayList<IpfixFieldSpecifier>();
+ StringBuffer uidSbuf = new StringBuffer();
+ int dataRecordLength = 0;
+ for (int i = 0; i < fieldCount; i++) {
+ IpfixFieldSpecifier fs = new IpfixFieldSpecifier(this.byteBuffer);
+ IpfixIe ie = templateManager.getInformationElement(fs);
+ if (ie != null) {
+ fs.setInformationElement(ie);
+ }
+ this.fieldSpecifiers.add(fs);
+ int ieLength = fs.getIeLength();
+ if (ieLength == IpfixIe.VARIABLE_LENGTH) {
+ this.isVariableLength = true;
+ }
+ dataRecordLength += ieLength;
+ uidSbuf.append(fs.getUid());
+ }
+ int limit = this.byteBuffer.position();
+ this.byteBuffer.limit(limit);
+ setBuffer.position(setBuffer.position() + limit);
+ this.dataRecordLength = dataRecordLength;
+ this.uid = uidSbuf.toString();
+ if(templateManager!=null){
+ templateManager.registerTemplateRecord(this);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format(
+ "trec:{tid:%d, fcnt:%d, len=%d, dlen=%s, flds:%s}",
+ getTemplateId(), getFieldCount(), byteBuffer.limit(),
+ isVariableLength ? IpfixIe.VARIABLE_LENGTH : dataRecordLength, fieldSpecifiers);
+ }
+
+ public List<IpfixFieldSpecifier> getFieldSpecifiers() {
+ return fieldSpecifiers;
+ }
+
+ public String getUid() {
+ return uid;
+ }
+
+ @Override
+ public int getTemplateId() {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, IDX_TEMPLATE_ID);
+ }
+
+ public int getFieldCount() {
+ return ByteBufferUtil.getUnsignedShort(byteBuffer, IDX_FIELD_COUNT);
+ }
+
+ /**
+ * @return Length in octets of respective data record.
+ */
+ @Override
+ public int getDataRecordLength() {
+ return dataRecordLength;
+ }
+ @Override
+ public boolean isVariableLength() {
+ return isVariableLength;
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecBoolean.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecBoolean.java
new file mode 100644
index 0000000..50ff420
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecBoolean.java
@@ -0,0 +1,37 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecBoolean implements IpfixIeCodec {
+ // private Logger logger = LoggerFactory.getLogger(getClass());
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.BOOLEAN;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMicroseconds.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMicroseconds.java
new file mode 100644
index 0000000..66e8e63
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMicroseconds.java
@@ -0,0 +1,48 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecDateTimeMicroseconds implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.DATETIMEMILLISECONDS;
+ }
+ public BigInteger getBigInteger(ByteBuffer setBuffer) {
+ // TODO add support to compressed encodings
+ int fieldLength=8;
+ byte[] ba = new byte[fieldLength+1];
+ ba[0]=0;
+ setBuffer.get(ba,1,fieldLength);
+ return new BigInteger(ba);
+ }
+
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMilliseconds.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMilliseconds.java
new file mode 100644
index 0000000..eaecbea
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeMilliseconds.java
@@ -0,0 +1,44 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecDateTimeMilliseconds implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.DATETIMEMICROSECONDS;
+ }
+ public BigInteger getBigInteger(ByteBuffer setBuffer){
+ byte bb [] = new byte[fieldLength];
+ setBuffer.get(bb);
+ return new BigInteger(bb);
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeNanoseconds.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeNanoseconds.java
new file mode 100644
index 0000000..a0fa6cb
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeNanoseconds.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecDateTimeNanoseconds implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.DATETIMENANOSECONDS;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeSeconds.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeSeconds.java
new file mode 100644
index 0000000..b5efeb3
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecDateTimeSeconds.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecDateTimeSeconds implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.DATETIMESECONDS;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat32.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat32.java
new file mode 100644
index 0000000..55ae82f
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat32.java
@@ -0,0 +1,42 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecFloat32 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.FLOAT32;
+ }
+ // TODO review
+ public float getFloat(ByteBuffer setBuffer) {
+ return setBuffer.getFloat();
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat64.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat64.java
new file mode 100644
index 0000000..38da2a8
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecFloat64.java
@@ -0,0 +1,43 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecFloat64 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.FLOAT64;
+ }
+ // TODO review
+ public double getDouble(ByteBuffer setBuffer) {
+ return setBuffer.getDouble();
+ }
+
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv4Address.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv4Address.java
new file mode 100644
index 0000000..0827dd4
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv4Address.java
@@ -0,0 +1,57 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.net.Inet4Address;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecIpv4Address implements IpfixIeCodec {
+ // -- sys --
+ private Logger logger = LoggerFactory.getLogger(getClass());
+ // -- model --
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ public Inet4Address getAddress(ByteBuffer setBuffer) {
+ byte[] ba = new byte[4];
+ setBuffer.get(ba);
+ Inet4Address addr = null;
+ try {
+ addr = (Inet4Address) Inet4Address.getByAddress(ba);
+ } catch (UnknownHostException e) {
+ logger.warn("Invalid IPv4 address.", e.toString());
+ }
+ return addr;
+ }
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.IPV4ADDRESS;
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv6Address.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv6Address.java
new file mode 100644
index 0000000..ed93273
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecIpv6Address.java
@@ -0,0 +1,34 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecIpv6Address implements IpfixIeCodec {
+ protected int fieldLength=getDataType().getDefaultLength();
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.IPV6ADDRESS;
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecMacAddress.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecMacAddress.java
new file mode 100644
index 0000000..d9694bb
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecMacAddress.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecMacAddress implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.MACADDRESS;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecOctetArray.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecOctetArray.java
new file mode 100644
index 0000000..8f01c2d
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecOctetArray.java
@@ -0,0 +1,48 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecOctetArray implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.OCTETARRAY;
+ }
+ public ByteBuffer getByteBuffer( ByteBuffer setBuffer ){
+ return VariableLength.getByteBuffer(setBuffer);
+ }
+ public String getString(ByteBuffer setBuffer, String charset ) throws UnsupportedEncodingException{
+ ByteBuffer bbuf = VariableLength.getByteBuffer(setBuffer);
+ byte[] bytes = new byte[bbuf.remaining()];
+ bbuf.get(bytes);
+ return new String(bytes,charset);
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned16.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned16.java
new file mode 100644
index 0000000..4396822
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned16.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecSigned16 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.SIGNED16;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned32.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned32.java
new file mode 100644
index 0000000..886c486
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned32.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecSigned32 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.SIGNED32;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned64.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned64.java
new file mode 100644
index 0000000..70ff44f
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned64.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecSigned64 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.SIGNED64;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned8.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned8.java
new file mode 100644
index 0000000..12c4b5c
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecSigned8.java
@@ -0,0 +1,36 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecSigned8 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.SIGNED8;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecString.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecString.java
new file mode 100644
index 0000000..0cd0949
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecString.java
@@ -0,0 +1,48 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecString implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.STRING;
+ }
+
+ public ByteBuffer getByteBuffer( ByteBuffer setBuffer ){
+ return VariableLength.getByteBuffer(setBuffer);
+ }
+ public String getString(ByteBuffer setBuffer) throws UnsupportedEncodingException{
+ ByteBuffer bbuf = VariableLength.getByteBuffer(setBuffer);
+ byte[] bytes = new byte[bbuf.remaining()];
+ bbuf.get(bytes);
+ return new String(bytes,"UTF-8");
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned16.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned16.java
new file mode 100644
index 0000000..c85748b
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned16.java
@@ -0,0 +1,56 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecUnsigned16 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+ // -- sys --
+ private static final Logger logger = LoggerFactory
+ .getLogger(IpfixIeCodecUnsigned16.class);
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.UNSIGNED16;
+ }
+ public int getInt(ByteBuffer setBuffer) {
+ if (fieldLength == 2) {
+ return ByteBufferUtil.getUnsignedShort(setBuffer);
+ } else if (fieldLength == 1) {
+ return ByteBufferUtil.getUnsignedByte(setBuffer);
+ }
+ logger.warn("Invalid unsigned16 encoding, returning 0., length:{}",
+ fieldLength);
+ return 0;
+ }
+
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned32.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned32.java
new file mode 100644
index 0000000..ff2aea9
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned32.java
@@ -0,0 +1,58 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecUnsigned32 implements IpfixIeCodec {
+ // -- sys --
+ private static final Logger logger = LoggerFactory
+ .getLogger(IpfixIeCodecUnsigned32.class);
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.UNSIGNED32;
+ }
+
+ public long getLong(ByteBuffer setBuffer) {
+ if (fieldLength == 4) {
+ return ByteBufferUtil.getUnsignedInt(setBuffer);
+ } else if (fieldLength == 2) {
+ return ByteBufferUtil.getUnsignedShort(setBuffer);
+ } else if (fieldLength == 1) {
+ return ByteBufferUtil.getUnsignedByte(setBuffer);
+ }
+ logger.warn("Invalid unsigned32 encoding, returning 0., length:{}",
+ fieldLength);
+ return 0;
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned64.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned64.java
new file mode 100644
index 0000000..dd62997
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned64.java
@@ -0,0 +1,67 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public abstract class IpfixIeCodecUnsigned64 implements IpfixIeCodec {
+ /**
+ * You must set this.
+ */
+ protected int fieldLength;
+ // -- sys --
+ private static final Logger logger = LoggerFactory
+ .getLogger(IpfixIeCodecUnsigned64.class);
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.UNSIGNED64;
+ }
+ public long getLong(ByteBuffer setBuffer) {
+ if (fieldLength == 4) {
+ return ByteBufferUtil.getUnsignedInt(setBuffer);
+ } else if (fieldLength == 2) {
+ return ByteBufferUtil.getUnsignedShort(setBuffer);
+ } else if (fieldLength == 1) {
+ return ByteBufferUtil.getUnsignedByte(setBuffer);
+ }
+ logger.warn("Invalid unsigned64 encoding, returning 0., length:{}",
+ fieldLength);
+ return 0;
+ }
+
+ public BigInteger getBigInteger(ByteBuffer setBuffer) {
+ byte[] ba = new byte[fieldLength+1];
+ ba[0]=0;
+ setBuffer.get(ba,1,fieldLength);
+ return new BigInteger(ba);
+ }
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned8.java b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned8.java
new file mode 100644
index 0000000..2e75a74
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/IpfixIeCodecUnsigned8.java
@@ -0,0 +1,43 @@
+/**
+*
+* Copyright (c) 2012, NOVI Consortium, European FP7 NOVI Project
+* Copyright according to BSD License
+* For full text of the license see: ./novi/Software/Monitoring/MonitoringTool/PacketTracking/license.txt
+*
+* @author <a href="mailto:ramon.masek@fokus.fraunhofer.de">Ramon Masek</a>, Fraunhofer FOKUS
+* @author <a href="mailto:c.henke@tu-berlin.de">Christian Henke</a>, Technical University Berlin
+* @author <a href="mailto:carsten.schmoll@fokus.fraunhofer.de">Carsten Schmoll</a>, Fraunhofer FOKUS
+* @author <a href="mailto:Julian.Vetter@campus.tu-berlin.de">Julian Vetter</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Jens Krenzin</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Michael Gehring</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Tacio Grespan Santos</a>, Fraunhofer FOKUS
+* @author <a href="mailto:">Fabian Wolff</a>, Fraunhofer FOKUS
+*
+*/
+
+package de.fhg.fokus.net.ipfix.api.codec;
+
+import java.nio.ByteBuffer;
+
+import de.fhg.fokus.net.ipfix.api.IpfixIeCodec;
+import de.fhg.fokus.net.ipfix.api.IpfixIeDataTypes;
+import de.fhg.fokus.net.ipfix.util.ByteBufferUtil;
+
+/**
+ *
+ * @author FhG-FOKUS NETwork Research
+ *
+ */
+public class IpfixIeCodecUnsigned8 implements IpfixIeCodec {
+ protected int fieldLength = getDataType().getDefaultLength();
+
+ @Override
+ public IpfixIeDataTypes getDataType() {
+ return IpfixIeDataTypes.UNSIGNED8;
+ }
+
+ public short getShort( ByteBuffer setBuffer){
+ return ByteBufferUtil.getUnsignedByte(setBuffer);
+ }
+
+}
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/package.html b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/package.html
new file mode 100644
index 0000000..92eb4fa
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/codec/package.html
@@ -0,0 +1,3 @@
+<html><head></head><body>
+IPFIX API (coders and decoders)
+</body></html> \ No newline at end of file
diff --git a/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/package.html b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/package.html
new file mode 100644
index 0000000..45df62e
--- /dev/null
+++ b/Monitoring/MonitoringTool/PacketTracking/ipfix4java/ipfix-api/src/main/java/de/fhg/fokus/net/ipfix/api/package.html
@@ -0,0 +1,3 @@
+<html><head></head><body>
+IPFIX API
+</body></html> \ No newline at end of file