author | Pavel Boyko <boyko@iitp.ru> |
Tue, 16 Jun 2009 17:58:16 +0400 | |
changeset 5074 | 355de6af8ea9 |
parent 4461 | ab9b58d664d7 |
child 4609 | 6ec902d6af68 |
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; |
|
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> stationManager); |
|
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, Mac48Address> 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 |
/** |
|
108 |
* When an A-MSDU is received, is deaggregated by this method and all extracted packets are |
|
109 |
* forwarded up. |
|
110 |
*/ |
|
111 |
void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, WifiMacHeader const *hdr); |
|
112 |
||
113 |
Ptr<EdcaTxopN> GetVOQueue (void) const; |
|
114 |
Ptr<EdcaTxopN> GetVIQueue (void) const; |
|
115 |
Ptr<EdcaTxopN> GetBEQueue (void) const; |
|
116 |
Ptr<EdcaTxopN> GetBKQueue (void) const; |
|
117 |
||
118 |
void SetVOQueue (Ptr<EdcaTxopN> voQueue); |
|
119 |
void SetVIQueue (Ptr<EdcaTxopN> viQueue); |
|
120 |
void SetBEQueue (Ptr<EdcaTxopN> beQueue); |
|
121 |
void SetBKQueue (Ptr<EdcaTxopN> bkQueue); |
|
122 |
||
4421
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
123 |
QstaWifiMac &operator = (const QstaWifiMac &); |
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
124 |
QstaWifiMac (const QstaWifiMac &); |
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
125 |
|
4408 | 126 |
typedef std::map<AccessClass, Ptr<EdcaTxopN> > Queues; |
127 |
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus; |
|
128 |
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; |
|
129 |
||
130 |
enum { |
|
131 |
ASSOCIATED, |
|
132 |
WAIT_PROBE_RESP, |
|
133 |
WAIT_ASSOC_RESP, |
|
134 |
BEACON_MISSED, |
|
135 |
REFUSED |
|
136 |
} m_state; |
|
137 |
||
138 |
/*Next map is used only for an esay access to a specific queue*/ |
|
139 |
Queues m_queues; |
|
140 |
Ptr<EdcaTxopN> m_voEdca; |
|
141 |
Ptr<EdcaTxopN> m_viEdca; |
|
142 |
Ptr<EdcaTxopN> m_beEdca; |
|
143 |
Ptr<EdcaTxopN> m_bkEdca; |
|
144 |
||
145 |
Ptr<MacLow> m_low; |
|
146 |
Ptr<WifiPhy> m_phy; |
|
147 |
Ptr<WifiRemoteStationManager> m_stationManager; |
|
148 |
DcfManager *m_dcfManager; |
|
149 |
MacRxMiddle *m_rxMiddle; |
|
150 |
MacTxMiddle *m_txMiddle; |
|
151 |
Ssid m_ssid; |
|
152 |
||
153 |
Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp; |
|
154 |
Callback<void> m_linkUp; |
|
155 |
Callback<void> m_linkDown; |
|
156 |
||
157 |
Time m_probeRequestTimeout; |
|
158 |
Time m_assocRequestTimeout; |
|
159 |
EventId m_probeRequestEvent; |
|
160 |
EventId m_assocRequestEvent; |
|
161 |
||
162 |
Time m_beaconWatchdogEnd; |
|
163 |
EventId m_beaconWatchdog; |
|
164 |
||
165 |
uint32_t m_maxMissedBeacons; |
|
166 |
}; |
|
167 |
||
168 |
} //namespace ns3 |
|
169 |
||
170 |
#endif /* QSTA_WIFI_MAC_H */ |