Extracting timestamp in lua
I am trying to extract the timestamp so I figure the following fields:
abs_time, utc_time, cls_time, rel_time
are containing the timestamp I need. Unfortunately, I got errors. According to Wireshark's official website:
One can extract those fields from the "pinfo" variable.
local function init_listener()
local tap = Listener.new("ip",filter_packets)
local ipid = Field.new("ip.id")
function tap.reset()
packets = 0;
end
function tap.packet(pinfo,tvb,ip)
-- as requested, double check with the previous code results.
-- tried this didn't worked..
local val1 = pinfo.abs_time
-- also want to extract those in the same manner ..
local val2 = pinfo.utc_time
local val3 = pinfo.cls_time
local val4 = pinfo.rel_time
-- omitted
end
function tap.draw()
print("Applying filter: " .. "\"" .. filter_packets .. "\"",packets)
end
end
So I have two questions :
- Is it true that those fields hold the timestamp of a packet header?
- How do I extract those fields in lua script?