compiler: Don't require constructor names to be globally unique in MSVC.
[cascardo/ovs.git] / datapath-windows / ovsext / Checksum.h
1 /*
2  * Copyright (c) 2014 VMware, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __CHECKSUM_H_
18 #define __CHECKSUM_H_ 1
19
20 typedef union _OVS_PACKET_HDR_INFO *POVS_PACKET_HDR_INFO;
21
22 UINT16 CalculateChecksum(UINT8 *ptr, UINT16 length, UINT16 initial);
23 UINT16 CopyAndCalculateChecksum(UINT8 *dst, UINT8 *src, UINT16 length,
24                                 UINT16 initial);
25 UINT16 IPChecksum(UINT8 *ipHdr, UINT16 length, UINT16 initial);
26 UINT16 IPPseudoChecksum(UINT32 *src, UINT32 *dst, UINT8 protocol,
27                         UINT16 totalLength);
28 UINT16 IPv6PseudoChecksum(UINT32 *src, UINT32 *dst, UINT8 protocol,
29                           UINT16 totalLength);
30 UINT16 ChecksumUpdate32(UINT16 oldSum, UINT32 prev, UINT32 newValue);
31 UINT16 ChecksumUpdate16(UINT16 oldSum, UINT16 prev, UINT16 newValue);
32 UINT16 CalculateChecksumNB(const PNET_BUFFER nb, UINT16 csumDataLen,
33                            UINT32 offset);
34 NDIS_STATUS OvsValidateIPChecksum(PNET_BUFFER_LIST curNbl,
35                                   POVS_PACKET_HDR_INFO hdrInfo);
36 NDIS_STATUS OvsValidateUDPChecksum(PNET_BUFFER_LIST curNbl,
37                                    BOOLEAN udpCsumZero);
38
39 #endif /* __CHECKSUM_H_ */