Renamed ChecksumCalculation template to Checksum
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Thu, 18 Aug 2011 02:13:57 +0000 (23:13 -0300)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@gmail.com>
Thu, 18 Aug 2011 02:13:57 +0000 (23:13 -0300)
- The name represents better an object
- Also changed the file extension from .h to .hpp, so keep templates with .hpp extension and classes with .h

src/host/checksum.hpp [moved from src/icmp/checksumcalculator.h with 87% similarity]
src/icmp/icmpchecksumcalculator.h

similarity index 87%
rename from src/icmp/checksumcalculator.h
rename to src/host/checksum.hpp
index 00e2e3e..a70dd28 100644 (file)
@@ -4,29 +4,29 @@
 // Distributed under the Boost Software License, Version 1.0.
 //    (See accompanying file LICENSE_1_0.txt or copy at
 //          http://www.boost.org/LICENSE_1_0.txt)
-#ifndef CHECKSUMCALCULATOR_H
-#define CHECKSUMCALCULATOR_H
+#ifndef CHECKSUM_HPP
+#define CHECKSUM_HPP
 
 #include <stdint.h>
 
 //-----------------------------------------------------------------------------
-// ChecksumCalculator
+// Checksum
 //-----------------------------------------------------------------------------
 
 /**
  * @brief Class that provides checksum calculation.
  */
 template<typename Iterator>
-class ChecksumCalculator
+class Checksum
 {
 public:
-    ChecksumCalculator(
+    Checksum(
             const Iterator &body_begin,
             const Iterator &body_end
     );
 
     // TODO common checksum
-    // The <typename Message> must have a method which returns an aray of works
+    // The <typename Message> must have a method which returns an array of words
     // this way the checksum calculator can be used with any ICMP, TCP, UDP...
     // uint16_t compute( const Message &message ) const
     // {
@@ -47,7 +47,7 @@ private:
 };
 
 template<typename Iterator>
-    ChecksumCalculator<Iterator>::ChecksumCalculator(
+    Checksum<Iterator>::Checksum(
             const Iterator &body_begin,
             const Iterator &body_end
     ) :
@@ -57,7 +57,7 @@ template<typename Iterator>
     }
 
 template<typename Iterator>
-    uint16_t ChecksumCalculator<Iterator>::compute(
+    uint16_t Checksum<Iterator>::compute(
             uint8_t type,
             uint8_t code,
             uint16_t identifier,
@@ -82,4 +82,4 @@ template<typename Iterator>
         return checksum;
     }
 
-#endif /* CHECKSUMCALCULATOR_H */
+#endif // CHECKSUM_HPP
index d46cfa8..d173619 100644 (file)
@@ -7,13 +7,13 @@
 #ifndef ICMPCHECKSUMCALCULATOR_H
 #define ICMPCHECKSUMCALCULATOR_H
 
-#include "icmp/checksumcalculator.h"
+#include "host/checksum.hpp"
 #include "icmp/icmpdata.h"
 
 //-----------------------------------------------------------------------------
 // IcmpChecksumCalculator
 //-----------------------------------------------------------------------------
 
-typedef ChecksumCalculator<IcmpData::const_iterator> IcmpChecksumCalculator;
+typedef Checksum<IcmpData::const_iterator> IcmpChecksumCalculator;
 
 #endif /* ICMPCHECKSUMCALCULATOR_H */