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 */
a polymophic address class
Definition: address.h:91
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Describes an IPv6 address.
Definition: ipv6-address.h:50
Network layer to device interface.
Definition: net-device.h:96
This class implements a device which does not communicate, in the sense that it does not interact wit...
virtual Address GetMulticast(Ipv4Address addr) const
Make and return a MAC multicast address using the provided multicast group.
Ptr< Node > m_node
node this NetDevice is associated to
virtual void SetNode(Ptr< Node > node)
virtual void SetIfIndex(const uint32_t index)
virtual void AddLinkChangeCallback(Callback< void > callback)
virtual void DoDispose(void)
Destructor implementation.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Ptr< Channel > m_channel
Channel used by the NetDevice.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
virtual Ptr< Node > GetNode(void) const
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
virtual uint32_t GetIfIndex(void) const
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual bool SetMtu(const uint16_t mtu)
virtual Ptr< Channel > GetChannel(void) const
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
static TypeId GetTypeId(void)
Get the type ID.
virtual void SetAddress(Address address)
Set the address of this interface.
a unique identifier for an interface.
Definition: type-id.h:59
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:93