A Discrete-Event Network Simulator
API
wifi-utils.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Sébastien Deronne <sebastien.deronne@gmail.com>
18  */
19 
20 #ifndef WIFI_UTILS_H
21 #define WIFI_UTILS_H
22 
23 #include "block-ack-type.h"
24 
25 #include "ns3/ptr.h"
26 
27 #include <list>
28 
29 namespace ns3
30 {
31 
32 class WifiMacHeader;
33 class Packet;
34 
42 double DbmToW(double dbm);
50 double DbToRatio(double db);
58 double WToDbm(double w);
66 double RatioToDb(double ratio);
72 uint32_t GetAckSize();
79 uint32_t GetBlockAckSize(BlockAckType type);
86 uint32_t GetBlockAckRequestSize(BlockAckReqType type);
93 uint32_t GetMuBarSize(std::list<BlockAckReqType> types);
99 uint32_t GetRtsSize();
105 uint32_t GetCtsSize();
114 bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize);
120 void AddWifiMacTrailer(Ptr<Packet> packet);
130 uint32_t GetSize(Ptr<const Packet> packet, const WifiMacHeader* hdr, bool isAmpdu);
131 
133 static constexpr uint16_t SEQNO_SPACE_SIZE = 4096;
134 
136 static constexpr uint16_t SEQNO_SPACE_HALF_SIZE = SEQNO_SPACE_SIZE / 2;
137 
140 static constexpr uint8_t SINGLE_LINK_OP_ID = 0;
141 
143 static constexpr uint8_t WIFI_LINKID_UNDEFINED = 0xff;
144 
145 } // namespace ns3
146 
147 #endif /* WIFI_UTILS_H */
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint16_t SEQNO_SPACE_HALF_SIZE
Size of the half the space of sequence numbers (used to determine old packets)
Definition: wifi-utils.h:136
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:52
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:46
uint32_t GetRtsSize()
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:103
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:40
uint32_t GetBlockAckRequestSize(BlockAckReqType type)
Return the total BlockAckRequest size (including FCS trailer).
Definition: wifi-utils.cc:76
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
Definition: wifi-utils.h:140
uint32_t GetMuBarSize(std::list< BlockAckReqType > types)
Return the total MU-BAR size (including FCS trailer).
Definition: wifi-utils.cc:86
static constexpr uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
Definition: wifi-utils.h:133
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
Definition: wifi-utils.cc:66
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: wifi-utils.cc:125
static constexpr uint8_t WIFI_LINKID_UNDEFINED
Invalid link identifier.
Definition: wifi-utils.h:143
uint32_t GetAckSize()
Return the total Ack size (including FCS trailer).
Definition: wifi-utils.cc:58
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:132
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:34
uint32_t GetCtsSize()
Return the total CTS size (including FCS trailer).
Definition: wifi-utils.cc:111
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
Definition: wifi-utils.cc:119