senf::IpChecksum Class Reference

Calculate TCP/IP 16bit checksum value. More...

#include <senf/Utils/IpChecksum.hh>

List of all members.


Detailed Description

Calculate TCP/IP 16bit checksum value.

This class allows calculation of the 16bit checksum value as defined in the TCP/IP v4 RFC's. This checksum is not a CRC.

To calculate the checksum, you create an instance of IpChecksum. You then repeatedly call the feed() members to pass data in. After all data has been processed, the sum() member will return the calculated checksum.

The mathematical properties of the checksum allow to skip any even number of zero bytes without changing the checksum value.

Definition at line 49 of file IpChecksum.hh.


Public Member Functions

void  feed (boost::uint8_t byte)
  Feed single byte.
template<class InputIterator >
void  feed (InputIterator b, InputIterator e)
  Feed range of bytes.
boost::uint16_t  sum () const
  Calculate checksum.

Structors and default members

  IpChecksum ()

Constructor & Destructor Documentation

senf::IpChecksum::
IpChecksum ()

Definition at line 31 of file IpChecksum.cci.


Member Function Documentation

template<class InputIterator >
void senf::IpChecksum::
feed ( InputIterator  b,
InputIterator  e )

Feed range of bytes.

Definition at line 34 of file IpChecksum.cti.

void senf::IpChecksum::
feed ( boost::uint8_t  byte )

Feed single byte.

Definition at line 35 of file IpChecksum.cci.

boost::uint16_t senf::IpChecksum::
sum ()

Calculate checksum.

Definition at line 41 of file IpChecksum.cci.


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