A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
edca-txop-n.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2006, 2009 INRIA
4
* Copyright (c) 2009 MIRKO BANCHI
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation;
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
*
19
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20
* Author: Mirko Banchi <mk.banchi@gmail.com>
21
*/
22
#ifndef EDCA_TXOP_N_H
23
#define EDCA_TXOP_N_H
24
25
#include "ns3/object.h"
26
#include "ns3/mac48-address.h"
27
#include "ns3/packet.h"
28
29
#include "
wifi-mode.h
"
30
#include "
wifi-mac-header.h
"
31
#include "
wifi-remote-station-manager.h
"
32
#include "
qos-utils.h
"
33
#include "
dcf.h
"
34
#include "
ctrl-headers.h
"
35
#include "
block-ack-manager.h
"
36
37
#include <map>
38
#include <list>
39
40
namespace
ns3 {
41
42
class
DcfState;
43
class
DcfManager;
44
class
MacLow;
45
class
MacTxMiddle;
46
class
WifiMac;
47
class
WifiMacParameters;
48
class
WifiMacQueue;
49
class
RandomStream;
50
class
QosBlockedDestinations;
51
class
MsduAggregator;
52
class
MgtAddBaResponseHeader;
53
class
BlockAckManager;
54
class
MgtDelBaHeader;
55
56
enum
TypeOfStation
57
{
58
STA
,
59
AP
,
60
ADHOC_STA
,
61
MESH
62
};
63
64
77
class
EdcaTxopN
:
public
Dcf
78
{
79
public
:
80
typedef
Callback <void, const WifiMacHeader&>
TxOk
;
81
typedef
Callback <void, const WifiMacHeader&>
TxFailed
;
82
83
static
TypeId
GetTypeId
(
void
);
84
EdcaTxopN
();
85
virtual
~EdcaTxopN
();
86
void
DoDispose
();
87
88
void
SetLow
(
Ptr<MacLow>
low);
89
void
SetTxMiddle
(
MacTxMiddle
*txMiddle);
90
void
SetManager
(
DcfManager
*manager);
91
void
SetTxOkCallback
(
TxOk
callback);
92
void
SetTxFailedCallback
(
TxFailed
callback);
93
void
SetWifiRemoteStationManager
(
Ptr<WifiRemoteStationManager>
remoteManager);
94
void
SetTypeOfStation
(
enum
TypeOfStation
type);
95
enum
TypeOfStation
GetTypeOfStation
(
void
)
const
;
96
97
Ptr<WifiMacQueue >
GetQueue
()
const
;
98
virtual
void
SetMinCw
(uint32_t minCw);
99
virtual
void
SetMaxCw
(uint32_t maxCw);
100
virtual
void
SetAifsn
(uint32_t aifsn);
101
virtual
uint32_t
GetMinCw
(
void
)
const
;
102
virtual
uint32_t
GetMaxCw
(
void
)
const
;
103
virtual
uint32_t
GetAifsn
(
void
)
const
;
104
105
Ptr<MacLow>
Low
(
void
);
106
Ptr<MsduAggregator>
GetMsduAggregator
(
void
)
const
;
107
108
/* dcf notifications forwarded here */
109
bool
NeedsAccess
(
void
)
const
;
110
void
NotifyAccessGranted
(
void
);
111
void
NotifyInternalCollision
(
void
);
112
void
NotifyCollision
(
void
);
116
void
NotifyChannelSwitching
(
void
);
117
118
/*event handlers*/
119
void
GotCts
(
double
snr,
WifiMode
txMode);
120
void
MissedCts
(
void
);
121
void
GotAck
(
double
snr,
WifiMode
txMode);
122
void
GotBlockAck
(
const
CtrlBAckResponseHeader
*blockAck,
Mac48Address
recipient);
123
void
MissedBlockAck
(
void
);
124
void
GotAddBaResponse
(
const
MgtAddBaResponseHeader
*respHdr,
Mac48Address
recipient);
125
void
GotDelBaFrame
(
const
MgtDelBaHeader
*delBaHdr,
Mac48Address
recipient);
126
void
MissedAck
(
void
);
127
void
StartNext
(
void
);
128
void
Cancel
(
void
);
129
void
EndTxNoAck
(
void
);
130
131
void
RestartAccessIfNeeded
(
void
);
132
void
StartAccessIfNeeded
(
void
);
133
bool
NeedRts
(
void
);
134
bool
NeedRtsRetransmission
(
void
);
135
bool
NeedDataRetransmission
(
void
);
136
bool
NeedFragmentation
(
void
)
const
;
137
uint32_t
GetNextFragmentSize
(
void
);
138
uint32_t
GetFragmentSize
(
void
);
139
uint32_t
GetFragmentOffset
(
void
);
140
bool
IsLastFragment
(
void
)
const
;
141
void
NextFragment
(
void
);
142
Ptr<Packet>
GetFragmentPacket
(
WifiMacHeader
*hdr);
143
144
void
SetAccessCategory
(
enum
AcIndex
ac);
145
void
Queue
(
Ptr<const Packet>
packet,
const
WifiMacHeader
&hdr);
146
void
SetMsduAggregator
(
Ptr<MsduAggregator>
aggr);
147
void
PushFront
(
Ptr<const Packet>
packet,
const
WifiMacHeader
&hdr);
148
void
CompleteConfig
(
void
);
149
void
SetBlockAckThreshold
(uint8_t threshold);
150
uint8_t
GetBlockAckThreshold
(
void
)
const
;
151
void
SetBlockAckInactivityTimeout
(uint16_t
timeout
);
152
void
SendDelbaFrame
(
Mac48Address
addr, uint8_t tid,
bool
byOriginator);
153
162
int64_t
AssignStreams
(int64_t stream);
163
164
private
:
165
void
DoStart
();
175
Mac48Address
MapSrcAddressForAggregation
(
const
WifiMacHeader
&hdr);
176
Mac48Address
MapDestAddressForAggregation
(
const
WifiMacHeader
&hdr);
177
EdcaTxopN
&
operator =
(
const
EdcaTxopN
&);
178
EdcaTxopN
(
const
EdcaTxopN
&);
179
180
/* If number of packets in the queue reaches m_blockAckThreshold value, an ADDBARequest frame
181
* is sent to destination in order to setup a block ack.
182
*/
183
bool
SetupBlockAckIfNeeded
();
184
/* Sends an ADDBARequest to establish a block ack agreement with sta
185
* addressed by <i>recipient</i> for tid <i>tid</i>.
186
*/
187
void
SendAddBaRequest
(
Mac48Address
recipient, uint8_t tid, uint16_t startSeq,
188
uint16_t
timeout
,
bool
immediateBAck);
189
/* After that all packets, for which a block ack agreement was established, have been
190
* transmitted, we have to send a block ack request.
191
*/
192
void
SendBlockAckRequest
(
const
struct
Bar
&bar);
193
/* For now is typically invoked to complete transmission of a packets sent with ack policy
194
* Block Ack: the packet is buffered and dcf is reset.
195
*/
196
void
CompleteTx
(
void
);
197
/* Verifies if dequeued packet has to be transmitted with ack policy Block Ack. This happens
198
* if an established block ack agreement exists with the receiver.
199
*/
200
void
VerifyBlockAck
(
void
);
201
202
AcIndex
m_ac
;
203
class
Dcf
;
204
class
TransmissionListener
;
205
class
BlockAckEventListener
;
206
friend
class
Dcf
;
207
friend
class
TransmissionListener
;
208
Dcf
*
m_dcf
;
209
DcfManager
*
m_manager
;
210
Ptr<WifiMacQueue>
m_queue
;
211
TxOk
m_txOkCallback
;
212
TxFailed
m_txFailedCallback
;
213
Ptr<MacLow>
m_low
;
214
MacTxMiddle
*
m_txMiddle
;
215
TransmissionListener
*
m_transmissionListener
;
216
BlockAckEventListener
*
m_blockAckListener
;
217
RandomStream
*
m_rng
;
218
Ptr<WifiRemoteStationManager>
m_stationManager
;
219
uint8_t
m_fragmentNumber
;
220
221
/* current packet could be a simple MSDU or, if an aggregator for this queue is
222
present, could be an A-MSDU.
223
*/
224
Ptr<const Packet>
m_currentPacket
;
225
226
WifiMacHeader
m_currentHdr
;
227
Ptr<MsduAggregator>
m_aggregator
;
228
TypeOfStation
m_typeOfStation
;
229
QosBlockedDestinations
*
m_qosBlockedDestinations
;
230
BlockAckManager
*
m_baManager
;
231
/*
232
* Represents the minimum number of packets for use of block ack.
233
*/
234
uint8_t
m_blockAckThreshold
;
235
enum
BlockAckType
m_blockAckType
;
236
Time
m_currentPacketTimestamp
;
237
uint16_t
m_blockAckInactivityTimeout
;
238
struct
Bar
m_currentBar
;
239
};
240
241
}
// namespace ns3
242
243
#endif
/* EDCA_TXOP_N_H */
src
wifi
model
edca-txop-n.h
Generated on Fri Dec 21 2012 19:00:48 for ns-3 by
1.8.1.2