author | Mirko Banchi <mk.banchi@gmail.com> |
Wed, 03 Feb 2010 20:34:52 +0100 | |
changeset 5958 | dd0accd82659 |
parent 5955 | 10fbe045901e |
child 5963 | 5f82c5a7068e |
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 EDCA_TXOP_N_H |
|
23 |
#define EDCA_TXOP_N_H |
|
24 |
||
25 |
#include "ns3/object.h" |
|
26 |
#include "ns3/mac48-address.h" |
|
27 |
#include "ns3/packet.h" |
|
28 |
||
29 |
#include "wifi-mode.h" |
|
30 |
#include "wifi-mac.h" |
|
31 |
#include "wifi-mac-header.h" |
|
32 |
#include "qos-utils.h" |
|
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
33 |
#include "dcf.h" |
4408 | 34 |
|
35 |
#include <map> |
|
36 |
#include <list> |
|
37 |
||
38 |
namespace ns3 { |
|
39 |
||
40 |
class DcfState; |
|
41 |
class DcfManager; |
|
42 |
class MacLow; |
|
43 |
class MacTxMiddle; |
|
44 |
class WifiMacParameters; |
|
45 |
class WifiMacQueue; |
|
46 |
class RandomStream; |
|
47 |
class MsduAggregator; |
|
5953
9e400f6b8a2c
handle wifi action frames in high MACs
Mirko Banchi <mk.banchi@gmail.com>
parents:
5952
diff
changeset
|
48 |
class MgtAddBaResponseHeader; |
5955
10fbe045901e
add support for block ack in MacLowTransmissionListener
Mirko Banchi <mk.banchi@gmail.com>
parents:
5953
diff
changeset
|
49 |
class CtrlBAckResponseHeader; |
5953
9e400f6b8a2c
handle wifi action frames in high MACs
Mirko Banchi <mk.banchi@gmail.com>
parents:
5952
diff
changeset
|
50 |
|
4408 | 51 |
|
52 |
/* This queue contains packets for a particular access class. |
|
53 |
* possibles access classes are: |
|
54 |
* |
|
55 |
* -AC_VO : voice, tid = 6,7 ^ |
|
56 |
* -AC_VI : video, tid = 4,5 | |
|
57 |
* -AC_BE : best-effort, tid = 0,3 | priority |
|
58 |
* -AC_BK : background, tid = 1,2 | |
|
59 |
* |
|
60 |
* For more details see section 9.1.3.1 in 802.11 standard. |
|
61 |
*/ |
|
62 |
enum TypeOfStation |
|
63 |
{ |
|
64 |
STA, |
|
65 |
AP, |
|
66 |
ADHOC_STA |
|
67 |
}; |
|
68 |
||
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
69 |
class EdcaTxopN : public Dcf |
4408 | 70 |
{ |
71 |
public: |
|
72 |
||
5819
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
5192
diff
changeset
|
73 |
typedef Callback <void, const WifiMacHeader&> TxOk; |
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
5192
diff
changeset
|
74 |
typedef Callback <void, const WifiMacHeader&> TxFailed; |
4408 | 75 |
|
76 |
static TypeId GetTypeId (void); |
|
77 |
EdcaTxopN (); |
|
78 |
virtual ~EdcaTxopN (); |
|
79 |
void DoDispose (); |
|
80 |
||
81 |
void SetLow (Ptr<MacLow> low); |
|
82 |
void SetTxMiddle (MacTxMiddle *txMiddle); |
|
83 |
void SetManager (DcfManager *manager); |
|
84 |
void SetTxOkCallback (TxOk callback); |
|
85 |
void SetTxFailedCallback (TxFailed callback); |
|
86 |
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager); |
|
87 |
void SetTypeOfStation (enum TypeOfStation type); |
|
88 |
enum TypeOfStation GetTypeOfStation (void) const; |
|
89 |
||
90 |
void SetMaxQueueSize (uint32_t size); |
|
91 |
void SetMaxQueueDelay (Time delay); |
|
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
92 |
virtual void SetMinCw (uint32_t minCw); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
93 |
virtual void SetMaxCw (uint32_t maxCw); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
94 |
virtual void SetAifsn (uint32_t aifsn); |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
95 |
virtual uint32_t GetMinCw (void) const; |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
96 |
virtual uint32_t GetMaxCw (void) const; |
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
97 |
virtual uint32_t GetAifsn (void) const; |
4408 | 98 |
|
99 |
Ptr<MacLow> Low (void); |
|
100 |
Ptr<MsduAggregator> GetMsduAggregator (void) const; |
|
101 |
||
102 |
/* dcf notifications forwarded here */ |
|
103 |
bool NeedsAccess (void) const; |
|
104 |
void NotifyAccessGranted (void); |
|
105 |
void NotifyInternalCollision (void); |
|
106 |
void NotifyCollision (void); |
|
5192 | 107 |
/** |
108 |
* When a channel switching occurs, enqueued packets are removed. |
|
109 |
*/ |
|
5189 | 110 |
void NotifyChannelSwitching (void); |
4408 | 111 |
|
112 |
/*event handlers*/ |
|
113 |
void GotCts (double snr, WifiMode txMode); |
|
114 |
void MissedCts (void); |
|
115 |
void GotAck (double snr, WifiMode txMode); |
|
5955
10fbe045901e
add support for block ack in MacLowTransmissionListener
Mirko Banchi <mk.banchi@gmail.com>
parents:
5953
diff
changeset
|
116 |
void GotBlockAck (const CtrlBAckResponseHeader *blockAck, Mac48Address recipient); |
5958 | 117 |
void MissedBlockAck (void); |
5953
9e400f6b8a2c
handle wifi action frames in high MACs
Mirko Banchi <mk.banchi@gmail.com>
parents:
5952
diff
changeset
|
118 |
void GotAddBaResponse (const MgtAddBaResponseHeader *respHdr, Mac48Address recipient); |
4408 | 119 |
void MissedAck (void); |
120 |
void StartNext (void); |
|
121 |
void Cancel (void); |
|
122 |
||
123 |
void RestartAccessIfNeeded (void); |
|
124 |
void StartAccessIfNeeded (void); |
|
125 |
bool NeedRts (void); |
|
126 |
bool NeedRtsRetransmission (void); |
|
127 |
bool NeedDataRetransmission (void); |
|
128 |
bool NeedFragmentation (void) const; |
|
129 |
uint32_t GetNextFragmentSize (void); |
|
130 |
uint32_t GetFragmentSize (void); |
|
131 |
uint32_t GetFragmentOffset (void); |
|
132 |
WifiRemoteStation *GetStation (Mac48Address to) const; |
|
133 |
bool IsLastFragment (void) const; |
|
134 |
void NextFragment (void); |
|
135 |
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr); |
|
136 |
||
5819
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
5192
diff
changeset
|
137 |
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr); |
4408 | 138 |
void SetMsduAggregator (Ptr<MsduAggregator> aggr); |
5952
0588b01cd77e
WifiMacQueue now supports head pushing
Mirko Banchi <mk.banchi@gmail.com>
parents:
5906
diff
changeset
|
139 |
void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr); |
4408 | 140 |
|
141 |
private: |
|
142 |
/** |
|
143 |
* This functions are used only to correctly set addresses in a-msdu subframe. |
|
144 |
* If aggregating sta is a STA (in an infrastructured network): |
|
145 |
* SA = Address2 |
|
146 |
* DA = Address3 |
|
147 |
* If aggregating sta is an AP |
|
148 |
* SA = Address3 |
|
149 |
* DA = Address1 |
|
150 |
*/ |
|
5819
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
5192
diff
changeset
|
151 |
Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr); |
514ec98954ab
Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents:
5192
diff
changeset
|
152 |
Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr); |
4421
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
153 |
EdcaTxopN &operator = (const EdcaTxopN &); |
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
154 |
EdcaTxopN (const EdcaTxopN &); |
4408 | 155 |
|
156 |
class Dcf; |
|
157 |
class TransmissionListener; |
|
158 |
friend class Dcf; |
|
159 |
friend class TransmissionListener; |
|
160 |
Dcf *m_dcf; |
|
161 |
DcfManager *m_manager; |
|
162 |
Ptr<WifiMacQueue> m_queue; |
|
163 |
TxOk m_txOkCallback; |
|
164 |
TxFailed m_txFailedCallback; |
|
165 |
Ptr<MacLow> m_low; |
|
166 |
MacTxMiddle *m_txMiddle; |
|
167 |
TransmissionListener *m_transmissionListener; |
|
168 |
RandomStream *m_rng; |
|
169 |
Ptr<WifiRemoteStationManager> m_stationManager; |
|
170 |
uint8_t m_fragmentNumber; |
|
171 |
||
172 |
/* current packet could be a simple MSDU or, if an aggregator for this queue is |
|
173 |
present, could be an A-MSDU. |
|
174 |
*/ |
|
175 |
Ptr<const Packet> m_currentPacket; |
|
176 |
||
177 |
WifiMacHeader m_currentHdr; |
|
178 |
Ptr<MsduAggregator> m_aggregator; |
|
179 |
TypeOfStation m_typeOfStation; |
|
180 |
}; |
|
181 |
||
182 |
} //namespace ns3 |
|
183 |
||
184 |
#endif /* EDCA_TXOP_N_H */ |