This documentation is not the Latest Release.
A Discrete-Event Network Simulator
API
mgt-headers.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 
23 #include <sstream>
24 #include "mgt-headers.h"
25 #include "ns3/simulator.h"
26 #include "ns3/assert.h"
27 
28 namespace ns3 {
29 
30 /***********************************************************
31  * Probe Request
32  ***********************************************************/
33 
34 NS_OBJECT_ENSURE_REGISTERED (MgtProbeRequestHeader);
35 
37 {
38 }
39 
40 void
42 {
43  m_ssid = ssid;
44 }
45 
46 Ssid
48 {
49  return m_ssid;
50 }
51 
52 void
54 {
55  m_rates = rates;
56 }
57 
58 void
60 {
61  m_htCapability = htcapabilities;
62 }
63 
66 {
67  return m_htCapability;
68 }
69 
70 void
72 {
73  m_vhtCapability = vhtcapabilities;
74 }
75 
78 {
79  return m_vhtCapability;
80 }
81 
84 {
85  return m_rates;
86 }
87 
88 uint32_t
90 {
91  uint32_t size = 0;
92  size += m_ssid.GetSerializedSize ();
93  size += m_rates.GetSerializedSize ();
97  return size;
98 }
99 
100 TypeId
102 {
103  static TypeId tid = TypeId ("ns3::MgtProbeRequestHeader")
104  .SetParent<Header> ()
105  .SetGroupName ("Wifi")
106  .AddConstructor<MgtProbeRequestHeader> ()
107  ;
108  return tid;
109 }
110 
111 TypeId
113 {
114  return GetTypeId ();
115 }
116 
117 void
118 MgtProbeRequestHeader::Print (std::ostream &os) const
119 {
120  os << "ssid=" << m_ssid << ", "
121  << "rates=" << m_rates << ", "
122  << "HT Capabilities=" << m_htCapability << " , "
123  << "VHT Capabilities= " << m_vhtCapability;
124 }
125 
126 void
128 {
130  i = m_ssid.Serialize (i);
131  i = m_rates.Serialize (i);
132  i = m_rates.extended.Serialize (i);
133  i = m_htCapability.Serialize (i);
134  i = m_vhtCapability.Serialize (i);
135 }
136 
137 uint32_t
139 {
141  i = m_ssid.Deserialize (i);
142  i = m_rates.Deserialize (i);
146  return i.GetDistanceFrom (start);
147 }
148 
149 
150 /***********************************************************
151  * Probe Response
152  ***********************************************************/
153 
155 
157 {
158 }
159 
161 {
162 }
163 
164 uint64_t
166 {
167  return m_timestamp;
168 }
169 
170 Ssid
172 {
173  return m_ssid;
174 }
175 
176 uint64_t
178 {
179  return m_beaconInterval;
180 }
181 
184 {
185  return m_rates;
186 }
187 
188 void
190 {
191  m_capability = capabilities;
192 }
193 
196 {
197  return m_capability;
198 }
199 
200 void
202 {
203  m_htCapability = htcapabilities;
204 }
205 
208 {
209  return m_htCapability;
210 }
211 
212 void
214 {
215  m_vhtCapability = vhtcapabilities;
216 }
217 
220 {
221  return m_vhtCapability;
222 }
223 
224 void
226 {
227  m_ssid = ssid;
228 }
229 
230 void
232 {
233  m_beaconInterval = us;
234 }
235 
236 void
238 {
239  m_rates = rates;
240 }
241 
242 TypeId
244 {
245  static TypeId tid = TypeId ("ns3::MgtProbeResponseHeader")
246  .SetParent<Header> ()
247  .SetGroupName ("Wifi")
248  .AddConstructor<MgtProbeResponseHeader> ()
249  ;
250  return tid;
251 }
252 
253 TypeId
255 {
256  return GetTypeId ();
257 }
258 
259 uint32_t
261 {
262  uint32_t size = 0;
263  size += 8; //timestamp
264  size += 2; //beacon interval
265  size += m_capability.GetSerializedSize ();
266  size += m_ssid.GetSerializedSize ();
267  size += m_rates.GetSerializedSize ();
268  //size += 3; //ds parameter set
272  return size;
273 }
274 
275 void
276 MgtProbeResponseHeader::Print (std::ostream &os) const
277 {
278  os << "ssid=" << m_ssid << ", "
279  << "rates=" << m_rates << ", "
280  << "HT Capabilities=" << m_htCapability << " , "
281  << "VHT Capabilities= " << m_vhtCapability;
282 }
283 
284 void
286 {
287  //timestamp
288  //beacon interval
289  //capability information
290  //ssid
291  //supported rates
292  //fh parameter set
293  //ds parameter set
294  //cf parameter set
295  //ibss parameter set
297  i.WriteHtolsbU64 (Simulator::Now ().GetMicroSeconds ());
298  i.WriteHtolsbU16 (m_beaconInterval / 1024);
299  i = m_capability.Serialize (i);
300  i = m_ssid.Serialize (i);
301  i = m_rates.Serialize (i);
302  //i.WriteU8 (0, 3); //ds parameter set.
303  i = m_rates.extended.Serialize (i);
304  i = m_htCapability.Serialize (i);
305  i = m_vhtCapability.Serialize (i);
306 }
307 
308 uint32_t
310 {
312  m_timestamp = i.ReadLsbtohU64 ();
314  m_beaconInterval *= 1024;
315  i = m_capability.Deserialize (i);
316  i = m_ssid.Deserialize (i);
317  i = m_rates.Deserialize (i);
318  //i.Next (3); //ds parameter set
322  return i.GetDistanceFrom (start);
323 }
324 
325 
326 /***********************************************************
327  * Beacons
328  ***********************************************************/
329 
331 
332 /* static */
333 TypeId
335 {
336  static TypeId tid = TypeId ("ns3::MgtBeaconHeader")
338  .SetGroupName ("Wifi")
339  .AddConstructor<MgtBeaconHeader> ()
340  ;
341  return tid;
342 }
343 
344 
345 /***********************************************************
346  * Assoc Request
347  ***********************************************************/
348 
350 
352  : m_listenInterval (0)
353 {
354 }
355 
357 {
358 }
359 
360 void
362 {
363  m_ssid = ssid;
364 }
365 
366 void
368 {
369  m_rates = rates;
370 }
371 
372 void
374 {
375  m_listenInterval = interval;
376 }
377 
378 void
380 {
381  m_capability = capabilities;
382 }
383 
386 {
387  return m_capability;
388 }
389 
390 void
392 {
393  m_htCapability = htcapabilities;
394 }
395 
398 {
399  return m_htCapability;
400 }
401 
402 void
404 {
405  m_vhtCapability = vhtcapabilities;
406 }
407 
410 {
411  return m_vhtCapability;
412 }
413 
414 Ssid
416 {
417  return m_ssid;
418 }
419 
422 {
423  return m_rates;
424 }
425 
426 uint16_t
428 {
429  return m_listenInterval;
430 }
431 
432 TypeId
434 {
435  static TypeId tid = TypeId ("ns3::MgtAssocRequestHeader")
436  .SetParent<Header> ()
437  .SetGroupName ("Wifi")
438  .AddConstructor<MgtAssocRequestHeader> ()
439  ;
440  return tid;
441 }
442 
443 TypeId
445 {
446  return GetTypeId ();
447 }
448 
449 uint32_t
451 {
452  uint32_t size = 0;
453  size += m_capability.GetSerializedSize ();
454  size += 2;
455  size += m_ssid.GetSerializedSize ();
456  size += m_rates.GetSerializedSize ();
460  return size;
461 }
462 
463 void
464 MgtAssocRequestHeader::Print (std::ostream &os) const
465 {
466  os << "ssid=" << m_ssid << ", "
467  << "rates=" << m_rates << ", "
468  << "HT Capabilities=" << m_htCapability << " , "
469  << "VHT Capabilities= " << m_vhtCapability;
470 }
471 
472 void
474 {
476  i = m_capability.Serialize (i);
478  i = m_ssid.Serialize (i);
479  i = m_rates.Serialize (i);
480  i = m_rates.extended.Serialize (i);
481  i = m_htCapability.Serialize (i);
482  i = m_vhtCapability.Serialize (i);
483 }
484 
485 uint32_t
487 {
489  i = m_capability.Deserialize (i);
491  i = m_ssid.Deserialize (i);
492  i = m_rates.Deserialize (i);
496  return i.GetDistanceFrom (start);
497 }
498 
499 
500 /***********************************************************
501  * Assoc Response
502  ***********************************************************/
503 
505 
507  : m_aid (0)
508 {
509 }
510 
512 {
513 }
514 
517 {
518  return m_code;
519 }
520 
523 {
524  return m_rates;
525 }
526 
527 void
529 {
530  m_code = code;
531 }
532 
533 void
535 {
536  m_rates = rates;
537 }
538 
539 void
541 {
542  m_capability = capabilities;
543 }
544 
547 {
548  return m_capability;
549 }
550 
551 void
553 {
554  m_htCapability = htcapabilities;
555 }
556 
557 void
559 {
560  m_vhtCapability = vhtcapabilities;
561 }
562 
565 {
566  return m_vhtCapability;
567 }
568 
571 {
572  return m_htCapability;
573 }
574 
575 TypeId
577 {
578  static TypeId tid = TypeId ("ns3::MgtAssocResponseHeader")
579  .SetParent<Header> ()
580  .SetGroupName ("Wifi")
581  .AddConstructor<MgtAssocResponseHeader> ()
582  ;
583  return tid;
584 }
585 
586 TypeId
588 {
589  return GetTypeId ();
590 }
591 
592 uint32_t
594 {
595  uint32_t size = 0;
596  size += m_capability.GetSerializedSize ();
597  size += m_code.GetSerializedSize ();
598  size += 2; //aid
599  size += m_rates.GetSerializedSize ();
603  return size;
604 }
605 
606 void
607 MgtAssocResponseHeader::Print (std::ostream &os) const
608 {
609  os << "status code=" << m_code << ", "
610  << "rates=" << m_rates << ", "
611  << "HT Capabilities=" << m_htCapability << " , "
612  << "VHT Capabilities= " << m_vhtCapability;
613 }
614 
615 void
617 {
619  i = m_capability.Serialize (i);
620  i = m_code.Serialize (i);
621  i.WriteHtolsbU16 (m_aid);
622  i = m_rates.Serialize (i);
623  i = m_rates.extended.Serialize (i);
624  i = m_htCapability.Serialize (i);
625  i = m_vhtCapability.Serialize (i);
626 }
627 
628 uint32_t
630 {
632  i = m_capability.Deserialize (i);
633  i = m_code.Deserialize (i);
634  m_aid = i.ReadLsbtohU16 ();
635  i = m_rates.Deserialize (i);
639  return i.GetDistanceFrom (start);
640 }
641 
642 
643 /**********************************************************
644  * ActionFrame
645  **********************************************************/
647 {
648 }
649 
651 {
652 }
653 
654 void
657 {
658  m_category = type;
659  switch (type)
660  {
661  case BLOCK_ACK:
662  {
663  m_actionValue = action.blockAck;
664  break;
665  }
666  case MESH:
667  {
668  m_actionValue = action.meshAction;
669  break;
670  }
671  case MULTIHOP:
672  {
673  m_actionValue = action.multihopAction;
674  break;
675  }
676  case SELF_PROTECTED:
677  {
679  break;
680  }
682  {
683  break;
684  }
685  }
686 }
687 
690 {
691  switch (m_category)
692  {
693  case BLOCK_ACK:
694  return BLOCK_ACK;
695  case MESH:
696  return MESH;
697  case MULTIHOP:
698  return MULTIHOP;
699  case SELF_PROTECTED:
700  return SELF_PROTECTED;
702  return VENDOR_SPECIFIC_ACTION;
703  default:
704  NS_FATAL_ERROR ("Unknown action value");
705  return SELF_PROTECTED;
706  }
707 }
708 
711 {
712  ActionValue retval;
713  retval.selfProtectedAction = PEER_LINK_OPEN; //Needs to be initialized to something to quiet valgrind in default cases
714  switch (m_category)
715  {
716  case BLOCK_ACK:
717  switch (m_actionValue)
718  {
721  break;
724  break;
725  case BLOCK_ACK_DELBA:
726  retval.blockAck = BLOCK_ACK_DELBA;
727  break;
728  }
729  break;
730 
731  case SELF_PROTECTED:
732  switch (m_actionValue)
733  {
734  case PEER_LINK_OPEN:
736  break;
737  case PEER_LINK_CONFIRM:
739  break;
740  case PEER_LINK_CLOSE:
742  break;
743  case GROUP_KEY_INFORM:
745  break;
746  case GROUP_KEY_ACK:
748  break;
749  default:
750  NS_FATAL_ERROR ("Unknown mesh peering management action code");
751  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
752  }
753  break;
754 
755  case MESH:
756  switch (m_actionValue)
757  {
758  case LINK_METRIC_REPORT:
760  break;
761  case PATH_SELECTION:
762  retval.meshAction = PATH_SELECTION;
763  break;
764  case PORTAL_ANNOUNCEMENT:
766  break;
769  break;
770  case MDA_SETUP_REQUEST:
771  retval.meshAction = MDA_SETUP_REQUEST;
772  break;
773  case MDA_SETUP_REPLY:
774  retval.meshAction = MDA_SETUP_REPLY;
775  break;
778  break;
779  case MDAOP_ADVERTISMENTS:
781  break;
782  case MDAOP_SET_TEARDOWN:
784  break;
787  break;
790  break;
791  default:
792  NS_FATAL_ERROR ("Unknown mesh peering management action code");
793  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
794  }
795  break;
796 
797  case MULTIHOP: //not yet supported
798  switch (m_actionValue)
799  {
800  case PROXY_UPDATE: //not used so far
801  retval.multihopAction = PROXY_UPDATE;
802  break;
803  case PROXY_UPDATE_CONFIRMATION: //not used so far
804  retval.multihopAction = PROXY_UPDATE;
805  break;
806  default:
807  NS_FATAL_ERROR ("Unknown mesh peering management action code");
808  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
809  }
810  break;
811  default:
812  NS_FATAL_ERROR ("Unsupported mesh action");
813  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
814  }
815  return retval;
816 }
817 
818 TypeId
820 {
821  static TypeId tid = TypeId ("ns3::WifiActionHeader")
822  .SetParent<Header> ()
823  .SetGroupName ("Wifi")
824  .AddConstructor<WifiActionHeader> ()
825  ;
826  return tid;
827 }
828 
829 TypeId
831 {
832  return GetTypeId ();
833 }
834 
835 std::string
837 {
838  if (value == BLOCK_ACK)
839  {
840  return "BlockAck";
841  }
842  else if (value == MESH)
843  {
844  return "Mesh";
845  }
846  else if (value == SELF_PROTECTED)
847  {
848  return "SelfProtected";
849  }
850  else if (value == VENDOR_SPECIFIC_ACTION)
851  {
852  return "VendorSpecificAction";
853  }
854  else
855  {
856  std::ostringstream convert;
857  convert << value;
858  return convert.str ();
859  }
860 }
861 std::string
863 {
864  if (value == PEER_LINK_OPEN)
865  {
866  return "PeerLinkOpen";
867  }
868  else if (value == PEER_LINK_CONFIRM)
869  {
870  return "PeerLinkConfirm";
871  }
872  else if (value == PEER_LINK_CLOSE)
873  {
874  return "PeerLinkClose";
875  }
876  else if (value == GROUP_KEY_INFORM)
877  {
878  return "GroupKeyInform";
879  }
880  else if (value == GROUP_KEY_ACK)
881  {
882  return "GroupKeyAck";
883  }
884  else
885  {
886  std::ostringstream convert;
887  convert << value;
888  return convert.str ();
889  }
890 }
891 
892 void
893 WifiActionHeader::Print (std::ostream &os) const
894 {
895  os << "category=" << CategoryValueToString ((CategoryValue) m_category)
897 }
898 
899 uint32_t
901 {
902  return 2;
903 }
904 
905 void
907 {
908  start.WriteU8 (m_category);
909  start.WriteU8 (m_actionValue);
910 }
911 
912 uint32_t
914 {
916  m_category = i.ReadU8 ();
917  m_actionValue = i.ReadU8 ();
918  return i.GetDistanceFrom (start);
919 }
920 
921 
922 /***************************************************
923 * ADDBARequest
924 ****************************************************/
925 
927 
929  : m_dialogToken (1),
930  m_amsduSupport (1),
931  m_bufferSize (0)
932 {
933 }
934 
935 TypeId
937 {
938  static TypeId tid = TypeId ("ns3::MgtAddBaRequestHeader")
939  .SetParent<Header> ()
940  .SetGroupName ("Wifi")
941  .AddConstructor<MgtAddBaRequestHeader> ()
942  ;
943  return tid;
944 }
945 
946 TypeId
948 {
949  return GetTypeId ();
950 }
951 
952 void
953 MgtAddBaRequestHeader::Print (std::ostream &os) const
954 {
955 }
956 
957 uint32_t
959 {
960  uint32_t size = 0;
961  size += 1; //Dialog token
962  size += 2; //Block ack parameter set
963  size += 2; //Block ack timeout value
964  size += 2; //Starting sequence control
965  return size;
966 }
967 
968 void
970 {
976 }
977 
978 uint32_t
980 {
982  m_dialogToken = i.ReadU8 ();
986  return i.GetDistanceFrom (start);
987 }
988 
989 void
991 {
992  m_policy = 0;
993 }
994 
995 void
997 {
998  m_policy = 1;
999 }
1000 
1001 void
1003 {
1004  NS_ASSERT (tid < 16);
1005  m_tid = tid;
1006 }
1007 
1008 void
1010 {
1012 }
1013 
1014 void
1016 {
1017  m_bufferSize = size;
1018 }
1019 
1020 void
1022 {
1023  m_startingSeq = seq;
1024 }
1025 
1026 void
1028 {
1029  m_startingSeq = (seqControl >> 4) & 0x0fff;
1030 }
1031 
1032 void
1034 {
1035  m_amsduSupport = supported;
1036 }
1037 
1038 uint8_t
1040 {
1041  return m_tid;
1042 }
1043 
1044 bool
1046 {
1047  return (m_policy == 1) ? true : false;
1048 }
1049 
1050 uint16_t
1052 {
1053  return m_timeoutValue;
1054 }
1055 
1056 uint16_t
1058 {
1059  return m_bufferSize;
1060 }
1061 
1062 bool
1064 {
1065  return (m_amsduSupport == 1) ? true : false;
1066 }
1067 
1068 uint16_t
1070 {
1071  return m_startingSeq;
1072 }
1073 
1074 uint16_t
1076 {
1077  return (m_startingSeq << 4) & 0xfff0;
1078 }
1079 
1080 uint16_t
1082 {
1083  uint16_t res = 0;
1084  res |= m_amsduSupport;
1085  res |= m_policy << 1;
1086  res |= m_tid << 2;
1087  res |= m_bufferSize << 6;
1088  return res;
1089 }
1090 
1091 void
1093 {
1094  m_amsduSupport = (params) & 0x01;
1095  m_policy = (params >> 1) & 0x01;
1096  m_tid = (params >> 2) & 0x0f;
1097  m_bufferSize = (params >> 6) & 0x03ff;
1098 }
1099 
1100 
1101 /***************************************************
1102 * ADDBAResponse
1103 ****************************************************/
1104 
1106 
1108  : m_dialogToken (1),
1109  m_amsduSupport (1),
1110  m_bufferSize (0)
1111 {
1112 }
1113 
1114 TypeId
1116 {
1117  static TypeId tid = TypeId ("ns3::MgtAddBaResponseHeader")
1118  .SetParent<Header> ()
1119  .SetGroupName ("Wifi")
1120  .AddConstructor<MgtAddBaResponseHeader> ()
1121  ;
1122  return tid;
1123 }
1124 
1125 TypeId
1127 {
1128  return GetTypeId ();
1129 }
1130 
1131 void
1132 MgtAddBaResponseHeader::Print (std::ostream &os) const
1133 {
1134  os << "status code=" << m_code;
1135 }
1136 
1137 uint32_t
1139 {
1140  uint32_t size = 0;
1141  size += 1; //Dialog token
1142  size += m_code.GetSerializedSize (); //Status code
1143  size += 2; //Block ack parameter set
1144  size += 2; //Block ack timeout value
1145  return size;
1146 }
1147 
1148 void
1150 {
1151  Buffer::Iterator i = start;
1152  i.WriteU8 (m_dialogToken);
1153  i = m_code.Serialize (i);
1156 }
1157 
1158 uint32_t
1160 {
1161  Buffer::Iterator i = start;
1162  m_dialogToken = i.ReadU8 ();
1163  i = m_code.Deserialize (i);
1166  return i.GetDistanceFrom (start);
1167 }
1168 
1169 void
1171 {
1172  m_policy = 0;
1173 }
1174 
1175 void
1177 {
1178  m_policy = 1;
1179 }
1180 
1181 void
1183 {
1184  NS_ASSERT (tid < 16);
1185  m_tid = tid;
1186 }
1187 
1188 void
1190 {
1192 }
1193 
1194 void
1196 {
1197  m_bufferSize = size;
1198 }
1199 
1200 void
1202 {
1203  m_code = code;
1204 }
1205 
1206 void
1208 {
1209  m_amsduSupport = supported;
1210 }
1211 
1212 StatusCode
1214 {
1215  return m_code;
1216 }
1217 
1218 uint8_t
1220 {
1221  return m_tid;
1222 }
1223 
1224 bool
1226 {
1227  return (m_policy == 1) ? true : false;
1228 }
1229 
1230 uint16_t
1232 {
1233  return m_timeoutValue;
1234 }
1235 
1236 uint16_t
1238 {
1239  return m_bufferSize;
1240 }
1241 
1242 bool
1244 {
1245  return (m_amsduSupport == 1) ? true : false;
1246 }
1247 
1248 uint16_t
1250 {
1251  uint16_t res = 0;
1252  res |= m_amsduSupport;
1253  res |= m_policy << 1;
1254  res |= m_tid << 2;
1255  res |= m_bufferSize << 6;
1256  return res;
1257 }
1258 
1259 void
1261 {
1262  m_amsduSupport = (params) & 0x01;
1263  m_policy = (params >> 1) & 0x01;
1264  m_tid = (params >> 2) & 0x0f;
1265  m_bufferSize = (params >> 6) & 0x03ff;
1266 }
1267 
1268 
1269 /***************************************************
1270 * DelBa
1271 ****************************************************/
1272 
1274 
1276  : m_reasonCode (1)
1277 {
1278 }
1279 
1280 TypeId
1282 {
1283  static TypeId tid = TypeId ("ns3::MgtDelBaHeader")
1284  .SetParent<Header> ()
1285  .SetGroupName ("Wifi")
1286  .AddConstructor<MgtDelBaHeader> ()
1287  ;
1288  return tid;
1289 }
1290 
1291 TypeId
1293 {
1294  return GetTypeId ();
1295 }
1296 
1297 void
1298 MgtDelBaHeader::Print (std::ostream &os) const
1299 {
1300 }
1301 
1302 uint32_t
1304 {
1305  uint32_t size = 0;
1306  size += 2; //DelBa parameter set
1307  size += 2; //Reason code
1308  return size;
1309 }
1310 
1311 void
1313 {
1314  Buffer::Iterator i = start;
1317 }
1318 
1319 uint32_t
1321 {
1322  Buffer::Iterator i = start;
1324  m_reasonCode = i.ReadLsbtohU16 ();
1325  return i.GetDistanceFrom (start);
1326 }
1327 
1328 bool
1330 {
1331  return (m_initiator == 1) ? true : false;
1332 }
1333 
1334 uint8_t
1336 {
1337  NS_ASSERT (m_tid < 16);
1338  uint8_t tid = static_cast<uint8_t> (m_tid);
1339  return tid;
1340 }
1341 
1342 void
1344 {
1345  m_initiator = 1;
1346 }
1347 
1348 void
1350 {
1351  m_initiator = 0;
1352 }
1353 
1354 void
1356 {
1357  NS_ASSERT (tid < 16);
1358  m_tid = static_cast<uint16_t> (tid);
1359 }
1360 
1361 uint16_t
1363 {
1364  uint16_t res = 0;
1365  res |= m_initiator << 11;
1366  res |= m_tid << 12;
1367  return res;
1368 }
1369 
1370 void
1372 {
1373  m_initiator = (params >> 11) & 0x01;
1374  m_tid = (params >> 12) & 0x0f;
1375 }
1376 
1377 } //namespace ns3
Protocol header serialization and deserialization.
Definition: header.h:42
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:979
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:83
uint16_t GetBufferSize(void) const
Return the buffer size.
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:616
StatusCode m_code
Status code.
Definition: mgt-headers.h:811
virtual uint32_t GetSerializedSize(void) const
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:183
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:444
Implement the header for management frames of type association request.
Definition: mgt-headers.h:42
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:379
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:813
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:893
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:77
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize capability information from the given buffer.
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:546
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:254
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:171
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:226
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:433
uint16_t m_timeoutValue
Timeout.
Definition: mgt-headers.h:694
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:452
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:953
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:309
uint64_t GetBeaconIntervalUs(void) const
Return the beacon interval in microseconds unit.
Definition: mgt-headers.cc:177
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:135
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:101
void SetImmediateBlockAck()
Enable immediate Block ACK.
Definition: mgt-headers.cc:996
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:418
def start()
Definition: core.py:1482
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:227
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:419
uint16_t GetSerializedSize() const
Return the serialized size of this supported rates information element.
void SetBufferSize(uint16_t size)
Set buffer size.
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:571
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:137
#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
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:310
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:450
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:391
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:189
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:361
uint32_t GetSerializedSize(void) const
Definition: status-code.cc:50
virtual void Print(std::ostream &os) const
uint16_t m_startingSeq
Starting sequence number.
Definition: mgt-headers.h:695
void SetAction(enum CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:655
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize capability information to the given buffer.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:145
std::string CategoryValueToString(CategoryValue value) const
Definition: mgt-headers.cc:836
uint16_t GetBufferSize(void) const
Return the buffer size.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:564
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:689
void SetDelayedBlockAck()
Enable delayed Block ACK.
ns3::Time timeout
void SetTid(uint8_t)
Set Traffic ID (TID).
void SetStatusCode(StatusCode code)
Set the status code.
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:136
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:693
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:112
void SetTimeout(uint16_t timeout)
Set timeout.
Buffer::Iterator Deserialize(Buffer::Iterator i)
Deserialize entire IE, which must be present.
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:47
Capability information.
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:53
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
uint32_t GetDistanceFrom(Iterator const &o) const
Definition: buffer.cc:783
uint16_t GetSerializedSize() const
Get the size of the serialized IE including Element ID and length fields.
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:415
iterator in a Buffer instance
Definition: buffer.h:98
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:367
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
uint16_t GetStartingSequenceControl(void) const
Return the raw sequence control.
virtual void Serialize(Buffer::Iterator start) const
void SetTid(uint8_t tid)
Set Traffic ID (TID).
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:276
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:285
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:219
ExtendedSupportedRatesIE extended
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:421
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:373
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:819
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:812
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:947
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:830
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:692
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:308
enum MultihopActionValue multihopAction
Definition: mgt-headers.h:522
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:385
virtual uint32_t GetSerializedSize() const
Definition: mgt-headers.cc:900
The IEEE 802.11ac VHT Capabilities.
void SetStartingSequenceControl(uint16_t seqControl)
Set sequence control with the given raw value.
void SetImmediateBlockAck()
Enable immediate Block ACK.
Buffer::Iterator Serialize(Buffer::Iterator start) const
This information element is a bit special in that it is only included if there are more than 8 rates...
void SetTid(uint8_t tid)
Set Traffic ID (TID).
uint16_t GetListenInterval(void) const
Return the listen interval.
Definition: mgt-headers.cc:427
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
enum MeshActionValue meshAction
Definition: mgt-headers.h:521
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:118
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:138
enum BlockAckActionValue blockAck
Definition: mgt-headers.h:524
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:690
Buffer::Iterator DeserializeIfPresent(Buffer::Iterator i)
Deserialize entire IE if it is present.
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:969
uint8_t GetTid(void) const
Return the Traffic ID (TID).
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:558
SupportedRates GetSupportedRates(void)
Return the supported rates.
Definition: mgt-headers.cc:522
uint64_t m_timestamp
Timestamp.
Definition: mgt-headers.h:415
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:59
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:587
uint64_t GetTimestamp()
Return the time stamp.
Definition: mgt-headers.cc:165
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:958
Buffer::Iterator Serialize(Buffer::Iterator start) const
Definition: status-code.cc:56
void SetByOriginator(void)
Set the initiator bit in the DELBA.
Status code for association response.
Definition: status-code.h:33
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:225
std::string SelfProtectedActionValueToString(SelfProtectedActionValue value) const
Definition: mgt-headers.cc:862
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:464
void SetByRecipient(void)
Un-set the initiator bit in the DELBA.
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
static TypeId GetTypeId(void)
Register this type.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:409
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:421
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual uint32_t GetSerializedSize(void) const
void SetBeaconIntervalUs(uint64_t us)
Set the beacon interval in microseconds unit.
Definition: mgt-headers.cc:231
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:243
void SetBufferSize(uint16_t size)
Set buffer size.
Buffer::Iterator Deserialize(Buffer::Iterator start)
Definition: status-code.cc:63
uint8_t GetTid(void) const
Return the Traffic ID (TID).
virtual void Serialize(Buffer::Iterator start) const
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:913
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:207
StatusCode GetStatusCode(void) const
Return the status code.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:65
bool IsByOriginator(void) const
Check if the initiator bit in the DELBA is setted.
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:403
tuple ssid
Definition: third.py:93
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:138
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:420
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:309
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:223
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:334
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:814
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:607
Buffer::Iterator Serialize(Buffer::Iterator start) const
uint16_t GetTimeout(void) const
Return the timeout.
uint8_t GetTid(void) const
Return the Traffic ID (TID).
uint8_t m_actionValue
Action value.
Definition: mgt-headers.h:563
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:38
Implement the header for management frames of type probe request.
Definition: mgt-headers.h:239
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:213
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
enum SelfProtectedActionValue selfProtectedAction
Definition: mgt-headers.h:523
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:910
Implement the header for management frames of type association response.
Definition: mgt-headers.h:147
virtual uint32_t Deserialize(Buffer::Iterator start)
StatusCode m_code
Status code.
Definition: mgt-headers.h:228
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:540
uint16_t m_tid
Traffic ID.
Definition: mgt-headers.h:884
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:936
void WriteU8(uint8_t data)
Definition: buffer.h:863
uint16_t GetSerializedSize() const
void WriteHtolsbU64(uint64_t data)
Definition: buffer.cc:926
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:576
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:534
uint16_t GetParameterSet(void) const
Return the raw parameter set.
uint32_t GetSerializedSize(void) const
Return the serialized size of capability information.
Implement the header for management frames of type add block ack response.
Definition: mgt-headers.h:703
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:824
typedef for union of different ActionValues
Definition: mgt-headers.h:519
uint8_t ReadU8(void)
Definition: buffer.h:1015
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:691
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:230
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:237
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:307
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:552
uint16_t ReadLsbtohU16(void)
Definition: buffer.cc:1065
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:195
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:41
void SetStatusCode(StatusCode code)
Set the status code.
Definition: mgt-headers.cc:528
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
uint8_t m_category
Category of the action.
Definition: mgt-headers.h:562
void SetDelayedBlockAck()
Enable delayed Block ACK.
Definition: mgt-headers.cc:990
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:486
void SetTimeout(uint16_t timeout)
Set timeout.
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:318
uint64_t ReadLsbtohU64(void)
Definition: buffer.cc:1093
uint16_t GetSerializedSize() const
Return the serialized size of this HT capability information element.
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:231
uint16_t GetParameterSet(void) const
Return the raw parameter set.
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:710
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:815
uint16_t GetParameterSet(void) const
Return the raw parameter set.
uint64_t m_beaconInterval
Beacon interval.
Definition: mgt-headers.h:417
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:89
Buffer::Iterator Serialize(Buffer::Iterator start) const
This information element is a bit special in that it is only included if the STA is an HT STA...
uint16_t m_timeoutValue
Timeout.
Definition: mgt-headers.h:816
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:134
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:397
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:260
a unique identifier for an interface.
Definition: type-id.h:58
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:127
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:826
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:201
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:429
Buffer::Iterator Serialize(Buffer::Iterator i) const
Serialize entire IE including Element ID and length fields.
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:629
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:593
StatusCode GetStatusCode(void)
Return the status code.
Definition: mgt-headers.cc:516
Ssid m_ssid
Service set ID (SSID)
Definition: mgt-headers.h:416
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:71
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:906
virtual uint32_t Deserialize(Buffer::Iterator start)
uint16_t GetTimeout(void) const
Return the timeout.
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:570
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:473