1 | initial version |
Not pretty but does it work for your captures with more bodyTypes?
message_type_all.lua
(replaces message_type_v2x.lua
)
do local protobuf_field_table = DissectorTable.get("protobuf_field") local message_type_dissector = Dissector.get("protobuf") protobuf_names_f = Field.new("protobuf.field.name") protobuf_values_f = Field.new("protobuf.field.value") proto_message_type = Proto("message_type_dissector", "All types") proto_message_type.dissector = function(tvb, pinfo, subtree) local bodytypes = { ["00"] = "BodyType_UNSPECIFIED", ["01"] = "pb_resp.Response", ["02"] = "pb_hs.Handshake", ["03"] = "pb_v2x.V2X", ["04"] = "pb_rtk.RTK", ["05"] = "pb_sys.System" } finfo_names = { protobuf_names_f() } finfo_values = { protobuf_values_f() } if (#finfo_names > 0) then for k, v in pairs(finfo_names) do -- process data and add results to the tree if string.format("%s", v) == "bodyType" then pinfo.cols.protocol = proto_message_type.name local subsubtree = subtree:add(proto_message_type, tvb()) pinfo.private["pb_msg_type"] = "message," .. string.format("%s", bodytypes[finfo_values[k].display]) pcall(Dissector.call, message_type_dissector, tvb, pinfo, subsubtree) end end end end protobuf_field_table:add("pb_pm.PacketMessage.body", proto_message_type) end