3.9.1. Packet moduleΒΆ

Packet capture module.

Enums

filter_result enum

Filtering result.

Values:

  • FILTER_ACCEPT -

    Accept packet result.

  • FILTER_DROP -

    Drop packet result.

class packet_module

Opaque state structure. Packet module used to interact with the low-level packets. The module will be used to receive packets and set a verdict on them. It also define an interface to access the packet fields.

Public Members

struct module module

Module structure.

bool (* multi_threaded)()

Get if the module support multi-threading.

bool (* pass_through)()

Get the capture mode.

bool (* is_realtime)()

Check if the module is realtime or not.

struct packet_module_state *(* init_state)(int thread_id)

Initialize the packet module state. This function will be called to create multiple states if the module supports multi-threading.

void(* cleanup_state)(struct packet_module_state *state)

Cleanup the packet module state.

int(* receive)(struct packet_module_state *state, struct packet **pkt)

Callback used to receive a new packet. This function should block until a packet is received.

Return
Non zero in case of error.

void(* verdict)(struct packet *pkt, filter_result result)

Apply a verdict on a received packet. The module should then apply this verdict on the underlying packet.

Parameters
  • pkt -

    The received packet. After calling this function the packet address is never used again by the application but allow the module to free it if needed.

  • result -

    The verdict to apply to this packet.

uint64 (* get_id)(struct packet *pkt)

Get the identifier of a packet.

const char *(* get_dissector)(struct packet *pkt)

Get the packet dissector.

void(* release_packet)(struct packet *pkt)

Release the packet and free its memory.

enum packet_status (* packet_getstate)(struct packet *pkt)

Get packet status.

struct packet *(* new_packet)(struct packet_module_state *state, size_t size)

Create a new packet.

bool (* send_packet)(struct packet *pkt)

Send a forged packet. This packet will be received again by Haka as a regular packet on the network.

size_t(* get_mtu)(struct packet *pkt)

Get the mtu for a packet.

struct time *(* get_timestamp)(struct packet *pkt)

Get the packet timestamp.