src/helper/point-to-point-helper.cc
changeset 6085 94b282f335d2
parent 6053 b17ea72acee9
child 6091 ab0d5e641fd7
equal deleted inserted replaced
6084:42bbd2a3dd1a 6085:94b282f335d2
    67 {
    67 {
    68   m_channelFactory.Set (n1, v1);
    68   m_channelFactory.Set (n1, v1);
    69 }
    69 }
    70 
    70 
    71 void 
    71 void 
    72 PointToPointHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous)
    72 PointToPointHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool explicitFilename, bool promiscuous)
    73 {
    73 {
    74   //
    74   //
    75   // All of the Pcap enable functions vector through here including the ones
    75   // All of the Pcap enable functions vector through here including the ones
    76   // that are wandering through all of devices on perhaps all of the nodes in
    76   // that are wandering through all of devices on perhaps all of the nodes in
    77   // the system.  We can only deal with devices of type PointToPointNetDevice.
    77   // the system.  We can only deal with devices of type PointToPointNetDevice.
    82       NS_LOG_INFO ("PointToPointHelper::EnablePcapInternal(): Device " << device << " not of type ns3::PointToPointNetDevice");
    82       NS_LOG_INFO ("PointToPointHelper::EnablePcapInternal(): Device " << device << " not of type ns3::PointToPointNetDevice");
    83       return;
    83       return;
    84     }
    84     }
    85 
    85 
    86   PcapHelper pcapHelper;
    86   PcapHelper pcapHelper;
    87   std::string filename = pcapHelper.GetFilenameFromDevice (prefix, device);
    87 
       
    88   std::string filename;
       
    89   if (explicitFilename)
       
    90     {
       
    91       filename = prefix;
       
    92     }
       
    93   else
       
    94     {
       
    95       filename = pcapHelper.GetFilenameFromDevice (prefix, device);
       
    96     }
       
    97 
    88   Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_PPP);
    98   Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, "w", PcapHelper::DLT_PPP);
    89   pcapHelper.HookDefaultSink<PointToPointNetDevice> (device, "PromiscSniffer", file);
    99   pcapHelper.HookDefaultSink<PointToPointNetDevice> (device, "PromiscSniffer", file);
    90 }
   100 }
    91 
   101 
    92 void 
   102 void