This library provides the user-space network packet buffer. More...
Functions | |
struct pkt_buff * | pktb_alloc (int family, void *data, size_t len, size_t extra) |
pktb_alloc - allocate a new packet buffer More... | |
EXPORT_SYMBOL (pktb_alloc) | |
uint8_t * | pktb_data (struct pkt_buff *pktb) |
pktb_data - return pointer to the beginning of the packet buffer More... | |
EXPORT_SYMBOL (pktb_data) | |
uint32_t | pktb_len (struct pkt_buff *pktb) |
pktb_len - return length of the packet buffer More... | |
EXPORT_SYMBOL (pktb_len) | |
void | pktb_free (struct pkt_buff *pktb) |
pktb_free - release packet buffer More... | |
EXPORT_SYMBOL (pktb_free) | |
void | pktb_push (struct pkt_buff *pktb, unsigned int len) |
pktb_push - update pointer to the beginning of the packet buffer More... | |
EXPORT_SYMBOL (pktb_push) | |
void | pktb_pull (struct pkt_buff *pktb, unsigned int len) |
pktb_pull - update pointer to the beginning of the packet buffer More... | |
EXPORT_SYMBOL (pktb_pull) | |
void | pktb_put (struct pkt_buff *pktb, unsigned int len) |
pktb_put - add extra bytes to the tail of the packet buffer More... | |
EXPORT_SYMBOL (pktb_put) | |
void | pktb_trim (struct pkt_buff *pktb, unsigned int len) |
pktb_trim - set new length for this packet buffer More... | |
EXPORT_SYMBOL (pktb_trim) | |
unsigned int | pktb_tailroom (struct pkt_buff *pktb) |
pktb_tailroom - get room in bytes in the tail of the packet buffer More... | |
EXPORT_SYMBOL (pktb_tailroom) | |
uint8_t * | pktb_mac_header (struct pkt_buff *pktb) |
pktb_mac_header - return pointer to layer 2 header (if any) More... | |
EXPORT_SYMBOL (pktb_mac_header) | |
uint8_t * | pktb_network_header (struct pkt_buff *pktb) |
pktb_network_header - return pointer to layer 3 header More... | |
EXPORT_SYMBOL (pktb_network_header) | |
uint8_t * | pktb_transport_header (struct pkt_buff *pktb) |
pktb_transport_header - return pointer to layer 4 header (if any) More... | |
EXPORT_SYMBOL (pktb_transport_header) | |
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) |
EXPORT_SYMBOL (pktb_mangle) | |
bool | pktb_mangled (const struct pkt_buff *pkt) |
pktb_mangled - return true if packet has been mangled More... | |
EXPORT_SYMBOL (pktb_mangled) | |
This library provides the user-space network packet buffer.
This abstraction is strongly inspired by Linux kernel network buffer, the so-called sk_buff.
EXPORT_SYMBOL | ( | pktb_alloc | ) |
EXPORT_SYMBOL | ( | pktb_data | ) |
EXPORT_SYMBOL | ( | pktb_len | ) |
EXPORT_SYMBOL | ( | pktb_free | ) |
EXPORT_SYMBOL | ( | pktb_push | ) |
EXPORT_SYMBOL | ( | pktb_pull | ) |
EXPORT_SYMBOL | ( | pktb_put | ) |
EXPORT_SYMBOL | ( | pktb_trim | ) |
EXPORT_SYMBOL | ( | pktb_tailroom | ) |
EXPORT_SYMBOL | ( | pktb_mac_header | ) |
EXPORT_SYMBOL | ( | pktb_network_header | ) |
EXPORT_SYMBOL | ( | pktb_transport_header | ) |
EXPORT_SYMBOL | ( | pktb_mangle | ) |
EXPORT_SYMBOL | ( | pktb_mangled | ) |
pktb_alloc - allocate a new packet buffer
family | Indicate what family, eg. AF_BRIDGE, AF_INET, AF_INET6, ... |
data | Pointer to packet data |
len | Packet length |
extra | Extra 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).
References pkt_buff::data, pkt_buff::data_len, ETH_HLEN, ETH_P_IP, ethhdr::h_proto, pkt_buff::head, pkt_buff::len, len, pkt_buff::mac_header, pkt_buff::network_header, NULL, and pkt_buff::tail.
pktb_data - return pointer to the beginning of the packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::data.
pktb_free - release packet buffer
pktb | Pointer to packet buffer |
pktb_len - return length of the packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::len.
pktb_mac_header - return pointer to layer 2 header (if any)
pktb | Pointer to packet buffer |
References pkt_buff::mac_header.
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 | ||
) |
References data, pkt_buff::len, pkt_buff::mangled, pkt_buff::network_header, pktb_put(), pktb_tailroom(), pktb_trim(), and pkt_buff::tail.
Referenced by nfq_ip_mangle().
pktb_mangled - return true if packet has been mangled
pktb | Pointer to packet buffer |
References pkt_buff::mangled.
pktb_network_header - return pointer to layer 3 header
pktb | Pointer to packet buffer |
References pkt_buff::network_header.
pktb_pull - update pointer to the beginning of the packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::data, pkt_buff::len, and len.
pktb_push - update pointer to the beginning of the packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::data, pkt_buff::len, and len.
pktb_put - add extra bytes to the tail of the packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::len, len, and pkt_buff::tail.
Referenced by pktb_mangle().
pktb_tailroom - get room in bytes in the tail of the packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::data_len, and pkt_buff::len.
Referenced by pktb_mangle().
pktb_transport_header - return pointer to layer 4 header (if any)
pktb | Pointer to packet buffer |
References pkt_buff::transport_header.
pktb_trim - set new length for this packet buffer
pktb | Pointer to packet buffer |
References pkt_buff::len, and len.
Referenced by pktb_mangle().