proto = Proto("NIFI", "Nintendo DS ni-fi") MAGIC = ProtoField.uint32("nifi.magic", "Magic", base.HEX) SENDERID = ProtoField.int32("nifi.senderid", "SenderID", base.DEC) TYPE = ProtoField.uint32("nifi.type", "Type", base.DEC) LENGTH = ProtoField.uint32("nifi.length", "Length", base.DEC) TIMESTAMP = ProtoField.uint64("nifi.timestamp", "Timestamp", base.DEC) proto.fields = { MAGIC, SENDERID, TYPE, LENGTH, TIMESTAMP, } function proto.dissector(buffer, pinfo, tree) -- check magic ("NIFI") if buffer(0, 4):uint() ~= 0x4e494649 then return end pinfo.cols.protocol = proto.name local subtree = tree:add(proto, buffer(), "Ni-Fi data") subtree:add(MAGIC, buffer(0, 4)) subtree:add_le(SENDERID, buffer(4, 4)) pinfo.cols.src = tostring(buffer(4, 4):le_int()) subtree:add_le(TYPE, buffer(8, 4)) subtree:add_le(LENGTH, buffer(12, 4)) subtree:add_le(TIMESTAMP, buffer(16, 8)) end