Haka
Data Fields
packet_module Struct Reference

#include <include/haka/packet_module.h>

Data Fields

struct module module
 
bool(* multi_threaded )()
 
bool(* pass_through )()
 
bool(* is_realtime )()
 
struct packet_module_state *(* init_state )(int thread_id)
 
void(* cleanup_state )(struct packet_module_state *state)
 
int(* receive )(struct packet_module_state *state, struct packet **pkt)
 
void(* verdict )(struct packet *pkt, filter_result result)
 
uint64(* get_id )(struct packet *pkt)
 
const char *(* get_dissector )(struct packet *pkt)
 
void(* release_packet )(struct packet *pkt)
 
enum packet_status(* packet_getstate )(struct packet *pkt)
 
struct packet *(* new_packet )(struct packet_module_state *state, size_t size)
 
bool(* send_packet )(struct packet *pkt)
 
size_t(* get_mtu )(struct packet *pkt)
 
const struct time *(* get_timestamp )(struct packet *pkt)
 

Detailed Description

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.

Field Documentation

void(* packet_module::cleanup_state) (struct packet_module_state *state)

Cleanup the packet module state.

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

Get the packet dissector.

uint64(* packet_module::get_id) (struct packet *pkt)

Get the identifier of a packet.

size_t(* packet_module::get_mtu) (struct packet *pkt)

Get the mtu for a packet.

const struct time*(* packet_module::get_timestamp) (struct packet *pkt)

Get the packet timestamp.

struct packet_module_state*(* packet_module::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.

bool(* packet_module::is_realtime) ()

Check if the module is realtime or not.

struct module packet_module::module

Module structure.

bool(* packet_module::multi_threaded) ()

Get if the module support multi-threading.

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

Create a new packet.

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

Get packet status.

bool(* packet_module::pass_through) ()

Get the capture mode.

int(* packet_module::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.

Returns
Non zero in case of error.
void(* packet_module::release_packet) (struct packet *pkt)

Release the packet and free its memory.

bool(* packet_module::send_packet) (struct packet *pkt)

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

void(* packet_module::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
pktThe 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.
resultThe verdict to apply to this packet.

The documentation for this struct was generated from the following file: