A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
block-ack-agreement.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 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_AGREEMENT_H
10#define BLOCK_ACK_AGREEMENT_H
11
12#include "block-ack-type.h"
13
14#include "ns3/event-id.h"
15#include "ns3/mac48-address.h"
16
17#include <optional>
18
19namespace ns3
20{
21/**
22 * @brief Maintains information for a block ack agreement.
23 * @ingroup wifi
24 */
26{
28
29 public:
30 /**
31 * Constructor for BlockAckAgreement with given peer and TID.
32 *
33 * @param peer the peer station
34 * @param tid the TID
35 */
36 BlockAckAgreement(Mac48Address peer, uint8_t tid);
37 virtual ~BlockAckAgreement();
38 /**
39 * Set buffer size.
40 *
41 * @param bufferSize the buffer size (in number of MPDUs)
42 */
43 void SetBufferSize(uint16_t bufferSize);
44 /**
45 * Set timeout.
46 *
47 * @param timeout the timeout value
48 */
49 void SetTimeout(uint16_t timeout);
50 /**
51 * Set starting sequence number.
52 *
53 * @param seq the starting sequence number
54 */
55 void SetStartingSequence(uint16_t seq);
56 /**
57 * Set starting sequence control.
58 *
59 * @param seq the starting sequence control
60 */
61 void SetStartingSequenceControl(uint16_t seq);
62 /**
63 * Set block ack policy to immediate Ack.
64 */
66 /**
67 * Set block ack policy to delayed Ack.
68 */
69 void SetDelayedBlockAck();
70 /**
71 * Enable or disable A-MSDU support.
72 *
73 * @param supported enable or disable A-MSDU support
74 */
75 void SetAmsduSupport(bool supported);
76 /**
77 * Return the Traffic ID (TID).
78 *
79 * @return TID
80 */
81 uint8_t GetTid() const;
82 /**
83 * Return the peer address.
84 *
85 * @return the peer MAC address
86 */
87 Mac48Address GetPeer() const;
88 /**
89 * Return the buffer size.
90 *
91 * @return the buffer size (in number of MPDUs)
92 */
93 uint16_t GetBufferSize() const;
94 /**
95 * Return the timeout.
96 *
97 * @return the timeout
98 */
99 uint16_t GetTimeout() const;
100 /**
101 * Return the starting sequence number.
102 *
103 * @return starting sequence number
104 */
105 virtual uint16_t GetStartingSequence() const;
106 /**
107 * Return the starting sequence control
108 *
109 * @return starting sequence control
110 */
111 uint16_t GetStartingSequenceControl() const;
112 /**
113 * Return the last sequence number covered by the ack window
114 *
115 * @return ending sequence number
116 */
117 uint16_t GetWinEnd() const;
118 /**
119 * Check whether the current ack policy is immediate BlockAck.
120 *
121 * @return true if the current ack policy is immediate BlockAck,
122 * false otherwise
123 */
124 bool IsImmediateBlockAck() const;
125 /**
126 * Check whether A-MSDU is supported
127 *
128 * @return true if A-MSDU is supported,
129 * false otherwise
130 */
131 bool IsAmsduSupported() const;
132 /**
133 * Enable or disable HT support.
134 *
135 * @param htSupported enable or disable HT support
136 */
137 void SetHtSupported(bool htSupported);
138 /**
139 * Check whether HT is supported
140 *
141 * @return true if HT is supported,
142 * false otherwise
143 */
144 bool IsHtSupported() const;
145 /**
146 * Get the type of the Block Acks sent by the recipient of this agreement.
147 *
148 * @return the type of the Block Acks sent by the recipient of this agreement
149 */
151 /**
152 * Get the type of the Block Ack Requests sent by the originator of this agreement.
153 *
154 * @return the type of the Block Ack Requests sent by the originator of this agreement
155 */
157 /**
158 * Get the distance between the given starting sequence number and the
159 * given sequence number.
160 *
161 * @param seqNumber the given sequence number
162 * @param startingSeqNumber the given starting sequence number
163 * @return the distance of the given sequence number from the given starting sequence number
164 */
165 static std::size_t GetDistance(uint16_t seqNumber, uint16_t startingSeqNumber);
166 /**
167 * Set the GCR group address for this agreement.
168 *
169 * @param gcrGroupAddress the GCR group address
170 */
171 void SetGcrGroupAddress(const Mac48Address& gcrGroupAddress);
172 /**
173 * Get the GCR group address of this agreement if it is a GCR Block Ack agreement.
174 *
175 * @return the GCR group address of this agreement if it is a GCR Block Ack agreement
176 */
177 const std::optional<Mac48Address>& GetGcrGroupAddress() const;
178
179 protected:
180 Mac48Address m_peer; //!< Peer address
181 bool m_amsduSupported; //!< Flag whether MSDU aggregation is supported
182 uint8_t m_blockAckPolicy; //!< Type of block ack: immediate or delayed
183 uint8_t m_tid; //!< Traffic ID
184 uint16_t m_bufferSize; //!< Buffer size
185 uint16_t m_timeout; //!< Timeout
186 uint16_t m_startingSeq; //!< Starting sequence control
187 uint16_t m_winEnd; //!< Ending sequence number
188 bool m_htSupported; //!< Flag whether HT is supported
189 std::optional<Mac48Address> m_gcrGroupAddress; //!< the optional GCR group address
190 mutable EventId m_inactivityEvent; //!< inactivity event
191};
192
193} // namespace ns3
194
195#endif /* BLOCK_ACK_AGREEMENT_H */
Maintains information for a block ack agreement.
uint16_t GetTimeout() const
Return the timeout.
bool IsHtSupported() const
Check whether HT is supported.
BlockAckAgreement(Mac48Address peer, uint8_t tid)
Constructor for BlockAckAgreement with given peer and TID.
Mac48Address m_peer
Peer address.
void SetGcrGroupAddress(const Mac48Address &gcrGroupAddress)
Set the GCR group address for this agreement.
void SetImmediateBlockAck()
Set block ack policy to immediate Ack.
uint16_t m_winEnd
Ending sequence number.
void SetStartingSequence(uint16_t seq)
Set starting sequence number.
virtual uint16_t GetStartingSequence() const
Return the starting sequence number.
void SetStartingSequenceControl(uint16_t seq)
Set starting sequence control.
BlockAckType GetBlockAckType() const
Get the type of the Block Acks sent by the recipient of this agreement.
EventId m_inactivityEvent
inactivity event
BlockAckReqType GetBlockAckReqType() const
Get the type of the Block Ack Requests sent by the originator of this agreement.
void SetBufferSize(uint16_t bufferSize)
Set buffer size.
uint8_t m_blockAckPolicy
Type of block ack: immediate or delayed.
void SetDelayedBlockAck()
Set block ack policy to delayed Ack.
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
uint16_t GetWinEnd() const
Return the last sequence number covered by the ack window.
uint8_t GetTid() const
Return the Traffic ID (TID).
uint16_t m_startingSeq
Starting sequence control.
bool m_amsduSupported
Flag whether MSDU aggregation is supported.
std::optional< Mac48Address > m_gcrGroupAddress
the optional GCR group address
uint16_t m_bufferSize
Buffer size.
void SetTimeout(uint16_t timeout)
Set timeout.
bool IsImmediateBlockAck() const
Check whether the current ack policy is immediate BlockAck.
static std::size_t GetDistance(uint16_t seqNumber, uint16_t startingSeqNumber)
Get the distance between the given starting sequence number and the given sequence number.
uint16_t GetStartingSequenceControl() const
Return the starting sequence control.
const std::optional< Mac48Address > & GetGcrGroupAddress() const
Get the GCR group address of this agreement if it is a GCR Block Ack agreement.
uint16_t GetBufferSize() const
Return the buffer size.
bool m_htSupported
Flag whether HT is supported.
void SetHtSupported(bool htSupported)
Enable or disable HT support.
bool IsAmsduSupported() const
Check whether A-MSDU is supported.
Mac48Address GetPeer() const
Return the peer address.
An identifier for simulation events.
Definition event-id.h:45
HtFrameExchangeManager handles the frame exchange sequences for HT stations.
an EUI-48 address
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Time timeout
The different BlockAckRequest variants.
The different BlockAck variants.