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 
19 #include "ns3/log.h"
20 #include "ns3/pointer.h"
21 #include "ns3/string.h"
22 #include "ns3/config.h"
23 #include "ns3/names.h"
24 #include "ns3/abort.h"
25 #include "ns3/wave-net-device.h"
26 #include "ns3/minstrel-wifi-manager.h"
27 #include "ns3/radiotap-header.h"
28 #include "ns3/unused.h"
29 #include "ns3/wifi-ack-policy-selector.h"
30 #include "wave-mac-helper.h"
31 #include "wave-helper.h"
32 
33 NS_LOG_COMPONENT_DEFINE ("WaveHelper");
34 
35 namespace ns3 {
36 
46 static void
49  std::string context,
51  WifiMode mode,
52  WifiPreamble preamble,
53  uint8_t txLevel)
54 {
55  NS_LOG_FUNCTION (stream << context << p << mode << preamble << txLevel);
56  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
57 }
58 
67 static void
71  WifiMode mode,
72  WifiPreamble preamble,
73  uint8_t txLevel)
74 {
75  NS_LOG_FUNCTION (stream << p << mode << preamble << txLevel);
76  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
77 }
78 
88 static void
91  std::string context,
93  double snr,
94  WifiMode mode,
95  enum WifiPreamble preamble)
96 {
97  NS_LOG_FUNCTION (stream << context << p << snr << mode << preamble);
98  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << context << " " << *p << std::endl;
99 }
100 
109 static void
113  double snr,
114  WifiMode mode,
115  enum WifiPreamble preamble)
116 {
117  NS_LOG_FUNCTION (stream << p << snr << mode << preamble);
118  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " " << *p << std::endl;
119 }
120 
121 
122 /****************************** YansWavePhyHelper ***********************************/
123 YansWavePhyHelper
125 {
126  YansWavePhyHelper helper;
127  helper.SetErrorRateModel ("ns3::NistErrorRateModel");
128  return helper;
129 }
130 
131 void
132 YansWavePhyHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
133 {
134  //
135  // All of the Pcap enable functions vector through here including the ones
136  // that are wandering through all of devices on perhaps all of the nodes in
137  // the system. We can only deal with devices of type WaveNetDevice.
138  //
139  Ptr<WaveNetDevice> device = nd->GetObject<WaveNetDevice> ();
140  if (device == 0)
141  {
142  NS_LOG_INFO ("YansWavePhyHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WaveNetDevice");
143  return;
144  }
145 
146  std::vector<Ptr<WifiPhy> > phys = device->GetPhys ();
147  NS_ABORT_MSG_IF (phys.size () == 0, "EnablePcapInternal(): Phy layer in WaveNetDevice must be set");
148 
149  PcapHelper pcapHelper;
150 
151  std::string filename;
152  if (explicitFilename)
153  {
154  filename = prefix;
155  }
156  else
157  {
158  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
159  }
160 
161  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, GetPcapDataLinkType ());
162 
163  std::vector<Ptr<WifiPhy> >::iterator i;
164  for (i = phys.begin (); i != phys.end (); ++i)
165  {
166  Ptr<WifiPhy> phy = (*i);
167  phy->TraceConnectWithoutContext ("MonitorSnifferTx", MakeBoundCallback (&YansWavePhyHelper::PcapSniffTxEvent, file));
168  phy->TraceConnectWithoutContext ("MonitorSnifferRx", MakeBoundCallback (&YansWavePhyHelper::PcapSniffRxEvent, file));
169  }
170 }
171 
172 void
175  std::string prefix,
176  Ptr<NetDevice> nd,
177  bool explicitFilename)
178 {
179  //
180  // All of the ascii enable functions vector through here including the ones
181  // that are wandering through all of devices on perhaps all of the nodes in
182  // the system. We can only deal with devices of type WaveNetDevice.
183  //
184  Ptr<WaveNetDevice> device = nd->GetObject<WaveNetDevice> ();
185  if (device == 0)
186  {
187  NS_LOG_INFO ("EnableAsciiInternal(): Device " << device << " not of type ns3::WaveNetDevice");
188  return;
189  }
190 
191  //
192  // Our trace sinks are going to use packet printing, so we have to make sure
193  // that is turned on.
194  //
196 
197  uint32_t nodeid = nd->GetNode ()->GetId ();
198  uint32_t deviceid = nd->GetIfIndex ();
199  std::ostringstream oss;
200 
201  //
202  // If we are not provided an OutputStreamWrapper, we are expected to create
203  // one using the usual trace filename conventions and write our traces
204  // without a context since there will be one file per context and therefore
205  // the context would be redundant.
206  //
207  if (stream == 0)
208  {
209  //
210  // Set up an output stream object to deal with private ofstream copy
211  // constructor and lifetime issues. Let the helper decide the actual
212  // name of the file given the prefix.
213  //
214  AsciiTraceHelper asciiTraceHelper;
215 
216  std::string filename;
217  if (explicitFilename)
218  {
219  filename = prefix;
220  }
221  else
222  {
223  filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
224  }
225 
226  Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
227  //
228  // We could go poking through the phy and the state looking for the
229  // correct trace source, but we can let Config deal with that with
230  // some search cost. Since this is presumably happening at topology
231  // creation time, it doesn't seem much of a price to pay.
232  //
233  oss.str ("");
234  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/RxOk";
236 
237  oss.str ("");
238  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/Tx";
240 
241  return;
242  }
243 
244  //
245  // If we are provided an OutputStreamWrapper, we are expected to use it, and
246  // to provide a context. We are free to come up with our own context if we
247  // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
248  // compatibility and simplicity, we just use Config::Connect and let it deal
249  // with coming up with a context.
250  //
251  oss.str ("");
252  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/RxOk";
254 
255  oss.str ("");
256  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WaveNetDevice/PhyEntities/*/$ns3::WifiPhy/State/Tx";
258 }
259 
260 /********************************** WaveHelper ******************************************/
262 {
263 }
264 
266 {
267 }
268 
271 {
272  WaveHelper helper;
273  // default 7 MAC entities and single PHY device.
275  helper.CreatePhys (1);
276  helper.SetChannelScheduler ("ns3::DefaultChannelScheduler");
277  helper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
278  "DataMode", StringValue ("OfdmRate6MbpsBW10MHz"),
279  "ControlMode",StringValue ("OfdmRate6MbpsBW10MHz"),
280  "NonUnicastMode", StringValue ("OfdmRate6MbpsBW10MHz"));
281  helper.SetAckPolicySelectorForAc (AC_BE, "ns3::ConstantWifiAckPolicySelector");
282  helper.SetAckPolicySelectorForAc (AC_BK, "ns3::ConstantWifiAckPolicySelector");
283  helper.SetAckPolicySelectorForAc (AC_VI, "ns3::ConstantWifiAckPolicySelector");
284  helper.SetAckPolicySelectorForAc (AC_VO, "ns3::ConstantWifiAckPolicySelector");
285  return helper;
286 }
287 
288 void
289 WaveHelper::CreateMacForChannel (std::vector<uint32_t> channelNumbers)
290 {
291  if (channelNumbers.size () == 0)
292  {
293  NS_FATAL_ERROR ("the WAVE MAC entities is at least one");
294  }
295  for (std::vector<uint32_t>::iterator i = channelNumbers.begin (); i != channelNumbers.end (); ++i)
296  {
298  {
299  NS_FATAL_ERROR ("the channel number " << (*i) << " is not a valid WAVE channel number");
300  }
301  }
302  m_macsForChannelNumber = channelNumbers;
303 }
304 
305 void
306 WaveHelper::CreatePhys (uint32_t phys)
307 {
308  if (phys == 0)
309  {
310  NS_FATAL_ERROR ("the WAVE PHY entities is at least one");
311  }
313  {
314  NS_FATAL_ERROR ("the number of assigned WAVE PHY entities is more than the number of valid WAVE channels");
315  }
316  m_physNumber = phys;
317 }
318 
319 void
321  std::string n0, const AttributeValue &v0,
322  std::string n1, const AttributeValue &v1,
323  std::string n2, const AttributeValue &v2,
324  std::string n3, const AttributeValue &v3,
325  std::string n4, const AttributeValue &v4,
326  std::string n5, const AttributeValue &v5,
327  std::string n6, const AttributeValue &v6,
328  std::string n7, const AttributeValue &v7)
329 {
332  m_stationManager.Set (n0, v0);
333  m_stationManager.Set (n1, v1);
334  m_stationManager.Set (n2, v2);
335  m_stationManager.Set (n3, v3);
336  m_stationManager.Set (n4, v4);
337  m_stationManager.Set (n5, v5);
338  m_stationManager.Set (n6, v6);
339  m_stationManager.Set (n7, v7);
340 }
341 
342 void
344  std::string n0, const AttributeValue &v0,
345  std::string n1, const AttributeValue &v1,
346  std::string n2, const AttributeValue &v2,
347  std::string n3, const AttributeValue &v3,
348  std::string n4, const AttributeValue &v4,
349  std::string n5, const AttributeValue &v5,
350  std::string n6, const AttributeValue &v6,
351  std::string n7, const AttributeValue &v7)
352 {
354  m_ackPolicySelector[ac].SetTypeId (type);
355  m_ackPolicySelector[ac].Set (n0, v0);
356  m_ackPolicySelector[ac].Set (n1, v1);
357  m_ackPolicySelector[ac].Set (n2, v2);
358  m_ackPolicySelector[ac].Set (n3, v3);
359  m_ackPolicySelector[ac].Set (n4, v4);
360  m_ackPolicySelector[ac].Set (n5, v5);
361  m_ackPolicySelector[ac].Set (n6, v6);
362  m_ackPolicySelector[ac].Set (n7, v7);
363 }
364 
365 void
367  std::string n0, const AttributeValue &v0,
368  std::string n1, const AttributeValue &v1,
369  std::string n2, const AttributeValue &v2,
370  std::string n3, const AttributeValue &v3,
371  std::string n4, const AttributeValue &v4,
372  std::string n5, const AttributeValue &v5,
373  std::string n6, const AttributeValue &v6,
374  std::string n7, const AttributeValue &v7)
375 {
378  m_channelScheduler.Set (n0, v0);
379  m_channelScheduler.Set (n1, v1);
380  m_channelScheduler.Set (n2, v2);
381  m_channelScheduler.Set (n3, v3);
382  m_channelScheduler.Set (n4, v4);
383  m_channelScheduler.Set (n5, v5);
384  m_channelScheduler.Set (n6, v6);
385  m_channelScheduler.Set (n7, v7);
386 }
387 
389 WaveHelper::Install (const WifiPhyHelper &phyHelper, const WifiMacHelper &macHelper, NodeContainer c) const
390 {
391  try
392  {
393  const QosWaveMacHelper& qosMac = dynamic_cast<const QosWaveMacHelper&> (macHelper);
394  NS_UNUSED (qosMac);
395  }
396  catch (const std::bad_cast &)
397  {
398  NS_FATAL_ERROR ("WifiMacHelper should be the class or subclass of QosWaveMacHelper");
399  }
400 
402  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
403  {
404  Ptr<Node> node = *i;
405  Ptr<WaveNetDevice> device = CreateObject<WaveNetDevice> ();
406 
407  device->SetChannelManager (CreateObject<ChannelManager> ());
408  device->SetChannelCoordinator (CreateObject<ChannelCoordinator> ());
409  device->SetVsaManager (CreateObject<VsaManager> ());
411 
412  for (uint32_t j = 0; j != m_physNumber; ++j)
413  {
414  Ptr<WifiPhy> phy = phyHelper.Create (node, device);
415  phy->ConfigureStandardAndBand (WIFI_PHY_STANDARD_80211p, WIFI_PHY_BAND_5GHZ);
416  phy->SetChannelNumber (ChannelManager::GetCch ());
417  device->AddPhy (phy);
418  }
419 
420  for (std::vector<uint32_t>::const_iterator k = m_macsForChannelNumber.begin ();
421  k != m_macsForChannelNumber.end (); ++k)
422  {
423  Ptr<WifiMac> wifiMac = macHelper.Create (device);
424  Ptr<OcbWifiMac> ocbMac = DynamicCast<OcbWifiMac> (wifiMac);
425  // we use WaveMacLow to replace original MacLow
426  ocbMac->EnableForWave (device);
429  // Install ack policy selector
430  BooleanValue qosSupported;
431  PointerValue ptr;
432  Ptr<WifiAckPolicySelector> ackSelector;
433 
434  ocbMac->GetAttributeFailSafe ("QosSupported", qosSupported);
435  if (qosSupported.Get ())
436  {
437  ocbMac->GetAttributeFailSafe ("BE_Txop", ptr);
439  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
440  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
441 
442  ocbMac->GetAttributeFailSafe ("BK_Txop", ptr);
444  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
445  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
446 
447  ocbMac->GetAttributeFailSafe ("VI_Txop", ptr);
449  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
450  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
451 
452  ocbMac->GetAttributeFailSafe ("VO_Txop", ptr);
454  ackSelector->SetQosTxop (ptr.Get<QosTxop> ());
455  ptr.Get<QosTxop> ()->SetAckPolicySelector (ackSelector);
456  }
457  device->AddMac (*k, ocbMac);
458  }
459 
460  device->SetAddress (Mac48Address::Allocate ());
461 
462  node->AddDevice (device);
463  devices.Add (device);
464  }
465  return devices;
466 }
467 
470 {
471  return Install (phy, mac, NodeContainer (node));
472 }
473 
475 WaveHelper::Install (const WifiPhyHelper &phy, const WifiMacHelper &mac, std::string nodeName) const
476 {
477  Ptr<Node> node = Names::Find<Node> (nodeName);
478  return Install (phy, mac, NodeContainer (node));
479 }
480 
481 void
483 {
485 
486  LogComponentEnable ("WaveNetDevice", LOG_LEVEL_ALL);
487  LogComponentEnable ("ChannelCoordinator", LOG_LEVEL_ALL);
488  LogComponentEnable ("ChannelManager", LOG_LEVEL_ALL);
489  LogComponentEnable ("ChannelScheduler", LOG_LEVEL_ALL);
490  LogComponentEnable ("DefaultChannelScheduler", LOG_LEVEL_ALL);
491  LogComponentEnable ("VsaManager", LOG_LEVEL_ALL);
492  LogComponentEnable ("OcbWifiMac", LOG_LEVEL_ALL);
493  LogComponentEnable ("VendorSpecificAction", LOG_LEVEL_ALL);
494  LogComponentEnable ("WaveMacLow", LOG_LEVEL_ALL);
495  LogComponentEnable ("HigherLayerTxVectorTag", LOG_LEVEL_ALL);
496 }
497 
498 int64_t
500 {
501  int64_t currentStream = stream;
502  Ptr<NetDevice> netDevice;
503  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
504  {
505  netDevice = (*i);
506  Ptr<WaveNetDevice> wave = DynamicCast<WaveNetDevice> (netDevice);
507  if (wave)
508  {
509  // Handle any random numbers in the PHY objects.
510  std::vector<Ptr<WifiPhy> > phys = wave->GetPhys ();
511  for (std::vector<Ptr<WifiPhy> >::iterator j = phys.begin (); j != phys.end (); ++j)
512  {
513  currentStream += (*j)->AssignStreams (currentStream);
514  }
515 
516  // Handle any random numbers in the MAC objects.
517  std::map<uint32_t, Ptr<OcbWifiMac> > macs = wave->GetMacs ();
518  for ( std::map<uint32_t, Ptr<OcbWifiMac> >::iterator k = macs.begin (); k != macs.end (); ++k)
519  {
520  Ptr<RegularWifiMac> rmac = DynamicCast<RegularWifiMac> (k->second);
521 
522  // Handle any random numbers in the station managers.
523  Ptr<WifiRemoteStationManager> manager = rmac->GetWifiRemoteStationManager ();
524  Ptr<MinstrelWifiManager> minstrel = DynamicCast<MinstrelWifiManager> (manager);
525  if (minstrel)
526  {
527  currentStream += minstrel->AssignStreams (currentStream);
528  }
529 
530  PointerValue ptr;
531  rmac->GetAttribute ("Txop", ptr);
532  Ptr<Txop> txop = ptr.Get<Txop> ();
533  currentStream += txop->AssignStreams (currentStream);
534 
535  rmac->GetAttribute ("VO_Txop", ptr);
536  Ptr<QosTxop> vo_txop = ptr.Get<QosTxop> ();
537  currentStream += vo_txop->AssignStreams (currentStream);
538 
539  rmac->GetAttribute ("VI_Txop", ptr);
540  Ptr<QosTxop> vi_txop = ptr.Get<QosTxop> ();
541  currentStream += vi_txop->AssignStreams (currentStream);
542 
543  rmac->GetAttribute ("BE_Txop", ptr);
544  Ptr<QosTxop> be_txop = ptr.Get<QosTxop> ();
545  currentStream += be_txop->AssignStreams (currentStream);
546 
547  rmac->GetAttribute ("BK_Txop", ptr);
548  Ptr<QosTxop> bk_txop = ptr.Get<QosTxop> ();
549  currentStream += bk_txop->AssignStreams (currentStream);
550  }
551  }
552  }
553  return (currentStream - stream);
554 }
555 } // namespace ns3
static void EnableLogComponents(void)
Helper to enable all WaveNetDevice log components with one statement.
Definition: wave-helper.cc:482
void CreateMacForChannel(std::vector< uint32_t > channelNumbers)
Definition: wave-helper.cc:289
ObjectFactory m_channelScheduler
channel scheduler
Definition: wave-helper.h:281
ObjectFactory m_ackPolicySelector[4]
ack policy selector for all ACs
Definition: wave-helper.h:280
Manage ASCII trace files for device models.
Definition: trace-helper.h:161
#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)
virtual void ConfigureStandard(enum WifiStandard standard)
AttributeValue implementation for Boolean.
Definition: boolean.h:36
Ptr< T > Get(void) const
Definition: pointer.h:201
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:499
static void AsciiPhyReceiveSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink without context.
Definition: wave-helper.cc:110
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
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
void SetAckPolicySelectorForAc(AcIndex ac, 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:343
create PHY objects
Definition: wifi-helper.h:46
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
Handle packet fragmentation and retransmissions for QoS data frames as well as MSDU aggregation (A-MS...
Definition: qos-txop.h:92
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
static bool IsWaveChannel(uint32_t channelNumber)
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition: unused.h:36
This class holds together multiple, ns3::WifiPhy, and ns3::OcbWifiMac (including ns3::WifiRemoteStati...
static void AsciiPhyReceiveSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, double snr, WifiMode mode, enum WifiPreamble preamble)
ASCII Phy receive sink with context.
Definition: wave-helper.cc:89
static WaveHelper Default(void)
Definition: wave-helper.cc:270
void EnableForWave(Ptr< WaveNetDevice > device)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we&#39;ll use to write the traced bits. ...
The 5 GHz band.
Definition: wifi-phy-band.h:35
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
bool GetAttributeFailSafe(std::string name, AttributeValue &value) const
Get the value of an attribute without raising erros.
Definition: object-base.cc:258
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 void SetAddress(Address address)
Set the address of this interface.
Video.
Definition: qos-utils.h:45
Voice.
Definition: qos-utils.h:47
Best Effort.
Definition: qos-utils.h:41
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
phy
Definition: third.py:93
static void PcapSniffTxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu)
Definition: wifi-helper.cc:224
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:32
Background.
Definition: qos-utils.h:43
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:320
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
std::vector< uint32_t > m_macsForChannelNumber
MACs for channel number.
Definition: wave-helper.h:282
std::map< uint32_t, Ptr< OcbWifiMac > > GetMacs(void) const
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:572
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
Definition: wave-helper.cc:132
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: txop.cc:332
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
void SetChannelScheduler(Ptr< ChannelScheduler > channelScheduler)
helps to create WaveNetDevice objects
Definition: wave-helper.h:112
virtual ~WaveHelper()
Definition: wave-helper.cc:265
void SetChannelManager(Ptr< ChannelManager > channelManager)
holds a vector of ns3::NetDevice pointers
mac
Definition: third.py:99
static void PcapSniffRxEvent(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise)
Definition: wifi-helper.cc:257
OFDM PHY (Clause 17 - amendment for 10 MHz and 5 MHz channels)
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:366
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Definition: config.cc:899
Qos Wave Mac Helper class.
PcapHelper::DataLinkType GetPcapDataLinkType(void) const
Get the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:545
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:173
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:918
bool Get(void) const
Definition: boolean.cc:51
static uint32_t GetCch(void)
virtual void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
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<T>.
Definition: pointer.h:36
void CreatePhys(uint32_t phys)
Definition: wave-helper.cc:306
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer c) const
Definition: wave-helper.cc:389
create MAC layers for a ns3::WifiNetDevice.
To trace WaveNetDevice, we have to overwrite the trace functions of class YansWifiPhyHelper.
Definition: wave-helper.h:40
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
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())
Definition: wifi-helper.cc:149
virtual Ptr< WifiMac > Create(Ptr< NetDevice > device) const
void AddPhy(Ptr< WifiPhy > phy)
ObjectFactory m_stationManager
station manager
Definition: wave-helper.h:279
Instantiate subclasses of ns3::Object.
static void EnableLogComponents(void)
Helper to enable all WifiNetDevice log components with one statement.
Definition: wifi-helper.cc:924
virtual Ptr< WifiPhy > Create(Ptr< Node > node, Ptr< NetDevice > device) const =0
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
#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:124
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:116
std::vector< Ptr< WifiPhy > > GetPhys(void) const
devices
Definition: first.py:39
void SetChannelCoordinator(Ptr< ChannelCoordinator > channelCoordinator)
WifiAckPolicySelector is in charge of selecting the acknowledgment policy for PSDUs containing QoS Da...
static void AsciiPhyTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink with context.
Definition: wave-helper.cc:47
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
This class will assign channel access for requests from higher layers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
uint32_t m_physNumber
Phy number.
Definition: wave-helper.h:283
Handle packet fragmentation and retransmissions for data and management frames.
Definition: txop.h:66
static void AsciiPhyTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p, WifiMode mode, WifiPreamble preamble, uint8_t txLevel)
ASCII Phy transmit sink without context.
Definition: wave-helper.cc:68