A Discrete-Event Network Simulator
API
wifi-phy-common.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006,2007 INRIA
4  * Copyright (c) 2020 Orange Labs
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  * Rediet <getachew.redieteab@orange.com>
21  */
22 
23 #ifndef WIFI_PHY_COMMON_H
24 #define WIFI_PHY_COMMON_H
25 
26 #include <ostream>
27 #include "ns3/fatal-error.h"
28 
40 namespace ns3 {
41 
51 typedef uint16_t WifiCodeRate;
52 const uint16_t WIFI_CODE_RATE_UNDEFINED = 0;
53 const uint16_t WIFI_CODE_RATE_1_2 = 1;
54 const uint16_t WIFI_CODE_RATE_2_3 = 2;
55 const uint16_t WIFI_CODE_RATE_3_4 = 3;
56 const uint16_t WIFI_CODE_RATE_5_6 = 4;
57 
63 {
73 };
74 
82 inline std::ostream& operator<< (std::ostream &os, const WifiPreamble &preamble)
83 {
84  switch (preamble)
85  {
86  case WIFI_PREAMBLE_LONG:
87  return (os << "LONG");
89  return (os << "SHORT");
91  return (os << "HT_MF");
93  return (os << "VHT_SU");
95  return (os << "VHT_MU");
97  return (os << "HE_SU");
99  return (os << "HE_ER_SU");
100  case WIFI_PREAMBLE_HE_MU:
101  return (os << "HE_MU");
102  case WIFI_PREAMBLE_HE_TB:
103  return (os << "HE_TB");
104  default:
105  NS_FATAL_ERROR ("Invalid preamble");
106  return (os << "INVALID");
107  }
108 }
109 
117 {
128 };
129 
137 inline std::ostream& operator<< (std::ostream &os, const WifiModulationClass &modulation)
138 {
139  switch (modulation)
140  {
141  case WIFI_MOD_CLASS_DSSS:
142  return (os << "DSSS");
144  return (os << "HR/DSSS");
146  return (os << "ERP-OFDM");
147  case WIFI_MOD_CLASS_OFDM:
148  return (os << "OFDM");
149  case WIFI_MOD_CLASS_HT:
150  return (os << "HT");
151  case WIFI_MOD_CLASS_VHT:
152  return (os << "VHT");
153  case WIFI_MOD_CLASS_HE:
154  return (os << "HE");
155  default:
156  NS_FATAL_ERROR ("Unknown modulation");
157  return (os << "unknown");
158  }
159 }
160 
166 {
186 };
187 
195 inline std::ostream& operator<< (std::ostream &os, const WifiPpduField &field)
196 {
197  switch (field)
198  {
200  return (os << "preamble");
202  return (os << "non-HT header");
204  return (os << "HT-SIG");
206  return (os << "training");
208  return (os << "SIG-A");
210  return (os << "SIG-B");
212  return (os << "data");
213  default:
214  NS_FATAL_ERROR ("Unknown field");
215  return (os << "unknown");
216  }
217 }
218 
224 {
228 };
229 
237 inline std::ostream& operator<< (std::ostream &os, const WifiPpduType &type)
238 {
239  switch (type)
240  {
241  case WIFI_PPDU_TYPE_SU:
242  return (os << "SU");
244  return (os << "DL MU");
246  return (os << "UL MU");
247  default:
248  NS_FATAL_ERROR ("Unknown type");
249  return (os << "unknown");
250  }
251 }
252 
258 {
259  UNKNOWN = 0,
277 };
278 
286 inline std::ostream& operator<< (std::ostream &os, const WifiPhyRxfailureReason &reason)
287 {
288  switch (reason)
289  {
291  return (os << "UNSUPPORTED_SETTINGS");
292  case CHANNEL_SWITCHING:
293  return (os << "CHANNEL_SWITCHING");
294  case RXING:
295  return (os << "RXING");
296  case TXING:
297  return (os << "TXING");
298  case SLEEPING:
299  return (os << "SLEEPING");
301  return (os << "BUSY_DECODING_PREAMBLE");
303  return (os << "PREAMBLE_DETECT_FAILURE");
305  return (os << "RECEPTION_ABORTED_BY_TX");
306  case L_SIG_FAILURE:
307  return (os << "L_SIG_FAILURE");
308  case HT_SIG_FAILURE:
309  return (os << "HT_SIG_FAILURE");
310  case SIG_A_FAILURE:
311  return (os << "SIG_A_FAILURE");
312  case SIG_B_FAILURE:
313  return (os << "SIG_B_FAILURE");
315  return (os << "PREAMBLE_DETECTION_PACKET_SWITCH");
317  return (os << "FRAME_CAPTURE_PACKET_SWITCH");
318  case OBSS_PD_CCA_RESET:
319  return (os << "OBSS_PD_CCA_RESET");
320  case HE_TB_PPDU_TOO_LATE:
321  return (os << "HE_TB_PPDU_TOO_LATE");
322  case FILTERED:
323  return (os << "FILTERED");
324  case UNKNOWN:
325  default:
326  NS_FATAL_ERROR ("Unknown reason");
327  return (os << "UNKNOWN");
328  }
329 }
330 
331 } //namespace ns3
332 
333 #endif /* WIFI_PHY_COMMON_H */
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802...
const uint16_t WIFI_CODE_RATE_2_3
2/3 coding rate
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
Modulation class unknown or unspecified.
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
HR/DSSS (Clause 16)
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP, HT-GF-STF + HT-GF-LTF1 fields for HT-GF, L-STF + L-LTF fields otherwise.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPpduField
The type of PPDU field (grouped for convenience)
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
const uint16_t WIFI_CODE_RATE_UNDEFINED
undefined coding rate
STF + LTF fields (excluding those in preamble for HT-GF)
PHY header field for DSSS or ERP, short PHY header field for HR/DSSS or ERP, field not present for HT...
const uint16_t WIFI_CODE_RATE_1_2
1/2 coding rate