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
|
local nifi = Proto("nifi", "Nintendo DS Ni-Fi")
nifi.fields.magic = ProtoField.uint32("nifi.magic", "Magic", base.HEX)
nifi.fields.senderid = ProtoField.int32("nifi.senderid", "SenderID", base.DEC)
nifi.fields.type = ProtoField.new("Type", "nifi.type", ftypes.UINT32)
nifi.fields.type_enum = ProtoField.uint16("nifi.type.enum", "Numeric message type enum", base.DEC, {
[0] = "Regular",
[1] = "CMD",
[2] = "Reply",
[3] = "ACK",
})
nifi.fields.type_aid = ProtoField.uint16("nifi.type.aid", "Message type \"aid\" value")
nifi.fields.length = ProtoField.uint32("nifi.length", "Length", base.DEC)
nifi.fields.timestamp = ProtoField.uint64("nifi.timestamp", "Timestamp", base.DEC)
local nifi_senderid_field = Field.new("nifi.senderid")
local nifi_type_enum_field = Field.new("nifi.type.enum")
function nifi.dissector(buffer, pinfo, tree)
-- check magic ("NIFI")
if buffer(0x00, 4):uint() ~= 0x4e494649 then return end
local nifi_tree = tree:add(nifi, buffer(0, 0x18), "Ni-Fi Header: 24 bytes")
nifi_tree:add(nifi.fields.magic, buffer(0x00, 4))
nifi_tree:add_le(nifi.fields.senderid, buffer(0x04, 4))
local nifi_type_tree = nifi_tree:add_le(nifi.fields.type, buffer(0x08, 4))
nifi_type_tree:add_le(nifi.fields.type_enum, buffer(0x08, 2))
nifi_type_tree:add_le(nifi.fields.type_aid, buffer(0x0a, 2))
nifi_tree:add_le(nifi.fields.length, buffer(0x0c, 4))
nifi_tree:add_le(nifi.fields.timestamp, buffer(0x10, 8))
pinfo.cols.protocol = nifi.name
pinfo.cols.src = nifi_senderid_field().display
pinfo.cols.info = "type:" .. nifi_type_enum_field().display
return 0x18
end
|