libnetfilter_queue  1.0.3
Functions
UDP helper functions

Functions

struct udphdr * nfq_udp_get_hdr (struct pkt_buff *pktb)
 
void * nfq_udp_get_payload (struct udphdr *udph, struct pkt_buff *pktb)
 
unsigned int nfq_udp_get_payload_len (struct udphdr *udph, struct pkt_buff *pktb)
 
void nfq_udp_compute_checksum_ipv4 (struct udphdr *udph, struct iphdr *iph)
 
void nfq_udp_compute_checksum_ipv6 (struct udphdr *udph, struct ip6_hdr *ip6h)
 
int nfq_udp_mangle_ipv4 (struct pkt_buff *pkt, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)
 
int nfq_udp_snprintf (char *buf, size_t size, const struct udphdr *udph)
 

Detailed Description

Function Documentation

void nfq_udp_compute_checksum_ipv4 ( struct udphdr *  udph,
struct iphdr *  iph 
)

nfq_udp_set_checksum_ipv4 - computes a IPv4/TCP packet's segment

Parameters
iphdrppointer to the ip header
ippayloadpayload of the ip packet
Returns
the checksum of the udp segment.
See also
nfq_pkt_compute_ip_checksum
nfq_pkt_compute_udp_checksum

Definition at line 95 of file udp.c.

void nfq_udp_compute_checksum_ipv6 ( struct udphdr *  udph,
struct ip6_hdr *  ip6h 
)

nfq_udp_set_checksum_ipv6 - computes a IPv6/TCP packet's segment

Parameters
iphdrppointer to the ip header
ippayloadpayload of the ip packet
Returns
the checksum of the udp segment.
See also
nfq_pkt_compute_ip_checksum
nfq_pkt_compute_udp_checksum

Definition at line 114 of file udp.c.

struct udphdr* nfq_udp_get_hdr ( struct pkt_buff *  pktb)

nfq_udp_get_hdr - get the UDP header.

Parameters
headpointer to the beginning of the packet
tailpointer to the tail of the packet

This function returns NULL if invalid UDP header is found. On success, it returns the UDP header.

Definition at line 40 of file udp.c.

void* nfq_udp_get_payload ( struct udphdr *  udph,
struct pkt_buff *  pktb 
)

nfq_udp_get_payload - get the UDP packet payload.

Parameters
udphthe pointer to the UDP header.
tailpointer to the tail of the packet

Definition at line 58 of file udp.c.

unsigned int nfq_udp_get_payload_len ( struct udphdr *  udph,
struct pkt_buff *  pktb 
)

nfq_udp_get_payload_len - get the udp packet payload.

Parameters
udpthe pointer to the udp header.

Definition at line 78 of file udp.c.

int nfq_udp_mangle_ipv4 ( struct pkt_buff *  pkt,
unsigned int  match_offset,
unsigned int  match_len,
const char *  rep_buffer,
unsigned int  rep_len 
)

nfq_tcp_mangle_ipv4 - mangle TCP/IPv4 packet buffer

Parameters
pktbpointer to network packet buffer
match_offsetoffset to content that you want to mangle
match_lenlength of the existing content you want to mangle
rep_bufferpointer to data you want to use to replace current content
rep_lenlength of data you want to use to replace current content
Note
This function recalculates the IPv4 and TCP checksums for you.

Definition at line 133 of file udp.c.

int nfq_udp_snprintf ( char *  buf,
size_t  size,
const struct udphdr *  udph 
)

nfq_pkt_snprintf_udp_hdr - print udp header into one buffer in a humnan readable way

Parameters
bufpointer to buffer that is used to print the object
sizesize of the buffer (or remaining room in it).
udppointer to a valid udp header.

Definition at line 161 of file udp.c.