A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
non-communicating-net-device.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010 CTTC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
21
22#include "ns3/boolean.h"
23#include "ns3/channel.h"
24#include "ns3/enum.h"
25#include "ns3/log.h"
26#include "ns3/pointer.h"
27#include "ns3/simulator.h"
28#include "ns3/uinteger.h"
29
30namespace ns3
31{
32
33NS_LOG_COMPONENT_DEFINE("NonCommunicatingNetDevice");
34
35NS_OBJECT_ENSURE_REGISTERED(NonCommunicatingNetDevice);
36
37TypeId
39{
40 static TypeId tid = TypeId("ns3::NonCommunicatingNetDevice")
42 .SetGroupName("Spectrum")
43 .AddConstructor<NonCommunicatingNetDevice>()
44 .AddAttribute("Phy",
45 "The PHY layer attached to this device.",
49 MakePointerChecker<Object>());
50 return tid;
51}
52
54{
55 NS_LOG_FUNCTION(this);
56}
57
59{
60 NS_LOG_FUNCTION(this);
61}
62
63void
65{
66 NS_LOG_FUNCTION(this);
67 m_node = nullptr;
68 m_channel = nullptr;
69 m_phy = nullptr;
71}
72
73void
75{
76 NS_LOG_FUNCTION(index);
77 m_ifIndex = index;
78}
79
82{
83 NS_LOG_FUNCTION(this);
84 return m_ifIndex;
85}
86
87bool
89{
90 NS_LOG_FUNCTION(mtu);
91 return (mtu == 0);
92}
93
94uint16_t
96{
97 NS_LOG_FUNCTION(this);
98 return 0;
99}
100
101void
103{
104 NS_LOG_FUNCTION(this);
105}
106
109{
110 NS_LOG_FUNCTION(this);
111 return Address();
112}
113
114bool
116{
117 NS_LOG_FUNCTION(this);
118 return false;
119}
120
123{
124 NS_LOG_FUNCTION(this);
125 return Address();
126}
127
128bool
130{
131 NS_LOG_FUNCTION(this);
132 return false;
133}
134
137{
138 NS_LOG_FUNCTION(addr);
139 return Address();
140}
141
144{
145 NS_LOG_FUNCTION(addr);
146 return Address();
147}
148
149bool
151{
152 NS_LOG_FUNCTION(this);
153 return false;
154}
155
156bool
158{
159 NS_LOG_FUNCTION(this);
160 return false;
161}
162
165{
166 NS_LOG_FUNCTION(this);
167 return m_node;
168}
169
170void
172{
173 NS_LOG_FUNCTION(node);
174
175 m_node = node;
176}
177
178void
180{
181 NS_LOG_FUNCTION(this << phy);
182 m_phy = phy;
183}
184
187{
188 NS_LOG_FUNCTION(this);
189 return m_phy;
190}
191
192void
194{
195 NS_LOG_FUNCTION(this << c);
196 m_channel = c;
197}
198
201{
202 NS_LOG_FUNCTION(this);
203 return m_channel;
204}
205
206bool
208{
209 NS_LOG_FUNCTION(this);
210 return false;
211}
212
213bool
215{
216 NS_LOG_FUNCTION(this);
217 return false;
218}
219
220void
222{
223 NS_LOG_FUNCTION(&callback);
224}
225
226void
228{
229 NS_LOG_FUNCTION(&cb);
230}
231
232void
234{
235 NS_LOG_FUNCTION(&cb);
236}
237
238bool
240{
241 NS_LOG_FUNCTION(this);
242 return false;
243}
244
245bool
246NonCommunicatingNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
247{
248 NS_LOG_FUNCTION(packet << dest << protocolNumber);
249 return false;
250}
251
252bool
254 const Address& src,
255 const Address& dest,
256 uint16_t protocolNumber)
257{
258 NS_LOG_FUNCTION(packet << src << dest << protocolNumber);
259 return false;
260}
261
262} // namespace ns3
a polymophic address class
Definition: address.h:101
Callback template class.
Definition: callback.h:438
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Describes an IPv6 address.
Definition: ipv6-address.h:49
Network layer to device interface.
Definition: net-device.h:98
This class implements a device which does not communicate, in the sense that it does not interact wit...
Ptr< Node > m_node
node this NetDevice is associated to
void SetIfIndex(const uint32_t index) override
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
void AddLinkChangeCallback(Callback< void > callback) override
Ptr< Channel > GetChannel() const override
Address GetMulticast(Ipv4Address addr) const override
Make and return a MAC multicast address using the provided multicast group.
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
void SetAddress(Address address) override
Set the address of this interface.
Ptr< Channel > m_channel
Channel used by the NetDevice.
bool SetMtu(const uint16_t mtu) override
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
void SetNode(Ptr< Node > node) override
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
bool IsBridge() const override
Return true if the net device is acting as a bridge.
virtual void DoDispose()
Destructor implementation.
Definition: object.cc:444
AttributeValue implementation for Pointer.
Definition: pointer.h:48
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:259
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.