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
non-communicating-net-device.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2010 CTTC
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
#include "ns3/log.h"
22
#include "ns3/queue.h"
23
#include "ns3/simulator.h"
24
#include "ns3/enum.h"
25
#include "ns3/boolean.h"
26
#include "ns3/uinteger.h"
27
#include "ns3/pointer.h"
28
#include "ns3/channel.h"
29
#include "
non-communicating-net-device.h
"
30
31
32
NS_LOG_COMPONENT_DEFINE
(
"NonCommunicatingNetDevice"
);
33
34
35
namespace
ns3 {
36
37
38
39
NS_OBJECT_ENSURE_REGISTERED
(NonCommunicatingNetDevice);
40
41
TypeId
42
NonCommunicatingNetDevice::GetTypeId
(
void
)
43
{
44
static
TypeId
tid =
TypeId
(
"ns3::NonCommunicatingNetDevice"
)
45
.
SetParent
<
NetDevice
> ()
46
.AddConstructor<NonCommunicatingNetDevice> ()
47
.AddAttribute (
"Phy"
,
"The PHY layer attached to this device."
,
48
PointerValue
(),
49
MakePointerAccessor (&
NonCommunicatingNetDevice::GetPhy
,
50
&
NonCommunicatingNetDevice::SetPhy
),
51
MakePointerChecker<Object> ())
52
;
53
return
tid;
54
}
55
56
NonCommunicatingNetDevice::NonCommunicatingNetDevice
()
57
{
58
NS_LOG_FUNCTION
(
this
);
59
}
60
61
NonCommunicatingNetDevice::~NonCommunicatingNetDevice
()
62
{
63
NS_LOG_FUNCTION
(
this
);
64
}
65
66
void
67
NonCommunicatingNetDevice::DoDispose
()
68
{
69
NS_LOG_FUNCTION
(
this
);
70
m_node
= 0;
71
m_channel
= 0;
72
m_phy
= 0;
73
NetDevice::DoDispose
();
74
}
75
76
77
void
78
NonCommunicatingNetDevice::SetIfIndex
(
const
uint32_t index)
79
{
80
NS_LOG_FUNCTION
(index);
81
m_ifIndex
= index;
82
}
83
84
uint32_t
85
NonCommunicatingNetDevice::GetIfIndex
(
void
)
const
86
{
87
NS_LOG_FUNCTION
(
this
);
88
return
m_ifIndex
;
89
}
90
91
bool
92
NonCommunicatingNetDevice::SetMtu
(uint16_t mtu)
93
{
94
NS_LOG_FUNCTION
(mtu);
95
return
(mtu == 0);
96
}
97
98
uint16_t
99
NonCommunicatingNetDevice::GetMtu
(
void
)
const
100
{
101
NS_LOG_FUNCTION
(
this
);
102
return
0;
103
}
104
105
void
106
NonCommunicatingNetDevice::SetAddress
(
Address
address)
107
{
108
NS_LOG_FUNCTION
(
this
);
109
}
110
111
Address
112
NonCommunicatingNetDevice::GetAddress
(
void
)
const
113
{
114
NS_LOG_FUNCTION
(
this
);
115
return
Address
();
116
}
117
118
bool
119
NonCommunicatingNetDevice::IsBroadcast
(
void
)
const
120
{
121
NS_LOG_FUNCTION
(
this
);
122
return
false
;
123
}
124
125
Address
126
NonCommunicatingNetDevice::GetBroadcast
(
void
)
const
127
{
128
NS_LOG_FUNCTION
(
this
);
129
return
Address
();
130
}
131
132
bool
133
NonCommunicatingNetDevice::IsMulticast
(
void
)
const
134
{
135
NS_LOG_FUNCTION
(
this
);
136
return
false
;
137
}
138
139
Address
140
NonCommunicatingNetDevice::GetMulticast
(
Ipv4Address
addr)
const
141
{
142
NS_LOG_FUNCTION
(addr);
143
return
Address
();
144
}
145
146
Address
147
NonCommunicatingNetDevice::GetMulticast
(
Ipv6Address
addr)
const
148
{
149
NS_LOG_FUNCTION
(addr);
150
return
Address
();
151
}
152
153
bool
154
NonCommunicatingNetDevice::IsPointToPoint
(
void
)
const
155
{
156
NS_LOG_FUNCTION
(
this
);
157
return
false
;
158
}
159
160
bool
161
NonCommunicatingNetDevice::IsBridge
(
void
)
const
162
{
163
NS_LOG_FUNCTION
(
this
);
164
return
false
;
165
}
166
167
168
Ptr<Node>
169
NonCommunicatingNetDevice::GetNode
(
void
)
const
170
{
171
NS_LOG_FUNCTION
(
this
);
172
return
m_node
;
173
}
174
175
void
176
NonCommunicatingNetDevice::SetNode
(
Ptr<Node>
node)
177
{
178
NS_LOG_FUNCTION
(node);
179
180
m_node
= node;
181
}
182
183
void
184
NonCommunicatingNetDevice::SetPhy
(
Ptr<Object>
phy)
185
{
186
NS_LOG_FUNCTION
(
this
<< phy);
187
m_phy
= phy;
188
}
189
190
191
Ptr<Object>
192
NonCommunicatingNetDevice::GetPhy
()
const
193
{
194
NS_LOG_FUNCTION
(
this
);
195
return
m_phy
;
196
}
197
198
199
void
200
NonCommunicatingNetDevice::SetChannel
(
Ptr<Channel>
c)
201
{
202
NS_LOG_FUNCTION
(
this
<< c);
203
m_channel
= c;
204
}
205
206
Ptr<Channel>
207
NonCommunicatingNetDevice::GetChannel
(
void
)
const
208
{
209
NS_LOG_FUNCTION
(
this
);
210
return
m_channel
;
211
}
212
213
214
bool
215
NonCommunicatingNetDevice::NeedsArp
(
void
)
const
216
{
217
NS_LOG_FUNCTION
(
this
);
218
return
false
;
219
}
220
221
bool
222
NonCommunicatingNetDevice::IsLinkUp
(
void
)
const
223
{
224
NS_LOG_FUNCTION
(
this
);
225
return
false
;
226
}
227
228
void
229
NonCommunicatingNetDevice::AddLinkChangeCallback
(
Callback<void>
callback)
230
{
231
NS_LOG_FUNCTION
(&callback);
232
}
233
234
void
235
NonCommunicatingNetDevice::SetReceiveCallback
(
NetDevice::ReceiveCallback
cb)
236
{
237
NS_LOG_FUNCTION
(&cb);
238
}
239
240
void
241
NonCommunicatingNetDevice::SetPromiscReceiveCallback
(
NetDevice::PromiscReceiveCallback
cb)
242
{
243
NS_LOG_FUNCTION
(&cb);
244
}
245
246
bool
247
NonCommunicatingNetDevice::SupportsSendFrom
()
const
248
{
249
NS_LOG_FUNCTION
(
this
);
250
return
false
;
251
}
252
253
254
bool
255
NonCommunicatingNetDevice::Send
(
Ptr<Packet>
packet,
const
Address
& dest, uint16_t protocolNumber)
256
{
257
NS_LOG_FUNCTION
(packet << dest << protocolNumber);
258
return
false
;
259
}
260
261
bool
262
NonCommunicatingNetDevice::SendFrom
(
Ptr<Packet>
packet,
const
Address
& src,
const
Address
& dest, uint16_t protocolNumber)
263
{
264
NS_LOG_FUNCTION
(packet << src << dest << protocolNumber);
265
return
false
;
266
}
267
268
269
}
// namespace ns3
src
spectrum
model
non-communicating-net-device.cc
Generated on Tue Nov 13 2012 10:32:22 for ns-3 by
1.8.1.2