--- a/src/devices/wifi/wifi-remote-station-manager.cc Sun Aug 23 20:54:31 2009 -0700
+++ b/src/devices/wifi/wifi-remote-station-manager.cc Mon Aug 24 13:09:32 2009 +0200
@@ -159,6 +159,18 @@
WifiModeValue (),
MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
MakeWifiModeChecker ())
+ .AddTraceSource ("MacTxRtsFailed",
+ "The transmission of a RTS by the MAC layer has failed",
+ MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed))
+ .AddTraceSource ("MacTxDataFailed",
+ "The transmission of a data packet by the MAC layer has failed",
+ MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxDataFailed))
+ .AddTraceSource ("MacTxFinalRtsFailed",
+ "The transmission of a RTS has exceeded the maximum number of attempts",
+ MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalRtsFailed))
+ .AddTraceSource ("MacTxFinalDataFailed",
+ "The transmission of a data packet has exceeded the maximum number of attempts",
+ MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalDataFailed))
;
return tid;
}
@@ -175,7 +187,7 @@
{
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
{
- delete (*i).second;
+ delete (*i);
}
m_stations.clear ();
delete m_nonUnicast;
@@ -237,14 +249,15 @@
}
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
{
- if ((*i).first == address)
+ if ((*i)->GetAddress () == address)
{
- return (*i).second;
+ return (*i);
}
}
WifiRemoteStation *station = CreateStation ();
+ station->SetAddress(address);
station->Reset ();
- m_stations.push_back (std::make_pair (address, station));
+ m_stations.push_back (station);
return station;
}
@@ -264,7 +277,7 @@
{
for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
{
- delete i->second;
+ delete (*i);
}
m_stations.clear ();
m_basicModes.clear ();
@@ -318,6 +331,33 @@
return m_nonUnicastMode;
}
+
+void
+WifiRemoteStationManager::NotifyTxRtsFailed (Mac48Address address)
+{
+ m_macTxRtsFailed (address);
+}
+
+void
+WifiRemoteStationManager::NotifyTxDataFailed (Mac48Address address)
+{
+ m_macTxDataFailed (address);
+}
+
+void
+WifiRemoteStationManager::NotifyTxFinalRtsFailed (Mac48Address address)
+{
+ m_macTxFinalRtsFailed (address);
+}
+
+void
+WifiRemoteStationManager::NotifyTxFinalDataFailed (Mac48Address address)
+{
+ m_macTxFinalDataFailed (address);
+}
+
+
+
} // namespace ns3
/***************************************************************
@@ -564,6 +604,16 @@
{
return m_avgSlrc;
}
+void
+WifiRemoteStation::SetAddress(Mac48Address address)
+{
+ m_address = address;
+}
+Mac48Address
+WifiRemoteStation::GetAddress()
+{
+ return m_address;
+}
uint32_t
WifiRemoteStation::GetNSupportedModes (void) const
{
@@ -698,6 +748,7 @@
WifiRemoteStation::ReportRtsFailed (void)
{
m_ssrc++;
+ GetManager ()->NotifyTxRtsFailed (m_address);
DoReportRtsFailed ();
}
@@ -705,6 +756,7 @@
WifiRemoteStation::ReportDataFailed (void)
{
m_slrc++;
+ GetManager ()->NotifyTxDataFailed (m_address);
DoReportDataFailed ();
}
@@ -727,6 +779,7 @@
WifiRemoteStation::ReportFinalRtsFailed (void)
{
m_ssrc = 0;
+ GetManager ()->NotifyTxFinalRtsFailed (m_address);
DoReportFinalRtsFailed ();
}
@@ -734,6 +787,7 @@
WifiRemoteStation::ReportFinalDataFailed (void)
{
m_slrc = 0;
+ GetManager ()->NotifyTxFinalDataFailed (m_address);
DoReportFinalDataFailed ();
}
--- a/src/devices/wifi/wifi-remote-station-manager.h Sun Aug 23 20:54:31 2009 -0700
+++ b/src/devices/wifi/wifi-remote-station-manager.h Mon Aug 24 13:09:32 2009 +0200
@@ -88,7 +88,7 @@
friend class WifiRemoteStation;
virtual void DoDispose (void);
private:
- typedef std::vector <std::pair<Mac48Address, WifiRemoteStation *> > Stations;
+ typedef std::vector <WifiRemoteStation *> Stations;
virtual class WifiRemoteStation *CreateStation (void) = 0;
Stations m_stations;
WifiMode m_defaultTxMode;
@@ -100,6 +100,63 @@
uint32_t m_rtsCtsThreshold;
uint32_t m_fragmentationThreshold;
WifiMode m_nonUnicastMode;
+
+
+ /**
+ * Public method used to fire a MacTxRtsFailed trace.
+ * Implemented for encapsulation purposes.
+ */
+ void NotifyTxRtsFailed (Mac48Address address);
+
+ /**
+ * Public method used to fire a MacTxDataFailed trace.
+ * Implemented for encapsulation purposes.
+ */
+ void NotifyTxDataFailed (Mac48Address address);
+
+ /**
+ * Public method used to fire a MacTxFinalRtsFailed trace.
+ * Implemented for encapsulation purposes.
+ */
+ void NotifyTxFinalRtsFailed (Mac48Address address);
+
+ /**
+ * Public method used to fire a MacTxFinalDataFailed trace.
+ * Implemented for encapsulation purposes.
+ */
+ void NotifyTxFinalDataFailed (Mac48Address address);
+
+
+ /**
+ * The trace source fired when the transmission of a RTS has failed
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Mac48Address> m_macTxRtsFailed;
+
+ /**
+ * The trace source fired when the transmission of a data packet has failed
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Mac48Address> m_macTxDataFailed;
+
+ /**
+ * The trace source fired when the transmission of a RTS has
+ * exceeded the maximum number of attempts
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Mac48Address> m_macTxFinalRtsFailed;
+
+ /**
+ * The trace source fired when the transmission of a data packet has
+ * exceeded the maximum number of attempts
+ *
+ * \see class CallBackTraceSource
+ */
+ TracedCallback<Mac48Address> m_macTxFinalDataFailed;
+
};
} // namespace ns3
@@ -264,6 +321,18 @@
* \return exponentially weighted average SLRC, this is used by Airtime link metric of 802.11s
*/
double GetAvgSlrc () const;
+ /**
+ * set the address of the remote stationt represented by this instance of WifiRemoteStation
+ *
+ * @param address the MAC address of the remote station
+ */
+ void SetAddress(Mac48Address address);
+ /**
+ * get the address of the remote stationt represented by this instance of WifiRemoteStation
+ *
+ * @return the MAC address of the remote station
+ */
+ Mac48Address GetAddress();
private:
virtual Ptr<WifiRemoteStationManager> GetManager (void) const = 0;
virtual WifiMode DoGetDataMode (uint32_t size) = 0;
@@ -294,6 +363,7 @@
TracedValue<uint32_t> m_slrc;
double m_avgSlrcCoefficient;
double m_avgSlrc;
+ Mac48Address m_address;
};
} // namespace ns3