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
block-ack-manager.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009, 2010 MIRKO BANCHI
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mirko Banchi <mk.banchi@gmail.com>
19
*/
20
#ifndef BLOCK_ACK_MANAGER_H
21
#define BLOCK_ACK_MANAGER_H
22
23
#include <map>
24
#include <list>
25
#include <deque>
26
27
#include "ns3/packet.h"
28
29
#include "
wifi-mac-header.h
"
30
#include "
originator-block-ack-agreement.h
"
31
#include "
ctrl-headers.h
"
32
#include "
qos-utils.h
"
33
34
using namespace
std;
35
36
namespace
ns3 {
37
38
class
MgtAddBaResponseHeader;
39
class
MgtAddBaRequestHeader;
40
class
MgtDelBaHeader;
41
class
MacTxMiddle;
42
class
WifiMacQueue;
43
49
struct
Bar
50
{
51
Bar
();
52
Bar
(
Ptr<const Packet>
packet,
53
Mac48Address
recipient,
54
uint8_t tid,
55
bool
immediate);
56
Ptr<const Packet>
bar
;
57
Mac48Address
recipient
;
58
uint8_t
tid
;
59
bool
immediate
;
60
};
61
66
class
BlockAckManager
67
{
68
private
:
69
BlockAckManager
(
const
BlockAckManager
&);
70
BlockAckManager
& operator= (
const
BlockAckManager
&);
71
72
public
:
73
BlockAckManager
();
74
~
BlockAckManager
();
82
bool
ExistsAgreement (
Mac48Address
recipient, uint8_t tid)
const
;
91
bool
ExistsAgreementInState (
Mac48Address
recipient, uint8_t tid,
92
enum
OriginatorBlockAckAgreement::State
state)
const
;
100
void
CreateAgreement (
const
MgtAddBaRequestHeader
*reqHdr,
Mac48Address
recipient);
108
void
DestroyAgreement (
Mac48Address
recipient, uint8_t tid);
115
void
UpdateAgreement (
const
MgtAddBaResponseHeader
*respHdr,
Mac48Address
recipient);
124
void
StorePacket (
Ptr<const Packet>
packet,
const
WifiMacHeader
&hdr,
Time
tStamp);
131
Ptr<const Packet>
GetNextPacket (
WifiMacHeader
&hdr);
132
bool
HasBar (
struct
Bar
&bar);
137
bool
HasPackets (
void
)
const
;
147
void
NotifyGotBlockAck (
const
CtrlBAckResponseHeader
*blockAck,
Mac48Address
recipient);
155
uint32_t GetNBufferedPackets (
Mac48Address
recipient, uint8_t tid)
const
;
163
uint32_t GetNRetryNeededPackets (
Mac48Address
recipient, uint8_t tid)
const
;
172
void
NotifyAgreementEstablished (
Mac48Address
recipient, uint8_t tid, uint16_t startingSeq);
181
void
NotifyAgreementUnsuccessful (
Mac48Address
recipient, uint8_t tid);
191
void
NotifyMpduTransmission (
Mac48Address
recipient, uint8_t tid, uint16_t nextSeqNumber);
198
void
SetBlockAckThreshold (uint8_t nPackets);
202
void
SetQueue (
Ptr<WifiMacQueue>
queue);
203
void
SetTxMiddle (
MacTxMiddle
* txMiddle);
209
void
SetBlockAckType (
enum
BlockAckType
bAckType);
217
void
TearDownBlockAck (
Mac48Address
recipient, uint8_t tid);
225
bool
HasOtherFragments (uint16_t sequenceNumber)
const
;
229
uint32_t GetNextPacketSize (
void
)
const
;
236
void
SetMaxPacketDelay (
Time
maxDelay);
239
void
SetBlockAckInactivityCallback (
Callback<void, Mac48Address, uint8_t, bool>
callback);
240
void
SetBlockDestinationCallback (
Callback<void, Mac48Address, uint8_t>
callback);
241
void
SetUnblockDestinationCallback (
Callback<void, Mac48Address, uint8_t>
callback);
248
bool
SwitchToBlockAckIfNeeded (
Mac48Address
recipient, uint8_t tid, uint16_t startingSeq);
254
uint16_t GetSeqNumOfNextRetryPacket (
Mac48Address
recipient, uint8_t tid)
const
;
255
private
:
262
Ptr<Packet>
ScheduleBlockAckReqIfNeeded (
Mac48Address
recipient, uint8_t tid);
266
void
CleanupBuffers (
void
);
267
void
InactivityTimeout (
Mac48Address
, uint8_t);
268
269
struct
Item
;
270
typedef
std::list<Item>
PacketQueue
;
271
typedef
std::list<Item>::iterator
PacketQueueI
;
272
typedef
std::list<Item>::const_iterator
PacketQueueCI
;
273
274
typedef
std::map<std::pair<Mac48Address, uint8_t>,
275
std::pair<OriginatorBlockAckAgreement, PacketQueue> >
Agreements
;
276
typedef
std::map<std::pair<Mac48Address, uint8_t>,
277
std::pair<OriginatorBlockAckAgreement, PacketQueue> >::iterator
AgreementsI
;
278
typedef
std::map<std::pair<Mac48Address, uint8_t>,
279
std::pair<OriginatorBlockAckAgreement, PacketQueue> >::const_iterator
AgreementsCI
;
280
281
struct
Item
282
{
283
Item
();
284
Item
(
Ptr<const Packet>
packet,
285
const
WifiMacHeader
&hdr,
286
Time
tStamp);
287
Ptr<const Packet>
packet
;
288
WifiMacHeader
hdr
;
289
Time
timestamp
;
290
};
291
298
Agreements
m_agreements
;
304
std::list<PacketQueueI>
m_retryPackets
;
305
std::list<Bar>
m_bars
;
306
307
uint8_t
m_blockAckThreshold
;
308
enum
BlockAckType
m_blockAckType
;
309
Time
m_maxDelay
;
310
MacTxMiddle
*
m_txMiddle
;
311
Mac48Address
m_address
;
312
Ptr<WifiMacQueue>
m_queue
;
313
Callback<void, Mac48Address, uint8_t, bool>
m_blockAckInactivityTimeout
;
314
Callback<void, Mac48Address, uint8_t>
m_blockPackets
;
315
Callback<void, Mac48Address, uint8_t>
m_unblockPackets
;
316
};
317
318
}
// namespace ns3
319
320
#endif
/* BLOCK_ACK_MANAGER_H */
src
wifi
model
block-ack-manager.h
Generated on Tue Oct 9 2012 16:45:48 for ns-3 by
1.8.1.2