Wireshark-dev: Re: [Wireshark-dev] Lua Tvb and escape caracter
From: didier <[email protected]>
Date: Mon, 29 Mar 2010 13:19:30 +0200
Hi,
Le mardi 16 juin 2009 à 15:34 +0200, cyril leguienne a écrit :
> function netx_proto.dissector(buffer,pinfo,tree)
>     pinfo.cols.protocol = "NetX"
>     packetnum = pinfo.number
>     local subtree_packet = tree:add(netx_proto,buffer(),"NetX Protocol 
> ("..buffer:len()..")")   
>     local msgbufferarray = buffer(1,buffer:len()-2):bytes()--Here I get 
> a byte array containing the data section from the frame
>     local temparray=ByteArray.new()--allocation for a buffering byte array
>     local offset=0
>     for i=0,msgbufferarray:len()-2 do -- I go through the array
>         if (msgbufferarray:get_index(i+1)==0x5C
>             or msgbufferarray:get_index(i+1)==0x10
>             or msgbufferarray:get_index(i+1)==0x13)
>             and msgbufferarray:get_index(i)==0x5C then--here I m looking 
> for escape sequences
>             temparray.append(msgbufferarray:subset(offset,i+1))--if 
> found I get a subset for the array that I append to the buffering array
>             offset=offset+i+1
>         end
>     end
>     msgbuffer = Tvb.new_real(temparray)--Here I try to create a new tvb 
> without escape sequence from the temporary bytearray
Is this stuff working with SVN HEAD?

I'm trying something like:
local msgbufferarray = buffer(ofs, plen):bytes() 
local temparray=ByteArray.new()
temparray.append(msgbufferarray:subset(0,plen))
  
But get the following error:
Lua Error: [string "/tmp/eris.lua"]:307: bad argument #2 to
'append' (userdata expected, got no value)

Thanks
Didier