Microchip® Advanced Software Framework

inet_chksum.c File Reference

Incluse internet checksum functions.

#include "lwip/opt.h"
#include "lwip/inet_chksum.h"
#include "lwip/def.h"
#include <stddef.h>
#include <string.h>

Macros

#define LWIP_CHKSUM   lwip_standard_chksum
 
#define LWIP_CHKSUM_ALGORITHM   2
 

Functions

u16_t inet_chksum (void *dataptr, u16_t len)
 
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). More...
 
u16_t inet_chksum_pseudo (struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t proto, u16_t proto_len)
 
u16_t inet_chksum_pseudo_partial (struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, u8_t proto, u16_t proto_len, u16_t chksum_len)
 
static u16_t lwip_standard_chksum (void *dataptr, int len)
 

#define LWIP_CHKSUM_ALGORITHM   2

u16_t inet_chksum ( void dataptr,
u16_t  len 
)
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

References FOLD_U32T, pbuf::len, LWIP_CHKSUM, pbuf::next, NULL, pbuf::payload, and SWAP_BYTES_IN_WORD.

Referenced by icmp_input().

u16_t inet_chksum_pseudo_partial ( struct pbuf p,
ip_addr_t src,
ip_addr_t dest,
u8_t  proto,
u16_t  proto_len,
u16_t  chksum_len 
)
static u16_t lwip_standard_chksum ( void dataptr,
int  len 
)
static

References FOLD_U32T, and SWAP_BYTES_IN_WORD.