From 19d625d1ee6725179d30e4b37c72461b487ad1d3 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Mon, 28 Feb 2011 11:30:47 +0100 Subject: [PATCH] Renamed IcmpBody to IcmpData according to the RFC 792 (Echo or Echo Reply Message section) --- src/ping/boostpinger.cpp | 10 +++++----- src/ping/icmpbody.h | 12 ------------ src/ping/icmpchecksumcalculator.h | 4 ++-- src/ping/icmpdata.h | 12 ++++++++++++ 4 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 src/ping/icmpbody.h create mode 100644 src/ping/icmpdata.h 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/icmpbody.h b/src/ping/icmpbody.h deleted file mode 100644 index 0878949..0000000 --- a/src/ping/icmpbody.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ICMPBODY_H -#define ICMPBODY_H - -#include - -//----------------------------------------------------------------------------- -// IcmpBody -//----------------------------------------------------------------------------- - -typedef std::string IcmpBody; - -#endif /* ICMPBODY_H */ 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/icmpdata.h b/src/ping/icmpdata.h new file mode 100644 index 0000000..d17c199 --- /dev/null +++ b/src/ping/icmpdata.h @@ -0,0 +1,12 @@ +#ifndef ICMPDATA_H +#define ICMPDATA_H + +#include + +//----------------------------------------------------------------------------- +// IcmpData +//----------------------------------------------------------------------------- + +typedef std::string IcmpData; + +#endif /* ICMPDATA_H */ -- 1.7.1