A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-acknowledgment.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef WIFI_ACKNOWLEDGMENT_H
21#define WIFI_ACKNOWLEDGMENT_H
22
23#include "block-ack-type.h"
24#include "ctrl-headers.h"
25#include "wifi-mac-header.h"
26#include "wifi-tx-vector.h"
27
28#include "ns3/nstime.h"
29
30#include <map>
31#include <memory>
32
33namespace ns3
34{
35
36class Mac48Address;
37
38/**
39 * \ingroup wifi
40 *
41 * WifiAcknowledgment is an abstract base struct. Each derived struct defines an acknowledgment
42 * method and stores the information needed to perform acknowledgment according to
43 * that method.
44 */
46{
47 /**
48 * \enum Method
49 * \brief Available acknowledgment methods
50 */
51 enum Method
52 {
53 NONE = 0,
62 };
63
64 /**
65 * Constructor.
66 * \param m the acknowledgment method for this object
67 */
69 virtual ~WifiAcknowledgment();
70
71 /**
72 * Clone this object.
73 * \return a pointer to the cloned object
74 */
75 virtual std::unique_ptr<WifiAcknowledgment> Copy() const = 0;
76
77 /**
78 * Get the QoS Ack policy to use for the MPDUs addressed to the given receiver
79 * and belonging to the given TID.
80 *
81 * \param receiver the MAC address of the receiver
82 * \param tid the TID
83 * \return the QoS Ack policy to use
84 */
85 WifiMacHeader::QosAckPolicy GetQosAckPolicy(Mac48Address receiver, uint8_t tid) const;
86
87 /**
88 * Set the QoS Ack policy to use for the MPDUs addressed to the given receiver
89 * and belonging to the given TID. If the pair (receiver, TID) already exists,
90 * it is overwritten with the given QoS Ack policy.
91 *
92 * \param receiver the MAC address of the receiver
93 * \param tid the TID
94 * \param ackPolicy the QoS Ack policy to use
95 */
96 void SetQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy);
97
98 /**
99 * \brief Print the object contents.
100 * \param os output stream in which the data should be printed.
101 */
102 virtual void Print(std::ostream& os) const = 0;
103
104 const Method method; //!< acknowledgment method
105 Time acknowledgmentTime; //!< time required by the acknowledgment method
106
107 private:
108 /**
109 * Check whether the given QoS Ack policy can be used for the MPDUs addressed
110 * to the given receiver and belonging to the given TID.
111 *
112 * \param receiver the MAC address of the receiver
113 * \param tid the TID
114 * \param ackPolicy the QoS Ack policy to use
115 * \return true if the given QoS Ack policy can be used, false otherwise
116 */
117 virtual bool CheckQosAckPolicy(Mac48Address receiver,
118 uint8_t tid,
119 WifiMacHeader::QosAckPolicy ackPolicy) const = 0;
120
121 /// Qos Ack Policy to set for MPDUs addressed to a given receiver and having a given TID
122 std::map<std::pair<Mac48Address, uint8_t>, WifiMacHeader::QosAckPolicy> m_ackPolicy;
123};
124
125/**
126 * \ingroup wifi
127 *
128 * WifiNoAck specifies that no acknowledgment is required.
129 */
131{
132 WifiNoAck();
133
134 std::unique_ptr<WifiAcknowledgment> Copy() const override;
135 bool CheckQosAckPolicy(Mac48Address receiver,
136 uint8_t tid,
137 WifiMacHeader::QosAckPolicy ackPolicy) const override;
138 void Print(std::ostream& os) const override;
139};
140
141/**
142 * \ingroup wifi
143 *
144 * WifiNormalAck specifies that acknowledgment via Normal Ack is required.
145 */
147{
149
150 std::unique_ptr<WifiAcknowledgment> Copy() const override;
151 bool CheckQosAckPolicy(Mac48Address receiver,
152 uint8_t tid,
153 WifiMacHeader::QosAckPolicy ackPolicy) const override;
154 void Print(std::ostream& os) const override;
155
156 WifiTxVector ackTxVector; //!< Ack TXVECTOR
157};
158
159/**
160 * \ingroup wifi
161 *
162 * WifiBlockAck specifies that acknowledgment via Block Ack is required.
163 */
165{
166 WifiBlockAck();
167
168 std::unique_ptr<WifiAcknowledgment> Copy() const override;
169 bool CheckQosAckPolicy(Mac48Address receiver,
170 uint8_t tid,
171 WifiMacHeader::QosAckPolicy ackPolicy) const override;
172 void Print(std::ostream& os) const override;
173
174 WifiTxVector blockAckTxVector; //!< BlockAck TXVECTOR
175 BlockAckType baType; //!< BlockAck type
176};
177
178/**
179 * \ingroup wifi
180 *
181 * WifiBarBlockAck specifies that a BlockAckReq is sent to solicit a Block Ack response.
182 */
184{
186
187 std::unique_ptr<WifiAcknowledgment> Copy() const override;
188 bool CheckQosAckPolicy(Mac48Address receiver,
189 uint8_t tid,
190 WifiMacHeader::QosAckPolicy ackPolicy) const override;
191 void Print(std::ostream& os) const override;
192
193 WifiTxVector blockAckReqTxVector; //!< BlockAckReq TXVECTOR
194 WifiTxVector blockAckTxVector; //!< BlockAck TXVECTOR
195 BlockAckReqType barType; //!< BlockAckReq type
196 BlockAckType baType; //!< BlockAck type
197};
198
199/**
200 * \ingroup wifi
201 *
202 * WifiDlMuBarBaSequence specifies that a DL MU PPDU is acknowledged through a
203 * sequence of BlockAckReq and BlockAck frames. Only one station may be allowed
204 * to reply a SIFS after the DL MU PPDU by sending either a Normal Ack or a BlockAck.
205 */
207{
209
210 std::unique_ptr<WifiAcknowledgment> Copy() const override;
211 bool CheckQosAckPolicy(Mac48Address receiver,
212 uint8_t tid,
213 WifiMacHeader::QosAckPolicy ackPolicy) const override;
214 void Print(std::ostream& os) const override;
215
216 /// information related to an Ack frame sent by a station
217 struct AckInfo
218 {
219 WifiTxVector ackTxVector; //!< TXVECTOR for the Ack frame
220 };
221
222 /// information related to a BlockAck frame sent by a station
224 {
225 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
226 BlockAckType baType; //!< BlockAck type
227 };
228
229 /// information related to a BlockAckReq frame sent to a station
231 {
232 WifiTxVector blockAckReqTxVector; //!< TXVECTOR for the BlockAckReq frame
233 BlockAckReqType barType; //!< BlockAckReq type
234 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
235 BlockAckType baType; //!< BlockAck type
236 };
237
238 /// Set of stations replying with an Ack frame (no more than one)
239 std::map<Mac48Address, AckInfo> stationsReplyingWithNormalAck;
240 /// Set of stations replying with a BlockAck frame (no more than one)
241 std::map<Mac48Address, BlockAckInfo> stationsReplyingWithBlockAck;
242 /// Set of stations receiving a BlockAckReq frame and replying with a BlockAck frame
243 std::map<Mac48Address, BlockAckReqInfo> stationsSendBlockAckReqTo;
244};
245
246/**
247 * \ingroup wifi
248 *
249 * WifiDlMuTfMuBar specifies that a DL MU PPDU is followed after a SIFS duration
250 * by a MU-BAR Trigger Frame (sent as single user frame) soliciting BlockAck
251 * frames sent as HE TB PPDUs.
252 */
254{
256
257 std::unique_ptr<WifiAcknowledgment> Copy() const override;
258 bool CheckQosAckPolicy(Mac48Address receiver,
259 uint8_t tid,
260 WifiMacHeader::QosAckPolicy ackPolicy) const override;
261 void Print(std::ostream& os) const override;
262
263 /// information related to a BlockAck frame sent by a station
265 {
266 CtrlBAckRequestHeader barHeader; //!< BlockAckReq header
267 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
268 BlockAckType baType; //!< BlockAck type
269 };
270
271 /// Set of stations replying with a BlockAck frame
272 std::map<Mac48Address, BlockAckInfo> stationsReplyingWithBlockAck;
273 std::list<BlockAckReqType> barTypes; //!< BAR types
274 uint16_t ulLength; //!< the UL Length field of the MU-BAR Trigger Frame
275 WifiTxVector muBarTxVector; //!< TXVECTOR used to transmit the MU-BAR Trigger Frame
276};
277
278/**
279 * \ingroup wifi
280 *
281 * WifiDlMuAggregateTf specifies that a DL MU PPDU made of PSDUs including each
282 * a MU-BAR Trigger Frame is acknowledged through BlockAck frames sent as
283 * HE TB PPDUs.
284 */
286{
288
289 std::unique_ptr<WifiAcknowledgment> Copy() const override;
290 bool CheckQosAckPolicy(Mac48Address receiver,
291 uint8_t tid,
292 WifiMacHeader::QosAckPolicy ackPolicy) const override;
293 void Print(std::ostream& os) const override;
294
295 /// information related to a BlockAck frame sent by a station
297 {
298 uint32_t muBarSize; //!< size in bytes of a MU-BAR Trigger Frame
299 CtrlBAckRequestHeader barHeader; //!< BlockAckReq header
300 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
301 BlockAckType baType; //!< BlockAck type
302 };
303
304 /// Set of stations replying with a BlockAck frame
305 std::map<Mac48Address, BlockAckInfo> stationsReplyingWithBlockAck;
306 uint16_t ulLength; //!< the UL Length field of the MU-BAR Trigger Frames
307};
308
309/**
310 * \ingroup wifi
311 *
312 * WifiUlMuMultiStaBa specifies that a Basic Trigger Frame is being sent to
313 * solicit TB PPDUs that will be acknowledged through a multi-STA BlockAck frame.
314 */
316{
318
319 std::unique_ptr<WifiAcknowledgment> Copy() const override;
320 bool CheckQosAckPolicy(Mac48Address receiver,
321 uint8_t tid,
322 WifiMacHeader::QosAckPolicy ackPolicy) const override;
323 void Print(std::ostream& os) const override;
324
325 /// Map (originator, tid) pairs to the their index in baType
326 std::map<std::pair<Mac48Address, uint8_t>, std::size_t> stationsReceivingMultiStaBa;
327 BlockAckType baType; //!< BlockAck type
328 WifiTxVector tbPpduTxVector; //!< TXVECTOR for a TB PPDU
329 WifiTxVector multiStaBaTxVector; //!< TXVECTOR for the Multi-STA BlockAck
330};
331
332/**
333 * \ingroup wifi
334 *
335 * WifiAckAfterTbPpdu is used when a station prepares a TB PPDU to send in
336 * response to a Basic Trigger Frame. The acknowledgment time must be
337 * zero because the time taken by the actual acknowledgment is not included
338 * in the duration indicated by the Trigger Frame. The QoS ack policy instead
339 * must be Normal Ack/Implicit Block Ack Request.
340 */
342{
344
345 std::unique_ptr<WifiAcknowledgment> Copy() const override;
346 bool CheckQosAckPolicy(Mac48Address receiver,
347 uint8_t tid,
348 WifiMacHeader::QosAckPolicy ackPolicy) const override;
349 void Print(std::ostream& os) const override;
350};
351
352/**
353 * \brief Stream insertion operator.
354 *
355 * \param os the output stream
356 * \param acknowledgment the acknowledgment method
357 * \returns a reference to the stream
358 */
359std::ostream& operator<<(std::ostream& os, const WifiAcknowledgment* acknowledgment);
360
361} // namespace ns3
362
363#endif /* WIFI_ACKNOWLEDGMENT_H */
Headers for BlockAckRequest.
Definition: ctrl-headers.h:52
an EUI-48 address
Definition: mac48-address.h:46
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
QosAckPolicy
Ack policy for QoS frames.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
The different BlockAckRequest variants.
The different BlockAck variants.
WifiAckAfterTbPpdu is used when a station prepares a TB PPDU to send in response to a Basic Trigger F...
void Print(std::ostream &os) const override
Print the object contents.
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
WifiAcknowledgment is an abstract base struct.
std::map< std::pair< Mac48Address, uint8_t >, WifiMacHeader::QosAckPolicy > m_ackPolicy
Qos Ack Policy to set for MPDUs addressed to a given receiver and having a given TID.
Time acknowledgmentTime
time required by the acknowledgment method
virtual std::unique_ptr< WifiAcknowledgment > Copy() const =0
Clone this object.
void SetQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy)
Set the QoS Ack policy to use for the MPDUs addressed to the given receiver and belonging to the give...
const Method method
acknowledgment method
WifiMacHeader::QosAckPolicy GetQosAckPolicy(Mac48Address receiver, uint8_t tid) const
Get the QoS Ack policy to use for the MPDUs addressed to the given receiver and belonging to the give...
virtual void Print(std::ostream &os) const =0
Print the object contents.
Method
Available acknowledgment methods.
virtual bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const =0
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
WifiBarBlockAck specifies that a BlockAckReq is sent to solicit a Block Ack response.
void Print(std::ostream &os) const override
Print the object contents.
BlockAckType baType
BlockAck type.
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
WifiTxVector blockAckReqTxVector
BlockAckReq TXVECTOR.
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
BlockAckReqType barType
BlockAckReq type.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
WifiBlockAck specifies that acknowledgment via Block Ack is required.
WifiTxVector blockAckTxVector
BlockAck TXVECTOR.
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
BlockAckType baType
BlockAck type.
void Print(std::ostream &os) const override
Print the object contents.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
information related to a BlockAck frame sent by a station
WifiTxVector blockAckTxVector
TXVECTOR for the BlockAck frame.
uint32_t muBarSize
size in bytes of a MU-BAR Trigger Frame
CtrlBAckRequestHeader barHeader
BlockAckReq header.
WifiDlMuAggregateTf specifies that a DL MU PPDU made of PSDUs including each a MU-BAR Trigger Frame i...
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
void Print(std::ostream &os) const override
Print the object contents.
uint16_t ulLength
the UL Length field of the MU-BAR Trigger Frames
std::map< Mac48Address, BlockAckInfo > stationsReplyingWithBlockAck
Set of stations replying with a BlockAck frame.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
information related to an Ack frame sent by a station
WifiTxVector ackTxVector
TXVECTOR for the Ack frame.
information related to a BlockAck frame sent by a station
WifiTxVector blockAckTxVector
TXVECTOR for the BlockAck frame.
information related to a BlockAckReq frame sent to a station
WifiTxVector blockAckReqTxVector
TXVECTOR for the BlockAckReq frame.
BlockAckReqType barType
BlockAckReq type.
WifiTxVector blockAckTxVector
TXVECTOR for the BlockAck frame.
WifiDlMuBarBaSequence specifies that a DL MU PPDU is acknowledged through a sequence of BlockAckReq a...
void Print(std::ostream &os) const override
Print the object contents.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
std::map< Mac48Address, BlockAckReqInfo > stationsSendBlockAckReqTo
Set of stations receiving a BlockAckReq frame and replying with a BlockAck frame.
std::map< Mac48Address, BlockAckInfo > stationsReplyingWithBlockAck
Set of stations replying with a BlockAck frame (no more than one)
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
std::map< Mac48Address, AckInfo > stationsReplyingWithNormalAck
Set of stations replying with an Ack frame (no more than one)
information related to a BlockAck frame sent by a station
WifiTxVector blockAckTxVector
TXVECTOR for the BlockAck frame.
BlockAckType baType
BlockAck type.
CtrlBAckRequestHeader barHeader
BlockAckReq header.
WifiDlMuTfMuBar specifies that a DL MU PPDU is followed after a SIFS duration by a MU-BAR Trigger Fra...
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
std::list< BlockAckReqType > barTypes
BAR types.
std::map< Mac48Address, BlockAckInfo > stationsReplyingWithBlockAck
Set of stations replying with a BlockAck frame.
uint16_t ulLength
the UL Length field of the MU-BAR Trigger Frame
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
void Print(std::ostream &os) const override
Print the object contents.
WifiTxVector muBarTxVector
TXVECTOR used to transmit the MU-BAR Trigger Frame.
WifiNoAck specifies that no acknowledgment is required.
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
void Print(std::ostream &os) const override
Print the object contents.
WifiNormalAck specifies that acknowledgment via Normal Ack is required.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...
WifiTxVector ackTxVector
Ack TXVECTOR.
void Print(std::ostream &os) const override
Print the object contents.
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
WifiUlMuMultiStaBa specifies that a Basic Trigger Frame is being sent to solicit TB PPDUs that will b...
BlockAckType baType
BlockAck type.
std::unique_ptr< WifiAcknowledgment > Copy() const override
Clone this object.
WifiTxVector tbPpduTxVector
TXVECTOR for a TB PPDU.
WifiTxVector multiStaBaTxVector
TXVECTOR for the Multi-STA BlockAck.
std::map< std::pair< Mac48Address, uint8_t >, std::size_t > stationsReceivingMultiStaBa
Map (originator, tid) pairs to the their index in baType.
void Print(std::ostream &os) const override
Print the object contents.
bool CheckQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy) const override
Check whether the given QoS Ack policy can be used for the MPDUs addressed to the given receiver and ...