X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2FIpChecksum.hh;h=89b3f4f4c81ef2e32b2bf14b04c06fba3c4bf35d;hb=f00a102138bcbabdaab1caab1db6a8876463dedc;hp=7efb55d6fe6a1e3cea438ad97059e46110bbc97e;hpb=ff0f2fabb3dbb76ee9383a98291a1420d2a59a7f;p=senf.git diff --git a/Utils/IpChecksum.hh b/Utils/IpChecksum.hh index 7efb55d..89b3f4f 100644 --- a/Utils/IpChecksum.hh +++ b/Utils/IpChecksum.hh @@ -34,7 +34,17 @@ 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 { @@ -51,12 +61,13 @@ namespace senf { ///@} /////////////////////////////////////////////////////////////////////////// - void feed(boost::uint8_t byte); + void feed(boost::uint8_t byte); ///< Feed single byte template void feed(InputIterator b, InputIterator e); + ///< Feed range of bytes - boost::uint16_t sum() const; + boost::uint16_t sum() const; ///< Calculate checksum protected: