friendev EtherDune TCP/IP library
Static Public Member Functions | List of all members
Checksum Class Reference

Contains functions to perform IP checksum operations. More...

#include <Checksum.h>

Static Public Member Functions

static uint16_t add (uint16_t a, uint16_t b)
 Adds two checksums, taking carry into account. More...
 
static uint16_t add (uint16_t a, uint16_t b, bool odd)
 Adds two checksums, taking carry into account and whether the second one starts at an odd index More...
 
static uint16_t calc (uint16_t len, const uint8_t *data)
 Calculates the checksum of the specified buffer in memory More...
 
static uint16_t calc (uint16_t checksum, uint16_t len, const uint8_t *data)
 Calculates the checksum of the specified buffer in memory, as a continuation of a previoulsy calculated checksum More...
 

Detailed Description

Contains functions to perform IP checksum operations.

Implements memory-efficient algorithm to calculate total and partial network checksums

Definition at line 26 of file Checksum.h.

Member Function Documentation

uint16_t Checksum::add ( uint16_t  a,
uint16_t  b 
)
static

Adds two checksums, taking carry into account.

Parameters
athe first checksum value
bThe second checksum value to add
Returns
the computed checksum

Definition at line 25 of file Checksum.cpp.

uint16_t Checksum::add ( uint16_t  a,
uint16_t  b,
bool  odd 
)
static

Adds two checksums, taking carry into account and whether the second one starts at an odd index

Parameters
athe first checksum value
bThe second checksum value to add
oddWhether the second value (b) starts at an odd index
Returns
the computed checksum

Definition at line 43 of file Checksum.cpp.

uint16_t Checksum::calc ( uint16_t  len,
const uint8_t *  data 
)
static

Calculates the checksum of the specified buffer in memory

Parameters
lenlength of the buffer
dataThe data.
Returns
the computed checksum

Definition at line 59 of file Checksum.cpp.

uint16_t Checksum::calc ( uint16_t  checksum,
uint16_t  len,
const uint8_t *  data 
)
static

Calculates the checksum of the specified buffer in memory, as a continuation of a previoulsy calculated checksum

Parameters
checksumPrevious checksum to add to
lenlength of the buffer
dataThe data.
Returns
the computed checksum

Definition at line 89 of file Checksum.cpp.


The documentation for this class was generated from the following files: