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"
55 virtual void Print (std::ostream &os)
const;
64 : m_dataTxVector (dataTxVector)
76 static TypeId tid =
TypeId (
"ns3::HighLatencyDataTxVectorTag")
78 .AddConstructor<HighLatencyDataTxVectorTag> ()
120 virtual void Print (std::ostream &os)
const;
129 : m_rtsTxVector (rtsTxVector)
141 static TypeId tid =
TypeId (
"ns3::HighLatencyRtsTxVectorTag")
143 .AddConstructor<HighLatencyRtsTxVectorTag> ()
185 virtual void Print (std::ostream &os)
const;
194 : m_ctsToSelfTxVector (ctsToSelfTxVector)
206 static TypeId tid =
TypeId (
"ns3::HighLatencyCtsToSelfTxVectorTag")
208 .AddConstructor<HighLatencyCtsToSelfTxVectorTag> ()
247 static TypeId tid =
TypeId (
"ns3::WifiRemoteStationManager")
249 .AddAttribute (
"IsLowLatency",
"If true, we attempt to modelize a so-called low-latency device: a device"
250 " where decisions about tx parameters can be made on a per-packet basis and feedback about the"
251 " transmission of each packet is obtained before sending the next. Otherwise, we modelize a "
252 " high-latency device, that is a device where we cannot update our decision about tx parameters"
253 " after every packet transmission.",
256 MakeBooleanChecker ())
257 .AddAttribute (
"MaxSsrc",
"The maximum number of retransmission attempts for an RTS. This value"
258 " will not have any effect on some rate control algorithms.",
261 MakeUintegerChecker<uint32_t> ())
262 .AddAttribute (
"MaxSlrc",
"The maximum number of retransmission attempts for a DATA packet. This value"
263 " will not have any effect on some rate control algorithms.",
266 MakeUintegerChecker<uint32_t> ())
267 .AddAttribute (
"RtsCtsThreshold",
"If the size of the data packet + LLC header + MAC header + FCS trailer is bigger than "
268 "this value, we use an RTS/CTS handshake before sending the data, as per IEEE Std. 802.11-2007, Section 9.2.6. "
269 "This value will not have any effect on some rate control algorithms.",
272 MakeUintegerChecker<uint32_t> ())
273 .AddAttribute (
"FragmentationThreshold",
"If the size of the data packet + LLC header + MAC header + FCS trailer is bigger"
274 "than this value, we fragment it such that the size of the fragments are equal or smaller "
275 "than this value, as per IEEE Std. 802.11-2007, Section 9.4. "
276 "This value will not have any effect on some rate control algorithms.",
280 MakeUintegerChecker<uint32_t> ())
281 .AddAttribute (
"NonUnicastMode",
"Wifi mode used for non-unicast transmissions.",
284 MakeWifiModeChecker ())
285 .AddAttribute (
"DefaultTxPowerLevel",
"Default power level to be used for transmissions. "
286 "This is the power level that is used by all those WifiManagers that do not"
287 "implement TX power control.",
290 MakeUintegerChecker<uint8_t> ())
291 .AddTraceSource (
"MacTxRtsFailed",
292 "The transmission of a RTS by the MAC layer has failed",
294 .AddTraceSource (
"MacTxDataFailed",
295 "The transmission of a data packet by the MAC layer has failed",
297 .AddTraceSource (
"MacTxFinalRtsFailed",
298 "The transmission of a RTS has exceeded the maximum number of attempts",
300 .AddTraceSource (
"MacTxFinalDataFailed",
301 "The transmission of a data packet has exceeded the maximum number of attempts",
317 for (StationStates::const_iterator i =
m_states.begin (); i !=
m_states.end (); i++)
405 state->m_operationalRateSet.clear ();
406 state->m_operationalMcsSet.clear ();
415 for (
WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++)
423 state->m_operationalRateSet.push_back (mode);
451 for (
WifiMcsListIterator i = state->m_operationalMcsSet.begin (); i != state->m_operationalMcsSet.end (); i++)
459 state->m_operationalMcsSet.push_back (mcs);
528 ConstCast<Packet> (packet)->RemovePacketTag (datatag);
529 ConstCast<Packet> (packet)->RemovePacketTag (rtstag);
530 ConstCast<Packet> (packet)->RemovePacketTag (ctstoselftag);
558 found = ConstCast<Packet> (packet)->PeekPacketTag (datatag);
576 found = ConstCast<Packet> (packet)->PeekPacketTag (ctstoselftag);
601 found = ConstCast<Packet> (packet)->PeekPacketTag (rtstag);
630 double ctsSnr,
WifiMode ctsMode,
double rtsSnr)
634 station->m_state->m_info.NotifyTxSuccess (station->m_ssrc);
640 double ackSnr,
WifiMode ackMode,
double dataSnr)
644 station->m_state->m_info.NotifyTxSuccess (station->m_slrc);
653 station->m_state->m_info.NotifyTxFailed ();
663 station->m_state->m_info.NotifyTxFailed ();
724 bool normally = station->m_ssrc <
GetMaxSsrc ();
733 bool normally = station->m_slrc <
GetMaxSlrc ();
757 NS_LOG_WARN (
"Fragmentation threshold should be larger than 256. Setting to 256.");
766 if (threshold % 2 != 0)
768 NS_LOG_WARN (
"Fragmentation threshold should be an even number. Setting to " << threshold - 1);
804 if (fragmentNumber >= nFragment)
809 if (fragmentNumber == nFragment - 1)
812 return lastFragmentSize;
827 return fragmentOffset;
834 bool isLast = fragmentNumber == (
GetNFragments (header, packet) - 1);
861 if ((!found || i->GetPhyRate () > mode.
GetPhyRate ())
980 <<
". Check standard and selected rates match.");
1128 for (StationStates::const_iterator i =
m_states.begin (); i !=
m_states.end (); i++)
1130 if ((*i)->m_address == address)
1160 return Lookup (address, tid);
1167 if ((*i)->m_tid == tid
1168 && (*i)->m_state->m_address == address)
1177 station->
m_tid = tid;
1383 : m_memoryTime (Seconds (1.0)),
1384 m_lastUpdate (Seconds (0.0)),
1402 m_failAvg = (double)retryCounter / (1 + (
double) retryCounter) * (1.0 - coefficient) + coefficient *
m_failAvg;