OLD | NEW |
(Empty) | |
| 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2006, 2009 INRIA |
| 4 * Copyright (c) 2009 MIRKO BANCHI |
| 5 * |
| 6 * This program is free software; you can redistribute it and/or modify |
| 7 * it under the terms of the GNU General Public License version 2 as· |
| 8 * published by the Free Software Foundation; |
| 9 * |
| 10 * This program is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 * GNU General Public License for more details. |
| 14 * |
| 15 * You should have received a copy of the GNU General Public License |
| 16 * along with this program; if not, write to the Free Software |
| 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 * |
| 19 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 20 * Author: Mirko Banchi <mk.banchi@gmail.com> |
| 21 */ |
| 22 #ifndef QSTA_WIFI_MAC_H |
| 23 #define QSTA_WIFI_MAC_H |
| 24 |
| 25 #include "ns3/callback.h" |
| 26 #include "ns3/packet.h" |
| 27 #include "ns3/event-id.h" |
| 28 |
| 29 #include "wifi-mac.h" |
| 30 #include "supported-rates.h" |
| 31 #include "qos-utils.h" |
| 32 |
| 33 #include <string> |
| 34 #include <vector> |
| 35 #include <list> |
| 36 #include <map> |
| 37 |
| 38 namespace ns3 { |
| 39 |
| 40 class DcfManager; |
| 41 class EdcaTxopN; |
| 42 class MacRxMiddle; |
| 43 class MacTxMiddle; |
| 44 class MacLow; |
| 45 class WifiMacHeader; |
| 46 class AmsduSubframeHeader; |
| 47 class MsduAggregator; |
| 48 |
| 49 class QstaWifiMac : public WifiMac |
| 50 { |
| 51 public: |
| 52 static TypeId GetTypeId (void); |
| 53 ·· |
| 54 QstaWifiMac (); |
| 55 virtual ~QstaWifiMac (); |
| 56 ·· |
| 57 // inherited from WifiMac. |
| 58 virtual void SetSlot (Time slotTime); |
| 59 virtual void SetSifs (Time sifs); |
| 60 virtual void SetEifsNoDifs (Time eifsNoDifs); |
| 61 virtual void SetAckTimeout (Time ackTimeout); |
| 62 virtual void SetCtsTimeout (Time ctsTimeout); |
| 63 virtual void SetPifs (Time pifs); |
| 64 virtual Time GetSlot (void) const; |
| 65 virtual Time GetSifs (void) const; |
| 66 virtual Time GetEifsNoDifs (void) const; |
| 67 virtual Time GetAckTimeout (void) const; |
| 68 virtual Time GetCtsTimeout (void) const; |
| 69 virtual Time GetPifs (void) const; |
| 70 virtual void SetWifiPhy (Ptr<WifiPhy> phy); |
| 71 virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> statio
nManager); |
| 72 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address
from){}; |
| 73 virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); |
| 74 virtual bool SupportsSendFrom (void) const; |
| 75 virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Ma
c48Address> upCallback); |
| 76 virtual void SetLinkUpCallback (Callback<void> linkUp); |
| 77 virtual void SetLinkDownCallback (Callback<void> linkDown); |
| 78 virtual Mac48Address GetAddress (void) const; |
| 79 virtual Ssid GetSsid (void) const; |
| 80 virtual void SetAddress (Mac48Address address); |
| 81 virtual void SetSsid (Ssid ssid); |
| 82 virtual Mac48Address GetBssid (void) const; |
| 83 |
| 84 void SetMaxMissedBeacons (uint32_t missed); |
| 85 void SetProbeRequestTimeout (Time timeout); |
| 86 void SetAssocRequestTimeout (Time timeout); |
| 87 void StartActiveAssociation (void); |
| 88 |
| 89 private: |
| 90 void SetBssid (Mac48Address bssid); |
| 91 Mac48Address GetBroadcastBssid (void); |
| 92 void Receive (Ptr<Packet> p, const WifiMacHeader *hdr); |
| 93 void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to); |
| 94 void SetActiveProbing (bool enable); |
| 95 bool GetActiveProbing (void) const; |
| 96 void MissedBeacons (void); |
| 97 SupportedRates GetSupportedRates (void) const; |
| 98 void RestartBeaconWatchdog (Time delay); |
| 99 void AssocRequestTimeout (void); |
| 100 void ProbeRequestTimeout (void); |
| 101 void SendAssociationRequest (void); |
| 102 void SendProbeRequest (void); |
| 103 void TryToEnsureAssociated (void); |
| 104 bool IsAssociated (void); |
| 105 virtual void DoDispose (void); |
| 106 |
| 107 /* If a qos tag is attached to the packet, returns a value < 8. |
| 108 A value >= 8 is returned otherwise. |
| 109 */ |
| 110 uint8_t GetTidForPacket (Ptr<const Packet> packet); |
| 111 |
| 112 /* Maps TID to Access classes. |
| 113 * For more details see table 9-1 of 802.11e standard. |
| 114 */ |
| 115 AccessClass MapTidToAc (uint8_t tid); |
| 116 |
| 117 /** |
| 118 * When an A-MSDU is received, is deaggregated by this method and all extracted
packets are |
| 119 * forwarded up. |
| 120 */ |
| 121 void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, WifiMacHeader c
onst *hdr); |
| 122 |
| 123 Ptr<EdcaTxopN> GetVOQueue (void) const; |
| 124 Ptr<EdcaTxopN> GetVIQueue (void) const; |
| 125 Ptr<EdcaTxopN> GetBEQueue (void) const; |
| 126 Ptr<EdcaTxopN> GetBKQueue (void) const; |
| 127 |
| 128 void SetVOQueue (Ptr<EdcaTxopN> voQueue); |
| 129 void SetVIQueue (Ptr<EdcaTxopN> viQueue); |
| 130 void SetBEQueue (Ptr<EdcaTxopN> beQueue); |
| 131 void SetBKQueue (Ptr<EdcaTxopN> bkQueue); |
| 132 |
| 133 typedef std::map<AccessClass, Ptr<EdcaTxopN> > Queues; |
| 134 typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > PacketSet; |
| 135 typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterato
r PacketSetCI; |
| 136 ···· |
| 137 enum { |
| 138 ASSOCIATED, |
| 139 WAIT_PROBE_RESP, |
| 140 WAIT_ASSOC_RESP, |
| 141 BEACON_MISSED, |
| 142 REFUSED |
| 143 } m_state; |
| 144 |
| 145 /*Next map is used only for an esay access to a specific queue*/ |
| 146 Queues m_queues; |
| 147 Ptr<EdcaTxopN> m_voEdca; |
| 148 Ptr<EdcaTxopN> m_viEdca; |
| 149 Ptr<EdcaTxopN> m_beEdca; |
| 150 Ptr<EdcaTxopN> m_bkEdca; |
| 151 |
| 152 Ptr<MacLow> m_low; |
| 153 Ptr<WifiPhy> m_phy; |
| 154 Ptr<WifiRemoteStationManager> m_stationManager; |
| 155 DcfManager *m_dcfManager; |
| 156 MacRxMiddle *m_rxMiddle; |
| 157 MacTxMiddle *m_txMiddle; |
| 158 Ssid m_ssid; |
| 159 ·· |
| 160 Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp; |
| 161 Callback<void> m_linkUp; |
| 162 Callback<void> m_linkDown; |
| 163 ·· |
| 164 Time m_probeRequestTimeout; |
| 165 Time m_assocRequestTimeout; |
| 166 EventId m_probeRequestEvent; |
| 167 EventId m_assocRequestEvent; |
| 168 ·· |
| 169 Time m_beaconWatchdogEnd; |
| 170 EventId m_beaconWatchdog; |
| 171 ·· |
| 172 uint32_t m_maxMissedBeacons; |
| 173 Time m_eifsNoDifs; |
| 174 std::string m_currentMode; |
| 175 }; |
| 176 |
| 177 } //namespace ns3 |
| 178 |
| 179 #endif /* QSTA_WIFI_MAC_H */ |
OLD | NEW |