sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
inet_chksum.h File Reference
#include "lwip/opt.h"
#include "lwip/pbuf.h"
#include "lwip/ip_addr.h"

Go to the source code of this file.

Macros

#define SWAP_BYTES_IN_WORD(w)
#define FOLD_U32T(u)
#define LWIP_CHKSUM_COPY_ALGORITHM   0

Functions

u16_t inet_chksum (const void *dataptr, u16_t len)
u16_t inet_chksum_pbuf (struct pbuf *p)
u16_t ip_chksum_pseudo (struct pbuf *p, u8_t proto, u16_t proto_len, const ip_addr_t *src, const ip_addr_t *dest)
u16_t ip_chksum_pseudo_partial (struct pbuf *p, u8_t proto, u16_t proto_len, u16_t chksum_len, const ip_addr_t *src, const ip_addr_t *dest)

Detailed Description

IP checksum calculation functions

Definition in file inet_chksum.h.

Macro Definition Documentation

◆ FOLD_U32T

#define FOLD_U32T ( u)
Value:
((u32_t)(((u) >> 16) + ((u) & 0x0000ffffUL)))

Split an u32_t in two u16_ts and add them up

Definition at line 53 of file inet_chksum.h.

◆ LWIP_CHKSUM_COPY_ALGORITHM

#define LWIP_CHKSUM_COPY_ALGORITHM   0

Definition at line 68 of file inet_chksum.h.

◆ SWAP_BYTES_IN_WORD

#define SWAP_BYTES_IN_WORD ( w)
Value:
(((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)

Swap the bytes in an u16_t: much like lwip_htons() for little-endian

Definition at line 48 of file inet_chksum.h.

Function Documentation

◆ inet_chksum()

u16_t inet_chksum ( const void * dataptr,
u16_t len )

Definition at line 555 of file inet_chksum.c.

◆ inet_chksum_pbuf()

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 inet_chksum.c.

◆ ip_chksum_pseudo()

u16_t ip_chksum_pseudo ( struct pbuf * p,
u8_t proto,
u16_t proto_len,
const ip_addr_t * src,
const ip_addr_t * dest )

Definition at line 379 of file inet_chksum.c.

◆ ip_chksum_pseudo_partial()

u16_t ip_chksum_pseudo_partial ( struct pbuf * p,
u8_t proto,
u16_t proto_len,
u16_t chksum_len,
const ip_addr_t * src,
const ip_addr_t * dest )

Definition at line 526 of file inet_chksum.c.