author | Kirill Andreev <andreev@iitp.ru> |
Wed, 29 Apr 2009 19:37:19 +0400 | |
changeset 4989 | 5f5b321b92d1 |
parent 4421 | 0608881b163f |
child 4461 | ab9b58d664d7 |
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 QAP_WIFI_MAC_H |
|
23 |
#define QAP_WIFI_MAC_H |
|
24 |
||
25 |
#include "ns3/mac48-address.h" |
|
26 |
#include "ns3/callback.h" |
|
27 |
#include "ns3/packet.h" |
|
28 |
#include "ns3/nstime.h" |
|
29 |
#include "ns3/event-id.h" |
|
30 |
||
31 |
#include "supported-rates.h" |
|
32 |
#include "wifi-remote-station-manager.h" |
|
33 |
#include "wifi-mac.h" |
|
34 |
#include "qos-utils.h" |
|
35 |
||
36 |
#include <map> |
|
37 |
||
38 |
namespace ns3 { |
|
39 |
||
40 |
class DcaTxop; |
|
41 |
class EdcaTxopN; |
|
42 |
class WifiMacHeader; |
|
43 |
class WifiPhy; |
|
44 |
class MacLow; |
|
45 |
class MacRxMiddle; |
|
46 |
class MacTxMiddle; |
|
47 |
class DcfManager; |
|
48 |
class AmsduSubframeHeader; |
|
49 |
class MsduAggregator; |
|
50 |
||
51 |
class QapWifiMac : public WifiMac |
|
52 |
{ |
|
53 |
public: |
|
54 |
static TypeId GetTypeId (void); |
|
55 |
QapWifiMac (); |
|
56 |
virtual ~QapWifiMac (); |
|
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; |
|
84 |
||
85 |
void SetBeaconInterval (Time interval); |
|
86 |
Time GetBeaconInterval (void) const; |
|
87 |
void StartBeaconing (void); |
|
88 |
||
89 |
private: |
|
90 |
virtual void DoDispose (void); |
|
91 |
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr); |
|
92 |
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to); |
|
93 |
void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to); |
|
94 |
/* Next function is invoked only when ap relies a frame. */ |
|
95 |
void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to, |
|
96 |
WifiMacHeader const *oldHdr); |
|
97 |
void TxOk (WifiMacHeader const &hdr); |
|
98 |
void TxFailed (WifiMacHeader const &hdr); |
|
99 |
void SendProbeResp (Mac48Address to); |
|
100 |
void SendAssocResp (Mac48Address to, bool success); |
|
101 |
void SendOneBeacon (void); |
|
102 |
SupportedRates GetSupportedRates (void) const; |
|
103 |
void SetBeaconGeneration (bool enable); |
|
104 |
bool GetBeaconGeneration (void) const; |
|
105 |
||
106 |
void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, WifiMacHeader const *hdr); |
|
4421
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
107 |
QapWifiMac &operator = (const QapWifiMac &); |
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
108 |
QapWifiMac (const QapWifiMac &); |
4408 | 109 |
|
110 |
typedef std::map<AccessClass, Ptr<EdcaTxopN> > Queues; |
|
111 |
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> > DeaggregatedMsdus; |
|
112 |
typedef std::list<std::pair<Ptr<Packet>, AmsduSubframeHeader> >::const_iterator DeaggregatedMsdusCI; |
|
113 |
||
114 |
Callback<void,Ptr<Packet>, Mac48Address, Mac48Address> m_forwardUp; |
|
115 |
||
116 |
Ptr<EdcaTxopN> GetVOQueue (void) const; |
|
117 |
Ptr<EdcaTxopN> GetVIQueue (void) const; |
|
118 |
Ptr<EdcaTxopN> GetBEQueue (void) const; |
|
119 |
Ptr<EdcaTxopN> GetBKQueue (void) const; |
|
120 |
||
121 |
void SetVOQueue (Ptr<EdcaTxopN> voQueue); |
|
122 |
void SetVIQueue (Ptr<EdcaTxopN> viQueue); |
|
123 |
void SetBEQueue (Ptr<EdcaTxopN> beQueue); |
|
124 |
void SetBKQueue (Ptr<EdcaTxopN> bkQueue); |
|
125 |
||
126 |
/*Next map is used only for an esay access to a specific queue*/ |
|
127 |
Queues m_queues; |
|
128 |
Ptr<EdcaTxopN> m_voEdca; |
|
129 |
Ptr<EdcaTxopN> m_viEdca; |
|
130 |
Ptr<EdcaTxopN> m_beEdca; |
|
131 |
Ptr<EdcaTxopN> m_bkEdca; |
|
132 |
Ptr<DcaTxop> m_beaconDca; |
|
133 |
Ptr<MacLow> m_low; |
|
134 |
Ptr<WifiPhy> m_phy; |
|
135 |
Ptr<WifiRemoteStationManager> m_stationManager; |
|
136 |
MacRxMiddle *m_rxMiddle; |
|
137 |
MacTxMiddle *m_txMiddle; |
|
138 |
DcfManager *m_dcfManager; |
|
139 |
Ssid m_ssid; |
|
140 |
EventId m_beaconEvent; |
|
141 |
Time m_beaconInterval; |
|
142 |
Time m_eifsNoDifs; |
|
143 |
}; |
|
144 |
||
145 |
} //namespace ns3 |
|
146 |
||
147 |
#endif /* QAP_WIFI_MAC_H */ |