lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I am writing LUA disectors for Wireshark packets. I am seeing that my disectors are getting called multiple times for a packet. I am calculating udp packet length as below
 
udp_len_f = Field.new("udp.length")
 
function InDirectmip_proto.dissector(buffer,pinfo,tree)
 
        print(udp_len_f ( ))
 
end
 
But in second call of disectors, udp length is coming null. I don't know for what packet this is being called?
 
Also I have created tree to add my own user defined information in wireshark tree as
 
stmpsecuritytree = tree:add(InDirectmip_proto,buffer(),"STMP SECURITY HEADER");
stmptree = tree:add(InDirectmip_proto,buffer(),"STMP DATA HEADER");
subtree = tree:add(InDirectmip_proto,buffer(),"ST DATA")
 
res, status = pcall (udp_len_f )
 
if( res) then
 
stmpsecuritytree:add(buffer(0,1)," STMP Message length: " .. udp_len_f());
 
else
print (" I got exception");
 
end
 
Here at call of pcall (udp_len_f ) , res is printing as false in second call. It means function udp_len_f () has thrown exception in second call. Due to this exception my message "STMP Message length" is not added in the wireshark tree.
 
 
I want to handle the exception in following if failed
 
                stmpsecuritytree:add(buffer(0,1)," STMP Message length: " .. udp_len_f());
 
in lua when I am calling above API.
 
 
Please help me in this regard.
 
Thanks in Advance
Awadhesh.