A Discrete-Event Network Simulator
API
simple-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) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #include "simple-net-device.h"
21 #include "simple-channel.h"
22 #include "ns3/node.h"
23 #include "ns3/packet.h"
24 #include "ns3/log.h"
25 #include "ns3/pointer.h"
26 #include "ns3/error-model.h"
27 #include "ns3/trace-source-accessor.h"
28 #include "ns3/boolean.h"
29 #include "ns3/string.h"
30 #include "ns3/tag.h"
31 #include "ns3/simulator.h"
32 #include "ns3/queue.h"
33 
34 namespace ns3 {
35 
36 NS_LOG_COMPONENT_DEFINE ("SimpleNetDevice");
37 
41 class SimpleTag : public Tag {
42 public:
47  static TypeId GetTypeId (void);
48  virtual TypeId GetInstanceTypeId (void) const;
49 
50  virtual uint32_t GetSerializedSize (void) const;
51  virtual void Serialize (TagBuffer i) const;
52  virtual void Deserialize (TagBuffer i);
53 
58  void SetSrc (Mac48Address src);
63  Mac48Address GetSrc (void) const;
64 
69  void SetDst (Mac48Address dst);
74  Mac48Address GetDst (void) const;
75 
80  void SetProto (uint16_t proto);
85  uint16_t GetProto (void) const;
86 
87  void Print (std::ostream &os) const;
88 
89 private:
92  uint16_t m_protocolNumber;
93 };
94 
95 
97 
98 TypeId
100 {
101  static TypeId tid = TypeId ("ns3::SimpleTag")
102  .SetParent<Tag> ()
103  .SetGroupName("Network")
104  .AddConstructor<SimpleTag> ()
105  ;
106  return tid;
107 }
108 TypeId
110 {
111  return GetTypeId ();
112 }
113 
114 uint32_t
116 {
117  return 8+8+2;
118 }
119 void
121 {
122  uint8_t mac[6];
123  m_src.CopyTo (mac);
124  i.Write (mac, 6);
125  m_dst.CopyTo (mac);
126  i.Write (mac, 6);
128 }
129 void
131 {
132  uint8_t mac[6];
133  i.Read (mac, 6);
134  m_src.CopyFrom (mac);
135  i.Read (mac, 6);
136  m_dst.CopyFrom (mac);
137  m_protocolNumber = i.ReadU16 ();
138 }
139 
140 void
142 {
143  m_src = src;
144 }
145 
147 SimpleTag::GetSrc (void) const
148 {
149  return m_src;
150 }
151 
152 void
154 {
155  m_dst = dst;
156 }
157 
159 SimpleTag::GetDst (void) const
160 {
161  return m_dst;
162 }
163 
164 void
165 SimpleTag::SetProto (uint16_t proto)
166 {
167  m_protocolNumber = proto;
168 }
169 
170 uint16_t
172 {
173  return m_protocolNumber;
174 }
175 
176 void
177 SimpleTag::Print (std::ostream &os) const
178 {
179  os << "src=" << m_src << " dst=" << m_dst << " proto=" << m_protocolNumber;
180 }
181 
182 
183 
185 
186 TypeId
188 {
189  static TypeId tid = TypeId ("ns3::SimpleNetDevice")
190  .SetParent<NetDevice> ()
191  .SetGroupName("Network")
192  .AddConstructor<SimpleNetDevice> ()
193  .AddAttribute ("ReceiveErrorModel",
194  "The receiver error model used to simulate packet loss",
195  PointerValue (),
197  MakePointerChecker<ErrorModel> ())
198  .AddAttribute ("PointToPointMode",
199  "The device is configured in Point to Point mode",
200  BooleanValue (false),
203  .AddAttribute ("TxQueue",
204  "A queue to use as the transmit queue in the device.",
205  StringValue ("ns3::DropTailQueue<Packet>"),
207  MakePointerChecker<Queue<Packet> > ())
208  .AddAttribute ("DataRate",
209  "The default data rate for point to point links. Zero means infinite",
210  DataRateValue (DataRate ("0b/s")),
213  .AddTraceSource ("PhyRxDrop",
214  "Trace source indicating a packet has been dropped "
215  "by the device during reception",
217  "ns3::Packet::TracedCallback")
218  ;
219  return tid;
220 }
221 
223  : m_channel (0),
224  m_node (0),
225  m_mtu (0xffff),
226  m_ifIndex (0),
227  m_linkUp (false)
228 {
229  NS_LOG_FUNCTION (this);
230 }
231 
232 void
233 SimpleNetDevice::Receive (Ptr<Packet> packet, uint16_t protocol,
234  Mac48Address to, Mac48Address from)
235 {
236  NS_LOG_FUNCTION (this << packet << protocol << to << from);
237  NetDevice::PacketType packetType;
238 
239  if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) )
240  {
241  m_phyRxDropTrace (packet);
242  return;
243  }
244 
245  if (to == m_address)
246  {
247  packetType = NetDevice::PACKET_HOST;
248  }
249  else if (to.IsBroadcast ())
250  {
251  packetType = NetDevice::PACKET_BROADCAST;
252  }
253  else if (to.IsGroup ())
254  {
255  packetType = NetDevice::PACKET_MULTICAST;
256  }
257  else
258  {
259  packetType = NetDevice::PACKET_OTHERHOST;
260  }
261 
262  if (packetType != NetDevice::PACKET_OTHERHOST)
263  {
264  m_rxCallback (this, packet, protocol, from);
265  }
266 
267  if (!m_promiscCallback.IsNull ())
268  {
269  m_promiscCallback (this, packet, protocol, from, to, packetType);
270  }
271 }
272 
273 void
275 {
276  NS_LOG_FUNCTION (this << channel);
277  m_channel = channel;
278  m_channel->Add (this);
279  m_linkUp = true;
281 }
282 
285 {
286  NS_LOG_FUNCTION (this);
287  return m_queue;
288 }
289 
290 void
292 {
293  NS_LOG_FUNCTION (this << q);
294  m_queue = q;
295 }
296 
297 void
299 {
300  NS_LOG_FUNCTION (this << em);
301  m_receiveErrorModel = em;
302 }
303 
304 void
305 SimpleNetDevice::SetIfIndex (const uint32_t index)
306 {
307  NS_LOG_FUNCTION (this << index);
308  m_ifIndex = index;
309 }
310 uint32_t
312 {
313  NS_LOG_FUNCTION (this);
314  return m_ifIndex;
315 }
318 {
319  NS_LOG_FUNCTION (this);
320  return m_channel;
321 }
322 void
324 {
325  NS_LOG_FUNCTION (this << address);
327 }
328 Address
330 {
331  //
332  // Implicit conversion from Mac48Address to Address
333  //
334  NS_LOG_FUNCTION (this);
335  return m_address;
336 }
337 bool
338 SimpleNetDevice::SetMtu (const uint16_t mtu)
339 {
340  NS_LOG_FUNCTION (this << mtu);
341  m_mtu = mtu;
342  return true;
343 }
344 uint16_t
346 {
347  NS_LOG_FUNCTION (this);
348  return m_mtu;
349 }
350 bool
352 {
353  NS_LOG_FUNCTION (this);
354  return m_linkUp;
355 }
356 void
358 {
359  NS_LOG_FUNCTION (this << &callback);
361 }
362 bool
364 {
365  NS_LOG_FUNCTION (this);
366  if (m_pointToPointMode)
367  {
368  return false;
369  }
370  return true;
371 }
372 Address
374 {
375  NS_LOG_FUNCTION (this);
376  return Mac48Address ("ff:ff:ff:ff:ff:ff");
377 }
378 bool
380 {
381  NS_LOG_FUNCTION (this);
382  if (m_pointToPointMode)
383  {
384  return false;
385  }
386  return true;
387 }
388 Address
390 {
391  NS_LOG_FUNCTION (this << multicastGroup);
392  return Mac48Address::GetMulticast (multicastGroup);
393 }
394 
396 {
397  NS_LOG_FUNCTION (this << addr);
398  return Mac48Address::GetMulticast (addr);
399 }
400 
401 bool
403 {
404  NS_LOG_FUNCTION (this);
405  if (m_pointToPointMode)
406  {
407  return true;
408  }
409  return false;
410 }
411 
412 bool
414 {
415  NS_LOG_FUNCTION (this);
416  return false;
417 }
418 
419 bool
420 SimpleNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
421 {
422  NS_LOG_FUNCTION (this << packet << dest << protocolNumber);
423 
424  return SendFrom (packet, m_address, dest, protocolNumber);
425 }
426 
427 bool
428 SimpleNetDevice::SendFrom (Ptr<Packet> p, const Address& source, const Address& dest, uint16_t protocolNumber)
429 {
430  NS_LOG_FUNCTION (this << p << source << dest << protocolNumber);
431  if (p->GetSize () > GetMtu ())
432  {
433  return false;
434  }
435 
437  Mac48Address from = Mac48Address::ConvertFrom (source);
438 
439  SimpleTag tag;
440  tag.SetSrc (from);
441  tag.SetDst (to);
442  tag.SetProto (protocolNumber);
443 
444  p->AddPacketTag (tag);
445 
446  if (m_queue->Enqueue (p))
447  {
448  if (m_queue->GetNPackets () == 1 && !FinishTransmissionEvent.IsRunning ())
449  {
451  }
452  return true;
453  }
454 
455  return false;
456 }
457 
458 void
460 {
461  if (m_queue->GetNPackets () == 0)
462  {
463  return;
464  }
466  "Tried to transmit a packet while another transmission was in progress");
467  Ptr<Packet> packet = m_queue->Dequeue ();
468 
479  Time txTime = Time (0);
480  if (m_bps > DataRate (0))
481  {
482  txTime = m_bps.CalculateBytesTxTime (packet->GetSize ());
483  }
485 }
486 
487 void
489 {
490  NS_LOG_FUNCTION (this);
491 
492  SimpleTag tag;
493  packet->RemovePacketTag (tag);
494 
495  Mac48Address src = tag.GetSrc ();
496  Mac48Address dst = tag.GetDst ();
497  uint16_t proto = tag.GetProto ();
498 
499  m_channel->Send (packet, proto, dst, src, this);
500 
502 
503  return;
504 }
505 
506 Ptr<Node>
508 {
509  NS_LOG_FUNCTION (this);
510  return m_node;
511 }
512 void
514 {
515  NS_LOG_FUNCTION (this << node);
516  m_node = node;
517 }
518 bool
520 {
521  NS_LOG_FUNCTION (this);
522  if (m_pointToPointMode)
523  {
524  return false;
525  }
526  return true;
527 }
528 void
530 {
531  NS_LOG_FUNCTION (this << &cb);
532  m_rxCallback = cb;
533 }
534 
535 void
537 {
538  NS_LOG_FUNCTION (this);
539  m_channel = 0;
540  m_node = 0;
542  m_queue->Dispose ();
544  {
546  }
548 }
549 
550 
551 void
553 {
554  NS_LOG_FUNCTION (this << &cb);
555  m_promiscCallback = cb;
556 }
557 
558 bool
560 {
561  NS_LOG_FUNCTION (this);
562  return true;
563 }
564 
565 } // namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::NetDevice::PACKET_BROADCAST
@ PACKET_BROADCAST
Packet addressed to all.
Definition: net-device.h:300
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::SimpleNetDevice::IsPointToPoint
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
Definition: simple-net-device.cc:402
ns3::DataRateValue
AttributeValue implementation for DataRate.
Definition: data-rate.h:298
ns3::SimpleTag::GetSrc
Mac48Address GetSrc(void) const
Get the source address.
Definition: simple-net-device.cc:147
ns3::SimpleTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition: simple-net-device.cc:120
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
simple-net-device.h
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::Mac48Address::GetMulticast
static Mac48Address GetMulticast(Ipv4Address address)
Definition: mac48-address.cc:191
ns3::DataRate::CalculateBytesTxTime
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
Definition: data-rate.cc:275
ns3::SimpleNetDevice::SetPromiscReceiveCallback
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
Definition: simple-net-device.cc:552
ns3::SimpleNetDevice::IsLinkUp
virtual bool IsLinkUp(void) const
Definition: simple-net-device.cc:351
ns3::SimpleNetDevice::GetMtu
virtual uint16_t GetMtu(void) const
Definition: simple-net-device.cc:345
ns3::Mac48Address::IsGroup
bool IsGroup(void) const
Definition: mac48-address.cc:164
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Callback< void >
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Callback::IsNull
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
ns3::TracedCallback::ConnectWithoutContext
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
Definition: traced-callback.h:135
ns3::MakeDataRateAccessor
Ptr< const AttributeAccessor > MakeDataRateAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: data-rate.h:298
ns3::SimpleNetDevice::FinishTransmission
void FinishTransmission(Ptr< Packet > packet)
The FinishTransmission method is used internally to finish the process of sending a packet out on the...
Definition: simple-net-device.cc:488
ns3::SimpleNetDevice::SendFrom
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
Definition: simple-net-device.cc:428
ns3::SimpleTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition: simple-net-device.cc:109
ns3::SimpleNetDevice::IsBroadcast
virtual bool IsBroadcast(void) const
Definition: simple-net-device.cc:363
third.channel
channel
Definition: third.py:92
ns3::SimpleTag
SimpleNetDevice tag to store source, destination and protocol of each packet.
Definition: simple-net-device.cc:41
ns3::SimpleTag::SetProto
void SetProto(uint16_t proto)
Set the protocol number.
Definition: simple-net-device.cc:165
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
ns3::Ipv6Address
Describes an IPv6 address.
Definition: ipv6-address.h:50
ns3::NetDevice::PACKET_HOST
@ PACKET_HOST
Packet addressed oo us.
Definition: net-device.h:298
ns3::PointerValue
Hold objects of type Ptr<T>.
Definition: pointer.h:37
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::SimpleNetDevice::SetChannel
void SetChannel(Ptr< SimpleChannel > channel)
Attach a channel to this net device.
Definition: simple-net-device.cc:274
ns3::SimpleNetDevice::Send
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Definition: simple-net-device.cc:420
third.mac
mac
Definition: third.py:99
ns3::SimpleNetDevice::SetMtu
virtual bool SetMtu(const uint16_t mtu)
Definition: simple-net-device.cc:338
ns3::SimpleNetDevice::m_linkChangeCallbacks
TracedCallback m_linkChangeCallbacks
List of callbacks to fire if the link changes state (up or down).
Definition: simple-net-device.h:191
ns3::SimpleTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition: simple-net-device.cc:130
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::SimpleNetDevice::StartTransmission
void StartTransmission(void)
The StartTransmission method is used internally to start the process of sending a packet out on the c...
Definition: simple-net-device.cc:459
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::SimpleNetDevice::SetAddress
virtual void SetAddress(Address address)
Set the address of this interface.
Definition: simple-net-device.cc:323
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::SimpleNetDevice::SetIfIndex
virtual void SetIfIndex(const uint32_t index)
Definition: simple-net-device.cc:305
ns3::SimpleTag::GetDst
Mac48Address GetDst(void) const
Get the destination address.
Definition: simple-net-device.cc:159
ns3::SimpleNetDevice::m_mtu
uint16_t m_mtu
MTU.
Definition: simple-net-device.h:146
ns3::SimpleNetDevice::GetBroadcast
virtual Address GetBroadcast(void) const
Definition: simple-net-device.cc:373
ns3::Ptr< Packet >
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
ns3::SimpleNetDevice::FinishTransmissionEvent
EventId FinishTransmissionEvent
the Tx Complete event
Definition: simple-net-device.h:186
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
ns3::SimpleNetDevice::GetAddress
virtual Address GetAddress(void) const
Definition: simple-net-device.cc:329
ns3::SimpleNetDevice::AddLinkChangeCallback
virtual void AddLinkChangeCallback(Callback< void > callback)
Definition: simple-net-device.cc:357
ns3::NetDevice::PACKET_OTHERHOST
@ PACKET_OTHERHOST
Packet addressed to someone else.
Definition: net-device.h:304
ns3::TagBuffer::Write
void Write(const uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:125
ns3::TagBuffer::ReadU16
TAG_BUFFER_INLINE uint16_t ReadU16(void)
Definition: tag-buffer.h:205
ns3::SimpleTag::m_protocolNumber
uint16_t m_protocolNumber
protocol number
Definition: simple-net-device.cc:92
ns3::Tag
tag a set of bytes in a packet
Definition: tag.h:37
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::Mac48Address::ConvertFrom
static Mac48Address ConvertFrom(const Address &address)
Definition: mac48-address.cc:126
ns3::Mac48Address::IsBroadcast
bool IsBroadcast(void) const
Definition: mac48-address.cc:158
ns3::SimpleNetDevice::m_queue
Ptr< Queue< Packet > > m_queue
The Queue for outgoing packets.
Definition: simple-net-device.h:184
ns3::SimpleTag::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition: simple-net-device.cc:115
ns3::SimpleNetDevice::SupportsSendFrom
virtual bool SupportsSendFrom(void) const
Definition: simple-net-device.cc:559
ns3::EventId::Cancel
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
ns3::SimpleNetDevice::IsMulticast
virtual bool IsMulticast(void) const
Definition: simple-net-device.cc:379
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::SimpleNetDevice::m_channel
Ptr< SimpleChannel > m_channel
the channel the device is connected to
Definition: simple-net-device.h:142
first.address
address
Definition: first.py:44
ns3::SimpleNetDevice::NeedsArp
virtual bool NeedsArp(void) const
Definition: simple-net-device.cc:519
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::SimpleNetDevice::GetChannel
virtual Ptr< Channel > GetChannel(void) const
Definition: simple-net-device.cc:317
NS_ASSERT_MSG
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
Queue< Packet >
ns3::SimpleNetDevice::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: simple-net-device.cc:536
simple-channel.h
ns3::SimpleNetDevice::GetQueue
Ptr< Queue< Packet > > GetQueue(void) const
Get a copy of the attached Queue.
Definition: simple-net-device.cc:284
ns3::SimpleNetDevice
This device assumes 48-bit mac addressing; there is also the possibility to add an ErrorModel if you ...
Definition: simple-net-device.h:55
ns3::SimpleTag::SetDst
void SetDst(Mac48Address dst)
Set the destination address.
Definition: simple-net-device.cc:153
ns3::SimpleTag::SetSrc
void SetSrc(Mac48Address src)
Set the source address.
Definition: simple-net-device.cc:141
ns3::SimpleNetDevice::IsBridge
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
Definition: simple-net-device.cc:413
ns3::SimpleNetDevice::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: simple-net-device.cc:187
ns3::SimpleNetDevice::SetQueue
void SetQueue(Ptr< Queue< Packet > > queue)
Attach a queue to the SimpleNetDevice.
Definition: simple-net-device.cc:291
ns3::MakePointerAccessor
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:227
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
ns3::Packet::AddPacketTag
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:956
ns3::SimpleNetDevice::SetNode
virtual void SetNode(Ptr< Node > node)
Definition: simple-net-device.cc:513
ns3::SimpleTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: simple-net-device.cc:99
ns3::SimpleTag::m_src
Mac48Address m_src
source address
Definition: simple-net-device.cc:90
ns3::SimpleNetDevice::m_pointToPointMode
bool m_pointToPointMode
Flag indicating whether or not the NetDevice is a Point to Point model.
Definition: simple-net-device.h:182
ns3::TagBuffer::Read
void Read(uint8_t *buffer, uint32_t size)
Definition: tag-buffer.cc:176
ns3::SimpleNetDevice::GetMulticast
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
Definition: simple-net-device.cc:389
ns3::Packet::RemovePacketTag
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:963
ns3::SimpleNetDevice::m_linkUp
bool m_linkUp
Flag indicating whether or not the link is up.
Definition: simple-net-device.h:176
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::SimpleNetDevice::m_bps
DataRate m_bps
The device nominal Data rate.
Definition: simple-net-device.h:185
ns3::SimpleNetDevice::m_address
Mac48Address m_address
MAC address.
Definition: simple-net-device.h:148
ns3::SimpleNetDevice::m_rxCallback
NetDevice::ReceiveCallback m_rxCallback
Receive callback.
Definition: simple-net-device.h:143
ns3::SimpleNetDevice::Receive
void Receive(Ptr< Packet > packet, uint16_t protocol, Mac48Address to, Mac48Address from)
Receive a packet from a connected SimpleChannel.
Definition: simple-net-device.cc:233
ns3::SimpleTag::m_dst
Mac48Address m_dst
destination address
Definition: simple-net-device.cc:91
ns3::SimpleNetDevice::GetNode
virtual Ptr< Node > GetNode(void) const
Definition: simple-net-device.cc:507
ns3::NetDevice::PacketType
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:297
ns3::TracedValueCallback::Time
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:813
ns3::Mac48Address::CopyTo
void CopyTo(uint8_t buffer[6]) const
Definition: mac48-address.cc:103
ns3::SimpleNetDevice::m_phyRxDropTrace
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received due to the error model being...
Definition: simple-net-device.h:159
ns3::SimpleNetDevice::m_receiveErrorModel
Ptr< ErrorModel > m_receiveErrorModel
Receive error model.
Definition: simple-net-device.h:149
ns3::TagBuffer
read and write tag data
Definition: tag-buffer.h:52
ns3::TagBuffer::WriteU16
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition: tag-buffer.h:180
ns3::Mac48Address::CopyFrom
void CopyFrom(const uint8_t buffer[6])
Definition: mac48-address.cc:97
ns3::SimpleNetDevice::SetReceiveCallback
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Definition: simple-net-device.cc:529
ns3::SimpleTag::GetProto
uint16_t GetProto(void) const
Get the protocol number.
Definition: simple-net-device.cc:171
ns3::SimpleNetDevice::m_promiscCallback
NetDevice::PromiscReceiveCallback m_promiscCallback
Promiscuous receive callback.
Definition: simple-net-device.h:144
ns3::SimpleNetDevice::GetIfIndex
virtual uint32_t GetIfIndex(void) const
Definition: simple-net-device.cc:311
ns3::SimpleTag::Print
void Print(std::ostream &os) const
Definition: simple-net-device.cc:177
ns3::SimpleNetDevice::m_ifIndex
uint32_t m_ifIndex
Interface index.
Definition: simple-net-device.h:147
ns3::Object::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: object.cc:346
ns3::SimpleNetDevice::SimpleNetDevice
SimpleNetDevice()
Definition: simple-net-device.cc:222
ns3::MakeDataRateChecker
Ptr< const AttributeChecker > MakeDataRateChecker(void)
Definition: data-rate.cc:30
ns3::SimpleNetDevice::SetReceiveErrorModel
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the SimpleNetDevice.
Definition: simple-net-device.cc:298
ns3::SimpleNetDevice::m_node
Ptr< Node > m_node
Node this netDevice is associated to.
Definition: simple-net-device.h:145
ns3::NetDevice
Network layer to device interface.
Definition: net-device.h:96
ns3::NetDevice::PACKET_MULTICAST
@ PACKET_MULTICAST
Packet addressed to multicast group.
Definition: net-device.h:302