Standardizing the enumerations
authorGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Tue, 29 Mar 2011 14:24:57 +0000 (16:24 +0200)
committerGuilherme Maciel Ferreira <guilherme.maciel.ferreira@intra2net.com>
Tue, 29 Mar 2011 14:24:57 +0000 (16:24 +0200)
src/icmp/icmpheader.h
src/ping/boostpinger.cpp
src/ping/boostpinger.h

index face048..85ebc67 100644 (file)
@@ -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,
index b40df03..4d67488 100644 (file)
@@ -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 )
index c1a82ba..f363242 100644 (file)
@@ -25,7 +25,8 @@ public:
     bool ping( const std::string &destination );
 
 private:
-    enum PingStatus {
+    enum PingStatus
+    {
         PingStatus_NotSent,
         PingStatus_SuccessReply,
         PingStatus_FailureTimeout,