inet_csum.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
20 #include <inttypes.h>
21 #include <stddef.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
47 uint16_t inet_csum_slice(uint16_t sum, const uint8_t *buf, uint16_t len, size_t accum_len);
48 
69 static inline uint16_t inet_csum(uint16_t sum, const uint8_t *buf, uint16_t len) {
70  return inet_csum_slice(sum, buf, len, 0);
71 }
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
static 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 f...
Definition: inet_csum.h:69
uint16_t inet_csum_slice(uint16_t sum, const uint8_t *buf, uint16_t len, size_t accum_len)
Calculates the unnormalized Internet Checksum of buf, where the buffer provides a slice of the full c...
Adds include for missing inttype definitions.