A Discrete-Event Network Simulator
API
lr-wpan-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) 2011 The Boeing Company
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:
19 * Tom Henderson <thomas.r.henderson@boeing.com>
20 * Tommaso Pecorella <tommaso.pecorella@unifi.it>
21 * Margherita Filippetti <morag87@gmail.com>
22 */
23#ifndef LR_WPAN_NET_DEVICE_H
24#define LR_WPAN_NET_DEVICE_H
25
26#include <ns3/net-device.h>
27#include <ns3/traced-callback.h>
28#include <ns3/lr-wpan-mac.h>
29
30namespace ns3 {
31
32class LrWpanPhy;
33class LrWpanCsmaCa;
34class SpectrumChannel;
35class Node;
36
50{
51public:
57 static TypeId GetTypeId (void);
58
59 LrWpanNetDevice (void);
60 virtual ~LrWpanNetDevice (void);
61
70 RFC6282
71 };
72
79
86
92 void SetCsmaCa (Ptr<LrWpanCsmaCa> csmaca);
93
101
107 Ptr<LrWpanMac> GetMac (void) const;
108
114 Ptr<LrWpanPhy> GetPhy (void) const;
115
121 Ptr<LrWpanCsmaCa> GetCsmaCa (void) const;
122
123 // From class NetDevice
124 virtual void SetIfIndex (const uint32_t index);
125 virtual uint32_t GetIfIndex (void) const;
126 virtual Ptr<Channel> GetChannel (void) const;
131 virtual void SetAddress (Address address);
136 virtual Address GetAddress (void) const;
137 virtual bool SetMtu (const uint16_t mtu);
138 virtual uint16_t GetMtu (void) const;
139 virtual bool IsLinkUp (void) const;
140 virtual void AddLinkChangeCallback (Callback<void> callback);
141 virtual bool IsBroadcast (void) const;
142 virtual Address GetBroadcast (void) const;
143 virtual bool IsMulticast (void) const;
144 virtual Address GetMulticast (Ipv4Address multicastGroup) const;
145 virtual Address GetMulticast (Ipv6Address addr) const;
146 virtual bool IsBridge (void) const;
147 virtual bool IsPointToPoint (void) const;
148 virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
149 virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
150 virtual Ptr<Node> GetNode (void) const;
151 virtual void SetNode (Ptr<Node> node);
152 virtual bool NeedsArp (void) const;
153
156 virtual bool SupportsSendFrom (void) const;
157
167
175 int64_t AssignStreams (int64_t stream);
176
177private:
178 // Inherited from NetDevice/Object
179 virtual void DoDispose (void);
180 virtual void DoInitialize (void);
181
185 void LinkUp (void);
186
190 void LinkDown (void);
191
198
202 void CompleteConfig (void);
203
221 Mac48Address BuildPseudoMacAddress (uint16_t panId, Mac16Address shortAddr) const;
222
227
232
237
242
248
254
259
264
269
274
282};
283
284} // namespace ns3
285
286#endif /* LR_WPAN_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.
virtual void SetIfIndex(const uint32_t index)
virtual void AddLinkChangeCallback(Callback< void > callback)
virtual void DoInitialize(void)
Initialize() implementation.
virtual bool IsBroadcast(void) const
virtual bool SetMtu(const uint16_t mtu)
virtual ~LrWpanNetDevice(void)
virtual bool NeedsArp(void) const
PseudoMacAddressMode_e m_pseudoMacMode
How the pseudo MAC address is created.
virtual bool IsLinkUp(void) const
virtual void DoDispose(void)
Destructor implementation.
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
virtual void SetNode(Ptr< Node > node)
Ptr< LrWpanMac > m_mac
The MAC for this NetDevice.
virtual Ptr< Channel > GetChannel(void) const
void CompleteConfig(void)
Configure PHY, MAC and CSMA/CA.
virtual void SetAddress(Address address)
This method indirects to LrWpanMac::SetShortAddress ()
bool m_useAcks
Configure the NetDevice to request MAC layer acknowledgments when sending packets using the Send() AP...
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual Ptr< Node > GetNode(void) const
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaca)
Set the CSMA/CA implementation to be used by the MAC and this NetDevice.
void LinkUp(void)
Mark NetDevice link as up.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
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.
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
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.
virtual bool IsMulticast(void) const
bool m_linkUp
Is the link/device currently up and running?
Ptr< LrWpanPhy > GetPhy(void) const
Get the PHY used by this NetDevice.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Ptr< LrWpanPhy > m_phy
The PHY for this NetDevice.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
virtual Address GetBroadcast(void) const
virtual uint32_t GetIfIndex(void) const
void SetMac(Ptr< LrWpanMac > mac)
Set the MAC to be used by this NetDevice.
virtual Address GetAddress(void) const
This method indirects to LrWpanMac::SetShortAddress ()
void LinkDown(void)
Mark NetDevice link as down.
virtual bool SupportsSendFrom(void) const
bool m_configComplete
True if MAC, PHY and CSMA/CA where successfully configured and the NetDevice is ready for being used.
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...
static TypeId GetTypeId(void)
Get the type ID.
Ptr< LrWpanCsmaCa > GetCsmaCa(void) const
Get the CSMA/CA implementation used by this NetDevice.
Ptr< SpectrumChannel > DoGetChannel(void) const
Attribute accessor method for the "Channel" attribute.
Ptr< LrWpanCsmaCa > m_csmaca
The CSMA/CA implementation for this NetDevice.
TracedCallback m_linkChanges
Trace source for link up/down changes.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual uint16_t GetMtu(void) const
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
uint32_t m_ifIndex
The interface index of this NetDevice.
This class can contain 16 bit addresses.
Definition: mac16-address.h:42
an EUI-48 address
Definition: mac48-address.h:44
Network layer to device interface.
Definition: net-device.h:96
Callback< bool, Ptr< NetDevice >, Ptr< const Packet >, uint16_t, const Address &, const Address &, enum PacketType > PromiscReceiveCallback
Definition: net-device.h:343
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Forward calls to a chain of Callback.
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.
channel
Definition: third.py:92
mac
Definition: third.py:96
phy
Definition: third.py:93
MCPS-DATA.indication params.
Definition: lr-wpan-mac.h:271