A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
originator-block-ack-agreement.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
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
8
*/
9
#ifndef ORIGINATOR_BLOCK_ACK_AGREEMENT_H
10
#define ORIGINATOR_BLOCK_ACK_AGREEMENT_H
11
12
#include "
block-ack-agreement.h
"
13
#include "
block-ack-window.h
"
14
15
#include <set>
16
17
class
OriginatorBlockAckWindowTest
;
18
19
namespace
ns3
20
{
21
22
class
WifiMpdu;
23
24
/**
25
* @ingroup wifi
26
* Maintains the state and information about transmitted MPDUs with Ack Policy set to Block Ack
27
* for an originator station. The state diagram is as follows:
28
*
29
*/
30
// clang-format off
31
/**
32
* \verbatim
33
/------------\ send ADDBARequest ----------------
34
| START |------------------>| PENDING |-------
35
\------------/ ---------------- \
36
^ receive / | \
37
| ADDBAResponse / | \
38
| (failure) v | \
39
| --------------- | ---------------------> ----------------
40
| | REJECTED | | receive ADDBAResponse (success) | ESTABLISHED |
41
| --------------- | no --------------------> ----------------
42
| receive ^ | ADDBAResponse /
43
| ADDBAResponse \ | /
44
| (failure) \ v /
45
| ---------------- /
46
|-------------------------| NO_REPLY |---------
47
Reset after timeout ----------------
48
\endverbatim
49
*/
50
// clang-format on
51
52
/**
53
*
54
* See also OriginatorBlockAckAgreement::State
55
*/
56
class
OriginatorBlockAckAgreement
:
public
BlockAckAgreement
57
{
58
/// allow BlockAckManager class access
59
friend
class
BlockAckManager
;
60
/// allow OriginatorBlockAckWindowTest class access
61
friend
class ::OriginatorBlockAckWindowTest;
62
63
public
:
64
/**
65
* Constructor
66
*
67
* @param recipient MAC address
68
* @param tid Traffic ID
69
*/
70
OriginatorBlockAckAgreement
(
Mac48Address
recipient, uint8_t tid);
71
~OriginatorBlockAckAgreement
()
override
;
72
73
/**
74
* Represents the state for this agreement.
75
*
76
* PENDING:
77
* If an agreement is in PENDING state it means that an ADDBARequest frame was sent to
78
* recipient in order to setup the block ack and the originator is waiting for the relative
79
* ADDBAResponse frame.
80
*
81
* ESTABLISHED:
82
* The block ack is active and all packets relative to this agreement are transmitted
83
* with Ack Policy set to Block Ack.
84
*
85
* NO_REPLY
86
* No reply after an ADDBA request. In this state the originator will send the rest of
87
* packets in queue using normal MPDU.
88
*
89
* RESET
90
* A transient state to mark the agreement for reinitialization after failed ADDBA request.
91
* Since it is a temporary state, it is not included in the state diagram above. In this
92
* state the next transmission will be treated as if the BA agreement is not created yet.
93
*
94
* REJECTED (not used for now):
95
* The agreement's state becomes REJECTED if an ADDBAResponse frame is received from
96
* recipient and the Status Code field is set to failure.
97
*/
98
/// State enumeration
99
enum
State
100
{
101
PENDING
,
102
ESTABLISHED
,
103
NO_REPLY
,
104
RESET
,
105
REJECTED
106
};
107
108
/**
109
* Set the current state.
110
*
111
* @param state to set
112
*/
113
void
SetState
(State state);
114
/**
115
* Check if the current state of this agreement is PENDING.
116
*
117
* @return true if the current state of this agreement is PENDING,
118
* false otherwise
119
*/
120
bool
IsPending
()
const
;
121
/**
122
* Check if the current state of this agreement is ESTABLISHED.
123
*
124
* @return true if the current state of this agreement is ESTABLISHED,
125
* false otherwise
126
*/
127
bool
IsEstablished
()
const
;
128
/**
129
* Check if the current state of this agreement is NO_REPLY.
130
*
131
* @return true if the current state of this agreement is NO_REPLY,
132
* false otherwise
133
*/
134
bool
IsNoReply
()
const
;
135
/**
136
* Check if the current state of this agreement is RESET.
137
*
138
* @return true if the current state of this agreement is RESET,
139
* false otherwise
140
*/
141
bool
IsReset
()
const
;
142
/**
143
* Check if the current state of this agreement is REJECTED.
144
*
145
* @return true if the current state of this agreement is REJECTED,
146
* false otherwise
147
*/
148
bool
IsRejected
()
const
;
149
150
/**
151
* Return the starting sequence number of the transmit window, if a transmit
152
* window has been initialized. Otherwise, return the starting sequence number
153
* stored by the BlockAckAgreement base class.
154
*
155
* @return the starting sequence number.
156
*/
157
uint16_t
GetStartingSequence
()
const override
;
158
159
/**
160
* Get the distance between the current starting sequence number and the
161
* given sequence number.
162
*
163
* @param seqNumber the given sequence number
164
* @return the distance of the given sequence number from the current winstart
165
*/
166
std::size_t
GetDistance
(uint16_t seqNumber)
const
;
167
168
/**
169
* Initialize the originator's transmit window by setting its size and starting
170
* sequence number equal to the values stored by the BlockAckAgreement base class.
171
*/
172
void
InitTxWindow
();
173
174
/**
175
* Advance the transmit window so as to include the transmitted MPDU, if the
176
* latter is not an old packet and is beyond the current transmit window.
177
*
178
* @param mpdu the transmitted MPDU
179
*/
180
void
NotifyTransmittedMpdu
(
Ptr<const WifiMpdu>
mpdu);
181
/**
182
* Record that the given MPDU has been acknowledged and advance the transmit
183
* window if possible.
184
*
185
* @param mpdu the acknowledged MPDU
186
*/
187
void
NotifyAckedMpdu
(
Ptr<const WifiMpdu>
mpdu);
188
/**
189
* Advance the transmit window beyond the MPDU that has been reported to
190
* be discarded.
191
*
192
* @param mpdu the discarded MPDU
193
*/
194
void
NotifyDiscardedMpdu
(
Ptr<const WifiMpdu>
mpdu);
195
196
/**
197
* Check whether all the MPDUs in the TX window other than the given ones have been already
198
* acknowledged.
199
*
200
* @param seqNumbers the sequence numbers of the given MPDUs
201
* @return whether all the MPDUs in the TX window other than the given ones have been already
202
* acknowledged
203
*/
204
bool
AllAckedMpdusInTxWindow
(
const
std::set<uint16_t>& seqNumbers)
const
;
205
206
private
:
207
/**
208
* Advance the transmit window so that the starting sequence number is the
209
* nearest unacknowledged MPDU.
210
*/
211
void
AdvanceTxWindow
();
212
213
State
m_state
;
///< state
214
BlockAckWindow
m_txWindow
;
///< originator's transmit window
215
};
216
217
}
// namespace ns3
218
219
#endif
/* ORIGINATOR_BLOCK_ACK_AGREEMENT_H */
block-ack-agreement.h
block-ack-window.h
OriginatorBlockAckWindowTest
Test for the originator block ack window.
Definition
block-ack-test-suite.cc:270
ns3::BlockAckAgreement
Maintains information for a block ack agreement.
Definition
block-ack-agreement.h:26
ns3::BlockAckManager
Manages all block ack agreements for an originator station.
Definition
block-ack-manager.h:42
ns3::BlockAckWindow
Block ack window.
Definition
block-ack-window.h:47
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::OriginatorBlockAckAgreement
Maintains the state and information about transmitted MPDUs with Ack Policy set to Block Ack for an o...
Definition
originator-block-ack-agreement.h:57
ns3::OriginatorBlockAckAgreement::NotifyDiscardedMpdu
void NotifyDiscardedMpdu(Ptr< const WifiMpdu > mpdu)
Advance the transmit window beyond the MPDU that has been reported to be discarded.
Definition
originator-block-ack-agreement.cc:174
ns3::OriginatorBlockAckAgreement::GetStartingSequence
uint16_t GetStartingSequence() const override
Return the starting sequence number of the transmit window, if a transmit window has been initialized...
Definition
originator-block-ack-agreement.cc:69
ns3::OriginatorBlockAckAgreement::m_state
State m_state
state
Definition
originator-block-ack-agreement.h:213
ns3::OriginatorBlockAckAgreement::m_txWindow
BlockAckWindow m_txWindow
originator's transmit window
Definition
originator-block-ack-agreement.h:214
ns3::OriginatorBlockAckAgreement::NotifyTransmittedMpdu
void NotifyTransmittedMpdu(Ptr< const WifiMpdu > mpdu)
Advance the transmit window so as to include the transmitted MPDU, if the latter is not an old packet...
Definition
originator-block-ack-agreement.cc:125
ns3::OriginatorBlockAckAgreement::NotifyAckedMpdu
void NotifyAckedMpdu(Ptr< const WifiMpdu > mpdu)
Record that the given MPDU has been acknowledged and advance the transmit window if possible.
Definition
originator-block-ack-agreement.cc:151
ns3::OriginatorBlockAckAgreement::IsPending
bool IsPending() const
Check if the current state of this agreement is PENDING.
Definition
originator-block-ack-agreement.cc:39
ns3::OriginatorBlockAckAgreement::IsReset
bool IsReset() const
Check if the current state of this agreement is RESET.
Definition
originator-block-ack-agreement.cc:63
ns3::OriginatorBlockAckAgreement::AdvanceTxWindow
void AdvanceTxWindow()
Advance the transmit window so that the starting sequence number is the nearest unacknowledged MPDU.
Definition
originator-block-ack-agreement.cc:116
ns3::OriginatorBlockAckAgreement::OriginatorBlockAckAgreement
OriginatorBlockAckAgreement(Mac48Address recipient, uint8_t tid)
Constructor.
Definition
originator-block-ack-agreement.cc:22
ns3::OriginatorBlockAckAgreement::IsEstablished
bool IsEstablished() const
Check if the current state of this agreement is ESTABLISHED.
Definition
originator-block-ack-agreement.cc:45
ns3::OriginatorBlockAckAgreement::SetState
void SetState(State state)
Set the current state.
Definition
originator-block-ack-agreement.cc:33
ns3::OriginatorBlockAckAgreement::AllAckedMpdusInTxWindow
bool AllAckedMpdusInTxWindow(const std::set< uint16_t > &seqNumbers) const
Check whether all the MPDUs in the TX window other than the given ones have been already acknowledged...
Definition
originator-block-ack-agreement.cc:92
ns3::OriginatorBlockAckAgreement::State
State
Represents the state for this agreement.
Definition
originator-block-ack-agreement.h:100
ns3::OriginatorBlockAckAgreement::NO_REPLY
@ NO_REPLY
Definition
originator-block-ack-agreement.h:103
ns3::OriginatorBlockAckAgreement::PENDING
@ PENDING
Definition
originator-block-ack-agreement.h:101
ns3::OriginatorBlockAckAgreement::ESTABLISHED
@ ESTABLISHED
Definition
originator-block-ack-agreement.h:102
ns3::OriginatorBlockAckAgreement::RESET
@ RESET
Definition
originator-block-ack-agreement.h:104
ns3::OriginatorBlockAckAgreement::REJECTED
@ REJECTED
Definition
originator-block-ack-agreement.h:105
ns3::OriginatorBlockAckAgreement::GetDistance
std::size_t GetDistance(uint16_t seqNumber) const
Get the distance between the current starting sequence number and the given sequence number.
Definition
originator-block-ack-agreement.cc:80
ns3::OriginatorBlockAckAgreement::~OriginatorBlockAckAgreement
~OriginatorBlockAckAgreement() override
Definition
originator-block-ack-agreement.cc:28
ns3::OriginatorBlockAckAgreement::IsNoReply
bool IsNoReply() const
Check if the current state of this agreement is NO_REPLY.
Definition
originator-block-ack-agreement.cc:57
ns3::OriginatorBlockAckAgreement::IsRejected
bool IsRejected() const
Check if the current state of this agreement is REJECTED.
Definition
originator-block-ack-agreement.cc:51
ns3::OriginatorBlockAckAgreement::InitTxWindow
void InitTxWindow()
Initialize the originator's transmit window by setting its size and starting sequence number equal to...
Definition
originator-block-ack-agreement.cc:86
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
wifi
model
originator-block-ack-agreement.h
Generated on Tue Apr 29 2025 11:07:09 for ns-3 by
1.11.0