Wireshark-dev: Re: [Wireshark-dev] How to print longs from Lua?

From: philippe alarcon <philippe.alarcon@xxxxxxx>
Date: Tue, 30 Mar 2010 20:45:15 +0200

Hello Beth,


I have used this to display a L2 address of 4 bytes :


subtreeitem:add(tvbuffer(b_offset,4), "L2 address : " .. string.format('%08X',tvbuffer(b_offset,4):uint()) .. "h")

May be you can try to use this 2 times for every set of 4 bytes.


I hope this will help you.


Best Regards
Philippe



Date: Tue, 30 Mar 2010 13:35:47 -0400
From: beth.tridium@xxxxxxxxx
To: wireshark-dev@xxxxxxxxxxxxx
Subject: [Wireshark-dev] How to print longs from Lua?

I'm writing a Lua post-dissector, where I wish to print MAC addresses (64-bit ints) to a Lua text window.  I can't seem to get it to work.

The best I can do so far is  "tostring(mac_addr)"  which prints the decimal equivalent of the lower 32 bits of the address.  What I would like is to print all 64 bits in hex.  I know that the "l" modifier normally used in printf/scanf etc (e.g. %lx) is not supported in Lua, so how do I print out this value?

If there is no way to print all 64 bits, then is there a way to split the value into upper and lower halves so that I can print each separately?

Thanks very much,
Beth





Télécharger en toute sécurité sur Internet ? La solution avec Internet Explorer 8