riot_sys::bindgen

Function inet_csum_slice

Source
pub unsafe extern "C" fn inet_csum_slice(
    sum: u16,
    buf: *const u8,
    len: u16,
    accum_len: size_t,
) -> u16
Expand description

@brief Calculates the unnormalized Internet Checksum of @p buf, where the buffer provides a slice of the full checksum domain, calculated in order.

@see RFC 1071

@details 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.

@param[in] sum An initial value for the checksum. @param[in] buf A buffer. @param[in] len Length of @p buf in byte. @param[in] accum_len Accumulated length of checksum domain that has already been checksummed.

@return The unnormalized Internet Checksum of @p buf.