summaryrefslogtreecommitdiffstats
path: root/src/extra
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2012-08-20 19:48:05 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2012-08-20 19:48:05 +0200
commit1eab5bedb6f024e5512d485ffd81d18d978ef3e3 (patch)
treeb29a78b7bd4593ca5441ba7a4889056e164ae2c8 /src/extra
parent3c42a36f3f170860b28d47ef028301276b78378b (diff)
src: update doxygen documentation for new API for libmnl
This patch updates the doxygen documentation for the new API. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/extra')
-rw-r--r--src/extra/ipv4.c17
-rw-r--r--src/extra/pktbuff.c50
-rw-r--r--src/extra/tcp.c10
-rw-r--r--src/extra/udp.c10
4 files changed, 83 insertions, 4 deletions
diff --git a/src/extra/ipv4.c b/src/extra/ipv4.c
index ce101ef..d7f1f69 100644
--- a/src/extra/ipv4.c
+++ b/src/extra/ipv4.c
@@ -56,9 +56,9 @@ struct iphdr *nfq_ip_get_hdr(struct pkt_buff *pktb)
EXPORT_SYMBOL(nfq_ip_get_hdr);
/**
- * nfq_ip_get_payload - get the IPv4 packet payload
+ * nfq_ip_set_transport_header - set transport header
* \param pktb: pointer to network packet buffer
- * \param iph: the pointer to the IPv4 header
+ * \param iph: pointer to the IPv4 header
*/
int nfq_ip_set_transport_header(struct pkt_buff *pktb, struct iphdr *iph)
{
@@ -77,8 +77,6 @@ EXPORT_SYMBOL(nfq_ip_set_transport_header);
* nfq_ip_set_checksum - set IPv4 checksum
* \param iph: pointer to the IPv4 header
*
- * \returns the checksum of the ip packet.
- *
* \note Call to this function if you modified the IPv4 header to update the
* checksum.
*/
@@ -91,6 +89,17 @@ void nfq_ip_set_checksum(struct iphdr *iph)
}
EXPORT_SYMBOL(nfq_ip_set_checksum);
+/**
+ * nfq_ip_mangle - mangle IPv4 packet buffer
+ * \param pktb: pointer to network packet buffer
+ * \param dataoff: offset to layer 4 header
+ * \param match_offset: offset to content that you want to mangle
+ * \param match_len: length of the existing content you want to mangle
+ * \param rep_buffer: pointer to data you want to use to replace current content
+ * \param rep_len: length of data you want to use to replace current content
+ *
+ * \note This function recalculates the IPv4 checksum (if needed).
+ */
int nfq_ip_mangle(struct pkt_buff *pkt, unsigned int dataoff,
unsigned int match_offset, unsigned int match_len,
const char *rep_buffer, unsigned int rep_len)
diff --git a/src/extra/pktbuff.c b/src/extra/pktbuff.c
index 0989f60..0bd778d 100644
--- a/src/extra/pktbuff.c
+++ b/src/extra/pktbuff.c
@@ -24,6 +24,8 @@
*
* This library provides the user-space network packet buffer. This abstraction
* is strongly inspired by Linux kernel network buffer, the so-called sk_buff.
+ *
+ * @{
*/
/**
@@ -83,59 +85,103 @@ pktb_alloc(int family, void *data, size_t len, size_t extra)
return pktb;
}
+/**
+ * pktb_data - return pointer to the beginning of the packet buffer
+ * \param pktb Pointer to packet buffer
+ */
uint8_t *pktb_data(struct pkt_buff *pktb)
{
return pktb->data;
}
+/**
+ * pktb_len - return length of the packet buffer
+ * \param pktb Pointer to packet buffer
+ */
uint32_t pktb_len(struct pkt_buff *pktb)
{
return pktb->len;
}
+/**
+ * pktb_free - release packet buffer
+ * \param pktb Pointer to packet buffer
+ */
void pktb_free(struct pkt_buff *pktb)
{
free(pktb);
}
+/**
+ * pktb_push - update pointer to the beginning of the packet buffer
+ * \param pktb Pointer to packet buffer
+ */
void pktb_push(struct pkt_buff *pktb, unsigned int len)
{
pktb->data -= len;
pktb->len += len;
}
+/**
+ * pktb_pull - update pointer to the beginning of the packet buffer
+ * \param pktb Pointer to packet buffer
+ */
void pktb_pull(struct pkt_buff *pktb, unsigned int len)
{
pktb->data += len;
pktb->len -= len;
}
+/**
+ * pktb_put - add extra bytes to the tail of the packet buffer
+ * \param pktb Pointer to packet buffer
+ */
void pktb_put(struct pkt_buff *pktb, unsigned int len)
{
pktb->tail += len;
pktb->len += len;
}
+/**
+ * pktb_trim - set new length for this packet buffer
+ * \param pktb Pointer to packet buffer
+ */
void pktb_trim(struct pkt_buff *pktb, unsigned int len)
{
pktb->len = len;
}
+/**
+ * pktb_tailroom - get room in bytes in the tail of the packet buffer
+ * \param pktb Pointer to packet buffer
+ */
unsigned int pktb_tailroom(struct pkt_buff *pktb)
{
return pktb->data_len - pktb->len;
}
+/**
+ * pktb_mac_header - return pointer to layer 2 header (if any)
+ * \param pktb Pointer to packet buffer
+ */
uint8_t *pktb_mac_header(struct pkt_buff *pktb)
{
return pktb->mac_header;
}
+/**
+ * pktb_network_header - return pointer to layer 3 header
+ * \param pktb Pointer to packet buffer
+ */
uint8_t *pktb_network_header(struct pkt_buff *pktb)
{
return pktb->network_header;
}
+/**
+ * pktb_transport_header - return pointer to layer 4 header (if any)
+ * \param pktb Pointer to packet buffer
+ */
uint8_t *pktb_transport_header(struct pkt_buff *pktb)
{
return pktb->transport_header;
@@ -202,6 +248,10 @@ int pktb_mangle(struct pkt_buff *pkt,
}
EXPORT_SYMBOL(pktb_mangle);
+/**
+ * pktb_mangled - return true if packet has been mangled
+ * \param pktb Pointer to packet buffer
+ */
bool pktb_mangled(const struct pkt_buff *pkt)
{
return pkt->mangled;
diff --git a/src/extra/tcp.c b/src/extra/tcp.c
index 2ea0d8a..5318b07 100644
--- a/src/extra/tcp.c
+++ b/src/extra/tcp.c
@@ -174,6 +174,16 @@ int nfq_tcp_snprintf(char *buf, size_t size, const struct tcphdr *tcph)
}
EXPORT_SYMBOL(nfq_tcp_snprintf);
+/**
+ * nfq_tcp_mangle_ipv4 - mangle TCP/IPv4 packet buffer
+ * \param pktb: pointer to network packet buffer
+ * \param match_offset: offset to content that you want to mangle
+ * \param match_len: length of the existing content you want to mangle
+ * \param rep_buffer: pointer to data you want to use to replace current content
+ * \param rep_len: length of data you want to use to replace current content
+ *
+ * \note This function recalculates the IPv4 and TCP checksums for you.
+ */
int
nfq_tcp_mangle_ipv4(struct pkt_buff *pkt,
unsigned int match_offset, unsigned int match_len,
diff --git a/src/extra/udp.c b/src/extra/udp.c
index 5f7f9ec..f0f6d2f 100644
--- a/src/extra/udp.c
+++ b/src/extra/udp.c
@@ -114,6 +114,16 @@ nfq_udp_compute_checksum_ipv6(struct udphdr *udph, struct ip6_hdr *ip6h)
}
EXPORT_SYMBOL(nfq_udp_compute_checksum_ipv6);
+/**
+ * nfq_tcp_mangle_ipv4 - mangle TCP/IPv4 packet buffer
+ * \param pktb: pointer to network packet buffer
+ * \param match_offset: offset to content that you want to mangle
+ * \param match_len: length of the existing content you want to mangle
+ * \param rep_buffer: pointer to data you want to use to replace current content
+ * \param rep_len: length of data you want to use to replace current content
+ *
+ * \note This function recalculates the IPv4 and TCP checksums for you.
+ */
int
nfq_udp_mangle_ipv4(struct pkt_buff *pkt,
unsigned int match_offset, unsigned int match_len,