A Discrete-Event Network Simulator
API
non-communicating-net-device.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010
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 #ifndef NON_COMMUNICATING_NET_DEVICE_H
22 #define NON_COMMUNICATING_NET_DEVICE_H
23 
24 #include <cstring>
25 #include <ns3/node.h>
26 #include <ns3/address.h>
27 #include <ns3/net-device.h>
28 #include <ns3/callback.h>
29 #include <ns3/packet.h>
30 #include <ns3/traced-callback.h>
31 #include <ns3/ptr.h>
32 
33 namespace ns3 {
34 
35 
36 class SpectrumChannel;
37 class Channel;
38 class SpectrumErrorModel;
39 
40 
41 
54 {
55 public:
60  static TypeId GetTypeId (void);
61 
63  virtual ~NonCommunicatingNetDevice ();
64 
65 
75  void SetChannel (Ptr<Channel> c);
76 
77 
85  void SetPhy (Ptr<Object> phy);
86 
90  Ptr<Object> GetPhy () const;
91 
92 
93 
94  // inherited from NetDevice
95  virtual void SetIfIndex (const uint32_t index);
96  virtual uint32_t GetIfIndex (void) const;
97  virtual Ptr<Channel> GetChannel (void) const;
98  virtual bool SetMtu (const uint16_t mtu);
99  virtual uint16_t GetMtu (void) const;
100  virtual void SetAddress (Address address);
101  virtual Address GetAddress (void) const;
102  virtual bool IsLinkUp (void) const;
103  virtual void AddLinkChangeCallback (Callback<void> callback);
104  virtual bool IsBroadcast (void) const;
105  virtual Address GetBroadcast (void) const;
106  virtual bool IsMulticast (void) const;
107  virtual bool IsPointToPoint (void) const;
108  virtual bool IsBridge (void) const;
109  virtual bool Send (Ptr<Packet> packet, const Address& dest,
110  uint16_t protocolNumber);
111  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest,
112  uint16_t protocolNumber);
113  virtual Ptr<Node> GetNode (void) const;
114  virtual void SetNode (Ptr<Node> node);
115  virtual bool NeedsArp (void) const;
117  virtual Address GetMulticast (Ipv4Address addr) const;
118  virtual Address GetMulticast (Ipv6Address addr) const;
120  virtual bool SupportsSendFrom (void) const;
121 
122 
123 
124 
125 
126 private:
127  virtual void DoDispose (void);
128 
131  uint32_t m_ifIndex;
133 };
134 
135 
136 } // namespace ns3
137 
138 #endif /* NON_COMMUNICATING_NET_DEVICE_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::NonCommunicatingNetDevice::NonCommunicatingNetDevice
NonCommunicatingNetDevice()
Definition: non-communicating-net-device.cc:53
ns3::NonCommunicatingNetDevice::GetBroadcast
virtual Address GetBroadcast(void) const
Definition: non-communicating-net-device.cc:123
ns3::Callback< void >
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::NonCommunicatingNetDevice::NeedsArp
virtual bool NeedsArp(void) const
Definition: non-communicating-net-device.cc:212
ns3::NonCommunicatingNetDevice::GetMulticast
virtual Address GetMulticast(Ipv4Address addr) const
Make and return a MAC multicast address using the provided multicast group.
Definition: non-communicating-net-device.cc:137
ns3::NonCommunicatingNetDevice::m_channel
Ptr< Channel > m_channel
Channel used by the NetDevice.
Definition: non-communicating-net-device.h:130
ns3::NonCommunicatingNetDevice::m_phy
Ptr< Object > m_phy
Phy object.
Definition: non-communicating-net-device.h:132
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::NonCommunicatingNetDevice::AddLinkChangeCallback
virtual void AddLinkChangeCallback(Callback< void > callback)
Definition: non-communicating-net-device.cc:226
ns3::NonCommunicatingNetDevice::SetMtu
virtual bool SetMtu(const uint16_t mtu)
Definition: non-communicating-net-device.cc:89
ns3::NonCommunicatingNetDevice::SetPhy
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
Definition: non-communicating-net-device.cc:181
ns3::NonCommunicatingNetDevice::m_ifIndex
uint32_t m_ifIndex
Interface index.
Definition: non-communicating-net-device.h:131
ns3::NonCommunicatingNetDevice
This class implements a device which does not communicate, in the sense that it does not interact wit...
Definition: non-communicating-net-device.h:54
ns3::NonCommunicatingNetDevice::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: non-communicating-net-device.cc:64
ns3::Ptr< Channel >
ns3::NonCommunicatingNetDevice::SetChannel
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
Definition: non-communicating-net-device.cc:197
ns3::NonCommunicatingNetDevice::GetPhy
Ptr< Object > GetPhy() const
Definition: non-communicating-net-device.cc:189
ns3::NonCommunicatingNetDevice::m_node
Ptr< Node > m_node
node this NetDevice is associated to
Definition: non-communicating-net-device.h:129
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::NonCommunicatingNetDevice::SetReceiveCallback
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Definition: non-communicating-net-device.cc:232
ns3::NonCommunicatingNetDevice::IsPointToPoint
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
Definition: non-communicating-net-device.cc:151
ns3::NonCommunicatingNetDevice::GetAddress
virtual Address GetAddress(void) const
Definition: non-communicating-net-device.cc:109
ns3::NonCommunicatingNetDevice::SetPromiscReceiveCallback
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
Definition: non-communicating-net-device.cc:238
ns3::NonCommunicatingNetDevice::SetNode
virtual void SetNode(Ptr< Node > node)
Definition: non-communicating-net-device.cc:173
first.address
address
Definition: first.py:44
ns3::NonCommunicatingNetDevice::GetNode
virtual Ptr< Node > GetNode(void) const
Definition: non-communicating-net-device.cc:166
ns3::NonCommunicatingNetDevice::SupportsSendFrom
virtual bool SupportsSendFrom(void) const
Definition: non-communicating-net-device.cc:244
ns3::NonCommunicatingNetDevice::~NonCommunicatingNetDevice
virtual ~NonCommunicatingNetDevice()
Definition: non-communicating-net-device.cc:58
ns3::NonCommunicatingNetDevice::GetMtu
virtual uint16_t GetMtu(void) const
Definition: non-communicating-net-device.cc:96
ns3::NonCommunicatingNetDevice::Send
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Definition: non-communicating-net-device.cc:252
ns3::NonCommunicatingNetDevice::GetIfIndex
virtual uint32_t GetIfIndex(void) const
Definition: non-communicating-net-device.cc:82
ns3::NonCommunicatingNetDevice::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: non-communicating-net-device.cc:38
ns3::NonCommunicatingNetDevice::IsBroadcast
virtual bool IsBroadcast(void) const
Definition: non-communicating-net-device.cc:116
ns3::NonCommunicatingNetDevice::IsMulticast
virtual bool IsMulticast(void) const
Definition: non-communicating-net-device.cc:130
ns3::NonCommunicatingNetDevice::GetChannel
virtual Ptr< Channel > GetChannel(void) const
Definition: non-communicating-net-device.cc:204
ns3::NonCommunicatingNetDevice::SendFrom
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
Definition: non-communicating-net-device.cc:259
ns3::NonCommunicatingNetDevice::SetIfIndex
virtual void SetIfIndex(const uint32_t index)
Definition: non-communicating-net-device.cc:75
ns3::NonCommunicatingNetDevice::SetAddress
virtual void SetAddress(Address address)
Set the address of this interface.
Definition: non-communicating-net-device.cc:103
ns3::NonCommunicatingNetDevice::IsBridge
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
Definition: non-communicating-net-device.cc:158
ns3::NonCommunicatingNetDevice::IsLinkUp
virtual bool IsLinkUp(void) const
Definition: non-communicating-net-device.cc:219
third.phy
phy
Definition: third.py:93
ns3::NetDevice
Network layer to device interface.
Definition: net-device.h:96