function tm_get_sband_version(buffer, pinfo, tree, sband_version, offset) -- Define ProtoFields local f_file_cnt = ProtoField.uint8("sband_version.file_cnt", "File Count", base.DEC) local f_file_name_cnt = ProtoField.uint8("sband_version.file_name_cnt", "File Name Count", base.DEC) local f_seconds = ProtoField.uint8("sband_version.seconds", "Seconds", base.DEC) local f_minutes = ProtoField.uint8("sband_version.minutes", "Minutes", base.DEC) local f_hours = ProtoField.uint8("sband_version.hours", "Hours", base.DEC) local f_year = ProtoField.uint16("sband_version.year", "Year", base.DEC) local f_months = ProtoField.uint8("sband_version.months", "Months", base.DEC) local f_day = ProtoField.uint8("sband_version.day", "Day", base.DEC) local f_file_name = ProtoField.bytes("sband_version.file_name", "File Name") local f_start_adr = ProtoField.uint32("sband_version.start_adr", "Start Address", base.HEX) local f_len = ProtoField.uint32("sband_version.len", "Length", base.DEC) local f_flags = ProtoField.uint8("sband_version.flags", "Flags", base.HEX) -- Register the fields in the protocol sband_version.fields = { f_file_cnt, f_file_name_cnt, f_seconds, f_minutes, f_hours, f_year, f_months, f_day, f_file_name, f_start_adr, f_len, f_flags } -- Create the subtree for `version_date_struct` local subtree = tree:add(sband_version, buffer(), "TM GET SBAND VERSION") -- Parse `file_cnt` local cnt = buffer(offset, 1):le_uint() subtree:add(f_file_cnt, buffer(offset, 1)) offset = offset + 1 -- Parse `file_name_cnt` --subtree:add(f_file_name_cnt, buffer(offset, 1)) --offset = offset + 1 -- Parse `VERSION_DATE_STRUCT` for i = 0 , cnt - 1 do local version_subtree = subtree:add(buffer(offset), "VERSION_DATE_STRUCT") -- Parse the packed date/time fields (32 bits) local date_time_value = buffer(offset, 4):le_uint() version_subtree:add(f_seconds, (date_time_value & 0x3F)) -- 6 bits version_subtree:add(f_minutes, ((date_time_value >> 6) & 0x3F)) -- 6 bits version_subtree:add(f_hours, ((date_time_value >> 12) & 0x1F)) -- 5 bits version_subtree:add(f_year, ((date_time_value >> 17) & 0x3F)) -- 6 bits version_subtree:add(f_months, ((date_time_value >> 23) & 0x0F)) -- 4 bits version_subtree:add(f_day, ((date_time_value >> 27) & 0x1F)) -- 5 bits offset = offset + 4 -- Parse `FileName` (4 bytes) version_subtree:add(f_file_name, buffer(offset, 4)) offset = offset + 4 -- Parse `start_adr` (32 bits) version_subtree:add_le(f_start_adr, buffer(offset, 4)) offset = offset + 4 -- Parse the packed `len` and `Flags` fields (32 bits) local len_flags_value = buffer(offset, 4):le_uint() version_subtree:add(f_len, (len_flags_value & 0x0FFFFFFF)) -- 28 bits version_subtree:add(f_flags, ((len_flags_value >> 28) & 0x0F)) -- 4 bits offset = offset + 4 end end