Simplify ns3tcp test code used for pcap writing
authorMatthieu Coudron <mattator@gmail.com>
Wed, 22 Jul 2015 01:13:59 +0200
changeset 11520 fa9763e3cbe1
parent 11519 5ee7d73ee702
child 11521 b23ca9ee0050
Simplify ns3tcp test code used for pcap writing
src/test/ns3tcp/ns3tcp-interop-test-suite.cc
src/test/ns3tcp/ns3tcp-loss-test-suite.cc
src/test/ns3tcp/ns3tcp-state-test-suite.cc
--- a/src/test/ns3tcp/ns3tcp-interop-test-suite.cc	Wed Jul 22 01:13:06 2015 +0200
+++ b/src/test/ns3tcp/ns3tcp-interop-test-suite.cc	Wed Jul 22 01:13:59 2015 +0200
@@ -157,15 +157,10 @@
       Time tNow = Simulator::Now ();
       int64_t tMicroSeconds = tNow.GetMicroSeconds ();
 
-      uint32_t size = p->GetSize ();
-      uint8_t *buf = new uint8_t[size];
-      p->CopyData (buf, size);
-
       m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000), 
                         uint32_t (tMicroSeconds % 1000000), 
-                        buf, 
-                        size);
-      delete [] buf;
+                        p
+                        );
     }
   else
     {
--- a/src/test/ns3tcp/ns3tcp-loss-test-suite.cc	Wed Jul 22 01:13:06 2015 +0200
+++ b/src/test/ns3tcp/ns3tcp-loss-test-suite.cc	Wed Jul 22 01:13:59 2015 +0200
@@ -166,15 +166,11 @@
       Time tNow = Simulator::Now ();
       int64_t tMicroSeconds = tNow.GetMicroSeconds ();
 
-      uint32_t size = p->GetSize ();
-      uint8_t *buf = new uint8_t[size];
-      p->CopyData (buf, size);
 
       m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000), 
                         uint32_t (tMicroSeconds % 1000000), 
-                        buf, 
-                        size);
-      delete [] buf;
+                        p
+                        );
     }
   else
     {
--- a/src/test/ns3tcp/ns3tcp-state-test-suite.cc	Wed Jul 22 01:13:06 2015 +0200
+++ b/src/test/ns3tcp/ns3tcp-state-test-suite.cc	Wed Jul 22 01:13:59 2015 +0200
@@ -170,15 +170,9 @@
       Time tNow = Simulator::Now ();
       int64_t tMicroSeconds = tNow.GetMicroSeconds ();
 
-      uint32_t size = p->GetSize ();
-      uint8_t *buf = new uint8_t[size];
-      p->CopyData (buf, size);
-
       m_pcapFile.Write (uint32_t (tMicroSeconds / 1000000), 
                         uint32_t (tMicroSeconds % 1000000), 
-                        buf, 
-                        size);
-      delete [] buf;
+                        p);
     }
   else
     {