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