From: Guilherme Maciel Ferreira Date: Tue, 29 Mar 2011 14:24:57 +0000 (+0200) Subject: Standardizing the enumerations X-Git-Tag: v1.0~104 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=02729022817e0544a301fad4c61b9f4e82ac7ff3;p=pingcheck Standardizing the enumerations --- diff --git a/src/icmp/icmpheader.h b/src/icmp/icmpheader.h index face048..85ebc67 100644 --- a/src/icmp/icmpheader.h +++ b/src/icmp/icmpheader.h @@ -29,21 +29,22 @@ class IcmpHeader public: enum IcmpType { - EchoReply = 0, - DestinationUnreachable = 3, - SourceQuench = 4, - Redirect = 5, - EchoRequest = 8, - TimeExceeded = 11, - ParameterProblem = 12, - TimestampRequest = 13, - TimestampReply = 14, - InfoRequest = 15, - InfoReply = 16, - AddressRequest = 17, - AddressReply = 18 + IcmpType_EchoReply = 0, + IcmpType_DestinationUnreachable = 3, + IcmpType_SourceQuench = 4, + IcmpType_Redirect = 5, + IcmpType_EchoRequest = 8, + IcmpType_TimeExceeded = 11, + IcmpType_ParameterProblem = 12, + IcmpType_TimestampRequest = 13, + IcmpType_TimestampReply = 14, + IcmpType_InfoRequest = 15, + IcmpType_InfoReply = 16, + IcmpType_AddressRequest = 17, + IcmpType_AddressReply = 18 }; +public: IcmpHeader(); IcmpHeader( IcmpType type, diff --git a/src/ping/boostpinger.cpp b/src/ping/boostpinger.cpp index b40df03..4d67488 100644 --- a/src/ping/boostpinger.cpp +++ b/src/ping/boostpinger.cpp @@ -102,7 +102,7 @@ IcmpPacket BoostPinger::create_echo_request( { IcmpData icmp_data( "ping-message" ); - IcmpHeader::IcmpType type = IcmpHeader::EchoRequest; + IcmpHeader::IcmpType type = IcmpHeader::IcmpType_EchoRequest; uint8_t code = 0; uint16_t identifier = get_identifier(); IcmpChecksumCalculator calculator( icmp_data.begin(), icmp_data.end() ); @@ -188,7 +188,7 @@ void BoostPinger::handle_receive_echo_reply( const size_t &bytes_transferred ) // We can receive all ICMP packets received by the host, so we need to // filter out only the echo replies that match the our identifier and // expected sequence number. - if ( is && icmp_packet.match( IcmpHeader::EchoReply, get_identifier(), SequenceNumber ) ) + if ( is && icmp_packet.match( IcmpHeader::IcmpType_EchoReply, get_identifier(), SequenceNumber ) ) { // If this is the first reply, interrupt the echo reply timeout. if ( RepliesCount == 0 ) diff --git a/src/ping/boostpinger.h b/src/ping/boostpinger.h index c1a82ba..f363242 100644 --- a/src/ping/boostpinger.h +++ b/src/ping/boostpinger.h @@ -25,7 +25,8 @@ public: bool ping( const std::string &destination ); private: - enum PingStatus { + enum PingStatus + { PingStatus_NotSent, PingStatus_SuccessReply, PingStatus_FailureTimeout,