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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Nicola Baldo <nbaldo@cttc.es>
7 */
8
10
11#include "ns3/boolean.h"
12#include "ns3/channel.h"
13#include "ns3/enum.h"
14#include "ns3/log.h"
15#include "ns3/pointer.h"
16#include "ns3/simulator.h"
17#include "ns3/uinteger.h"
18
19namespace ns3
20{
21
22NS_LOG_COMPONENT_DEFINE("NonCommunicatingNetDevice");
23
24NS_OBJECT_ENSURE_REGISTERED(NonCommunicatingNetDevice);
25
26TypeId
28{
29 static TypeId tid = TypeId("ns3::NonCommunicatingNetDevice")
31 .SetGroupName("Spectrum")
32 .AddConstructor<NonCommunicatingNetDevice>()
33 .AddAttribute("Phy",
34 "The PHY layer attached to this device.",
39 return tid;
40}
41
46
51
52void
54{
55 NS_LOG_FUNCTION(this);
56 m_node = nullptr;
57 m_channel = nullptr;
58 m_phy = nullptr;
60}
61
62void
64{
65 NS_LOG_FUNCTION(index);
66 m_ifIndex = index;
67}
68
75
76bool
78{
79 NS_LOG_FUNCTION(mtu);
80 return (mtu == 0);
81}
82
83uint16_t
85{
86 NS_LOG_FUNCTION(this);
87 return 0;
88}
89
90void
95
98{
99 NS_LOG_FUNCTION(this);
100 return Address();
101}
102
103bool
105{
106 NS_LOG_FUNCTION(this);
107 return false;
108}
109
112{
113 NS_LOG_FUNCTION(this);
114 return Address();
115}
116
117bool
119{
120 NS_LOG_FUNCTION(this);
121 return false;
122}
123
126{
127 NS_LOG_FUNCTION(addr);
128 return Address();
129}
130
133{
134 NS_LOG_FUNCTION(addr);
135 return Address();
136}
137
138bool
140{
141 NS_LOG_FUNCTION(this);
142 return false;
143}
144
145bool
147{
148 NS_LOG_FUNCTION(this);
149 return false;
150}
151
154{
155 NS_LOG_FUNCTION(this);
156 return m_node;
157}
158
159void
161{
162 NS_LOG_FUNCTION(node);
163
164 m_node = node;
165}
166
167void
169{
170 NS_LOG_FUNCTION(this << phy);
171 m_phy = phy;
172}
173
176{
177 NS_LOG_FUNCTION(this);
178 return m_phy;
179}
180
181void
187
190{
191 NS_LOG_FUNCTION(this);
192 return m_channel;
193}
194
195bool
197{
198 NS_LOG_FUNCTION(this);
199 return false;
200}
201
202bool
204{
205 NS_LOG_FUNCTION(this);
206 return false;
207}
208
209void
214
215void
220
221void
226
227bool
229{
230 NS_LOG_FUNCTION(this);
231 return false;
232}
233
234bool
235NonCommunicatingNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
236{
237 NS_LOG_FUNCTION(packet << dest << protocolNumber);
238 return false;
239}
240
241bool
243 const Address& src,
244 const Address& dest,
245 uint16_t protocolNumber)
246{
247 NS_LOG_FUNCTION(packet << src << dest << protocolNumber);
248 return false;
249}
250
251} // namespace ns3
a polymophic address class
Definition address.h:90
Callback template class.
Definition callback.h:422
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
Network layer to device interface.
Definition net-device.h:87
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:433
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition pointer.h:248
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
Definition pointer.h:269
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#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:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.