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 <list>
25#include "ns3/ptr.h"
26#include "block-ack-type.h"
27
28namespace ns3 {
29
30class WifiMacHeader;
31class Packet;
32
40double DbmToW (double dbm);
48double DbToRatio (double db);
56double WToDbm (double w);
64double RatioToDb (double ratio);
70uint32_t GetAckSize (void);
77uint32_t GetBlockAckSize (BlockAckType type);
84uint32_t GetBlockAckRequestSize (BlockAckReqType type);
91uint32_t GetMuBarSize (std::list<BlockAckReqType> types);
97uint32_t GetRtsSize (void);
103uint32_t GetCtsSize (void);
112bool IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize);
118void AddWifiMacTrailer (Ptr<Packet> packet);
128uint32_t GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu);
129
131const uint16_t SEQNO_SPACE_SIZE = 4096;
132
135} // namespace ns3
136
137#endif /* WIFI_UTILS_H */
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:49
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:43
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:37
uint32_t GetAckSize(void)
Return the total Ack size (including FCS trailer).
Definition: wifi-utils.cc:55
uint32_t GetRtsSize(void)
Return the total RTS size (including FCS trailer).
Definition: wifi-utils.cc:100
uint32_t GetBlockAckRequestSize(BlockAckReqType type)
Return the total BlockAckRequest size (including FCS trailer).
Definition: wifi-utils.cc:73
uint32_t GetMuBarSize(std::list< BlockAckReqType > types)
Return the total MU-BAR size (including FCS trailer).
Definition: wifi-utils.cc:83
uint32_t GetCtsSize(void)
Return the total CTS size (including FCS trailer).
Definition: wifi-utils.cc:108
uint32_t GetBlockAckSize(BlockAckType type)
Return the total BlockAck size (including FCS trailer).
Definition: wifi-utils.cc:63
void AddWifiMacTrailer(Ptr< Packet > packet)
Add FCS trailer to a packet.
Definition: wifi-utils.cc:122
const uint16_t SEQNO_SPACE_SIZE
Size of the space of sequence numbers.
Definition: wifi-utils.h:131
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:129
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:134
double DbToRatio(double dB)
Convert from dB to ratio.
Definition: wifi-utils.cc:31
bool IsInWindow(uint16_t seq, uint16_t winstart, uint16_t winsize)
Definition: wifi-utils.cc:116