How can I read a Buffer in a Little Endian order?
In LUA, wow could I get the number (integer, float,...) from the following bytes -buffer(94,2)- in LITTLE ENDIAN? Afterwords I want to multiply this number by a constant "x".
What I did:
-- First of all, creation of the protofield
somefield = ProtoField.uint16("foo.somefield", "Some Field", base.DEC, nil, 0xffff)
number = tonumber(tostring(buffer(94,2)))
-- I get here the BIG ENDIAN number but I want the LITTLE ENDIAN one
x=2
-- value of the constant
number2 = number*x
subtree:add(somefield,number2)
As I said, with this code I get the BIG ENDIAN order from "number" and I want to get the LITTLE ENDIAN one and store it in "number". I would appreciate a lot if you could help me. Many thanks for your help!
how to invert two bytes in lua script dissector ?