author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 06 Jan 2010 16:26:07 +0100 | |
changeset 6065 | 0f012e7d9128 |
parent 5819 | 514ec98954ab |
child 6068 | a2127017ecb4 |
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; |
|
48 |
||
49 |
/* This queue contains packets for a particular access class. |
|
50 |
* possibles access classes are: |
|
51 |
* |
|
52 |
* -AC_VO : voice, tid = 6,7 ^ |
|
53 |
* -AC_VI : video, tid = 4,5 | |
|
54 |
* -AC_BE : best-effort, tid = 0,3 | priority |
|
55 |
* -AC_BK : background, tid = 1,2 | |
|
56 |
* |
|
57 |
* For more details see section 9.1.3.1 in 802.11 standard. |
|
58 |
*/ |
|
59 |
enum TypeOfStation |
|
60 |
{ |
|
61 |
STA, |
|
62 |
AP, |
|
63 |
ADHOC_STA |
|
64 |
}; |
|
65 |
||
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
66 |
class EdcaTxopN : public Dcf |
4408 | 67 |
{ |
68 |
public: |
|
69 |
||
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
|
70 |
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
|
71 |
typedef Callback <void, const WifiMacHeader&> TxFailed; |
4408 | 72 |
|
73 |
static TypeId GetTypeId (void); |
|
74 |
EdcaTxopN (); |
|
75 |
virtual ~EdcaTxopN (); |
|
76 |
void DoDispose (); |
|
77 |
||
78 |
void SetLow (Ptr<MacLow> low); |
|
79 |
void SetTxMiddle (MacTxMiddle *txMiddle); |
|
80 |
void SetManager (DcfManager *manager); |
|
81 |
void SetTxOkCallback (TxOk callback); |
|
82 |
void SetTxFailedCallback (TxFailed callback); |
|
83 |
void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager); |
|
84 |
void SetTypeOfStation (enum TypeOfStation type); |
|
85 |
enum TypeOfStation GetTypeOfStation (void) const; |
|
86 |
||
87 |
void SetMaxQueueSize (uint32_t size); |
|
88 |
void SetMaxQueueDelay (Time delay); |
|
4720
15221757964f
bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4421
diff
changeset
|
89 |
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
|
90 |
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
|
91 |
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
|
92 |
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
|
93 |
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
|
94 |
virtual uint32_t GetAifsn (void) const; |
4408 | 95 |
|
96 |
Ptr<MacLow> Low (void); |
|
97 |
Ptr<MsduAggregator> GetMsduAggregator (void) const; |
|
98 |
||
99 |
/* dcf notifications forwarded here */ |
|
100 |
bool NeedsAccess (void) const; |
|
101 |
void NotifyAccessGranted (void); |
|
102 |
void NotifyInternalCollision (void); |
|
103 |
void NotifyCollision (void); |
|
5192 | 104 |
/** |
105 |
* When a channel switching occurs, enqueued packets are removed. |
|
106 |
*/ |
|
5189 | 107 |
void NotifyChannelSwitching (void); |
4408 | 108 |
|
109 |
/*event handlers*/ |
|
110 |
void GotCts (double snr, WifiMode txMode); |
|
111 |
void MissedCts (void); |
|
112 |
void GotAck (double snr, WifiMode txMode); |
|
113 |
void MissedAck (void); |
|
114 |
void StartNext (void); |
|
115 |
void Cancel (void); |
|
116 |
||
117 |
void RestartAccessIfNeeded (void); |
|
118 |
void StartAccessIfNeeded (void); |
|
119 |
bool NeedRts (void); |
|
120 |
bool NeedRtsRetransmission (void); |
|
121 |
bool NeedDataRetransmission (void); |
|
122 |
bool NeedFragmentation (void) const; |
|
123 |
uint32_t GetNextFragmentSize (void); |
|
124 |
uint32_t GetFragmentSize (void); |
|
125 |
uint32_t GetFragmentOffset (void); |
|
126 |
bool IsLastFragment (void) const; |
|
127 |
void NextFragment (void); |
|
128 |
Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr); |
|
129 |
||
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
|
130 |
void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr); |
4408 | 131 |
void SetMsduAggregator (Ptr<MsduAggregator> aggr); |
132 |
||
133 |
private: |
|
134 |
/** |
|
135 |
* This functions are used only to correctly set addresses in a-msdu subframe. |
|
136 |
* If aggregating sta is a STA (in an infrastructured network): |
|
137 |
* SA = Address2 |
|
138 |
* DA = Address3 |
|
139 |
* If aggregating sta is an AP |
|
140 |
* SA = Address3 |
|
141 |
* DA = Address1 |
|
142 |
*/ |
|
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
|
143 |
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
|
144 |
Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr); |
4421
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
145 |
EdcaTxopN &operator = (const EdcaTxopN &); |
0608881b163f
help python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
4408
diff
changeset
|
146 |
EdcaTxopN (const EdcaTxopN &); |
4408 | 147 |
|
148 |
class Dcf; |
|
149 |
class TransmissionListener; |
|
150 |
friend class Dcf; |
|
151 |
friend class TransmissionListener; |
|
152 |
Dcf *m_dcf; |
|
153 |
DcfManager *m_manager; |
|
154 |
Ptr<WifiMacQueue> m_queue; |
|
155 |
TxOk m_txOkCallback; |
|
156 |
TxFailed m_txFailedCallback; |
|
157 |
Ptr<MacLow> m_low; |
|
158 |
MacTxMiddle *m_txMiddle; |
|
159 |
TransmissionListener *m_transmissionListener; |
|
160 |
RandomStream *m_rng; |
|
161 |
Ptr<WifiRemoteStationManager> m_stationManager; |
|
162 |
uint8_t m_fragmentNumber; |
|
163 |
||
164 |
/* current packet could be a simple MSDU or, if an aggregator for this queue is |
|
165 |
present, could be an A-MSDU. |
|
166 |
*/ |
|
167 |
Ptr<const Packet> m_currentPacket; |
|
168 |
||
169 |
WifiMacHeader m_currentHdr; |
|
170 |
Ptr<MsduAggregator> m_aggregator; |
|
171 |
TypeOfStation m_typeOfStation; |
|
172 |
}; |
|
173 |
||
174 |
} //namespace ns3 |
|
175 |
||
176 |
#endif /* EDCA_TXOP_N_H */ |