Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions wireshark-sbn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ local proto_sbn_type =

local proto_sbn_cpuid = ProtoField.uint32("cfs_sbn.CPUID", "CPUID", base.DEC)

local proto_sbn_spacecraftid = ProtoField.uint32("cfs_sbn.SPACECRAFTID", "SPACECRAFTID", base.HEX)

local proto_sbn_version =
ProtoField.string("cfs_sbn.sub.Version", "Version", base.ASCII)

Expand All @@ -39,6 +41,7 @@ proto_sbn.fields = {
proto_sbn_msgsz,
proto_sbn_type,
proto_sbn_cpuid,
proto_sbn_spacecraftid,
proto_sbn_sub,
proto_sbn_version,
proto_sbn_sub_cnt,
Expand All @@ -52,28 +55,41 @@ function proto_sbn.dissector(buffer, pinfo, tree)
local subtree = tree:add(proto_sbn, buffer(), "SBN Data")
local offset = 0

-- Size (2 B)
subtree:add(proto_sbn_msgsz, buffer(offset, 2))
offset = offset + 2

-- Type (1 B)
subtree:add(proto_sbn_type, buffer(offset, 1))
local msgtype = buffer(offset, 1):uint()
offset = offset + 1

subtree:add(proto_sbn_cpuid, buffer(3, 4))
-- CPUID (4 B)
subtree:add(proto_sbn_cpuid, buffer(offset, 4))
offset = offset + 4

-- SpacecraftID (4 B)
subtree:add(proto_sbn_spacecraftid, buffer(offset, 4))
offset = offset + 4

if msgtype == 1 then -- sub
-- Version (48 B)
subtree:add(proto_sbn_version, buffer(offset, 48))
offset = offset + 48
end

if msgtype == 1 or msgtype == 2 then -- sub/unsub
-- Count (2 B)
subtree:add(proto_sbn_sub_cnt, buffer(offset, 2))
local sub_cnt = buffer(offset, 2):uint()
offset = offset + 2

for i = 0, sub_cnt - 1, 1 do
subtree:add(proto_sbn_sub_mid, buffer(offset, 2))
-- MID (4 B)
subtree:add(proto_sbn_sub_mid, buffer(offset, 4))
offset = offset + 4

-- QOS (2 B) - ignored
offset = offset + 2
end
end
Expand Down