Creates a ByteArray object.
A string consisting of hexadecimal bytes like "00 B1 A2" or "1a2b3c4d".
A string separator between hex bytes/words (default=" "), or if the boolean value true is used, then the first argument is treated as raw binary data
Concatenate two ByteArrays.
Compares two ByteArray values.
Since: 1.11.4
Prepend a ByteArray to this ByteArray.
Append a ByteArray to this ByteArray.
Sets the size of a ByteArray, either truncating it or filling it with zeros.
Sets the value of an index of a ByteArray.
Get the value of a byte in a ByteArray.
Obtain the length of a ByteArray.
Obtain a segment of a ByteArray, as a new ByteArray.
The position of the first byte (0=first).
The length of the segment.
Obtain a base64 decoded ByteArray.
Obtain a Lua string of the binary bytes in a ByteArray.
The position of the first byte (default=0/first).
The length of the segment to get (default=all).
Obtain a Lua string of the bytes in a ByteArray as hex-ascii, with given separator
True to use lower-case hex characters (default=false).
A string separator to insert between hex bytes (default=nil).
A Tvb represents the packet's buffer. It is passed as an argument to listeners and dissectors, and can be used to extract information (via TvbRange) from the packet's data.
To create a TvbRange the Tvb must be called with offset and length as optional arguments; the offset defaults to 0 and the length to tvb:len().
![]() | Warning |
---|---|
Tvbs are usable only by the current listener or dissector call and are destroyed as soon as the listener/dissector returns, so references to them are unusable once the function has returned. |
Creates a new Tvb from a ByteArray (it gets added to the current frame too).
Creates a (sub)Tvb from a TvbRange.
Convert the bytes of a Tvb into a string, to be used for debugging purposes as '...' will be appended in case the string is too long.
Obtain the reported (not captured) length of a Tvb.
Obtain the actual (captured) length of a Tvb.
Obtain the reported (not captured) length of packet data to end of a Tvb or -1 if the offset is beyond the end of the Tvb.
Returns the raw offset (from the beginning of the source Tvb) of a sub Tvb.
A TvbRange represents a usable range of a Tvb and is used to extract data from the Tvb that generated it.
TvbRanges are created by calling a Tvb (e.g. 'tvb(offset,length)'). If the TvbRange span is outside the Tvb's range the creation will cause a runtime error.
Creates a TvbRange from this Tvb.
The offset (in octets) from the beginning of the Tvb. Defaults to 0.
The length (in octets) of the range. Defaults to until the end of the Tvb.
Obtain a Lua string of the binary bytes in a Tvb.
The position of the first byte (default=0/first).
The length of the segment to get (default=all).
Get a Big Endian (network order) unsigned integer from a TvbRange. The range must be 1, 2, 3 or 4 octets long.
Get a Little Endian unsigned integer from a TvbRange. The range must be 1, 2, 3 or 4 octets long.
Get a Big Endian (network order) unsigned 64 bit integer from a TvbRange, as a UInt64 object. The range must be 1-8 octets long.
Get a Little Endian unsigned 64 bit integer from a TvbRange, as a UInt64 object. The range must be 1-8 octets long.
Get a Big Endian (network order) signed integer from a TvbRange. The range must be 1, 2 or 4 octets long.
Get a Little Endian signed integer from a TvbRange. The range must be 1, 2 or 4 octets long.
Get a Big Endian (network order) signed 64 bit integer from a TvbRange, as an Int64 object. The range must be 1-8 octets long.
Get a Little Endian signed 64 bit integer from a TvbRange, as an Int64 object. The range must be 1-8 octets long.
Get a Big Endian (network order) floating point number from a TvbRange. The range must be 4 or 8 octets long.
Get a Little Endian floating point number from a TvbRange. The range must be 4 or 8 octets long.
Get an IPv4 Address from a TvbRange, as an Address object.
Get an Little Endian IPv4 Address from a TvbRange, as an Address object.
Get an Ethernet Address from a TvbRange, as an Address object.
Obtain a time_t structure from a TvbRange, as an NSTime object.
Obtain a nstime from a TvbRange, as an NSTime object.
Obtain a string from a TvbRange.
Obtain a Big Endian (network order) UTF-16 encoded string from a TvbRange.
Obtain a Little Endian UTF-16 encoded string from a TvbRange.
Obtain a zero terminated string from a TvbRange.
Find the size of a zero terminated string from a TvbRange. The size of the string includes the terminating zero.
Obtain a Big Endian (network order) UTF-16 encoded zero terminated string from a TvbRange.
Obtain a Little Endian UTF-16 encoded zero terminated string from a TvbRange
Obtain a ByteArray from a TvbRange.
Starting in 1.11.4, this function also takes an optional encoding argument, which can be set to ENC_STR_HEX to decode a hex-string from the TvbRange into the returned ByteArray. The encoding can be bitwise-or'ed with one or more separator encodings, such as ENC_SEP_COLON, to allow separators to occur between each pair of hex characters.
The return value also now returns the number of bytes used as a second return value.
On failure or error, nil is returned for both return values.
![]() | Note |
---|---|
The encoding type of the hex string should also be set, for example ENC_ASCII or ENC_UTF_8, along with ENC_STR_HEX. |
Get a bitfield from a TvbRange.
The bit offset from the beginning of the TvbRange. Defaults to 0.
The length (in bits) of the field. Defaults to 1.
Creates a sub-TvbRange from this TvbRange.
The offset (in octets) from the beginning of the TvbRange. Defaults to 0.
The length (in octets) of the range. Defaults to until the end of the TvbRange.
The name to be given to the new data-source.
Obtain a Lua string of the binary bytes in a TvbRange.
The position of the first byte (default=0/first).
The length of the segment to get (default=all).