1.1 --- a/src/devices/wifi/wifi-remote-station-manager.cc Sun Aug 23 20:54:31 2009 -0700
1.2 +++ b/src/devices/wifi/wifi-remote-station-manager.cc Mon Aug 24 13:09:32 2009 +0200
1.3 @@ -159,6 +159,18 @@
1.4 WifiModeValue (),
1.5 MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
1.6 MakeWifiModeChecker ())
1.7 + .AddTraceSource ("MacTxRtsFailed",
1.8 + "The transmission of a RTS by the MAC layer has failed",
1.9 + MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed))
1.10 + .AddTraceSource ("MacTxDataFailed",
1.11 + "The transmission of a data packet by the MAC layer has failed",
1.12 + MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxDataFailed))
1.13 + .AddTraceSource ("MacTxFinalRtsFailed",
1.14 + "The transmission of a RTS has exceeded the maximum number of attempts",
1.15 + MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalRtsFailed))
1.16 + .AddTraceSource ("MacTxFinalDataFailed",
1.17 + "The transmission of a data packet has exceeded the maximum number of attempts",
1.18 + MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxFinalDataFailed))
1.19 ;
1.20 return tid;
1.21 }
1.22 @@ -175,7 +187,7 @@
1.23 {
1.24 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1.25 {
1.26 - delete (*i).second;
1.27 + delete (*i);
1.28 }
1.29 m_stations.clear ();
1.30 delete m_nonUnicast;
1.31 @@ -237,14 +249,15 @@
1.32 }
1.33 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1.34 {
1.35 - if ((*i).first == address)
1.36 + if ((*i)->GetAddress () == address)
1.37 {
1.38 - return (*i).second;
1.39 + return (*i);
1.40 }
1.41 }
1.42 WifiRemoteStation *station = CreateStation ();
1.43 + station->SetAddress(address);
1.44 station->Reset ();
1.45 - m_stations.push_back (std::make_pair (address, station));
1.46 + m_stations.push_back (station);
1.47 return station;
1.48 }
1.49
1.50 @@ -264,7 +277,7 @@
1.51 {
1.52 for (Stations::const_iterator i = m_stations.begin (); i != m_stations.end (); i++)
1.53 {
1.54 - delete i->second;
1.55 + delete (*i);
1.56 }
1.57 m_stations.clear ();
1.58 m_basicModes.clear ();
1.59 @@ -318,6 +331,33 @@
1.60 return m_nonUnicastMode;
1.61 }
1.62
1.63 +
1.64 +void
1.65 +WifiRemoteStationManager::NotifyTxRtsFailed (Mac48Address address)
1.66 +{
1.67 + m_macTxRtsFailed (address);
1.68 +}
1.69 +
1.70 +void
1.71 +WifiRemoteStationManager::NotifyTxDataFailed (Mac48Address address)
1.72 +{
1.73 + m_macTxDataFailed (address);
1.74 +}
1.75 +
1.76 +void
1.77 +WifiRemoteStationManager::NotifyTxFinalRtsFailed (Mac48Address address)
1.78 +{
1.79 + m_macTxFinalRtsFailed (address);
1.80 +}
1.81 +
1.82 +void
1.83 +WifiRemoteStationManager::NotifyTxFinalDataFailed (Mac48Address address)
1.84 +{
1.85 + m_macTxFinalDataFailed (address);
1.86 +}
1.87 +
1.88 +
1.89 +
1.90 } // namespace ns3
1.91
1.92 /***************************************************************
1.93 @@ -564,6 +604,16 @@
1.94 {
1.95 return m_avgSlrc;
1.96 }
1.97 +void
1.98 +WifiRemoteStation::SetAddress(Mac48Address address)
1.99 +{
1.100 + m_address = address;
1.101 +}
1.102 +Mac48Address
1.103 +WifiRemoteStation::GetAddress()
1.104 +{
1.105 + return m_address;
1.106 +}
1.107 uint32_t
1.108 WifiRemoteStation::GetNSupportedModes (void) const
1.109 {
1.110 @@ -698,6 +748,7 @@
1.111 WifiRemoteStation::ReportRtsFailed (void)
1.112 {
1.113 m_ssrc++;
1.114 + GetManager ()->NotifyTxRtsFailed (m_address);
1.115 DoReportRtsFailed ();
1.116 }
1.117
1.118 @@ -705,6 +756,7 @@
1.119 WifiRemoteStation::ReportDataFailed (void)
1.120 {
1.121 m_slrc++;
1.122 + GetManager ()->NotifyTxDataFailed (m_address);
1.123 DoReportDataFailed ();
1.124 }
1.125
1.126 @@ -727,6 +779,7 @@
1.127 WifiRemoteStation::ReportFinalRtsFailed (void)
1.128 {
1.129 m_ssrc = 0;
1.130 + GetManager ()->NotifyTxFinalRtsFailed (m_address);
1.131 DoReportFinalRtsFailed ();
1.132 }
1.133
1.134 @@ -734,6 +787,7 @@
1.135 WifiRemoteStation::ReportFinalDataFailed (void)
1.136 {
1.137 m_slrc = 0;
1.138 + GetManager ()->NotifyTxFinalDataFailed (m_address);
1.139 DoReportFinalDataFailed ();
1.140 }
1.141
2.1 --- a/src/devices/wifi/wifi-remote-station-manager.h Sun Aug 23 20:54:31 2009 -0700
2.2 +++ b/src/devices/wifi/wifi-remote-station-manager.h Mon Aug 24 13:09:32 2009 +0200
2.3 @@ -88,7 +88,7 @@
2.4 friend class WifiRemoteStation;
2.5 virtual void DoDispose (void);
2.6 private:
2.7 - typedef std::vector <std::pair<Mac48Address, WifiRemoteStation *> > Stations;
2.8 + typedef std::vector <WifiRemoteStation *> Stations;
2.9 virtual class WifiRemoteStation *CreateStation (void) = 0;
2.10 Stations m_stations;
2.11 WifiMode m_defaultTxMode;
2.12 @@ -100,6 +100,63 @@
2.13 uint32_t m_rtsCtsThreshold;
2.14 uint32_t m_fragmentationThreshold;
2.15 WifiMode m_nonUnicastMode;
2.16 +
2.17 +
2.18 + /**
2.19 + * Public method used to fire a MacTxRtsFailed trace.
2.20 + * Implemented for encapsulation purposes.
2.21 + */
2.22 + void NotifyTxRtsFailed (Mac48Address address);
2.23 +
2.24 + /**
2.25 + * Public method used to fire a MacTxDataFailed trace.
2.26 + * Implemented for encapsulation purposes.
2.27 + */
2.28 + void NotifyTxDataFailed (Mac48Address address);
2.29 +
2.30 + /**
2.31 + * Public method used to fire a MacTxFinalRtsFailed trace.
2.32 + * Implemented for encapsulation purposes.
2.33 + */
2.34 + void NotifyTxFinalRtsFailed (Mac48Address address);
2.35 +
2.36 + /**
2.37 + * Public method used to fire a MacTxFinalDataFailed trace.
2.38 + * Implemented for encapsulation purposes.
2.39 + */
2.40 + void NotifyTxFinalDataFailed (Mac48Address address);
2.41 +
2.42 +
2.43 + /**
2.44 + * The trace source fired when the transmission of a RTS has failed
2.45 + *
2.46 + * \see class CallBackTraceSource
2.47 + */
2.48 + TracedCallback<Mac48Address> m_macTxRtsFailed;
2.49 +
2.50 + /**
2.51 + * The trace source fired when the transmission of a data packet has failed
2.52 + *
2.53 + * \see class CallBackTraceSource
2.54 + */
2.55 + TracedCallback<Mac48Address> m_macTxDataFailed;
2.56 +
2.57 + /**
2.58 + * The trace source fired when the transmission of a RTS has
2.59 + * exceeded the maximum number of attempts
2.60 + *
2.61 + * \see class CallBackTraceSource
2.62 + */
2.63 + TracedCallback<Mac48Address> m_macTxFinalRtsFailed;
2.64 +
2.65 + /**
2.66 + * The trace source fired when the transmission of a data packet has
2.67 + * exceeded the maximum number of attempts
2.68 + *
2.69 + * \see class CallBackTraceSource
2.70 + */
2.71 + TracedCallback<Mac48Address> m_macTxFinalDataFailed;
2.72 +
2.73 };
2.74
2.75 } // namespace ns3
2.76 @@ -264,6 +321,18 @@
2.77 * \return exponentially weighted average SLRC, this is used by Airtime link metric of 802.11s
2.78 */
2.79 double GetAvgSlrc () const;
2.80 + /**
2.81 + * set the address of the remote stationt represented by this instance of WifiRemoteStation
2.82 + *
2.83 + * @param address the MAC address of the remote station
2.84 + */
2.85 + void SetAddress(Mac48Address address);
2.86 + /**
2.87 + * get the address of the remote stationt represented by this instance of WifiRemoteStation
2.88 + *
2.89 + * @return the MAC address of the remote station
2.90 + */
2.91 + Mac48Address GetAddress();
2.92 private:
2.93 virtual Ptr<WifiRemoteStationManager> GetManager (void) const = 0;
2.94 virtual WifiMode DoGetDataMode (uint32_t size) = 0;
2.95 @@ -294,6 +363,7 @@
2.96 TracedValue<uint32_t> m_slrc;
2.97 double m_avgSlrcCoefficient;
2.98 double m_avgSlrc;
2.99 + Mac48Address m_address;
2.100 };
2.101
2.102 } // namespace ns3