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
dca-txop.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#ifndef DCA_TXOP_H
22
#define DCA_TXOP_H
23
24
#include <stdint.h>
25
#include "ns3/callback.h"
26
#include "ns3/packet.h"
27
#include "ns3/nstime.h"
28
#include "ns3/object.h"
29
#include "ns3/wifi-mac-header.h"
30
#include "ns3/wifi-mode.h"
31
#include "ns3/wifi-remote-station-manager.h"
32
#include "ns3/dcf.h"
33
34
namespace
ns3 {
35
36
class
DcfState;
37
class
DcfManager;
38
class
WifiMacQueue;
39
class
MacLow;
40
class
WifiMacParameters;
41
class
MacTxMiddle;
42
class
RandomStream;
43
class
MacStation;
44
class
MacStations;
45
67
class
DcaTxop
:
public
Dcf
68
{
69
public
:
70
static
TypeId
GetTypeId
(
void
);
71
72
typedef
Callback <void, const WifiMacHeader&>
TxOk
;
73
typedef
Callback <void, const WifiMacHeader&>
TxFailed
;
74
75
DcaTxop
();
76
~DcaTxop
();
77
78
void
SetLow
(
Ptr<MacLow>
low);
79
void
SetManager
(
DcfManager
*manager);
80
void
SetWifiRemoteStationManager
(
Ptr<WifiRemoteStationManager>
remoteManager);
81
86
void
SetTxOkCallback
(
TxOk
callback);
91
void
SetTxFailedCallback
(
TxFailed
callback);
92
93
Ptr<WifiMacQueue >
GetQueue
()
const
;
94
virtual
void
SetMinCw
(uint32_t minCw);
95
virtual
void
SetMaxCw
(uint32_t maxCw);
96
virtual
void
SetAifsn
(uint32_t aifsn);
97
virtual
uint32_t
GetMinCw
(
void
)
const
;
98
virtual
uint32_t
GetMaxCw
(
void
)
const
;
99
virtual
uint32_t
GetAifsn
(
void
)
const
;
100
108
void
Queue
(
Ptr<const Packet>
packet,
const
WifiMacHeader
&hdr);
109
118
int64_t
AssignStreams
(int64_t stream);
119
120
private
:
121
class
TransmissionListener
;
122
class
NavListener;
123
class
PhyListener
;
124
class
Dcf
;
125
friend
class
Dcf
;
126
friend
class
TransmissionListener
;
127
128
DcaTxop
&
operator =
(
const
DcaTxop
&);
129
DcaTxop
(
const
DcaTxop
&o);
130
131
// Inherited from ns3::Object
132
Ptr<MacLow>
Low
(
void
);
133
void
DoStart
();
134
/* dcf notifications forwarded here */
135
bool
NeedsAccess
(
void
)
const
;
136
void
NotifyAccessGranted
(
void
);
137
void
NotifyInternalCollision
(
void
);
138
void
NotifyCollision
(
void
);
142
void
NotifyChannelSwitching
(
void
);
143
/* event handlers */
144
void
GotCts
(
double
snr,
WifiMode
txMode);
145
void
MissedCts
(
void
);
146
void
GotAck
(
double
snr,
WifiMode
txMode);
147
void
MissedAck
(
void
);
148
void
StartNext
(
void
);
149
void
Cancel
(
void
);
150
151
void
RestartAccessIfNeeded
(
void
);
152
void
StartAccessIfNeeded
(
void
);
153
bool
NeedRts
(
Ptr<const Packet>
packet,
const
WifiMacHeader
*header);
154
bool
NeedRtsRetransmission
(
void
);
155
bool
NeedDataRetransmission
(
void
);
156
bool
NeedFragmentation
(
void
);
157
uint32_t
GetNextFragmentSize
(
void
);
158
uint32_t
GetFragmentSize
(
void
);
159
uint32_t
GetFragmentOffset
(
void
);
160
bool
IsLastFragment
(
void
);
161
void
NextFragment
(
void
);
162
Ptr<Packet>
GetFragmentPacket
(
WifiMacHeader
*hdr);
163
virtual
void
DoDispose
(
void
);
164
165
Dcf
*
m_dcf
;
166
DcfManager
*
m_manager
;
167
TxOk
m_txOkCallback
;
168
TxFailed
m_txFailedCallback
;
169
Ptr<WifiMacQueue>
m_queue
;
170
MacTxMiddle
*
m_txMiddle
;
171
Ptr <MacLow>
m_low
;
172
Ptr<WifiRemoteStationManager>
m_stationManager
;
173
TransmissionListener
*
m_transmissionListener
;
174
RandomStream
*
m_rng
;
175
176
bool
m_accessOngoing
;
177
Ptr<const Packet>
m_currentPacket
;
178
WifiMacHeader
m_currentHdr
;
179
uint8_t
m_fragmentNumber
;
180
};
181
182
}
// namespace ns3
183
184
185
186
#endif
/* DCA_TXOP_H */
src
wifi
model
dca-txop.h
Generated on Tue Nov 13 2012 10:32:24 for ns-3 by
1.8.1.2