From: Guilherme Maciel Ferreira Date: Mon, 28 Feb 2011 10:30:47 +0000 (+0100) Subject: Renamed IcmpBody to IcmpData according to the RFC 792 (Echo or Echo Reply Message... X-Git-Tag: v1.0~174 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=19d625d1ee6725179d30e4b37c72461b487ad1d3;p=pingcheck Renamed IcmpBody to IcmpData according to the RFC 792 (Echo or Echo Reply Message section) --- diff --git a/src/ping/boostpinger.cpp b/src/ping/boostpinger.cpp index 587a14e..1adb386 100644 --- a/src/ping/boostpinger.cpp +++ b/src/ping/boostpinger.cpp @@ -7,7 +7,7 @@ #include #include -#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(); diff --git a/src/ping/icmpchecksumcalculator.h b/src/ping/icmpchecksumcalculator.h index 9d475bf..fe08d3e 100644 --- a/src/ping/icmpchecksumcalculator.h +++ b/src/ping/icmpchecksumcalculator.h @@ -2,12 +2,12 @@ #define ICMPCHECKSUMCALCULATOR_H #include "checksumcalculator.h" -#include "icmpbody.h" +#include "icmpdata.h" //----------------------------------------------------------------------------- // IcmpChecksumCalculator //----------------------------------------------------------------------------- -typedef ChecksumCalculator IcmpChecksumCalculator; +typedef ChecksumCalculator IcmpChecksumCalculator; #endif /* ICMPCHECKSUMCALCULATOR_H */ diff --git a/src/ping/icmpbody.h b/src/ping/icmpdata.h similarity index 63% rename from src/ping/icmpbody.h rename to src/ping/icmpdata.h index 0878949..d17c199 100644 --- a/src/ping/icmpbody.h +++ b/src/ping/icmpdata.h @@ -1,12 +1,12 @@ -#ifndef ICMPBODY_H -#define ICMPBODY_H +#ifndef ICMPDATA_H +#define ICMPDATA_H #include //----------------------------------------------------------------------------- -// IcmpBody +// IcmpData //----------------------------------------------------------------------------- -typedef std::string IcmpBody; +typedef std::string IcmpData; -#endif /* ICMPBODY_H */ +#endif /* ICMPDATA_H */