32 #ifndef __LWIP_INET_CHKSUM_H__
33 #define __LWIP_INET_CHKSUM_H__
37 #include "lwip/pbuf.h"
38 #include "lwip/ip_addr.h"
41 #ifndef SWAP_BYTES_IN_WORD
42 #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)
44 #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w)
47 #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)
53 #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL))
56 #if LWIP_CHECKSUM_ON_COPY
59 #ifndef LWIP_CHKSUM_COPY
60 #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len)
61 #ifndef LWIP_CHKSUM_COPY_ALGORITHM
62 #define LWIP_CHKSUM_COPY_ALGORITHM 1
66 #define LWIP_CHKSUM_COPY_ALGORITHM 0
73 u16_t inet_chksum(
void *dataptr, u16_t len)ICACHE_FLASH_ATTR;
74 u16_t inet_chksum_pbuf(
struct pbuf *p)ICACHE_FLASH_ATTR;
75 u16_t inet_chksum_pseudo(
struct pbuf *p,
76 ip_addr_t *src, ip_addr_t *dest,
77 u8_t proto, u16_t proto_len)ICACHE_FLASH_ATTR;
78 u16_t inet_chksum_pseudo_partial(
struct pbuf *p,
79 ip_addr_t *src, ip_addr_t *dest,
80 u8_t proto, u16_t proto_len, u16_t chksum_len)ICACHE_FLASH_ATTR;
81 #if LWIP_CHKSUM_COPY_ALGORITHM
82 u16_t lwip_chksum_copy(
void *dst,
const void *src, u16_t len)ICACHE_FLASH_ATTR;