Package renaming - missed the pre-written files in the previous commit.
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
new file mode 100644
index 0000000..5e710ca
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
@@ -0,0 +1,158 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public class ArpOpcode implements OFValueType<ArpOpcode> {
+
+    final static int LENGTH = 2;
+
+    private static final int ARP_OPCODE_VAL_REQUEST   = 1;
+    private static final int ARP_OPCODE_VAL_REPLY = 2;
+    private static final int ARP_OPCODE_VAL_REQUEST_REVERSE   = 3;
+    private static final int ARP_OPCODE_VAL_REPLY_REVERSE = 4;
+    private static final int ARP_OPCODE_VAL_DRARP_REQUEST = 5;
+    private static final int ARP_OPCODE_VAL_DRARP_REPLY   = 6;
+    private static final int ARP_OPCODE_VAL_DRARP_ERROR   = 7;
+    private static final int ARP_OPCODE_VAL_INARP_REQUEST = 8;
+    private static final int ARP_OPCODE_VAL_INARP_REPLY   = 9;
+    private static final int ARP_OPCODE_VAL_ARP_NAK   = 10;
+    private static final int ARP_OPCODE_VAL_MARS_REQUEST  = 11;
+    private static final int ARP_OPCODE_VAL_MARS_MULTI    = 12;
+    private static final int ARP_OPCODE_VAL_MARS_MSERV    = 13;
+    private static final int ARP_OPCODE_VAL_MARS_JOIN = 14;
+    private static final int ARP_OPCODE_VAL_MARS_LEAVE    = 15;
+    private static final int ARP_OPCODE_VAL_MARS_NAK  = 16;
+    private static final int ARP_OPCODE_VAL_MARS_UNSERV   = 17;
+    private static final int ARP_OPCODE_VAL_MARS_SJOIN    = 18;
+    private static final int ARP_OPCODE_VAL_MARS_SLEAVE   = 19;
+    private static final int ARP_OPCODE_VAL_MARS_GROUPLIST_REQUEST    = 20;
+    private static final int ARP_OPCODE_VAL_MARS_GROUPLIST_REPLY  = 21;
+    private static final int ARP_OPCODE_VAL_MARS_REDIRECT_MAP = 22;
+    private static final int ARP_OPCODE_VAL_MAPOS_UNARP   = 23;
+    private static final int ARP_OPCODE_VAL_OP_EXP1   = 24;
+    private static final int ARP_OPCODE_VAL_OP_EXP2   = 25;
+
+    public static final ArpOpcode ARP_OPCODE_REQUEST  = new ArpOpcode(ARP_OPCODE_VAL_REQUEST);
+    public static final ArpOpcode ARP_OPCODE_REPLY    = new ArpOpcode(ARP_OPCODE_VAL_REPLY);
+    public static final ArpOpcode ARP_OPCODE_REQUEST_REVERSE  = new ArpOpcode(ARP_OPCODE_VAL_REQUEST_REVERSE);
+    public static final ArpOpcode ARP_OPCODE_REPLY_REVERSE    = new ArpOpcode(ARP_OPCODE_VAL_REPLY_REVERSE);
+    public static final ArpOpcode ARP_OPCODE_DRARP_REQUEST    = new ArpOpcode(ARP_OPCODE_VAL_DRARP_REQUEST);
+    public static final ArpOpcode ARP_OPCODE_DRARP_REPLY  = new ArpOpcode(ARP_OPCODE_VAL_DRARP_REPLY);
+    public static final ArpOpcode ARP_OPCODE_DRARP_ERROR  = new ArpOpcode(ARP_OPCODE_VAL_DRARP_ERROR);
+    public static final ArpOpcode ARP_OPCODE_INARP_REQUEST    = new ArpOpcode(ARP_OPCODE_VAL_INARP_REQUEST);
+    public static final ArpOpcode ARP_OPCODE_INARP_REPLY  = new ArpOpcode(ARP_OPCODE_VAL_INARP_REPLY);
+    public static final ArpOpcode ARP_OPCODE_ARP_NAK  = new ArpOpcode(ARP_OPCODE_VAL_ARP_NAK);
+    public static final ArpOpcode ARP_OPCODE_MARS_REQUEST = new ArpOpcode(ARP_OPCODE_VAL_MARS_REQUEST);
+    public static final ArpOpcode ARP_OPCODE_MARS_MULTI   = new ArpOpcode(ARP_OPCODE_VAL_MARS_MULTI);
+    public static final ArpOpcode ARP_OPCODE_MARS_MSERV   = new ArpOpcode(ARP_OPCODE_VAL_MARS_MSERV);
+    public static final ArpOpcode ARP_OPCODE_MARS_JOIN    = new ArpOpcode(ARP_OPCODE_VAL_MARS_JOIN);
+    public static final ArpOpcode ARP_OPCODE_MARS_LEAVE   = new ArpOpcode(ARP_OPCODE_VAL_MARS_LEAVE);
+    public static final ArpOpcode ARP_OPCODE_MARS_NAK = new ArpOpcode(ARP_OPCODE_VAL_MARS_NAK);
+    public static final ArpOpcode ARP_OPCODE_MARS_UNSERV  = new ArpOpcode(ARP_OPCODE_VAL_MARS_UNSERV);
+    public static final ArpOpcode ARP_OPCODE_MARS_SJOIN   = new ArpOpcode(ARP_OPCODE_VAL_MARS_SJOIN);
+    public static final ArpOpcode ARP_OPCODE_MARS_SLEAVE  = new ArpOpcode(ARP_OPCODE_VAL_MARS_SLEAVE);
+    public static final ArpOpcode ARP_OPCODE_MARS_GROUPLIST_REQUEST   = new ArpOpcode(ARP_OPCODE_VAL_MARS_GROUPLIST_REQUEST);
+    public static final ArpOpcode ARP_OPCODE_MARS_GROUPLIST_REPLY = new ArpOpcode(ARP_OPCODE_VAL_MARS_GROUPLIST_REPLY);
+    public static final ArpOpcode ARP_OPCODE_MARS_REDIRECT_MAP    = new ArpOpcode(ARP_OPCODE_VAL_MARS_REDIRECT_MAP);
+    public static final ArpOpcode ARP_OPCODE_MAPOS_UNARP  = new ArpOpcode(ARP_OPCODE_VAL_MAPOS_UNARP);
+    public static final ArpOpcode ARP_OPCODE_OP_EXP1  = new ArpOpcode(ARP_OPCODE_VAL_OP_EXP1);
+    public static final ArpOpcode ARP_OPCODE_OP_EXP2  = new ArpOpcode(ARP_OPCODE_VAL_OP_EXP2);
+
+    private static final int MIN_OPCODE = 0;
+    private static final int MAX_OPCODE = 0xFFFF;
+    
+    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 ARP_OPCODE_VAL_REQUEST:
+                return ARP_OPCODE_REQUEST;
+            case ARP_OPCODE_VAL_REPLY:
+                return ARP_OPCODE_REPLY;
+            case ARP_OPCODE_VAL_REQUEST_REVERSE:
+                return ARP_OPCODE_REQUEST_REVERSE;
+            case ARP_OPCODE_VAL_REPLY_REVERSE:
+                return ARP_OPCODE_REPLY_REVERSE;
+            case ARP_OPCODE_VAL_DRARP_REQUEST:
+                return ARP_OPCODE_DRARP_REQUEST;
+            case ARP_OPCODE_VAL_DRARP_REPLY:
+                return ARP_OPCODE_DRARP_REPLY;
+            case ARP_OPCODE_VAL_DRARP_ERROR:
+                return ARP_OPCODE_DRARP_ERROR;
+            case ARP_OPCODE_VAL_INARP_REQUEST:
+                return ARP_OPCODE_INARP_REQUEST;
+            case ARP_OPCODE_VAL_INARP_REPLY:
+                return ARP_OPCODE_INARP_REPLY;
+            case ARP_OPCODE_VAL_ARP_NAK:
+                return ARP_OPCODE_ARP_NAK;
+            case ARP_OPCODE_VAL_MARS_REQUEST:
+                return ARP_OPCODE_MARS_REQUEST;
+            case ARP_OPCODE_VAL_MARS_MULTI:
+                return ARP_OPCODE_MARS_MULTI;
+            case ARP_OPCODE_VAL_MARS_MSERV:
+                return ARP_OPCODE_MARS_MSERV;
+            case ARP_OPCODE_VAL_MARS_JOIN:
+                return ARP_OPCODE_MARS_JOIN;
+            case ARP_OPCODE_VAL_MARS_LEAVE:
+                return ARP_OPCODE_MARS_LEAVE;
+            case ARP_OPCODE_VAL_MARS_NAK:
+                return ARP_OPCODE_MARS_NAK;
+            case ARP_OPCODE_VAL_MARS_UNSERV:
+                return ARP_OPCODE_MARS_UNSERV;
+            case ARP_OPCODE_VAL_MARS_SJOIN:
+                return ARP_OPCODE_MARS_SJOIN;
+            case ARP_OPCODE_VAL_MARS_SLEAVE:
+                return ARP_OPCODE_MARS_SLEAVE;
+            case ARP_OPCODE_VAL_MARS_GROUPLIST_REQUEST:
+                return ARP_OPCODE_MARS_GROUPLIST_REQUEST;
+            case ARP_OPCODE_VAL_MARS_GROUPLIST_REPLY:
+                return ARP_OPCODE_MARS_GROUPLIST_REPLY;
+            case ARP_OPCODE_VAL_MARS_REDIRECT_MAP:
+                return ARP_OPCODE_MARS_REDIRECT_MAP;
+            case ARP_OPCODE_VAL_MAPOS_UNARP:
+                return ARP_OPCODE_MAPOS_UNARP;
+            case ARP_OPCODE_VAL_OP_EXP1:
+                return ARP_OPCODE_OP_EXP1;
+            case ARP_OPCODE_VAL_OP_EXP2:
+                return ARP_OPCODE_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);
+    }
+    
+    public int getOpCode() {
+        return opcode;
+    }
+    
+}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java
new file mode 100644
index 0000000..52f5455
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java
@@ -0,0 +1,251 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+
+/**
+ * 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 ETH_TYPE_VAL_IPv4              = 0x0800; // Internet Protocol version 4 (IPv4)
+    static final int ETH_TYPE_VAL_ARP               = 0x0806; // Address Resolution Protocol (ARP)
+    static final int ETH_TYPE_VAL_WAKE_ON_LAN       = 0x0842; // Wake-on-LAN[3]
+    static final int ETH_TYPE_VAL_TRILL             = 0x22F3; // IETF TRILL Protocol
+    static final int ETH_TYPE_VAL_DECNET_IV         = 0x6003; // DECnet Phase IV
+    static final int ETH_TYPE_VAL_REV_ARP           = 0x8035; // Reverse Address Resolution Protocol
+    static final int ETH_TYPE_VAL_APPLE_TALK        = 0x809B; // AppleTalk (Ethertalk)
+    static final int ETH_TYPE_VAL_APPLE_TALK_ARP    = 0x80F3; // AppleTalk Address Resolution Protocol (AARP)
+    static final int ETH_TYPE_VAL_VLAN_FRAME        = 0x8100; // VLAN-tagged frame (IEEE 802.1Q) & Shortest Path Bridging IEEE 802.1aq[4]
+    static final int ETH_TYPE_VAL_IPX_8137          = 0x8137; // IPX
+    static final int ETH_TYPE_VAL_IPX_8138          = 0x8138; // IPX
+    static final int ETH_TYPE_VAL_QNX               = 0x8204; // QNX Qnet
+    static final int ETH_TYPE_VAL_IPv6              = 0x86DD; // Internet Protocol Version 6 (IPv6)
+    static final int ETH_TYPE_VAL_ETH_FLOW          = 0x8808; // Ethernet flow control
+    static final int ETH_TYPE_VAL_SLOW_PROTOCOLS    = 0x8809; // Slow Protocols (IEEE 802.3)
+    static final int ETH_TYPE_VAL_COBRANET          = 0x8819; // CobraNet
+    static final int ETH_TYPE_VAL_MPLS_UNICAST      = 0x8847; // MPLS unicast
+    static final int ETH_TYPE_VAL_MPLS_MULTICAST    = 0x8848; // MPLS multicast
+    static final int ETH_TYPE_VAL_PPPoE_DISCOVERY   = 0x8863; // PPPoE Discovery Stage
+    static final int ETH_TYPE_VAL_PPPoE_SESSION     = 0x8864; // PPPoE Session Stage
+    static final int ETH_TYPE_VAL_JUMBO_FRAMES      = 0x8870; // Jumbo Frames
+    static final int ETH_TYPE_VAL_HOMEPLUG_10       = 0x887B; // HomePlug 1.0 MME
+    static final int ETH_TYPE_VAL_EAP_OVER_LAN      = 0x888E; // EAP over LAN (IEEE 802.1X)
+    static final int ETH_TYPE_VAL_PROFINET          = 0x8892; // PROFINET Protocol
+    static final int ETH_TYPE_VAL_HYPERSCSI         = 0x889A; // HyperSCSI (SCSI over Ethernet)
+    static final int ETH_TYPE_VAL_ATA_OVER_ETH      = 0x88A2; // ATA over Ethernet
+    static final int ETH_TYPE_VAL_ETHERCAT          = 0x88A4; // EtherCAT Protocol
+    static final int ETH_TYPE_VAL_BRIDGING          = 0x88A8; // Provider Bridging (IEEE 802.1ad) & Shortest Path Bridging IEEE 802.1aq[5]
+    static final int ETH_TYPE_VAL_POWERLINK         = 0x88AB; // Ethernet Powerlink[citation needed]
+    static final int ETH_TYPE_VAL_LLDP              = 0x88CC; // Link Layer Discovery Protocol (LLDP)
+    static final int ETH_TYPE_VAL_SERCOS            = 0x88CD; // SERCOS III
+    static final int ETH_TYPE_VAL_HOMEPLUG_AV       = 0x88E1; // HomePlug AV MME[citation needed]
+    static final int ETH_TYPE_VAL_MRP               = 0x88E3; // Media Redundancy Protocol (IEC62439-2)
+    static final int ETH_TYPE_VAL_MAC_SEC           = 0x88E5; // MAC security (IEEE 802.1AE)
+    static final int ETH_TYPE_VAL_PTP               = 0x88F7; // Precision Time Protocol (IEEE 1588)
+    static final int ETH_TYPE_VAL_CFM               = 0x8902; // IEEE 802.1ag Connectivity Fault Management (CFM) Protocol / ITU-T Recommendation Y.1731 (OAM)
+    static final int ETH_TYPE_VAL_FCoE              = 0x8906; // Fibre Channel over Ethernet (FCoE)
+    static final int ETH_TYPE_VAL_FCoE_INIT         = 0x8914; // FCoE Initialization Protocol
+    static final int ETH_TYPE_VAL_RoCE              = 0x8915; // RDMA over Converged Ethernet (RoCE)
+    static final int ETH_TYPE_VAL_HSR               = 0x892F; // High-availability Seamless Redundancy (HSR)
+    static final int ETH_TYPE_VAL_CONF_TEST         = 0x9000; // Ethernet Configuration Testing Protocol[6]
+    static final int ETH_TYPE_VAL_Q_IN_Q            = 0x9100; // Q-in-Q
+    static final int ETH_TYPE_VAL_LLT               = 0xCAFE; // Veritas Low Latency Transport (LLT)[7] for Veritas Cluster Server
+
+    public static final EthType ETH_TYPE_IPv4               = new EthType(ETH_TYPE_VAL_IPv4);
+    public static final EthType ETH_TYPE_ARP                = new EthType(ETH_TYPE_VAL_ARP);
+    public static final EthType ETH_TYPE_WAKE_ON_LAN        = new EthType(ETH_TYPE_VAL_WAKE_ON_LAN);
+    public static final EthType ETH_TYPE_TRILL              = new EthType(ETH_TYPE_VAL_TRILL);
+    public static final EthType ETH_TYPE_DECNET_IV          = new EthType(ETH_TYPE_VAL_DECNET_IV); 
+    public static final EthType ETH_TYPE_REV_ARP            = new EthType(ETH_TYPE_VAL_REV_ARP );
+    public static final EthType ETH_TYPE_APPLE_TALK         = new EthType(ETH_TYPE_VAL_APPLE_TALK); 
+    public static final EthType ETH_TYPE_APPLE_TALK_ARP     = new EthType(ETH_TYPE_VAL_APPLE_TALK_ARP); 
+    public static final EthType ETH_TYPE_VLAN_FRAME         = new EthType(ETH_TYPE_VAL_VLAN_FRAME );
+    public static final EthType ETH_TYPE_IPX_8137           = new EthType(ETH_TYPE_VAL_IPX_8137 );
+    public static final EthType ETH_TYPE_IPX_8138           = new EthType(ETH_TYPE_VAL_IPX_8138 );
+    public static final EthType ETH_TYPE_QNX                = new EthType(ETH_TYPE_VAL_QNX );
+    public static final EthType ETH_TYPE_IPv6               = new EthType(ETH_TYPE_VAL_IPv6 );
+    public static final EthType ETH_TYPE_ETH_FLOW           = new EthType(ETH_TYPE_VAL_ETH_FLOW); 
+    public static final EthType ETH_TYPE_SLOW_PROTOCOLS     = new EthType(ETH_TYPE_VAL_SLOW_PROTOCOLS );
+    public static final EthType ETH_TYPE_COBRANET           = new EthType(ETH_TYPE_VAL_COBRANET );
+    public static final EthType ETH_TYPE_MPLS_UNICAST       = new EthType(ETH_TYPE_VAL_MPLS_UNICAST );
+    public static final EthType ETH_TYPE_MPLS_MULTICAST     = new EthType(ETH_TYPE_VAL_MPLS_MULTICAST );
+    public static final EthType ETH_TYPE_PPPoE_DISCOVERY    = new EthType(ETH_TYPE_VAL_PPPoE_DISCOVERY);
+    public static final EthType ETH_TYPE_PPPoE_SESSION      = new EthType(ETH_TYPE_VAL_PPPoE_SESSION );
+    public static final EthType ETH_TYPE_JUMBO_FRAMES       = new EthType(ETH_TYPE_VAL_JUMBO_FRAMES );
+    public static final EthType ETH_TYPE_HOMEPLUG_10        = new EthType(ETH_TYPE_VAL_HOMEPLUG_10 );
+    public static final EthType ETH_TYPE_EAP_OVER_LAN       = new EthType(ETH_TYPE_VAL_EAP_OVER_LAN );
+    public static final EthType ETH_TYPE_PROFINET           = new EthType(ETH_TYPE_VAL_PROFINET );
+    public static final EthType ETH_TYPE_HYPERSCSI          = new EthType(ETH_TYPE_VAL_HYPERSCSI );
+    public static final EthType ETH_TYPE_ATA_OVER_ETH       = new EthType(ETH_TYPE_VAL_ATA_OVER_ETH); 
+    public static final EthType ETH_TYPE_ETHERCAT           = new EthType(ETH_TYPE_VAL_ETHERCAT );
+    public static final EthType ETH_TYPE_BRIDGING           = new EthType(ETH_TYPE_VAL_BRIDGING );
+    public static final EthType ETH_TYPE_POWERLINK          = new EthType(ETH_TYPE_VAL_POWERLINK );
+    public static final EthType ETH_TYPE_LLDP               = new EthType(ETH_TYPE_VAL_LLDP );
+    public static final EthType ETH_TYPE_SERCOS             = new EthType(ETH_TYPE_VAL_SERCOS );
+    public static final EthType ETH_TYPE_HOMEPLUG_AV        = new EthType(ETH_TYPE_VAL_HOMEPLUG_AV );
+    public static final EthType ETH_TYPE_MRP                = new EthType(ETH_TYPE_VAL_MRP );
+    public static final EthType ETH_TYPE_MAC_SEC            = new EthType(ETH_TYPE_VAL_MAC_SEC); 
+    public static final EthType ETH_TYPE_PTP                = new EthType(ETH_TYPE_VAL_PTP );
+    public static final EthType ETH_TYPE_CFM                = new EthType(ETH_TYPE_VAL_CFM );
+    public static final EthType ETH_TYPE_FCoE               = new EthType(ETH_TYPE_VAL_FCoE );
+    public static final EthType ETH_TYPE_FCoE_INIT          = new EthType(ETH_TYPE_VAL_FCoE_INIT );
+    public static final EthType ETH_TYPE_RoCE               = new EthType(ETH_TYPE_VAL_RoCE );
+    public static final EthType ETH_TYPE_HSR                = new EthType(ETH_TYPE_VAL_HSR );
+    public static final EthType ETH_TYPE_CONF_TEST          = new EthType(ETH_TYPE_VAL_CONF_TEST );
+    public static final EthType ETH_TYPE_Q_IN_Q             = new EthType(ETH_TYPE_VAL_Q_IN_Q );
+    public static final EthType ETH_TYPE_LLT                = new EthType(ETH_TYPE_VAL_LLT );
+
+    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 ETH_TYPE_VAL_IPv4:
+                return ETH_TYPE_IPv4;
+            case ETH_TYPE_VAL_ARP:
+                return ETH_TYPE_ARP;
+            case ETH_TYPE_VAL_WAKE_ON_LAN:
+                return ETH_TYPE_WAKE_ON_LAN;
+            case ETH_TYPE_VAL_TRILL:
+                return ETH_TYPE_TRILL;
+            case ETH_TYPE_VAL_DECNET_IV:
+                return ETH_TYPE_DECNET_IV;
+            case ETH_TYPE_VAL_REV_ARP:
+                return ETH_TYPE_REV_ARP;
+            case ETH_TYPE_VAL_APPLE_TALK:
+                return ETH_TYPE_APPLE_TALK;
+            case ETH_TYPE_VAL_APPLE_TALK_ARP:
+                return ETH_TYPE_APPLE_TALK_ARP;
+            case ETH_TYPE_VAL_VLAN_FRAME:
+                return ETH_TYPE_VLAN_FRAME;
+            case ETH_TYPE_VAL_IPX_8137:
+                return ETH_TYPE_IPX_8137;
+            case ETH_TYPE_VAL_IPX_8138:
+                return ETH_TYPE_IPX_8138;
+            case ETH_TYPE_VAL_QNX:
+                return ETH_TYPE_QNX;
+            case ETH_TYPE_VAL_IPv6:
+                return ETH_TYPE_IPv6;
+            case ETH_TYPE_VAL_ETH_FLOW:
+                return ETH_TYPE_ETH_FLOW;
+            case ETH_TYPE_VAL_SLOW_PROTOCOLS:
+                return ETH_TYPE_SLOW_PROTOCOLS;
+            case ETH_TYPE_VAL_COBRANET:
+                return ETH_TYPE_COBRANET;
+            case ETH_TYPE_VAL_MPLS_UNICAST:
+                return ETH_TYPE_MPLS_UNICAST;
+            case ETH_TYPE_VAL_MPLS_MULTICAST:
+                return ETH_TYPE_MPLS_MULTICAST;
+            case ETH_TYPE_VAL_PPPoE_DISCOVERY:
+                return ETH_TYPE_PPPoE_DISCOVERY;
+            case ETH_TYPE_VAL_PPPoE_SESSION:
+                return ETH_TYPE_PPPoE_SESSION;
+            case ETH_TYPE_VAL_JUMBO_FRAMES:
+                return ETH_TYPE_JUMBO_FRAMES;
+            case ETH_TYPE_VAL_HOMEPLUG_10:
+                return ETH_TYPE_HOMEPLUG_10;
+            case ETH_TYPE_VAL_EAP_OVER_LAN:
+                return ETH_TYPE_EAP_OVER_LAN;
+            case ETH_TYPE_VAL_PROFINET:
+                return ETH_TYPE_PROFINET;
+            case ETH_TYPE_VAL_HYPERSCSI:
+                return ETH_TYPE_HYPERSCSI;
+            case ETH_TYPE_VAL_ATA_OVER_ETH:
+                return ETH_TYPE_ATA_OVER_ETH;
+            case ETH_TYPE_VAL_ETHERCAT:
+                return ETH_TYPE_ETHERCAT;
+            case ETH_TYPE_VAL_BRIDGING:
+                return ETH_TYPE_BRIDGING;
+            case ETH_TYPE_VAL_POWERLINK:
+                return ETH_TYPE_POWERLINK;
+            case ETH_TYPE_VAL_LLDP:
+                return ETH_TYPE_LLDP;
+            case ETH_TYPE_VAL_SERCOS:
+                return ETH_TYPE_SERCOS;
+            case ETH_TYPE_VAL_HOMEPLUG_AV:
+                return ETH_TYPE_HOMEPLUG_AV;
+            case ETH_TYPE_VAL_MRP:
+                return ETH_TYPE_MRP;
+            case ETH_TYPE_VAL_MAC_SEC:
+                return ETH_TYPE_MAC_SEC;
+            case ETH_TYPE_VAL_PTP:
+                return ETH_TYPE_PTP;
+            case ETH_TYPE_VAL_CFM:
+                return ETH_TYPE_CFM;
+            case ETH_TYPE_VAL_FCoE:
+                return ETH_TYPE_FCoE;
+            case ETH_TYPE_VAL_FCoE_INIT:
+                return ETH_TYPE_FCoE_INIT;
+            case ETH_TYPE_VAL_RoCE:
+                return ETH_TYPE_RoCE;
+            case ETH_TYPE_VAL_HSR:
+                return ETH_TYPE_HSR;
+            case ETH_TYPE_VAL_CONF_TEST:
+                return ETH_TYPE_CONF_TEST;
+            case ETH_TYPE_VAL_Q_IN_Q:
+                return ETH_TYPE_Q_IN_Q;
+            case ETH_TYPE_VAL_LLT:
+                return ETH_TYPE_LLT;
+            default:
+                // TODO: What's here?
+                return new EthType(type);
+        }
+    }
+
+    @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 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;
+    }
+
+    
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
new file mode 100644
index 0000000..46ada58
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
@@ -0,0 +1,53 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+/**
+ * 
+ * @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;
+    
+    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 > 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));
+    }
+
+    
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
new file mode 100644
index 0000000..00a789b
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
@@ -0,0 +1,167 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public class ICMPv4Type implements OFValueType<ICMPv4Type> {
+
+    final static int LENGTH = 1;
+
+    private static final short ICMPV4_TYPE_VAL_ECHO_REPLY    = 0;
+    private static final short ICMPV4_TYPE_VAL_DESTINATION_UNREACHABLE   = 3;
+    private static final short ICMPV4_TYPE_VAL_SOURCE_QUENCH = 4;
+    private static final short ICMPV4_TYPE_VAL_REDIRECT  = 5;
+    private static final short ICMPV4_TYPE_VAL_ALTERNATE_HOST_ADDRESS    = 6;
+    private static final short ICMPV4_TYPE_VAL_ECHO  = 8;
+    private static final short ICMPV4_TYPE_VAL_ROUTER_ADVERTISEMENT  = 9;
+    private static final short ICMPV4_TYPE_VAL_ROUTER_SOLICITATION   = 10;
+    private static final short ICMPV4_TYPE_VAL_TIME_EXCEEDED = 11;
+    private static final short ICMPV4_TYPE_VAL_PARAMETER_PROBLEM = 12;
+    private static final short ICMPV4_TYPE_VAL_TIMESTAMP = 13;
+    private static final short ICMPV4_TYPE_VAL_TIMESTAMP_REPLY   = 14;
+    private static final short ICMPV4_TYPE_VAL_INFORMATION_REQUEST   = 15;
+    private static final short ICMPV4_TYPE_VAL_INFORMATION_REPLY = 16;
+    private static final short ICMPV4_TYPE_VAL_ADDRESS_MASK_REQUEST  = 17;
+    private static final short ICMPV4_TYPE_VAL_ADDRESS_MASK_REPLY    = 18;
+    private static final short ICMPV4_TYPE_VAL_TRACEROUTE    = 30;
+    private static final short ICMPV4_TYPE_VAL_DATAGRAM_CONVERSION_ERROR = 31;
+    private static final short ICMPV4_TYPE_VAL_MOBILE_HOST_REDIRECT  = 32;
+    private static final short ICMPV4_TYPE_VAL_IPV6_WHERE_ARE_YOU    = 33;
+    private static final short ICMPV4_TYPE_VAL_IPV6_I_AM_HERE    = 34;
+    private static final short ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REQUEST   = 35;
+    private static final short ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REPLY = 36;
+    private static final short ICMPV4_TYPE_VAL_DOMAIN_NAME_REQUEST   = 37;
+    private static final short ICMPV4_TYPE_VAL_DOMAIN_NAME_REPLY = 38;
+    private static final short ICMPV4_TYPE_VAL_SKIP  = 39;
+    private static final short ICMPV4_TYPE_VAL_PHOTURIS  = 40;
+    private static final short ICMPV4_TYPE_VAL_EXPERIMENTAL_MOBILITY = 41;
+
+    public static final ICMPv4Type ICMPV4_TYPE_ECHO_REPLY   = new ICMPv4Type(ICMPV4_TYPE_VAL_ECHO_REPLY);
+    public static final ICMPv4Type ICMPV4_TYPE_DESTINATION_UNREACHABLE  = new ICMPv4Type(ICMPV4_TYPE_VAL_DESTINATION_UNREACHABLE);
+    public static final ICMPv4Type ICMPV4_TYPE_SOURCE_QUENCH    = new ICMPv4Type(ICMPV4_TYPE_VAL_SOURCE_QUENCH);
+    public static final ICMPv4Type ICMPV4_TYPE_REDIRECT = new ICMPv4Type(ICMPV4_TYPE_VAL_REDIRECT);
+    public static final ICMPv4Type ICMPV4_TYPE_ALTERNATE_HOST_ADDRESS   = new ICMPv4Type(ICMPV4_TYPE_VAL_ALTERNATE_HOST_ADDRESS);
+    public static final ICMPv4Type ICMPV4_TYPE_ECHO = new ICMPv4Type(ICMPV4_TYPE_VAL_ECHO);
+    public static final ICMPv4Type ICMPV4_TYPE_ROUTER_ADVERTISEMENT = new ICMPv4Type(ICMPV4_TYPE_VAL_ROUTER_ADVERTISEMENT);
+    public static final ICMPv4Type ICMPV4_TYPE_ROUTER_SOLICITATION  = new ICMPv4Type(ICMPV4_TYPE_VAL_ROUTER_SOLICITATION);
+    public static final ICMPv4Type ICMPV4_TYPE_TIME_EXCEEDED    = new ICMPv4Type(ICMPV4_TYPE_VAL_TIME_EXCEEDED);
+    public static final ICMPv4Type ICMPV4_TYPE_PARAMETER_PROBLEM    = new ICMPv4Type(ICMPV4_TYPE_VAL_PARAMETER_PROBLEM);
+    public static final ICMPv4Type ICMPV4_TYPE_TIMESTAMP    = new ICMPv4Type(ICMPV4_TYPE_VAL_TIMESTAMP);
+    public static final ICMPv4Type ICMPV4_TYPE_TIMESTAMP_REPLY  = new ICMPv4Type(ICMPV4_TYPE_VAL_TIMESTAMP_REPLY);
+    public static final ICMPv4Type ICMPV4_TYPE_INFORMATION_REQUEST  = new ICMPv4Type(ICMPV4_TYPE_VAL_INFORMATION_REQUEST);
+    public static final ICMPv4Type ICMPV4_TYPE_INFORMATION_REPLY    = new ICMPv4Type(ICMPV4_TYPE_VAL_INFORMATION_REPLY);
+    public static final ICMPv4Type ICMPV4_TYPE_ADDRESS_MASK_REQUEST = new ICMPv4Type(ICMPV4_TYPE_VAL_ADDRESS_MASK_REQUEST);
+    public static final ICMPv4Type ICMPV4_TYPE_ADDRESS_MASK_REPLY   = new ICMPv4Type(ICMPV4_TYPE_VAL_ADDRESS_MASK_REPLY);
+    public static final ICMPv4Type ICMPV4_TYPE_TRACEROUTE   = new ICMPv4Type(ICMPV4_TYPE_VAL_TRACEROUTE);
+    public static final ICMPv4Type ICMPV4_TYPE_DATAGRAM_CONVERSION_ERROR    = new ICMPv4Type(ICMPV4_TYPE_VAL_DATAGRAM_CONVERSION_ERROR);
+    public static final ICMPv4Type ICMPV4_TYPE_MOBILE_HOST_REDIRECT = new ICMPv4Type(ICMPV4_TYPE_VAL_MOBILE_HOST_REDIRECT);
+    public static final ICMPv4Type ICMPV4_TYPE_IPV6_WHERE_ARE_YOU  = new ICMPv4Type(ICMPV4_TYPE_VAL_IPV6_WHERE_ARE_YOU);
+    public static final ICMPv4Type ICMPV4_TYPE_IPV6_I_AM_HERE = new ICMPv4Type(ICMPV4_TYPE_VAL_IPV6_I_AM_HERE);
+    public static final ICMPv4Type ICMPV4_TYPE_MOBILE_REGISTRATION_REQUEST  = new ICMPv4Type(ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REQUEST);
+    public static final ICMPv4Type ICMPV4_TYPE_MOBILE_REGISTRATION_REPLY    = new ICMPv4Type(ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REPLY);
+    public static final ICMPv4Type ICMPV4_TYPE_DOMAIN_NAME_REQUEST  = new ICMPv4Type(ICMPV4_TYPE_VAL_DOMAIN_NAME_REQUEST);
+    public static final ICMPv4Type ICMPV4_TYPE_DOMAIN_NAME_REPLY    = new ICMPv4Type(ICMPV4_TYPE_VAL_DOMAIN_NAME_REPLY);
+    public static final ICMPv4Type ICMPV4_TYPE_SKIP = new ICMPv4Type(ICMPV4_TYPE_VAL_SKIP);
+    public static final ICMPv4Type ICMPV4_TYPE_PHOTURIS = new ICMPv4Type(ICMPV4_TYPE_VAL_PHOTURIS);
+    public static final ICMPv4Type ICMPV4_TYPE_EXPERIMENTAL_MOBILITY    = new ICMPv4Type(ICMPV4_TYPE_VAL_EXPERIMENTAL_MOBILITY);
+
+    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 ICMPV4_TYPE_VAL_ECHO_REPLY:
+                return ICMPV4_TYPE_ECHO_REPLY;
+            case ICMPV4_TYPE_VAL_DESTINATION_UNREACHABLE:
+                return ICMPV4_TYPE_DESTINATION_UNREACHABLE;
+            case ICMPV4_TYPE_VAL_SOURCE_QUENCH:
+                return ICMPV4_TYPE_SOURCE_QUENCH;
+            case ICMPV4_TYPE_VAL_REDIRECT:
+                return ICMPV4_TYPE_REDIRECT;
+            case ICMPV4_TYPE_VAL_ALTERNATE_HOST_ADDRESS:
+                return ICMPV4_TYPE_ALTERNATE_HOST_ADDRESS;
+            case ICMPV4_TYPE_VAL_ECHO:
+                return ICMPV4_TYPE_ECHO;
+            case ICMPV4_TYPE_VAL_ROUTER_ADVERTISEMENT:
+                return ICMPV4_TYPE_ROUTER_ADVERTISEMENT;
+            case ICMPV4_TYPE_VAL_ROUTER_SOLICITATION:
+                return ICMPV4_TYPE_ROUTER_SOLICITATION;
+            case ICMPV4_TYPE_VAL_TIME_EXCEEDED:
+                return ICMPV4_TYPE_TIME_EXCEEDED;
+            case ICMPV4_TYPE_VAL_PARAMETER_PROBLEM:
+                return ICMPV4_TYPE_PARAMETER_PROBLEM;
+            case ICMPV4_TYPE_VAL_TIMESTAMP:
+                return ICMPV4_TYPE_TIMESTAMP;
+            case ICMPV4_TYPE_VAL_TIMESTAMP_REPLY:
+                return ICMPV4_TYPE_TIMESTAMP_REPLY;
+            case ICMPV4_TYPE_VAL_INFORMATION_REQUEST:
+                return ICMPV4_TYPE_INFORMATION_REQUEST;
+            case ICMPV4_TYPE_VAL_INFORMATION_REPLY:
+                return ICMPV4_TYPE_INFORMATION_REPLY;
+            case ICMPV4_TYPE_VAL_ADDRESS_MASK_REQUEST:
+                return ICMPV4_TYPE_ADDRESS_MASK_REQUEST;
+            case ICMPV4_TYPE_VAL_ADDRESS_MASK_REPLY:
+                return ICMPV4_TYPE_ADDRESS_MASK_REPLY;
+            case ICMPV4_TYPE_VAL_TRACEROUTE:
+                return ICMPV4_TYPE_TRACEROUTE;
+            case ICMPV4_TYPE_VAL_DATAGRAM_CONVERSION_ERROR:
+                return ICMPV4_TYPE_DATAGRAM_CONVERSION_ERROR;
+            case ICMPV4_TYPE_VAL_MOBILE_HOST_REDIRECT:
+                return ICMPV4_TYPE_MOBILE_HOST_REDIRECT;
+            case ICMPV4_TYPE_VAL_IPV6_WHERE_ARE_YOU:
+                return ICMPV4_TYPE_IPV6_WHERE_ARE_YOU;
+            case ICMPV4_TYPE_VAL_IPV6_I_AM_HERE:
+                return ICMPV4_TYPE_IPV6_I_AM_HERE;
+            case ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REQUEST:
+                return ICMPV4_TYPE_MOBILE_REGISTRATION_REQUEST;
+            case ICMPV4_TYPE_VAL_MOBILE_REGISTRATION_REPLY:
+                return ICMPV4_TYPE_MOBILE_REGISTRATION_REPLY;
+            case ICMPV4_TYPE_VAL_DOMAIN_NAME_REQUEST:
+                return ICMPV4_TYPE_DOMAIN_NAME_REQUEST;
+            case ICMPV4_TYPE_VAL_DOMAIN_NAME_REPLY:
+                return ICMPV4_TYPE_DOMAIN_NAME_REPLY;
+            case ICMPV4_TYPE_VAL_SKIP:
+                return ICMPV4_TYPE_SKIP;
+            case ICMPV4_TYPE_VAL_PHOTURIS:
+                return ICMPV4_TYPE_PHOTURIS;
+            case ICMPV4_TYPE_VAL_EXPERIMENTAL_MOBILITY:
+                return ICMPV4_TYPE_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));
+    }
+
+    
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java
new file mode 100644
index 0000000..401d79b
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4.java
@@ -0,0 +1,135 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+
+
+/**
+ * Wrapper around an IPv4 address
+ *
+ * @author Andreas Wundsam <andreas.wundsam@bigswitch.com>
+ */
+public class IPv4 implements OFValueType<IPv4> {
+    static final int LENGTH = 4;
+    private final int rawValue;
+    
+    public static final IPv4 NO_MASK = IPv4.of(0xFFFFFFFF);
+    public static final IPv4 FULL_MASK = IPv4.of(0x00000000);
+
+    private IPv4(final int rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static IPv4 of(final byte[] address) {
+        if (address.length != LENGTH) {
+            throw new IllegalArgumentException(
+                    "Invalid byte array length for IPv4 address: " + address);
+        }
+
+        int raw =
+                (address[0] & 0xFF) << 24 | (address[1] & 0xFF) << 16
+                        | (address[2] & 0xFF) << 8 | (address[3] & 0xFF) << 0;
+        return IPv4.of(raw);
+    }
+
+    public static IPv4 of(final int raw) {
+        return new IPv4(raw);
+    }
+
+    public static IPv4 of(final String string) {
+        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 IPv4.of(raw);
+    }
+
+    public int getInt() {
+        return rawValue;
+    }
+
+    volatile byte[] bytesCache = null;
+
+    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 bytesCache;
+    }
+
+    @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();
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + rawValue;
+        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;
+        IPv4 other = (IPv4) obj;
+        if (rawValue != other.rawValue)
+            return false;
+        return true;
+    }
+    
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(rawValue);
+    }
+    
+    public static IPv4 read4Bytes(ChannelBuffer c) {
+        return IPv4.of(c.readInt());
+    }
+
+    @Override
+    public IPv4 applyMask(IPv4 mask) {
+        return IPv4.of(this.rawValue & mask.rawValue);
+    }
+
+    
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
new file mode 100644
index 0000000..d2f2cc7
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4WithMask.java
@@ -0,0 +1,83 @@
+package org.projectfloodlight.openflow.types;
+
+public class IPv4WithMask extends Masked<IPv4> {
+
+    private IPv4WithMask(int rawValue, int rawMask) {
+        super(IPv4.of(rawValue), IPv4.of(rawMask));
+    }
+    
+    private IPv4WithMask(IPv4 value, IPv4 mask) {
+        super(value, mask);
+    }
+    
+    public static IPv4WithMask of(int rawValue, int rawMask) {
+        return new IPv4WithMask(rawValue, rawMask);
+    }
+    
+    public static IPv4WithMask of(IPv4 value, IPv4 mask) {
+        return new IPv4WithMask(value, mask);
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder res = new StringBuilder();
+        res.append(((IPv4)value).toString());
+        
+        int maskint = ((IPv4)mask).getInt();
+        res.append('/');
+        if (Integer.bitCount((~maskint) + 1) == 1) {
+            // CIDR notation
+            res.append(Integer.bitCount(maskint));
+        } else {
+            // Full address mask
+            res.append(((IPv4)mask).toString());
+        }
+        
+        return res.toString();
+    }
+    
+    public static IPv4WithMask of(final String string) {
+        int slashPos;
+        String ip = string;
+        int maskBits = 0;
+        IPv4 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 = IPv4.of(suffix);
+                } else {
+                    // CIDR Suffix
+                    maskBits = Integer.parseInt(suffix);
+                }
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("IP Address not well formed: " + string);
+            }
+            if (maskBits < 0 || maskBits > 32) {
+                throw new IllegalArgumentException("IP Address not well formed: " + string);
+            }
+        }
+        
+        // Read IP
+        IPv4 ipv4 = IPv4.of(ip);
+        
+        if (maskAddress != null) {
+            // Full address mask
+            return IPv4WithMask.of(ipv4, maskAddress);
+        } else if (maskBits == 0) {
+            // No mask
+            return IPv4WithMask.of(ipv4, IPv4.NO_MASK);
+        } else {
+            // With mask
+            int mask = (-1) << (32 - maskBits);
+            return IPv4WithMask.of(ipv4, IPv4.of(mask));
+        }
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java
new file mode 100644
index 0000000..0907d17
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6.java
@@ -0,0 +1,289 @@
+package org.projectfloodlight.openflow.types;
+
+import java.util.regex.Pattern;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+/**
+ * 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 IPv6 implements OFValueType<IPv6> {
+    static final int LENGTH = 16;
+    private final long raw1;
+    private final long raw2;
+
+    public static final IPv6 NO_MASK = IPv6.of(0xFFFFFFFFFFFFFFFFl, 0xFFFFFFFFFFFFFFFFl);
+    public static final IPv6 FULL_MASK = IPv6.of(0x0, 0x0);
+
+    private IPv6(final long raw1, final long raw2) {
+        this.raw1 = raw1;
+        this.raw2 = raw2;
+    }
+
+    public static IPv6 of(final byte[] address) {
+        if (address.length != LENGTH) {
+            throw new IllegalArgumentException(
+                    "Invalid byte array length for IPv6 address: " + address);
+        }
+
+        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 IPv6.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 IPv6 getIPv6() {
+            return IPv6.of(raw1, raw2);
+        }
+    }
+
+    private final static Pattern colonPattern = Pattern.compile(":");
+
+    public static IPv6 of(final String string) {
+        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();
+    }
+
+    public static IPv6 of(final long raw1, final long raw2) {
+        return new IPv6(raw1, raw2);
+    }
+
+    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 bytesCache;
+    }
+
+    @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;
+        IPv6 other = (IPv6) 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 IPv6 read16Bytes(ChannelBuffer c) throws OFParseError {
+        return IPv6.of(c.readLong(), c.readLong());
+    }
+
+    @Override
+    public IPv6 applyMask(IPv6 mask) {
+        return IPv6.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
new file mode 100644
index 0000000..7feb0d9
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
@@ -0,0 +1,67 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+public class IPv6FlowLabel implements OFValueType<IPv6FlowLabel> {
+
+    static final int LENGTH = 4;
+
+    private final int label;
+
+    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) {
+        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;
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
new file mode 100644
index 0000000..894a6dd
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6WithMask.java
@@ -0,0 +1,91 @@
+package org.projectfloodlight.openflow.types;
+
+import java.math.BigInteger;
+import java.util.Arrays;
+
+public class IPv6WithMask extends Masked<IPv6> {
+
+    private IPv6WithMask(IPv6 value, IPv6 mask) {
+        super(value, mask);
+    }
+    
+    public static IPv6WithMask of(IPv6 value, IPv6 mask) {
+        return new IPv6WithMask(value, mask);
+    }
+    
+    @Override
+    public String toString() {
+        StringBuilder res = new StringBuilder();
+        res.append(((IPv6)value).toString());
+        res.append('/');
+        
+        BigInteger maskint = new BigInteger(((IPv6)mask).getBytes());
+        if (maskint.not().add(BigInteger.ONE).bitCount() == 1) {
+            // CIDR notation
+            res.append(maskint.bitCount());
+        } else {
+            // Full address mask
+            res.append(((IPv6)mask).toString());
+        }
+        
+        return res.toString();
+    }
+    
+    public static IPv6WithMask of(final String string) {
+        int slashPos;
+        String ip = string;
+        int maskBits = 0;
+        IPv6 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 = IPv6.of(suffix);
+                } else {
+                    // CIDR Suffix
+                    maskBits = Integer.parseInt(suffix);
+                }
+            } catch (NumberFormatException e) {
+                throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
+            }
+            if (maskBits < 0 || maskBits > 128) {
+                throw new IllegalArgumentException("IPv6 Address not well formed: " + string);
+            }
+        }
+        
+        // Read IP
+        IPv6 ipv6 = IPv6.of(ip);
+        
+        if (maskAddress != null) {
+            // Full address mask
+            return IPv6WithMask.of(ipv6, maskAddress);
+        } else if (maskBits == 0) {
+            // No mask
+            return IPv6WithMask.of(ipv6, IPv6.NO_MASK);
+        } else {
+            // With mask
+            BigInteger mask = BigInteger.ONE.negate().shiftLeft(128 - maskBits);
+            byte[] maskBytesTemp = mask.toByteArray();
+            byte[] maskBytes;
+            if (maskBytesTemp.length < 16) {
+                maskBytes = new byte[16];
+                System.arraycopy(maskBytesTemp, 0, maskBytes, 16 - maskBytesTemp.length, maskBytesTemp.length);
+                Arrays.fill(maskBytes, 0, 16 - maskBytesTemp.length, (byte)(0xFF));
+            } else if (maskBytesTemp.length > 16) {
+                maskBytes = new byte[16];
+                System.arraycopy(maskBytesTemp, 0, maskBytes, 0, maskBytes.length);
+            } else {
+                maskBytes = maskBytesTemp;
+            }
+            return IPv6WithMask.of(ipv6, IPv6.of(maskBytes));
+        }
+    }
+
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpDscp.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpDscp.java
new file mode 100644
index 0000000..f311d9d
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpDscp.java
@@ -0,0 +1,245 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+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 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;
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpEcn.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpEcn.java
new file mode 100644
index 0000000..5ecd251
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpEcn.java
@@ -0,0 +1,65 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+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 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;
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
new file mode 100644
index 0000000..e78c97b
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
@@ -0,0 +1,648 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+/**
+ * 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 IP_PROTO_NUM_HOPOPT  = 0x00;
+    static final short IP_PROTO_NUM_ICMP    = 0x01;
+    static final short IP_PROTO_NUM_IGMP    = 0x02;
+    static final short IP_PROTO_NUM_GGP = 0x03;
+    static final short IP_PROTO_NUM_IPv4    = 0x04;
+    static final short IP_PROTO_NUM_ST  = 0x05;
+    static final short IP_PROTO_NUM_TCP = 0x06;
+    static final short IP_PROTO_NUM_CBT = 0x07;
+    static final short IP_PROTO_NUM_EGP = 0x08;
+    static final short IP_PROTO_NUM_IGP = 0x09;
+    static final short IP_PROTO_NUM_BBN_RCC_MON = 0x0A;
+    static final short IP_PROTO_NUM_NVP_II  = 0x0B;
+    static final short IP_PROTO_NUM_PUP = 0x0C;
+    static final short IP_PROTO_NUM_ARGUS   = 0x0D;
+    static final short IP_PROTO_NUM_EMCON   = 0x0E;
+    static final short IP_PROTO_NUM_XNET    = 0x0F;
+    static final short IP_PROTO_NUM_CHAOS   = 0x10;
+    static final short IP_PROTO_NUM_UDP = 0x11;
+    static final short IP_PROTO_NUM_MUX = 0x12;
+    static final short IP_PROTO_NUM_DCN_MEAS    = 0x13;
+    static final short IP_PROTO_NUM_HMP = 0x14;
+    static final short IP_PROTO_NUM_PRM = 0x15;
+    static final short IP_PROTO_NUM_XNS_IDP = 0x16;
+    static final short IP_PROTO_NUM_TRUNK_1 = 0x17;
+    static final short IP_PROTO_NUM_TRUNK_2 = 0x18;
+    static final short IP_PROTO_NUM_LEAF_1  = 0x19;
+    static final short IP_PROTO_NUM_LEAF_2  = 0x1A;
+    static final short IP_PROTO_NUM_RDP = 0x1B;
+    static final short IP_PROTO_NUM_IRTP    = 0x1C;
+    static final short IP_PROTO_NUM_ISO_TP4 = 0x1D;
+    static final short IP_PROTO_NUM_NETBLT  = 0x1E;
+    static final short IP_PROTO_NUM_MFE_NSP = 0x1F;
+    static final short IP_PROTO_NUM_MERIT_INP   = 0x20;
+    static final short IP_PROTO_NUM_DCCP    = 0x21;
+    static final short IP_PROTO_NUM_3PC = 0x22;
+    static final short IP_PROTO_NUM_IDPR    = 0x23;
+    static final short IP_PROTO_NUM_XTP = 0x24;
+    static final short IP_PROTO_NUM_DDP = 0x25;
+    static final short IP_PROTO_NUM_IDPR_CMTP   = 0x26;
+    static final short IP_PROTO_NUM_TP_PP   = 0x27;
+    static final short IP_PROTO_NUM_IL  = 0x28;
+    static final short IP_PROTO_NUM_IPv6    = 0x29;
+    static final short IP_PROTO_NUM_SDRP    = 0x2A;
+    static final short IP_PROTO_NUM_IPv6_ROUTE  = 0x2B;
+    static final short IP_PROTO_NUM_IPv6_FRAG   = 0x2C;
+    static final short IP_PROTO_NUM_IDRP    = 0x2D;
+    static final short IP_PROTO_NUM_RSVP    = 0x2E;
+    static final short IP_PROTO_NUM_GRE = 0x2F;
+    static final short IP_PROTO_NUM_MHRP    = 0x30;
+    static final short IP_PROTO_NUM_BNA = 0x31;
+    static final short IP_PROTO_NUM_ESP = 0x32;
+    static final short IP_PROTO_NUM_AH  = 0x33;
+    static final short IP_PROTO_NUM_I_NLSP  = 0x34;
+    static final short IP_PROTO_NUM_SWIPE   = 0x35;
+    static final short IP_PROTO_NUM_NARP    = 0x36;
+    static final short IP_PROTO_NUM_MOBILE  = 0x37;
+    static final short IP_PROTO_NUM_TLSP    = 0x38;
+    static final short IP_PROTO_NUM_SKIP    = 0x39;
+    static final short IP_PROTO_NUM_IPv6_ICMP   = 0x3A;
+    static final short IP_PROTO_NUM_IPv6_NO_NXT = 0x3B;
+    static final short IP_PROTO_NUM_IPv6_OPTS   = 0x3C;
+    static final short IP_PROTO_NUM_HOST_INTERNAL   = 0x3D;
+    static final short IP_PROTO_NUM_CFTP    = 0x3E;
+    static final short IP_PROTO_NUM_LOCAL_NET   = 0x3F;
+    static final short IP_PROTO_NUM_SAT_EXPAK   = 0x40;
+    static final short IP_PROTO_NUM_KRYPTOLAN   = 0x41;
+    static final short IP_PROTO_NUM_RVD = 0x42;
+    static final short IP_PROTO_NUM_IPPC    = 0x43;
+    static final short IP_PROTO_NUM_DIST_FS = 0x44;
+    static final short IP_PROTO_NUM_SAT_MON = 0x45;
+    static final short IP_PROTO_NUM_VISA    = 0x46;
+    static final short IP_PROTO_NUM_IPCV    = 0x47;
+    static final short IP_PROTO_NUM_CPNX    = 0x48;
+    static final short IP_PROTO_NUM_CPHB    = 0x49;
+    static final short IP_PROTO_NUM_WSN = 0x4A;
+    static final short IP_PROTO_NUM_PVP = 0x4B;
+    static final short IP_PROTO_NUM_BR_SAT_MON  = 0x4C;
+    static final short IP_PROTO_NUM_SUN_ND  = 0x4D;
+    static final short IP_PROTO_NUM_WB_MON  = 0x4E;
+    static final short IP_PROTO_NUM_WB_EXPAK    = 0x4F;
+    static final short IP_PROTO_NUM_ISO_IP  = 0x50;
+    static final short IP_PROTO_NUM_VMTP    = 0x51;
+    static final short IP_PROTO_NUM_SECURE_VMTP = 0x52;
+    static final short IP_PROTO_NUM_VINES   = 0x53;
+    static final short IP_PROTO_NUM_TTP_IPTM = 0x54;
+    static final short IP_PROTO_NUM_NSFNET_IGP  = 0x55;
+    static final short IP_PROTO_NUM_DGP = 0x56;
+    static final short IP_PROTO_NUM_TCF = 0x57;
+    static final short IP_PROTO_NUM_EIGRP   = 0x58;
+    static final short IP_PROTO_NUM_OSPF    = 0x59;
+    static final short IP_PROTO_NUM_Sprite_RPC  = 0x5A;
+    static final short IP_PROTO_NUM_LARP    = 0x5B;
+    static final short IP_PROTO_NUM_MTP = 0x5C;
+    static final short IP_PROTO_NUM_AX_25   = 0x5D;
+    static final short IP_PROTO_NUM_IPIP    = 0x5E;
+    static final short IP_PROTO_NUM_MICP    = 0x5F;
+    static final short IP_PROTO_NUM_SCC_SP  = 0x60;
+    static final short IP_PROTO_NUM_ETHERIP = 0x61;
+    static final short IP_PROTO_NUM_ENCAP   = 0x62;
+    static final short IP_PROTO_NUM_PRIVATE_ENCRYPT = 0x63;
+    static final short IP_PROTO_NUM_GMTP    = 0x64;
+    static final short IP_PROTO_NUM_IFMP    = 0x65;
+    static final short IP_PROTO_NUM_PNNI    = 0x66;
+    static final short IP_PROTO_NUM_PIM = 0x67;
+    static final short IP_PROTO_NUM_ARIS    = 0x68;
+    static final short IP_PROTO_NUM_SCPS    = 0x69;
+    static final short IP_PROTO_NUM_QNX = 0x6A;
+    static final short IP_PROTO_NUM_A_N = 0x6B;
+    static final short IP_PROTO_NUM_IP_COMP = 0x6C;
+    static final short IP_PROTO_NUM_SNP = 0x6D;
+    static final short IP_PROTO_NUM_COMPAQ_PEER = 0x6E;
+    static final short IP_PROTO_NUM_IPX_IN_IP   = 0x6F;
+    static final short IP_PROTO_NUM_VRRP    = 0x70;
+    static final short IP_PROTO_NUM_PGM = 0x71;
+    static final short IP_PROTO_NUM_ZERO_HOP    = 0x72;
+    static final short IP_PROTO_NUM_L2TP    = 0x73;
+    static final short IP_PROTO_NUM_DDX = 0x74;
+    static final short IP_PROTO_NUM_IATP    = 0x75;
+    static final short IP_PROTO_NUM_STP = 0x76;
+    static final short IP_PROTO_NUM_SRP = 0x77;
+    static final short IP_PROTO_NUM_UTI = 0x78;
+    static final short IP_PROTO_NUM_SMP = 0x79;
+    static final short IP_PROTO_NUM_SM  = 0x7A;
+    static final short IP_PROTO_NUM_PTP = 0x7B;
+    static final short IP_PROTO_NUM_IS_IS_OVER_IPv4 = 0x7C;
+    static final short IP_PROTO_NUM_FIRE    = 0x7D;
+    static final short IP_PROTO_NUM_CRTP    = 0x7E;
+    static final short IP_PROTO_NUM_CRUDP   = 0x7F;
+    static final short IP_PROTO_NUM_SSCOPMCE    = 0x80;
+    static final short IP_PROTO_NUM_IPLT    = 0x81;
+    static final short IP_PROTO_NUM_SPS = 0x82;
+    static final short IP_PROTO_NUM_PIPE    = 0x83;
+    static final short IP_PROTO_NUM_SCTP    = 0x84;
+    static final short IP_PROTO_NUM_FC  = 0x85;
+    static final short IP_PROTO_NUM_RSVP_E2E_IGNORE = 0x86;
+    static final short IP_PROTO_NUM_MOBILITY_HEADER = 0x87;
+    static final short IP_PROTO_NUM_UDP_LITE    = 0x88;
+    static final short IP_PROTO_NUM_MPLS_IN_IP  = 0x89;
+    static final short IP_PROTO_NUM_MANET   = 0x8A;
+    static final short IP_PROTO_NUM_HIP = 0x8B;
+    static final short IP_PROTO_NUM_SHIM6   = 0x8C;
+
+    public static final IpProtocol IP_PROTO_HOPOPT = new IpProtocol(IP_PROTO_NUM_HOPOPT);
+    public static final IpProtocol IP_PROTO_ICMP = new IpProtocol(IP_PROTO_NUM_ICMP);
+    public static final IpProtocol IP_PROTO_IGMP = new IpProtocol(IP_PROTO_NUM_IGMP);
+    public static final IpProtocol IP_PROTO_GGP = new IpProtocol(IP_PROTO_NUM_GGP);
+    public static final IpProtocol IP_PROTO_IPv4 = new IpProtocol(IP_PROTO_NUM_IPv4);
+    public static final IpProtocol IP_PROTO_ST = new IpProtocol(IP_PROTO_NUM_ST);
+    public static final IpProtocol IP_PROTO_TCP = new IpProtocol(IP_PROTO_NUM_TCP);
+    public static final IpProtocol IP_PROTO_CBT = new IpProtocol(IP_PROTO_NUM_CBT);
+    public static final IpProtocol IP_PROTO_EGP = new IpProtocol(IP_PROTO_NUM_EGP);
+    public static final IpProtocol IP_PROTO_IGP = new IpProtocol(IP_PROTO_NUM_IGP);
+    public static final IpProtocol IP_PROTO_BBN_RCC_MON = new IpProtocol(IP_PROTO_NUM_BBN_RCC_MON);
+    public static final IpProtocol IP_PROTO_NVP_II = new IpProtocol(IP_PROTO_NUM_NVP_II);
+    public static final IpProtocol IP_PROTO_PUP = new IpProtocol(IP_PROTO_NUM_PUP);
+    public static final IpProtocol IP_PROTO_ARGUS = new IpProtocol(IP_PROTO_NUM_ARGUS);
+    public static final IpProtocol IP_PROTO_EMCON = new IpProtocol(IP_PROTO_NUM_EMCON);
+    public static final IpProtocol IP_PROTO_XNET = new IpProtocol(IP_PROTO_NUM_XNET);
+    public static final IpProtocol IP_PROTO_CHAOS = new IpProtocol(IP_PROTO_NUM_CHAOS);
+    public static final IpProtocol IP_PROTO_UDP = new IpProtocol(IP_PROTO_NUM_UDP);
+    public static final IpProtocol IP_PROTO_MUX = new IpProtocol(IP_PROTO_NUM_MUX);
+    public static final IpProtocol IP_PROTO_DCN_MEAS = new IpProtocol(IP_PROTO_NUM_DCN_MEAS);
+    public static final IpProtocol IP_PROTO_HMP = new IpProtocol(IP_PROTO_NUM_HMP);
+    public static final IpProtocol IP_PROTO_PRM = new IpProtocol(IP_PROTO_NUM_PRM);
+    public static final IpProtocol IP_PROTO_XNS_IDP = new IpProtocol(IP_PROTO_NUM_XNS_IDP);
+    public static final IpProtocol IP_PROTO_TRUNK_1 = new IpProtocol(IP_PROTO_NUM_TRUNK_1);
+    public static final IpProtocol IP_PROTO_TRUNK_2 = new IpProtocol(IP_PROTO_NUM_TRUNK_2);
+    public static final IpProtocol IP_PROTO_LEAF_1 = new IpProtocol(IP_PROTO_NUM_LEAF_1);
+    public static final IpProtocol IP_PROTO_LEAF_2 = new IpProtocol(IP_PROTO_NUM_LEAF_2);
+    public static final IpProtocol IP_PROTO_RDP = new IpProtocol(IP_PROTO_NUM_RDP);
+    public static final IpProtocol IP_PROTO_IRTP = new IpProtocol(IP_PROTO_NUM_IRTP);
+    public static final IpProtocol IP_PROTO_ISO_TP4 = new IpProtocol(IP_PROTO_NUM_ISO_TP4);
+    public static final IpProtocol IP_PROTO_NETBLT = new IpProtocol(IP_PROTO_NUM_NETBLT);
+    public static final IpProtocol IP_PROTO_MFE_NSP = new IpProtocol(IP_PROTO_NUM_MFE_NSP);
+    public static final IpProtocol IP_PROTO_MERIT_INP = new IpProtocol(IP_PROTO_NUM_MERIT_INP);
+    public static final IpProtocol IP_PROTO_DCCP = new IpProtocol(IP_PROTO_NUM_DCCP);
+    public static final IpProtocol IP_PROTO_3PC = new IpProtocol(IP_PROTO_NUM_3PC);
+    public static final IpProtocol IP_PROTO_IDPR = new IpProtocol(IP_PROTO_NUM_IDPR);
+    public static final IpProtocol IP_PROTO_XTP = new IpProtocol(IP_PROTO_NUM_XTP);
+    public static final IpProtocol IP_PROTO_DDP = new IpProtocol(IP_PROTO_NUM_DDP);
+    public static final IpProtocol IP_PROTO_IDPR_CMTP = new IpProtocol(IP_PROTO_NUM_IDPR_CMTP);
+    public static final IpProtocol IP_PROTO_TP_PP = new IpProtocol(IP_PROTO_NUM_TP_PP);
+    public static final IpProtocol IP_PROTO_IL = new IpProtocol(IP_PROTO_NUM_IL);
+    public static final IpProtocol IP_PROTO_IPv6 = new IpProtocol(IP_PROTO_NUM_IPv6);
+    public static final IpProtocol IP_PROTO_SDRP = new IpProtocol(IP_PROTO_NUM_SDRP);
+    public static final IpProtocol IP_PROTO_IPv6_ROUTE = new IpProtocol(IP_PROTO_NUM_IPv6_ROUTE);
+    public static final IpProtocol IP_PROTO_IPv6_FRAG = new IpProtocol(IP_PROTO_NUM_IPv6_FRAG);
+    public static final IpProtocol IP_PROTO_IDRP = new IpProtocol(IP_PROTO_NUM_IDRP);
+    public static final IpProtocol IP_PROTO_RSVP = new IpProtocol(IP_PROTO_NUM_RSVP);
+    public static final IpProtocol IP_PROTO_GRE = new IpProtocol(IP_PROTO_NUM_GRE);
+    public static final IpProtocol IP_PROTO_MHRP = new IpProtocol(IP_PROTO_NUM_MHRP);
+    public static final IpProtocol IP_PROTO_BNA = new IpProtocol(IP_PROTO_NUM_BNA);
+    public static final IpProtocol IP_PROTO_ESP = new IpProtocol(IP_PROTO_NUM_ESP);
+    public static final IpProtocol IP_PROTO_AH = new IpProtocol(IP_PROTO_NUM_AH);
+    public static final IpProtocol IP_PROTO_I_NLSP = new IpProtocol(IP_PROTO_NUM_I_NLSP);
+    public static final IpProtocol IP_PROTO_SWIPE = new IpProtocol(IP_PROTO_NUM_SWIPE);
+    public static final IpProtocol IP_PROTO_NARP = new IpProtocol(IP_PROTO_NUM_NARP);
+    public static final IpProtocol IP_PROTO_MOBILE = new IpProtocol(IP_PROTO_NUM_MOBILE);
+    public static final IpProtocol IP_PROTO_TLSP = new IpProtocol(IP_PROTO_NUM_TLSP);
+    public static final IpProtocol IP_PROTO_SKIP = new IpProtocol(IP_PROTO_NUM_SKIP);
+    public static final IpProtocol IP_PROTO_IPv6_ICMP = new IpProtocol(IP_PROTO_NUM_IPv6_ICMP);
+    public static final IpProtocol IP_PROTO_IPv6_NO_NXT = new IpProtocol(IP_PROTO_NUM_IPv6_NO_NXT);
+    public static final IpProtocol IP_PROTO_IPv6_OPTS = new IpProtocol(IP_PROTO_NUM_IPv6_OPTS);
+    public static final IpProtocol IP_PROTO_HOST_INTERNAL = new IpProtocol(IP_PROTO_NUM_HOST_INTERNAL);
+    public static final IpProtocol IP_PROTO_CFTP = new IpProtocol(IP_PROTO_NUM_CFTP);
+    public static final IpProtocol IP_PROTO_LOCAL_NET = new IpProtocol(IP_PROTO_NUM_LOCAL_NET);
+    public static final IpProtocol IP_PROTO_SAT_EXPAK = new IpProtocol(IP_PROTO_NUM_SAT_EXPAK);
+    public static final IpProtocol IP_PROTO_KRYPTOLAN = new IpProtocol(IP_PROTO_NUM_KRYPTOLAN);
+    public static final IpProtocol IP_PROTO_RVD = new IpProtocol(IP_PROTO_NUM_RVD);
+    public static final IpProtocol IP_PROTO_IPPC = new IpProtocol(IP_PROTO_NUM_IPPC);
+    public static final IpProtocol IP_PROTO_DIST_FS = new IpProtocol(IP_PROTO_NUM_DIST_FS);
+    public static final IpProtocol IP_PROTO_SAT_MON = new IpProtocol(IP_PROTO_NUM_SAT_MON);
+    public static final IpProtocol IP_PROTO_VISA = new IpProtocol(IP_PROTO_NUM_VISA);
+    public static final IpProtocol IP_PROTO_IPCV = new IpProtocol(IP_PROTO_NUM_IPCV);
+    public static final IpProtocol IP_PROTO_CPNX = new IpProtocol(IP_PROTO_NUM_CPNX);
+    public static final IpProtocol IP_PROTO_CPHB = new IpProtocol(IP_PROTO_NUM_CPHB);
+    public static final IpProtocol IP_PROTO_WSN = new IpProtocol(IP_PROTO_NUM_WSN);
+    public static final IpProtocol IP_PROTO_PVP = new IpProtocol(IP_PROTO_NUM_PVP);
+    public static final IpProtocol IP_PROTO_BR_SAT_MON = new IpProtocol(IP_PROTO_NUM_BR_SAT_MON);
+    public static final IpProtocol IP_PROTO_SUN_ND = new IpProtocol(IP_PROTO_NUM_SUN_ND);
+    public static final IpProtocol IP_PROTO_WB_MON = new IpProtocol(IP_PROTO_NUM_WB_MON);
+    public static final IpProtocol IP_PROTO_WB_EXPAK = new IpProtocol(IP_PROTO_NUM_WB_EXPAK);
+    public static final IpProtocol IP_PROTO_ISO_IP = new IpProtocol(IP_PROTO_NUM_ISO_IP);
+    public static final IpProtocol IP_PROTO_VMTP = new IpProtocol(IP_PROTO_NUM_VMTP);
+    public static final IpProtocol IP_PROTO_SECURE_VMTP = new IpProtocol(IP_PROTO_NUM_SECURE_VMTP);
+    public static final IpProtocol IP_PROTO_VINES = new IpProtocol(IP_PROTO_NUM_VINES);
+    public static final IpProtocol IP_PROTO_TTP_IPTM = new IpProtocol(IP_PROTO_NUM_TTP_IPTM);
+    public static final IpProtocol IP_PROTO_NSFNET_IGP = new IpProtocol(IP_PROTO_NUM_NSFNET_IGP);
+    public static final IpProtocol IP_PROTO_DGP = new IpProtocol(IP_PROTO_NUM_DGP);
+    public static final IpProtocol IP_PROTO_TCF = new IpProtocol(IP_PROTO_NUM_TCF);
+    public static final IpProtocol IP_PROTO_EIGRP = new IpProtocol(IP_PROTO_NUM_EIGRP);
+    public static final IpProtocol IP_PROTO_OSPF = new IpProtocol(IP_PROTO_NUM_OSPF);
+    public static final IpProtocol IP_PROTO_Sprite_RPC = new IpProtocol(IP_PROTO_NUM_Sprite_RPC);
+    public static final IpProtocol IP_PROTO_LARP = new IpProtocol(IP_PROTO_NUM_LARP);
+    public static final IpProtocol IP_PROTO_MTP = new IpProtocol(IP_PROTO_NUM_MTP);
+    public static final IpProtocol IP_PROTO_AX_25 = new IpProtocol(IP_PROTO_NUM_AX_25);
+    public static final IpProtocol IP_PROTO_IPIP = new IpProtocol(IP_PROTO_NUM_IPIP);
+    public static final IpProtocol IP_PROTO_MICP = new IpProtocol(IP_PROTO_NUM_MICP);
+    public static final IpProtocol IP_PROTO_SCC_SP = new IpProtocol(IP_PROTO_NUM_SCC_SP);
+    public static final IpProtocol IP_PROTO_ETHERIP = new IpProtocol(IP_PROTO_NUM_ETHERIP);
+    public static final IpProtocol IP_PROTO_ENCAP = new IpProtocol(IP_PROTO_NUM_ENCAP);
+    public static final IpProtocol IP_PROTO_PRIVATE_ENCRYPT = new IpProtocol(IP_PROTO_NUM_PRIVATE_ENCRYPT);
+    public static final IpProtocol IP_PROTO_GMTP = new IpProtocol(IP_PROTO_NUM_GMTP);
+    public static final IpProtocol IP_PROTO_IFMP = new IpProtocol(IP_PROTO_NUM_IFMP);
+    public static final IpProtocol IP_PROTO_PNNI = new IpProtocol(IP_PROTO_NUM_PNNI);
+    public static final IpProtocol IP_PROTO_PIM = new IpProtocol(IP_PROTO_NUM_PIM);
+    public static final IpProtocol IP_PROTO_ARIS = new IpProtocol(IP_PROTO_NUM_ARIS);
+    public static final IpProtocol IP_PROTO_SCPS = new IpProtocol(IP_PROTO_NUM_SCPS);
+    public static final IpProtocol IP_PROTO_QNX = new IpProtocol(IP_PROTO_NUM_QNX);
+    public static final IpProtocol IP_PROTO_A_N = new IpProtocol(IP_PROTO_NUM_A_N);
+    public static final IpProtocol IP_PROTO_IP_COMP = new IpProtocol(IP_PROTO_NUM_IP_COMP);
+    public static final IpProtocol IP_PROTO_SNP = new IpProtocol(IP_PROTO_NUM_SNP);
+    public static final IpProtocol IP_PROTO_COMPAQ_PEER = new IpProtocol(IP_PROTO_NUM_COMPAQ_PEER);
+    public static final IpProtocol IP_PROTO_IPX_IN_IP = new IpProtocol(IP_PROTO_NUM_IPX_IN_IP);
+    public static final IpProtocol IP_PROTO_VRRP = new IpProtocol(IP_PROTO_NUM_VRRP);
+    public static final IpProtocol IP_PROTO_PGM = new IpProtocol(IP_PROTO_NUM_PGM);
+    public static final IpProtocol IP_PROTO_ZERO_HOP = new IpProtocol(IP_PROTO_NUM_ZERO_HOP);
+    public static final IpProtocol IP_PROTO_L2TP = new IpProtocol(IP_PROTO_NUM_L2TP);
+    public static final IpProtocol IP_PROTO_DDX = new IpProtocol(IP_PROTO_NUM_DDX);
+    public static final IpProtocol IP_PROTO_IATP = new IpProtocol(IP_PROTO_NUM_IATP);
+    public static final IpProtocol IP_PROTO_STP = new IpProtocol(IP_PROTO_NUM_STP);
+    public static final IpProtocol IP_PROTO_SRP = new IpProtocol(IP_PROTO_NUM_SRP);
+    public static final IpProtocol IP_PROTO_UTI = new IpProtocol(IP_PROTO_NUM_UTI);
+    public static final IpProtocol IP_PROTO_SMP = new IpProtocol(IP_PROTO_NUM_SMP);
+    public static final IpProtocol IP_PROTO_SM = new IpProtocol(IP_PROTO_NUM_SM);
+    public static final IpProtocol IP_PROTO_PTP = new IpProtocol(IP_PROTO_NUM_PTP);
+    public static final IpProtocol IP_PROTO_IS_IS_OVER_IPv4 = new IpProtocol(IP_PROTO_NUM_IS_IS_OVER_IPv4);
+    public static final IpProtocol IP_PROTO_FIRE = new IpProtocol(IP_PROTO_NUM_FIRE);
+    public static final IpProtocol IP_PROTO_CRTP = new IpProtocol(IP_PROTO_NUM_CRTP);
+    public static final IpProtocol IP_PROTO_CRUDP = new IpProtocol(IP_PROTO_NUM_CRUDP);
+    public static final IpProtocol IP_PROTO_SSCOPMCE = new IpProtocol(IP_PROTO_NUM_SSCOPMCE);
+    public static final IpProtocol IP_PROTO_IPLT = new IpProtocol(IP_PROTO_NUM_IPLT);
+    public static final IpProtocol IP_PROTO_SPS = new IpProtocol(IP_PROTO_NUM_SPS);
+    public static final IpProtocol IP_PROTO_PIPE = new IpProtocol(IP_PROTO_NUM_PIPE);
+    public static final IpProtocol IP_PROTO_SCTP = new IpProtocol(IP_PROTO_NUM_SCTP);
+    public static final IpProtocol IP_PROTO_FC = new IpProtocol(IP_PROTO_NUM_FC);
+    public static final IpProtocol IP_PROTO_RSVP_E2E_IGNORE = new IpProtocol(IP_PROTO_NUM_RSVP_E2E_IGNORE);
+    public static final IpProtocol IP_PROTO_MOBILITY_HEADER = new IpProtocol(IP_PROTO_NUM_MOBILITY_HEADER);
+    public static final IpProtocol IP_PROTO_UDP_LITE = new IpProtocol(IP_PROTO_NUM_UDP_LITE);
+    public static final IpProtocol IP_PROTO_MPLS_IN_IP = new IpProtocol(IP_PROTO_NUM_MPLS_IN_IP);
+    public static final IpProtocol IP_PROTO_MANET = new IpProtocol(IP_PROTO_NUM_MANET);
+    public static final IpProtocol IP_PROTO_HIP = new IpProtocol(IP_PROTO_NUM_HIP);
+    public static final IpProtocol IP_PROTO_SHIM6 = new IpProtocol(IP_PROTO_NUM_SHIM6);
+
+    public static final IpProtocol NO_MASK = IP_PROTO_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 IP_PROTO_NUM_HOPOPT:
+                return IP_PROTO_HOPOPT;
+            case IP_PROTO_NUM_ICMP:
+                return IP_PROTO_ICMP;
+            case IP_PROTO_NUM_IGMP:
+                return IP_PROTO_IGMP;
+            case IP_PROTO_NUM_GGP:
+                return IP_PROTO_GGP;
+            case IP_PROTO_NUM_IPv4:
+                return IP_PROTO_IPv4;
+            case IP_PROTO_NUM_ST:
+                return IP_PROTO_ST;
+            case IP_PROTO_NUM_TCP:
+                return IP_PROTO_TCP;
+            case IP_PROTO_NUM_CBT:
+                return IP_PROTO_CBT;
+            case IP_PROTO_NUM_EGP:
+                return IP_PROTO_EGP;
+            case IP_PROTO_NUM_IGP:
+                return IP_PROTO_IGP;
+            case IP_PROTO_NUM_BBN_RCC_MON:
+                return IP_PROTO_BBN_RCC_MON;
+            case IP_PROTO_NUM_NVP_II:
+                return IP_PROTO_NVP_II;
+            case IP_PROTO_NUM_PUP:
+                return IP_PROTO_PUP;
+            case IP_PROTO_NUM_ARGUS:
+                return IP_PROTO_ARGUS;
+            case IP_PROTO_NUM_EMCON:
+                return IP_PROTO_EMCON;
+            case IP_PROTO_NUM_XNET:
+                return IP_PROTO_XNET;
+            case IP_PROTO_NUM_CHAOS:
+                return IP_PROTO_CHAOS;
+            case IP_PROTO_NUM_UDP:
+                return IP_PROTO_UDP;
+            case IP_PROTO_NUM_MUX:
+                return IP_PROTO_MUX;
+            case IP_PROTO_NUM_DCN_MEAS:
+                return IP_PROTO_DCN_MEAS;
+            case IP_PROTO_NUM_HMP:
+                return IP_PROTO_HMP;
+            case IP_PROTO_NUM_PRM:
+                return IP_PROTO_PRM;
+            case IP_PROTO_NUM_XNS_IDP:
+                return IP_PROTO_XNS_IDP;
+            case IP_PROTO_NUM_TRUNK_1:
+                return IP_PROTO_TRUNK_1;
+            case IP_PROTO_NUM_TRUNK_2:
+                return IP_PROTO_TRUNK_2;
+            case IP_PROTO_NUM_LEAF_1:
+                return IP_PROTO_LEAF_1;
+            case IP_PROTO_NUM_LEAF_2:
+                return IP_PROTO_LEAF_2;
+            case IP_PROTO_NUM_RDP:
+                return IP_PROTO_RDP;
+            case IP_PROTO_NUM_IRTP:
+                return IP_PROTO_IRTP;
+            case IP_PROTO_NUM_ISO_TP4:
+                return IP_PROTO_ISO_TP4;
+            case IP_PROTO_NUM_NETBLT:
+                return IP_PROTO_NETBLT;
+            case IP_PROTO_NUM_MFE_NSP:
+                return IP_PROTO_MFE_NSP;
+            case IP_PROTO_NUM_MERIT_INP:
+                return IP_PROTO_MERIT_INP;
+            case IP_PROTO_NUM_DCCP:
+                return IP_PROTO_DCCP;
+            case IP_PROTO_NUM_3PC:
+                return IP_PROTO_3PC;
+            case IP_PROTO_NUM_IDPR:
+                return IP_PROTO_IDPR;
+            case IP_PROTO_NUM_XTP:
+                return IP_PROTO_XTP;
+            case IP_PROTO_NUM_DDP:
+                return IP_PROTO_DDP;
+            case IP_PROTO_NUM_IDPR_CMTP:
+                return IP_PROTO_IDPR_CMTP;
+            case IP_PROTO_NUM_TP_PP:
+                return IP_PROTO_TP_PP;
+            case IP_PROTO_NUM_IL:
+                return IP_PROTO_IL;
+            case IP_PROTO_NUM_IPv6:
+                return IP_PROTO_IPv6;
+            case IP_PROTO_NUM_SDRP:
+                return IP_PROTO_SDRP;
+            case IP_PROTO_NUM_IPv6_ROUTE:
+                return IP_PROTO_IPv6_ROUTE;
+            case IP_PROTO_NUM_IPv6_FRAG:
+                return IP_PROTO_IPv6_FRAG;
+            case IP_PROTO_NUM_IDRP:
+                return IP_PROTO_IDRP;
+            case IP_PROTO_NUM_RSVP:
+                return IP_PROTO_RSVP;
+            case IP_PROTO_NUM_GRE:
+                return IP_PROTO_GRE;
+            case IP_PROTO_NUM_MHRP:
+                return IP_PROTO_MHRP;
+            case IP_PROTO_NUM_BNA:
+                return IP_PROTO_BNA;
+            case IP_PROTO_NUM_ESP:
+                return IP_PROTO_ESP;
+            case IP_PROTO_NUM_AH:
+                return IP_PROTO_AH;
+            case IP_PROTO_NUM_I_NLSP:
+                return IP_PROTO_I_NLSP;
+            case IP_PROTO_NUM_SWIPE:
+                return IP_PROTO_SWIPE;
+            case IP_PROTO_NUM_NARP:
+                return IP_PROTO_NARP;
+            case IP_PROTO_NUM_MOBILE:
+                return IP_PROTO_MOBILE;
+            case IP_PROTO_NUM_TLSP:
+                return IP_PROTO_TLSP;
+            case IP_PROTO_NUM_SKIP:
+                return IP_PROTO_SKIP;
+            case IP_PROTO_NUM_IPv6_ICMP:
+                return IP_PROTO_IPv6_ICMP;
+            case IP_PROTO_NUM_IPv6_NO_NXT:
+                return IP_PROTO_IPv6_NO_NXT;
+            case IP_PROTO_NUM_IPv6_OPTS:
+                return IP_PROTO_IPv6_OPTS;
+            case IP_PROTO_NUM_HOST_INTERNAL:
+                return IP_PROTO_HOST_INTERNAL;
+            case IP_PROTO_NUM_CFTP:
+                return IP_PROTO_CFTP;
+            case IP_PROTO_NUM_LOCAL_NET:
+                return IP_PROTO_LOCAL_NET;
+            case IP_PROTO_NUM_SAT_EXPAK:
+                return IP_PROTO_SAT_EXPAK;
+            case IP_PROTO_NUM_KRYPTOLAN:
+                return IP_PROTO_KRYPTOLAN;
+            case IP_PROTO_NUM_RVD:
+                return IP_PROTO_RVD;
+            case IP_PROTO_NUM_IPPC:
+                return IP_PROTO_IPPC;
+            case IP_PROTO_NUM_DIST_FS:
+                return IP_PROTO_DIST_FS;
+            case IP_PROTO_NUM_SAT_MON:
+                return IP_PROTO_SAT_MON;
+            case IP_PROTO_NUM_VISA:
+                return IP_PROTO_VISA;
+            case IP_PROTO_NUM_IPCV:
+                return IP_PROTO_IPCV;
+            case IP_PROTO_NUM_CPNX:
+                return IP_PROTO_CPNX;
+            case IP_PROTO_NUM_CPHB:
+                return IP_PROTO_CPHB;
+            case IP_PROTO_NUM_WSN:
+                return IP_PROTO_WSN;
+            case IP_PROTO_NUM_PVP:
+                return IP_PROTO_PVP;
+            case IP_PROTO_NUM_BR_SAT_MON:
+                return IP_PROTO_BR_SAT_MON;
+            case IP_PROTO_NUM_SUN_ND:
+                return IP_PROTO_SUN_ND;
+            case IP_PROTO_NUM_WB_MON:
+                return IP_PROTO_WB_MON;
+            case IP_PROTO_NUM_WB_EXPAK:
+                return IP_PROTO_WB_EXPAK;
+            case IP_PROTO_NUM_ISO_IP:
+                return IP_PROTO_ISO_IP;
+            case IP_PROTO_NUM_VMTP:
+                return IP_PROTO_VMTP;
+            case IP_PROTO_NUM_SECURE_VMTP:
+                return IP_PROTO_SECURE_VMTP;
+            case IP_PROTO_NUM_VINES:
+                return IP_PROTO_VINES;
+            case IP_PROTO_NUM_TTP_IPTM:
+                return IP_PROTO_TTP_IPTM;
+            case IP_PROTO_NUM_NSFNET_IGP:
+                return IP_PROTO_NSFNET_IGP;
+            case IP_PROTO_NUM_DGP:
+                return IP_PROTO_DGP;
+            case IP_PROTO_NUM_TCF:
+                return IP_PROTO_TCF;
+            case IP_PROTO_NUM_EIGRP:
+                return IP_PROTO_EIGRP;
+            case IP_PROTO_NUM_OSPF:
+                return IP_PROTO_OSPF;
+            case IP_PROTO_NUM_Sprite_RPC:
+                return IP_PROTO_Sprite_RPC;
+            case IP_PROTO_NUM_LARP:
+                return IP_PROTO_LARP;
+            case IP_PROTO_NUM_MTP:
+                return IP_PROTO_MTP;
+            case IP_PROTO_NUM_AX_25:
+                return IP_PROTO_AX_25;
+            case IP_PROTO_NUM_IPIP:
+                return IP_PROTO_IPIP;
+            case IP_PROTO_NUM_MICP:
+                return IP_PROTO_MICP;
+            case IP_PROTO_NUM_SCC_SP:
+                return IP_PROTO_SCC_SP;
+            case IP_PROTO_NUM_ETHERIP:
+                return IP_PROTO_ETHERIP;
+            case IP_PROTO_NUM_ENCAP:
+                return IP_PROTO_ENCAP;
+            case IP_PROTO_NUM_PRIVATE_ENCRYPT:
+                return IP_PROTO_PRIVATE_ENCRYPT;
+            case IP_PROTO_NUM_GMTP:
+                return IP_PROTO_GMTP;
+            case IP_PROTO_NUM_IFMP:
+                return IP_PROTO_IFMP;
+            case IP_PROTO_NUM_PNNI:
+                return IP_PROTO_PNNI;
+            case IP_PROTO_NUM_PIM:
+                return IP_PROTO_PIM;
+            case IP_PROTO_NUM_ARIS:
+                return IP_PROTO_ARIS;
+            case IP_PROTO_NUM_SCPS:
+                return IP_PROTO_SCPS;
+            case IP_PROTO_NUM_QNX:
+                return IP_PROTO_QNX;
+            case IP_PROTO_NUM_A_N:
+                return IP_PROTO_A_N;
+            case IP_PROTO_NUM_IP_COMP:
+                return IP_PROTO_IP_COMP;
+            case IP_PROTO_NUM_SNP:
+                return IP_PROTO_SNP;
+            case IP_PROTO_NUM_COMPAQ_PEER:
+                return IP_PROTO_COMPAQ_PEER;
+            case IP_PROTO_NUM_IPX_IN_IP:
+                return IP_PROTO_IPX_IN_IP;
+            case IP_PROTO_NUM_VRRP:
+                return IP_PROTO_VRRP;
+            case IP_PROTO_NUM_PGM:
+                return IP_PROTO_PGM;
+            case IP_PROTO_NUM_ZERO_HOP:
+                return IP_PROTO_ZERO_HOP;
+            case IP_PROTO_NUM_L2TP:
+                return IP_PROTO_L2TP;
+            case IP_PROTO_NUM_DDX:
+                return IP_PROTO_DDX;
+            case IP_PROTO_NUM_IATP:
+                return IP_PROTO_IATP;
+            case IP_PROTO_NUM_STP:
+                return IP_PROTO_STP;
+            case IP_PROTO_NUM_SRP:
+                return IP_PROTO_SRP;
+            case IP_PROTO_NUM_UTI:
+                return IP_PROTO_UTI;
+            case IP_PROTO_NUM_SMP:
+                return IP_PROTO_SMP;
+            case IP_PROTO_NUM_SM:
+                return IP_PROTO_SM;
+            case IP_PROTO_NUM_PTP:
+                return IP_PROTO_PTP;
+            case IP_PROTO_NUM_IS_IS_OVER_IPv4:
+                return IP_PROTO_IS_IS_OVER_IPv4;
+            case IP_PROTO_NUM_FIRE:
+                return IP_PROTO_FIRE;
+            case IP_PROTO_NUM_CRTP:
+                return IP_PROTO_CRTP;
+            case IP_PROTO_NUM_CRUDP:
+                return IP_PROTO_CRUDP;
+            case IP_PROTO_NUM_SSCOPMCE:
+                return IP_PROTO_SSCOPMCE;
+            case IP_PROTO_NUM_IPLT:
+                return IP_PROTO_IPLT;
+            case IP_PROTO_NUM_SPS:
+                return IP_PROTO_SPS;
+            case IP_PROTO_NUM_PIPE:
+                return IP_PROTO_PIPE;
+            case IP_PROTO_NUM_SCTP:
+                return IP_PROTO_SCTP;
+            case IP_PROTO_NUM_FC:
+                return IP_PROTO_FC;
+            case IP_PROTO_NUM_RSVP_E2E_IGNORE:
+                return IP_PROTO_RSVP_E2E_IGNORE;
+            case IP_PROTO_NUM_MOBILITY_HEADER:
+                return IP_PROTO_MOBILITY_HEADER;
+            case IP_PROTO_NUM_UDP_LITE:
+                return IP_PROTO_UDP_LITE;
+            case IP_PROTO_NUM_MPLS_IN_IP:
+                return IP_PROTO_MPLS_IN_IP;
+            case IP_PROTO_NUM_MANET:
+                return IP_PROTO_MANET;
+            case IP_PROTO_NUM_HIP:
+                return IP_PROTO_HIP;
+            case IP_PROTO_NUM_SHIM6:
+                return IP_PROTO_SHIM6;
+            default:
+                if (proto >= MAX_PROTO) {
+                    throw new IllegalArgumentException("Illegal IP protocol number: "
+                            + proto);
+                } else {
+                    return new IpProtocol(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 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;
+    }
+    
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
new file mode 100644
index 0000000..040d875
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
@@ -0,0 +1,130 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.util.HexString;
+
+/**
+ * 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;
+
+    public static final MacAddress NO_MASK = MacAddress.of(0xFFFFFFFFFFFFFFFFl);
+    public static final MacAddress FULL_MASK = MacAddress.of(0x0);
+
+    private MacAddress(final long rawValue) {
+        this.rawValue = rawValue;
+    }
+
+    public static MacAddress of(final byte[] address) {
+        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(final long raw) {
+        return new MacAddress(raw);
+    }
+
+    public static MacAddress of(final String string) {
+        int index = 0;
+        int shift = 40;
+
+        long raw = 0;
+        if (string.length() != 6 * 2 + 5)
+            throw new IllegalArgumentException("Mac address not well formed: " + string);
+
+        while (shift >= 0) {
+            raw |=
+                    ((long) (Character.digit(string.charAt(index++), 16) << 4 | Character
+                            .digit(string.charAt(index++), 16))) << shift;
+
+            if (shift == 0)
+                break;
+            if (string.charAt(index++) != ':')
+                throw new IllegalArgumentException("Mac address not well formed: " + string);
+            shift -= 8;
+        }
+        return MacAddress.of(raw);
+    }
+
+    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 bytesCache;
+    }
+
+    @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);
+    }
+
+
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java
new file mode 100644
index 0000000..ead7d62
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java
@@ -0,0 +1,61 @@
+package org.projectfloodlight.openflow.types;
+
+
+
+public class Masked<T extends OFValueType<T>> implements OFValueType<Masked<T>> {
+    protected T value;
+    protected 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 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 String toString() {
+        // General representation: value/mask
+        StringBuilder sb = new StringBuilder();
+        sb.append(value.toString()).append('/').append(mask.toString());
+        return sb.toString();
+    }
+
+    @Override
+    public Masked<T> applyMask(Masked<T> mask) {
+        return this;
+    }
+    
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFFlowModCmd.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFFlowModCmd.java
new file mode 100644
index 0000000..7173bde
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFFlowModCmd.java
@@ -0,0 +1,11 @@
+package org.projectfloodlight.openflow.types;
+
+/**
+ * Version agnostic view of commands to an OFFlowMod
+ *
+ * @author capveg
+ */
+
+public enum OFFlowModCmd {
+    ADD, MODIFY, MODIFY_STRICT, DELETE, DELETE_STRICT
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFHelloElement.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFHelloElement.java
new file mode 100644
index 0000000..10d06a0
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFHelloElement.java
@@ -0,0 +1,5 @@
+package org.projectfloodlight.openflow.types;
+
+public interface OFHelloElement {
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
new file mode 100644
index 0000000..861d4a8
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
@@ -0,0 +1,66 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public class OFMetadata implements OFValueType<OFMetadata> {
+
+    static int LENGTH = 8;
+
+    private final U64 u64;
+
+    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 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();
+    }
+
+
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPhysicalPort.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPhysicalPort.java
new file mode 100644
index 0000000..ca662f7
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPhysicalPort.java
@@ -0,0 +1,90 @@
+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;
+
+/**
+ * A wrapper around the OpenFlow physical port description. The interfaces to
+ * this object are version agnostic.
+ *
+ * @author capveg
+ */
+
+public class OFPhysicalPort implements OFValueType<OFPhysicalPort>, Writeable {
+
+    static final int LENGTH = 4;
+
+    private final int port;
+
+    public static final OFPhysicalPort NO_MASK = OFPhysicalPort.of(0xFFFFFFFF);
+    public static final OFPhysicalPort FULL_MASK = OFPhysicalPort.of(0x0);
+
+    private OFPhysicalPort(int port) {
+        this.port = port;
+    }
+
+    public static OFPhysicalPort of(int port) {
+        return new OFPhysicalPort(port);
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof OFPhysicalPort))
+            return false;
+        OFPhysicalPort other = (OFPhysicalPort)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.toHexString(port);
+    }
+
+    public void write4Bytes(ChannelBuffer c) {
+        c.writeInt(this.port);
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        write4Bytes(bb);
+    }
+
+    public static OFPhysicalPort read4Bytes(ChannelBuffer c) throws OFParseError {
+        return OFPhysicalPort.of((int)(c.readUnsignedInt() & 0xFFFFFFFF));
+    }
+
+    @Override
+    public OFPhysicalPort applyMask(OFPhysicalPort mask) {
+        return OFPhysicalPort.of(this.port & mask.port);
+    }
+
+    public int getPortNumber() {
+        return port;
+    }
+
+    public final static Reader READER = new Reader();
+    private static class Reader implements OFMessageReader<OFPhysicalPort> {
+        @Override
+        public OFPhysicalPort readFrom(ChannelBuffer bb) throws OFParseError {
+            return OFPhysicalPort.read4Bytes(bb);
+        }
+
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
new file mode 100644
index 0000000..d65d0aa
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
@@ -0,0 +1,541 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.annotations.Immutable;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+/**
+ * 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");
+
+    public static final OFPort NO_MASK = OFPort.of(0xFFFFFFFF);
+    public static final OFPort FULL_MASK = OFPort.of(0x0);
+    
+    /** cache of frequently used ports */
+    private static class PrecachedPort {
+        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 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 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);
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
new file mode 100644
index 0000000..5f41494
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
@@ -0,0 +1,12 @@
+package org.projectfloodlight.openflow.types;
+
+
+
+
+public interface OFValueType<T extends OFValueType<T>> {
+
+    public int getLength();
+    
+    public T applyMask(T mask);
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
new file mode 100644
index 0000000..4cf5b90
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
@@ -0,0 +1,78 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+/**
+ * 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;
+
+    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 < 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);
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
new file mode 100644
index 0000000..55a467e
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
@@ -0,0 +1,108 @@
+/**
+ *    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;
+
+public class U16 implements Writeable, OFValueType<U16> {
+    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 new U16(t(value));
+    }
+
+    public static final U16 ofRaw(short value) {
+        return new U16(value);
+    }
+
+    public int getValue() {
+        return f(raw);
+    }
+
+    public short getRaw() {
+        return raw;
+    }
+
+    @Override
+    public String toString() {
+        return "" + f(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));
+    }
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java
new file mode 100644
index 0000000..2634ed1
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java
@@ -0,0 +1,108 @@
+/**
+ *    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;
+
+public class U32 implements Writeable, OFValueType<U32> {
+    private final int raw;
+
+    private U32(int raw) {
+        this.raw = raw;
+    }
+
+    public static U32 of(long value) {
+        return new U32(U32.t(value));
+    }
+
+    public static U32 ofRaw(int value) {
+        return new U32(value);
+    }
+
+    public long getValue() {
+        return f(raw);
+    }
+
+    public int getRaw() {
+        return raw;
+    }
+
+    @Override
+    public String toString() {
+        return "" + f(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);
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java
new file mode 100644
index 0000000..5de62dc
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java
@@ -0,0 +1,112 @@
+/**
+ *    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.protocol.Writeable;
+
+public class U64 implements Writeable, OFValueType<U64> {
+    private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;
+
+    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) {
+        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 getBigInteger().toString();
+    }
+
+    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 ofRaw(raw & mask.raw);
+    }
+
+    @Override
+    public void writeTo(ChannelBuffer bb) {
+        bb.writeLong(raw);
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java
new file mode 100644
index 0000000..41e740e
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java
@@ -0,0 +1,109 @@
+/**
+ *    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;
+
+public class U8 implements Writeable, OFValueType<U8> {
+    private final byte raw;
+
+    private U8(byte raw) {
+        this.raw = raw;
+    }
+
+    public static final U8 of(short value) {
+        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 "" + f(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));
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
new file mode 100644
index 0000000..9b5ef11
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
@@ -0,0 +1,69 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+public class VlanPcp implements OFValueType<VlanPcp> {
+
+    private static final byte VALIDATION_MASK = 0x07;
+    static final int LENGTH = 1;
+
+    private final byte pcp;
+
+    public static final VlanPcp NO_MASK = VlanPcp.of((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.writeShort(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));
+    }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
new file mode 100644
index 0000000..705464c
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
@@ -0,0 +1,85 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+public class VlanVid implements OFValueType<VlanVid> {
+
+    private static final short VALIDATION_MASK = 0x0FFF;
+    final static int LENGTH = 2;
+
+    public static final VlanVid NO_MASK = VlanVid.of((short)0xFFFF);
+    public static final VlanVid FULL_MASK = VlanVid.of((short)0x0);
+
+    private final short vid;
+
+    private VlanVid(short vid) {
+        this.vid = vid;
+    }
+
+    public static VlanVid of(short vid) {
+        if ((vid & VALIDATION_MASK) != vid)
+            throw new IllegalArgumentException("Illegal VLAN VID value: " + vid);
+        return new VlanVid(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);
+    }
+
+    public short getValue() {
+        return vid;
+    }
+
+    @Override
+    public int getLength() {
+        return LENGTH;
+    }
+
+
+    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 bytesCache;
+    }
+
+    public void write2Bytes(ChannelBuffer c) {
+        c.writeShort(this.vid);
+    }
+
+    public static VlanVid read2Bytes(ChannelBuffer c) throws OFParseError {
+        return VlanVid.of(c.readShort());
+    }
+
+    @Override
+    public VlanVid applyMask(VlanVid mask) {
+        return VlanVid.of((short)(this.vid & mask.vid));
+    }
+
+}