src/wifi/model/wifi-remote-station-manager.cc
changeset 10139 17a71cd49da3
parent 9870 6543f3876ff5
child 10207 4c42c64f7ea8
--- a/src/wifi/model/wifi-remote-station-manager.cc	Tue Aug 13 10:37:49 2013 -0700
+++ b/src/wifi/model/wifi-remote-station-manager.cc	Tue Aug 13 22:05:25 2013 -0700
@@ -40,13 +40,77 @@
 
 namespace ns3 {
 
-class TxModeTag : public Tag
+class HighLatencyDataTxVectorTag : public Tag
 {
 public:
-  TxModeTag ();
-  TxModeTag (WifiMode rtsMode, WifiMode dataMode);
-  WifiMode GetRtsMode (void) const;
-  WifiMode GetDataMode (void) const;
+  HighLatencyDataTxVectorTag ();
+  HighLatencyDataTxVectorTag (WifiTxVector dataTxVector);
+  WifiTxVector GetDataTxVector (void) const;
+
+  static TypeId GetTypeId (void);
+  virtual TypeId GetInstanceTypeId (void) const;
+  virtual uint32_t GetSerializedSize (void) const;
+  virtual void Serialize (TagBuffer i) const;
+  virtual void Deserialize (TagBuffer i);
+  virtual void Print (std::ostream &os) const;
+private:
+  WifiTxVector m_dataTxVector;
+};
+
+HighLatencyDataTxVectorTag::HighLatencyDataTxVectorTag ()
+{
+}
+HighLatencyDataTxVectorTag::HighLatencyDataTxVectorTag ( WifiTxVector dataTxVector)
+  : m_dataTxVector (dataTxVector)
+{
+}
+
+WifiTxVector 
+HighLatencyDataTxVectorTag::GetDataTxVector (void) const
+{
+  return m_dataTxVector;
+}
+TypeId
+HighLatencyDataTxVectorTag::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::HighLatencyDataTxVectorTag")
+    .SetParent<Tag> ()
+    .AddConstructor<HighLatencyDataTxVectorTag> ()  
+    ;
+  return tid;
+}
+TypeId
+HighLatencyDataTxVectorTag::GetInstanceTypeId (void) const
+{
+  return GetTypeId ();
+}
+uint32_t
+HighLatencyDataTxVectorTag::GetSerializedSize (void) const
+{
+  return sizeof (WifiTxVector);
+}
+void
+HighLatencyDataTxVectorTag::Serialize (TagBuffer i) const
+{
+  i.Write ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector));
+}
+void
+HighLatencyDataTxVectorTag::Deserialize (TagBuffer i)
+{
+  i.Read ((uint8_t *)&m_dataTxVector, sizeof (WifiTxVector));
+}
+void
+HighLatencyDataTxVectorTag::Print (std::ostream &os) const
+{
+  os << "Data=" << m_dataTxVector;
+}
+
+class HighLatencyRtsTxVectorTag : public Tag
+{
+public:
+  HighLatencyRtsTxVectorTag ();
+  HighLatencyRtsTxVectorTag (WifiTxVector rtsTxVector);
+  WifiTxVector GetRtsTxVector (void) const;
 
   static TypeId GetTypeId (void);
   virtual TypeId GetInstanceTypeId (void) const;
@@ -55,78 +119,124 @@
   virtual void Deserialize (TagBuffer i);
   virtual void Print (std::ostream &os) const;
 private:
-  WifiMode m_rtsMode;
-  WifiMode m_dataMode;
+  WifiTxVector m_rtsTxVector;
 };
 
-TxModeTag::TxModeTag ()
+HighLatencyRtsTxVectorTag::HighLatencyRtsTxVectorTag ()
 {
 }
-TxModeTag::TxModeTag (WifiMode rtsMode, WifiMode dataMode)
-  : m_rtsMode (rtsMode),
-    m_dataMode (dataMode)
+HighLatencyRtsTxVectorTag::HighLatencyRtsTxVectorTag ( WifiTxVector rtsTxVector)
+  : m_rtsTxVector (rtsTxVector)
 {
 }
-WifiMode
-TxModeTag::GetRtsMode (void) const
+
+WifiTxVector 
+HighLatencyRtsTxVectorTag::GetRtsTxVector (void) const
 {
-  return m_rtsMode;
-}
-WifiMode
-TxModeTag::GetDataMode (void) const
-{
-  return m_dataMode;
+  return m_rtsTxVector;
 }
 TypeId
-TxModeTag::GetTypeId (void)
+HighLatencyRtsTxVectorTag::GetTypeId (void)
 {
-  static TypeId tid = TypeId ("ns3::TxModeTag")
+  static TypeId tid = TypeId ("ns3::HighLatencyRtsTxVectorTag")
     .SetParent<Tag> ()
-    .AddConstructor<TxModeTag> ()
-    .AddAttribute ("RtsTxMode",
-                   "Tx mode of rts to use later",
-                   EmptyAttributeValue (),
-                   MakeWifiModeAccessor (&TxModeTag::GetRtsMode),
-                   MakeWifiModeChecker ())
-    .AddAttribute ("DataTxMode",
-                   "Tx mode of data to use later",
-                   EmptyAttributeValue (),
-                   MakeWifiModeAccessor (&TxModeTag::GetDataMode),
-                   MakeWifiModeChecker ())
-  ;
+    .AddConstructor<HighLatencyRtsTxVectorTag> ()  
+    ;
   return tid;
 }
 TypeId
-TxModeTag::GetInstanceTypeId (void) const
+HighLatencyRtsTxVectorTag::GetInstanceTypeId (void) const
 {
   return GetTypeId ();
 }
 uint32_t
-TxModeTag::GetSerializedSize (void) const
+HighLatencyRtsTxVectorTag::GetSerializedSize (void) const
+{
+  return sizeof (WifiTxVector);
+}
+void
+HighLatencyRtsTxVectorTag::Serialize (TagBuffer i) const
 {
-  return sizeof (WifiMode) * 2;
+  i.Write ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector));
+}
+void
+HighLatencyRtsTxVectorTag::Deserialize (TagBuffer i)
+{
+  i.Read ((uint8_t *)&m_rtsTxVector, sizeof (WifiTxVector));
 }
 void
-TxModeTag::Serialize (TagBuffer i) const
+HighLatencyRtsTxVectorTag::Print (std::ostream &os) const
+{
+  os << "Rts=" << m_rtsTxVector;
+}
+
+class HighLatencyCtsToSelfTxVectorTag : public Tag
+{
+public:
+  HighLatencyCtsToSelfTxVectorTag ();
+  HighLatencyCtsToSelfTxVectorTag (WifiTxVector ctsToSelfTxVector);
+  WifiTxVector GetCtsToSelfTxVector (void) const;
+
+  static TypeId GetTypeId (void);
+  virtual TypeId GetInstanceTypeId (void) const;
+  virtual uint32_t GetSerializedSize (void) const;
+  virtual void Serialize (TagBuffer i) const;
+  virtual void Deserialize (TagBuffer i);
+  virtual void Print (std::ostream &os) const;
+private:
+  WifiTxVector m_ctsToSelfTxVector;
+};
+
+HighLatencyCtsToSelfTxVectorTag::HighLatencyCtsToSelfTxVectorTag ()
 {
-  i.Write ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
-  i.Write ((uint8_t *)&m_dataMode, sizeof (WifiMode));
+}
+HighLatencyCtsToSelfTxVectorTag::HighLatencyCtsToSelfTxVectorTag ( WifiTxVector ctsToSelfTxVector)
+  : m_ctsToSelfTxVector (ctsToSelfTxVector)
+{
+}
+
+WifiTxVector 
+HighLatencyCtsToSelfTxVectorTag::GetCtsToSelfTxVector (void) const
+{
+  return m_ctsToSelfTxVector;
+}
+TypeId
+HighLatencyCtsToSelfTxVectorTag::GetTypeId (void)
+{
+  static TypeId tid = TypeId ("ns3::HighLatencyCtsToSelfTxVectorTag")
+    .SetParent<Tag> ()
+    .AddConstructor<HighLatencyCtsToSelfTxVectorTag> ()  
+    ;
+  return tid;
+}
+TypeId
+HighLatencyCtsToSelfTxVectorTag::GetInstanceTypeId (void) const
+{
+  return GetTypeId ();
+}
+uint32_t
+HighLatencyCtsToSelfTxVectorTag::GetSerializedSize (void) const
+{
+  return sizeof (WifiTxVector);
 }
 void
-TxModeTag::Deserialize (TagBuffer i)
+HighLatencyCtsToSelfTxVectorTag::Serialize (TagBuffer i) const
 {
-  i.Read ((uint8_t *)&m_rtsMode, sizeof (WifiMode));
-  i.Read ((uint8_t *)&m_dataMode, sizeof (WifiMode));
+  i.Write ((uint8_t *)&m_ctsToSelfTxVector, sizeof (WifiTxVector));
 }
 void
-TxModeTag::Print (std::ostream &os) const
+HighLatencyCtsToSelfTxVectorTag::Deserialize (TagBuffer i)
 {
-  os << "Rts=" << m_rtsMode << ", Data=" << m_dataMode;
+  i.Read ((uint8_t *)&m_ctsToSelfTxVector, sizeof (WifiTxVector));
+}
+void
+HighLatencyCtsToSelfTxVectorTag::Print (std::ostream &os) const
+{
+  os << "Cts To Self=" << m_ctsToSelfTxVector;
 }
 
 } // namespace ns3
 
-
 namespace ns3 {
 
 NS_OBJECT_ENSURE_REGISTERED (WifiRemoteStationManager);
@@ -172,6 +282,12 @@
                    WifiModeValue (),
                    MakeWifiModeAccessor (&WifiRemoteStationManager::m_nonUnicastMode),
                    MakeWifiModeChecker ())
+    .AddAttribute ("DefaultTxPowerLevel", "Default power level to be used for transmissions. "
+                   "This is the power level that is used by all those WifiManagers that do not"
+                   "implement TX power control.",
+                   UintegerValue (0),
+                   MakeUintegerAccessor (&WifiRemoteStationManager::m_defaultTxPowerLevel),
+                   MakeUintegerChecker<uint8_t> ())
     .AddTraceSource ("MacTxRtsFailed",
                      "The transmission of a RTS by the MAC layer has failed",
                      MakeTraceSourceAccessor (&WifiRemoteStationManager::m_macTxRtsFailed))
@@ -219,9 +335,27 @@
   // acknowledgements.
   m_wifiPhy = phy;
   m_defaultTxMode = phy->GetMode (0);
+  if(HasHtSupported())
+    {
+       m_defaultTxMcs = phy->GetMcs (0);
+    }
+  else
+    {
+      m_defaultTxMcs = 0;
+    }
   Reset ();
 }
+void
+WifiRemoteStationManager::SetHtSupported (bool enable)
+{
+  m_htSupported=enable;
+}
 
+bool
+WifiRemoteStationManager::HasHtSupported (void) const
+{
+  return m_htSupported;
+}
 uint32_t
 WifiRemoteStationManager::GetMaxSsrc (void) const
 {
@@ -269,7 +403,9 @@
   NS_ASSERT (!address.IsGroup ());
   WifiRemoteStationState *state = LookupState (address);
   state->m_operationalRateSet.clear ();
+  state->m_operationalMcsSet.clear ();
   AddSupportedMode (address, GetDefaultMode ());
+  AddSupportedMcs(address,GetDefaultMcs());
 }
 void
 WifiRemoteStationManager::AddSupportedMode (Mac48Address address, WifiMode mode)
@@ -286,6 +422,42 @@
     }
   state->m_operationalRateSet.push_back (mode);
 }
+/*void
+WifiRemoteStationManager::AddBssMembershipParameters(Mac48Address address, uint32_t selector)
+{
+  NS_ASSERT (!address.IsGroup ());
+  WifiRemoteStationState *state = LookupState (address);
+  WifiMode mode;
+  WifiModeList membershipselectormodes = m_wifiPhy->GetMembershipSelectorModes(selector);
+  for (WifiModeListIterator j = membershipselectormodes.begin (); j != membershipselectormodes.end (); j++)
+    {
+      mode=(*j);
+     for (WifiModeListIterator i = state->m_operationalRateSet.begin (); i != state->m_operationalRateSet.end (); i++)
+      {
+        if ((*i) == mode)
+          {
+            // already in.
+            break;
+          }
+      }
+    state->m_operationalRateSet.push_back (mode);
+  }
+}*/
+void 
+WifiRemoteStationManager::AddSupportedMcs (Mac48Address address, uint8_t mcs)
+{
+  NS_ASSERT (!address.IsGroup ());
+  WifiRemoteStationState *state = LookupState (address);
+  for (WifiMcsListIterator i = state->m_operationalMcsSet.begin (); i != state->m_operationalMcsSet.end (); i++)
+    {
+      if ((*i) == mcs)
+        {
+          // already in.
+          return;
+        }
+    }
+  state->m_operationalMcsSet.push_back (mcs);
+}
 bool
 WifiRemoteStationManager::IsBrandNew (Mac48Address address) const
 {
@@ -346,47 +518,94 @@
       return;
     }
   WifiRemoteStation *station = Lookup (address, header);
-  WifiMode rts = DoGetRtsMode (station);
-  WifiMode data = DoGetDataMode (station, fullPacketSize);
-  TxModeTag tag;
+  WifiTxVector rts = DoGetRtsTxVector (station);
+  WifiTxVector data = DoGetDataTxVector (station, fullPacketSize); 
+  WifiTxVector ctstoself = DoGetCtsToSelfTxVector (); 
+  HighLatencyDataTxVectorTag datatag;
+  HighLatencyRtsTxVectorTag rtstag;
+  HighLatencyCtsToSelfTxVectorTag ctstoselftag;
   // first, make sure that the tag is not here anymore.
-  ConstCast<Packet> (packet)->RemovePacketTag (tag);
-  tag = TxModeTag (rts, data);
+  ConstCast<Packet> (packet)->RemovePacketTag (datatag);
+  ConstCast<Packet> (packet)->RemovePacketTag (rtstag);
+  ConstCast<Packet> (packet)->RemovePacketTag (ctstoselftag);
+  datatag = HighLatencyDataTxVectorTag (data);
+  rtstag = HighLatencyRtsTxVectorTag (rts);
+  ctstoselftag = HighLatencyCtsToSelfTxVectorTag (ctstoself);
   // and then, add it back
-  packet->AddPacketTag (tag);
+  packet->AddPacketTag (datatag);
+  packet->AddPacketTag (rtstag);
+  packet->AddPacketTag (ctstoselftag);
 }
-WifiMode
-WifiRemoteStationManager::GetDataMode (Mac48Address address, const WifiMacHeader *header,
+WifiTxVector
+WifiRemoteStationManager::GetDataTxVector (Mac48Address address, const WifiMacHeader *header,
                                        Ptr<const Packet> packet, uint32_t fullPacketSize)
 {
   if (address.IsGroup ())
     {
-      return GetNonUnicastMode ();
+      WifiTxVector v;
+      v.SetMode (GetNonUnicastMode ());
+      v.SetTxPowerLevel (m_defaultTxPowerLevel);
+      v.SetShortGuardInterval (false);
+      v.SetNss (1);
+      v.SetNess (0);
+      v.SetStbc (false);
+      return v;
     }
   if (!IsLowLatency ())
     {
-      TxModeTag tag;
+      HighLatencyDataTxVectorTag datatag;
       bool found;
-      found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
+      found = ConstCast<Packet> (packet)->PeekPacketTag (datatag);
       NS_ASSERT (found);
-      return tag.GetDataMode ();
+      // cast found to void, to suppress 'found' set but not used
+      // compiler warning
+      (void) found;
+      return datatag.GetDataTxVector ();
     }
-  return DoGetDataMode (Lookup (address, header), fullPacketSize);
+  return DoGetDataTxVector (Lookup (address, header), fullPacketSize);
 }
-WifiMode
-WifiRemoteStationManager::GetRtsMode (Mac48Address address, const WifiMacHeader *header,
+WifiTxVector
+WifiRemoteStationManager::GetCtsToSelfTxVector(const WifiMacHeader *header,
+                                      Ptr<const Packet> packet)
+{
+  
+  if (!IsLowLatency ())
+    {
+      HighLatencyCtsToSelfTxVectorTag ctstoselftag;
+      bool found;
+      found = ConstCast<Packet> (packet)->PeekPacketTag (ctstoselftag);
+      NS_ASSERT (found);
+      // cast found to void, to suppress 'found' set but not used
+      // compiler warning
+      (void) found;
+      return ctstoselftag.GetCtsToSelfTxVector ();
+    }
+  return DoGetCtsToSelfTxVector ();
+}
+
+WifiTxVector
+WifiRemoteStationManager::DoGetCtsToSelfTxVector (void)
+{
+  return WifiTxVector (GetDefaultMode(), GetDefaultTxPowerLevel (),0,m_wifiPhy->GetGuardInterval(),GetNumberOfTransmitAntennas(), GetNumberOfTransmitAntennas(), false);
+}
+
+WifiTxVector
+WifiRemoteStationManager::GetRtsTxVector (Mac48Address address, const WifiMacHeader *header,
                                       Ptr<const Packet> packet)
 {
   NS_ASSERT (!address.IsGroup ());
   if (!IsLowLatency ())
     {
-      TxModeTag tag;
+      HighLatencyRtsTxVectorTag rtstag;
       bool found;
-      found = ConstCast<Packet> (packet)->PeekPacketTag (tag);
+      found = ConstCast<Packet> (packet)->PeekPacketTag (rtstag);
       NS_ASSERT (found);
-      return tag.GetRtsMode ();
+      // cast found to void, to suppress 'found' set but not used
+      // compiler warning
+      (void) found;
+      return rtstag.GetRtsTxVector ();
     }
-  return DoGetRtsMode (Lookup (address, header));
+  return DoGetRtsTxVector (Lookup (address, header));
 }
 void
 WifiRemoteStationManager::ReportRtsFailed (Mac48Address address, const WifiMacHeader *header)
@@ -469,6 +688,34 @@
   return DoNeedRts (Lookup (address, header), packet, normally);
 }
 bool
+WifiRemoteStationManager::NeedCtsToSelf (WifiTxVector txVector)
+{
+  WifiMode mode = txVector.GetMode();
+ 
+  // search the BSS Basic Rate set if the used mode in the basic set then no need for Cts to self
+  for (WifiModeListIterator i = m_bssBasicRateSet.begin ();
+       i != m_bssBasicRateSet.end (); i++)
+    {
+      if (mode == *i)
+        {
+          return false;
+        }
+    }
+  if (HasHtSupported())
+    {
+      uint8_t mcs = m_wifiPhy->WifiModeToMcs (mode);
+      for (WifiMcsListIterator i = m_bssBasicMcsSet.begin ();
+           i != m_bssBasicMcsSet.end (); i++)
+        {
+          if (mcs == *i)
+            {
+              return false;
+            }
+        }
+    }
+  return true;
+}
+bool
 WifiRemoteStationManager::NeedRtsRetransmission (Mac48Address address, const WifiMacHeader *header,
                                                  Ptr<const Packet> packet)
 {
@@ -622,7 +869,29 @@
           found = true;
         }
     }
-
+  if(HasHtSupported())
+      {
+  if (!found)
+    {
+     uint8_t mcs = GetDefaultMcs (); 
+      mode=  m_wifiPhy->McsToWifiMode (mcs); 
+    }
+  for (WifiMcsListIterator i = m_bssBasicMcsSet.begin ();
+       i != m_bssBasicMcsSet.end (); i++)
+    {
+       WifiMode thismode=  m_wifiPhy->McsToWifiMode (*i); 
+      if ((!found || thismode.GetPhyRate () > mode.GetPhyRate ())
+          && thismode.GetPhyRate () <= reqMode.GetPhyRate ()
+          && thismode.GetModulationClass () == reqMode.GetModulationClass ())
+        {
+          mode = thismode;
+          // We've found a potentially-suitable transmit rate, but we
+          // need to continue and consider all the basic rates before
+          // we can be sure we've got the right one.
+          found = true;
+        }
+    }
+}
   // If we found a suitable rate in the BSSBasicRateSet, then we are
   // done and can return that mode.
   if (found)
@@ -673,6 +942,27 @@
           found = true;
         }
     }
+    if(HasHtSupported())
+      {
+        for (uint32_t idx = 0; idx < m_wifiPhy->GetNMcs (); idx++)
+          {
+            uint8_t thismcs = m_wifiPhy->GetMcs (idx);
+            WifiMode thismode=  m_wifiPhy->McsToWifiMode (thismcs);
+             if (thismode.IsMandatory ()
+          && (!found || thismode.GetPhyRate () > mode.GetPhyRate ())
+          && thismode.GetPhyRate () <= reqMode.GetPhyRate ()
+          && thismode.GetModulationClass () == reqMode.GetModulationClass ())
+        {
+          mode = thismode;
+          // As above; we've found a potentially-suitable transmit
+          // rate, but we need to continue and consider all the
+          // mandatory rates before we can be sure we've got the right
+          // one.
+          found = true;
+        }
+            
+          }
+      }
 
   /**
    * If we still haven't found a suitable rate for the response then
@@ -693,18 +983,137 @@
   return mode;
 }
 
-WifiMode
-WifiRemoteStationManager::GetCtsMode (Mac48Address address, WifiMode rtsMode)
+WifiTxVector
+WifiRemoteStationManager::GetCtsTxVector (Mac48Address address, WifiMode rtsMode)
+{
+  NS_ASSERT (!address.IsGroup ());
+  WifiTxVector v;
+  v.SetMode (GetControlAnswerMode (address, rtsMode));
+  v.SetTxPowerLevel (DoGetCtsTxPowerLevel (address, v.GetMode()));
+  v.SetShortGuardInterval (DoGetCtsTxGuardInterval(address, v.GetMode()));
+  v.SetNss (DoGetCtsTxNss(address, v.GetMode()));
+  v.SetNess (DoGetCtsTxNess(address, v.GetMode()));
+  v.SetStbc (DoGetCtsTxStbc(address, v.GetMode()));
+  return v;
+}
+WifiTxVector
+WifiRemoteStationManager::GetAckTxVector (Mac48Address address, WifiMode dataMode)
+{
+  NS_ASSERT (!address.IsGroup ());
+  WifiTxVector v;
+  v.SetMode (GetControlAnswerMode (address, dataMode));
+  v.SetTxPowerLevel (DoGetAckTxPowerLevel (address, v.GetMode()));
+  v.SetShortGuardInterval(DoGetAckTxGuardInterval(address, v.GetMode()));
+  v.SetNss(DoGetAckTxNss(address, v.GetMode()));
+  v.SetNess(DoGetAckTxNess(address, v.GetMode()));
+  v.SetStbc(DoGetAckTxStbc(address, v.GetMode()));
+  return v;
+}
+WifiTxVector
+WifiRemoteStationManager::GetBlockAckTxVector (Mac48Address address, WifiMode blockAckReqMode)
 {
   NS_ASSERT (!address.IsGroup ());
-  return GetControlAnswerMode (address, rtsMode);
+  WifiTxVector v;
+  v.SetMode (GetControlAnswerMode (address, blockAckReqMode));
+  v.SetTxPowerLevel (DoGetBlockAckTxPowerLevel (address, v.GetMode()));
+  v.SetShortGuardInterval (DoGetBlockAckTxGuardInterval(address, v.GetMode()));
+  v.SetNss (DoGetBlockAckTxNss(address, v.GetMode()));
+  v.SetNess (DoGetBlockAckTxNess(address, v.GetMode()));
+  v.SetStbc (DoGetBlockAckTxStbc(address, v.GetMode()));
+  return v;
+}
+
+uint8_t 
+WifiRemoteStationManager::DoGetCtsTxPowerLevel (Mac48Address address, WifiMode ctsMode)
+{
+  return m_defaultTxPowerLevel;
+}
+
+bool 
+WifiRemoteStationManager::DoGetCtsTxGuardInterval(Mac48Address address, WifiMode ctsMode)
+{
+  return m_wifiPhy->GetGuardInterval();
+}
+
+uint8_t
+WifiRemoteStationManager::DoGetCtsTxNss(Mac48Address address, WifiMode ctsMode)
+{
+  return 1;
+}
+uint8_t
+WifiRemoteStationManager::DoGetCtsTxNess(Mac48Address address, WifiMode ctsMode)
+{
+  return 0;
+}
+bool 
+WifiRemoteStationManager::DoGetCtsTxStbc(Mac48Address address, WifiMode ctsMode)
+{
+  return m_wifiPhy->GetStbc();
+}
+
+uint8_t 
+WifiRemoteStationManager::DoGetAckTxPowerLevel (Mac48Address address, WifiMode ackMode)
+{
+  return m_defaultTxPowerLevel;
+}
+
+bool 
+WifiRemoteStationManager::DoGetAckTxGuardInterval(Mac48Address address, WifiMode ackMode)
+{
+  return m_wifiPhy->GetGuardInterval();
 }
-WifiMode
-WifiRemoteStationManager::GetAckMode (Mac48Address address, WifiMode dataMode)
+
+uint8_t
+WifiRemoteStationManager::DoGetAckTxNss(Mac48Address address, WifiMode ackMode)
+{
+  return 1;
+}
+uint8_t
+WifiRemoteStationManager::DoGetAckTxNess(Mac48Address address, WifiMode ackMode)
+{
+  return 0;
+}
+bool 
+WifiRemoteStationManager::DoGetAckTxStbc(Mac48Address address, WifiMode ackMode)
+{
+  return m_wifiPhy->GetStbc();
+}
+
+uint8_t 
+WifiRemoteStationManager::DoGetBlockAckTxPowerLevel (Mac48Address address, WifiMode blockAckMode)
+{
+  return m_defaultTxPowerLevel;
+}
+
+bool 
+WifiRemoteStationManager::DoGetBlockAckTxGuardInterval(Mac48Address address, WifiMode blockAckMode)
 {
-  NS_ASSERT (!address.IsGroup ());
-  return GetControlAnswerMode (address, dataMode);
+  return m_wifiPhy->GetGuardInterval();
+}
+
+uint8_t
+WifiRemoteStationManager::DoGetBlockAckTxNss(Mac48Address address, WifiMode blockAckMode)
+{
+  return 1;
+}
+uint8_t
+WifiRemoteStationManager::DoGetBlockAckTxNess(Mac48Address address, WifiMode blockAckMode)
+{
+  return 0;
 }
+bool 
+WifiRemoteStationManager::DoGetBlockAckTxStbc(Mac48Address address, WifiMode blockAckMode)
+{
+  return m_wifiPhy->GetStbc();
+}
+
+
+uint8_t
+WifiRemoteStationManager::GetDefaultTxPowerLevel (void) const
+{
+  return m_defaultTxPowerLevel;
+}
+
 
 WifiRemoteStationInfo
 WifiRemoteStationManager::GetInfo (Mac48Address address)
@@ -727,6 +1136,12 @@
   state->m_state = WifiRemoteStationState::BRAND_NEW;
   state->m_address = address;
   state->m_operationalRateSet.push_back (GetDefaultMode ());
+  state->m_operationalMcsSet.push_back(GetDefaultMcs());
+  state->m_shortGuardInterval=m_wifiPhy->GetGuardInterval();
+  state->m_greenfield=m_wifiPhy->GetGreenfield();
+  state->m_rx=1;
+  state->m_tx=1;
+  state->m_stbc=false;
   const_cast<WifiRemoteStationManager *> (this)->m_states.push_back (state);
   return state;
 }
@@ -767,12 +1182,32 @@
   return station;
 
 }
-
+//Used by all stations to record HT capabilities of remote stations
+void
+WifiRemoteStationManager::AddStationHtCapabilities (Mac48Address from, HtCapabilities htcapabilities)
+{
+  WifiRemoteStationState *state;
+  state=LookupState (from);
+  state->m_shortGuardInterval=htcapabilities.GetShortGuardInterval20();
+  state->m_greenfield=htcapabilities.GetGreenfield();
+ 
+}
+//Used by mac low to choose format used GF, MF or Non HT
+bool 
+WifiRemoteStationManager::GetGreenfieldSupported (Mac48Address address) const
+{
+ return LookupState(address)->m_greenfield;
+}
 WifiMode
 WifiRemoteStationManager::GetDefaultMode (void) const
 {
   return m_defaultTxMode;
 }
+uint8_t
+WifiRemoteStationManager::GetDefaultMcs (void) const
+{
+  return m_defaultTxMcs;
+}
 void
 WifiRemoteStationManager::Reset (void)
 {
@@ -783,6 +1218,8 @@
   m_stations.clear ();
   m_bssBasicRateSet.clear ();
   m_bssBasicRateSet.push_back (m_defaultTxMode);
+  m_bssBasicMcsSet.clear();
+  m_bssBasicMcsSet.push_back (m_defaultTxMcs);
   NS_ASSERT (m_defaultTxMode.IsMandatory ());
 }
 void
@@ -808,6 +1245,32 @@
   NS_ASSERT (i < m_bssBasicRateSet.size ());
   return m_bssBasicRateSet[i];
 }
+
+void 
+WifiRemoteStationManager::AddBasicMcs (uint8_t mcs)
+{
+   for (uint32_t i = 0; i < GetNBasicMcs (); i++)
+    {
+      if (GetBasicMcs (i) == mcs)
+        {
+          return;
+        }
+    }
+  m_bssBasicMcsSet.push_back (mcs);
+}
+
+uint32_t
+WifiRemoteStationManager::GetNBasicMcs (void) const
+{
+  return m_bssBasicMcsSet.size ();
+}
+uint8_t 
+WifiRemoteStationManager::GetBasicMcs (uint32_t i) const
+{
+   NS_ASSERT (i < m_bssBasicMcsSet.size ());
+  return m_bssBasicMcsSet[i];
+}
+
 WifiMode
 WifiRemoteStationManager::GetNonUnicastMode (void) const
 {
@@ -852,12 +1315,69 @@
   NS_ASSERT (i < GetNSupported (station));
   return station->m_state->m_operationalRateSet[i];
 }
+uint8_t
+WifiRemoteStationManager::GetMcsSupported (const WifiRemoteStation *station, uint32_t i) const
+{
+  NS_ASSERT (i < GetNMcsSupported (station));
+  return station->m_state->m_operationalMcsSet[i];
+}
+bool 
+WifiRemoteStationManager::GetShortGuardInterval (const WifiRemoteStation *station) const
+{
+  return station->m_state->m_shortGuardInterval;
+}
+bool 
+WifiRemoteStationManager::GetGreenfield (const WifiRemoteStation *station) const
+{
+  return station->m_state->m_greenfield;
+}
+bool 
+WifiRemoteStationManager::GetStbc (const WifiRemoteStation *station) const
+{
+  return station->m_state->m_stbc;
+}
+uint32_t 
+WifiRemoteStationManager::GetNumberOfReceiveAntennas (const WifiRemoteStation *station) const
+{
+  return station->m_state->m_rx;
+}
+uint32_t 
+WifiRemoteStationManager::GetNumberOfTransmitAntennas (const WifiRemoteStation *station) const
+{
+  return station->m_state->m_tx;
+}
+uint32_t 
+WifiRemoteStationManager::GetShortRetryCount (const WifiRemoteStation *station) const
+{
+  return station->m_ssrc;
+}
+uint32_t 
+WifiRemoteStationManager::GetLongRetryCount (const WifiRemoteStation *station) const
+{
+  return station->m_slrc;
+}
 uint32_t
 WifiRemoteStationManager::GetNSupported (const WifiRemoteStation *station) const
 {
   return station->m_state->m_operationalRateSet.size ();
 }
+uint32_t
+WifiRemoteStationManager::GetNMcsSupported (const WifiRemoteStation *station) const
+{
+  return station->m_state->m_operationalMcsSet.size ();
+}
+void
+WifiRemoteStationManager::SetDefaultTxPowerLevel (uint8_t txPower)
+{
+  m_defaultTxPowerLevel = txPower;
+}
 
+//support 11n
+uint32_t
+WifiRemoteStationManager::GetNumberOfTransmitAntennas (void)
+{
+  return m_wifiPhy->GetNumberOfTransmitAntennas();
+}
 //WifiRemoteStationInfo constructor
 WifiRemoteStationInfo::WifiRemoteStationInfo ()
   : m_memoryTime (Seconds (1.0)),