A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 class Queue;
40 
41 
42 
55 {
56 public:
57  static TypeId GetTypeId (void);
58 
60  virtual ~NonCommunicatingNetDevice ();
61 
62 
72  void SetChannel (Ptr<Channel> c);
73 
74 
82  void SetPhy (Ptr<Object> phy);
83 
87  Ptr<Object> GetPhy () const;
88 
89 
90 
91  // inherited from NetDevice
92  virtual void SetIfIndex (const uint32_t index);
93  virtual uint32_t GetIfIndex (void) const;
94  virtual Ptr<Channel> GetChannel (void) const;
95  virtual bool SetMtu (const uint16_t mtu);
96  virtual uint16_t GetMtu (void) const;
97  virtual void SetAddress (Address address);
98  virtual Address GetAddress (void) const;
99  virtual bool IsLinkUp (void) const;
100  virtual void AddLinkChangeCallback (Callback<void> callback);
101  virtual bool IsBroadcast (void) const;
102  virtual Address GetBroadcast (void) const;
103  virtual bool IsMulticast (void) const;
104  virtual bool IsPointToPoint (void) const;
105  virtual bool IsBridge (void) const;
106  virtual bool Send (Ptr<Packet> packet, const Address& dest,
107  uint16_t protocolNumber);
108  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest,
109  uint16_t protocolNumber);
110  virtual Ptr<Node> GetNode (void) const;
111  virtual void SetNode (Ptr<Node> node);
112  virtual bool NeedsArp (void) const;
114  virtual Address GetMulticast (Ipv4Address addr) const;
115  virtual Address GetMulticast (Ipv6Address addr) const;
117  virtual bool SupportsSendFrom (void) const;
118 
119 
120 
121 
122 
123 private:
124  virtual void DoDispose (void);
125 
128 
129  uint32_t m_ifIndex;
130 
132 };
133 
134 
135 } // namespace ns3
136 
137 #endif /* NON_COMMUNICATING_NET_DEVICE_H */
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)
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
virtual void SetAddress(Address address)
Set the address of this interface.
This class implements a device which does not communicate, in the sense that it does not interact wit...
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)
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
a unique identifier for an interface.
Definition: type-id.h:49
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual void SetNode(Ptr< Node > node)
virtual Ptr< Channel > GetChannel(void) const