Merge into master from pull request #104:
Wireshark dissector improvements (https://github.com/floodlight/loxigen/pull/104)
diff --git a/openflow_input/standard-1.1 b/openflow_input/standard-1.1
index a6f511f..9b72e8c 100644
--- a/openflow_input/standard-1.1
+++ b/openflow_input/standard-1.1
@@ -72,9 +72,6 @@
     OFPP_ALL = 0xfffffffc,
     OFPP_CONTROLLER = 0xfffffffd,
     OFPP_LOCAL = 0xfffffffe,
-};
-
-enum ofp_port_no(wire_type=uint32_t, complete=False) {
     OFPP_ANY = 0xffffffff,
 };
 
diff --git a/openflow_input/standard-1.2 b/openflow_input/standard-1.2
index cf146e0..e9d915a 100644
--- a/openflow_input/standard-1.2
+++ b/openflow_input/standard-1.2
@@ -68,9 +68,6 @@
     OFPP_ALL = 0xfffffffc,
     OFPP_CONTROLLER = 0xfffffffd,
     OFPP_LOCAL = 0xfffffffe,
-};
-
-enum ofp_port_no(wire_type=uint32_t, complete=False) {
     OFPP_ANY = 0xffffffff,
 };
 
diff --git a/openflow_input/standard-1.3 b/openflow_input/standard-1.3
index 432ccf7..db7ff0d 100644
--- a/openflow_input/standard-1.3
+++ b/openflow_input/standard-1.3
@@ -58,10 +58,6 @@
     OFPQ_MIN_RATE_UNCFG = 0xffff,
 };
 
-enum ofp_port_no(wire_type=uint32_t, complete=False) {
-    OFPP_ANY = 0xffffffff,
-};
-
 enum ofp_port(wire_type=uint32_t) {
     OFPP_MAX = 0xffffff00,
     OFPP_IN_PORT = 0xfffffff8,
@@ -71,6 +67,7 @@
     OFPP_ALL = 0xfffffffc,
     OFPP_CONTROLLER = 0xfffffffd,
     OFPP_LOCAL = 0xfffffffe,
+    OFPP_ANY = 0xffffffff,
 };
 
 enum ofp_type(wire_type=uint8_t) {
diff --git a/wireshark_gen/templates/_ofreader.lua b/wireshark_gen/templates/_ofreader.lua
index b25f7c8..a4c57be 100644
--- a/wireshark_gen/templates/_ofreader.lua
+++ b/wireshark_gen/templates/_ofreader.lua
@@ -64,5 +64,9 @@
         return r
     end
     
+    self.skip_align = function()
+        offset = math.floor((offset + 7)/8)*8
+    end
+
     return self
 end
diff --git a/wireshark_gen/templates/_oftype_readers.lua b/wireshark_gen/templates/_oftype_readers.lua
index fb6eb6f..1db9f1f 100644
--- a/wireshark_gen/templates/_oftype_readers.lua
+++ b/wireshark_gen/templates/_oftype_readers.lua
@@ -123,3 +123,29 @@
 function read_list_of_packet_queue_t(reader, version, subtree, field_name)
     -- TODO
 end
+
+function read_list_of_oxm_t(reader, version, subtree, field_name)
+    if reader.is_empty() then
+        return
+    end
+    local list_len = reader.peek(-2,2):uint()
+    local reader2 = reader.slice(list_len - 4)
+    local list = subtree:add(fields[field_name], reader2.peek_all(0))
+    while not reader2.is_empty() do
+        local match_len = 4 + reader2.peek(3,1):uint()
+        local child_reader = reader2.slice(match_len)
+        local child_subtree = list:add(fields[field_name], child_reader.peek_all(0))
+        local info = dissect_of_oxm_v3(child_reader, child_subtree)
+        child_subtree:set_text(info)
+    end
+    reader.skip_align()
+end
+
+function read_list_of_instruction_t(reader, version, subtree, field_name)
+    if reader.is_empty() then
+        return
+    end
+    if not reader.is_empty() then
+        subtree:add(fields[field_name], reader.read_all())
+    end
+end
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index 1b1bc8a..bf1cdf5 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -53,10 +53,41 @@
 
 :: #endfor
 
+
+:: values = {
+::     'of13.flow_mod.type': 'enum_v4_ofp_type',
+::     'of13.error_msg.type': 'enum_v4_ofp_type',
+::     'of13.stats_request.type': 'enum_v4_ofp_type',
+::     'of13.stats_request.stats_type': 'enum_v4_ofp_stats_type',
+::     'of13.stats_request.flags': 'enum_v4_ofp_stats_request_flags',
+::     'of13.stats_reply.type': 'enum_v4_ofp_type',
+::     'of13.stats_reply.stats_type': 'enum_v4_ofp_stats_type',
+::     'of13.stats_reply.flags': 'enum_v4_ofp_stats_reply_flags',
+::     'of13.flow_mod.table_id': 'enum_v4_ofp_table',
+::     'of13.flow_mod._command': 'enum_v4_ofp_flow_mod_command',
+::     'of13.flow_mod.out_port': 'enum_v4_ofp_port',
+::     'of13.flow_mod.out_group': 'enum_v4_ofp_group',
+::     'of13.error_msg.err_type': 'enum_v4_ofp_error_type',
+::     'of13.port_mod.type': 'enum_v4_ofp_type',
+::     'of13.hello.type': 'enum_v4_ofp_type',
+::     'of13.features_request.type': 'enum_v4_ofp_type',
+::     'of13.features_reply.type': 'enum_v4_ofp_type',
+::     'of13.barrier_request.type': 'enum_v4_ofp_type',
+::     'of13.barrier_reply.type': 'enum_v4_ofp_type',
+::     'of13.echo_request.type': 'enum_v4_ofp_type',
+::     'of13.echo_reply.type': 'enum_v4_ofp_type',
+::     'of13.match_t.type': 'enum_v4_ofp_match_type'
+:: }
+
+
 fields = {}
 :: for field in fields:
 :: if field.type in ["uint8", "uint16", "uint32", "uint64"]:
+:: if field.fullname in values:
+fields[${repr(field.fullname)}] = ProtoField.${field.type}("${field.fullname}", "${field.name}", base.${field.base}, ${values[field.fullname]})
+:: else:
 fields[${repr(field.fullname)}] = ProtoField.${field.type}("${field.fullname}", "${field.name}", base.${field.base})
+:: #endif
 :: elif field.type in ["ipv4", "ipv6", "ether", "bytes", "stringz"]:
 fields[${repr(field.fullname)}] = ProtoField.${field.type}("${field.fullname}", "${field.name}")
 :: else:
@@ -119,6 +150,16 @@
     return protocol, info
 end
 
+function dissect_of_oxm_v3(reader, subtree)
+    local type_val = reader.peek(0,4):uint()
+
+    local info = "unknown"
+    if of_oxm_v3_dissectors[type_val] then
+        info = of_oxm_v3_dissectors[type_val](reader, subtree)
+    end
+
+    return info
+end
 -- of dissector function
 function p_of.dissector (buf, pkt, root)
     local offset = 0