NetServices Stack source

Dependents:   HelloWorld ServoInterfaceBoardExample1 4180_Lab4

Embed: (wiki syntax)

« Back to documentation index

inet_chksum.c File Reference

inet_chksum.c File Reference

Incluse internet checksum functions. More...

Go to the source code of this file.

Functions

static u16_t lwip_standard_chksum (void *dataptr, u16_t len)
 lwip checksum
static u16_t lwip_standard_chksum (void *dataptr, int len)
 An optimized checksum routine.
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.

Detailed Description

Incluse internet checksum functions.

Definition in file inet_chksum.c.


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 409 of file 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 445 of file inet_chksum.c.

static u16_t lwip_standard_chksum ( void *  dataptr,
int  len 
) [static]

An optimized checksum routine.

Basically, it uses loop-unrolling on the checksum loop, treating the head and tail bytes specially, whereas the inner loop acts on 8 bytes at a time.

  • start of buffer to be checksummed. May be an odd byte address. number of bytes in the buffer to be checksummed.
    Returns:
    host order (!) lwip checksum (non-inverted Internet sum)
    by Curt McDowell, Broadcom Corp. December 8th, 2005

Definition at line 135 of file inet_chksum.c.

static u16_t lwip_standard_chksum ( void *  dataptr,
u16_t  len 
) [static]

lwip checksum

Parameters:
dataptrpoints to start of data to be summed at any boundary
lenlength of data to be summed
Returns:
host order (!) lwip checksum (non-inverted Internet sum)
Note:
accumulator size limits summable length to 64k
host endianess is irrelevant (p3 RFC1071)

Definition at line 81 of file inet_chksum.c.