aboutsummaryrefslogtreecommitdiff
path: root/wireshark/nifi-dissect.lua
diff options
context:
space:
mode:
Diffstat (limited to 'wireshark/nifi-dissect.lua')
-rw-r--r--wireshark/nifi-dissect.lua32
1 files changed, 32 insertions, 0 deletions
diff --git a/wireshark/nifi-dissect.lua b/wireshark/nifi-dissect.lua
new file mode 100644
index 0000000..98520e5
--- /dev/null
+++ b/wireshark/nifi-dissect.lua
@@ -0,0 +1,32 @@
+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
+