Renamed IcmpBody to IcmpData according to the RFC 792 (Echo or Echo Reply Message...
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 28 Feb 2011 10:30:47 +0000 (11:30 +0100)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Mon, 28 Feb 2011 10:30:47 +0000 (11:30 +0100)
src/ping/boostpinger.cpp
src/ping/icmpchecksumcalculator.h
src/ping/icmpdata.h [moved from src/ping/icmpbody.h with 63% similarity]

index 587a14e..1adb386 100644 (file)
@@ -7,7 +7,7 @@
 #include <sys/socket.h>
 #include <sys/types.h>
 
-#include "icmpbody.h"
+#include "icmpdata.h"
 #include "icmpchecksumcalculator.h"
 #include "icmpheader.h"
 #include "ipv4header.h"
@@ -53,21 +53,21 @@ void BoostPinger::ping( const std::string &destination )
 
 void BoostPinger::start_send()
 {
-    IcmpBody body( "ping message" );
+    IcmpData data( "ping message" );
 
     // Create an ICMP header for an echo request.
     SequenceNumber++;
     IcmpHeader::IcmpType type = IcmpHeader::EchoRequest;
     uint8_t code = 0;
     uint16_t identifier = get_identifier();
-    IcmpChecksumCalculator calculator( body.begin(), body.end() );
+    IcmpChecksumCalculator calculator( data.begin(), data.end() );
     uint16_t checksum = calculator.compute( type, code, identifier, SequenceNumber );
     IcmpHeader echo_request( type, code, checksum, identifier, SequenceNumber );
 
     // Encode the request packet.
     boost::asio::streambuf request_buffer;
     std::ostream os( &request_buffer );
-    os << echo_request << body;
+    os << echo_request << data;
 
     int ping_times = SequenceNumber;
     if ( ping_times < 4 )
@@ -137,7 +137,7 @@ void BoostPinger::handle_receive( const std::size_t &length )
         if ( NumReplies == 0 )
             Timer.cancel();
 
-        NumReplies++;
+        ++NumReplies;
 
         // Print out some information about the reply packet.
         posix_time::ptime now = posix_time::microsec_clock::universal_time();
index 9d475bf..fe08d3e 100644 (file)
@@ -2,12 +2,12 @@
 #define ICMPCHECKSUMCALCULATOR_H
 
 #include "checksumcalculator.h"
-#include "icmpbody.h"
+#include "icmpdata.h"
 
 //-----------------------------------------------------------------------------
 // IcmpChecksumCalculator
 //-----------------------------------------------------------------------------
 
-typedef ChecksumCalculator<IcmpBody::iterator> IcmpChecksumCalculator;
+typedef ChecksumCalculator<IcmpData::iterator> IcmpChecksumCalculator;
 
 #endif /* ICMPCHECKSUMCALCULATOR_H */
similarity index 63%
rename from src/ping/icmpbody.h
rename to src/ping/icmpdata.h
index 0878949..d17c199 100644 (file)
@@ -1,12 +1,12 @@
-#ifndef ICMPBODY_H
-#define ICMPBODY_H
+#ifndef ICMPDATA_H
+#define ICMPDATA_H
 
 #include <string>
 
 //-----------------------------------------------------------------------------
-// IcmpBody
+// IcmpData
 //-----------------------------------------------------------------------------
 
-typedef std::string IcmpBody;
+typedef std::string IcmpData;
 
-#endif /* ICMPBODY_H */
+#endif /* ICMPDATA_H */