A Discrete-Event Network Simulator
API
mgt-headers.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 * Mirko Banchi <mk.banchi@gmail.com>
20 */
21
22#include "mgt-headers.h"
23
24#include "ns3/address-utils.h"
25#include "ns3/simulator.h"
26
27namespace ns3
28{
29
30/***********************************************************
31 * Probe Request
32 ***********************************************************/
33
34NS_OBJECT_ENSURE_REGISTERED(MgtProbeRequestHeader);
35
37{
38}
39
40void
42{
43 m_ssid = ssid;
44}
45
46void
48{
49 m_ssid = std::move(ssid);
50}
51
52const Ssid&
54{
55 return m_ssid;
56}
57
58void
60{
61 m_rates = rates;
62}
63
64void
66{
67 m_rates = std::move(rates);
68}
69
70void
72{
73 m_extendedCapability = extendedCapabilities;
74}
75
76void
78{
79 m_extendedCapability = std::move(extendedCapabilities);
80}
81
82const std::optional<ExtendedCapabilities>&
84{
86}
87
88void
90{
91 m_htCapability = htCapabilities;
92}
93
94void
96{
97 m_htCapability = std::move(htCapabilities);
98}
99
100const std::optional<HtCapabilities>&
102{
103 return m_htCapability;
104}
105
106void
108{
109 m_vhtCapability = vhtCapabilities;
110}
111
112void
114{
115 m_vhtCapability = std::move(vhtCapabilities);
116}
117
118const std::optional<VhtCapabilities>&
120{
121 return m_vhtCapability;
122}
123
124void
126{
127 m_heCapability = heCapabilities;
128}
129
130void
132{
133 m_heCapability = std::move(heCapabilities);
134}
135
136const std::optional<HeCapabilities>&
138{
139 return m_heCapability;
140}
141
142void
144{
145 m_ehtCapability = ehtCapabilities;
146}
147
148void
150{
151 m_ehtCapability = std::move(ehtCapabilities);
152}
153
154const std::optional<EhtCapabilities>&
156{
157 return m_ehtCapability;
158}
159
160const SupportedRates&
162{
163 return m_rates;
164}
165
168{
169 uint32_t size = 0;
170 size += m_ssid.GetSerializedSize();
171 size += m_rates.GetSerializedSize();
172 if (m_rates.GetNRates() > 8)
173 {
174 size += m_rates.extended->GetSerializedSize();
175 }
176 if (m_extendedCapability.has_value())
177 {
178 size += m_extendedCapability->GetSerializedSize();
179 }
180 if (m_htCapability.has_value())
181 {
182 size += m_htCapability->GetSerializedSize();
183 }
184 if (m_vhtCapability.has_value())
185 {
186 size += m_vhtCapability->GetSerializedSize();
187 }
188 if (m_heCapability.has_value())
189 {
190 size += m_heCapability->GetSerializedSize();
191 }
192 if (m_ehtCapability.has_value())
193 {
194 size += m_ehtCapability->GetSerializedSize();
195 }
196 return size;
197}
198
199TypeId
201{
202 static TypeId tid = TypeId("ns3::MgtProbeRequestHeader")
203 .SetParent<Header>()
204 .SetGroupName("Wifi")
205 .AddConstructor<MgtProbeRequestHeader>();
206 return tid;
207}
208
209TypeId
211{
212 return GetTypeId();
213}
214
215void
216MgtProbeRequestHeader::Print(std::ostream& os) const
217{
218 os << "ssid=" << m_ssid << ", "
219 << "rates=" << m_rates << ", ";
220 if (m_extendedCapability.has_value())
221 {
222 os << "Extended Capabilities=" << *m_extendedCapability << " , ";
223 }
224 if (m_htCapability.has_value())
225 {
226 os << "HT Capabilities=" << *m_htCapability << " , ";
227 }
228 if (m_vhtCapability.has_value())
229 {
230 os << "VHT Capabilities=" << *m_vhtCapability << " , ";
231 }
232 if (m_heCapability.has_value())
233 {
234 os << "HE Capabilities=" << *m_heCapability << " , ";
235 }
236 if (m_ehtCapability.has_value())
237 {
238 os << "EHT Capabilities=" << *m_ehtCapability;
239 }
240}
241
242void
244{
246 i = m_ssid.Serialize(i);
247 i = m_rates.Serialize(i);
248 if (m_rates.GetNRates() > 8)
249 {
250 i = m_rates.extended->Serialize(i);
251 }
252 if (m_extendedCapability.has_value())
253 {
254 i = m_extendedCapability->Serialize(i);
255 }
256 if (m_htCapability.has_value())
257 {
258 i = m_htCapability->Serialize(i);
259 }
260 if (m_vhtCapability.has_value())
261 {
262 i = m_vhtCapability->Serialize(i);
263 }
264 if (m_heCapability.has_value())
265 {
266 i = m_heCapability->Serialize(i);
267 }
268 if (m_ehtCapability.has_value())
269 {
270 i = m_ehtCapability->Serialize(i);
271 }
272}
273
276{
278 i = m_ssid.Deserialize(i);
279 i = m_rates.Deserialize(i);
285 const bool is2_4Ghz = m_rates.IsSupportedRate(
286 1000000 /* 1 Mbit/s */); // TODO: use presence of VHT capabilities IE and HE 6 GHz Band
287 // Capabilities IE once the later is implemented
289 return i.GetDistanceFrom(start);
290}
291
292/***********************************************************
293 * Probe Response
294 ***********************************************************/
295
297
299{
300}
301
303{
304}
305
306uint64_t
308{
309 return m_timestamp;
310}
311
312const Ssid&
314{
315 return m_ssid;
316}
317
318uint64_t
320{
321 return m_beaconInterval;
322}
323
324const SupportedRates&
326{
327 return m_rates;
328}
329
330void
332{
333 m_capability = capabilities;
334}
335
336void
338{
339 m_capability = std::move(capabilities);
340}
341
344{
345 return m_capability;
346}
347
348void
350{
351 m_extendedCapability = extendedCapabilities;
352}
353
354void
356{
357 m_extendedCapability = std::move(extendedCapabilities);
358}
359
360const std::optional<ExtendedCapabilities>&
362{
364}
365
366void
368{
369 m_htCapability = htCapabilities;
370}
371
372void
374{
375 m_htCapability = std::move(htCapabilities);
376}
377
378const std::optional<HtCapabilities>&
380{
381 return m_htCapability;
382}
383
384void
386{
387 m_htOperation = htOperation;
388}
389
390void
392{
393 m_htOperation = std::move(htOperation);
394}
395
396const std::optional<HtOperation>&
398{
399 return m_htOperation;
400}
401
402void
404{
405 m_vhtCapability = vhtCapabilities;
406}
407
408void
410{
411 m_vhtCapability = std::move(vhtCapabilities);
412}
413
414const std::optional<VhtCapabilities>&
416{
417 return m_vhtCapability;
418}
419
420void
422{
423 m_vhtOperation = vhtOperation;
424}
425
426void
428{
429 m_vhtOperation = std::move(vhtOperation);
430}
431
432const std::optional<VhtOperation>&
434{
435 return m_vhtOperation;
436}
437
438void
440{
441 m_heCapability = heCapabilities;
442}
443
444void
446{
447 m_heCapability = std::move(heCapabilities);
448}
449
450const std::optional<HeCapabilities>&
452{
453 return m_heCapability;
454}
455
456void
458{
459 m_heOperation = heOperation;
460}
461
462void
464{
465 m_heOperation = std::move(heOperation);
466}
467
468const std::optional<HeOperation>&
470{
471 return m_heOperation;
472}
473
474void
476{
477 m_ehtCapability = ehtCapabilities;
478}
479
480void
482{
483 m_ehtCapability = std::move(ehtCapabilities);
484}
485
486const std::optional<EhtCapabilities>&
488{
489 return m_ehtCapability;
490}
491
492void
494{
495 m_ehtOperation = ehtOperation;
496}
497
498void
500{
501 m_ehtOperation = std::move(ehtOperation);
502}
503
504const std::optional<EhtOperation>&
506{
507 return m_ehtOperation;
508}
509
510void
512{
513 m_ssid = ssid;
514}
515
516void
518{
519 m_ssid = std::move(ssid);
520}
521
522void
524{
525 m_beaconInterval = us;
526}
527
528void
530{
531 m_rates = rates;
532}
533
534void
536{
537 m_rates = std::move(rates);
538}
539
540void
542{
543 m_dsssParameterSet = dsssParameterSet;
544}
545
546void
548{
549 m_dsssParameterSet = std::move(dsssParameterSet);
550}
551
552const std::optional<DsssParameterSet>&
554{
555 return m_dsssParameterSet;
556}
557
558void
560{
561 m_erpInformation = erpInformation;
562}
563
564void
566{
567 m_erpInformation = std::move(erpInformation);
568}
569
570const std::optional<ErpInformation>&
572{
573 return m_erpInformation;
574}
575
576void
578{
579 m_edcaParameterSet = edcaParameters;
580}
581
582void
584{
585 m_edcaParameterSet = std::move(edcaParameters);
586}
587
588void
590{
591 m_muEdcaParameterSet = muEdcaParameters;
592}
593
594void
596{
597 m_muEdcaParameterSet = std::move(muEdcaParameters);
598}
599
600void
602{
603 m_reducedNeighborReport = reducedNeighborReport;
604}
605
606void
608{
609 m_reducedNeighborReport = std::move(reducedNeighborReport);
610}
611
612void
614{
615 m_multiLinkElement = multiLinkElement;
616}
617
618void
620{
621 m_multiLinkElement = std::move(multiLinkElement);
622}
623
624const std::optional<EdcaParameterSet>&
626{
627 return m_edcaParameterSet;
628}
629
630const std::optional<MuEdcaParameterSet>&
632{
634}
635
636const std::optional<ReducedNeighborReport>&
638{
640}
641
642const std::optional<MultiLinkElement>&
644{
645 return m_multiLinkElement;
646}
647
648TypeId
650{
651 static TypeId tid = TypeId("ns3::MgtProbeResponseHeader")
652 .SetParent<Header>()
653 .SetGroupName("Wifi")
654 .AddConstructor<MgtProbeResponseHeader>();
655 return tid;
656}
657
658TypeId
660{
661 return GetTypeId();
662}
663
666{
667 uint32_t size = 0;
668 size += 8; // timestamp
669 size += 2; // beacon interval
671 size += m_ssid.GetSerializedSize();
672 size += m_rates.GetSerializedSize();
673 if (m_dsssParameterSet.has_value())
674 {
675 size += m_dsssParameterSet->GetSerializedSize();
676 }
677 if (m_erpInformation.has_value())
678 {
679 size += m_erpInformation->GetSerializedSize();
680 }
681 if (m_rates.GetNRates() > 8)
682 {
683 size += m_rates.extended->GetSerializedSize();
684 }
685 if (m_edcaParameterSet.has_value())
686 {
687 size += m_edcaParameterSet->GetSerializedSize();
688 }
689 if (m_extendedCapability.has_value())
690 {
691 size += m_extendedCapability->GetSerializedSize();
692 }
693 if (m_htCapability.has_value())
694 {
695 size += m_htCapability->GetSerializedSize();
696 }
697 if (m_htOperation.has_value())
698 {
699 size += m_htOperation->GetSerializedSize();
700 }
701 if (m_vhtCapability.has_value())
702 {
703 size += m_vhtCapability->GetSerializedSize();
704 }
705 if (m_vhtOperation.has_value())
706 {
707 size += m_vhtOperation->GetSerializedSize();
708 }
709 if (m_reducedNeighborReport.has_value())
710 {
711 size += m_reducedNeighborReport->GetSerializedSize();
712 }
713 if (m_heCapability.has_value())
714 {
715 size += m_heCapability->GetSerializedSize();
716 }
717 if (m_heOperation.has_value())
718 {
719 size += m_heOperation->GetSerializedSize();
720 }
721 if (m_muEdcaParameterSet.has_value())
722 {
723 size += m_muEdcaParameterSet->GetSerializedSize();
724 }
725 if (m_multiLinkElement.has_value())
726 {
727 size += m_multiLinkElement->GetSerializedSize();
728 }
729 if (m_ehtCapability.has_value())
730 {
731 size += m_ehtCapability->GetSerializedSize();
732 }
733 if (m_ehtOperation.has_value())
734 {
735 size += m_ehtOperation->GetSerializedSize();
736 }
737 return size;
738}
739
740void
741MgtProbeResponseHeader::Print(std::ostream& os) const
742{
743 os << "ssid=" << m_ssid << ", "
744 << "rates=" << m_rates << ", ";
745 if (m_erpInformation.has_value())
746 {
747 os << "ERP information=" << *m_erpInformation << ", ";
748 }
749 if (m_extendedCapability.has_value())
750 {
751 os << "Extended Capabilities=" << *m_extendedCapability << " , ";
752 }
753 if (m_htCapability.has_value())
754 {
755 os << "HT Capabilities=" << *m_htCapability << " , ";
756 }
757 if (m_htOperation.has_value())
758 {
759 os << "HT Operation=" << *m_htOperation << " , ";
760 }
761 if (m_vhtCapability.has_value())
762 {
763 os << "VHT Capabilities=" << *m_vhtCapability << " , ";
764 }
765 if (m_vhtOperation.has_value())
766 {
767 os << "VHT Operation=" << *m_vhtOperation << " , ";
768 }
769 if (m_heCapability.has_value())
770 {
771 os << "HE Capabilities=" << *m_heCapability << " , ";
772 }
773 if (m_heOperation.has_value())
774 {
775 os << "HE Operation=" << *m_heOperation << " , ";
776 }
777 if (m_ehtCapability.has_value())
778 {
779 os << "EHT Capabilities=" << *m_ehtCapability;
780 }
781 if (m_ehtOperation.has_value())
782 {
783 os << "EHT Operation=" << *m_ehtOperation;
784 }
785}
786
787void
789{
791 i.WriteHtolsbU64(Simulator::Now().GetMicroSeconds());
792 i.WriteHtolsbU16(static_cast<uint16_t>(m_beaconInterval / 1024));
793 i = m_capability.Serialize(i);
794 i = m_ssid.Serialize(i);
795 i = m_rates.Serialize(i);
796 if (m_dsssParameterSet.has_value())
797 {
798 i = m_dsssParameterSet->Serialize(i);
799 }
800 if (m_erpInformation.has_value())
801 {
802 i = m_erpInformation->Serialize(i);
803 }
804 if (m_rates.GetNRates() > 8)
805 {
806 i = m_rates.extended->Serialize(i);
807 }
808 if (m_edcaParameterSet.has_value())
809 {
810 i = m_edcaParameterSet->Serialize(i);
811 }
812 if (m_extendedCapability.has_value())
813 {
814 i = m_extendedCapability->Serialize(i);
815 }
816 if (m_htCapability.has_value())
817 {
818 i = m_htCapability->Serialize(i);
819 }
820 if (m_htOperation.has_value())
821 {
822 i = m_htOperation->Serialize(i);
823 }
824 if (m_vhtCapability.has_value())
825 {
826 i = m_vhtCapability->Serialize(i);
827 }
828 if (m_vhtOperation.has_value())
829 {
830 i = m_vhtOperation->Serialize(i);
831 }
832 if (m_reducedNeighborReport.has_value())
833 {
834 i = m_reducedNeighborReport->Serialize(i);
835 }
836 if (m_heCapability.has_value())
837 {
838 i = m_heCapability->Serialize(i);
839 }
840 if (m_heOperation.has_value())
841 {
842 i = m_heOperation->Serialize(i);
843 }
844 if (m_muEdcaParameterSet.has_value())
845 {
846 i = m_muEdcaParameterSet->Serialize(i);
847 }
848 if (m_multiLinkElement.has_value())
849 {
850 i = m_multiLinkElement->Serialize(i);
851 }
852 if (m_ehtCapability.has_value())
853 {
854 i = m_ehtCapability->Serialize(i);
855 }
856 if (m_ehtOperation.has_value())
857 {
858 i = m_ehtOperation->Serialize(i);
859 }
860}
861
864{
869 m_beaconInterval *= 1024;
871 i = m_ssid.Deserialize(i);
872 i = m_rates.Deserialize(i);
887 const bool is2_4Ghz = m_rates.IsSupportedRate(
888 1000000 /* 1 Mbit/s */); // TODO: use presence of VHT capabilities IE and HE 6 GHz Band
889 // Capabilities IE once the later is implemented
892
893 return i.GetDistanceFrom(start);
894}
895
896/***********************************************************
897 * Beacons
898 ***********************************************************/
899
901
902/* static */
903TypeId
905{
906 static TypeId tid = TypeId("ns3::MgtBeaconHeader")
908 .SetGroupName("Wifi")
909 .AddConstructor<MgtBeaconHeader>();
910 return tid;
911}
912
913/***********************************************************
914 * Assoc Request
915 ***********************************************************/
916
918
920 : m_listenInterval(0)
921{
922}
923
925{
926}
927
928void
930{
931 m_ssid = ssid;
932}
933
934void
936{
937 m_ssid = std::move(ssid);
938}
939
940void
942{
943 m_rates = rates;
944}
945
946void
948{
949 m_rates = std::move(rates);
950}
951
952void
954{
955 m_listenInterval = interval;
956}
957
958void
960{
961 m_capability = capabilities;
962}
963
964void
966{
967 m_capability = std::move(capabilities);
968}
969
972{
973 return m_capability;
974}
975
976void
978{
979 m_extendedCapability = extendedCapabilities;
980}
981
982void
984{
985 m_extendedCapability = std::move(extendedCapabilities);
986}
987
988const std::optional<ExtendedCapabilities>&
990{
992}
993
994void
996{
997 m_htCapability = htCapabilities;
998}
999
1000void
1002{
1003 m_htCapability = std::move(htCapabilities);
1004}
1005
1006const std::optional<HtCapabilities>&
1008{
1009 return m_htCapability;
1010}
1011
1012void
1014{
1015 m_vhtCapability = vhtCapabilities;
1016}
1017
1018void
1020{
1021 m_vhtCapability = std::move(vhtCapabilities);
1022}
1023
1024const std::optional<VhtCapabilities>&
1026{
1027 return m_vhtCapability;
1028}
1029
1030void
1032{
1033 m_heCapability = heCapabilities;
1034}
1035
1036void
1038{
1039 m_heCapability = std::move(heCapabilities);
1040}
1041
1042const std::optional<HeCapabilities>&
1044{
1045 return m_heCapability;
1046}
1047
1048void
1050{
1051 m_ehtCapability = ehtCapabilities;
1052}
1053
1054void
1056{
1057 m_ehtCapability = std::move(ehtCapabilities);
1058}
1059
1060const std::optional<EhtCapabilities>&
1062{
1063 return m_ehtCapability;
1064}
1065
1066void
1068{
1069 m_multiLinkElement = multiLinkElement;
1070}
1071
1072void
1074{
1075 m_multiLinkElement = std::move(multiLinkElement);
1076}
1077
1078const std::optional<MultiLinkElement>&
1080{
1081 return m_multiLinkElement;
1082}
1083
1084const Ssid&
1086{
1087 return m_ssid;
1088}
1089
1090const SupportedRates&
1092{
1093 return m_rates;
1094}
1095
1096uint16_t
1098{
1099 return m_listenInterval;
1100}
1101
1102TypeId
1104{
1105 static TypeId tid = TypeId("ns3::MgtAssocRequestHeader")
1106 .SetParent<Header>()
1107 .SetGroupName("Wifi")
1108 .AddConstructor<MgtAssocRequestHeader>();
1109 return tid;
1110}
1111
1112TypeId
1114{
1115 return GetTypeId();
1116}
1117
1120{
1121 uint32_t size = 0;
1123 size += 2;
1124 size += m_ssid.GetSerializedSize();
1125 size += m_rates.GetSerializedSize();
1126 if (m_rates.GetNRates() > 8)
1127 {
1128 size += m_rates.extended->GetSerializedSize();
1129 }
1130 if (m_extendedCapability.has_value())
1131 {
1132 size += m_extendedCapability->GetSerializedSize();
1133 }
1134 if (m_htCapability.has_value())
1135 {
1136 size += m_htCapability->GetSerializedSize();
1137 }
1138 if (m_vhtCapability.has_value())
1139 {
1140 size += m_vhtCapability->GetSerializedSize();
1141 }
1142 if (m_heCapability.has_value())
1143 {
1144 size += m_heCapability->GetSerializedSize();
1145 }
1146 if (m_multiLinkElement.has_value())
1147 {
1148 size += m_multiLinkElement->GetSerializedSize();
1149 }
1150 if (m_ehtCapability.has_value())
1151 {
1152 size += m_ehtCapability->GetSerializedSize();
1153 }
1154 return size;
1155}
1156
1157void
1158MgtAssocRequestHeader::Print(std::ostream& os) const
1159{
1160 os << "ssid=" << m_ssid << ", "
1161 << "rates=" << m_rates << ", ";
1162 if (m_extendedCapability.has_value())
1163 {
1164 os << "Extended Capabilities=" << *m_extendedCapability << " , ";
1165 }
1166 if (m_htCapability.has_value())
1167 {
1168 os << "HT Capabilities=" << *m_htCapability << " , ";
1169 }
1170 if (m_vhtCapability.has_value())
1171 {
1172 os << "VHT Capabilities=" << *m_vhtCapability << " , ";
1173 }
1174 if (m_heCapability.has_value())
1175 {
1176 os << "HE Capabilities=" << *m_heCapability << " , ";
1177 }
1178 if (m_ehtCapability.has_value())
1179 {
1180 os << "EHT Capabilities=" << *m_ehtCapability;
1181 }
1182}
1183
1184void
1186{
1188 i = m_capability.Serialize(i);
1190 i = m_ssid.Serialize(i);
1191 i = m_rates.Serialize(i);
1192 if (m_rates.GetNRates() > 8)
1193 {
1194 i = m_rates.extended->Serialize(i);
1195 }
1196 if (m_extendedCapability.has_value())
1197 {
1198 i = m_extendedCapability->Serialize(i);
1199 }
1200 if (m_htCapability.has_value())
1201 {
1202 i = m_htCapability->Serialize(i);
1203 }
1204 if (m_vhtCapability.has_value())
1205 {
1206 i = m_vhtCapability->Serialize(i);
1207 }
1208 if (m_heCapability.has_value())
1209 {
1210 i = m_heCapability->Serialize(i);
1211 }
1212 if (m_multiLinkElement.has_value())
1213 {
1214 i = m_multiLinkElement->Serialize(i);
1215 }
1216 if (m_ehtCapability.has_value())
1217 {
1218 i = m_ehtCapability->Serialize(i);
1219 }
1220}
1221
1224{
1225 Buffer::Iterator tmp;
1229 i = m_ssid.Deserialize(i);
1230 i = m_rates.Deserialize(i);
1237 i,
1239 const bool is2_4Ghz = m_rates.IsSupportedRate(
1240 1000000 /* 1 Mbit/s */); // TODO: use presence of VHT capabilities IE and HE 6 GHz Band
1241 // Capabilities IE once the later is implemented
1243 return i.GetDistanceFrom(start);
1244}
1245
1246/***********************************************************
1247 * Ressoc Request
1248 ***********************************************************/
1249
1251
1253 : m_currentApAddr(Mac48Address())
1254{
1255}
1256
1258{
1259}
1260
1261void
1263{
1264 m_ssid = ssid;
1265}
1266
1267void
1269{
1270 m_ssid = std::move(ssid);
1271}
1272
1273void
1275{
1276 m_rates = rates;
1277}
1278
1279void
1281{
1282 m_rates = std::move(rates);
1283}
1284
1285void
1287{
1288 m_listenInterval = interval;
1289}
1290
1291void
1293{
1294 m_capability = capabilities;
1295}
1296
1297void
1299{
1300 m_capability = std::move(capabilities);
1301}
1302
1305{
1306 return m_capability;
1307}
1308
1309void
1311{
1312 m_extendedCapability = extendedCapabilities;
1313}
1314
1315void
1317{
1318 m_extendedCapability = std::move(extendedCapabilities);
1319}
1320
1321const std::optional<ExtendedCapabilities>&
1323{
1324 return m_extendedCapability;
1325}
1326
1327void
1329{
1330 m_htCapability = htCapabilities;
1331}
1332
1333void
1335{
1336 m_htCapability = std::move(htCapabilities);
1337}
1338
1339const std::optional<HtCapabilities>&
1341{
1342 return m_htCapability;
1343}
1344
1345void
1347{
1348 m_vhtCapability = vhtCapabilities;
1349}
1350
1351void
1353{
1354 m_vhtCapability = std::move(vhtCapabilities);
1355}
1356
1357const std::optional<VhtCapabilities>&
1359{
1360 return m_vhtCapability;
1361}
1362
1363void
1365{
1366 m_heCapability = heCapabilities;
1367}
1368
1369void
1371{
1372 m_heCapability = std::move(heCapabilities);
1373}
1374
1375const std::optional<HeCapabilities>&
1377{
1378 return m_heCapability;
1379}
1380
1381void
1383{
1384 m_ehtCapability = ehtCapabilities;
1385}
1386
1387void
1389{
1390 m_ehtCapability = std::move(ehtCapabilities);
1391}
1392
1393const std::optional<EhtCapabilities>&
1395{
1396 return m_ehtCapability;
1397}
1398
1399void
1401{
1402 m_multiLinkElement = multiLinkElement;
1403}
1404
1405void
1407{
1408 m_multiLinkElement = std::move(multiLinkElement);
1409}
1410
1411const std::optional<MultiLinkElement>&
1413{
1414 return m_multiLinkElement;
1415}
1416
1417const Ssid&
1419{
1420 return m_ssid;
1421}
1422
1423const SupportedRates&
1425{
1426 return m_rates;
1427}
1428
1429uint16_t
1431{
1432 return m_listenInterval;
1433}
1434
1435void
1437{
1438 m_currentApAddr = currentApAddr;
1439}
1440
1441TypeId
1443{
1444 static TypeId tid = TypeId("ns3::MgtReassocRequestHeader")
1445 .SetParent<Header>()
1446 .SetGroupName("Wifi")
1447 .AddConstructor<MgtReassocRequestHeader>();
1448 return tid;
1449}
1450
1451TypeId
1453{
1454 return GetTypeId();
1455}
1456
1459{
1460 uint32_t size = 0;
1462 size += 2; // listen interval
1463 size += 6; // current AP address
1464 size += m_ssid.GetSerializedSize();
1465 size += m_rates.GetSerializedSize();
1466 if (m_rates.GetNRates() > 8)
1467 {
1468 size += m_rates.extended->GetSerializedSize();
1469 }
1470 if (m_extendedCapability.has_value())
1471 {
1472 size += m_extendedCapability->GetSerializedSize();
1473 }
1474 if (m_htCapability.has_value())
1475 {
1476 size += m_htCapability->GetSerializedSize();
1477 }
1478 if (m_vhtCapability.has_value())
1479 {
1480 size += m_vhtCapability->GetSerializedSize();
1481 }
1482 if (m_heCapability.has_value())
1483 {
1484 size += m_heCapability->GetSerializedSize();
1485 }
1486 if (m_multiLinkElement.has_value())
1487 {
1488 size += m_multiLinkElement->GetSerializedSize();
1489 }
1490 if (m_ehtCapability.has_value())
1491 {
1492 size += m_ehtCapability->GetSerializedSize();
1493 }
1494 return size;
1495}
1496
1497void
1498MgtReassocRequestHeader::Print(std::ostream& os) const
1499{
1500 os << "current AP address=" << m_currentApAddr << ", "
1501 << "ssid=" << m_ssid << ", "
1502 << "rates=" << m_rates << ", ";
1503 if (m_extendedCapability.has_value())
1504 {
1505 os << "Extended Capabilities=" << *m_extendedCapability << " , ";
1506 }
1507 if (m_htCapability.has_value())
1508 {
1509 os << "HT Capabilities=" << *m_htCapability << " , ";
1510 }
1511 if (m_vhtCapability.has_value())
1512 {
1513 os << "VHT Capabilities=" << *m_vhtCapability << " , ";
1514 }
1515 if (m_heCapability.has_value())
1516 {
1517 os << "HE Capabilities=" << *m_heCapability << " , ";
1518 }
1519 if (m_ehtCapability.has_value())
1520 {
1521 os << "EHT Capabilities=" << *m_ehtCapability;
1522 }
1523}
1524
1525void
1527{
1529 i = m_capability.Serialize(i);
1532 i = m_ssid.Serialize(i);
1533 i = m_rates.Serialize(i);
1534 if (m_rates.GetNRates() > 8)
1535 {
1536 i = m_rates.extended->Serialize(i);
1537 }
1538 if (m_extendedCapability.has_value())
1539 {
1540 i = m_extendedCapability->Serialize(i);
1541 }
1542 if (m_htCapability.has_value())
1543 {
1544 i = m_htCapability->Serialize(i);
1545 }
1546 if (m_vhtCapability.has_value())
1547 {
1548 i = m_vhtCapability->Serialize(i);
1549 }
1550 if (m_heCapability.has_value())
1551 {
1552 i = m_heCapability->Serialize(i);
1553 }
1554 if (m_multiLinkElement.has_value())
1555 {
1556 i = m_multiLinkElement->Serialize(i);
1557 }
1558 if (m_ehtCapability.has_value())
1559 {
1560 i = m_ehtCapability->Serialize(i);
1561 }
1562}
1563
1566{
1567 Buffer::Iterator tmp;
1572 i = m_ssid.Deserialize(i);
1573 i = m_rates.Deserialize(i);
1580 i,
1582 const bool is2_4Ghz = m_rates.IsSupportedRate(
1583 1000000 /* 1 Mbit/s */); // TODO: use presence of VHT capabilities IE and HE 6 GHz Band
1584 // Capabilities IE once the later is implemented
1586 return i.GetDistanceFrom(start);
1587}
1588
1589/***********************************************************
1590 * Assoc/Reassoc Response
1591 ***********************************************************/
1592
1594
1596 : m_aid(0)
1597{
1598}
1599
1601{
1602}
1603
1606{
1607 return m_code;
1608}
1609
1610const SupportedRates&
1612{
1613 return m_rates;
1614}
1615
1616void
1618{
1619 m_code = code;
1620}
1621
1622void
1624{
1625 m_rates = rates;
1626}
1627
1628void
1630{
1631 m_rates = std::move(rates);
1632}
1633
1634void
1636{
1637 m_capability = capabilities;
1638}
1639
1640void
1642{
1643 m_capability = std::move(capabilities);
1644}
1645
1648{
1649 return m_capability;
1650}
1651
1652void
1654{
1655 m_extendedCapability = extendedCapabilities;
1656}
1657
1658void
1660{
1661 m_extendedCapability = std::move(extendedCapabilities);
1662}
1663
1664const std::optional<ExtendedCapabilities>&
1666{
1667 return m_extendedCapability;
1668}
1669
1670void
1672{
1673 m_htCapability = htCapabilities;
1674}
1675
1676void
1678{
1679 m_htCapability = std::move(htCapabilities);
1680}
1681
1682const std::optional<HtCapabilities>&
1684{
1685 return m_htCapability;
1686}
1687
1688void
1690{
1691 m_htOperation = htOperation;
1692}
1693
1694void
1696{
1697 m_htOperation = std::move(htOperation);
1698}
1699
1700const std::optional<HtOperation>&
1702{
1703 return m_htOperation;
1704}
1705
1706void
1708{
1709 m_vhtCapability = vhtCapabilities;
1710}
1711
1712void
1714{
1715 m_vhtCapability = std::move(vhtCapabilities);
1716}
1717
1718const std::optional<VhtCapabilities>&
1720{
1721 return m_vhtCapability;
1722}
1723
1724void
1726{
1727 m_vhtOperation = vhtOperation;
1728}
1729
1730void
1732{
1733 m_vhtOperation = std::move(vhtOperation);
1734}
1735
1736const std::optional<VhtOperation>&
1738{
1739 return m_vhtOperation;
1740}
1741
1742void
1744{
1745 m_heCapability = heCapabilities;
1746}
1747
1748void
1750{
1751 m_heCapability = std::move(heCapabilities);
1752}
1753
1754const std::optional<HeCapabilities>&
1756{
1757 return m_heCapability;
1758}
1759
1760void
1762{
1763 m_heOperation = heOperation;
1764}
1765
1766void
1768{
1769 m_heOperation = std::move(heOperation);
1770}
1771
1772const std::optional<HeOperation>&
1774{
1775 return m_heOperation;
1776}
1777
1778void
1780{
1781 m_ehtCapability = ehtCapabilities;
1782}
1783
1784void
1786{
1787 m_ehtCapability = std::move(ehtCapabilities);
1788}
1789
1790const std::optional<EhtCapabilities>&
1792{
1793 return m_ehtCapability;
1794}
1795
1796void
1798{
1799 m_ehtOperation = ehtOperation;
1800}
1801
1802void
1804{
1805 m_ehtOperation = std::move(ehtOperation);
1806}
1807
1808const std::optional<EhtOperation>&
1810{
1811 return m_ehtOperation;
1812}
1813
1814void
1816{
1817 m_multiLinkElement = multiLinkElement;
1818}
1819
1820void
1822{
1823 m_multiLinkElement = std::move(multiLinkElement);
1824}
1825
1826const std::optional<MultiLinkElement>&
1828{
1829 return m_multiLinkElement;
1830}
1831
1832void
1834{
1835 m_aid = aid;
1836}
1837
1838uint16_t
1840{
1841 return m_aid;
1842}
1843
1844void
1846{
1847 m_erpInformation = erpInformation;
1848}
1849
1850void
1852{
1853 m_erpInformation = std::move(erpInformation);
1854}
1855
1856const std::optional<ErpInformation>&
1858{
1859 return m_erpInformation;
1860}
1861
1862void
1864{
1865 m_edcaParameterSet = edcaparameters;
1866}
1867
1868void
1870{
1871 m_edcaParameterSet = std::move(edcaparameters);
1872}
1873
1874void
1876{
1877 m_muEdcaParameterSet = muEdcaParameters;
1878}
1879
1880void
1882{
1883 m_muEdcaParameterSet = std::move(muEdcaParameters);
1884}
1885
1886const std::optional<EdcaParameterSet>&
1888{
1889 return m_edcaParameterSet;
1890}
1891
1892const std::optional<MuEdcaParameterSet>&
1894{
1895 return m_muEdcaParameterSet;
1896}
1897
1898TypeId
1900{
1901 static TypeId tid = TypeId("ns3::MgtAssocResponseHeader")
1902 .SetParent<Header>()
1903 .SetGroupName("Wifi")
1904 .AddConstructor<MgtAssocResponseHeader>();
1905 return tid;
1906}
1907
1908TypeId
1910{
1911 return GetTypeId();
1912}
1913
1916{
1917 uint32_t size = 0;
1919 size += m_code.GetSerializedSize();
1920 size += 2; // aid
1921 size += m_rates.GetSerializedSize();
1922 if (m_erpInformation.has_value())
1923 {
1924 size += m_erpInformation->GetSerializedSize();
1925 }
1926 if (m_rates.GetNRates() > 8)
1927 {
1928 size += m_rates.extended->GetSerializedSize();
1929 }
1930 if (m_edcaParameterSet.has_value())
1931 {
1932 size += m_edcaParameterSet->GetSerializedSize();
1933 }
1934 if (m_extendedCapability.has_value())
1935 {
1936 size += m_extendedCapability->GetSerializedSize();
1937 }
1938 if (m_htCapability.has_value())
1939 {
1940 size += m_htCapability->GetSerializedSize();
1941 }
1942 if (m_htOperation.has_value())
1943 {
1944 size += m_htOperation->GetSerializedSize();
1945 }
1946 if (m_vhtCapability.has_value())
1947 {
1948 size += m_vhtCapability->GetSerializedSize();
1949 }
1950 if (m_vhtOperation.has_value())
1951 {
1952 size += m_vhtOperation->GetSerializedSize();
1953 }
1954 if (m_heCapability.has_value())
1955 {
1956 size += m_heCapability->GetSerializedSize();
1957 }
1958 if (m_heOperation.has_value())
1959 {
1960 size += m_heOperation->GetSerializedSize();
1961 }
1962 if (m_muEdcaParameterSet.has_value())
1963 {
1964 size += m_muEdcaParameterSet->GetSerializedSize();
1965 }
1966 if (m_multiLinkElement.has_value())
1967 {
1968 size += m_multiLinkElement->GetSerializedSize();
1969 }
1970 if (m_ehtCapability.has_value())
1971 {
1972 size += m_ehtCapability->GetSerializedSize();
1973 }
1974 if (m_ehtOperation.has_value())
1975 {
1976 size += m_ehtOperation->GetSerializedSize();
1977 }
1978 return size;
1979}
1980
1981void
1982MgtAssocResponseHeader::Print(std::ostream& os) const
1983{
1984 os << "status code=" << m_code << ", "
1985 << "aid=" << m_aid << ", "
1986 << "rates=" << m_rates << ", ";
1987 if (m_erpInformation.has_value())
1988 {
1989 os << "ERP information=" << *m_erpInformation << ", ";
1990 }
1991 if (m_extendedCapability.has_value())
1992 {
1993 os << "Extended Capabilities=" << *m_extendedCapability << " , ";
1994 }
1995 if (m_htCapability.has_value())
1996 {
1997 os << "HT Capabilities=" << *m_htCapability << " , ";
1998 }
1999 if (m_htOperation.has_value())
2000 {
2001 os << "HT Operation=" << *m_htOperation << " , ";
2002 }
2003 if (m_vhtCapability.has_value())
2004 {
2005 os << "VHT Capabilities=" << *m_vhtCapability << " , ";
2006 }
2007 if (m_vhtOperation.has_value())
2008 {
2009 os << "VHT Operation=" << *m_vhtOperation << " , ";
2010 }
2011 if (m_heCapability.has_value())
2012 {
2013 os << "HE Capabilities=" << *m_heCapability << " , ";
2014 }
2015 if (m_heOperation.has_value())
2016 {
2017 os << "HE Operation=" << *m_heOperation << " , ";
2018 }
2019 if (m_ehtCapability.has_value())
2020 {
2021 os << "EHT Capabilities=" << *m_ehtCapability;
2022 }
2023 if (m_ehtOperation.has_value())
2024 {
2025 os << "EHT Operation=" << *m_ehtOperation;
2026 }
2027}
2028
2029void
2031{
2033 i = m_capability.Serialize(i);
2034 i = m_code.Serialize(i);
2036 i = m_rates.Serialize(i);
2037 if (m_erpInformation.has_value())
2038 {
2039 i = m_erpInformation->Serialize(i);
2040 }
2041 if (m_rates.GetNRates() > 8)
2042 {
2043 i = m_rates.extended->Serialize(i);
2044 }
2045 if (m_edcaParameterSet.has_value())
2046 {
2047 i = m_edcaParameterSet->Serialize(i);
2048 }
2049 if (m_extendedCapability.has_value())
2050 {
2051 i = m_extendedCapability->Serialize(i);
2052 }
2053 if (m_htCapability.has_value())
2054 {
2055 i = m_htCapability->Serialize(i);
2056 }
2057 if (m_htOperation.has_value())
2058 {
2059 i = m_htOperation->Serialize(i);
2060 }
2061 if (m_vhtCapability.has_value())
2062 {
2063 i = m_vhtCapability->Serialize(i);
2064 }
2065 if (m_vhtOperation.has_value())
2066 {
2067 i = m_vhtOperation->Serialize(i);
2068 }
2069 if (m_heCapability.has_value())
2070 {
2071 i = m_heCapability->Serialize(i);
2072 }
2073 if (m_heOperation.has_value())
2074 {
2075 i = m_heOperation->Serialize(i);
2076 }
2077 if (m_muEdcaParameterSet.has_value())
2078 {
2079 i = m_muEdcaParameterSet->Serialize(i);
2080 }
2081 if (m_multiLinkElement.has_value())
2082 {
2083 i = m_multiLinkElement->Serialize(i);
2084 }
2085 if (m_ehtCapability.has_value())
2086 {
2087 i = m_ehtCapability->Serialize(i);
2088 }
2089 if (m_ehtOperation.has_value())
2090 {
2091 i = m_ehtOperation->Serialize(i);
2092 }
2093}
2094
2097{
2098 Buffer::Iterator tmp;
2101 i = m_code.Deserialize(i);
2102 m_aid = i.ReadLsbtohU16();
2103 i = m_rates.Deserialize(i);
2116 i,
2118 const bool is2_4Ghz = m_rates.IsSupportedRate(
2119 1000000 /* 1 Mbit/s */); // TODO: use presence of VHT capabilities IE and HE 6 GHz Band
2120 // Capabilities IE once the later is implemented
2123 return i.GetDistanceFrom(start);
2124}
2125
2126/**********************************************************
2127 * ActionFrame
2128 **********************************************************/
2130{
2131}
2132
2134{
2135}
2136
2137void
2140{
2141 m_category = static_cast<uint8_t>(type);
2142 switch (type)
2143 {
2144 case QOS: {
2145 m_actionValue = static_cast<uint8_t>(action.qos);
2146 break;
2147 }
2148 case BLOCK_ACK: {
2149 m_actionValue = static_cast<uint8_t>(action.blockAck);
2150 break;
2151 }
2152 case PUBLIC: {
2153 m_actionValue = static_cast<uint8_t>(action.publicAction);
2154 break;
2155 }
2156 case RADIO_MEASUREMENT: {
2157 m_actionValue = static_cast<uint8_t>(action.radioMeasurementAction);
2158 break;
2159 }
2160 case MESH: {
2161 m_actionValue = static_cast<uint8_t>(action.meshAction);
2162 break;
2163 }
2164 case MULTIHOP: {
2165 m_actionValue = static_cast<uint8_t>(action.multihopAction);
2166 break;
2167 }
2168 case SELF_PROTECTED: {
2169 m_actionValue = static_cast<uint8_t>(action.selfProtectedAction);
2170 break;
2171 }
2172 case DMG: {
2173 m_actionValue = static_cast<uint8_t>(action.dmgAction);
2174 break;
2175 }
2176 case FST: {
2177 m_actionValue = static_cast<uint8_t>(action.fstAction);
2178 break;
2179 }
2180 case UNPROTECTED_DMG: {
2181 m_actionValue = static_cast<uint8_t>(action.unprotectedDmgAction);
2182 break;
2183 }
2185 break;
2186 }
2187 }
2188}
2189
2192{
2193 switch (m_category)
2194 {
2195 case QOS:
2196 return QOS;
2197 case BLOCK_ACK:
2198 return BLOCK_ACK;
2199 case PUBLIC:
2200 return PUBLIC;
2201 case RADIO_MEASUREMENT:
2202 return RADIO_MEASUREMENT;
2203 case MESH:
2204 return MESH;
2205 case MULTIHOP:
2206 return MULTIHOP;
2207 case SELF_PROTECTED:
2208 return SELF_PROTECTED;
2209 case DMG:
2210 return DMG;
2211 case FST:
2212 return FST;
2213 case UNPROTECTED_DMG:
2214 return UNPROTECTED_DMG;
2217 default:
2218 NS_FATAL_ERROR("Unknown action value");
2219 return SELF_PROTECTED;
2220 }
2221}
2222
2225{
2226 ActionValue retval;
2227 retval.selfProtectedAction =
2228 PEER_LINK_OPEN; // Needs to be initialized to something to quiet valgrind in default cases
2229 switch (m_category)
2230 {
2231 case QOS:
2232 switch (m_actionValue)
2233 {
2234 case ADDTS_REQUEST:
2235 retval.qos = ADDTS_REQUEST;
2236 break;
2237 case ADDTS_RESPONSE:
2238 retval.qos = ADDTS_RESPONSE;
2239 break;
2240 case DELTS:
2241 retval.qos = DELTS;
2242 break;
2243 case SCHEDULE:
2244 retval.qos = SCHEDULE;
2245 break;
2246 case QOS_MAP_CONFIGURE:
2247 retval.qos = QOS_MAP_CONFIGURE;
2248 break;
2249 default:
2250 NS_FATAL_ERROR("Unknown qos action code");
2251 retval.qos = ADDTS_REQUEST; /* quiet compiler */
2252 }
2253 break;
2254
2255 case BLOCK_ACK:
2256 switch (m_actionValue)
2257 {
2260 break;
2263 break;
2264 case BLOCK_ACK_DELBA:
2265 retval.blockAck = BLOCK_ACK_DELBA;
2266 break;
2267 default:
2268 NS_FATAL_ERROR("Unknown block ack action code");
2269 retval.blockAck = BLOCK_ACK_ADDBA_REQUEST; /* quiet compiler */
2270 }
2271 break;
2272
2273 case PUBLIC:
2274 switch (m_actionValue)
2275 {
2276 case QAB_REQUEST:
2277 retval.publicAction = QAB_REQUEST;
2278 break;
2279 case QAB_RESPONSE:
2280 retval.publicAction = QAB_RESPONSE;
2281 break;
2282 default:
2283 NS_FATAL_ERROR("Unknown public action code");
2284 retval.publicAction = QAB_REQUEST; /* quiet compiler */
2285 }
2286 break;
2287
2288 case RADIO_MEASUREMENT:
2289 switch (m_actionValue)
2290 {
2293 break;
2296 break;
2299 break;
2302 break;
2305 break;
2308 break;
2309 default:
2310 NS_FATAL_ERROR("Unknown radio measurement action code");
2311 retval.radioMeasurementAction = RADIO_MEASUREMENT_REQUEST; /* quiet compiler */
2312 }
2313 break;
2314
2315 case SELF_PROTECTED:
2316 switch (m_actionValue)
2317 {
2318 case PEER_LINK_OPEN:
2320 break;
2321 case PEER_LINK_CONFIRM:
2323 break;
2324 case PEER_LINK_CLOSE:
2326 break;
2327 case GROUP_KEY_INFORM:
2329 break;
2330 case GROUP_KEY_ACK:
2332 break;
2333 default:
2334 NS_FATAL_ERROR("Unknown mesh peering management action code");
2335 retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
2336 }
2337 break;
2338
2339 case MESH:
2340 switch (m_actionValue)
2341 {
2342 case LINK_METRIC_REPORT:
2344 break;
2345 case PATH_SELECTION:
2346 retval.meshAction = PATH_SELECTION;
2347 break;
2350 break;
2353 break;
2354 case MDA_SETUP_REQUEST:
2356 break;
2357 case MDA_SETUP_REPLY:
2358 retval.meshAction = MDA_SETUP_REPLY;
2359 break;
2362 break;
2365 break;
2366 case MDAOP_SET_TEARDOWN:
2368 break;
2371 break;
2374 break;
2375 default:
2376 NS_FATAL_ERROR("Unknown mesh peering management action code");
2377 retval.meshAction = LINK_METRIC_REPORT; /* quiet compiler */
2378 }
2379 break;
2380
2381 case MULTIHOP: // not yet supported
2382 switch (m_actionValue)
2383 {
2384 case PROXY_UPDATE: // not used so far
2386 break;
2387 case PROXY_UPDATE_CONFIRMATION: // not used so far
2389 break;
2390 default:
2391 NS_FATAL_ERROR("Unknown mesh peering management action code");
2392 retval.multihopAction = PROXY_UPDATE; /* quiet compiler */
2393 }
2394 break;
2395
2396 case DMG:
2397 switch (m_actionValue)
2398 {
2401 break;
2404 break;
2407 break;
2410 break;
2413 break;
2416 break;
2417 case DMG_DTP_REQUEST:
2418 retval.dmgAction = DMG_DTP_REQUEST;
2419 break;
2420 case DMG_DTP_RESPONSE:
2421 retval.dmgAction = DMG_DTP_RESPONSE;
2422 break;
2425 break;
2428 break;
2431 break;
2434 break;
2435 case DMG_RLS_REQUEST:
2436 retval.dmgAction = DMG_RLS_REQUEST;
2437 break;
2438 case DMG_RLS_RESPONSE:
2439 retval.dmgAction = DMG_RLS_RESPONSE;
2440 break;
2443 break;
2444 case DMG_RLS_TEARDOWN:
2445 retval.dmgAction = DMG_RLS_TEARDOWN;
2446 break;
2449 break;
2452 break;
2453 case DMG_TPA_REQUEST:
2454 retval.dmgAction = DMG_TPA_REQUEST;
2455 break;
2456 case DMG_TPA_RESPONSE:
2457 retval.dmgAction = DMG_TPA_RESPONSE;
2458 break;
2459 case DMG_ROC_REQUEST:
2460 retval.dmgAction = DMG_ROC_REQUEST;
2461 break;
2462 case DMG_ROC_RESPONSE:
2463 retval.dmgAction = DMG_ROC_RESPONSE;
2464 break;
2465 default:
2466 NS_FATAL_ERROR("Unknown DMG management action code");
2467 retval.dmgAction = DMG_POWER_SAVE_CONFIGURATION_REQUEST; /* quiet compiler */
2468 }
2469 break;
2470
2471 case FST:
2472 switch (m_actionValue)
2473 {
2474 case FST_SETUP_REQUEST:
2476 break;
2477 case FST_SETUP_RESPONSE:
2479 break;
2480 case FST_TEAR_DOWN:
2481 retval.fstAction = FST_TEAR_DOWN;
2482 break;
2483 case FST_ACK_REQUEST:
2484 retval.fstAction = FST_ACK_REQUEST;
2485 break;
2486 case FST_ACK_RESPONSE:
2487 retval.fstAction = FST_ACK_RESPONSE;
2488 break;
2491 break;
2492 default:
2493 NS_FATAL_ERROR("Unknown FST management action code");
2494 retval.fstAction = FST_SETUP_REQUEST; /* quiet compiler */
2495 }
2496 break;
2497
2498 case UNPROTECTED_DMG:
2499 switch (m_actionValue)
2500 {
2503 break;
2506 break;
2509 break;
2512 break;
2515 break;
2518 break;
2519 default:
2520 NS_FATAL_ERROR("Unknown Unprotected DMG action code");
2521 retval.unprotectedDmgAction = UNPROTECTED_DMG_ANNOUNCE; /* quiet compiler */
2522 }
2523 break;
2524
2525 default:
2526 NS_FATAL_ERROR("Unsupported action");
2527 retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
2528 }
2529 return retval;
2530}
2531
2532TypeId
2534{
2535 static TypeId tid = TypeId("ns3::WifiActionHeader")
2536 .SetParent<Header>()
2537 .SetGroupName("Wifi")
2538 .AddConstructor<WifiActionHeader>();
2539 return tid;
2540}
2541
2542TypeId
2544{
2545 return GetTypeId();
2546}
2547
2548std::string
2550{
2551 switch (value)
2552 {
2553 case QOS:
2554 return "QoS";
2555 case BLOCK_ACK:
2556 return "BlockAck";
2557 case PUBLIC:
2558 return "Public";
2559 case RADIO_MEASUREMENT:
2560 return "RadioMeasurement";
2561 case MESH:
2562 return "Mesh";
2563 case MULTIHOP:
2564 return "Multihop";
2565 case SELF_PROTECTED:
2566 return "SelfProtected";
2567 case DMG:
2568 return "Dmg";
2569 case FST:
2570 return "Fst";
2571 case UNPROTECTED_DMG:
2572 return "UnprotectedDmg";
2574 return "VendorSpecificAction";
2575 default:
2576 std::ostringstream convert;
2577 convert << value;
2578 return convert.str();
2579 }
2580}
2581
2582std::string
2584{
2585 if (value == PEER_LINK_OPEN)
2586 {
2587 return "PeerLinkOpen";
2588 }
2589 else if (value == PEER_LINK_CONFIRM)
2590 {
2591 return "PeerLinkConfirm";
2592 }
2593 else if (value == PEER_LINK_CLOSE)
2594 {
2595 return "PeerLinkClose";
2596 }
2597 else if (value == GROUP_KEY_INFORM)
2598 {
2599 return "GroupKeyInform";
2600 }
2601 else if (value == GROUP_KEY_ACK)
2602 {
2603 return "GroupKeyAck";
2604 }
2605 else
2606 {
2607 std::ostringstream convert;
2608 convert << value;
2609 return convert.str();
2610 }
2611}
2612
2613void
2614WifiActionHeader::Print(std::ostream& os) const
2615{
2616 os << "category=" << CategoryValueToString((CategoryValue)m_category)
2618}
2619
2622{
2623 return 2;
2624}
2625
2626void
2628{
2629 start.WriteU8(m_category);
2630 start.WriteU8(m_actionValue);
2631}
2632
2635{
2637 m_category = i.ReadU8();
2638 m_actionValue = i.ReadU8();
2639 return i.GetDistanceFrom(start);
2640}
2641
2642/***************************************************
2643 * ADDBARequest
2644 ****************************************************/
2645
2647
2649 : m_dialogToken(1),
2650 m_amsduSupport(1),
2651 m_bufferSize(0)
2652{
2653}
2654
2655TypeId
2657{
2658 static TypeId tid = TypeId("ns3::MgtAddBaRequestHeader")
2659 .SetParent<Header>()
2660 .SetGroupName("Wifi")
2661 .AddConstructor<MgtAddBaRequestHeader>();
2662 return tid;
2663}
2664
2665TypeId
2667{
2668 return GetTypeId();
2669}
2670
2671void
2672MgtAddBaRequestHeader::Print(std::ostream& os) const
2673{
2674}
2675
2678{
2679 uint32_t size = 0;
2680 size += 1; // Dialog token
2681 size += 2; // Block ack parameter set
2682 size += 2; // Block ack timeout value
2683 size += 2; // Starting sequence control
2684 return size;
2685}
2686
2687void
2689{
2695}
2696
2699{
2701 m_dialogToken = i.ReadU8();
2705 return i.GetDistanceFrom(start);
2706}
2707
2708void
2710{
2711 m_policy = 0;
2712}
2713
2714void
2716{
2717 m_policy = 1;
2718}
2719
2720void
2722{
2723 NS_ASSERT(tid < 16);
2724 m_tid = tid;
2725}
2726
2727void
2729{
2731}
2732
2733void
2735{
2736 m_bufferSize = size;
2737}
2738
2739void
2741{
2742 m_startingSeq = seq;
2743}
2744
2745void
2747{
2748 m_startingSeq = (seqControl >> 4) & 0x0fff;
2749}
2750
2751void
2753{
2754 m_amsduSupport = supported;
2755}
2756
2757uint8_t
2759{
2760 return m_tid;
2761}
2762
2763bool
2765{
2766 return m_policy == 1;
2767}
2768
2769uint16_t
2771{
2772 return m_timeoutValue;
2773}
2774
2775uint16_t
2777{
2778 return m_bufferSize;
2779}
2780
2781bool
2783{
2784 return m_amsduSupport == 1;
2785}
2786
2787uint16_t
2789{
2790 return m_startingSeq;
2791}
2792
2793uint16_t
2795{
2796 return (m_startingSeq << 4) & 0xfff0;
2797}
2798
2799uint16_t
2801{
2802 uint16_t res = 0;
2804 res |= m_policy << 1;
2805 res |= m_tid << 2;
2806 res |= m_bufferSize << 6;
2807 return res;
2808}
2809
2810void
2812{
2813 m_amsduSupport = (params)&0x01;
2814 m_policy = (params >> 1) & 0x01;
2815 m_tid = (params >> 2) & 0x0f;
2816 m_bufferSize = (params >> 6) & 0x03ff;
2817}
2818
2819/***************************************************
2820 * ADDBAResponse
2821 ****************************************************/
2822
2824
2826 : m_dialogToken(1),
2827 m_amsduSupport(1),
2828 m_bufferSize(0)
2829{
2830}
2831
2832TypeId
2834{
2835 static TypeId tid = TypeId("ns3::MgtAddBaResponseHeader")
2836 .SetParent<Header>()
2837 .SetGroupName("Wifi")
2838 .AddConstructor<MgtAddBaResponseHeader>();
2839 return tid;
2840}
2841
2842TypeId
2844{
2845 return GetTypeId();
2846}
2847
2848void
2849MgtAddBaResponseHeader::Print(std::ostream& os) const
2850{
2851 os << "status code=" << m_code;
2852}
2853
2856{
2857 uint32_t size = 0;
2858 size += 1; // Dialog token
2859 size += m_code.GetSerializedSize(); // Status code
2860 size += 2; // Block ack parameter set
2861 size += 2; // Block ack timeout value
2862 return size;
2863}
2864
2865void
2867{
2870 i = m_code.Serialize(i);
2873}
2874
2877{
2879 m_dialogToken = i.ReadU8();
2880 i = m_code.Deserialize(i);
2883 return i.GetDistanceFrom(start);
2884}
2885
2886void
2888{
2889 m_policy = 0;
2890}
2891
2892void
2894{
2895 m_policy = 1;
2896}
2897
2898void
2900{
2901 NS_ASSERT(tid < 16);
2902 m_tid = tid;
2903}
2904
2905void
2907{
2909}
2910
2911void
2913{
2914 m_bufferSize = size;
2915}
2916
2917void
2919{
2920 m_code = code;
2921}
2922
2923void
2925{
2926 m_amsduSupport = supported;
2927}
2928
2931{
2932 return m_code;
2933}
2934
2935uint8_t
2937{
2938 return m_tid;
2939}
2940
2941bool
2943{
2944 return m_policy == 1;
2945}
2946
2947uint16_t
2949{
2950 return m_timeoutValue;
2951}
2952
2953uint16_t
2955{
2956 return m_bufferSize;
2957}
2958
2959bool
2961{
2962 return m_amsduSupport == 1;
2963}
2964
2965uint16_t
2967{
2968 uint16_t res = 0;
2970 res |= m_policy << 1;
2971 res |= m_tid << 2;
2972 res |= m_bufferSize << 6;
2973 return res;
2974}
2975
2976void
2978{
2979 m_amsduSupport = (params)&0x01;
2980 m_policy = (params >> 1) & 0x01;
2981 m_tid = (params >> 2) & 0x0f;
2982 m_bufferSize = (params >> 6) & 0x03ff;
2983}
2984
2985/***************************************************
2986 * DelBa
2987 ****************************************************/
2988
2990
2992 : m_reasonCode(1)
2993{
2994}
2995
2996TypeId
2998{
2999 static TypeId tid = TypeId("ns3::MgtDelBaHeader")
3000 .SetParent<Header>()
3001 .SetGroupName("Wifi")
3002 .AddConstructor<MgtDelBaHeader>();
3003 return tid;
3004}
3005
3006TypeId
3008{
3009 return GetTypeId();
3010}
3011
3012void
3013MgtDelBaHeader::Print(std::ostream& os) const
3014{
3015}
3016
3019{
3020 uint32_t size = 0;
3021 size += 2; // DelBa parameter set
3022 size += 2; // Reason code
3023 return size;
3024}
3025
3026void
3028{
3032}
3033
3036{
3040 return i.GetDistanceFrom(start);
3041}
3042
3043bool
3045{
3046 return m_initiator == 1;
3047}
3048
3049uint8_t
3051{
3052 NS_ASSERT(m_tid < 16);
3053 uint8_t tid = static_cast<uint8_t>(m_tid);
3054 return tid;
3055}
3056
3057void
3059{
3060 m_initiator = 1;
3061}
3062
3063void
3065{
3066 m_initiator = 0;
3067}
3068
3069void
3071{
3072 NS_ASSERT(tid < 16);
3073 m_tid = static_cast<uint16_t>(tid);
3074}
3075
3076uint16_t
3078{
3079 uint16_t res = 0;
3080 res |= m_initiator << 11;
3081 res |= m_tid << 12;
3082 return res;
3083}
3084
3085void
3087{
3088 m_initiator = (params >> 11) & 0x01;
3089 m_tid = (params >> 12) & 0x0f;
3090}
3091
3092} // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:905
uint8_t ReadU8()
Definition: buffer.h:1027
void WriteU8(uint8_t data)
Definition: buffer.h:881
uint16_t ReadLsbtohU16()
Definition: buffer.cc:1067
uint64_t ReadLsbtohU64()
Definition: buffer.cc:1097
void WriteHtolsbU64(uint64_t data)
Definition: buffer.cc:923
uint32_t GetDistanceFrom(const Iterator &o) const
Definition: buffer.cc:783
uint32_t GetSerializedSize() const
Return the serialized size of capability information.
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize capability information to the given buffer.
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize capability information from the given buffer.
The DSSS Parameter Set.
The EDCA Parameter Set.
The IEEE 802.11be EHT Capabilities.
EHT Operation Information Element.
Definition: eht-operation.h:67
The ErpInformation Information Element.
The Extended Capabilities Information Element.
The IEEE 802.11ax HE Capabilities.
The HE Operation Information Element.
Definition: he-operation.h:36
Protocol header serialization and deserialization.
Definition: header.h:44
The HT Capabilities Information Element.
The HT Operation Information Element.
Definition: ht-operation.h:51
an EUI-48 address
Definition: mac48-address.h:46
Implement the header for management frames of type Add Block Ack request.
Definition: mgt-headers.h:1511
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
uint16_t m_startingSeq
Starting sequence number.
Definition: mgt-headers.h:1634
void Serialize(Buffer::Iterator start) const override
uint16_t GetStartingSequenceControl() const
Return the raw sequence control.
void SetStartingSequenceControl(uint16_t seqControl)
Set sequence control with the given raw value.
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:1631
static TypeId GetTypeId()
Register this type.
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:1629
void SetBufferSize(uint16_t size)
Set buffer size.
void Print(std::ostream &os) const override
void SetDelayedBlockAck()
Enable delayed BlockAck.
uint8_t m_dialogToken
Not used for now.
Definition: mgt-headers.h:1628
uint16_t GetParameterSet() const
Return the raw parameter set.
uint32_t Deserialize(Buffer::Iterator start) override
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
void SetImmediateBlockAck()
Enable immediate BlockAck.
uint16_t GetBufferSize() const
Return the buffer size.
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:1632
uint16_t GetTimeout() const
Return the timeout.
uint8_t GetTid() const
Return the Traffic ID (TID).
uint16_t GetStartingSequence() const
Return the starting sequence number.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSerializedSize() const override
bool IsAmsduSupported() const
Return whether A-MSDU capability is supported.
bool IsImmediateBlockAck() const
Return whether the Block Ack policy is immediate Block Ack.
uint16_t m_timeoutValue
Timeout.
Definition: mgt-headers.h:1633
void SetTimeout(uint16_t timeout)
Set timeout.
void SetTid(uint8_t tid)
Set Traffic ID (TID).
uint8_t m_policy
Block Ack policy.
Definition: mgt-headers.h:1630
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1642
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:1752
void SetTid(uint8_t tid)
Set Traffic ID (TID).
uint32_t GetSerializedSize() const override
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:1749
uint8_t m_dialogToken
Not used for now.
Definition: mgt-headers.h:1747
void Serialize(Buffer::Iterator start) const override
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
uint16_t GetBufferSize() const
Return the buffer size.
bool IsAmsduSupported() const
Return whether A-MSDU capability is supported.
StatusCode GetStatusCode() const
Return the status code.
void SetTimeout(uint16_t timeout)
Set timeout.
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:1750
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetBufferSize(uint16_t size)
Set buffer size.
uint16_t m_timeoutValue
Timeout.
Definition: mgt-headers.h:1753
void Print(std::ostream &os) const override
void SetStatusCode(StatusCode code)
Set the status code.
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:1751
uint8_t GetTid() const
Return the Traffic ID (TID).
bool IsImmediateBlockAck() const
Return whether the Block Ack policy is immediate Block Ack.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
uint16_t GetParameterSet() const
Return the raw parameter set.
uint32_t Deserialize(Buffer::Iterator start) override
uint16_t GetTimeout() const
Return the timeout.
void SetDelayedBlockAck()
Enable delayed BlockAck.
void SetImmediateBlockAck()
Enable immediate BlockAck.
static TypeId GetTypeId()
Register this type.
StatusCode m_code
Status code.
Definition: mgt-headers.h:1748
Implement the header for management frames of type association request.
Definition: mgt-headers.h:55
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:232
const std::optional< ExtendedCapabilities > & GetExtendedCapabilities() const
Return the extended capabilities, if present.
Definition: mgt-headers.cc:989
std::optional< VhtCapabilities > m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:236
void SetMultiLinkElement(const MultiLinkElement &multiLinkElement)
Set the Multi-Link Element information element.
const SupportedRates & GetSupportedRates() const
Return the supported rates.
void SetHeCapabilities(const HeCapabilities &heCapabilities)
Set the HE capabilities.
uint32_t Deserialize(Buffer::Iterator start) override
const CapabilityInformation & GetCapabilities() const
Return the Capability information.
Definition: mgt-headers.cc:971
const std::optional< HeCapabilities > & GetHeCapabilities() const
Return the HE capabilities, if present.
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:233
void SetExtendedCapabilities(const ExtendedCapabilities &extendedCapabilities)
Set the Extended Capabilities.
Definition: mgt-headers.cc:977
void SetSupportedRates(const SupportedRates &rates)
Set the supported rates.
Definition: mgt-headers.cc:941
const std::optional< MultiLinkElement > & GetMultiLinkElement() const
Return the Multi-Link Element information element, if present.
void SetEhtCapabilities(const EhtCapabilities &ehtCapabilities)
Set the EHT capabilities.
std::optional< ExtendedCapabilities > m_extendedCapability
Extended capabilities.
Definition: mgt-headers.h:234
void SetHtCapabilities(const HtCapabilities &htCapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:995
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:953
uint16_t GetListenInterval() const
Return the listen interval.
uint32_t GetSerializedSize() const override
void Print(std::ostream &os) const override
std::optional< HeCapabilities > m_heCapability
HE capabilities.
Definition: mgt-headers.h:237
void SetVhtCapabilities(const VhtCapabilities &vhtCapabilities)
Set the VHT capabilities.
const std::optional< EhtCapabilities > & GetEhtCapabilities() const
Return the EHT capabilities, if present.
const std::optional< HtCapabilities > & GetHtCapabilities() const
Return the HT capabilities, if present.
uint16_t m_listenInterval
listen interval
Definition: mgt-headers.h:238
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:231
std::optional< HtCapabilities > m_htCapability
HT capabilities.
Definition: mgt-headers.h:235
std::optional< MultiLinkElement > m_multiLinkElement
Multi-Link Element.
Definition: mgt-headers.h:240
const std::optional< VhtCapabilities > & GetVhtCapabilities() const
Return the VHT capabilities, if present.
void SetCapabilities(const CapabilityInformation &capabilities)
Set the Capability information.
Definition: mgt-headers.cc:959
static TypeId GetTypeId()
Register this type.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Serialize(Buffer::Iterator start) const override
const Ssid & GetSsid() const
Return the Service Set Identifier (SSID).
std::optional< EhtCapabilities > m_ehtCapability
EHT capabilities.
Definition: mgt-headers.h:239
void SetSsid(const Ssid &ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:929
Implement the header for management frames of type association and reassociation response.
Definition: mgt-headers.h:447
void SetHeCapabilities(const HeCapabilities &heCapabilities)
Set the HE capabilities.
std::optional< VhtCapabilities > m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:737
static TypeId GetTypeId()
Register this type.
const std::optional< MultiLinkElement > & GetMultiLinkElement() const
Return the Multi-Link Element information element, if present.
StatusCode GetStatusCode()
Return the status code.
const std::optional< EhtOperation > & GetEhtOperation() const
Return the EHT operation, if present.
void SetHtOperation(const HtOperation &htOperation)
Set the HT operation.
void SetMuEdcaParameterSet(const MuEdcaParameterSet &muEdcaParameterSet)
Set the MU EDCA Parameter Set.
void SetEdcaParameterSet(const EdcaParameterSet &edcaParameterSet)
Set the EDCA Parameter Set.
std::optional< HeOperation > m_heOperation
HE operation.
Definition: mgt-headers.h:742
void Serialize(Buffer::Iterator start) const override
void SetEhtCapabilities(const EhtCapabilities &ehtCapabilities)
Set the EHT capabilities.
void SetStatusCode(StatusCode code)
Set the status code.
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:730
void SetVhtOperation(const VhtOperation &vhtOperation)
Set the VHT operation.
void SetHeOperation(const HeOperation &heOperation)
Set the HE operation.
void SetAssociationId(uint16_t aid)
Set the association ID.
void SetCapabilities(const CapabilityInformation &capabilities)
Set the Capability information.
const std::optional< MuEdcaParameterSet > & GetMuEdcaParameterSet() const
Return the MU EDCA Parameter Set, if present.
const std::optional< VhtOperation > & GetVhtOperation() const
Return the VHT operation, if present.
std::optional< EhtOperation > m_ehtOperation
EHT Operation.
Definition: mgt-headers.h:745
uint32_t Deserialize(Buffer::Iterator start) override
void SetEhtOperation(const EhtOperation &ehtOperation)
Set the EHT operation.
void SetVhtCapabilities(const VhtCapabilities &vhtCapabilities)
Set the VHT capabilities.
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:731
std::optional< MuEdcaParameterSet > m_muEdcaParameterSet
MU EDCA Parameter Set.
Definition: mgt-headers.h:743
std::optional< HtCapabilities > m_htCapability
HT capabilities.
Definition: mgt-headers.h:735
const std::optional< EdcaParameterSet > & GetEdcaParameterSet() const
Return the EDCA Parameter Set, if present.
std::optional< ExtendedCapabilities > m_extendedCapability
extended capabilities
Definition: mgt-headers.h:734
const std::optional< ErpInformation > & GetErpInformation() const
Return the ERP information, if present.
const std::optional< HeCapabilities > & GetHeCapabilities() const
Return the HE capabilities, if present.
std::optional< EhtCapabilities > m_ehtCapability
EHT capabilities.
Definition: mgt-headers.h:744
std::optional< VhtOperation > m_vhtOperation
VHT operation.
Definition: mgt-headers.h:738
const std::optional< ExtendedCapabilities > & GetExtendedCapabilities() const
Return the extended capabilities, if present.
const std::optional< VhtCapabilities > & GetVhtCapabilities() const
Return the VHT capabilities, if present.
const std::optional< HtCapabilities > & GetHtCapabilities() const
Return the HT capabilities, if present.
std::optional< MultiLinkElement > m_multiLinkElement
Multi-Link Element.
Definition: mgt-headers.h:746
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void Print(std::ostream &os) const override
void SetSupportedRates(const SupportedRates &rates)
Set the supported rates.
const std::optional< HeOperation > & GetHeOperation() const
Return the HE operation, if present.
const std::optional< EhtCapabilities > & GetEhtCapabilities() const
Return the EHT capabilities, if present.
const std::optional< HtOperation > & GetHtOperation() const
Return the HT operation, if present.
void SetExtendedCapabilities(const ExtendedCapabilities &extendedCapabilities)
Set the extended capabilities.
uint32_t GetSerializedSize() const override
const SupportedRates & GetSupportedRates() const
Return the supported rates.
uint16_t GetAssociationId() const
Return the association ID.
std::optional< EdcaParameterSet > m_edcaParameterSet
EDCA Parameter Set.
Definition: mgt-headers.h:740
void SetHtCapabilities(const HtCapabilities &htCapabilities)
Set the HT capabilities.
void SetMultiLinkElement(const MultiLinkElement &multiLinkElement)
Set the Multi-Link Element information element.
std::optional< ErpInformation > m_erpInformation
ERP information.
Definition: mgt-headers.h:739
const CapabilityInformation & GetCapabilities() const
Return the Capability information.
void SetErpInformation(const ErpInformation &erpInformation)
Set the ERP information.
std::optional< HeCapabilities > m_heCapability
HE capabilities.
Definition: mgt-headers.h:741
std::optional< HtOperation > m_htOperation
HT operation.
Definition: mgt-headers.h:736
StatusCode m_code
Status code.
Definition: mgt-headers.h:732
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:1257
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:904
Implement the header for management frames of type Delete Block Ack.
Definition: mgt-headers.h:1761
static TypeId GetTypeId()
Register this type.
void SetTid(uint8_t tid)
Set Traffic ID (TID).
uint32_t Deserialize(Buffer::Iterator start) override
void SetByRecipient()
Un-set the initiator bit in the DELBA.
void Print(std::ostream &os) const override
uint16_t m_initiator
initiator
Definition: mgt-headers.h:1819
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint8_t GetTid() const
Return the Traffic ID (TID).
uint16_t m_reasonCode
Not used for now.
Definition: mgt-headers.h:1821
bool IsByOriginator() const
Check if the initiator bit in the DELBA is set.
uint16_t GetParameterSet() const
Return the raw parameter set.
void Serialize(Buffer::Iterator start) const override
uint16_t m_tid
Traffic ID.
Definition: mgt-headers.h:1820
uint32_t GetSerializedSize() const override
void SetByOriginator()
Set the initiator bit in the DELBA.
Implement the header for management frames of type probe request.
Definition: mgt-headers.h:754
const Ssid & GetSsid() const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:53
void SetSsid(const Ssid &ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:41
std::optional< VhtCapabilities > m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:893
std::optional< HeCapabilities > m_heCapability
HE capabilities.
Definition: mgt-headers.h:894
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:889
const std::optional< EhtCapabilities > & GetEhtCapabilities() const
Return the EHT capabilities, if present.
Definition: mgt-headers.cc:155
uint32_t GetSerializedSize() const override
Definition: mgt-headers.cc:167
const SupportedRates & GetSupportedRates() const
Return the supported rates.
Definition: mgt-headers.cc:161
~MgtProbeRequestHeader() override
Definition: mgt-headers.cc:36
const std::optional< VhtCapabilities > & GetVhtCapabilities() const
Return the VHT capabilities, if present.
Definition: mgt-headers.cc:119
void SetSupportedRates(const SupportedRates &rates)
Set the supported rates.
Definition: mgt-headers.cc:59
void SetEhtCapabilities(const EhtCapabilities &ehtCapabilities)
Set the EHT capabilities.
Definition: mgt-headers.cc:143
void Serialize(Buffer::Iterator start) const override
Definition: mgt-headers.cc:243
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:890
void SetVhtCapabilities(const VhtCapabilities &vhtCapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:107
const std::optional< HeCapabilities > & GetHeCapabilities() const
Return the HE capabilities, if present.
Definition: mgt-headers.cc:137
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:200
const std::optional< ExtendedCapabilities > & GetExtendedCapabilities() const
Return the extended capabilities, if present.
Definition: mgt-headers.cc:83
std::optional< ExtendedCapabilities > m_extendedCapability
extended capabilities
Definition: mgt-headers.h:891
uint32_t Deserialize(Buffer::Iterator start) override
Definition: mgt-headers.cc:275
std::optional< EhtCapabilities > m_ehtCapability
EHT capabilities.
Definition: mgt-headers.h:895
void SetHeCapabilities(const HeCapabilities &heCapabilities)
Set the HE capabilities.
Definition: mgt-headers.cc:125
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:210
void Print(std::ostream &os) const override
Definition: mgt-headers.cc:216
std::optional< HtCapabilities > m_htCapability
HT capabilities.
Definition: mgt-headers.h:892
void SetHtCapabilities(const HtCapabilities &htCapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:89
void SetExtendedCapabilities(const ExtendedCapabilities &extendedCapabilities)
Set the extended capabilities.
Definition: mgt-headers.cc:71
const std::optional< HtCapabilities > & GetHtCapabilities() const
Return the HT capabilities, if present.
Definition: mgt-headers.cc:101
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:903
uint64_t GetTimestamp() const
Return the time stamp.
Definition: mgt-headers.cc:307
uint64_t m_beaconInterval
Beacon interval.
Definition: mgt-headers.h:1231
std::optional< HeCapabilities > m_heCapability
HE capabilities.
Definition: mgt-headers.h:1240
void SetVhtOperation(const VhtOperation &vhtOperation)
Set the VHT operation.
Definition: mgt-headers.cc:421
std::optional< HeOperation > m_heOperation
HE operation.
Definition: mgt-headers.h:1241
const std::optional< DsssParameterSet > & GetDsssParameterSet() const
Return the DSSS Parameter Set, if present.
Definition: mgt-headers.cc:553
std::optional< EdcaParameterSet > m_edcaParameterSet
EDCA Parameter Set.
Definition: mgt-headers.h:1243
std::optional< EhtCapabilities > m_ehtCapability
EHT capabilities.
Definition: mgt-headers.h:1245
const std::optional< VhtCapabilities > & GetVhtCapabilities() const
Return the VHT capabilities, if present.
Definition: mgt-headers.cc:415
static TypeId GetTypeId()
Register this type.
Definition: mgt-headers.cc:649
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:659
const std::optional< ExtendedCapabilities > & GetExtendedCapabilities() const
Return the extended capabilities, if present.
Definition: mgt-headers.cc:361
void Print(std::ostream &os) const override
Definition: mgt-headers.cc:741
void SetHtOperation(const HtOperation &htOperation)
Set the HT operation.
Definition: mgt-headers.cc:385
uint32_t Deserialize(Buffer::Iterator start) override
Definition: mgt-headers.cc:863
const std::optional< MuEdcaParameterSet > & GetMuEdcaParameterSet() const
Return the MU EDCA Parameter Set, if present.
Definition: mgt-headers.cc:631
std::optional< EhtOperation > m_ehtOperation
EHT Operation.
Definition: mgt-headers.h:1246
std::optional< ReducedNeighborReport > m_reducedNeighborReport
Reduced Neighbor Report information.
Definition: mgt-headers.h:1248
std::optional< HtOperation > m_htOperation
HT operation.
Definition: mgt-headers.h:1237
const Ssid & GetSsid() const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:313
void SetDsssParameterSet(const DsssParameterSet &dsssParameterSet)
Set the DSSS Parameter Set.
Definition: mgt-headers.cc:541
Ssid m_ssid
Service set ID (SSID)
Definition: mgt-headers.h:1230
const std::optional< ErpInformation > & GetErpInformation() const
Return the ERP information, if present.
Definition: mgt-headers.cc:571
void SetCapabilities(const CapabilityInformation &capabilities)
Set the Capability information.
Definition: mgt-headers.cc:331
std::optional< VhtOperation > m_vhtOperation
VHT operation.
Definition: mgt-headers.h:1239
const std::optional< HeOperation > & GetHeOperation() const
Return the HE operation, if present.
Definition: mgt-headers.cc:469
const std::optional< HtOperation > & GetHtOperation() const
Return the HT operation, if present.
Definition: mgt-headers.cc:397
const std::optional< EdcaParameterSet > & GetEdcaParameterSet() const
Return the EDCA Parameter Set, if present.
Definition: mgt-headers.cc:625
std::optional< MultiLinkElement > m_multiLinkElement
Multi-Link Element.
Definition: mgt-headers.h:1249
const std::optional< ReducedNeighborReport > & GetReducedNeighborReport() const
Return the Reduced Neighbor Report information element, if present.
Definition: mgt-headers.cc:637
void SetReducedNeighborReport(const ReducedNeighborReport &reducedNeighborReport)
Set the Reduced Neighbor Report information element.
Definition: mgt-headers.cc:601
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:1232
const CapabilityInformation & GetCapabilities() const
Return the Capability information.
Definition: mgt-headers.cc:343
void SetEhtCapabilities(const EhtCapabilities &ehtCapabilities)
Set the EHT capabilities.
Definition: mgt-headers.cc:475
void SetVhtCapabilities(const VhtCapabilities &vhtCapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:403
void SetHtCapabilities(const HtCapabilities &htCapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:367
const std::optional< MultiLinkElement > & GetMultiLinkElement() const
Return the Multi-Link Element information element, if present.
Definition: mgt-headers.cc:643
void SetSsid(const Ssid &ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:511
std::optional< ErpInformation > m_erpInformation
ERP information.
Definition: mgt-headers.h:1242
std::optional< DsssParameterSet > m_dsssParameterSet
DSSS Parameter Set.
Definition: mgt-headers.h:1234
void SetSupportedRates(const SupportedRates &rates)
Set the supported rates.
Definition: mgt-headers.cc:529
void SetHeOperation(const HeOperation &heOperation)
Set the HE operation.
Definition: mgt-headers.cc:457
void SetErpInformation(const ErpInformation &erpInformation)
Set the ERP information.
Definition: mgt-headers.cc:559
void SetExtendedCapabilities(const ExtendedCapabilities &extendedCapabilities)
Set the extended capabilities.
Definition: mgt-headers.cc:349
const std::optional< EhtCapabilities > & GetEhtCapabilities() const
Return the EHT capabilities, if present.
Definition: mgt-headers.cc:487
std::optional< MuEdcaParameterSet > m_muEdcaParameterSet
MU EDCA Parameter Set.
Definition: mgt-headers.h:1244
void SetBeaconIntervalUs(uint64_t us)
Set the beacon interval in microseconds unit.
Definition: mgt-headers.cc:523
uint64_t GetBeaconIntervalUs() const
Return the beacon interval in microseconds unit.
Definition: mgt-headers.cc:319
void Serialize(Buffer::Iterator start) const override
Definition: mgt-headers.cc:788
void SetEdcaParameterSet(const EdcaParameterSet &edcaParameterSet)
Set the EDCA Parameter Set.
Definition: mgt-headers.cc:577
uint32_t GetSerializedSize() const override
Definition: mgt-headers.cc:665
void SetHeCapabilities(const HeCapabilities &heCapabilities)
Set the HE capabilities.
Definition: mgt-headers.cc:439
std::optional< ExtendedCapabilities > m_extendedCapability
extended capabilities
Definition: mgt-headers.h:1235
void SetMuEdcaParameterSet(const MuEdcaParameterSet &muEdcaParameterSet)
Set the MU EDCA Parameter Set.
Definition: mgt-headers.cc:589
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:1233
std::optional< VhtCapabilities > m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:1238
const std::optional< HtCapabilities > & GetHtCapabilities() const
Return the HT capabilities, if present.
Definition: mgt-headers.cc:379
const std::optional< VhtOperation > & GetVhtOperation() const
Return the VHT operation, if present.
Definition: mgt-headers.cc:433
uint64_t m_timestamp
Timestamp.
Definition: mgt-headers.h:1229
const std::optional< EhtOperation > & GetEhtOperation() const
Return the EHT operation, if present.
Definition: mgt-headers.cc:505
const SupportedRates & GetSupportedRates() const
Return the supported rates.
Definition: mgt-headers.cc:325
std::optional< HtCapabilities > m_htCapability
HT capabilities.
Definition: mgt-headers.h:1236
const std::optional< HeCapabilities > & GetHeCapabilities() const
Return the HE capabilities, if present.
Definition: mgt-headers.cc:451
void SetMultiLinkElement(const MultiLinkElement &multiLinkElement)
Set the Multi-Link Element information element.
Definition: mgt-headers.cc:613
void SetEhtOperation(const EhtOperation &ehtOperation)
Set the EHT operation.
Definition: mgt-headers.cc:493
Implement the header for management frames of type reassociation request.
Definition: mgt-headers.h:248
const CapabilityInformation & GetCapabilities() const
Return the Capability information.
Mac48Address m_currentApAddr
Address of the current access point.
Definition: mgt-headers.h:429
void Serialize(Buffer::Iterator start) const override
uint16_t m_listenInterval
listen interval
Definition: mgt-headers.h:437
uint16_t GetListenInterval() const
Return the listen interval.
std::optional< MultiLinkElement > m_multiLinkElement
Multi-Link Element.
Definition: mgt-headers.h:439
const SupportedRates & GetSupportedRates() const
Return the supported rates.
std::optional< ExtendedCapabilities > m_extendedCapability
Extended capabilities.
Definition: mgt-headers.h:433
uint32_t GetSerializedSize() const override
void SetEhtCapabilities(const EhtCapabilities &ehtCapabilities)
Set the EHT capabilities.
static TypeId GetTypeId()
Register this type.
std::optional< EhtCapabilities > m_ehtCapability
EHT capabilities.
Definition: mgt-headers.h:438
std::optional< VhtCapabilities > m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:435
void SetExtendedCapabilities(const ExtendedCapabilities &extendedCapabilities)
Set the Extended Capabilities.
void Print(std::ostream &os) const override
const std::optional< MultiLinkElement > & GetMultiLinkElement() const
Return the Multi-Link Element information element, if present.
std::optional< HeCapabilities > m_heCapability
HE capabilities.
Definition: mgt-headers.h:436
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:431
void SetMultiLinkElement(const MultiLinkElement &multiLinkElement)
Set the Multi-Link Element information element.
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:430
const std::optional< EhtCapabilities > & GetEhtCapabilities() const
Return the EHT capabilities, if present.
void SetCapabilities(const CapabilityInformation &capabilities)
Set the Capability information.
const std::optional< HtCapabilities > & GetHtCapabilities() const
Return the HT capabilities, if present.
const std::optional< VhtCapabilities > & GetVhtCapabilities() const
Return the VHT capabilities, if present.
void SetListenInterval(uint16_t interval)
Set the listen interval.
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:432
const std::optional< HeCapabilities > & GetHeCapabilities() const
Return the HE capabilities, if present.
void SetSupportedRates(const SupportedRates &rates)
Set the supported rates.
void SetVhtCapabilities(const VhtCapabilities &vhtCapabilities)
Set the VHT capabilities.
void SetHtCapabilities(const HtCapabilities &htCapabilities)
Set the HT capabilities.
const Ssid & GetSsid() const
Return the Service Set Identifier (SSID).
uint32_t Deserialize(Buffer::Iterator start) override
std::optional< HtCapabilities > m_htCapability
HT capabilities.
Definition: mgt-headers.h:434
void SetSsid(const Ssid &ssid)
Set the Service Set Identifier (SSID).
void SetCurrentApAddress(Mac48Address currentApAddr)
Set the address of the current access point.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetHeCapabilities(const HeCapabilities &heCapabilities)
Set the HE capabilities.
const std::optional< ExtendedCapabilities > & GetExtendedCapabilities() const
Return the extended capabilities, if present.
The MU EDCA Parameter Set.
The Reduced Neighbor Report element.
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
Status code for association response.
Definition: status-code.h:32
Buffer::Iterator Serialize(Buffer::Iterator start) const
Definition: status-code.cc:54
Buffer::Iterator Deserialize(Buffer::Iterator start)
Definition: status-code.cc:61
uint32_t GetSerializedSize() const
Definition: status-code.cc:48
The Supported Rates Information Element.
uint8_t GetNRates() const
Return the number of supported rates.
std::optional< ExtendedSupportedRatesIE > extended
extended supported rates info element
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
The IEEE 802.11ac VHT Capabilities.
The VHT Operation Information Element.
Definition: vht-operation.h:36
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:1279
uint32_t GetSerializedSize() const override
SelfProtectedActionValue
SelfProtectedActionValue enumeration.
Definition: mgt-headers.h:1374
uint8_t m_category
Category of the action.
Definition: mgt-headers.h:1502
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
std::string CategoryValueToString(CategoryValue value) const
Category value to string function.
CategoryValue
CategoryValue enumeration.
Definition: mgt-headers.h:1291
std::string SelfProtectedActionValueToString(SelfProtectedActionValue value) const
Self protected action value to string function.
uint8_t m_actionValue
Action value.
Definition: mgt-headers.h:1503
uint32_t Deserialize(Buffer::Iterator start) override
void Print(std::ostream &os) const override
static TypeId GetTypeId()
Register this type.
void SetAction(CategoryValue type, ActionValue action)
Set action for this Action header.
~WifiActionHeader() override
void Serialize(Buffer::Iterator start) const override
@ DMG_MULTI_RELAY_CHANNEL_MEASUREMENT_REQUEST
Definition: mgt-headers.h:1398
@ DMG_MULTI_RELAY_CHANNEL_MEASUREMENT_REPORT
Definition: mgt-headers.h:1399
CategoryValue GetCategory() const
Return the category value.
ActionValue GetAction() const
Return the action value.
uint16_t GetSerializedSize() const
Get the size of the serialized IE including Element ID and length fields (for every element this IE i...
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize entire IE (which may possibly be fragmented into multiple elements), which must be presen...
static Buffer::Iterator DeserializeIfPresent(std::optional< IE > &optElem, Buffer::Iterator i, Args &&... args)
Deserialize an entire IE (which may possibly be fragmented into multiple elements) that is optionally...
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize entire IE including Element ID and length fields.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ WIFI_MAC_MGT_BEACON
@ WIFI_MAC_MGT_ASSOCIATION_RESPONSE
@ WIFI_MAC_MGT_ASSOCIATION_REQUEST
@ WIFI_MAC_MGT_REASSOCIATION_REQUEST
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
value
Definition: second.py:41
ssid
Definition: third.py:86
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
ns3::Time timeout
typedef for union of different ActionValues
Definition: mgt-headers.h:1444
UnprotectedDmgActionValue unprotectedDmgAction
unprotected dmg
Definition: mgt-headers.h:1454
SelfProtectedActionValue selfProtectedAction
self protected
Definition: mgt-headers.h:1449
MultihopActionValue multihopAction
multi hop
Definition: mgt-headers.h:1450
RadioMeasurementActionValue radioMeasurementAction
radio measurement
Definition: mgt-headers.h:1447
PublicActionValue publicAction
public
Definition: mgt-headers.h:1448
BlockAckActionValue blockAck
block ack
Definition: mgt-headers.h:1446