![]() |
Rawsock library
v0.3.4
Library to make the use of raw sockets easier, under Linux. Currently supporting IPv4, UDP and a custom latency measurement protocol (LaMP - supported both in raw and non-raw sockets).
|
#include <linux/types.h>Go to the source code of this file.
Functions | |
| __sum16 | ip_fast_csum (const void *iph, unsigned int ihl) |
| Calculate the IPv4 checksum (optimized for IP headers, which always checksum on 4 octet boundaries) More... | |
IP checksum calculation alternative header - from Linux kernel 4.19.1 (not an original work)
This header file gives access to a function (ip_fast_csum()) that can be used to compute, in an efficient and reliable way, the IPv4 checksum to be put inside the corresponding field of the IPv4 header.
It represents an alternative user-space header to access the Linux kernel ip_fast_csum() function.
This is not an original work: this function comes from the Linux kernel 4.19.1, released under GNU GPL version 2. There is no modification to its code.
The function, even though it is used internally in the main Rawsock module, is available through a separate header in order to enable any application to use it separately in user space, when needed.
Definition in file ipcsum_alth.h.
| __sum16 ip_fast_csum | ( | const void * | iph, |
| unsigned int | ihl | ||
| ) |
Calculate the IPv4 checksum (optimized for IP headers, which always checksum on 4 octet boundaries)
This function can be used to compute the IPv4 header checksum, given the whole header and the IHL field.
Example of use:
struct iphdr header; header.check=ip_fast_csum((__u8 *)&header, 5); // IHL = 5 word -> no options
| [in] | iph | Pointer to the IPv4 header. |
| [in] | ihl | Value of the IPv4 IHL (Internet Header Length). |
Definition at line 84 of file ipcsum_alth.c.