It depends in how you want the char:
- a one byte unsigned integer can be taken with u = tvb(offset,1):get_uint()
- a string containing just one char (supposing it's printable) would
be taken with str = tvb(offset,1):get_string()
- a bytearray that contains just one char would be ba =
tvb(offset,1):get_bytes()
the you can fetch the value of the first byte with ba[0]
Luis
On 9/28/06, Ahad L. Amdani <ahad.amdani@xxxxxxxx> wrote:
Ahad L. Amdani <ahad.amdani@...> writes:
>
> Hello,
>
> I'm doing some extension development on Wireshark through LUA and I can't
seem
> to find out how to pull just a single character from the packet. The packet
is
> encoded in little endian format, so I can use the tvbrange:le_uint and
> tvbrange:le_float functions to pull those types of values, but there doesn't
> seem to be a tvbrange:char() -- there is a tvbrange:string() but it doesn't
> work correctly, or at least, in my experience. I also tried the bytes() and
> tried to print out the bytearray, but that didn't work either.
>
I've just read that LUA also supports calling functions written in C. Is there
a C-based function pre-defined that takes specified amount of bytes or
characters from the packet? Possibly one that assumes little endian format,
such as the le_uint() and le_float() functions?
Thanks in advance,
Ahad
_______________________________________________
Wireshark-dev mailing list
Wireshark-dev@xxxxxxxxxxxxx
http://www.wireshark.org/mailman/listinfo/wireshark-dev
--
This information is top security. When you have read it, destroy yourself.
-- Marshall McLuhan