A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lr-wpan-net-device.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 The Boeing Company
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:
18 * Tom Henderson <thomas.r.henderson@boeing.com>
19 * Tommaso Pecorella <tommaso.pecorella@unifi.it>
20 * Margherita Filippetti <morag87@gmail.com>
21 */
22#ifndef LR_WPAN_NET_DEVICE_H
23#define LR_WPAN_NET_DEVICE_H
24
25#include <ns3/lr-wpan-mac.h>
26#include <ns3/net-device.h>
27#include <ns3/traced-callback.h>
28
29namespace ns3
30{
31
32class LrWpanPhy;
33class LrWpanCsmaCa;
34class SpectrumChannel;
35class Node;
36
50{
51 public:
57 static TypeId GetTypeId();
58
60 ~LrWpanNetDevice() override;
61
69 {
71 RFC6282
72 };
73
79 void SetMac(Ptr<LrWpanMac> mac);
80
86 void SetPhy(Ptr<LrWpanPhy> phy);
87
93 void SetCsmaCa(Ptr<LrWpanCsmaCa> csmaca);
94
101 void SetChannel(Ptr<SpectrumChannel> channel);
102
108 Ptr<LrWpanMac> GetMac() const;
109
115 Ptr<LrWpanPhy> GetPhy() const;
116
123
124 // From class NetDevice
125 void SetIfIndex(const uint32_t index) override;
126 uint32_t GetIfIndex() const override;
127 Ptr<Channel> GetChannel() const override;
132 void SetAddress(Address address) override;
137 Address GetAddress() const override;
138
163 void SetPanAssociation(uint16_t panId,
164 Mac64Address coordExtAddr,
165 Mac16Address coordShortAddr,
166 Mac16Address assignedShortAddr);
167
168 bool SetMtu(const uint16_t mtu) override;
169 uint16_t GetMtu() const override;
170 bool IsLinkUp() const override;
171 void AddLinkChangeCallback(Callback<void> callback) override;
172 bool IsBroadcast() const override;
173 Address GetBroadcast() const override;
174 bool IsMulticast() const override;
175 Address GetMulticast(Ipv4Address multicastGroup) const override;
176 Address GetMulticast(Ipv6Address addr) const override;
177 bool IsBridge() const override;
178 bool IsPointToPoint() const override;
179 bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
180 bool SendFrom(Ptr<Packet> packet,
181 const Address& source,
182 const Address& dest,
183 uint16_t protocolNumber) override;
184 Ptr<Node> GetNode() const override;
185 void SetNode(Ptr<Node> node) override;
186 bool NeedsArp() const override;
187
190 bool SupportsSendFrom() const override;
191
201
209 int64_t AssignStreams(int64_t stream);
210
211 private:
212 // Inherited from NetDevice/Object
213 void DoDispose() override;
214 void DoInitialize() override;
215
219 void LinkUp();
220
224 void LinkDown();
225
232
236 void CompleteConfig();
237
255 Mac48Address BuildPseudoMacAddress(uint16_t panId, Mac16Address shortAddr) const;
256
261
266
271
276
282
288
293
298
303
308
316};
317
318} // namespace ns3
319
320#endif /* LR_WPAN_NET_DEVICE_H */
a polymophic address class
Definition: address.h:100
Callback template class.
Definition: callback.h:443
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
Describes an IPv6 address.
Definition: ipv6-address.h:50
Network layer to device interface.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
static TypeId GetTypeId()
Get the type ID.
PseudoMacAddressMode_e m_pseudoMacMode
How the pseudo MAC address is created.
PseudoMacAddressMode_e
How the pseudo-MAC address is built from the short address (XXXX) and the PanId (YYYY).
@ RFC4944
YYYY:0000:XXXX (with U/L bit set to local)
@ RFC6282
0200:0000:XXXX
Ptr< LrWpanMac > m_mac
The MAC for this NetDevice.
Address GetAddress() const override
This method indirects to LrWpanMac::SetShortAddress ()
Ptr< Node > GetNode() const override
bool m_useAcks
Configure the NetDevice to request MAC layer acknowledgments when sending packets using the Send() AP...
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaca)
Set the CSMA/CA implementation to be used by the MAC and this NetDevice.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Ptr< SpectrumChannel > DoGetChannel() const
Attribute accessor method for the "Channel" attribute.
Ptr< LrWpanMac > GetMac() const
Get the MAC used by this NetDevice.
bool SupportsSendFrom() const override
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
void AddLinkChangeCallback(Callback< void > callback) override
void SetNode(Ptr< Node > node) override
Ptr< Node > m_node
The node associated with this NetDevice.
void SetPhy(Ptr< LrWpanPhy > phy)
Set the PHY to be used by the MAC and this NetDevice.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
bool IsBroadcast() const override
bool SetMtu(const uint16_t mtu) override
uint16_t GetMtu() const override
bool IsMulticast() const override
void McpsDataIndication(McpsDataIndicationParams params, Ptr< Packet > pkt)
The callback used by the MAC to hand over incoming packets to the NetDevice.
ReceiveCallback m_receiveCallback
Upper layer callback used for notification of new data packet arrivals.
bool m_linkUp
Is the link/device currently up and running?
Ptr< LrWpanPhy > GetPhy() const
Get the PHY used by this NetDevice.
uint32_t GetIfIndex() const override
bool IsLinkUp() const override
Ptr< LrWpanPhy > m_phy
The PHY for this NetDevice.
void SetAddress(Address address) override
This method indirects to LrWpanMac::SetShortAddress ()
void SetPanAssociation(uint16_t panId, Mac64Address coordExtAddr, Mac16Address coordShortAddr, Mac16Address assignedShortAddr)
This method is use to manually configure the coordinator through which the device or coordinator is a...
Ptr< LrWpanCsmaCa > GetCsmaCa() const
Get the CSMA/CA implementation used by this NetDevice.
Address GetBroadcast() const override
void SetMac(Ptr< LrWpanMac > mac)
Set the MAC to be used by this NetDevice.
bool IsBridge() const override
Return true if the net device is acting as a bridge.
void SetIfIndex(const uint32_t index) override
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
bool m_configComplete
True if MAC, PHY and CSMA/CA where successfully configured and the NetDevice is ready for being used.
bool NeedsArp() const override
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
Mac48Address BuildPseudoMacAddress(uint16_t panId, Mac16Address shortAddr) const
Builds a "pseudo 48-bit address" from the PanId and Short Address The form is PanId : 0x0 : 0x0 : Sho...
Ptr< LrWpanCsmaCa > m_csmaca
The CSMA/CA implementation for this NetDevice.
TracedCallback m_linkChanges
Trace source for link up/down changes.
void CompleteConfig()
Configure PHY, MAC and CSMA/CA.
void DoDispose() override
Destructor implementation.
void LinkUp()
Mark NetDevice link as up.
Ptr< Channel > GetChannel() const override
void DoInitialize() override
Initialize() implementation.
void LinkDown()
Mark NetDevice link as down.
uint32_t m_ifIndex
The interface index of this NetDevice.
This class can contain 16 bit addresses.
Definition: mac16-address.h:44
an EUI-48 address
Definition: mac48-address.h:46
an EUI-64 address
Definition: mac64-address.h:46
Network layer to device interface.
Definition: net-device.h:98
Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, enum PacketType > PromiscReceiveCallback
Definition: net-device.h:352
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.
MCPS-DATA.indication params.
Definition: lr-wpan-mac.h:412