A Discrete-Event Network Simulator
API
 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"
30 
31 
32 NS_LOG_COMPONENT_DEFINE ("NonCommunicatingNetDevice");
33 
34 
35 namespace ns3 {
36 
37 
38 
39 NS_OBJECT_ENSURE_REGISTERED (NonCommunicatingNetDevice)
40  ;
41 
42 TypeId
44 {
45  static TypeId tid = TypeId ("ns3::NonCommunicatingNetDevice")
46  .SetParent<NetDevice> ()
47  .AddConstructor<NonCommunicatingNetDevice> ()
48  .AddAttribute ("Phy", "The PHY layer attached to this device.",
49  PointerValue (),
50  MakePointerAccessor (&NonCommunicatingNetDevice::GetPhy,
52  MakePointerChecker<Object> ())
53  ;
54  return tid;
55 }
56 
58 {
59  NS_LOG_FUNCTION (this);
60 }
61 
63 {
64  NS_LOG_FUNCTION (this);
65 }
66 
67 void
69 {
70  NS_LOG_FUNCTION (this);
71  m_node = 0;
72  m_channel = 0;
73  m_phy = 0;
75 }
76 
77 
78 void
80 {
81  NS_LOG_FUNCTION (index);
82  m_ifIndex = index;
83 }
84 
85 uint32_t
87 {
88  NS_LOG_FUNCTION (this);
89  return m_ifIndex;
90 }
91 
92 bool
94 {
95  NS_LOG_FUNCTION (mtu);
96  return (mtu == 0);
97 }
98 
99 uint16_t
101 {
102  NS_LOG_FUNCTION (this);
103  return 0;
104 }
105 
106 void
108 {
109  NS_LOG_FUNCTION (this);
110 }
111 
112 Address
114 {
115  NS_LOG_FUNCTION (this);
116  return Address ();
117 }
118 
119 bool
121 {
122  NS_LOG_FUNCTION (this);
123  return false;
124 }
125 
126 Address
128 {
129  NS_LOG_FUNCTION (this);
130  return Address ();
131 }
132 
133 bool
135 {
136  NS_LOG_FUNCTION (this);
137  return false;
138 }
139 
140 Address
142 {
143  NS_LOG_FUNCTION (addr);
144  return Address ();
145 }
146 
147 Address
149 {
150  NS_LOG_FUNCTION (addr);
151  return Address ();
152 }
153 
154 bool
156 {
157  NS_LOG_FUNCTION (this);
158  return false;
159 }
160 
161 bool
163 {
164  NS_LOG_FUNCTION (this);
165  return false;
166 }
167 
168 
169 Ptr<Node>
171 {
172  NS_LOG_FUNCTION (this);
173  return m_node;
174 }
175 
176 void
178 {
179  NS_LOG_FUNCTION (node);
180 
181  m_node = node;
182 }
183 
184 void
186 {
187  NS_LOG_FUNCTION (this << phy);
188  m_phy = phy;
189 }
190 
191 
194 {
195  NS_LOG_FUNCTION (this);
196  return m_phy;
197 }
198 
199 
200 void
202 {
203  NS_LOG_FUNCTION (this << c);
204  m_channel = c;
205 }
206 
209 {
210  NS_LOG_FUNCTION (this);
211  return m_channel;
212 }
213 
214 
215 bool
217 {
218  NS_LOG_FUNCTION (this);
219  return false;
220 }
221 
222 bool
224 {
225  NS_LOG_FUNCTION (this);
226  return false;
227 }
228 
229 void
231 {
232  NS_LOG_FUNCTION (&callback);
233 }
234 
235 void
237 {
238  NS_LOG_FUNCTION (&cb);
239 }
240 
241 void
243 {
244  NS_LOG_FUNCTION (&cb);
245 }
246 
247 bool
249 {
250  NS_LOG_FUNCTION (this);
251  return false;
252 }
253 
254 
255 bool
256 NonCommunicatingNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNumber)
257 {
258  NS_LOG_FUNCTION (packet << dest << protocolNumber);
259  return false;
260 }
261 
262 bool
263 NonCommunicatingNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
264 {
265  NS_LOG_FUNCTION (packet << src << dest << protocolNumber);
266  return false;
267 }
268 
269 
270 } // 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)
Definition: log.h:345
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: object.cc:336
virtual void SetAddress(Address address)
Set the address of this interface.
a polymophic address class
Definition: address.h:86
virtual Address GetMulticast(Ipv4Address addr) const
Make and return a MAC multicast address using the provided multicast group.
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
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)
hold objects of type Ptr
Definition: pointer.h:33
Describes an IPv6 address.
Definition: ipv6-address.h:46
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Network layer to device interface.
Definition: net-device.h:75
virtual bool SetMtu(const uint16_t mtu)
NS_LOG_COMPONENT_DEFINE("NonCommunicatingNetDevice")
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
a unique identifier for an interface.
Definition: type-id.h:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)
virtual Ptr< Channel > GetChannel(void) const