The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
checksum.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file checksum.h
5
* @brief the Internet checksum (RFC 1071): the ones' complement of the
6
* ones' complement sum of the 16-bit words.
7
*
8
* the words are added in memory order, so the result can be stored as it
9
* is, in either byte order.
10
*/
11
12
#include "
common/stdint.h
"
13
14
/**
15
* add bytes to a partial sum. an odd length pads with a zero byte, so
16
* only the last piece of a checksum may have an odd length.
17
*/
18
uint32_t
checksum_add
(
uint32_t
sum,
const
void
*data,
uint32_t
length);
19
20
/**
21
* fold a partial sum and complement it: the checksum to store.
22
*/
23
uint16_t
checksum_finish
(
uint32_t
sum);
24
25
/**
26
* the checksum of one buffer.
27
*/
28
uint16_t
checksum
(
const
void
*data,
uint32_t
length);
checksum_add
uint32_t checksum_add(uint32_t sum, const void *data, uint32_t length)
add bytes to a partial sum.
Definition
checksum.c:8
checksum_finish
uint16_t checksum_finish(uint32_t sum)
fold a partial sum and complement it: the checksum to store.
Definition
checksum.c:28
checksum
uint16_t checksum(const void *data, uint32_t length)
the checksum of one buffer.
Definition
checksum.c:37
stdint.h
uint32_t
unsigned int uint32_t
Definition
fb.h:17
uint16_t
unsigned short uint16_t
Definition
stdint.h:13
src
kernel
net
checksum.h
Generated by
1.18.0