Barrelfish
Macros | Functions
inet_chksum.c File Reference

Macros

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

Functions

u16_t inet_chksum_pbuf (struct pbuf *p)
 

Detailed Description

Incluse internet checksum functions.

Macro Definition Documentation

#define FOLD_U32T (   u)    ((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)

Like the name says...

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