forked from dnlplm/WiresharkQMIDissector
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qmi_dissector_trailer.part
42 lines (38 loc) · 1.28 KB
/
qmi_dissector_trailer.part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
else
mhdrtree:add_le(f.msgid, msgid)
end
mhdrtree:add_le(f.msglen, msglen)
off = off + 4
-- TLVs, see GobiAPI/Core/QMIBuffers.h
local msgend = off + msglen:le_uint()
while off < msgend do
local tlvt = buffer(off, 1)
local tlvl = buffer(off+1, 2)
local tlvv = buffer(off+3, tlvl:le_uint())
local tlv_name_available = pcall(function()
tlv_name = tlv_description[msgid:le_uint()][tlvt:uint()]
end)
if not tlv_name_available then
tlv_name = "Unknown TLV"
end
if tlv_name == nil then
tlv_name = "Unknown TLV"
end
local treesize = tlvl:le_uint() + 3
local treename = string.format("TLV 0x%.2x %s", tlvt:uint(), tlv_name)
local tlvtree = qmitree:add(qmi_proto, buffer(off, treesize), treename)
tlvtree:add(f.tlvt, tlvt)
tlvtree:add_le(f.tlvl, tlvl)
tlvtree:add(f.tlvv, tlvv)
off = off + treesize
end
-- Setup columns
local svcstr = services[svcid:uint()] and
services[svcid:uint()] or string.format("0x%x", svcid:uint())
local typestr = indicationbit == 1 and
"Indication" or responsebit == 1 and "Response" or "Request"
msgstr = msgstr ~= nil and msgstr or string.format("0x%x", msgid:le_uint())
pinfo.cols.protocol:append("/QMI")
pinfo.cols.info:append(string.format(", %s %s: %s", svcstr, typestr, msgstr))
end
register_postdissector(qmi_proto)