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).
minirighi_udp_checksum.h File Reference
#include <inttypes.h>
#include <stdlib.h>
#include <netinet/in.h>

Go to the source code of this file.

Functions

uint16_t minirighi_udp_checksum (const void *buff, size_t len, in_addr_t src_addr, in_addr_t dest_addr)
 Calculate the UDP checksum (calculated with the whole packet) More...
 

Detailed Description

UDP checksum calculation utility - from the Minirighi IA-32 Operating System

This header file gives access to a function (minirighi_udp_checksum()) that can be used to compute the UDP checksum to be put inside the corresponding field of the UDP header.

This is not an original work: this function comes from the Minirighi IA-32 Operating System, released under GNU GPL. Except for the name, there is no modification to its code.

Moreover, the original definition can be found at line 29 of file udp.c of the Minirighi system.

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, when needed.

Version
Rawsock library verion: 0.3.4
Author
Andrea Righi drizz.nosp@m.t@in.nosp@m.wind..nosp@m.it
Date
2003-01-21 Andrea Righi: Suppressed deferencing type-punned pointer warning.

Definition in file minirighi_udp_checksum.h.

Function Documentation

uint16_t minirighi_udp_checksum ( const void *  buff,
size_t  len,
in_addr_t  src_addr,
in_addr_t  dest_addr 
)

Calculate the UDP checksum (calculated with the whole packet)

Note
This documentation is coded to reflect exactly the one provided for the Minirighi Opearing System, available here.
Parameters
[in]buffThe UDP packet.
[in]lenThe UDP packet length.
[in]src_addrThe IP source address (in network format).
[in]dest_addrThe IP destination address (in network format).
Returns
The result of the checksum.

Definition at line 18 of file minirighi_udp_checksum.c.