A Discrete-Event Network Simulator
API
constant-rate-wifi-manager.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2004,2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #include "ns3/string.h"
22 #include "ns3/log.h"
24 #include "ns3/wifi-tx-vector.h"
25 #include "ns3/wifi-utils.h"
26 
27 #define Min(a,b) ((a < b) ? a : b)
28 
29 namespace ns3 {
30 
31 NS_LOG_COMPONENT_DEFINE ("ConstantRateWifiManager");
32 
33 NS_OBJECT_ENSURE_REGISTERED (ConstantRateWifiManager);
34 
35 TypeId
37 {
38  static TypeId tid = TypeId ("ns3::ConstantRateWifiManager")
40  .SetGroupName ("Wifi")
41  .AddConstructor<ConstantRateWifiManager> ()
42  .AddAttribute ("DataMode", "The transmission mode to use for every data packet transmission",
43  StringValue ("OfdmRate6Mbps"),
46  .AddAttribute ("ControlMode", "The transmission mode to use for every RTS packet transmission.",
47  StringValue ("OfdmRate6Mbps"),
50  ;
51  return tid;
52 }
53 
55 {
56  NS_LOG_FUNCTION (this);
57 }
58 
60 {
61  NS_LOG_FUNCTION (this);
62 }
63 
66 {
67  NS_LOG_FUNCTION (this);
68  WifiRemoteStation *station = new WifiRemoteStation ();
69  return station;
70 }
71 
72 void
74  double rxSnr, WifiMode txMode)
75 {
76  NS_LOG_FUNCTION (this << station << rxSnr << txMode);
77 }
78 
79 void
81 {
82  NS_LOG_FUNCTION (this << station);
83 }
84 
85 void
87 {
88  NS_LOG_FUNCTION (this << station);
89 }
90 
91 void
93  double ctsSnr, WifiMode ctsMode, double rtsSnr)
94 {
95  NS_LOG_FUNCTION (this << st << ctsSnr << ctsMode << rtsSnr);
96 }
97 
98 void
100  double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss)
101 {
102  NS_LOG_FUNCTION (this << st << ackSnr << ackMode << dataSnr << dataChannelWidth << +dataNss);
103 }
104 
105 void
107 {
108  NS_LOG_FUNCTION (this << station);
109 }
110 
111 void
113 {
114  NS_LOG_FUNCTION (this << station);
115 }
116 
119 {
120  NS_LOG_FUNCTION (this << st);
123  {
124  nss = 1 + (m_dataMode.GetMcsValue () / 8);
125  }
127 }
128 
131 {
132  NS_LOG_FUNCTION (this << st);
134 }
135 
136 } //namespace ns3
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
Hold variables of type string.
Definition: string.h:41
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
use constant rates for data and RTS transmissions
Ptr< const AttributeChecker > MakeWifiModeChecker(void)
Definition: wifi-mode.cc:235
WifiPreamble GetPreambleForTransmission(WifiModulationClass modulation, bool useShortPreamble)
Return the preamble to be used for the transmission.
Definition: wifi-utils.cc:116
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:47
uint8_t GetNumberOfSupportedStreams(Mac48Address address) const
Return the number of spatial streams supported by the station.
bool GetShortPreambleEnabled(void) const
Return whether the device uses short PHY preambles.
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition: int64x64.h:218
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1313
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
Definition: wifi-utils.cc:59
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
hold a list of per-remote-station state.
WifiModulationClass GetModulationClass() const
Definition: wifi-mode.cc:159
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
WifiMode m_ctlMode
Wifi mode for RTS frames.
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:97
void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) override
This method is a pure virtual method that must be implemented by the sub-class.
Ptr< const AttributeAccessor > MakeWifiModeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition: wifi-mode.h:246
bool GetShortGuardIntervalSupported(void) const
Return whether the device has SGI support enabled.
bool GetAggregation(const WifiRemoteStation *station) const
Return whether the given station supports A-MPDU.
WifiMode m_dataMode
Wifi mode for unicast Data frames.
WifiRemoteStation * DoCreateStation(void) const override
uint16_t GetGuardInterval(void) const
Return the supported HE guard interval duration (in nanoseconds).
static TypeId GetTypeId(void)
Get the type ID.
uint8_t GetMcsValue(void) const
Definition: wifi-mode.cc:137
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
hold per-remote-station state.
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
uint16_t GetChannelWidth(const WifiRemoteStation *station) const
Return the channel width supported by the station.