added debug option enforcing dump of ICMP packets even if not broken
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 26 Feb 2015 15:48:08 +0000 (16:48 +0100)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Thu, 26 Feb 2015 15:48:08 +0000 (16:48 +0100)
src/icmp/icmppacketfactory.cpp

index 78163ce..448e5c0 100644 (file)
@@ -128,6 +128,7 @@ void dump_packet(const std::string &data)
 //-----------------------------------------------------------------------------
 
 bool dump_broken_packets = true;
+bool dump_all_packets = false;
 
 /**
  * @brief Creates an ICMP packet from the input stream @c std::istream.
@@ -166,7 +167,7 @@ IcmpPacketItem IcmpPacketFactory::create_icmp_packet(
     stringbuf data_backup;
 
     // read packet from stream, possibly copying data first
-    if (dump_broken_packets)
+    if (dump_broken_packets | dump_all_packets)
     {
         // read all data into backup
         ostream backup_filler(&data_backup);
@@ -198,7 +199,7 @@ IcmpPacketItem IcmpPacketFactory::create_icmp_packet(
     }
 
     // dump data if had trouble with packet
-    if (dump_broken_packets && !icmp_packet)
+    if ( (dump_broken_packets && !icmp_packet) | dump_all_packets )
         dump_packet(data_backup.str());
 
     return icmp_packet;