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_htCapability = htcapabilities;
192 }
193 
196 {
197  return m_htCapability;
198 }
199 
200 void
202 {
203  m_vhtCapability = vhtcapabilities;
204 }
205 
208 {
209  return m_vhtCapability;
210 }
211 
212 void
214 {
215  m_ssid = ssid;
216 }
217 
218 void
220 {
221  m_beaconInterval = us;
222 }
223 
224 void
226 {
227  m_rates = rates;
228 }
229 
230 TypeId
232 {
233  static TypeId tid = TypeId ("ns3::MgtProbeResponseHeader")
234  .SetParent<Header> ()
235  .SetGroupName ("Wifi")
236  .AddConstructor<MgtProbeResponseHeader> ()
237  ;
238  return tid;
239 }
240 
241 TypeId
243 {
244  return GetTypeId ();
245 }
246 
247 uint32_t
249 {
250  uint32_t size = 0;
251  size += 8; //timestamp
252  size += 2; //beacon interval
253  size += m_capability.GetSerializedSize ();
254  size += m_ssid.GetSerializedSize ();
255  size += m_rates.GetSerializedSize ();
256  //size += 3; //ds parameter set
260  return size;
261 }
262 
263 void
264 MgtProbeResponseHeader::Print (std::ostream &os) const
265 {
266  os << "ssid=" << m_ssid << ", "
267  << "rates=" << m_rates << ", "
268  << "HT Capabilities=" << m_htCapability << " , "
269  << "VHT Capabilities= " << m_vhtCapability;
270 }
271 
272 void
274 {
275  //timestamp
276  //beacon interval
277  //capability information
278  //ssid
279  //supported rates
280  //fh parameter set
281  //ds parameter set
282  //cf parameter set
283  //ibss parameter set
285  i.WriteHtolsbU64 (Simulator::Now ().GetMicroSeconds ());
286  i.WriteHtolsbU16 (m_beaconInterval / 1024);
287  i = m_capability.Serialize (i);
288  i = m_ssid.Serialize (i);
289  i = m_rates.Serialize (i);
290  //i.WriteU8 (0, 3); //ds parameter set.
291  i = m_rates.extended.Serialize (i);
292  i = m_htCapability.Serialize (i);
293  i = m_vhtCapability.Serialize (i);
294 }
295 
296 uint32_t
298 {
300  m_timestamp = i.ReadLsbtohU64 ();
302  m_beaconInterval *= 1024;
303  i = m_capability.Deserialize (i);
304  i = m_ssid.Deserialize (i);
305  i = m_rates.Deserialize (i);
306  //i.Next (3); //ds parameter set
310  return i.GetDistanceFrom (start);
311 }
312 
313 
314 /***********************************************************
315  * Beacons
316  ***********************************************************/
317 
319 
320 /* static */
321 TypeId
323 {
324  static TypeId tid = TypeId ("ns3::MgtBeaconHeader")
326  .SetGroupName ("Wifi")
327  .AddConstructor<MgtBeaconHeader> ()
328  ;
329  return tid;
330 }
331 
332 
333 /***********************************************************
334  * Assoc Request
335  ***********************************************************/
336 
338 
340  : m_listenInterval (0)
341 {
342 }
343 
345 {
346 }
347 
348 void
350 {
351  m_ssid = ssid;
352 }
353 
354 void
356 {
357  m_rates = rates;
358 }
359 
360 void
362 {
363  m_htCapability = htcapabilities;
364 }
365 
366 void
368 {
369  m_listenInterval = interval;
370 }
371 
372 void
374 {
375  m_vhtCapability = vhtcapabilities;
376 }
377 
380 {
381  return m_vhtCapability;
382 }
383 
386 {
387  return m_htCapability;
388 }
389 
390 Ssid
392 {
393  return m_ssid;
394 }
395 
398 {
399  return m_rates;
400 }
401 
402 uint16_t
404 {
405  return m_listenInterval;
406 }
407 
408 TypeId
410 {
411  static TypeId tid = TypeId ("ns3::MgtAssocRequestHeader")
412  .SetParent<Header> ()
413  .SetGroupName ("Wifi")
414  .AddConstructor<MgtAssocRequestHeader> ()
415  ;
416  return tid;
417 }
418 
419 TypeId
421 {
422  return GetTypeId ();
423 }
424 
425 uint32_t
427 {
428  uint32_t size = 0;
429  size += m_capability.GetSerializedSize ();
430  size += 2;
431  size += m_ssid.GetSerializedSize ();
432  size += m_rates.GetSerializedSize ();
436  return size;
437 }
438 
439 void
440 MgtAssocRequestHeader::Print (std::ostream &os) const
441 {
442  os << "ssid=" << m_ssid << ", "
443  << "rates=" << m_rates << ", "
444  << "HT Capabilities=" << m_htCapability << " , "
445  << "VHT Capabilities= " << m_vhtCapability;
446 }
447 
448 void
450 {
452  i = m_capability.Serialize (i);
454  i = m_ssid.Serialize (i);
455  i = m_rates.Serialize (i);
456  i = m_rates.extended.Serialize (i);
457  i = m_htCapability.Serialize (i);
458  i = m_vhtCapability.Serialize (i);
459 }
460 
461 uint32_t
463 {
465  i = m_capability.Deserialize (i);
467  i = m_ssid.Deserialize (i);
468  i = m_rates.Deserialize (i);
472  return i.GetDistanceFrom (start);
473 }
474 
475 
476 /***********************************************************
477  * Assoc Response
478  ***********************************************************/
479 
481 
483  : m_aid (0)
484 {
485 }
486 
488 {
489 }
490 
493 {
494  return m_code;
495 }
496 
499 {
500  return m_rates;
501 }
502 
503 void
505 {
506  m_code = code;
507 }
508 
509 void
511 {
512  m_rates = rates;
513 }
514 
515 void
517 {
518  m_htCapability = htcapabilities;
519 }
520 
521 void
523 {
524  m_vhtCapability = vhtcapabilities;
525 }
526 
529 {
530  return m_vhtCapability;
531 }
532 
535 {
536  return m_htCapability;
537 }
538 
539 TypeId
541 {
542  static TypeId tid = TypeId ("ns3::MgtAssocResponseHeader")
543  .SetParent<Header> ()
544  .SetGroupName ("Wifi")
545  .AddConstructor<MgtAssocResponseHeader> ()
546  ;
547  return tid;
548 }
549 
550 TypeId
552 {
553  return GetTypeId ();
554 }
555 
556 uint32_t
558 {
559  uint32_t size = 0;
560  size += m_capability.GetSerializedSize ();
561  size += m_code.GetSerializedSize ();
562  size += 2; //aid
563  size += m_rates.GetSerializedSize ();
567  return size;
568 }
569 
570 void
571 MgtAssocResponseHeader::Print (std::ostream &os) const
572 {
573  os << "status code=" << m_code << ", "
574  << "rates=" << m_rates << ", "
575  << "HT Capabilities=" << m_htCapability << " , "
576  << "VHT Capabilities= " << m_vhtCapability;
577 }
578 
579 void
581 {
583  i = m_capability.Serialize (i);
584  i = m_code.Serialize (i);
585  i.WriteHtolsbU16 (m_aid);
586  i = m_rates.Serialize (i);
587  i = m_rates.extended.Serialize (i);
588  i = m_htCapability.Serialize (i);
589  i = m_vhtCapability.Serialize (i);
590 }
591 
592 uint32_t
594 {
596  i = m_capability.Deserialize (i);
597  i = m_code.Deserialize (i);
598  m_aid = i.ReadLsbtohU16 ();
599  i = m_rates.Deserialize (i);
603  return i.GetDistanceFrom (start);
604 }
605 
606 
607 /**********************************************************
608  * ActionFrame
609  **********************************************************/
611 {
612 }
613 
615 {
616 }
617 
618 void
621 {
622  m_category = type;
623  switch (type)
624  {
625  case BLOCK_ACK:
626  {
627  m_actionValue = action.blockAck;
628  break;
629  }
630  case MESH:
631  {
632  m_actionValue = action.meshAction;
633  break;
634  }
635  case MULTIHOP:
636  {
637  m_actionValue = action.multihopAction;
638  break;
639  }
640  case SELF_PROTECTED:
641  {
643  break;
644  }
646  {
647  break;
648  }
649  }
650 }
651 
654 {
655  switch (m_category)
656  {
657  case BLOCK_ACK:
658  return BLOCK_ACK;
659  case MESH:
660  return MESH;
661  case MULTIHOP:
662  return MULTIHOP;
663  case SELF_PROTECTED:
664  return SELF_PROTECTED;
666  return VENDOR_SPECIFIC_ACTION;
667  default:
668  NS_FATAL_ERROR ("Unknown action value");
669  return SELF_PROTECTED;
670  }
671 }
672 
675 {
676  ActionValue retval;
677  retval.selfProtectedAction = PEER_LINK_OPEN; //Needs to be initialized to something to quiet valgrind in default cases
678  switch (m_category)
679  {
680  case BLOCK_ACK:
681  switch (m_actionValue)
682  {
685  break;
688  break;
689  case BLOCK_ACK_DELBA:
690  retval.blockAck = BLOCK_ACK_DELBA;
691  break;
692  }
693  break;
694 
695  case SELF_PROTECTED:
696  switch (m_actionValue)
697  {
698  case PEER_LINK_OPEN:
700  break;
701  case PEER_LINK_CONFIRM:
703  break;
704  case PEER_LINK_CLOSE:
706  break;
707  case GROUP_KEY_INFORM:
709  break;
710  case GROUP_KEY_ACK:
712  break;
713  default:
714  NS_FATAL_ERROR ("Unknown mesh peering management action code");
715  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
716  }
717  break;
718 
719  case MESH:
720  switch (m_actionValue)
721  {
722  case LINK_METRIC_REPORT:
724  break;
725  case PATH_SELECTION:
726  retval.meshAction = PATH_SELECTION;
727  break;
728  case PORTAL_ANNOUNCEMENT:
730  break;
733  break;
734  case MDA_SETUP_REQUEST:
735  retval.meshAction = MDA_SETUP_REQUEST;
736  break;
737  case MDA_SETUP_REPLY:
738  retval.meshAction = MDA_SETUP_REPLY;
739  break;
742  break;
743  case MDAOP_ADVERTISMENTS:
745  break;
746  case MDAOP_SET_TEARDOWN:
748  break;
751  break;
754  break;
755  default:
756  NS_FATAL_ERROR ("Unknown mesh peering management action code");
757  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
758  }
759  break;
760 
761  case MULTIHOP: //not yet supported
762  switch (m_actionValue)
763  {
764  case PROXY_UPDATE: //not used so far
765  retval.multihopAction = PROXY_UPDATE;
766  break;
767  case PROXY_UPDATE_CONFIRMATION: //not used so far
768  retval.multihopAction = PROXY_UPDATE;
769  break;
770  default:
771  NS_FATAL_ERROR ("Unknown mesh peering management action code");
772  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
773  }
774  break;
775  default:
776  NS_FATAL_ERROR ("Unsupported mesh action");
777  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
778  }
779  return retval;
780 }
781 
782 TypeId
784 {
785  static TypeId tid = TypeId ("ns3::WifiActionHeader")
786  .SetParent<Header> ()
787  .SetGroupName ("Wifi")
788  .AddConstructor<WifiActionHeader> ()
789  ;
790  return tid;
791 }
792 
793 TypeId
795 {
796  return GetTypeId ();
797 }
798 
799 std::string
801 {
802  if (value == BLOCK_ACK)
803  {
804  return "BlockAck";
805  }
806  else if (value == MESH)
807  {
808  return "Mesh";
809  }
810  else if (value == SELF_PROTECTED)
811  {
812  return "SelfProtected";
813  }
814  else if (value == VENDOR_SPECIFIC_ACTION)
815  {
816  return "VendorSpecificAction";
817  }
818  else
819  {
820  std::ostringstream convert;
821  convert << value;
822  return convert.str ();
823  }
824 }
825 std::string
827 {
828  if (value == PEER_LINK_OPEN)
829  {
830  return "PeerLinkOpen";
831  }
832  else if (value == PEER_LINK_CONFIRM)
833  {
834  return "PeerLinkConfirm";
835  }
836  else if (value == PEER_LINK_CLOSE)
837  {
838  return "PeerLinkClose";
839  }
840  else if (value == GROUP_KEY_INFORM)
841  {
842  return "GroupKeyInform";
843  }
844  else if (value == GROUP_KEY_ACK)
845  {
846  return "GroupKeyAck";
847  }
848  else
849  {
850  std::ostringstream convert;
851  convert << value;
852  return convert.str ();
853  }
854 }
855 
856 void
857 WifiActionHeader::Print (std::ostream &os) const
858 {
859  os << "category=" << CategoryValueToString ((CategoryValue) m_category)
861 }
862 
863 uint32_t
865 {
866  return 2;
867 }
868 
869 void
871 {
872  start.WriteU8 (m_category);
873  start.WriteU8 (m_actionValue);
874 }
875 
876 uint32_t
878 {
880  m_category = i.ReadU8 ();
881  m_actionValue = i.ReadU8 ();
882  return i.GetDistanceFrom (start);
883 }
884 
885 
886 /***************************************************
887 * ADDBARequest
888 ****************************************************/
889 
891 
893  : m_dialogToken (1),
894  m_amsduSupport (1),
895  m_bufferSize (0)
896 {
897 }
898 
899 TypeId
901 {
902  static TypeId tid = TypeId ("ns3::MgtAddBaRequestHeader")
903  .SetParent<Header> ()
904  .SetGroupName ("Wifi")
905  .AddConstructor<MgtAddBaRequestHeader> ()
906  ;
907  return tid;
908 }
909 
910 TypeId
912 {
913  return GetTypeId ();
914 }
915 
916 void
917 MgtAddBaRequestHeader::Print (std::ostream &os) const
918 {
919 }
920 
921 uint32_t
923 {
924  uint32_t size = 0;
925  size += 1; //Dialog token
926  size += 2; //Block ack parameter set
927  size += 2; //Block ack timeout value
928  size += 2; //Starting sequence control
929  return size;
930 }
931 
932 void
934 {
940 }
941 
942 uint32_t
944 {
946  m_dialogToken = i.ReadU8 ();
950  return i.GetDistanceFrom (start);
951 }
952 
953 void
955 {
956  m_policy = 0;
957 }
958 
959 void
961 {
962  m_policy = 1;
963 }
964 
965 void
967 {
968  NS_ASSERT (tid < 16);
969  m_tid = tid;
970 }
971 
972 void
974 {
976 }
977 
978 void
980 {
981  m_bufferSize = size;
982 }
983 
984 void
986 {
987  m_startingSeq = seq;
988 }
989 
990 void
992 {
993  m_startingSeq = (seqControl >> 4) & 0x0fff;
994 }
995 
996 void
998 {
999  m_amsduSupport = supported;
1000 }
1001 
1002 uint8_t
1004 {
1005  return m_tid;
1006 }
1007 
1008 bool
1010 {
1011  return (m_policy == 1) ? true : false;
1012 }
1013 
1014 uint16_t
1016 {
1017  return m_timeoutValue;
1018 }
1019 
1020 uint16_t
1022 {
1023  return m_bufferSize;
1024 }
1025 
1026 bool
1028 {
1029  return (m_amsduSupport == 1) ? true : false;
1030 }
1031 
1032 uint16_t
1034 {
1035  return m_startingSeq;
1036 }
1037 
1038 uint16_t
1040 {
1041  return (m_startingSeq << 4) & 0xfff0;
1042 }
1043 
1044 uint16_t
1046 {
1047  uint16_t res = 0;
1048  res |= m_amsduSupport;
1049  res |= m_policy << 1;
1050  res |= m_tid << 2;
1051  res |= m_bufferSize << 6;
1052  return res;
1053 }
1054 
1055 void
1057 {
1058  m_amsduSupport = (params) & 0x01;
1059  m_policy = (params >> 1) & 0x01;
1060  m_tid = (params >> 2) & 0x0f;
1061  m_bufferSize = (params >> 6) & 0x03ff;
1062 }
1063 
1064 
1065 /***************************************************
1066 * ADDBAResponse
1067 ****************************************************/
1068 
1070 
1072  : m_dialogToken (1),
1073  m_amsduSupport (1),
1074  m_bufferSize (0)
1075 {
1076 }
1077 
1078 TypeId
1080 {
1081  static TypeId tid = TypeId ("ns3::MgtAddBaResponseHeader")
1082  .SetParent<Header> ()
1083  .SetGroupName ("Wifi")
1084  .AddConstructor<MgtAddBaResponseHeader> ()
1085  ;
1086  return tid;
1087 }
1088 
1089 TypeId
1091 {
1092  return GetTypeId ();
1093 }
1094 
1095 void
1096 MgtAddBaResponseHeader::Print (std::ostream &os) const
1097 {
1098  os << "status code=" << m_code;
1099 }
1100 
1101 uint32_t
1103 {
1104  uint32_t size = 0;
1105  size += 1; //Dialog token
1106  size += m_code.GetSerializedSize (); //Status code
1107  size += 2; //Block ack parameter set
1108  size += 2; //Block ack timeout value
1109  return size;
1110 }
1111 
1112 void
1114 {
1115  Buffer::Iterator i = start;
1116  i.WriteU8 (m_dialogToken);
1117  i = m_code.Serialize (i);
1120 }
1121 
1122 uint32_t
1124 {
1125  Buffer::Iterator i = start;
1126  m_dialogToken = i.ReadU8 ();
1127  i = m_code.Deserialize (i);
1130  return i.GetDistanceFrom (start);
1131 }
1132 
1133 void
1135 {
1136  m_policy = 0;
1137 }
1138 
1139 void
1141 {
1142  m_policy = 1;
1143 }
1144 
1145 void
1147 {
1148  NS_ASSERT (tid < 16);
1149  m_tid = tid;
1150 }
1151 
1152 void
1154 {
1156 }
1157 
1158 void
1160 {
1161  m_bufferSize = size;
1162 }
1163 
1164 void
1166 {
1167  m_code = code;
1168 }
1169 
1170 void
1172 {
1173  m_amsduSupport = supported;
1174 }
1175 
1176 StatusCode
1178 {
1179  return m_code;
1180 }
1181 
1182 uint8_t
1184 {
1185  return m_tid;
1186 }
1187 
1188 bool
1190 {
1191  return (m_policy == 1) ? true : false;
1192 }
1193 
1194 uint16_t
1196 {
1197  return m_timeoutValue;
1198 }
1199 
1200 uint16_t
1202 {
1203  return m_bufferSize;
1204 }
1205 
1206 bool
1208 {
1209  return (m_amsduSupport == 1) ? true : false;
1210 }
1211 
1212 uint16_t
1214 {
1215  uint16_t res = 0;
1216  res |= m_amsduSupport;
1217  res |= m_policy << 1;
1218  res |= m_tid << 2;
1219  res |= m_bufferSize << 6;
1220  return res;
1221 }
1222 
1223 void
1225 {
1226  m_amsduSupport = (params) & 0x01;
1227  m_policy = (params >> 1) & 0x01;
1228  m_tid = (params >> 2) & 0x0f;
1229  m_bufferSize = (params >> 6) & 0x03ff;
1230 }
1231 
1232 
1233 /***************************************************
1234 * DelBa
1235 ****************************************************/
1236 
1238 
1240  : m_reasonCode (1)
1241 {
1242 }
1243 
1244 TypeId
1246 {
1247  static TypeId tid = TypeId ("ns3::MgtDelBaHeader")
1248  .SetParent<Header> ()
1249  .SetGroupName ("Wifi")
1250  .AddConstructor<MgtDelBaHeader> ()
1251  ;
1252  return tid;
1253 }
1254 
1255 TypeId
1257 {
1258  return GetTypeId ();
1259 }
1260 
1261 void
1262 MgtDelBaHeader::Print (std::ostream &os) const
1263 {
1264 }
1265 
1266 uint32_t
1268 {
1269  uint32_t size = 0;
1270  size += 2; //DelBa parameter set
1271  size += 2; //Reason code
1272  return size;
1273 }
1274 
1275 void
1277 {
1278  Buffer::Iterator i = start;
1281 }
1282 
1283 uint32_t
1285 {
1286  Buffer::Iterator i = start;
1288  m_reasonCode = i.ReadLsbtohU16 ();
1289  return i.GetDistanceFrom (start);
1290 }
1291 
1292 bool
1294 {
1295  return (m_initiator == 1) ? true : false;
1296 }
1297 
1298 uint8_t
1300 {
1301  NS_ASSERT (m_tid < 16);
1302  uint8_t tid = static_cast<uint8_t> (m_tid);
1303  return tid;
1304 }
1305 
1306 void
1308 {
1309  m_initiator = 1;
1310 }
1311 
1312 void
1314 {
1315  m_initiator = 0;
1316 }
1317 
1318 void
1320 {
1321  NS_ASSERT (tid < 16);
1322  m_tid = static_cast<uint16_t> (tid);
1323 }
1324 
1325 uint16_t
1327 {
1328  uint16_t res = 0;
1329  res |= m_initiator << 11;
1330  res |= m_tid << 12;
1331  return res;
1332 }
1333 
1334 void
1336 {
1337  m_initiator = (params >> 11) & 0x01;
1338  m_tid = (params >> 12) & 0x0f;
1339 }
1340 
1341 } //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:943
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:580
StatusCode m_code
Status code.
Definition: mgt-headers.h:778
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:420
Implement the header for management frames of type association request.
Definition: mgt-headers.h:43
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:780
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:857
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.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:242
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:205
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:409
uint16_t m_timeoutValue
Timeout.
Definition: mgt-headers.h:661
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:419
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:917
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:288
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:126
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:101
void SetImmediateBlockAck()
Enable immediate Block ACK.
Definition: mgt-headers.cc:960
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:385
def start()
Definition: core.py:1482
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:206
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:386
uint16_t GetSerializedSize() const
Return the serialized size of this supported rates information element.
void SetBufferSize(uint16_t size)
Set buffer size.
Definition: mgt-headers.cc:979
Implement the header for management frames of type add block ack request.
Definition: mgt-headers.h:538
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:128
#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:289
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:426
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:361
void SetSsid(Ssid ssid)
Set the Service Set Identifier (SSID).
Definition: mgt-headers.cc:349
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:662
void SetAction(enum CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:619
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:800
uint16_t GetBufferSize(void) const
Return the buffer size.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:528
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:653
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:127
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:660
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
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:53
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:997
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:391
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:355
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:264
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:273
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:207
ExtendedSupportedRatesIE extended
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:397
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:367
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:783
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:779
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:911
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:794
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:659
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:287
enum MultihopActionValue multihopAction
Definition: mgt-headers.h:489
virtual uint32_t GetSerializedSize() const
Definition: mgt-headers.cc:864
The IEEE 802.11ac VHT Capabilities.
void SetStartingSequenceControl(uint16_t seqControl)
Set sequence control with the given raw value.
Definition: mgt-headers.cc:991
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).
Definition: mgt-headers.cc:966
uint16_t GetListenInterval(void) const
Return the listen interval.
Definition: mgt-headers.cc:403
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
enum MeshActionValue meshAction
Definition: mgt-headers.h:488
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:491
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:657
Buffer::Iterator DeserializeIfPresent(Buffer::Iterator i)
Deserialize entire IE if it is present.
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
Definition: mgt-headers.cc:985
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:933
uint8_t GetTid(void) const
Return the Traffic ID (TID).
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:522
SupportedRates GetSupportedRates(void)
Return the supported rates.
Definition: mgt-headers.cc:498
uint64_t m_timestamp
Timestamp.
Definition: mgt-headers.h:382
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:551
uint64_t GetTimestamp()
Return the time stamp.
Definition: mgt-headers.cc:165
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:922
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:213
std::string SelfProtectedActionValueToString(SelfProtectedActionValue value) const
Definition: mgt-headers.cc:826
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:440
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:379
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:388
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:219
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:231
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:877
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:195
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:373
tuple ssid
Definition: third.py:93
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:130
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:387
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:297
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:322
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:781
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:571
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:530
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:218
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:201
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
enum SelfProtectedActionValue selfProtectedAction
Definition: mgt-headers.h:490
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:910
Implement the header for management frames of type association response.
Definition: mgt-headers.h:138
virtual uint32_t Deserialize(Buffer::Iterator start)
StatusCode m_code
Status code.
Definition: mgt-headers.h:207
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
uint16_t m_tid
Traffic ID.
Definition: mgt-headers.h:851
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:900
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:540
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:510
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:670
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:791
typedef for union of different ActionValues
Definition: mgt-headers.h:486
uint8_t ReadU8(void)
Definition: buffer.h:1015
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:658
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:209
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:225
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:286
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:516
uint16_t ReadLsbtohU16(void)
Definition: buffer.cc:1065
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:504
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:529
void SetDelayedBlockAck()
Enable delayed Block ACK.
Definition: mgt-headers.cc:954
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:462
void SetTimeout(uint16_t timeout)
Set timeout.
Definition: mgt-headers.cc:973
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:297
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:210
uint16_t GetParameterSet(void) const
Return the raw parameter set.
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:674
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:782
uint16_t GetParameterSet(void) const
Return the raw parameter set.
uint64_t m_beaconInterval
Beacon interval.
Definition: mgt-headers.h:384
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:783
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:125
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:385
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:248
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:189
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:396
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:593
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:557
StatusCode GetStatusCode(void)
Return the status code.
Definition: mgt-headers.cc:492
Ssid m_ssid
Service set ID (SSID)
Definition: mgt-headers.h:383
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:71
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:870
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:534
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:449