| 1 | initial version |
(I used the field processing loop from EASYPOST.lua )
To add a bytes field to the tree, specify the tvb:
11.7.1. TreeItem
11.7.1.2. treeitem:add([protofield], [tvbrange], [value], [label])
subtree:add(rawMessage, v.tvb)
If you just to want a string displaying the value then define the field as a string not bytes.
local msgData = Field.new('btcommon.eir_ad.entry.data')
local bgNotificationData = Proto('bgadv', 'Background Notification Data')
local rawMessage = ProtoField.bytes('bgadv.data')
bgNotificationData.fields =
{
rawMessage,
}
function bgNotificationData.dissector(tvb, pinfo, tree)
local subtree = nil
-- copy existing field(s) into table for processing
finfo = { msgData() }
if (#finfo > 0) then
if not subtree then
subtree = tree:add(bgNotificationData, btMsgData, "Message Data")
end
for k, v in pairs(finfo) do
-- process data and add results to the tree
subtree:add(rawMessage, v.tvb)
end
end
end
register_postdissector(bgNotificationData)