Comment # 12
on bug 10801
from Hadriel Kaplan
OK, found the issue.
The problem is you're trying to get the ByteArray value of a *Protocol* field -
not a regular field, but the Protocol itself. I.e., the field named "h264"
isn't a normal field, but instead a protocol. (in the C-code, it's a
FT_PROTOCOL type)
So apparently there's a bug in Wireshark for how it handles a protocol field.
I know where and what the bug is, so I'll submit a fix. (as soon as I can get
my wireshark dev environment working again - it's not working right now)
In the meantime, what you can successfully do is get the protocol field's
TvbRange object, and from that convert it into a ByteArray.
So like this:
local f_h264 = Field.new("h264")
local my_h264_tap = Listener.new("frame", "h264")
local tw = TextWindow.new("Export H264 to File Info Win")
function twappend(str)
tw:append(str)
tw:append("\n")
end
function my_h264_tap.packet(pinfo,tvb)
local h264s = { f_h264() }
for i,h264_f in ipairs(h264s) do
if h264_f.len < 2 then
return
end
-- get a TvbRange of the field
local h264tvb = h264_f.tvb
-- get ByteArray from TvbRange
local h264 = h264tvb:bytes()
twappend("========>id:" .. tostring(pinfo.number) .. " what:" ..
h264:get_index(0));
end
end
You are receiving this mail because:
- You are watching all bug changes.