Watt-32 tcp/ip  2.2 dev-rel.10
chksum.h
Go to the documentation of this file.
1 
3 #ifndef _w32_CHECK_SUM_H
4 #define _w32_CHECK_SUM_H
5 
6 #define in_checksum_fast W32_NAMESPACE (in_checksum_fast)
7 #define do_checksum W32_NAMESPACE (do_checksum)
8 
9 extern int do_checksum (const BYTE *buf, BYTE proto, unsigned len);
10 
11 extern WORD _ip6_checksum (const in6_Header *ip, WORD proto,
12  const void *payload, unsigned payloadlen);
13 
14 extern int _ip6_tcp_checksum (const in6_Header *ip, const tcp_Header *tcp, unsigned len);
15 extern int _ip6_udp_checksum (const in6_Header *ip, const udp_Header *udp, unsigned len);
16 extern int _ip6_icmp_checksum (const in6_Header *ip, const void *icmp, unsigned len);
17 
18 /*
19  * In chksum0.asm / chksum0.s
20  * Fast asm-version doesn't work with Watcom (don't know why).
21  * LCC-win32's linker doesn't handle tasm's object files. So use
22  * the slow C-version.
23  */
24 #if (DOSX)
25  extern WORD cdecl in_checksum_fast (const void *ptr, unsigned len);
26 
27  #if defined(__WATCOMC__)
28  /* No decoration. Args on stack. All regs preserved */
29  #pragma aux (cdecl) _w32_in_checksum_fast "_*" parm caller[];
30  #elif defined(__HIGHC__)
31  #pragma alias (_w32_in_checksum_fast, "_w32_in_checksum_fast")
32  #endif
33 
34  #if defined(__WATCOMC__) || defined(__LCC__) || !defined(__i386__)
35  #define CHECKSUM(p, len) in_checksum (p, len)
36  #else
37  #define HAVE_IN_CHECKSUM_FAST
38  #define CHECKSUM(p, len) in_checksum_fast (p, len)
39  #endif
40 #else
41  #define CHECKSUM(p, len) in_checksum (p, len)
42 #endif
43 
44 #endif
int _ip6_tcp_checksum(const in6_Header *ip, const tcp_Header *tcp, unsigned len)
Check tcp header checksum of an IPv6 packet.
Definition: chksum.c:90
Definition: ip_icmp.h:62
WORD _ip6_checksum(const in6_Header *ip, WORD proto, const void *payload, unsigned payloadlen)
Generic IPv6 checksum function.
Definition: chksum.c:58
Definition: ip.h:67
int _ip6_udp_checksum(const in6_Header *ip, const udp_Header *udp, unsigned len)
Check udp header checksum of an IPv6 packet.
Definition: chksum.c:105