Reputation: 13
I'm trying to read a float variable from the buffer but i'm getting a zero value. This is the code i used:
-- Create fields
str_format=string.format
p_Genie.fields = {}
local fields = p_Genie.fields
fields.number_field = ProtoField.float("p_Genie.number", "Number",base.DEC)
function addFloat32(tree, buf, start, name, floatSize)
local rang = buf(start, floatSize)
local ti = tree:add_le(fields.number_field, rang)
ti:set_text(str_format("%s %f", name, rang:le_float()))
return floatSize
end
What am i doing wrong? Thanks.
Upvotes: 0
Views: 492
Reputation: 6264
I don't think your use of ProtoField.float is correct. According to Section 11.6.7.16 of the Wireshark Developer's Guide, the 3rd argument is an optional valuestring, not a base. Maybe start by fixing that and see if it resolves your problem.
Upvotes: 1