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#include <optional>
33
34namespace ns3
35{
36
37class Mac48Address;
38
39/**
40 * \ingroup wifi
41 *
42 * WifiAcknowledgment is an abstract base struct. Each derived struct defines an acknowledgment
43 * method and stores the information needed to perform acknowledgment according to
44 * that method.
45 */
47{
48 /**
49 * \enum Method
50 * \brief Available acknowledgment methods
51 */
52 enum Method
53 {
54 NONE = 0,
63 };
64
65 /**
66 * Constructor.
67 * \param m the acknowledgment method for this object
68 */
70 virtual ~WifiAcknowledgment();
71
72 /**
73 * Clone this object.
74 * \return a pointer to the cloned object
75 */
76 virtual std::unique_ptr<WifiAcknowledgment> Copy() const = 0;
77
78 /**
79 * Get the QoS Ack policy to use for the MPDUs addressed to the given receiver
80 * and belonging to the given TID.
81 *
82 * \param receiver the MAC address of the receiver
83 * \param tid the TID
84 * \return the QoS Ack policy to use
85 */
86 WifiMacHeader::QosAckPolicy GetQosAckPolicy(Mac48Address receiver, uint8_t tid) const;
87
88 /**
89 * Set the QoS Ack policy to use for the MPDUs addressed to the given receiver
90 * and belonging to the given TID. If the pair (receiver, TID) already exists,
91 * it is overwritten with the given QoS Ack policy.
92 *
93 * \param receiver the MAC address of the receiver
94 * \param tid the TID
95 * \param ackPolicy the QoS Ack policy to use
96 */
97 void SetQosAckPolicy(Mac48Address receiver, uint8_t tid, WifiMacHeader::QosAckPolicy ackPolicy);
98
99 /**
100 * \brief Print the object contents.
101 * \param os output stream in which the data should be printed.
102 */
103 virtual void Print(std::ostream& os) const = 0;
104
105 const Method method; //!< acknowledgment method
106 std::optional<Time> acknowledgmentTime; //!< time required by the acknowledgment method
107
108 private:
109 /**
110 * Check whether the given QoS Ack policy can be used for the MPDUs addressed
111 * to the given receiver and belonging to the given TID.
112 *
113 * \param receiver the MAC address of the receiver
114 * \param tid the TID
115 * \param ackPolicy the QoS Ack policy to use
116 * \return true if the given QoS Ack policy can be used, false otherwise
117 */
118 virtual bool CheckQosAckPolicy(Mac48Address receiver,
119 uint8_t tid,
120 WifiMacHeader::QosAckPolicy ackPolicy) const = 0;
121
122 /// Qos Ack Policy to set for MPDUs addressed to a given receiver and having a given TID
123 std::map<std::pair<Mac48Address, uint8_t>, WifiMacHeader::QosAckPolicy> m_ackPolicy;
124};
125
126/**
127 * \ingroup wifi
128 *
129 * WifiNoAck specifies that no acknowledgment is required.
130 */
132{
133 WifiNoAck();
134
135 std::unique_ptr<WifiAcknowledgment> Copy() const override;
136 bool CheckQosAckPolicy(Mac48Address receiver,
137 uint8_t tid,
138 WifiMacHeader::QosAckPolicy ackPolicy) const override;
139 void Print(std::ostream& os) const override;
140};
141
142/**
143 * \ingroup wifi
144 *
145 * WifiNormalAck specifies that acknowledgment via Normal Ack is required.
146 */
148{
150
151 std::unique_ptr<WifiAcknowledgment> Copy() const override;
152 bool CheckQosAckPolicy(Mac48Address receiver,
153 uint8_t tid,
154 WifiMacHeader::QosAckPolicy ackPolicy) const override;
155 void Print(std::ostream& os) const override;
156
157 WifiTxVector ackTxVector; //!< Ack TXVECTOR
158};
159
160/**
161 * \ingroup wifi
162 *
163 * WifiBlockAck specifies that acknowledgment via Block Ack is required.
164 */
166{
167 WifiBlockAck();
168
169 std::unique_ptr<WifiAcknowledgment> Copy() const override;
170 bool CheckQosAckPolicy(Mac48Address receiver,
171 uint8_t tid,
172 WifiMacHeader::QosAckPolicy ackPolicy) const override;
173 void Print(std::ostream& os) const override;
174
175 WifiTxVector blockAckTxVector; //!< BlockAck TXVECTOR
176 BlockAckType baType; //!< BlockAck type
177};
178
179/**
180 * \ingroup wifi
181 *
182 * WifiBarBlockAck specifies that a BlockAckReq is sent to solicit a Block Ack response.
183 */
185{
187
188 std::unique_ptr<WifiAcknowledgment> Copy() const override;
189 bool CheckQosAckPolicy(Mac48Address receiver,
190 uint8_t tid,
191 WifiMacHeader::QosAckPolicy ackPolicy) const override;
192 void Print(std::ostream& os) const override;
193
194 WifiTxVector blockAckReqTxVector; //!< BlockAckReq TXVECTOR
195 WifiTxVector blockAckTxVector; //!< BlockAck TXVECTOR
196 BlockAckReqType barType; //!< BlockAckReq type
197 BlockAckType baType; //!< BlockAck type
198};
199
200/**
201 * \ingroup wifi
202 *
203 * WifiDlMuBarBaSequence specifies that a DL MU PPDU is acknowledged through a
204 * sequence of BlockAckReq and BlockAck frames. Only one station may be allowed
205 * to reply a SIFS after the DL MU PPDU by sending either a Normal Ack or a BlockAck.
206 */
208{
210
211 std::unique_ptr<WifiAcknowledgment> Copy() const override;
212 bool CheckQosAckPolicy(Mac48Address receiver,
213 uint8_t tid,
214 WifiMacHeader::QosAckPolicy ackPolicy) const override;
215 void Print(std::ostream& os) const override;
216
217 /// information related to an Ack frame sent by a station
218 struct AckInfo
219 {
220 WifiTxVector ackTxVector; //!< TXVECTOR for the Ack frame
221 };
222
223 /// information related to a BlockAck frame sent by a station
225 {
226 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
227 BlockAckType baType; //!< BlockAck type
228 };
229
230 /// information related to a BlockAckReq frame sent to a station
232 {
233 WifiTxVector blockAckReqTxVector; //!< TXVECTOR for the BlockAckReq frame
234 BlockAckReqType barType; //!< BlockAckReq type
235 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
236 BlockAckType baType; //!< BlockAck type
237 };
238
239 /// Set of stations replying with an Ack frame (no more than one)
240 std::map<Mac48Address, AckInfo> stationsReplyingWithNormalAck;
241 /// Set of stations replying with a BlockAck frame (no more than one)
242 std::map<Mac48Address, BlockAckInfo> stationsReplyingWithBlockAck;
243 /// Set of stations receiving a BlockAckReq frame and replying with a BlockAck frame
244 std::map<Mac48Address, BlockAckReqInfo> stationsSendBlockAckReqTo;
245};
246
247/**
248 * \ingroup wifi
249 *
250 * WifiDlMuTfMuBar specifies that a DL MU PPDU is followed after a SIFS duration
251 * by a MU-BAR Trigger Frame (sent as single user frame) soliciting BlockAck
252 * frames sent as HE TB PPDUs.
253 */
255{
257
258 std::unique_ptr<WifiAcknowledgment> Copy() const override;
259 bool CheckQosAckPolicy(Mac48Address receiver,
260 uint8_t tid,
261 WifiMacHeader::QosAckPolicy ackPolicy) const override;
262 void Print(std::ostream& os) const override;
263
264 /// information related to a BlockAck frame sent by a station
266 {
267 CtrlBAckRequestHeader barHeader; //!< BlockAckReq header
268 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
269 BlockAckType baType; //!< BlockAck type
270 };
271
272 /// Set of stations replying with a BlockAck frame
273 std::map<Mac48Address, BlockAckInfo> stationsReplyingWithBlockAck;
274 std::list<BlockAckReqType> barTypes; //!< BAR types
275 uint16_t ulLength; //!< the UL Length field of the MU-BAR Trigger Frame
276 WifiTxVector muBarTxVector; //!< TXVECTOR used to transmit the MU-BAR Trigger Frame
277};
278
279/**
280 * \ingroup wifi
281 *
282 * WifiDlMuAggregateTf specifies that a DL MU PPDU made of PSDUs including each
283 * a MU-BAR Trigger Frame is acknowledged through BlockAck frames sent as
284 * HE TB PPDUs.
285 */
287{
289
290 std::unique_ptr<WifiAcknowledgment> Copy() const override;
291 bool CheckQosAckPolicy(Mac48Address receiver,
292 uint8_t tid,
293 WifiMacHeader::QosAckPolicy ackPolicy) const override;
294 void Print(std::ostream& os) const override;
295
296 /// information related to a BlockAck frame sent by a station
298 {
299 uint32_t muBarSize; //!< size in bytes of a MU-BAR Trigger Frame
300 CtrlBAckRequestHeader barHeader; //!< BlockAckReq header
301 WifiTxVector blockAckTxVector; //!< TXVECTOR for the BlockAck frame
302 BlockAckType baType; //!< BlockAck type
303 };
304
305 /// Set of stations replying with a BlockAck frame
306 std::map<Mac48Address, BlockAckInfo> stationsReplyingWithBlockAck;
307 uint16_t ulLength; //!< the UL Length field of the MU-BAR Trigger Frames
308};
309
310/**
311 * \ingroup wifi
312 *
313 * WifiUlMuMultiStaBa specifies that a Basic Trigger Frame is being sent to
314 * solicit TB PPDUs that will be acknowledged through a multi-STA BlockAck frame.
315 */
317{
319
320 std::unique_ptr<WifiAcknowledgment> Copy() const override;
321 bool CheckQosAckPolicy(Mac48Address receiver,
322 uint8_t tid,
323 WifiMacHeader::QosAckPolicy ackPolicy) const override;
324 void Print(std::ostream& os) const override;
325
326 /// Map (originator, tid) pairs to the their index in baType
327 std::map<std::pair<Mac48Address, uint8_t>, std::size_t> stationsReceivingMultiStaBa;
328 BlockAckType baType; //!< BlockAck type
329 WifiTxVector tbPpduTxVector; //!< TXVECTOR for a TB PPDU
330 WifiTxVector multiStaBaTxVector; //!< TXVECTOR for the Multi-STA BlockAck
331};
332
333/**
334 * \ingroup wifi
335 *
336 * WifiAckAfterTbPpdu is used when a station prepares a TB PPDU to send in
337 * response to a Basic Trigger Frame. The acknowledgment time must be
338 * zero because the time taken by the actual acknowledgment is not included
339 * in the duration indicated by the Trigger Frame. The QoS ack policy instead
340 * must be Normal Ack/Implicit Block Ack Request.
341 */
343{
345
346 std::unique_ptr<WifiAcknowledgment> Copy() const override;
347 bool CheckQosAckPolicy(Mac48Address receiver,
348 uint8_t tid,
349 WifiMacHeader::QosAckPolicy ackPolicy) const override;
350 void Print(std::ostream& os) const override;
351};
352
353/**
354 * \brief Stream insertion operator.
355 *
356 * \param os the output stream
357 * \param acknowledgment the acknowledgment method
358 * \returns a reference to the stream
359 */
360std::ostream& operator<<(std::ostream& os, const WifiAcknowledgment* acknowledgment);
361
362} // namespace ns3
363
364#endif /* WIFI_ACKNOWLEDGMENT_H */
Headers for BlockAckRequest.
Definition: ctrl-headers.h:52
an EUI-48 address
Definition: mac48-address.h:46
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.
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 ...
std::optional< Time > acknowledgmentTime
time required by the acknowledgment method
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 ...