suricata
packet-bindgen.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct Packet_ Packet
 
typedef struct Flow_ Flow
 

Enumerations

enum  PacketL3Types { PACKET_L3_UNKNOWN = 0, PACKET_L3_IPV4, PACKET_L3_IPV6, PACKET_L3_ARP }
 

Functions

uint8_t SCPacketGetIPProto (const Packet *p)
 Get IP proto regardless of IP version. More...
 
bool SCPacketIsToServer (const Packet *p)
 Test whether the packet is marked as flowing to the server. More...
 
bool SCPacketIsToClient (const Packet *p)
 Test whether the packet is marked as flowing to the client. More...
 
enum PacketL3Types SCPacketGetL3Type (const Packet *p)
 Get the type of the packet's L3 layer. More...
 
const uint8_t * SCPacketGetL3 (const Packet *p, uint32_t *len)
 Get the L3 packet data, starting at the L3 header. More...
 
Flow * SCPacketGetFlow (const Packet *p)
 Get the flow associated with the packet. More...
 
void SCPacketGetTimeAsParts (const Packet *p, uint64_t *secs, uint64_t *usecs)
 Get packet timestamp as individual values. More...
 

Typedef Documentation

◆ Flow

typedef struct Flow_ Flow

Definition at line 1 of file packet-bindgen.h.

◆ Packet

typedef struct Packet_ Packet

Definition at line 1 of file packet-bindgen.h.

Enumeration Type Documentation

◆ PacketL3Types

Enumerator
PACKET_L3_UNKNOWN 
PACKET_L3_IPV4 
PACKET_L3_IPV6 
PACKET_L3_ARP 

Definition at line 24 of file packet-bindgen.h.

Function Documentation

◆ SCPacketGetFlow()

Flow* SCPacketGetFlow ( const Packet *  p)

Get the flow associated with the packet.

Definition at line 300 of file packet.c.

References Packet_::flow, and p.

◆ SCPacketGetIPProto()

uint8_t SCPacketGetIPProto ( const Packet *  p)

Get IP proto regardless of IP version.

Exported wrapper around the PacketGetIPProto inline for plugins and Rust.

Definition at line 223 of file packet.c.

◆ SCPacketGetL3()

const uint8_t* SCPacketGetL3 ( const Packet *  p,
uint32_t *  len 
)

Get the L3 packet data, starting at the L3 header.

The returned data is borrowed from p and is valid only while its packet buffer remains valid and unchanged. For IPv4 and IPv6 the length comes from the IP header and includes the IPv6 base header. For ARP it is the fixed ARP header length. Trailing padding is excluded. The decoder has already validated the length against the captured packet length.

Parameters
pPacket to inspect, or NULL.
lenNon-NULL output pointer, set to zero when no data is returned.
Return values
NULLThe packet is NULL or has no decoded L3 layer.

Definition at line 271 of file packet.c.

References Packet_::l3, len, p, PACKET_L3_IPV4, and PacketL3::type.

◆ SCPacketGetL3Type()

enum PacketL3Types SCPacketGetL3Type ( const Packet *  p)

Get the type of the packet's L3 layer.

Return values
PACKET_L3_UNKNOWNThe packet is NULL or has no decoded L3 layer.

Definition at line 243 of file packet.c.

◆ SCPacketGetTimeAsParts()

void SCPacketGetTimeAsParts ( const Packet *  p,
uint64_t *  secs,
uint64_t *  usecs 
)

Get packet timestamp as individual values.

Definition at line 308 of file packet.c.

References p, SCTIME_SECS, SCTIME_USECS, and Packet_::ts.

◆ SCPacketIsToClient()

bool SCPacketIsToClient ( const Packet *  p)

Test whether the packet is marked as flowing to the client.

Requires a valid packet. Returns false when the direction flag is not set.

Definition at line 243 of file packet.c.

References p, and PKT_IS_TOCLIENT.

◆ SCPacketIsToServer()

bool SCPacketIsToServer ( const Packet *  p)

Test whether the packet is marked as flowing to the server.

Requires a valid packet. Returns false when the direction flag is not set.

Definition at line 233 of file packet.c.

References p, and PKT_IS_TOSERVER.