Haka
Data Structures | Enumerations | Functions
packet.h File Reference
#include <stddef.h>
#include <haka/types.h>
#include <haka/time.h>
#include <haka/thread.h>
#include <haka/vbuffer.h>
#include <haka/lua/object.h>
#include <haka/lua/ref.h>

Go to the source code of this file.

Data Structures

struct  packet
 

Enumerations

Functions

bool packet_init (struct packet_module_state *state)
 
void packet_addref (struct packet *pkt)
 
bool packet_release (struct packet *pkt)
 
struct packetpacket_new (size_t size)
 
const struct timepacket_timestamp (struct packet *pkt)
 
uint64 packet_id (struct packet *pkt)
 
struct vbufferpacket_payload (struct packet *pkt)
 
const char * packet_dissector (struct packet *pkt)
 
void packet_drop (struct packet *pkt)
 
void packet_accept (struct packet *pkt)
 
bool packet_send (struct packet *pkt)
 
int packet_receive (struct engine_thread *engine, struct packet **pkt)
 
size_t packet_mtu (struct packet *pkt)
 
enum packet_status packet_state (struct packet *pkt)
 
enum packet_mode packet_mode ()
 

Detailed Description

Packet manipulation utilities.

Enumeration Type Documentation

Packet capture mode.

Enumerator
MODE_NORMAL 

Normal mode (read/write).

MODE_PASSTHROUGH 

Listen mode (read-only).

Packet status.

Enumerator
STATUS_NORMAL 

Packet captured by Haka.

STATUS_FORGED 

Packet forged.

STATUS_SENT 

Packet already sent on the network.

Function Documentation

void packet_accept ( struct packet pkt)

Accept a packet and send it on the network.

void packet_addref ( struct packet pkt)

Increment packet ref count.

const char* packet_dissector ( struct packet pkt)

Get the packet dissector to use.

void packet_drop ( struct packet pkt)

Drop the packet.

uint64 packet_id ( struct packet pkt)

Get the id of the packet.

bool packet_init ( struct packet_module_state *  state)

Initialize packet internals for a given thread.

Current packet capture mode.

size_t packet_mtu ( struct packet pkt)

Get the packet mtu.

struct packet* packet_new ( size_t  size)

Create a new packet.

struct vbuffer* packet_payload ( struct packet pkt)

Get the packet payload.

int packet_receive ( struct engine_thread *  engine,
struct packet **  pkt 
)

Wait for some packet to be availabe.

bool packet_release ( struct packet pkt)

Decrement packet ref count and release it if needed.

bool packet_send ( struct packet pkt)

Send a packet. The packet will re-enter Haka to be filtered like a new packet.

enum packet_status packet_state ( struct packet pkt)

Get the packet state.

const struct time* packet_timestamp ( struct packet pkt)

Get the timestamp of the packet.