libnetfilter_queue  1.0.3
Functions
User-space network packet buffer

Functions

struct pkt_buff * pktb_alloc (int family, void *data, size_t len, size_t extra)
 
uint8_t * pktb_data (struct pkt_buff *pktb)
 
uint32_t pktb_len (struct pkt_buff *pktb)
 
void pktb_free (struct pkt_buff *pktb)
 
void pktb_push (struct pkt_buff *pktb, unsigned int len)
 
void pktb_pull (struct pkt_buff *pktb, unsigned int len)
 
void pktb_put (struct pkt_buff *pktb, unsigned int len)
 
void pktb_trim (struct pkt_buff *pktb, unsigned int len)
 
unsigned int pktb_tailroom (struct pkt_buff *pktb)
 
uint8_t * pktb_mac_header (struct pkt_buff *pktb)
 
uint8_t * pktb_network_header (struct pkt_buff *pktb)
 
uint8_t * pktb_transport_header (struct pkt_buff *pktb)
 
int pktb_mangle (struct pkt_buff *pkt, unsigned int dataoff, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)
 
bool pktb_mangled (const struct pkt_buff *pkt)
 

Detailed Description

This library provides the user-space network packet buffer. This abstraction is strongly inspired by Linux kernel network buffer, the so-called sk_buff.

Function Documentation

struct pkt_buff* pktb_alloc ( int  family,
void *  data,
size_t  len,
size_t  extra 
)

pktb_alloc - allocate a new packet buffer

Parameters
familyIndicate what family, eg. AF_BRIDGE, AF_INET, AF_INET6, ...
dataPointer to packet data
lenPacket length
extraExtra memory in the tail to be allocated (for mangling)

This function returns a packet buffer that contains the packet data and some extra memory room in the tail (in case of requested).

Returns
a pointer to a new queue handle or NULL on failure.

Definition at line 44 of file pktbuff.c.

uint8_t* pktb_data ( struct pkt_buff *  pktb)

pktb_data - return pointer to the beginning of the packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 93 of file pktbuff.c.

void pktb_free ( struct pkt_buff *  pktb)

pktb_free - release packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 113 of file pktbuff.c.

uint32_t pktb_len ( struct pkt_buff *  pktb)

pktb_len - return length of the packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 103 of file pktbuff.c.

uint8_t* pktb_mac_header ( struct pkt_buff *  pktb)

pktb_mac_header - return pointer to layer 2 header (if any)

Parameters
pktbPointer to packet buffer

Definition at line 176 of file pktbuff.c.

bool pktb_mangled ( const struct pkt_buff *  pkt)

pktb_mangled - return true if packet has been mangled

Parameters
pktbPointer to packet buffer

Definition at line 267 of file pktbuff.c.

uint8_t* pktb_network_header ( struct pkt_buff *  pktb)

pktb_network_header - return pointer to layer 3 header

Parameters
pktbPointer to packet buffer

Definition at line 186 of file pktbuff.c.

void pktb_pull ( struct pkt_buff *  pktb,
unsigned int  len 
)

pktb_pull - update pointer to the beginning of the packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 134 of file pktbuff.c.

void pktb_push ( struct pkt_buff *  pktb,
unsigned int  len 
)

pktb_push - update pointer to the beginning of the packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 123 of file pktbuff.c.

void pktb_put ( struct pkt_buff *  pktb,
unsigned int  len 
)

pktb_put - add extra bytes to the tail of the packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 145 of file pktbuff.c.

unsigned int pktb_tailroom ( struct pkt_buff *  pktb)

pktb_tailroom - get room in bytes in the tail of the packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 166 of file pktbuff.c.

uint8_t* pktb_transport_header ( struct pkt_buff *  pktb)

pktb_transport_header - return pointer to layer 4 header (if any)

Parameters
pktbPointer to packet buffer

Definition at line 196 of file pktbuff.c.

void pktb_trim ( struct pkt_buff *  pktb,
unsigned int  len 
)

pktb_trim - set new length for this packet buffer

Parameters
pktbPointer to packet buffer

Definition at line 156 of file pktbuff.c.