A Discrete-Event Network Simulator
API
reduced-neighbor-report.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2021 Universita' degli Studi di Napoli Federico II
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 * Author: Stefano Avallone <stavallo@unina.it>
19 */
20
23#include "ns3/abort.h"
24#include "ns3/address-utils.h"
25#include <iterator>
26
27namespace ns3 {
28
30{
31}
32
35{
37}
38
39std::size_t
41{
42 return m_nbrApInfoFields.size ();
43}
44
45void
47{
49}
50
51void
54{
55 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
56
57 uint8_t operatingClass = 0;
58 uint8_t channelNumber = channel.GetNumber ();
59
60 // Information taken from Table E-4 of 802.11-2020
61 switch (channel.GetPhyBand ())
62 {
64 if (channel.GetWidth () == 20)
65 {
66 operatingClass = 81;
67 }
68 else if (channel.GetWidth () == 40)
69 {
70 operatingClass = 83;
71 }
72 break;
74 if (channel.GetWidth () == 20)
75 {
76 if (channelNumber == 36 || channelNumber == 40
77 || channelNumber == 44 || channelNumber == 48)
78 {
79 operatingClass = 115;
80 }
81 else if (channelNumber == 52 || channelNumber == 56
82 || channelNumber == 60 || channelNumber == 64)
83 {
84 operatingClass = 118;
85 }
86 else if (channelNumber == 100 || channelNumber == 104 || channelNumber == 108
87 || channelNumber == 112 || channelNumber == 116 || channelNumber == 120
88 || channelNumber == 124 || channelNumber == 128 || channelNumber == 132
89 || channelNumber == 136 || channelNumber == 140 || channelNumber == 144)
90 {
91 operatingClass = 121;
92 }
93 else if (channelNumber == 149 || channelNumber == 153 || channelNumber == 157
94 || channelNumber == 161 || channelNumber == 165 || channelNumber == 169
95 || channelNumber == 173 || channelNumber == 177 || channelNumber == 181)
96 {
97 operatingClass = 125;
98 }
99 }
100 else if (channel.GetWidth () == 40)
101 {
102 if (channelNumber == 38 || channelNumber == 46)
103 {
104 operatingClass = 116;
105 }
106 else if (channelNumber == 54 || channelNumber == 62)
107 {
108 operatingClass = 119;
109 }
110 else if (channelNumber == 102 || channelNumber == 110 || channelNumber == 118
111 || channelNumber == 126 || channelNumber == 134 || channelNumber == 142)
112 {
113 operatingClass = 122;
114 }
115 else if (channelNumber == 151 || channelNumber == 159
116 || channelNumber == 167 || channelNumber == 175)
117 {
118 operatingClass = 126;
119 }
120 }
121 else if (channel.GetWidth () == 80)
122 {
123 if (channelNumber == 42 || channelNumber == 58 || channelNumber == 106
124 || channelNumber == 122 || channelNumber == 138 || channelNumber == 155
125 || channelNumber == 171)
126 {
127 operatingClass = 128;
128 }
129 }
130 else if (channel.GetWidth () == 160)
131 {
132 if (channelNumber == 50 || channelNumber == 114 || channelNumber == 163)
133 {
134 operatingClass = 129;
135 }
136 }
137 break;
139 if (channel.GetWidth () == 20)
140 {
141 operatingClass = 131;
142 }
143 else if (channel.GetWidth () == 40)
144 {
145 operatingClass = 132;
146 }
147 else if (channel.GetWidth () == 80)
148 {
149 operatingClass = 133;
150 }
151 else if (channel.GetWidth () == 160)
152 {
153 operatingClass = 134;
154 }
155 break;
157 default:
158 NS_ABORT_MSG ("The provided channel has an unspecified PHY band");
159 break;
160 }
161
162 NS_ABORT_MSG_IF (operatingClass == 0, "Operating class not found for channel number "
163 << channelNumber << " width " << channel.GetWidth () << " MHz "
164 << "band " << channel.GetPhyBand ());
165
166 // find the primary channel number
167 uint16_t startingFreq = 0;
168
169 switch (channel.GetPhyBand ())
170 {
172 startingFreq = 2407;
173 break;
175 startingFreq = 5000;
176 break;
178 startingFreq = 5940;
179 break;
181 default:
182 NS_ABORT_MSG ("The provided channel has an unspecified PHY band");
183 break;
184 }
185
186 uint8_t primaryChannelNumber = (channel.GetPrimaryChannelCenterFrequency (20) - startingFreq) / 5;
187
188 m_nbrApInfoFields.at (nbrApInfoId).operatingClass = operatingClass;
189 m_nbrApInfoFields.at (nbrApInfoId).channelNumber = primaryChannelNumber;
190}
191
193ReducedNeighborReport::GetOperatingChannel (std::size_t nbrApInfoId) const
194{
195 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
196
198 uint16_t width = 0;
199
200 switch (m_nbrApInfoFields.at (nbrApInfoId).operatingClass)
201 {
202 case 81:
204 width = 20;
205 break;
206 case 83:
208 width = 40;
209 break;
210 case 115:
211 case 118:
212 case 121:
213 case 125:
214 band = WIFI_PHY_BAND_5GHZ;
215 width = 20;
216 break;
217 case 116:
218 case 119:
219 case 122:
220 case 126:
221 band = WIFI_PHY_BAND_5GHZ;
222 width = 40;
223 break;
224 case 128:
225 band = WIFI_PHY_BAND_5GHZ;
226 width = 80;
227 break;
228 case 129:
229 band = WIFI_PHY_BAND_5GHZ;
230 width = 160;
231 break;
232 case 131:
233 band = WIFI_PHY_BAND_6GHZ;
234 width = 20;
235 break;
236 case 132:
237 band = WIFI_PHY_BAND_6GHZ;
238 width = 40;
239 break;
240 case 133:
241 band = WIFI_PHY_BAND_6GHZ;
242 width = 80;
243 break;
244 case 134:
245 band = WIFI_PHY_BAND_6GHZ;
246 width = 160;
247 break;
248 default:
249 break;
250 }
251
252 NS_ABORT_IF (band == WIFI_PHY_BAND_UNSPECIFIED || width == 0);
253
254 uint16_t startingFreq = 0;
255
256 switch (band)
257 {
259 startingFreq = 2407;
260 break;
262 startingFreq = 5000;
263 break;
265 startingFreq = 5940;
266 break;
268 default:
269 NS_ABORT_MSG ("Unspecified band");
270 break;
271 }
272
273 uint8_t primaryChannelNumber = m_nbrApInfoFields.at (nbrApInfoId).channelNumber;
274 uint16_t primaryChannelCenterFrequency = startingFreq + primaryChannelNumber * 5;
275
276 uint8_t channelNumber = 0;
277 uint16_t frequency = 0;
278
280 {
281 if (std::get<2> (channel) == width
282 && std::get<3> (channel) == WIFI_PHY_OFDM_CHANNEL
283 && std::get<4> (channel) == band
284 && primaryChannelCenterFrequency > std::get<1> (channel) - width / 2
285 && primaryChannelCenterFrequency < std::get<1> (channel) + width / 2)
286 {
287 // the center frequency of the primary channel falls into the frequency
288 // range of this channel
289 bool found = false;
290
291 if (band != WIFI_PHY_BAND_2_4GHZ)
292 {
293 found = true;
294 }
295 else
296 {
297 // frequency channels overlap in the 2.4 GHz band, hence we have to check
298 // that the given primary channel center frequency can be the center frequency
299 // of the primary20 channel of the channel under consideration
300 switch (width)
301 {
302 case 20:
303 if (std::get<1> (channel) == primaryChannelCenterFrequency)
304 {
305 found = true;
306 }
307 break;
308 case 40:
309 if (std::get<1> (channel) == primaryChannelCenterFrequency + 10
310 || std::get<1> (channel) == primaryChannelCenterFrequency - 10)
311 {
312 found = true;
313 }
314 break;
315 default:
316 NS_ABORT_MSG ("No channel of width " << width << " MHz in the 2.4 GHz band");
317 }
318 }
319
320 if (found)
321 {
322 channelNumber = std::get<0> (channel);
323 frequency = std::get<1> (channel);
324 break;
325 }
326 }
327 }
328
329 NS_ABORT_IF (channelNumber == 0 || frequency == 0);
330
332 channel.Set (channelNumber, frequency, width, WIFI_STANDARD_UNSPECIFIED, band);
333
334 uint16_t channelLowestFreq = frequency - width / 2;
335 uint16_t primaryChannelLowestFreq = primaryChannelCenterFrequency - 10;
336 channel.SetPrimary20Index ((primaryChannelLowestFreq - channelLowestFreq) / 20);
337
338 return channel;
339}
340
341std::size_t
343{
344 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
345 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ();
346}
347
348void
350{
351 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
352 m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.push_back (TbttInformation ());
353}
354
355void
357{
358 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
359
360 uint8_t length = 0; // reserved value
361
362 auto it = std::next (m_nbrApInfoFields.begin (), nbrApInfoId);
363
364 if (it->hasBssid
365 && !it->hasShortSsid
366 && !it->hasBssParams
367 && !it->has20MHzPsd
368 && !it->hasMldParams)
369 {
370 length = 7;
371 }
372 else if (it->hasBssid
373 && it->hasShortSsid
374 && it->hasBssParams
375 && it->has20MHzPsd
376 && it->hasMldParams)
377 {
378 length = 16;
379 }
380 else
381 {
382 NS_ABORT_MSG ("Unsupported TBTT Information field contents");
383 }
384
385 // set the TBTT Information Length field
386 it->tbttInfoHdr.tbttInfoLength = length;
387}
388
389void
391{
392 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
393
394 auto it = std::next (m_nbrApInfoFields.begin (), nbrApInfoId);
395
396 switch (it->tbttInfoHdr.tbttInfoLength)
397 {
398 case 7:
399 it->hasBssid = true;
400 it->hasShortSsid = false;
401 it->hasBssParams = false;
402 it->has20MHzPsd = false;
403 it->hasMldParams = false;
404 break;
405 case 16:
406 it->hasBssid = true;
407 it->hasShortSsid = true;
408 it->hasBssParams = true;
409 it->has20MHzPsd = true;
410 it->hasMldParams = true;
411 break;
412 default:
413 NS_ABORT_MSG ("Unsupported TBTT Information Length value: "
414 << it->tbttInfoHdr.tbttInfoLength);
415 }
416}
417
418void
419ReducedNeighborReport::SetBssid (std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid)
420{
421 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
422 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
423
424 m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).bssid = bssid;
425
426 m_nbrApInfoFields.at (nbrApInfoId).hasBssid = true;
427}
428
429bool
430ReducedNeighborReport::HasBssid (std::size_t nbrApInfoId) const
431{
432 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
433
434 return m_nbrApInfoFields.at (nbrApInfoId).hasBssid;
435}
436
438ReducedNeighborReport::GetBssid (std::size_t nbrApInfoId, std::size_t index) const
439{
440 NS_ASSERT (HasBssid (nbrApInfoId));
441 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
442
443 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).bssid;
444}
445
446void
447ReducedNeighborReport::SetShortSsid (std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid)
448{
449 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
450 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
451
452 m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).shortSsid = shortSsid;
453
454 m_nbrApInfoFields.at (nbrApInfoId).hasShortSsid = true;
455}
456
457bool
458ReducedNeighborReport::HasShortSsid (std::size_t nbrApInfoId) const
459{
460 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
461
462 return m_nbrApInfoFields.at (nbrApInfoId).hasShortSsid;
463}
464
466ReducedNeighborReport::GetShortSsid (std::size_t nbrApInfoId, std::size_t index) const
467{
468 NS_ASSERT (HasShortSsid (nbrApInfoId));
469 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
470
471 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).shortSsid;
472}
473
474void
475ReducedNeighborReport::SetBssParameters (std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters)
476{
477 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
478 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
479
480 m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).bssParameters = bssParameters;
481
482 m_nbrApInfoFields.at (nbrApInfoId).hasBssParams = true;
483}
484
485bool
486ReducedNeighborReport::HasBssParameters (std::size_t nbrApInfoId) const
487{
488 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
489
490 return m_nbrApInfoFields.at (nbrApInfoId).hasBssParams;
491}
492
493uint8_t
494ReducedNeighborReport::GetBssParameters (std::size_t nbrApInfoId, std::size_t index) const
495{
496 NS_ASSERT (HasBssParameters (nbrApInfoId));
497 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
498
499 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).bssParameters;
500}
501
502void
503ReducedNeighborReport::SetPsd20MHz (std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz)
504{
505 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
506 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
507
508 m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).psd20MHz = psd20MHz;
509
510 m_nbrApInfoFields.at (nbrApInfoId).has20MHzPsd = true;
511}
512
513bool
514ReducedNeighborReport::HasPsd20MHz (std::size_t nbrApInfoId) const
515{
516 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
517
518 return m_nbrApInfoFields.at (nbrApInfoId).has20MHzPsd;
519}
520
521uint8_t
522ReducedNeighborReport::GetPsd20MHz (std::size_t nbrApInfoId, std::size_t index) const
523{
524 NS_ASSERT (HasPsd20MHz (nbrApInfoId));
525 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
526
527 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).psd20MHz;
528}
529
530void
531ReducedNeighborReport::SetMldParameters (std::size_t nbrApInfoId, std::size_t index,
532 uint8_t mldId, uint8_t linkId, uint8_t changeCount)
533{
534 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
535 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
536
537 auto it = std::next (m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.begin (), index);
538 it->mldParameters.mldId = mldId;
539 it->mldParameters.linkId = (linkId & 0x0f);
540 it->mldParameters.bssParamsChangeCount = changeCount;
541
542 m_nbrApInfoFields.at (nbrApInfoId).hasMldParams = true;
543}
544
545bool
546ReducedNeighborReport::HasMldParameters (std::size_t nbrApInfoId) const
547{
548 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
549
550 return m_nbrApInfoFields.at (nbrApInfoId).hasMldParams;
551}
552
553uint8_t
554ReducedNeighborReport::GetMldId (std::size_t nbrApInfoId, std::size_t index) const
555{
556 NS_ASSERT (HasMldParameters (nbrApInfoId));
557 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
558
559 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).mldParameters.mldId;
560}
561
562uint8_t
563ReducedNeighborReport::GetLinkId (std::size_t nbrApInfoId, std::size_t index) const
564{
565 NS_ASSERT (HasMldParameters (nbrApInfoId));
566 NS_ASSERT (index < m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size ());
567
568 return m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.at (index).mldParameters.linkId & 0x0f;
569}
570
571void
573{
574 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
575 NS_ASSERT (!m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.empty ());
576
577 // set the TBTT Information Count field
578 m_nbrApInfoFields.at (nbrApInfoId).tbttInfoHdr.tbttInfoCount = m_nbrApInfoFields.at (nbrApInfoId).tbttInformationSet.size () - 1;
579}
580
581uint8_t
583{
584 NS_ASSERT (nbrApInfoId < m_nbrApInfoFields.size ());
585
586 return 1 + m_nbrApInfoFields.at (nbrApInfoId).tbttInfoHdr.tbttInfoCount;
587}
588
589uint16_t
591{
592 uint16_t size = 0;
593
594 for (const auto& neighborApInfo : m_nbrApInfoFields)
595 {
596 size += 4;
597
598 size += 1 * neighborApInfo.tbttInformationSet.size ();
599
600 if (neighborApInfo.hasBssid)
601 {
602 size += 6 * neighborApInfo.tbttInformationSet.size ();
603 }
604 if (neighborApInfo.hasShortSsid)
605 {
606 size += 4 * neighborApInfo.tbttInformationSet.size ();
607 }
608 if (neighborApInfo.hasBssParams)
609 {
610 size += 1 * neighborApInfo.tbttInformationSet.size ();
611 }
612 if (neighborApInfo.has20MHzPsd)
613 {
614 size += 1 * neighborApInfo.tbttInformationSet.size ();
615 }
616 if (neighborApInfo.hasMldParams)
617 {
618 size += 3 * neighborApInfo.tbttInformationSet.size ();
619 }
620 }
621
622 return size;
623}
624
625void
627{
628 for (std::size_t id = 0; id < m_nbrApInfoFields.size (); ++ id)
629 {
632 }
633
634 for (auto& neighborApInfo : m_nbrApInfoFields)
635 {
636 // serialize the TBTT Information Header
637 uint16_t tbttInfoHdr = 0;
638 tbttInfoHdr |= neighborApInfo.tbttInfoHdr.type;
639 tbttInfoHdr |= (neighborApInfo.tbttInfoHdr.filtered << 2);
640 tbttInfoHdr |= (neighborApInfo.tbttInfoHdr.tbttInfoCount << 4);
641 tbttInfoHdr |= (neighborApInfo.tbttInfoHdr.tbttInfoLength << 8);
642 start.WriteHtolsbU16 (tbttInfoHdr);
643
644 start.WriteU8 (neighborApInfo.operatingClass);
645 start.WriteU8 (neighborApInfo.channelNumber);
646
647 for (const auto& tbttInformation : neighborApInfo.tbttInformationSet)
648 {
649 start.WriteU8 (tbttInformation.neighborApTbttOffset);
650
651 if (neighborApInfo.hasBssid)
652 {
653 WriteTo (start, tbttInformation.bssid);
654 }
655 if (neighborApInfo.hasShortSsid)
656 {
657 start.WriteHtolsbU32 (tbttInformation.shortSsid);
658 }
659 if (neighborApInfo.hasBssParams)
660 {
661 start.WriteU8 (tbttInformation.bssParameters);
662 }
663 if (neighborApInfo.has20MHzPsd)
664 {
665 start.WriteU8 (tbttInformation.psd20MHz);
666 }
667 if (neighborApInfo.hasMldParams)
668 {
669 start.WriteU8 (tbttInformation.mldParameters.mldId);
670 uint16_t other = 0;
671 other |= (tbttInformation.mldParameters.linkId & 0x0f);
672 other |= (tbttInformation.mldParameters.bssParamsChangeCount << 4);
673 start.WriteHtolsbU16 (other);
674 }
675 }
676 }
677}
678
679uint16_t
681{
683 uint16_t count = 0;
684
685 while (count < length)
686 {
688
689 auto tbttInfoHdr = i.ReadLsbtohU16 ();
690 m_nbrApInfoFields.back ().tbttInfoHdr.type = tbttInfoHdr & 0x0003;
691 m_nbrApInfoFields.back ().tbttInfoHdr.filtered = (tbttInfoHdr >> 2) & 0x0001;
692 m_nbrApInfoFields.back ().tbttInfoHdr.tbttInfoCount = (tbttInfoHdr >> 4) & 0x000f;
693 m_nbrApInfoFields.back ().tbttInfoHdr.tbttInfoLength = (tbttInfoHdr >> 8) & 0x00ff;
694
695 m_nbrApInfoFields.back ().operatingClass = i.ReadU8 ();
696 m_nbrApInfoFields.back ().channelNumber = i.ReadU8 ();
697 count += 4;
698
699 std::size_t neighborId = m_nbrApInfoFields.size () - 1;
700 ReadTbttInformationLength (neighborId);
701
702 for (uint8_t j = 0; j < ReadTbttInformationCount (neighborId); j++)
703 {
704 AddTbttInformationField (neighborId);
705
706 m_nbrApInfoFields.back ().tbttInformationSet.back ().neighborApTbttOffset = i.ReadU8 ();
707 count++;
708
709 if (m_nbrApInfoFields.back ().hasBssid)
710 {
711 ReadFrom (i, m_nbrApInfoFields.back ().tbttInformationSet.back ().bssid);
712 count += 6;
713 }
714 if (m_nbrApInfoFields.back ().hasShortSsid)
715 {
716 m_nbrApInfoFields.back ().tbttInformationSet.back ().shortSsid = i.ReadLsbtohU32 ();
717 count += 4;
718 }
719 if (m_nbrApInfoFields.back ().hasBssParams)
720 {
721 m_nbrApInfoFields.back ().tbttInformationSet.back ().bssParameters = i.ReadU8 ();
722 count += 1;
723 }
724 if (m_nbrApInfoFields.back ().has20MHzPsd)
725 {
726 m_nbrApInfoFields.back ().tbttInformationSet.back ().psd20MHz = i.ReadU8 ();
727 count += 1;
728 }
729 if (m_nbrApInfoFields.back ().hasMldParams)
730 {
731 m_nbrApInfoFields.back ().tbttInformationSet.back ().mldParameters.mldId = i.ReadU8 ();
732 uint16_t other = i.ReadLsbtohU16 ();
733 count += 3;
734 m_nbrApInfoFields.back ().tbttInformationSet.back ().mldParameters.linkId = other & 0x000f;
735 m_nbrApInfoFields.back ().tbttInformationSet.back ().mldParameters.bssParamsChangeCount = (other >> 4) & 0x00ff;
736 }
737 }
738 }
739
740 return count;
741}
742
743} //namespace ns3
iterator in a Buffer instance
Definition: buffer.h:99
uint32_t ReadLsbtohU32(void)
Definition: buffer.cc:1077
uint8_t ReadU8(void)
Definition: buffer.h:1021
uint16_t ReadLsbtohU16(void)
Definition: buffer.cc:1066
an EUI-48 address
Definition: mac48-address.h:44
void WriteTbttInformationLength(std::size_t nbrApInfoId) const
Set the TBTT Information Length field of the given Neighbor AP Information field based on the xxxPres...
Mac48Address GetBssid(std::size_t nbrApInfoId, std::size_t index) const
Get the BSSID field (must be present) in the i-th TBTT Information field of the given Neighbor AP Inf...
std::vector< NeighborApInformation > m_nbrApInfoFields
one or more Neighbor AP Information fields
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
bool HasShortSsid(std::size_t nbrApInfoId) const
Return true if the Short SSID field is present in all the TBTT Information fields of the given Neighb...
void WriteTbttInformationCount(std::size_t nbrApInfoId) const
Set the TBTT Information Count field of the given Neighbor AP Information field based on the size of ...
bool HasBssid(std::size_t nbrApInfoId) const
Return true if the BSSID field is present in all the TBTT Information fields of the given Neighbor AP...
uint8_t ReadTbttInformationCount(std::size_t nbrApInfoId) const
Get the TBTT Information Count field of the given Neighbor AP Information field.
void SetMldParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t mldId, uint8_t linkId, uint8_t changeSequence)
Set the MLD Parameters subfield of the i-th TBTT Information field of the given Neighbor AP Informati...
void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid)
Set the Short SSID field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
uint32_t GetShortSsid(std::size_t nbrApInfoId, std::size_t index) const
Get the Short SSID field (must be present) in the i-th TBTT Information field of the given Neighbor A...
void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid)
Set the BSSID field of the i-th TBTT Information field of the given Neighbor AP Information field.
std::size_t GetNNbrApInfoFields(void) const
Get the number of Neighbor AP Information fields.
void AddNbrApInfoField(void)
Add a Neighbor AP Information field.
std::size_t GetNTbttInformationFields(std::size_t nbrApInfoId) const
Get the number of TBTT Information fields included in the TBTT Information Set field of the given Nei...
uint8_t GetLinkId(std::size_t nbrApInfoId, std::size_t index) const
Get the Link ID value in the MLD Parameters subfield (must be present) in the i-th TBTT Information f...
uint8_t GetMldId(std::size_t nbrApInfoId, std::size_t index) const
Get the MLD ID value in the MLD Parameters subfield (must be present) in the i-th TBTT Information fi...
void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz)
Set the 20 MHz PSD field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
WifiPhyOperatingChannel GetOperatingChannel(std::size_t nbrApInfoId) const
Get the operating channel coded into the Operating Class and the Channel Number fields of the given N...
void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters)
Set the BSS Parameters field of the i-th TBTT Information field of the given Neighbor AP Information ...
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
uint8_t GetPsd20MHz(std::size_t nbrApInfoId, std::size_t index) const
Get the 20 MHz PSD field (must be present) in the i-th TBTT Information field of the given Neighbor A...
bool HasMldParameters(std::size_t nbrApInfoId) const
Return true if the MLD Parameters subfield is present in all the TBTT Information fields of the given...
void AddTbttInformationField(std::size_t nbrApInfoId)
Add a TBTT Information fields to the TBTT Information Set field of the given Neighbor AP Information ...
void ReadTbttInformationLength(std::size_t nbrApInfoId)
Use the TBTT Information Length field of the given Neighbor AP Information field to set the xxxPresen...
bool HasBssParameters(std::size_t nbrApInfoId) const
Return true if the BSS Parameters field is present in all the TBTT Information fields of the given Ne...
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel &channel)
Set the Operating Class and the Channel Number fields of the given Neighbor AP Information field base...
bool HasPsd20MHz(std::size_t nbrApInfoId) const
Return true if the 20 MHz PSD field is present in all the TBTT Information fields of the given Neighb...
uint8_t GetBssParameters(std::size_t nbrApInfoId, std::size_t index) const
Get the BSS Parameters field (must be present) in the i-th TBTT Information field of the given Neighb...
Class that keeps track of all information about the current PHY operating channel.
static const std::set< FrequencyChannelInfo > m_frequencyChannels
Available frequency channels.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:50
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
@ WIFI_STANDARD_UNSPECIFIED
@ WIFI_PHY_OFDM_CHANNEL
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
Definition: wifi-phy-band.h:39
@ WIFI_PHY_BAND_UNSPECIFIED
Unspecified.
Definition: wifi-phy-band.h:43
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
Definition: wifi-phy-band.h:35
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
channel
Definition: third.py:83
def start()
Definition: core.py:1852
#define IE_REDUCED_NEIGHBOR_REPORT