Merge into master from pull request #41:
add explicit inheritance to loxi input files (https://github.com/floodlight/loxigen/pull/41)
diff --git a/c_gen/c_test_gen.py b/c_gen/c_test_gen.py
index 9910b7f..14ab24e 100644
--- a/c_gen/c_test_gen.py
+++ b/c_gen/c_test_gen.py
@@ -745,6 +745,7 @@
 """ % dict(cls=cls, base_type=base_type))
 
     sub_classes =  type_maps.sub_class_map(base_type, version)
+    sub_classes = [(instance, subcls) for (instance, subcls) in sub_classes if not type_maps.class_is_virtual(subcls)]
     v_name = loxi_utils.version_to_name(version)
 
     if len(sub_classes) == 0:
@@ -792,6 +793,7 @@
 """ % dict(cls=cls, base_type=base_type))
 
     sub_classes =  type_maps.sub_class_map(base_type, version)
+    sub_classes = [(instance, subcls) for (instance, subcls) in sub_classes if not type_maps.class_is_virtual(subcls)]
     v_name = loxi_utils.version_to_name(version)
 
     if len(sub_classes) == 0:
@@ -1083,6 +1085,8 @@
         for cls in of_g.ordered_messages:
             if not (cls, version) in of_g.base_length:
                 continue
+            if type_maps.class_is_virtual(cls):
+                continue
             bytes = of_g.base_length[(cls, version)] + of_g.extra_length.get((cls, version), 0)
             out.write("""
 static int
@@ -1136,6 +1140,8 @@
         for cls in of_g.ordered_messages:
             if not (cls, version) in of_g.base_length:
                 continue
+            if type_maps.class_is_virtual(cls):
+                continue
             test_name = "%s_create_%s" % (cls, loxi_utils.version_to_name(version))
             out.write("    RUN_TEST(%s);\n" % test_name)
 
@@ -1166,6 +1172,7 @@
 """ % dict(cls=cls, base_type=base_type))
 
     sub_classes =  type_maps.sub_class_map(base_type, version)
+    sub_classes = [(instance, subcls) for (instance, subcls) in sub_classes if not type_maps.class_is_virtual(subcls)]
     v_name = loxi_utils.version_to_name(version)
 
     if len(sub_classes) == 0:
@@ -1224,6 +1231,7 @@
 
 
     sub_classes =  type_maps.sub_class_map(base_type, version)
+    sub_classes = [(instance, subcls) for (instance, subcls) in sub_classes if not type_maps.class_is_virtual(subcls)]
     v_name = loxi_utils.version_to_name(version)
 
     if len(sub_classes) == 0:
diff --git a/c_gen/templates/locitest/test_validator.c b/c_gen/templates/locitest/test_validator.c
index d7947b9..6b9dd87 100644
--- a/c_gen/templates/locitest/test_validator.c
+++ b/c_gen/templates/locitest/test_validator.c
@@ -117,7 +117,7 @@
 ::        for cls in reversed(of_g.standard_class_order):
 ::            if not loxi_utils.class_in_version(cls, version):
 ::                continue
-::            elif cls in type_maps.inheritance_map:
+::            elif type_maps.class_is_virtual(cls):
 ::                continue
 ::            elif not loxi_utils.class_is_message(cls):
 ::                continue
diff --git a/loxi_front_end/frontend.py b/loxi_front_end/frontend.py
index ab98c26..d25c2eb 100644
--- a/loxi_front_end/frontend.py
+++ b/loxi_front_end/frontend.py
@@ -60,8 +60,8 @@
 
     for decl_ast in ast:
         if decl_ast[0] == 'struct':
-            members = [create_member(m_ast) for m_ast in decl_ast[2]]
-            ofclass = OFClass(name=decl_ast[1], members=members)
+            members = [create_member(m_ast) for m_ast in decl_ast[3]]
+            ofclass = OFClass(name=decl_ast[1], superclass=decl_ast[2], members=members)
             ofinput.classes.append(ofclass)
         if decl_ast[0] == 'enum':
             enum = OFEnum(name=decl_ast[1], values=[(x[0], x[1]) for x in decl_ast[2]])
diff --git a/loxi_front_end/parser.py b/loxi_front_end/parser.py
index 503a05a..7893008 100644
--- a/loxi_front_end/parser.py
+++ b/loxi_front_end/parser.py
@@ -54,7 +54,8 @@
 type_member = P.Group(tag('type') + any_type + identifier + s('==') + integer)
 data_member = P.Group(tag('data') + any_type - identifier)
 struct_member = pad_member | type_member | data_member;
-struct = kw('struct') - identifier - s('{') + \
+parent = (s(':') - identifier) | tag(None)
+struct = kw('struct') - identifier - parent - s('{') + \
          P.Group(P.ZeroOrMore(struct_member - s(';'))) + \
          s('}') - s(';')
 
diff --git a/loxi_front_end/type_maps.py b/loxi_front_end/type_maps.py
index f9a66f6..b64f1b5 100644
--- a/loxi_front_end/type_maps.py
+++ b/loxi_front_end/type_maps.py
@@ -154,6 +154,9 @@
         return True
     if loxi_utils.class_is_list(cls):
         return True
+    # TODO get this from the input file when we have virtual class syntax
+    if cls in ["of_flow_mod", "of_stats_request", "of_stats_reply", "of_bsn_header", "of_nicira_header", "of_action_bsn", "of_action_nicira", "of_action_id_bsn", "of_action_id_nicira"]:
+        return True
     return False
 
 ################################################################
diff --git a/loxi_ir.py b/loxi_ir.py
index 9a27272..824524b 100644
--- a/loxi_ir.py
+++ b/loxi_ir.py
@@ -72,7 +72,7 @@
 @param name
 @param members List of *Member objects
 """
-OFClass = namedtuple('OFClass', ['name', 'members'])
+OFClass = namedtuple('OFClass', ['name', 'superclass', 'members'])
 
 """
 Normal field
diff --git a/loxi_utils/loxi_utils.py b/loxi_utils/loxi_utils.py
index 648e109..f5f9b63 100644
--- a/loxi_utils/loxi_utils.py
+++ b/loxi_utils/loxi_utils.py
@@ -417,7 +417,7 @@
 # Is class a flow modify of some sort?
 
 def cls_is_flow_mod(cls):
-    return cls in ["of_flow_modify", "of_flow_add", "of_flow_delete",
+    return cls in ["of_flow_mod", "of_flow_modify", "of_flow_add", "of_flow_delete",
                    "of_flow_modify_strict", "of_flow_delete_strict"]
 
 
diff --git a/loxigen.py b/loxigen.py
index 36d6872..9bddf4b 100755
--- a/loxigen.py
+++ b/loxigen.py
@@ -359,10 +359,6 @@
         else:
             of_g.ordered_non_messages.append(cls)
 
-    of_g.ordered_pseudo_objects.append("of_stats_request")
-    of_g.ordered_pseudo_objects.append("of_stats_reply")
-    of_g.ordered_pseudo_objects.append("of_flow_mod")
-
     of_g.ordered_messages.sort()
     of_g.ordered_pseudo_objects.sort()
     of_g.ordered_non_messages.sort()
@@ -481,7 +477,7 @@
     def find_experimenter(parent, cls):
         for experimenter in sorted(of_g.experimenter_name_to_id.keys(), reverse=True):
             prefix = parent + '_' + experimenter
-            if cls.startswith(prefix):
+            if cls.startswith(prefix) and cls != prefix:
                 return experimenter
         return None
 
@@ -520,7 +516,7 @@
             # HACK (though this is what loxi_utils.class_is_message() does)
             if not [x for x in ofclass.members if isinstance(x, OFDataMember) and x.name == 'xid']:
                 continue
-            if cls == 'of_header':
+            if type_maps.class_is_virtual(cls):
                 continue
             subcls = cls[3:]
             val = find_type_value(ofclass, 'type')
diff --git a/openflow_input/bsn b/openflow_input/bsn
new file mode 100644
index 0000000..16f3323
--- /dev/null
+++ b/openflow_input/bsn
@@ -0,0 +1,48 @@
+// Copyright 2013, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+// the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may distribute libraries
+// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+// that copyright and licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i) included in
+// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+// documentation for the LoxiGen Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
+// a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// 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
+// EPL for the specific language governing permissions and limitations
+// under the EPL.
+
+#version any
+
+// BSN extension message
+struct of_bsn_header : of_experimenter {
+    uint8_t version;
+    uint8_t type == 4;
+    uint16_t length;
+    uint32_t xid;
+    uint32_t experimenter == 0x5c16c7;
+    uint32_t subtype;
+};
+
+// BSN extension action
+struct of_action_bsn : of_action_experimenter {
+    uint16_t type == 65535;
+    uint16_t len;
+    uint32_t experimenter == 0x5c16c7;
+    uint32_t subtype;
+    pad(4);
+};
+
diff --git a/openflow_input/bsn_bw b/openflow_input/bsn_bw
index e0ff3e3..50c9267 100644
--- a/openflow_input/bsn_bw
+++ b/openflow_input/bsn_bw
@@ -30,7 +30,7 @@
 
 #version any
 
-struct of_bsn_bw_enable_set_request {
+struct of_bsn_bw_enable_set_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -40,7 +40,7 @@
     uint32_t enable;        // 0 to disable the extension, 1 to enable it
 };
 
-struct of_bsn_bw_enable_set_reply {
+struct of_bsn_bw_enable_set_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -51,7 +51,7 @@
     uint32_t status;        // Result code: 0 success
 };
 
-struct of_bsn_bw_enable_get_request {
+struct of_bsn_bw_enable_get_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -60,7 +60,7 @@
     uint32_t subtype == 19;
 };
 
-struct of_bsn_bw_enable_get_reply {
+struct of_bsn_bw_enable_get_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -70,7 +70,7 @@
     uint32_t enabled;       // 0 if feature is disabled; 1 if feature enabled
 };
 
-struct of_bsn_bw_clear_data_request {
+struct of_bsn_bw_clear_data_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -79,7 +79,7 @@
     uint32_t subtype == 21;
 };
 
-struct of_bsn_bw_clear_data_reply {
+struct of_bsn_bw_clear_data_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_get_interfaces b/openflow_input/bsn_get_interfaces
index 01902bc..6f316b0 100644
--- a/openflow_input/bsn_get_interfaces
+++ b/openflow_input/bsn_get_interfaces
@@ -27,7 +27,7 @@
 
 #version any
 
-struct of_bsn_get_interfaces_request {
+struct of_bsn_get_interfaces_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -44,7 +44,7 @@
     of_ipv4_t ipv4_netmask;
 };
 
-struct of_bsn_get_interfaces_reply {
+struct of_bsn_get_interfaces_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_ip_mask b/openflow_input/bsn_ip_mask
index b6d517b..615ed40 100644
--- a/openflow_input/bsn_ip_mask
+++ b/openflow_input/bsn_ip_mask
@@ -27,7 +27,7 @@
 
 #version 1
 
-struct of_bsn_set_ip_mask {
+struct of_bsn_set_ip_mask : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -39,7 +39,7 @@
     uint32_t mask;
 };
 
-struct of_bsn_get_ip_mask_request {
+struct of_bsn_get_ip_mask_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -50,7 +50,7 @@
     pad(7);
 };
 
-struct of_bsn_get_ip_mask_reply {
+struct of_bsn_get_ip_mask_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_l2_table b/openflow_input/bsn_l2_table
index 8075d7f..725c805 100644
--- a/openflow_input/bsn_l2_table
+++ b/openflow_input/bsn_l2_table
@@ -28,7 +28,7 @@
 #version 1
 
 // BSN L2 table configuration messages
-struct of_bsn_set_l2_table_request {
+struct of_bsn_set_l2_table_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -41,7 +41,7 @@
     pad(4);
 };
 
-struct of_bsn_set_l2_table_reply {
+struct of_bsn_set_l2_table_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -54,7 +54,7 @@
     uint32_t status; // 0 means success
 };
 
-struct of_bsn_get_l2_table_request {
+struct of_bsn_get_l2_table_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -63,7 +63,7 @@
     uint32_t subtype == 13;
 };
 
-struct of_bsn_get_l2_table_reply {
+struct of_bsn_get_l2_table_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_mirror b/openflow_input/bsn_mirror
index cc9e4c3..e2f473f 100644
--- a/openflow_input/bsn_mirror
+++ b/openflow_input/bsn_mirror
@@ -28,7 +28,7 @@
 #version any
 
 // BSN mirror action
-struct of_action_bsn_mirror {
+struct of_action_bsn_mirror : of_action_bsn {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter == 0x5c16c7;
@@ -40,7 +40,7 @@
 };
 
 // BSN mirroring messages
-struct of_bsn_set_mirroring {
+struct of_bsn_set_mirroring : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -51,7 +51,7 @@
     pad(3);
 };
 
-struct of_bsn_get_mirroring_request {
+struct of_bsn_get_mirroring_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -62,7 +62,7 @@
     pad(3);
 };
 
-struct of_bsn_get_mirroring_reply {
+struct of_bsn_get_mirroring_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_pktin_suppression b/openflow_input/bsn_pktin_suppression
index 281d6d4..ab4c2fd 100644
--- a/openflow_input/bsn_pktin_suppression
+++ b/openflow_input/bsn_pktin_suppression
@@ -55,7 +55,7 @@
 // The switch should reject the message if both 'hard_timeout' and 'idle_timeout'
 // are zero, since the suppression flows would never expire.
 
-struct of_bsn_set_pktin_suppression_request {
+struct of_bsn_set_pktin_suppression_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -70,7 +70,7 @@
     uint64_t cookie;
 };
 
-struct of_bsn_set_pktin_suppression_reply {
+struct of_bsn_set_pktin_suppression_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_set_tunnel_dst b/openflow_input/bsn_set_tunnel_dst
index 74757f6..b9be58f 100644
--- a/openflow_input/bsn_set_tunnel_dst
+++ b/openflow_input/bsn_set_tunnel_dst
@@ -28,7 +28,7 @@
 #version any
 
 // BSN set tunnel destination IP action
-struct of_action_bsn_set_tunnel_dst {
+struct of_action_bsn_set_tunnel_dst : of_action_bsn {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter == 0x5c16c7;
diff --git a/openflow_input/bsn_shell b/openflow_input/bsn_shell
index 805b7e9..d9c2dc7 100644
--- a/openflow_input/bsn_shell
+++ b/openflow_input/bsn_shell
@@ -27,7 +27,7 @@
 
 #version 1
 
-struct of_bsn_shell_command {
+struct of_bsn_shell_command : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -38,7 +38,7 @@
     of_octets_t data;
 };
 
-struct of_bsn_shell_output {
+struct of_bsn_shell_output : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -48,7 +48,7 @@
     of_octets_t data;
 };
 
-struct of_bsn_shell_status {
+struct of_bsn_shell_status : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/bsn_table_mod b/openflow_input/bsn_table_mod
index cc5e723..5846c53 100644
--- a/openflow_input/bsn_table_mod
+++ b/openflow_input/bsn_table_mod
@@ -29,7 +29,7 @@
 
 // This is the 1.1+ table mod message which we back port to 1.0
 // for use inside components
-struct of_table_mod {
+struct of_table_mod : of_header {
     uint8_t version;
     uint8_t type == 22;
     uint16_t length;
diff --git a/openflow_input/bsn_vport b/openflow_input/bsn_vport
index 0cf30bf..4da4638 100644
--- a/openflow_input/bsn_vport
+++ b/openflow_input/bsn_vport
@@ -53,7 +53,7 @@
 
 // Q-in-Q virtual port specification
 
-struct of_bsn_vport_q_in_q {
+struct of_bsn_vport_q_in_q : of_bsn_vport {
     uint16_t type == 0;
     uint16_t length;  /* 16 */
     uint32_t port_no;     /* OF port number of parent; usually phys port */
@@ -64,7 +64,7 @@
 };
 
 // Request from controller to switch to create vport
-struct of_bsn_virtual_port_create_request {
+struct of_bsn_virtual_port_create_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -78,7 +78,7 @@
 
 // Reply from switch to controller indicating port number created
 // vport_no must be 16 bits to be compatible with 1.0
-struct of_bsn_virtual_port_create_reply {
+struct of_bsn_virtual_port_create_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -90,7 +90,7 @@
 };
 
 // Request from controller to switch to remove a vport
-struct of_bsn_virtual_port_remove_request {
+struct of_bsn_virtual_port_remove_request : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -101,7 +101,7 @@
 };
 
 // Request from controller to switch to remove a vport
-struct of_bsn_virtual_port_remove_reply {
+struct of_bsn_virtual_port_remove_reply : of_bsn_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/nicira b/openflow_input/nicira
new file mode 100644
index 0000000..f76be27
--- /dev/null
+++ b/openflow_input/nicira
@@ -0,0 +1,49 @@
+// Copyright 2013, Big Switch Networks, Inc.
+//
+// LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
+// the following special exception:
+//
+// LOXI Exception
+//
+// As a special exception to the terms of the EPL, you may distribute libraries
+// generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
+// that copyright and licensing notices generated by LoxiGen are not altered or removed
+// from the LoxiGen Libraries and the notice provided below is (i) included in
+// the LoxiGen Libraries, if distributed in source code form and (ii) included in any
+// documentation for the LoxiGen Libraries, if distributed in binary form.
+//
+// Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
+//
+// You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
+// a copy of the EPL at:
+//
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// 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
+// EPL for the specific language governing permissions and limitations
+// under the EPL.
+
+#version any
+
+// Nicira extension message
+struct of_nicira_header : of_experimenter {
+    uint8_t version;
+    uint8_t type == 4;
+    uint16_t length;
+    uint32_t xid;
+    uint32_t experimenter == 0x2320;
+    uint32_t subtype;
+};
+
+// Nicira extension action
+struct of_action_nicira: of_action_experimenter {
+    uint16_t type == 65535;
+    uint16_t len;
+    uint32_t experimenter == 0x2320;
+    uint16_t subtype;
+    pad(2);
+    pad(4);
+};
+
diff --git a/openflow_input/nicira_dec_ttl b/openflow_input/nicira_dec_ttl
index 77649af..3b95366 100644
--- a/openflow_input/nicira_dec_ttl
+++ b/openflow_input/nicira_dec_ttl
@@ -27,7 +27,7 @@
 
 #version any
 
-struct of_action_nicira_dec_ttl {
+struct of_action_nicira_dec_ttl : of_action_nicira {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter == 0x2320;
diff --git a/openflow_input/nicira_role b/openflow_input/nicira_role
index 5747d45..1ed0b3d 100644
--- a/openflow_input/nicira_role
+++ b/openflow_input/nicira_role
@@ -33,7 +33,7 @@
    NX_ROLE_SLAVE = 2,
 };
 
-struct of_nicira_controller_role_request {
+struct of_nicira_controller_role_request : of_nicira_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -43,7 +43,7 @@
     uint32_t role;         // 0 other, 1 master, 2 slave
 };
 
-struct of_nicira_controller_role_reply {
+struct of_nicira_controller_role_reply : of_nicira_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
diff --git a/openflow_input/oxm-1.2 b/openflow_input/oxm-1.2
index 01af6c6..e75d218 100644
--- a/openflow_input/oxm-1.2
+++ b/openflow_input/oxm-1.2
@@ -32,403 +32,401 @@
 #version 3
 #version 4
 
-/* TODO fix the C backend to not require this */
 struct of_oxm {
     uint32_t type_len;
 };
 
-
-struct of_oxm_arp_op {
+struct of_oxm_arp_op : of_oxm {
     uint32_t type_len == 0x80002a02;
     uint16_t value;
 };
 
-struct of_oxm_arp_op_masked {
+struct of_oxm_arp_op_masked : of_oxm {
     uint32_t type_len == 0x80002b04;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_arp_sha {
+struct of_oxm_arp_sha : of_oxm {
     uint32_t type_len == 0x80003006;
     of_mac_addr_t value;
 };
 
-struct of_oxm_arp_sha_masked {
+struct of_oxm_arp_sha_masked : of_oxm {
     uint32_t type_len == 0x8000310c;
     of_mac_addr_t value;
     of_mac_addr_t value_mask;
 };
 
-struct of_oxm_arp_spa {
+struct of_oxm_arp_spa : of_oxm {
     uint32_t type_len == 0x80002c04;
     uint32_t value;
 };
 
-struct of_oxm_arp_spa_masked {
+struct of_oxm_arp_spa_masked : of_oxm {
     uint32_t type_len == 0x80002d08;
     uint32_t value;
     uint32_t value_mask;
 };
 
-struct of_oxm_arp_tha {
+struct of_oxm_arp_tha : of_oxm {
     uint32_t type_len == 0x80003206;
     of_mac_addr_t value;
 };
 
-struct of_oxm_arp_tha_masked {
+struct of_oxm_arp_tha_masked : of_oxm {
     uint32_t type_len == 0x8000330c;
     of_mac_addr_t value;
     of_mac_addr_t value_mask;
 };
 
-struct of_oxm_arp_tpa {
+struct of_oxm_arp_tpa : of_oxm {
     uint32_t type_len == 0x80002e04;
     uint32_t value;
 };
 
-struct of_oxm_arp_tpa_masked {
+struct of_oxm_arp_tpa_masked : of_oxm {
     uint32_t type_len == 0x80002f08;
     uint32_t value;
     uint32_t value_mask;
 };
 
-struct of_oxm_eth_dst {
+struct of_oxm_eth_dst : of_oxm {
     uint32_t type_len == 0x80000606;
     of_mac_addr_t value;
 };
 
-struct of_oxm_eth_dst_masked {
+struct of_oxm_eth_dst_masked : of_oxm {
     uint32_t type_len == 0x8000070c;
     of_mac_addr_t value;
     of_mac_addr_t value_mask;
 };
 
-struct of_oxm_eth_src {
+struct of_oxm_eth_src : of_oxm {
     uint32_t type_len == 0x80000806;
     of_mac_addr_t value;
 };
 
-struct of_oxm_eth_src_masked {
+struct of_oxm_eth_src_masked : of_oxm {
     uint32_t type_len == 0x8000090c;
     of_mac_addr_t value;
     of_mac_addr_t value_mask;
 };
 
-struct of_oxm_eth_type {
+struct of_oxm_eth_type : of_oxm {
     uint32_t type_len == 0x80000a02;
     uint16_t value;
 };
 
-struct of_oxm_eth_type_masked {
+struct of_oxm_eth_type_masked : of_oxm {
     uint32_t type_len == 0x80000b04;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_icmpv4_code {
+struct of_oxm_icmpv4_code : of_oxm {
     uint32_t type_len == 0x80002801;
     uint8_t value;
 };
 
-struct of_oxm_icmpv4_code_masked {
+struct of_oxm_icmpv4_code_masked : of_oxm {
     uint32_t type_len == 0x80002902;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_icmpv4_type {
+struct of_oxm_icmpv4_type : of_oxm {
     uint32_t type_len == 0x80002601;
     uint8_t value;
 };
 
-struct of_oxm_icmpv4_type_masked {
+struct of_oxm_icmpv4_type_masked : of_oxm {
     uint32_t type_len == 0x80002702;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_icmpv6_code {
+struct of_oxm_icmpv6_code : of_oxm {
     uint32_t type_len == 0x80003c01;
     uint8_t value;
 };
 
-struct of_oxm_icmpv6_code_masked {
+struct of_oxm_icmpv6_code_masked : of_oxm {
     uint32_t type_len == 0x80003d02;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_icmpv6_type {
+struct of_oxm_icmpv6_type : of_oxm {
     uint32_t type_len == 0x80003a01;
     uint8_t value;
 };
 
-struct of_oxm_icmpv6_type_masked {
+struct of_oxm_icmpv6_type_masked : of_oxm {
     uint32_t type_len == 0x80003b02;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_in_phy_port {
+struct of_oxm_in_phy_port : of_oxm {
     uint32_t type_len == 0x80000204;
     of_port_no_t value;
 };
 
-struct of_oxm_in_phy_port_masked {
+struct of_oxm_in_phy_port_masked : of_oxm {
     uint32_t type_len == 0x80000308;
     of_port_no_t value;
     of_port_no_t value_mask;
 };
 
-struct of_oxm_in_port {
+struct of_oxm_in_port : of_oxm {
     uint32_t type_len == 0x80000004;
     of_port_no_t value;
 };
 
-struct of_oxm_in_port_masked {
+struct of_oxm_in_port_masked : of_oxm {
     uint32_t type_len == 0x80000108;
     of_port_no_t value;
     of_port_no_t value_mask;
 };
 
-struct of_oxm_ip_dscp {
+struct of_oxm_ip_dscp : of_oxm {
     uint32_t type_len == 0x80001001;
     uint8_t value;
 };
 
-struct of_oxm_ip_dscp_masked {
+struct of_oxm_ip_dscp_masked : of_oxm {
     uint32_t type_len == 0x80001102;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_ip_ecn {
+struct of_oxm_ip_ecn : of_oxm {
     uint32_t type_len == 0x80001201;
     uint8_t value;
 };
 
-struct of_oxm_ip_ecn_masked {
+struct of_oxm_ip_ecn_masked : of_oxm {
     uint32_t type_len == 0x80001302;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_ip_proto {
+struct of_oxm_ip_proto : of_oxm {
     uint32_t type_len == 0x80001401;
     uint8_t value;
 };
 
-struct of_oxm_ip_proto_masked {
+struct of_oxm_ip_proto_masked : of_oxm {
     uint32_t type_len == 0x80001502;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_ipv4_dst {
+struct of_oxm_ipv4_dst : of_oxm {
     uint32_t type_len == 0x80001804;
     of_ipv4_t value;
 };
 
-struct of_oxm_ipv4_dst_masked {
+struct of_oxm_ipv4_dst_masked : of_oxm {
     uint32_t type_len == 0x80001908;
     of_ipv4_t value;
     of_ipv4_t value_mask;
 };
 
-struct of_oxm_ipv4_src {
+struct of_oxm_ipv4_src : of_oxm {
     uint32_t type_len == 0x80001604;
     of_ipv4_t value;
 };
 
-struct of_oxm_ipv4_src_masked {
+struct of_oxm_ipv4_src_masked : of_oxm {
     uint32_t type_len == 0x80001708;
     of_ipv4_t value;
     of_ipv4_t value_mask;
 };
 
-struct of_oxm_ipv6_dst {
+struct of_oxm_ipv6_dst : of_oxm {
     uint32_t type_len == 0x80003610;
     of_ipv6_t value;
 };
 
-struct of_oxm_ipv6_dst_masked {
+struct of_oxm_ipv6_dst_masked : of_oxm {
     uint32_t type_len == 0x80003720;
     of_ipv6_t value;
     of_ipv6_t value_mask;
 };
 
-struct of_oxm_ipv6_flabel {
+struct of_oxm_ipv6_flabel : of_oxm {
     uint32_t type_len == 0x80003804;
     uint32_t value;
 };
 
-struct of_oxm_ipv6_flabel_masked {
+struct of_oxm_ipv6_flabel_masked : of_oxm {
     uint32_t type_len == 0x80003908;
     uint32_t value;
     uint32_t value_mask;
 };
 
-struct of_oxm_ipv6_nd_sll {
+struct of_oxm_ipv6_nd_sll : of_oxm {
     uint32_t type_len == 0x80004006;
     of_mac_addr_t value;
 };
 
-struct of_oxm_ipv6_nd_sll_masked {
+struct of_oxm_ipv6_nd_sll_masked : of_oxm {
     uint32_t type_len == 0x8000410c;
     of_mac_addr_t value;
     of_mac_addr_t value_mask;
 };
 
-struct of_oxm_ipv6_nd_target {
+struct of_oxm_ipv6_nd_target : of_oxm {
     uint32_t type_len == 0x80003e10;
     of_ipv6_t value;
 };
 
-struct of_oxm_ipv6_nd_target_masked {
+struct of_oxm_ipv6_nd_target_masked : of_oxm {
     uint32_t type_len == 0x80003f20;
     of_ipv6_t value;
     of_ipv6_t value_mask;
 };
 
-struct of_oxm_ipv6_nd_tll {
+struct of_oxm_ipv6_nd_tll : of_oxm {
     uint32_t type_len == 0x80004206;
     of_mac_addr_t value;
 };
 
-struct of_oxm_ipv6_nd_tll_masked {
+struct of_oxm_ipv6_nd_tll_masked : of_oxm {
     uint32_t type_len == 0x8000430c;
     of_mac_addr_t value;
     of_mac_addr_t value_mask;
 };
 
-struct of_oxm_ipv6_src {
+struct of_oxm_ipv6_src : of_oxm {
     uint32_t type_len == 0x80003410;
     of_ipv6_t value;
 };
 
-struct of_oxm_ipv6_src_masked {
+struct of_oxm_ipv6_src_masked : of_oxm {
     uint32_t type_len == 0x80003520;
     of_ipv6_t value;
     of_ipv6_t value_mask;
 };
 
-struct of_oxm_metadata {
+struct of_oxm_metadata : of_oxm {
     uint32_t type_len == 0x80000408;
     uint64_t value;
 };
 
-struct of_oxm_metadata_masked {
+struct of_oxm_metadata_masked : of_oxm {
     uint32_t type_len == 0x80000510;
     uint64_t value;
     uint64_t value_mask;
 };
 
-struct of_oxm_mpls_label {
+struct of_oxm_mpls_label : of_oxm {
     uint32_t type_len == 0x80004404;
     uint32_t value;
 };
 
-struct of_oxm_mpls_label_masked {
+struct of_oxm_mpls_label_masked : of_oxm {
     uint32_t type_len == 0x80004508;
     uint32_t value;
     uint32_t value_mask;
 };
 
-struct of_oxm_mpls_tc {
+struct of_oxm_mpls_tc : of_oxm {
     uint32_t type_len == 0x80004601;
     uint8_t value;
 };
 
-struct of_oxm_mpls_tc_masked {
+struct of_oxm_mpls_tc_masked : of_oxm {
     uint32_t type_len == 0x80004702;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_sctp_dst {
+struct of_oxm_sctp_dst : of_oxm {
     uint32_t type_len == 0x80002402;
     uint16_t value;
 };
 
-struct of_oxm_sctp_dst_masked {
+struct of_oxm_sctp_dst_masked : of_oxm {
     uint32_t type_len == 0x80002504;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_sctp_src {
+struct of_oxm_sctp_src : of_oxm {
     uint32_t type_len == 0x80002202;
     uint16_t value;
 };
 
-struct of_oxm_sctp_src_masked {
+struct of_oxm_sctp_src_masked : of_oxm {
     uint32_t type_len == 0x80002304;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_tcp_dst {
+struct of_oxm_tcp_dst : of_oxm {
     uint32_t type_len == 0x80001c02;
     uint16_t value;
 };
 
-struct of_oxm_tcp_dst_masked {
+struct of_oxm_tcp_dst_masked : of_oxm {
     uint32_t type_len == 0x80001d04;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_tcp_src {
+struct of_oxm_tcp_src : of_oxm {
     uint32_t type_len == 0x80001a02;
     uint16_t value;
 };
 
-struct of_oxm_tcp_src_masked {
+struct of_oxm_tcp_src_masked : of_oxm {
     uint32_t type_len == 0x80001b04;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_udp_dst {
+struct of_oxm_udp_dst : of_oxm {
     uint32_t type_len == 0x80002002;
     uint16_t value;
 };
 
-struct of_oxm_udp_dst_masked {
+struct of_oxm_udp_dst_masked : of_oxm {
     uint32_t type_len == 0x80002104;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_udp_src {
+struct of_oxm_udp_src : of_oxm {
     uint32_t type_len == 0x80001e02;
     uint16_t value;
 };
 
-struct of_oxm_udp_src_masked {
+struct of_oxm_udp_src_masked : of_oxm {
     uint32_t type_len == 0x80001f04;
     uint16_t value;
     uint16_t value_mask;
 };
 
-struct of_oxm_vlan_pcp {
+struct of_oxm_vlan_pcp : of_oxm {
     uint32_t type_len == 0x80000e01;
     uint8_t value;
 };
 
-struct of_oxm_vlan_pcp_masked {
+struct of_oxm_vlan_pcp_masked : of_oxm {
     uint32_t type_len == 0x80000f02;
     uint8_t value;
     uint8_t value_mask;
 };
 
-struct of_oxm_vlan_vid {
+struct of_oxm_vlan_vid : of_oxm {
     uint32_t type_len == 0x80000c02;
     uint16_t value;
 };
 
-struct of_oxm_vlan_vid_masked {
+struct of_oxm_vlan_vid_masked : of_oxm {
     uint32_t type_len == 0x80000d04;
     uint16_t value;
     uint16_t value_mask;
diff --git a/openflow_input/standard-1.0 b/openflow_input/standard-1.0
index e9cb6f0..64c60d5 100644
--- a/openflow_input/standard-1.0
+++ b/openflow_input/standard-1.0
@@ -296,6 +296,7 @@
     OFPQOFC_EPERM = 2,
 };
 
+/* XXX rename to of_message */
 struct of_header {
     uint8_t version;
     uint8_t type;
@@ -303,14 +304,14 @@
     uint32_t xid;
 };
 
-struct of_hello {
+struct of_hello : of_header {
     uint8_t version;
     uint8_t type == 0;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_echo_request {
+struct of_echo_request : of_header {
     uint8_t version;
     uint8_t type == 2;
     uint16_t length;
@@ -318,7 +319,7 @@
     of_octets_t data;
 };
 
-struct of_echo_reply {
+struct of_echo_reply : of_header {
     uint8_t version;
     uint8_t type == 3;
     uint16_t length;
@@ -326,7 +327,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter {
+struct of_experimenter : of_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -336,28 +337,28 @@
     of_octets_t data;
 };
 
-struct of_barrier_request {
+struct of_barrier_request : of_header {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_barrier_reply {
+struct of_barrier_reply : of_header {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_request {
+struct of_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 7;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_reply {
+struct of_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 8;
     uint16_t length;
@@ -366,7 +367,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_set_config {
+struct of_set_config : of_header {
     uint8_t version;
     uint8_t type == 9;
     uint16_t length;
@@ -387,14 +388,14 @@
     uint32_t peer;
 };
 
-struct of_features_request {
+struct of_features_request : of_header {
     uint8_t version;
     uint8_t type == 5;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_features_reply {
+struct of_features_reply : of_header {
     uint8_t version;
     uint8_t type == 6;
     uint16_t length;
@@ -408,7 +409,7 @@
     list(of_port_desc_t) ports;
 };
 
-struct of_port_status {
+struct of_port_status : of_header {
     uint8_t version;
     uint8_t type == 12;
     uint16_t length;
@@ -418,7 +419,7 @@
     of_port_desc_t desc;
 };
 
-struct of_port_mod {
+struct of_port_mod : of_header {
     uint8_t version;
     uint8_t type == 15;
     uint16_t length;
@@ -431,7 +432,7 @@
     pad(4);
 };
 
-struct of_packet_in {
+struct of_packet_in : of_header {
     uint8_t version;
     uint8_t type == 10;
     uint16_t length;
@@ -444,88 +445,88 @@
     of_octets_t data;
 };
 
-struct of_action_output {
+struct of_action_output : of_action {
     uint16_t type == 0;
     uint16_t len;
     of_port_no_t port;
     uint16_t max_len;
 };
 
-struct of_action_set_vlan_vid {
+struct of_action_set_vlan_vid : of_action {
     uint16_t type == 1;
     uint16_t len;
     uint16_t vlan_vid;
     pad(2);
 };
 
-struct of_action_strip_vlan {
+struct of_action_strip_vlan : of_action {
     uint16_t type == 3;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_set_vlan_pcp {
+struct of_action_set_vlan_pcp : of_action {
     uint16_t type == 2;
     uint16_t len;
     uint8_t vlan_pcp;
     pad(3);
 };
 
-struct of_action_set_dl_src {
+struct of_action_set_dl_src : of_action {
     uint16_t type == 4;
     uint16_t len;
     of_mac_addr_t dl_addr;
     pad(6);
 };
 
-struct of_action_set_dl_dst {
+struct of_action_set_dl_dst : of_action {
     uint16_t type == 5;
     uint16_t len;
     of_mac_addr_t dl_addr;
     pad(6);
 };
 
-struct of_action_set_nw_src {
+struct of_action_set_nw_src : of_action {
     uint16_t type == 6;
     uint16_t len;
     uint32_t nw_addr;
 };
 
-struct of_action_set_nw_dst {
+struct of_action_set_nw_dst : of_action {
     uint16_t type == 7;
     uint16_t len;
     uint32_t nw_addr;
 };
 
-struct of_action_set_tp_src {
+struct of_action_set_tp_src : of_action {
     uint16_t type == 9;
     uint16_t len;
     uint16_t tp_port;
     pad(2);
 };
 
-struct of_action_set_tp_dst {
+struct of_action_set_tp_dst : of_action {
     uint16_t type == 10;
     uint16_t len;
     uint16_t tp_port;
     pad(2);
 };
 
-struct of_action_set_nw_tos {
+struct of_action_set_nw_tos : of_action {
     uint16_t type == 8;
     uint16_t len;
     uint8_t nw_tos;
     pad(3);
 };
 
-struct of_action_experimenter {
+struct of_action_experimenter : of_action {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
     of_octets_t data;
 };
 
-struct of_action_enqueue {
+struct of_action_enqueue : of_action {
     uint16_t type == 11;
     uint16_t len;
     of_port_no_t port;
@@ -539,7 +540,7 @@
     pad(4);
 };
 
-struct of_packet_out {
+struct of_packet_out : of_header {
     uint8_t version;
     uint8_t type == 13;
     uint16_t length;
@@ -569,7 +570,24 @@
     uint16_t tcp_dst;
 };
 
-struct of_flow_add {
+struct of_flow_mod : of_header {
+    uint8_t version;
+    uint8_t type == 14;
+    uint16_t length;
+    uint32_t xid;
+    of_match_t match;
+    uint64_t cookie;
+    of_fm_cmd_t _command;
+    uint16_t idle_timeout;
+    uint16_t hard_timeout;
+    uint16_t priority;
+    uint32_t buffer_id;
+    of_port_no_t out_port;
+    uint16_t flags;
+    list(of_action_t) actions;
+};
+
+struct of_flow_add : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -586,7 +604,7 @@
     list(of_action_t) actions;
 };
 
-struct of_flow_modify {
+struct of_flow_modify : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -603,7 +621,7 @@
     list(of_action_t) actions;
 };
 
-struct of_flow_modify_strict {
+struct of_flow_modify_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -620,7 +638,7 @@
     list(of_action_t) actions;
 };
 
-struct of_flow_delete {
+struct of_flow_delete : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -637,7 +655,7 @@
     list(of_action_t) actions;
 };
 
-struct of_flow_delete_strict {
+struct of_flow_delete_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -654,7 +672,7 @@
     list(of_action_t) actions;
 };
 
-struct of_flow_removed {
+struct of_flow_removed : of_header {
     uint8_t version;
     uint8_t type == 11;
     uint16_t length;
@@ -672,7 +690,7 @@
     uint64_t byte_count;
 };
 
-struct of_error_msg {
+struct of_error_msg : of_header {
     uint8_t version;
     uint8_t type == 1;
     uint16_t length;
@@ -739,7 +757,25 @@
 
 // STATS request/reply:  Desc, flow, agg, table, port, queue
 
-struct of_desc_stats_request {
+struct of_stats_request : of_header {
+    uint8_t version;
+    uint8_t type == 16;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+};
+
+struct of_stats_reply : of_header {
+    uint8_t version;
+    uint8_t type == 17;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+};
+
+struct of_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -748,7 +784,7 @@
     uint16_t flags;
 };
 
-struct of_desc_stats_reply {
+struct of_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -762,7 +798,7 @@
     of_desc_str_t dp_desc;
 };
 
-struct of_flow_stats_request {
+struct of_flow_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -775,7 +811,7 @@
     of_port_no_t out_port;
 };
 
-struct of_flow_stats_reply {
+struct of_flow_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -785,7 +821,7 @@
     list(of_flow_stats_entry_t) entries;
 };
 
-struct of_aggregate_stats_request {
+struct of_aggregate_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -798,7 +834,7 @@
     of_port_no_t out_port;
 };
 
-struct of_aggregate_stats_reply {
+struct of_aggregate_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -811,7 +847,7 @@
     pad(4);
 };
 
-struct of_table_stats_request {
+struct of_table_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -820,7 +856,7 @@
     uint16_t flags;
 };
 
-struct of_table_stats_reply {
+struct of_table_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -830,7 +866,7 @@
     list(of_table_stats_entry_t) entries;
 };
 
-struct of_port_stats_request {
+struct of_port_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -841,7 +877,7 @@
     pad(6);
 };
 
-struct of_port_stats_reply {
+struct of_port_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -851,7 +887,7 @@
     list(of_port_stats_entry_t) entries;
 };
 
-struct of_queue_stats_request {
+struct of_queue_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -863,7 +899,7 @@
     uint32_t queue_id;
 };
 
-struct of_queue_stats_reply {
+struct of_queue_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -873,7 +909,7 @@
     list(of_queue_stats_entry_t) entries;
 };
 
-struct of_experimenter_stats_request {
+struct of_experimenter_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -884,7 +920,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter_stats_reply {
+struct of_experimenter_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -903,7 +939,7 @@
     pad(4);
 };
 
-struct of_queue_prop_min_rate {
+struct of_queue_prop_min_rate : of_queue_prop {
     uint16_t type == 1;
     uint16_t len;
     pad(4);
@@ -918,7 +954,7 @@
     list(of_queue_prop_t) properties;
 };
 
-struct of_queue_get_config_request {
+struct of_queue_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 20;
     uint16_t length;
@@ -927,7 +963,7 @@
     pad(2);
 };
 
-struct of_queue_get_config_reply {
+struct of_queue_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 21;
     uint16_t length;
diff --git a/openflow_input/standard-1.1 b/openflow_input/standard-1.1
index 553e665..4366af8 100644
--- a/openflow_input/standard-1.1
+++ b/openflow_input/standard-1.1
@@ -407,6 +407,7 @@
     OFPQT_MIN_RATE = 1,
 };
 
+/* XXX rename to of_message */
 struct of_header {
     uint8_t version;
     uint8_t type;
@@ -414,14 +415,14 @@
     uint32_t xid;
 };
 
-struct of_hello {
+struct of_hello : of_header {
     uint8_t version;
     uint8_t type == 0;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_echo_request {
+struct of_echo_request : of_header {
     uint8_t version;
     uint8_t type == 2;
     uint16_t length;
@@ -429,7 +430,7 @@
     of_octets_t data;
 };
 
-struct of_echo_reply {
+struct of_echo_reply : of_header {
     uint8_t version;
     uint8_t type == 3;
     uint16_t length;
@@ -437,7 +438,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter {
+struct of_experimenter : of_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -447,28 +448,28 @@
     of_octets_t data;
 };
 
-struct of_barrier_request {
+struct of_barrier_request : of_header {
     uint8_t version;
     uint8_t type == 20;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_barrier_reply {
+struct of_barrier_reply : of_header {
     uint8_t version;
     uint8_t type == 21;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_request {
+struct of_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 7;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_reply {
+struct of_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 8;
     uint16_t length;
@@ -477,7 +478,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_set_config {
+struct of_set_config : of_header {
     uint8_t version;
     uint8_t type == 9;
     uint16_t length;
@@ -486,7 +487,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_table_mod {
+struct of_table_mod : of_header {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -512,14 +513,14 @@
     uint32_t max_speed;
 };
 
-struct of_features_request {
+struct of_features_request : of_header {
     uint8_t version;
     uint8_t type == 5;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_features_reply {
+struct of_features_reply : of_header {
     uint8_t version;
     uint8_t type == 6;
     uint16_t length;
@@ -533,7 +534,7 @@
     list(of_port_desc_t) ports;
 };
 
-struct of_port_status {
+struct of_port_status : of_header {
     uint8_t version;
     uint8_t type == 12;
     uint16_t length;
@@ -543,7 +544,7 @@
     of_port_desc_t desc;
 };
 
-struct of_port_mod {
+struct of_port_mod : of_header {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -558,7 +559,7 @@
     pad(4);
 };
 
-struct of_packet_in {
+struct of_packet_in : of_header {
     uint8_t version;
     uint8_t type == 10;
     uint16_t length;
@@ -572,7 +573,7 @@
     of_octets_t data;
 };
 
-struct of_action_output {
+struct of_action_output : of_action {
     uint16_t type == 0;
     uint16_t len;
     of_port_no_t port;
@@ -580,165 +581,165 @@
     pad(6);
 };
 
-struct of_action_set_vlan_vid {
+struct of_action_set_vlan_vid : of_action {
     uint16_t type == 1;
     uint16_t len;
     uint16_t vlan_vid;
     pad(2);
 };
 
-struct of_action_set_vlan_pcp {
+struct of_action_set_vlan_pcp : of_action {
     uint16_t type == 2;
     uint16_t len;
     uint8_t vlan_pcp;
     pad(3);
 };
 
-struct of_action_set_dl_src {
+struct of_action_set_dl_src : of_action {
     uint16_t type == 3;
     uint16_t len;
     of_mac_addr_t dl_addr;
     pad(6);
 };
 
-struct of_action_set_dl_dst {
+struct of_action_set_dl_dst : of_action {
     uint16_t type == 4;
     uint16_t len;
     of_mac_addr_t dl_addr;
     pad(6);
 };
 
-struct of_action_set_nw_src {
+struct of_action_set_nw_src : of_action {
     uint16_t type == 5;
     uint16_t len;
     uint32_t nw_addr;
 };
 
-struct of_action_set_nw_dst {
+struct of_action_set_nw_dst : of_action {
     uint16_t type == 6;
     uint16_t len;
     uint32_t nw_addr;
 };
 
-struct of_action_set_nw_tos {
+struct of_action_set_nw_tos : of_action {
     uint16_t type == 7;
     uint16_t len;
     uint8_t nw_tos;
     pad(3);
 };
 
-struct of_action_set_nw_ecn {
+struct of_action_set_nw_ecn : of_action {
     uint16_t type == 8;
     uint16_t len;
     uint8_t nw_ecn;
     pad(3);
 };
 
-struct of_action_set_tp_src {
+struct of_action_set_tp_src : of_action {
     uint16_t type == 9;
     uint16_t len;
     uint16_t tp_port;
     pad(2);
 };
 
-struct of_action_set_tp_dst {
+struct of_action_set_tp_dst : of_action {
     uint16_t type == 10;
     uint16_t len;
     uint16_t tp_port;
     pad(2);
 };
 
-struct of_action_copy_ttl_out {
+struct of_action_copy_ttl_out : of_action {
     uint16_t type == 11;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_copy_ttl_in {
+struct of_action_copy_ttl_in : of_action {
     uint16_t type == 12;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_set_mpls_label {
+struct of_action_set_mpls_label : of_action {
     uint16_t type == 13;
     uint16_t len;
     uint32_t mpls_label;
 };
 
-struct of_action_set_mpls_tc {
+struct of_action_set_mpls_tc : of_action {
     uint16_t type == 14;
     uint16_t len;
     uint8_t mpls_tc;
     pad(3);
 };
 
-struct of_action_set_mpls_ttl {
+struct of_action_set_mpls_ttl : of_action {
     uint16_t type == 15;
     uint16_t len;
     uint8_t mpls_ttl;
     pad(3);
 };
 
-struct of_action_dec_mpls_ttl {
+struct of_action_dec_mpls_ttl : of_action {
     uint16_t type == 16;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_vlan {
+struct of_action_push_vlan : of_action {
     uint16_t type == 17;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_pop_vlan {
+struct of_action_pop_vlan : of_action {
     uint16_t type == 18;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_mpls {
+struct of_action_push_mpls : of_action {
     uint16_t type == 19;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_pop_mpls {
+struct of_action_pop_mpls : of_action {
     uint16_t type == 20;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_set_queue {
+struct of_action_set_queue : of_action {
     uint16_t type == 21;
     uint16_t len;
     uint32_t queue_id;
 };
 
-struct of_action_group {
+struct of_action_group : of_action {
     uint16_t type == 22;
     uint16_t len;
     uint32_t group_id;
 };
 
-struct of_action_set_nw_ttl {
+struct of_action_set_nw_ttl : of_action {
     uint16_t type == 23;
     uint16_t len;
     uint8_t nw_ttl;
     pad(3);
 };
 
-struct of_action_dec_nw_ttl {
+struct of_action_dec_nw_ttl : of_action {
     uint16_t type == 24;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_experimenter {
+struct of_action_experimenter : of_action {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
@@ -751,7 +752,7 @@
     pad(4);
 };
 
-struct of_packet_out {
+struct of_packet_out : of_header {
     uint8_t version;
     uint8_t type == 13;
     uint16_t length;
@@ -798,14 +799,14 @@
     pad(4);
 };
 
-struct of_instruction_goto_table {
+struct of_instruction_goto_table : of_instruction {
     uint16_t type == 1;
     uint16_t len;
     uint8_t table_id;
     pad(3);
 };
 
-struct of_instruction_write_metadata {
+struct of_instruction_write_metadata : of_instruction {
     uint16_t type == 2;
     uint16_t len;
     pad(4);
@@ -813,34 +814,55 @@
     uint64_t metadata_mask;
 };
 
-struct of_instruction_write_actions {
+struct of_instruction_write_actions : of_instruction {
     uint16_t type == 3;
     uint16_t len;
     pad(4);
     list(of_action_t) actions;
 };
 
-struct of_instruction_apply_actions {
+struct of_instruction_apply_actions : of_instruction {
     uint16_t type == 4;
     uint16_t len;
     pad(4);
     list(of_action_t) actions;
 };
 
-struct of_instruction_clear_actions {
+struct of_instruction_clear_actions : of_instruction {
     uint16_t type == 5;
     uint16_t len;
     pad(4);
 };
 
-struct of_instruction_experimenter {
+struct of_instruction_experimenter : of_instruction {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
     of_octets_t data;
 };
 
-struct of_flow_add {
+struct of_flow_mod : of_header {
+    uint8_t version;
+    uint8_t type == 14;
+    uint16_t length;
+    uint32_t xid;
+    uint64_t cookie;
+    uint64_t cookie_mask;
+    uint8_t table_id;
+    of_fm_cmd_t _command;
+    uint16_t idle_timeout;
+    uint16_t hard_timeout;
+    uint16_t priority;
+    uint32_t buffer_id;
+    of_port_no_t out_port;
+    uint32_t out_group;
+    uint16_t flags;
+    pad(2);
+    of_match_t match;
+    list(of_instruction_t) instructions;
+};
+
+struct of_flow_add : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -861,7 +883,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_modify {
+struct of_flow_modify : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -882,7 +904,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_modify_strict {
+struct of_flow_modify_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -903,7 +925,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_delete {
+struct of_flow_delete : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -924,7 +946,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_delete_strict {
+struct of_flow_delete_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -954,7 +976,7 @@
     list(of_action_t) actions;
 };
 
-struct of_group_mod {
+struct of_group_mod : of_header {
     uint8_t version;
     uint8_t type == 15;
     uint16_t length;
@@ -966,7 +988,7 @@
     list(of_bucket_t) buckets;
 };
 
-struct of_flow_removed {
+struct of_flow_removed : of_header {
     uint8_t version;
     uint8_t type == 11;
     uint16_t length;
@@ -984,7 +1006,7 @@
     of_match_t match;
 };
 
-struct of_error_msg {
+struct of_error_msg : of_header {
     uint8_t version;
     uint8_t type == 1;
     uint16_t length;
@@ -1080,7 +1102,27 @@
 
 // STATS:  Desc, flow, agg, table, port, queue, group, group_desc, experi
 
-struct of_desc_stats_request {
+struct of_stats_request : of_header {
+    uint8_t version;
+    uint8_t type == 18;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+    pad(4);
+};
+
+struct of_stats_reply : of_header {
+    uint8_t version;
+    uint8_t type == 19;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+    pad(4);
+};
+
+struct of_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1090,7 +1132,7 @@
     pad(4);
 };
 
-struct of_desc_stats_reply {
+struct of_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1105,7 +1147,7 @@
     of_desc_str_t dp_desc;
 };
 
-struct of_flow_stats_request {
+struct of_flow_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1123,7 +1165,7 @@
     of_match_t match;
 };
 
-struct of_flow_stats_reply {
+struct of_flow_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1134,7 +1176,7 @@
     list(of_flow_stats_entry_t) entries;
 };
 
-struct of_aggregate_stats_request {
+struct of_aggregate_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1152,7 +1194,7 @@
     of_match_t match;
 };
 
-struct of_aggregate_stats_reply {
+struct of_aggregate_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1166,7 +1208,7 @@
     pad(4);
 };
 
-struct of_table_stats_request {
+struct of_table_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1176,7 +1218,7 @@
     pad(4);
 };
 
-struct of_table_stats_reply {
+struct of_table_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1187,7 +1229,7 @@
     list(of_table_stats_entry_t) entries;
 };
 
-struct of_port_stats_request {
+struct of_port_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1199,7 +1241,7 @@
     pad(4);
 };
 
-struct of_port_stats_reply {
+struct of_port_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1210,7 +1252,7 @@
     list(of_port_stats_entry_t) entries;
 };
 
-struct of_queue_stats_request {
+struct of_queue_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1222,7 +1264,7 @@
     uint32_t queue_id;
 };
 
-struct of_queue_stats_reply {
+struct of_queue_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1233,7 +1275,7 @@
     list(of_queue_stats_entry_t) entries;
 };
 
-struct of_group_stats_request {
+struct of_group_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1245,7 +1287,7 @@
     pad(4);
 };
 
-struct of_group_stats_reply {
+struct of_group_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1256,7 +1298,7 @@
     list(of_group_stats_entry_t) entries;
 };
 
-struct of_group_desc_stats_request {
+struct of_group_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1266,7 +1308,7 @@
     pad(4);
 };
 
-struct of_group_desc_stats_reply {
+struct of_group_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1277,7 +1319,7 @@
     list(of_group_desc_stats_entry_t) entries;
 };
 
-struct of_experimenter_stats_request {
+struct of_experimenter_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1290,7 +1332,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter_stats_reply {
+struct of_experimenter_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1311,7 +1353,7 @@
     pad(4);
 };
 
-struct of_queue_prop_min_rate {
+struct of_queue_prop_min_rate : of_queue_prop {
     uint16_t type == 1;
     uint16_t len;
     pad(4);
@@ -1326,7 +1368,7 @@
     list(of_queue_prop_t) properties;
 };
 
-struct of_queue_get_config_request {
+struct of_queue_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 22;
     uint16_t length;
@@ -1335,7 +1377,7 @@
     pad(4);
 };
 
-struct of_queue_get_config_reply {
+struct of_queue_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 23;
     uint16_t length;
diff --git a/openflow_input/standard-1.2 b/openflow_input/standard-1.2
index 8b4fa3f..b49c83f 100644
--- a/openflow_input/standard-1.2
+++ b/openflow_input/standard-1.2
@@ -447,6 +447,7 @@
     OFPCR_ROLE_SLAVE = 3,
 };
 
+/* XXX rename to of_message */
 struct of_header {
     uint8_t version;
     uint8_t type;
@@ -454,14 +455,14 @@
     uint32_t xid;
 };
 
-struct of_hello {
+struct of_hello : of_header {
     uint8_t version;
     uint8_t type == 0;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_echo_request {
+struct of_echo_request : of_header {
     uint8_t version;
     uint8_t type == 2;
     uint16_t length;
@@ -469,7 +470,7 @@
     of_octets_t data;
 };
 
-struct of_echo_reply {
+struct of_echo_reply : of_header {
     uint8_t version;
     uint8_t type == 3;
     uint16_t length;
@@ -477,7 +478,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter {
+struct of_experimenter : of_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -487,28 +488,28 @@
     of_octets_t data;
 };
 
-struct of_barrier_request {
+struct of_barrier_request : of_header {
     uint8_t version;
     uint8_t type == 20;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_barrier_reply {
+struct of_barrier_reply : of_header {
     uint8_t version;
     uint8_t type == 21;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_request {
+struct of_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 7;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_reply {
+struct of_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 8;
     uint16_t length;
@@ -517,7 +518,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_set_config {
+struct of_set_config : of_header {
     uint8_t version;
     uint8_t type == 9;
     uint16_t length;
@@ -526,7 +527,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_table_mod {
+struct of_table_mod : of_header {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -552,14 +553,14 @@
     uint32_t max_speed;
 };
 
-struct of_features_request {
+struct of_features_request : of_header {
     uint8_t version;
     uint8_t type == 5;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_features_reply {
+struct of_features_reply : of_header {
     uint8_t version;
     uint8_t type == 6;
     uint16_t length;
@@ -573,7 +574,7 @@
     list(of_port_desc_t) ports;
 };
 
-struct of_port_status {
+struct of_port_status : of_header {
     uint8_t version;
     uint8_t type == 12;
     uint16_t length;
@@ -583,7 +584,7 @@
     of_port_desc_t desc;
 };
 
-struct of_port_mod {
+struct of_port_mod : of_header {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -604,7 +605,7 @@
     list(of_oxm_t) oxm_list;
 };
 
-struct of_action_output {
+struct of_action_output : of_action {
     uint16_t type == 0;
     uint16_t len;
     of_port_no_t port;
@@ -612,90 +613,90 @@
     pad(6);
 };
 
-struct of_action_copy_ttl_out {
+struct of_action_copy_ttl_out : of_action {
     uint16_t type == 11;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_copy_ttl_in {
+struct of_action_copy_ttl_in : of_action {
     uint16_t type == 12;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_set_mpls_ttl {
+struct of_action_set_mpls_ttl : of_action {
     uint16_t type == 15;
     uint16_t len;
     uint8_t mpls_ttl;
     pad(3);
 };
 
-struct of_action_dec_mpls_ttl {
+struct of_action_dec_mpls_ttl : of_action {
     uint16_t type == 16;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_vlan {
+struct of_action_push_vlan : of_action {
     uint16_t type == 17;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_pop_vlan {
+struct of_action_pop_vlan : of_action {
     uint16_t type == 18;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_mpls {
+struct of_action_push_mpls : of_action {
     uint16_t type == 19;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_pop_mpls {
+struct of_action_pop_mpls : of_action {
     uint16_t type == 20;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_set_queue {
+struct of_action_set_queue : of_action {
     uint16_t type == 21;
     uint16_t len;
     uint32_t queue_id;
 };
 
-struct of_action_group {
+struct of_action_group : of_action {
     uint16_t type == 22;
     uint16_t len;
     uint32_t group_id;
 };
 
-struct of_action_set_nw_ttl {
+struct of_action_set_nw_ttl : of_action {
     uint16_t type == 23;
     uint16_t len;
     uint8_t nw_ttl;
     pad(3);
 };
 
-struct of_action_dec_nw_ttl {
+struct of_action_dec_nw_ttl : of_action {
     uint16_t type == 24;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_set_field {
+struct of_action_set_field : of_action {
     uint16_t type == 25;
     uint16_t len;
     of_oxm_t field;
 };
 
-struct of_action_experimenter {
+struct of_action_experimenter : of_action {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
@@ -714,14 +715,14 @@
     pad(4);
 };
 
-struct of_instruction_goto_table {
+struct of_instruction_goto_table : of_instruction {
     uint16_t type == 1;
     uint16_t len;
     uint8_t table_id;
     pad(3);
 };
 
-struct of_instruction_write_metadata {
+struct of_instruction_write_metadata : of_instruction {
     uint16_t type == 2;
     uint16_t len;
     pad(4);
@@ -729,34 +730,55 @@
     uint64_t metadata_mask;
 };
 
-struct of_instruction_write_actions {
+struct of_instruction_write_actions : of_instruction {
     uint16_t type == 3;
     uint16_t len;
     pad(4);
     list(of_action_t) actions;
 };
 
-struct of_instruction_apply_actions {
+struct of_instruction_apply_actions : of_instruction {
     uint16_t type == 4;
     uint16_t len;
     pad(4);
     list(of_action_t) actions;
 };
 
-struct of_instruction_clear_actions {
+struct of_instruction_clear_actions : of_instruction {
     uint16_t type == 5;
     uint16_t len;
     pad(4);
 };
 
-struct of_instruction_experimenter {
+struct of_instruction_experimenter : of_instruction {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
     of_octets_t data;
 };
 
-struct of_flow_add {
+struct of_flow_mod : of_header {
+    uint8_t version;
+    uint8_t type == 14;
+    uint16_t length;
+    uint32_t xid;
+    uint64_t cookie;
+    uint64_t cookie_mask;
+    uint8_t table_id;
+    of_fm_cmd_t _command;
+    uint16_t idle_timeout;
+    uint16_t hard_timeout;
+    uint16_t priority;
+    uint32_t buffer_id;
+    of_port_no_t out_port;
+    uint32_t out_group;
+    uint16_t flags;
+    pad(2);
+    of_match_t match;
+    list(of_instruction_t) instructions;
+};
+
+struct of_flow_add : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -777,7 +799,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_modify {
+struct of_flow_modify : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -798,7 +820,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_modify_strict {
+struct of_flow_modify_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -819,7 +841,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_delete {
+struct of_flow_delete : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -840,7 +862,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_delete_strict {
+struct of_flow_delete_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -870,7 +892,7 @@
     list(of_action_t) actions;
 };
 
-struct of_group_mod {
+struct of_group_mod : of_header {
     uint8_t version;
     uint8_t type == 15;
     uint16_t length;
@@ -882,7 +904,7 @@
     list(of_bucket_t) buckets;
 };
 
-struct of_packet_out {
+struct of_packet_out : of_header {
     uint8_t version;
     uint8_t type == 13;
     uint16_t length;
@@ -895,7 +917,7 @@
     of_octets_t data;
 };
 
-struct of_packet_in {
+struct of_packet_in : of_header {
     uint8_t version;
     uint8_t type == 10;
     uint16_t length;
@@ -909,7 +931,7 @@
     of_octets_t data; /* FIXME: Ensure total_len gets updated */
 };
 
-struct of_flow_removed {
+struct of_flow_removed : of_header {
     uint8_t version;
     uint8_t type == 11;
     uint16_t length;
@@ -927,7 +949,7 @@
     of_match_t match;
 };
 
-struct of_error_msg {
+struct of_error_msg : of_header {
     uint8_t version;
     uint8_t type == 1;
     uint16_t length;
@@ -1040,7 +1062,27 @@
 // STATS: 
 //  Desc, flow, agg, table, port, queue, group, group_desc, group_feat, experi
 
-struct of_desc_stats_request {
+struct of_stats_request : of_header {
+    uint8_t version;
+    uint8_t type == 18;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+    pad(4);
+};
+
+struct of_stats_reply : of_header {
+    uint8_t version;
+    uint8_t type == 19;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+    pad(4);
+};
+
+struct of_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1050,7 +1092,7 @@
     pad(4);
 };
 
-struct of_desc_stats_reply {
+struct of_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1065,7 +1107,7 @@
     of_desc_str_t dp_desc;
 };
 
-struct of_flow_stats_request {
+struct of_flow_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1083,7 +1125,7 @@
     of_match_t match;
 };
 
-struct of_flow_stats_reply {
+struct of_flow_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1094,7 +1136,7 @@
     list(of_flow_stats_entry_t) entries;
 };
 
-struct of_aggregate_stats_request {
+struct of_aggregate_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1112,7 +1154,7 @@
     of_match_t match;
 };
 
-struct of_aggregate_stats_reply {
+struct of_aggregate_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1126,7 +1168,7 @@
     pad(4);
 };
 
-struct of_table_stats_request {
+struct of_table_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1136,7 +1178,7 @@
     pad(4);
 };
 
-struct of_table_stats_reply {
+struct of_table_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1147,7 +1189,7 @@
     list(of_table_stats_entry_t) entries;
 };
 
-struct of_port_stats_request {
+struct of_port_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1159,7 +1201,7 @@
     pad(4);
 };
 
-struct of_port_stats_reply {
+struct of_port_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1170,7 +1212,7 @@
     list(of_port_stats_entry_t) entries;
 };
 
-struct of_queue_stats_request {
+struct of_queue_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1182,7 +1224,7 @@
     uint32_t queue_id;
 };
 
-struct of_queue_stats_reply {
+struct of_queue_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1193,7 +1235,7 @@
     list(of_queue_stats_entry_t) entries;
 };
 
-struct of_group_stats_request {
+struct of_group_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1205,7 +1247,7 @@
     pad(4);
 };
 
-struct of_group_stats_reply {
+struct of_group_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1216,7 +1258,7 @@
     list(of_group_stats_entry_t) entries;
 };
 
-struct of_group_desc_stats_request {
+struct of_group_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1226,7 +1268,7 @@
     pad(4);
 };
 
-struct of_group_desc_stats_reply {
+struct of_group_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1237,7 +1279,7 @@
     list(of_group_desc_stats_entry_t) entries;
 };
 
-struct of_group_features_stats_request {
+struct of_group_features_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1247,7 +1289,7 @@
     pad(4);
 };
 
-struct of_group_features_stats_reply {
+struct of_group_features_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1267,7 +1309,7 @@
     uint32_t actions_ff;
 };
 
-struct of_experimenter_stats_request {
+struct of_experimenter_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1280,7 +1322,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter_stats_reply {
+struct of_experimenter_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1301,7 +1343,7 @@
     pad(4);
 };
 
-struct of_queue_prop_min_rate {
+struct of_queue_prop_min_rate : of_queue_prop {
     uint16_t type == 1;
     uint16_t len;
     pad(4);
@@ -1309,7 +1351,7 @@
     pad(6);
 };
 
-struct of_queue_prop_max_rate {
+struct of_queue_prop_max_rate : of_queue_prop {
     uint16_t type == 2;
     uint16_t len;
     pad(4);
@@ -1317,7 +1359,7 @@
     pad(6);
 };
 
-struct of_queue_prop_experimenter {
+struct of_queue_prop_experimenter : of_queue_prop {
     uint16_t type == 65535;
     uint16_t len;
     pad(4);
@@ -1334,7 +1376,7 @@
     list(of_queue_prop_t) properties;
 };
 
-struct of_queue_get_config_request {
+struct of_queue_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 22;
     uint16_t length;
@@ -1343,7 +1385,7 @@
     pad(4);
 };
 
-struct of_queue_get_config_reply {
+struct of_queue_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 23;
     uint16_t length;
@@ -1353,7 +1395,7 @@
     list(of_packet_queue_t) queues;
 };
 
-struct of_role_request {
+struct of_role_request : of_header {
     uint8_t version;
     uint8_t type == 24;
     uint16_t length;
@@ -1363,7 +1405,7 @@
     uint64_t generation_id;
 };
 
-struct of_role_reply {
+struct of_role_reply : of_header {
     uint8_t version;
     uint8_t type == 25;
     uint16_t length;
diff --git a/openflow_input/standard-1.3 b/openflow_input/standard-1.3
index 0d5cec3..ab32abe 100644
--- a/openflow_input/standard-1.3
+++ b/openflow_input/standard-1.3
@@ -548,6 +548,7 @@
     OFPHET_VERSIONBITMAP = 1,
 };
 
+/* XXX rename to of_message */
 struct of_header {
     uint8_t version;
     uint8_t type;
@@ -570,13 +571,13 @@
     uint16_t length;
 };
 
-struct of_hello_elem_versionbitmap {
+struct of_hello_elem_versionbitmap : of_hello_elem {
     uint16_t type == 1;
     uint16_t length;
     list(of_uint32_t) bitmaps;
 };
 
-struct of_hello {
+struct of_hello : of_header {
     uint8_t version;
     uint8_t type == 0;
     uint16_t length;
@@ -584,7 +585,7 @@
     list(of_hello_elem_t) elements;
 };
 
-struct of_echo_request {
+struct of_echo_request : of_header {
     uint8_t version;
     uint8_t type == 2;
     uint16_t length;
@@ -592,7 +593,7 @@
     of_octets_t data;
 };
 
-struct of_echo_reply {
+struct of_echo_reply : of_header {
     uint8_t version;
     uint8_t type == 3;
     uint16_t length;
@@ -600,7 +601,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter {
+struct of_experimenter : of_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -610,28 +611,28 @@
     of_octets_t data;
 };
 
-struct of_barrier_request {
+struct of_barrier_request : of_header {
     uint8_t version;
     uint8_t type == 20;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_barrier_reply {
+struct of_barrier_reply : of_header {
     uint8_t version;
     uint8_t type == 21;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_request {
+struct of_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 7;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_get_config_reply {
+struct of_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 8;
     uint16_t length;
@@ -640,7 +641,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_set_config {
+struct of_set_config : of_header {
     uint8_t version;
     uint8_t type == 9;
     uint16_t length;
@@ -649,7 +650,7 @@
     uint16_t miss_send_len;
 };
 
-struct of_table_mod {
+struct of_table_mod : of_header {
     uint8_t version;
     uint8_t type == 17;
     uint16_t length;
@@ -675,14 +676,14 @@
     uint32_t max_speed;
 };
 
-struct of_features_request {
+struct of_features_request : of_header {
     uint8_t version;
     uint8_t type == 5;
     uint16_t length;
     uint32_t xid;
 };
 
-struct of_features_reply {
+struct of_features_reply : of_header {
     uint8_t version;
     uint8_t type == 6;
     uint16_t length;
@@ -696,7 +697,7 @@
     uint32_t reserved;
 };
 
-struct of_port_status {
+struct of_port_status : of_header {
     uint8_t version;
     uint8_t type == 12;
     uint16_t length;
@@ -706,7 +707,7 @@
     of_port_desc_t desc;
 };
 
-struct of_port_mod {
+struct of_port_mod : of_header {
     uint8_t version;
     uint8_t type == 16;
     uint16_t length;
@@ -736,7 +737,7 @@
     pad(4);
 };
 
-struct of_action_output {
+struct of_action_output : of_action {
     uint16_t type == 0;
     uint16_t len;
     of_port_no_t port;
@@ -744,103 +745,103 @@
     pad(6);
 };
 
-struct of_action_copy_ttl_out {
+struct of_action_copy_ttl_out : of_action {
     uint16_t type == 11;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_copy_ttl_in {
+struct of_action_copy_ttl_in : of_action {
     uint16_t type == 12;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_set_mpls_ttl {
+struct of_action_set_mpls_ttl : of_action {
     uint16_t type == 15;
     uint16_t len;
     uint8_t mpls_ttl;
     pad(3);
 };
 
-struct of_action_dec_mpls_ttl {
+struct of_action_dec_mpls_ttl : of_action {
     uint16_t type == 16;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_vlan {
+struct of_action_push_vlan : of_action {
     uint16_t type == 17;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_pop_vlan {
+struct of_action_pop_vlan : of_action {
     uint16_t type == 18;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_mpls {
+struct of_action_push_mpls : of_action {
     uint16_t type == 19;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_pop_mpls {
+struct of_action_pop_mpls : of_action {
     uint16_t type == 20;
     uint16_t len;
     uint16_t ethertype;
     pad(2);
 };
 
-struct of_action_set_queue {
+struct of_action_set_queue : of_action {
     uint16_t type == 21;
     uint16_t len;
     uint32_t queue_id;
 };
 
-struct of_action_group {
+struct of_action_group : of_action {
     uint16_t type == 22;
     uint16_t len;
     uint32_t group_id;
 };
 
-struct of_action_set_nw_ttl {
+struct of_action_set_nw_ttl : of_action {
     uint16_t type == 23;
     uint16_t len;
     uint8_t nw_ttl;
     pad(3);
 };
 
-struct of_action_dec_nw_ttl {
+struct of_action_dec_nw_ttl : of_action {
     uint16_t type == 24;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_set_field {
+struct of_action_set_field : of_action {
     uint16_t type == 25;
     uint16_t len;
     of_oxm_t field;
 };
 
-struct of_action_experimenter {
+struct of_action_experimenter : of_action {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
     of_octets_t data;
 };
 
-struct of_action_pop_pbb {
+struct of_action_pop_pbb : of_action {
     uint16_t type == 27;
     uint16_t len;
     pad(4);
 };
 
-struct of_action_push_pbb {
+struct of_action_push_pbb : of_action {
     uint16_t type == 26;
     uint16_t len;
     uint16_t ethertype;
@@ -858,14 +859,14 @@
     uint16_t len;
 };
 
-struct of_instruction_goto_table {
+struct of_instruction_goto_table : of_instruction {
     uint16_t type == 1;
     uint16_t len;
     uint8_t table_id;
     pad(3);
 };
 
-struct of_instruction_write_metadata {
+struct of_instruction_write_metadata : of_instruction {
     uint16_t type == 2;
     uint16_t len;
     pad(4);
@@ -873,40 +874,61 @@
     uint64_t metadata_mask;
 };
 
-struct of_instruction_write_actions {
+struct of_instruction_write_actions : of_instruction {
     uint16_t type == 3;
     uint16_t len;
     pad(4);
     list(of_action_t) actions;
 };
 
-struct of_instruction_apply_actions {
+struct of_instruction_apply_actions : of_instruction {
     uint16_t type == 4;
     uint16_t len;
     pad(4);
     list(of_action_t) actions;
 };
 
-struct of_instruction_clear_actions {
+struct of_instruction_clear_actions : of_instruction {
     uint16_t type == 5;
     uint16_t len;
     pad(4);
 };
 
-struct of_instruction_meter {
+struct of_instruction_meter : of_instruction {
     uint16_t type == 6;
     uint16_t len;
     uint32_t meter_id;
 };
 
-struct of_instruction_experimenter {
+struct of_instruction_experimenter : of_instruction {
     uint16_t type == 65535;
     uint16_t len;
     uint32_t experimenter;
     of_octets_t data;
 };
 
-struct of_flow_add {
+struct of_flow_mod : of_header {
+    uint8_t version;
+    uint8_t type == 14;
+    uint16_t length;
+    uint32_t xid;
+    uint64_t cookie;
+    uint64_t cookie_mask;
+    uint8_t table_id;
+    of_fm_cmd_t _command;
+    uint16_t idle_timeout;
+    uint16_t hard_timeout;
+    uint16_t priority;
+    uint32_t buffer_id;
+    of_port_no_t out_port;
+    uint32_t out_group;
+    uint16_t flags;
+    pad(2);
+    of_match_t match;
+    list(of_instruction_t) instructions;
+};
+
+struct of_flow_add : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -927,7 +949,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_modify {
+struct of_flow_modify : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -948,7 +970,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_modify_strict {
+struct of_flow_modify_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -969,7 +991,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_delete {
+struct of_flow_delete : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -990,7 +1012,7 @@
     list(of_instruction_t) instructions;
 };
 
-struct of_flow_delete_strict {
+struct of_flow_delete_strict : of_flow_mod {
     uint8_t version;
     uint8_t type == 14;
     uint16_t length;
@@ -1020,7 +1042,7 @@
     list(of_action_t) actions;
 };
 
-struct of_group_mod {
+struct of_group_mod : of_header {
     uint8_t version;
     uint8_t type == 15;
     uint16_t length;
@@ -1032,7 +1054,7 @@
     list(of_bucket_t) buckets;
 };
 
-struct of_packet_out {
+struct of_packet_out : of_header {
     uint8_t version;
     uint8_t type == 13;
     uint16_t length;
@@ -1045,7 +1067,7 @@
     of_octets_t data;
 };
 
-struct of_packet_in {
+struct of_packet_in : of_header {
     uint8_t version;
     uint8_t type == 10;
     uint16_t length;
@@ -1060,7 +1082,7 @@
     of_octets_t data; /* FIXME: Ensure total_len gets updated */
 };
 
-struct of_flow_removed {
+struct of_flow_removed : of_header {
     uint8_t version;
     uint8_t type == 11;
     uint16_t length;
@@ -1085,7 +1107,7 @@
 //    uint32_t        burst_size;  // These are excluded b/c this is the header
 };
 
-struct of_meter_band_drop {
+struct of_meter_band_drop : of_meter_band {
     uint16_t        type == 1;
     uint16_t        len;
     uint32_t        rate;
@@ -1093,7 +1115,7 @@
     pad(4);
 };
 
-struct of_meter_band_dscp_remark {
+struct of_meter_band_dscp_remark : of_meter_band {
     uint16_t        type == 2;
     uint16_t        len;
     uint32_t        rate;
@@ -1102,7 +1124,7 @@
     pad(3);
 };
 
-struct of_meter_band_experimenter {
+struct of_meter_band_experimenter : of_meter_band {
     uint16_t        type == 65535;
     uint16_t        len;
     uint32_t        rate;
@@ -1110,7 +1132,7 @@
     uint32_t        experimenter;
 };
 
-struct of_meter_mod {
+struct of_meter_mod : of_header {
     uint8_t version;
     uint8_t type == 29;
     uint16_t length;
@@ -1121,7 +1143,7 @@
     list(of_meter_band_t) meters;
 };
 
-struct of_error_msg {
+struct of_error_msg : of_header {
     uint8_t version;
     uint8_t type == 1;
     uint16_t length;
@@ -1228,7 +1250,27 @@
 // STATS: 
 //  Desc, flow, agg, table, port, queue, group, group_desc, group_feat, experi
 
-struct of_desc_stats_request {
+struct of_stats_request : of_header {
+    uint8_t version;
+    uint8_t type == 18;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+    pad(4);
+};
+
+struct of_stats_reply : of_header {
+    uint8_t version;
+    uint8_t type == 19;
+    uint16_t length;
+    uint32_t xid;
+    uint16_t stats_type;
+    uint16_t flags;
+    pad(4);
+};
+
+struct of_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1238,7 +1280,7 @@
     pad(4);
 };
 
-struct of_desc_stats_reply {
+struct of_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1253,7 +1295,7 @@
     of_desc_str_t dp_desc;
 };
 
-struct of_flow_stats_request {
+struct of_flow_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1271,7 +1313,7 @@
     of_match_t match;
 };
 
-struct of_flow_stats_reply {
+struct of_flow_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1282,7 +1324,7 @@
     list(of_flow_stats_entry_t) entries;
 };
 
-struct of_aggregate_stats_request {
+struct of_aggregate_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1300,7 +1342,7 @@
     of_match_t match;
 };
 
-struct of_aggregate_stats_reply {
+struct of_aggregate_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1314,7 +1356,7 @@
     pad(4);
 };
 
-struct of_table_stats_request {
+struct of_table_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1324,7 +1366,7 @@
     pad(4);
 };
 
-struct of_table_stats_reply {
+struct of_table_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1342,92 +1384,92 @@
     uint16_t         length;
 };
 
-struct of_table_feature_prop_instructions {
+struct of_table_feature_prop_instructions : of_table_feature_prop {
     uint16_t         type == 0;
     uint16_t         length;
     // FIXME Check if instruction_t is right for ids here
     list(of_instruction_t)   instruction_ids;
 };
 
-struct of_table_feature_prop_instructions_miss {
+struct of_table_feature_prop_instructions_miss : of_table_feature_prop {
     uint16_t         type == 1;
     uint16_t         length;
     list(of_instruction_t)   instruction_ids;
 };
 
-struct of_table_feature_prop_next_tables {
+struct of_table_feature_prop_next_tables : of_table_feature_prop {
     uint16_t         type == 2;
     uint16_t         length;
     list(of_uint8_t) next_table_ids;
 };
 
-struct of_table_feature_prop_next_tables_miss {
+struct of_table_feature_prop_next_tables_miss : of_table_feature_prop {
     uint16_t         type == 3;
     uint16_t         length;
     list(of_uint8_t) next_table_ids;
 };
 
-struct of_table_feature_prop_write_actions {
+struct of_table_feature_prop_write_actions : of_table_feature_prop {
     uint16_t         type == 4;
     uint16_t         length;
     list(of_action_id_t) action_ids;
 };
 
-struct of_table_feature_prop_write_actions_miss {
+struct of_table_feature_prop_write_actions_miss : of_table_feature_prop {
     uint16_t         type == 5;
     uint16_t         length;
     list(of_action_id_t) action_ids;
 };
 
-struct of_table_feature_prop_apply_actions {
+struct of_table_feature_prop_apply_actions : of_table_feature_prop {
     uint16_t         type == 6;
     uint16_t         length;
     list(of_action_id_t) action_ids;
 };
 
-struct of_table_feature_prop_apply_actions_miss {
+struct of_table_feature_prop_apply_actions_miss : of_table_feature_prop {
     uint16_t         type == 7;
     uint16_t         length;
     list(of_action_id_t) action_ids;
 };
 
-struct of_table_feature_prop_match {
+struct of_table_feature_prop_match : of_table_feature_prop {
     uint16_t         type == 8;
     uint16_t         length;
     list(of_uint32_t) oxm_ids;
 };
 
-struct of_table_feature_prop_wildcards {
+struct of_table_feature_prop_wildcards : of_table_feature_prop {
     uint16_t         type == 10;
     uint16_t         length;
     list(of_uint32_t) oxm_ids;
 };
 
-struct of_table_feature_prop_write_setfield {
+struct of_table_feature_prop_write_setfield : of_table_feature_prop {
     uint16_t         type == 12;
     uint16_t         length;
     list(of_uint32_t) oxm_ids;
 };
 
-struct of_table_feature_prop_write_setfield_miss {
+struct of_table_feature_prop_write_setfield_miss : of_table_feature_prop {
     uint16_t         type == 13;
     uint16_t         length;
     list(of_uint32_t) oxm_ids;
 };
 
-struct of_table_feature_prop_apply_setfield {
+struct of_table_feature_prop_apply_setfield : of_table_feature_prop {
     uint16_t         type == 14;
     uint16_t         length;
     list(of_uint32_t) oxm_ids;
 };
 
-struct of_table_feature_prop_apply_setfield_miss {
+struct of_table_feature_prop_apply_setfield_miss : of_table_feature_prop {
     uint16_t         type == 15;
     uint16_t         length;
     list(of_uint32_t) oxm_ids;
 };
 
-struct of_table_feature_prop_experimenter {
+struct of_table_feature_prop_experimenter : of_table_feature_prop {
     uint16_t         type == 65535;
     uint16_t         length;
     uint32_t         experimenter;
@@ -1436,7 +1478,7 @@
 };
 
 // Not yet supported
-// struct of_table_feature_prop_experimenter_miss {
+// struct of_table_feature_prop_experimenter_miss : of_table_feature_prop {
 //     uint16_t         type;
 //     uint16_t         length;
 //     uint32_t         experimenter;
@@ -1465,7 +1507,7 @@
     pad(2);
 };
 
-struct of_port_stats_request {
+struct of_port_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1477,7 +1519,7 @@
     pad(4);
 };
 
-struct of_port_stats_reply {
+struct of_port_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1488,7 +1530,7 @@
     list(of_port_stats_entry_t) entries;
 };
 
-struct of_queue_stats_request {
+struct of_queue_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1500,7 +1542,7 @@
     uint32_t queue_id;
 };
 
-struct of_queue_stats_reply {
+struct of_queue_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1511,7 +1553,7 @@
     list(of_queue_stats_entry_t) entries;
 };
 
-struct of_group_stats_request {
+struct of_group_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1523,7 +1565,7 @@
     pad(4);
 };
 
-struct of_group_stats_reply {
+struct of_group_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1534,7 +1576,7 @@
     list(of_group_stats_entry_t) entries;
 };
 
-struct of_group_desc_stats_request {
+struct of_group_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1544,7 +1586,7 @@
     pad(4);
 };
 
-struct of_group_desc_stats_reply {
+struct of_group_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1555,7 +1597,7 @@
     list(of_group_desc_stats_entry_t) entries;
 };
 
-struct of_group_features_stats_request {
+struct of_group_features_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1565,7 +1607,7 @@
     pad(4);
 };
 
-struct of_group_features_stats_reply {
+struct of_group_features_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1585,7 +1627,7 @@
     uint32_t actions_ff;
 };
 
-struct of_meter_stats_request {
+struct of_meter_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1597,7 +1639,7 @@
     pad(4);
 };
 
-struct of_meter_stats_reply {
+struct of_meter_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1608,7 +1650,7 @@
     list(of_meter_stats_t) entries;
 };
 
-struct of_meter_config_stats_request {
+struct of_meter_config_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1620,7 +1662,7 @@
     pad(4);
 };
 
-struct of_meter_config_stats_reply {
+struct of_meter_config_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1632,7 +1674,7 @@
 };
 
 // FIXME stats added to get things working
-struct of_meter_features_stats_request {
+struct of_meter_features_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1643,7 +1685,7 @@
 };
 
 // FIXME stats added to get things working
-struct of_meter_features_stats_reply {
+struct of_meter_features_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1655,7 +1697,7 @@
 };
 
 // FIXME stats added to get things working
-struct of_table_features_stats_request {
+struct of_table_features_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1667,7 +1709,7 @@
 };
 
 // FIXME stats added to get things working
-struct of_table_features_stats_reply {
+struct of_table_features_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1679,7 +1721,7 @@
 };
 
 // FIXME stats added to get things working
-struct of_port_desc_stats_request {
+struct of_port_desc_stats_request : of_stats_request {
     uint8_t version;
     uint8_t type == 18;
     uint16_t length;
@@ -1690,7 +1732,7 @@
 };
 
 // FIXME stats added to get things working
-struct of_port_desc_stats_reply {
+struct of_port_desc_stats_reply : of_stats_reply {
     uint8_t version;
     uint8_t type == 19;
     uint16_t length;
@@ -1738,7 +1780,7 @@
     pad(4);
 };
 
-struct of_queue_prop_min_rate {
+struct of_queue_prop_min_rate : of_queue_prop {
     uint16_t type == 1;
     uint16_t len;
     pad(4);
@@ -1746,7 +1788,7 @@
     pad(6);
 };
 
-struct of_queue_prop_max_rate {
+struct of_queue_prop_max_rate : of_queue_prop {
     uint16_t type == 2;
     uint16_t len;
     pad(4);
@@ -1754,7 +1796,7 @@
     pad(6);
 };
 
-struct of_queue_prop_experimenter {
+struct of_queue_prop_experimenter : of_queue_prop {
     uint16_t type == 65535;
     uint16_t len;
     pad(4);
@@ -1771,7 +1813,7 @@
     list(of_queue_prop_t) properties;
 };
 
-struct of_queue_get_config_request {
+struct of_queue_get_config_request : of_header {
     uint8_t version;
     uint8_t type == 22;
     uint16_t length;
@@ -1780,7 +1822,7 @@
     pad(4);
 };
 
-struct of_queue_get_config_reply {
+struct of_queue_get_config_reply : of_header {
     uint8_t version;
     uint8_t type == 23;
     uint16_t length;
@@ -1790,7 +1832,7 @@
     list(of_packet_queue_t) queues;
 };
 
-struct of_role_request {
+struct of_role_request : of_header {
     uint8_t version;
     uint8_t type == 24;
     uint16_t length;
@@ -1800,7 +1842,7 @@
     uint64_t generation_id;
 };
 
-struct of_role_reply {
+struct of_role_reply : of_header {
     uint8_t version;
     uint8_t type == 25;
     uint16_t length;
@@ -1815,7 +1857,7 @@
 //   while uint32_t[1] is interest for slave
 ////////////////////////////////////////////////////////////////
 
-struct of_async_get_request {
+struct of_async_get_request : of_header {
     uint8_t version;
     uint8_t type == 26;
     uint16_t length;
@@ -1828,7 +1870,7 @@
     uint32_t flow_removed_mask_slave;
 };
 
-struct of_async_get_reply {
+struct of_async_get_reply : of_header {
     uint8_t version;
     uint8_t type == 27;
     uint16_t length;
@@ -1841,7 +1883,7 @@
     uint32_t flow_removed_mask_slave;
 };
 
-struct of_async_set {
+struct of_async_set : of_header {
     uint8_t version;
     uint8_t type == 28;
     uint16_t length;
diff --git a/utest/test_frontend.py b/utest/test_frontend.py
index 01b8270..609a262 100755
--- a/utest/test_frontend.py
+++ b/utest/test_frontend.py
@@ -90,7 +90,7 @@
                 ['OFPPC_NO_FWD', 32],
                 ['OFPPC_NO_PACKET_IN', 64]]],
             ['metadata', 'version', '2'],
-            ['struct', 'of_echo_reply', [
+            ['struct', 'of_echo_reply', None, [
                 ['data', 'uint8_t', 'version'],
                 ['type', 'uint8_t', 'type', 3],
                 ['data', 'uint16_t', 'length'],
@@ -100,7 +100,7 @@
                 ['OFPQOFC_BAD_PORT', 0],
                 ['OFPQOFC_BAD_QUEUE', 1],
                 ['OFPQOFC_EPERM', 2]]],
-            ['struct', 'of_packet_queue', [
+            ['struct', 'of_packet_queue', None, [
                 ['data', 'uint32_t', 'queue_id'],
                 ['data', 'uint16_t', 'len'],
                 ['pad', 2],
@@ -111,13 +111,13 @@
         ofinput = frontend.create_ofinput(ast)
         self.assertEquals(set([1, 2]), ofinput.wire_versions)
         expected_classes = [
-            OFClass('of_echo_reply', [
+            OFClass('of_echo_reply', None, [
                 OFDataMember('version', 'uint8_t'), # XXX
                 OFTypeMember('type', 'uint8_t', 3),
                 OFLengthMember('length', 'uint16_t'),
                 OFDataMember('xid', 'uint32_t'),
                 OFDataMember('data', 'of_octets_t')]),
-            OFClass('of_packet_queue', [
+            OFClass('of_packet_queue', None, [
                 OFDataMember('queue_id', 'uint32_t'),
                 OFLengthMember('len', 'uint16_t'),
                 OFPadMember(2),
@@ -140,5 +140,57 @@
         ]
         self.assertEquals(expected_enums, ofinput.enums)
 
+    def test_inheritance(self):
+        ast = parser.parse("""
+#version 1
+
+struct of_queue_prop {
+    uint16_t type;
+    uint16_t len;
+    pad(4);
+};
+
+struct of_queue_prop_min_rate : of_queue_prop {
+    uint16_t type == 1;
+    uint16_t len;
+    pad(4);
+    uint16_t rate;
+    pad(6);
+};
+""")
+
+        # Not testing the parser, just making sure the AST is what we expect
+        expected_ast = [
+            ['metadata', 'version', '1'],
+
+            ['struct', 'of_queue_prop', None, [
+                ['data', 'uint16_t', 'type'],
+                ['data', 'uint16_t', 'len'],
+                ['pad', 4]]],
+
+            ['struct', 'of_queue_prop_min_rate', 'of_queue_prop', [
+                ['type', 'uint16_t', 'type', 1],
+                ['data', 'uint16_t', 'len'],
+                ['pad', 4],
+                ['data', 'uint16_t', 'rate'],
+                ['pad', 6]]],
+        ]
+        self.assertEquals(expected_ast, ast)
+
+        ofinput = frontend.create_ofinput(ast)
+        expected_classes = [
+            OFClass('of_queue_prop', None, [
+                OFDataMember('type', 'uint16_t'),
+                OFLengthMember('len', 'uint16_t'),
+                OFPadMember(4)]),
+            OFClass('of_queue_prop_min_rate', 'of_queue_prop', [
+                OFTypeMember('type', 'uint16_t', 1),
+                OFLengthMember('len', 'uint16_t'),
+                OFPadMember(4),
+                OFDataMember('rate', 'uint16_t'),
+                OFPadMember(6)]),
+        ]
+        self.assertEquals(expected_classes, ofinput.classes)
+
 if __name__ == '__main__':
     unittest.main()
diff --git a/utest/test_parser.py b/utest/test_parser.py
index 40d2913..c24665c 100755
--- a/utest/test_parser.py
+++ b/utest/test_parser.py
@@ -42,7 +42,7 @@
 struct foo { };
 """
         ast = parser.parse(src)
-        self.assertEquals(ast, [['struct', 'foo', []]])
+        self.assertEquals(ast, [['struct', 'foo', None, []]])
 
     def test_one_field(self):
         src = """\
@@ -52,7 +52,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', [['data', 'uint32_t', 'bar']]]])
+            [['struct', 'foo', None, [['data', 'uint32_t', 'bar']]]])
 
     def test_multiple_fields(self):
         src = """\
@@ -64,7 +64,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo',
+            [['struct', 'foo', None,
                 [['data', 'uint32_t', 'bar'],
                  ['data', 'uint8_t', 'baz'],
                  ['data', 'uint64_t', 'abc']]]])
@@ -77,7 +77,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', [['data', 'uint32_t[4]', 'bar']]]])
+            [['struct', 'foo', None, [['data', 'uint32_t[4]', 'bar']]]])
 
     def test_list_type(self):
         src = """\
@@ -87,7 +87,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', [['data', 'list(of_action_t)', 'bar']]]])
+            [['struct', 'foo', None, [['data', 'list(of_action_t)', 'bar']]]])
 
     def test_pad_member(self):
         src = """\
@@ -97,7 +97,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', [['pad', 1]]]])
+            [['struct', 'foo', None, [['pad', 1]]]])
 
     def test_type_member(self):
         src = """\
@@ -107,7 +107,17 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', [['type', 'uint16_t', 'foo', 0x10]]]])
+            [['struct', 'foo', None, [['type', 'uint16_t', 'foo', 0x10]]]])
+
+    def test_inheritance(self):
+        src = """\
+struct foo : bar {
+    uint16_t foo == 0x10;
+};
+"""
+        ast = parser.parse(src)
+        self.assertEquals(ast,
+            [['struct', 'foo', 'bar', [['type', 'uint16_t', 'foo', 0x10]]]])
 
 class EnumTests(unittest.TestCase):
     def test_empty(self):
@@ -165,7 +175,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', []], ['struct', 'bar', []]])
+            [['struct', 'foo', None, []], ['struct', 'bar', None, []]])
 
     def test_comments(self):
         src = """\
@@ -179,7 +189,7 @@
 """
         ast = parser.parse(src)
         self.assertEquals(ast,
-            [['struct', 'foo', [['data', 'uint32_t', 'a']]]])
+            [['struct', 'foo', None, [['data', 'uint32_t', 'a']]]])
 
     def test_mixed(self):
         src = """\
@@ -191,9 +201,9 @@
         ast = parser.parse(src)
         self.assertEquals(ast,
             [['metadata', 'version', '1'],
-             ['struct', 'foo', []],
+             ['struct', 'foo', None, []],
              ['metadata', 'version', '2'],
-             ['struct', 'bar', []]])
+             ['struct', 'bar', None, []]])
 
 class TestErrors(unittest.TestCase):
     def syntax_error(self, src, regex):