LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2006, 2009 INRIA | 3 * Copyright (c) 2006, 2009 INRIA |
4 * Copyright (c) 2009 MIRKO BANCHI | 4 * Copyright (c) 2009 MIRKO BANCHI |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 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· | 7 * it under the terms of the GNU General Public License version 2 as· |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 namespace ns3 { | 39 namespace ns3 { |
40 | 40 |
41 class DcfState; | 41 class DcfState; |
42 class DcfManager; | 42 class DcfManager; |
43 class MacLow; | 43 class MacLow; |
44 class MacTxMiddle; | 44 class MacTxMiddle; |
45 class WifiMacParameters; | 45 class WifiMacParameters; |
46 class WifiMacQueue; | 46 class WifiMacQueue; |
47 class RandomStream; | 47 class RandomStream; |
| 48 class QosBlockedDestinations; |
48 class MsduAggregator; | 49 class MsduAggregator; |
49 class MgtAddBaResponseHeader; | 50 class MgtAddBaResponseHeader; |
50 class BlockAckManager; | 51 class BlockAckManager; |
51 class MgtDelBaHeader; | 52 class MgtDelBaHeader; |
| 53 |
52 | 54 |
53 /* This queue contains packets for a particular access class. | 55 /* This queue contains packets for a particular access class. |
54 * possibles access classes are: | 56 * possibles access classes are: |
55 *··· | 57 *··· |
56 * -AC_VO : voice, tid = 6,7 ^ | 58 * -AC_VO : voice, tid = 6,7 ^ |
57 * -AC_VI : video, tid = 4,5 | | 59 * -AC_VI : video, tid = 4,5 | |
58 * -AC_BE : best-effort, tid = 0,3 | priority·· | 60 * -AC_BE : best-effort, tid = 0,3 | priority·· |
59 * -AC_BK : background, tid = 1,2 | | 61 * -AC_BK : background, tid = 1,2 | |
60 *· | 62 *· |
61 * For more details see section 9.1.3.1 in 802.11 standard. | 63 * For more details see section 9.1.3.1 in 802.11 standard. |
62 */ | 64 */ |
63 enum TypeOfStation | 65 enum TypeOfStation |
64 { | 66 { |
65 STA, | 67 STA, |
66 AP, | 68 AP, |
67 ADHOC_STA | 69 ADHOC_STA |
68 }; | 70 }; |
69 | 71 |
70 class EdcaTxopN : public Dcf | 72 class EdcaTxopN : public Dcf |
71 { | 73 { |
72 public: | 74 public: |
73 | 75 |
74 typedef Callback <void, WifiMacHeader const&> TxOk; | 76 typedef Callback <void, const WifiMacHeader&> TxOk; |
75 typedef Callback <void, WifiMacHeader const&> TxFailed; | 77 typedef Callback <void, const WifiMacHeader&> TxFailed; |
76 ·· | 78 ·· |
77 static TypeId GetTypeId (void); | 79 static TypeId GetTypeId (void); |
78 EdcaTxopN (); | 80 EdcaTxopN (); |
79 virtual ~EdcaTxopN (); | 81 virtual ~EdcaTxopN (); |
80 void DoDispose (); | 82 void DoDispose (); |
81 ·· | 83 ·· |
82 void SetLow (Ptr<MacLow> low); | 84 void SetLow (Ptr<MacLow> low); |
83 void SetTxMiddle (MacTxMiddle *txMiddle); | 85 void SetTxMiddle (MacTxMiddle *txMiddle); |
84 void SetManager (DcfManager *manager); | 86 void SetManager (DcfManager *manager); |
85 void SetTxOkCallback (TxOk callback); | 87 void SetTxOkCallback (TxOk callback); |
86 void SetTxFailedCallback (TxFailed callback); | 88 void SetTxFailedCallback (TxFailed callback); |
87 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager)
; | 89 void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> remoteManager)
; |
88 void SetTypeOfStation (enum TypeOfStation type); | 90 void SetTypeOfStation (enum TypeOfStation type); |
89 enum TypeOfStation GetTypeOfStation (void) const; | 91 enum TypeOfStation GetTypeOfStation (void) const; |
90 const MacTxMiddle* GetTxMiddle (void) const; | |
91 | 92 |
92 void SetMaxQueueSize (uint32_t size); | 93 void SetMaxQueueSize (uint32_t size); |
93 void SetMaxQueueDelay (Time delay); | 94 void SetMaxQueueDelay (Time delay); |
94 virtual void SetMinCw (uint32_t minCw); | 95 virtual void SetMinCw (uint32_t minCw); |
95 virtual void SetMaxCw (uint32_t maxCw); | 96 virtual void SetMaxCw (uint32_t maxCw); |
96 virtual void SetAifsn (uint32_t aifsn); | 97 virtual void SetAifsn (uint32_t aifsn); |
97 virtual uint32_t GetMinCw (void) const; | 98 virtual uint32_t GetMinCw (void) const; |
98 virtual uint32_t GetMaxCw (void) const; | 99 virtual uint32_t GetMaxCw (void) const; |
99 virtual uint32_t GetAifsn (void) const; | 100 virtual uint32_t GetAifsn (void) const; |
100 | 101 |
(...skipping 29 matching lines...) Expand all Loading... |
130 bool NeedDataRetransmission (void); | 131 bool NeedDataRetransmission (void); |
131 bool NeedFragmentation (void) const; | 132 bool NeedFragmentation (void) const; |
132 uint32_t GetNextFragmentSize (void); | 133 uint32_t GetNextFragmentSize (void); |
133 uint32_t GetFragmentSize (void); | 134 uint32_t GetFragmentSize (void); |
134 uint32_t GetFragmentOffset (void); | 135 uint32_t GetFragmentOffset (void); |
135 WifiRemoteStation *GetStation (Mac48Address to) const; | 136 WifiRemoteStation *GetStation (Mac48Address to) const; |
136 bool IsLastFragment (void) const; | 137 bool IsLastFragment (void) const; |
137 void NextFragment (void); | 138 void NextFragment (void); |
138 Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr); | 139 Ptr<Packet> GetFragmentPacket (WifiMacHeader *hdr); |
139 ·· | 140 ·· |
140 void Queue (Ptr<const Packet> packet, WifiMacHeader const &hdr); | 141 void SetAccessClass (enum AccessClass ac); |
| 142 void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr); |
141 void SetMsduAggregator (Ptr<MsduAggregator> aggr); | 143 void SetMsduAggregator (Ptr<MsduAggregator> aggr); |
142 void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr); | 144 void PushFront (Ptr<const Packet> packet, const WifiMacHeader &hdr); |
143 void CompleteConfig (void); | 145 void CompleteConfig (void); |
144 void SetBlockAckThreshold (uint8_t threshold); | 146 void SetBlockAckThreshold (uint8_t threshold); |
145 uint8_t GetBlockAckThreshold (void) const; | 147 uint8_t GetBlockAckThreshold (void) const; |
146 ·· | 148 void SendDelbaFrame (Mac48Address addr, uint8_t tid, bool byOriginator); |
147 | 149 |
148 private: | 150 private: |
149 /** | 151 /** |
150 * This functions are used only to correctly set addresses in a-msdu subframe. | 152 * This functions are used only to correctly set addresses in a-msdu subframe. |
151 * If aggregating sta is a STA (in an infrastructured network): | 153 * If aggregating sta is a STA (in an infrastructured network): |
152 * SA = Address2 | 154 * SA = Address2 |
153 * DA = Address3 | 155 * DA = Address3 |
154 * If aggregating sta is an AP | 156 * If aggregating sta is an AP |
155 * SA = Address3 | 157 * SA = Address3 |
156 * DA = Address1 | 158 * DA = Address1 |
157 */ | 159 */ |
158 Mac48Address MapSrcAddressForAggregation (WifiMacHeader const &hdr); | 160 Mac48Address MapSrcAddressForAggregation (const WifiMacHeader &hdr); |
159 Mac48Address MapDestAddressForAggregation (WifiMacHeader const &hdr); | 161 Mac48Address MapDestAddressForAggregation (const WifiMacHeader &hdr); |
160 EdcaTxopN &operator = (const EdcaTxopN &); | 162 EdcaTxopN &operator = (const EdcaTxopN &); |
161 EdcaTxopN (const EdcaTxopN &); | 163 EdcaTxopN (const EdcaTxopN &); |
162 | 164 |
163 /* If number of packets in the queue reaches m_blockAckThreshold value, an ADD
BARequest frame | 165 /* If number of packets in the queue reaches m_blockAckThreshold value, an ADD
BARequest frame |
164 * is sent to destination in order to setup a block ack. | 166 * is sent to destination in order to setup a block ack. |
165 */ | 167 */ |
166 bool SetupBlockAckIfNeeded (); | 168 bool SetupBlockAckIfNeeded (); |
167 /* Sends an ADDBARequest to establish a block ack agreement with sta | 169 /* Sends an ADDBARequest to establish a block ack agreement with sta |
168 * addressed by <i>recipient</i> for tid <i>tid</i>. | 170 * addressed by <i>recipient</i> for tid <i>tid</i>. |
169 */ | 171 */ |
170 void SendAddBaRequest (Mac48Address recipient, uint8_t tid, uint16_t startSeq, | 172 void SendAddBaRequest (Mac48Address recipient, uint8_t tid, uint16_t startSeq, |
171 uint16_t timeout, bool immediateBAck); | 173 uint16_t timeout, bool immediateBAck); |
172 /* After that all packets, for which a block ack agreement was established, ha
ve been | 174 /* After that all packets, for which a block ack agreement was established, ha
ve been |
173 * transmitted, we have to send a block ack request. | 175 * transmitted, we have to send a block ack request. |
174 */ | 176 */ |
175 void SendBlockAckRequest (void); | 177 void SendBlockAckRequest (const struct Bar &bar); |
176 /* For now is typically invoked to complete transmission of a packets sent wit
h ack policy | 178 /* For now is typically invoked to complete transmission of a packets sent wit
h ack policy |
177 * Block Ack: the packet is buffered and dcf is reset. | 179 * Block Ack: the packet is buffered and dcf is reset. |
178 */ | 180 */ |
179 void CompleteTx (void); | 181 void CompleteTx (void); |
180 /* Verifies if dequeued packet has to be transmitted with ack policy Block Ack
. This happens | 182 /* Verifies if dequeued packet has to be transmitted with ack policy Block Ack
. This happens |
181 * if an established block ack agreement exists with the receiver. | 183 * if an established block ack agreement exists with the receiver. |
182 */ | 184 */ |
183 void VerifyBlockAck (void); | 185 void VerifyBlockAck (void); |
184 ·· | 186 ·· |
185 ·· | 187 AccessClass m_ac; |
186 class Dcf; | 188 class Dcf; |
187 class TransmissionListener; | 189 class TransmissionListener; |
| 190 class BlockAckEventListener; |
188 friend class Dcf; | 191 friend class Dcf; |
189 friend class TransmissionListener; | 192 friend class TransmissionListener; |
190 Dcf *m_dcf; | 193 Dcf *m_dcf; |
191 DcfManager *m_manager; | 194 DcfManager *m_manager; |
192 Ptr<WifiMacQueue> m_queue; | 195 Ptr<WifiMacQueue> m_queue; |
193 TxOk m_txOkCallback; | 196 TxOk m_txOkCallback; |
194 TxFailed m_txFailedCallback; | 197 TxFailed m_txFailedCallback; |
195 Ptr<MacLow> m_low; | 198 Ptr<MacLow> m_low; |
196 MacTxMiddle *m_txMiddle; | 199 MacTxMiddle *m_txMiddle; |
197 TransmissionListener *m_transmissionListener; | 200 TransmissionListener *m_transmissionListener; |
| 201 BlockAckEventListener *m_blockAckListener; |
198 RandomStream *m_rng; | 202 RandomStream *m_rng; |
199 Ptr<WifiRemoteStationManager> m_stationManager; | 203 Ptr<WifiRemoteStationManager> m_stationManager; |
200 uint8_t m_fragmentNumber; | 204 uint8_t m_fragmentNumber; |
201 ·· | 205 ·· |
202 /* current packet could be a simple MSDU or, if an aggregator for this queue i
s | 206 /* current packet could be a simple MSDU or, if an aggregator for this queue i
s |
203 present, could be an A-MSDU. | 207 present, could be an A-MSDU. |
204 */ | 208 */ |
205 Ptr<const Packet> m_currentPacket; | 209 Ptr<const Packet> m_currentPacket; |
206 ·· | 210 ·· |
207 WifiMacHeader m_currentHdr; | 211 WifiMacHeader m_currentHdr; |
208 Ptr<MsduAggregator> m_aggregator; | 212 Ptr<MsduAggregator> m_aggregator; |
209 TypeOfStation m_typeOfStation; | 213 TypeOfStation m_typeOfStation; |
| 214 QosBlockedDestinations *m_qosBlockedDestinations; |
210 BlockAckManager *m_baManager; | 215 BlockAckManager *m_baManager; |
211 /* | 216 /* |
212 * Represents the minimun number of packets for use of block ack. | 217 * Represents the minimun number of packets for use of block ack. |
213 */ | 218 */ |
214 uint8_t m_blockAckThreshold; | 219 uint8_t m_blockAckThreshold; |
215 enum BlockAckType m_blockAckType; | 220 enum BlockAckType m_blockAckType; |
216 Time m_currentPacketTimestamp; | 221 Time m_currentPacketTimestamp; |
217 uint16_t m_blockAckInactivityTimeout; | 222 uint16_t m_blockAckInactivityTimeout; |
218 }; | 223 }; |
219 | 224 |
220 } //namespace ns3 | 225 } //namespace ns3 |
221 | 226 |
222 #endif /* EDCA_TXOP_N_H */ | 227 #endif /* EDCA_TXOP_N_H */ |
LEFT | RIGHT |