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
* See also OriginatorBlockAckAgreement::State
54
*/
55
class
OriginatorBlockAckAgreement
:
public
BlockAckAgreement
56
{
57
/// allow BlockAckManager class access
58
friend
class
BlockAckManager
;
59
/// allow OriginatorBlockAckWindowTest class access
60
friend
class ::OriginatorBlockAckWindowTest;
61
62
public
:
63
/**
64
* Constructor
65
*
66
* @param recipient MAC address
67
* @param tid Traffic ID
68
*/
69
OriginatorBlockAckAgreement
(
Mac48Address
recipient, uint8_t tid);
70
~OriginatorBlockAckAgreement
()
override
;
71
72
/**
73
* Represents the state for this agreement.
74
*
75
* PENDING:
76
* If an agreement is in PENDING state it means that an ADDBARequest frame was sent to
77
* recipient in order to setup the block ack and the originator is waiting for the relative
78
* ADDBAResponse frame.
79
*
80
* ESTABLISHED:
81
* The block ack is active and all packets relative to this agreement are transmitted
82
* with Ack Policy set to Block Ack.
83
*
84
* NO_REPLY
85
* No reply after an ADDBA request. In this state the originator will send the rest of
86
* packets in queue using normal MPDU.
87
*
88
* RESET
89
* A transient state to mark the agreement for reinitialization after failed ADDBA request.
90
* Since it is a temporary state, it is not included in the state diagram above. In this
91
* state the next transmission will be treated as if the BA agreement is not created yet.
92
*
93
* REJECTED (not used for now):
94
* The agreement's state becomes REJECTED if an ADDBAResponse frame is received from
95
* recipient and the Status Code field is set to failure.
96
*/
97
/// State enumeration
98
enum
State
99
{
100
PENDING
,
101
ESTABLISHED
,
102
NO_REPLY
,
103
RESET
,
104
REJECTED
105
};
106
107
/**
108
* Set the current state.
109
*
110
* @param state to set
111
*/
112
void
SetState
(State state);
113
/**
114
* Check if the current state of this agreement is PENDING.
115
*
116
* @return true if the current state of this agreement is PENDING,
117
* false otherwise
118
*/
119
bool
IsPending
()
const
;
120
/**
121
* Check if the current state of this agreement is ESTABLISHED.
122
*
123
* @return true if the current state of this agreement is ESTABLISHED,
124
* false otherwise
125
*/
126
bool
IsEstablished
()
const
;
127
/**
128
* Check if the current state of this agreement is NO_REPLY.
129
*
130
* @return true if the current state of this agreement is NO_REPLY,
131
* false otherwise
132
*/
133
bool
IsNoReply
()
const
;
134
/**
135
* Check if the current state of this agreement is RESET.
136
*
137
* @return true if the current state of this agreement is RESET,
138
* false otherwise
139
*/
140
bool
IsReset
()
const
;
141
/**
142
* Check if the current state of this agreement is REJECTED.
143
*
144
* @return true if the current state of this agreement is REJECTED,
145
* false otherwise
146
*/
147
bool
IsRejected
()
const
;
148
149
/**
150
* Return the starting sequence number of the transmit window, if a transmit
151
* window has been initialized. Otherwise, return the starting sequence number
152
* stored by the BlockAckAgreement base class.
153
*
154
* @return the starting sequence number.
155
*/
156
uint16_t
GetStartingSequence
()
const override
;
157
158
/**
159
* Get the distance between the current starting sequence number and the
160
* given sequence number.
161
*
162
* @param seqNumber the given sequence number
163
* @return the distance of the given sequence number from the current winstart
164
*/
165
std::size_t
GetDistance
(uint16_t seqNumber)
const
;
166
167
/**
168
* Initialize the originator's transmit window by setting its size and starting
169
* sequence number equal to the values stored by the BlockAckAgreement base class.
170
*/
171
void
InitTxWindow
();
172
173
/**
174
* Advance the transmit window so as to include the transmitted MPDU, if the
175
* latter is not an old packet and is beyond the current transmit window.
176
*
177
* @param mpdu the transmitted MPDU
178
*/
179
void
NotifyTransmittedMpdu
(
Ptr<const WifiMpdu>
mpdu);
180
/**
181
* Record that the given MPDU has been acknowledged and advance the transmit
182
* window if possible.
183
*
184
* @param mpdu the acknowledged MPDU
185
*/
186
void
NotifyAckedMpdu
(
Ptr<const WifiMpdu>
mpdu);
187
/**
188
* Advance the transmit window beyond the MPDU that has been reported to
189
* be discarded.
190
*
191
* @param mpdu the discarded MPDU
192
*/
193
void
NotifyDiscardedMpdu
(
Ptr<const WifiMpdu>
mpdu);
194
195
/**
196
* Check whether all the MPDUs in the TX window other than the given ones have been already
197
* acknowledged.
198
*
199
* @param seqNumbers the sequence numbers of the given MPDUs
200
* @return whether all the MPDUs in the TX window other than the given ones have been already
201
* acknowledged
202
*/
203
bool
AllAckedMpdusInTxWindow
(
const
std::set<uint16_t>& seqNumbers)
const
;
204
205
private
:
206
/**
207
* Advance the transmit window so that the starting sequence number is the
208
* nearest unacknowledged MPDU.
209
*/
210
void
AdvanceTxWindow
();
211
212
State
m_state
;
///< state
213
BlockAckWindow
m_txWindow
;
///< originator's transmit window
214
};
215
216
}
// namespace ns3
217
218
#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:41
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:56
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:212
ns3::OriginatorBlockAckAgreement::m_txWindow
BlockAckWindow m_txWindow
originator's transmit window
Definition
originator-block-ack-agreement.h:213
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:99
ns3::OriginatorBlockAckAgreement::NO_REPLY
@ NO_REPLY
Definition
originator-block-ack-agreement.h:102
ns3::OriginatorBlockAckAgreement::PENDING
@ PENDING
Definition
originator-block-ack-agreement.h:100
ns3::OriginatorBlockAckAgreement::ESTABLISHED
@ ESTABLISHED
Definition
originator-block-ack-agreement.h:101
ns3::OriginatorBlockAckAgreement::RESET
@ RESET
Definition
originator-block-ack-agreement.h:103
ns3::OriginatorBlockAckAgreement::REJECTED
@ REJECTED
Definition
originator-block-ack-agreement.h:104
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 Wed Dec 4 2024 18:20:52 for ns-3 by
1.11.0