A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
non-communicating-net-device.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#ifndef NON_COMMUNICATING_NET_DEVICE_H
21#define NON_COMMUNICATING_NET_DEVICE_H
22
23#include <ns3/address.h>
24#include <ns3/callback.h>
25#include <ns3/net-device.h>
26#include <ns3/node.h>
27#include <ns3/packet.h>
28#include <ns3/ptr.h>
29#include <ns3/traced-callback.h>
30
31#include <cstring>
32
33namespace ns3
34{
35
36class SpectrumChannel;
37class Channel;
38class SpectrumErrorModel;
39
52{
53 public:
58 static TypeId GetTypeId();
59
62
73
81 void SetPhy(Ptr<Object> phy);
82
86 Ptr<Object> GetPhy() const;
87
88 // inherited from NetDevice
89 void SetIfIndex(const uint32_t index) override;
90 uint32_t GetIfIndex() const override;
91 Ptr<Channel> GetChannel() const override;
92 bool SetMtu(const uint16_t mtu) override;
93 uint16_t GetMtu() const override;
94 void SetAddress(Address address) override;
95 Address GetAddress() const override;
96 bool IsLinkUp() const override;
97 void AddLinkChangeCallback(Callback<void> callback) override;
98 bool IsBroadcast() const override;
99 Address GetBroadcast() const override;
100 bool IsMulticast() const override;
101 bool IsPointToPoint() const override;
102 bool IsBridge() const override;
103 bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
104 bool SendFrom(Ptr<Packet> packet,
105 const Address& source,
106 const Address& dest,
107 uint16_t protocolNumber) override;
108 Ptr<Node> GetNode() const override;
109 void SetNode(Ptr<Node> node) override;
110 bool NeedsArp() const override;
112 Address GetMulticast(Ipv4Address addr) const override;
113 Address GetMulticast(Ipv6Address addr) const override;
115 bool SupportsSendFrom() const override;
116
117 private:
118 void DoDispose() override;
119
124};
125
126} // namespace ns3
127
128#endif /* NON_COMMUNICATING_NET_DEVICE_H */
a polymophic address class
Definition: address.h:100
Callback template class.
Definition: callback.h:438
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Describes an IPv6 address.
Definition: ipv6-address.h:49
Network layer to device interface.
Definition: net-device.h:98
This class implements a device which does not communicate, in the sense that it does not interact wit...
Ptr< Node > m_node
node this NetDevice is associated to
void SetIfIndex(const uint32_t index) override
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
void AddLinkChangeCallback(Callback< void > callback) override
Ptr< Channel > GetChannel() const override
Address GetMulticast(Ipv4Address addr) const override
Make and return a MAC multicast address using the provided multicast group.
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
void SetAddress(Address address) override
Set the address of this interface.
Ptr< Channel > m_channel
Channel used by the NetDevice.
bool SetMtu(const uint16_t mtu) override
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
void SetNode(Ptr< Node > node) override
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
void DoDispose() override
Destructor implementation.
static TypeId GetTypeId()
Get the type ID.
bool IsBridge() const override
Return true if the net device is acting as a bridge.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.