Adding OF_STATS messages readers
diff --git a/wireshark_gen/templates/_oftype_readers.lua b/wireshark_gen/templates/_oftype_readers.lua
index 4f5d7f9..4d3d352 100644
--- a/wireshark_gen/templates/_oftype_readers.lua
+++ b/wireshark_gen/templates/_oftype_readers.lua
@@ -81,6 +81,10 @@
end
end
+function read_of_port_name_t(reader, version, subtree, field_name)
+ read_scalar(reader, subtree, field_name, 16)
+end
+
function read_of_mac_addr_t(reader, version, subtree, field_name)
read_scalar(reader, subtree, field_name, 6)
end
@@ -118,11 +122,91 @@
end
function read_list_of_port_desc_t(reader, version, subtree, field_name)
- -- TODO
+ if reader.is_empty() then
+ return
+ end
+ local list = subtree:add(fields[field_name], reader.peek_all(0))
+ list:set_text("List of port descriptions")
+ while not reader.is_empty() do
+ local port_desc_len = 64
+ local child_reader = reader.slice(port_desc_len)
+ local child_subtree = list:add(fields[field_name], child_reader.peek_all(0))
+ local info = dissect_of_port_desc(child_reader, child_subtree, version)
+ child_subtree:set_text(info)
+ end
+end
+
+function read_list_of_flow_stats_entry_t(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local list = subtree:add(fields[field_name], reader.peek_all(0))
+ list:set_text("List of flow stats entries")
+ while not reader.is_empty() do
+ local stats_len = reader.peek(0,2):uint()
+ local child_reader = reader.slice(stats_len)
+ local child_subtree = list:add(fields[field_name], child_reader.peek_all(0))
+ local info = dissect_of_flow_stats_entry(child_reader, child_subtree, version)
+ child_subtree:set_text(info)
+ end
+end
+
+function read_list_of_port_stats_entry_t(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local list = subtree:add(fields[field_name], reader.peek_all(0))
+ list:set_text("List of port stats entries")
+ while not reader.is_empty() do
+ local stats_len = 112
+ local child_reader = reader.slice(stats_len)
+ local child_subtree = list:add(fields[field_name], child_reader.peek_all(0))
+ local info = dissect_of_port_stats_entry(child_reader, child_subtree, version)
+ child_subtree:set_text(info)
+ end
+end
+
+function read_list_of_table_stats_entry_t(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local list = subtree:add(fields[field_name], reader.peek_all(0))
+ list:set_text("List of table stats entries")
+ while not reader.is_empty() do
+ local stats_len = 24
+ local child_reader = reader.slice(stats_len)
+ local child_subtree = list:add(fields[field_name], child_reader.peek_all(0))
+ local info = dissect_of_table_stats_entry(child_reader, child_subtree, version)
+ child_subtree:set_text(info)
+ end
+end
+
+function read_list_of_queue_stats_entry_t(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local list = subtree:add(fields[field_name], reader.peek_all(0))
+ list:set_text("List of flow stats entries")
+ while not reader.is_empty() do
+ local stats_len = 40
+ local child_reader = reader.slice(stats_len)
+ local child_subtree = list:add(fields[field_name], child_reader.peek_all(0))
+ local info = dissect_of_queue_stats_entry(child_reader, child_subtree, version)
+ child_subtree:set_text(info)
+ end
end
function read_list_of_packet_queue_t(reader, version, subtree, field_name)
-- TODO
+ read_of_octets_t()
+end
+
+function read_of_desc_str_t(reader, version, subtree, field_name)
+ read_scalar(reader, subtree, field_name, 256)
+end
+
+function read_of_serial_num_t(reader, version, subtree, field_name)
+ read_scalar(reader, subtree, field_name, 32)
end
function read_list_of_oxm_t(reader, version, subtree, field_name)
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index f2791d1..1aa815a 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -125,6 +125,48 @@
:: #endfor
}
+local of_port_desc_dissectors = {
+:: for version in ir:
+ [${version}] = dissect_of_port_desc_v${version},
+:: #endfor
+}
+
+local of_stats_reply_dissectors = {
+:: for version in ir:
+ [${version}] = of_stats_reply_v${version}_dissectors,
+:: #endfor
+}
+
+local of_stats_request_dissectors = {
+:: for version in ir:
+ [${version}] = of_stats_request_v${version}_dissectors,
+:: #endfor
+}
+
+local of_flow_stats_entry_dissectors = {
+:: for version in ir:
+ [${version}] = dissect_of_flow_stats_entry_v${version},
+:: #endfor
+}
+
+local of_port_stats_entry_dissectors = {
+:: for version in ir:
+ [${version}] = dissect_of_port_stats_entry_v${version},
+:: #endfor
+}
+
+local of_table_stats_entry_dissectors = {
+:: for version in ir:
+ [${version}] = dissect_of_table_stats_entry_v${version},
+:: #endfor
+}
+
+local of_queue_stats_entry_dissectors = {
+:: for version in ir:
+ [${version}] = dissect_of_queue_stats_entry_v${version},
+:: #endfor
+}
+
function dissect_of_message(buf, root)
local reader = OFReader.new(buf)
local subtree = root:add(p_of, buf(0))
@@ -183,6 +225,51 @@
return info
end
+function dissect_of_port_desc(reader, subtree, version_val)
+ local info = "unknown"
+ if of_port_desc_dissectors[version_val] then
+ info = of_port_desc_dissectors[version_val](reader, subtree)
+ end
+
+ return info
+end
+
+function dissect_of_flow_stats_entry(reader, subtree, version_val)
+ local info = "unknown"
+ if of_flow_stats_entry_dissectors[version_val] then
+ info = of_flow_stats_entry_dissectors[version_val](reader, subtree)
+ end
+
+ return info
+end
+
+function dissect_of_port_stats_entry(reader, subtree, version_val)
+ local info = "unknown"
+ if of_port_stats_entry_dissectors[version_val] then
+ info = of_port_stats_entry_dissectors[version_val](reader, subtree)
+ end
+
+ return info
+end
+
+function dissect_of_table_stats_entry(reader, subtree, version_val)
+ local info = "unknown"
+ if of_table_stats_entry_dissectors[version_val] then
+ info = of_table_stats_entry_dissectors[version_val](reader, subtree)
+ end
+
+ return info
+end
+
+function dissect_of_queue_stats_entry(reader, subtree, version_val)
+ local info = "unknown"
+ if of_queue_stats_entry_dissectors[version_val] then
+ info = of_queue_stats_entry_dissectors[version_val](reader, subtree)
+ end
+
+ return info
+end
+
-- of dissector function
function p_of.dissector (buf, pkt, root)
local offset = 0