A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 NS_LOG_COMPONENT_DEFINE ("WimaxHelper");
40 
41 namespace ns3 {
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 {
76  Ptr<WimaxPhy> phy;
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 {
105  Ptr<WimaxPhy> phy;
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 {
129  Ptr<WimaxPhy> phy;
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 {
145  Ptr<WimaxPhy> phy;
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,
291  Ptr<WimaxChannel> channel,
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,
330  Ptr<WimaxChannel> channel,
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 
550 {
551  std::list<Ptr<Packet> > packets = burst->GetPackets ();
552  for (std::list<Ptr<Packet> >::iterator iter = packets.begin (); iter != packets.end (); ++iter)
553  {
554  Ptr<Packet> p = (*iter)->Copy ();
555  WimaxMacToMacHeader m2m (p->GetSize ());
556  p->AddHeader (m2m);
557  file->Write (Simulator::Now (), p);
558  }
559 }
560 
561 void
562 WimaxHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool explicitFilename, bool promiscuous)
563 {
564  //
565  // All of the Pcap enable functions vector through here including the ones
566  // that are wandering through all of devices on perhaps all of the nodes in
567  // the system. We can only deal with devices of type WimaxNetDevice.
568  //
569  Ptr<WimaxNetDevice> device = nd->GetObject<WimaxNetDevice> ();
570  if (device == 0)
571  {
572  NS_LOG_INFO ("WimaxHelper::EnablePcapInternal(): Device " << &device << " not of type ns3::WimaxNetDevice");
573  return;
574  }
575 
576  Ptr<WimaxPhy> phy = device->GetPhy ();
577  PcapHelper pcapHelper;
578  std::string filename;
579  if (explicitFilename)
580  {
581  filename = prefix;
582  }
583  else
584  {
585  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
586  }
587 
588  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out, PcapHelper::DLT_EN10MB);
589 
590  phy->TraceConnectWithoutContext ("Tx", MakeBoundCallback (&PcapSniffTxRxEvent, file));
591  phy->TraceConnectWithoutContext ("Rx", MakeBoundCallback (&PcapSniffTxRxEvent, file));
592 }
593 
594 int64_t
596 {
597  NS_LOG_FUNCTION (this << stream);
598  return m_channel->AssignStreams (stream);
599 }
600 
601 int64_t
603 {
604  int64_t currentStream = stream;
605  Ptr<NetDevice> netDevice;
606  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
607  {
608  netDevice = (*i);
609  Ptr<WimaxNetDevice> wimax = DynamicCast<WimaxNetDevice> (netDevice);
610  if (wimax)
611  {
612  // Handle any random numbers in the PHY objects.
613  currentStream += wimax->GetPhy ()->AssignStreams (currentStream);
614  }
615  }
616 
617  // Handle any random numbers in the channel.
618  currentStream += m_channel->AssignStreams (currentStream);
619 
620  return (currentStream - stream);
621 }
622 
623 } // namespace ns3
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
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 "...
tuple devices
Definition: first.py:32
static void DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Enqueue default trace sink.
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, uint32_t dataLinkType, uint32_t snapLen=65535, int32_t tzCorrection=0)
Create and initialize a pcap file.
Definition: trace-helper.cc:49
An migration-based uplink scheduler.
Definition: wimax-helper.h:90
static void AsciiRxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &source)
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
void SetMaxSustainedTrafficRate(uint32_t)
Manage pcap files for device models.
Definition: trace-helper.h:38
void Write(Time t, Ptr< const Packet > p)
Write the next packet to file.
SchedulerType
Scheduler Type Different implementations of uplink/downlink scheduler.
Definition: wimax-helper.h:86
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Build bound Callbacks which take varying numbers of arguments, and potentially returning a value...
Definition: callback.h:1467
NetDeviceType
Net Device Type Distinguish a subscriber station(SS) device from base station(BS) device...
Definition: wimax-helper.h:66
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:170
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:744
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:223
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:95
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 Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:728
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)
void SetMinReservedTrafficRate(uint32_t)
void SetServiceSchedulingType(enum ServiceFlow::SchedulingType)
static void PcapSniffTxRxEvent(Ptr< PcapFileWrapper > file, Ptr< const PacketBurst > burst)
A simple scheduler - rtPS based scheduler.
Definition: wimax-helper.h:89
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
double GetSeconds(void) const
Definition: nstime.h:272
void SetMaxTrafficBurst(uint32_t)
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
static Mac48Address Allocate(void)
Allocate a new Mac48Address.
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:552
void SetSduSize(uint8_t)
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this 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
Ptr< WimaxChannel > m_channel
Definition: wimax-helper.h:310
void SetRequestTransmissionPolicy(uint32_t)
void SetUnsolicitedGrantInterval(uint16_t)
void SetPropagationLossModel(SimpleOfdmWimaxChannel::PropModel propagationModel)
Set the propagation and loss model of the channel.
Definition: wimax-helper.cc:94
#define list
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:122
void SetTrafficPriority(uint8_t)
void SetConvergenceSublayerParam(CsParameters)
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.
keep track of a set of node pointers.
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
an EUI-48 address
Definition: mac48-address.h:41
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
void SetMaximumLatency(uint32_t)
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 time".
Definition: simulator.cc:180
void SetMinTolerableTrafficRate(uint32_t)
static void AsciiTxEvent(Ptr< OutputStreamWrapper > stream, std::string path, Ptr< const Packet > packet, const Mac48Address &dest)
uint32_t AddDevice(Ptr< NetDevice > device)
Definition: node.cc:120
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
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.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
void SetToleratedJitter(uint32_t)
static void EnableLogComponents(void)
Helper to enable all WimaxNetDevice log components with one statement.
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
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:77
void SetCsSpecification(enum CsSpecification)
std::list< Ptr< Packet > > GetPackets(void) const
Definition: packet-burst.cc:91
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
A simple priority-based FCFS scheduler.
Definition: wimax-helper.h:88
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:318