3.6. PacketΒΆ

Packet manipulation utilities.

Enums

packet_status enum

Packet status.

Values:

  • STATUS_NORMAL -

    Packet captured by Haka.

  • STATUS_FORGED -

    Packet forged.

  • STATUS_SENT -

    Packet already sent on the network.

packet_mode enum

Packet capture mode.

Values:

  • MODE_NORMAL -

    Normal mode (read/write).

  • MODE_PASSTHROUGH -

    Listen mode (read-only).

Functions

bool packet_init(struct packet_module_state * state)

Initialize packet internals for a given thread.

void packet_addref(struct packet * pkt)

Increment packet ref count.

bool packet_release(struct packet * pkt)

Decrement packet ref count and release it if needed.

struct packet * packet_new(size_t size)

Create a new packet.

struct time * packet_timestamp(struct packet * pkt)

Get the timestamp of the packet.

uint64 packet_id(struct packet * pkt)

Get the id of the packet.

struct vbuffer * packet_payload(struct packet * pkt)

Get the packet payload.

const char * packet_dissector(struct packet * pkt)

Get the packet dissector to use.

void packet_drop(struct packet * pkt)

Drop the packet.

void packet_accept(struct packet * pkt)

Accept a packet and send it on the network.

bool packet_send(struct packet * pkt)

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

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

Wait for some packet to be availabe.

size_t packet_mtu(struct packet * pkt)

Get the packet mtu.

enum packet_status packet_state(struct packet * pkt)

Get the packet state.

enum packet_mode packet_mode()

Current packet capture mode.

Variables

struct time_realm network_time

class packet

Opaque packet structure.

Public Members

struct lua_ref userdata

Private Members

struct lua_object lua_object

atomic_t ref

struct vbuffer payload