Added cubby-holes for new projects.
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/annotations/Immutable.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/annotations/Immutable.java
new file mode 100644
index 0000000..5de2171
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/annotations/Immutable.java
@@ -0,0 +1,13 @@
+package org.projectfloodlight.openflow.annotations;
+
+/**
+ * This annotation marks a class that is considered externally immutable. I.e.,
+ * the externally visible state of the class will not change after its
+ * construction. Such a class can be freely shared between threads and does not
+ * require defensive copying (don't call clone).
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+public @interface Immutable {
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/NonExistantMessage.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/NonExistantMessage.java
new file mode 100644
index 0000000..e5192fd
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/NonExistantMessage.java
@@ -0,0 +1,30 @@
+package org.projectfloodlight.openflow.exceptions;
+
+/**
+ * Error: someone asked to create an OFMessage with wireformat type and version,
+ * but that doesn't exist
+ *
+ * @author capveg
+ */
+public class NonExistantMessage extends Exception {
+
+    private static final long serialVersionUID = 1L;
+    byte type;
+    byte version;
+
+    /**
+     * Error: someone asked to create an OFMessage with wireformat type and
+     * version, but that doesn't exist
+     *
+     * @param type
+     *            the wire format
+     * @param version
+     *            the OpenFlow wireformat version number, e.g. 1 == v1.1, 2 =
+     *            v1.2, etc.
+     */
+    public NonExistantMessage(final byte type, final byte version) {
+        this.type = type;
+        this.version = version;
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFParseError.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFParseError.java
new file mode 100644
index 0000000..658dce7
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFParseError.java
@@ -0,0 +1,22 @@
+package org.projectfloodlight.openflow.exceptions;
+
+public class OFParseError extends Exception {
+    private static final long serialVersionUID = 1L;
+
+    public OFParseError() {
+        super();
+    }
+
+    public OFParseError(final String message, final Throwable cause) {
+        super(message, cause);
+    }
+
+    public OFParseError(final String message) {
+        super(message);
+    }
+
+    public OFParseError(final Throwable cause) {
+        super(cause);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFShortRead.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFShortRead.java
new file mode 100644
index 0000000..c68a678
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFShortRead.java
@@ -0,0 +1,6 @@
+package org.projectfloodlight.openflow.exceptions;
+
+public class OFShortRead extends Exception {
+    private static final long serialVersionUID = 1L;
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFShortWrite.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFShortWrite.java
new file mode 100644
index 0000000..4f99118
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFShortWrite.java
@@ -0,0 +1,7 @@
+package org.projectfloodlight.openflow.exceptions;
+
+public class OFShortWrite extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFUnsupported.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFUnsupported.java
new file mode 100644
index 0000000..fa52c08
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/exceptions/OFUnsupported.java
@@ -0,0 +1,7 @@
+package org.projectfloodlight.openflow.exceptions;
+
+public class OFUnsupported extends Exception {
+
+    private static final long serialVersionUID = 1L;
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFBsnVportQInQT.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFBsnVportQInQT.java
new file mode 100644
index 0000000..ff077ce
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFBsnVportQInQT.java
@@ -0,0 +1,5 @@
+package org.projectfloodlight.openflow.protocol;
+
+public class OFBsnVportQInQT {
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMatchBmap.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMatchBmap.java
new file mode 100644
index 0000000..68ca86d
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMatchBmap.java
@@ -0,0 +1,13 @@
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.types.PrimitiveSinkable;
+
+import com.google.common.hash.PrimitiveSink;
+
+public class OFMatchBmap implements PrimitiveSinkable{
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMessageReader.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMessageReader.java
new file mode 100644
index 0000000..8837867
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMessageReader.java
@@ -0,0 +1,8 @@
+package org.projectfloodlight.openflow.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+public interface OFMessageReader<T> {
+    T readFrom(ChannelBuffer bb) throws OFParseError;
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMessageWriter.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMessageWriter.java
new file mode 100644
index 0000000..bec5634
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFMessageWriter.java
@@ -0,0 +1,8 @@
+package org.projectfloodlight.openflow.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+public interface OFMessageWriter<T> {
+    public void write(ChannelBuffer bb, T message) throws OFParseError;
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFObject.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFObject.java
new file mode 100644
index 0000000..5d37987
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFObject.java
@@ -0,0 +1,11 @@
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.types.PrimitiveSinkable;
+
+
+/**
+ * Base interface of all OpenFlow objects (e.g., messages, actions, stats, etc.)
+ */
+public interface OFObject extends Writeable, PrimitiveSinkable {
+    OFVersion getVersion();
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFObjectFactory.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFObjectFactory.java
new file mode 100644
index 0000000..c5869ef
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFObjectFactory.java
@@ -0,0 +1,7 @@
+package org.projectfloodlight.openflow.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFObjectFactory<T extends OFObject> {
+    T read(ChannelBuffer buffer);
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFOxmList.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFOxmList.java
new file mode 100644
index 0000000..7f66110
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFOxmList.java
@@ -0,0 +1,154 @@
+package org.projectfloodlight.openflow.protocol;
+
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.match.MatchField;
+import org.projectfloodlight.openflow.protocol.match.MatchFields;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxm;
+import org.projectfloodlight.openflow.types.OFValueType;
+import org.projectfloodlight.openflow.types.PrimitiveSinkable;
+import org.projectfloodlight.openflow.util.ChannelUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Objects;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.hash.PrimitiveSink;
+
+public class OFOxmList implements Iterable<OFOxm<?>>, Writeable, PrimitiveSinkable {
+    private static final Logger logger = LoggerFactory.getLogger(OFOxmList.class);
+
+    private final Map<MatchFields, OFOxm<?>> oxmMap;
+
+    public final static OFOxmList EMPTY = new OFOxmList(ImmutableMap.<MatchFields, OFOxm<?>>of());
+
+    private OFOxmList(Map<MatchFields, OFOxm<?>> oxmMap) {
+        this.oxmMap = oxmMap;
+    }
+
+    @SuppressWarnings("unchecked")
+    public <T extends OFValueType<T>> OFOxm<T> get(MatchField<T> matchField) {
+        return (OFOxm<T>) oxmMap.get(matchField.id);
+    }
+
+    public static class Builder {
+        private final Map<MatchFields, OFOxm<?>> oxmMap;
+
+        public Builder() {
+            oxmMap = new EnumMap<MatchFields, OFOxm<?>>(MatchFields.class);
+        }
+
+        public Builder(EnumMap<MatchFields, OFOxm<?>> oxmMap) {
+            this.oxmMap = oxmMap;
+        }
+
+        public <T extends OFValueType<T>> void set(OFOxm<T> oxm) {
+            oxmMap.put(oxm.getMatchField().id, oxm);
+        }
+
+        public <T extends OFValueType<T>> void unset(MatchField<T> matchField) {
+            oxmMap.remove(matchField.id);
+        }
+
+        public OFOxmList build() {
+            return OFOxmList.ofList(oxmMap.values());
+        }
+    }
+
+    @Override
+    public Iterator<OFOxm<?>> iterator() {
+        return oxmMap.values().iterator();
+    }
+
+    public static OFOxmList ofList(Iterable<OFOxm<?>> oxmList) {
+        Map<MatchFields, OFOxm<?>> map = new EnumMap<MatchFields, OFOxm<?>>(
+                MatchFields.class);
+        for (OFOxm<?> o : oxmList) {
+            OFOxm<?> canonical = o.getCanonical();
+
+            if(logger.isDebugEnabled() && !Objects.equal(o, canonical)) {
+                logger.debug("OFOxmList: normalized non-canonical OXM {} to {}", o, canonical);
+            }
+
+            if(canonical != null)
+                map.put(canonical.getMatchField().id, canonical);
+
+        }
+        return new OFOxmList(map);
+    }
+
+    public static OFOxmList of(OFOxm<?>... oxms) {
+        Map<MatchFields, OFOxm<?>> map = new EnumMap<MatchFields, OFOxm<?>>(
+                MatchFields.class);
+        for (OFOxm<?> o : oxms) {
+            OFOxm<?> canonical = o.getCanonical();
+
+            if(logger.isDebugEnabled() && !Objects.equal(o, canonical)) {
+                logger.debug("OFOxmList: normalized non-canonical OXM {} to {}", o, canonical);
+            }
+
+            if(canonical != null)
+                map.put(canonical.getMatchField().id, canonical);
+        }
+        return new OFOxmList(map);
+    }
+
+    public static OFOxmList readFrom(ChannelBuffer bb, int length,
+            OFMessageReader<OFOxm<?>> reader) throws OFParseError {
+        return ofList(ChannelUtils.readList(bb, length, reader));
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        for (OFOxm<?> o : this) {
+            o.writeTo(bb);
+        }
+    }
+
+    public OFOxmList.Builder createBuilder() {
+        return new OFOxmList.Builder(new EnumMap<MatchFields, OFOxm<?>>(oxmMap));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((oxmMap == null) ? 0 : oxmMap.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        OFOxmList other = (OFOxmList) obj;
+        if (oxmMap == null) {
+            if (other.oxmMap != null)
+                return false;
+        } else if (!oxmMap.equals(other.oxmMap))
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return "OFOxmList" + oxmMap;
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        for (OFOxm<?> o : this) {
+            o.putTo(sink);
+        }
+    }
+
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFRequest.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFRequest.java
new file mode 100644
index 0000000..6666943
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFRequest.java
@@ -0,0 +1,5 @@
+package org.projectfloodlight.openflow.protocol;
+
+/** Type safety interface. Enables type safe combinations of requests and replies */
+public interface OFRequest<REPLY extends OFMessage> extends OFMessage {
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFTableFeature.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFTableFeature.java
new file mode 100644
index 0000000..b722228
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFTableFeature.java
@@ -0,0 +1,5 @@
+package org.projectfloodlight.openflow.protocol;
+
+public class OFTableFeature {
+    // FIXME implement
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFVersion.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFVersion.java
new file mode 100644
index 0000000..6f54e5f
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/OFVersion.java
@@ -0,0 +1,16 @@
+package org.projectfloodlight.openflow.protocol;
+
+public enum OFVersion {
+    OF_10(1), OF_11(2), OF_12(3), OF_13(4);
+
+    public final int wireVersion;
+
+    OFVersion(final int wireVersion) {
+        this.wireVersion = wireVersion;
+    }
+
+    public int getWireVersion() {
+        return wireVersion;
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/Writeable.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/Writeable.java
new file mode 100644
index 0000000..31ae9ab
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/Writeable.java
@@ -0,0 +1,7 @@
+package org.projectfloodlight.openflow.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface Writeable {
+    void writeTo(ChannelBuffer bb);
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java
new file mode 100644
index 0000000..2ee2764
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java
@@ -0,0 +1,5 @@
+package org.projectfloodlight.openflow.protocol;
+
+public interface XidGenerator {
+    long nextXid();
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerators.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerators.java
new file mode 100644
index 0000000..4609afa
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerators.java
@@ -0,0 +1,38 @@
+package org.projectfloodlight.openflow.protocol;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public class XidGenerators {
+    private static final XidGenerator GLOBAL_XID_GENERATOR = new StandardXidGenerator();
+
+    public static XidGenerator create() {
+        return new StandardXidGenerator();
+    }
+
+    public static XidGenerator global() {
+        return GLOBAL_XID_GENERATOR;
+    }
+}
+
+class StandardXidGenerator implements XidGenerator {
+
+    private final AtomicLong xidGen = new AtomicLong();
+    long MAX_XID = 0xFFffFFffL;
+
+    @Override
+    public long nextXid() {
+        long xid;
+        do {
+            xid = xidGen.incrementAndGet();
+            if(xid > MAX_XID) {
+                synchronized(this) {
+                    if(xidGen.get() > MAX_XID) {
+                        xidGen.set(0);
+                    }
+                }
+            }
+        } while(xid > MAX_XID);
+        return xid;
+    }
+
+}
\ No newline at end of file
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/Match.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/Match.java
new file mode 100644
index 0000000..0efdcbb
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/Match.java
@@ -0,0 +1,216 @@
+package org.projectfloodlight.openflow.protocol.match;
+
+import org.projectfloodlight.openflow.protocol.OFObject;
+import org.projectfloodlight.openflow.types.Masked;
+import org.projectfloodlight.openflow.types.OFValueType;
+
+/**
+ * Generic interface for version-agnostic immutable Match structure.
+ * The Match structure is defined in the OpenFlow protocol, and it contains information on
+ * the fields to be matched in a specific flow record.
+ * This interface does not assume anything on the fields in the Match structure. If in
+ * some version, the match structure cannot handle a certain field, it may return <code>false</code>
+ * for <code>supports(...)</code> calls, and throw <code>UnsupportedOperationException</code> from all
+ * other methods in such cases.
+ * <br><br>
+ * On wildcards and masks:<br>
+ * This interface defines the following masking notations for fields:
+ * <ul>
+ * <li><b>Exact</b>: field is matched exactly against a single, fixed value (no mask, or mask is all ones).
+ * <li><b>Wildcarded</b>: field is not being matched. It is fully masked (mask=0) and any value of it
+ * will match the flow record having this match.
+ * <li><b>Partially masked</b>: field is matched using a specified mask which is neither 0 nor all ones. Mask can
+ * be either arbitrary or require some specific structure.
+ * </ul>
+ * Implementing classes may or may not support all types of these masking types. They may also support
+ * them in part. For example, OF1.0 supports exact match and (full) wildcarding for all fields, but it
+ * does only supports partial masking for IP source/destination fields, and this partial masking must be
+ * in the CIDR prefix format. Thus, OF1.0 implementation may throw <code>UnsupportedOperationException</code> if given
+ * in <code>setMasked</code> an IP mask of, for example, 255.0.255.0, or if <code>setMasked</code> is called for any field
+ * which is not IP source/destination address.
+ * <br><br>
+ * On prerequisites:<br>
+ * From the OF1.1 spec, page 28, the OF1.0 spec failed to explicitly specify this, but it
+ * is the behavior of OF1.0 switches:
+ * "Protocol-specific fields within ofp_match will be ignored within a single table when
+ * the corresponding protocol is not specified in the match. The MPLS match fields will
+ * be ignored unless the Ethertype is specified as MPLS. Likewise, the IP header and
+ * transport header fields will be ignored unless the Ethertype is specified as either
+ * IPv4 or ARP. The tp_src and tp_dst fields will be ignored unless the network protocol
+ * specified is as TCP, UDP or SCTP. Fields that are ignored don't need to be wildcarded
+ * and should be set to 0."
+ * <br><br>
+ * This interface uses generics to assure type safety in users code. However, implementing classes may have to suppress
+ * 'unchecked cast' warnings while making sure they correctly cast base on their implementation details.
+ *
+ * @author Yotam Harchol (yotam.harchol@bigswitch.com)
+ */
+public interface Match extends OFObject {
+
+    /**
+     * Returns a value for the given field if:
+     * <ul>
+     * <li>Field is supported
+     * <li>Field is not fully wildcarded
+     * <li>Prerequisites are ok
+     * </ul>
+     * If one of the above conditions does not hold, returns null. Value is returned masked if partially wildcarded.
+     *
+     * @param field Match field to retrieve
+     * @return Value of match field (may be masked), or <code>null</code> if field is one of the conditions above does not hold.
+     * @throws UnsupportedOperationException If field is not supported.
+     */
+    public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException;
+
+    /**
+     * Returns the masked value for the given field from this match, along with the mask itself.
+     * Prerequisite: field is partially masked.
+     * If prerequisite is not met, a <code>null</code> is returned.
+     *
+     * @param field Match field to retrieve.
+     * @return Masked value of match field or null if no mask is set.
+     * @throws UnsupportedOperationException If field is not supported.
+     */
+    public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException;
+
+    /**
+     * Returns true if and only if this match object supports the given match field.
+     *
+     * @param field Match field
+     * @return true if field is supported, false otherwise.
+     */
+    public boolean supports(MatchField<?> field);
+
+    /**
+     * Returns true if and only if this match object supports partially bitmasking of the given field.
+     * (note: not all possible values of this bitmask have to be acceptable)
+     *
+     * @param field Match field.
+     * @return true if field can be partially masked, false otherwise.
+     * @throws UnsupportedOperationException If field is not supported.
+     */
+    public boolean supportsMasked(MatchField<?> field) throws UnsupportedOperationException;
+
+    /**
+     * Returns true if and only if this field is currently specified in the match with an exact value and
+     * no mask. I.e., the specified match will only select packets that match the exact value of getValue(field).
+     *
+     * @param field Match field.
+     * @return true if field has a specific exact value, false if not.
+     * @throws UnsupportedOperationException If field is not supported.
+     */
+    public boolean isExact(MatchField<?> field) throws UnsupportedOperationException;
+
+    /**
+     * True if and only if this field is currently logically unspecified in the match, i.e, the
+     * value returned by getValue(f) has no impact on whether a packet will be selected
+     * by the match or not.
+     *
+     * @param field Match field.
+     * @return true if field is fully wildcarded, false if not.
+     * @throws UnsupportedOperationException If field is not supported.
+     */
+    public boolean isFullyWildcarded(MatchField<?> field) throws UnsupportedOperationException;
+
+    /**
+     * True if and only if this field is currently partially specified in the match, i.e, the
+     * match will only select packets that match (p.value & getMask(field)) == getValue(field),
+     * and getMask(field) != 0.
+     *
+     * @param field Match field.
+     * @return true if field is partially masked, false if not.
+     * @throws UnsupportedOperationException If field is not supported.
+     */
+    public boolean isPartiallyMasked(MatchField<?> field) throws UnsupportedOperationException;
+
+    /**
+     * Get an Iterable over the match fields that have been specified for the
+     * match. This includes the match fields that are exact or masked match
+     * (but not fully wildcarded).
+     *
+     * @return
+     */
+    public Iterable<MatchField<?>> getMatchFields();
+
+    /**
+     * Returns a builder to build new instances of this type of match object.
+     * @return Match builder
+     */
+    public Builder createBuilder();
+
+    /**
+     * Builder interface for Match objects.
+     * Builder is used to create new Match objects and it creates the match according to the version it
+     * corresponds to. The builder uses the same notation of wildcards and masks, and can also throw
+     * <code>UnsupportedOperationException</code> if it is asked to create some matching that is not supported in
+     * the version it represents.
+     *
+     * While used, MatchBuilder may not be consistent in terms of field prerequisites. However, user must
+     * solve these before using the generated Match object as these prerequisites should be enforced in the
+     * getters.
+     *
+     * @author Yotam Harchol (yotam.harchol@bigswitch.com)
+     */
+    interface Builder {
+        public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException;
+
+        public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException;
+
+        public boolean supports(MatchField<?> field);
+
+        public boolean supportsMasked(MatchField<?> field) throws UnsupportedOperationException;
+
+        public boolean isExact(MatchField<?> field) throws UnsupportedOperationException;
+
+        public boolean isFullyWildcarded(MatchField<?> field) throws UnsupportedOperationException;
+
+        public boolean isPartiallyMasked(MatchField<?> field) throws UnsupportedOperationException;
+
+        /**
+         * Sets a specific exact value for a field.
+         *
+         * @param field Match field to set.
+         * @param value Value of match field.
+         * @return the Builder instance used.
+         * @throws UnsupportedOperationException If field is not supported.
+         */
+        public <F extends OFValueType<F>> Builder setExact(MatchField<F> field, F value) throws UnsupportedOperationException;
+
+        /**
+         * Sets a masked value for a field.
+         *
+         * @param field Match field to set.
+         * @param value Value of field.
+         * @param mask Mask value.
+         * @return the Builder instance used.
+         * @throws UnsupportedOperationException If field is not supported, if field is supported but does not support masking, or if mask structure is not supported.
+         */
+        public <F extends OFValueType<F>> Builder setMasked(MatchField<F> field, F value, F mask) throws UnsupportedOperationException;
+
+        /**
+         * Sets a masked value for a field.
+         *
+         * @param field Match field to set.
+         * @param valueWithMask Compound Masked object contains the value and the mask.
+         * @return the Builder instance used.
+         * @throws UnsupportedOperationException If field is not supported, if field is supported but does not support masking, or if mask structure is not supported.
+         */
+        public <F extends OFValueType<F>> Builder setMasked(MatchField<F> field, Masked<F> valueWithMask) throws UnsupportedOperationException;
+
+        /**
+         * Unsets any value given for the field and wildcards it so that it matches any value.
+         *
+         * @param field Match field to unset.
+         * @return the Builder instance used.
+         * @throws UnsupportedOperationException If field is not supported.
+         */
+        public <F extends OFValueType<F>> Builder wildcard(MatchField<F> field) throws UnsupportedOperationException;
+
+        /**
+         * Returns the match created by this builder.
+         *
+         * @return a Match object.
+         */
+        public Match build();
+    }
+}
\ No newline at end of file
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
new file mode 100644
index 0000000..78e6075
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -0,0 +1,251 @@
+package org.projectfloodlight.openflow.protocol.match;
+
+import org.projectfloodlight.openflow.types.ArpOpcode;
+import org.projectfloodlight.openflow.types.ClassId;
+import org.projectfloodlight.openflow.types.EthType;
+import org.projectfloodlight.openflow.types.ICMPv4Code;
+import org.projectfloodlight.openflow.types.ICMPv4Type;
+import org.projectfloodlight.openflow.types.IPv4Address;
+import org.projectfloodlight.openflow.types.IPv6Address;
+import org.projectfloodlight.openflow.types.IPv6FlowLabel;
+import org.projectfloodlight.openflow.types.IpDscp;
+import org.projectfloodlight.openflow.types.IpEcn;
+import org.projectfloodlight.openflow.types.IpProtocol;
+import org.projectfloodlight.openflow.types.LagId;
+import org.projectfloodlight.openflow.types.MacAddress;
+import org.projectfloodlight.openflow.types.OFBitMask128;
+import org.projectfloodlight.openflow.types.OFBooleanValue;
+import org.projectfloodlight.openflow.types.OFMetadata;
+import org.projectfloodlight.openflow.types.OFPort;
+import org.projectfloodlight.openflow.types.OFValueType;
+import org.projectfloodlight.openflow.types.OFVlanVidMatch;
+import org.projectfloodlight.openflow.types.TransportPort;
+import org.projectfloodlight.openflow.types.U16;
+import org.projectfloodlight.openflow.types.U64;
+import org.projectfloodlight.openflow.types.U32;
+import org.projectfloodlight.openflow.types.U8;
+import org.projectfloodlight.openflow.types.UDF;
+import org.projectfloodlight.openflow.types.VRF;
+import org.projectfloodlight.openflow.types.VlanPcp;
+
+@SuppressWarnings("unchecked")
+public class MatchField<F extends OFValueType<F>> {
+    private final String name;
+    public final MatchFields id;
+    private final Prerequisite<?>[] prerequisites;
+
+    private MatchField(final String name, final MatchFields id, Prerequisite<?>... prerequisites) {
+        this.name = name;
+        this.id = id;
+        this.prerequisites = prerequisites;
+    }
+
+    public final static MatchField<OFPort> IN_PORT =
+            new MatchField<OFPort>("in_port", MatchFields.IN_PORT);
+
+    public final static MatchField<OFPort> IN_PHY_PORT =
+            new MatchField<OFPort>("in_phy_port", MatchFields.IN_PHY_PORT,
+                    new Prerequisite<OFPort>(MatchField.IN_PORT));
+
+    public final static MatchField<OFMetadata> METADATA =
+            new MatchField<OFMetadata>("metadata", MatchFields.METADATA);
+
+    public final static MatchField<MacAddress> ETH_DST =
+            new MatchField<MacAddress>("eth_dst", MatchFields.ETH_DST);
+
+    public final static MatchField<MacAddress> ETH_SRC =
+            new MatchField<MacAddress>("eth_src", MatchFields.ETH_SRC);
+
+    public final static MatchField<EthType> ETH_TYPE =
+            new MatchField<EthType>("eth_type", MatchFields.ETH_TYPE);
+
+    public final static MatchField<OFVlanVidMatch> VLAN_VID =
+            new MatchField<OFVlanVidMatch>("vlan_vid", MatchFields.VLAN_VID);
+
+    public final static MatchField<VlanPcp> VLAN_PCP =
+            new MatchField<VlanPcp>("vlan_pcp", MatchFields.VLAN_PCP,
+                    new Prerequisite<OFVlanVidMatch>(MatchField.VLAN_VID));
+
+    public final static MatchField<IpDscp> IP_DSCP =
+            new MatchField<IpDscp>("ip_dscp", MatchFields.IP_DSCP,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4, EthType.IPv6));
+
+    public final static MatchField<IpEcn> IP_ECN =
+            new MatchField<IpEcn>("ip_ecn", MatchFields.IP_ECN,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4, EthType.IPv6));
+
+    public final static MatchField<IpProtocol> IP_PROTO =
+            new MatchField<IpProtocol>("ip_proto", MatchFields.IP_PROTO,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4, EthType.IPv6));
+
+    public final static MatchField<IPv4Address> IPV4_SRC =
+            new MatchField<IPv4Address>("ipv4_src", MatchFields.IPV4_SRC,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4));
+
+    public final static MatchField<IPv4Address> IPV4_DST =
+            new MatchField<IPv4Address>("ipv4_dst", MatchFields.IPV4_DST,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv4));
+
+    public final static MatchField<TransportPort> TCP_SRC = new MatchField<TransportPort>(
+            "tcp_src", MatchFields.TCP_SRC,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.TCP));
+
+    public final static MatchField<TransportPort> TCP_DST = new MatchField<TransportPort>(
+            "tcp_dst", MatchFields.TCP_DST,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.TCP));
+
+    public final static MatchField<TransportPort> UDP_SRC = new MatchField<TransportPort>(
+            "udp_src", MatchFields.UDP_SRC,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.UDP));
+
+    public final static MatchField<TransportPort> UDP_DST = new MatchField<TransportPort>(
+            "udp_dst", MatchFields.UDP_DST,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.UDP));
+
+    public final static MatchField<TransportPort> SCTP_SRC = new MatchField<TransportPort>(
+            "sctp_src", MatchFields.SCTP_SRC,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.SCTP));
+
+    public final static MatchField<TransportPort> SCTP_DST = new MatchField<TransportPort>(
+            "sctp_dst", MatchFields.SCTP_DST,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.SCTP));
+
+    public final static MatchField<ICMPv4Type> ICMPV4_TYPE = new MatchField<ICMPv4Type>(
+            "icmpv4_type", MatchFields.ICMPV4_TYPE,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.ICMP));
+
+    public final static MatchField<ICMPv4Code> ICMPV4_CODE = new MatchField<ICMPv4Code>(
+            "icmpv4_code", MatchFields.ICMPV4_CODE,
+            new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.ICMP));
+
+    public final static MatchField<ArpOpcode> ARP_OP = new MatchField<ArpOpcode>(
+            "arp_op", MatchFields.ARP_OP,
+            new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ARP));
+
+    public final static MatchField<IPv4Address> ARP_SPA =
+            new MatchField<IPv4Address>("arp_spa", MatchFields.ARP_SPA,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ARP));
+
+    public final static MatchField<IPv4Address> ARP_TPA =
+            new MatchField<IPv4Address>("arp_tpa", MatchFields.ARP_TPA,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ARP));
+
+    public final static MatchField<MacAddress> ARP_SHA =
+            new MatchField<MacAddress>("arp_sha", MatchFields.ARP_SHA,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ARP));
+
+    public final static MatchField<MacAddress> ARP_THA =
+            new MatchField<MacAddress>("arp_tha", MatchFields.ARP_THA,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.ARP));
+
+    public final static MatchField<IPv6Address> IPV6_SRC =
+            new MatchField<IPv6Address>("ipv6_src", MatchFields.IPV6_SRC,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv6));
+
+    public final static MatchField<IPv6Address> IPV6_DST =
+            new MatchField<IPv6Address>("ipv6_dst", MatchFields.IPV6_DST,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv6));
+
+    public final static MatchField<IPv6FlowLabel> IPV6_FLABEL =
+            new MatchField<IPv6FlowLabel>("ipv6_flabel", MatchFields.IPV6_FLABEL,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.IPv6));
+
+    public final static MatchField<U8> ICMPV6_TYPE =
+            new MatchField<U8>("icmpv6_type", MatchFields.ICMPV6_TYPE,
+                    new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IPv6_ICMP));
+
+    public final static MatchField<U8> ICMPV6_CODE =
+            new MatchField<U8>("icmpv6_code", MatchFields.ICMPV6_CODE,
+                    new Prerequisite<IpProtocol>(MatchField.IP_PROTO, IpProtocol.IPv6_ICMP));
+
+    public final static MatchField<IPv6Address> IPV6_ND_TARGET =
+            new MatchField<IPv6Address>("ipv6_nd_target", MatchFields.IPV6_ND_TARGET,
+                    new Prerequisite<U8>(MatchField.ICMPV6_TYPE, U8.of((short)135), U8.of((short)136)));
+
+    public final static MatchField<MacAddress> IPV6_ND_SLL =
+            new MatchField<MacAddress>("ipv6_nd_sll", MatchFields.IPV6_ND_SLL,
+                    new Prerequisite<U8>(MatchField.ICMPV6_TYPE, U8.of((short)135)));
+
+    public final static MatchField<MacAddress> IPV6_ND_TLL =
+            new MatchField<MacAddress>("ipv6_nd_tll", MatchFields.IPV6_ND_TLL,
+                    new Prerequisite<U8>(MatchField.ICMPV6_TYPE, U8.of((short)136)));
+
+    public final static MatchField<U32> MPLS_LABEL =
+            new MatchField<U32>("mpls_label", MatchFields.MPLS_LABEL,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.MPLS_UNICAST, EthType.MPLS_MULTICAST));
+
+    public final static MatchField<U8> MPLS_TC =
+            new MatchField<U8>("mpls_tc", MatchFields.MPLS_TC,
+                    new Prerequisite<EthType>(MatchField.ETH_TYPE, EthType.MPLS_UNICAST, EthType.MPLS_MULTICAST));
+
+    public final static MatchField<U64> TUNNEL_ID = 
+            new MatchField<U64>("tunnel_id", MatchFields.TUNNEL_ID);
+
+    public final static MatchField<OFBitMask128> BSN_IN_PORTS_128 =
+            new MatchField<OFBitMask128>("bsn_in_ports_128", MatchFields.BSN_IN_PORTS_128);
+
+    public final static MatchField<LagId> BSN_LAG_ID =
+            new MatchField<LagId>("bsn_lag_id", MatchFields.BSN_LAG_ID);
+
+    public final static MatchField<VRF> BSN_VRF =
+            new MatchField<VRF>("bsn_vrf", MatchFields.BSN_VRF);
+
+    public final static MatchField<OFBooleanValue> BSN_GLOBAL_VRF_ALLOWED =
+            new MatchField<OFBooleanValue>("bsn_global_vrf_allowed", MatchFields.BSN_GLOBAL_VRF_ALLOWED);
+
+    public final static MatchField<ClassId> BSN_L3_INTERFACE_CLASS_ID =
+            new MatchField<ClassId>("bsn_l3_interface_class_id", MatchFields.BSN_L3_INTERFACE_CLASS_ID);
+
+    public final static MatchField<ClassId> BSN_L3_SRC_CLASS_ID =
+            new MatchField<ClassId>("bsn_l3_src_class_id", MatchFields.BSN_L3_SRC_CLASS_ID);
+
+    public final static MatchField<ClassId> BSN_L3_DST_CLASS_ID =
+            new MatchField<ClassId>("bsn_l3_dst_class_id", MatchFields.BSN_L3_DST_CLASS_ID);
+
+    public final static MatchField<ClassId> BSN_EGR_PORT_GROUP_ID =
+            new MatchField<ClassId>("bsn_egr_port_group_id", MatchFields.BSN_EGR_PORT_GROUP_ID);
+
+    public final static MatchField<UDF> BSN_UDF0 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF0);
+
+    public final static MatchField<UDF> BSN_UDF1 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF1);
+
+    public final static MatchField<UDF> BSN_UDF2 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF2);
+
+    public final static MatchField<UDF> BSN_UDF3 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF3);
+
+    public final static MatchField<UDF> BSN_UDF4 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF4);
+
+    public final static MatchField<UDF> BSN_UDF5 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF5);
+
+    public final static MatchField<UDF> BSN_UDF6 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF6);
+
+    public final static MatchField<UDF> BSN_UDF7 =
+            new MatchField<UDF>("bsn_udf", MatchFields.BSN_UDF7);
+
+    public final static MatchField<U16> BSN_TCP_FLAGS =
+            new MatchField<U16>("bsn_tcp_flags", MatchFields.BSN_TCP_FLAGS);
+
+    public final static MatchField<ClassId> BSN_VLAN_XLATE_PORT_GROUP_ID =
+            new MatchField<ClassId>("bsn_vlan_xlate_port_group_id", MatchFields.BSN_VLAN_XLATE_PORT_GROUP_ID);
+
+    public String getName() {
+        return name;
+    }
+
+    public boolean arePrerequisitesOK(Match match) {
+        for (Prerequisite<?> p : this.prerequisites) {
+            if (!p.isSatisfied(match)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
new file mode 100644
index 0000000..863634e
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchFields.java
@@ -0,0 +1,60 @@
+package org.projectfloodlight.openflow.protocol.match;
+
+// MUST BE ORDERED BY THE ORDER OF OF SPEC!!!
+public enum MatchFields {
+    IN_PORT,
+    IN_PHY_PORT,
+    METADATA,
+    ETH_DST,
+    ETH_SRC,
+    ETH_TYPE,
+    VLAN_VID,
+    VLAN_PCP,
+    IP_DSCP,
+    IP_ECN,
+    IP_PROTO,
+    IPV4_SRC,
+    IPV4_DST,
+    TCP_SRC,
+    TCP_DST,
+    UDP_SRC,
+    UDP_DST,
+    SCTP_SRC,
+    SCTP_DST,
+    ICMPV4_TYPE,
+    ICMPV4_CODE,
+    ARP_OP,
+    ARP_SPA,
+    ARP_TPA,
+    ARP_SHA,
+    ARP_THA,
+    IPV6_SRC,
+    IPV6_DST,
+    IPV6_FLABEL,
+    ICMPV6_TYPE,
+    ICMPV6_CODE,
+    IPV6_ND_TARGET,
+    IPV6_ND_SLL,
+    IPV6_ND_TLL,
+    MPLS_LABEL,
+    MPLS_TC,
+    TUNNEL_ID,
+    BSN_IN_PORTS_128,
+    BSN_LAG_ID,
+    BSN_VRF,
+    BSN_GLOBAL_VRF_ALLOWED,
+    BSN_L3_INTERFACE_CLASS_ID,
+    BSN_L3_SRC_CLASS_ID,
+    BSN_L3_DST_CLASS_ID,
+    BSN_EGR_PORT_GROUP_ID,
+    BSN_UDF0,
+    BSN_UDF1,
+    BSN_UDF2,
+    BSN_UDF3,
+    BSN_UDF4,
+    BSN_UDF5,
+    BSN_UDF6,
+    BSN_UDF7,
+    BSN_TCP_FLAGS,
+    BSN_VLAN_XLATE_PORT_GROUP_ID,
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/Prerequisite.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/Prerequisite.java
new file mode 100644
index 0000000..03d5e79
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/match/Prerequisite.java
@@ -0,0 +1,45 @@
+package org.projectfloodlight.openflow.protocol.match;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.projectfloodlight.openflow.types.OFValueType;
+
+public class Prerequisite<T extends OFValueType<T>> {
+    private final MatchField<T> field;
+    private final Set<OFValueType<T>> values;
+    private boolean any;
+
+    @SafeVarargs
+    public Prerequisite(MatchField<T> field, OFValueType<T>... values) {
+        this.values = new HashSet<OFValueType<T>>();
+        this.field = field;
+        if (values == null || values.length == 0) {
+            this.any = true;
+        } else {
+            this.any = false;
+            for (OFValueType<T> value : values) {
+                this.values.add(value);
+            }
+        }
+    }
+
+    /**
+     * Returns true if this prerequisite is satisfied by the given match object.
+     *
+     * @param match Match object
+     * @return true iff prerequisite is satisfied.
+     */
+    public boolean isSatisfied(Match match) {
+        OFValueType<T> res = match.get(this.field);
+        if (res == null)
+            return false;
+        if (this.any)
+            return true;
+        if (this.values.contains(res)) {
+            return true;
+        }
+        return false;
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
new file mode 100644
index 0000000..b4937ba
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
@@ -0,0 +1,91 @@
+package org.projectfloodlight.openflow.protocol.ver10;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFActionType;
+import org.projectfloodlight.openflow.protocol.match.Match;
+
+import com.google.common.hash.PrimitiveSink;
+
+/**
+ * Collection of helper functions for reading and writing into ChannelBuffers
+ *
+ * @author capveg
+ */
+
+public class ChannelUtilsVer10 {
+    public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
+        return OFMatchV1Ver10.READER.readFrom(bb);
+    }
+
+    public static Set<OFActionType> readSupportedActions(ChannelBuffer bb) {
+        int actions = bb.readInt();
+        EnumSet<OFActionType> supportedActions = EnumSet.noneOf(OFActionType.class);
+        if ((actions & (1 << OFActionTypeSerializerVer10.OUTPUT_VAL)) != 0)
+            supportedActions.add(OFActionType.OUTPUT);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_VLAN_VID_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_VLAN_VID);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_VLAN_PCP_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_VLAN_PCP);
+        if ((actions & (1 << OFActionTypeSerializerVer10.STRIP_VLAN_VAL)) != 0)
+            supportedActions.add(OFActionType.STRIP_VLAN);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_DL_SRC_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_DL_SRC);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_DL_DST_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_DL_DST);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_SRC_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_NW_SRC);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_DST_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_NW_DST);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_NW_TOS_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_NW_TOS);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_TP_SRC_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_TP_SRC);
+        if ((actions & (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL)) != 0)
+            supportedActions.add(OFActionType.SET_TP_DST);
+        if ((actions & (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL)) != 0)
+            supportedActions.add(OFActionType.ENQUEUE);
+        return supportedActions;
+    }
+
+    public static int supportedActionsToWire(Set<OFActionType> supportedActions) {
+        int supportedActionsVal = 0;
+        if (supportedActions.contains(OFActionType.OUTPUT))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.OUTPUT_VAL);
+        if (supportedActions.contains(OFActionType.SET_VLAN_VID))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_VLAN_VID_VAL);
+        if (supportedActions.contains(OFActionType.SET_VLAN_PCP))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_VLAN_PCP_VAL);
+        if (supportedActions.contains(OFActionType.STRIP_VLAN))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.STRIP_VLAN_VAL);
+        if (supportedActions.contains(OFActionType.SET_DL_SRC))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_DL_SRC_VAL);
+        if (supportedActions.contains(OFActionType.SET_DL_DST))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_DL_DST_VAL);
+        if (supportedActions.contains(OFActionType.SET_NW_SRC))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_SRC_VAL);
+        if (supportedActions.contains(OFActionType.SET_NW_DST))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_DST_VAL);
+        if (supportedActions.contains(OFActionType.SET_NW_TOS))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_NW_TOS_VAL);
+        if (supportedActions.contains(OFActionType.SET_TP_SRC))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_SRC_VAL);
+        if (supportedActions.contains(OFActionType.SET_TP_DST))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.SET_TP_DST_VAL);
+        if (supportedActions.contains(OFActionType.ENQUEUE))
+            supportedActionsVal |= (1 << OFActionTypeSerializerVer10.ENQUEUE_VAL);
+        return supportedActionsVal;
+    }
+
+    public static void putSupportedActionsTo(Set<OFActionType> supportedActions, PrimitiveSink sink) {
+        sink.putInt(supportedActionsToWire(supportedActions));
+    }
+
+    public static void writeSupportedActions(ChannelBuffer bb, Set<OFActionType> supportedActions) {
+        bb.writeInt(supportedActionsToWire(supportedActions));
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java
new file mode 100644
index 0000000..b090e47
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java
@@ -0,0 +1,26 @@
+package org.projectfloodlight.openflow.protocol.ver11;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMatchBmap;
+import org.projectfloodlight.openflow.protocol.match.Match;
+
+/**
+ * Collection of helper functions for reading and writing into ChannelBuffers
+ *
+ * @author capveg
+ */
+
+public class ChannelUtilsVer11 {
+    public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
+        return OFMatchV2Ver11.READER.readFrom(bb);
+    }
+
+    public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+
+    public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver12/ChannelUtilsVer12.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver12/ChannelUtilsVer12.java
new file mode 100644
index 0000000..756363d
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver12/ChannelUtilsVer12.java
@@ -0,0 +1,40 @@
+package org.projectfloodlight.openflow.protocol.ver12;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMatchBmap;
+import org.projectfloodlight.openflow.protocol.match.Match;
+import org.projectfloodlight.openflow.protocol.ver12.OFMatchV3Ver12;
+import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ;
+
+/**
+ * Collection of helper functions for reading and writing into ChannelBuffers
+ *
+ * @author capveg
+ */
+
+public class ChannelUtilsVer12 {
+    public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
+        return OFMatchV3Ver12.READER.readFrom(bb);
+    }
+
+    // TODO these need to be figured out / removed
+
+    public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+
+    public static void writeOFBsnVportQInQ(ChannelBuffer bb,
+            OFBsnVportQInQ vport) {
+        throw new UnsupportedOperationException("not implemented");
+
+    }
+
+    public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+
+    public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java
new file mode 100644
index 0000000..8216bb0
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java
@@ -0,0 +1,26 @@
+package org.projectfloodlight.openflow.protocol.ver13;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMatchBmap;
+import org.projectfloodlight.openflow.protocol.match.Match;
+
+/**
+ * Collection of helper functions for reading and writing into ChannelBuffers
+ *
+ * @author capveg
+ */
+
+public class ChannelUtilsVer13 {
+    public static Match readOFMatch(final ChannelBuffer bb) throws OFParseError {
+        return OFMatchV3Ver13.READER.readFrom(bb);
+    }
+
+    public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+
+    public static void writeOFMatchBmap(ChannelBuffer bb, OFMatchBmap match) {
+        throw new UnsupportedOperationException("not implemented");
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
new file mode 100644
index 0000000..dd50d29
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
@@ -0,0 +1,198 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+public class ArpOpcode implements OFValueType<ArpOpcode> {
+
+    final static int LENGTH = 2;
+
+    private static final int VAL_REQUEST   = 1;
+    private static final int VAL_REPLY = 2;
+    private static final int VAL_REQUEST_REVERSE   = 3;
+    private static final int VAL_REPLY_REVERSE = 4;
+    private static final int VAL_DRARP_REQUEST = 5;
+    private static final int VAL_DRARP_REPLY   = 6;
+    private static final int VAL_DRARP_ERROR   = 7;
+    private static final int VAL_INARP_REQUEST = 8;
+    private static final int VAL_INARP_REPLY   = 9;
+    private static final int VAL_ARP_NAK   = 10;
+    private static final int VAL_MARS_REQUEST  = 11;
+    private static final int VAL_MARS_MULTI    = 12;
+    private static final int VAL_MARS_MSERV    = 13;
+    private static final int VAL_MARS_JOIN = 14;
+    private static final int VAL_MARS_LEAVE    = 15;
+    private static final int VAL_MARS_NAK  = 16;
+    private static final int VAL_MARS_UNSERV   = 17;
+    private static final int VAL_MARS_SJOIN    = 18;
+    private static final int VAL_MARS_SLEAVE   = 19;
+    private static final int VAL_MARS_GROUPLIST_REQUEST    = 20;
+    private static final int VAL_MARS_GROUPLIST_REPLY  = 21;
+    private static final int VAL_MARS_REDIRECT_MAP = 22;
+    private static final int VAL_MAPOS_UNARP   = 23;
+    private static final int VAL_OP_EXP1   = 24;
+    private static final int VAL_OP_EXP2   = 25;
+
+    public static final ArpOpcode REQUEST  = new ArpOpcode(VAL_REQUEST);
+    public static final ArpOpcode REPLY    = new ArpOpcode(VAL_REPLY);
+    public static final ArpOpcode REQUEST_REVERSE  = new ArpOpcode(VAL_REQUEST_REVERSE);
+    public static final ArpOpcode REPLY_REVERSE    = new ArpOpcode(VAL_REPLY_REVERSE);
+    public static final ArpOpcode DRARP_REQUEST    = new ArpOpcode(VAL_DRARP_REQUEST);
+    public static final ArpOpcode DRARP_REPLY  = new ArpOpcode(VAL_DRARP_REPLY);
+    public static final ArpOpcode DRARP_ERROR  = new ArpOpcode(VAL_DRARP_ERROR);
+    public static final ArpOpcode INARP_REQUEST    = new ArpOpcode(VAL_INARP_REQUEST);
+    public static final ArpOpcode INARP_REPLY  = new ArpOpcode(VAL_INARP_REPLY);
+    public static final ArpOpcode ARP_NAK  = new ArpOpcode(VAL_ARP_NAK);
+    public static final ArpOpcode MARS_REQUEST = new ArpOpcode(VAL_MARS_REQUEST);
+    public static final ArpOpcode MARS_MULTI   = new ArpOpcode(VAL_MARS_MULTI);
+    public static final ArpOpcode MARS_MSERV   = new ArpOpcode(VAL_MARS_MSERV);
+    public static final ArpOpcode MARS_JOIN    = new ArpOpcode(VAL_MARS_JOIN);
+    public static final ArpOpcode MARS_LEAVE   = new ArpOpcode(VAL_MARS_LEAVE);
+    public static final ArpOpcode MARS_NAK = new ArpOpcode(VAL_MARS_NAK);
+    public static final ArpOpcode MARS_UNSERV  = new ArpOpcode(VAL_MARS_UNSERV);
+    public static final ArpOpcode MARS_SJOIN   = new ArpOpcode(VAL_MARS_SJOIN);
+    public static final ArpOpcode MARS_SLEAVE  = new ArpOpcode(VAL_MARS_SLEAVE);
+    public static final ArpOpcode MARS_GROUPLIST_REQUEST   = new ArpOpcode(VAL_MARS_GROUPLIST_REQUEST);
+    public static final ArpOpcode MARS_GROUPLIST_REPLY = new ArpOpcode(VAL_MARS_GROUPLIST_REPLY);
+    public static final ArpOpcode MARS_REDIRECT_MAP    = new ArpOpcode(VAL_MARS_REDIRECT_MAP);
+    public static final ArpOpcode MAPOS_UNARP  = new ArpOpcode(VAL_MAPOS_UNARP);
+    public static final ArpOpcode OP_EXP1  = new ArpOpcode(VAL_OP_EXP1);
+    public static final ArpOpcode OP_EXP2  = new ArpOpcode(VAL_OP_EXP2);
+
+    private static final int MIN_OPCODE = 0;
+    private static final int MAX_OPCODE = 0xFFFF;
+
+    private static final int NONE_VAL = 0;
+    public static final ArpOpcode NONE = new ArpOpcode(NONE_VAL);
+
+    public static final ArpOpcode NO_MASK = new ArpOpcode(0xFFFFFFFF);
+    public static final ArpOpcode FULL_MASK = new ArpOpcode(0x00000000);
+
+    private final int opcode;
+
+    private ArpOpcode(int opcode) {
+        this.opcode = opcode;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public int getOpcode() {
+        return this.opcode;
+    }
+
+    public static ArpOpcode of(int opcode) {
+        if (opcode < MIN_OPCODE || opcode > MAX_OPCODE)
+            throw new IllegalArgumentException("Invalid ARP opcode: " + opcode);
+        switch (opcode) {
+            case NONE_VAL:
+                return NONE;
+            case VAL_REQUEST:
+                return REQUEST;
+            case VAL_REPLY:
+                return REPLY;
+            case VAL_REQUEST_REVERSE:
+                return REQUEST_REVERSE;
+            case VAL_REPLY_REVERSE:
+                return REPLY_REVERSE;
+            case VAL_DRARP_REQUEST:
+                return DRARP_REQUEST;
+            case VAL_DRARP_REPLY:
+                return DRARP_REPLY;
+            case VAL_DRARP_ERROR:
+                return DRARP_ERROR;
+            case VAL_INARP_REQUEST:
+                return INARP_REQUEST;
+            case VAL_INARP_REPLY:
+                return INARP_REPLY;
+            case VAL_ARP_NAK:
+                return ARP_NAK;
+            case VAL_MARS_REQUEST:
+                return MARS_REQUEST;
+            case VAL_MARS_MULTI:
+                return MARS_MULTI;
+            case VAL_MARS_MSERV:
+                return MARS_MSERV;
+            case VAL_MARS_JOIN:
+                return MARS_JOIN;
+            case VAL_MARS_LEAVE:
+                return MARS_LEAVE;
+            case VAL_MARS_NAK:
+                return MARS_NAK;
+            case VAL_MARS_UNSERV:
+                return MARS_UNSERV;
+            case VAL_MARS_SJOIN:
+                return MARS_SJOIN;
+            case VAL_MARS_SLEAVE:
+                return MARS_SLEAVE;
+            case VAL_MARS_GROUPLIST_REQUEST:
+                return MARS_GROUPLIST_REQUEST;
+            case VAL_MARS_GROUPLIST_REPLY:
+                return MARS_GROUPLIST_REPLY;
+            case VAL_MARS_REDIRECT_MAP:
+                return MARS_REDIRECT_MAP;
+            case VAL_MAPOS_UNARP:
+                return MAPOS_UNARP;
+            case VAL_OP_EXP1:
+                return OP_EXP1;
+            case VAL_OP_EXP2:
+                return OP_EXP2;
+            default:
+                return new ArpOpcode(opcode);
+        }
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.opcode);
+    }
+
+    public static ArpOpcode read2Bytes(ChannelBuffer c) {
+        return ArpOpcode.of(c.readUnsignedShort());
+    }
+
+    @Override
+    public ArpOpcode applyMask(ArpOpcode mask) {
+        return ArpOpcode.of(this.opcode & mask.opcode);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + opcode;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ArpOpcode other = (ArpOpcode) obj;
+        if (opcode != other.opcode)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int compareTo(ArpOpcode o) {
+        return UnsignedInts.compare(opcode, o.opcode);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort((short) this.opcode);
+    }
+
+    @Override
+    public String toString() {
+        return String.valueOf(this.opcode);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ClassId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ClassId.java
new file mode 100644
index 0000000..7d7c38e
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ClassId.java
@@ -0,0 +1,92 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+@Immutable
+public class ClassId implements OFValueType<ClassId> {
+    static final int LENGTH = 4;
+
+    private final static int NONE_VAL = 0;
+    public final static ClassId NONE = new ClassId(NONE_VAL);
+
+    private final static int NO_MASK_VAL = 0xFFFFFFFF;
+    public final static ClassId NO_MASK = new ClassId(NO_MASK_VAL);
+    public final static ClassId FULL_MASK = NONE;
+
+    private final int rawValue;
+
+    private ClassId(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static ClassId of(final int raw) {
+        if(raw == NONE_VAL)
+            return NONE;
+        else if(raw == NO_MASK_VAL)
+            return NO_MASK;
+        return new ClassId(raw);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(rawValue);
+    }
+
+    @Override
+    public ClassId applyMask(ClassId mask) {
+        return ClassId.of(rawValue & mask.rawValue);    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ClassId other = (ClassId) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+
+    public static ClassId read4Bytes(ChannelBuffer c) {
+        return ClassId.of(c.readInt());
+    }
+
+    @Override
+    public int compareTo(ClassId o) {
+        return UnsignedInts.compare(rawValue, rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
new file mode 100644
index 0000000..79fa14f
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
@@ -0,0 +1,87 @@
+package org.projectfloodlight.openflow.types;
+
+import org.projectfloodlight.openflow.annotations.Immutable;
+import org.projectfloodlight.openflow.util.HexString;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.UnsignedLongs;
+
+/**
+ * Abstraction of a datapath ID that can be set and/or accessed as either a
+ * long value or a colon-separated string. Immutable
+ *
+ * @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
+ */
+@Immutable
+public class DatapathId implements PrimitiveSinkable, Comparable<DatapathId> {
+
+    public static final DatapathId NONE = new DatapathId(0);
+
+    private final long rawValue;
+
+    private DatapathId(long rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static DatapathId of(long rawValue) {
+        return new DatapathId(rawValue);
+    }
+
+    public static DatapathId of(String s) {
+        return new DatapathId(HexString.toLong(s));
+    }
+
+    public static DatapathId of(byte[] bytes) {
+        return new DatapathId(Longs.fromByteArray(bytes));
+    }
+
+    public long getLong() {
+        return rawValue;
+    }
+
+    public U64 getUnsignedLong() {
+        return U64.of(rawValue);
+    }
+
+    public byte[] getBytes() {
+        return Longs.toByteArray(rawValue);
+    }
+
+    @Override
+    public String toString() {
+        return HexString.toHexString(rawValue);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (rawValue ^ (rawValue >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        DatapathId other = (DatapathId) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putLong(rawValue);
+    }
+
+    @Override
+    public int compareTo(DatapathId o) {
+        return UnsignedLongs.compare(rawValue, o.rawValue);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/EthType.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/EthType.java
new file mode 100644
index 0000000..c5f4f86
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/EthType.java
@@ -0,0 +1,270 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+
+/**
+ * EtherType field representation.
+ *
+ * @author Yotam Harchol (yotam.harchol@bigswitch.com)
+ */
+public class EthType implements OFValueType<EthType> {
+    static final int LENGTH = 2;
+
+    private final int rawValue;
+
+    static final int VAL_IPv4              = 0x0800; // Internet Protocol version 4 (IPv4)
+    static final int VAL_ARP               = 0x0806; // Address Resolution Protocol (ARP)
+    static final int VAL_WAKE_ON_LAN       = 0x0842; // Wake-on-LAN[3]
+    static final int VAL_TRILL             = 0x22F3; // IETF TRILL Protocol
+    static final int VAL_DECNET_IV         = 0x6003; // DECnet Phase IV
+    static final int VAL_REV_ARP           = 0x8035; // Reverse Address Resolution Protocol
+    static final int VAL_APPLE_TALK        = 0x809B; // AppleTalk (Ethertalk)
+    static final int VAL_APPLE_TALK_ARP    = 0x80F3; // AppleTalk Address Resolution Protocol (AARP)
+    static final int VAL_VLAN_FRAME        = 0x8100; // VLAN-tagged frame (IEEE 802.1Q) & Shortest Path Bridging IEEE 802.1aq[4]
+    static final int VAL_IPX_8137          = 0x8137; // IPX
+    static final int VAL_IPX_8138          = 0x8138; // IPX
+    static final int VAL_QNX               = 0x8204; // QNX Qnet
+    static final int VAL_IPv6              = 0x86DD; // Internet Protocol Version 6 (IPv6)
+    static final int VAL_ETH_FLOW          = 0x8808; // Ethernet flow control
+    static final int VAL_SLOW_PROTOCOLS    = 0x8809; // Slow Protocols (IEEE 802.3)
+    static final int VAL_COBRANET          = 0x8819; // CobraNet
+    static final int VAL_MPLS_UNICAST      = 0x8847; // MPLS unicast
+    static final int VAL_MPLS_MULTICAST    = 0x8848; // MPLS multicast
+    static final int VAL_PPPoE_DISCOVERY   = 0x8863; // PPPoE Discovery Stage
+    static final int VAL_PPPoE_SESSION     = 0x8864; // PPPoE Session Stage
+    static final int VAL_JUMBO_FRAMES      = 0x8870; // Jumbo Frames
+    static final int VAL_HOMEPLUG_10       = 0x887B; // HomePlug 1.0 MME
+    static final int VAL_EAP_OVER_LAN      = 0x888E; // EAP over LAN (IEEE 802.1X)
+    static final int VAL_PROFINET          = 0x8892; // PROFINET Protocol
+    static final int VAL_HYPERSCSI         = 0x889A; // HyperSCSI (SCSI over Ethernet)
+    static final int VAL_ATA_OVER_ETH      = 0x88A2; // ATA over Ethernet
+    static final int VAL_ETHERCAT          = 0x88A4; // EtherCAT Protocol
+    static final int VAL_BRIDGING          = 0x88A8; // Provider Bridging (IEEE 802.1ad) & Shortest Path Bridging IEEE 802.1aq[5]
+    static final int VAL_POWERLINK         = 0x88AB; // Ethernet Powerlink[citation needed]
+    static final int VAL_LLDP              = 0x88CC; // Link Layer Discovery Protocol (LLDP)
+    static final int VAL_SERCOS            = 0x88CD; // SERCOS III
+    static final int VAL_HOMEPLUG_AV       = 0x88E1; // HomePlug AV MME[citation needed]
+    static final int VAL_MRP               = 0x88E3; // Media Redundancy Protocol (IEC62439-2)
+    static final int VAL_MAC_SEC           = 0x88E5; // MAC security (IEEE 802.1AE)
+    static final int VAL_PTP               = 0x88F7; // Precision Time Protocol (IEEE 1588)
+    static final int VAL_CFM               = 0x8902; // IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)
+    static final int VAL_FCoE              = 0x8906; // Fibre Channel over Ethernet (FCoE)
+    static final int VAL_FCoE_INIT         = 0x8914; // FCoE Initialization Protocol
+    static final int VAL_RoCE              = 0x8915; // RDMA over Converged Ethernet (RoCE)
+    static final int VAL_HSR               = 0x892F; // High-availability Seamless Redundancy (HSR)
+    static final int VAL_CONF_TEST         = 0x9000; // Ethernet Configuration Testing Protocol[6]
+    static final int VAL_Q_IN_Q            = 0x9100; // Q-in-Q
+    static final int VAL_LLT               = 0xCAFE; // Veritas Low Latency Transport (LLT)[7] for Veritas Cluster Server
+
+    public static final EthType IPv4               = new EthType(VAL_IPv4);
+    public static final EthType ARP                = new EthType(VAL_ARP);
+    public static final EthType WAKE_ON_LAN        = new EthType(VAL_WAKE_ON_LAN);
+    public static final EthType TRILL              = new EthType(VAL_TRILL);
+    public static final EthType DECNET_IV          = new EthType(VAL_DECNET_IV);
+    public static final EthType REV_ARP            = new EthType(VAL_REV_ARP );
+    public static final EthType APPLE_TALK         = new EthType(VAL_APPLE_TALK);
+    public static final EthType APPLE_TALK_ARP     = new EthType(VAL_APPLE_TALK_ARP);
+    public static final EthType VLAN_FRAME         = new EthType(VAL_VLAN_FRAME );
+    public static final EthType IPX_8137           = new EthType(VAL_IPX_8137 );
+    public static final EthType IPX_8138           = new EthType(VAL_IPX_8138 );
+    public static final EthType QNX                = new EthType(VAL_QNX );
+    public static final EthType IPv6               = new EthType(VAL_IPv6 );
+    public static final EthType ETH_FLOW           = new EthType(VAL_ETH_FLOW);
+    public static final EthType SLOW_PROTOCOLS     = new EthType(VAL_SLOW_PROTOCOLS );
+    public static final EthType COBRANET           = new EthType(VAL_COBRANET );
+    public static final EthType MPLS_UNICAST       = new EthType(VAL_MPLS_UNICAST );
+    public static final EthType MPLS_MULTICAST     = new EthType(VAL_MPLS_MULTICAST );
+    public static final EthType PPPoE_DISCOVERY    = new EthType(VAL_PPPoE_DISCOVERY);
+    public static final EthType PPPoE_SESSION      = new EthType(VAL_PPPoE_SESSION );
+    public static final EthType JUMBO_FRAMES       = new EthType(VAL_JUMBO_FRAMES );
+    public static final EthType HOMEPLUG_10        = new EthType(VAL_HOMEPLUG_10 );
+    public static final EthType EAP_OVER_LAN       = new EthType(VAL_EAP_OVER_LAN );
+    public static final EthType PROFINET           = new EthType(VAL_PROFINET );
+    public static final EthType HYPERSCSI          = new EthType(VAL_HYPERSCSI );
+    public static final EthType ATA_OVER_ETH       = new EthType(VAL_ATA_OVER_ETH);
+    public static final EthType ETHERCAT           = new EthType(VAL_ETHERCAT );
+    public static final EthType BRIDGING           = new EthType(VAL_BRIDGING );
+    public static final EthType POWERLINK          = new EthType(VAL_POWERLINK );
+    public static final EthType LLDP               = new EthType(VAL_LLDP );
+    public static final EthType SERCOS             = new EthType(VAL_SERCOS );
+    public static final EthType HOMEPLUG_AV        = new EthType(VAL_HOMEPLUG_AV );
+    public static final EthType MRP                = new EthType(VAL_MRP );
+    public static final EthType MAC_SEC            = new EthType(VAL_MAC_SEC);
+    public static final EthType PTP                = new EthType(VAL_PTP );
+    public static final EthType CFM                = new EthType(VAL_CFM );
+    public static final EthType FCoE               = new EthType(VAL_FCoE );
+    public static final EthType FCoE_INIT          = new EthType(VAL_FCoE_INIT );
+    public static final EthType RoCE               = new EthType(VAL_RoCE );
+    public static final EthType HSR                = new EthType(VAL_HSR );
+    public static final EthType CONF_TEST          = new EthType(VAL_CONF_TEST );
+    public static final EthType Q_IN_Q             = new EthType(VAL_Q_IN_Q );
+    public static final EthType LLT                = new EthType(VAL_LLT );
+
+
+    private static final int NONE_VAL = 0x0;
+    public static final EthType NONE = new EthType(NONE_VAL);
+
+    public static final EthType NO_MASK = new EthType(0xFFFFFFFF);
+    public static final EthType FULL_MASK = new EthType(0x00000000);
+
+    private EthType(int type) {
+        this.rawValue = type;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public static EthType of(int type) {
+        switch (type) {
+            case NONE_VAL:
+                return NONE;
+            case VAL_IPv4:
+                return IPv4;
+            case VAL_ARP:
+                return ARP;
+            case VAL_WAKE_ON_LAN:
+                return WAKE_ON_LAN;
+            case VAL_TRILL:
+                return TRILL;
+            case VAL_DECNET_IV:
+                return DECNET_IV;
+            case VAL_REV_ARP:
+                return REV_ARP;
+            case VAL_APPLE_TALK:
+                return APPLE_TALK;
+            case VAL_APPLE_TALK_ARP:
+                return APPLE_TALK_ARP;
+            case VAL_VLAN_FRAME:
+                return VLAN_FRAME;
+            case VAL_IPX_8137:
+                return IPX_8137;
+            case VAL_IPX_8138:
+                return IPX_8138;
+            case VAL_QNX:
+                return QNX;
+            case VAL_IPv6:
+                return IPv6;
+            case VAL_ETH_FLOW:
+                return ETH_FLOW;
+            case VAL_SLOW_PROTOCOLS:
+                return SLOW_PROTOCOLS;
+            case VAL_COBRANET:
+                return COBRANET;
+            case VAL_MPLS_UNICAST:
+                return MPLS_UNICAST;
+            case VAL_MPLS_MULTICAST:
+                return MPLS_MULTICAST;
+            case VAL_PPPoE_DISCOVERY:
+                return PPPoE_DISCOVERY;
+            case VAL_PPPoE_SESSION:
+                return PPPoE_SESSION;
+            case VAL_JUMBO_FRAMES:
+                return JUMBO_FRAMES;
+            case VAL_HOMEPLUG_10:
+                return HOMEPLUG_10;
+            case VAL_EAP_OVER_LAN:
+                return EAP_OVER_LAN;
+            case VAL_PROFINET:
+                return PROFINET;
+            case VAL_HYPERSCSI:
+                return HYPERSCSI;
+            case VAL_ATA_OVER_ETH:
+                return ATA_OVER_ETH;
+            case VAL_ETHERCAT:
+                return ETHERCAT;
+            case VAL_BRIDGING:
+                return BRIDGING;
+            case VAL_POWERLINK:
+                return POWERLINK;
+            case VAL_LLDP:
+                return LLDP;
+            case VAL_SERCOS:
+                return SERCOS;
+            case VAL_HOMEPLUG_AV:
+                return HOMEPLUG_AV;
+            case VAL_MRP:
+                return MRP;
+            case VAL_MAC_SEC:
+                return MAC_SEC;
+            case VAL_PTP:
+                return PTP;
+            case VAL_CFM:
+                return CFM;
+            case VAL_FCoE:
+                return FCoE;
+            case VAL_FCoE_INIT:
+                return FCoE_INIT;
+            case VAL_RoCE:
+                return RoCE;
+            case VAL_HSR:
+                return HSR;
+            case VAL_CONF_TEST:
+                return CONF_TEST;
+            case VAL_Q_IN_Q:
+                return Q_IN_Q;
+            case VAL_LLT:
+                return LLT;
+            default:
+                // TODO: What's here?
+                return new EthType(type);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toHexString(rawValue);
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.rawValue);
+    }
+
+    public static EthType read2Bytes(ChannelBuffer c) {
+        return EthType.of(c.readUnsignedShort());
+    }
+
+    @Override
+    public EthType applyMask(EthType mask) {
+        return EthType.of(this.rawValue & mask.rawValue);
+    }
+
+    public int getValue() {
+        return rawValue;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof EthType))
+            return false;
+        EthType o = (EthType)obj;
+        if (o.rawValue != this.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 37;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public int compareTo(EthType o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/GenTableId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/GenTableId.java
new file mode 100644
index 0000000..cfa7cdf
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/GenTableId.java
@@ -0,0 +1,93 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+public class GenTableId implements OFValueType<GenTableId>, Comparable<GenTableId> {
+    final static int LENGTH = 2;
+
+    private static final int VALIDATION_MASK = 0xFFFF;
+
+    private static final int ALL_VAL = 0xFFFF;
+    private static final int NONE_VAL = 0x0000;
+    public static final GenTableId NONE = new GenTableId(NONE_VAL);
+
+    public static final GenTableId ALL = new GenTableId(ALL_VAL);
+    public static final GenTableId ZERO = NONE;
+
+    private final int id;
+
+    private GenTableId(int id) {
+        this.id = id;
+    }
+
+    public static GenTableId of(int id) {
+        switch(id) {
+            case NONE_VAL:
+                return NONE;
+            case ALL_VAL:
+                return ALL;
+            default:
+                if ((id & VALIDATION_MASK) != id)
+                    throw new IllegalArgumentException("Illegal Table id value: " + id);
+                return new GenTableId(id);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Integer.toHexString(id);
+    }
+
+    public int getValue() {
+        return id;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.id);
+    }
+
+    public static GenTableId read2Bytes(ChannelBuffer c) throws OFParseError {
+        return GenTableId.of(c.readUnsignedShort());
+    }
+
+    @Override
+    public GenTableId applyMask(GenTableId mask) {
+        return GenTableId.of(this.id & mask.id);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof GenTableId))
+            return false;
+        GenTableId other = (GenTableId)obj;
+        if (other.id != this.id)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int prime = 13873;
+        return this.id * prime;
+    }
+
+    @Override
+    public int compareTo(GenTableId other) {
+        return UnsignedInts.compare(this.id, other.id);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort((byte) id);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/HashValue.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/HashValue.java
new file mode 100644
index 0000000..3030e3e
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/HashValue.java
@@ -0,0 +1,102 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+/** a hash value that supports bit-wise combinations, mainly to calculate hash values for
+ *  reconciliation operations.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ *
+ * @param <H> - this type, for return type safety.
+ */
+@Immutable
+public interface HashValue<H extends HashValue<H>> {
+    /** return the "numBits" highest-order bits of the hash.
+     *  @param numBits number of higest-order bits to return [0-32].
+     *  @return a numberic value of the 0-32 highest-order bits.
+     */
+    int prefixBits(int numBits);
+
+    /** perform an arithmetic addition of this value and other. Wraps around on
+     * overflow of the defined word size.
+     *
+     * @param other
+     * @return this + other
+     */
+    H add(H other);
+
+    /**
+     * arithmetically substract the given 'other' value from this value.
+     * around on overflow.
+     *
+     * @param other
+     * @return this - other
+     */
+    H subtract(H other);
+
+    /** @return the bitwise inverse of this value */
+    H inverse();
+
+    /** or this value with another value value of the same type */
+    H or(H other);
+
+    /** and this value with another value value of the same type */
+    H and(H other);
+
+    /** xor this value with another value value of the same type */
+    H xor(H other);
+
+    /** create and return a builder */
+    Builder<H> builder();
+
+    /** a mutator for HashValues. Allows perfomring a series of
+     *  operations on a hashv value without the associated cost of object
+     *  reallocation.
+     *
+     * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+     *
+     * @param <H> - the hashvalue
+     */
+    public interface Builder<H> {
+        /** perform an arithmetic addition of this value and other. Wraps around on
+         * overflow of the defined word size.
+         *
+         * @param other
+         * @return this mutator
+         */
+        Builder<H> add(H other);
+
+        /**
+         * arithmetically substract the given 'other' value from the value stored in this mutator.
+         * around on overflow.
+         *
+         * @param other
+         * @return this mutator
+         */
+        Builder<H> subtract(H other);
+
+        /** bitwise invert the value stored in this mutator
+         *
+         * @return this mutator
+         */
+        Builder<H> invert();
+
+        /** or the value stored in this mutator with another value value of the same type
+        * @return this mutator
+        */
+        Builder<H> or(H other);
+
+        /** and the value stored in this mutator with another value value of the same type
+        * @return this mutator
+        */
+        Builder<H> and(H other);
+
+        /** xor the value stored in this mutator with another value value of the same type
+        * @return this mutator
+        */
+        Builder<H> xor(H other);
+
+        /** @return the hash value */
+        public H build();
+    }
+}
\ No newline at end of file
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/HashValueUtils.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/HashValueUtils.java
new file mode 100644
index 0000000..15f8a9b
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/HashValueUtils.java
@@ -0,0 +1,29 @@
+package org.projectfloodlight.openflow.types;
+
+import com.google.common.base.Preconditions;
+
+public class HashValueUtils {
+    private HashValueUtils() { }
+
+    public static long combineWithValue(long key, long value, int keyBits) {
+        Preconditions.checkArgument(keyBits >= 0 && keyBits <= 64, "keyBits must be [0,64]");
+
+        int valueBits = 64 - keyBits;
+        long valueMask = valueBits == 64 ? 0xFFFFFFFFFFFFFFFFL : (1L << valueBits) - 1;
+
+        return key ^ (value & valueMask);
+    }
+
+    public static int prefixBits(long raw1, int numBits) {
+        Preconditions.checkArgument(numBits >= 0 && numBits <= 32,
+                "numBits must be in range [0, 32]");
+
+        if(numBits == 0)
+            return 0;
+
+        final int shiftDown = 64 - numBits;
+
+        return (int) (raw1 >>> shiftDown);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
new file mode 100644
index 0000000..ced5737
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
@@ -0,0 +1,98 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+/**
+ *
+ * @author Yotam Harchol (yotam.harchol@bigswitch.com)
+ *
+ */
+public class ICMPv4Code implements OFValueType<ICMPv4Code> {
+
+    final static int LENGTH = 1;
+    final static short MAX_CODE = 0xFF;
+
+    private final short code;
+
+    private static final short NONE_VAL = 0;
+    public static final ICMPv4Code NONE = new ICMPv4Code(NONE_VAL);
+
+    public static final ICMPv4Code NO_MASK = new ICMPv4Code((short)0xFFFF);
+    public static final ICMPv4Code FULL_MASK = new ICMPv4Code((short)0x0000);
+
+    private ICMPv4Code(short code) {
+        this.code = code;
+    }
+
+    public static ICMPv4Code of(short code) {
+        if(code == NONE_VAL)
+            return NONE;
+
+        if (code > MAX_CODE || code < 0)
+            throw new IllegalArgumentException("Illegal ICMPv4 code: " + code);
+        return new ICMPv4Code(code);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public short getCode() {
+        return code;
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.code);
+    }
+
+    public static ICMPv4Code readByte(ChannelBuffer c) {
+        return ICMPv4Code.of(c.readUnsignedByte());
+    }
+
+    @Override
+    public ICMPv4Code applyMask(ICMPv4Code mask) {
+        return ICMPv4Code.of((short)(this.code & mask.code));
+    }
+
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + code;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ICMPv4Code other = (ICMPv4Code) obj;
+        if (code != other.code)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int compareTo(ICMPv4Code o) {
+        return Shorts.compare(code, o.code);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort(code);
+    }
+
+    @Override
+    public String toString() {
+        return String.valueOf(this.code);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
new file mode 100644
index 0000000..634bc03
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
@@ -0,0 +1,207 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+public class ICMPv4Type implements OFValueType<ICMPv4Type> {
+    final static int LENGTH = 1;
+
+    private static final short VAL_ECHO_REPLY    = 0;
+    private static final short VAL_DESTINATION_UNREACHABLE   = 3;
+    private static final short VAL_SOURCE_QUENCH = 4;
+    private static final short VAL_REDIRECT  = 5;
+    private static final short VAL_ALTERNATE_HOST_ADDRESS    = 6;
+    private static final short VAL_ECHO  = 8;
+    private static final short VAL_ROUTER_ADVERTISEMENT  = 9;
+    private static final short VAL_ROUTER_SOLICITATION   = 10;
+    private static final short VAL_TIME_EXCEEDED = 11;
+    private static final short VAL_PARAMETER_PROBLEM = 12;
+    private static final short VAL_TIMESTAMP = 13;
+    private static final short VAL_TIMESTAMP_REPLY   = 14;
+    private static final short VAL_INFORMATION_REQUEST   = 15;
+    private static final short VAL_INFORMATION_REPLY = 16;
+    private static final short VAL_ADDRESS_MASK_REQUEST  = 17;
+    private static final short VAL_ADDRESS_MASK_REPLY    = 18;
+    private static final short VAL_TRACEROUTE    = 30;
+    private static final short VAL_DATAGRAM_CONVERSION_ERROR = 31;
+    private static final short VAL_MOBILE_HOST_REDIRECT  = 32;
+    private static final short VAL_IPV6_WHERE_ARE_YOU    = 33;
+    private static final short VAL_IPV6_I_AM_HERE    = 34;
+    private static final short VAL_MOBILE_REGISTRATION_REQUEST   = 35;
+    private static final short VAL_MOBILE_REGISTRATION_REPLY = 36;
+    private static final short VAL_DOMAIN_NAME_REQUEST   = 37;
+    private static final short VAL_DOMAIN_NAME_REPLY = 38;
+    private static final short VAL_SKIP  = 39;
+    private static final short VAL_PHOTURIS  = 40;
+    private static final short VAL_EXPERIMENTAL_MOBILITY = 41;
+
+    public static final ICMPv4Type ECHO_REPLY   = new ICMPv4Type(VAL_ECHO_REPLY);
+    public static final ICMPv4Type DESTINATION_UNREACHABLE  = new ICMPv4Type(VAL_DESTINATION_UNREACHABLE);
+    public static final ICMPv4Type SOURCE_QUENCH    = new ICMPv4Type(VAL_SOURCE_QUENCH);
+    public static final ICMPv4Type REDIRECT = new ICMPv4Type(VAL_REDIRECT);
+    public static final ICMPv4Type ALTERNATE_HOST_ADDRESS   = new ICMPv4Type(VAL_ALTERNATE_HOST_ADDRESS);
+    public static final ICMPv4Type ECHO = new ICMPv4Type(VAL_ECHO);
+    public static final ICMPv4Type ROUTER_ADVERTISEMENT = new ICMPv4Type(VAL_ROUTER_ADVERTISEMENT);
+    public static final ICMPv4Type ROUTER_SOLICITATION  = new ICMPv4Type(VAL_ROUTER_SOLICITATION);
+    public static final ICMPv4Type TIME_EXCEEDED    = new ICMPv4Type(VAL_TIME_EXCEEDED);
+    public static final ICMPv4Type PARAMETER_PROBLEM    = new ICMPv4Type(VAL_PARAMETER_PROBLEM);
+    public static final ICMPv4Type TIMESTAMP    = new ICMPv4Type(VAL_TIMESTAMP);
+    public static final ICMPv4Type TIMESTAMP_REPLY  = new ICMPv4Type(VAL_TIMESTAMP_REPLY);
+    public static final ICMPv4Type INFORMATION_REQUEST  = new ICMPv4Type(VAL_INFORMATION_REQUEST);
+    public static final ICMPv4Type INFORMATION_REPLY    = new ICMPv4Type(VAL_INFORMATION_REPLY);
+    public static final ICMPv4Type ADDRESS_MASK_REQUEST = new ICMPv4Type(VAL_ADDRESS_MASK_REQUEST);
+    public static final ICMPv4Type ADDRESS_MASK_REPLY   = new ICMPv4Type(VAL_ADDRESS_MASK_REPLY);
+    public static final ICMPv4Type TRACEROUTE   = new ICMPv4Type(VAL_TRACEROUTE);
+    public static final ICMPv4Type DATAGRAM_CONVERSION_ERROR    = new ICMPv4Type(VAL_DATAGRAM_CONVERSION_ERROR);
+    public static final ICMPv4Type MOBILE_HOST_REDIRECT = new ICMPv4Type(VAL_MOBILE_HOST_REDIRECT);
+    public static final ICMPv4Type IPV6_WHERE_ARE_YOU  = new ICMPv4Type(VAL_IPV6_WHERE_ARE_YOU);
+    public static final ICMPv4Type IPV6_I_AM_HERE = new ICMPv4Type(VAL_IPV6_I_AM_HERE);
+    public static final ICMPv4Type MOBILE_REGISTRATION_REQUEST  = new ICMPv4Type(VAL_MOBILE_REGISTRATION_REQUEST);
+    public static final ICMPv4Type MOBILE_REGISTRATION_REPLY    = new ICMPv4Type(VAL_MOBILE_REGISTRATION_REPLY);
+    public static final ICMPv4Type DOMAIN_NAME_REQUEST  = new ICMPv4Type(VAL_DOMAIN_NAME_REQUEST);
+    public static final ICMPv4Type DOMAIN_NAME_REPLY    = new ICMPv4Type(VAL_DOMAIN_NAME_REPLY);
+    public static final ICMPv4Type SKIP = new ICMPv4Type(VAL_SKIP);
+    public static final ICMPv4Type PHOTURIS = new ICMPv4Type(VAL_PHOTURIS);
+    public static final ICMPv4Type EXPERIMENTAL_MOBILITY    = new ICMPv4Type(VAL_EXPERIMENTAL_MOBILITY);
+
+    // HACK alert - we're disapproriating ECHO_REPLY (value 0) as 'none' as well
+    public static final ICMPv4Type NONE   = ECHO_REPLY;
+
+    public static final ICMPv4Type NO_MASK = new ICMPv4Type((short)0xFFFF);
+    public static final ICMPv4Type FULL_MASK = new ICMPv4Type((short)0x0000);
+
+    private final short type;
+
+    private static final int MIN_TYPE = 0;
+    private static final int MAX_TYPE = 0xFF;
+
+    private ICMPv4Type(short type) {
+        this.type = type;
+    }
+
+    public static ICMPv4Type of(short type) {
+        if (type < MIN_TYPE || type > MAX_TYPE)
+            throw new IllegalArgumentException("Invalid ICMPv4 type: " + type);
+        switch (type) {
+            case VAL_ECHO_REPLY:
+                return ECHO_REPLY;
+            case VAL_DESTINATION_UNREACHABLE:
+                return DESTINATION_UNREACHABLE;
+            case VAL_SOURCE_QUENCH:
+                return SOURCE_QUENCH;
+            case VAL_REDIRECT:
+                return REDIRECT;
+            case VAL_ALTERNATE_HOST_ADDRESS:
+                return ALTERNATE_HOST_ADDRESS;
+            case VAL_ECHO:
+                return ECHO;
+            case VAL_ROUTER_ADVERTISEMENT:
+                return ROUTER_ADVERTISEMENT;
+            case VAL_ROUTER_SOLICITATION:
+                return ROUTER_SOLICITATION;
+            case VAL_TIME_EXCEEDED:
+                return TIME_EXCEEDED;
+            case VAL_PARAMETER_PROBLEM:
+                return PARAMETER_PROBLEM;
+            case VAL_TIMESTAMP:
+                return TIMESTAMP;
+            case VAL_TIMESTAMP_REPLY:
+                return TIMESTAMP_REPLY;
+            case VAL_INFORMATION_REQUEST:
+                return INFORMATION_REQUEST;
+            case VAL_INFORMATION_REPLY:
+                return INFORMATION_REPLY;
+            case VAL_ADDRESS_MASK_REQUEST:
+                return ADDRESS_MASK_REQUEST;
+            case VAL_ADDRESS_MASK_REPLY:
+                return ADDRESS_MASK_REPLY;
+            case VAL_TRACEROUTE:
+                return TRACEROUTE;
+            case VAL_DATAGRAM_CONVERSION_ERROR:
+                return DATAGRAM_CONVERSION_ERROR;
+            case VAL_MOBILE_HOST_REDIRECT:
+                return MOBILE_HOST_REDIRECT;
+            case VAL_IPV6_WHERE_ARE_YOU:
+                return IPV6_WHERE_ARE_YOU;
+            case VAL_IPV6_I_AM_HERE:
+                return IPV6_I_AM_HERE;
+            case VAL_MOBILE_REGISTRATION_REQUEST:
+                return MOBILE_REGISTRATION_REQUEST;
+            case VAL_MOBILE_REGISTRATION_REPLY:
+                return MOBILE_REGISTRATION_REPLY;
+            case VAL_DOMAIN_NAME_REQUEST:
+                return DOMAIN_NAME_REQUEST;
+            case VAL_DOMAIN_NAME_REPLY:
+                return DOMAIN_NAME_REPLY;
+            case VAL_SKIP:
+                return SKIP;
+            case VAL_PHOTURIS:
+                return PHOTURIS;
+            case VAL_EXPERIMENTAL_MOBILITY:
+                return EXPERIMENTAL_MOBILITY;
+            default:
+                return new ICMPv4Type(type);
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public short getType() {
+        return type;
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.type);
+    }
+
+    public static ICMPv4Type readByte(ChannelBuffer c) {
+        return ICMPv4Type.of(c.readUnsignedByte());
+    }
+
+    @Override
+    public ICMPv4Type applyMask(ICMPv4Type mask) {
+        return ICMPv4Type.of((short)(this.type & mask.type));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + type;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ICMPv4Type other = (ICMPv4Type) obj;
+        if (type != other.type)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int compareTo(ICMPv4Type o) {
+        return Shorts.compare(type, o.type);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort(type);
+    }
+
+    @Override
+    public String toString() {
+        return String.valueOf(this.type);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
new file mode 100644
index 0000000..cee9ad1
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPAddress.java
@@ -0,0 +1,164 @@
+package org.projectfloodlight.openflow.types;
+
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+
+import javax.annotation.Nonnull;
+
+import com.google.common.base.Preconditions;
+
+public abstract class IPAddress<F extends IPAddress<F>> implements OFValueType<F> {
+
+    /**
+     * Returns the Internet Protocol (IP) version of this object
+     *
+     * @return  the Internet Protocol (IP) version of this object
+     */
+    public abstract IPVersion getIpVersion();
+
+    /**
+     * Checks if this IPAddress represents a valid CIDR style netmask, i.e.,
+     * it has a set of leading "1" bits followed by only "0" bits
+     * @return true if this represents a valid CIDR style netmask, false
+     * otherwise
+     */
+    public abstract boolean isCidrMask();
+
+    /**
+     * If this IPAddress represents a valid CIDR style netmask (see
+     * isCidrMask()) returns the length of the prefix (the number of "1" bits).
+     * @return length of CIDR mask if this represents a valid CIDR mask
+     * @throws IllegalStateException if isCidrMask() == false
+     */
+    public abstract int asCidrMaskLength();
+
+    /**
+     * Checks if the IPAddress is the global broadcast address
+     * 255.255.255.255 in case of IPv4
+     * @return boolean true or false
+     */
+    public abstract boolean isBroadcast();
+
+    /**
+     * Perform a low level AND operation on the bits of two IPAddress<?> objects
+     * @param   other IPAddress<?>
+     * @return  new IPAddress<?> object after the AND oper
+     */
+    public abstract F and(F other);
+
+    /**
+     * Perform a low level OR operation on the bits of two IPAddress<?> objects
+     * @param   other IPAddress<?>
+     * @return  new IPAddress<?> object after the AND oper
+     */
+    public abstract F or(F other);
+
+    /**
+     * Returns a new IPAddress object with the bits inverted
+     * @return  IPAddress<?>
+     */
+    public abstract F not();
+
+    /**
+     * Returns an {@code IPAddressWithMask<F>} object that represents this
+     * IP address masked by the given IP address mask.
+     *
+     * @param mask  the {@code F} object that represents the mask
+     * @return      an {@code IPAddressWithMask<F>} object that represents this
+     *              IP address masked by the given mask
+     * @throws NullPointerException  if the given mask was {@code null}
+     */
+    @Nonnull
+    public abstract IPAddressWithMask<F> withMask(@Nonnull final F mask);
+
+    /**
+     * Returns an {@code IPAddressWithMask<F>} object that represents this
+     * IP address masked by the CIDR subnet mask of the given prefix length.
+     *
+     * @param cidrMaskLength  the prefix length of the CIDR subnet mask
+     *                        (i.e. the number of leading one-bits),
+     *                        where <code>
+     *                        0 <= cidrMaskLength <= (F.getLength() * 8)
+     *                        </code>
+     * @return                an {@code IPAddressWithMask<F>} object that
+     *                        represents this IP address masked by the CIDR
+     *                        subnet mask of the given prefix length
+     * @throws IllegalArgumentException  if the given prefix length was invalid
+     * @see #ofCidrMaskLength(int)
+     */
+    @Nonnull
+    public abstract IPAddressWithMask<F> withMaskOfLength(
+            final int cidrMaskLength);
+
+    /**
+     * Returns the raw IP address of this {@code IPAddress} object. The result
+     * is in network byte order: the highest order byte of the address is in
+     * {@code getBytes()[0]}.
+     * <p>
+     * Similar to {@link InetAddress#getAddress()}
+     *
+     * @return  the raw IP address of this object
+     * @see InetAddress#getAddress()
+     */
+    public abstract byte[] getBytes();
+
+    @Override
+    public abstract String toString();
+
+    @Override
+    public abstract boolean equals(Object other);
+
+    @Override
+    public abstract int hashCode();
+
+    /** parse an IPv4Address or IPv6Address from their conventional string representation.
+     *  For details on supported representations,  refer to {@link IPv4Address#of(String)}
+     *  and {@link IPv6Address#of(String)}
+     *
+     * @param ip a string representation of an IP address
+     * @return the parsed IP address
+     * @throws NullPointerException if ip is null
+     * @throws IllegalArgumentException if string is not a valid IP address
+     */
+    @Nonnull
+    public static IPAddress<?> of(@Nonnull String ip) {
+        Preconditions.checkNotNull(ip, "ip must not be null");
+        if (ip.indexOf('.') != -1)
+            return IPv4Address.of(ip);
+        else if (ip.indexOf(':') != -1)
+            return IPv6Address.of(ip);
+        else
+            throw new IllegalArgumentException("IP Address not well formed: " + ip);
+    }
+
+    /**
+     * Factory function for InetAddress values.
+     * @param address the InetAddress you wish to parse into an IPAddress object.
+     * @return the IPAddress object.
+     * @throws NullPointerException if address is null
+     */
+    @Nonnull
+    public static IPAddress<?> of(@Nonnull InetAddress address) {
+        Preconditions.checkNotNull(address, "address must not be null");
+        if(address instanceof Inet4Address)
+            return IPv4Address.of((Inet4Address) address);
+        else if (address instanceof Inet6Address)
+            return IPv6Address.of((Inet6Address) address);
+        else
+            return IPAddress.of(address.getHostAddress());
+    }
+
+    /**
+     * Factory function for InetAddress values.
+     * @param address the InetAddress you wish to parse into an IPAddress object.
+     * @return the IPAddress object.
+     * @throws NullPointerException if address is null
+     * @deprecated  replaced by {@link #of(InetAddress)}
+     */
+    @Deprecated
+    @Nonnull
+    public static IPAddress<?> fromInetAddress(@Nonnull InetAddress address) {
+        return of(address);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
new file mode 100644
index 0000000..7cd8099
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPAddressWithMask.java
@@ -0,0 +1,55 @@
+package org.projectfloodlight.openflow.types;
+
+import com.google.common.base.Preconditions;
+
+
+public abstract class IPAddressWithMask<F extends IPAddress<F>> extends Masked<F> {
+
+    protected IPAddressWithMask(F value, F mask) {
+        super(value, mask);
+    }
+
+    public abstract IPVersion getIpVersion();
+    
+    public abstract boolean contains(IPAddress<?> ip);
+
+    public F getSubnetBroadcastAddress() {
+        if (!mask.isCidrMask()) {
+            throw new IllegalArgumentException("Mask Invalid " + mask +
+                                               " cannot get subnet for non CIDR mask");
+        }
+        return value.or(mask.not());
+    }
+
+    public boolean isSubnetBroadcastAddress(F candidate) {
+        return getSubnetBroadcastAddress().equals(candidate);
+    }
+
+    public static IPAddressWithMask<?> of(String ip) {
+        Preconditions.checkNotNull(ip, "string ip must not be null");
+
+        if (ip.indexOf('.') != -1)
+            return IPv4AddressWithMask.of(ip);
+        else if (ip.indexOf(':') != -1)
+            return IPv6AddressWithMask.of(ip);
+        else
+            throw new IllegalArgumentException("IP Address not well formed: " + ip);
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder res = new StringBuilder();
+        res.append(value.toString());
+
+        res.append('/');
+        if (mask.isCidrMask()) {
+            // CIDR notation
+            res.append(mask.asCidrMaskLength());
+        } else {
+            // Full address mask
+            res.append(mask.toString());
+        }
+
+        return res.toString();
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPVersion.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPVersion.java
new file mode 100644
index 0000000..5bfc6d8
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPVersion.java
@@ -0,0 +1,6 @@
+package org.projectfloodlight.openflow.types;
+
+public enum IPVersion {
+    IPv4,
+    IPv6
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
new file mode 100644
index 0000000..3a1b15e
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
@@ -0,0 +1,348 @@
+package org.projectfloodlight.openflow.types;
+
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.util.Arrays;
+
+import javax.annotation.Nonnull;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.base.Preconditions;
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+
+
+/**
+ * Wrapper around an IPv4Address address
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+public class IPv4Address extends IPAddress<IPv4Address> {
+    static final int LENGTH = 4;
+    private final int rawValue;
+
+    private static final int NOT_A_CIDR_MASK = -1;
+    private static final int CIDR_MASK_CACHE_UNSET = -2;
+    // Must appear before the static IPv4Address constant assignments
+    private volatile int cidrMaskLengthCache = CIDR_MASK_CACHE_UNSET;
+
+    private final static int NONE_VAL = 0x0;
+    public final static IPv4Address NONE = new IPv4Address(NONE_VAL);
+
+    public static final IPv4Address NO_MASK = IPv4Address.of(0xFFFFFFFF);
+    public static final IPv4Address FULL_MASK = IPv4Address.of(0x00000000);
+
+    private IPv4Address(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    @Override
+    public IPVersion getIpVersion() {
+        return IPVersion.IPv4;
+    }
+
+    private int asCidrMaskLengthInternal() {
+        if (cidrMaskLengthCache == CIDR_MASK_CACHE_UNSET) {
+            // No lock required. We only write cidrMaskLengthCache once
+            int maskint = getInt();
+            if (maskint == 0) {
+                cidrMaskLengthCache = 0;
+            } else if (Integer.bitCount((~maskint) + 1) == 1) {
+                // IP represents a true CIDR prefix length
+                cidrMaskLengthCache = Integer.bitCount(maskint);
+            } else {
+                cidrMaskLengthCache = NOT_A_CIDR_MASK;
+            }
+        }
+        return cidrMaskLengthCache;
+    }
+
+    @Override
+    public boolean isCidrMask() {
+        return asCidrMaskLengthInternal() != NOT_A_CIDR_MASK;
+    }
+
+    @Override
+    public int asCidrMaskLength() {
+        if (!isCidrMask()) {
+            throw new IllegalStateException("IP is not a valid CIDR prefix " +
+                    "mask " + toString());
+        } else {
+            return asCidrMaskLengthInternal();
+        }
+    }
+
+    @Override
+    public boolean isBroadcast() {
+        return this.equals(NO_MASK);
+    }
+
+    @Override
+    public IPv4Address and(IPv4Address other) {
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv4Address otherIp = other;
+        return IPv4Address.of(rawValue & otherIp.rawValue);
+    }
+
+    @Override
+    public IPv4Address or(IPv4Address other) {
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv4Address otherIp = other;
+        return IPv4Address.of(rawValue | otherIp.rawValue);
+    }
+
+    @Override
+    public IPv4Address not() {
+        return IPv4Address.of(~rawValue);
+    }
+
+    /**
+     * Returns an {@code IPv4Address} object that represents the given
+     * IP address. The argument is in network byte order: the highest
+     * order byte of the address is in {@code address[0]}.
+     * <p>
+     * The address byte array must be 4 bytes long (32 bits long).
+     * <p>
+     * Similar to {@link InetAddress#getByAddress(byte[])}.
+     *
+     * @param address  the raw IP address in network byte order
+     * @return         an {@code IPv4Address} object that represents the given
+     *                 raw IP address
+     * @throws NullPointerException      if the given address was {@code null}
+     * @throws IllegalArgumentException  if the given address was of an invalid
+     *                                   byte array length
+     * @see InetAddress#getByAddress(byte[])
+     */
+    @Nonnull
+    public static IPv4Address of(@Nonnull final byte[] address) {
+        Preconditions.checkNotNull(address, "address must not be null");
+
+        if (address.length != LENGTH) {
+            throw new IllegalArgumentException(
+                    "Invalid byte array length for IPv4 address: " + address.length);
+        }
+
+        int raw =
+                (address[0] & 0xFF) << 24 | (address[1] & 0xFF) << 16
+                        | (address[2] & 0xFF) << 8 | (address[3] & 0xFF) << 0;
+        return IPv4Address.of(raw);
+    }
+
+    /**
+     * Returns an {@code IPv4Address} object that represents the given
+     * IP address.
+     *
+     * @param raw  the raw IP address represented as a 32-bit integer
+     * @return     an {@code IPv4Address} object that represents the given
+     *             raw IP address
+     */
+    @Nonnull
+    public static IPv4Address of(final int raw) {
+        if(raw == NONE_VAL)
+            return NONE;
+        return new IPv4Address(raw);
+    }
+
+    /**
+     * Returns an {@code IPv4Address} object that represents the given
+     * IP address. The argument is in the canonical quad-dotted notation.
+     * For example, {@code 1.2.3.4}.
+     *
+     * @param string  the IP address in the canonical quad-dotted notation
+     * @return        an {@code IPv4Address} object that represents the given
+     *                IP address
+     * @throws NullPointerException      if the given string was {@code null}
+     * @throws IllegalArgumentException  if the given string was not a valid
+     *                                   IPv4 address
+     */
+    @Nonnull
+    public static IPv4Address of(@Nonnull final String string) throws IllegalArgumentException {
+        Preconditions.checkNotNull(string, "string must not be null");
+
+        int start = 0;
+        int shift = 24;
+
+        int raw = 0;
+        while (shift >= 0) {
+            int end = string.indexOf('.', start);
+            if (end == start || !((shift > 0) ^ (end < 0)))
+                throw new IllegalArgumentException("IP Address not well formed: " + string);
+
+            String substr =
+                    end > 0 ? string.substring(start, end) : string.substring(start);
+            int val = Integer.parseInt(substr);
+            if (val < 0 || val > 255)
+                throw new IllegalArgumentException("IP Address not well formed: " + string);
+
+            raw |= val << shift;
+
+            shift -= 8;
+            start = end + 1;
+        }
+        return IPv4Address.of(raw);
+    }
+
+    /**
+     * Returns an {@code IPv4Address} object that represents the given
+     * IP address. The argument is given as an {@code Inet4Address} object.
+     *
+     * @param address  the IP address as an {@code Inet4Address} object
+     * @return         an {@code IPv4Address} object that represents the
+     *                 given IP address
+     * @throws NullPointerException  if the given {@code Inet4Address} was
+     *                               {@code null}
+     */
+    @Nonnull
+    public static IPv4Address of(@Nonnull final Inet4Address address) {
+        Preconditions.checkNotNull(address, "address must not be null");
+        return IPv4Address.of(address.getAddress());
+    }
+
+    /**
+     * Returns an {@code IPv4Address} object that represents the
+     * CIDR subnet mask of the given prefix length.
+     *
+     * @param cidrMaskLength  the prefix length of the CIDR subnet mask
+     *                        (i.e. the number of leading one-bits),
+     *                        where {@code 0 <= cidrMaskLength <= 32}
+     * @return                an {@code IPv4Address} object that represents the
+     *                        CIDR subnet mask of the given prefix length
+     * @throws IllegalArgumentException  if the given prefix length was invalid
+     */
+    @Nonnull
+    public static IPv4Address ofCidrMaskLength(final int cidrMaskLength) {
+        Preconditions.checkArgument(
+                cidrMaskLength >= 0 && cidrMaskLength <= 32,
+                "Invalid IPv4 CIDR mask length: %s", cidrMaskLength);
+
+        if (cidrMaskLength == 32) {
+            return IPv4Address.NO_MASK;
+        } else if (cidrMaskLength == 0) {
+            return IPv4Address.FULL_MASK;
+        } else {
+            int mask = (-1) << (32 - cidrMaskLength);
+            return IPv4Address.of(mask);
+        }
+    }
+
+    /**
+     * Returns an {@code IPv4AddressWithMask} object that represents this
+     * IP address masked by the given IP address mask.
+     *
+     * @param mask  the {@code IPv4Address} object that represents the mask
+     * @return      an {@code IPv4AddressWithMask} object that represents this
+     *              IP address masked by the given mask
+     * @throws NullPointerException  if the given mask was {@code null}
+     */
+    @Nonnull
+    @Override
+    public IPv4AddressWithMask withMask(@Nonnull final IPv4Address mask) {
+        return IPv4AddressWithMask.of(this, mask);
+    }
+
+    /**
+     * Returns an {@code IPv4AddressWithMask} object that represents this
+     * IP address masked by the CIDR subnet mask of the given prefix length.
+     *
+     * @param cidrMaskLength  the prefix length of the CIDR subnet mask
+     *                        (i.e. the number of leading one-bits),
+     *                        where {@code 0 <= cidrMaskLength <= 32}
+     * @return                an {@code IPv4AddressWithMask} object that
+     *                        represents this IP address masked by the CIDR
+     *                        subnet mask of the given prefix length
+     * @throws IllegalArgumentException  if the given prefix length was invalid
+     * @see #ofCidrMaskLength(int)
+     */
+    @Nonnull
+    @Override
+    public IPv4AddressWithMask withMaskOfLength(final int cidrMaskLength) {
+        return this.withMask(IPv4Address.ofCidrMaskLength(cidrMaskLength));
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    private volatile byte[] bytesCache = null;
+
+    @Override
+    public byte[] getBytes() {
+        if (bytesCache == null) {
+            synchronized (this) {
+                if (bytesCache == null) {
+                    bytesCache =
+                            new byte[] { (byte) ((rawValue >>> 24) & 0xFF),
+                                    (byte) ((rawValue >>> 16) & 0xFF),
+                                    (byte) ((rawValue >>> 8) & 0xFF),
+                                    (byte) ((rawValue >>> 0) & 0xFF) };
+                }
+            }
+        }
+        return Arrays.copyOf(bytesCache, bytesCache.length);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder res = new StringBuilder();
+        res.append((rawValue >> 24) & 0xFF).append('.');
+        res.append((rawValue >> 16) & 0xFF).append('.');
+        res.append((rawValue >> 8) & 0xFF).append('.');
+        res.append((rawValue >> 0) & 0xFF);
+        return res.toString();
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+
+    public static IPv4Address read4Bytes(ChannelBuffer c) {
+        return IPv4Address.of(c.readInt());
+    }
+
+    @Override
+    public IPv4Address applyMask(IPv4Address mask) {
+        return and(mask);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        IPv4Address other = (IPv4Address) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int compareTo(IPv4Address o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
new file mode 100644
index 0000000..b6dc1b9
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv4AddressWithMask.java
@@ -0,0 +1,139 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.Nonnull;
+
+import com.google.common.base.Preconditions;
+
+
+public class IPv4AddressWithMask extends IPAddressWithMask<IPv4Address> {
+    public final static IPv4AddressWithMask NONE = of(IPv4Address.NONE, IPv4Address.NONE);
+
+    private IPv4AddressWithMask(int rawValue, int rawMask) {
+        super(IPv4Address.of(rawValue), IPv4Address.of(rawMask));
+    }
+
+    private IPv4AddressWithMask(IPv4Address value, IPv4Address mask) {
+        super(value, mask);
+    }
+
+    @Override
+    public IPVersion getIpVersion() {
+        return IPVersion.IPv4;
+    }
+
+    /**
+     * Returns an {@code IPv4AddressWithMask} object that represents the given
+     * raw IP address masked by the given raw IP address mask.
+     *
+     * @param rawValue  the raw IP address to be masked
+     * @param rawMask   the raw IP address mask
+     * @return          an {@code IPv4AddressWithMask} object that represents
+     *                  the given raw IP address masked by the given raw IP
+     *                  address mask
+     * @deprecated      replaced by {@link IPv4Address#of(int)} and
+     *                  {@link IPv4Address#withMask(IPv4Address), e.g. <code>
+     *                  IPv4Address.of(int).withMask(IPv4Address.of(int))
+     *                  </code>
+     */
+    @Nonnull
+    @Deprecated
+    public static IPv4AddressWithMask of(final int rawValue, final int rawMask) {
+        return new IPv4AddressWithMask(rawValue, rawMask);
+    }
+
+    /**
+     * Returns an {@code IPv4AddressWithMask} object that represents the given
+     * IP address masked by the given IP address mask. Both arguments are given
+     * as {@code IPv4Address} objects.
+     *
+     * @param value  the IP address to be masked
+     * @param mask   the IP address mask
+     * @return       an {@code IPv4AddressWithMask} object that represents
+     *               the given IP address masked by the given IP address mask
+     * @throws NullPointerException  if any of the given {@code IPv4Address}
+     *                               objects were {@code null}
+     */
+    @Nonnull
+    public static IPv4AddressWithMask of(
+            @Nonnull final IPv4Address value,
+            @Nonnull final IPv4Address mask) {
+        Preconditions.checkNotNull(value, "value must not be null");
+        Preconditions.checkNotNull(mask, "mask must not be null");
+
+        return new IPv4AddressWithMask(value, mask);
+    }
+
+    /**
+     * Returns an {@code IPv4AddressWithMask} object that corresponds to
+     * the given string in CIDR notation or other acceptable notations.
+     * <p>
+     * The following notations are accepted.
+     * <table><tr>
+     * <th>Notation</th><th>Example</th><th>Notes</th>
+     * </tr><tr>
+     * <td>IPv4 address only</td><td>{@code 1.2.3.4}</td><td>The subnet mask of
+     * prefix length 32 (i.e. {@code 255.255.255.255}) is assumed.</td>
+     * </tr><tr>
+     * <td>IPv4 address/mask</td><td>{@code 1.2.3.4/255.255.255.0}</td>
+     * </tr><tr>
+     * <td>CIDR notation</td><td>{@code 1.2.3.4/24}</td>
+     * </tr></table>
+     *
+     * @param string  the string in acceptable notations
+     * @return        an {@code IPv4AddressWithMask} object that corresponds to
+     *                the given string in acceptable notations
+     * @throws NullPointerException      if the given string was {@code null}
+     * @throws IllegalArgumentException  if the given string was malformed
+     */
+    @Nonnull
+    public static IPv4AddressWithMask of(@Nonnull final String string) {
+        Preconditions.checkNotNull(string, "string must not be null");
+
+        int slashPos;
+        String ip = string;
+        int cidrMaskLength = 32;
+        IPv4Address maskAddress = null;
+
+        // Read mask suffix
+        if ((slashPos = string.indexOf('/')) != -1) {
+            ip = string.substring(0, slashPos);
+            try {
+                String suffix = string.substring(slashPos + 1);
+                if (suffix.length() == 0)
+                    throw new IllegalArgumentException("IP Address not well formed: " + string);
+                if (suffix.indexOf('.') != -1) {
+                    // Full mask
+                    maskAddress = IPv4Address.of(suffix);
+                } else {
+                    // CIDR Suffix
+                    cidrMaskLength = Integer.parseInt(suffix);
+                }
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("IP Address not well formed: " + string);
+            }
+        }
+
+        // Read IP
+        IPv4Address ipv4 = IPv4Address.of(ip);
+
+        if (maskAddress != null) {
+            // Full address mask
+            return IPv4AddressWithMask.of(ipv4, maskAddress);
+        } else {
+            return IPv4AddressWithMask.of(
+                    ipv4, IPv4Address.ofCidrMaskLength(cidrMaskLength));
+        }
+    }
+
+    @Override
+    public boolean contains(IPAddress<?> ip) {
+        Preconditions.checkNotNull(ip, "ip must not be null");
+
+        if(ip.getIpVersion() == IPVersion.IPv4) {
+            IPv4Address ipv4 = (IPv4Address) ip;
+            return this.matches(ipv4);
+        }
+
+        return false;
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
new file mode 100644
index 0000000..471d0fb
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -0,0 +1,541 @@
+package org.projectfloodlight.openflow.types;
+
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.util.Arrays;
+import java.util.regex.Pattern;
+
+import javax.annotation.Nonnull;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.base.Preconditions;
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Longs;
+
+/**
+ * IPv6 address object. Instance controlled, immutable. Internal representation:
+ * two 64 bit longs (not that you'd have to know).
+ *
+ * @author Andreas Wundsam <andreas.wundsam@teleteach.de>
+ */
+public class IPv6Address extends IPAddress<IPv6Address> {
+    static final int LENGTH = 16;
+    private final long raw1;
+    private final long raw2;
+
+    private static final int NOT_A_CIDR_MASK = -1;
+    private static final int CIDR_MASK_CACHE_UNSET = -2;
+    // Must appear before the static IPv4Address constant assignments
+    private volatile int cidrMaskLengthCache = CIDR_MASK_CACHE_UNSET;
+
+    private final static long NONE_VAL1 = 0x0L;
+    private final static long NONE_VAL2 = 0x0L;
+    public static final IPv6Address NONE = new IPv6Address(NONE_VAL1, NONE_VAL2);
+
+
+    public static final IPv6Address NO_MASK = IPv6Address.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
+    public static final IPv6Address FULL_MASK = IPv6Address.of(0x0, 0x0);
+
+    private IPv6Address(final long raw1, final long raw2) {
+        this.raw1 = raw1;
+        this.raw2 = raw2;
+    }
+
+    @Override
+    public IPVersion getIpVersion() {
+        return IPVersion.IPv6;
+    }
+
+
+    private int computeCidrMask64(long raw) {
+        long mask = raw;
+        if (raw == 0)
+            return 0;
+        else if (Long.bitCount((~mask) + 1) == 1) {
+            // represent a true CIDR prefix length
+            return Long.bitCount(mask);
+        }
+        else {
+            // Not a true prefix
+            return NOT_A_CIDR_MASK;
+        }
+    }
+
+    private int asCidrMaskLengthInternal() {
+        if (cidrMaskLengthCache == CIDR_MASK_CACHE_UNSET) {
+            // No synchronization needed. Writing cidrMaskLengthCache only once
+            if (raw1 == 0 && raw2 == 0) {
+                cidrMaskLengthCache = 0;
+            } else if (raw1 == -1L) {
+                // top half is all 1 bits
+                int tmpLength = computeCidrMask64(raw2);
+                if (tmpLength != NOT_A_CIDR_MASK)
+                    tmpLength += 64;
+                cidrMaskLengthCache = tmpLength;
+            } else if (raw2 == 0) {
+                cidrMaskLengthCache = computeCidrMask64(raw1);
+            } else {
+                cidrMaskLengthCache = NOT_A_CIDR_MASK;
+            }
+        }
+        return cidrMaskLengthCache;
+    }
+
+    @Override
+    public boolean isCidrMask() {
+        return asCidrMaskLengthInternal() != NOT_A_CIDR_MASK;
+    }
+
+    @Override
+    public int asCidrMaskLength() {
+        if (!isCidrMask()) {
+            throw new IllegalStateException("IP is not a valid CIDR prefix " +
+                    "mask " + toString());
+        } else {
+            return asCidrMaskLengthInternal();
+        }
+    }
+
+    @Override
+    public boolean isBroadcast() {
+        return this.equals(NO_MASK);
+    }
+
+    @Override
+    public IPv6Address and(IPv6Address other) {
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv6Address otherIp = other;
+        return IPv6Address.of((raw1 & otherIp.raw1), (raw2 & otherIp.raw2));
+    }
+
+    @Override
+    public IPv6Address or(IPv6Address other) {
+        Preconditions.checkNotNull(other, "other must not be null");
+
+        IPv6Address otherIp = other;
+        return IPv6Address.of((raw1 | otherIp.raw1), (raw2 | otherIp.raw2));
+    }
+
+    @Override
+    public IPv6Address not() {
+        return IPv6Address.of(~raw1, ~raw2);
+    }
+
+    /**
+     * Returns an {@code IPv6Address} object that represents the given
+     * IP address. The argument is in network byte order: the highest
+     * order byte of the address is in {@code address[0]}.
+     * <p>
+     * The address byte array must be 16 bytes long (128 bits long).
+     * <p>
+     * Similar to {@link InetAddress#getByAddress(byte[])}.
+     *
+     * @param address  the raw IP address in network byte order
+     * @return         an {@code IPv6Address} object that represents the given
+     *                 raw IP address
+     * @throws NullPointerException      if the given address was {@code null}
+     * @throws IllegalArgumentException  if the given address was of an invalid
+     *                                   byte array length
+     * @see InetAddress#getByAddress(byte[])
+     */
+    @Nonnull
+    public static IPv6Address of(@Nonnull final byte[] address) {
+        Preconditions.checkNotNull(address, "address must not be null");
+
+        if (address.length != LENGTH) {
+            throw new IllegalArgumentException(
+                    "Invalid byte array length for IPv6 address: " + address.length);
+        }
+
+        long raw1 =
+                (address[0] & 0xFFL) << 56 | (address[1] & 0xFFL) << 48
+                        | (address[2] & 0xFFL) << 40 | (address[3] & 0xFFL) << 32
+                        | (address[4] & 0xFFL) << 24 | (address[5] & 0xFFL) << 16
+                        | (address[6] & 0xFFL) << 8 | (address[7]);
+
+        long raw2 =
+                (address[8] & 0xFFL) << 56 | (address[9] & 0xFFL) << 48
+                        | (address[10] & 0xFFL) << 40 | (address[11] & 0xFFL) << 32
+                        | (address[12] & 0xFFL) << 24 | (address[13] & 0xFFL) << 16
+                        | (address[14] & 0xFFL) << 8 | (address[15]);
+
+        return IPv6Address.of(raw1, raw2);
+    }
+
+    private static class IPv6Builder {
+        private long raw1, raw2;
+
+        public void setUnsignedShortWord(final int i, final int value) {
+            int shift = 48 - (i % 4) * 16;
+
+            if (value < 0 || value > 0xFFFF)
+                throw new IllegalArgumentException("16 bit word must be in [0, 0xFFFF]");
+
+            if (i >= 0 && i < 4)
+                raw1 = raw1 & ~(0xFFFFL << shift) | (value & 0xFFFFL) << shift;
+            else if (i >= 4 && i < 8)
+                raw2 = raw2 & ~(0xFFFFL << shift) | (value & 0xFFFFL) << shift;
+            else
+                throw new IllegalArgumentException("16 bit word index must be in [0,7]");
+        }
+
+        public IPv6Address getIPv6() {
+            return IPv6Address.of(raw1, raw2);
+        }
+    }
+
+    private final static Pattern colonPattern = Pattern.compile(":");
+
+    /**
+     * Returns an {@code IPv6Address} object that represents the given
+     * IP address. The argument is in the conventional string representation
+     * of IPv6 addresses.
+     * <p>
+     * Expects up to 8 groups of 16-bit hex words seperated by colons
+     * (e.g., 2001:db8:85a3:8d3:1319:8a2e:370:7348).
+     * <p>
+     * Supports zero compression (e.g., 2001:db8::7348).
+     * Does <b>not</b> currently support embedding a dotted-quad IPv4 address
+     * into the IPv6 address (e.g., 2001:db8::192.168.0.1).
+     *
+     * @param string  the IP address in the conventional string representation
+     *                of IPv6 addresses
+     * @return        an {@code IPv6Address} object that represents the given
+     *                IP address
+     * @throws NullPointerException      if the given string was {@code null}
+     * @throws IllegalArgumentException  if the given string was not a valid
+     *                                   IPv6 address
+     */
+    @Nonnull
+    public static IPv6Address of(@Nonnull final String string) throws IllegalArgumentException {
+        Preconditions.checkNotNull(string, "string must not be null");
+
+        IPv6Builder builder = new IPv6Builder();
+        String[] parts = colonPattern.split(string, -1);
+
+        int leftWord = 0;
+        int leftIndex = 0;
+
+        boolean hitZeroCompression = false;
+
+        for (leftIndex = 0; leftIndex < parts.length; leftIndex++) {
+            String part = parts[leftIndex];
+            if (part.length() == 0) {
+                // hit empty group of zero compression
+                hitZeroCompression = true;
+                break;
+            }
+            builder.setUnsignedShortWord(leftWord++, Integer.parseInt(part, 16));
+        }
+
+        if (hitZeroCompression) {
+            if (leftIndex == 0) {
+                // if colon is at the start, two columns must be at the start,
+                // move to the second empty group
+                leftIndex = 1;
+                if (parts.length < 2 || parts[1].length() > 0)
+                    throw new IllegalArgumentException("Malformed IPv6 address: " + string);
+            }
+
+            int rightWord = 7;
+            int rightIndex;
+            for (rightIndex = parts.length - 1; rightIndex > leftIndex; rightIndex--) {
+                String part = parts[rightIndex];
+                if (part.length() == 0)
+                    break;
+                builder.setUnsignedShortWord(rightWord--, Integer.parseInt(part, 16));
+            }
+            if (rightIndex == parts.length - 1) {
+                // if colon is at the end, two columns must be at the end, move
+                // to the second empty group
+                if (rightIndex < 1 || parts[rightIndex - 1].length() > 0)
+                    throw new IllegalArgumentException("Malformed IPv6 address: " + string);
+                rightIndex--;
+            }
+            if (leftIndex != rightIndex)
+                throw new IllegalArgumentException("Malformed IPv6 address: " + string);
+        } else {
+            if (leftIndex != 8) {
+                throw new IllegalArgumentException("Malformed IPv6 address: " + string);
+            }
+        }
+        return builder.getIPv6();
+    }
+
+    /**
+     * Returns an {@code IPv6Address} object that represents the given
+     * IP address. The arguments are the two 64-bit integers representing
+     * the first (higher-order) and second (lower-order) 64-bit blocks
+     * of the IP address.
+     *
+     * @param raw1  the first (higher-order) 64-bit block of the IP address
+     * @param raw2  the second (lower-order) 64-bit block of the IP address
+     * @return      an {@code IPv6Address} object that represents the given
+     *              raw IP address
+     */
+    @Nonnull
+    public static IPv6Address of(final long raw1, final long raw2) {
+        if(raw1==NONE_VAL1 && raw2 == NONE_VAL2)
+            return NONE;
+        return new IPv6Address(raw1, raw2);
+    }
+
+    /**
+     * Returns an {@code IPv6Address} object that represents the given
+     * IP address. The argument is given as an {@code Inet6Address} object.
+     *
+     * @param address  the IP address as an {@code Inet6Address} object
+     * @return         an {@code IPv6Address} object that represents the
+     *                 given IP address
+     * @throws NullPointerException  if the given {@code Inet6Address} was
+     *                               {@code null}
+     */
+    @Nonnull
+    public static IPv6Address of(@Nonnull final Inet6Address address) {
+        Preconditions.checkNotNull(address, "address must not be null");
+        return IPv6Address.of(address.getAddress());
+    }
+
+    /**
+     * Returns an {@code IPv6Address} object that represents the
+     * CIDR subnet mask of the given prefix length.
+     *
+     * @param cidrMaskLength  the prefix length of the CIDR subnet mask
+     *                        (i.e. the number of leading one-bits),
+     *                        where {@code 0 <= cidrMaskLength <= 128}
+     * @return                an {@code IPv6Address} object that represents the
+     *                        CIDR subnet mask of the given prefix length
+     * @throws IllegalArgumentException  if the given prefix length was invalid
+     */
+    @Nonnull
+    public static IPv6Address ofCidrMaskLength(final int cidrMaskLength) {
+        Preconditions.checkArgument(
+                cidrMaskLength >= 0 && cidrMaskLength <= 128,
+                "Invalid IPv6 CIDR mask length: %s", cidrMaskLength);
+
+        if (cidrMaskLength == 128) {
+            return IPv6Address.NO_MASK;
+        } else if (cidrMaskLength == 0) {
+            return IPv6Address.FULL_MASK;
+        } else {
+            int shift1 = Math.min(cidrMaskLength, 64);
+            long raw1 = shift1 == 0 ? 0 : -1L << (64 - shift1);
+            int shift2 = Math.max(cidrMaskLength - 64, 0);
+            long raw2 = shift2 == 0 ? 0 : -1L << (64 - shift2);
+            return IPv6Address.of(raw1, raw2);
+        }
+    }
+
+    /**
+     * Returns an {@code IPv6AddressWithMask} object that represents this
+     * IP address masked by the given IP address mask.
+     *
+     * @param mask  the {@code IPv6Address} object that represents the mask
+     * @return      an {@code IPv6AddressWithMask} object that represents this
+     *              IP address masked by the given mask
+     * @throws NullPointerException  if the given mask was {@code null}
+     */
+    @Nonnull
+    @Override
+    public IPv6AddressWithMask withMask(@Nonnull final IPv6Address mask) {
+        return IPv6AddressWithMask.of(this, mask);
+    }
+
+    /**
+     * Returns an {@code IPv6AddressWithMask} object that represents this
+     * IP address masked by the CIDR subnet mask of the given prefix length.
+     *
+     * @param cidrMaskLength  the prefix length of the CIDR subnet mask
+     *                        (i.e. the number of leading one-bits),
+     *                        where {@code 0 <= cidrMaskLength <= 128}
+     * @return                an {@code IPv6AddressWithMask} object that
+     *                        represents this IP address masked by the CIDR
+     *                        subnet mask of the given prefix length
+     * @throws IllegalArgumentException  if the given prefix length was invalid
+     * @see #ofCidrMaskLength(int)
+     */
+    @Nonnull
+    @Override
+    public IPv6AddressWithMask withMaskOfLength(final int cidrMaskLength) {
+        return this.withMask(IPv6Address.ofCidrMaskLength(cidrMaskLength));
+    }
+
+    private volatile byte[] bytesCache = null;
+
+    public byte[] getBytes() {
+        if (bytesCache == null) {
+            synchronized (this) {
+                if (bytesCache == null) {
+                    bytesCache =
+                            new byte[] { (byte) ((raw1 >> 56) & 0xFF),
+                                    (byte) ((raw1 >> 48) & 0xFF),
+                                    (byte) ((raw1 >> 40) & 0xFF),
+                                    (byte) ((raw1 >> 32) & 0xFF),
+                                    (byte) ((raw1 >> 24) & 0xFF),
+                                    (byte) ((raw1 >> 16) & 0xFF),
+                                    (byte) ((raw1 >> 8) & 0xFF),
+                                    (byte) ((raw1 >> 0) & 0xFF),
+
+                                    (byte) ((raw2 >> 56) & 0xFF),
+                                    (byte) ((raw2 >> 48) & 0xFF),
+                                    (byte) ((raw2 >> 40) & 0xFF),
+                                    (byte) ((raw2 >> 32) & 0xFF),
+                                    (byte) ((raw2 >> 24) & 0xFF),
+                                    (byte) ((raw2 >> 16) & 0xFF),
+                                    (byte) ((raw2 >> 8) & 0xFF),
+                                    (byte) ((raw2 >> 0) & 0xFF) };
+                }
+            }
+        }
+        return Arrays.copyOf(bytesCache, bytesCache.length);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public String toString() {
+        return toString(true, false);
+    }
+
+    public int getUnsignedShortWord(final int i) {
+        if (i >= 0 && i < 4)
+            return (int) ((raw1 >>> (48 - i * 16)) & 0xFFFF);
+        else if (i >= 4 && i < 8)
+            return (int) ((raw2 >>> (48 - (i - 4) * 16)) & 0xFFFF);
+        else
+            throw new IllegalArgumentException("16 bit word index must be in [0,7]");
+    }
+
+    /** get the index of the first word where to apply IPv6 zero compression */
+    public int getZeroCompressStart() {
+        int start = Integer.MAX_VALUE;
+        int maxLength = -1;
+
+        int candidateStart = -1;
+
+        for (int i = 0; i < 8; i++) {
+            if (candidateStart >= 0) {
+                // in a zero octect
+                if (getUnsignedShortWord(i) != 0) {
+                    // end of this candidate word
+                    int candidateLength = i - candidateStart;
+                    if (candidateLength >= maxLength) {
+                        start = candidateStart;
+                        maxLength = candidateLength;
+                    }
+                    candidateStart = -1;
+                }
+            } else {
+                // not in a zero octect
+                if (getUnsignedShortWord(i) == 0) {
+                    candidateStart = i;
+                }
+            }
+        }
+
+        if (candidateStart >= 0) {
+            int candidateLength = 8 - candidateStart;
+            if (candidateLength >= maxLength) {
+                start = candidateStart;
+                maxLength = candidateLength;
+            }
+        }
+
+        return start;
+    }
+
+    public String toString(final boolean zeroCompression, final boolean leadingZeros) {
+        StringBuilder res = new StringBuilder();
+
+        int compressionStart = zeroCompression ? getZeroCompressStart() : Integer.MAX_VALUE;
+        boolean inCompression = false;
+        boolean colonNeeded = false;
+
+        for (int i = 0; i < 8; i++) {
+            int word = getUnsignedShortWord(i);
+
+            if (word == 0) {
+                if (inCompression)
+                    continue;
+                else if (i == compressionStart) {
+                    res.append(':').append(':');
+                    inCompression = true;
+                    colonNeeded = false;
+                    continue;
+                }
+            } else {
+                inCompression = false;
+            }
+
+            if (colonNeeded) {
+                res.append(':');
+                colonNeeded = false;
+            }
+
+            res.append(leadingZeros ? String.format("%04x", word) : Integer.toString(word,
+                    16));
+            colonNeeded = true;
+        }
+        return res.toString();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (raw1 ^ (raw1 >>> 32));
+        result = prime * result + (int) (raw2 ^ (raw2 >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        IPv6Address other = (IPv6Address) obj;
+        if (raw1 != other.raw1)
+            return false;
+        if (raw2 != other.raw2)
+            return false;
+        return true;
+    }
+
+    public void write16Bytes(ChannelBuffer c) {
+        c.writeLong(this.raw1);
+        c.writeLong(this.raw2);
+    }
+
+    public static IPv6Address read16Bytes(ChannelBuffer c) throws OFParseError {
+        return IPv6Address.of(c.readLong(), c.readLong());
+    }
+
+    @Override
+    public IPv6Address applyMask(IPv6Address mask) {
+        return and(mask);
+    }
+
+    @Override
+    public int compareTo(IPv6Address o) {
+        int res = Longs.compare(raw1, o.raw1);
+        if(res != 0)
+            return res;
+        else
+            return Longs.compare(raw2, o.raw2);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putLong(raw1);
+        sink.putLong(raw2);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
new file mode 100644
index 0000000..ee34923
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6AddressWithMask.java
@@ -0,0 +1,73 @@
+package org.projectfloodlight.openflow.types;
+
+import com.google.common.base.Preconditions;
+
+public class IPv6AddressWithMask extends IPAddressWithMask<IPv6Address> {
+    public final static IPv6AddressWithMask NONE = of(IPv6Address.NONE, IPv6Address.NONE);
+
+    private IPv6AddressWithMask(IPv6Address value, IPv6Address mask) {
+        super(value, mask);
+    }
+
+    @Override
+    public IPVersion getIpVersion() {
+        return IPVersion.IPv6;
+    }
+
+    public static IPv6AddressWithMask of(IPv6Address value, IPv6Address mask) {
+        Preconditions.checkNotNull(value, "value must not be null");
+        Preconditions.checkNotNull(mask, "mask must not be null");
+        return new IPv6AddressWithMask(value, mask);
+    }
+
+    public static IPv6AddressWithMask of(final String string) {
+        Preconditions.checkNotNull(string, "string must not be null");
+
+        int slashPos;
+        String ip = string;
+        int cidrMaskLength = 128;
+        IPv6Address maskAddress = null;
+
+        // Read mask suffix
+        if ((slashPos = string.indexOf('/')) != -1) {
+            ip = string.substring(0, slashPos);
+            try {
+                String suffix = string.substring(slashPos + 1);
+                if (suffix.length() == 0)
+                    throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
+                if (suffix.indexOf(':') != -1) {
+                    // Full mask
+                    maskAddress = IPv6Address.of(suffix);
+                } else {
+                    // CIDR Suffix
+                    cidrMaskLength = Integer.parseInt(suffix);
+                }
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
+            }
+        }
+
+        // Read IP
+        IPv6Address ipv6 = IPv6Address.of(ip);
+
+        if (maskAddress != null) {
+            // Full address mask
+            return IPv6AddressWithMask.of(ipv6, maskAddress);
+        } else {
+            return IPv6AddressWithMask.of(ipv6,
+                    IPv6Address.ofCidrMaskLength(cidrMaskLength));
+        }
+    }
+
+    @Override
+    public boolean contains(IPAddress<?> ip) {
+        Preconditions.checkNotNull(ip, "ip must not be null");
+
+        if(ip.getIpVersion() == IPVersion.IPv6) {
+            IPv6Address ipv6 = (IPv6Address) ip;
+            return this.matches(ipv6);
+        }
+
+        return false;
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
new file mode 100644
index 0000000..de49b51
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
@@ -0,0 +1,85 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+public class IPv6FlowLabel implements OFValueType<IPv6FlowLabel> {
+
+    static final int LENGTH = 4;
+
+    private final int label;
+
+    private final static int NONE_VAL = 0x0;
+    public static final IPv6FlowLabel NONE = new IPv6FlowLabel(NONE_VAL);
+
+    public static final IPv6FlowLabel NO_MASK = IPv6FlowLabel.of(0xFFFFFFFF);
+    public static final IPv6FlowLabel FULL_MASK = IPv6FlowLabel.of(0x0);
+
+    private IPv6FlowLabel(int label) {
+        this.label = label;
+    }
+
+    public static IPv6FlowLabel of(int label) {
+        if(label == NONE_VAL)
+            return NONE;
+        return new IPv6FlowLabel(label);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof IPv6FlowLabel))
+            return false;
+        IPv6FlowLabel other = (IPv6FlowLabel)obj;
+        if (other.label != this.label)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 59;
+        int result = 1;
+        result = prime * result + label;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toHexString(label);
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(this.label);
+    }
+
+    public static IPv6FlowLabel read4Bytes(ChannelBuffer c) throws OFParseError {
+        return IPv6FlowLabel.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
+    }
+
+    @Override
+    public IPv6FlowLabel applyMask(IPv6FlowLabel mask) {
+        return IPv6FlowLabel.of(this.label & mask.label);
+    }
+
+    public int getIPv6FlowLabelValue() {
+        return label;
+    }
+
+    @Override
+    public int compareTo(IPv6FlowLabel o) {
+        return UnsignedInts.compare(label, o.label);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(this.label);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpDscp.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpDscp.java
new file mode 100644
index 0000000..27596b7
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpDscp.java
@@ -0,0 +1,254 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+
+public enum IpDscp implements OFValueType<IpDscp> {
+    DSCP_0((byte)0),
+    DSCP_1((byte)1),
+    DSCP_2((byte)2),
+    DSCP_3((byte)3),
+    DSCP_4((byte)4),
+    DSCP_5((byte)5),
+    DSCP_6((byte)6),
+    DSCP_7((byte)7),
+    DSCP_8((byte)8),
+    DSCP_9((byte)9),
+    DSCP_10((byte)10),
+    DSCP_11((byte)11),
+    DSCP_12((byte)12),
+    DSCP_13((byte)13),
+    DSCP_14((byte)14),
+    DSCP_15((byte)15),
+    DSCP_16((byte)16),
+    DSCP_17((byte)17),
+    DSCP_18((byte)18),
+    DSCP_19((byte)19),
+    DSCP_20((byte)20),
+    DSCP_21((byte)21),
+    DSCP_22((byte)22),
+    DSCP_23((byte)23),
+    DSCP_24((byte)24),
+    DSCP_25((byte)25),
+    DSCP_26((byte)26),
+    DSCP_27((byte)27),
+    DSCP_28((byte)28),
+    DSCP_29((byte)29),
+    DSCP_30((byte)30),
+    DSCP_31((byte)31),
+    DSCP_32((byte)32),
+    DSCP_33((byte)33),
+    DSCP_34((byte)34),
+    DSCP_35((byte)35),
+    DSCP_36((byte)36),
+    DSCP_37((byte)37),
+    DSCP_38((byte)38),
+    DSCP_39((byte)39),
+    DSCP_40((byte)40),
+    DSCP_41((byte)41),
+    DSCP_42((byte)42),
+    DSCP_43((byte)43),
+    DSCP_44((byte)44),
+    DSCP_45((byte)45),
+    DSCP_46((byte)46),
+    DSCP_47((byte)47),
+    DSCP_48((byte)48),
+    DSCP_49((byte)49),
+    DSCP_50((byte)50),
+    DSCP_51((byte)51),
+    DSCP_52((byte)52),
+    DSCP_53((byte)53),
+    DSCP_54((byte)54),
+    DSCP_55((byte)55),
+    DSCP_56((byte)56),
+    DSCP_57((byte)57),
+    DSCP_58((byte)58),
+    DSCP_59((byte)59),
+    DSCP_60((byte)60),
+    DSCP_61((byte)61),
+    DSCP_62((byte)62),
+    DSCP_63((byte)63),
+    DSCP_NO_MASK((byte)0xFF);
+
+    static final int LENGTH = 1;
+
+    public static final IpDscp NONE = DSCP_0;
+
+    public static final IpDscp NO_MASK = DSCP_NO_MASK;
+    public static final IpDscp FULL_MASK = DSCP_0;
+
+    private final byte dscp;
+
+    private IpDscp(byte dscp) {
+        this.dscp = dscp;
+    }
+
+    public static IpDscp of(byte dscp) {
+        switch (dscp) {
+            case 0:
+                return DSCP_0;
+            case 1:
+                return DSCP_1;
+            case 2:
+                return DSCP_2;
+            case 3:
+                return DSCP_3;
+            case 4:
+                return DSCP_4;
+            case 5:
+                return DSCP_5;
+            case 6:
+                return DSCP_6;
+            case 7:
+                return DSCP_7;
+            case 8:
+                return DSCP_8;
+            case 9:
+                return DSCP_9;
+            case 10:
+                return DSCP_10;
+            case 11:
+                return DSCP_11;
+            case 12:
+                return DSCP_12;
+            case 13:
+                return DSCP_13;
+            case 14:
+                return DSCP_14;
+            case 15:
+                return DSCP_15;
+            case 16:
+                return DSCP_16;
+            case 17:
+                return DSCP_17;
+            case 18:
+                return DSCP_18;
+            case 19:
+                return DSCP_19;
+            case 20:
+                return DSCP_20;
+            case 21:
+                return DSCP_21;
+            case 22:
+                return DSCP_22;
+            case 23:
+                return DSCP_23;
+            case 24:
+                return DSCP_24;
+            case 25:
+                return DSCP_25;
+            case 26:
+                return DSCP_26;
+            case 27:
+                return DSCP_27;
+            case 28:
+                return DSCP_28;
+            case 29:
+                return DSCP_29;
+            case 30:
+                return DSCP_30;
+            case 31:
+                return DSCP_31;
+            case 32:
+                return DSCP_32;
+            case 33:
+                return DSCP_33;
+            case 34:
+                return DSCP_34;
+            case 35:
+                return DSCP_35;
+            case 36:
+                return DSCP_36;
+            case 37:
+                return DSCP_37;
+            case 38:
+                return DSCP_38;
+            case 39:
+                return DSCP_39;
+            case 40:
+                return DSCP_40;
+            case 41:
+                return DSCP_41;
+            case 42:
+                return DSCP_42;
+            case 43:
+                return DSCP_43;
+            case 44:
+                return DSCP_44;
+            case 45:
+                return DSCP_45;
+            case 46:
+                return DSCP_46;
+            case 47:
+                return DSCP_47;
+            case 48:
+                return DSCP_48;
+            case 49:
+                return DSCP_49;
+            case 50:
+                return DSCP_50;
+            case 51:
+                return DSCP_51;
+            case 52:
+                return DSCP_52;
+            case 53:
+                return DSCP_53;
+            case 54:
+                return DSCP_54;
+            case 55:
+                return DSCP_55;
+            case 56:
+                return DSCP_56;
+            case 57:
+                return DSCP_57;
+            case 58:
+                return DSCP_58;
+            case 59:
+                return DSCP_59;
+            case 60:
+                return DSCP_60;
+            case 61:
+                return DSCP_61;
+            case 62:
+                return DSCP_62;
+            case 63:
+                return DSCP_63;
+            default:
+                throw new IllegalArgumentException("Illegal IPv4 DSCP value: " + dscp);
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toHexString(dscp);
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.dscp);
+    }
+
+    public static IpDscp readByte(ChannelBuffer c) throws OFParseError {
+        return IpDscp.of((byte)(c.readUnsignedByte()));
+    }
+
+    @Override
+    public IpDscp applyMask(IpDscp mask) {
+        return IpDscp.of((byte)(this.dscp & mask.dscp));
+    }
+
+    public byte getDscpValue() {
+        return dscp;
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte(dscp);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpEcn.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpEcn.java
new file mode 100644
index 0000000..654df01
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpEcn.java
@@ -0,0 +1,73 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+
+public enum IpEcn implements OFValueType<IpEcn> {
+    ECN_00((byte)0),
+    ECN_01((byte)1),
+    ECN_10((byte)2),
+    ECN_11((byte)3),
+    ECN_NO_MASK((byte)0xFF);
+
+    public static final IpEcn NONE = ECN_00;
+    public static final IpEcn NO_MASK = ECN_NO_MASK;
+    public static final IpEcn FULL_MASK = ECN_00;
+
+    static final int LENGTH = 1;
+
+    private final byte ecn;
+
+    private IpEcn(byte ecn) {
+        this.ecn = ecn;
+    }
+
+    public static IpEcn of(byte ecn) {
+        switch (ecn) {
+            case 0:
+                return ECN_00;
+            case 1:
+                return ECN_01;
+            case 2:
+                return ECN_10;
+            case 3:
+                return ECN_11;
+            default:
+                throw new IllegalArgumentException("Illegal IP ECN value: " + ecn);
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public String toString() {
+        return (ecn < 3 ? "0" : "") + Integer.toBinaryString(ecn);
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.ecn);
+    }
+
+    public static IpEcn readByte(ChannelBuffer c) throws OFParseError {
+        return IpEcn.of((byte)(c.readUnsignedByte()));
+    }
+
+    @Override
+    public IpEcn applyMask(IpEcn mask) {
+        return IpEcn.of((byte)(this.ecn & mask.ecn));
+    }
+
+    public byte getEcnValue() {
+        return ecn;
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte(ecn);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
new file mode 100644
index 0000000..69f497e
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
@@ -0,0 +1,665 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+/**
+ * IP-Protocol field representation
+ *
+ * @author Yotam Harchol (yotam.harchol@bigswitch.com)
+ */
+public class IpProtocol implements OFValueType<IpProtocol> {
+
+    static final short MAX_PROTO = 0xFF;
+    static final int LENGTH = 1;
+
+    private final short proto;
+
+    static final short NUM_HOPOPT  = 0x00;
+    static final short NUM_ICMP    = 0x01;
+    static final short NUM_IGMP    = 0x02;
+    static final short NUM_GGP = 0x03;
+    static final short NUM_IPv4    = 0x04;
+    static final short NUM_ST  = 0x05;
+    static final short NUM_TCP = 0x06;
+    static final short NUM_CBT = 0x07;
+    static final short NUM_EGP = 0x08;
+    static final short NUM_IGP = 0x09;
+    static final short NUM_BBN_RCC_MON = 0x0A;
+    static final short NUM_NVP_II  = 0x0B;
+    static final short NUM_PUP = 0x0C;
+    static final short NUM_ARGUS   = 0x0D;
+    static final short NUM_EMCON   = 0x0E;
+    static final short NUM_XNET    = 0x0F;
+    static final short NUM_CHAOS   = 0x10;
+    static final short NUM_UDP = 0x11;
+    static final short NUM_MUX = 0x12;
+    static final short NUM_DCN_MEAS    = 0x13;
+    static final short NUM_HMP = 0x14;
+    static final short NUM_PRM = 0x15;
+    static final short NUM_XNS_IDP = 0x16;
+    static final short NUM_TRUNK_1 = 0x17;
+    static final short NUM_TRUNK_2 = 0x18;
+    static final short NUM_LEAF_1  = 0x19;
+    static final short NUM_LEAF_2  = 0x1A;
+    static final short NUM_RDP = 0x1B;
+    static final short NUM_IRTP    = 0x1C;
+    static final short NUM_ISO_TP4 = 0x1D;
+    static final short NUM_NETBLT  = 0x1E;
+    static final short NUM_MFE_NSP = 0x1F;
+    static final short NUM_MERIT_INP   = 0x20;
+    static final short NUM_DCCP    = 0x21;
+    static final short NUM_3PC = 0x22;
+    static final short NUM_IDPR    = 0x23;
+    static final short NUM_XTP = 0x24;
+    static final short NUM_DDP = 0x25;
+    static final short NUM_IDPR_CMTP   = 0x26;
+    static final short NUM_TP_PP   = 0x27;
+    static final short NUM_IL  = 0x28;
+    static final short NUM_IPv6    = 0x29;
+    static final short NUM_SDRP    = 0x2A;
+    static final short NUM_IPv6_ROUTE  = 0x2B;
+    static final short NUM_IPv6_FRAG   = 0x2C;
+    static final short NUM_IDRP    = 0x2D;
+    static final short NUM_RSVP    = 0x2E;
+    static final short NUM_GRE = 0x2F;
+    static final short NUM_MHRP    = 0x30;
+    static final short NUM_BNA = 0x31;
+    static final short NUM_ESP = 0x32;
+    static final short NUM_AH  = 0x33;
+    static final short NUM_I_NLSP  = 0x34;
+    static final short NUM_SWIPE   = 0x35;
+    static final short NUM_NARP    = 0x36;
+    static final short NUM_MOBILE  = 0x37;
+    static final short NUM_TLSP    = 0x38;
+    static final short NUM_SKIP    = 0x39;
+    static final short NUM_IPv6_ICMP   = 0x3A;
+    static final short NUM_IPv6_NO_NXT = 0x3B;
+    static final short NUM_IPv6_OPTS   = 0x3C;
+    static final short NUM_HOST_INTERNAL   = 0x3D;
+    static final short NUM_CFTP    = 0x3E;
+    static final short NUM_LOCAL_NET   = 0x3F;
+    static final short NUM_SAT_EXPAK   = 0x40;
+    static final short NUM_KRYPTOLAN   = 0x41;
+    static final short NUM_RVD = 0x42;
+    static final short NUM_IPPC    = 0x43;
+    static final short NUM_DIST_FS = 0x44;
+    static final short NUM_SAT_MON = 0x45;
+    static final short NUM_VISA    = 0x46;
+    static final short NUM_IPCV    = 0x47;
+    static final short NUM_CPNX    = 0x48;
+    static final short NUM_CPHB    = 0x49;
+    static final short NUM_WSN = 0x4A;
+    static final short NUM_PVP = 0x4B;
+    static final short NUM_BR_SAT_MON  = 0x4C;
+    static final short NUM_SUN_ND  = 0x4D;
+    static final short NUM_WB_MON  = 0x4E;
+    static final short NUM_WB_EXPAK    = 0x4F;
+    static final short NUM_ISO_IP  = 0x50;
+    static final short NUM_VMTP    = 0x51;
+    static final short NUM_SECURE_VMTP = 0x52;
+    static final short NUM_VINES   = 0x53;
+    static final short NUM_TTP_IPTM = 0x54;
+    static final short NUM_NSFNET_IGP  = 0x55;
+    static final short NUM_DGP = 0x56;
+    static final short NUM_TCF = 0x57;
+    static final short NUM_EIGRP   = 0x58;
+    static final short NUM_OSPF    = 0x59;
+    static final short NUM_Sprite_RPC  = 0x5A;
+    static final short NUM_LARP    = 0x5B;
+    static final short NUM_MTP = 0x5C;
+    static final short NUM_AX_25   = 0x5D;
+    static final short NUM_IPIP    = 0x5E;
+    static final short NUM_MICP    = 0x5F;
+    static final short NUM_SCC_SP  = 0x60;
+    static final short NUM_ETHERIP = 0x61;
+    static final short NUM_ENCAP   = 0x62;
+    static final short NUM_PRIVATE_ENCRYPT = 0x63;
+    static final short NUM_GMTP    = 0x64;
+    static final short NUM_IFMP    = 0x65;
+    static final short NUM_PNNI    = 0x66;
+    static final short NUM_PIM = 0x67;
+    static final short NUM_ARIS    = 0x68;
+    static final short NUM_SCPS    = 0x69;
+    static final short NUM_QNX = 0x6A;
+    static final short NUM_A_N = 0x6B;
+    static final short NUM_IP_COMP = 0x6C;
+    static final short NUM_SNP = 0x6D;
+    static final short NUM_COMPAQ_PEER = 0x6E;
+    static final short NUM_IPX_IN_IP   = 0x6F;
+    static final short NUM_VRRP    = 0x70;
+    static final short NUM_PGM = 0x71;
+    static final short NUM_ZERO_HOP    = 0x72;
+    static final short NUM_L2TP    = 0x73;
+    static final short NUM_DDX = 0x74;
+    static final short NUM_IATP    = 0x75;
+    static final short NUM_STP = 0x76;
+    static final short NUM_SRP = 0x77;
+    static final short NUM_UTI = 0x78;
+    static final short NUM_SMP = 0x79;
+    static final short NUM_SM  = 0x7A;
+    static final short NUM_PTP = 0x7B;
+    static final short NUM_IS_IS_OVER_IPv4 = 0x7C;
+    static final short NUM_FIRE    = 0x7D;
+    static final short NUM_CRTP    = 0x7E;
+    static final short NUM_CRUDP   = 0x7F;
+    static final short NUM_SSCOPMCE    = 0x80;
+    static final short NUM_IPLT    = 0x81;
+    static final short NUM_SPS = 0x82;
+    static final short NUM_PIPE    = 0x83;
+    static final short NUM_SCTP    = 0x84;
+    static final short NUM_FC  = 0x85;
+    static final short NUM_RSVP_E2E_IGNORE = 0x86;
+    static final short NUM_MOBILITY_HEADER = 0x87;
+    static final short NUM_UDP_LITE    = 0x88;
+    static final short NUM_MPLS_IN_IP  = 0x89;
+    static final short NUM_MANET   = 0x8A;
+    static final short NUM_HIP = 0x8B;
+    static final short NUM_SHIM6   = 0x8C;
+
+    public static final IpProtocol HOPOPT = new IpProtocol(NUM_HOPOPT);
+    public static final IpProtocol ICMP = new IpProtocol(NUM_ICMP);
+    public static final IpProtocol IGMP = new IpProtocol(NUM_IGMP);
+    public static final IpProtocol GGP = new IpProtocol(NUM_GGP);
+    public static final IpProtocol IPv4 = new IpProtocol(NUM_IPv4);
+    public static final IpProtocol ST = new IpProtocol(NUM_ST);
+    public static final IpProtocol TCP = new IpProtocol(NUM_TCP);
+    public static final IpProtocol CBT = new IpProtocol(NUM_CBT);
+    public static final IpProtocol EGP = new IpProtocol(NUM_EGP);
+    public static final IpProtocol IGP = new IpProtocol(NUM_IGP);
+    public static final IpProtocol BBN_RCC_MON = new IpProtocol(NUM_BBN_RCC_MON);
+    public static final IpProtocol NVP_II = new IpProtocol(NUM_NVP_II);
+    public static final IpProtocol PUP = new IpProtocol(NUM_PUP);
+    public static final IpProtocol ARGUS = new IpProtocol(NUM_ARGUS);
+    public static final IpProtocol EMCON = new IpProtocol(NUM_EMCON);
+    public static final IpProtocol XNET = new IpProtocol(NUM_XNET);
+    public static final IpProtocol CHAOS = new IpProtocol(NUM_CHAOS);
+    public static final IpProtocol UDP = new IpProtocol(NUM_UDP);
+    public static final IpProtocol MUX = new IpProtocol(NUM_MUX);
+    public static final IpProtocol DCN_MEAS = new IpProtocol(NUM_DCN_MEAS);
+    public static final IpProtocol HMP = new IpProtocol(NUM_HMP);
+    public static final IpProtocol PRM = new IpProtocol(NUM_PRM);
+    public static final IpProtocol XNS_IDP = new IpProtocol(NUM_XNS_IDP);
+    public static final IpProtocol TRUNK_1 = new IpProtocol(NUM_TRUNK_1);
+    public static final IpProtocol TRUNK_2 = new IpProtocol(NUM_TRUNK_2);
+    public static final IpProtocol LEAF_1 = new IpProtocol(NUM_LEAF_1);
+    public static final IpProtocol LEAF_2 = new IpProtocol(NUM_LEAF_2);
+    public static final IpProtocol RDP = new IpProtocol(NUM_RDP);
+    public static final IpProtocol IRTP = new IpProtocol(NUM_IRTP);
+    public static final IpProtocol ISO_TP4 = new IpProtocol(NUM_ISO_TP4);
+    public static final IpProtocol NETBLT = new IpProtocol(NUM_NETBLT);
+    public static final IpProtocol MFE_NSP = new IpProtocol(NUM_MFE_NSP);
+    public static final IpProtocol MERIT_INP = new IpProtocol(NUM_MERIT_INP);
+    public static final IpProtocol DCCP = new IpProtocol(NUM_DCCP);
+    public static final IpProtocol _3PC = new IpProtocol(NUM_3PC);
+    public static final IpProtocol IDPR = new IpProtocol(NUM_IDPR);
+    public static final IpProtocol XTP = new IpProtocol(NUM_XTP);
+    public static final IpProtocol DDP = new IpProtocol(NUM_DDP);
+    public static final IpProtocol IDPR_CMTP = new IpProtocol(NUM_IDPR_CMTP);
+    public static final IpProtocol TP_PP = new IpProtocol(NUM_TP_PP);
+    public static final IpProtocol IL = new IpProtocol(NUM_IL);
+    public static final IpProtocol IPv6 = new IpProtocol(NUM_IPv6);
+    public static final IpProtocol SDRP = new IpProtocol(NUM_SDRP);
+    public static final IpProtocol IPv6_ROUTE = new IpProtocol(NUM_IPv6_ROUTE);
+    public static final IpProtocol IPv6_FRAG = new IpProtocol(NUM_IPv6_FRAG);
+    public static final IpProtocol IDRP = new IpProtocol(NUM_IDRP);
+    public static final IpProtocol RSVP = new IpProtocol(NUM_RSVP);
+    public static final IpProtocol GRE = new IpProtocol(NUM_GRE);
+    public static final IpProtocol MHRP = new IpProtocol(NUM_MHRP);
+    public static final IpProtocol BNA = new IpProtocol(NUM_BNA);
+    public static final IpProtocol ESP = new IpProtocol(NUM_ESP);
+    public static final IpProtocol AH = new IpProtocol(NUM_AH);
+    public static final IpProtocol I_NLSP = new IpProtocol(NUM_I_NLSP);
+    public static final IpProtocol SWIPE = new IpProtocol(NUM_SWIPE);
+    public static final IpProtocol NARP = new IpProtocol(NUM_NARP);
+    public static final IpProtocol MOBILE = new IpProtocol(NUM_MOBILE);
+    public static final IpProtocol TLSP = new IpProtocol(NUM_TLSP);
+    public static final IpProtocol SKIP = new IpProtocol(NUM_SKIP);
+    public static final IpProtocol IPv6_ICMP = new IpProtocol(NUM_IPv6_ICMP);
+    public static final IpProtocol IPv6_NO_NXT = new IpProtocol(NUM_IPv6_NO_NXT);
+    public static final IpProtocol IPv6_OPTS = new IpProtocol(NUM_IPv6_OPTS);
+    public static final IpProtocol HOST_INTERNAL = new IpProtocol(NUM_HOST_INTERNAL);
+    public static final IpProtocol CFTP = new IpProtocol(NUM_CFTP);
+    public static final IpProtocol LOCAL_NET = new IpProtocol(NUM_LOCAL_NET);
+    public static final IpProtocol SAT_EXPAK = new IpProtocol(NUM_SAT_EXPAK);
+    public static final IpProtocol KRYPTOLAN = new IpProtocol(NUM_KRYPTOLAN);
+    public static final IpProtocol RVD = new IpProtocol(NUM_RVD);
+    public static final IpProtocol IPPC = new IpProtocol(NUM_IPPC);
+    public static final IpProtocol DIST_FS = new IpProtocol(NUM_DIST_FS);
+    public static final IpProtocol SAT_MON = new IpProtocol(NUM_SAT_MON);
+    public static final IpProtocol VISA = new IpProtocol(NUM_VISA);
+    public static final IpProtocol IPCV = new IpProtocol(NUM_IPCV);
+    public static final IpProtocol CPNX = new IpProtocol(NUM_CPNX);
+    public static final IpProtocol CPHB = new IpProtocol(NUM_CPHB);
+    public static final IpProtocol WSN = new IpProtocol(NUM_WSN);
+    public static final IpProtocol PVP = new IpProtocol(NUM_PVP);
+    public static final IpProtocol BR_SAT_MON = new IpProtocol(NUM_BR_SAT_MON);
+    public static final IpProtocol SUN_ND = new IpProtocol(NUM_SUN_ND);
+    public static final IpProtocol WB_MON = new IpProtocol(NUM_WB_MON);
+    public static final IpProtocol WB_EXPAK = new IpProtocol(NUM_WB_EXPAK);
+    public static final IpProtocol ISO_IP = new IpProtocol(NUM_ISO_IP);
+    public static final IpProtocol VMTP = new IpProtocol(NUM_VMTP);
+    public static final IpProtocol SECURE_VMTP = new IpProtocol(NUM_SECURE_VMTP);
+    public static final IpProtocol VINES = new IpProtocol(NUM_VINES);
+    public static final IpProtocol TTP_IPTM = new IpProtocol(NUM_TTP_IPTM);
+    public static final IpProtocol NSFNET_IGP = new IpProtocol(NUM_NSFNET_IGP);
+    public static final IpProtocol DGP = new IpProtocol(NUM_DGP);
+    public static final IpProtocol TCF = new IpProtocol(NUM_TCF);
+    public static final IpProtocol EIGRP = new IpProtocol(NUM_EIGRP);
+    public static final IpProtocol OSPF = new IpProtocol(NUM_OSPF);
+    public static final IpProtocol Sprite_RPC = new IpProtocol(NUM_Sprite_RPC);
+    public static final IpProtocol LARP = new IpProtocol(NUM_LARP);
+    public static final IpProtocol MTP = new IpProtocol(NUM_MTP);
+    public static final IpProtocol AX_25 = new IpProtocol(NUM_AX_25);
+    public static final IpProtocol IPIP = new IpProtocol(NUM_IPIP);
+    public static final IpProtocol MICP = new IpProtocol(NUM_MICP);
+    public static final IpProtocol SCC_SP = new IpProtocol(NUM_SCC_SP);
+    public static final IpProtocol ETHERIP = new IpProtocol(NUM_ETHERIP);
+    public static final IpProtocol ENCAP = new IpProtocol(NUM_ENCAP);
+    public static final IpProtocol PRIVATE_ENCRYPT = new IpProtocol(NUM_PRIVATE_ENCRYPT);
+    public static final IpProtocol GMTP = new IpProtocol(NUM_GMTP);
+    public static final IpProtocol IFMP = new IpProtocol(NUM_IFMP);
+    public static final IpProtocol PNNI = new IpProtocol(NUM_PNNI);
+    public static final IpProtocol PIM = new IpProtocol(NUM_PIM);
+    public static final IpProtocol ARIS = new IpProtocol(NUM_ARIS);
+    public static final IpProtocol SCPS = new IpProtocol(NUM_SCPS);
+    public static final IpProtocol QNX = new IpProtocol(NUM_QNX);
+    public static final IpProtocol A_N = new IpProtocol(NUM_A_N);
+    public static final IpProtocol IP_COMP = new IpProtocol(NUM_IP_COMP);
+    public static final IpProtocol SNP = new IpProtocol(NUM_SNP);
+    public static final IpProtocol COMPAQ_PEER = new IpProtocol(NUM_COMPAQ_PEER);
+    public static final IpProtocol IPX_IN_IP = new IpProtocol(NUM_IPX_IN_IP);
+    public static final IpProtocol VRRP = new IpProtocol(NUM_VRRP);
+    public static final IpProtocol PGM = new IpProtocol(NUM_PGM);
+    public static final IpProtocol ZERO_HOP = new IpProtocol(NUM_ZERO_HOP);
+    public static final IpProtocol L2TP = new IpProtocol(NUM_L2TP);
+    public static final IpProtocol DDX = new IpProtocol(NUM_DDX);
+    public static final IpProtocol IATP = new IpProtocol(NUM_IATP);
+    public static final IpProtocol STP = new IpProtocol(NUM_STP);
+    public static final IpProtocol SRP = new IpProtocol(NUM_SRP);
+    public static final IpProtocol UTI = new IpProtocol(NUM_UTI);
+    public static final IpProtocol SMP = new IpProtocol(NUM_SMP);
+    public static final IpProtocol SM = new IpProtocol(NUM_SM);
+    public static final IpProtocol PTP = new IpProtocol(NUM_PTP);
+    public static final IpProtocol IS_IS_OVER_IPv4 = new IpProtocol(NUM_IS_IS_OVER_IPv4);
+    public static final IpProtocol FIRE = new IpProtocol(NUM_FIRE);
+    public static final IpProtocol CRTP = new IpProtocol(NUM_CRTP);
+    public static final IpProtocol CRUDP = new IpProtocol(NUM_CRUDP);
+    public static final IpProtocol SSCOPMCE = new IpProtocol(NUM_SSCOPMCE);
+    public static final IpProtocol IPLT = new IpProtocol(NUM_IPLT);
+    public static final IpProtocol SPS = new IpProtocol(NUM_SPS);
+    public static final IpProtocol PIPE = new IpProtocol(NUM_PIPE);
+    public static final IpProtocol SCTP = new IpProtocol(NUM_SCTP);
+    public static final IpProtocol FC = new IpProtocol(NUM_FC);
+    public static final IpProtocol RSVP_E2E_IGNORE = new IpProtocol(NUM_RSVP_E2E_IGNORE);
+    public static final IpProtocol MOBILITY_HEADER = new IpProtocol(NUM_MOBILITY_HEADER);
+    public static final IpProtocol UDP_LITE = new IpProtocol(NUM_UDP_LITE);
+    public static final IpProtocol MPLS_IN_IP = new IpProtocol(NUM_MPLS_IN_IP);
+    public static final IpProtocol MANET = new IpProtocol(NUM_MANET);
+    public static final IpProtocol HIP = new IpProtocol(NUM_HIP);
+    public static final IpProtocol SHIM6 = new IpProtocol(NUM_SHIM6);
+
+    public static final IpProtocol NONE = HOPOPT;
+
+    public static final IpProtocol NO_MASK = HOPOPT;
+    public static final IpProtocol FULL_MASK = new IpProtocol((short)0x0000);
+
+    private IpProtocol(short version) {
+        this.proto = version;
+    }
+
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public static IpProtocol of(short proto) {
+        switch (proto) {
+            case NUM_HOPOPT:
+                return HOPOPT;
+            case NUM_ICMP:
+                return ICMP;
+            case NUM_IGMP:
+                return IGMP;
+            case NUM_GGP:
+                return GGP;
+            case NUM_IPv4:
+                return IPv4;
+            case NUM_ST:
+                return ST;
+            case NUM_TCP:
+                return TCP;
+            case NUM_CBT:
+                return CBT;
+            case NUM_EGP:
+                return EGP;
+            case NUM_IGP:
+                return IGP;
+            case NUM_BBN_RCC_MON:
+                return BBN_RCC_MON;
+            case NUM_NVP_II:
+                return NVP_II;
+            case NUM_PUP:
+                return PUP;
+            case NUM_ARGUS:
+                return ARGUS;
+            case NUM_EMCON:
+                return EMCON;
+            case NUM_XNET:
+                return XNET;
+            case NUM_CHAOS:
+                return CHAOS;
+            case NUM_UDP:
+                return UDP;
+            case NUM_MUX:
+                return MUX;
+            case NUM_DCN_MEAS:
+                return DCN_MEAS;
+            case NUM_HMP:
+                return HMP;
+            case NUM_PRM:
+                return PRM;
+            case NUM_XNS_IDP:
+                return XNS_IDP;
+            case NUM_TRUNK_1:
+                return TRUNK_1;
+            case NUM_TRUNK_2:
+                return TRUNK_2;
+            case NUM_LEAF_1:
+                return LEAF_1;
+            case NUM_LEAF_2:
+                return LEAF_2;
+            case NUM_RDP:
+                return RDP;
+            case NUM_IRTP:
+                return IRTP;
+            case NUM_ISO_TP4:
+                return ISO_TP4;
+            case NUM_NETBLT:
+                return NETBLT;
+            case NUM_MFE_NSP:
+                return MFE_NSP;
+            case NUM_MERIT_INP:
+                return MERIT_INP;
+            case NUM_DCCP:
+                return DCCP;
+            case NUM_3PC:
+                return _3PC;
+            case NUM_IDPR:
+                return IDPR;
+            case NUM_XTP:
+                return XTP;
+            case NUM_DDP:
+                return DDP;
+            case NUM_IDPR_CMTP:
+                return IDPR_CMTP;
+            case NUM_TP_PP:
+                return TP_PP;
+            case NUM_IL:
+                return IL;
+            case NUM_IPv6:
+                return IPv6;
+            case NUM_SDRP:
+                return SDRP;
+            case NUM_IPv6_ROUTE:
+                return IPv6_ROUTE;
+            case NUM_IPv6_FRAG:
+                return IPv6_FRAG;
+            case NUM_IDRP:
+                return IDRP;
+            case NUM_RSVP:
+                return RSVP;
+            case NUM_GRE:
+                return GRE;
+            case NUM_MHRP:
+                return MHRP;
+            case NUM_BNA:
+                return BNA;
+            case NUM_ESP:
+                return ESP;
+            case NUM_AH:
+                return AH;
+            case NUM_I_NLSP:
+                return I_NLSP;
+            case NUM_SWIPE:
+                return SWIPE;
+            case NUM_NARP:
+                return NARP;
+            case NUM_MOBILE:
+                return MOBILE;
+            case NUM_TLSP:
+                return TLSP;
+            case NUM_SKIP:
+                return SKIP;
+            case NUM_IPv6_ICMP:
+                return IPv6_ICMP;
+            case NUM_IPv6_NO_NXT:
+                return IPv6_NO_NXT;
+            case NUM_IPv6_OPTS:
+                return IPv6_OPTS;
+            case NUM_HOST_INTERNAL:
+                return HOST_INTERNAL;
+            case NUM_CFTP:
+                return CFTP;
+            case NUM_LOCAL_NET:
+                return LOCAL_NET;
+            case NUM_SAT_EXPAK:
+                return SAT_EXPAK;
+            case NUM_KRYPTOLAN:
+                return KRYPTOLAN;
+            case NUM_RVD:
+                return RVD;
+            case NUM_IPPC:
+                return IPPC;
+            case NUM_DIST_FS:
+                return DIST_FS;
+            case NUM_SAT_MON:
+                return SAT_MON;
+            case NUM_VISA:
+                return VISA;
+            case NUM_IPCV:
+                return IPCV;
+            case NUM_CPNX:
+                return CPNX;
+            case NUM_CPHB:
+                return CPHB;
+            case NUM_WSN:
+                return WSN;
+            case NUM_PVP:
+                return PVP;
+            case NUM_BR_SAT_MON:
+                return BR_SAT_MON;
+            case NUM_SUN_ND:
+                return SUN_ND;
+            case NUM_WB_MON:
+                return WB_MON;
+            case NUM_WB_EXPAK:
+                return WB_EXPAK;
+            case NUM_ISO_IP:
+                return ISO_IP;
+            case NUM_VMTP:
+                return VMTP;
+            case NUM_SECURE_VMTP:
+                return SECURE_VMTP;
+            case NUM_VINES:
+                return VINES;
+            case NUM_TTP_IPTM:
+                return TTP_IPTM;
+            case NUM_NSFNET_IGP:
+                return NSFNET_IGP;
+            case NUM_DGP:
+                return DGP;
+            case NUM_TCF:
+                return TCF;
+            case NUM_EIGRP:
+                return EIGRP;
+            case NUM_OSPF:
+                return OSPF;
+            case NUM_Sprite_RPC:
+                return Sprite_RPC;
+            case NUM_LARP:
+                return LARP;
+            case NUM_MTP:
+                return MTP;
+            case NUM_AX_25:
+                return AX_25;
+            case NUM_IPIP:
+                return IPIP;
+            case NUM_MICP:
+                return MICP;
+            case NUM_SCC_SP:
+                return SCC_SP;
+            case NUM_ETHERIP:
+                return ETHERIP;
+            case NUM_ENCAP:
+                return ENCAP;
+            case NUM_PRIVATE_ENCRYPT:
+                return PRIVATE_ENCRYPT;
+            case NUM_GMTP:
+                return GMTP;
+            case NUM_IFMP:
+                return IFMP;
+            case NUM_PNNI:
+                return PNNI;
+            case NUM_PIM:
+                return PIM;
+            case NUM_ARIS:
+                return ARIS;
+            case NUM_SCPS:
+                return SCPS;
+            case NUM_QNX:
+                return QNX;
+            case NUM_A_N:
+                return A_N;
+            case NUM_IP_COMP:
+                return IP_COMP;
+            case NUM_SNP:
+                return SNP;
+            case NUM_COMPAQ_PEER:
+                return COMPAQ_PEER;
+            case NUM_IPX_IN_IP:
+                return IPX_IN_IP;
+            case NUM_VRRP:
+                return VRRP;
+            case NUM_PGM:
+                return PGM;
+            case NUM_ZERO_HOP:
+                return ZERO_HOP;
+            case NUM_L2TP:
+                return L2TP;
+            case NUM_DDX:
+                return DDX;
+            case NUM_IATP:
+                return IATP;
+            case NUM_STP:
+                return STP;
+            case NUM_SRP:
+                return SRP;
+            case NUM_UTI:
+                return UTI;
+            case NUM_SMP:
+                return SMP;
+            case NUM_SM:
+                return SM;
+            case NUM_PTP:
+                return PTP;
+            case NUM_IS_IS_OVER_IPv4:
+                return IS_IS_OVER_IPv4;
+            case NUM_FIRE:
+                return FIRE;
+            case NUM_CRTP:
+                return CRTP;
+            case NUM_CRUDP:
+                return CRUDP;
+            case NUM_SSCOPMCE:
+                return SSCOPMCE;
+            case NUM_IPLT:
+                return IPLT;
+            case NUM_SPS:
+                return SPS;
+            case NUM_PIPE:
+                return PIPE;
+            case NUM_SCTP:
+                return SCTP;
+            case NUM_FC:
+                return FC;
+            case NUM_RSVP_E2E_IGNORE:
+                return RSVP_E2E_IGNORE;
+            case NUM_MOBILITY_HEADER:
+                return MOBILITY_HEADER;
+            case NUM_UDP_LITE:
+                return UDP_LITE;
+            case NUM_MPLS_IN_IP:
+                return MPLS_IN_IP;
+            case NUM_MANET:
+                return MANET;
+            case NUM_HIP:
+                return HIP;
+            case NUM_SHIM6:
+                return SHIM6;
+            default:
+                if (proto >= MAX_PROTO) {
+                    throw new IllegalArgumentException("Illegal IP protocol number: "
+                            + proto);
+                } else {
+                    return new IpProtocol(proto);
+                }
+        }
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toHexString(proto);
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.proto);
+    }
+
+    public static IpProtocol readByte(ChannelBuffer c) {
+        return IpProtocol.of(c.readUnsignedByte());
+    }
+
+    @Override
+    public IpProtocol applyMask(IpProtocol mask) {
+        return IpProtocol.of((short)(this.proto & mask.proto));
+    }
+
+    public short getIpProtocolNumber() {
+        return proto;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof IpProtocol))
+            return false;
+        IpProtocol o = (IpProtocol)obj;
+        if (o.proto != this.proto)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 37;
+        int result = 1;
+        result = prime * result + proto;
+        return result;
+    }
+
+
+    @Override
+    public int compareTo(IpProtocol o) {
+        return Shorts.compare(proto, o.proto);
+    }
+
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort(proto);
+    }
+
+}
\ No newline at end of file
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/LagId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/LagId.java
new file mode 100644
index 0000000..51364e1
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/LagId.java
@@ -0,0 +1,92 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+@Immutable
+public class LagId implements OFValueType<LagId> {
+    static final int LENGTH = 4;
+    private final int rawValue;
+
+    private final static int NONE_VAL = 0;
+    public final static LagId NONE = new LagId(NONE_VAL);
+
+    private final static int NO_MASK_VAL = 0xFFFFFFFF;
+    public final static LagId NO_MASK = new LagId(NO_MASK_VAL);
+    public final static LagId FULL_MASK = NONE;
+
+    private LagId(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static LagId of(final int raw) {
+        if(raw == NONE_VAL)
+            return NONE;
+        else if (raw == NO_MASK_VAL)
+            return NO_MASK;
+        return new LagId(raw);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(rawValue);
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        LagId other = (LagId) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+
+    public static LagId read4Bytes(ChannelBuffer c) {
+        return LagId.of(c.readInt());
+    }
+
+    @Override
+    public int compareTo(LagId o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public LagId applyMask(LagId mask) {
+        return LagId.of(rawValue & mask.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
new file mode 100644
index 0000000..d7f044e
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
@@ -0,0 +1,207 @@
+package org.projectfloodlight.openflow.types;
+
+import java.util.Arrays;
+
+import javax.annotation.Nonnull;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.util.HexString;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Longs;
+
+/**
+ * Wrapper around a 6 byte mac address.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+
+public class MacAddress implements OFValueType<MacAddress> {
+    static final int MacAddrLen = 6;
+    private final long rawValue;
+
+    private final static long NONE_VAL = 0x0L;
+    public static final MacAddress NONE = new MacAddress(NONE_VAL);
+
+    private final static long BROADCAST_VAL = 0x0000FFFFFFFFFFFFL;
+    public static final MacAddress BROADCAST = new MacAddress(BROADCAST_VAL);
+
+    public static final MacAddress NO_MASK = MacAddress.of(0xFFFFFFFFFFFFFFFFl);
+    public static final MacAddress FULL_MASK = MacAddress.of(0x0);
+
+    private static final long LLDP_MAC_ADDRESS_MASK = 0xfffffffffff0L;
+    private static final long LLDP_MAC_ADDRESS_VALUE = 0x0180c2000000L;
+
+    private MacAddress(final long rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static MacAddress of(final byte[] address) {
+        if (address.length != MacAddrLen)
+            throw new IllegalArgumentException(
+                    "Mac address byte array must be exactly 6 bytes long; length = " + address.length);
+        long raw =
+                (address[0] & 0xFFL) << 40 | (address[1] & 0xFFL) << 32
+                        | (address[2] & 0xFFL) << 24 | (address[3] & 0xFFL) << 16
+                        | (address[4] & 0xFFL) << 8 | (address[5] & 0xFFL);
+        return MacAddress.of(raw);
+    }
+
+    public static MacAddress of(long raw) {
+        raw &= BROADCAST_VAL;
+        if(raw == NONE_VAL)
+            return NONE;
+        if (raw == BROADCAST_VAL)
+            return BROADCAST;
+        return new MacAddress(raw);
+    }
+
+    /** Parse a mac adress from the canonical string representation as
+     *  6 hex bytes separated by colons (01:02:03:04:05:06).
+     *
+     * @param macString - a mac address in canonical string representation
+     * @return the parsed MacAddress
+     * @throws IllegalArgumentException if macString is not a valid mac adddress
+     */
+    @Nonnull
+    public static MacAddress of(@Nonnull final String macString) throws IllegalArgumentException {
+        if (macString == null) {
+            throw new NullPointerException("macString must not be null");
+        }
+        int index = 0;
+        int shift = 40;
+        final String FORMAT_ERROR = "Mac address is not well-formed. " +
+                "It must consist of 6 hex digit pairs separated by colons: ";
+
+        long raw = 0;
+        if (macString.length() != 6 * 2 + 5)
+            throw new IllegalArgumentException(FORMAT_ERROR + macString);
+
+        while (shift >= 0) {
+            int digit1 = Character.digit(macString.charAt(index++), 16);
+            int digit2 = Character.digit(macString.charAt(index++), 16);
+            if ((digit1 < 0) || (digit2 < 0))
+                throw new IllegalArgumentException(FORMAT_ERROR + macString);
+            raw |= ((long) (digit1 << 4 | digit2)) << shift;
+
+            if (shift == 0)
+                break;
+            if (macString.charAt(index++) != ':')
+                throw new IllegalArgumentException(FORMAT_ERROR + macString);
+            shift -= 8;
+        }
+        return MacAddress.of(raw);
+    }
+
+    private volatile byte[] bytesCache = null;
+
+    public byte[] getBytes() {
+        if (bytesCache == null) {
+            synchronized (this) {
+                if (bytesCache == null) {
+                    bytesCache =
+                            new byte[] { (byte) ((rawValue >> 40) & 0xFF),
+                                    (byte) ((rawValue >> 32) & 0xFF),
+                                    (byte) ((rawValue >> 24) & 0xFF),
+                                    (byte) ((rawValue >> 16) & 0xFF),
+                                    (byte) ((rawValue >> 8) & 0xFF),
+                                    (byte) ((rawValue >> 0) & 0xFF) };
+                }
+            }
+        }
+        return Arrays.copyOf(bytesCache, bytesCache.length);
+    }
+
+    /**
+     * Returns {@code true} if the MAC address is the broadcast address.
+     * @return {@code true} if the MAC address is the broadcast address.
+     */
+    public boolean isBroadcast() {
+        return this == BROADCAST;
+    }
+
+    /**
+     * Returns {@code true} if the MAC address is a multicast address.
+     * @return {@code true} if the MAC address is a multicast address.
+     */
+    public boolean isMulticast() {
+        if (isBroadcast()) {
+            return false;
+        }
+        return (rawValue & (0x01L << 40)) != 0;
+    }
+
+    /**
+     * Returns {@code true} if the MAC address is an LLDP mac address.
+     * @return {@code true} if the MAC address is an LLDP mac address.
+     */
+    public boolean isLLDPAddress() {
+        return (rawValue & LLDP_MAC_ADDRESS_MASK) == LLDP_MAC_ADDRESS_VALUE;
+    }
+
+    @Override
+    public int getLength() {
+        return MacAddrLen;
+    }
+
+    @Override
+    public String toString() {
+        return HexString.toHexString(rawValue, 6);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (rawValue ^ (rawValue >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        MacAddress other = (MacAddress) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    public long getLong() {
+        return rawValue;
+    }
+
+    public void write6Bytes(ChannelBuffer c) {
+        c.writeInt((int) (this.rawValue >> 16));
+        c.writeShort((int) this.rawValue & 0xFFFF);
+    }
+
+    public static MacAddress read6Bytes(ChannelBuffer c) throws OFParseError {
+        long raw = c.readUnsignedInt() << 16 | c.readUnsignedShort();
+        return MacAddress.of(raw);
+    }
+
+    @Override
+    public MacAddress applyMask(MacAddress mask) {
+        return MacAddress.of(this.rawValue & mask.rawValue);
+    }
+
+    @Override
+    public int compareTo(MacAddress o) {
+        return Longs.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt((int) (this.rawValue >> 16));
+        sink.putShort((short) (this.rawValue & 0xFFFF));
+    }
+
+
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/Masked.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/Masked.java
new file mode 100644
index 0000000..b5a995d
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/Masked.java
@@ -0,0 +1,97 @@
+package org.projectfloodlight.openflow.types;
+
+import com.google.common.hash.PrimitiveSink;
+
+
+
+public class Masked<T extends OFValueType<T>> implements OFValueType<Masked<T>> {
+    protected final T value;
+
+    /** bitmask of the value. Note: a set (1) bit in this mask means 'match on this value'.
+     *  This the natural mask represenation as in IPv[46] netmasks. It is the inverse of the
+     *  OpenFlow 1.0 'wildcard' meaning.
+     */
+    protected final T mask;
+
+    protected Masked(T value, T mask) {
+        this.value = value.applyMask(mask);
+        this.mask = mask;
+    }
+
+    public T getValue() {
+        return value;
+    }
+
+    public T getMask() {
+        return mask;
+    }
+
+    public static <T extends OFValueType<T>> Masked<T> of(T value, T mask) {
+        return new Masked<T>(value, mask);
+    }
+
+    @Override
+    public int getLength() {
+        return this.value.getLength() + this.mask.getLength();
+    }
+
+    @Override
+    public String toString() {
+        // General representation: value/mask
+        StringBuilder sb = new StringBuilder();
+        sb.append(value.toString()).append('/').append(mask.toString());
+        return sb.toString();
+    }
+
+    /** Determine whether candidate value is matched by this masked value
+     *  (i.e., does candiate lie in the 'network/range' specified by this masked
+     *  value).
+     *
+     * @param candidate the candidate value to test
+     * @return true iff the candidate lies in the area specified by this masked
+     *         value.
+     */
+    public boolean matches(T candidate) {
+        // candidate lies in the area of this masked value if its
+        // value with the masked bit zero'ed out equals this's value
+        // (e.g., our 'network address' for networks)
+        return candidate.applyMask(this.mask).equals(this.value);
+    }
+
+    @Override
+    public Masked<T> applyMask(Masked<T> mask) {
+        return this;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof Masked<?>))
+            return false;
+        Masked<?> mobj = (Masked<?>)obj;
+        return this.value.equals(mobj.value) && this.mask.equals(mobj.mask);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 59;
+        int result = 1;
+        result = prime * result + this.value.hashCode();
+        result = prime * result + this.mask.hashCode();
+        return result;
+    }
+
+    @Override
+    public int compareTo(Masked<T> o) {
+        int res = value.compareTo(o.value);
+        if(res != 0)
+            return res;
+        else
+            return mask.compareTo(o.mask);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        value.putTo(sink);
+        mask.putTo(sink);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFAuxId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFAuxId.java
new file mode 100644
index 0000000..c8e04d2
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFAuxId.java
@@ -0,0 +1,86 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+public class OFAuxId implements Comparable<OFAuxId>, PrimitiveSinkable {
+    
+    private static final short VALIDATION_MASK = 0xFF;
+    
+    private static final short MAIN_VAL = 0x0000;
+    
+    public static final OFAuxId MAIN = new OFAuxId(MAIN_VAL);
+            
+    private final short id;
+
+    private OFAuxId(short id) {
+        this.id = id;
+    }
+
+    public static OFAuxId of(short id) {
+        switch(id) {
+            case MAIN_VAL:
+                return MAIN;
+            default:
+                if ((id & VALIDATION_MASK) != id)
+                    throw new IllegalArgumentException("Illegal Aux id value: " + id);
+                return new OFAuxId(id);
+        }
+    }
+
+    public static OFAuxId of(int id) {
+        if((id & VALIDATION_MASK) != id)
+            throw new IllegalArgumentException("Illegal Aux id value: "+id);
+        return of((short) id);
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Integer.toHexString(id);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + id;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) return true;
+        if (obj == null) return false;
+        if (getClass() != obj.getClass()) return false;
+        OFAuxId other = (OFAuxId) obj;
+        if (id != other.id) return false;
+        return true;
+    }
+
+    public short getValue() {
+        return id;
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.id);
+    }
+
+    public static OFAuxId readByte(ChannelBuffer c) throws OFParseError {
+        return OFAuxId.of(c.readUnsignedByte());
+    }
+
+
+    @Override
+    public int compareTo(OFAuxId other) {
+        return Shorts.compare(this.id, other.id);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte((byte) id);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBitMask128.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBitMask128.java
new file mode 100644
index 0000000..93f5a2d
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBitMask128.java
@@ -0,0 +1,103 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+
+public class OFBitMask128 implements OFValueType<OFBitMask128> {
+
+    static final int LENGTH = 16;
+
+    private final long raw1; // MSBs (ports 64-127)
+    private final long raw2; // LSBs (ports 0-63)
+
+    public static final OFBitMask128 ALL = new OFBitMask128(-1, -1);
+    public static final OFBitMask128 NONE = new OFBitMask128(0, 0);
+
+    public static final OFBitMask128 NO_MASK = ALL;
+    public static final OFBitMask128 FULL_MASK = NONE;
+
+    private OFBitMask128(long raw1, long raw2) {
+        this.raw1 = raw1;
+        this.raw2 = raw2;
+    }
+
+    public static OFBitMask128 of(long raw1, long raw2) {
+        if (raw1 == -1 && raw2 == -1)
+            return ALL;
+        if (raw1 == 0 && raw2 == 0)
+            return NONE;
+        return new OFBitMask128(raw1, raw2);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public OFBitMask128 applyMask(OFBitMask128 mask) {
+        return of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof OFBitMask128))
+            return false;
+        OFBitMask128 other = (OFBitMask128)obj;
+        return (other.raw1 == this.raw1 && other.raw2 == this.raw2);
+    }
+
+    @Override
+    public int hashCode() {
+        return (int)(31 * raw1 + raw2);
+    }
+
+    protected static boolean isBitOn(long raw1, long raw2, int bit) {
+        if (bit < 0 || bit >= 128)
+            throw new IndexOutOfBoundsException();
+        long word;
+        if (bit < 64) {
+            word = raw2; // ports 0-63
+        } else {
+            word = raw1; // ports 64-127
+            bit -= 64;
+        }
+        return (word & ((long)1 << bit)) != 0;
+    }
+
+    public void write16Bytes(ChannelBuffer cb) {
+        cb.writeLong(raw1);
+        cb.writeLong(raw2);
+    }
+
+    public static OFBitMask128 read16Bytes(ChannelBuffer cb) {
+        long raw1 = cb.readLong();
+        long raw2 = cb.readLong();
+        return of(raw1, raw2);
+    }
+
+    public boolean isOn(int bit) {
+        return isBitOn(raw1, raw2, bit);
+    }
+
+    @Override
+    public String toString() {
+        return (String.format("%64s", Long.toBinaryString(raw2)) + String.format("%64s", Long.toBinaryString(raw1))).replaceAll(" ", "0");
+    }
+
+    @Override
+    public int compareTo(OFBitMask128 o) {
+        long c = this.raw1 - o.raw1;
+        if (c != 0)
+            return Long.signum(c);
+        return Long.signum(this.raw2 - o.raw2);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putLong(raw1);
+        sink.putLong(raw2);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBooleanValue.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBooleanValue.java
new file mode 100644
index 0000000..e276092
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBooleanValue.java
@@ -0,0 +1,110 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+
+import com.google.common.hash.PrimitiveSink;
+
+public class OFBooleanValue implements Writeable, OFValueType<OFBooleanValue> {
+    public final static OFBooleanValue TRUE = new OFBooleanValue(true);
+    public final static OFBooleanValue FALSE = new OFBooleanValue(false);
+
+    public final static OFBooleanValue NO_MASK = TRUE;
+    public final static OFBooleanValue FULL_MASK = FALSE;
+
+    private final boolean value;
+
+    private OFBooleanValue(boolean value) {
+      this.value = value;
+    }
+
+    public static OFBooleanValue of(boolean value) {
+      return value ? TRUE : FALSE;
+    }
+
+    public boolean getValue() {
+      return value;
+    }
+
+    public int getInt() {
+      return value ? 1 : 0;
+    }
+
+    @Override
+    public String toString() {
+        return "" + value;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + getInt();
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        OFBooleanValue other = (OFBooleanValue) obj;
+        if (value != other.value)
+            return false;
+        return true;
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeByte(getInt());
+    }
+
+    private static class Reader implements OFMessageReader<OFBooleanValue> {
+        @Override
+        public OFBooleanValue readFrom(ChannelBuffer bb) throws OFParseError {
+            return of(bb.readByte() != 0);
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return 1;
+    }
+
+    @Override
+    public OFBooleanValue applyMask(OFBooleanValue mask) {
+        return of(value && mask.value);
+    }
+
+    @Override
+    public int compareTo(OFBooleanValue o) {
+        return getInt() - o.getInt();
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte((byte)getInt());
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
new file mode 100644
index 0000000..7f76b4d
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
@@ -0,0 +1,69 @@
+package org.projectfloodlight.openflow.types;
+
+import org.projectfloodlight.openflow.annotations.Immutable;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+/**
+ * Abstraction of a buffer id in OpenFlow. Immutable.
+ *
+ * @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
+ */
+@Immutable
+public class OFBufferId implements Comparable<OFBufferId>, PrimitiveSinkable {
+    public static final OFBufferId NO_BUFFER = new OFBufferId(0xFFFFFFFF);
+
+    private final int rawValue;
+
+    private OFBufferId(int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static OFBufferId of(final int rawValue) {
+        if (rawValue == NO_BUFFER.getInt())
+            return NO_BUFFER;
+        return new OFBufferId(rawValue);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public String toString() {
+        return Long.toString(U32.f(rawValue));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        OFBufferId other = (OFBufferId) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int compareTo(OFBufferId o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFErrorCauseData.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFErrorCauseData.java
new file mode 100644
index 0000000..824b809
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFErrorCauseData.java
@@ -0,0 +1,127 @@
+package org.projectfloodlight.openflow.types;
+
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFErrorMsg;
+import org.projectfloodlight.openflow.protocol.OFFactories;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.protocol.Writeable;
+import org.projectfloodlight.openflow.util.ChannelUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Optional;
+import com.google.common.hash.PrimitiveSink;
+
+/** A special-purpose wrapper for the 'data' field in an {@link OFErrorMsg} message
+ *  that contains a byte serialization of the offending message.
+ *
+ *  This attempts to parse the offending message on demand, and if successful
+ *  will present the parsed message.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+public class OFErrorCauseData implements Writeable, PrimitiveSinkable {
+    private static final Logger logger =
+            LoggerFactory.getLogger(OFErrorCauseData.class);
+
+    /** A default 'empty' cause. Note: the OFVersion OF_13 passed in here is irrelevant,
+     *  because parsing of the 0-byte array will always return null, irrespective of the
+     *  version.
+     */
+    public static final OFErrorCauseData NONE = new OFErrorCauseData(new byte[0], OFVersion.OF_13);
+
+    private final byte[] data;
+    private final OFVersion version;
+
+    private OFErrorCauseData(byte[] data, OFVersion version) {
+        this.data = data;
+        this.version = version;
+    }
+
+    public static OFErrorCauseData of(byte[] data, OFVersion version) {
+         return new OFErrorCauseData(Arrays.copyOf(data, data.length), version);
+    }
+
+    public byte[] getData() {
+        return Arrays.copyOf(data, data.length);
+    }
+
+    public Optional<OFMessage> getParsedMessage() {
+        OFFactory factory = OFFactories.getFactory(version);
+        try {
+            OFMessage msg = factory.getReader().readFrom(ChannelBuffers.wrappedBuffer(data));
+            if(msg != null)
+                return Optional.of(msg);
+            else
+                return Optional.absent();
+        } catch (OFParseError e) {
+            logger.debug("Error parsing error cause data as OFMessage: {}", e.getMessage(), e);
+            return Optional.absent();
+        }
+    }
+
+    public static OFErrorCauseData read(ChannelBuffer bb, int length, OFVersion version) {
+        byte[] bytes = ChannelUtils.readBytes(bb, length);
+        return of(bytes, version);
+   }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putBytes(data);
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeBytes(data);
+    }
+
+   @Override
+   public String toString() {
+      Optional<OFMessage> parsedMessage = getParsedMessage();
+      if(parsedMessage.isPresent()) {
+          return String.valueOf(parsedMessage.get());
+      } else {
+          StringBuilder b = new StringBuilder();
+          b.append("[unparsed: ");
+          for(int i=0; i<data.length; i++) {
+              if(i>0)
+                  b.append(" ");
+              b.append(String.format("%02x", data[i]));
+          }
+          b.append("]");
+          return b.toString();
+      }
+   }
+
+   @Override
+   public int hashCode() {
+       final int prime = 31;
+       int result = 1;
+       result = prime * result + Arrays.hashCode(data);
+       result = prime * result + ((version == null) ? 0 : version.hashCode());
+       return result;
+   }
+
+   @Override
+   public boolean equals(Object obj) {
+       if (this == obj)
+           return true;
+       if (obj == null)
+           return false;
+       if (getClass() != obj.getClass())
+           return false;
+       OFErrorCauseData other = (OFErrorCauseData) obj;
+       if (!Arrays.equals(data, other.data))
+           return false;
+       if (version != other.version)
+           return false;
+       return true;
+   }
+
+}
\ No newline at end of file
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFGroup.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFGroup.java
new file mode 100644
index 0000000..b05d5fa
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFGroup.java
@@ -0,0 +1,156 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.annotations.Immutable;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+/**
+ * Abstraction of an logical / OpenFlow group (ofp_group) in OpenFlow.
+ * Immutable.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+@Immutable
+public class OFGroup implements OFValueType<OFGroup> {
+    static final int LENGTH = 4;
+
+    // private int constants (OF1.1+) to avoid duplication in the code
+    // should not have to use these outside this class
+    private static final int ZERO_VAL = 0x00;
+    private static final int MAX_VAL = 0xffffff00;
+    private static final int ALL_VAL = 0xfffffffc;
+    private static final int ANY_VAL = 0xffffffff;
+
+
+    // ////////////// public constants - use to access well known OpenFlow group constants
+
+    /** Maximum number of physical and logical switch groups. */
+    public final static OFGroup MAX = new NamedGroup(MAX_VAL, "max");
+
+    /** All groups */
+    public final static OFGroup ALL = new NamedGroup(ALL_VAL, "all");
+
+    /**
+     * Wildcard group used only for flow mod (delete) and flow stats requests. */
+    public final static OFGroup ANY = new NamedGroup(ANY_VAL, "any");
+
+    /** group 0 in case we need it */
+    public static final OFGroup ZERO = OFGroup.of(ZERO_VAL);
+
+    public static final OFGroup NO_MASK = ANY;
+    public static final OFGroup FULL_MASK = ZERO;
+
+    /** raw openflow group number as a signed 32 bit integer */
+    private final int groupNumber;
+
+    /** private constructor. use of*-Factory methods instead */
+    private OFGroup(final int portNumber) {
+        this.groupNumber = portNumber;
+    }
+
+    /**
+     * get an OFGroup object corresponding to a raw 32-bit integer group number.
+     * NOTE: The group object may either be newly allocated or cached. Do not
+     * rely on either behavior.
+     *
+     * @param groupNumber the raw 32-bit group number
+     * @return a corresponding OFPort
+     */
+    public static OFGroup of(final int groupNumber) {
+        switch(groupNumber) {
+            case ZERO_VAL:
+                return MAX;
+            case MAX_VAL:
+                return MAX;
+            case ALL_VAL:
+                return ALL;
+            case ANY_VAL:
+                return ANY;
+            default:
+                if(UnsignedInts.compare(groupNumber, MAX_VAL) > 0) {
+                    // greater than max_val, but not one of the reserved values
+                    throw new IllegalArgumentException("Unknown special group number: "
+                            + groupNumber);
+                }
+                return new OFGroup(groupNumber);
+        }
+    }
+
+    /** return the group number as a int32 */
+    public int getGroupNumber() {
+        return groupNumber;
+    }
+
+    @Override
+    public String toString() {
+        return UnsignedInts.toString(groupNumber);
+    }
+
+    /** Extension of OFGroup for named groups */
+    static class NamedGroup extends OFGroup {
+        private final String name;
+
+        NamedGroup(final int portNo, final String name) {
+            super(portNo);
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        @Override
+        public String toString() {
+            return name;
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof OFGroup))
+            return false;
+        OFGroup other = (OFGroup)obj;
+        if (other.groupNumber != this.groupNumber)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 53;
+        int result = 1;
+        result = prime * result + groupNumber;
+        return result;
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(this.groupNumber);
+    }
+
+    public static OFGroup read4Bytes(ChannelBuffer c) throws OFParseError {
+        return OFGroup.of(c.readInt());
+    }
+
+    @Override
+    public OFGroup applyMask(OFGroup mask) {
+        return OFGroup.of(this.groupNumber & mask.groupNumber);
+    }
+
+    @Override
+    public int compareTo(OFGroup o) {
+        return UnsignedInts.compare(this.groupNumber, o.groupNumber);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(groupNumber);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFHelloElement.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFHelloElement.java
new file mode 100644
index 0000000..10d06a0
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFHelloElement.java
@@ -0,0 +1,5 @@
+package org.projectfloodlight.openflow.types;
+
+public interface OFHelloElement {
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
new file mode 100644
index 0000000..fcabdcd
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
@@ -0,0 +1,81 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+
+public class OFMetadata implements OFValueType<OFMetadata> {
+
+    static int LENGTH = 8;
+
+    private final U64 u64;
+
+    public static final OFMetadata NONE = OFMetadata.of(U64.ZERO);
+
+    public static final OFMetadata NO_MASK = OFMetadata.of(U64.ofRaw(0xFFFFFFFFFFFFFFFFl));
+    public static final OFMetadata FULL_MASK = OFMetadata.of(U64.ofRaw(0x0));
+
+    public OFMetadata(U64 ofRaw) {
+        u64 = ofRaw;
+    }
+
+    public static OFMetadata of(U64 u64) {
+        return new OFMetadata(u64);
+    }
+
+    public static OFMetadata ofRaw(long raw) {
+        return new OFMetadata(U64.ofRaw(raw));
+    }
+
+    public U64 getValue() {
+        return u64;
+    }
+
+    public static OFMetadata read8Bytes(ChannelBuffer cb) {
+        return OFMetadata.ofRaw(cb.readLong());
+    }
+
+    public void write8Bytes(ChannelBuffer cb) {
+        u64.writeTo(cb);
+    }
+
+    @Override
+    public int getLength() {
+        return u64.getLength();
+    }
+
+    @Override
+    public OFMetadata applyMask(OFMetadata mask) {
+        return OFMetadata.of(this.u64.applyMask(mask.u64));
+    }
+
+    @Override
+    public boolean equals(Object arg0) {
+        if (!(arg0 instanceof OFMetadata))
+            return false;
+        OFMetadata other = (OFMetadata)arg0;
+
+        return this.u64.equals(other.u64);
+    }
+
+    @Override
+    public int hashCode() {
+        int prime = 53;
+        return this.u64.hashCode() * prime;
+    }
+
+    @Override
+    public String toString() {
+        return "Metadata: " + u64.toString();
+    }
+
+    @Override
+    public int compareTo(OFMetadata o) {
+        return u64.compareTo(o.u64);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        u64.putTo(sink);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFPort.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
new file mode 100644
index 0000000..155a9db
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
@@ -0,0 +1,563 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.annotations.Immutable;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+/**
+ * Abstraction of an logical / OpenFlow switch port (ofp_port_no) in OpenFlow.
+ * Immutable. Note: Switch port numbers were changed in OpenFlow 1.1 from uint16
+ * to uint32. This class uses a 32 bit representation internally. Port numbers
+ * are converted from/to uint16 when constructed / getPortNumberasShort is
+ * called. If this port is not representable in OpenFlow 1.0, an
+ * IllegalStateException is raised.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+@Immutable
+public class OFPort implements OFValueType<OFPort> {
+    static final int LENGTH = 4;
+
+    // private int constants (OF1.1+) to avoid duplication in the code
+    // should not have to use these outside this class
+    private static final int OFPP_ANY_INT = 0xFFffFFff;
+    private static final int OFPP_LOCAL_INT = 0xFFffFFfe;
+    private static final int OFPP_CONTROLLER_INT = 0xFFffFFfd;
+    private static final int OFPP_ALL_INT = 0xFFffFFfc;
+    private static final int OFPP_FLOOD_INT = 0xFFffFFfb;
+    private static final int OFPP_NORMAL_INT = 0xFFffFFfa;
+    private static final int OFPP_TABLE_INT = 0xFFffFFf9;
+    private static final int OFPP_MAX_INT = 0xFFffFF00;
+    private static final int OFPP_IN_PORT_INT = 0xFFffFFf8;
+
+    // private short constants (OF1.0) to avoid duplication in the code
+    // should not have to use these outside this class
+    private static final short OFPP_ANY_SHORT = (short) 0xFFff;
+    private static final short OFPP_LOCAL_SHORT = (short) 0xFFfe;
+    private static final short OFPP_CONTROLLER_SHORT = (short) 0xFFfd;
+    private static final short OFPP_ALL_SHORT = (short) 0xFFfc;
+    private static final short OFPP_FLOOD_SHORT = (short) 0xFFfb;
+    private static final short OFPP_NORMAL_SHORT = (short) 0xFFfa;
+    private static final short OFPP_TABLE_SHORT = (short) 0xFFf9;
+    private static final short OFPP_IN_PORT_SHORT = (short) 0xFFf8;
+    private static final short OFPP_MAX_SHORT = (short) 0xFF00;
+    private static final int OFPP_MAX_SHORT_UNSIGNED = 0xFF00;
+
+    // ////////////// public constants - use to access well known OpenFlow ports
+
+    /** Maximum number of physical and logical switch ports. */
+    public final static OFPort MAX = new NamedPort(OFPP_MAX_INT, "max");
+
+    /**
+     * Send the packet out the input port. This reserved port must be explicitly
+     * used in order to send back out of the input port.
+     */
+    public final static OFPort IN_PORT = new NamedPort(OFPP_IN_PORT_INT, "in_port");
+
+    /**
+     * Submit the packet to the first flow table NB: This destination port can
+     * only be used in packet-out messages.
+     */
+    public final static OFPort TABLE = new NamedPort(OFPP_TABLE_INT, "table");
+
+    /** Process with normal L2/L3 switching. */
+    public final static OFPort NORMAL = new NamedPort(OFPP_NORMAL_INT, "normal");
+
+    /**
+     * All physical ports in VLAN, except input port and those blocked or link
+     * down
+     */
+    public final static OFPort FLOOD = new NamedPort(OFPP_FLOOD_INT, "flood");
+
+    /** All physical ports except input port */
+    public final static OFPort ALL = new NamedPort(OFPP_ALL_INT, "all");
+
+    /** Send to controller */
+    public final static OFPort CONTROLLER =
+            new NamedPort(OFPP_CONTROLLER_INT, "controller");
+
+    /** local openflow "port" */
+    public final static OFPort LOCAL = new NamedPort(OFPP_LOCAL_INT, "local");
+
+    /**
+     * Wildcard port used only for flow mod (delete) and flow stats requests.
+     * Selects all flows regardless of output port (including flows with no
+     * output port). NOTE: OpenFlow 1.0 calls this 'NONE'
+     */
+    public final static OFPort ANY = new NamedPort(OFPP_ANY_INT, "any");
+    /** the wildcarded default for OpenFlow 1.0 (value: 0). Elsewhere in OpenFlow
+     *  we need "ANY" as the default
+     */
+    public static final OFPort ZERO = OFPort.of(0);
+
+    public static final OFPort NO_MASK = OFPort.of(0xFFFFFFFF);
+    public static final OFPort FULL_MASK = ZERO;
+
+    /** cache of frequently used ports */
+    private static class PrecachedPort {
+        private final static OFPort p0 = new OFPort(0);
+        private final static OFPort p1 = new OFPort(1);
+        private final static OFPort p2 = new OFPort(2);
+        private final static OFPort p3 = new OFPort(3);
+        private final static OFPort p4 = new OFPort(4);
+        private final static OFPort p5 = new OFPort(5);
+        private final static OFPort p6 = new OFPort(6);
+        private final static OFPort p7 = new OFPort(7);
+        private final static OFPort p8 = new OFPort(8);
+        private final static OFPort p9 = new OFPort(9);
+        private final static OFPort p10 = new OFPort(10);
+        private final static OFPort p11 = new OFPort(11);
+        private final static OFPort p12 = new OFPort(12);
+        private final static OFPort p13 = new OFPort(13);
+        private final static OFPort p14 = new OFPort(14);
+        private final static OFPort p15 = new OFPort(15);
+        private final static OFPort p16 = new OFPort(16);
+        private final static OFPort p17 = new OFPort(17);
+        private final static OFPort p18 = new OFPort(18);
+        private final static OFPort p19 = new OFPort(19);
+        private final static OFPort p20 = new OFPort(20);
+        private final static OFPort p21 = new OFPort(21);
+        private final static OFPort p22 = new OFPort(22);
+        private final static OFPort p23 = new OFPort(23);
+        private final static OFPort p24 = new OFPort(24);
+        private final static OFPort p25 = new OFPort(25);
+        private final static OFPort p26 = new OFPort(26);
+        private final static OFPort p27 = new OFPort(27);
+        private final static OFPort p28 = new OFPort(28);
+        private final static OFPort p29 = new OFPort(29);
+        private final static OFPort p31 = new OFPort(31);
+        private final static OFPort p32 = new OFPort(32);
+        private final static OFPort p33 = new OFPort(33);
+        private final static OFPort p34 = new OFPort(34);
+        private final static OFPort p35 = new OFPort(35);
+        private final static OFPort p36 = new OFPort(36);
+        private final static OFPort p37 = new OFPort(37);
+        private final static OFPort p38 = new OFPort(38);
+        private final static OFPort p39 = new OFPort(39);
+        private final static OFPort p40 = new OFPort(40);
+        private final static OFPort p41 = new OFPort(41);
+        private final static OFPort p42 = new OFPort(42);
+        private final static OFPort p43 = new OFPort(43);
+        private final static OFPort p44 = new OFPort(44);
+        private final static OFPort p45 = new OFPort(45);
+        private final static OFPort p46 = new OFPort(46);
+        private final static OFPort p47 = new OFPort(47);
+        private final static OFPort p48 = new OFPort(48);
+    }
+
+    /** raw openflow port number as a signed 32 bit integer */
+    private final int portNumber;
+
+    /** private constructor. use of*-Factory methods instead */
+    private OFPort(final int portNumber) {
+        this.portNumber = portNumber;
+    }
+
+    /**
+     * get an OFPort object corresponding to a raw 32-bit integer port number.
+     * NOTE: The port object may either be newly allocated or cached. Do not
+     * rely on either behavior.
+     *
+     * @param portNumber
+     * @return a corresponding OFPort
+     */
+    public static OFPort ofInt(final int portNumber) {
+        switch (portNumber) {
+            case 0:
+                return PrecachedPort.p0;
+            case 1:
+                return PrecachedPort.p1;
+            case 2:
+                return PrecachedPort.p2;
+            case 3:
+                return PrecachedPort.p3;
+            case 4:
+                return PrecachedPort.p4;
+            case 5:
+                return PrecachedPort.p5;
+            case 6:
+                return PrecachedPort.p6;
+            case 7:
+                return PrecachedPort.p7;
+            case 8:
+                return PrecachedPort.p8;
+            case 9:
+                return PrecachedPort.p9;
+            case 10:
+                return PrecachedPort.p10;
+            case 11:
+                return PrecachedPort.p11;
+            case 12:
+                return PrecachedPort.p12;
+            case 13:
+                return PrecachedPort.p13;
+            case 14:
+                return PrecachedPort.p14;
+            case 15:
+                return PrecachedPort.p15;
+            case 16:
+                return PrecachedPort.p16;
+            case 17:
+                return PrecachedPort.p17;
+            case 18:
+                return PrecachedPort.p18;
+            case 19:
+                return PrecachedPort.p19;
+            case 20:
+                return PrecachedPort.p20;
+            case 21:
+                return PrecachedPort.p21;
+            case 22:
+                return PrecachedPort.p22;
+            case 23:
+                return PrecachedPort.p23;
+            case 24:
+                return PrecachedPort.p24;
+            case 25:
+                return PrecachedPort.p25;
+            case 26:
+                return PrecachedPort.p26;
+            case 27:
+                return PrecachedPort.p27;
+            case 28:
+                return PrecachedPort.p28;
+            case 29:
+                return PrecachedPort.p29;
+            case 31:
+                return PrecachedPort.p31;
+            case 32:
+                return PrecachedPort.p32;
+            case 33:
+                return PrecachedPort.p33;
+            case 34:
+                return PrecachedPort.p34;
+            case 35:
+                return PrecachedPort.p35;
+            case 36:
+                return PrecachedPort.p36;
+            case 37:
+                return PrecachedPort.p37;
+            case 38:
+                return PrecachedPort.p38;
+            case 39:
+                return PrecachedPort.p39;
+            case 40:
+                return PrecachedPort.p40;
+            case 41:
+                return PrecachedPort.p41;
+            case 42:
+                return PrecachedPort.p42;
+            case 43:
+                return PrecachedPort.p43;
+            case 44:
+                return PrecachedPort.p44;
+            case 45:
+                return PrecachedPort.p45;
+            case 46:
+                return PrecachedPort.p46;
+            case 47:
+                return PrecachedPort.p47;
+            case 48:
+                return PrecachedPort.p48;
+            case OFPP_MAX_INT:
+                return MAX;
+            case OFPP_IN_PORT_INT:
+                return IN_PORT;
+            case OFPP_TABLE_INT:
+                return TABLE;
+            case OFPP_NORMAL_INT:
+                return NORMAL;
+            case OFPP_FLOOD_INT:
+                return FLOOD;
+            case OFPP_ALL_INT:
+                return ALL;
+            case OFPP_CONTROLLER_INT:
+                return CONTROLLER;
+            case OFPP_LOCAL_INT:
+                return LOCAL;
+            case OFPP_ANY_INT:
+                return ANY;
+            default:
+                // note: This means effectively : portNumber > OFPP_MAX_SHORT
+                // accounting for
+                // signedness of both portNumber and OFPP_MAX_INT(which is
+                // -256).
+                // Any unsigned integer value > OFPP_MAX_INT will be ]-256:0[
+                // when read signed
+                if (portNumber < 0 && portNumber > OFPP_MAX_INT)
+                    throw new IllegalArgumentException("Unknown special port number: "
+                            + portNumber);
+                return new OFPort(portNumber);
+        }
+    }
+
+    /** convenience function: delegates to ofInt */
+    public static OFPort of(final int portNumber) {
+        return ofInt(portNumber);
+    }
+
+    /**
+     * get an OFPort object corresponding to a raw signed 16-bit integer port
+     * number (OF1.0). Note that the port returned will have the corresponding
+     * 32-bit integer value allocated as its port number. NOTE: The port object
+     * may either be newly allocated or cached. Do not rely on either behavior.
+     *
+     * @param portNumber
+     * @return a corresponding OFPort
+     */
+    public static OFPort ofShort(final short portNumber) {
+        switch (portNumber) {
+            case 0:
+                return PrecachedPort.p0;
+            case 1:
+                return PrecachedPort.p1;
+            case 2:
+                return PrecachedPort.p2;
+            case 3:
+                return PrecachedPort.p3;
+            case 4:
+                return PrecachedPort.p4;
+            case 5:
+                return PrecachedPort.p5;
+            case 6:
+                return PrecachedPort.p6;
+            case 7:
+                return PrecachedPort.p7;
+            case 8:
+                return PrecachedPort.p8;
+            case 9:
+                return PrecachedPort.p9;
+            case 10:
+                return PrecachedPort.p10;
+            case 11:
+                return PrecachedPort.p11;
+            case 12:
+                return PrecachedPort.p12;
+            case 13:
+                return PrecachedPort.p13;
+            case 14:
+                return PrecachedPort.p14;
+            case 15:
+                return PrecachedPort.p15;
+            case 16:
+                return PrecachedPort.p16;
+            case 17:
+                return PrecachedPort.p17;
+            case 18:
+                return PrecachedPort.p18;
+            case 19:
+                return PrecachedPort.p19;
+            case 20:
+                return PrecachedPort.p20;
+            case 21:
+                return PrecachedPort.p21;
+            case 22:
+                return PrecachedPort.p22;
+            case 23:
+                return PrecachedPort.p23;
+            case 24:
+                return PrecachedPort.p24;
+            case 25:
+                return PrecachedPort.p25;
+            case 26:
+                return PrecachedPort.p26;
+            case 27:
+                return PrecachedPort.p27;
+            case 28:
+                return PrecachedPort.p28;
+            case 29:
+                return PrecachedPort.p29;
+            case 31:
+                return PrecachedPort.p31;
+            case 32:
+                return PrecachedPort.p32;
+            case 33:
+                return PrecachedPort.p33;
+            case 34:
+                return PrecachedPort.p34;
+            case 35:
+                return PrecachedPort.p35;
+            case 36:
+                return PrecachedPort.p36;
+            case 37:
+                return PrecachedPort.p37;
+            case 38:
+                return PrecachedPort.p38;
+            case 39:
+                return PrecachedPort.p39;
+            case 40:
+                return PrecachedPort.p40;
+            case 41:
+                return PrecachedPort.p41;
+            case 42:
+                return PrecachedPort.p42;
+            case 43:
+                return PrecachedPort.p43;
+            case 44:
+                return PrecachedPort.p44;
+            case 45:
+                return PrecachedPort.p45;
+            case 46:
+                return PrecachedPort.p46;
+            case 47:
+                return PrecachedPort.p47;
+            case 48:
+                return PrecachedPort.p48;
+            case OFPP_MAX_SHORT:
+                return MAX;
+            case OFPP_IN_PORT_SHORT:
+                return IN_PORT;
+            case OFPP_TABLE_SHORT:
+                return TABLE;
+            case OFPP_NORMAL_SHORT:
+                return NORMAL;
+            case OFPP_FLOOD_SHORT:
+                return FLOOD;
+            case OFPP_ALL_SHORT:
+                return ALL;
+            case OFPP_CONTROLLER_SHORT:
+                return CONTROLLER;
+            case OFPP_LOCAL_SHORT:
+                return LOCAL;
+            case OFPP_ANY_SHORT:
+                return ANY;
+            default:
+                // note: This means effectively : portNumber > OFPP_MAX_SHORT
+                // accounting for
+                // signedness of both portNumber and OFPP_MAX_SHORT (which is
+                // -256).
+                // Any unsigned integer value > OFPP_MAX_SHORT will be ]-256:0[
+                // when read signed
+                if (portNumber < 0 && portNumber > OFPP_MAX_SHORT)
+                    throw new IllegalArgumentException("Unknown special port number: "
+                            + portNumber);
+                return new OFPort(portNumber);
+        }
+    }
+
+    /** return the port number as a int32 */
+    public int getPortNumber() {
+        return portNumber;
+    }
+
+    /**
+     * return the port number as int16. Special ports as defined by the OpenFlow
+     * spec will be converted to their OpenFlow 1.0 equivalent. port numbers >=
+     * FF00 will cause a IllegalArgumentException to be thrown
+     *
+     * @throws IllegalArgumentException
+     *             if a regular port number exceeds the maximum value in OF1.0
+     **/
+    public short getShortPortNumber() {
+
+        switch (portNumber) {
+            case OFPP_MAX_INT:
+                return OFPP_MAX_SHORT;
+            case OFPP_IN_PORT_INT:
+                return OFPP_IN_PORT_SHORT;
+            case OFPP_TABLE_INT:
+                return OFPP_TABLE_SHORT;
+            case OFPP_NORMAL_INT:
+                return OFPP_NORMAL_SHORT;
+            case OFPP_FLOOD_INT:
+                return OFPP_FLOOD_SHORT;
+            case OFPP_ALL_INT:
+                return OFPP_ALL_SHORT;
+            case OFPP_CONTROLLER_INT:
+                return OFPP_CONTROLLER_SHORT;
+            case OFPP_LOCAL_INT:
+                return OFPP_LOCAL_SHORT;
+            case OFPP_ANY_INT:
+                return OFPP_ANY_SHORT;
+
+            default:
+                if (portNumber >= OFPP_MAX_SHORT_UNSIGNED || portNumber < 0)
+                    throw new IllegalArgumentException("32bit Port number "
+                            + U32.f(portNumber)
+                            + " cannot be represented as uint16 (OF1.0)");
+
+                return (short) portNumber;
+        }
+    }
+
+    @Override
+    public String toString() {
+        return Long.toString(U32.f(portNumber));
+    }
+
+    /** Extension of OFPort for named ports */
+    static class NamedPort extends OFPort {
+        private final String name;
+
+        NamedPort(final int portNo, final String name) {
+            super(portNo);
+            this.name = name;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        @Override
+        public String toString() {
+            return name;
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof OFPort))
+            return false;
+        OFPort other = (OFPort)obj;
+        if (other.portNumber != this.portNumber)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 53;
+        int result = 1;
+        result = prime * result + portNumber;
+        return result;
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.portNumber);
+    }
+
+    public static OFPort read2Bytes(ChannelBuffer c) throws OFParseError {
+        return OFPort.ofShort(c.readShort());
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(this.portNumber);
+    }
+
+    public static OFPort read4Bytes(ChannelBuffer c) throws OFParseError {
+        return OFPort.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
+    }
+
+    @Override
+    public OFPort applyMask(OFPort mask) {
+        return OFPort.of(this.portNumber & mask.portNumber);
+    }
+
+    @Override
+    public int compareTo(OFPort o) {
+        return UnsignedInts.compare(this.portNumber, o.portNumber);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(portNumber);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java
new file mode 100644
index 0000000..63b97f3
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFPortBitMap.java
@@ -0,0 +1,165 @@
+package org.projectfloodlight.openflow.types;
+
+import java.util.ArrayList;
+
+import javax.annotation.concurrent.Immutable;
+
+
+/** User-facing object representing a bitmap of ports that can be matched on.
+ *  This is implemented by the custom BSN OXM type of_oxm_bsn_in_ports_182.
+ *
+ *  You can call set() on the builder for all the Ports you want to match on
+ *  and unset to exclude the port.
+ *
+ *  <b>Implementation note:</b> to comply with the matching semantics of OXM (which is a logical "AND" not "OR")
+ *  the underlying match uses a data format which is very unintuitive. The value is always
+ *  0, and the mask has the bits set for the ports that should <b>NOT</b> be included in the
+ *  range.
+ *
+ *  For the curious: We transformed the bitmap (a logical OR) problem into a logical
+ *  AND NOT problem.
+ *
+ *  We logically mean:   Inport is 1 OR 3
+ *  We technically say:  Inport IS NOT 2 AND IS NOT 4 AND IS NOT 5 AND IS NOT ....
+ *  The second term cannot be represented in OXM, the second can.
+ *
+ *  That said, all that craziness is hidden from the user of this object.
+ *
+ *  <h2>Usage</h2>
+ *  OFPortBitmap is meant to be used with MatchField <tt>BSN_IN_PORTS_128</tt> in place
+ *  of the raw type Masked&lt;OFBitMask128&gt;.
+ *
+ *  <h3>Example:</h3>:
+ *  <pre>
+ *  OFPortBitMap portBitMap;
+ *  Match.Builder matchBuilder;
+ *  // initialize
+ *  matchBuilder.setMasked(MatchField.BSN_IN_PORTS_128, portBitmap);
+ *  </pre>
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+@Immutable
+public class OFPortBitMap extends Masked<OFBitMask128> {
+
+    private OFPortBitMap(OFBitMask128 mask) {
+        super(OFBitMask128.NONE, mask);
+    }
+
+    /** @return whether or not the given port is logically included in the
+     *  match, i.e., whether a packet from in-port <emph>port</emph> be matched by
+     *  this OXM.
+     */
+    public boolean isOn(OFPort port) {
+        // see the implementation note above about the logical inversion of the mask
+        return !(this.mask.isOn(port.getPortNumber()));
+    }
+
+    public static OFPortBitMap ofPorts(OFPort... ports) {
+        Builder builder = new Builder();
+        for (OFPort port: ports) {
+            builder.set(port);
+        }
+        return builder.build();
+    }
+
+    /** @return an OFPortBitmap based on the 'mask' part of an OFBitMask128, as, e.g., returned
+     *  by the switch.
+     **/
+    public static OFPortBitMap of(OFBitMask128 mask) {
+        return new OFPortBitMap(mask);
+    }
+
+    /** @return iterating over all ports that are logically included in the
+     *  match, i.e., whether a packet from in-port <emph>port</emph> be matched by
+     *  this OXM.
+     */
+    public Iterable<OFPort> getOnPorts() {
+        ArrayList<OFPort> ports = new ArrayList<>();
+        for(int i=0; i < 127; i++) {
+            if(!(this.mask.isOn(i))) {
+                ports.add(OFPort.of(i));
+            }
+        }
+        return ports;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof OFPortBitMap))
+            return false;
+        OFPortBitMap other = (OFPortBitMap)obj;
+        return (other.value.equals(this.value) && other.mask.equals(this.mask));
+    }
+
+    @Override
+    public int hashCode() {
+        return 619 * mask.hashCode() + 257 * value.hashCode();
+    }
+
+    public static class Builder {
+        private long raw1 = -1, raw2 = -1;
+
+        public Builder() {
+
+        }
+
+        /** @return whether or not the given port is logically included in the
+         *  match, i.e., whether a packet from in-port <emph>port</emph> be matched by
+         *  this OXM.
+         */
+        public boolean isOn(OFPort port) {
+            // see the implementation note above about the logical inversion of the mask
+            return !(OFBitMask128.isBitOn(raw1, raw2, port.getPortNumber()));
+        }
+
+        /** remove this port from the match, i.e., packets from this in-port
+         *  will NOT be matched.
+         */
+        public Builder unset(OFPort port) {
+            // see the implementation note above about the logical inversion of the mask
+            int bit = port.getPortNumber();
+            if (bit < 0 || bit > 127)
+                throw new IndexOutOfBoundsException("Port number is out of bounds");
+            else if (bit == 127)
+                // the highest order bit in the bitmask is reserved. The switch will
+                // set that bit for all ports >= 127. The reason is that we don't want
+                // the OFPortMap to match all ports out of its range (i.e., a packet
+                // coming in on port 181 would match *any* OFPortMap).
+                throw new IndexOutOfBoundsException("The highest order bit in the bitmask is reserved.");
+            else if (bit < 64) {
+                raw2 |= ((long)1 << bit);
+            } else {
+                raw1 |= ((long)1 << (bit - 64));
+            }
+            return this;
+        }
+
+        /** add this port from the match, i.e., packets from this in-port
+         *  will NOT be matched.
+         */
+        public Builder set(OFPort port) {
+            // see the implementation note above about the logical inversion of the mask
+            int bit = port.getPortNumber();
+            if (bit < 0 || bit > 127)
+                throw new IndexOutOfBoundsException("Port number is out of bounds");
+            else if (bit == 127)
+                // the highest order bit in the bitmask is reserved. The switch will
+                // set that bit for all ports >= 127. The reason is that we don't want
+                // the OFPortMap to match all ports out of its range (i.e., a packet
+                // coming in on port 181 would match *any* OFPortMap).
+                throw new IndexOutOfBoundsException("The highest order bit in the bitmask is reserved.");
+            else if (bit < 64) {
+                raw2 &= ~((long)1 << bit);
+            } else {
+                raw1 &= ~((long)1 << (bit - 64));
+            }
+            return this;
+        }
+
+        public OFPortBitMap build() {
+            return new OFPortBitMap(OFBitMask128.of(raw1, raw2));
+        }
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
new file mode 100644
index 0000000..03e84dd
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
@@ -0,0 +1,11 @@
+package org.projectfloodlight.openflow.types;
+
+
+
+
+public interface OFValueType<T extends OFValueType<T>> extends Comparable<T>, PrimitiveSinkable {
+    public int getLength();
+
+    public T applyMask(T mask);
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFVlanVidMatch.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFVlanVidMatch.java
new file mode 100644
index 0000000..0a35926
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFVlanVidMatch.java
@@ -0,0 +1,204 @@
+package org.projectfloodlight.openflow.types;
+
+import java.util.Arrays;
+
+import javax.annotation.Nullable;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+/** Represents an OpenFlow Vlan VID for use in Matches, as specified by the OpenFlow 1.3 spec.
+ *
+ *  <b> Note: this is not just the 12-bit vlan tag. OpenFlow defines
+ *      the additional mask bits 0x1000 to represent the presence of a vlan
+ *      tag. This additional bit will be stripped when writing a OF1.0 value
+ *      tag.
+ *  </b>
+ *
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ *
+ */
+public class OFVlanVidMatch implements OFValueType<OFVlanVidMatch> {
+    private static final Logger logger = LoggerFactory.getLogger(OFVlanVidMatch.class);
+
+    private static final short VALIDATION_MASK = 0x1FFF;
+    private static final short PRESENT_VAL = 0x1000;
+    private static final short VLAN_MASK = 0x0FFF;
+    private static final short NONE_VAL = 0x0000;
+    private static final short UNTAGGED_VAL_OF13 = (short) 0x0000;
+    private static final short UNTAGGED_VAL_OF10 = (short) 0xFFFF;
+    final static int LENGTH = 2;
+
+    /** presence of a VLAN tag is indicated by the presence of bit 0x1000 */
+    public static final OFVlanVidMatch PRESENT = new OFVlanVidMatch(PRESENT_VAL);
+
+    /** this value means 'not set' in OF1.0 (e.g., in a match). not used elsewhere */
+    public static final OFVlanVidMatch NONE = new OFVlanVidMatch(NONE_VAL);
+
+    /** for use with masking operations */
+    public static final OFVlanVidMatch NO_MASK = new OFVlanVidMatch((short)0xFFFF);
+    public static final OFVlanVidMatch FULL_MASK = NONE;
+
+    /** an untagged packet is specified as 0000 in OF 1.0, but 0xFFFF in OF1.0. Special case that. */
+    public static final OFVlanVidMatch UNTAGGED = new OFVlanVidMatch(NONE_VAL) {
+        @Override
+        public void write2BytesOF10(ChannelBuffer c) {
+            c.writeShort(UNTAGGED_VAL_OF10);
+        }
+    };
+
+    private final short vid;
+
+    private OFVlanVidMatch(short vid) {
+        this.vid = vid;
+    }
+
+    public static OFVlanVidMatch ofRawVid(short vid) {
+        if(vid == UNTAGGED_VAL_OF13)
+            return UNTAGGED;
+        else if(vid == PRESENT_VAL)
+            return PRESENT;
+        else if(vid == UNTAGGED_VAL_OF10) {
+            // workaround for IVS sometimes sending 0F1.0 untagged (0xFFFF) values
+            logger.warn("Warning: received OF1.0 untagged vlan value (0xFFFF) in OF1.3 VlanVid. Treating as UNTAGGED");
+            return UNTAGGED;
+        } else if ((vid & VALIDATION_MASK) != vid)
+            throw new IllegalArgumentException(String.format("Illegal VLAN value: %x", vid));
+        return new OFVlanVidMatch(vid);
+    }
+
+    public static OFVlanVidMatch ofVlanVid(VlanVid vid) {
+        if(vid == null)
+            return UNTAGGED;
+        else if(VlanVid.NO_MASK.equals(vid))
+            // NO_MASK is a special value in that it doesn't fit in the
+            // allowed value space (0x1FFF) of this type. Do a manual conversion
+            return NO_MASK;
+        else
+            return ofVlan(vid.getVlan());
+    }
+
+
+    public static OFVlanVidMatch ofVlan(int vlan) {
+        if( (vlan & VLAN_MASK) != vlan)
+            throw new IllegalArgumentException(String.format("Illegal VLAN value: %x", vlan));
+        return ofRawVid( (short) (vlan | PRESENT_VAL));
+    }
+
+    public static OFVlanVidMatch ofVlanOF10(short of10vlan) {
+        if(of10vlan == NONE_VAL) {
+            return NONE;
+        } else if(of10vlan == UNTAGGED_VAL_OF10) {
+            return UNTAGGED;
+        } else {
+            return ofVlan(of10vlan);
+        }
+    }
+
+    /** @return whether or not this VlanId has the present (0x1000) bit set */
+    public boolean isPresentBitSet() {
+       return (vid & PRESENT_VAL) != 0;
+    }
+
+    /** @return the actual VLAN tag this vid identifies */
+    public short getVlan() {
+        return (short) (vid & VLAN_MASK);
+    }
+
+    /** @return the actual vlan tag this vid identifies as a VlanVid object, if this
+     *  VlanVidMatch has the present bit set (i.e., identifies a tagged VLAN).
+     *  Else, returns null.
+     */
+    @Nullable
+    public VlanVid getVlanVid() {
+        if(this.equals(NO_MASK))
+            return VlanVid.NO_MASK;
+        else if(isPresentBitSet())
+            return VlanVid.ofVlan((short) (vid & VLAN_MASK));
+        else
+            return null;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof OFVlanVidMatch))
+            return false;
+        OFVlanVidMatch other = (OFVlanVidMatch)obj;
+        if (other.vid != this.vid)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int prime = 13873;
+        return this.vid * prime;
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Integer.toHexString(vid);
+    }
+
+    public short getRawVid() {
+        return vid;
+    }
+
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+
+    private volatile byte[] bytesCache = null;
+
+    public byte[] getBytes() {
+        if (bytesCache == null) {
+            synchronized (this) {
+                if (bytesCache == null) {
+                    bytesCache =
+                            new byte[] { (byte) ((vid >>> 8) & 0xFF),
+                                         (byte) ((vid >>> 0) & 0xFF) };
+                }
+            }
+        }
+        return Arrays.copyOf(bytesCache, bytesCache.length);
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.vid);
+    }
+
+    public void write2BytesOF10(ChannelBuffer c) {
+        c.writeShort(this.getVlan());
+    }
+
+    public static OFVlanVidMatch read2Bytes(ChannelBuffer c) throws OFParseError {
+        return OFVlanVidMatch.ofRawVid(c.readShort());
+    }
+
+    public static OFVlanVidMatch read2BytesOF10(ChannelBuffer c) throws OFParseError {
+        return OFVlanVidMatch.ofVlanOF10(c.readShort());
+    }
+
+    @Override
+    public OFVlanVidMatch applyMask(OFVlanVidMatch mask) {
+        return OFVlanVidMatch.ofRawVid((short)(this.vid & mask.vid));
+    }
+
+    @Override
+    public int compareTo(OFVlanVidMatch o) {
+        return Shorts.compare(vid, o.vid);
+    }
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort(vid);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFVlanVidMatchWithMask.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFVlanVidMatchWithMask.java
new file mode 100644
index 0000000..c91c28c
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/OFVlanVidMatchWithMask.java
@@ -0,0 +1,10 @@
+package org.projectfloodlight.openflow.types;
+
+public class OFVlanVidMatchWithMask extends Masked<OFVlanVidMatch> {
+    private OFVlanVidMatchWithMask(OFVlanVidMatch value, OFVlanVidMatch mask) {
+        super(value, mask);
+    }
+
+    /* a combination of Vlan Vid and mask that matches any tagged packet */
+    public final static OFVlanVidMatchWithMask ANY_TAGGED = new OFVlanVidMatchWithMask(OFVlanVidMatch.PRESENT, OFVlanVidMatch.PRESENT);
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/PortSpeed.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/PortSpeed.java
new file mode 100644
index 0000000..6affab8
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/PortSpeed.java
@@ -0,0 +1,33 @@
+package org.projectfloodlight.openflow.types;
+
+/**
+ * Represents the speed of a port
+ */
+public enum PortSpeed {
+    /** no speed set */
+    SPEED_NONE(0),
+    SPEED_10MB(10),
+    SPEED_100MB(100),
+    SPEED_1GB(1_000),
+    SPEED_10GB(10_000),
+    SPEED_40GB(40_000),
+    SPEED_100GB(100_000),
+    SPEED_1TB(1_000_000);
+
+    private long speedInBps;
+    private PortSpeed(int speedInMbps) {
+        this.speedInBps = speedInMbps * 1000L*1000L;
+    }
+
+    public long getSpeedBps() {
+        return this.speedInBps;
+    }
+
+    public static PortSpeed max(PortSpeed s1, PortSpeed s2) {
+        return (s1.getSpeedBps() > s2.getSpeedBps()) ? s1 : s2;
+    }
+
+    public static PortSpeed min(PortSpeed s1, PortSpeed s2) {
+        return (s1.getSpeedBps() < s2.getSpeedBps()) ? s1 : s2;
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/PrimitiveSinkable.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/PrimitiveSinkable.java
new file mode 100644
index 0000000..e50cb75
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/PrimitiveSinkable.java
@@ -0,0 +1,7 @@
+package org.projectfloodlight.openflow.types;
+
+import com.google.common.hash.PrimitiveSink;
+
+public interface PrimitiveSinkable {
+    public void putTo(PrimitiveSink sink);
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/TableId.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/TableId.java
new file mode 100644
index 0000000..950087d
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/TableId.java
@@ -0,0 +1,100 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+public class TableId implements OFValueType<TableId>, Comparable<TableId> {
+
+    final static int LENGTH = 1;
+
+    private static final short VALIDATION_MASK = 0x00FF;
+
+    private static final short ALL_VAL = 0x00FF;
+    private static final short NONE_VAL = 0x0000;
+    public static final TableId NONE = new TableId(NONE_VAL);
+
+    public static final TableId ALL = new TableId(ALL_VAL);
+    public static final TableId ZERO = NONE;
+
+    private final short id;
+
+    private TableId(short id) {
+        this.id = id;
+    }
+
+    public static TableId of(short id) {
+        switch(id) {
+            case NONE_VAL:
+                return NONE;
+            case ALL_VAL:
+                return ALL;
+            default:
+                if ((id & VALIDATION_MASK) != id)
+                    throw new IllegalArgumentException("Illegal Table id value: " + id);
+                return new TableId(id);
+        }
+    }
+
+    public static TableId of(int id) {
+        if((id & VALIDATION_MASK) != id)
+            throw new IllegalArgumentException("Illegal Table id value: "+id);
+        return of((short) id);
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Integer.toHexString(id);
+    }
+
+    public short getValue() {
+        return id;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.id);
+    }
+
+    public static TableId readByte(ChannelBuffer c) throws OFParseError {
+        return TableId.of(c.readUnsignedByte());
+    }
+
+    @Override
+    public TableId applyMask(TableId mask) {
+        return TableId.of((short)(this.id & mask.id));
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof TableId))
+            return false;
+        TableId other = (TableId)obj;
+        if (other.id != this.id)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int prime = 13873;
+        return this.id * prime;
+    }
+
+    @Override
+    public int compareTo(TableId other) {
+        return Shorts.compare(this.id, other.id);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte((byte) id);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
new file mode 100644
index 0000000..6ab0254
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
@@ -0,0 +1,98 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Ints;
+
+/**
+ * Represents L4 (Transport Layer) port (TCP, UDP, etc.)
+ *
+ * @author Yotam Harchol (yotam.harchol@bigswitch.com)
+ */
+public class TransportPort implements OFValueType<TransportPort> {
+
+    static final int LENGTH = 2;
+    static final int MAX_PORT = 0xFFFF;
+    static final int MIN_PORT = 0;
+
+    private final static int NONE_VAL = 0;
+    public final static TransportPort NONE = new TransportPort(NONE_VAL);
+
+    public static final TransportPort NO_MASK = new TransportPort(0xFFFFFFFF);
+    public static final TransportPort FULL_MASK = TransportPort.of(0x0);
+
+    private final int port;
+
+    private TransportPort(int port) {
+        this.port = port;
+    }
+
+    public static TransportPort of(int port) {
+        if(port == NONE_VAL)
+            return NONE;
+        else if (port == NO_MASK.port)
+            return NO_MASK;
+        else if (port < MIN_PORT || port > MAX_PORT) {
+            throw new IllegalArgumentException("Illegal transport layer port number: " + port);
+        }
+        return new TransportPort(port);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof TransportPort))
+            return false;
+        TransportPort other = (TransportPort)obj;
+        if (other.port != this.port)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 59;
+        int result = 1;
+        result = prime * result + port;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(port);
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.port);
+    }
+
+    public static TransportPort read2Bytes(ChannelBuffer c) throws OFParseError {
+        return TransportPort.of((c.readUnsignedShort() & 0x0FFFF));
+    }
+
+    @Override
+    public TransportPort applyMask(TransportPort mask) {
+        return TransportPort.of(this.port & mask.port);
+    }
+
+    @Override
+    public int compareTo(TransportPort o) {
+        return Ints.compare(port,  o.port);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort((short) port);
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U128.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U128.java
new file mode 100644
index 0000000..ddf4faa
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U128.java
@@ -0,0 +1,222 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.Nonnull;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedLongs;
+
+public class U128 implements OFValueType<U128>, HashValue<U128> {
+
+    static final int LENGTH = 16;
+
+    private final long raw1; // MSBs
+    private final long raw2; // LSBs
+
+    public static final U128 ZERO = new U128(0, 0);
+
+    private U128(long raw1, long raw2) {
+        this.raw1 = raw1;
+        this.raw2 = raw2;
+    }
+
+    public static U128 of(long raw1, long raw2) {
+        if (raw1 == 0 && raw2 == 0)
+            return ZERO;
+        return new U128(raw1, raw2);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+
+    public long getMsb() {
+        return raw1;
+    }
+
+    public long getLsb() {
+        return raw2;
+    }
+
+    @Override
+    public U128 applyMask(U128 mask) {
+        return and(mask);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (raw1 ^ (raw1 >>> 32));
+        result = prime * result + (int) (raw2 ^ (raw2 >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        U128 other = (U128) obj;
+        if (raw1 != other.raw1)
+            return false;
+        if (raw2 != other.raw2)
+            return false;
+        return true;
+    }
+
+    public void write16Bytes(ChannelBuffer cb) {
+        cb.writeLong(raw1);
+        cb.writeLong(raw2);
+    }
+
+    public static U128 read16Bytes(ChannelBuffer cb) {
+        long raw1 = cb.readLong();
+        long raw2 = cb.readLong();
+        return of(raw1, raw2);
+    }
+
+    @Override
+    public String toString() {
+        return String.format("0x%016x%016x", raw1, raw2);
+    }
+
+    @Override
+    public int compareTo(@Nonnull U128 o) {
+        int msb = UnsignedLongs.compare(this.raw1, o.raw1);
+        if(msb != 0)
+            return msb;
+        else
+            return UnsignedLongs.compare(this.raw2, o.raw2);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putLong(raw1);
+        sink.putLong(raw2);
+    }
+
+    @Override
+    public U128 inverse() {
+        return U128.of(~raw1, ~raw2);
+    }
+
+    @Override
+    public U128 or(U128 other) {
+        return U128.of(raw1 | other.raw1, raw2 | other.raw2);
+    }
+
+    @Override
+    public U128 and(U128 other) {
+        return U128.of(raw1 & other.raw1, raw2 & other.raw2);
+    }
+
+    @Override
+    public U128 xor(U128 other) {
+        return U128.of(raw1 ^ other.raw1, raw2 ^ other.raw2);
+    }
+
+    @Override
+    public U128 add(U128 other) {
+        long newRaw2 = this.raw2 + other.raw2;
+        long newRaw1 = this.raw1 + other.raw1;
+        if(UnsignedLongs.compare(newRaw2, this.raw2) < 0) {
+            // raw2 overflow
+            newRaw1+=1;
+        }
+        return U128.of(newRaw1, newRaw2);
+    }
+
+    @Override
+    public U128 subtract(U128 other) {
+        long newRaw2 = this.raw2 - other.raw2;
+        long newRaw1 = this.raw1 - other.raw1;
+        if(UnsignedLongs.compare(this.raw2, other.raw2) < 0) {
+            newRaw1 -= 1;
+        }
+        return U128.of(newRaw1, newRaw2);
+    }
+    @Override
+    public int prefixBits(int numBits) {
+        return HashValueUtils.prefixBits(this.raw1, numBits);
+    }
+
+    @Override
+    public HashValue.Builder<U128> builder() {
+        return new U128Builder(raw1, raw2);
+    }
+
+    static class U128Builder implements HashValue.Builder<U128> {
+        private long raw1, raw2;
+
+        public U128Builder(long raw1, long raw2) {
+            this.raw1 = raw1;
+            this.raw2 = raw2;
+        }
+
+        @Override
+        public Builder<U128> add(U128 other) {
+            raw2 += other.raw2;
+            raw1 += other.raw1;
+            if(UnsignedLongs.compare(raw2, other.raw2) < 0) {
+                // raw2 overflow
+                raw1+=1;
+            }
+            return this;
+        }
+
+        @Override
+        public Builder<U128> subtract(
+                U128 other) {
+            if(UnsignedLongs.compare(this.raw2, other.raw2) >= 0) {
+                raw2 -= other.raw2;
+                raw1 -= other.raw1;
+            } else {
+                // raw2 overflow
+                raw2 -= other.raw2;
+                raw1 = this.raw1 - other.raw1 - 1;
+            }
+            return this;
+        }
+
+        @Override
+        public Builder<U128> invert() {
+            raw1 = ~raw1;
+            raw2 = ~raw2;
+            return this;
+        }
+
+        @Override
+        public Builder<U128> or(U128 other) {
+            raw1 |= other.raw1;
+            raw2 |= other.raw2;
+            return this;
+        }
+
+        @Override
+        public Builder<U128> and(U128 other) {
+            raw1 &= other.raw1;
+            raw2 &= other.raw2;
+            return this;
+        }
+
+        @Override
+        public Builder<U128> xor(U128 other) {
+            raw1 ^= other.raw1;
+            raw2 ^= other.raw2;
+            return this;
+        }
+
+        @Override
+        public U128 build() {
+            return U128.of(raw1, raw2);
+        }
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U16.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U16.java
new file mode 100644
index 0000000..2466ffc
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U16.java
@@ -0,0 +1,130 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Ints;
+
+public class U16 implements Writeable, OFValueType<U16> {
+    private final static short ZERO_VAL = 0;
+    public final static U16 ZERO = new U16(ZERO_VAL);
+
+    private static final short NO_MASK_VAL = (short)0xFFff;
+    public final static U16 NO_MASK = new U16(NO_MASK_VAL);
+    public static final U16 FULL_MASK = ZERO;
+
+    public static int f(final short i) {
+        return i & 0xffff;
+    }
+
+    public static short t(final int l) {
+        return (short) l;
+    }
+
+    private final short raw;
+
+    private U16(short raw) {
+        this.raw = raw;
+    }
+
+    public static final U16 of(int value) {
+        return ofRaw(t(value));
+    }
+
+    public static final U16 ofRaw(short raw) {
+        if(raw == ZERO_VAL)
+            return ZERO;
+        return new U16(raw);
+    }
+
+    public int getValue() {
+        return f(raw);
+    }
+
+    public short getRaw() {
+        return raw;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("0x%04x", raw);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + raw;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        U16 other = (U16) obj;
+        if (raw != other.raw)
+            return false;
+        return true;
+    }
+
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeShort(raw);
+    }
+
+
+    public final static Reader READER = new Reader();
+
+    private static class Reader implements OFMessageReader<U16> {
+        @Override
+        public U16 readFrom(ChannelBuffer bb) throws OFParseError {
+            return ofRaw(bb.readShort());
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return 2;
+    }
+
+    @Override
+    public U16 applyMask(U16 mask) {
+        return ofRaw( (short) (raw & mask.raw));
+    }
+
+    @Override
+    public int compareTo(U16 o) {
+        return Ints.compare(f(raw), f(o.raw));
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort(raw);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U32.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U32.java
new file mode 100644
index 0000000..c69786c
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U32.java
@@ -0,0 +1,130 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+public class U32 implements Writeable, OFValueType<U32> {
+    private final static int ZERO_VAL = 0;
+    public final static U32 ZERO = new U32(ZERO_VAL);
+
+    private static final int NO_MASK_VAL = 0xFFffFFff;
+    public final static U32 NO_MASK = new U32(NO_MASK_VAL);
+    public static final U32 FULL_MASK = ZERO;
+
+    private final int raw;
+
+    private U32(int raw) {
+        this.raw = raw;
+    }
+
+    public static U32 of(long value) {
+        return ofRaw(U32.t(value));
+    }
+
+    public static U32 ofRaw(int raw) {
+        if(raw == ZERO_VAL)
+            return ZERO;
+        if(raw == NO_MASK_VAL)
+            return NO_MASK;
+        return new U32(raw);
+    }
+
+    public long getValue() {
+        return f(raw);
+    }
+
+    public int getRaw() {
+        return raw;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("0x%08x", raw);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + raw;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        U32 other = (U32) obj;
+        if (raw != other.raw)
+            return false;
+
+        return true;
+    }
+
+    public static long f(final int i) {
+        return i & 0xffffffffL;
+    }
+
+    public static int t(final long l) {
+        return (int) l;
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeInt(raw);
+    }
+
+    public final static Reader READER = new Reader();
+
+    private static class Reader implements OFMessageReader<U32> {
+        @Override
+        public U32 readFrom(ChannelBuffer bb) throws OFParseError {
+            return new U32(bb.readInt());
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return 4;
+    }
+
+    @Override
+    public U32 applyMask(U32 mask) {
+        return ofRaw(raw & mask.raw);
+    }
+
+    @Override
+    public int compareTo(U32 o) {
+        return UnsignedInts.compare(raw, o.raw);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(raw);
+    }}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U64.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U64.java
new file mode 100644
index 0000000..f15544f
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U64.java
@@ -0,0 +1,237 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.types;
+
+import java.math.BigInteger;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedLongs;
+
+public class U64 implements Writeable, OFValueType<U64>, HashValue<U64> {
+    private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;
+    private final static long ZERO_VAL = 0;
+    public final static U64 ZERO = new U64(ZERO_VAL);
+
+    private static final long NO_MASK_VAL = 0xFFffFFffFFffFFffL;
+    public final static U64 NO_MASK = new U64(NO_MASK_VAL);
+    public static final U64 FULL_MASK = ZERO;
+
+    private final long raw;
+
+    protected U64(final long raw) {
+        this.raw = raw;
+    }
+
+    public static U64 of(long raw) {
+        return ofRaw(raw);
+    }
+
+    public static U64 ofRaw(final long raw) {
+        if(raw == ZERO_VAL)
+            return ZERO;
+        return new U64(raw);
+    }
+
+    public static U64 parseHex(String hex) {
+        return new U64(new BigInteger(hex, 16).longValue());
+    }
+
+    public long getValue() {
+        return raw;
+    }
+
+    public BigInteger getBigInteger() {
+        BigInteger bigInt = BigInteger.valueOf(raw & UNSIGNED_MASK);
+        if (raw < 0) {
+          bigInt = bigInt.setBit(Long.SIZE - 1);
+        }
+        return bigInt;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("0x%016x", raw);
+    }
+
+    public static BigInteger f(final long value) {
+        BigInteger bigInt = BigInteger.valueOf(value & UNSIGNED_MASK);
+        if (value < 0) {
+          bigInt = bigInt.setBit(Long.SIZE - 1);
+        }
+        return bigInt;
+    }
+
+    public static long t(final BigInteger l) {
+        return l.longValue();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + (int) (raw ^ (raw >>> 32));
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        U64 other = (U64) obj;
+        if (raw != other.raw)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int getLength() {
+        return 8;
+    }
+
+    @Override
+    public U64 applyMask(U64 mask) {
+        return and(mask);
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeLong(raw);
+    }
+
+    @Override
+    public int compareTo(U64 o) {
+        return UnsignedLongs.compare(raw, o.raw);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putLong(raw);
+    }
+
+    @Override
+    public U64 inverse() {
+        return U64.of(~raw);
+    }
+
+    @Override
+    public U64 or(U64 other) {
+        return U64.of(raw | other.raw);
+    }
+
+    @Override
+    public U64 and(U64 other) {
+        return ofRaw(raw & other.raw);
+    }
+    @Override
+    public U64 xor(U64 other) {
+        return U64.of(raw ^ other.raw);
+    }
+
+    @Override
+    public U64 add(U64 other) {
+        return U64.of(this.raw + other.raw);
+    }
+
+    @Override
+    public U64 subtract(U64 other) {
+        return U64.of(this.raw - other.raw);
+    }
+
+    /** return the "numBits" highest-order bits of the hash.
+     *  @param numBits number of higest-order bits to return [0-32].
+     *  @return a numberic value of the 0-32 highest-order bits.
+     */
+    @Override
+    public int prefixBits(int numBits) {
+        return HashValueUtils.prefixBits(raw, numBits);
+    }
+
+    public final static Reader READER = new Reader();
+
+    private static class Reader implements OFMessageReader<U64> {
+        @Override
+        public U64 readFrom(ChannelBuffer bb) throws OFParseError {
+            return U64.ofRaw(bb.readLong());
+        }
+    }
+
+    @Override
+    public HashValue.Builder<U64> builder() {
+        return new U64Builder(raw);
+    }
+
+    static class U64Builder implements Builder<U64> {
+        long raw;
+
+        public U64Builder(long raw) {
+            this.raw = raw;
+        }
+
+        @Override
+        public Builder<U64> add(U64 other) {
+            raw += other.raw;
+            return this;
+        }
+
+        @Override
+        public Builder<U64> subtract(
+                U64 other) {
+            raw -= other.raw;
+            return this;
+        }
+
+        @Override
+        public Builder<U64> invert() {
+            raw = ~raw;
+            return this;
+        }
+
+        @Override
+        public Builder<U64> or(U64 other) {
+            raw |= other.raw;
+            return this;
+        }
+
+        @Override
+        public Builder<U64> and(U64 other) {
+            raw &= other.raw;
+            return this;
+        }
+
+        @Override
+        public Builder<U64> xor(U64 other) {
+            raw ^= other.raw;
+            return this;
+        }
+
+        @Override
+        public U64 build() {
+            return U64.of(raw);
+        }
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U8.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U8.java
new file mode 100644
index 0000000..17191af
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/U8.java
@@ -0,0 +1,133 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedBytes;
+
+public class U8 implements Writeable, OFValueType<U8> {
+    private final static byte ZERO_VAL = 0;
+    public final static U8 ZERO = new U8(ZERO_VAL);
+
+    private static final byte NO_MASK_VAL = (byte) 0xFF;
+    public static final U8 NO_MASK = new U8(NO_MASK_VAL);
+    public static final U8 FULL_MASK = ZERO;
+
+    private final byte raw;
+
+    private U8(byte raw) {
+        this.raw = raw;
+    }
+
+    public static final U8 of(short value) {
+        if(value == ZERO_VAL)
+            return ZERO;
+        if(value == NO_MASK_VAL)
+            return NO_MASK;
+
+        return new U8(t(value));
+    }
+
+    public static final U8 ofRaw(byte value) {
+        return new U8(value);
+    }
+
+    public short getValue() {
+        return f(raw);
+    }
+
+    public byte getRaw() {
+        return raw;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("0x%02x", raw);
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + raw;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        U8 other = (U8) obj;
+        if (raw != other.raw)
+            return false;
+        return true;
+    }
+
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeByte(raw);
+    }
+
+    public static short f(final byte i) {
+        return (short) (i & 0xff);
+    }
+
+    public static byte t(final short l) {
+        return (byte) l;
+    }
+
+
+    public final static Reader READER = new Reader();
+
+    private static class Reader implements OFMessageReader<U8> {
+        @Override
+        public U8 readFrom(ChannelBuffer bb) throws OFParseError {
+            return new U8(bb.readByte());
+        }
+    }
+
+    @Override
+    public int getLength() {
+        return 1;
+    }
+
+    @Override
+    public U8 applyMask(U8 mask) {
+        return ofRaw( (byte) (raw & mask.raw));
+    }
+
+    @Override
+    public int compareTo(U8 o) {
+        return UnsignedBytes.compare(raw, o.raw);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte(raw);
+    }
+ }
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/UDF.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/UDF.java
new file mode 100644
index 0000000..e537c20
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/UDF.java
@@ -0,0 +1,85 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+@Immutable
+public class UDF implements OFValueType<UDF> {
+    static final int LENGTH = 4;
+    private final int rawValue;
+
+    public static final UDF ZERO = UDF.of(0x0);
+    public static final UDF NO_MASK = UDF.of(0xFFFFFFFF);
+    public static final UDF FULL_MASK = UDF.of(0x00000000);
+
+    private UDF(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static UDF of(final int raw) {
+        return new UDF(raw);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        UDF other = (UDF) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(rawValue);
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+
+    public static UDF read4Bytes(ChannelBuffer c) {
+        return UDF.of(c.readInt());
+    }
+
+    @Override
+    public UDF applyMask(UDF mask) {
+        return UDF.of(this.rawValue & mask.rawValue);
+    }
+
+    @Override
+    public int compareTo(UDF o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VRF.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VRF.java
new file mode 100644
index 0000000..b742da5
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VRF.java
@@ -0,0 +1,85 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedInts;
+
+@Immutable
+public class VRF implements OFValueType<VRF> {
+    static final int LENGTH = 4;
+    private final int rawValue;
+
+    public static final VRF ZERO = VRF.of(0x0);
+    public static final VRF NO_MASK = VRF.of(0xFFFFFFFF);
+    public static final VRF FULL_MASK = VRF.of(0x00000000);
+
+    private VRF(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static VRF of(final int raw) {
+        return new VRF(raw);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        VRF other = (VRF) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+
+    @Override
+    public String toString() {
+        return Integer.toString(rawValue);
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+
+    public static VRF read4Bytes(ChannelBuffer c) {
+        return VRF.of(c.readInt());
+    }
+
+    @Override
+    public VRF applyMask(VRF mask) {
+        return VRF.of(this.rawValue & mask.rawValue);
+    }
+
+    @Override
+    public int compareTo(VRF o) {
+        return UnsignedInts.compare(rawValue, o.rawValue);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putInt(rawValue);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
new file mode 100644
index 0000000..cbb7004
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
@@ -0,0 +1,82 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.UnsignedBytes;
+
+public class VlanPcp implements OFValueType<VlanPcp> {
+
+    private static final byte VALIDATION_MASK = 0x07;
+    private static final byte NONE_VAL = 0x00;
+    static final int LENGTH = 1;
+
+    private final byte pcp;
+
+    public static final VlanPcp NONE = new VlanPcp(NONE_VAL);
+    public static final VlanPcp NO_MASK = new VlanPcp((byte)0xFF);
+    public static final VlanPcp FULL_MASK = VlanPcp.of((byte)0x0);
+
+    private VlanPcp(byte pcp) {
+        this.pcp = pcp;
+    }
+
+    public static VlanPcp of(byte pcp) {
+        if ((pcp & VALIDATION_MASK) != pcp)
+            throw new IllegalArgumentException("Illegal VLAN PCP value: " + pcp);
+        return new VlanPcp(pcp);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof VlanPcp))
+            return false;
+        VlanPcp other = (VlanPcp)obj;
+        if (other.pcp != this.pcp)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int prime = 20173;
+        return this.pcp * prime;
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Integer.toHexString(pcp);
+    }
+
+    public byte getValue() {
+        return pcp;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    public void writeByte(ChannelBuffer c) {
+        c.writeByte(this.pcp);
+    }
+
+    public static VlanPcp readByte(ChannelBuffer c) throws OFParseError {
+        return VlanPcp.of((byte)(c.readUnsignedByte() & 0xFF));
+    }
+
+    @Override
+    public VlanPcp applyMask(VlanPcp mask) {
+        return VlanPcp.of((byte)(this.pcp & mask.pcp));
+    }
+
+    @Override
+    public int compareTo(VlanPcp o) {
+        return UnsignedBytes.compare(pcp, o.pcp);
+    }
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putByte(pcp);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
new file mode 100644
index 0000000..ee605de
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
@@ -0,0 +1,115 @@
+package org.projectfloodlight.openflow.types;
+
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+/** Represents an 802.1Q Vlan VID (12 bits).
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ *
+ */
+public class VlanVid implements OFValueType<VlanVid> {
+
+    private static final short VALIDATION_MASK = 0x0FFF;
+    private static final short ZERO_VAL = 0x0000;
+    final static int LENGTH = 2;
+
+    /** this value means 'not set' in OF1.0 (e.g., in a match). not used elsewhere */
+    public static final VlanVid ZERO = new VlanVid(ZERO_VAL);
+
+    /** for use with masking operations */
+    public static final VlanVid NO_MASK = new VlanVid((short)0xFFFF);
+    public static final VlanVid FULL_MASK = ZERO;
+
+    private final short vid;
+
+    private VlanVid(short vid) {
+        this.vid = vid;
+    }
+
+    public static VlanVid ofVlan(int vid) {
+        if (vid == NO_MASK.vid)
+            return NO_MASK;
+        if ((vid & VALIDATION_MASK) != vid)
+            throw new IllegalArgumentException(String.format("Illegal VLAN value: %x", vid));
+        return new VlanVid((short) vid);
+    }
+
+    /** @return the actual VLAN tag this vid identifies */
+    public short getVlan() {
+        return vid;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof VlanVid))
+            return false;
+        VlanVid other = (VlanVid)obj;
+        if (other.vid != this.vid)
+            return false;
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int prime = 13873;
+        return this.vid * prime;
+    }
+
+    @Override
+    public String toString() {
+        return "0x" + Integer.toHexString(vid);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    private volatile byte[] bytesCache = null;
+
+    public byte[] getBytes() {
+        if (bytesCache == null) {
+            synchronized (this) {
+                if (bytesCache == null) {
+                    bytesCache =
+                            new byte[] { (byte) ((vid >>> 8) & 0xFF),
+                                         (byte) ((vid >>> 0) & 0xFF) };
+                }
+            }
+        }
+        return Arrays.copyOf(bytesCache, bytesCache.length);
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.vid);
+    }
+
+    public void write2BytesOF10(ChannelBuffer c) {
+        c.writeShort(this.getVlan());
+    }
+
+    public static VlanVid read2Bytes(ChannelBuffer c) throws OFParseError {
+        return VlanVid.ofVlan(c.readShort());
+    }
+
+    @Override
+    public VlanVid applyMask(VlanVid mask) {
+        return VlanVid.ofVlan((short)(this.vid & mask.vid));
+    }
+
+    @Override
+    public int compareTo(VlanVid o) {
+        return Shorts.compare(vid, o.vid);
+    }
+
+    @Override
+    public void putTo(PrimitiveSink sink) {
+        sink.putShort(vid);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/ActionUtils.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/ActionUtils.java
new file mode 100644
index 0000000..e0553a9
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/ActionUtils.java
@@ -0,0 +1,43 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.List;
+
+import org.projectfloodlight.openflow.protocol.OFFlowMod;
+import org.projectfloodlight.openflow.protocol.OFFlowStatsEntry;
+import org.projectfloodlight.openflow.protocol.OFInstructionType;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
+import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions;
+
+import com.google.common.collect.ImmutableList;
+
+public class ActionUtils {
+    private ActionUtils() {}
+
+    public static List<OFAction> getActions(OFFlowStatsEntry e) {
+        if(e.getVersion() == OFVersion.OF_10) {
+            return e.getActions();
+        } else {
+            for(OFInstruction i: e.getInstructions()) {
+                if(i.getType() == OFInstructionType.APPLY_ACTIONS) {
+                    return ((OFInstructionApplyActions) i).getActions();
+                }
+            }
+            return ImmutableList.of();
+        }
+    }
+
+    public static List<OFAction> getActions(OFFlowMod e) {
+        if(e.getVersion() == OFVersion.OF_10) {
+            return e.getActions();
+        } else {
+            for(OFInstruction i: e.getInstructions()) {
+                if(i.getType() == OFInstructionType.APPLY_ACTIONS) {
+                    return ((OFInstructionApplyActions) i).getActions();
+                }
+            }
+            return ImmutableList.of();
+        }
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/ChannelUtils.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/ChannelUtils.java
new file mode 100644
index 0000000..1a1ac6a
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/ChannelUtils.java
@@ -0,0 +1,80 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.List;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+import org.projectfloodlight.openflow.protocol.Writeable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Charsets;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableList.Builder;
+
+/**
+ * Collection of helper functions for reading and writing into ChannelBuffers
+ *
+ * @author capveg
+ */
+
+public class ChannelUtils {
+    private static final Logger logger = LoggerFactory.getLogger(ChannelUtils.class);
+    public static String readFixedLengthString(ChannelBuffer bb, int length) {
+        byte[] dst = new byte[length];
+        bb.readBytes(dst, 0, length);
+        int validLength = 0;
+        for (validLength = 0; validLength < length; validLength++) {
+            if (dst[validLength] == 0)
+                break;
+        }
+        return new String(dst, 0, validLength, Charsets.US_ASCII);
+    }
+
+    public static void writeFixedLengthString(ChannelBuffer bb, String string,
+            int length) {
+        int l = string.length();
+        if (l > length) {
+            throw new IllegalArgumentException("Error writing string: length="
+                    + l + " > max Length=" + length);
+        }
+        bb.writeBytes(string.getBytes(Charsets.US_ASCII));
+        if (l < length) {
+            bb.writeZero(length - l);
+        }
+    }
+
+    static public byte[] readBytes(final ChannelBuffer bb, final int length) {
+        byte byteArray[] = new byte[length];
+        bb.readBytes(byteArray);
+        return byteArray;
+    }
+
+    static public void writeBytes(final ChannelBuffer bb,
+            final byte byteArray[]) {
+        bb.writeBytes(byteArray);
+    }
+
+    public static <T> List<T> readList(ChannelBuffer bb, int length, OFMessageReader<T> reader) throws OFParseError {
+        int end = bb.readerIndex() + length;
+        Builder<T> builder = ImmutableList.<T>builder();
+        if(logger.isTraceEnabled())
+            logger.trace("readList(length={}, reader={})", length, reader.getClass());
+        while(bb.readerIndex() < end) {
+            T read = reader.readFrom(bb);
+            if(logger.isTraceEnabled())
+                logger.trace("readList: read={}, left={}", read, end - bb.readerIndex());
+            builder.add(read);
+        }
+        if(bb.readerIndex() != end) {
+            throw new IllegalStateException("Overread length: length="+length + " overread by "+ (bb.readerIndex() - end) + " reader: "+reader);
+        }
+        return builder.build();
+    }
+
+    public static void writeList(ChannelBuffer bb, List<? extends Writeable> writeables) {
+        for(Writeable w: writeables)
+            w.writeTo(bb);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/FunnelUtils.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/FunnelUtils.java
new file mode 100644
index 0000000..f62d7f9
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/FunnelUtils.java
@@ -0,0 +1,14 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.List;
+
+import org.projectfloodlight.openflow.types.PrimitiveSinkable;
+
+import com.google.common.hash.PrimitiveSink;
+
+public class FunnelUtils {
+    public static void putList(List<? extends PrimitiveSinkable> sinkables, PrimitiveSink sink) {
+        for(PrimitiveSinkable p: sinkables)
+            p.putTo(sink);
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/HexString.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/HexString.java
new file mode 100644
index 0000000..bcc46f7
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/HexString.java
@@ -0,0 +1,100 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.util;
+
+import org.projectfloodlight.openflow.types.U8;
+
+public class HexString {
+    /**
+     * Convert a string of bytes to a ':' separated hex string
+     *
+     * @param bytes
+     * @return "0f:ca:fe:de:ad:be:ef"
+     */
+    public static String toHexString(final byte[] bytes) {
+        int i;
+        String ret = "";
+        String tmp;
+        for (i = 0; i < bytes.length; i++) {
+            if (i > 0)
+                ret += ":";
+            tmp = Integer.toHexString(U8.f(bytes[i]));
+            if (tmp.length() == 1)
+                ret += "0";
+            ret += tmp;
+        }
+        return ret;
+    }
+
+    public static String toHexString(final long val, final int padTo) {
+        char arr[] = Long.toHexString(val).toCharArray();
+        String ret = "";
+        // prepend the right number of leading zeros
+        int i = 0;
+        for (; i < (padTo * 2 - arr.length); i++) {
+            ret += "0";
+            if ((i % 2) != 0)
+                ret += ":";
+        }
+        for (int j = 0; j < arr.length; j++) {
+            ret += arr[j];
+            if ((((i + j) % 2) != 0) && (j < (arr.length - 1)))
+                ret += ":";
+        }
+        return ret;
+    }
+
+    public static String toHexString(final long val) {
+        return toHexString(val, 8);
+    }
+
+    /**
+     * Convert a string of hex values into a string of bytes
+     *
+     * @param values
+     *            "0f:ca:fe:de:ad:be:ef"
+     * @return [15, 5 ,2, 5, 17]
+     * @throws NumberFormatException
+     *             If the string can not be parsed
+     */
+    public static byte[] fromHexString(final String values) throws NumberFormatException {
+        String[] octets = values.split(":");
+        byte[] ret = new byte[octets.length];
+
+        for (int i = 0; i < octets.length; i++) {
+            if (octets[i].length() > 2)
+                throw new NumberFormatException("Invalid octet length");
+            ret[i] = Integer.valueOf(octets[i], 16).byteValue();
+        }
+        return ret;
+    }
+
+    public static long toLong(String value) throws NumberFormatException {
+        String[] octets = value.split(":");
+        if (octets.length > 8)
+            throw new NumberFormatException("Input string is too big to fit in long: " + value);
+        long l = 0;
+        for (String octet: octets) {
+            if (octet.length() > 2)
+                throw new NumberFormatException("Each colon-separated byte component must consist of 1 or 2 hex digits: " + value);
+            short s = Short.parseShort(octet, 16);
+            l = (l << 8) + s;
+        }
+        return l;
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/LRULinkedHashMap.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/LRULinkedHashMap.java
new file mode 100644
index 0000000..7798e67
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/LRULinkedHashMap.java
@@ -0,0 +1,42 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.util;
+
+import java.util.LinkedHashMap;
+
+public class LRULinkedHashMap<K, V> extends LinkedHashMap<K, V> {
+    private static final long serialVersionUID = -2964986094089626647L;
+    protected int maximumCapacity;
+
+    public LRULinkedHashMap(final int initialCapacity, final int maximumCapacity) {
+        super(initialCapacity, 0.75f, true);
+        this.maximumCapacity = maximumCapacity;
+    }
+
+    public LRULinkedHashMap(final int maximumCapacity) {
+        super(16, 0.75f, true);
+        this.maximumCapacity = maximumCapacity;
+    }
+
+    @Override
+    protected boolean removeEldestEntry(final java.util.Map.Entry<K, V> eldest) {
+        if (this.size() > maximumCapacity)
+            return true;
+        return false;
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java
new file mode 100644
index 0000000..48362da
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/LengthCountingPseudoChannelBuffer.java
@@ -0,0 +1,673 @@
+package org.projectfloodlight.openflow.util;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.channels.GatheringByteChannel;
+import java.nio.channels.ScatteringByteChannel;
+import java.nio.charset.Charset;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBufferFactory;
+import org.jboss.netty.buffer.ChannelBufferIndexFinder;
+
+public class LengthCountingPseudoChannelBuffer implements ChannelBuffer {
+
+    int writerIndex = 0;
+    private int markedWriterIndex;
+
+    @Override
+    public ChannelBufferFactory factory() {
+        return null;
+    }
+
+    @Override
+    public int capacity() {
+        return Integer.MAX_VALUE;
+    }
+
+    @Override
+    public ByteOrder order() {
+        return ByteOrder.BIG_ENDIAN;
+    }
+
+    @Override
+    public boolean isDirect() {
+        return true;
+    }
+
+    @Override
+    public int readerIndex() {
+        return 0;
+    }
+
+    @Override
+    public void readerIndex(int readerIndex) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int writerIndex() {
+        return writerIndex;
+    }
+
+    @Override
+    public void writerIndex(int writerIndex) {
+        this.writerIndex = writerIndex;
+    }
+
+    @Override
+    public void setIndex(int readerIndex, int writerIndex) {
+        if(readerIndex != 0)
+            throw new UnsupportedOperationException();
+        this.writerIndex = writerIndex;
+    }
+
+    @Override
+    public int readableBytes() {
+        return writerIndex;
+    }
+
+    @Override
+    public int writableBytes() {
+        return Integer.MAX_VALUE - writerIndex;
+    }
+
+    @Override
+    public boolean readable() {
+        return writerIndex > 0;
+    }
+
+    @Override
+    public boolean writable() {
+        return writerIndex < Integer.MAX_VALUE;
+    }
+
+    @Override
+    public void clear() {
+        writerIndex = 0;
+
+    }
+
+    @Override
+    public void markReaderIndex() {
+    }
+
+    @Override
+    public void resetReaderIndex() {
+    }
+
+    @Override
+    public void markWriterIndex() {
+        markedWriterIndex = writerIndex;
+    }
+
+    @Override
+    public void resetWriterIndex() {
+        writerIndex = markedWriterIndex;
+    }
+
+    @Override
+    public void discardReadBytes() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void ensureWritableBytes(int writableBytes) {
+        if(!((Integer.MAX_VALUE - writableBytes) > writerIndex))
+            throw new IllegalStateException();
+    }
+
+    @Override
+    public byte getByte(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short getUnsignedByte(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short getShort(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getUnsignedShort(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getMedium(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getUnsignedMedium(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getInt(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long getUnsignedInt(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long getLong(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public char getChar(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public float getFloat(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public double getDouble(int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ChannelBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ChannelBuffer dst, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, byte[] dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, byte[] dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, ByteBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void getBytes(int index, OutputStream out, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int getBytes(int index, GatheringByteChannel out, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setByte(int index, int value) {
+    }
+
+    @Override
+    public void setShort(int index, int value) {
+    }
+
+    @Override
+    public void setMedium(int index, int value) {
+    }
+
+    @Override
+    public void setInt(int index, int value) {
+    }
+
+    @Override
+    public void setLong(int index, long value) {
+    }
+
+    @Override
+    public void setChar(int index, int value) {
+    }
+
+    @Override
+    public void setFloat(int index, float value) {
+    }
+
+    @Override
+    public void setDouble(int index, double value) {
+    }
+
+    @Override
+    public void setBytes(int index, ChannelBuffer src) {
+    }
+
+    @Override
+    public void setBytes(int index, ChannelBuffer src, int length) {
+    }
+
+    @Override
+    public void setBytes(int index, ChannelBuffer src, int srcIndex, int length) {
+    }
+
+    @Override
+    public void setBytes(int index, byte[] src) {
+    }
+
+    @Override
+    public void setBytes(int index, byte[] src, int srcIndex, int length) {
+    }
+
+    @Override
+    public void setBytes(int index, ByteBuffer src) {
+
+    }
+
+    @Override
+    public int setBytes(int index, InputStream in, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int setBytes(int index, ScatteringByteChannel in, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void setZero(int index, int length) {
+    }
+
+    @Override
+    public byte readByte() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short readUnsignedByte() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public short readShort() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readUnsignedShort() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readMedium() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readUnsignedMedium() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readInt() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long readUnsignedInt() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long readLong() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public char readChar() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public float readFloat() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public double readDouble() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer readBytes(int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @Deprecated
+    public ChannelBuffer readBytes(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer readSlice(int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @Deprecated
+    public
+    ChannelBuffer readSlice(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ChannelBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ChannelBuffer dst, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ChannelBuffer dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(byte[] dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(byte[] dst, int dstIndex, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(ByteBuffer dst) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void readBytes(OutputStream out, int length) throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int readBytes(GatheringByteChannel out, int length)
+            throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void skipBytes(int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @Deprecated
+    public int skipBytes(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void writeByte(int value) {
+        writerIndex++;
+    }
+
+    @Override
+    public void writeShort(int value) {
+    writerIndex += 2;
+}
+
+@Override
+public void writeMedium(int value) {
+    writerIndex += 3;
+}
+
+@Override
+public void writeInt(int value) {
+    writerIndex += 4;
+}
+
+@Override
+public void writeLong(long value) {
+    writerIndex += 8;
+}
+
+
+    @Override
+    public void writeChar(int value) {
+        writeShort(value);
+    }
+
+    @Override
+    public void writeFloat(float value) {
+        writeInt(Float.floatToIntBits(value));
+    }
+
+    @Override
+    public void writeDouble(double value) {
+        writeLong(Double.doubleToLongBits(value));
+
+    }
+
+    @Override
+    public void writeBytes(ChannelBuffer src) {
+        writerIndex += src.readableBytes();
+
+    }
+
+    @Override
+    public void writeBytes(ChannelBuffer src, int length) {
+        writerIndex += src.readableBytes();
+
+    }
+
+    @Override
+    public void writeBytes(ChannelBuffer src, int srcIndex, int length) {
+        writerIndex += length;
+    }
+
+    @Override
+    public void writeBytes(byte[] src) {
+        writerIndex += src.length;
+
+    }
+
+    @Override
+    public void writeBytes(byte[] src, int srcIndex, int length) {
+        writerIndex += length;
+    }
+
+    @Override
+    public void writeBytes(ByteBuffer src) {
+        writerIndex += src.remaining();
+
+    }
+
+    @Override
+    public int writeBytes(InputStream in, int length) throws IOException {
+        writerIndex += length;
+        return length;
+    }
+
+    @Override
+    public int writeBytes(ScatteringByteChannel in, int length)
+            throws IOException {
+        writerIndex += length;
+        return length;
+    }
+
+    @Override
+    public void writeZero(int length) {
+        writerIndex += length;
+
+    }
+
+    @Override
+    public int indexOf(int fromIndex, int toIndex, byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int indexOf(int fromIndex, int toIndex,
+            ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int length, byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int length, ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int index, int length, byte value) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int bytesBefore(int index, int length,
+            ChannelBufferIndexFinder indexFinder) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer copy() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer copy(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer slice() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer slice(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ChannelBuffer duplicate() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer toByteBuffer() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer toByteBuffer(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer[] toByteBuffers() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public ByteBuffer[] toByteBuffers(int index, int length) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public boolean hasArray() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public byte[] array() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int arrayOffset() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public String toString(Charset charset) {
+        return "LengthCountingPseudoChannelBuffer(length="+writerIndex+")";
+    }
+
+    @Override
+    public String toString(int index, int length, Charset charset) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public String toString(String charsetName) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public String toString(String charsetName,
+            ChannelBufferIndexFinder terminatorFinder) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public String toString(int index, int length, String charsetName) {
+        return toString();
+    }
+
+    @Override
+    @Deprecated
+    public
+    String toString(int index, int length, String charsetName,
+            ChannelBufferIndexFinder terminatorFinder) {
+        return toString();
+    }
+
+    @Override
+    public int compareTo(ChannelBuffer buffer) {
+        throw new UnsupportedOperationException();
+
+    }
+
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/MultiplePktInReasonUtil.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/MultiplePktInReasonUtil.java
new file mode 100644
index 0000000..a919f62
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/MultiplePktInReasonUtil.java
@@ -0,0 +1,46 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.Set;
+
+import com.google.common.collect.ImmutableSet;
+
+import org.projectfloodlight.openflow.types.U64;
+import org.projectfloodlight.openflow.protocol.OFBsnPktinFlag;
+import org.projectfloodlight.openflow.protocol.OFPacketIn;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.protocol.match.MatchField;
+import org.projectfloodlight.openflow.protocol.match.Match;
+import org.projectfloodlight.openflow.protocol.ver13.OFBsnPktinFlagSerializerVer13;
+import org.projectfloodlight.openflow.types.OFMetadata;
+
+
+public class MultiplePktInReasonUtil {
+    private MultiplePktInReasonUtil() {}
+
+    /**
+     * This function is used in BVS T5/6 to decode the multiple packet in
+     * reasons in Match.MetaData field.
+     * */
+    public static Set<OFBsnPktinFlag> getOFBsnPktinFlags(OFPacketIn pktIn) {
+        if(pktIn.getVersion() != OFVersion.OF_13) {
+            throw new IllegalArgumentException("multiple pkt in reasons are "
+                                               + "only supported by BVS using "
+                                               + "openflow 1.3");
+        }
+
+        Match match = pktIn.getMatch();
+        if(match == null) {
+            return ImmutableSet.<OFBsnPktinFlag>of();
+        }
+        OFMetadata metaData = match.get(MatchField.METADATA);
+        if(metaData == null) {
+            return ImmutableSet.<OFBsnPktinFlag>of();
+        }
+        U64 metaDataValue = metaData.getValue();
+        if(metaDataValue == null) {
+            return ImmutableSet.<OFBsnPktinFlag>of();
+        }
+        return OFBsnPktinFlagSerializerVer13.ofWireValue(metaDataValue
+                                                               .getValue());
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/PrimitiveSinkUtils.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/PrimitiveSinkUtils.java
new file mode 100644
index 0000000..28eb3a4
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/PrimitiveSinkUtils.java
@@ -0,0 +1,75 @@
+package org.projectfloodlight.openflow.util;
+
+import java.util.List;
+import java.util.SortedSet;
+
+import javax.annotation.Nullable;
+
+import org.projectfloodlight.openflow.types.PrimitiveSinkable;
+
+import com.google.common.hash.PrimitiveSink;
+
+/** Utility methods for dumping collections into primitive sinks.
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+public class PrimitiveSinkUtils {
+    private PrimitiveSinkUtils() {}
+
+    /** puts a nullable String into a primitive sink. The entry is prepended by a 'presence'
+     *  boolean bit and the string length;
+     *
+     *
+     * @param sink the sink to put the object
+     * @param nullableObj the potentially null string to put in the sink
+     */
+    public static void putNullableStringTo(PrimitiveSink sink,
+            @Nullable CharSequence nullableChars) {
+
+        sink.putBoolean(nullableChars != null);
+        if(nullableChars != null) {
+            sink.putInt(nullableChars.length());
+            sink.putUnencodedChars(nullableChars);
+        }
+    }
+
+    /** puts a nullable element into a primitive sink. The entry is prepended by a 'present' bit.
+     *
+     * @param sink the sink to put the object
+     * @param nullableObj the nullable object
+     */
+    public static void putNullableTo(PrimitiveSink sink,
+            @Nullable PrimitiveSinkable nullableObj) {
+        sink.putBoolean(nullableObj != null);
+        if(nullableObj != null)
+            nullableObj.putTo(sink);
+    }
+
+    /** puts the elements of a sorted set into the {@link PrimitiveSink}. Does not support null
+     *  elements. The elements are assumed to be self-delimitating.
+     *
+     * @param sink
+     * @param set
+     */
+    public static void putSortedSetTo(PrimitiveSink sink,
+            SortedSet<? extends PrimitiveSinkable> set) {
+        sink.putInt(set.size());
+        for(PrimitiveSinkable e: set) {
+            e.putTo(sink);
+        }
+    }
+
+    /** puts the elements of a list into the {@link PrimitiveSink}. Does not support null
+     *  elements. The elements are assumed to be self-delimitating.
+     *
+     * @param sink
+     * @param set
+     */
+    public static void putListTo(PrimitiveSink sink,
+            List<? extends PrimitiveSinkable> set) {
+        sink.putInt(set.size());
+        for(PrimitiveSinkable e: set) {
+            e.putTo(sink);
+        }
+    }
+}
diff --git a/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/StringByteSerializer.java b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/StringByteSerializer.java
new file mode 100644
index 0000000..6949fb2
--- /dev/null
+++ b/of-save/lib/src/main/java/org/projectfloodlight/openflow/util/StringByteSerializer.java
@@ -0,0 +1,58 @@
+/**
+ *    Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior
+ *    University
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License"); you may
+ *    not use this file except in compliance with the License. You may obtain
+ *    a copy of the License at
+ *
+ *         http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ *    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ *    License for the specific language governing permissions and limitations
+ *    under the License.
+ **/
+
+package org.projectfloodlight.openflow.util;
+
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.Arrays;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public class StringByteSerializer {
+    public static String readFrom(final ChannelBuffer data, final int length) {
+        byte[] stringBytes = new byte[length];
+        data.readBytes(stringBytes);
+        // find the first index of 0
+        int index = 0;
+        for (byte b : stringBytes) {
+            if (0 == b)
+                break;
+            ++index;
+        }
+        return new String(Arrays.copyOf(stringBytes, index), Charset.forName("ascii"));
+    }
+
+    public static void writeTo(final ChannelBuffer data, final int length,
+            final String value) {
+        try {
+            byte[] name = value.getBytes("ASCII");
+            if (name.length < length) {
+                data.writeBytes(name);
+                for (int i = name.length; i < length; ++i) {
+                    data.writeByte((byte) 0);
+                }
+            } else {
+                data.writeBytes(name, 0, length - 1);
+                data.writeByte((byte) 0);
+            }
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e);
+        }
+
+    }
+}