lwIP
2.1.0
Lightweight IP stack
|
Macros | |
#define | SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8) |
#define | FOLD_U32T(u) ((u32_t)(((u) >> 16) + ((u) & 0x0000ffffUL))) |
Functions | |
u16_t | inet_chksum_pbuf (struct pbuf *p) |
u16_t | ip6_chksum_pseudo (struct pbuf *p, u8_t proto, u16_t proto_len, const ip6_addr_t *src, const ip6_addr_t *dest) |
u16_t | ip6_chksum_pseudo_partial (struct pbuf *p, u8_t proto, u16_t proto_len, u16_t chksum_len, const ip6_addr_t *src, const ip6_addr_t *dest) |
IP checksum calculation functions
#define FOLD_U32T | ( | u | ) | ((u32_t)(((u) >> 16) + ((u) & 0x0000ffffUL))) |
Split an u32_t in two u16_ts and add them up
#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
u16_t inet_chksum_pbuf | ( | struct pbuf * | p | ) |
Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used).
p | pbuf chain over that the checksum should be calculated |
u16_t ip6_chksum_pseudo | ( | struct pbuf * | p, |
u8_t | proto, | ||
u16_t | proto_len, | ||
const ip6_addr_t * | src, | ||
const ip6_addr_t * | dest | ||
) |
Calculates the checksum with IPv6 pseudo header used by TCP and UDP for a pbuf chain. IPv6 addresses are expected to be in network byte order.
p | chain of pbufs over that a checksum should be calculated (ip data part) |
proto | ipv6 protocol/next header (used for checksum of pseudo header) |
proto_len | length of the ipv6 payload (used for checksum of pseudo header) |
src | source ipv6 address (used for checksum of pseudo header) |
dest | destination ipv6 address (used for checksum of pseudo header) |
u16_t ip6_chksum_pseudo_partial | ( | struct pbuf * | p, |
u8_t | proto, | ||
u16_t | proto_len, | ||
u16_t | chksum_len, | ||
const ip6_addr_t * | src, | ||
const ip6_addr_t * | dest | ||
) |
Calculates the checksum with IPv6 pseudo header used by TCP and UDP for a pbuf chain. IPv6 addresses are expected to be in network byte order. Will only compute for a portion of the payload.
p | chain of pbufs over that a checksum should be calculated (ip data part) |
proto | ipv6 protocol/next header (used for checksum of pseudo header) |
proto_len | length of the ipv6 payload (used for checksum of pseudo header) |
chksum_len | number of payload bytes used to compute chksum |
src | source ipv6 address (used for checksum of pseudo header) |
dest | destination ipv6 address (used for checksum of pseudo header) |