Merge remote-tracking branch 'rlane/explicit-inheritance2'

Conflicts:
	loxi_front_end/frontend.py
	loxi_front_end/parser.py
	loxi_ir.py
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 24819a1..bba941c 100644
--- a/loxi_front_end/frontend.py
+++ b/loxi_front_end/frontend.py
@@ -65,9 +65,9 @@
             # 0: "enum"
             # 1: name
             # 2: potentially list of [param_name, param_value]
-            # 3: [ super_class] or []
+            # 3: super_class
             # 4: list of [constant_name, constant_value]+
-            super_class = decl_ast[3][0] if decl_ast[3] else ""
+            super_class = decl_ast[3]
             members = [create_member(m_ast) for m_ast in decl_ast[4]]
             ofclass = OFClass(name=decl_ast[1], members=members, super_class=super_class,
                     params = { param: value for param, value in decl_ast[2] })
diff --git a/loxi_front_end/parser.py b/loxi_front_end/parser.py
index 1b6b75f..d5920e8 100644
--- a/loxi_front_end/parser.py
+++ b/loxi_front_end/parser.py
@@ -60,7 +60,8 @@
 struct_param_list << struct_param + P.Optional(s(',') - P.Optional(struct_param_list))
 
 struct_member = pad_member | type_member | data_member;
-struct = kw('struct') - identifier - P.Group(P.Optional(s('(') - struct_param_list - s(')'))) - P.Group(P.Optional(s('<') - word)) - s('{') + \
+parent = (s(':') - identifier) | tag(None)
+struct = kw('struct') - identifier - P.Group(P.Optional(s('(') - struct_param_list - s(')'))) - 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 aeefa74..9e266eb 100644
--- a/loxi_ir.py
+++ b/loxi_ir.py
@@ -76,7 +76,7 @@
 @param super_class name of the super class
 @param params optional dictionary of parameters
 """
-class OFClass(namedtuple('OFClass', ['name', 'members', 'super_class', 'params'])):
+class OFClass(namedtuple('OFClass', ['name', 'members', 'superclass', 'params'])):
     def member_by_name(self, name):
         return find(self.members, lambda m: hasattr(m, "name") and m.name == name)
 
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 92204ca..dcd547e 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 03b4b43..06198df 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 ceb2016..6382759 100644
--- a/openflow_input/standard-1.0
+++ b/openflow_input/standard-1.0
@@ -299,6 +299,7 @@
     OFPQOFC_EPERM = 2,
 };
 
+/* XXX rename to of_message */
 struct of_header {
     uint8_t version;
     uint8_t type;
@@ -306,14 +307,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;
@@ -321,7 +322,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;
@@ -329,7 +330,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter {
+struct of_experimenter : of_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -339,28 +340,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;
@@ -369,7 +370,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;
@@ -390,14 +391,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;
@@ -411,7 +412,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;
@@ -421,7 +422,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;
@@ -434,7 +435,7 @@
     pad(4);
 };
 
-struct of_packet_in {
+struct of_packet_in : of_header {
     uint8_t version;
     uint8_t type == 10;
     uint16_t length;
@@ -447,88 +448,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;
@@ -542,7 +543,7 @@
     pad(4);
 };
 
-struct of_packet_out {
+struct of_packet_out : of_header {
     uint8_t version;
     uint8_t type == 13;
     uint16_t length;
@@ -572,7 +573,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;
@@ -589,7 +607,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;
@@ -606,7 +624,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;
@@ -623,7 +641,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;
@@ -640,7 +658,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;
@@ -657,7 +675,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;
@@ -675,7 +693,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;
@@ -742,7 +760,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;
@@ -751,7 +787,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;
@@ -765,7 +801,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;
@@ -778,7 +814,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;
@@ -788,7 +824,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;
@@ -801,7 +837,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;
@@ -814,7 +850,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;
@@ -823,7 +859,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;
@@ -833,7 +869,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;
@@ -844,7 +880,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;
@@ -854,7 +890,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;
@@ -866,7 +902,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;
@@ -876,7 +912,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;
@@ -887,7 +923,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;
@@ -906,7 +942,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);
@@ -921,7 +957,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;
@@ -930,7 +966,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 18faaa8..222071a 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 4ff23b7..6bcebdc 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 ab94fd5..0a56793 100644
--- a/openflow_input/standard-1.3
+++ b/openflow_input/standard-1.3
@@ -550,6 +550,7 @@
     OFPHET_VERSIONBITMAP = 1,
 };
 
+/* XXX rename to of_message */
 struct of_header {
     uint8_t version;
     uint8_t type;
@@ -572,13 +573,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;
@@ -586,7 +587,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;
@@ -594,7 +595,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;
@@ -602,7 +603,7 @@
     of_octets_t data;
 };
 
-struct of_experimenter {
+struct of_experimenter : of_header {
     uint8_t version;
     uint8_t type == 4;
     uint16_t length;
@@ -612,28 +613,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;
@@ -642,7 +643,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;
@@ -651,7 +652,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;
@@ -677,14 +678,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;
@@ -698,7 +699,7 @@
     uint32_t reserved;
 };
 
-struct of_port_status {
+struct of_port_status : of_header {
     uint8_t version;
     uint8_t type == 12;
     uint16_t length;
@@ -708,7 +709,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;
@@ -738,7 +739,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;
@@ -746,103 +747,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;
@@ -860,14 +861,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);
@@ -875,40 +876,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;
@@ -929,7 +951,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;
@@ -950,7 +972,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;
@@ -971,7 +993,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;
@@ -992,7 +1014,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;
@@ -1022,7 +1044,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;
@@ -1034,7 +1056,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;
@@ -1047,7 +1069,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;
@@ -1062,7 +1084,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;
@@ -1087,7 +1109,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;
@@ -1095,7 +1117,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;
@@ -1104,7 +1126,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;
@@ -1112,7 +1134,7 @@
     uint32_t        experimenter;
 };
 
-struct of_meter_mod {
+struct of_meter_mod : of_header {
     uint8_t version;
     uint8_t type == 29;
     uint16_t length;
@@ -1123,7 +1145,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;
@@ -1230,7 +1252,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;
@@ -1240,7 +1282,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;
@@ -1255,7 +1297,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;
@@ -1273,7 +1315,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;
@@ -1284,7 +1326,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;
@@ -1302,7 +1344,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;
@@ -1316,7 +1358,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;
@@ -1326,7 +1368,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;
@@ -1344,92 +1386,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;
@@ -1438,7 +1480,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;
@@ -1467,7 +1509,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;
@@ -1479,7 +1521,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;
@@ -1490,7 +1532,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;
@@ -1502,7 +1544,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;
@@ -1513,7 +1555,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;
@@ -1525,7 +1567,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;
@@ -1536,7 +1578,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;
@@ -1546,7 +1588,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;
@@ -1557,7 +1599,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;
@@ -1567,7 +1609,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;
@@ -1587,7 +1629,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;
@@ -1599,7 +1641,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;
@@ -1610,7 +1652,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;
@@ -1622,7 +1664,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;
@@ -1634,7 +1676,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;
@@ -1645,7 +1687,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;
@@ -1657,7 +1699,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;
@@ -1669,7 +1711,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;
@@ -1681,7 +1723,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;
@@ -1692,7 +1734,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;
@@ -1740,7 +1782,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);
@@ -1748,7 +1790,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);
@@ -1756,7 +1798,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);
@@ -1773,7 +1815,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;
@@ -1782,7 +1824,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;
@@ -1792,7 +1834,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;
@@ -1802,7 +1844,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;
@@ -1817,7 +1859,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;
@@ -1830,7 +1872,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;
@@ -1843,7 +1885,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):