Internet Checksum¶
Provides a function to calculate the Internet Checksum.
-
uint16_t
inet_csum_slice
(uint16_t sum, const uint8_t * buf, uint16_t len,msp430_types.h::size_t
accum_len)¶ Calculates the unnormalized Internet Checksum of
buf
, where the buffer provides a slice of the full checksum domain, calculated in order.See also
Parameters
sum: An initial value for the checksum. buf: A buffer. len: Length of buf
in 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.See 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 buf
in byte.Return values
- The unnormalized Internet Checksum of
buf
.
- The unnormalized Internet Checksum of