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/simulator.h"
23 #include "ns3/enum.h"
24 #include "ns3/boolean.h"
25 #include "ns3/uinteger.h"
26 #include "ns3/pointer.h"
27 #include "ns3/channel.h"
29 
30 
31 namespace ns3 {
32 
33 NS_LOG_COMPONENT_DEFINE ("NonCommunicatingNetDevice");
34 
35 NS_OBJECT_ENSURE_REGISTERED (NonCommunicatingNetDevice);
36 
37 TypeId
39 {
40  static TypeId tid = TypeId ("ns3::NonCommunicatingNetDevice")
41  .SetParent<NetDevice> ()
42  .SetGroupName ("Spectrum")
43  .AddConstructor<NonCommunicatingNetDevice> ()
44  .AddAttribute ("Phy", "The PHY layer attached to this device.",
45  PointerValue (),
48  MakePointerChecker<Object> ())
49  ;
50  return tid;
51 }
52 
54 {
55  NS_LOG_FUNCTION (this);
56 }
57 
59 {
60  NS_LOG_FUNCTION (this);
61 }
62 
63 void
65 {
66  NS_LOG_FUNCTION (this);
67  m_node = 0;
68  m_channel = 0;
69  m_phy = 0;
71 }
72 
73 
74 void
76 {
77  NS_LOG_FUNCTION (index);
78  m_ifIndex = index;
79 }
80 
81 uint32_t
83 {
84  NS_LOG_FUNCTION (this);
85  return m_ifIndex;
86 }
87 
88 bool
90 {
91  NS_LOG_FUNCTION (mtu);
92  return (mtu == 0);
93 }
94 
95 uint16_t
97 {
98  NS_LOG_FUNCTION (this);
99  return 0;
100 }
101 
102 void
104 {
105  NS_LOG_FUNCTION (this);
106 }
107 
108 Address
110 {
111  NS_LOG_FUNCTION (this);
112  return Address ();
113 }
114 
115 bool
117 {
118  NS_LOG_FUNCTION (this);
119  return false;
120 }
121 
122 Address
124 {
125  NS_LOG_FUNCTION (this);
126  return Address ();
127 }
128 
129 bool
131 {
132  NS_LOG_FUNCTION (this);
133  return false;
134 }
135 
136 Address
138 {
139  NS_LOG_FUNCTION (addr);
140  return Address ();
141 }
142 
143 Address
145 {
146  NS_LOG_FUNCTION (addr);
147  return Address ();
148 }
149 
150 bool
152 {
153  NS_LOG_FUNCTION (this);
154  return false;
155 }
156 
157 bool
159 {
160  NS_LOG_FUNCTION (this);
161  return false;
162 }
163 
164 
165 Ptr<Node>
167 {
168  NS_LOG_FUNCTION (this);
169  return m_node;
170 }
171 
172 void
174 {
175  NS_LOG_FUNCTION (node);
176 
177  m_node = node;
178 }
179 
180 void
182 {
183  NS_LOG_FUNCTION (this << phy);
184  m_phy = phy;
185 }
186 
187 
190 {
191  NS_LOG_FUNCTION (this);
192  return m_phy;
193 }
194 
195 
196 void
198 {
199  NS_LOG_FUNCTION (this << c);
200  m_channel = c;
201 }
202 
205 {
206  NS_LOG_FUNCTION (this);
207  return m_channel;
208 }
209 
210 
211 bool
213 {
214  NS_LOG_FUNCTION (this);
215  return false;
216 }
217 
218 bool
220 {
221  NS_LOG_FUNCTION (this);
222  return false;
223 }
224 
225 void
227 {
228  NS_LOG_FUNCTION (&callback);
229 }
230 
231 void
233 {
234  NS_LOG_FUNCTION (&cb);
235 }
236 
237 void
239 {
240  NS_LOG_FUNCTION (&cb);
241 }
242 
243 bool
245 {
246  NS_LOG_FUNCTION (this);
247  return false;
248 }
249 
250 
251 bool
252 NonCommunicatingNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNumber)
253 {
254  NS_LOG_FUNCTION (packet << dest << protocolNumber);
255  return false;
256 }
257 
258 bool
259 NonCommunicatingNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
260 {
261  NS_LOG_FUNCTION (packet << src << dest << protocolNumber);
262  return false;
263 }
264 
265 
266 } // namespace ns3
virtual void SetIfIndex(const uint32_t index)
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:45
void SetChannel(Ptr< Channel > c)
This class doesn&#39;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:204
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
phy
Definition: third.py:86
virtual Ptr< Node > GetNode(void) const
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
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 void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual Ptr< Channel > GetChannel(void) const
virtual void AddLinkChangeCallback(Callback< void > callback)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
address
Definition: first.py:37
virtual uint32_t GetIfIndex(void) const
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
Ptr< Channel > m_channel
Channel used by the NetDevice.
Describes an IPv6 address.
Definition: ipv6-address.h:49
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:95
virtual bool SetMtu(const uint16_t mtu)
Ptr< Node > m_node
node this NetDevice is associated to
virtual Address GetMulticast(Ipv4Address addr) const
Make and return a MAC multicast address using the provided multicast group.
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)