-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprodigy_tocs.lua
33 lines (25 loc) · 1.24 KB
/
prodigy_tocs.lua
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
local M = {}
------------------------------
-- TOCS: Trintex Object Caching Subsystem
------------------------------
local tocs_proto = Proto("TOCS", "Trintex Object Caching Subsystem")
tocs_proto.fields.packet_seq = ProtoField.uint8("tocs.packet_seq", "TOCS Message Sequence", base.DEC)
tocs_proto.fields.block_num = ProtoField.uint8("tocs.block_num", "TOCS Message Block Number", base.DEC)
tocs_proto.fields.blocks_tot = ProtoField.uint8("tocs.block_tot", "TOCS Message Blocks Total", base.DEC)
tocs_proto.fields.obj_len = ProtoField.uint16("tocs.obj_len", "TOCS Object Length", base.DEC)
tocs_proto.fields.object = ProtoField.bytes("tocs.object", "TOCS Object")
function tocs_proto.dissector(tvb, pinfo, subtree)
pinfo.cols.protocol = "TOCS"
subtree:add(tocs_proto.fields.packet_seq, tvb(1,1))
subtree:add(tocs_proto.fields.block_num, tvb(2,1))
subtree:add(tocs_proto.fields.blocks_tot, tvb(3,1))
subtree:add(tocs_proto.fields.obj_len, tvb(4, 2))
local obj_len = tvb(4,2):uint()
if obj_len == 0 then
subtree:add_expert_info(PI_PROTOCOL, PI_CHAT, "TOCS indicates the client has the latest version of the requested object")
else
subtree:add(tocs_proto.fields.object, tvb(6, obj_len))
end
end
M.proto = tocs_proto
return M