home
topology files
command‑line options
the core API
FAQ
download and install
|
cnet's Application Programming Interface
- NAME
- CRC and checksum functions
- SYNOPSIS
-
#include <cnet.h>
int32_t CNET_IP_checksum(unsigned short *addr, size_t nbytes);
uint16_t CNET_ccitt(unsigned char *addr, size_t nbytes);
uint16_t CNET_crc16(unsigned char *addr, size_t nbytes);
uint32_t CNET_crc32(unsigned char *addr, size_t nbytes);
- DESCRIPTION
-
These four functions each take a memory address and perform the
requested checksum (iff
CNET_IP_checksum() ) or
CRC (the other three)
calculation on the indicated number of bytes starting from that address.
CNET_IP_checksum() calculates the standard Internet checksum,
as defined in
RFC-1071.
- RETURN VALUE
-
The value returned will be the requested CRC or checksum of the indicated
block of memory.
No error detection is performed on the arguments.
|