A Discrete-Event Network Simulator
API
wave-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: Junling Bu <linlinjavaer@gmail.com>
17  */
18 #include "ns3/wifi-mac.h"
19 #include "ns3/wifi-phy.h"
20 #include "ns3/log.h"
21 #include "ns3/pointer.h"
22 #include "ns3/string.h"
23 #include "ns3/wifi-mode.h"
24 #include "ns3/config.h"
25 #include "ns3/names.h"
26 #include "ns3/abort.h"
27 #include "ns3/wave-net-device.h"
28 #include "ns3/minstrel-wifi-manager.h"
29 #include "ns3/radiotap-header.h"
30 #include "wave-mac-helper.h"
31 #include "wave-helper.h"
32 
33 NS_LOG_COMPONENT_DEFINE ("WaveHelper");
34 
35 namespace ns3 {
36 
37 static void
40  std::string context,
42  WifiMode mode,
43  WifiPreamble preamble,
44  uint8_t txLevel)
45 {
46  NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
47  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
48 }
49 
50 static void
54  WifiMode mode,
55  WifiPreamble preamble,
56  uint8_t txLevel)
57 {
58  NS_LOG_FUNCTION (stream << p << mode << preamble << txLevel);
59  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
60 }
61 
62 static void
65  std::string context,
67  double snr,
68  WifiMode mode,
69  enum WifiPreamble preamble)
70 {
71  NS_LOG_FUNCTION (stream << context << p << snr << mode << preamble);
72  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
73 }
74 
75 static void
79  double snr,
80  WifiMode mode,
81  enum WifiPreamble preamble)
82 {
83  NS_LOG_FUNCTION (stream << p << snr << mode << preamble);
84  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
85 }
86 
87 static void
90  Ptr<const Packet> packet,
91  uint16_t channelFreqMhz,
92  uint16_t channelNumber,
93  uint32_t rate,
94  bool isShortPreamble,
95  uint8_t txPower)
96 {
97  uint32_t dlt = file->GetDataLinkType ();
98 
99  switch (dlt)
100  {
102  file->Write (Simulator::Now (), packet);
103  return;
105  {
106  NS_FATAL_ERROR ("PcapSniffTxEvent(): DLT_PRISM_HEADER not implemented");
107  return;
108  }
110  {
111  Ptr<Packet> p = packet->Copy ();
112  RadiotapHeader header;
113  uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
114  header.SetTsft (Simulator::Now ().GetMicroSeconds ());
115 
116  // Our capture includes the FCS, so we set the flag to say so.
118 
119  if (isShortPreamble)
120  {
122  }
123 
124  header.SetFrameFlags (frameFlags);
125  header.SetRate (rate);
126 
127  uint16_t channelFlags = 0;
128  switch (rate)
129  {
130  case 2: // 1Mbps
131  case 4: // 2Mbps
132  case 10: // 5Mbps
133  case 22: // 11Mbps
134  channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
135  break;
136 
137  default:
138  channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
139  break;
140  }
141 
142  if (channelFreqMhz < 2500)
143  {
145  }
146  else
147  {
149  }
150 
151  header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
152 
153 
154  p->AddHeader (header);
155  file->Write (Simulator::Now (), p);
156  return;
157  }
158  default:
159  NS_ABORT_MSG ("PcapSniffTxEvent(): Unexpected data link type " << dlt);
160  }
161 }
162 
163 static void
166  Ptr<const Packet> packet,
167  uint16_t channelFreqMhz,
168  uint16_t channelNumber,
169  uint32_t rate,
170  bool isShortPreamble,
171  double signalDbm,
172  double noiseDbm)
173 {
174  uint32_t dlt = file->GetDataLinkType ();
175 
176  switch (dlt)
177  {
179  file->Write (Simulator::Now (), packet);
180  return;
182  {
183  NS_FATAL_ERROR ("PcapSniffRxEvent(): DLT_PRISM_HEADER not implemented");
184  return;
185  }
187  {
188  Ptr<Packet> p = packet->Copy ();
189  RadiotapHeader header;
190  uint8_t frameFlags = RadiotapHeader::FRAME_FLAG_NONE;
191  header.SetTsft (Simulator::Now ().GetMicroSeconds ());
192 
193  // Our capture includes the FCS, so we set the flag to say so.
195 
196  if (isShortPreamble)
197  {
199  }
200 
201  header.SetFrameFlags (frameFlags);
202  header.SetRate (rate);
203 
204  uint16_t channelFlags = 0;
205  switch (rate)
206  {
207  case 2: // 1Mbps
208  case 4: // 2Mbps
209  case 10: // 5Mbps
210  case 22: // 11Mbps
211  channelFlags |= RadiotapHeader::CHANNEL_FLAG_CCK;
212  break;
213 
214  default:
215  channelFlags |= RadiotapHeader::CHANNEL_FLAG_OFDM;
216  break;
217  }
218 
219  if (channelFreqMhz < 2500)
220  {
222  }
223  else
224  {
226  }
227 
228  header.SetChannelFrequencyAndFlags (channelFreqMhz, channelFlags);
229 
230  header.SetAntennaSignalPower (signalDbm);
231  header.SetAntennaNoisePower (noiseDbm);
232 
233  p->AddHeader (header);
234  file->Write (Simulator::Now (), p);
235  return;
236  }
237  default:
238  NS_ABORT_MSG ("PcapSniffRxEvent(): Unexpected data link type " << dlt);
239  }
240 }
241 
242 /****************************** YansWavePhyHelper ***********************************/
243 YansWavePhyHelper
245 {
246  YansWavePhyHelper helper;
247  helper.SetErrorRateModel ("ns3::NistErrorRateModel");
248  return helper;
249 }
250 
251 void
252 YansWavePhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
253 {
254  //
255  // All of the Pcap enable functions vector through here including the ones
256  // that are wandering through all of devices on perhaps all of the nodes in
257  // the system. We can only deal with devices of type WaveNetDevice.
258  //
259  Ptr<WaveNetDevice> device = nd->GetObject<WaveNetDevice> ();
260  if (device == 0)
261  {
262  NS_LOG_INFO ("YansWavePhyHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WaveNetDevice");
263  return;
264  }
265 
266  std::vector<Ptr<WifiPhy> > phys = device->GetPhys ();
267  NS_ABORT_MSG_IF (phys.size () == 0, "EnablePcapInternal(): Phy layer in WaveNetDevice must be set");
268 
269  PcapHelper pcapHelper;
270 
271  std::string filename;
272  if (explicitFilename)
273  {
274  filename = prefix;
275  }
276  else
277  {
278  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
279  }
280 
281  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, GetPcapDataLinkType ());
282 
283  std::vector<Ptr<WifiPhy> >::iterator i;
284  for (i = phys.begin (); i != phys.end (); ++i)
285  {
286  Ptr<WifiPhy> phy = (*i);
287  phy->TraceConnectWithoutContext ("MonitorSnifferTx", MakeBoundCallback (&PcapSniffTxEvent, file));
288  phy->TraceConnectWithoutContext ("MonitorSnifferRx", MakeBoundCallback (&PcapSniffRxEvent, file));
289  }
290 }
291 
292 void
295  std::string prefix,
296  Ptr<NetDevice> nd,
297  bool explicitFilename)
298 {
299  //
300  // All of the ascii enable functions vector through here including the ones
301  // that are wandering through all of devices on perhaps all of the nodes in
302  // the system. We can only deal with devices of type WaveNetDevice.
303  //
304  Ptr<WaveNetDevice> device = nd->GetObject<WaveNetDevice> ();
305  if (device == 0)
306  {
307  NS_LOG_INFO ("EnableAsciiInternal(): Device " << device << " not of type ns3::WaveNetDevice");
308  return;
309  }
310 
311  //
312  // Our trace sinks are going to use packet printing, so we have to make sure
313  // that is turned on.
314  //
316 
317  uint32_t nodeid = nd->GetNode ()->GetId ();
318  uint32_t deviceid = nd->GetIfIndex ();
319  std::ostringstream oss;
320 
321  //
322  // If we are not provided an OutputStreamWrapper, we are expected to create
323  // one using the usual trace filename conventions and write our traces
324  // without a context since there will be one file per context and therefore
325  // the context would be redundant.
326  //
327  if (stream == 0)
328  {
329  //
330  // Set up an output stream object to deal with private ofstream copy
331  // constructor and lifetime issues. Let the helper decide the actual
332  // name of the file given the prefix.
333  //
334  AsciiTraceHelper asciiTraceHelper;
335 
336  std::string filename;
337  if (explicitFilename)
338  {
339  filename = prefix;
340  }
341  else
342  {
343  filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
344  }
345 
346  Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
347  //
348  // We could go poking through the phy and the state looking for the
349  // correct trace source, but we can let Config deal with that with
350  // some search cost. Since this is presumably happening at topology
351  // creation time, it doesn't seem much of a price to pay.
352  //
353  oss.str ("");
354  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/RxOk";
356 
357  oss.str ("");
358  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/Tx";
360 
361  return;
362  }
363 
364  //
365  // If we are provided an OutputStreamWrapper, we are expected to use it, and
366  // to provide a context. We are free to come up with our own context if we
367  // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
368  // compatibility and simplicity, we just use Config::Connect and let it deal
369  // with coming up with a context.
370  //
371  oss.str ("");
372  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/RxOk";
374 
375  oss.str ("");
376  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/Tx";
378 }
379 
380 /********************************** WaveHelper ******************************************/
382 {
383 }
384 
386 {
387 }
388 
391 {
392  WaveHelper helper;
393  // default 7 MAC entities and single PHY device.
395  helper.CreatePhys (1);
396  helper.SetChannelScheduler ("ns3::DefaultChannelScheduler");
397  helper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
398  "DataMode", StringValue ("OfdmRate6MbpsBW10MHz"),
399  "ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"),
400  "NonUnicastMode", StringValue ("OfdmRate6MbpsBW10MHz"));
401  return helper;
402 }
403 
404 void
405 WaveHelper::CreateMacForChannel (std::vector<uint32_t> channelNumbers)
406 {
407  if (channelNumbers.size () == 0)
408  {
409  NS_FATAL_ERROR ("the WAVE MAC entities is at least one");
410  }
411  for (std::vector<uint32_t>::iterator i = channelNumbers.begin (); i != channelNumbers.end (); ++i)
412  {
414  {
415  NS_FATAL_ERROR ("the channel number " << (*i) << " is not a valid WAVE channel number");
416  }
417  }
418  m_macsForChannelNumber = channelNumbers;
419 }
420 
421 void
422 WaveHelper::CreatePhys (uint32_t phys)
423 {
424  if (phys == 0)
425  {
426  NS_FATAL_ERROR ("the WAVE PHY entities is at least one");
427  }
429  {
430  NS_FATAL_ERROR ("the number of assigned WAVE PHY entities is more than the number of valid WAVE channels");
431  }
432  m_physNumber = phys;
433 }
434 
435 void
437  std::string n0, const AttributeValue &v0,
438  std::string n1, const AttributeValue &v1,
439  std::string n2, const AttributeValue &v2,
440  std::string n3, const AttributeValue &v3,
441  std::string n4, const AttributeValue &v4,
442  std::string n5, const AttributeValue &v5,
443  std::string n6, const AttributeValue &v6,
444  std::string n7, const AttributeValue &v7)
445 {
448  m_stationManager.Set (n0, v0);
449  m_stationManager.Set (n1, v1);
450  m_stationManager.Set (n2, v2);
451  m_stationManager.Set (n3, v3);
452  m_stationManager.Set (n4, v4);
453  m_stationManager.Set (n5, v5);
454  m_stationManager.Set (n6, v6);
455  m_stationManager.Set (n7, v7);
456 }
457 
458 void
460  std::string n0, const AttributeValue &v0,
461  std::string n1, const AttributeValue &v1,
462  std::string n2, const AttributeValue &v2,
463  std::string n3, const AttributeValue &v3,
464  std::string n4, const AttributeValue &v4,
465  std::string n5, const AttributeValue &v5,
466  std::string n6, const AttributeValue &v6,
467  std::string n7, const AttributeValue &v7)
468 {
471  m_channelScheduler.Set (n0, v0);
472  m_channelScheduler.Set (n1, v1);
473  m_channelScheduler.Set (n2, v2);
474  m_channelScheduler.Set (n3, v3);
475  m_channelScheduler.Set (n4, v4);
476  m_channelScheduler.Set (n5, v5);
477  m_channelScheduler.Set (n6, v6);
478  m_channelScheduler.Set (n7, v7);
479 }
480 
482 WaveHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const
483 {
484  try
485  {
486  const QosWaveMacHelper& qosMac = dynamic_cast<const QosWaveMacHelper&> (macHelper);
487  // below check will never fail, just used for survive from
488  // gcc warn "-Wunused-but-set-variable"
489  if (&qosMac == 0)
490  {
491  NS_FATAL_ERROR ("it could never get here");
492  }
493  }
494  catch (const std::bad_cast &)
495  {
496  NS_FATAL_ERROR ("WifiMacHelper should be the class or subclass of QosWaveMacHelper");
497  }
498 
500  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
501  {
502  Ptr<Node> node = *i;
503  Ptr<WaveNetDevice> device = CreateObject<WaveNetDevice> ();
504 
505  device->SetChannelManager (CreateObject<ChannelManager> ());
506  device->SetChannelCoordinator (CreateObject<ChannelCoordinator> ());
507  device->SetVsaManager (CreateObject<VsaManager> ());
509 
510  for (uint32_t j = 0; j != m_physNumber; ++j)
511  {
512  Ptr<WifiPhy> phy = phyHelper.Create (node, device);
515  device->AddPhy (phy);
516  }
517 
518  for (std::vector<uint32_t>::const_iterator k = m_macsForChannelNumber.begin ();
519  k != m_macsForChannelNumber.end (); ++k)
520  {
521  Ptr<WifiMac> wifiMac = macHelper.Create ();
522  Ptr<OcbWifiMac> ocbMac = DynamicCast<OcbWifiMac> (wifiMac);
523  // we use WaveMacLow to replace original MacLow
524  ocbMac->EnableForWave (device);
527  device->AddMac (*k, ocbMac);
528  }
529 
530  device->SetAddress (Mac48Address::Allocate ());
531 
532  node->AddDevice (device);
533  devices.Add (device);
534  }
535  return devices;
536 }
537 
539 WaveHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, Ptr<Node> node) const
540 {
541  return Install (phy, mac, NodeContainer (node));
542 }
543 
545 WaveHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, std::string nodeName) const
546 {
547  Ptr<Node> node = Names::Find<Node> (nodeName);
548  return Install (phy, mac, NodeContainer (node));
549 }
550 
551 void
553 {
555 
556  LogComponentEnable ("WaveNetDevice", LOG_LEVEL_ALL);
557  LogComponentEnable ("ChannelCoordinator", LOG_LEVEL_ALL);
558  LogComponentEnable ("ChannelManager", LOG_LEVEL_ALL);
559  LogComponentEnable ("ChannelScheduler", LOG_LEVEL_ALL);
560  LogComponentEnable ("DefaultChannelScheduler", LOG_LEVEL_ALL);
561  LogComponentEnable ("VsaManager", LOG_LEVEL_ALL);
562  LogComponentEnable ("OcbWifiMac", LOG_LEVEL_ALL);
563  LogComponentEnable ("VendorSpecificAction", LOG_LEVEL_ALL);
564  LogComponentEnable ("WaveMacLow", LOG_LEVEL_ALL);
565  LogComponentEnable ("HigherLayerTxVectorTag", LOG_LEVEL_ALL);
566 }
567 
568 int64_t
570 {
571  int64_t currentStream = stream;
572  Ptr<NetDevice> netDevice;
573  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
574  {
575  netDevice = (*i);
576  Ptr<WaveNetDevice> wave = DynamicCast<WaveNetDevice> (netDevice);
577  if (wave)
578  {
579  // Handle any random numbers in the PHY objects.
580  std::vector<Ptr<WifiPhy> > phys = wave->GetPhys ();
581  for (std::vector<Ptr<WifiPhy> >::iterator j = phys.begin (); j != phys.end (); ++i)
582  {
583  currentStream += (*j)->AssignStreams (currentStream);
584  }
585 
586  // Handle any random numbers in the MAC objects.
587  std::map<uint32_t, Ptr<OcbWifiMac> > macs = wave->GetMacs ();
588  for ( std::map<uint32_t, Ptr<OcbWifiMac> >::iterator k = macs.begin (); k != macs.end (); ++k)
589  {
590  Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (k->second);
591 
592  // Handle any random numbers in the station managers.
593  Ptr<WifiRemoteStationManager> manager = rmac->GetWifiRemoteStationManager ();
594  Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> (manager);
595  if (minstrel)
596  {
597  currentStream += minstrel->AssignStreams (currentStream);
598  }
599 
600  PointerValue ptr;
601  rmac->GetAttribute ("DcaTxop", ptr);
602  Ptr<DcaTxop> dcaTxop = ptr.Get<DcaTxop> ();
603  currentStream += dcaTxop->AssignStreams (currentStream);
604 
605  rmac->GetAttribute ("VO_EdcaTxopN", ptr);
606  Ptr<EdcaTxopN> vo_edcaTxopN = ptr.Get<EdcaTxopN> ();
607  currentStream += vo_edcaTxopN->AssignStreams (currentStream);
608 
609  rmac->GetAttribute ("VI_EdcaTxopN", ptr);
610  Ptr<EdcaTxopN> vi_edcaTxopN = ptr.Get<EdcaTxopN> ();
611  currentStream += vi_edcaTxopN->AssignStreams (currentStream);
612 
613  rmac->GetAttribute ("BE_EdcaTxopN", ptr);
614  Ptr<EdcaTxopN> be_edcaTxopN = ptr.Get<EdcaTxopN> ();
615  currentStream += be_edcaTxopN->AssignStreams (currentStream);
616 
617  rmac->GetAttribute ("BK_EdcaTxopN", ptr);
618  Ptr<EdcaTxopN> bk_edcaTxopN = ptr.Get<EdcaTxopN> ();
619  currentStream += bk_edcaTxopN->AssignStreams (currentStream);
620  }
621  }
622  }
623  return (currentStream - stream);
624 }
625 } // namespace ns3
uint32_t GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
static void EnableLogComponents(void)
Helper to enable all WaveNetDevice log components with one statement.
Definition: wave-helper.cc:552
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
void CreateMacForChannel(std::vector< uint32_t > channelNumbers)
Definition: wave-helper.cc:405
ObjectFactory m_channelScheduler
Definition: wave-helper.h:246
Ptr< T > Get(void) const
Definition: pointer.h:184
Manage ASCII trace files for device models.
Definition: trace-helper.h:141
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static std::vector< uint32_t > GetWaveChannels(void)
void SetErrorRateModel(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
tuple devices
Definition: first.py:32
virtual void ConfigureStandard(enum WifiPhyStandard standard)=0
Configure the PHY-level parameters for different Wi-Fi standard.
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the Phy and Mac aspects ...
Definition: wave-helper.cc:569
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
Frame sent/received with short preamble.
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
Definition: wave-helper.cc:76
virtual void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > stationManager)
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Radiotap header implementation.
Hold variables of type string.
Definition: string.h:41
Hold a value for an Attribute.
Definition: attribute.h:68
Manage pcap files for device models.
Definition: trace-helper.h:38
create PHY objects
Definition: wifi-helper.h:46
void Write(Time t, Ptr< const Packet > p)
Write the next packet to file.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1487
virtual Ptr< WifiMac > Create(void) const =0
void ConfigureStandard(enum WifiPhyStandard standard)
Definition: wifi-mac.cc:280
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
static bool IsWaveChannel(uint32_t channelNumber)
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
This class holds together multiple, ns3::WifiPhy, and ns3::OcbWifiMac (including ns3::WifiRemoteStati...
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
static void AsciiPhyReceiveSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
Definition: wave-helper.cc:63
static WaveHelper Default(void)
Definition: wave-helper.cc:390
void EnableForWave(Ptr< WaveNetDevice > device)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:244
#define NS_FATAL_ERROR(msg)
Fatal error handling.
Definition: fatal-error.h:100
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits. ...
void SetAntennaNoisePower(double noise)
Set the RF noise power at the antenna as a decibel difference from an arbitrary, fixed reference...
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:738
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the ascii trace helper figure out a reasonable filename to use for an ascii trace file associated...
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wave-helper.cc:482
void SetTsft(uint64_t tsft)
Set the Time Synchronization Function Timer (TSFT) value.
virtual void SetAddress(Address address)
Set the address of this interface.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:93
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:29
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:327
void SetRemoteStationManager(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wave-helper.cc:436
This queue contains packets for a particular access class.
Definition: edca-txop-n.h:84
static uint32_t GetNumberOfWaveChannels(void)
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the pcap helper figure out a reasonable filename to use for a pcap file associated with a device...
Definition: trace-helper.cc:80
uint32_t GetDataLinkType(void)
Returns the data link type field of the pcap file as defined by the network field in the pcap global ...
std::vector< uint32_t > m_macsForChannelNumber
Definition: wave-helper.h:247
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:351
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:547
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Definition: wave-helper.cc:252
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
void SetChannelScheduler(Ptr< ChannelScheduler > channelScheduler)
helps to create WaveNetDevice objects
Definition: wave-helper.h:110
void SetChannelFrequencyAndFlags(uint16_t frequency, uint16_t flags)
Set the transmit/receive channel frequency and flags.
virtual ~WaveHelper()
Definition: wave-helper.cc:385
void SetChannelManager(Ptr< ChannelManager > channelManager)
holds a vector of ns3::NetDevice pointers
void SetChannelScheduler(std::string type, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: wave-helper.cc:459
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
hold a list of per-remote-station state.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
Definition: wave-helper.cc:293
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
Definition: wave-helper.cc:164
void SetFrameFlags(uint8_t flags)
Set the frame flags of the transmitted or received frame.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
void SetRate(uint8_t rate)
Set the transmit/receive channel frequency in units of megahertz.
static uint32_t GetCch(void)
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:298
std::map< uint32_t, Ptr< OcbWifiMac > > GetMacs(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
Hold objects of type Ptr.
Definition: pointer.h:36
void CreatePhys(uint32_t phys)
Definition: wave-helper.cc:422
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
create MAC objects
Definition: wifi-helper.h:72
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Definition: wave-helper.h:39
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
virtual void SetChannelNumber(uint16_t id)=0
Set channel number.
std::vector< Ptr< WifiPhy > > GetPhys(void) const
void AddPhy(Ptr< WifiPhy > phy)
ObjectFactory m_stationManager
Definition: wave-helper.h:245
Instantiate subclasses of ns3::Object.
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:142
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
Definition: wave-helper.cc:88
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:120
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
static YansWavePhyHelper Default(void)
Create a phy helper in a default working state.
Definition: wave-helper.cc:244
void SetVsaManager(Ptr< VsaManager > vsaManager)
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
void AddMac(uint32_t channelNumber, Ptr< OcbWifiMac > mac)
Print everything.
Definition: log.h:112
void SetChannelCoordinator(Ptr< ChannelCoordinator > channelCoordinator)
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
handle packet fragmentation and retransmissions.
Definition: dca-txop.h:67
static void AsciiPhyTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
Definition: wave-helper.cc:38
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:727
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:253
This class will assign channel access for requests from higher layers.
uint32_t m_physNumber
Definition: wave-helper.h:248
void SetAntennaSignalPower(double signal)
Set the RF signal power at the antenna as a decibel difference from an arbitrary, fixed reference...
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
Definition: wave-helper.cc:51