Wireshark-dev: Re: [Wireshark-dev] Lua Tvb and escape caracter
From: Cyril Le Guienne <cleguienne@xxxxxxxxx>
Date: Thu, 18 Jun 2009 08:23:37 +0200
Yes that's the way I found it too. I'll post a message later that day on
that particular subject
Thanks
Perhaps you can try (I do not test): temparray.tvb() I found this from epan/wslua/wslua_tvb.c by searching new_real. Perhaps http://www.wireshark.org/docs/wsug_html_chunked/wsluarm_modules.html is outdated?On Tue, Jun 16, 2009 at 9:34 PM, cyril leguienne <cleguienne@xxxxxxxxx <mailto:cleguienne@xxxxxxxxx>> wrote:Hello everybody, I don't know if it is the right place to ask the question, let me know if not. I am currently writting a simple dissector using lua for a proprietary protocol. This protocol is quite basic ,i.e : frame start character+ data + frame stop character . But the problem is that the data field can contain frame start or stop characters that must be escaped with an escape character. In order to pass the data field to another dissector I have to remove the escape characters from the tvb before. But there are no function to remove data from a tvb nor a tvbrange nor byte array. I then wrote the following code: 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 I then have an runtime error telling me "attempt to call field 'new_real'(a nil value)". I'm quite puzzled as I can't find an example of Tvb creation in the documentation and in forums. If someone could give me a clue about how to solve my problem. Thanks Cyril ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx <mailto:wireshark-dev@xxxxxxxxxxxxx>> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx <mailto:wireshark-dev-request@xxxxxxxxxxxxx>?subject=unsubscribe ------------------------------------------------------------------------ ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
- References:
- [Wireshark-dev] Lua Tvb and escape caracter
- From: cyril leguienne
- Re: [Wireshark-dev] Lua Tvb and escape caracter
- From: yami
- [Wireshark-dev] Lua Tvb and escape caracter
- Prev by Date: Re: [Wireshark-dev] Lua Tvb and escape caracter
- Next by Date: [Wireshark-dev] Slow Protocol Subtype 0x0a ?
- Previous by thread: Re: [Wireshark-dev] Lua Tvb and escape caracter
- Next by thread: Re: [Wireshark-dev] Wire Shark does not open on
- Index(es):