src/helper/point-to-point-helper.cc
changeset 4264 9d2e96c4e6e4
parent 4263 fec2f830d015
child 4448 641b88d1e131
--- a/src/helper/point-to-point-helper.cc	Sat Feb 28 16:25:24 2009 -0800
+++ b/src/helper/point-to-point-helper.cc	Tue Mar 10 23:47:55 2009 -0700
@@ -90,9 +90,24 @@
   pcap->Open (oss.str ());
   pcap->WritePppHeader ();
   oss.str ("");
-  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/Sniffer";
+  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
+  oss << "/$ns3::PointToPointNetDevice/PromiscSniffer";
   Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PointToPointHelper::SniffEvent, pcap));
 }
+
+void 
+PointToPointHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd)
+{
+  EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
+}
+
+void 
+PointToPointHelper::EnablePcap (std::string filename, std::string ndName)
+{
+  Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
+  EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
+}
+
 void 
 PointToPointHelper::EnablePcap (std::string filename, NetDeviceContainer d)
 {
@@ -102,6 +117,7 @@
       EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
     }
 }
+
 void
 PointToPointHelper::EnablePcap (std::string filename, NodeContainer n)
 {
@@ -140,6 +156,7 @@
   oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::PointToPointNetDevice/TxQueue/Drop";
   Config::Connect (oss.str (), MakeBoundCallback (&PointToPointHelper::AsciiDropEvent, &os));
 }
+
 void 
 PointToPointHelper::EnableAscii (std::ostream &os, NetDeviceContainer d)
 {
@@ -149,6 +166,7 @@
       EnableAscii (os, dev->GetNode ()->GetId (), dev->GetIfIndex ());
     }
 }
+
 void
 PointToPointHelper::EnableAscii (std::ostream &os, NodeContainer n)
 {
@@ -248,24 +266,28 @@
 {
   writer->WritePacket (packet);
 }
+
 void 
 PointToPointHelper::AsciiEnqueueEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
 {
   *os << "+ " << Simulator::Now ().GetSeconds () << " ";
   *os << path << " " << *packet << std::endl;
 }
+
 void 
 PointToPointHelper::AsciiDequeueEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
 {
   *os << "- " << Simulator::Now ().GetSeconds () << " ";
   *os << path << " " << *packet << std::endl;
 }
+
 void 
 PointToPointHelper::AsciiDropEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
 {
   *os << "d " << Simulator::Now ().GetSeconds () << " ";
   *os << path << " " << *packet << std::endl;
 }
+
 void 
 PointToPointHelper::AsciiRxEvent (std::ostream *os, std::string path, Ptr<const Packet> packet)
 {
@@ -273,5 +295,4 @@
   *os << path << " " << *packet << std::endl;
 }
 
-
 } // namespace ns3