A Discrete-Event Network Simulator
API
wifi-phy-header.h
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 #ifndef WIFI_PHY_HEADER_H
22 #define WIFI_PHY_HEADER_H
23 
24 #include "ns3/header.h"
25 
26 namespace ns3 {
27 
34 class DsssSigHeader : public Header
35 {
36 public:
37  DsssSigHeader ();
38  virtual ~DsssSigHeader ();
39 
44  static TypeId GetTypeId (void);
45  TypeId GetInstanceTypeId (void) const;
46  void Print (std::ostream &os) const;
47  uint32_t GetSerializedSize (void) const;
48  void Serialize (Buffer::Iterator start) const;
50 
56  void SetRate (uint64_t rate);
62  uint64_t GetRate (void) const;
68  void SetLength (uint16_t length);
74  uint16_t GetLength (void) const;
75 
76 
77 private:
78  uint8_t m_rate;
79  uint16_t m_length;
80 };
81 
82 
89 class LSigHeader : public Header
90 {
91 public:
92  LSigHeader ();
93  virtual ~LSigHeader ();
94 
99  static TypeId GetTypeId (void);
100  TypeId GetInstanceTypeId (void) const;
101  void Print (std::ostream &os) const;
102  uint32_t GetSerializedSize (void) const;
103  void Serialize (Buffer::Iterator start) const;
105 
112  void SetRate (uint64_t rate, uint16_t channelWidth = 20);
119  uint64_t GetRate (uint16_t channelWidth = 20) const;
125  void SetLength (uint16_t length);
131  uint16_t GetLength (void) const;
132 
133 
134 private:
135  uint8_t m_rate;
136  uint16_t m_length;
137 };
138 
139 
146 class HtSigHeader : public Header
147 {
148 public:
149  HtSigHeader ();
150  virtual ~HtSigHeader ();
151 
156  static TypeId GetTypeId (void);
157  TypeId GetInstanceTypeId (void) const;
158  void Print (std::ostream &os) const;
159  uint32_t GetSerializedSize (void) const;
160  void Serialize (Buffer::Iterator start) const;
162 
168  void SetMcs (uint8_t mcs);
174  uint8_t GetMcs (void) const;
180  void SetChannelWidth (uint16_t channelWidth);
186  uint16_t GetChannelWidth (void) const;
192  void SetAggregation (bool aggregation);
198  bool GetAggregation (void) const;
204  void SetFecCoding (bool ldpc);
210  bool IsLdpcFecCoding (void) const;
216  void SetShortGuardInterval (bool sgi);
222  bool GetShortGuardInterval (void) const;
228  void SetHtLength (uint16_t length);
234  uint16_t GetHtLength (void) const;
235 
236 
237 private:
238  uint8_t m_mcs;
239  uint8_t m_cbw20_40;
240  uint16_t m_htLength;
241  uint8_t m_aggregation;
242  uint8_t m_fecCoding;
243  uint8_t m_sgi;
244 };
245 
252 class VhtSigHeader : public Header
253 {
254 public:
255  VhtSigHeader ();
256  virtual ~VhtSigHeader ();
257 
262  static TypeId GetTypeId (void);
263  TypeId GetInstanceTypeId (void) const;
264  void Print (std::ostream &os) const;
265  uint32_t GetSerializedSize (void) const;
266  void Serialize (Buffer::Iterator start) const;
268 
274  void SetMuFlag (bool mu);
275 
281  void SetChannelWidth (uint16_t channelWidth);
287  uint16_t GetChannelWidth (void) const;
293  void SetNStreams (uint8_t nStreams);
299  uint8_t GetNStreams (void) const;
300 
306  void SetShortGuardInterval (bool sgi);
312  bool GetShortGuardInterval (void) const;
318  void SetShortGuardIntervalDisambiguation (bool disambiguation);
324  bool GetShortGuardIntervalDisambiguation (void) const;
330  void SetCoding (bool ldpc);
336  bool IsLdpcCoding (void) const;
342  void SetSuMcs (uint8_t mcs);
348  uint8_t GetSuMcs (void) const;
349 
350 
351 private:
352  //VHT-SIG-A1 fields
353  uint8_t m_bw;
354  uint8_t m_nsts;
355 
356  //VHT-SIG-A2 fields
357  uint8_t m_sgi;
359  uint8_t m_coding;
360  uint8_t m_suMcs;
361 
363  bool m_mu;
364  };
365 
366 
372 class HeSigHeader : public Header
373 {
374 public:
375  HeSigHeader ();
376  virtual ~HeSigHeader ();
377 
382  static TypeId GetTypeId (void);
383  TypeId GetInstanceTypeId (void) const;
384  void Print (std::ostream &os) const;
385  uint32_t GetSerializedSize (void) const;
386  void Serialize (Buffer::Iterator start) const;
388 
394  void SetMuFlag (bool mu);
395 
401  void SetMcs (uint8_t mcs);
407  uint8_t GetMcs (void) const;
413  void SetBssColor (uint8_t bssColor);
419  uint8_t GetBssColor (void) const;
425  void SetChannelWidth (uint16_t channelWidth);
431  uint16_t GetChannelWidth (void) const;
438  void SetGuardIntervalAndLtfSize (uint16_t gi, uint8_t ltf);
444  uint16_t GetGuardInterval (void) const;
450  void SetNStreams (uint8_t nStreams);
456  uint8_t GetNStreams (void) const;
462  void SetCoding (bool ldpc);
468  bool IsLdpcCoding (void) const;
469 
470 private:
471  //HE-SIG-A1 fields
472  uint8_t m_format;
473  uint8_t m_bssColor;
474  uint8_t m_ul_dl;
475  uint8_t m_mcs;
476  uint8_t m_spatialReuse;
477  uint8_t m_bandwidth;
478  uint8_t m_gi_ltf_size;
479  uint8_t m_nsts;
480 
481  //HE-SIG-A2 fields
482  uint8_t m_coding;
483 
485  bool m_mu;
486 };
487 
488 } //namespace ns3
489 
490 #endif /* WIFI_PHY_HEADER_H */
bool IsLdpcCoding(void) const
Return whether LDPC is used or not.
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.
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.
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).
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.
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.
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.
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
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.