.TH "udp" 3 "Thu Jan 28 2021" "Version 1.0.5" "libnetfilter_queue" \" -*- nroff -*- .ad l .nh .SH NAME udp \- UDP helper functions .SH SYNOPSIS .br .PP .SS "Modules" .in +1c .ti -1c .RI "\fBInternal UDP functions\fP" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "struct udphdr * \fBnfq_udp_get_hdr\fP (struct pkt_buff *pktb)" .br .ti -1c .RI "void * \fBnfq_udp_get_payload\fP (struct udphdr *udph, struct pkt_buff *pktb)" .br .ti -1c .RI "unsigned int \fBnfq_udp_get_payload_len\fP (struct udphdr *udph, struct pkt_buff *pktb)" .br .ti -1c .RI "int \fBnfq_udp_mangle_ipv4\fP (struct pkt_buff *pktb, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)" .br .ti -1c .RI "int \fBnfq_udp_mangle_ipv6\fP (struct pkt_buff *pktb, unsigned int match_offset, unsigned int match_len, const char *rep_buffer, unsigned int rep_len)" .br .ti -1c .RI "int \fBnfq_udp_snprintf\fP (char *buf, size_t size, const struct udphdr *udph)" .br .in -1c .SH "Detailed Description" .PP .SH "Function Documentation" .PP .SS "struct udphdr* nfq_udp_get_hdr (struct pkt_buff * pktb)" nfq_udp_get_hdr - get the UDP header\&. .PP \fBParameters\fP .RS 4 \fIpktb\fP Pointer to userspace network packet buffer .RE .PP \fBReturns\fP .RS 4 validated pointer to the UDP header or NULL if the UDP header was not set or if a minimal length check fails\&. .RE .PP \fBNote\fP .RS 4 You have to call \fBnfq_ip_set_transport_header()\fP or \fBnfq_ip6_set_transport_header()\fP first to set the UDP header\&. .RE .PP .PP Definition at line 43 of file udp\&.c\&. .SS "void* nfq_udp_get_payload (struct udphdr * udph, struct pkt_buff * pktb)" nfq_udp_get_payload - get the UDP packet payload\&. .PP \fBParameters\fP .RS 4 \fIudph\fP Pointer to UDP header .br \fIpktb\fP Pointer to userspace network packet buffer .RE .PP \fBReturns\fP .RS 4 Pointer to the UDP payload, or NULL if malformed UDP packet\&. .RE .PP .PP Definition at line 62 of file udp\&.c\&. .SS "unsigned int nfq_udp_get_payload_len (struct udphdr * udph, struct pkt_buff * pktb)" nfq_udp_get_payload_len - get the udp packet payload\&. .PP \fBParameters\fP .RS 4 \fIudph\fP Pointer to UDP header .br \fIpktb\fP Pointer to userspace network packet buffer .RE .PP \fBReturns\fP .RS 4 Length of UDP payload (user data) .RE .PP .PP Definition at line 84 of file udp\&.c\&. .SS "int nfq_udp_mangle_ipv4 (struct pkt_buff * pktb, unsigned int match_offset, unsigned int match_len, const char * rep_buffer, unsigned int rep_len)" nfq_udp_mangle_ipv4 - Mangle UDP/IPv4 packet buffer .PP \fBParameters\fP .RS 4 \fIpktb\fP Pointer to network packet buffer .br \fImatch_offset\fP Offset from start of UDP data of content that you want to mangle .br \fImatch_len\fP Length of the existing content you want to mangle .br \fIrep_buffer\fP Pointer to data you want to use to replace current content .br \fIrep_len\fP Length of data you want to use to replace current content .RE .PP \fBReturns\fP .RS 4 1 for success and 0 for failure\&. See \fBpktb_mangle()\fP for failure case .RE .PP \fBNote\fP .RS 4 This function updates the IPv4 and UDP lengths and recalculates their checksums for you\&. .RE .PP .PP Definition at line 150 of file udp\&.c\&. .SS "int nfq_udp_mangle_ipv6 (struct pkt_buff * pktb, unsigned int match_offset, unsigned int match_len, const char * rep_buffer, unsigned int rep_len)" nfq_udp_mangle_ipv6 - Mangle UDP/IPv6 packet buffer .PP \fBParameters\fP .RS 4 \fIpktb\fP Pointer to network packet buffer .br \fImatch_offset\fP Offset from start of UDP data of content that you want to mangle .br \fImatch_len\fP Length of the existing content you want to mangle .br \fIrep_buffer\fP Pointer to data you want to use to replace current content .br \fIrep_len\fP Length of data you want to use to replace current content .RE .PP \fBReturns\fP .RS 4 1 for success and 0 for failure\&. See \fBpktb_mangle()\fP for failure case .RE .PP \fBNote\fP .RS 4 This function updates the IPv6 and UDP lengths and recalculates the UDP checksum for you\&. .RE .PP .PP Definition at line 184 of file udp\&.c\&. .SS "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 .PP \fBParameters\fP .RS 4 \fIbuf\fP pointer to buffer that is used to print the object .br \fIsize\fP size of the buffer (or remaining room in it)\&. .br \fIudph\fP pointer to a valid udp header\&. .RE .PP \fBReturns\fP .RS 4 The number of characters notionally written (excluding trailing NUL) .RE .PP \fBSee also\fP .RS 4 \fBsnprintf\fP(3) .RE .PP .PP Definition at line 220 of file udp\&.c\&. .SH "Author" .PP Generated automatically by Doxygen for libnetfilter_queue from the source code\&.