Object Layer

Packet contents at a given protocol layer.

Methods

Name In Out Description
layer_bytes number Number of bytes at this layer. Example: UDP layer has 8 bytes
protocol_id a GUID The GUID of the protocol
rawbytes a Buffer object Raw bytes
total_bytes number Total number bytes in the packet, i.e. same as Packet:wire_length()
packet a Packet object The full packet
testbit bitno bool Test if a bit is set in this layer. Bits are numbered serially from 0 to 8*layer_bytes-1 This is a shortcut for layer:rawbytes():hval_8(bitno/8)
You are encouraged to use testbit because it increases performance by reducing Lua-C round trips.
getbyte offset number Get a byte at this offset. Shortcut for layer:rawbytes():hval_8(offset)
You are encouraged to use getbyte because it increases performance by reducing Lua-C round trips.
flowkey string get the flowkey string for the packet. this is equivalent to layer:packet():flowid():id() but more efficient by avoiding 3 round trips.