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 SetShortGuardInterval (bool sgi);
210  bool GetShortGuardInterval (void) const;
216  void SetHtLength (uint16_t length);
222  uint16_t GetHtLength (void) const;
223 
224 
225 private:
226  uint8_t m_mcs;
227  uint8_t m_cbw20_40;
228  uint16_t m_htLength;
229  uint8_t m_aggregation;
230  uint8_t m_sgi;
231 };
232 
239 class VhtSigHeader : public Header
240 {
241 public:
242  VhtSigHeader ();
243  virtual ~VhtSigHeader ();
244 
249  static TypeId GetTypeId (void);
250  TypeId GetInstanceTypeId (void) const;
251  void Print (std::ostream &os) const;
252  uint32_t GetSerializedSize (void) const;
253  void Serialize (Buffer::Iterator start) const;
255 
261  void SetMuFlag (bool mu);
262 
268  void SetChannelWidth (uint16_t channelWidth);
274  uint16_t GetChannelWidth (void) const;
280  void SetNStreams (uint8_t nStreams);
286  uint8_t GetNStreams (void) const;
287 
293  void SetShortGuardInterval (bool sgi);
299  bool GetShortGuardInterval (void) const;
305  void SetShortGuardIntervalDisambiguation (bool disambiguation);
311  bool GetShortGuardIntervalDisambiguation (void) const;
317  void SetSuMcs (uint8_t mcs);
323  uint8_t GetSuMcs (void) const;
324 
325 
326 private:
327  //VHT-SIG-A1 fields
328  uint8_t m_bw;
329  uint8_t m_nsts;
330 
331  //VHT-SIG-A2 fields
332  uint8_t m_sgi;
334  uint8_t m_suMcs;
335 
337  bool m_mu;
338  };
339 
340 
346 class HeSigHeader : public Header
347 {
348 public:
349  HeSigHeader ();
350  virtual ~HeSigHeader ();
351 
356  static TypeId GetTypeId (void);
357  TypeId GetInstanceTypeId (void) const;
358  void Print (std::ostream &os) const;
359  uint32_t GetSerializedSize (void) const;
360  void Serialize (Buffer::Iterator start) const;
362 
368  void SetMuFlag (bool mu);
369 
375  void SetMcs (uint8_t mcs);
381  uint8_t GetMcs (void) const;
387  void SetBssColor (uint8_t bssColor);
393  uint8_t GetBssColor (void) const;
399  void SetChannelWidth (uint16_t channelWidth);
405  uint16_t GetChannelWidth (void) const;
412  void SetGuardIntervalAndLtfSize (uint16_t gi, uint8_t ltf);
418  uint16_t GetGuardInterval (void) const;
424  void SetNStreams (uint8_t nStreams);
430  uint8_t GetNStreams (void) const;
431 
432 
433 private:
434  //HE-SIG-A1 fields
435  uint8_t m_format;
436  uint8_t m_bssColor;
437  uint8_t m_ul_dl;
438  uint8_t m_mcs;
439  uint8_t m_spatialReuse;
440  uint8_t m_bandwidth;
441  uint8_t m_gi_ltf_size;
442  uint8_t m_nsts;
443 
445  bool m_mu;
446 };
447 
448 } //namespace ns3
449 
450 #endif /* WIFI_PHY_HEADER_H */
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.
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_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).
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)
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 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).
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 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.
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.