Loading...
Searching...
No Matches
inet_csum.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef NET_INET_CSUM_H
21#define NET_INET_CSUM_H
22
23#include <inttypes.h>
24#include <stddef.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
50uint16_t inet_csum_slice(uint16_t sum, const uint8_t *buf, uint16_t len, size_t accum_len);
51
72static inline uint16_t inet_csum(uint16_t sum, const uint8_t *buf, uint16_t len) {
73 return inet_csum_slice(sum, buf, len, 0);
74}
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* NET_INET_CSUM_H */
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:72
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.