src/helper/yans-wifi-helper.cc
changeset 4264 9d2e96c4e6e4
parent 4263 fec2f830d015
child 4492 3ebeb7bf3c15
equal deleted inserted replaced
4263:fec2f830d015 4264:9d2e96c4e6e4
   218   // with the locally-defined WifiPhyHelper::Create method.
   218   // with the locally-defined WifiPhyHelper::Create method.
   219   Ptr<PcapWriter> pcap = ::ns3::Create<PcapWriter> ();
   219   Ptr<PcapWriter> pcap = ::ns3::Create<PcapWriter> ();
   220   pcap->Open (oss.str ());
   220   pcap->Open (oss.str ());
   221   pcap->WriteWifiHeader ();
   221   pcap->WriteWifiHeader ();
   222   oss.str ("");
   222   oss.str ("");
   223   oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WifiNetDevice/Phy/PromiscSniffer";
   223   oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid;
       
   224   oss << "/$ns3::WifiNetDevice/Phy/PromiscSniffer";
   224   Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapSnifferEvent, pcap));
   225   Config::ConnectWithoutContext (oss.str (), MakeBoundCallback (&PcapSnifferEvent, pcap));
   225 }
   226 }
       
   227 
   226 void 
   228 void 
   227 YansWifiPhyHelper::EnablePcap (std::string filename, NetDeviceContainer d)
   229 YansWifiPhyHelper::EnablePcap (std::string filename, NetDeviceContainer d)
   228 {
   230 {
   229   for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
   231   for (NetDeviceContainer::Iterator i = d.Begin (); i != d.End (); ++i)
   230     {
   232     {
   231       Ptr<NetDevice> dev = *i;
   233       Ptr<NetDevice> dev = *i;
   232       EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
   234       EnablePcap (filename, dev->GetNode ()->GetId (), dev->GetIfIndex ());
   233     }
   235     }
   234 }
   236 }
       
   237 
       
   238 void 
       
   239 YansWifiPhyHelper::EnablePcap (std::string filename, Ptr<NetDevice> nd)
       
   240 {
       
   241   EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
       
   242 }
       
   243 
       
   244 void 
       
   245 YansWifiPhyHelper::EnablePcap (std::string filename, std::string ndName)
       
   246 {
       
   247   Ptr<NetDevice> nd = Names::Find<NetDevice> (ndName);
       
   248   EnablePcap (filename, nd->GetNode ()->GetId (), nd->GetIfIndex ());
       
   249 }
       
   250 
   235 void
   251 void
   236 YansWifiPhyHelper::EnablePcap (std::string filename, NodeContainer n)
   252 YansWifiPhyHelper::EnablePcap (std::string filename, NodeContainer n)
   237 {
   253 {
   238   NetDeviceContainer devs;
   254   NetDeviceContainer devs;
   239   for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
   255   for (NodeContainer::Iterator i = n.Begin (); i != n.End (); ++i)
   292 YansWifiPhyHelper::EnableAsciiAll (std::ostream &os)
   308 YansWifiPhyHelper::EnableAsciiAll (std::ostream &os)
   293 {
   309 {
   294   EnableAscii (os, NodeContainer::GetGlobal ());
   310   EnableAscii (os, NodeContainer::GetGlobal ());
   295 }
   311 }
   296 
   312 
   297 
       
   298 
       
   299 } // namespace ns3
   313 } // namespace ns3