A Discrete-Event Network Simulator
API
wimax-helper.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20  */
21 
22 #include "wimax-helper.h"
23 #include "ns3/simulator.h"
24 #include "ns3/packet.h"
25 #include "ns3/log.h"
26 #include <string>
27 #include "ns3/config.h"
28 #include "ns3/wimax-net-device.h"
29 #include "ns3/bs-net-device.h"
30 #include "ns3/ss-net-device.h"
31 #include "ns3/wimax-channel.h"
32 #include "ns3/simple-ofdm-wimax-channel.h"
33 #include "ns3/wimax-phy.h"
34 #include "ns3/simple-ofdm-wimax-phy.h"
35 #include "ns3/pointer.h"
36 #include "ns3/wimax-mac-to-mac-header.h"
37 
38 
39 namespace ns3 {
40 
41 NS_LOG_COMPONENT_DEFINE ("WimaxHelper");
42 
44  : m_channel (0)
45 {
46 }
47 
49 {
50 }
51 
53  uint32_t nodeid,
54  uint32_t deviceid,
55  char *netdevice,
56  char *connection)
57 {
58  std::ostringstream oss;
59  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::" << netdevice << "/" << connection
60  << "/TxQueue/Enqueue";
62 
63  oss.str ("");
64  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::" << netdevice << "/" << connection
65  << "/TxQueue/Dequeue";
67 
68  oss.str ("");
69  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::" << netdevice << "/" << connection
70  << "/TxQueue/Drop";
72 }
73 
75 {
77  switch (phyType)
78  {
80  phy = CreateObject<SimpleOfdmWimaxPhy> ();
81  if (!m_channel)
82  {
83  m_channel = CreateObject<SimpleOfdmWimaxChannel> (SimpleOfdmWimaxChannel::COST231_PROPAGATION);
84  }
85  break;
86  default:
87  NS_FATAL_ERROR ("Invalid physical type");
88  break;
89  }
90 
91  return phy;
92 }
93 
95 {
96  if (!m_channel)
97  {
98  m_channel = CreateObject<SimpleOfdmWimaxChannel> ();
99  }
100  m_channel->GetObject<SimpleOfdmWimaxChannel> ()->SetPropagationModel (propagationModel);
101 }
102 
103 Ptr<WimaxPhy> WimaxHelper::CreatePhy (PhyType phyType, char * SNRTraceFilePath, bool activateLoss)
104 {
107  switch (phyType)
108  {
110  sphy = CreateObject<SimpleOfdmWimaxPhy> ();
111  phy = sphy;
112  sphy->SetSNRToBlockErrorRateTracesPath (SNRTraceFilePath);
113  sphy->ActivateLoss (activateLoss);
114  if (!m_channel)
115  {
116  m_channel = CreateObject<SimpleOfdmWimaxChannel> (SimpleOfdmWimaxChannel::COST231_PROPAGATION);
117  }
118  break;
119  default:
120  NS_FATAL_ERROR ("Invalid physical type");
121  break;
122  }
123 
124  return phy;
125 }
126 
128 {
130  switch (phyType)
131  {
133  phy = CreateObject<SimpleOfdmWimaxPhy> ();
134  break;
135  default:
136  NS_FATAL_ERROR ("Invalid physical type");
137  break;
138  }
139 
140  return phy;
141 }
142 
143 Ptr<WimaxPhy> WimaxHelper::CreatePhyWithoutChannel (PhyType phyType, char * SNRTraceFilePath, bool activateLoss)
144 {
147  switch (phyType)
148  {
150  sphy = CreateObject<SimpleOfdmWimaxPhy> ();
151  phy = sphy;
152  sphy->SetSNRToBlockErrorRateTracesPath (SNRTraceFilePath);
153  sphy->ActivateLoss (activateLoss);
154  break;
155  default:
156  NS_FATAL_ERROR ("Invalid physical type");
157  break;
158  }
159 
160  return phy;
161 }
162 
164 {
165  Ptr<UplinkScheduler> uplinkScheduler;
166  switch (schedulerType)
167  {
168  case SCHED_TYPE_SIMPLE:
169  uplinkScheduler = CreateObject<UplinkSchedulerSimple> ();
170  break;
171  case SCHED_TYPE_RTPS:
172  uplinkScheduler = CreateObject<UplinkSchedulerRtps> ();
173  break;
174  case SCHED_TYPE_MBQOS:
175  uplinkScheduler = CreateObject<UplinkSchedulerMBQoS> (Seconds (0.25));
176  break;
177  default:
178  NS_FATAL_ERROR ("Invalid scheduling type");
179  break;
180  }
181  return uplinkScheduler;
182 }
183 
185 {
186  Ptr<BSScheduler> bsScheduler;
187  switch (schedulerType)
188  {
189  case SCHED_TYPE_SIMPLE:
190  bsScheduler = CreateObject<BSSchedulerSimple> ();
191  break;
192  case SCHED_TYPE_RTPS:
193  bsScheduler = CreateObject<BSSchedulerRtps> ();
194  break;
195  case SCHED_TYPE_MBQOS:
196  bsScheduler = CreateObject<BSSchedulerSimple> ();
197  break;
198  default:
199  NS_FATAL_ERROR ("Invalid scheduling type");
200  break;
201  }
202  return bsScheduler;
203 }
204 
206  NetDeviceType deviceType,
207  PhyType phyType,
208  SchedulerType schedulerType,
209  double frameDuration)
210 {
212  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
213  {
214  Ptr<Node> node = *i;
215  Ptr<WimaxPhy> phy = CreatePhy (phyType);
216 
217  // Set SuperFrame Duration
218  phy->SetFrameDuration (Seconds (frameDuration));
219 
220  Ptr<WimaxNetDevice> device;
221  Ptr<UplinkScheduler> uplinkScheduler = CreateUplinkScheduler (schedulerType);
222  Ptr<BSScheduler> bsScheduler = CreateBSScheduler (schedulerType);
223 
224  if (deviceType == DEVICE_TYPE_BASE_STATION)
225  {
226  // attach phy
227  Ptr<BaseStationNetDevice> deviceBS;
228  deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
229  device = deviceBS;
230  uplinkScheduler->SetBs (deviceBS);
231  bsScheduler->SetBs (deviceBS);
232  }
233  else
234  {
235  device = CreateObject<SubscriberStationNetDevice> (node, phy);
236  }
237  device->SetAddress (Mac48Address::Allocate ());
238  phy->SetDevice (device);
239  device->Start ();
240  device->Attach (m_channel); // attach channel
241 
242  node->AddDevice (device);
243 
244  devices.Add (device);
245  }
246  return devices;
247 }
248 
250  NetDeviceType deviceType,
251  PhyType phyType,
252  SchedulerType schedulerType)
253 {
255  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
256  {
257  Ptr<Node> node = *i;
258  Ptr<WimaxPhy> phy = CreatePhy (phyType);
259  Ptr<WimaxNetDevice> device;
260  Ptr<UplinkScheduler> uplinkScheduler = CreateUplinkScheduler (schedulerType);
261  Ptr<BSScheduler> bsScheduler = CreateBSScheduler (schedulerType);
262 
263  if (deviceType == DEVICE_TYPE_BASE_STATION)
264  {
265  // attach phy
266  Ptr<BaseStationNetDevice> deviceBS;
267  deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
268  device = deviceBS;
269  uplinkScheduler->SetBs (deviceBS);
270  bsScheduler->SetBs (deviceBS);
271  }
272  else
273  {
274  device = CreateObject<SubscriberStationNetDevice> (node, phy);
275  }
276  device->SetAddress (Mac48Address::Allocate ());
277  phy->SetDevice (device);
278  device->Start ();
279  device->Attach (m_channel); // attach channel
280 
281  node->AddDevice (device);
282 
283  devices.Add (device);
284  }
285  return devices;
286 }
287 
289  NetDeviceType deviceType,
290  PhyType phyType,
292  SchedulerType schedulerType)
293 {
295  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
296  {
297  Ptr<Node> node = *i;
298 
299  Ptr<WimaxPhy> phy = CreatePhyWithoutChannel (phyType, (char*) "dummy", 0);
300  Ptr<WimaxNetDevice> device;
301  Ptr<UplinkScheduler> uplinkScheduler = CreateUplinkScheduler (schedulerType);
302  Ptr<BSScheduler> bsScheduler = CreateBSScheduler (schedulerType);
303 
304  if (deviceType == DEVICE_TYPE_BASE_STATION)
305  {
306  Ptr<BaseStationNetDevice> deviceBS;
307  deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
308  device = deviceBS;
309  uplinkScheduler->SetBs (deviceBS);
310  bsScheduler->SetBs (deviceBS);
311  }
312  else
313  {
314  device = CreateObject<SubscriberStationNetDevice> (node, phy);
315  }
316  device->SetAddress (Mac48Address::Allocate ());
317  phy->SetDevice (device);
318  device->Start ();
319  device->Attach (channel);
320 
321  node->AddDevice (device);
322  devices.Add (device);
323  }
324  return devices;
325 }
326 
328  NetDeviceType deviceType,
329  PhyType phyType,
331  SchedulerType schedulerType)
332 {
333 
334  // Ptr<WimaxPhy> phy = CreatePhyWithoutChannel (phyType);
335  Ptr<WimaxPhy> phy = CreatePhyWithoutChannel (phyType, (char*) "dummy", 0);
336  Ptr<WimaxNetDevice> device;
337  Ptr<UplinkScheduler> uplinkScheduler = CreateUplinkScheduler (schedulerType);
338  Ptr<BSScheduler> bsScheduler = CreateBSScheduler (schedulerType);
339 
340  if (deviceType == DEVICE_TYPE_BASE_STATION)
341  {
342  Ptr<BaseStationNetDevice> deviceBS;
343  deviceBS = CreateObject<BaseStationNetDevice> (node, phy, uplinkScheduler, bsScheduler);
344  device = deviceBS;
345  uplinkScheduler->SetBs (deviceBS);
346  bsScheduler->SetBs (deviceBS);
347  }
348  else
349  {
350  device = CreateObject<SubscriberStationNetDevice> (node, phy);
351  }
352  device->SetAddress (Mac48Address::Allocate ());
353  phy->SetDevice (device);
354  device->Start ();
355  device->Attach (channel);
356 
357  node->AddDevice (device);
358 
359  return device;
360 }
361 
362 void
364 {
365  LogComponentEnable ("BandwidthManager", LOG_LEVEL_ALL);
366  LogComponentEnable ("BSLinkManager", LOG_LEVEL_ALL);
367  LogComponentEnable ("BaseStationNetDevice", LOG_LEVEL_ALL);
368  LogComponentEnable ("BSSchedulerRtps", LOG_LEVEL_ALL);
369  LogComponentEnable ("BSSchedulerSimple", LOG_LEVEL_ALL);
370  LogComponentEnable ("BSScheduler", LOG_LEVEL_ALL);
371  LogComponentEnable ("BsServiceFlowManager", LOG_LEVEL_ALL);
372  LogComponentEnable ("UplinkSchedulerMBQoS", LOG_LEVEL_ALL);
373  LogComponentEnable ("UplinkSchedulerRtps", LOG_LEVEL_ALL);
374  LogComponentEnable ("UplinkSchedulerSimple", LOG_LEVEL_ALL);
375  LogComponentEnable ("UplinkScheduler", LOG_LEVEL_ALL);
376  LogComponentEnable ("BurstProfileManager", LOG_LEVEL_ALL);
377  LogComponentEnable ("ConnectionManager", LOG_LEVEL_ALL);
378  LogComponentEnable ("IpcsClassifierRecord", LOG_LEVEL_ALL);
379  LogComponentEnable ("IpcsClassifier", LOG_LEVEL_ALL);
380  LogComponentEnable ("MACMESSAGES", LOG_LEVEL_ALL);
381  LogComponentEnable ("PacketBurst", LOG_LEVEL_ALL);
382  LogComponentEnable ("ServiceFlowManager", LOG_LEVEL_ALL);
383  LogComponentEnable ("simpleOfdmWimaxChannel", LOG_LEVEL_ALL);
384  LogComponentEnable ("SimpleOfdmWimaxPhy", LOG_LEVEL_ALL);
385  LogComponentEnable ("SNRToBlockErrorRateManager", LOG_LEVEL_ALL);
386  LogComponentEnable ("SSLinkManager", LOG_LEVEL_ALL);
387  LogComponentEnable ("SSManager", LOG_LEVEL_ALL);
388  LogComponentEnable ("SubscriberStationNetDevice", LOG_LEVEL_ALL);
389  LogComponentEnable ("SSScheduler", LOG_LEVEL_ALL);
390  LogComponentEnable ("SsServiceFlowManager", LOG_LEVEL_ALL);
391  LogComponentEnable ("WimaxChannel", LOG_LEVEL_ALL);
392  LogComponentEnable ("WimaxMacQueue", LOG_LEVEL_ALL);
393  LogComponentEnable ("WimaxNetDevice", LOG_LEVEL_ALL);
394  LogComponentEnable ("WimaxPhy", LOG_LEVEL_ALL);
396  LogComponentEnable ("BandwidthManager", LOG_LEVEL_ALL);
397  LogComponentEnable ("BaseStationNetDevice", LOG_LEVEL_ALL);
398  LogComponentEnable ("BSSchedulerRtps", LOG_LEVEL_ALL);
399  LogComponentEnable ("BSSchedulerSimple", LOG_LEVEL_ALL);
400  LogComponentEnable ("BSScheduler", LOG_LEVEL_ALL);
401  LogComponentEnable ("SubscriberStationNetDevice", LOG_LEVEL_ALL);
402  LogComponentEnable ("SSScheduler", LOG_LEVEL_ALL);
403  LogComponentEnable ("WimaxMacQueue", LOG_LEVEL_ALL);
404 }
405 
406 
408  std::string path,
409  Ptr<const Packet> packet,
410  const Mac48Address &source)
411 {
412  *stream->GetStream () << "r " << Simulator::Now ().GetSeconds () << " from: " << source << " ";
413  *stream->GetStream () << path << std::endl;
414 }
415 
416 void WimaxHelper::AsciiTxEvent (Ptr<OutputStreamWrapper> stream, std::string path, Ptr<const Packet> packet, const Mac48Address &dest)
417 {
418  *stream->GetStream () << "t " << Simulator::Now ().GetSeconds () << " to: " << dest << " ";
419  *stream->GetStream () << path << std::endl;
420 }
421 
423  ServiceFlow::SchedulingType schedulinType,
424  IpcsClassifierRecord classifier)
425 {
426  CsParameters csParam (CsParameters::ADD, classifier);
427  ServiceFlow serviceFlow = ServiceFlow (direction);
428  serviceFlow.SetConvergenceSublayerParam (csParam);
430  serviceFlow.SetServiceSchedulingType (schedulinType);
431  serviceFlow.SetMaxSustainedTrafficRate (100);
432  serviceFlow.SetMinReservedTrafficRate (1000000);
433  serviceFlow.SetMinTolerableTrafficRate (1000000);
434  serviceFlow.SetMaximumLatency (100);
435  serviceFlow.SetMaxTrafficBurst (2000);
436  serviceFlow.SetTrafficPriority (1);
437  serviceFlow.SetUnsolicitedGrantInterval (1);
438  serviceFlow.SetMaxSustainedTrafficRate (70);
439  serviceFlow.SetToleratedJitter (10);
440  serviceFlow.SetSduSize (49);
441  serviceFlow.SetRequestTransmissionPolicy (0);
442  return serviceFlow;
443 }
444 
445 void
447  std::string prefix,
448  Ptr<NetDevice> nd,
449  bool explicitFilename)
450 {
451  //
452  // All of the ascii enable functions vector through here including the ones
453  // that are wandering through all of devices on perhaps all of the nodes in
454  // the system. We can only deal with devices of type CsmaNetDevice.
455  //
456  Ptr<WimaxNetDevice> device = nd->GetObject<WimaxNetDevice> ();
457  if (device == 0)
458  {
459  NS_LOG_INFO ("WimaxHelper::EnableAsciiInternal(): Device " << device << " not of type ns3::WimaxNetDevice");
460  return;
461  }
462 
463  //
464  // Our default trace sinks are going to use packet printing, so we have to
465  // make sure that is turned on.
466  //
468 
469  //
470  // If we are not provided an OutputStreamWrapper, we are expected to create
471  // one using the usual trace filename conventions and do a Hook*WithoutContext
472  // since there will be one file per context and therefore the context would
473  // be redundant.
474  //
475  if (stream == 0)
476  {
477  //
478  // Set up an output stream object to deal with private ofstream copy
479  // constructor and lifetime issues. Let the helper decide the actual
480  // name of the file given the prefix.
481  //
482  AsciiTraceHelper asciiTraceHelper;
483  std::string filename;
484  if (explicitFilename)
485  {
486  filename = prefix;
487  }
488  else
489  {
490  filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
491  }
492  Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
493 
494  uint32_t nodeid = nd->GetNode ()->GetId ();
495  uint32_t deviceid = nd->GetIfIndex ();
496  std::ostringstream oss;
497  //
498  // The MacRx trace source provides our "r" event.
499  //
500 
501  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WimaxNetDevice/Rx";
502  Config::Connect (oss.str (), MakeBoundCallback (&WimaxHelper::AsciiRxEvent, theStream));
503  oss.str ("");
504  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WimaxNetDevice/Tx";
505  Config::Connect (oss.str (), MakeBoundCallback (&WimaxHelper::AsciiTxEvent, theStream));
506  //
507  // The "+", '-', and 'd' events are driven by trace sources actually in the
508  // transmit queue.
509  //
510 
511  EnableAsciiForConnection (theStream, nodeid, deviceid, (char*) "WimaxNetDevice", (char*) "InitialRangingConnection");
512  EnableAsciiForConnection (theStream, nodeid, deviceid, (char*) "WimaxNetDevice", (char*) "BroadcastConnection");
513  EnableAsciiForConnection (theStream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "BasicConnection");
514  EnableAsciiForConnection (theStream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "PrimaryConnection");
515  return;
516  }
517 
518  //
519  // If we are provided an OutputStreamWrapper, we are expected to use it, and
520  // to providd a context. We are free to come up with our own context if we
521  // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
522  // compatibility and simplicity, we just use Config::Connect and let it deal
523  // with the context.
524  //
525  // Note that we are going to use the default trace sinks provided by the
526  // ascii trace helper. There is actually no AsciiTraceHelper in sight here,
527  // but the default trace sinks are actually publicly available static
528  // functions that are always there waiting for just such a case.
529  //
530  uint32_t nodeid = nd->GetNode ()->GetId ();
531  uint32_t deviceid = nd->GetIfIndex ();
532  std::ostringstream oss;
533 
534  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WimaxNetDevice/Rx";
536 
537  oss.str ("");
538  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::WimaxNetDevice/Tx";
540 
541  EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "WimaxNetDevice", (char*) "InitialRangingConnection");
542  EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "WimaxNetDevice", (char*) "BroadcastConnection");
543  EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "BasicConnection");
544  EnableAsciiForConnection (stream, nodeid, deviceid, (char*) "SubscriberStationNetDevice", (char*) "PrimaryConnection");
545 
546 }
547 
555 {
556  std::list<Ptr<Packet> > packets = burst->GetPackets ();
557  for (std::list<Ptr<Packet> >::iterator iter = packets.begin (); iter != packets.end (); ++iter)
558  {
559  Ptr<Packet> p = (*iter)->Copy ();
560  WimaxMacToMacHeader m2m (p->GetSize ());
561  p->AddHeader (m2m);
562  file->Write (Simulator::Now (), p);
563  }
564 }
565 
566 void
567 WimaxHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool explicitFilename, bool promiscuous)
568 {
569  //
570  // All of the Pcap enable functions vector through here including the ones
571  // that are wandering through all of devices on perhaps all of the nodes in
572  // the system. We can only deal with devices of type WimaxNetDevice.
573  //
574  Ptr<WimaxNetDevice> device = nd->GetObject<WimaxNetDevice> ();
575  if (device == 0)
576  {
577  NS_LOG_INFO ("WimaxHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WimaxNetDevice");
578  return;
579  }
580 
581  Ptr<WimaxPhy> phy = device->GetPhy ();
582  PcapHelper pcapHelper;
583  std::string filename;
584  if (explicitFilename)
585  {
586  filename = prefix;
587  }
588  else
589  {
590  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
591  }
592 
593  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, PcapHelper::DLT_EN10MB);
594 
595  phy->TraceConnectWithoutContext ("Tx", MakeBoundCallback (&PcapSniffTxRxEvent, file));
596  phy->TraceConnectWithoutContext ("Rx", MakeBoundCallback (&PcapSniffTxRxEvent, file));
597 }
598 
599 int64_t
601 {
602  NS_LOG_FUNCTION (this << stream);
603  return m_channel->AssignStreams (stream);
604 }
605 
606 int64_t
608 {
609  int64_t currentStream = stream;
610  Ptr<NetDevice> netDevice;
611  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
612  {
613  netDevice = (*i);
614  Ptr<WimaxNetDevice> wimax = DynamicCast<WimaxNetDevice> (netDevice);
615  if (wimax)
616  {
617  // Handle any random numbers in the PHY objects.
618  currentStream += wimax->GetPhy ()->AssignStreams (currentStream);
619  }
620  }
621 
622  // Handle any random numbers in the channel.
623  currentStream += m_channel->AssignStreams (currentStream);
624 
625  return (currentStream - stream);
626 }
627 
628 } // namespace ns3
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 void DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Enqueue default trace sink.
An migration-based uplink scheduler.
Definition: wimax-helper.h:89
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
ASCII trace receive event.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:831
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
void SetRequestTransmissionPolicy(uint32_t policy)
Set request transmission policy.
Manage pcap files for device models.
Definition: trace-helper.h:38
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
Definition: wimax-helper.h:85
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1686
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:355
SimpleOfdmWimaxChannel class.
NetDeviceType
Net Device Type Distinguish a subscriber station(SS) device from base station(BS) device...
Definition: wimax-helper.h:65
static void DefaultDropSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Drop default trace sink.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
void SetToleratedJitter(uint32_t jitter)
Set tolerated jitter.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:278
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
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. ...
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
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...
NetDeviceContainer Install(NodeContainer c, NetDeviceType type, PhyType phyType, SchedulerType schedulerType)
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file.
Definition: trace-helper.cc:49
IpcsClassifierRecord class.
void SetSduSize(uint8_t sduSize)
Set SDU size.
void SetMinReservedTrafficRate(uint32_t minResvRate)
Set minimum reserved traffic rate.
std::list< Ptr< Packet > > GetPackets(void) const
Definition: packet-burst.cc:92
channel
Definition: third.py:85
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
print pcap record
phy
Definition: third.py:86
A simple scheduler - rtPS based scheduler.
Definition: wimax-helper.h:88
static void EnableAsciiForConnection(Ptr< OutputStreamWrapper > oss, uint32_t nodeid, uint32_t deviceid, char *netdevice, char *connection)
Enable ascii trace output on the indicated net device for a given connection.
Definition: wimax-helper.cc:52
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition: service-flow.h:58
CsParameters class.
Definition: cs-parameters.h:35
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
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:369
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
Direction
Direction enumeration.
Definition: service-flow.h:43
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:572
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
this class implements the mac to mac header needed to dump a wimax pcap file The header format was re...
holds a vector of ns3::NetDevice pointers
void SetUnsolicitedGrantInterval(uint16_t unsolicitedGrantInterval)
Set unsolicied grant interval.
Ptr< WimaxChannel > m_channel
wifi channel
Definition: wimax-helper.h:326
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
Definition: wimax-helper.cc:94
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:843
#define list
void SetMaximumLatency(uint32_t MaximumLatency)
Set maximum latency.
static void DefaultDequeueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Dequeue default trace sink.
Hold together all WiMAX-related objects in a NetDevice.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetConvergenceSublayerParam(CsParameters csparam)
Set convergence sublayer parameters.
keep track of a set of node pointers.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
an EUI-48 address
Definition: mac48-address.h:43
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
void SetMinTolerableTrafficRate(uint32_t minJitter)
Set minimum tolerable traffic rate.
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
ASCII trace transmit event.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:128
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1014
void SetMaxTrafficBurst(uint32_t maxTrafficBurst)
Set maximum traffic burst.
ServiceFlow CreateServiceFlow(ServiceFlow::Direction direction, ServiceFlow::SchedulingType schedulinType, IpcsClassifierRecord classifier)
Creates a transport service flow.
Ptr< WimaxPhy > CreatePhyWithoutChannel(PhyType phyType)
Ptr< BSScheduler > CreateBSScheduler(SchedulerType schedulerType)
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool explicitFilename, bool promiscuous)
Enable pcap output on the indicated net device.
Print everything.
Definition: log.h:113
void SetTrafficPriority(uint8_t priority)
Set traffic priority.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
void SetCsSpecification(enum CsSpecification spec)
Set CS specification.
void SetMaxSustainedTrafficRate(uint32_t maxSustainedRate)
Set max sustained traffic rate.
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
devices
Definition: first.py:32
Ptr< WimaxPhy > CreatePhy(PhyType phyType)
Definition: wimax-helper.cc:74
Ptr< UplinkScheduler > CreateUplinkScheduler(SchedulerType schedulerType)
WimaxHelper(void)
Create a Wimax helper in an empty state.
Definition: wimax-helper.cc:43
PhyType
WiMAX Physical layer WiMAX Physical layers with different levels of detail.
Definition: wimax-helper.h:76
void SetServiceSchedulingType(enum ServiceFlow::SchedulingType schedType)
Set service scheduling type.
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:256
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
A simple priority-based FCFS scheduler.
Definition: wimax-helper.h:87