A Discrete-Event Network Simulator
API
wifi-utils.h
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
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_UTILS_H
22 #define WIFI_UTILS_H
23 
24 #include "wifi-mode.h"
25 #include "ctrl-headers.h"
26 #include "wifi-mac-header.h"
27 #include "wifi-mac-trailer.h"
28 #include "ns3/nstime.h"
29 #include "ns3/uinteger.h"
30 #include "ns3/packet.h"
31 
32 namespace ns3 {
33 
41 double Log2 (double val);
49 double DbmToW (double dbm);
57 double DbToRatio (double db);
65 double WToDbm (double w);
73 double RatioToDb (double ratio);
78 bool Is2_4Ghz (double frequency);
83 bool Is5Ghz (double frequency);
93 uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Time heGuardInterval);
99 uint32_t GetAckSize (void);
106 uint32_t GetBlockAckSize (BlockAckType type);
112 uint32_t GetRtsSize (void);
118 uint32_t GetCtsSize (void);
127 bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
133 void AddWifiMacTrailer (Ptr<Packet> packet);
143 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu);
144 
145 } // namespace ns3
146 
147 #endif /* WIFI_UTILS_H */
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: wifi-utils.cc:152
uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:130
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval)
Convert the guard interval to nanoseconds based on the wifimode.
Definition: wifi-utils.cc:81
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:42
bool Is2_4Ghz(double frequency)
Definition: wifi-utils.cc:61
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:159
uint32_t GetAckSize(void)
Return the total ACK size (including FCS trailer).
Definition: wifi-utils.cc:100
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:733
bool Is5Ghz(double frequency)
Definition: wifi-utils.cc:71
BlockAckType
Enumeration for different block ACK policies.
Definition: ctrl-headers.h:31
Every class exported by the ns3 library is enclosed in the ns3 namespace.
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
Definition: wifi-utils.cc:146
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:49
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:55
uint32_t GetCtsSize(void)
Return the total CTS size (including FCS trailer).
Definition: wifi-utils.cc:138
uint32_t GetBlockAckSize(BlockAckType type)
Return the total Block ACK size (including FCS trailer).
Definition: wifi-utils.cc:108
SpectrumValue Log2(const SpectrumValue &arg)