dissect-wireshark: display type+name in Info column
refs #3105
Change-Id: If8887282af9bdf53214bdd4727da3d5a7899f8d0
diff --git a/tools/dissect-wireshark/ndn.lua b/tools/dissect-wireshark/ndn.lua
index 1ae18fd..13b8a8c 100755
--- a/tools/dissect-wireshark/ndn.lua
+++ b/tools/dissect-wireshark/ndn.lua
@@ -1,4 +1,4 @@
--- Copyright (c) 2015-2016, Regents of the University of California.
+-- Copyright (c) 2015-2018, Regents of the University of California.
--
-- This file is part of ndn-tools (Named Data Networking Essential Tools).
-- See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -410,6 +410,9 @@
local nBytesLeft = tvb:len() - block.offset
-- print (pInfo.number .. ":: Found block: " .. block.type .. " of length " .. block.size .. " bytesLeft: " .. nBytesLeft)
+ local pktType = ""
+ local pktName = ""
+
while (block.size <= nBytesLeft) do
-- Create TreeItems
block.tree = root:add(ndn, tvb(block.offset, block.size))
@@ -445,6 +448,19 @@
end
block.visited = true
end
+
+ -- prepare information to fill info column
+ if block.type == 5 and pktType ~= "Nack" then
+ pktType = "Interest"
+ elseif block.type == 6 then
+ pktType = "Data"
+ elseif block.type == 800 then
+ pktType = "Nack"
+ end
+
+ if pktName == "" and block.type == 7 then
+ pktName = getUriFromName(block)
+ end
end
local info = NDN_DICT[block.type]
@@ -467,6 +483,7 @@
end -- while(block.size <= nBytesLeft)
pInfo.cols.protocol = tostring(pInfo.cols.protocol) .. " (" .. ndn.name .. ")"
+ pInfo.cols.info = pktType .. " " .. pktName
if (nBytesLeft > 0 and block ~= nil and block.size ~= nil and block.size > nBytesLeft) then
pInfo.desegment_offset = tvb:len() - nBytesLeft
@@ -492,3 +509,4 @@
ethernetDissectorTable:add(0x8624, ndn)
io.stderr:write("ndn.lua is successfully loaded\n")
+