TuyaOS
宏定义 | 函数
inet_chksum.h 文件参考
#include "lwip/opt.h"
#include "lwip/pbuf.h"
#include "lwip/ip_addr.h"
inet_chksum.h 的引用(Include)关系图:

浏览源代码.

宏定义

#define FOLD_U32T(u)   ((u32_t)(((u) >> 16) + ((u) & 0x0000ffffUL)))
 
#define LWIP_CHKSUM_COPY_ALGORITHM   0
 
#define SWAP_BYTES_IN_WORD(w)   (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)
 

函数

u16_t inet_chksum (const void *dataptr, u16_t len)
 
u16_t inet_chksum_pbuf (struct pbuf *p)
 
u16_t ip_chksum_pseudo (struct pbuf *p, u8_t proto, u16_t proto_len, const ip_addr_t *src, const ip_addr_t *dest)
 
u16_t ip_chksum_pseudo_partial (struct pbuf *p, u8_t proto, u16_t proto_len, u16_t chksum_len, const ip_addr_t *src, const ip_addr_t *dest)
 

详细描述

IP checksum calculation functions

宏定义说明

◆ FOLD_U32T

#define FOLD_U32T (   u)    ((u32_t)(((u) >> 16) + ((u) & 0x0000ffffUL)))

Split an u32_t in two u16_ts and add them up

◆ SWAP_BYTES_IN_WORD

#define SWAP_BYTES_IN_WORD (   w)    (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)

Swap the bytes in an u16_t: much like lwip_htons() for little-endian