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_htOperations = htoperations;
216 }
217 
220 {
221  return m_htOperations;
222 }
223 
224 void
226 {
227  m_vhtCapability = vhtcapabilities;
228 }
229 
232 {
233  return m_vhtCapability;
234 }
235 
236 void
238 {
239  m_ssid = ssid;
240 }
241 
242 void
244 {
245  m_beaconInterval = us;
246 }
247 
248 void
250 {
251  m_rates = rates;
252 }
253 
254 void
256 {
257  m_erpInformation = erpInformation;
258 }
259 
262 {
263  return m_erpInformation;
264 }
265 
266 TypeId
268 {
269  static TypeId tid = TypeId ("ns3::MgtProbeResponseHeader")
270  .SetParent<Header> ()
271  .SetGroupName ("Wifi")
272  .AddConstructor<MgtProbeResponseHeader> ()
273  ;
274  return tid;
275 }
276 
277 TypeId
279 {
280  return GetTypeId ();
281 }
282 
283 uint32_t
285 {
286  uint32_t size = 0;
287  size += 8; //timestamp
288  size += 2; //beacon interval
289  size += m_capability.GetSerializedSize ();
290  size += m_ssid.GetSerializedSize ();
291  size += m_rates.GetSerializedSize ();
292  //size += 3; //ds parameter set
298  return size;
299 }
300 
301 void
302 MgtProbeResponseHeader::Print (std::ostream &os) const
303 {
304  os << "ssid=" << m_ssid << ", "
305  << "rates=" << m_rates << ", "
306  << "ERP information=" << m_erpInformation << ", "
307  << "HT Capabilities=" << m_htCapability << " , "
308  << "HT Operations=" << m_htOperations << " , "
309  << "VHT Capabilities= " << m_vhtCapability;
310 }
311 
312 void
314 {
315  //timestamp
316  //beacon interval
317  //capability information
318  //ssid
319  //supported rates
320  //fh parameter set
321  //ds parameter set
322  //cf parameter set
323  //ibss parameter set
325  i.WriteHtolsbU64 (Simulator::Now ().GetMicroSeconds ());
326  i.WriteHtolsbU16 (m_beaconInterval / 1024);
327  i = m_capability.Serialize (i);
328  i = m_ssid.Serialize (i);
329  i = m_rates.Serialize (i);
330  //i.WriteU8 (0, 3); //ds parameter set.
331  i = m_erpInformation.Serialize (i);
332  i = m_rates.extended.Serialize (i);
333  i = m_htCapability.Serialize (i);
334  i = m_htOperations.Serialize (i);
335  i = m_vhtCapability.Serialize (i);
336 }
337 
338 uint32_t
340 {
342  m_timestamp = i.ReadLsbtohU64 ();
344  m_beaconInterval *= 1024;
345  i = m_capability.Deserialize (i);
346  i = m_ssid.Deserialize (i);
347  i = m_rates.Deserialize (i);
348  //i.Next (3); //ds parameter set
354  return i.GetDistanceFrom (start);
355 }
356 
357 
358 /***********************************************************
359  * Beacons
360  ***********************************************************/
361 
363 
364 /* static */
365 TypeId
367 {
368  static TypeId tid = TypeId ("ns3::MgtBeaconHeader")
370  .SetGroupName ("Wifi")
371  .AddConstructor<MgtBeaconHeader> ()
372  ;
373  return tid;
374 }
375 
376 
377 /***********************************************************
378  * Assoc Request
379  ***********************************************************/
380 
382 
384  : m_listenInterval (0)
385 {
386 }
387 
389 {
390 }
391 
392 void
394 {
395  m_ssid = ssid;
396 }
397 
398 void
400 {
401  m_rates = rates;
402 }
403 
404 void
406 {
407  m_listenInterval = interval;
408 }
409 
410 void
412 {
413  m_capability = capabilities;
414 }
415 
418 {
419  return m_capability;
420 }
421 
422 void
424 {
425  m_htCapability = htcapabilities;
426 }
427 
430 {
431  return m_htCapability;
432 }
433 
434 void
436 {
437  m_vhtCapability = vhtcapabilities;
438 }
439 
442 {
443  return m_vhtCapability;
444 }
445 
446 Ssid
448 {
449  return m_ssid;
450 }
451 
454 {
455  return m_rates;
456 }
457 
458 uint16_t
460 {
461  return m_listenInterval;
462 }
463 
464 TypeId
466 {
467  static TypeId tid = TypeId ("ns3::MgtAssocRequestHeader")
468  .SetParent<Header> ()
469  .SetGroupName ("Wifi")
470  .AddConstructor<MgtAssocRequestHeader> ()
471  ;
472  return tid;
473 }
474 
475 TypeId
477 {
478  return GetTypeId ();
479 }
480 
481 uint32_t
483 {
484  uint32_t size = 0;
485  size += m_capability.GetSerializedSize ();
486  size += 2;
487  size += m_ssid.GetSerializedSize ();
488  size += m_rates.GetSerializedSize ();
492  return size;
493 }
494 
495 void
496 MgtAssocRequestHeader::Print (std::ostream &os) const
497 {
498  os << "ssid=" << m_ssid << ", "
499  << "rates=" << m_rates << ", "
500  << "HT Capabilities=" << m_htCapability << " , "
501  << "VHT Capabilities= " << m_vhtCapability;
502 }
503 
504 void
506 {
508  i = m_capability.Serialize (i);
510  i = m_ssid.Serialize (i);
511  i = m_rates.Serialize (i);
512  i = m_rates.extended.Serialize (i);
513  i = m_htCapability.Serialize (i);
514  i = m_vhtCapability.Serialize (i);
515 }
516 
517 uint32_t
519 {
521  i = m_capability.Deserialize (i);
523  i = m_ssid.Deserialize (i);
524  i = m_rates.Deserialize (i);
528  return i.GetDistanceFrom (start);
529 }
530 
531 
532 /***********************************************************
533  * Assoc Response
534  ***********************************************************/
535 
537 
539  : m_aid (0)
540 {
541 }
542 
544 {
545 }
546 
549 {
550  return m_code;
551 }
552 
555 {
556  return m_rates;
557 }
558 
559 void
561 {
562  m_code = code;
563 }
564 
565 void
567 {
568  m_rates = rates;
569 }
570 
571 void
573 {
574  m_capability = capabilities;
575 }
576 
579 {
580  return m_capability;
581 }
582 
583 void
585 {
586  m_htCapability = htcapabilities;
587 }
588 
591 {
592  return m_htCapability;
593 }
594 
595 void
597 {
598  m_htOperations = htoperations;
599 }
600 
603 {
604  return m_htOperations;
605 }
606 
607 void
609 {
610  m_vhtCapability = vhtcapabilities;
611 }
612 
615 {
616  return m_vhtCapability;
617 }
618 
619 void
621 {
622  m_erpInformation = erpInformation;
623 }
624 
627 {
628  return m_erpInformation;
629 }
630 
631 
632 TypeId
634 {
635  static TypeId tid = TypeId ("ns3::MgtAssocResponseHeader")
636  .SetParent<Header> ()
637  .SetGroupName ("Wifi")
638  .AddConstructor<MgtAssocResponseHeader> ()
639  ;
640  return tid;
641 }
642 
643 TypeId
645 {
646  return GetTypeId ();
647 }
648 
649 uint32_t
651 {
652  uint32_t size = 0;
653  size += m_capability.GetSerializedSize ();
654  size += m_code.GetSerializedSize ();
655  size += 2; //aid
656  size += m_rates.GetSerializedSize ();
662  return size;
663 }
664 
665 void
666 MgtAssocResponseHeader::Print (std::ostream &os) const
667 {
668  os << "status code=" << m_code << ", "
669  << "rates=" << m_rates << ", "
670  << "ERP information=" << m_erpInformation << ", "
671  << "HT Capabilities=" << m_htCapability << " , "
672  << "HT Operations=" << m_htOperations << " , "
673  << "VHT Capabilities= " << m_vhtCapability;
674 }
675 
676 void
678 {
680  i = m_capability.Serialize (i);
681  i = m_code.Serialize (i);
682  i.WriteHtolsbU16 (m_aid);
683  i = m_rates.Serialize (i);
684  i = m_erpInformation.Serialize (i);
685  i = m_rates.extended.Serialize (i);
686  i = m_htCapability.Serialize (i);
687  i = m_htOperations.Serialize (i);
688  i = m_vhtCapability.Serialize (i);
689 }
690 
691 uint32_t
693 {
695  i = m_capability.Deserialize (i);
696  i = m_code.Deserialize (i);
697  m_aid = i.ReadLsbtohU16 ();
698  i = m_rates.Deserialize (i);
704  return i.GetDistanceFrom (start);
705 }
706 
707 
708 /**********************************************************
709  * ActionFrame
710  **********************************************************/
712 {
713 }
714 
716 {
717 }
718 
719 void
722 {
723  m_category = type;
724  switch (type)
725  {
726  case BLOCK_ACK:
727  {
728  m_actionValue = action.blockAck;
729  break;
730  }
731  case MESH:
732  {
733  m_actionValue = action.meshAction;
734  break;
735  }
736  case MULTIHOP:
737  {
738  m_actionValue = action.multihopAction;
739  break;
740  }
741  case SELF_PROTECTED:
742  {
744  break;
745  }
747  {
748  break;
749  }
750  }
751 }
752 
755 {
756  switch (m_category)
757  {
758  case BLOCK_ACK:
759  return BLOCK_ACK;
760  case MESH:
761  return MESH;
762  case MULTIHOP:
763  return MULTIHOP;
764  case SELF_PROTECTED:
765  return SELF_PROTECTED;
767  return VENDOR_SPECIFIC_ACTION;
768  default:
769  NS_FATAL_ERROR ("Unknown action value");
770  return SELF_PROTECTED;
771  }
772 }
773 
776 {
777  ActionValue retval;
778  retval.selfProtectedAction = PEER_LINK_OPEN; //Needs to be initialized to something to quiet valgrind in default cases
779  switch (m_category)
780  {
781  case BLOCK_ACK:
782  switch (m_actionValue)
783  {
786  break;
789  break;
790  case BLOCK_ACK_DELBA:
791  retval.blockAck = BLOCK_ACK_DELBA;
792  break;
793  }
794  break;
795 
796  case SELF_PROTECTED:
797  switch (m_actionValue)
798  {
799  case PEER_LINK_OPEN:
801  break;
802  case PEER_LINK_CONFIRM:
804  break;
805  case PEER_LINK_CLOSE:
807  break;
808  case GROUP_KEY_INFORM:
810  break;
811  case GROUP_KEY_ACK:
813  break;
814  default:
815  NS_FATAL_ERROR ("Unknown mesh peering management action code");
816  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
817  }
818  break;
819 
820  case MESH:
821  switch (m_actionValue)
822  {
823  case LINK_METRIC_REPORT:
825  break;
826  case PATH_SELECTION:
827  retval.meshAction = PATH_SELECTION;
828  break;
829  case PORTAL_ANNOUNCEMENT:
831  break;
834  break;
835  case MDA_SETUP_REQUEST:
836  retval.meshAction = MDA_SETUP_REQUEST;
837  break;
838  case MDA_SETUP_REPLY:
839  retval.meshAction = MDA_SETUP_REPLY;
840  break;
843  break;
844  case MDAOP_ADVERTISMENTS:
846  break;
847  case MDAOP_SET_TEARDOWN:
849  break;
852  break;
855  break;
856  default:
857  NS_FATAL_ERROR ("Unknown mesh peering management action code");
858  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
859  }
860  break;
861 
862  case MULTIHOP: //not yet supported
863  switch (m_actionValue)
864  {
865  case PROXY_UPDATE: //not used so far
866  retval.multihopAction = PROXY_UPDATE;
867  break;
868  case PROXY_UPDATE_CONFIRMATION: //not used so far
869  retval.multihopAction = PROXY_UPDATE;
870  break;
871  default:
872  NS_FATAL_ERROR ("Unknown mesh peering management action code");
873  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
874  }
875  break;
876  default:
877  NS_FATAL_ERROR ("Unsupported mesh action");
878  retval.selfProtectedAction = PEER_LINK_OPEN; /* quiet compiler */
879  }
880  return retval;
881 }
882 
883 TypeId
885 {
886  static TypeId tid = TypeId ("ns3::WifiActionHeader")
887  .SetParent<Header> ()
888  .SetGroupName ("Wifi")
889  .AddConstructor<WifiActionHeader> ()
890  ;
891  return tid;
892 }
893 
894 TypeId
896 {
897  return GetTypeId ();
898 }
899 
900 std::string
902 {
903  if (value == BLOCK_ACK)
904  {
905  return "BlockAck";
906  }
907  else if (value == MESH)
908  {
909  return "Mesh";
910  }
911  else if (value == SELF_PROTECTED)
912  {
913  return "SelfProtected";
914  }
915  else if (value == VENDOR_SPECIFIC_ACTION)
916  {
917  return "VendorSpecificAction";
918  }
919  else
920  {
921  std::ostringstream convert;
922  convert << value;
923  return convert.str ();
924  }
925 }
926 std::string
928 {
929  if (value == PEER_LINK_OPEN)
930  {
931  return "PeerLinkOpen";
932  }
933  else if (value == PEER_LINK_CONFIRM)
934  {
935  return "PeerLinkConfirm";
936  }
937  else if (value == PEER_LINK_CLOSE)
938  {
939  return "PeerLinkClose";
940  }
941  else if (value == GROUP_KEY_INFORM)
942  {
943  return "GroupKeyInform";
944  }
945  else if (value == GROUP_KEY_ACK)
946  {
947  return "GroupKeyAck";
948  }
949  else
950  {
951  std::ostringstream convert;
952  convert << value;
953  return convert.str ();
954  }
955 }
956 
957 void
958 WifiActionHeader::Print (std::ostream &os) const
959 {
960  os << "category=" << CategoryValueToString ((CategoryValue) m_category)
962 }
963 
964 uint32_t
966 {
967  return 2;
968 }
969 
970 void
972 {
973  start.WriteU8 (m_category);
974  start.WriteU8 (m_actionValue);
975 }
976 
977 uint32_t
979 {
981  m_category = i.ReadU8 ();
982  m_actionValue = i.ReadU8 ();
983  return i.GetDistanceFrom (start);
984 }
985 
986 
987 /***************************************************
988 * ADDBARequest
989 ****************************************************/
990 
992 
994  : m_dialogToken (1),
995  m_amsduSupport (1),
996  m_bufferSize (0)
997 {
998 }
999 
1000 TypeId
1002 {
1003  static TypeId tid = TypeId ("ns3::MgtAddBaRequestHeader")
1004  .SetParent<Header> ()
1005  .SetGroupName ("Wifi")
1006  .AddConstructor<MgtAddBaRequestHeader> ()
1007  ;
1008  return tid;
1009 }
1010 
1011 TypeId
1013 {
1014  return GetTypeId ();
1015 }
1016 
1017 void
1018 MgtAddBaRequestHeader::Print (std::ostream &os) const
1019 {
1020 }
1021 
1022 uint32_t
1024 {
1025  uint32_t size = 0;
1026  size += 1; //Dialog token
1027  size += 2; //Block ack parameter set
1028  size += 2; //Block ack timeout value
1029  size += 2; //Starting sequence control
1030  return size;
1031 }
1032 
1033 void
1035 {
1036  Buffer::Iterator i = start;
1037  i.WriteU8 (m_dialogToken);
1041 }
1042 
1043 uint32_t
1045 {
1046  Buffer::Iterator i = start;
1047  m_dialogToken = i.ReadU8 ();
1051  return i.GetDistanceFrom (start);
1052 }
1053 
1054 void
1056 {
1057  m_policy = 0;
1058 }
1059 
1060 void
1062 {
1063  m_policy = 1;
1064 }
1065 
1066 void
1068 {
1069  NS_ASSERT (tid < 16);
1070  m_tid = tid;
1071 }
1072 
1073 void
1075 {
1077 }
1078 
1079 void
1081 {
1082  m_bufferSize = size;
1083 }
1084 
1085 void
1087 {
1088  m_startingSeq = seq;
1089 }
1090 
1091 void
1093 {
1094  m_startingSeq = (seqControl >> 4) & 0x0fff;
1095 }
1096 
1097 void
1099 {
1100  m_amsduSupport = supported;
1101 }
1102 
1103 uint8_t
1105 {
1106  return m_tid;
1107 }
1108 
1109 bool
1111 {
1112  return (m_policy == 1) ? true : false;
1113 }
1114 
1115 uint16_t
1117 {
1118  return m_timeoutValue;
1119 }
1120 
1121 uint16_t
1123 {
1124  return m_bufferSize;
1125 }
1126 
1127 bool
1129 {
1130  return (m_amsduSupport == 1) ? true : false;
1131 }
1132 
1133 uint16_t
1135 {
1136  return m_startingSeq;
1137 }
1138 
1139 uint16_t
1141 {
1142  return (m_startingSeq << 4) & 0xfff0;
1143 }
1144 
1145 uint16_t
1147 {
1148  uint16_t res = 0;
1149  res |= m_amsduSupport;
1150  res |= m_policy << 1;
1151  res |= m_tid << 2;
1152  res |= m_bufferSize << 6;
1153  return res;
1154 }
1155 
1156 void
1158 {
1159  m_amsduSupport = (params) & 0x01;
1160  m_policy = (params >> 1) & 0x01;
1161  m_tid = (params >> 2) & 0x0f;
1162  m_bufferSize = (params >> 6) & 0x03ff;
1163 }
1164 
1165 
1166 /***************************************************
1167 * ADDBAResponse
1168 ****************************************************/
1169 
1171 
1173  : m_dialogToken (1),
1174  m_amsduSupport (1),
1175  m_bufferSize (0)
1176 {
1177 }
1178 
1179 TypeId
1181 {
1182  static TypeId tid = TypeId ("ns3::MgtAddBaResponseHeader")
1183  .SetParent<Header> ()
1184  .SetGroupName ("Wifi")
1185  .AddConstructor<MgtAddBaResponseHeader> ()
1186  ;
1187  return tid;
1188 }
1189 
1190 TypeId
1192 {
1193  return GetTypeId ();
1194 }
1195 
1196 void
1197 MgtAddBaResponseHeader::Print (std::ostream &os) const
1198 {
1199  os << "status code=" << m_code;
1200 }
1201 
1202 uint32_t
1204 {
1205  uint32_t size = 0;
1206  size += 1; //Dialog token
1207  size += m_code.GetSerializedSize (); //Status code
1208  size += 2; //Block ack parameter set
1209  size += 2; //Block ack timeout value
1210  return size;
1211 }
1212 
1213 void
1215 {
1216  Buffer::Iterator i = start;
1217  i.WriteU8 (m_dialogToken);
1218  i = m_code.Serialize (i);
1221 }
1222 
1223 uint32_t
1225 {
1226  Buffer::Iterator i = start;
1227  m_dialogToken = i.ReadU8 ();
1228  i = m_code.Deserialize (i);
1231  return i.GetDistanceFrom (start);
1232 }
1233 
1234 void
1236 {
1237  m_policy = 0;
1238 }
1239 
1240 void
1242 {
1243  m_policy = 1;
1244 }
1245 
1246 void
1248 {
1249  NS_ASSERT (tid < 16);
1250  m_tid = tid;
1251 }
1252 
1253 void
1255 {
1257 }
1258 
1259 void
1261 {
1262  m_bufferSize = size;
1263 }
1264 
1265 void
1267 {
1268  m_code = code;
1269 }
1270 
1271 void
1273 {
1274  m_amsduSupport = supported;
1275 }
1276 
1277 StatusCode
1279 {
1280  return m_code;
1281 }
1282 
1283 uint8_t
1285 {
1286  return m_tid;
1287 }
1288 
1289 bool
1291 {
1292  return (m_policy == 1) ? true : false;
1293 }
1294 
1295 uint16_t
1297 {
1298  return m_timeoutValue;
1299 }
1300 
1301 uint16_t
1303 {
1304  return m_bufferSize;
1305 }
1306 
1307 bool
1309 {
1310  return (m_amsduSupport == 1) ? true : false;
1311 }
1312 
1313 uint16_t
1315 {
1316  uint16_t res = 0;
1317  res |= m_amsduSupport;
1318  res |= m_policy << 1;
1319  res |= m_tid << 2;
1320  res |= m_bufferSize << 6;
1321  return res;
1322 }
1323 
1324 void
1326 {
1327  m_amsduSupport = (params) & 0x01;
1328  m_policy = (params >> 1) & 0x01;
1329  m_tid = (params >> 2) & 0x0f;
1330  m_bufferSize = (params >> 6) & 0x03ff;
1331 }
1332 
1333 
1334 /***************************************************
1335 * DelBa
1336 ****************************************************/
1337 
1339 
1341  : m_reasonCode (1)
1342 {
1343 }
1344 
1345 TypeId
1347 {
1348  static TypeId tid = TypeId ("ns3::MgtDelBaHeader")
1349  .SetParent<Header> ()
1350  .SetGroupName ("Wifi")
1351  .AddConstructor<MgtDelBaHeader> ()
1352  ;
1353  return tid;
1354 }
1355 
1356 TypeId
1358 {
1359  return GetTypeId ();
1360 }
1361 
1362 void
1363 MgtDelBaHeader::Print (std::ostream &os) const
1364 {
1365 }
1366 
1367 uint32_t
1369 {
1370  uint32_t size = 0;
1371  size += 2; //DelBa parameter set
1372  size += 2; //Reason code
1373  return size;
1374 }
1375 
1376 void
1378 {
1379  Buffer::Iterator i = start;
1382 }
1383 
1384 uint32_t
1386 {
1387  Buffer::Iterator i = start;
1389  m_reasonCode = i.ReadLsbtohU16 ();
1390  return i.GetDistanceFrom (start);
1391 }
1392 
1393 bool
1395 {
1396  return (m_initiator == 1) ? true : false;
1397 }
1398 
1399 uint8_t
1401 {
1402  NS_ASSERT (m_tid < 16);
1403  uint8_t tid = static_cast<uint8_t> (m_tid);
1404  return tid;
1405 }
1406 
1407 void
1409 {
1410  m_initiator = 1;
1411 }
1412 
1413 void
1415 {
1416  m_initiator = 0;
1417 }
1418 
1419 void
1421 {
1422  NS_ASSERT (tid < 16);
1423  m_tid = static_cast<uint16_t> (tid);
1424 }
1425 
1426 uint16_t
1428 {
1429  uint16_t res = 0;
1430  res |= m_initiator << 11;
1431  res |= m_tid << 12;
1432  return res;
1433 }
1434 
1435 void
1437 {
1438  m_initiator = (params >> 11) & 0x01;
1439  m_tid = (params >> 12) & 0x0f;
1440 }
1441 
1442 } //namespace ns3
Protocol header serialization and deserialization.
Definition: header.h:42
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...
static TypeId GetTypeId(void)
Register this type.
virtual uint32_t Deserialize(Buffer::Iterator start)
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:83
The HT Operations Information ElementThis class knows how to serialise and deserialise the HT Operati...
Definition: ht-operations.h:54
uint16_t GetBufferSize(void) const
Return the buffer size.
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:677
StatusCode m_code
Status code.
Definition: mgt-headers.h:866
virtual uint32_t GetSerializedSize(void) const
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 ERP STA...
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:183
HtOperations m_htOperations
HT operations.
Definition: mgt-headers.h:258
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:476
Implement the header for management frames of type association request.
Definition: mgt-headers.h:44
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:411
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:868
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:958
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:578
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:278
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:171
HtOperations GetHtOperations(void) const
Return the HT operations.
Definition: mgt-headers.cc:602
#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:253
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:465
uint16_t m_timeoutValue
Timeout.
Definition: mgt-headers.h:749
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:507
virtual void Print(std::ostream &os) const
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:337
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:137
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:101
void SetImmediateBlockAck()
Enable immediate Block ACK.
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:471
def start()
Definition: core.py:1482
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:254
CapabilityInformation m_capability
Capability information.
Definition: mgt-headers.h:472
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:626
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:139
#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:338
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:482
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:423
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:393
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:750
void SetAction(enum CategoryValue type, ActionValue action)
Set action for this Action header.
Definition: mgt-headers.cc:720
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:901
uint16_t GetBufferSize(void) const
Return the buffer size.
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:614
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
CategoryValue GetCategory()
Return the category value.
Definition: mgt-headers.cc:754
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:138
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:748
ErpInformation m_erpInformation
ERP information.
Definition: mgt-headers.h:260
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:447
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:399
ErpInformation GetErpInformation(void) const
Return the ERP information.
Definition: mgt-headers.cc:626
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
uint16_t GetStartingSequenceControl(void) const
Return the raw sequence control.
uint16_t GetSerializedSize() const
Return the serialized size of this HT Operations IE.
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:302
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:313
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capabilities.
Definition: mgt-headers.cc:231
ExtendedSupportedRatesIE extended
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:453
void SetListenInterval(uint16_t interval)
Set the listen interval.
Definition: mgt-headers.cc:405
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:884
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:867
void SetErpInformation(ErpInformation erpInformation)
Set the ERP information.
Definition: mgt-headers.cc:255
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual TypeId GetInstanceTypeId() const
Get the most derived TypeId for this Object.
Definition: mgt-headers.cc:895
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:747
SupportedRates m_rates
List of supported rates.
Definition: mgt-headers.h:336
enum MultihopActionValue multihopAction
Definition: mgt-headers.h:577
ErpInformation GetErpInformation(void) const
Return the ERP information.
Definition: mgt-headers.cc:261
CapabilityInformation GetCapabilities(void) const
Return the Capability information.
Definition: mgt-headers.cc:417
virtual uint32_t GetSerializedSize() const
Definition: mgt-headers.cc:965
The IEEE 802.11ac VHT Capabilities.
void SetStartingSequenceControl(uint16_t seqControl)
Set sequence control with the given raw value.
void SetErpInformation(ErpInformation erpInformation)
Set the ERP information.
Definition: mgt-headers.cc:620
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:459
void SetParameterSet(uint16_t params)
Set the parameter set from the given raw value.
enum MeshActionValue meshAction
Definition: mgt-headers.h:576
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:579
uint8_t m_amsduSupport
Flag if A-MSDU is supported.
Definition: mgt-headers.h:745
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
uint8_t GetTid(void) const
Return the Traffic ID (TID).
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:608
ErpInformation m_erpInformation
ERP information.
Definition: mgt-headers.h:476
SupportedRates GetSupportedRates(void)
Return the supported rates.
Definition: mgt-headers.cc:554
uint64_t m_timestamp
Timestamp.
Definition: mgt-headers.h:468
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:644
uint64_t GetTimestamp()
Return the time stamp.
Definition: mgt-headers.cc:165
virtual uint32_t GetSerializedSize(void) const
HtOperations m_htOperations
HT operations.
Definition: mgt-headers.h:474
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:237
std::string SelfProtectedActionValueToString(SelfProtectedActionValue value) const
Definition: mgt-headers.cc:927
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:496
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:441
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:475
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:243
static TypeId GetTypeId(void)
Register this type.
Definition: mgt-headers.cc:267
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:978
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:435
tuple ssid
Definition: third.py:93
VhtCapabilities m_vhtCapability
VHT capabilities.
Definition: mgt-headers.h:140
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:473
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:339
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:366
uint8_t m_tid
Traffic ID.
Definition: mgt-headers.h:869
virtual void Print(std::ostream &os) const
Definition: mgt-headers.cc:666
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:618
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:268
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:225
bool IsImmediateBlockAck(void) const
Return whether the Block ACK policy is immediate Block ACK.
enum SelfProtectedActionValue selfProtectedAction
Definition: mgt-headers.h:578
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:910
void SetHtOperations(HtOperations htoperations)
Set the HT operations.
Definition: mgt-headers.cc:213
Implement the header for management frames of type association response.
Definition: mgt-headers.h:149
virtual uint32_t Deserialize(Buffer::Iterator start)
StatusCode m_code
Status code.
Definition: mgt-headers.h:255
uint16_t GetStartingSequence(void) const
Return the starting sequence number.
void SetCapabilities(CapabilityInformation capabilities)
Set the Capability information.
Definition: mgt-headers.cc:572
uint16_t m_tid
Traffic ID.
Definition: mgt-headers.h:939
static TypeId GetTypeId(void)
Register this type.
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:633
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:566
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:758
Implement the header for management frames of type del block ack.
Definition: mgt-headers.h:879
typedef for union of different ActionValues
Definition: mgt-headers.h:574
uint8_t ReadU8(void)
Definition: buffer.h:1015
uint8_t m_policy
Block ACK policy.
Definition: mgt-headers.h:746
HtCapabilities m_htCapability
HT capabilities.
Definition: mgt-headers.h:257
void SetSupportedRates(SupportedRates rates)
Set the supported rates.
Definition: mgt-headers.cc:249
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:335
void SetHtCapabilities(HtCapabilities htcapabilities)
Set the HT capabilities.
Definition: mgt-headers.cc:584
uint16_t ReadLsbtohU16(void)
Definition: buffer.cc:1065
The ErpInformation Information ElementThis class knows how to serialise and deserialise the ErpInform...
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:560
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:617
void SetDelayedBlockAck()
Enable delayed Block ACK.
virtual uint32_t Deserialize(Buffer::Iterator start)
Definition: mgt-headers.cc:518
void SetTimeout(uint16_t timeout)
Set timeout.
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:346
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:259
uint16_t GetParameterSet(void) const
Return the raw parameter set.
ActionValue GetAction()
Return the action value.
Definition: mgt-headers.cc:775
uint16_t m_bufferSize
Buffer size.
Definition: mgt-headers.h:870
uint16_t GetParameterSet(void) const
Return the raw parameter set.
uint64_t m_beaconInterval
Beacon interval.
Definition: mgt-headers.h:470
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:871
HtOperations GetHtOperations(void) const
Return the HT operations.
Definition: mgt-headers.cc:219
uint16_t GetSerializedSize() const
Return the serialized size of this ErpInformation information element.
Ssid m_ssid
Service Set ID (SSID)
Definition: mgt-headers.h:136
HtCapabilities GetHtCapabilities(void) const
Return the HT capabilities.
Definition: mgt-headers.cc:429
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:284
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:484
void SetHtOperations(HtOperations htoperations)
Set the HT operations.
Definition: mgt-headers.cc:596
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:692
virtual uint32_t GetSerializedSize(void) const
Definition: mgt-headers.cc:650
StatusCode GetStatusCode(void)
Return the status code.
Definition: mgt-headers.cc:548
Ssid m_ssid
Service set ID (SSID)
Definition: mgt-headers.h:469
void SetVhtCapabilities(VhtCapabilities vhtcapabilities)
Set the VHT capabilities.
Definition: mgt-headers.cc:71
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:971
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:590
virtual void Print(std::ostream &os) const
virtual void Serialize(Buffer::Iterator start) const
Definition: mgt-headers.cc:505