author | Mirko Banchi <mk.banchi@gmail.com> |
Wed, 03 Feb 2010 20:34:52 +0100 | |
changeset 5958 | dd0accd82659 |
parent 5953 | 9e400f6b8a2c |
child 6080 | 41ee42654550 |
permissions | -rw-r--r-- |
4408 | 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; |
|
5953
9e400f6b8a2c
handle wifi action frames in high MACs
Mirko Banchi <mk.banchi@gmail.com>
parents:
5906
diff
changeset
|
48 |
class MgtAddBaRequestHeader; |
4408 | 49 |
|
50 |
class QstaWifiMac : public WifiMac |
|
51 |
{ |
|
52 |
public: |
|
53 |
static TypeId GetTypeId (void); |
|
54 |
||
55 |
QstaWifiMac (); |
|
56 |
virtual ~QstaWifiMac (); |
|
57 |
||
58 |
// inherited from WifiMac. |
|
59 |
virtual void SetSlot (Time slotTime); |
|
60 |
virtual void SetSifs (Time sifs); |
|
61 |
virtual void SetEifsNoDifs (Time eifsNoDifs); |
|
62 |
virtual void SetAckTimeout (Time ackTimeout); |
|
63 |
virtual void SetCtsTimeout (Time ctsTimeout); |
|
64 |
virtual void SetPifs (Time pifs); |
|
65 |
virtual Time GetSlot (void) const; |
|
66 |
virtual Time GetSifs (void) const; |
|
67 |
virtual Time GetEifsNoDifs (void) const; |
|
68 |
virtual Time GetAckTimeout (void) const; |
|
69 |
virtual Time GetCtsTimeout (void) const; |
|
70 |
virtual Time GetPifs (void) const; |
|
71 |
virtual void SetWifiPhy (Ptr<WifiPhy> phy); |
|
72 |
virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager); |
|
73 |
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from){}; |
|
74 |
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to); |
|
75 |
virtual bool SupportsSendFrom (void) const; |
|
76 |
virtual void SetForwardUpCallback (Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> upCallback); |
|
77 |
virtual void SetLinkUpCallback (Callback<void> linkUp); |
|
78 |
virtual void SetLinkDownCallback (Callback<void> linkDown); |
|
79 |
virtual Mac48Address GetAddress (void) const; |
|
80 |
virtual Ssid GetSsid (void) const; |
|
81 |
virtual void SetAddress (Mac48Address address); |
|
82 |
virtual void SetSsid (Ssid ssid); |
|
83 |
virtual Mac48Address GetBssid (void) const; |
|
5958 | 84 |
virtual void SetBasicBlockAckTimeout (Time blockAckTimeout); |
85 |
virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout); |
|
86 |
virtual Time GetBasicBlockAckTimeout (void) const; |
|
87 |
virtual Time GetCompressedBlockAckTimeout (void) const; |
|
4408 | 88 |
|
89 |
void SetMaxMissedBeacons (uint32_t missed); |
|
90 |
void SetProbeRequestTimeout (Time timeout); |
|
91 |
void SetAssocRequestTimeout (Time timeout); |
|
92 |
void StartActiveAssociation (void); |
|
93 |
||
94 |
private: |
|
95 |
void SetBssid (Mac48Address bssid); |
|
96 |
Mac48Address GetBroadcastBssid (void); |
|
97 |
void Receive (Ptr<Packet> p, const WifiMacHeader *hdr); |
|
98 |
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to); |
|
99 |
void SetActiveProbing (bool enable); |
|
100 |
bool GetActiveProbing (void) const; |
|
101 |
void MissedBeacons (void); |
|
102 |
SupportedRates GetSupportedRates (void) const; |
|
103 |
void RestartBeaconWatchdog (Time delay); |
|
104 |
void AssocRequestTimeout (void); |
|
105 |
void ProbeRequestTimeout (void); |
|
106 |
void SendAssociationRequest (void); |
|
107 |
void SendProbeRequest (void); |
|
5953
9e400f6b8a2c
handle wifi action frames in high MACs
Mirko Banchi <mk.banchi@gmail.com>
parents:
5906
diff
changeset
|
108 |
void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Address originator); |
4408 | 109 |
void TryToEnsureAssociated (void); |
4609
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
110 |
bool IsAssociated (void) const; |
6ec902d6af68
bug 605: Nqsta MAC should ignore beacons SSIDs while waiting for association response
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4461
diff
changeset
|
111 |
bool IsWaitAssocResp (void) const; |
4408 | 112 |
virtual void DoDispose (void); |
113 |
||
114 |
/** |
|
115 |
* When an A-MSDU is received, is deaggregated by this method and all extracted packets are |
|
116 |
* forwarded up. |
|
117 |
*/ |
|
5819
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
4720
diff
changeset
|
118 |
void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, const WifiMacHeader *hdr); |
4408 | 119 |
|
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4609
diff
changeset
|
120 |
QstaWifiMac &operator = (const QstaWifiMac &); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4609
diff
changeset
|
121 |
QstaWifiMac (const QstaWifiMac &); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4609
diff
changeset
|
122 |
virtual void FinishConfigureStandard (enum WifiPhyStandard standard); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4609
diff
changeset
|
123 |
void SetQueue (enum AccessClass ac); |
4408 | 124 |
Ptr<EdcaTxopN> GetVOQueue (void) const; |
125 |
Ptr<EdcaTxopN> GetVIQueue (void) const; |
|
126 |
Ptr<EdcaTxopN> GetBEQueue (void) const; |
|
127 |
Ptr<EdcaTxopN> GetBKQueue (void) const; |
|
128 |
||
129 |
typedef std::map<AccessClass, Ptr<EdcaTxopN> > Queues; |
|
130 |
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus; |
|
131 |
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; |
|
132 |
||
133 |
enum { |
|
134 |
ASSOCIATED, |
|
135 |
WAIT_PROBE_RESP, |
|
136 |
WAIT_ASSOC_RESP, |
|
137 |
BEACON_MISSED, |
|
138 |
REFUSED |
|
139 |
} m_state; |
|
140 |
||
141 |
Queues m_queues; |
|
142 |
Ptr<MacLow> m_low; |
|
143 |
Ptr<WifiPhy> m_phy; |
|
144 |
Ptr<WifiRemoteStationManager> m_stationManager; |
|
145 |
DcfManager *m_dcfManager; |
|
146 |
MacRxMiddle *m_rxMiddle; |
|
147 |
MacTxMiddle *m_txMiddle; |
|
148 |
Ssid m_ssid; |
|
149 |
||
150 |
Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp; |
|
151 |
Callback<void> m_linkUp; |
|
152 |
Callback<void> m_linkDown; |
|
153 |
||
154 |
Time m_probeRequestTimeout; |
|
155 |
Time m_assocRequestTimeout; |
|
156 |
EventId m_probeRequestEvent; |
|
157 |
EventId m_assocRequestEvent; |
|
158 |
||
159 |
Time m_beaconWatchdogEnd; |
|
160 |
EventId m_beaconWatchdog; |
|
161 |
||
162 |
uint32_t m_maxMissedBeacons; |
|
163 |
}; |
|
164 |
||
165 |
} //namespace ns3 |
|
166 |
||
167 |
#endif /* QSTA_WIFI_MAC_H */ |