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 == MLMESCAN_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 if (params.m_panDescList[panDescIndex].m_superframeSpec.IsAssocPermit())
109 {
110 std::string addressing;
111 if (params.m_panDescList[panDescIndex].m_coorAddrMode == SHORT_ADDR)
112 {
113 addressing = "Short";
114 }
115 else if (params.m_panDescList[panDescIndex].m_coorAddrMode == EXT_ADDR)
116 {
117 addressing = "Ext";
118 }
119
120 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId()
121 << " [" << device->GetMac()->GetShortAddress() << " | "
122 << device->GetMac()->GetExtendedAddress() << "]"
123 << " MLME-scan.confirm: Selected PAN ID "
124 << params.m_panDescList[panDescIndex].m_coorPanId
125 << "| Coord addressing mode: " << addressing << " | LQI "
126 << static_cast<int>(params.m_panDescList[panDescIndex].m_linkQuality)
127 << "\n";
128
129 if (params.m_panDescList[panDescIndex].m_linkQuality >= 127)
130 {
131 MlmeAssociateRequestParams assocParams;
132 assocParams.m_chNum = params.m_panDescList[panDescIndex].m_logCh;
133 assocParams.m_chPage = params.m_panDescList[panDescIndex].m_logChPage;
134 assocParams.m_coordPanId = params.m_panDescList[panDescIndex].m_coorPanId;
135 assocParams.m_coordAddrMode = params.m_panDescList[panDescIndex].m_coorAddrMode;
136
137 if (params.m_panDescList[panDescIndex].m_coorAddrMode ==
138 LrWpanAddressMode::SHORT_ADDR)
139 {
140 assocParams.m_coordAddrMode = LrWpanAddressMode::SHORT_ADDR;
141 assocParams.m_coordShortAddr =
142 params.m_panDescList[panDescIndex].m_coorShortAddr;
143 assocParams.m_capabilityInfo.SetShortAddrAllocOn(true);
144 }
145 else if (assocParams.m_coordAddrMode == LrWpanAddressMode::EXT_ADDR)
146 {
147 assocParams.m_coordAddrMode = LrWpanAddressMode::EXT_ADDR;
148 assocParams.m_coordExtAddr =
149 params.m_panDescList[panDescIndex].m_coorExtAddr;
150 assocParams.m_coordShortAddr = Mac16Address("ff:fe");
151 assocParams.m_capabilityInfo.SetShortAddrAllocOn(false);
152 }
153
155 device->GetMac(),
156 assocParams);
157 }
158 else
159 {
160 std::cout << Simulator::Now().As(Time::S) << " Node "
161 << device->GetNode()->GetId() << " ["
162 << device->GetMac()->GetShortAddress() << " | "
163 << device->GetMac()->GetExtendedAddress() << "]"
164 << " MLME-scan.confirm: Beacon found but link quality too low for "
165 "association.\n";
166 }
167 }
168 }
169 else
170 {
171 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId()
172 << " [" << device->GetMac()->GetShortAddress() << " | "
173 << device->GetMac()->GetExtendedAddress()
174 << "] MLME-scan.confirm: Beacon not found.\n";
175 }
176 }
177 else
178 {
179 std::cout << Simulator::Now().As(Time::S) << " [" << device->GetMac()->GetShortAddress()
180 << " | " << device->GetMac()->GetExtendedAddress()
181 << "] error occurred, scan failed.\n";
182 }
183}
184
185static void
187{
188 // This is typically implemented by the coordinator next layer (3rd layer or higher).
189 // The steps described below are out of the scope of the standard.
190
191 // Here the 3rd layer should check:
192 // a) Whether or not the device was previously associated with this PAN
193 // (the coordinator keeps a list).
194 // b) The coordinator have sufficient resources available to allow the
195 // association.
196 // If the association fails, status = 1 or 2 and assocShortAddr = FFFF.
197
198 // In this example, the coordinator accepts every association request and have no association
199 // limits. Furthermore, previous associated devices are not checked.
200
201 // When short address allocation is on (set initially in the association request), the
202 // coordinator is supposed to assign a short address. In here, we just do a dummy address
203 // assign. The assigned short address is just a truncated version of the device existing
204 // extended address (i.e the default short address).
205
206 MlmeAssociateResponseParams assocRespParams;
207
208 assocRespParams.m_extDevAddr = params.m_extDevAddr;
209 assocRespParams.m_status = LrWpanAssociationStatus::ASSOCIATED;
210 if (params.capabilityInfo.IsShortAddrAllocOn())
211 {
212 // Truncate the extended address and make an assigned
213 // short address based on this. This mechanism is not described by the standard.
214 // It is just implemented here as a quick and dirty way to assign short addresses.
215 uint8_t buffer64MacAddr[8];
216 uint8_t buffer16MacAddr[2];
217
218 params.m_extDevAddr.CopyTo(buffer64MacAddr);
219 buffer16MacAddr[1] = buffer64MacAddr[7];
220 buffer16MacAddr[0] = buffer64MacAddr[6];
221
222 Mac16Address shortAddr;
223 shortAddr.CopyFrom(buffer16MacAddr);
224 assocRespParams.m_assocShortAddr = shortAddr;
225 }
226 else
227 {
228 // If Short Address allocation flag is false, the device will
229 // use its extended address to send data packets and short address will be
230 // equal to ff:fe. See 802.15.4-2011 (Section 5.3.2.2)
231 assocRespParams.m_assocShortAddr = Mac16Address("ff:fe");
232 }
233
234 Simulator::ScheduleNow(&LrWpanMac::MlmeAssociateResponse, device->GetMac(), assocRespParams);
235}
236
237static void
239{
240 // Used by coordinator higher layer to inform results of a
241 // association procedure from its mac layer.This is implemented by other protocol stacks
242 // and is only here for demonstration purposes.
243 switch (params.m_status)
244 {
245 case LrWpanMlmeCommStatus::MLMECOMMSTATUS_TRANSACTION_EXPIRED:
246 std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
247 << " [" << device->GetMac()->GetShortAddress() << " | "
248 << device->GetMac()->GetExtendedAddress() << "]"
249 << " MLME-comm-status.indication: Transaction for device " << params.m_dstExtAddr
250 << " EXPIRED in pending transaction list\n";
251 break;
252 case LrWpanMlmeCommStatus::MLMECOMMSTATUS_NO_ACK:
253 std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
254 << " [" << device->GetMac()->GetShortAddress() << " | "
255 << device->GetMac()->GetExtendedAddress() << "]"
256 << " MLME-comm-status.indication: NO ACK from " << params.m_dstExtAddr
257 << " device registered in the pending transaction list\n";
258 break;
259
260 case LrWpanMlmeCommStatus::MLMECOMMSTATUS_CHANNEL_ACCESS_FAILURE:
261 std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
262 << " [" << device->GetMac()->GetShortAddress() << " | "
263 << device->GetMac()->GetExtendedAddress() << "]"
264 << " MLME-comm-status.indication: CHANNEL ACCESS problem in transaction for "
265 << params.m_dstExtAddr << " registered in the pending transaction list\n";
266 break;
267
268 default:
269 break;
270 }
271}
272
273static void
275{
276 // Used by device higher layer to inform the results of a
277 // association procedure from its mac layer.This is implemented by other protocol stacks
278 // and is only here for demonstration purposes.
279 if (params.m_status == LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_SUCCESS)
280 {
281 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
282 << device->GetMac()->GetShortAddress() << " | "
283 << device->GetMac()->GetExtendedAddress() << "]"
284 << " MLME-associate.confirm: Association with coordinator successful."
285 << " (PAN: " << device->GetMac()->GetPanId()
286 << " | CoordShort: " << device->GetMac()->GetCoordShortAddress()
287 << " | CoordExt: " << device->GetMac()->GetCoordExtAddress() << ")\n";
288 }
289 else if (params.m_status == LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_NO_ACK)
290 {
291 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
292 << device->GetMac()->GetShortAddress() << " | "
293 << device->GetMac()->GetExtendedAddress() << "]"
294 << " MLME-associate.confirm: Association with coordinator FAILED (NO ACK).\n";
295 }
296 else
297 {
298 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
299 << device->GetMac()->GetShortAddress() << " | "
300 << device->GetMac()->GetExtendedAddress() << "]"
301 << " MLME-associate.confirm: Association with coordinator FAILED.\n";
302 }
303}
304
305static void
307{
308 if (params.m_status == LrWpanMlmePollConfirmStatus::MLMEPOLL_CHANNEL_ACCESS_FAILURE)
309 {
310 std::cout
311 << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
312 << device->GetMac()->GetShortAddress() << " | "
313 << device->GetMac()->GetExtendedAddress() << "]"
314 << " MLME-poll.confirm: CHANNEL ACCESS problem when sending a data request command.\n";
315 }
316 else if (params.m_status == LrWpanMlmePollConfirmStatus::MLMEPOLL_NO_ACK)
317 {
318 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
319 << device->GetMac()->GetShortAddress() << " | "
320 << device->GetMac()->GetExtendedAddress() << "]"
321 << " MLME-poll.confirm: Data Request Command FAILED (NO ACK).\n";
322 }
323 else if (params.m_status != LrWpanMlmePollConfirmStatus::MLMEPOLL_SUCCESS)
324 {
325 std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
326 << device->GetMac()->GetShortAddress() << " | "
327 << device->GetMac()->GetExtendedAddress() << "]"
328 << " MLME-poll.confirm: Data Request command FAILED.\n";
329 }
330}
331
332int
333main(int argc, char* argv[])
334{
336
337 nodes.Create(100);
339
341 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
342 mobility.SetPositionAllocator("ns3::GridPositionAllocator",
343 "MinX",
344 DoubleValue(0.0),
345 "MinY",
346 DoubleValue(0.0),
347 "DeltaX",
348 DoubleValue(30.0),
349 "DeltaY",
350 DoubleValue(30.0),
351 "GridWidth",
352 UintegerValue(20),
353 "LayoutType",
354 StringValue("RowFirst"));
355
356 mobility.Install(nodes);
357
358 Ptr<ListPositionAllocator> listPositionAlloc = CreateObject<ListPositionAllocator>();
359 listPositionAlloc->Add(Vector(210, 50, 0)); // Coordinator 1 mobility (210,50,0)
360 listPositionAlloc->Add(Vector(360, 50, 0)); // Coordinator 2 mobility (360,50,0)
361
362 mobility.SetPositionAllocator(listPositionAlloc);
363 mobility.Install(coordinators);
364
365 Ptr<SingleModelSpectrumChannel> channel = CreateObject<SingleModelSpectrumChannel>();
367 CreateObject<LogDistancePropagationLossModel>();
369 CreateObject<ConstantSpeedPropagationDelayModel>();
370
371 channel->AddPropagationLossModel(propModel);
372 channel->SetPropagationDelayModel(delayModel);
373
374 LrWpanHelper lrWpanHelper;
375 lrWpanHelper.SetChannel(channel);
376
377 NetDeviceContainer lrwpanDevices = lrWpanHelper.Install(nodes);
378 lrwpanDevices.Add(lrWpanHelper.Install(coordinators));
379
380 // Set the extended address to all devices (EUI-64)
381 lrWpanHelper.SetExtendedAddresses(lrwpanDevices);
382
383 // Devices hooks & MAC MLME-scan primitive set
384 for (NodeContainer::Iterator i = nodes.Begin(); i != nodes.End(); i++)
385 {
386 Ptr<Node> node = *i;
387 Ptr<NetDevice> netDevice = node->GetDevice(0);
388 Ptr<LrWpanNetDevice> lrwpanDevice = DynamicCast<LrWpanNetDevice>(netDevice);
389 lrwpanDevice->GetMac()->SetMlmeScanConfirmCallback(
390 MakeBoundCallback(&ScanConfirm, lrwpanDevice));
391 lrwpanDevice->GetMac()->SetMlmeAssociateConfirmCallback(
392 MakeBoundCallback(&AssociateConfirm, lrwpanDevice));
393 lrwpanDevice->GetMac()->SetMlmePollConfirmCallback(
394 MakeBoundCallback(&PollConfirm, lrwpanDevice));
395
396 // Devices initiate channels scan on channels 11, 12, 13, and 14 looking for beacons
397 // Scan Channels represented by bits 0-26 (27 LSB)
398 // ch 14 ch 11
399 // | |
400 // 0x7800 = 0000000000000000111100000000000
401
402 MlmeScanRequestParams scanParams;
403 scanParams.m_chPage = 0;
404 scanParams.m_scanChannels = 0x7800;
405 scanParams.m_scanDuration = 14;
406 scanParams.m_scanType = MLMESCAN_PASSIVE;
407
408 // We start the scanning process 100 milliseconds apart for each device
409 // to avoid a storm of association requests with the coordinators
410 Time jitter = Seconds(2) + MilliSeconds(std::distance(nodes.Begin(), i) * 100);
411 Simulator::ScheduleWithContext(node->GetId(),
412 jitter,
414 lrwpanDevice->GetMac(),
415 scanParams);
416 }
417
418 // Coordinator hooks
420 {
421 Ptr<Node> coor = *i;
422 Ptr<NetDevice> netDevice = coor->GetDevice(0);
423 Ptr<LrWpanNetDevice> lrwpanDevice = DynamicCast<LrWpanNetDevice>(netDevice);
424 lrwpanDevice->GetMac()->SetMlmeAssociateIndicationCallback(
425 MakeBoundCallback(&AssociateIndication, lrwpanDevice));
426 lrwpanDevice->GetMac()->SetMlmeCommStatusIndicationCallback(
428 }
429
430 Ptr<Node> coor1 = coordinators.Get(0);
431 Ptr<NetDevice> netDeviceCoor1 = coor1->GetDevice(0);
432 Ptr<LrWpanNetDevice> coor1Device = DynamicCast<LrWpanNetDevice>(netDeviceCoor1);
433
434 Ptr<Node> coor2 = coordinators.Get(1);
435 Ptr<NetDevice> netDeviceCoor2 = coor2->GetDevice(0);
436 Ptr<LrWpanNetDevice> coor2Device = DynamicCast<LrWpanNetDevice>(netDeviceCoor2);
437
438 // Coordinators require that their short address is explicitly set.
439 // Either FF:FE to indicate that only extended addresses will be used in the following
440 // data communications or any other value (except for FF:FF) to indicate that the coordinator
441 // will use the short address in these communications.
442 // The default short address for all devices is FF:FF (unassigned/no associated).
443
444 // coor1 (PAN 5) = extended addressing mode coor2 (PAN 7) = short addressing mode
445 coor1Device->GetMac()->SetShortAddress(Mac16Address("FF:FE"));
446 coor2Device->GetMac()->SetShortAddress(Mac16Address("CA:FE"));
447
448 // PAN coordinator 1 (PAN 5) transmits beacons on channel 12
450 params.m_panCoor = true;
451 params.m_PanId = 5;
452 params.m_bcnOrd = 3;
453 params.m_sfrmOrd = 3;
454 params.m_logCh = 12;
455
456 Simulator::ScheduleWithContext(coor1Device->GetNode()->GetId(),
457 Seconds(2.0),
459 coor1Device->GetMac(),
460 params);
461
462 // PAN coordinator N2 (PAN 7) transmits beacons on channel 14
464 params2.m_panCoor = true;
465 params2.m_PanId = 7;
466 params2.m_bcnOrd = 3;
467 params2.m_sfrmOrd = 3;
468 params2.m_logCh = 14;
469
470 Simulator::ScheduleWithContext(coor2Device->GetNode()->GetId(),
471 Seconds(2.0),
473 coor2Device->GetMac(),
474 params2);
475
476 anim = new AnimationInterface("lrwpan-bootstrap.xml");
478 anim->UpdateNodeDescription(coordinators.Get(0), "Coordinator (PAN 5)");
479 anim->UpdateNodeDescription(coordinators.Get(1), "Coordinator (PAN 7)");
480 anim->UpdateNodeColor(coordinators.Get(0), 0, 0, 255);
481 anim->UpdateNodeColor(coordinators.Get(1), 0, 51, 102);
482 anim->UpdateNodeSize(nodes.GetN(), 9, 9);
483 anim->UpdateNodeSize(nodes.GetN() + 1, 9, 9);
484
488
490 delete anim;
491 return 0;
492}
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.
void SetShortAddrAllocOn(bool addrAlloc)
Set the Short Address Flag in the Capability Information Field.
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 MlmeStartRequest(MlmeStartRequestParams params)
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:549
void MlmeAssociateRequest(MlmeAssociateRequestParams params)
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:648
void MlmeScanRequest(MlmeScanRequestParams params)
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:588
void MlmeAssociateResponse(MlmeAssociateResponseParams params)
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:723
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.
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.
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:78
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:140
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:587
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static void Run()
Run the simulation.
Definition: simulator.cc:176
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:606
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:184
Hold variables of type string.
Definition: string.h:56
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:417
@ S
second
Definition: nstime.h:116
Hold an unsigned integer type.
Definition: uinteger.h:45
@ MLMESCAN_PASSIVE
Definition: lr-wpan-mac.h:183
@ MLMESCAN_SUCCESS
Definition: lr-wpan-mac.h:234
@ SHORT_ADDR
Definition: lr-wpan-mac.h:156
@ EXT_ADDR
Definition: lr-wpan-mac.h:157
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
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
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:81
ns mobility
Definition: third.py:96
FtrParams params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
MLME-ASSOCIATE.confirm params.
Definition: lr-wpan-mac.h:586
MLME-ASSOCIATE.indication params.
Definition: lr-wpan-mac.h:449
MLME-ASSOCIATE.request params.
Definition: lr-wpan-mac.h:566
uint8_t m_chNum
The channel number on which to attempt association.
Definition: lr-wpan-mac.h:567
CapabilityField m_capabilityInfo
Specifies the operational capabilities of the associating device.
Definition: lr-wpan-mac.h:577
uint8_t m_coordAddrMode
The coordinator addressing mode for this primitive and subsequent MPDU.
Definition: lr-wpan-mac.h:569
uint32_t m_chPage
The channel page on which to attempt association.
Definition: lr-wpan-mac.h:568
Mac64Address m_coordExtAddr
The extended address of the coordinator with which to associate.
Definition: lr-wpan-mac.h:575
Mac16Address m_coordShortAddr
The short address of the coordinator with which to associate.
Definition: lr-wpan-mac.h:573
uint16_t m_coordPanId
The identifier of the PAN with which to associate.
Definition: lr-wpan-mac.h:571
MLME-ASSOCIATE.response params.
Definition: lr-wpan-mac.h:461
LrWpanAssociationStatus m_status
The status of the association attempt (As defined on Table 83 IEEE 802.15.4-2006)
Definition: lr-wpan-mac.h:465
Mac16Address m_assocShortAddr
The short address allocated by the coordinator on successful assoc.
Definition: lr-wpan-mac.h:463
Mac64Address m_extDevAddr
The extended address of the device requesting association.
Definition: lr-wpan-mac.h:462
MLME-COMM-STATUS.indication params.
Definition: lr-wpan-mac.h:637
MLME-START.confirm params.
Definition: lr-wpan-mac.h:681
MLME-SCAN.confirm params.
Definition: lr-wpan-mac.h:544
MLME-SCAN.request params.
Definition: lr-wpan-mac.h:525
uint32_t m_scanChannels
The channel numbers to be scanned.
Definition: lr-wpan-mac.h:528
uint32_t m_chPage
The channel page on which to perform scan.
Definition: lr-wpan-mac.h:535
uint8_t m_scanDuration
The factor (0-14) used to calculate the length of time to spend scanning.
Definition: lr-wpan-mac.h:531
LrWpanMlmeScanType m_scanType
Indicates the type of scan performed as described in IEEE 802.15.4-2011 (5.1.2.1).
Definition: lr-wpan-mac.h:526
MLME-START.request params.
Definition: lr-wpan-mac.h:475
uint8_t m_logCh
Logical channel on which to start using the new superframe configuration.
Definition: lr-wpan-mac.h:477
bool m_panCoor
On true this device will become coordinator.
Definition: lr-wpan-mac.h:486
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
Definition: lr-wpan-mac.h:483
uint16_t m_PanId
Pan Identifier used by the device.
Definition: lr-wpan-mac.h:476
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
Definition: lr-wpan-mac.h:485