A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
block-ack-manager.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009, 2010 MIRKO BANCHI
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mirko Banchi <mk.banchi@gmail.com>
7 */
8
9#ifndef BLOCK_ACK_MANAGER_H
10#define BLOCK_ACK_MANAGER_H
11
12#include "block-ack-type.h"
15#include "wifi-mac-header.h"
16#include "wifi-mpdu.h"
17#include "wifi-tx-vector.h"
18
19#include "ns3/nstime.h"
20#include "ns3/object.h"
21#include "ns3/traced-callback.h"
22
23#include <map>
24#include <optional>
25
26namespace ns3
27{
28
29class MgtAddBaResponseHeader;
30class MgtAddBaRequestHeader;
31class CtrlBAckResponseHeader;
32class CtrlBAckRequestHeader;
33class WifiMacQueue;
34class MacRxMiddle;
35
36/**
37 * @brief Manages all block ack agreements for an originator station.
38 * @ingroup wifi
39 */
40class BlockAckManager : public Object
41{
42 private:
43 /**
44 * Enumeration for the statuses of a buffered MPDU
45 */
52
53 public:
54 /**
55 * @brief Get the type ID.
56 * @return the object TypeId
57 */
58 static TypeId GetTypeId();
59
61 ~BlockAckManager() override;
62
63 // Delete copy constructor and assignment operator to avoid misuse
66
67 /// optional const reference to OriginatorBlockAckAgreement
69 std::optional<std::reference_wrapper<const OriginatorBlockAckAgreement>>;
70 /// optional const reference to RecipientBlockAckAgreement
72 std::optional<std::reference_wrapper<const RecipientBlockAckAgreement>>;
73
74 /**
75 * @param recipient MAC address of the recipient
76 * @param tid Traffic ID
77 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack agreement)
78 *
79 * @return a const reference to the block ack agreement with the given recipient, if it exists
80 *
81 * Check if we are the originator of an existing block ack agreement with the given recipient.
82 */
84 const Mac48Address& recipient,
85 uint8_t tid,
86 std::optional<Mac48Address> gcrGroupAddr = std::nullopt) const;
87
88 /**
89 * @param originator MAC address of the originator
90 * @param tid Traffic ID
91 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack agreement)
92 *
93 * @return a const reference to the block ack agreement with the given originator, if it exists
94 *
95 * Check if we are the recipient of an existing block ack agreement with the given originator.
96 */
98 const Mac48Address& originator,
99 uint8_t tid,
100 std::optional<Mac48Address> gcrGroupAddr = std::nullopt) const;
101
102 /**
103 * @param reqHdr Relative Add block ack request (action frame).
104 * @param recipient Address of peer station involved in block ack mechanism.
105 *
106 * Creates a new originator block ack agreement in pending state. When a ADDBA response
107 * with a successful status code is received, the relative agreement becomes established.
108 */
110 const Mac48Address& recipient);
111 /**
112 * @param recipient Address of peer station involved in block ack mechanism.
113 * @param tid traffic ID of transmitted packet.
114 * @param gcrGroupAddr the GCR Group Address (only if it a GCR Block Ack agreement)
115 *
116 * Invoked when a recipient reject a block ack agreement or when a DELBA frame
117 * is Received/Transmitted.
118 */
119 void DestroyOriginatorAgreement(const Mac48Address& recipient,
120 uint8_t tid,
121 std::optional<Mac48Address> gcrGroupAddr);
122 /**
123 * @param respHdr Relative Add block ack response (action frame).
124 * @param recipient Address of peer station involved in block ack mechanism.
125 * @param startingSeq the updated starting sequence number
126 *
127 * Invoked upon receipt of a ADDBA response frame from <i>recipient</i>.
128 */
130 const Mac48Address& recipient,
131 uint16_t startingSeq);
132
133 /**
134 * @param respHdr Add block ack response from originator (action
135 * frame).
136 * @param originator Address of peer station involved in block ack
137 * mechanism.
138 * @param startingSeq Sequence number of the first MPDU of all
139 * packets for which block ack was negotiated.
140 * @param rxMiddle the MAC RX Middle on this station
141 *
142 * This function is typically invoked only by ns3::WifiMac
143 * when the STA (which may be non-AP in ESS, or in an IBSS) has
144 * received an ADDBA Request frame and is transmitting an ADDBA
145 * Response frame. At this point the frame exchange manager must
146 * allocate buffers to collect all correctly received packets belonging
147 * to the category for which block ack was negotiated.
148 */
150 const Mac48Address& originator,
151 uint16_t startingSeq,
152 Ptr<MacRxMiddle> rxMiddle);
153 /**
154 * Destroy a recipient Block Ack agreement.
155 *
156 * @param originator the originator MAC address
157 * @param tid the TID associated with the Block Ack agreement
158 * @param gcrGroupAddr the GCR Group Address (only if it a GCR Block Ack agreement)
159 */
160 void DestroyRecipientAgreement(const Mac48Address& originator,
161 uint8_t tid,
162 std::optional<Mac48Address> gcrGroupAddr);
163
164 /**
165 * @param mpdu MPDU to store.
166 *
167 * Stores <i>mpdu</i> for a possible future retransmission. Retransmission occurs
168 * if the packet, in a BlockAck frame, is indicated by recipient as not received.
169 */
170 void StorePacket(Ptr<WifiMpdu> mpdu);
171 /**
172 * Invoked upon receipt of an Ack frame on the given link after the transmission of a
173 * QoS data frame sent under an established block ack agreement. Remove the acknowledged
174 * frame from the outstanding packets and update the starting sequence number of the
175 * transmit window, if needed.
176 *
177 * @param linkId the ID of the given link
178 * @param mpdu The acknowledged MPDU.
179 */
180 void NotifyGotAck(uint8_t linkId, Ptr<const WifiMpdu> mpdu);
181 /**
182 * Invoked upon missed reception of an Ack frame on the given link after the
183 * transmission of a QoS data frame sent under an established block ack agreement.
184 * Remove the acknowledged frame from the outstanding packets and insert it in the
185 * retransmission queue.
186 *
187 * @param linkId the ID of the given link
188 * @param mpdu The unacknowledged MPDU.
189 */
190 void NotifyMissedAck(uint8_t linkId, Ptr<WifiMpdu> mpdu);
191 /**
192 * @param linkId the ID of the given link
193 * @param blockAck The received BlockAck frame.
194 * @param recipient Sender of BlockAck frame.
195 * @param tids the set of TIDs the acknowledged MPDUs belong to
196 * @param index the index of the Per AID TID Info subfield, in case of Multi-STA
197 * Block Ack, or 0, otherwise
198 * @return a pair of values indicating the number of successfully received MPDUs
199 * and the number of failed MPDUs
200 *
201 * Invoked upon receipt of a BlockAck frame on the given link. Typically, this function
202 * is called by ns3::QosTxop object. Performs a check on which MPDUs, previously sent
203 * with Ack Policy set to Block Ack, were correctly received by the recipient.
204 * An acknowledged MPDU is removed from the buffer, retransmitted otherwise.
205 * Note that <i>tids</i> is only used if <i>blockAck</i> is a Multi-STA Block Ack
206 * using All-ack context.
207 */
208 std::pair<uint16_t, uint16_t> NotifyGotBlockAck(uint8_t linkId,
209 const CtrlBAckResponseHeader& blockAck,
210 const Mac48Address& recipient,
211 const std::set<uint8_t>& tids,
212 size_t index = 0);
213 /**
214 * @param linkId the ID of the given link
215 * @param recipient Sender of the expected BlockAck frame.
216 * @param tid Traffic ID.
217 *
218 * Invoked upon missed reception of a block ack frame on the given link. Typically, this
219 * function is called by ns3::QosTxop object. Performs a check on which MPDUs, previously
220 * sent with ack policy set to Block Ack, should be placed in the retransmission queue.
221 */
222 void NotifyMissedBlockAck(uint8_t linkId, const Mac48Address& recipient, uint8_t tid);
223 /**
224 * @param originator MAC address of the sender of the Block Ack Request
225 * @param tid Traffic ID
226 * @param startingSeq the starting sequence number in the Block Ack Request
227 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack Request frame)
228 *
229 * Perform required actions upon receiving a Block Ack Request frame.
230 */
231 void NotifyGotBlockAckRequest(const Mac48Address& originator,
232 uint8_t tid,
233 uint16_t startingSeq,
234 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
235
236 /**
237 * @param mpdu the received MPDU
238 *
239 * Perform required actions upon receiving an MPDU.
240 */
242 /**
243 * @param recipient Address of peer station involved in block ack mechanism.
244 * @param tid Traffic ID.
245 *
246 * @return the number of packets buffered for a specified agreement
247 *
248 * Returns the number of packets buffered for a specified agreement. This methods doesn't return
249 * the number of buffered MPDUs but the number of buffered MSDUs.
250 */
251 uint32_t GetNBufferedPackets(const Mac48Address& recipient, uint8_t tid) const;
252 /**
253 * @param recipient Address of peer station involved in block ack mechanism.
254 * @param tid Traffic ID of transmitted packet.
255 * @param gcrGroupAddr the GCR Group Address (only if it a GCR Block Ack agreement)
256 *
257 * Marks an originator agreement as rejected. This happens if <i>recipient</i> station reject
258 * block ack setup by an ADDBA Response frame with a failure status code. For now we assume
259 * that every QoS station accepts a block ack setup.
260 */
262 uint8_t tid,
263 std::optional<Mac48Address> gcrGroupAddr);
264 /**
265 * @param recipient Address of peer station involved in block ack mechanism.
266 * @param tid Traffic ID of transmitted packet.
267 * @param gcrGroupAddr the GCR Group Address (only if it a GCR Block Ack agreement)
268 *
269 * Marks an originator agreement after not receiving response to ADDBA request. During this
270 * state any packets in queue will be transmitted using normal MPDU. This also unblocks
271 * recipient address.
272 */
274 uint8_t tid,
275 std::optional<Mac48Address> gcrGroupAddr);
276 /**
277 * @param recipient Address of peer station involved in block ack mechanism.
278 * @param tid Traffic ID of transmitted packet.
279 * @param gcrGroupAddr the GCR Group Address (only if it a GCR Block Ack agreement)
280 *
281 * Set Originator BA agreement to a transitory state to reset it after not receiving response
282 * to ADDBA request.
283 */
284 void NotifyOriginatorAgreementReset(const Mac48Address& recipient,
285 uint8_t tid,
286 std::optional<Mac48Address> gcrGroupAddr);
287 /**
288 * @param nPackets Minimum number of packets for use of block ack.
289 *
290 * Upon receipt of a BlockAck frame, if total number of packets (packets in WifiMacQueue
291 * and buffered packets) is greater of <i>nPackets</i>, they are transmitted using block ack
292 * mechanism.
293 */
294 void SetBlockAckThreshold(uint8_t nPackets);
295
296 /**
297 * @param queue The WifiMacQueue object.
298 */
299 void SetQueue(const Ptr<WifiMacQueue> queue);
300
301 /**
302 * Set block ack inactivity callback
303 * @param callback the block ack inactivity callback function
304 */
306 Callback<void, Mac48Address, uint8_t, bool, std::optional<Mac48Address>> callback);
307 /**
308 * Set block destination callback
309 * @param callback the block destination callback
310 */
312 /**
313 * Set unblock destination callback
314 * @param callback the unblock destination callback
315 */
317
318 /**
319 * This function returns true if a block ack agreement is established with the
320 * given recipient for the given TID and there is at least an outstanding MPDU
321 * for such agreement whose lifetime is not expired.
322 *
323 * @param tid Traffic ID
324 * @param recipient MAC address of the recipient
325 *
326 * @returns true if BAR retransmission needed
327 */
328 bool NeedBarRetransmission(uint8_t tid, const Mac48Address& recipient);
329 /**
330 * This function returns the buffer size negotiated with the recipient.
331 *
332 * @param tid Traffic ID
333 * @param recipient MAC address of the recipient
334 *
335 * @returns the buffer size negotiated with the recipient
336 */
337 uint16_t GetRecipientBufferSize(const Mac48Address& recipient, uint8_t tid) const;
338 /**
339 * This function returns the starting sequence number of the transmit window.
340 *
341 * @param tid Traffic ID
342 * @param recipient MAC address of the recipient
343 *
344 * @returns the starting sequence number of the transmit window (WinStartO)
345 */
346 uint16_t GetOriginatorStartingSequence(const Mac48Address& recipient, uint8_t tid) const;
347
348 /**
349 * typedef for a callback to invoke when an MPDU is successfully ack'ed.
350 */
352 /**
353 * typedef for a callback to invoke when an MPDU is negatively ack'ed.
354 */
356 /**
357 * typedef for a callback to invoke when an MPDU is dropped.
358 */
360
361 /**
362 * @param callback the callback to invoke when a
363 * packet transmission was completed successfully.
364 */
365 void SetTxOkCallback(TxOk callback);
366 /**
367 * @param callback the callback to invoke when a
368 * packet transmission was completed unsuccessfuly.
369 */
370 void SetTxFailedCallback(TxFailed callback);
371 /**
372 * @param callback the callback to invoke when an old MPDU is dropped
373 */
375
376 /**
377 * TracedCallback signature for state changes.
378 *
379 * @param [in] now Time when the \pname{state} changed.
380 * @param [in] recipient MAC address of the recipient.
381 * @param [in] tid the TID.
382 * @param [in] state The state.
383 */
385 const Mac48Address& recipient,
386 uint8_t tid,
388
389 /**
390 * @param mpdu the discarded frame
391 *
392 * Notify the block ack manager that an MPDU has been discarded, e.g., because
393 * the MSDU lifetime expired. If there is an established block ack agreement,
394 * make the transmit window advance beyond the discarded frame. This also
395 * involves (i) the removal of frames that consequently become old from the
396 * retransmit queue and from the queue of the block ack agreement, and (ii) the
397 * scheduling of a BlockAckRequest.
398 */
400
401 /**
402 * @param recipient the recipient
403 * @param tid the TID
404 * @return the BlockAckRequest header for the established BA agreement
405 *
406 * Get the BlockAckRequest header for the established BA agreement
407 * (<i>recipient</i>,<i>tid</i>).
408 */
409 CtrlBAckRequestHeader GetBlockAckReqHeader(const Mac48Address& recipient, uint8_t tid) const;
410
411 /**
412 * @param reqHdr the BlockAckRequest header
413 * @param hdr the 802.11 MAC header
414 *
415 * Enqueue the given BlockAckRequest into the queue storing the next BAR
416 * frames to transmit. If a BAR for the same recipient and TID is already present
417 * in the queue, it is replaced by the new one. If the given BAR is retransmitted,
418 * it is placed at the head of the queue, otherwise at the tail.
419 */
420 void ScheduleBar(const CtrlBAckRequestHeader& reqHdr, const WifiMacHeader& hdr);
421
422 /// agreement key typedef (MAC address and TID)
423 using AgreementKey = std::pair<Mac48Address, uint8_t>;
424
425 /**
426 * @return the list of BA agreements (identified by the recipient and TID pair) for which a BAR
427 * shall only be sent if there are queued data frames belonging to those agreements
428 */
429 const std::list<AgreementKey>& GetSendBarIfDataQueuedList() const;
430 /**
431 * Add the given (recipient, TID) pair to the list of BA agreements for which a BAR
432 * shall only be sent if there are queued data frames belonging to those agreements
433 *
434 * @param recipient the recipient
435 * @param tid the TID
436 */
437 void AddToSendBarIfDataQueuedList(const Mac48Address& recipient, uint8_t tid);
438 /**
439 * Remove the given (recipient, TID) pair from the list of BA agreements for which a BAR
440 * shall only be sent if there are queued data frames belonging to those agreements
441 *
442 * @param recipient the recipient
443 * @param tid the TID
444 */
445 void RemoveFromSendBarIfDataQueuedList(const Mac48Address& recipient, uint8_t tid);
446
447 /**
448 * This function returns the minimum buffer size from ADDBA Response frames sent by all members
449 * of a group address <i>groupAddress</i> for a given TID <i>tid</i>.
450 *
451 * @param groupAddress the group address
452 * @param tid the traffic ID.
453 *
454 * @return the GCR buffer size.
455 */
456 uint16_t GetGcrBufferSize(const Mac48Address& groupAddress, uint8_t tid) const;
457
458 /**
459 * This function returns the starting sequence number of the transmit window for a given GCR
460 * Block Ack agreement established with all members of a group address <i>groupAddress</i> for a
461 * given TID <i>tid</i>.
462 *
463 * @param groupAddress the group address
464 * @param tid Traffic ID
465 *
466 * @returns the starting sequence number of the transmit window (WinStartO)
467 */
468 uint16_t GetGcrStartingSequence(const Mac48Address& groupAddress, uint8_t tid) const;
469
470 protected:
471 void DoDispose() override;
472
473 private:
474 /**
475 * Inactivity timeout function for a Block Ack agreement
476 * @param recipient the recipient MAC address
477 * @param tid Traffic ID
478 * @param gcrGroupAddr the GCR Group Address (only if it a GCR Block Ack agreement)
479 */
480 void InactivityTimeout(const Mac48Address& recipient,
481 uint8_t tid,
482 std::optional<Mac48Address> gcrGroupAddr);
483
484 /**
485 * typedef for a list of WifiMpdu.
486 */
487 using PacketQueue = std::list<Ptr<WifiMpdu>>;
488 /**
489 * typedef for an iterator for PacketQueue.
490 */
491 using PacketQueueI = std::list<Ptr<WifiMpdu>>::iterator;
492
493 /// AgreementKey-indexed map of originator block ack agreements
495 std::multimap<AgreementKey, std::pair<OriginatorBlockAckAgreement, PacketQueue>>;
496 /// An iterator for originator block ack agreements
497 using OriginatorAgreementsI = OriginatorAgreements::iterator;
498 /// A const iterator for originator block ack agreements
499 using OriginatorAgreementsCI = OriginatorAgreements::const_iterator;
500
501 /// AgreementKey-indexed map of recipient block ack agreements
502 using RecipientAgreements = std::multimap<AgreementKey, RecipientBlockAckAgreement>;
503 /// An iterator for recipient block ack agreements
504 using RecipientAgreementsI = RecipientAgreements::iterator;
505 /// A const iterator for recipient block ack agreements
506 using RecipientAgreementsCI = RecipientAgreements::const_iterator;
507
508 /**
509 * @param recipient MAC address of the recipient
510 * @param tid Traffic ID
511 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack agreement)
512 *
513 * @return an iterator to the block ack agreement
514 */
516 const Mac48Address& recipient,
517 uint8_t tid,
518 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
519
520 /**
521 * @param recipient MAC address of the recipient
522 * @param tid Traffic ID
523 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack agreement)
524 *
525 * @return a const iterator to the block ack agreement
526 */
528 const Mac48Address& recipient,
529 uint8_t tid,
530 std::optional<Mac48Address> gcrGroupAddr = std::nullopt) const;
531
532 /**
533 * @param originator MAC address of the originator
534 * @param tid Traffic ID
535 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack agreement)
536 *
537 * @return an iterator to the block ack agreement
538 */
540 const Mac48Address& originator,
541 uint8_t tid,
542 std::optional<Mac48Address> gcrGroupAddr = std::nullopt);
543
544 /**
545 * @param originator MAC address of the originator
546 * @param tid Traffic ID
547 * @param gcrGroupAddr the GCR Group Address (only if it is a GCR Block Ack agreement)
548 *
549 * @return a const iterator to the block ack agreement
550 */
552 const Mac48Address& originator,
553 uint8_t tid,
554 std::optional<Mac48Address> gcrGroupAddr = std::nullopt) const;
555
556 /**
557 * Handle the given in flight MPDU based on its given status. If the status is
558 * ACKNOWLEDGED, the MPDU is removed from both the EDCA queue and the queue of
559 * in flight MPDUs. If the status is TO_RETRANSMIT, the MPDU is only removed
560 * from the queue of in flight MPDUs. Note that the MPDU is removed from both
561 * queues (independently of the status) if the MPDU is not stored in the EDCA
562 * queue, is an old packet or its lifetime expired.
563 *
564 * @param linkId the ID of the link on which the MPDU has been transmitted
565 * @param mpduIt an iterator pointing to the MPDU in the queue of in flight MPDUs
566 * @param status the status of the in flight MPDU
567 * @param it iterator pointing to the Block Ack agreement
568 * @param now the current time
569 * @return an iterator pointing to the next MPDU in the queue of in flight MPDUs
570 */
571 PacketQueueI HandleInFlightMpdu(uint8_t linkId,
572 PacketQueueI mpduIt,
573 MpduStatus status,
574 const OriginatorAgreementsI& it,
575 const Time& now);
576
577 /**
578 * Handle discarded MPDU by making the transmit window advance beyond the discarded frame.
579 * This also involves (i) the removal of frames that consequently become old from the
580 * retransmit queue and from the queue of the block ack agreement, and (ii) the
581 * scheduling of a BlockAckRequest.
582 *
583 * @param mpdu the discarded MPDU
584 * @param iter an iterator to the corresponding agreement
585 */
587
588 /**
589 * This data structure contains, for each originator block ack agreement (recipient, TID),
590 * a set of packets for which an ack by block ack is requested.
591 * Every packet or fragment indicated as correctly received in BlockAck frame is
592 * erased from this data structure. Pushed back in retransmission queue otherwise.
593 */
595 RecipientAgreements m_recipientAgreements; //!< Recipient Block Ack agreements
596
597 std::list<AgreementKey> m_sendBarIfDataQueued; ///< list of BA agreements for which a BAR shall
598 ///< only be sent if data is queued
599
600 uint8_t m_blockAckThreshold; ///< block ack threshold
603 m_blockAckInactivityTimeout; ///< BlockAck inactivity timeout callback
606 TxOk m_txOkCallback; ///< transmit OK callback
607 TxFailed m_txFailedCallback; ///< transmit failed callback
608 DroppedOldMpdu m_droppedOldMpduCallback; ///< the dropped MPDU callback
609
610 /**
611 * The trace source fired when a state transition occurred.
612 */
615};
616
617} // namespace ns3
618
619#endif /* BLOCK_ACK_MANAGER_H */
Manages all block ack agreements for an originator station.
void SetTxFailedCallback(TxFailed callback)
std::pair< Mac48Address, uint8_t > AgreementKey
agreement key typedef (MAC address and TID)
void UpdateOriginatorAgreement(const MgtAddBaResponseHeader &respHdr, const Mac48Address &recipient, uint16_t startingSeq)
Callback< void, Mac48Address, uint8_t > m_unblockPackets
unblock packets callback
OriginatorAgreements::iterator OriginatorAgreementsI
An iterator for originator block ack agreements.
void SetQueue(const Ptr< WifiMacQueue > queue)
void SetTxOkCallback(TxOk callback)
OriginatorAgreementsI GetOriginatorBaAgreement(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
void NotifyOriginatorAgreementNoReply(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
uint8_t m_blockAckThreshold
block ack threshold
RecipientAgreements m_recipientAgreements
Recipient Block Ack agreements.
static TypeId GetTypeId()
Get the type ID.
TracedCallback< Time, Mac48Address, uint8_t, OriginatorBlockAckAgreement::State > m_originatorAgreementState
The trace source fired when a state transition occurred.
void SetBlockAckThreshold(uint8_t nPackets)
DroppedOldMpdu m_droppedOldMpduCallback
the dropped MPDU callback
std::list< Ptr< WifiMpdu > > PacketQueue
typedef for a list of WifiMpdu.
void SetDroppedOldMpduCallback(DroppedOldMpdu callback)
std::multimap< AgreementKey, RecipientBlockAckAgreement > RecipientAgreements
AgreementKey-indexed map of recipient block ack agreements.
TxFailed m_txFailedCallback
transmit failed callback
void SetUnblockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
Set unblock destination callback.
std::optional< std::reference_wrapper< const OriginatorBlockAckAgreement > > OriginatorAgreementOptConstRef
optional const reference to OriginatorBlockAckAgreement
Ptr< WifiMacQueue > m_queue
queue
RecipientAgreements::iterator RecipientAgreementsI
An iterator for recipient block ack agreements.
uint16_t GetRecipientBufferSize(const Mac48Address &recipient, uint8_t tid) const
This function returns the buffer size negotiated with the recipient.
void NotifyOriginatorAgreementRejected(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
void CreateOriginatorAgreement(const MgtAddBaRequestHeader &reqHdr, const Mac48Address &recipient)
void CreateRecipientAgreement(const MgtAddBaResponseHeader &respHdr, const Mac48Address &originator, uint16_t startingSeq, Ptr< MacRxMiddle > rxMiddle)
Callback< void, Mac48Address, uint8_t, bool, std::optional< Mac48Address > > m_blockAckInactivityTimeout
BlockAck inactivity timeout callback.
OriginatorAgreements::const_iterator OriginatorAgreementsCI
A const iterator for originator block ack agreements.
void DestroyOriginatorAgreement(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
void NotifyMissedBlockAck(uint8_t linkId, const Mac48Address &recipient, uint8_t tid)
OriginatorAgreements m_originatorAgreements
This data structure contains, for each originator block ack agreement (recipient, TID),...
void StorePacket(Ptr< WifiMpdu > mpdu)
void RemoveFromSendBarIfDataQueuedList(const Mac48Address &recipient, uint8_t tid)
Remove the given (recipient, TID) pair from the list of BA agreements for which a BAR shall only be s...
BlockAckManager & operator=(const BlockAckManager &)=delete
void NotifyGotAck(uint8_t linkId, Ptr< const WifiMpdu > mpdu)
Invoked upon receipt of an Ack frame on the given link after the transmission of a QoS data frame sen...
void AddToSendBarIfDataQueuedList(const Mac48Address &recipient, uint8_t tid)
Add the given (recipient, TID) pair to the list of BA agreements for which a BAR shall only be sent i...
void NotifyDiscardedMpdu(Ptr< const WifiMpdu > mpdu)
void NotifyGotMpdu(Ptr< const WifiMpdu > mpdu)
void HandleDiscardedMpdu(Ptr< const WifiMpdu > mpdu, OriginatorAgreementsI iter)
Handle discarded MPDU by making the transmit window advance beyond the discarded frame.
Callback< void, Ptr< const WifiMpdu > > TxFailed
typedef for a callback to invoke when an MPDU is negatively ack'ed.
bool NeedBarRetransmission(uint8_t tid, const Mac48Address &recipient)
This function returns true if a block ack agreement is established with the given recipient for the g...
Callback< void, Ptr< const WifiMpdu > > TxOk
typedef for a callback to invoke when an MPDU is successfully ack'ed.
void SetBlockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
Set block destination callback.
void NotifyOriginatorAgreementReset(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
std::list< AgreementKey > m_sendBarIfDataQueued
list of BA agreements for which a BAR shall only be sent if data is queued
void DestroyRecipientAgreement(const Mac48Address &originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
Destroy a recipient Block Ack agreement.
uint32_t GetNBufferedPackets(const Mac48Address &recipient, uint8_t tid) const
PacketQueueI HandleInFlightMpdu(uint8_t linkId, PacketQueueI mpduIt, MpduStatus status, const OriginatorAgreementsI &it, const Time &now)
Handle the given in flight MPDU based on its given status.
std::list< Ptr< WifiMpdu > >::iterator PacketQueueI
typedef for an iterator for PacketQueue.
void SetBlockAckInactivityCallback(Callback< void, Mac48Address, uint8_t, bool, std::optional< Mac48Address > > callback)
Set block ack inactivity callback.
OriginatorAgreementOptConstRef GetAgreementAsOriginator(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) const
RecipientAgreements::const_iterator RecipientAgreementsCI
A const iterator for recipient block ack agreements.
uint16_t GetOriginatorStartingSequence(const Mac48Address &recipient, uint8_t tid) const
This function returns the starting sequence number of the transmit window.
void NotifyGotBlockAckRequest(const Mac48Address &originator, uint8_t tid, uint16_t startingSeq, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
uint16_t GetGcrStartingSequence(const Mac48Address &groupAddress, uint8_t tid) const
This function returns the starting sequence number of the transmit window for a given GCR Block Ack a...
BlockAckManager(const BlockAckManager &)=delete
Callback< void, Ptr< const WifiMpdu > > DroppedOldMpdu
typedef for a callback to invoke when an MPDU is dropped.
uint16_t GetGcrBufferSize(const Mac48Address &groupAddress, uint8_t tid) const
This function returns the minimum buffer size from ADDBA Response frames sent by all members of a gro...
TxOk m_txOkCallback
transmit OK callback
MpduStatus
Enumeration for the statuses of a buffered MPDU.
void(* AgreementStateTracedCallback)(Time now, const Mac48Address &recipient, uint8_t tid, OriginatorBlockAckAgreement::State state)
TracedCallback signature for state changes.
std::pair< uint16_t, uint16_t > NotifyGotBlockAck(uint8_t linkId, const CtrlBAckResponseHeader &blockAck, const Mac48Address &recipient, const std::set< uint8_t > &tids, size_t index=0)
void DoDispose() override
Destructor implementation.
std::multimap< AgreementKey, std::pair< OriginatorBlockAckAgreement, PacketQueue > > OriginatorAgreements
AgreementKey-indexed map of originator block ack agreements.
std::optional< std::reference_wrapper< const RecipientBlockAckAgreement > > RecipientAgreementOptConstRef
optional const reference to RecipientBlockAckAgreement
void ScheduleBar(const CtrlBAckRequestHeader &reqHdr, const WifiMacHeader &hdr)
void InactivityTimeout(const Mac48Address &recipient, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr)
Inactivity timeout function for a Block Ack agreement.
Callback< void, Mac48Address, uint8_t > m_blockPackets
block packets callback
RecipientAgreementsI GetRecipientBaAgreement(const Mac48Address &originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt)
RecipientAgreementOptConstRef GetAgreementAsRecipient(const Mac48Address &originator, uint8_t tid, std::optional< Mac48Address > gcrGroupAddr=std::nullopt) const
CtrlBAckRequestHeader GetBlockAckReqHeader(const Mac48Address &recipient, uint8_t tid) const
const std::list< AgreementKey > & GetSendBarIfDataQueuedList() const
void NotifyMissedAck(uint8_t linkId, Ptr< WifiMpdu > mpdu)
Invoked upon missed reception of an Ack frame on the given link after the transmission of a QoS data ...
Callback template class.
Definition callback.h:422
Headers for BlockAckRequest.
Headers for BlockAck response.
an EUI-48 address
Implement the header for management frames of type Add Block Ack request.
Implement the header for management frames of type Add Block Ack response.
A base class which provides memory management and object aggregation.
Definition object.h:78
State
Represents the state for this agreement.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition type-id.h:48
Implements the IEEE 802.11 MAC header.
Every class exported by the ns3 library is enclosed in the ns3 namespace.