diff --git a/mvrxchange_dissector/mvrxchange.lua b/mvrxchange_dissector/mvrxchange.lua index 08b78bae..3639a02c 100644 --- a/mvrxchange_dissector/mvrxchange.lua +++ b/mvrxchange_dissector/mvrxchange.lua @@ -25,10 +25,11 @@ mvrxchange.fields.message_ver_major = ProtoField.string('mvrxchange.message_ver_ mvrxchange.fields.message_ver_minor = ProtoField.string('mvrxchange.message_ver_minor', "MESSAGE_VER_MINOR") mvrxchange.fields.message_comment = ProtoField.string('mvrxchange.message_comment', "MESSAGE_COMMENT") mvrxchange.fields.message_commits = ProtoField.string('mvrxchange.message_commits', "MESSAGE_COMMITS") +mvrxchange.fields.message_files = ProtoField.string('mvrxchange.message_files', "MESSAGE_FILES") mvrxchange.fields.message_station_uuid = ProtoField.string('mvrxchange.message_station_uuid', "MESSAGE_STATION_UUID") mvrxchange.fields.message_from_station_uuid = ProtoField.string('mvrxchange.message_from_station_uuid', "MESSAGE_FROM_STATION_UUID") mvrxchange.fields.message_file_uuid = ProtoField.string('mvrxchange.message_file_uuid', "MESSAGE_FILE_UUID") - +mvrxchange.fields.message_errors = ProtoField.string('mvrxchange.message_errors', "MESSAGE_ERRORS") function process_message(data, subtree) @@ -54,20 +55,34 @@ function process_message(data, subtree) subtree:add(mvrxchange.fields.message_comment):append_text(data["Comment"]) end if data["Commits"] ~= nil then - subtree:add(mvrxchange.fields.message_commits):append_text("Number:" .. tostring(#data["Commits"]) .. "") + subtree:add(mvrxchange.fields.message_commits):append_text("" .. tostring(#data["Commits"]) .. "") + end + + if data["Files"] ~= nil then + errsubtree = subtree:add(mvrxchange.fields.message_files):append_text("Number:" .. tostring(#data["Files"]) .. "") + errsubtree:add_expert_info(PI_MALFORMED, PI_WARN, "Wrong field, should be Commits") end if data["StationName"] ~= nil then subtree:add(mvrxchange.fields.message_station_name):append_text(data["StationName"]) end if data["StationUUID"] ~= nil then - subtree:add(mvrxchange.fields.message_station_uuid):append_text(data["StationUUID"]) + errsubtree = subtree:add(mvrxchange.fields.message_station_uuid):append_text(data["StationUUID"]) + if (data["StationUUID"] == "00000000-0000-0000-0000-000000000000") or (data["StationUUID"] == "") then + errsubtree:add_expert_info(PI_MALFORMED, PI_WARN, "UUID should not be empty or 0") + end end if data["FileUUID"] ~= nil then - subtree:add(mvrxchange.fields.message_file_uuid):append_text(data["FileUUID"]) + errsubtree = subtree:add(mvrxchange.fields.message_file_uuid):append_text(data["FileUUID"]) + if data["FileUUID"] == "00000000-0000-0000-0000-000000000000" then + errsubtree:add_expert_info(PI_MALFORMED, PI_WARN, "UUID can be empty or UUID but should not be 0") + end end if data["FromStationUUID"] ~= nil then if is_not_table(data["FromStationUUID"]) then - subtree:add(mvrxchange.fields.message_from_station_uuid):append_text(data["FromStationUUID"]) + errsubtree = subtree:add(mvrxchange.fields.message_from_station_uuid):append_text(data["FromStationUUID"]) + if data["FromStationUUID"] == "" then + errsubtree:add_expert_info(PI_MALFORMED, PI_WARN, "Should not be empty") + end end end end