lua-users home
lua-l archive

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


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 ="udp.length")
function InDirectmip_proto.dissector(buffer,pinfo,tree)
        print(udp_len_f ( ))
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());
print (" I got exception");
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