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-preamble.h"
26 #include "wifi-mode.h"
28 namespace ns3 {
30 class WifiNetDevice;
31 class WifiMacHeader;
32 class WifiMode;
33 class Packet;
34 class Time;
43 double DbmToW (double dbm);
51 double DbToRatio (double db);
59 double WToDbm (double w);
67 double RatioToDb (double ratio);
72 bool Is2_4Ghz (double frequency);
77 bool Is5Ghz (double frequency);
86 uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, const Ptr<WifiNetDevice> device);
96 uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Time heGuardInterval);
106 WifiPreamble GetPreambleForTransmission (WifiModulationClass modulation, bool useShortPreamble, bool useGreenfield);
116 uint16_t GetChannelWidthForTransmission (WifiMode mode, uint16_t maxSupportedChannelWidth);
133 uint32_t GetAckSize (void);
140 uint32_t GetBlockAckSize (BlockAckType type);
146 uint32_t GetRtsSize (void);
152 uint32_t GetCtsSize (void);
161 bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
167 void AddWifiMacTrailer (Ptr<Packet> packet);
177 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu);
184 bool IsAmpdu (Ptr<const Packet> packet);
195  Time GetPpduMaxTime (WifiPreamble preamble);
198  const uint16_t SEQNO_SPACE_SIZE = 4096;
202 } // namespace ns3
204 #endif /* WIFI_UTILS_H */
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: wifi-utils.cc:221
uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:199
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:41
bool Is2_4Ghz(double frequency)
Definition: wifi-utils.cc:59
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:228
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:201
uint32_t GetAckSize(void)
Return the total ACK size (including FCS trailer).
Definition: wifi-utils.cc:181
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:743
bool Is5Ghz(double frequency)
Definition: wifi-utils.cc:65
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble, bool useGreenfield)
Return the preamble to be used for the transmission.
Definition: wifi-utils.cc:128
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-preamble.h:30
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the wifimode.
Definition: wifi-utils.cc:71
bool IsAmpdu(Ptr< const Packet > packet)
Definition: wifi-utils.cc:270
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:109
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
Definition: wifi-utils.cc:215
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:158
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:207
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:36
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:244
uint32_t GetBlockAckSize(BlockAckType type)
Return the total Block ACK size (including FCS trailer).
Definition: wifi-utils.cc:189
const uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
Definition: wifi-utils.h:198
The different block ACK policies.