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
wimax-net-device.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008, 2009 INRIA, UDcast
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
* Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19
* Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20
*/
21
22
#ifndef WIMAX_NET_DEVICE_H
23
#define WIMAX_NET_DEVICE_H
24
25
#include "ns3/net-device.h"
26
#include "ns3/event-id.h"
27
#include "ns3/mac48-address.h"
28
#include "
cid.h
"
29
#include "
wimax-connection.h
"
30
#include "
cid-factory.h
"
31
#include "
mac-messages.h
"
32
#include "
dl-mac-messages.h
"
33
#include "
ul-mac-messages.h
"
34
#include "ns3/traced-callback.h"
35
#include "ns3/nstime.h"
36
#include "ns3/log.h"
37
#include "
wimax-phy.h
"
38
#include "
wimax-mac-header.h
"
39
40
namespace
ns3 {
41
42
class
Node;
43
class
Packet;
44
class
TraceContext;
45
class
TraceResolver;
46
class
Channel;
47
class
WimaxChannel;
48
class
PacketBurst;
49
class
BurstProfileManager;
50
class
ConnectionManager;
51
class
ServiceFlowManager;
52
class
BandwidthManager;
53
class
UplinkScheduler;
54
69
class
WimaxNetDevice
:
public
NetDevice
70
{
71
public
:
72
enum
Direction
73
{
74
DIRECTION_DOWNLINK
,
DIRECTION_UPLINK
75
};
76
77
enum
RangingStatus
78
{
79
RANGING_STATUS_EXPIRED
,
RANGING_STATUS_CONTINUE
,
RANGING_STATUS_ABORT
,
RANGING_STATUS_SUCCESS
80
};
81
82
static
TypeId
GetTypeId
(
void
);
83
WimaxNetDevice
(
void
);
84
virtual
~WimaxNetDevice
(
void
);
88
void
SetTtg
(uint16_t ttg);
92
uint16_t
GetTtg
(
void
)
const
;
96
void
SetRtg
(uint16_t rtg);
100
uint16_t
GetRtg
(
void
)
const
;
101
void
Attach
(
Ptr<WimaxChannel>
channel);
105
void
SetPhy
(
Ptr<WimaxPhy>
phy);
109
Ptr<WimaxPhy>
GetPhy
(
void
)
const
;
110
114
void
SetChannel
(
Ptr<WimaxChannel>
wimaxChannel);
115
116
uint64_t
GetChannel
(uint8_t index)
const
;
117
118
void
SetNrFrames
(uint32_t nrFrames);
119
uint32_t
GetNrFrames
(
void
)
const
;
123
void
SetMacAddress
(
Mac48Address
address);
127
Mac48Address
GetMacAddress
(
void
)
const
;
128
void
SetState
(uint8_t state);
129
uint8_t
GetState
(
void
)
const
;
133
Ptr<WimaxConnection>
GetInitialRangingConnection
(
void
)
const
;
137
Ptr<WimaxConnection>
GetBroadcastConnection
(
void
)
const
;
138
139
void
SetCurrentDcd
(
Dcd
dcd);
140
Dcd
GetCurrentDcd
(
void
)
const
;
141
void
SetCurrentUcd
(
Ucd
ucd);
142
Ucd
GetCurrentUcd
(
void
)
const
;
146
Ptr<ConnectionManager>
GetConnectionManager
(
void
)
const
;
147
151
virtual
void
SetConnectionManager
(
Ptr<ConnectionManager>
connectionManager );
152
156
Ptr<BurstProfileManager>
GetBurstProfileManager
(
void
)
const
;
157
161
void
SetBurstProfileManager
(
Ptr<BurstProfileManager>
burstProfileManager);
162
166
Ptr<BandwidthManager>
GetBandwidthManager
(
void
)
const
;
167
171
void
SetBandwidthManager
(
Ptr<BandwidthManager>
bandwidthManager);
172
173
/*
174
* \brief Creates the initial ranging and broadcast connections
175
*/
176
void
CreateDefaultConnections
(
void
);
177
178
virtual
void
Start
(
void
) = 0;
179
virtual
void
Stop
(
void
) = 0;
180
181
void
SetReceiveCallback
(
void
);
182
183
void
ForwardUp
(
Ptr<Packet>
packet,
const
Mac48Address
&source,
const
Mac48Address
&dest);
184
185
virtual
bool
Enqueue
(
Ptr<Packet>
packet,
const
MacHeaderType
&hdrType,
Ptr<WimaxConnection>
connection) = 0;
186
void
ForwardDown
(
Ptr<PacketBurst>
burst,
WimaxPhy::ModulationType
modulationType);
187
188
// temp, shall be private
189
static
uint8_t
m_direction
;
// downlink or uplink
190
191
static
Time
m_frameStartTime
;
// temp, to determine the frame start time at SS side, shall actually be determined by frame start preamble
192
193
virtual
void
SetName
(
const
std::string name);
194
virtual
std::string
GetName
(
void
)
const
;
195
virtual
void
SetIfIndex
(
const
uint32_t index);
196
virtual
uint32_t
GetIfIndex
(
void
)
const
;
197
virtual
Ptr<Channel>
GetPhyChannel
(
void
)
const
;
198
virtual
Ptr<Channel>
GetChannel
(
void
)
const
;
199
virtual
void
SetAddress
(
Address
address);
200
virtual
Address
GetAddress
(
void
)
const
;
201
virtual
bool
SetMtu
(
const
uint16_t mtu);
202
virtual
uint16_t
GetMtu
(
void
)
const
;
203
virtual
bool
IsLinkUp
(
void
)
const
;
204
virtual
void
SetLinkChangeCallback
(
Callback<void>
callback);
205
virtual
bool
IsBroadcast
(
void
)
const
;
206
virtual
Address
GetBroadcast
(
void
)
const
;
207
virtual
bool
IsMulticast
(
void
)
const
;
208
virtual
Address
GetMulticast
(
void
)
const
;
209
virtual
Address
MakeMulticastAddress
(
Ipv4Address
multicastGroup)
const
;
210
virtual
bool
IsPointToPoint
(
void
)
const
;
211
virtual
bool
Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber);
212
virtual
void
SetNode
(
Ptr<Node>
node);
213
virtual
Ptr<Node>
GetNode
(
void
)
const
;
214
virtual
bool
NeedsArp
(
void
)
const
;
215
virtual
void
SetReceiveCallback
(
NetDevice::ReceiveCallback
cb);
216
virtual
void
AddLinkChangeCallback
(
Callback<void>
callback);
217
virtual
bool
SendFrom
(
Ptr<Packet>
packet,
const
Address
& source,
const
Address
& dest, uint16_t protocolNumber);
218
virtual
void
SetPromiscReceiveCallback
(
PromiscReceiveCallback
cb);
219
NetDevice::PromiscReceiveCallback
GetPromiscReceiveCallback
(
void
);
220
virtual
bool
SupportsSendFrom
(
void
)
const
;
221
222
TracedCallback<Ptr<const Packet>
,
const
Mac48Address
&>
m_traceRx
;
223
TracedCallback<Ptr<const Packet>
,
const
Mac48Address
&>
m_traceTx
;
224
225
virtual
void
DoDispose
(
void
);
226
virtual
Address
GetMulticast
(
Ipv6Address
addr)
const
;
227
virtual
Address
GetMulticast
(
Ipv4Address
multicastGroup)
const
;
228
virtual
bool
IsBridge
(
void
)
const
;
229
230
bool
IsPromisc
(
void
);
231
void
NotifyPromiscTrace
(
Ptr<Packet>
p);
232
233
private
:
234
WimaxNetDevice
(
const
WimaxNetDevice
&);
235
WimaxNetDevice
&
operator=
(
const
WimaxNetDevice
&);
236
237
static
const
uint16_t
MAX_MSDU_SIZE
= 1500;
238
// recommended by wimax forum.
239
static
const
uint16_t
DEFAULT_MSDU_SIZE
= 1400;
240
241
virtual
bool
DoSend
(
Ptr<Packet>
packet,
242
const
Mac48Address
& source,
243
const
Mac48Address
& dest,
244
uint16_t protocolNumber) = 0;
245
virtual
void
DoReceive
(
Ptr<Packet>
packet) = 0;
246
virtual
Ptr<WimaxChannel>
DoGetChannel
(
void
)
const
;
247
void
Receive
(
Ptr<const PacketBurst>
burst);
248
void
InitializeChannels
(
void
);
249
250
Ptr<Node>
m_node
;
251
Ptr<WimaxPhy>
m_phy
;
252
NetDevice::ReceiveCallback
m_forwardUp
;
253
NetDevice::PromiscReceiveCallback
m_promiscRx
;
254
255
uint32_t
m_ifIndex
;
256
std::string
m_name
;
257
bool
m_linkUp
;
258
Callback<void>
m_linkChange
;
259
mutable
uint16_t
m_mtu
;
260
261
// temp, shall be in BS. defined here to allow SS to access. SS shall actually determine it from DLFP, shall be moved to BS after DLFP is implemented
262
static
uint32_t
m_nrFrames
;
263
264
// not sure if it shall be included here
265
std::vector<uint64_t>
m_dlChannels
;
266
267
Mac48Address
m_address
;
268
uint8_t
m_state
;
269
uint32_t
m_symbolIndex
;
270
271
// length of TTG and RTG, in units of PSs
272
uint16_t
m_ttg
;
273
uint16_t
m_rtg
;
274
275
Dcd
m_currentDcd
;
276
Ucd
m_currentUcd
;
277
278
Ptr<WimaxConnection>
m_initialRangingConnection
;
279
Ptr<WimaxConnection>
m_broadcastConnection
;
280
281
Ptr<ConnectionManager>
m_connectionManager
;
282
Ptr<BurstProfileManager>
m_burstProfileManager
;
283
Ptr<BandwidthManager>
m_bandwidthManager
;
284
285
Ptr<Object>
m_mobility
;
286
287
};
288
289
}
// namespace ns3
290
291
#endif
/* WIMAX_NET_DEVICE_H */
src
wimax
model
wimax-net-device.h
Generated on Tue Nov 13 2012 10:32:26 for ns-3 by
1.8.1.2