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 "block-ack-type.h"
25 
26 namespace ns3 {
27 
28 class WifiMacHeader;
29 class WifiMode;
30 class Packet;
31 class Time;
32 
40 double DbmToW (double dbm);
48 double DbToRatio (double db);
56 double WToDbm (double w);
64 double RatioToDb (double ratio);
69 bool Is2_4Ghz (double frequency);
74 bool Is5Ghz (double frequency);
84 uint16_t ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Time heGuardInterval);
90 uint32_t GetAckSize (void);
97 uint32_t GetBlockAckSize (BlockAckType type);
103 uint32_t GetRtsSize (void);
109 uint32_t GetCtsSize (void);
118 bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
124 void AddWifiMacTrailer (Ptr<Packet> packet);
134 uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu);
135 
136 } // namespace ns3
137 
138 #endif /* WIFI_UTILS_H */
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: wifi-utils.cc:139
uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:117
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval)
Convert the guard interval to nanoseconds based on the wifimode.
Definition: wifi-utils.cc:68
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:38
bool Is2_4Ghz(double frequency)
Definition: wifi-utils.cc:56
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:146
uint32_t GetAckSize(void)
Return the total ACK size (including FCS trailer).
Definition: wifi-utils.cc:87
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:740
bool Is5Ghz(double frequency)
Definition: wifi-utils.cc:62
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:133
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:44
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:32
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:50
uint32_t GetCtsSize(void)
Return the total CTS size (including FCS trailer).
Definition: wifi-utils.cc:125
uint32_t GetBlockAckSize(BlockAckType type)
Return the total Block ACK size (including FCS trailer).
Definition: wifi-utils.cc:95
BlockAckType
The different block ACK policies.