libnetfilter_queue  1.0.3
Data Structures | Macros | Functions
TCP helper functions

Data Structures

union  tcp_word_hdr
 

Macros

#define tcp_flag_word(tp)   ( ((union tcp_word_hdr *)(tp))->words[3])
 

Functions

struct tcphdr * nfq_tcp_get_hdr (struct pkt_buff *pktb)
 
void * nfq_tcp_get_payload (struct tcphdr *tcph, struct pkt_buff *pktb)
 
unsigned int nfq_tcp_get_payload_len (struct tcphdr *tcph, struct pkt_buff *pktb)
 
void nfq_tcp_compute_checksum_ipv4 (struct tcphdr *tcph, struct iphdr *iph)
 
void nfq_tcp_compute_checksum_ipv6 (struct tcphdr *tcph, struct ip6_hdr *ip6h)
 
int nfq_tcp_snprintf (char *buf, size_t size, const struct tcphdr *tcph)
 
int nfq_tcp_mangle_ipv4 (struct pkt_buff *pkt, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)
 

Detailed Description

Function Documentation

void nfq_tcp_compute_checksum_ipv4 ( struct tcphdr *  tcph,
struct iphdr *  iph 
)

nfq_tcp_set_checksum_ipv4 - computes IPv4/TCP packet checksum

Parameters
tcphpointer to the TCP header
iphpointer to the IPv4 header

Definition at line 95 of file tcp.c.

void nfq_tcp_compute_checksum_ipv6 ( struct tcphdr *  tcph,
struct ip6_hdr *  ip6h 
)

nfq_tcp_set_checksum_ipv6 - computes IPv6/TCP packet checksum

Parameters
tcphpointer to the TCP header
iphpointer to the IPv6 header

Definition at line 109 of file tcp.c.

struct tcphdr* nfq_tcp_get_hdr ( struct pkt_buff *  pktb)

nfq_tcp_get - get the TCP header

Parameters
pktbpointer to user-space network packet buffer

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

Note
You have to call nfq_ip_set_transport_header or nfq_ip6_set_transport_header first to access the TCP header.

Definition at line 43 of file tcp.c.

void* nfq_tcp_get_payload ( struct tcphdr *  tcph,
struct pkt_buff *  pktb 
)

nfq_tcp_get_payload - get the TCP packet payload

Parameters
tcphpointer to the TCP header
pktbpointer to user-space network packet buffer

Definition at line 61 of file tcp.c.

unsigned int nfq_tcp_get_payload_len ( struct tcphdr *  tcph,
struct pkt_buff *  pktb 
)

nfq_tcp_get_payload_len - get the tcp packet payload

Parameters
tcphpointer to the TCP header
pktbpointer to user-space network packet buffer

Definition at line 83 of file tcp.c.

int nfq_tcp_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 193 of file tcp.c.

int nfq_tcp_snprintf ( char *  buf,
size_t  size,
const struct tcphdr *  tcph 
)

nfq_pkt_snprintf_tcp_hdr - print tcp 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).
tcppointer to a valid tcp header.

Definition at line 137 of file tcp.c.