A Discrete-Event Network Simulator
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016
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
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  */
21 #ifndef WIFI_UTILS_H
22 #define WIFI_UTILS_H
24 #include "block-ack-type.h"
25 #include "wifi-phy-common.h"
26 #include "wifi-mode.h"
27 #include <list>
29 namespace ns3 {
31 class WifiNetDevice;
32 class WifiMacHeader;
33 class WifiMode;
34 class Packet;
35 class Time;
44 double DbmToW (double dbm);
52 double DbToRatio (double db);
60 double WToDbm (double w);
68 double RatioToDb (double ratio);
77 uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, const Ptr<WifiNetDevice> device);
87 uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Time heGuardInterval);
96 WifiPreamble GetPreambleForTransmission (WifiModulationClass modulation, bool useShortPreamble);
106 uint16_t GetChannelWidthForTransmission (WifiMode mode, uint16_t maxSupportedChannelWidth);
123 uint32_t GetAckSize (void);
130 uint32_t GetBlockAckSize (BlockAckType type);
137 uint32_t GetBlockAckRequestSize (BlockAckReqType type);
144 uint32_t GetMuBarSize (std::list<BlockAckReqType> types);
150 uint32_t GetRtsSize (void);
156 uint32_t GetCtsSize (void);
165 bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
171 void AddWifiMacTrailer (Ptr<Packet> packet);
181 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu);
191 Time GetPpduMaxTime (WifiPreamble preamble);
201 bool IsHt (WifiPreamble preamble);
210 bool IsVht (WifiPreamble preamble);
219 bool IsHe (WifiPreamble preamble);
222 const uint16_t SEQNO_SPACE_SIZE = 4096;
226 } // namespace ns3
228 #endif /* WIFI_UTILS_H */
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802...
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: wifi-utils.cc:231
uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:209
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:41
Declaration of the following enums:
uint32_t GetSize(Ptr< const Packet > packet, const WifiMacHeader *hdr, bool isAmpdu)
Return the total size of the packet after WifiMacHeader and FCS trailer have been added...
Definition: wifi-utils.cc:238
const uint16_t SEQNO_SPACE_HALF_SIZE
Size of the half the space of sequence numbers (used to determine old packets)
Definition: wifi-utils.h:225
uint32_t GetAckSize(void)
Return the total Ack size (including FCS trailer).
Definition: wifi-utils.cc:164
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:813
bool IsVht(WifiPreamble preamble)
Return whether the preamble is a VHT format preamble.
Definition: wifi-utils.cc:283
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Definition: wifi-utils.cc:116
bool IsHe(WifiPreamble preamble)
Return whether the preamble is a HE format preamble.
Definition: wifi-utils.cc:289
The type of preamble to be used by an IEEE 802.11 transmission.
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
Definition: wifi-utils.cc:59
uint32_t GetMuBarSize(std::list< BlockAckReqType > types)
Return the total MU-BAR size (including FCS trailer).
Definition: wifi-utils.cc:192
uint32_t GetBlockAckRequestSize(BlockAckReqType type)
Return the total BlockAckRequest size (including FCS trailer).
Definition: wifi-utils.cc:182
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t GetChannelWidthForTransmission(WifiMode mode, uint16_t maxSupportedChannelWidth)
Return the channel width that corresponds to the selected mode (instead of letting the PHY&#39;s default ...
Definition: wifi-utils.cc:97
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
Definition: wifi-utils.cc:225
bool IsAllowedControlAnswerModulationClass(WifiModulationClass modClassReq, WifiModulationClass modClassAnswer)
Return whether the modulation class of the selected mode for the control answer frame is allowed...
Definition: wifi-utils.cc:141
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:47
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:35
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:53
uint32_t GetCtsSize(void)
Return the total CTS size (including FCS trailer).
Definition: wifi-utils.cc:217
Time GetPpduMaxTime(WifiPreamble preamble)
Get the maximum PPDU duration (see Section 10.14 of 802.11-2016) for the PHY layers defining the aPPD...
Definition: wifi-utils.cc:254
bool IsHt(WifiPreamble preamble)
Return whether the preamble is a HT format preamble.
Definition: wifi-utils.cc:277
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
Definition: wifi-utils.cc:172
const uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
Definition: wifi-utils.h:222