limit line length of new files to 80 characters
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 4 Feb 2015 11:02:11 +0000 (12:02 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Wed, 4 Feb 2015 11:02:11 +0000 (12:02 +0100)
src/icmp/icmppacketdistributor.cpp
src/icmp/icmppacketdistributor.h

index 7850305..26c4178 100644 (file)
@@ -135,7 +135,7 @@ IcmpPacketDistributor::IcmpPacketDistributor(
 
 void IcmpPacketDistributor::register_receive_handler()
 {
-    // Waiting for a reply, We prepare the buffer to receive up to SOCKET_BUFFER_SIZE bytes
+    // wait for reply, prepare buffer to receive up to SOCKET_BUFFER_SIZE bytes
     Socket->async_receive(
             ReplyBuffer.prepare( SOCKET_BUFFER_SIZE ),
             boost::bind( &IcmpPacketDistributor::handle_receive, this,
@@ -144,8 +144,9 @@ void IcmpPacketDistributor::register_receive_handler()
     );
 }
 
-void IcmpPacketDistributor::handle_receive( const boost::system::error_code &error,
-                                           const size_t &bytes_transferred )
+void IcmpPacketDistributor::handle_receive(
+                                        const boost::system::error_code &error,
+                                        const size_t &bytes_transferred )
 {
     if ( error )
     {
@@ -172,23 +173,27 @@ void IcmpPacketDistributor::handle_receive( const boost::system::error_code &err
         }
 
         // Decode the reply packet.
-        IcmpPacketItem icmp_packet = IcmpPacketFactory::create_icmp_packet( Protocol, is );
+        IcmpPacketItem icmp_packet = IcmpPacketFactory::create_icmp_packet(
+                                                                 Protocol, is );
         if ( !icmp_packet )
         {
-            GlobalLogger.warning() << "Ignoring broken ICMP packet" << std::endl;
+            GlobalLogger.warning() << "Ignoring broken ICMP packet"
+                                   << std::endl;
         }
 
         // check which pinger wants this packet
         bool packet_matches = false;
         BOOST_FOREACH( IcmpPingerItem pinger, PingerList )
         {
-            packet_matches |= pinger->handle_receive_icmp_packet(icmp_packet, bytes_received);
+            packet_matches |= pinger->handle_receive_icmp_packet(icmp_packet,
+                                                                bytes_received);
             if (packet_matches)
                 break;
         }
 
         if (!packet_matches)
-            GlobalLogger.warning() << "Packet did not match any pinger" << std::endl;
+            GlobalLogger.warning() << "Packet did not match any pinger"
+                                   << std::endl;
 
     catch ( ... )
     {
@@ -204,10 +209,12 @@ bool IcmpPacketDistributor::register_pinger( const IcmpPingerItem new_pinger )
     std::pair<PingerListIterator, bool> result = PingerList.insert(new_pinger);
     bool was_new = result.second;
     if (was_new)
-        GlobalLogger.info() << "Register new pinger with IcmpPacketDistributor" << std::endl;
+        GlobalLogger.info() << "Register new pinger with IcmpPacketDistributor"
+                            << std::endl;
     else
-        GlobalLogger.warning() << "Pinger to register was already known in IcmpPacketDistributor"
-                               << std::endl;
+        GlobalLogger.warning()
+            << "Pinger to register was already known in IcmpPacketDistributor"
+            << std::endl;
     return was_new;
 }
 
@@ -217,10 +224,12 @@ bool IcmpPacketDistributor::unregister_pinger( const IcmpPingerItem old_pinger )
     int n_erased = PingerList.erase(old_pinger);
     bool was_erased = n_erased > 0;
     if (was_erased)
-        GlobalLogger.info() << "Removed pinger from IcmpPacketDistributor" << std::endl;
+        GlobalLogger.info() << "Removed pinger from IcmpPacketDistributor"
+                            << std::endl;
     else
-        GlobalLogger.warning() << "Could not find pinger to remove from IcmpPacketDistributor"
-                               << std::endl;
+        GlobalLogger.warning()
+            << "Could not find pinger to remove from IcmpPacketDistributor"
+            << std::endl;
     return was_erased;
 }
 
@@ -243,14 +252,16 @@ void IcmpPacketDistributor::clean_up()
     PingerList.clear();
 
     boost::system::error_code error;
-    //Socket->shutdown(icmp::socket::shutdown_both, error);    // both=send and receive
+    //Socket->shutdown(icmp::socket::shutdown_both, error);  //both=send&receive
     //if ( error )
-    //    GlobalLogger.warning() << "Received error " << error << " when shutting down ICMP socket";
+    //    GlobalLogger.warning() << "Received error " << error
+    //                           << " when shutting down ICMP socket";
     // always gave an error system:9 (probably EBADF: Bad file descriptor)
 
     Socket->close(error);
     if ( error )
-        GlobalLogger.warning() << "Received error " << error << " when closing ICMP socket";
+        GlobalLogger.warning() << "Received error " << error
+                               << " when closing ICMP socket";
 }
 
 IcmpPacketDistributor::~IcmpPacketDistributor()
index 0147cc1..c8cfec7 100644 (file)
@@ -36,7 +36,8 @@ using boost::asio::ip::icmp;
 
 // for each IP protocol (v4/v6) and each network interface (string),
 //   there can only be one IcmpPacketDistributor instance
-typedef std::pair<icmp::socket::protocol_type, std::string> DistributorInstanceIdentifier;
+typedef std::pair<icmp::socket::protocol_type, std::string>
+                                                 DistributorInstanceIdentifier;
 
 struct IcmpPacketDistributorInstanceIdentifierComparator
 {