inet_csum.h¶
Internet Checksum definitions.
-
uint16_t
inet_csum_slice(uint16_t sum, const uint8_t * buf, uint16_t len,msp430_types.h::size_taccum_len)¶ Calculates the unnormalized Internet Checksum of
buf, where the buffer provides a slice of the full checksum domain, calculated in order.The Internet Checksum is not normalized (i. e. its 1’s complement was not taken of the result) to use it for further calculation. This function handles padding an odd number of bytes across the full domain.See also
Parameters
sum: An initial value for the checksum. buf: A buffer. len: Length of bufin byte.accum_len: Accumulated length of checksum domain that has already been checksummed. Return values
- The unnormalized Internet Checksum of
buf.
- The unnormalized Internet Checksum of
-
uint16_t
inet_csum(uint16_t sum, const uint8_t * buf, uint16_t len)¶ Calculates the unnormalized Internet Checksum of
buf, where the buffer provides a standalone domain for the checksum.The Internet Checksum is not normalized (i. e. its 1’s complement was not taken of the result) to use it for further calculation. This function, rather thanSee also
inet_csum.h::inet_csum_slice(), has been used historically when we are not concerned with padding for an odd number of bytes.Parameters
sum: An initial value for the checksum. buf: A buffer. len: Length of bufin byte.Return values
- The unnormalized Internet Checksum of
buf.
- The unnormalized Internet Checksum of