General CRC and checksum computation. More...
#include <byteorder.h>
#include <sys/types.h>
Defines | |
#define | IP_CHECKSUM_ZERO 0xFFFFu |
IP checksum value for computed zero checksum. | |
#define | compute_crc32(seed, data, length) compute_crc32_le(seed, (uint8_t *) data, length) |
Computes CRC32 value. | |
Functions | |
uint32_t | compute_crc32_le (uint32_t seed, uint8_t *data, size_t length) |
Computes CRC32 value in the little-endian environment. | |
uint32_t | compute_crc32_be (uint32_t seed, uint8_t *data, size_t length) |
Computes CRC32 value in the big-endian environment. | |
uint32_t | compute_checksum (uint32_t seed, uint8_t *data, size_t length) |
Computes sum of the 2 byte fields. | |
uint16_t | compact_checksum (uint32_t sum) |
Compacts the computed checksum to the 16 bit number adding the carries. | |
uint16_t | flip_checksum (uint16_t checksum) |
Returns or flips the checksum if zero. | |
uint16_t | ip_checksum (uint8_t *data, size_t length) |
Computes the ip header checksum. |
General CRC and checksum computation.