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
aloha-noack-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) 2010
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: Nicola Baldo <nbaldo@cttc.es>
19
*/
20
21
#ifndef ALOHA_NOACK_NET_DEVICE_H
22
#define ALOHA_NOACK_NET_DEVICE_H
23
24
#include <
string.h
>
25
#include <ns3/node.h>
26
#include <ns3/address.h>
27
#include <ns3/net-device.h>
28
#include <ns3/callback.h>
29
#include <ns3/packet.h>
30
#include <ns3/traced-callback.h>
31
#include <ns3/nstime.h>
32
#include <ns3/ptr.h>
33
#include <ns3/mac48-address.h>
34
#include <ns3/generic-phy.h>
35
36
namespace
ns3 {
37
38
39
class
SpectrumChannel;
40
class
Channel;
41
class
SpectrumErrorModel;
42
class
Queue;
43
44
45
59
class
AlohaNoackNetDevice
:
public
NetDevice
60
{
61
public
:
62
enum
State
63
{
64
IDLE
,
TX
,
RX
65
};
66
67
static
TypeId
GetTypeId
(
void
);
68
69
AlohaNoackNetDevice
();
70
virtual
~AlohaNoackNetDevice
();
71
72
78
virtual
void
SetQueue
(
Ptr<Queue>
queue);
79
80
85
void
NotifyTransmissionEnd
(
Ptr<const Packet>
);
86
91
void
NotifyReceptionStart
();
92
93
98
void
NotifyReceptionEndError
();
99
105
void
NotifyReceptionEndOk
(
Ptr<Packet>
p);
106
107
117
void
SetChannel
(
Ptr<Channel>
c);
118
119
125
void
SetGenericPhyTxStartCallback
(
GenericPhyTxStartCallback
c);
126
127
128
140
void
SetPhy
(
Ptr<Object>
phy);
141
145
Ptr<Object>
GetPhy
()
const
;
146
147
148
149
// inherited from NetDevice
150
virtual
void
SetIfIndex
(
const
uint32_t index);
151
virtual
uint32_t
GetIfIndex
(
void
)
const
;
152
virtual
Ptr<Channel>
GetChannel
(
void
)
const
;
153
virtual
bool
SetMtu
(
const
uint16_t mtu);
154
virtual
uint16_t
GetMtu
(
void
)
const
;
155
virtual
void
SetAddress
(
Address
address);
156
virtual
Address
GetAddress
(
void
)
const
;
157
virtual
bool
IsLinkUp
(
void
)
const
;
158
virtual
void
AddLinkChangeCallback
(
Callback<void>
callback);
159
virtual
bool
IsBroadcast
(
void
)
const
;
160
virtual
Address
GetBroadcast
(
void
)
const
;
161
virtual
bool
IsMulticast
(
void
)
const
;
162
virtual
bool
IsPointToPoint
(
void
)
const
;
163
virtual
bool
IsBridge
(
void
)
const
;
164
virtual
bool
Send
(
Ptr<Packet>
packet,
const
Address
& dest,
165
uint16_t protocolNumber);
166
virtual
bool
SendFrom
(
Ptr<Packet>
packet,
const
Address
& source,
const
Address
& dest,
167
uint16_t protocolNumber);
168
virtual
Ptr<Node>
GetNode
(
void
)
const
;
169
virtual
void
SetNode
(
Ptr<Node>
node);
170
virtual
bool
NeedsArp
(
void
)
const
;
171
virtual
void
SetReceiveCallback
(
NetDevice::ReceiveCallback
cb);
172
virtual
Address
GetMulticast
(
Ipv4Address
addr)
const
;
173
virtual
Address
GetMulticast
(
Ipv6Address
addr)
const
;
174
virtual
void
SetPromiscReceiveCallback
(
PromiscReceiveCallback
cb);
175
virtual
bool
SupportsSendFrom
(
void
)
const
;
176
177
178
179
180
181
private
:
182
void
NotifyGuardIntervalEnd
();
183
virtual
void
DoDispose
(
void
);
184
189
void
StartTransmission
();
190
191
192
Ptr<Queue>
m_queue
;
193
194
TracedCallback<Ptr<const Packet>
>
m_macTxTrace
;
195
TracedCallback<Ptr<const Packet>
>
m_macTxDropTrace
;
196
TracedCallback<Ptr<const Packet>
>
m_macPromiscRxTrace
;
197
TracedCallback<Ptr<const Packet>
>
m_macRxTrace
;
198
199
Ptr<Node>
m_node
;
200
Ptr<Channel>
m_channel
;
201
202
Mac48Address
m_address
;
203
204
NetDevice::ReceiveCallback
m_rxCallback
;
205
NetDevice::PromiscReceiveCallback
m_promiscRxCallback
;
206
207
GenericPhyTxStartCallback
m_phyMacTxStartCallback
;
208
212
TracedCallback<>
m_linkChangeCallbacks
;
213
214
215
uint32_t
m_ifIndex
;
216
mutable
uint32_t
m_mtu
;
217
bool
m_linkUp
;
218
219
220
State
m_state
;
221
222
Ptr<Packet>
m_currentPkt
;
223
224
Ptr<Object>
m_phy
;
225
};
226
227
228
}
// namespace ns3
229
230
#endif
/* ALOHA_NOACK_NET_DEVICE_H */
src
spectrum
model
aloha-noack-net-device.h
Generated on Tue Oct 9 2012 16:45:46 for ns-3 by
1.8.1.2