Skip to main content

Object Layer

Packet contents at a given protocol layer.

Methods

NameInOutDescription
layer_bytesnumberNumber of bytes at this layer. Example: UDP layer has 8 bytes
protocol_ida GUIDThe GUID of the protocol
rawbytesa Buffer objectRaw bytes
total_bytesnumberTotal number bytes in the packet, i.e. same as Packet:wire_length()
packeta Packet objectThe full packet
testbitbitnoboolTest if a bit is set in this layer. Bits are numbered serially from 0 to 8layer_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.
getbyteoffsetnumberGet 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.
flowkeystringget the flowkey string for the packet. this is equivalent to layer:packet():flowid():id() but more efficient by avoiding 3 round trips.