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 TypeId
43 {
44  static TypeId tid = TypeId ("ns3::NonCommunicatingNetDevice")
45  .SetParent<NetDevice> ()
46  .AddConstructor<NonCommunicatingNetDevice> ()
47  .AddAttribute ("Phy", "The PHY layer attached to this device.",
48  PointerValue (),
49  MakePointerAccessor (&NonCommunicatingNetDevice::GetPhy,
51  MakePointerChecker<Object> ())
52  ;
53  return tid;
54 }
55 
57 {
58  NS_LOG_FUNCTION (this);
59 }
60 
62 {
63  NS_LOG_FUNCTION (this);
64 }
65 
66 void
68 {
69  NS_LOG_FUNCTION (this);
70  m_node = 0;
71  m_channel = 0;
72  m_phy = 0;
74 }
75 
76 
77 void
79 {
80  NS_LOG_FUNCTION (index);
81  m_ifIndex = index;
82 }
83 
84 uint32_t
86 {
87  NS_LOG_FUNCTION (this);
88  return m_ifIndex;
89 }
90 
91 bool
93 {
94  NS_LOG_FUNCTION (mtu);
95  return (mtu == 0);
96 }
97 
98 uint16_t
100 {
101  NS_LOG_FUNCTION (this);
102  return 0;
103 }
104 
105 void
107 {
108  NS_LOG_FUNCTION (this);
109 }
110 
111 Address
113 {
114  NS_LOG_FUNCTION (this);
115  return Address ();
116 }
117 
118 bool
120 {
121  NS_LOG_FUNCTION (this);
122  return false;
123 }
124 
125 Address
127 {
128  NS_LOG_FUNCTION (this);
129  return Address ();
130 }
131 
132 bool
134 {
135  NS_LOG_FUNCTION (this);
136  return false;
137 }
138 
139 Address
141 {
142  NS_LOG_FUNCTION (addr);
143  return Address ();
144 }
145 
146 Address
148 {
149  NS_LOG_FUNCTION (addr);
150  return Address ();
151 }
152 
153 bool
155 {
156  NS_LOG_FUNCTION (this);
157  return false;
158 }
159 
160 bool
162 {
163  NS_LOG_FUNCTION (this);
164  return false;
165 }
166 
167 
168 Ptr<Node>
170 {
171  NS_LOG_FUNCTION (this);
172  return m_node;
173 }
174 
175 void
177 {
178  NS_LOG_FUNCTION (node);
179 
180  m_node = node;
181 }
182 
183 void
185 {
186  NS_LOG_FUNCTION (this << phy);
187  m_phy = phy;
188 }
189 
190 
193 {
194  NS_LOG_FUNCTION (this);
195  return m_phy;
196 }
197 
198 
199 void
201 {
202  NS_LOG_FUNCTION (this << c);
203  m_channel = c;
204 }
205 
208 {
209  NS_LOG_FUNCTION (this);
210  return m_channel;
211 }
212 
213 
214 bool
216 {
217  NS_LOG_FUNCTION (this);
218  return false;
219 }
220 
221 bool
223 {
224  NS_LOG_FUNCTION (this);
225  return false;
226 }
227 
228 void
230 {
231  NS_LOG_FUNCTION (&callback);
232 }
233 
234 void
236 {
237  NS_LOG_FUNCTION (&cb);
238 }
239 
240 void
242 {
243  NS_LOG_FUNCTION (&cb);
244 }
245 
246 bool
248 {
249  NS_LOG_FUNCTION (this);
250  return false;
251 }
252 
253 
254 bool
255 NonCommunicatingNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNumber)
256 {
257  NS_LOG_FUNCTION (packet << dest << protocolNumber);
258  return false;
259 }
260 
261 bool
262 NonCommunicatingNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address& dest, uint16_t protocolNumber)
263 {
264  NS_LOG_FUNCTION (packet << src << dest << protocolNumber);
265  return false;
266 }
267 
268 
269 } // 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 the class in the ns-3 factory.
Definition: object-base.h:38
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:170
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:335
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)
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:49
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)
virtual Ptr< Channel > GetChannel(void) const