// $Id$
//
-// Copyright (C) 2007
-// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
-// Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
+// Copyright (C) 2007
+// Fraunhofer Institute for Open Communication Systems (FOKUS)
+// Competence Center NETwork research (NET), St. Augustin, GERMANY
// Stefan Bund <g0dil@berlios.de>
//
// This program is free software; you can redistribute it and/or modify
/** \file
\brief IpChecksum public header */
-#ifndef HH_IpChecksum_
-#define HH_IpChecksum_ 1
+#ifndef HH_SENF_Utils_IpChecksum_
+#define HH_SENF_Utils_IpChecksum_ 1
// Custom includes
#include <boost/cstdint.hpp>
namespace senf {
- /** \brief
+ /** \brief 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 \e 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 \e even number of zero bytes
+ without changing the checksum value.
*/
class IpChecksum
{
///@}
///////////////////////////////////////////////////////////////////////////
- void feed(boost::uint8_t byte);
+ 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;
+ boost::uint16_t sum() const; ///< Calculate checksum
protected: