A Discrete-Event Network Simulator
API
wifi-phy-header.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018 Sébastien Deronne
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
19  */
20 
21 #include "wifi-phy-header.h"
22 
23 namespace ns3 {
24 
25 NS_OBJECT_ENSURE_REGISTERED (DsssSigHeader);
26 
28  : m_rate (0b00001010),
29  m_length (0)
30 {
31 }
32 
34 {
35 }
36 
37 TypeId
39 {
40  static TypeId tid = TypeId ("ns3::DsssSigHeader")
41  .SetParent<Header> ()
42  .SetGroupName ("Wifi")
43  .AddConstructor<DsssSigHeader> ()
44  ;
45  return tid;
46 }
47 
48 TypeId
50 {
51  return GetTypeId ();
52 }
53 
54 void
55 DsssSigHeader::Print (std::ostream &os) const
56 {
57  os << "SIGNAL=" << GetRate ()
58  << " LENGTH=" << m_length;
59 }
60 
61 uint32_t
63 {
64  return 6;
65 }
66 
67 void
68 DsssSigHeader::SetRate (uint64_t rate)
69 {
70  /* Here is the binary representation for a given rate:
71  * 1 Mbit/s: 00001010
72  * 2 Mbit/s: 00010100
73  * 5.5 Mbit/s: 00110111
74  * 11 Mbit/s: 01101110
75  */
76  switch (rate)
77  {
78  case 1000000:
79  m_rate = 0b00001010;
80  break;
81  case 2000000:
82  m_rate = 0b00010100;
83  break;
84  case 5500000:
85  m_rate = 0b00110111;
86  break;
87  case 11000000:
88  m_rate = 0b01101110;
89  break;
90  default:
91  NS_ASSERT_MSG (false, "Invalid rate");
92  break;
93  }
94 }
95 
96 uint64_t
98 {
99  uint64_t rate = 0;
100  switch (m_rate)
101  {
102  case 0b00001010:
103  rate = 1000000;
104  break;
105  case 0b00010100:
106  rate = 2000000;
107  break;
108  case 0b00110111:
109  rate = 5500000;
110  break;
111  case 0b01101110:
112  rate = 11000000;
113  break;
114  default:
115  NS_ASSERT_MSG (false, "Invalid rate");
116  break;
117  }
118  return rate;
119 }
120 
121 void
122 DsssSigHeader::SetLength (uint16_t length)
123 {
124  m_length = length;
125 }
126 
127 uint16_t
129 {
130  return m_length;
131 }
132 
133 void
135 {
136  start.WriteU8 (m_rate);
137  start.WriteU8 (0); /* SERVICE */
138  start.WriteU16 (m_length);
139  start.WriteU16 (0); /* CRC */
140 }
141 
142 uint32_t
144 {
146  m_rate = i.ReadU8 ();
147  i.ReadU8 (); /* SERVICE */
148  m_length = i.ReadU16 ();
149  i.ReadU16 (); /* CRC */
150  return i.GetDistanceFrom (start);
151 }
152 
154 
156  : m_rate (0b1101),
157  m_length (0)
158 {
159 }
160 
162 {
163 }
164 
165 TypeId
167 {
168  static TypeId tid = TypeId ("ns3::LSigHeader")
169  .SetParent<Header> ()
170  .SetGroupName ("Wifi")
171  .AddConstructor<LSigHeader> ()
172  ;
173  return tid;
174 }
175 
176 TypeId
178 {
179  return GetTypeId ();
180 }
181 
182 void
183 LSigHeader::Print (std::ostream &os) const
184 {
185  os << "SIGNAL=" << GetRate ()
186  << " LENGTH=" << m_length;
187 }
188 
189 uint32_t
191 {
192  return 3;
193 }
194 
195 void
196 LSigHeader::SetRate (uint64_t rate, uint16_t channelWidth)
197 {
198  if (channelWidth < 20)
199  {
200  //conversion for 5 MHz and 10 MHz
201  rate *= (20 / channelWidth);
202  }
203  /* Here is the binary representation for a given rate:
204  * 6 Mbit/s: 1101
205  * 9 Mbit/s: 1111
206  * 12 Mbit/s: 0101
207  * 18 Mbit/s: 0111
208  * 24 Mbit/s: 1001
209  * 36 Mbit/s: 1011
210  * 48 Mbit/s: 0001
211  * 54 Mbit/s: 0011
212  */
213  switch (rate)
214  {
215  case 6000000:
216  m_rate = 0b1101;
217  break;
218  case 9000000:
219  m_rate = 0b1111;
220  break;
221  case 12000000:
222  m_rate = 0b0101;
223  break;
224  case 18000000:
225  m_rate = 0b0111;
226  break;
227  case 24000000:
228  m_rate = 0b1001;
229  break;
230  case 36000000:
231  m_rate = 0b1011;
232  break;
233  case 48000000:
234  m_rate = 0b0001;
235  break;
236  case 54000000:
237  m_rate = 0b0011;
238  break;
239  default:
240  NS_ASSERT_MSG (false, "Invalid rate");
241  break;
242  }
243 }
244 
245 uint64_t
246 LSigHeader::GetRate (uint16_t channelWidth) const
247 {
248  uint64_t rate = 0;
249  switch (m_rate)
250  {
251  case 0b1101:
252  rate = 6000000;
253  break;
254  case 0b1111:
255  rate = 9000000;
256  break;
257  case 0b0101:
258  rate = 12000000;
259  break;
260  case 0b0111:
261  rate = 18000000;
262  break;
263  case 0b1001:
264  rate = 24000000;
265  break;
266  case 0b1011:
267  rate = 36000000;
268  break;
269  case 0b0001:
270  rate = 48000000;
271  break;
272  case 0b0011:
273  rate = 54000000;
274  break;
275  default:
276  NS_ASSERT_MSG (false, "Invalid rate");
277  break;
278  }
279  if (channelWidth == 5)
280  {
281  rate /= 4; //compute corresponding 5 MHz rate
282  }
283  else if (channelWidth == 10)
284  {
285  rate /= 2; //compute corresponding 10 MHz rate
286  }
287  return rate;
288 }
289 
290 void
291 LSigHeader::SetLength (uint16_t length)
292 {
293  NS_ASSERT_MSG (length < 4096, "Invalid length");
294  m_length = length;
295 }
296 
297 uint16_t
299 {
300  return m_length;
301 }
302 
303 void
305 {
306  uint8_t byte = 0;
307  uint16_t bytes = 0;
308 
309  byte |= m_rate;
310  byte |= (m_length & 0x07) << 5;
311  start.WriteU8 (byte);
312 
313  bytes |= (m_length & 0x0ff8) >> 3;
314  start.WriteU16 (bytes);
315 }
316 
317 uint32_t
319 {
321 
322  uint8_t byte = i.ReadU8 ();
323  m_rate = byte & 0x0f;
324  m_length = (byte >> 5) & 0x07;
325 
326  uint16_t bytes = i.ReadU16 ();
327  m_length |= (bytes << 3) & 0x0ff8;
328 
329  return i.GetDistanceFrom (start);
330 }
331 
333 
335  : m_mcs (0),
336  m_cbw20_40 (0),
337  m_htLength (0),
338  m_aggregation (0),
339  m_sgi (0)
340 {
341 }
342 
344 {
345 }
346 
347 TypeId
349 {
350  static TypeId tid = TypeId ("ns3::HtSigHeader")
351  .SetParent<Header> ()
352  .SetGroupName ("Wifi")
353  .AddConstructor<HtSigHeader> ()
354  ;
355  return tid;
356 }
357 
358 TypeId
360 {
361  return GetTypeId ();
362 }
363 
364 void
365 HtSigHeader::Print (std::ostream &os) const
366 {
367  os << "MCS=" << +m_mcs
368  << " HT_LENGTH=" << m_htLength
369  << " CHANNEL_WIDTH=" << GetChannelWidth ()
370  << " FEC_CODING=" << (m_fecCoding ? "LDPC" : "BCC")
371  << " SGI=" << +m_sgi
372  << " AGGREGATION=" << +m_aggregation;
373 }
374 
375 uint32_t
377 {
378  return 6;
379 }
380 
381 void
382 HtSigHeader::SetMcs (uint8_t mcs)
383 {
384  NS_ASSERT (mcs <= 31);
385  m_mcs = mcs;
386 }
387 
388 uint8_t
390 {
391  return m_mcs;
392 }
393 
394 void
395 HtSigHeader::SetChannelWidth (uint16_t channelWidth)
396 {
397  m_cbw20_40 = (channelWidth > 20) ? 1 : 0;
398 }
399 
400 uint16_t
402 {
403  return m_cbw20_40 ? 40 : 20;
404 }
405 
406 void
407 HtSigHeader::SetHtLength (uint16_t length)
408 {
409  m_htLength = length;
410 }
411 
412 uint16_t
414 {
415  return m_htLength;
416 }
417 
418 void
419 HtSigHeader::SetAggregation (bool aggregation)
420 {
421  m_aggregation = aggregation ? 1 : 0;
422 }
423 
424 bool
426 {
427  return m_aggregation ? true : false;
428 }
429 
430 void
432 {
433  m_fecCoding = ldpc ? 1 : 0;
434 }
435 
436 bool
438 {
439  return m_fecCoding ? true : false;
440 }
441 
442 void
444 {
445  m_sgi = sgi ? 1 : 0;
446 }
447 
448 bool
450 {
451  return m_sgi ? true : false;
452 }
453 
454 void
456 {
457  uint8_t byte = m_mcs;
458  byte |= ((m_cbw20_40 & 0x01) << 7);
459  start.WriteU8 (byte);
460  start.WriteU16 (m_htLength);
461  byte = (0x01 << 2); //Set Reserved bit #2 to 1
462  byte |= ((m_aggregation & 0x01) << 3);
463  byte |= ((m_fecCoding & 0x01) << 6);
464  byte |= ((m_sgi & 0x01) << 7);
465  start.WriteU8 (byte);
466  start.WriteU16 (0);
467 }
468 
469 uint32_t
471 {
473  uint8_t byte = i.ReadU8 ();
474  m_mcs = byte & 0x7f;
475  m_cbw20_40 = ((byte >> 7) & 0x01);
476  m_htLength = i.ReadU16 ();
477  byte = i.ReadU8 ();
478  m_aggregation = ((byte >> 3) & 0x01);
479  m_fecCoding = ((byte >> 6) & 0x01);
480  m_sgi = ((byte >> 7) & 0x01);
481  i.ReadU16 ();
482  return i.GetDistanceFrom (start);
483 }
484 
486 
488  : m_bw (0),
489  m_nsts (0),
490  m_sgi (0),
491  m_sgi_disambiguation (0),
492  m_suMcs (0),
493  m_mu (false)
494 {
495 }
496 
498 {
499 }
500 
501 TypeId
503 {
504  static TypeId tid = TypeId ("ns3::VhtSigHeader")
505  .SetParent<Header> ()
506  .SetGroupName ("Wifi")
507  .AddConstructor<VhtSigHeader> ()
508  ;
509  return tid;
510 }
511 
512 TypeId
514 {
515  return GetTypeId ();
516 }
517 
518 void
519 VhtSigHeader::Print (std::ostream &os) const
520 {
521  os << "SU_MCS=" << +m_suMcs
522  << " CHANNEL_WIDTH=" << GetChannelWidth ()
523  << " SGI=" << +m_sgi
524  << " NSTS=" << +m_nsts
525  << " CODING=" << (m_coding ? "LDPC" : "BCC")
526  << " MU=" << +m_mu;
527 }
528 
529 uint32_t
531 {
532  uint32_t size = 0;
533  size += 3; //VHT-SIG-A1
534  size += 3; //VHT-SIG-A2
535  if (m_mu)
536  {
537  size += 4; //VHT-SIG-B
538  }
539  return size;
540 }
541 
542 void
544 {
545  m_mu = mu;
546 }
547 
548 void
549 VhtSigHeader::SetChannelWidth (uint16_t channelWidth)
550 {
551  if (channelWidth == 160)
552  {
553  m_bw = 3;
554  }
555  else if (channelWidth == 80)
556  {
557  m_bw = 2;
558  }
559  else if (channelWidth == 40)
560  {
561  m_bw = 1;
562  }
563  else
564  {
565  m_bw = 0;
566  }
567 }
568 
569 uint16_t
571 {
572  if (m_bw == 3)
573  {
574  return 160;
575  }
576  else if (m_bw == 2)
577  {
578  return 80;
579  }
580  else if (m_bw == 1)
581  {
582  return 40;
583  }
584  else
585  {
586  return 20;
587  }
588 }
589 
590 void
591 VhtSigHeader::SetNStreams (uint8_t nStreams)
592 {
593  NS_ASSERT (nStreams <= 8);
594  m_nsts = (nStreams - 1);
595 }
596 
597 uint8_t
599 {
600  return (m_nsts + 1);
601 }
602 
603 void
605 {
606  m_sgi = sgi ? 1 : 0;
607 }
608 
609 bool
611 {
612  return m_sgi ? true : false;
613 }
614 
615 void
617 {
618  m_sgi_disambiguation = disambiguation ? 1 : 0;
619 }
620 
621 bool
623 {
624  return m_sgi_disambiguation ? true : false;
625 }
626 
627 void
629 {
630  m_coding = ldpc ? 1 : 0;
631 }
632 
633 bool
635 {
636  return m_coding ? true : false;
637 
638 }
639 
640 void
642 {
643  NS_ASSERT (mcs <= 9);
644  m_suMcs = mcs;
645 }
646 
647 uint8_t
649 {
650  return m_suMcs;
651 }
652 
653 void
655 {
656  //VHT-SIG-A1
657  uint8_t byte = m_bw;
658  byte |= (0x01 << 2); //Set Reserved bit #2 to 1
659  start.WriteU8 (byte);
660  uint16_t bytes = (m_nsts & 0x07) << 2;
661  bytes |= (0x01 << (23 - 8)); //Set Reserved bit #23 to 1
662  start.WriteU16 (bytes);
663 
664  //VHT-SIG-A2
665  byte = m_sgi & 0x01;
666  byte |= ((m_sgi_disambiguation & 0x01) << 1);
667  byte |= ((m_coding & 0x01) << 2);
668  byte |= ((m_suMcs & 0x0f) << 4);
669  start.WriteU8 (byte);
670  bytes = (0x01 << (9 - 8)); //Set Reserved bit #9 to 1
671  start.WriteU16 (bytes);
672 
673  if (m_mu)
674  {
675  //VHT-SIG-B
676  start.WriteU32 (0);
677  }
678 }
679 
680 uint32_t
682 {
684 
685  //VHT-SIG-A1
686  uint8_t byte = i.ReadU8 ();
687  m_bw = byte & 0x03;
688  uint16_t bytes = i.ReadU16 ();
689  m_nsts = ((bytes >> 2) & 0x07);
690 
691  //VHT-SIG-A2
692  byte = i.ReadU8 ();
693  m_sgi = byte & 0x01;
694  m_sgi_disambiguation = ((byte >> 1) & 0x01);
695  m_coding = ((byte >> 2) & 0x01);
696  m_suMcs = ((byte >> 4) & 0x0f);
697  i.ReadU16 ();
698 
699  if (m_mu)
700  {
701  //VHT-SIG-B
702  i.ReadU32 ();
703  }
704 
705  return i.GetDistanceFrom (start);
706 }
707 
708 
710 
712  : m_format (1),
713  m_bssColor (0),
714  m_ul_dl (0),
715  m_mcs (0),
716  m_spatialReuse (0),
717  m_bandwidth (0),
718  m_gi_ltf_size (0),
719  m_nsts (0),
720  m_mu (false)
721 {
722 }
723 
725 {
726 }
727 
728 TypeId
730 {
731  static TypeId tid = TypeId ("ns3::HeSigHeader")
732  .SetParent<Header> ()
733  .SetGroupName ("Wifi")
734  .AddConstructor<HeSigHeader> ()
735  ;
736  return tid;
737 }
738 
739 TypeId
741 {
742  return GetTypeId ();
743 }
744 
745 void
746 HeSigHeader::Print (std::ostream &os) const
747 {
748  os << "MCS=" << +m_mcs
749  << " CHANNEL_WIDTH=" << GetChannelWidth ()
750  << " GI=" << GetGuardInterval ()
751  << " NSTS=" << +m_nsts
752  << " BSSColor=" << +m_bssColor
753  << " CODING=" << (m_coding ? "LDPC" : "BCC")
754  << " MU=" << +m_mu;
755 }
756 
757 uint32_t
759 {
760  uint32_t size = 0;
761  size += 4; //HE-SIG-A1
762  size += 4; //HE-SIG-A2
763  if (m_mu)
764  {
765  size += 1; //HE-SIG-B
766  }
767  return size;
768 }
769 
770 void
772 {
773  m_mu = mu;
774 }
775 
776 void
777 HeSigHeader::SetMcs (uint8_t mcs)
778 {
779  NS_ASSERT (mcs <= 11);
780  m_mcs = mcs;
781 }
782 
783 uint8_t
785 {
786  return m_mcs;
787 }
788 
789 void
790 HeSigHeader::SetBssColor (uint8_t bssColor)
791 {
792  NS_ASSERT (bssColor < 64);
793  m_bssColor = bssColor;
794 }
795 
796 uint8_t
798 {
799  return m_bssColor;
800 }
801 
802 void
803 HeSigHeader::SetChannelWidth (uint16_t channelWidth)
804 {
805  if (channelWidth == 160)
806  {
807  m_bandwidth = 3;
808  }
809  else if (channelWidth == 80)
810  {
811  m_bandwidth = 2;
812  }
813  else if (channelWidth == 40)
814  {
815  m_bandwidth = 1;
816  }
817  else
818  {
819  m_bandwidth = 0;
820  }
821 }
822 
823 uint16_t
825 {
826  if (m_bandwidth == 3)
827  {
828  return 160;
829  }
830  else if (m_bandwidth == 2)
831  {
832  return 80;
833  }
834  else if (m_bandwidth == 1)
835  {
836  return 40;
837  }
838  else
839  {
840  return 20;
841  }
842 }
843 
844 void
845 HeSigHeader::SetGuardIntervalAndLtfSize (uint16_t gi, uint8_t ltf)
846 {
847  if (gi == 800 && ltf == 1)
848  {
849  m_gi_ltf_size = 0;
850  }
851  else if (gi == 800 && ltf == 2)
852  {
853  m_gi_ltf_size = 1;
854  }
855  else if (gi == 1600 && ltf == 2)
856  {
857  m_gi_ltf_size = 2;
858  }
859  else
860  {
861  m_gi_ltf_size = 3;
862  }
863 }
864 
865 uint16_t
867 {
868  if (m_gi_ltf_size == 3)
869  {
870  //we currently do not consider DCM nor STBC fields
871  return 3200;
872  }
873  else if (m_gi_ltf_size == 2)
874  {
875  return 1600;
876  }
877  else
878  {
879  return 800;
880  }
881 }
882 
883 void
884 HeSigHeader::SetNStreams (uint8_t nStreams)
885 {
886  NS_ASSERT (nStreams <= 8);
887  m_nsts = (nStreams - 1);
888 }
889 
890 uint8_t
892 {
893  return (m_nsts + 1);
894 }
895 
896 void
898 {
899  m_coding = ldpc ? 1 : 0;
900 }
901 
902 bool
904 {
905  return m_coding ? true : false;
906 
907 }
908 
909 void
911 {
912  //HE-SIG-A1
913  uint8_t byte = m_format & 0x01;
914  byte |= ((m_ul_dl & 0x01) << 2);
915  byte |= ((m_mcs & 0x0f) << 3);
916  start.WriteU8 (byte);
917  uint16_t bytes = (m_bssColor & 0x3f);
918  bytes |= (0x01 << 6); //Reserved set to 1
919  bytes |= ((m_spatialReuse & 0x0f) << 7);
920  bytes |= ((m_bandwidth & 0x03) << 11);
921  bytes |= ((m_gi_ltf_size & 0x03) << 13);
922  bytes |= ((m_nsts & 0x01) << 15);
923  start.WriteU16 (bytes);
924  start.WriteU8 ((m_nsts >> 1) & 0x03);
925 
926  //HE-SIG-A2
927  uint32_t sigA2 = 0;
928  sigA2 |= ((m_coding & 0x01) << 7);
929  sigA2 |= (0x01 << 14); //Set Reserved bit #14 to 1
930  start.WriteU32 (sigA2);
931 
932  if (m_mu)
933  {
934  //HE-SIG-B
935  start.WriteU8 (0);
936  }
937 }
938 
939 uint32_t
941 {
943 
944  //HE-SIG-A1
945  uint8_t byte = i.ReadU8 ();
946  m_format = (byte & 0x01);
947  m_ul_dl = ((byte >> 2) & 0x01);
948  m_mcs = ((byte >> 3) & 0x0f);
949  uint16_t bytes = i.ReadU16 ();
950  m_bssColor = (bytes & 0x3f);
951  m_spatialReuse = ((bytes >> 7) & 0x0f);
952  m_bandwidth = ((bytes >> 11) & 0x03);
953  m_gi_ltf_size = ((bytes >> 13) & 0x03);
954  m_nsts = ((bytes >> 15) & 0x01);
955  byte = i.ReadU8 ();
956  m_nsts |= (byte & 0x03) << 1;
957 
958  //HE-SIG-A2
959  uint32_t sigA2 = i.ReadU32 ();
960  m_coding = ((sigA2 >> 7) & 0x01);
961 
962  if (m_mu)
963  {
964  //HE-SIG-B
965  i.ReadU8 ();
966  }
967 
968  return i.GetDistanceFrom (start);
969 }
970 
971 } //namespace ns3
bool IsLdpcCoding(void) const
Return whether LDPC is used or not.
uint16_t ReadU16(void)
Definition: buffer.h:1029
Protocol header serialization and deserialization.
Definition: header.h:42
uint16_t GetChannelWidth(void) const
Return the channel width (in MHz).
void Print(std::ostream &os) const
void Print(std::ostream &os) const
uint8_t m_bandwidth
Bandwidth field.
uint8_t m_sgi
Short Guard Interval.
void SetFecCoding(bool ldpc)
Fill the FEC coding field of HT-SIG.
uint32_t ReadU32(void)
Definition: buffer.cc:972
uint8_t m_spatialReuse
Spatial Reuse field.
uint8_t m_cbw20_40
CBW 20/40.
void SetMcs(uint8_t mcs)
Fill the MCS field of HT-SIG.
uint16_t m_htLength
HT length.
uint8_t m_coding
SU/MU coding (0 for BCC, 1 for LDPC)
uint8_t m_format
Format bit.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of VHT-SIG-A1 (in MHz).
uint8_t m_ul_dl
UL/DL bit.
uint16_t GetChannelWidth(void) const
Return the channel width (in MHz).
void SetMuFlag(bool mu)
Set the Multi-User (MU) flag.
uint8_t m_mcs
MCS field.
void SetNStreams(uint8_t nStreams)
Fill the number of streams field of HE-SIG-A1.
def start()
Definition: core.py:1855
static TypeId GetTypeId(void)
Get the type ID.
Implements the IEEE 802.11ac PHY header (VHT-SIG-A1/A2/B).
#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
void Print(std::ostream &os) const
void Serialize(Buffer::Iterator start) const
uint8_t m_gi_ltf_size
GI+LTF Size field.
uint16_t GetChannelWidth(void) const
Return the channel width (in MHz).
void SetCoding(bool ldpc)
Fill the coding field of HE-SIG-A2.
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetShortGuardIntervalDisambiguation(bool disambiguation)
Fill the short GI NSYM disambiguation field of VHT-SIG-A2.
void SetRate(uint64_t rate, uint16_t channelWidth=20)
Fill the RATE field of L-SIG (in bit/s).
uint8_t m_nsts
NSTS.
void SetBssColor(uint8_t bssColor)
Fill the BSS Color field of HE-SIG-A1.
void SetRate(uint64_t rate)
Fill the RATE field of L-SIG (in bit/s).
STL namespace.
uint8_t m_nsts
NSTS.
uint32_t Deserialize(Buffer::Iterator start)
uint8_t GetMcs(void) const
Return the MCS field of HE-SIG-A1.
uint16_t GetLength(void) const
Return the LENGTH field of L-SIG (in bytes).
uint16_t m_length
LENGTH field.
uint32_t Deserialize(Buffer::Iterator start)
bool IsLdpcCoding(void) const
Return whether LDPC is used or not.
iterator in a Buffer instance
Definition: buffer.h:98
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint32_t GetDistanceFrom(Iterator const &o) const
Definition: buffer.cc:783
static TypeId GetTypeId(void)
Get the type ID.
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
void SetCoding(bool ldpc)
Fill the coding field of VHT-SIG-A2.
void Serialize(Buffer::Iterator start) const
uint32_t GetSerializedSize(void) const
void SetMcs(uint8_t mcs)
Fill the MCS field of HE-SIG-A1.
uint8_t m_rate
RATE field.
void SetNStreams(uint8_t nStreams)
Fill the number of streams field of VHT-SIG-A1.
void Print(std::ostream &os) const
uint32_t GetSerializedSize(void) const
void SetSuMcs(uint8_t mcs)
Fill the SU VHT MCS field of VHT-SIG-A2.
bool m_mu
This is used to decide whether MU SIG-B should be added or not.
uint32_t GetSerializedSize(void) const
bool GetShortGuardInterval(void) const
Return the short guard interval field of HT-SIG.
uint16_t GetLength(void) const
Return the LENGTH field of L-SIG (in bytes).
uint8_t m_fecCoding
FEC coding (0 for BCC or 1 for LDPC)
Implements the IEEE 802.11 OFDM and ERP OFDM L-SIG PHY header.
void SetMuFlag(bool mu)
Set the Multi-User (MU) flag.
uint8_t m_coding
Coding (0 for BCC, 1 for LDPC)
uint8_t GetNStreams(void) const
Return the number of streams.
void SetLength(uint16_t length)
Fill the LENGTH field of L-SIG (in bytes).
uint8_t GetNStreams(void) const
Return the number of streams.
void SetAggregation(bool aggregation)
Fill the aggregation field of HT-SIG.
void Serialize(Buffer::Iterator start) const
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of HE-SIG-A1 (in MHz).
uint16_t m_length
LENGTH field.
uint8_t m_rate
RATE field.
static TypeId GetTypeId(void)
Get the type ID.
bool IsLdpcFecCoding(void) const
Return whether LDPC is used or not.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Print(std::ostream &os) const
uint32_t Deserialize(Buffer::Iterator start)
uint32_t Deserialize(Buffer::Iterator start)
bool GetAggregation(void) const
Return the aggregation field of HT-SIG.
uint8_t m_sgi_disambiguation
Short GI NSYM Disambiguation.
void Serialize(Buffer::Iterator start) const
uint8_t GetMcs(void) const
Return the MCS field of HT-SIG.
uint8_t m_suMcs
SU VHT MCS.
uint8_t m_sgi
Short GI.
void SetChannelWidth(uint16_t channelWidth)
Fill the channel width field of HT-SIG (in MHz).
uint64_t GetRate(void) const
Return the RATE field of L-SIG (in bit/s).
void Serialize(Buffer::Iterator start) const
Implements the IEEE 802.11n PHY header (HT-SIG1/2).
bool m_mu
This is used to decide whether MU SIG-B should be added or not.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
static TypeId GetTypeId(void)
Get the type ID.
void SetHtLength(uint16_t length)
Fill the HT length field of HT-SIG (in bytes).
uint8_t GetSuMcs(void) const
Return the SU VHT MCS field of VHT-SIG-A2.
bool GetShortGuardInterval(void) const
Return the short GI field of VHT-SIG-A2.
Implements the IEEE 802.11ax HE-SIG PHY header (HE-SIG-A1/A2/B)
Implements the IEEE 802.11 DSSS SIG PHY header.
uint16_t GetHtLength(void) const
Return the HT length field of HT-SIG (in bytes).
void SetGuardIntervalAndLtfSize(uint16_t gi, uint8_t ltf)
Fill the GI + LTF size field of HE-SIG-A1.
void SetLength(uint16_t length)
Fill the LENGTH field of L-SIG (in bytes).
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint8_t ReadU8(void)
Definition: buffer.h:1021
void SetShortGuardInterval(bool sgi)
Fill the short guard interval field of VHT-SIG-A2.
uint32_t Deserialize(Buffer::Iterator start)
uint16_t GetGuardInterval(void) const
Return the guard interval (in nanoseconds).
uint32_t GetSerializedSize(void) const
uint64_t GetRate(uint16_t channelWidth=20) const
Return the RATE field of L-SIG (in bit/s).
uint8_t m_mcs
Modulation and Coding Scheme index.
uint8_t GetBssColor(void) const
Return the BSS Color field in the HE-SIG-A1.
static TypeId GetTypeId(void)
Get the type ID.
void SetShortGuardInterval(bool sgi)
Fill the short guard interval field of HT-SIG.
uint32_t GetSerializedSize(void) const
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
uint8_t m_aggregation
Aggregation.
bool GetShortGuardIntervalDisambiguation(void) const
Return the short GI NSYM disambiguation field of VHT-SIG-A2.
TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
uint8_t m_bssColor
BSS color field.