--- a/src/wifi/model/monitor-mac-high.cc Sat Jul 16 09:43:24 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,419 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2008 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, Ashwin Narayan <ashwin.narayan89@gmail.com>
- */
-#include "monitor-mac-high.h"
-
-#include "ns3/log.h"
-#include "ns3/boolean.h"
-#include "ns3/pointer.h"
-#include "ns3/uinteger.h"
-#include "ns3/trace-source-accessor.h"
-
-#include "mac-rx-middle.h"
-#include "mac-tx-middle.h"
-#include "mac-low.h"
-#include "dcf.h"
-#include "dcf-manager.h"
-#include "wifi-phy.h"
-
-#include "msdu-aggregator.h"
-
-NS_LOG_COMPONENT_DEFINE ("MonitorMacHigh");
-
-namespace ns3 {
-
-NS_OBJECT_ENSURE_REGISTERED (MonitorMacHigh);
-
-TypeId
-MonitorMacHigh::GetTypeId (void)
-{
- static TypeId tid = TypeId ("ns3::MonitorMacHigh")
- .SetParent<WifiMac> ()
- .AddConstructor<MonitorMacHigh> ()
- ;
- return tid;
-}
-
-MonitorMacHigh::MonitorMacHigh ()
-{
- NS_LOG_FUNCTION (this);
- m_rxMiddle = new MacRxMiddle ();
- m_rxMiddle->SetForwardCallback (MakeCallback (&MonitorMacHigh::Receive, this));
-
- m_txMiddle = new MacTxMiddle ();
-
- m_low = CreateObject<MacLow> ();
- m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
- m_low->SetMonitorMode ();
-
- m_dcfManager = new DcfManager ();
- m_dcfManager->SetupLowListener (m_low);
-
- m_dca = CreateObject<DcaTxop> ();
- m_dca->SetLow (m_low);
- m_dca->SetManager (m_dcfManager);
- m_dca->SetTxOkCallback (MakeCallback (&MonitorMacHigh::TxOk, this));
- m_dca->SetTxFailedCallback (MakeCallback (&MonitorMacHigh::TxFailed, this));
-}
-
-MonitorMacHigh::~MonitorMacHigh ()
-{
- NS_LOG_FUNCTION (this);
-}
-
-void
-MonitorMacHigh::DoStart ()
-{
- NS_LOG_FUNCTION (this);
-
- m_dca->Start ();
-}
-
-void
-MonitorMacHigh::DoDispose ()
-{
- NS_LOG_FUNCTION (this);
- delete m_rxMiddle;
- m_rxMiddle = NULL;
-
- delete m_txMiddle;
- m_txMiddle = NULL;
-
- delete m_dcfManager;
- m_dcfManager = NULL;
-
- m_low->Dispose ();
- m_low = NULL;
-
- m_phy = NULL;
- m_stationManager = NULL;
-
- m_dca->Dispose ();
- m_dca = NULL;
-}
-
-Ptr<DcaTxop>
-MonitorMacHigh::GetDcaTxop () const
-{
- return m_dca;
-}
-
-void
-MonitorMacHigh::SetForwardUpCallback (ForwardUpCallback upCallback)
-{
- NS_LOG_FUNCTION (this);
- m_forwardUp = upCallback;
-}
-
-void
-MonitorMacHigh::SetLinkUpCallback (Callback<void> linkUp)
-{
- NS_LOG_FUNCTION (this);
- m_linkUp = linkUp;
-}
-
-void
-MonitorMacHigh::SetLinkDownCallback (Callback<void> linkDown)
-{
- NS_LOG_FUNCTION (this);
- m_linkDown = linkDown;
-}
-
-void
-MonitorMacHigh::SetQosSupported (bool enable)
-{
- NS_FATAL_ERROR ("QoS Functionality not supported in MonitorMacHigh");
-}
-
-bool
-MonitorMacHigh::GetQosSupported () const
-{
- return false;
-}
-
-void
-MonitorMacHigh::SetSlot (Time slotTime)
-{
- NS_LOG_FUNCTION (this << slotTime);
- m_dcfManager->SetSlot (slotTime);
- m_low->SetSlotTime (slotTime);
-}
-
-Time
-MonitorMacHigh::GetSlot (void) const
-{
- return m_low->GetSlotTime ();
-}
-
-void
-MonitorMacHigh::SetSifs (Time sifs)
-{
- NS_LOG_FUNCTION (this << sifs);
- m_dcfManager->SetSifs (sifs);
- m_low->SetSifs (sifs);
-}
-
-Time
-MonitorMacHigh::GetSifs (void) const
-{
- return m_low->GetSifs ();
-}
-
-void
-MonitorMacHigh::SetEifsNoDifs (Time eifsNoDifs)
-{
- NS_LOG_FUNCTION (this << eifsNoDifs);
- m_dcfManager->SetEifsNoDifs (eifsNoDifs);
-}
-
-Time
-MonitorMacHigh::GetEifsNoDifs (void) const
-{
- return m_dcfManager->GetEifsNoDifs ();
-}
-
-void
-MonitorMacHigh::SetPifs (Time pifs)
-{
- NS_LOG_FUNCTION (this << pifs);
- m_low->SetPifs (pifs);
-}
-
-Time
-MonitorMacHigh::GetPifs (void) const
-{
- return m_low->GetPifs ();
-}
-
-void
-MonitorMacHigh::SetAckTimeout (Time ackTimeout)
-{
- NS_LOG_FUNCTION (this << ackTimeout);
- m_low->SetAckTimeout (ackTimeout);
-}
-
-Time
-MonitorMacHigh::GetAckTimeout (void) const
-{
- return m_low->GetAckTimeout ();
-}
-
-void
-MonitorMacHigh::SetCtsTimeout (Time ctsTimeout)
-{
- NS_LOG_FUNCTION (this << ctsTimeout);
- m_low->SetCtsTimeout (ctsTimeout);
-}
-
-Time
-MonitorMacHigh::GetCtsTimeout (void) const
-{
- return m_low->GetCtsTimeout ();
-}
-
-void
-MonitorMacHigh::SetBasicBlockAckTimeout (Time blockAckTimeout)
-{
- NS_LOG_FUNCTION (this << blockAckTimeout);
- m_low->SetBasicBlockAckTimeout (blockAckTimeout);
-}
-
-Time
-MonitorMacHigh::GetBasicBlockAckTimeout (void) const
-{
- return m_low->GetBasicBlockAckTimeout ();
-}
-
-void
-MonitorMacHigh::SetCompressedBlockAckTimeout (Time blockAckTimeout)
-{
- NS_LOG_FUNCTION (this << blockAckTimeout);
- m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
-}
-
-Time
-MonitorMacHigh::GetCompressedBlockAckTimeout (void) const
-{
- return m_low->GetCompressedBlockAckTimeout ();
-}
-
-void
-MonitorMacHigh::SetAddress (Mac48Address address)
-{
- NS_LOG_FUNCTION (this << address);
- m_low->SetAddress (address);
-}
-
-Mac48Address
-MonitorMacHigh::GetAddress (void) const
-{
- return m_low->GetAddress ();
-}
-
-void
-MonitorMacHigh::SetSsid (Ssid ssid)
-{
- NS_LOG_FUNCTION (this << ssid);
- m_ssid = ssid;
-}
-
-Ssid
-MonitorMacHigh::GetSsid (void) const
-{
- return m_ssid;
-}
-
-void
-MonitorMacHigh::SetBssid (Mac48Address bssid)
-{
- NS_LOG_FUNCTION (this << bssid);
- m_low->SetBssid (bssid);
-}
-
-Mac48Address
-MonitorMacHigh::GetBssid (void) const
-{
- return m_low->GetBssid ();
-}
-
-void
-MonitorMacHigh::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
-{
- NS_LOG_FUNCTION (this << stationManager);
- m_stationManager = stationManager;
- m_low->SetWifiRemoteStationManager (stationManager);
-
- m_dca->SetWifiRemoteStationManager (stationManager);
-}
-
-void
-MonitorMacHigh::SetWifiPhy (Ptr<WifiPhy> phy)
-{
- NS_LOG_FUNCTION (this << phy);
- m_phy = phy;
- m_dcfManager->SetupPhyListener (phy);
- m_low->SetPhy (phy);
-}
-
-void
-MonitorMacHigh::SetPromisc (void)
-{
- m_low->SetPromisc ();
-}
-
-void
-MonitorMacHigh::Enqueue (Ptr<const Packet> packet,
- Mac48Address to, Mac48Address from)
-{
-}
-
-void
-MonitorMacHigh::Enqueue (Ptr<const Packet> packet,
- Mac48Address to)
-{
-}
-
-bool
-MonitorMacHigh::SupportsSendFrom (void) const
-{
- return false;
-}
-
-void
-MonitorMacHigh::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
-{
- NS_LOG_FUNCTION (this << packet << from);
- m_forwardUp (packet, from, to);
-}
-
-void
-MonitorMacHigh::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)
-{
-
- Mac48Address to = hdr->GetAddr1 ();
- Mac48Address from = hdr->GetAddr2 ();
- NS_LOG_DEBUG ("Received packet to: " << to << " from: " << from << " at:" << m_low->GetAddress ());
- packet->AddHeader (*radiotaphdr);
- ForwardUp (packet, from, to);
-}
-
-void
-MonitorMacHigh::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
- const WifiMacHeader *hdr)
-{
-}
-
-void
-MonitorMacHigh::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
- Mac48Address originator)
-{
-}
-
-void
-MonitorMacHigh::FinishConfigureStandard (enum WifiPhyStandard standard)
-{
- uint32_t cwmin;
- uint32_t cwmax;
-
- switch (standard)
- {
- case WIFI_PHY_STANDARD_80211p_CCH:
- case WIFI_PHY_STANDARD_80211p_SCH:
- cwmin = 15;
- cwmax = 511;
- break;
-
- case WIFI_PHY_STANDARD_holland:
- case WIFI_PHY_STANDARD_80211a:
- case WIFI_PHY_STANDARD_80211g:
- case WIFI_PHY_STANDARD_80211_10Mhz:
- case WIFI_PHY_STANDARD_80211_5Mhz:
- cwmin = 15;
- cwmax = 1023;
- break;
-
- case WIFI_PHY_STANDARD_80211b:
- cwmin = 31;
- cwmax = 1023;
- break;
-
- default:
- NS_FATAL_ERROR ("Unsupported WifiPhyStandard in MonitorMacHigh::FinishConfigureStandard ()");
- }
-
- // The special value of AC_BE_NQOS which exists in the Access
- // Category enumeration allows us to configure plain old DCF.
- ConfigureDcf (m_dca, cwmin, cwmax, AC_BE_NQOS);
-}
-
-void
-MonitorMacHigh::TxOk (const WifiMacHeader &hdr)
-{
- NS_LOG_FUNCTION (this << hdr);
- m_txOkCallback (hdr);
-}
-
-void
-MonitorMacHigh::TxFailed (const WifiMacHeader &hdr)
-{
- NS_LOG_FUNCTION (this << hdr);
- m_txErrCallback (hdr);
-}
-
-} // namespace ns3
--- a/src/wifi/model/monitor-mac-high.h Sat Jul 16 09:43:24 2011 -0400
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2008 INRIA
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, Ashwin Narayan <ashwin.narayan89@gmail.com>
- */
-#ifndef MONITOR_MAC_HIGH_H
-#define MONITOR_MAC_HIGH_H
-
-#include "ns3/wifi-mac.h"
-#include "ns3/radiotap-header.h"
-
-#include "dca-txop.h"
-#include "edca-txop-n.h"
-#include "wifi-remote-station-manager.h"
-#include "ssid.h"
-#include "qos-utils.h"
-
-#include <map>
-
-namespace ns3 {
-
-class Dcf;
-class MacLow;
-class MacRxMiddle;
-class MacTxMiddle;
-class DcfManager;
-
-/**
- * \brief base class for Monitor Wifi Mac objects.
- *
- * This class is essentially a copy of the non-QoS
- * functionality of RegularWifiMac
- *
- */
-
-class MonitorMacHigh : public WifiMac
-{
-public:
- static TypeId GetTypeId (void);
-
- MonitorMacHigh ();
- virtual ~MonitorMacHigh ();
-
- void SetSlot (Time slotTime);
- void SetSifs (Time sifs);
- void SetEifsNoDifs (Time eifsNoDifs);
- void SetPifs (Time pifs);
- void SetCtsTimeout (Time ctsTimeout);
- void SetAckTimeout (Time ackTimeout);
- Time GetPifs (void) const;
- Time GetSifs (void) const;
- Time GetSlot (void) const;
- Time GetEifsNoDifs (void) const;
- Time GetCtsTimeout (void) const;
- Time GetAckTimeout (void) const;
- virtual Mac48Address GetAddress (void) const;
- virtual Ssid GetSsid (void) const;
- virtual void SetAddress (Mac48Address address);
- virtual void SetSsid (Ssid ssid);
- virtual void SetBssid (Mac48Address bssid);
- virtual Mac48Address GetBssid (void) const;
- virtual void SetPromisc (void);
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
- virtual bool SupportsSendFrom (void) const;
- virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
- virtual void SetWifiPhy (Ptr<WifiPhy> phy);
- virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
- typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ForwardUpCallback;
- virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
- virtual void SetLinkUpCallback (Callback<void> linkUp);
- virtual void SetLinkDownCallback (Callback<void> linkDown);
- virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
- virtual Time GetBasicBlockAckTimeout (void) const;
- virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
- virtual Time GetCompressedBlockAckTimeout (void) const;
-
-protected:
- virtual void DoStart ();
- virtual void DoDispose ();
-
- MacRxMiddle *m_rxMiddle;
- MacTxMiddle *m_txMiddle;
- Ptr<MacLow> m_low;
- DcfManager *m_dcfManager;
- Ptr<WifiPhy> m_phy;
-
- Ptr<WifiRemoteStationManager> m_stationManager;
-
- ForwardUpCallback m_forwardUp;
- Callback<void> m_linkUp;
- Callback<void> m_linkDown;
-
- Ssid m_ssid;
-
- Ptr<DcaTxop> m_dca;
-
- virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
-
- virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr);
- virtual void TxOk (const WifiMacHeader &hdr);
- virtual void TxFailed (const WifiMacHeader &hdr);
-
- void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
-
- virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
- const WifiMacHeader *hdr);
-
- virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
- Mac48Address originator);
-
- bool m_qosSupported;
- void SetQosSupported (bool enable);
- bool GetQosSupported () const;
-private:
- Ptr<DcaTxop> GetDcaTxop (void) const;
-
- TracedCallback<const WifiMacHeader &> m_txOkCallback;
- TracedCallback<const WifiMacHeader &> m_txErrCallback;
-};
-
-} // namespace ns3
-
-#endif /* MONITOR_MAC_HIGH_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/monitor-wifi-mac.cc Sat Jul 16 10:44:13 2011 -0400
@@ -0,0 +1,419 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, Ashwin Narayan <ashwin.narayan89@gmail.com>
+ */
+#include "monitor-wifi-mac.h"
+
+#include "ns3/log.h"
+#include "ns3/boolean.h"
+#include "ns3/pointer.h"
+#include "ns3/uinteger.h"
+#include "ns3/trace-source-accessor.h"
+
+#include "mac-rx-middle.h"
+#include "mac-tx-middle.h"
+#include "mac-low.h"
+#include "dcf.h"
+#include "dcf-manager.h"
+#include "wifi-phy.h"
+
+#include "msdu-aggregator.h"
+
+NS_LOG_COMPONENT_DEFINE ("MonitorWifiMac");
+
+namespace ns3 {
+
+NS_OBJECT_ENSURE_REGISTERED (MonitorWifiMac);
+
+TypeId
+MonitorWifiMac::GetTypeId (void)
+{
+ static TypeId tid = TypeId ("ns3::MonitorWifiMac")
+ .SetParent<WifiMac> ()
+ .AddConstructor<MonitorWifiMac> ()
+ ;
+ return tid;
+}
+
+MonitorWifiMac::MonitorWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+ m_rxMiddle = new MacRxMiddle ();
+ m_rxMiddle->SetForwardCallback (MakeCallback (&MonitorWifiMac::Receive, this));
+
+ m_txMiddle = new MacTxMiddle ();
+
+ m_low = CreateObject<MacLow> ();
+ m_low->SetRxCallback (MakeCallback (&MacRxMiddle::Receive, m_rxMiddle));
+ m_low->SetMonitorMode ();
+
+ m_dcfManager = new DcfManager ();
+ m_dcfManager->SetupLowListener (m_low);
+
+ m_dca = CreateObject<DcaTxop> ();
+ m_dca->SetLow (m_low);
+ m_dca->SetManager (m_dcfManager);
+ m_dca->SetTxOkCallback (MakeCallback (&MonitorWifiMac::TxOk, this));
+ m_dca->SetTxFailedCallback (MakeCallback (&MonitorWifiMac::TxFailed, this));
+}
+
+MonitorWifiMac::~MonitorWifiMac ()
+{
+ NS_LOG_FUNCTION (this);
+}
+
+void
+MonitorWifiMac::DoStart ()
+{
+ NS_LOG_FUNCTION (this);
+
+ m_dca->Start ();
+}
+
+void
+MonitorWifiMac::DoDispose ()
+{
+ NS_LOG_FUNCTION (this);
+ delete m_rxMiddle;
+ m_rxMiddle = NULL;
+
+ delete m_txMiddle;
+ m_txMiddle = NULL;
+
+ delete m_dcfManager;
+ m_dcfManager = NULL;
+
+ m_low->Dispose ();
+ m_low = NULL;
+
+ m_phy = NULL;
+ m_stationManager = NULL;
+
+ m_dca->Dispose ();
+ m_dca = NULL;
+}
+
+Ptr<DcaTxop>
+MonitorWifiMac::GetDcaTxop () const
+{
+ return m_dca;
+}
+
+void
+MonitorWifiMac::SetForwardUpCallback (ForwardUpCallback upCallback)
+{
+ NS_LOG_FUNCTION (this);
+ m_forwardUp = upCallback;
+}
+
+void
+MonitorWifiMac::SetLinkUpCallback (Callback<void> linkUp)
+{
+ NS_LOG_FUNCTION (this);
+ m_linkUp = linkUp;
+}
+
+void
+MonitorWifiMac::SetLinkDownCallback (Callback<void> linkDown)
+{
+ NS_LOG_FUNCTION (this);
+ m_linkDown = linkDown;
+}
+
+void
+MonitorWifiMac::SetQosSupported (bool enable)
+{
+ NS_FATAL_ERROR ("QoS Functionality not supported in MonitorWifiMac");
+}
+
+bool
+MonitorWifiMac::GetQosSupported () const
+{
+ return false;
+}
+
+void
+MonitorWifiMac::SetSlot (Time slotTime)
+{
+ NS_LOG_FUNCTION (this << slotTime);
+ m_dcfManager->SetSlot (slotTime);
+ m_low->SetSlotTime (slotTime);
+}
+
+Time
+MonitorWifiMac::GetSlot (void) const
+{
+ return m_low->GetSlotTime ();
+}
+
+void
+MonitorWifiMac::SetSifs (Time sifs)
+{
+ NS_LOG_FUNCTION (this << sifs);
+ m_dcfManager->SetSifs (sifs);
+ m_low->SetSifs (sifs);
+}
+
+Time
+MonitorWifiMac::GetSifs (void) const
+{
+ return m_low->GetSifs ();
+}
+
+void
+MonitorWifiMac::SetEifsNoDifs (Time eifsNoDifs)
+{
+ NS_LOG_FUNCTION (this << eifsNoDifs);
+ m_dcfManager->SetEifsNoDifs (eifsNoDifs);
+}
+
+Time
+MonitorWifiMac::GetEifsNoDifs (void) const
+{
+ return m_dcfManager->GetEifsNoDifs ();
+}
+
+void
+MonitorWifiMac::SetPifs (Time pifs)
+{
+ NS_LOG_FUNCTION (this << pifs);
+ m_low->SetPifs (pifs);
+}
+
+Time
+MonitorWifiMac::GetPifs (void) const
+{
+ return m_low->GetPifs ();
+}
+
+void
+MonitorWifiMac::SetAckTimeout (Time ackTimeout)
+{
+ NS_LOG_FUNCTION (this << ackTimeout);
+ m_low->SetAckTimeout (ackTimeout);
+}
+
+Time
+MonitorWifiMac::GetAckTimeout (void) const
+{
+ return m_low->GetAckTimeout ();
+}
+
+void
+MonitorWifiMac::SetCtsTimeout (Time ctsTimeout)
+{
+ NS_LOG_FUNCTION (this << ctsTimeout);
+ m_low->SetCtsTimeout (ctsTimeout);
+}
+
+Time
+MonitorWifiMac::GetCtsTimeout (void) const
+{
+ return m_low->GetCtsTimeout ();
+}
+
+void
+MonitorWifiMac::SetBasicBlockAckTimeout (Time blockAckTimeout)
+{
+ NS_LOG_FUNCTION (this << blockAckTimeout);
+ m_low->SetBasicBlockAckTimeout (blockAckTimeout);
+}
+
+Time
+MonitorWifiMac::GetBasicBlockAckTimeout (void) const
+{
+ return m_low->GetBasicBlockAckTimeout ();
+}
+
+void
+MonitorWifiMac::SetCompressedBlockAckTimeout (Time blockAckTimeout)
+{
+ NS_LOG_FUNCTION (this << blockAckTimeout);
+ m_low->SetCompressedBlockAckTimeout (blockAckTimeout);
+}
+
+Time
+MonitorWifiMac::GetCompressedBlockAckTimeout (void) const
+{
+ return m_low->GetCompressedBlockAckTimeout ();
+}
+
+void
+MonitorWifiMac::SetAddress (Mac48Address address)
+{
+ NS_LOG_FUNCTION (this << address);
+ m_low->SetAddress (address);
+}
+
+Mac48Address
+MonitorWifiMac::GetAddress (void) const
+{
+ return m_low->GetAddress ();
+}
+
+void
+MonitorWifiMac::SetSsid (Ssid ssid)
+{
+ NS_LOG_FUNCTION (this << ssid);
+ m_ssid = ssid;
+}
+
+Ssid
+MonitorWifiMac::GetSsid (void) const
+{
+ return m_ssid;
+}
+
+void
+MonitorWifiMac::SetBssid (Mac48Address bssid)
+{
+ NS_LOG_FUNCTION (this << bssid);
+ m_low->SetBssid (bssid);
+}
+
+Mac48Address
+MonitorWifiMac::GetBssid (void) const
+{
+ return m_low->GetBssid ();
+}
+
+void
+MonitorWifiMac::SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager)
+{
+ NS_LOG_FUNCTION (this << stationManager);
+ m_stationManager = stationManager;
+ m_low->SetWifiRemoteStationManager (stationManager);
+
+ m_dca->SetWifiRemoteStationManager (stationManager);
+}
+
+void
+MonitorWifiMac::SetWifiPhy (Ptr<WifiPhy> phy)
+{
+ NS_LOG_FUNCTION (this << phy);
+ m_phy = phy;
+ m_dcfManager->SetupPhyListener (phy);
+ m_low->SetPhy (phy);
+}
+
+void
+MonitorWifiMac::SetPromisc (void)
+{
+ m_low->SetPromisc ();
+}
+
+void
+MonitorWifiMac::Enqueue (Ptr<const Packet> packet,
+ Mac48Address to, Mac48Address from)
+{
+}
+
+void
+MonitorWifiMac::Enqueue (Ptr<const Packet> packet,
+ Mac48Address to)
+{
+}
+
+bool
+MonitorWifiMac::SupportsSendFrom (void) const
+{
+ return false;
+}
+
+void
+MonitorWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to)
+{
+ NS_LOG_FUNCTION (this << packet << from);
+ m_forwardUp (packet, from, to);
+}
+
+void
+MonitorWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr)
+{
+
+ Mac48Address to = hdr->GetAddr1 ();
+ Mac48Address from = hdr->GetAddr2 ();
+ NS_LOG_DEBUG ("Received packet to: " << to << " from: " << from << " at:" << m_low->GetAddress ());
+ packet->AddHeader (*radiotaphdr);
+ ForwardUp (packet, from, to);
+}
+
+void
+MonitorWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
+ const WifiMacHeader *hdr)
+{
+}
+
+void
+MonitorWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
+ Mac48Address originator)
+{
+}
+
+void
+MonitorWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard)
+{
+ uint32_t cwmin;
+ uint32_t cwmax;
+
+ switch (standard)
+ {
+ case WIFI_PHY_STANDARD_80211p_CCH:
+ case WIFI_PHY_STANDARD_80211p_SCH:
+ cwmin = 15;
+ cwmax = 511;
+ break;
+
+ case WIFI_PHY_STANDARD_holland:
+ case WIFI_PHY_STANDARD_80211a:
+ case WIFI_PHY_STANDARD_80211g:
+ case WIFI_PHY_STANDARD_80211_10Mhz:
+ case WIFI_PHY_STANDARD_80211_5Mhz:
+ cwmin = 15;
+ cwmax = 1023;
+ break;
+
+ case WIFI_PHY_STANDARD_80211b:
+ cwmin = 31;
+ cwmax = 1023;
+ break;
+
+ default:
+ NS_FATAL_ERROR ("Unsupported WifiPhyStandard in MonitorWifiMac::FinishConfigureStandard ()");
+ }
+
+ // The special value of AC_BE_NQOS which exists in the Access
+ // Category enumeration allows us to configure plain old DCF.
+ ConfigureDcf (m_dca, cwmin, cwmax, AC_BE_NQOS);
+}
+
+void
+MonitorWifiMac::TxOk (const WifiMacHeader &hdr)
+{
+ NS_LOG_FUNCTION (this << hdr);
+ m_txOkCallback (hdr);
+}
+
+void
+MonitorWifiMac::TxFailed (const WifiMacHeader &hdr)
+{
+ NS_LOG_FUNCTION (this << hdr);
+ m_txErrCallback (hdr);
+}
+
+} // namespace ns3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/wifi/model/monitor-wifi-mac.h Sat Jul 16 10:44:13 2011 -0400
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
+/*
+ * Copyright (c) 2008 INRIA
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>, Ashwin Narayan <ashwin.narayan89@gmail.com>
+ */
+#ifndef MONITOR_WIFI_MAC_H
+#define MONITOR_WIFI_MAC_H
+
+#include "ns3/wifi-mac.h"
+#include "ns3/radiotap-header.h"
+
+#include "dca-txop.h"
+#include "edca-txop-n.h"
+#include "wifi-remote-station-manager.h"
+#include "ssid.h"
+#include "qos-utils.h"
+
+#include <map>
+
+namespace ns3 {
+
+class Dcf;
+class MacLow;
+class MacRxMiddle;
+class MacTxMiddle;
+class DcfManager;
+
+/**
+ * \brief base class for Monitor Wifi Mac objects.
+ *
+ * This class is essentially a copy of the non-QoS
+ * functionality of RegularWifiMac
+ *
+ */
+
+class MonitorWifiMac : public WifiMac
+{
+public:
+ static TypeId GetTypeId (void);
+
+ MonitorWifiMac ();
+ virtual ~MonitorWifiMac ();
+
+ void SetSlot (Time slotTime);
+ void SetSifs (Time sifs);
+ void SetEifsNoDifs (Time eifsNoDifs);
+ void SetPifs (Time pifs);
+ void SetCtsTimeout (Time ctsTimeout);
+ void SetAckTimeout (Time ackTimeout);
+ Time GetPifs (void) const;
+ Time GetSifs (void) const;
+ Time GetSlot (void) const;
+ Time GetEifsNoDifs (void) const;
+ Time GetCtsTimeout (void) const;
+ Time GetAckTimeout (void) const;
+ virtual Mac48Address GetAddress (void) const;
+ virtual Ssid GetSsid (void) const;
+ virtual void SetAddress (Mac48Address address);
+ virtual void SetSsid (Ssid ssid);
+ virtual void SetBssid (Mac48Address bssid);
+ virtual Mac48Address GetBssid (void) const;
+ virtual void SetPromisc (void);
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
+ virtual bool SupportsSendFrom (void) const;
+ virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
+ virtual void SetWifiPhy (Ptr<WifiPhy> phy);
+ virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
+ typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ForwardUpCallback;
+ virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
+ virtual void SetLinkUpCallback (Callback<void> linkUp);
+ virtual void SetLinkDownCallback (Callback<void> linkDown);
+ virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
+ virtual Time GetBasicBlockAckTimeout (void) const;
+ virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
+ virtual Time GetCompressedBlockAckTimeout (void) const;
+
+protected:
+ virtual void DoStart ();
+ virtual void DoDispose ();
+
+ MacRxMiddle *m_rxMiddle;
+ MacTxMiddle *m_txMiddle;
+ Ptr<MacLow> m_low;
+ DcfManager *m_dcfManager;
+ Ptr<WifiPhy> m_phy;
+
+ Ptr<WifiRemoteStationManager> m_stationManager;
+
+ ForwardUpCallback m_forwardUp;
+ Callback<void> m_linkUp;
+ Callback<void> m_linkDown;
+
+ Ssid m_ssid;
+
+ Ptr<DcaTxop> m_dca;
+
+ virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
+
+ virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr, const RadiotapHeader *radiotaphdr);
+ virtual void TxOk (const WifiMacHeader &hdr);
+ virtual void TxFailed (const WifiMacHeader &hdr);
+
+ void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
+
+ virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
+ const WifiMacHeader *hdr);
+
+ virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
+ Mac48Address originator);
+
+ bool m_qosSupported;
+ void SetQosSupported (bool enable);
+ bool GetQosSupported () const;
+private:
+ Ptr<DcaTxop> GetDcaTxop (void) const;
+
+ TracedCallback<const WifiMacHeader &> m_txOkCallback;
+ TracedCallback<const WifiMacHeader &> m_txErrCallback;
+};
+
+} // namespace ns3
+
+#endif /* MONITOR_WIFI_MAC_H */