Rtos API example

Embed: (wiki syntax)

« Back to documentation index

inet_chksum.h File Reference

inet_chksum.h File Reference

IP checksum calculation functions. More...

Go to the source code of this file.

Functions

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).
u16_t lwip_chksum_copy (void *dst, const void *src, u16_t len)
 Safe but slow: first call MEMCPY, then call LWIP_CHKSUM.
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.
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.

Detailed Description

IP checksum calculation functions.

Definition in file inet_chksum.h.


Function Documentation

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).

Parameters:
ppbuf chain over that the checksum should be calculated
Returns:
checksum (as u16_t) to be saved directly in the protocol header

Definition at line 568 of file lwip_inet_chksum.c.

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.

Parameters:
pchain of pbufs over that a checksum should be calculated (ip data part)
protoipv6 protocol/next header (used for checksum of pseudo header)
proto_lenlength of the ipv6 payload (used for checksum of pseudo header)
srcsource ipv6 address (used for checksum of pseudo header)
destdestination ipv6 address (used for checksum of pseudo header)
Returns:
checksum (as u16_t) to be saved directly in the protocol header

Definition at line 343 of file lwip_inet_chksum.c.

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.

Parameters:
pchain of pbufs over that a checksum should be calculated (ip data part)
protoipv6 protocol/next header (used for checksum of pseudo header)
proto_lenlength of the ipv6 payload (used for checksum of pseudo header)
chksum_lennumber of payload bytes used to compute chksum
srcsource ipv6 address (used for checksum of pseudo header)
destdestination ipv6 address (used for checksum of pseudo header)
Returns:
checksum (as u16_t) to be saved directly in the protocol header

Definition at line 491 of file lwip_inet_chksum.c.

u16_t lwip_chksum_copy ( void *  dst,
const void *  src,
u16_t  len 
)

Safe but slow: first call MEMCPY, then call LWIP_CHKSUM.

For architectures with big caches, data might still be in cache when generating the checksum after copying.

Definition at line 604 of file lwip_inet_chksum.c.