A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lr-wpan-bootstrap.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Tokushima University, Japan.
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 * Author: Alberto Gallegos Ramonet <alramonet@is.tokushima-u.ac.jp>
18 */
19
20/*
21 * This example demonstrates the use of lr-wpan bootstrap (i.e. IEEE 802.15.4 Scan & Association).
22 * For a full description of this process check IEEE 802.15.4-2011 Section 5.1.3.1 and Figure 18.
23 *
24 * In this example, we create a grid topology of 100 nodes.
25 * Additionally, 2 coordinators are created and set in beacon-enabled mode.
26 * Coordinator 1 = Channel 14, Pan ID 5 , Coordinator 2 = Channel 12, Pan ID 7.
27 * Nodes start scanning channels 11-14 looking for beacons for a defined duration (PASSIVE SCAN).
28 * The scanning start time is slightly different for each node to avoid a storm of association
29 * requests. When a node scan is completed, an association request is send to one coordinator based
30 * on the LQI results of the scan. A node may not find any beacons if the coordinator is outside its
31 * communication range. An association request may not be send if LQI is too low for an association.
32 *
33 * The coordinator in PAN 5 runs in extended addressing mode and do not assign short addresses.
34 * The coordinator in PAN 7 runs in short addressing mode and assign short addresses.
35 *
36 * At the end of the simulation, an animation is generated (lrwpan-bootstrap.xml), showing the
37 * results of the association with each coordinator. This simulation can take a few seconds to
38 * complete.
39 */
40
41#include <ns3/core-module.h>
42#include <ns3/lr-wpan-module.h>
43#include <ns3/mobility-module.h>
44#include <ns3/netanim-module.h>
45#include <ns3/network-module.h>
46#include <ns3/propagation-module.h>
47#include <ns3/spectrum-module.h>
48
49#include <iostream>
50
51using namespace ns3;
52
56
57static void
59{
60 std::cout << Simulator::Now().As(Time::S) << " | Animation Updated, End of simulation.\n";
61 for (uint32_t i = 0; i < nodes.GetN(); ++i)
62 {
63 anim->UpdateNodeSize(i, 5, 5);
64 Ptr<Node> node = nodes.Get(i);
65 Ptr<NetDevice> netDevice = node->GetDevice(0);
66 Ptr<LrWpanNetDevice> lrwpanDevice = DynamicCast<LrWpanNetDevice>(netDevice);
67 int panId = lrwpanDevice->GetMac()->GetPanId();
68
69 switch (panId)
70 {
71 case 5:
72 anim->UpdateNodeColor(node, 0, 0, 255);
73 break;
74 case 7:
75 anim->UpdateNodeColor(node, 0, 51, 102);
76 break;
77 default:
78 break;
79 }
80 }
81}
82
83static void
85{
86 // The algorithm to select which coordinator to associate is not
87 // covered by the standard. In this case, we use the coordinator
88 // with the highest LQI value obtained from a passive scan and make
89 // sure this coordinator allows association.
90
91 if (params.m_status == LrWpanMacStatus::SUCCESS)
92 {
93 // Select the coordinator with the highest LQI from the PAN Descriptor List
94 int maxLqi = 0;
95 int panDescIndex = 0;
96 if (!params.m_panDescList.empty())
97 {
98 for (uint32_t i = 0; i < params.m_panDescList.size(); i++)
99 {
100 if (params.m_panDescList[i].m_linkQuality > maxLqi)
101 {
102 maxLqi = params.m_panDescList[i].m_linkQuality;
103 panDescIndex = i;
104 }
105 }
106
107 // Only request association if the coordinator is permitting association at this moment.
108 SuperframeField superframe(params.m_panDescList[panDescIndex].m_superframeSpec);
109 if (superframe.IsAssocPermit())
110 {
111 std::string addressing;
112 if (params.m_panDescList[panDescIndex].m_coorAddrMode == SHORT_ADDR)
113 {
114 addressing = "Short";
115 }
116 else if (params.m_panDescList[panDescIndex].m_coorAddrMode == EXT_ADDR)
117 {
118 addressing = "Ext";
119 }
120
121 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId()
122 << " [" << device->GetMac()->GetShortAddress() << " | "
123 << device->GetMac()->GetExtendedAddress() << "]"
124 << " MLME-scan.confirm: Selected PAN ID "
125 << params.m_panDescList[panDescIndex].m_coorPanId
126 << "| Coord addressing mode: " << addressing << " | LQI "
127 << static_cast<int>(params.m_panDescList[panDescIndex].m_linkQuality)
128 << "\n";
129
130 if (params.m_panDescList[panDescIndex].m_linkQuality >= 127)
131 {
132 MlmeAssociateRequestParams assocParams;
133 assocParams.m_chNum = params.m_panDescList[panDescIndex].m_logCh;
134 assocParams.m_chPage = params.m_panDescList[panDescIndex].m_logChPage;
135 assocParams.m_coordPanId = params.m_panDescList[panDescIndex].m_coorPanId;
136 assocParams.m_coordAddrMode = params.m_panDescList[panDescIndex].m_coorAddrMode;
137 CapabilityField capability;
138
139 if (params.m_panDescList[panDescIndex].m_coorAddrMode ==
140 LrWpanAddressMode::SHORT_ADDR)
141 {
142 assocParams.m_coordAddrMode = LrWpanAddressMode::SHORT_ADDR;
143 assocParams.m_coordShortAddr =
144 params.m_panDescList[panDescIndex].m_coorShortAddr;
145 capability.SetShortAddrAllocOn(true);
146 }
147 else if (assocParams.m_coordAddrMode == LrWpanAddressMode::EXT_ADDR)
148 {
149 assocParams.m_coordAddrMode = LrWpanAddressMode::EXT_ADDR;
150 assocParams.m_coordExtAddr =
151 params.m_panDescList[panDescIndex].m_coorExtAddr;
152 assocParams.m_coordShortAddr = Mac16Address("ff:fe");
153 capability.SetShortAddrAllocOn(false);
154 }
155 assocParams.m_capabilityInfo = capability.GetCapability();
156
158 device->GetMac(),
159 assocParams);
160 }
161 else
162 {
163 std::cout << Simulator::Now().As(Time::S) << " Node "
164 << device->GetNode()->GetId() << " ["
165 << device->GetMac()->GetShortAddress() << " | "
166 << device->GetMac()->GetExtendedAddress() << "]"
167 << " MLME-scan.confirm: Beacon found but link quality too low for "
168 "association.\n";
169 }
170 }
171 }
172 else
173 {
174 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId()
175 << " [" << device->GetMac()->GetShortAddress() << " | "
176 << device->GetMac()->GetExtendedAddress()
177 << "] MLME-scan.confirm: Beacon not found.\n";
178 }
179 }
180 else
181 {
182 std::cout << Simulator::Now().As(Time::S) << " [" << device->GetMac()->GetShortAddress()
183 << " | " << device->GetMac()->GetExtendedAddress()
184 << "] error occurred, scan failed.\n";
185 }
186}
187
188static void
190{
191 // This is typically implemented by the coordinator next layer (3rd layer or higher).
192 // The steps described below are out of the scope of the standard.
193
194 // Here the 3rd layer should check:
195 // a) Whether or not the device was previously associated with this PAN
196 // (the coordinator keeps a list).
197 // b) The coordinator have sufficient resources available to allow the
198 // association.
199 // If the association fails, status = 1 or 2 and assocShortAddr = FFFF.
200
201 // In this example, the coordinator accepts every association request and have no association
202 // limits. Furthermore, previous associated devices are not checked.
203
204 // When short address allocation is on (set initially in the association request), the
205 // coordinator is supposed to assign a short address. In here, we just do a dummy address
206 // assign. The assigned short address is just a truncated version of the device existing
207 // extended address (i.e the default short address).
208
209 MlmeAssociateResponseParams assocRespParams;
210
211 assocRespParams.m_extDevAddr = params.m_extDevAddr;
212 assocRespParams.m_status = LrWpanMacStatus::SUCCESS;
213 CapabilityField capability;
214 capability.SetCapability(params.capabilityInfo);
215
216 if (capability.IsShortAddrAllocOn())
217 {
218 // Truncate the extended address and make an assigned
219 // short address based on this. This mechanism is not described by the standard.
220 // It is just implemented here as a quick and dirty way to assign short addresses.
221 uint8_t buffer64MacAddr[8];
222 uint8_t buffer16MacAddr[2];
223
224 params.m_extDevAddr.CopyTo(buffer64MacAddr);
225 buffer16MacAddr[1] = buffer64MacAddr[7];
226 buffer16MacAddr[0] = buffer64MacAddr[6];
227
228 Mac16Address shortAddr;
229 shortAddr.CopyFrom(buffer16MacAddr);
230 assocRespParams.m_assocShortAddr = shortAddr;
231 }
232 else
233 {
234 // If Short Address allocation flag is false, the device will
235 // use its extended address to send data packets and short address will be
236 // equal to ff:fe. See 802.15.4-2011 (Section 5.3.2.2)
237 assocRespParams.m_assocShortAddr = Mac16Address("ff:fe");
238 }
239
240 Simulator::ScheduleNow(&LrWpanMac::MlmeAssociateResponse, device->GetMac(), assocRespParams);
241}
242
243static void
245{
246 // Used by coordinator higher layer to inform results of a
247 // association procedure from its mac layer.This is implemented by other protocol stacks
248 // and is only here for demonstration purposes.
249 switch (params.m_status)
250 {
251 case LrWpanMacStatus::TRANSACTION_EXPIRED:
252 std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
253 << " [" << device->GetMac()->GetShortAddress() << " | "
254 << device->GetMac()->GetExtendedAddress() << "]"
255 << " MLME-comm-status.indication: Transaction for device " << params.m_dstExtAddr
256 << " EXPIRED in pending transaction list\n";
257 break;
258 case LrWpanMacStatus::NO_ACK:
259 std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
260 << " [" << device->GetMac()->GetShortAddress() << " | "
261 << device->GetMac()->GetExtendedAddress() << "]"
262 << " MLME-comm-status.indication: NO ACK from " << params.m_dstExtAddr
263 << " device registered in the pending transaction list\n";
264 break;
265
266 case LrWpanMacStatus::CHANNEL_ACCESS_FAILURE:
267 std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
268 << " [" << device->GetMac()->GetShortAddress() << " | "
269 << device->GetMac()->GetExtendedAddress() << "]"
270 << " MLME-comm-status.indication: CHANNEL ACCESS problem in transaction for "
271 << params.m_dstExtAddr << " registered in the pending transaction list\n";
272 break;
273
274 default:
275 break;
276 }
277}
278
279static void
281{
282 // Used by device higher layer to inform the results of a
283 // association procedure from its mac layer.This is implemented by other protocol stacks
284 // and is only here for demonstration purposes.
285 if (params.m_status == LrWpanMacStatus::SUCCESS)
286 {
287 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
288 << device->GetMac()->GetShortAddress() << " | "
289 << device->GetMac()->GetExtendedAddress() << "]"
290 << " MLME-associate.confirm: Association with coordinator successful."
291 << " (PAN: " << device->GetMac()->GetPanId()
292 << " | CoordShort: " << device->GetMac()->GetCoordShortAddress()
293 << " | CoordExt: " << device->GetMac()->GetCoordExtAddress() << ")\n";
294 }
295 else if (params.m_status == LrWpanMacStatus::NO_ACK)
296 {
297 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
298 << device->GetMac()->GetShortAddress() << " | "
299 << device->GetMac()->GetExtendedAddress() << "]"
300 << " MLME-associate.confirm: Association with coordinator FAILED (NO ACK).\n";
301 }
302 else
303 {
304 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
305 << device->GetMac()->GetShortAddress() << " | "
306 << device->GetMac()->GetExtendedAddress() << "]"
307 << " MLME-associate.confirm: Association with coordinator FAILED.\n";
308 }
309}
310
311static void
313{
314 if (params.m_status == LrWpanMacStatus::CHANNEL_ACCESS_FAILURE)
315 {
316 std::cout
317 << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
318 << device->GetMac()->GetShortAddress() << " | "
319 << device->GetMac()->GetExtendedAddress() << "]"
320 << " MLME-poll.confirm: CHANNEL ACCESS problem when sending a data request command.\n";
321 }
322 else if (params.m_status == LrWpanMacStatus::NO_ACK)
323 {
324 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
325 << device->GetMac()->GetShortAddress() << " | "
326 << device->GetMac()->GetExtendedAddress() << "]"
327 << " MLME-poll.confirm: Data Request Command FAILED (NO ACK).\n";
328 }
329 else if (params.m_status != LrWpanMacStatus::SUCCESS)
330 {
331 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
332 << device->GetMac()->GetShortAddress() << " | "
333 << device->GetMac()->GetExtendedAddress() << "]"
334 << " MLME-poll.confirm: Data Request command FAILED.\n";
335 }
336}
337
338int
339main(int argc, char* argv[])
340{
342
343 nodes.Create(100);
345
347 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
348 mobility.SetPositionAllocator("ns3::GridPositionAllocator",
349 "MinX",
350 DoubleValue(0.0),
351 "MinY",
352 DoubleValue(0.0),
353 "DeltaX",
354 DoubleValue(30.0),
355 "DeltaY",
356 DoubleValue(30.0),
357 "GridWidth",
358 UintegerValue(20),
359 "LayoutType",
360 StringValue("RowFirst"));
361
362 mobility.Install(nodes);
363
364 Ptr<ListPositionAllocator> listPositionAlloc = CreateObject<ListPositionAllocator>();
365 listPositionAlloc->Add(Vector(210, 50, 0)); // Coordinator 1 mobility (210,50,0)
366 listPositionAlloc->Add(Vector(360, 50, 0)); // Coordinator 2 mobility (360,50,0)
367
368 mobility.SetPositionAllocator(listPositionAlloc);
369 mobility.Install(coordinators);
370
371 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
373 CreateObject<LogDistancePropagationLossModel>();
375 CreateObject<ConstantSpeedPropagationDelayModel>();
376
377 channel->AddPropagationLossModel(propModel);
378 channel->SetPropagationDelayModel(delayModel);
379
380 LrWpanHelper lrWpanHelper;
381 lrWpanHelper.SetChannel(channel);
382
383 NetDeviceContainer lrwpanDevices = lrWpanHelper.Install(nodes);
384 lrwpanDevices.Add(lrWpanHelper.Install(coordinators));
385
386 // Set the extended address to all devices (EUI-64)
387 lrWpanHelper.SetExtendedAddresses(lrwpanDevices);
388
389 // Devices hooks & MAC MLME-scan primitive set
390 for (auto i = nodes.Begin(); i != nodes.End(); i++)
391 {
392 Ptr<Node> node = *i;
393 Ptr<NetDevice> netDevice = node->GetDevice(0);
394 Ptr<LrWpanNetDevice> lrwpanDevice = DynamicCast<LrWpanNetDevice>(netDevice);
395 lrwpanDevice->GetMac()->SetMlmeScanConfirmCallback(
396 MakeBoundCallback(&ScanConfirm, lrwpanDevice));
397 lrwpanDevice->GetMac()->SetMlmeAssociateConfirmCallback(
398 MakeBoundCallback(&AssociateConfirm, lrwpanDevice));
399 lrwpanDevice->GetMac()->SetMlmePollConfirmCallback(
400 MakeBoundCallback(&PollConfirm, lrwpanDevice));
401
402 // Devices initiate channels scan on channels 11, 12, 13, and 14 looking for beacons
403 // Scan Channels represented by bits 0-26 (27 LSB)
404 // ch 14 ch 11
405 // | |
406 // 0x7800 = 0000000000000000111100000000000
407
408 MlmeScanRequestParams scanParams;
409 scanParams.m_chPage = 0;
410 scanParams.m_scanChannels = 0x7800;
411 scanParams.m_scanDuration = 14;
412 scanParams.m_scanType = MLMESCAN_PASSIVE;
413
414 // We start the scanning process 100 milliseconds apart for each device
415 // to avoid a storm of association requests with the coordinators
416 Time jitter = Seconds(2) + MilliSeconds(std::distance(nodes.Begin(), i) * 100);
417 Simulator::ScheduleWithContext(node->GetId(),
418 jitter,
420 lrwpanDevice->GetMac(),
421 scanParams);
422 }
423
424 // Coordinator hooks
425 for (auto i = coordinators.Begin(); i != coordinators.End(); i++)
426 {
427 Ptr<Node> coor = *i;
428 Ptr<NetDevice> netDevice = coor->GetDevice(0);
429 Ptr<LrWpanNetDevice> lrwpanDevice = DynamicCast<LrWpanNetDevice>(netDevice);
430 lrwpanDevice->GetMac()->SetMlmeAssociateIndicationCallback(
431 MakeBoundCallback(&AssociateIndication, lrwpanDevice));
432 lrwpanDevice->GetMac()->SetMlmeCommStatusIndicationCallback(
434 }
435
436 Ptr<Node> coor1 = coordinators.Get(0);
437 Ptr<NetDevice> netDeviceCoor1 = coor1->GetDevice(0);
438 Ptr<LrWpanNetDevice> coor1Device = DynamicCast<LrWpanNetDevice>(netDeviceCoor1);
439
440 Ptr<Node> coor2 = coordinators.Get(1);
441 Ptr<NetDevice> netDeviceCoor2 = coor2->GetDevice(0);
442 Ptr<LrWpanNetDevice> coor2Device = DynamicCast<LrWpanNetDevice>(netDeviceCoor2);
443
444 // Coordinators require that their short address is explicitly set.
445 // Either FF:FE to indicate that only extended addresses will be used in the following
446 // data communications or any other value (except for FF:FF) to indicate that the coordinator
447 // will use the short address in these communications.
448 // The default short address for all devices is FF:FF (unassigned/no associated).
449
450 // coor1 (PAN 5) = extended addressing mode coor2 (PAN 7) = short addressing mode
451 coor1Device->GetMac()->SetShortAddress(Mac16Address("FF:FE"));
452 coor2Device->GetMac()->SetShortAddress(Mac16Address("CA:FE"));
453
454 // PAN coordinator 1 (PAN 5) transmits beacons on channel 12
456 params.m_panCoor = true;
457 params.m_PanId = 5;
458 params.m_bcnOrd = 3;
459 params.m_sfrmOrd = 3;
460 params.m_logCh = 12;
461
462 Simulator::ScheduleWithContext(coor1Device->GetNode()->GetId(),
463 Seconds(2.0),
465 coor1Device->GetMac(),
466 params);
467
468 // PAN coordinator N2 (PAN 7) transmits beacons on channel 14
470 params2.m_panCoor = true;
471 params2.m_PanId = 7;
472 params2.m_bcnOrd = 3;
473 params2.m_sfrmOrd = 3;
474 params2.m_logCh = 14;
475
476 Simulator::ScheduleWithContext(coor2Device->GetNode()->GetId(),
477 Seconds(2.0),
479 coor2Device->GetMac(),
480 params2);
481
482 anim = new AnimationInterface("lrwpan-bootstrap.xml");
484 anim->UpdateNodeDescription(coordinators.Get(0), "Coordinator (PAN 5)");
485 anim->UpdateNodeDescription(coordinators.Get(1), "Coordinator (PAN 7)");
486 anim->UpdateNodeColor(coordinators.Get(0), 0, 0, 255);
487 anim->UpdateNodeColor(coordinators.Get(1), 0, 51, 102);
488 anim->UpdateNodeSize(nodes.GetN(), 9, 9);
489 anim->UpdateNodeSize(nodes.GetN() + 1, 9, 9);
490
494
496 delete anim;
497 return 0;
498}
Interface to network animator.
void SkipPacketTracing()
Do not trace packets.
void UpdateNodeSize(Ptr< Node > n, double width, double height)
Helper function to update the size of a node.
void UpdateNodeDescription(Ptr< Node > n, std::string descr)
Helper function to update the description for a given node.
void UpdateNodeColor(Ptr< Node > n, uint8_t r, uint8_t g, uint8_t b)
Helper function to update the node color.
Represent the Capability Information Field.
uint8_t GetCapability() const
Get the bitmap representing the device capability.
void SetCapability(uint8_t bitmap)
Set the bitmap representing the device capability.
void SetShortAddrAllocOn(bool addrAlloc)
Set the Short Address Flag in the Capability Information Field.
bool IsShortAddrAllocOn() const
True if the device wishes the coordinator to allocate a short address as result of the association pr...
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
helps to manage and create IEEE 802.15.4 NetDevice objects
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel associated to this helper.
void SetExtendedAddresses(NetDeviceContainer c)
Set the extended 64 bit addresses (EUI-64) for a group of LrWpanNetDevices.
NetDeviceContainer Install(NodeContainer c)
Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes.
void MlmeAssociateRequest(MlmeAssociateRequestParams params) override
IEEE 802.15.4-2011, section 6.2.2.1 MLME-ASSOCIATE.request Request primitive used by a device to requ...
Definition: lr-wpan-mac.cc:683
void MlmeAssociateResponse(MlmeAssociateResponseParams params) override
IEEE 802.15.4-2011, section 6.2.2.3 MLME-ASSOCIATE.response Primitive used to initiate a response to ...
Definition: lr-wpan-mac.cc:758
void MlmeScanRequest(MlmeScanRequestParams params) override
IEEE 802.15.4-2011, section 6.2.10.1 MLME-SCAN.request Request primitive used to initiate a channel s...
Definition: lr-wpan-mac.cc:623
void MlmeStartRequest(MlmeStartRequestParams params) override
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
Definition: lr-wpan-mac.cc:584
This class can contain 16 bit addresses.
Definition: mac16-address.h:44
void CopyFrom(const uint8_t buffer[2])
Helper class used to assign positions and mobility models to nodes.
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
keep track of a set of node pointers.
Iterator End() const
Get an iterator which indicates past-the-last Node in the container.
uint32_t GetN() const
Get the number of Ptr<Node> stored in this container.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Iterator Begin() const
Get an iterator which refers to the first Node in the container.
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:142
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:588
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
static void Run()
Run the simulation.
Definition: simulator.cc:178
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:605
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:186
Hold variables of type string.
Definition: string.h:56
Represent the Superframe Specification information field.
bool IsAssocPermit() const
Check if the Association Permit bit is enabled.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:415
@ S
second
Definition: nstime.h:116
Hold an unsigned integer type.
Definition: uinteger.h:45
@ MLMESCAN_PASSIVE
@ SHORT_ADDR
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Definition: callback.h:765
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
static void UpdateAnimation()
static void AssociateIndication(Ptr< LrWpanNetDevice > device, MlmeAssociateIndicationParams params)
NodeContainer coordinators
static void PollConfirm(Ptr< LrWpanNetDevice > device, MlmePollConfirmParams params)
static void AssociateConfirm(Ptr< LrWpanNetDevice > device, MlmeAssociateConfirmParams params)
AnimationInterface * anim
static void ScanConfirm(Ptr< LrWpanNetDevice > device, MlmeScanConfirmParams params)
NodeContainer nodes
static void CommStatusIndication(Ptr< LrWpanNetDevice > device, MlmeCommStatusIndicationParams params)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LogLevel
Logging severity classes and levels.
Definition: log.h:94
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition: log.h:118
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition: log.h:119
@ LOG_PREFIX_NODE
Prefix all trace prints with simulation node.
Definition: log.h:120
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:320
ns channel
Definition: third.py:88
ns mobility
Definition: third.py:105
FtrParams params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
MLME-ASSOCIATE.confirm params.
MLME-ASSOCIATE.indication params.
MLME-ASSOCIATE.request params.
uint8_t m_chNum
The channel number on which to attempt association.
uint8_t m_coordAddrMode
The coordinator addressing mode for this primitive and subsequent MPDU.
uint8_t m_capabilityInfo
Specifies the operational capabilities of the associating device (bitmap).
uint32_t m_chPage
The channel page on which to attempt association.
Mac64Address m_coordExtAddr
The extended address of the coordinator with which to associate.
Mac16Address m_coordShortAddr
The short address of the coordinator with which to associate.
uint16_t m_coordPanId
The identifier of the PAN with which to associate.
MLME-ASSOCIATE.response params.
Mac16Address m_assocShortAddr
The short address allocated by the coordinator on successful assoc.
LrWpanMacStatus m_status
The status of the association attempt (As defined on Table 83 IEEE 802.15.4-2006)
Mac64Address m_extDevAddr
The extended address of the device requesting association.
MLME-COMM-STATUS.indication params.
MLME-START.confirm params.
MLME-SCAN.confirm params.
MLME-SCAN.request params.
uint32_t m_scanChannels
The channel numbers to be scanned.
uint32_t m_chPage
The channel page on which to perform scan.
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
MLME-START.request params.
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
bool m_panCoor
On true this device will become coordinator.
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
uint16_t m_PanId
Pan Identifier used by the device.
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.