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