help with LUA + ipv4 + append_text
in a LUA script I've multiple TLV tree items. Inside each tree item I'm able to visualize different type of variables, ie ipv4 addresses:
f.tlvvalue_ipv4 = ProtoField.ipv4 ("myproto.tlvvalue_ipv4", "TLV Value")
tlv_tree:add (f.tlvvalue_ipv4, buffer(offset, tlvlen))
Now I would like to repeat the same information (ipv4 address) in the append_text as well so it get visible avoiding to expand that specific tree item first.
For string I can do:
local tlvvalue_string=buffer(offset+4, tlvlen):string()
tlv_tree:append_text (", Value: " .. tlvvalue_string)
but not sure how to visualize the ipv4 or numbers...
So suppose buffer(offset+4, tlvlen) points to an ipv4.... how to print it with the append_text ?
Appreciated any help!!!
From a google search I found the following: "To print the address in the display tree, you need to find a way to convert those bytes to a string, or else find a different datatree:add() method that accepts the ipv4 format data. (If you can find the latter, that would be the better solution.)"
Is there any function that converts hex strings into printable ipv4 string ?
ie:
does provide:
Thx