A Discrete-Event Network Simulator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
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  */
23 #include "ns3/net-device.h"
24 #include "ns3/mac48-address.h"
25 #include <stdint.h>
26 #include <string>
28 namespace ns3 {
30 class Node;
39 {
40 public:
45  static TypeId GetTypeId (void);
48  // inherited from NetDevice base class.
49  virtual void SetIfIndex (const uint32_t index);
50  virtual uint32_t GetIfIndex (void) const;
51  virtual Ptr<Channel> GetChannel (void) const;
52  virtual void SetAddress (Address address);
53  virtual Address GetAddress (void) const;
54  virtual bool SetMtu (const uint16_t mtu);
55  virtual uint16_t GetMtu (void) const;
56  virtual bool IsLinkUp (void) const;
57  virtual void AddLinkChangeCallback (Callback<void> callback);
58  virtual bool IsBroadcast (void) const;
59  virtual Address GetBroadcast (void) const;
60  virtual bool IsMulticast (void) const;
61  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
62  virtual bool IsPointToPoint (void) const;
63  virtual bool IsBridge (void) const;
64  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
65  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
66  virtual Ptr<Node> GetNode (void) const;
67  virtual void SetNode (Ptr<Node> node);
68  virtual bool NeedsArp (void) const;
71  virtual Address GetMulticast (Ipv6Address addr) const;
74  virtual bool SupportsSendFrom (void) const;
76 protected:
77  virtual void DoDispose (void);
78 private:
87  void Receive (Ptr<Packet> packet, uint16_t protocol, Mac48Address to, Mac48Address from);
100  uint16_t m_mtu;
101  uint32_t m_ifIndex;
103 };
105 } // namespace ns3
107 #endif /* LOOPBACK_NET_DEVICE_H */
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
uint32_t m_ifIndex
interface index
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
virtual Address GetAddress(void) const
virtual void SetNode(Ptr< Node > node)
Mac48Address m_address
NetDevice MAC address.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
NetDevice::ReceiveCallback m_rxCallback
The callback used to notify higher layers that a packet has been received.
virtual bool SupportsSendFrom(void) const
a polymophic address class
Definition: address.h:86
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
uint16_t m_mtu
device MTU
virtual bool IsBroadcast(void) const
NetDevice::PromiscReceiveCallback m_promiscCallback
The callback used to notify higher layers that a packet has been received in promiscuous mode...
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual bool IsLinkUp(void) const
virtual uint16_t GetMtu(void) const
an EUI-48 address
Definition: mac48-address.h:41
virtual uint32_t GetIfIndex(void) const
virtual bool SetMtu(const uint16_t mtu)
virtual Address GetBroadcast(void) const
Describes an IPv6 address.
Definition: ipv6-address.h:46
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
Virtual network interface that loops back any data sent to it to be immediately received on the same ...
virtual Ptr< Channel > GetChannel(void) const
Network layer to device interface.
Definition: net-device.h:75
virtual void SetIfIndex(const uint32_t index)
virtual bool NeedsArp(void) const
Ptr< Node > m_node
the node this NetDevice is associated with
virtual bool IsMulticast(void) const
void Receive(Ptr< Packet > packet, uint16_t protocol, Mac48Address to, Mac48Address from)
Receive a packet from tge Loopback NetDevice.
virtual Ptr< Node > GetNode(void) const
tuple address
Definition: first.py:37
static TypeId GetTypeId(void)
Get the type ID.
a unique identifier for an interface.
Definition: type-id.h:49
virtual void SetAddress(Address address)
Set the address of this interface.
virtual void AddLinkChangeCallback(Callback< void > callback)