42,9 → 42,9 |
#include <sys/types.h> |
|
/** Computes CRC32 value. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bits. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bits. |
* @returns The computed CRC32 of the length bits of the data. |
*/ |
#ifdef ARCH_IS_BIG_ENDIAN |
54,17 → 54,17 |
#endif |
|
/** Computes CRC32 value in the little-endian environment. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bits. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bits. |
* @returns The computed CRC32 of the length bits of the data. |
*/ |
uint32_t compute_crc32_le( uint32_t seed, uint8_t * data, size_t length ); |
|
/** Computes CRC32 value in the big-endian environment. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bits. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bits. |
* @returns The computed CRC32 of the length bits of the data. |
*/ |
uint32_t compute_crc32_be( uint32_t seed, uint8_t * data, size_t length ); |
71,21 → 71,21 |
|
/** Computes sum of the 2 byte fields. |
* Padds one zero (0) byte if odd. |
* @param seed Initial value. Often used as 0 or ~0. Input parameter. |
* @param data Pointer to the beginning of data to process. Input parameter. |
* @param length Length of the data in bytes. Input parameter. |
* @param[in] seed Initial value. Often used as 0 or ~0. |
* @param[in] data Pointer to the beginning of data to process. |
* @param[in] length Length of the data in bytes. |
* @returns The computed checksum of the length bytes of the data. |
*/ |
uint32_t compute_checksum( uint32_t seed, uint8_t * data, size_t length ); |
|
/** Compacts the computed checksum to the 16 bit number adding the carries. |
* @param sum Computed checksum. Input parameter. |
* @param[in] sum Computed checksum. |
* @returns Compacted computed checksum to the 16 bits. |
*/ |
uint16_t compact_checksum( uint32_t sum ); |
|
/** Returns or flips the checksum if zero. |
* @param checksum The computed checksum. Input parameter. |
* @param[in] checksum The computed checksum. |
* @returns The internet protocol header checksum. |
* @returns 0xFFFF if the computed checksum is zero. |
*/ |
95,8 → 95,8 |
* To compute the checksum of a new packet, the checksum header field must be zero. |
* To check the checksum of a received packet, the checksum may be left set. |
* The zero (0) value will be returned in this case if valid. |
* @param data The header data. Input parameter. |
* @param length The header length in bytes. Input parameter. |
* @param[in] data The header data. |
* @param[in] length The header length in bytes. |
* @returns The internet protocol header checksum. |
* @returns 0xFFFF if the computed checksum is zero. |
*/ |