diff -r ca451dc20c4d src/helper/wimax-helper.cc --- a/src/helper/wimax-helper.cc Wed Sep 22 12:42:07 2010 -0700 +++ b/src/helper/wimax-helper.cc Sun Sep 26 23:25:55 2010 -0500 @@ -545,26 +545,16 @@ WimaxHelper::EnableAsciiInternal (Ptr file, - Ptr burst) +static void PcapSniffTxRxEvent (Ptr file, + Ptr burst) { std::list > packets = burst->GetPackets (); for (std::list >::iterator iter = packets.begin (); iter != packets.end (); ++iter) { - WimaxMacToMacHeader m2m ((*iter)->GetSize ()); - (*iter)->AddHeader (m2m); - file->Write (Simulator::Now (), (*iter)); - } -} - -static void PcapSniffRxEvent (Ptr file, Ptr burst) -{ - std::list > packets = burst->GetPackets (); - for (std::list >::iterator iter = packets.begin (); iter != packets.end (); ++iter) - { - WimaxMacToMacHeader m2m ((*iter)->GetSize ()); - (*iter)->AddHeader (m2m); - file->Write (Simulator::Now (), (*iter)); + Ptr p = (*iter)->Copy (); + WimaxMacToMacHeader m2m (p->GetSize ()); + p->AddHeader (m2m); + file->Write (Simulator::Now (), p); } } @@ -597,8 +587,8 @@ WimaxHelper::EnablePcapInternal (std::st Ptr file = pcapHelper.CreateFile (filename, std::ios::out, PcapHelper::DLT_EN10MB); - phy->TraceConnectWithoutContext ("Tx", MakeBoundCallback (&PcapSniffTxEvent, file)); - phy->TraceConnectWithoutContext ("Rx", MakeBoundCallback (&PcapSniffRxEvent, file)); + phy->TraceConnectWithoutContext ("Tx", MakeBoundCallback (&PcapSniffTxRxEvent, file)); + phy->TraceConnectWithoutContext ("Rx", MakeBoundCallback (&PcapSniffTxRxEvent, file)); } } // namespace ns3