lua-users home
lua-l archive

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


To be more precise I'd like to convert a string into a userdata so I can use that type of function :

function xxx(buf,pkt,tree)

local apdu = buf(0,1):uint()
 local pdu_variant = buf(1,1):uint()
 local t = root:add(proto_dlms,buf(0))
 t:append_text( string.format(" %u Bytes", buf:len() ))

end

Is there a way to convert a string into userdata like buf ? Or the userdata type is specific to the application that returns the variable, and by default if lua doesn't know the type of the variable it call it a userdata?


-----Message d'origine-----
De : lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] De la part de Thijs Schreijer
Envoyé : mardi 9 juin 2015 14:48
À : Lua mailing list
Objet : RE: Wireshark dissector : conversion of string into userdata



> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org]
> On Behalf Of Segreto, Ingrid
> Sent: dinsdag 9 juni 2015 14:40
> To: Lua mailing list
> Subject: Wireshark dissector : conversion of string into userdata
>
> Hi,
>
> I'm working on a wireshark dissector and I have a part of my dissector
> that uses a C#.net dll. The objective is to decipher a part of the
> frame (this is done by the dll) captured by wireshark and to dissect
> the deciphered frame obtained. The problem is that all my dissectors
> functions uses a parameter called "buffer" which has a "userdata" type
> coming from Wireshark, and my dll returns a string.
> Is there a way to convert the string into a userdata ?
>
> I tried to modify my dll to return a byte[] type but I was not able to
> use this variable like "buffer".
>
> I also tried to send back my result on the network on localhost using
> (luasocket) but wireshark doesn't capture the packets in localhost.
>
> Thanks,
>
> Best regards
>
> Ingrid

This pretty much sounds like a wireshark specific problem. I think you're better of asking this question on their support pages or mailing lists.

Thijs