22 #include "ns3/simulator.h"
23 #include "ns3/assert.h"
26 #include "ns3/boolean.h"
27 #include "ns3/double.h"
28 #include "ns3/uinteger.h"
29 #include "ns3/wifi-phy.h"
30 #include "ns3/trace-source-accessor.h"
56 virtual void Print (std::ostream &os)
const;
66 : m_rtsMode (rtsMode),
85 .AddConstructor<TxModeTag> ()
86 .AddAttribute (
"RtsTxMode",
87 "Tx mode of rts to use later",
90 MakeWifiModeChecker ())
91 .AddAttribute (
"DataTxMode",
92 "Tx mode of data to use later",
95 MakeWifiModeChecker ())
137 static TypeId tid =
TypeId (
"ns3::WifiRemoteStationManager")
139 .AddAttribute (
"IsLowLatency",
"If true, we attempt to modelize a so-called low-latency device: a device"
140 " where decisions about tx parameters can be made on a per-packet basis and feedback about the"
141 " transmission of each packet is obtained before sending the next. Otherwise, we modelize a "
142 " high-latency device, that is a device where we cannot update our decision about tx parameters"
143 " after every packet transmission.",
146 MakeBooleanChecker ())
147 .AddAttribute (
"MaxSsrc",
"The maximum number of retransmission attempts for an RTS. This value"
148 " will not have any effect on some rate control algorithms.",
151 MakeUintegerChecker<uint32_t> ())
152 .AddAttribute (
"MaxSlrc",
"The maximum number of retransmission attempts for a DATA packet. This value"
153 " will not have any effect on some rate control algorithms.",
156 MakeUintegerChecker<uint32_t> ())
157 .AddAttribute (
"RtsCtsThreshold",
"If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than "
158 "this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. "
159 "This value will not have any effect on some rate control algorithms.",
162 MakeUintegerChecker<uint32_t> ())
163 .AddAttribute (
"FragmentationThreshold",
"If the size of the data packet + LLC header + MAC header + FCS trailer is bigger"
164 "than this value, we fragment it such that the size of the fragments are equal or smaller "
165 "than this value, as per IEEE Std. 802.11-2007, Section 9.4. "
166 "This value will not have any effect on some rate control algorithms.",
170 MakeUintegerChecker<uint32_t> ())
171 .AddAttribute (
"NonUnicastMode",
"Wifi mode used for non-unicast transmissions.",
174 MakeWifiModeChecker ())
175 .AddTraceSource (
"MacTxRtsFailed",
176 "The transmission of a RTS by the MAC layer has failed",
178 .AddTraceSource (
"MacTxDataFailed",
179 "The transmission of a data packet by the MAC layer has failed",
181 .AddTraceSource (
"MacTxFinalRtsFailed",
182 "The transmission of a RTS has exceeded the maximum number of attempts",
184 .AddTraceSource (
"MacTxFinalDataFailed",
185 "The transmission of a data packet has exceeded the maximum number of attempts",
201 for (StationStates::const_iterator i =
m_states.begin (); i !=
m_states.end (); i++)
271 state->m_operationalRateSet.clear ();
279 for (
WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++)
287 state->m_operationalRateSet.push_back (mode);
353 ConstCast<Packet> (packet)->RemovePacketTag (tag);
370 found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
385 found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
411 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
415 station->m_state->m_info.NotifyTxSuccess (station->m_ssrc);
421 double ackSnr,
WifiMode ackMode,
double dataSnr)
425 station->m_state->m_info.NotifyTxSuccess (station->m_slrc);
434 station->m_state->m_info.NotifyTxFailed ();
444 station->m_state->m_info.NotifyTxFailed ();
477 bool normally = station->m_ssrc <
GetMaxSsrc ();
486 bool normally = station->m_slrc <
GetMaxSlrc ();
510 NS_LOG_WARN (
"Fragmentation threshold should be larger than 256. Setting to 256.");
519 if (threshold % 2 != 0)
521 NS_LOG_WARN (
"Fragmentation threshold should be an even number. Setting to " << threshold - 1);
557 if (fragmentNumber >= nFragment)
562 if (fragmentNumber == nFragment - 1)
565 return lastFragmentSize;
580 return fragmentOffset;
587 bool isLast = fragmentNumber == (
GetNFragments (header, packet) - 1);
614 if ((!found || i->GetPhyRate () > mode.
GetPhyRate ())
690 <<
". Check standard and selected rates match.");
719 for (StationStates::const_iterator i =
m_states.begin (); i !=
m_states.end (); i++)
721 if ((*i)->m_address == address)
745 return Lookup (address, tid);
752 if ((*i)->m_tid == tid
753 && (*i)->m_state->m_address == address)
762 station->
m_tid = tid;
863 : m_memoryTime (
Seconds (1.0)),
882 m_failAvg = (double)retryCounter / (1 + (
double) retryCounter) * (1.0 - coefficient) + coefficient *
m_failAvg;