ReactOS 0.4.16-dev-205-g7b2bb7e
checksum.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS TCP/IP protocol driver
4 * FILE: include/checksum.h
5 * PURPOSE: Checksum routine definitions
6 */
7
8#pragma once
9
11 ULONG Sum);
12
14 PVOID Data,
15 UINT Count,
16 ULONG Seed);
17
18unsigned int
20 const unsigned char * buff,
21 int len,
22 unsigned int sum);
23
27 PUCHAR PacketBuffer,
29
30#define IPv4Checksum(Data, Count, Seed)(~ChecksumFold(ChecksumCompute(Data, Count, Seed)))
31#define TCPv4Checksum(Data, Count, Seed)(~ChecksumFold(csum_partial(Data, Count, Seed)))
32//#define TCPv4Checksum(Data, Count, Seed)(~ChecksumFold(ChecksumCompute(Data, Count, Seed)))
33
34/*
35 * Macro to check for a correct checksum
36 * BOOLEAN IPv4CorrectChecksum(PVOID Data, UINT Count)
37 */
38#define IPv4CorrectChecksum(Data, Count) \
39 (BOOLEAN)(IPv4Checksum(Data, Count, 0) == DH2N(0x0000FFFF))
40
41/*
42 * Macro to check for a correct checksum
43 * BOOLEAN TCPv4CorrectChecksum(PTCPv4_PSEUDO_HEADER TcpPseudoHeader,
44 * PVOID Data, UINT Count)
45 */
46#define TCPv4CorrectChecksum(TcpPseudoHeader, Data, Count) \
47 (BOOLEAN)(TCPv4Checksum(Data, Count, \
48 TCPv4Checksum(TcpPseudoHeader, sizeof(TCPv4_PSEUDO_HEADER), \
49 0)) == DH2N(0x0000FFFF))
_In_ ULONG _In_opt_ WDFREQUEST _In_opt_ PVOID _In_ size_t _In_ PVOID _In_ size_t _Out_ size_t * DataLength
Definition: cdrom.h:1444
unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum)
ULONG ChecksumCompute(PVOID Data, UINT Count, ULONG Seed)
Definition: checksum.c:27
ULONG UDPv4ChecksumCalculate(PIPv4_HEADER IPHeader, PUCHAR PacketBuffer, ULONG DataLength)
Definition: checksum.c:60
ULONG ChecksumFold(ULONG Sum)
Definition: checksum.c:15
static unsigned char buff[32768]
Definition: fatten.c:17
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
int Count
Definition: noreturn.cpp:7
static int sum(int x_, int y_)
Definition: ptr2_test.cpp:35
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59