27 #include <ns3/abort.h>    30 #include <ns3/spectrum-channel.h>    31 #include <ns3/pointer.h>    32 #include <ns3/boolean.h>    33 #include <ns3/mobility-model.h>    34 #include <ns3/packet.h>    48     .SetGroupName (
"LrWpan")
    50     .AddAttribute (
"Channel", 
"The channel attached to this device",
    53                    MakePointerChecker<SpectrumChannel> ())
    54     .AddAttribute (
"Phy", 
"The PHY layer attached to this device.",
    58                    MakePointerChecker<LrWpanPhy> ())
    59     .AddAttribute (
"Mac", 
"The MAC layer attached to this device.",
    63                    MakePointerChecker<LrWpanMac> ())
    64     .AddAttribute (
"UseAcks", 
"Request acknowledgments for data frames.",
    73   : m_configComplete (false)
    76   m_mac = CreateObject<LrWpanMac> ();
    77   m_phy = CreateObject<LrWpanPhy> ();
    78   m_csmaca = CreateObject<LrWpanCsmaCa> ();
   108   m_phy->Initialize ();
   109   m_mac->Initialize ();
   134       NS_LOG_WARN (
"LrWpanNetDevice: no Mobility found on the node, probably it's not a good idea.");
   138   m_phy->SetErrorModel (model);
   139   m_phy->SetDevice (
this);
   224   return m_phy->GetChannel ();
   247   return m_phy->GetChannel ();
   261   return m_mac->GetShortAddress ();
   383       NS_LOG_ERROR (
"Fragmentation is needed for this packet, drop the packet ");
   399   m_mac->McpsDataRequest (m_mcpsDataRequestParams, packet);
   448   NS_LOG_WARN (
"Unsupported; use LrWpan MAC APIs instead");
   470   int64_t streamIndex = stream;
   471   streamIndex += 
m_csmaca->AssignStreams (stream);
   472   streamIndex += 
m_phy->AssignStreams (stream);
   473   NS_LOG_DEBUG (
"Number of assigned RV streams:  " << (streamIndex - stream));
   474   return (streamIndex - stream);
 virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
uint16_t m_dstPanId
Destination PAN identifier. 
virtual uint16_t GetMtu(void) const
virtual void SetNode(Ptr< Node > node)
virtual void DoInitialize(void)
Initialize() implementation. 
virtual void AddLinkChangeCallback(Callback< void > callback)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
  AttributeValue implementation for Boolean. 
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message. 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
void PlmeGetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttributeIdentifier id, LrWpanPhyPibAttributes *attribute)
IEEE 802.15.4-2006 section 6.2.2.6 PLME-GET.confirm Get attributes per definition from Table 23 in se...
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
bool m_useAcks
Configure the NetDevice to request MAC layer acknowledgments when sending packets using the Send() AP...
virtual Address GetBroadcast(void) const
Mac16Address m_dstAddr
Destination address. 
static Mac16Address ConvertFrom(const Address &address)
ReceiveCallback m_receiveCallback
Upper layer callback used for notification of new data packet arrivals. 
static TypeId GetTypeId(void)
Get the type ID. 
TracedCallback m_linkChanges
Trace source for link up/down changes. 
virtual uint32_t GetIfIndex(void) const
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
 Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
void PlmeCcaConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status. 
virtual bool SupportsSendFrom(void) const
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
virtual Address GetAddress(void) const
This method indirects to LrWpanMac::SetShortAddress () 
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual void DoDispose(void)
Destructor implementation. 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function. 
virtual void DoDispose(void)
Destructor implementation. 
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge. 
Network layer to device interface. 
uint8_t m_msduHandle
MSDU handle. 
a polymophic address class 
Ptr< LrWpanPhy > GetPhy(void) const
Get the PHY used by this NetDevice. 
virtual void SetAddress(Address address)
This method indirects to LrWpanMac::SetShortAddress () 
virtual Ptr< Channel > GetChannel(void) const
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...
void SetLrWpanMacState(LrWpanMacState macState)
CSMA-CA algorithm calls back the MAC after executing channel assessment. 
Keep track of the current position and velocity of an object. 
Ptr< LrWpanMac > m_mac
The MAC for this NetDevice. 
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t energyLevel)
IEEE 802.15.4-2006 section 6.2.2.4 PLME-ED.confirm status and energy level. 
virtual void SetIfIndex(const uint32_t index)
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to...
Ptr< LrWpanCsmaCa > m_csmaca
The CSMA/CA implementation for this NetDevice. 
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
 Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void DoInitialize(void)
Initialize() implementation. 
virtual bool IsMulticast(void) const
void LinkDown(void)
Mark NetDevice link as down. 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void PdDataConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.1.2 Confirm the end of transmission of an MPDU to MAC. 
uint8_t m_txOptions
Tx Options (bitfield) 
void SetMac(Ptr< LrWpanMac > mac)
Set the MAC to be used by this NetDevice. 
void PdDataIndication(uint32_t psduLength, Ptr< Packet > p, uint8_t lqi)
IEEE 802.15.4-2006 section 6.2.1.3 PD-DATA.indication Indicates the transfer of an MPDU from PHY to M...
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object. 
LrWpanAddressMode m_srcAddrMode
Source address mode. 
bool m_linkUp
Is the link/device currently up and running? 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
Hold objects of type Ptr<T>. 
LrWpanAddressMode m_dstAddrMode
Destination address mode. 
Ptr< const AttributeChecker > MakeBooleanChecker(void)
  
Ptr< LrWpanPhy > m_phy
The PHY for this NetDevice. 
void CompleteConfig(void)
Configure PHY, MAC and CSMA/CA. 
Ptr< SpectrumChannel > DoGetChannel(void) const
Attribute accessor method for the "Channel" attribute. 
uint32_t m_ifIndex
The interface index of this NetDevice. 
Mac16Address m_srcAddr
Source address. 
This class can contain 16 bit addresses. 
void McpsDataIndication(McpsDataIndicationParams params, Ptr< Packet > pkt)
The callback used by the MAC to hand over incoming packets to the NetDevice. 
virtual ~LrWpanNetDevice(void)
Describes an IPv6 address. 
Ipv4 addresses are stored in host order in this class. 
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link. 
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context). 
Network layer to device interface. 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN. 
void LinkUp(void)
Mark NetDevice link as up. 
Ptr< LrWpanCsmaCa > GetCsmaCa(void) const
Get the CSMA/CA implementation used by this NetDevice. 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
Ptr< Node > m_node
The node associated with this NetDevice. 
virtual Ptr< Node > GetNode(void) const
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR. 
void PlmeSetTRXStateConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state. 
MCPS-DATA.request params. 
virtual bool IsLinkUp(void) const
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group. 
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice. 
bool m_configComplete
True if MAC, PHY and CSMA/CA where successfully configured and the NetDevice is ready for being used...
void SetCsmaCa(Ptr< LrWpanCsmaCa > csmaca)
Set the CSMA/CA implementation to be used by the MAC and this NetDevice. 
a unique identifier for an interface. 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
void PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttributeIdentifier id)
IEEE 802.15.4-2006 section 6.2.2.10 PLME-SET.confirm Set attributes per definition from Table 23 in s...
virtual bool SetMtu(const uint16_t mtu)
virtual bool IsBroadcast(void) const
MCPS-DATA.indication params. 
virtual bool NeedsArp(void) const