A Discrete-Event Network Simulator
API
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"
30 
31 
32 namespace ns3 {
33 
34 NS_LOG_COMPONENT_DEFINE ("NonCommunicatingNetDevice");
35 
36 NS_OBJECT_ENSURE_REGISTERED (NonCommunicatingNetDevice);
37 
38 TypeId
40 {
41  static TypeId tid = TypeId ("ns3::NonCommunicatingNetDevice")
42  .SetParent<NetDevice> ()
43  .SetGroupName ("Spectrum")
44  .AddConstructor<NonCommunicatingNetDevice> ()
45  .AddAttribute ("Phy", "The PHY layer attached to this device.",
46  PointerValue (),
49  MakePointerChecker<Object> ())
50  ;
51  return tid;
52 }
53 
55 {
56  NS_LOG_FUNCTION (this);
57 }
58 
60 {
61  NS_LOG_FUNCTION (this);
62 }
63 
64 void
66 {
67  NS_LOG_FUNCTION (this);
68  m_node = 0;
69  m_channel = 0;
70  m_phy = 0;
72 }
73 
74 
75 void
77 {
78  NS_LOG_FUNCTION (index);
79  m_ifIndex = index;
80 }
81 
82 uint32_t
84 {
85  NS_LOG_FUNCTION (this);
86  return m_ifIndex;
87 }
88 
89 bool
91 {
92  NS_LOG_FUNCTION (mtu);
93  return (mtu == 0);
94 }
95 
96 uint16_t
98 {
99  NS_LOG_FUNCTION (this);
100  return 0;
101 }
102 
103 void
105 {
106  NS_LOG_FUNCTION (this);
107 }
108 
109 Address
111 {
112  NS_LOG_FUNCTION (this);
113  return Address ();
114 }
115 
116 bool
118 {
119  NS_LOG_FUNCTION (this);
120  return false;
121 }
122 
123 Address
125 {
126  NS_LOG_FUNCTION (this);
127  return Address ();
128 }
129 
130 bool
132 {
133  NS_LOG_FUNCTION (this);
134  return false;
135 }
136 
137 Address
139 {
140  NS_LOG_FUNCTION (addr);
141  return Address ();
142 }
143 
144 Address
146 {
147  NS_LOG_FUNCTION (addr);
148  return Address ();
149 }
150 
151 bool
153 {
154  NS_LOG_FUNCTION (this);
155  return false;
156 }
157 
158 bool
160 {
161  NS_LOG_FUNCTION (this);
162  return false;
163 }
164 
165 
166 Ptr<Node>
168 {
169  NS_LOG_FUNCTION (this);
170  return m_node;
171 }
172 
173 void
175 {
176  NS_LOG_FUNCTION (node);
177 
178  m_node = node;
179 }
180 
181 void
183 {
184  NS_LOG_FUNCTION (this << phy);
185  m_phy = phy;
186 }
187 
188 
191 {
192  NS_LOG_FUNCTION (this);
193  return m_phy;
194 }
195 
196 
197 void
199 {
200  NS_LOG_FUNCTION (this << c);
201  m_channel = c;
202 }
203 
206 {
207  NS_LOG_FUNCTION (this);
208  return m_channel;
209 }
210 
211 
212 bool
214 {
215  NS_LOG_FUNCTION (this);
216  return false;
217 }
218 
219 bool
221 {
222  NS_LOG_FUNCTION (this);
223  return false;
224 }
225 
226 void
228 {
229  NS_LOG_FUNCTION (&callback);
230 }
231 
232 void
234 {
235  NS_LOG_FUNCTION (&cb);
236 }
237 
238 void
240 {
241  NS_LOG_FUNCTION (&cb);
242 }
243 
244 bool
246 {
247  NS_LOG_FUNCTION (this);
248  return false;
249 }
250 
251 
252 bool
253 NonCommunicatingNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNumber)
254 {
255  NS_LOG_FUNCTION (packet << dest << protocolNumber);
256  return false;
257 }
258 
259 bool
260 NonCommunicatingNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
261 {
262  NS_LOG_FUNCTION (packet << src << dest << protocolNumber);
263  return false;
264 }
265 
266 
267 } // namespace ns3
virtual void SetIfIndex(const uint32_t index)
virtual Address GetBroadcast(void) const
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
#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:44
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:201
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
static TypeId GetTypeId(void)
Get the type ID.
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
virtual void SetAddress(Address address)
Set the address of this interface.
This class implements a device which does not communicate, in the sense that it does not interact wit...
a polymophic address class
Definition: address.h:90
virtual Address GetMulticast(Ipv4Address addr) const
Make and return a MAC multicast address using the provided multicast group.
tuple phy
Definition: third.py:86
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:220
virtual void DoDispose(void)
Destructor implementation.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual void AddLinkChangeCallback(Callback< void > callback)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
Definition: pointer.h:36
Ptr< Channel > m_channel
Channel used by the NetDevice.
Describes an IPv6 address.
Definition: ipv6-address.h:48
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Network layer to device interface.
Definition: net-device.h:405
virtual bool SetMtu(const uint16_t mtu)
Ptr< Node > m_node
node this NetDevice is associated to
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual Ptr< Node > GetNode(void) const
virtual uint32_t GetIfIndex(void) const
tuple address
Definition: first.py:37
virtual uint16_t GetMtu(void) const
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:904
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)
virtual Ptr< Channel > GetChannel(void) const