A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::LrWpanMac Class Reference

Class that implements the LR-WPAN Mac state machine. More...

#include <lr-wpan-mac.h>

+ Inheritance diagram for ns3::LrWpanMac:
+ Collaboration diagram for ns3::LrWpanMac:

Classes

struct  TxQueueElement
 Helper structure for managing transmission queue elements. More...
 

Public Member Functions

 LrWpanMac (void)
 Default constructor. More...
 
virtual ~LrWpanMac (void)
 
LrWpanAssociationStatus GetAssociationStatus (void) const
 Get the current association status. More...
 
Mac64Address GetExtendedAddress (void) const
 Get the extended address of this MAC. More...
 
uint64_t GetMacAckWaitDuration (void) const
 Get the macAckWaitDuration attribute value. More...
 
uint8_t GetMacMaxFrameRetries (void) const
 Get the macMaxFrameRetries attribute value. More...
 
uint16_t GetPanId (void) const
 Get the PAN id used by this MAC. More...
 
Ptr< LrWpanPhyGetPhy (void)
 Get the underlying PHY of the MAC. More...
 
bool GetRxOnWhenIdle (void)
 Check if the receiver will be enabled when the MAC is idle. More...
 
Mac16Address GetShortAddress (void) const
 Get the short address of this MAC. More...
 
void McpsDataRequest (McpsDataRequestParams params, Ptr< Packet > p)
 IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU. More...
 
void PdDataConfirm (LrWpanPhyEnumeration status)
 IEEE 802.15.4-2006 section 6.2.1.2 Confirm the end of transmission of an MPDU to MAC. More...
 
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 MAC (receiving) More...
 
void PlmeCcaConfirm (LrWpanPhyEnumeration status)
 IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status. More...
 
void PlmeEdConfirm (LrWpanPhyEnumeration status, uint8_t energyLevel)
 IEEE 802.15.4-2006 section 6.2.2.4 PLME-ED.confirm status and energy level. More...
 
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 section 6.4.2. More...
 
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 section 6.4.2. More...
 
void PlmeSetTRXStateConfirm (LrWpanPhyEnumeration status)
 IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state. More...
 
void SetAssociationStatus (LrWpanAssociationStatus status)
 Set the current association status. More...
 
void SetCsmaCa (Ptr< LrWpanCsmaCa > csmaCa)
 Set the CSMA/CA implementation to be used by the MAC. More...
 
void SetExtendedAddress (Mac64Address address)
 Set the extended address of this MAC. More...
 
void SetLrWpanMacState (LrWpanMacState macState)
 CSMA-CA algorithm calls back the MAC after executing channel assessment. More...
 
void SetMacMaxFrameRetries (uint8_t retries)
 Set the macMaxFrameRetries attribute value. More...
 
void SetMcpsDataConfirmCallback (McpsDataConfirmCallback c)
 Set the callback for the confirmation of a data transmission request. More...
 
void SetMcpsDataIndicationCallback (McpsDataIndicationCallback c)
 Set the callback for the indication of an incoming data packet. More...
 
void SetPanId (uint16_t panId)
 Set the PAN id used by this MAC. More...
 
void SetPhy (Ptr< LrWpanPhy > phy)
 Set the underlying PHY for the MAC. More...
 
void SetRxOnWhenIdle (bool rxOnWhenIdle)
 Set if the receiver should be enabled when the MAC is idle. More...
 
void SetShortAddress (Mac16Address address)
 Set the short address of this MAC. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 
virtual ~Object ()
 
void AggregateObject (Ptr< Object > other)
 
void Dispose (void)
 Run the DoDispose methods of this object and all the objects aggregated to it. More...
 
AggregateIterator GetAggregateIterator (void) const
 
virtual TypeId GetInstanceTypeId (void) const
 
template<typename T >
Ptr< T > GetObject (void) const
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 
void Initialize (void)
 This method calls the virtual DoInitialize method on all the objects aggregated to this object. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
 
void SetAttribute (std::string name, const AttributeValue &value)
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
static void Cleanup (void)
 Noop. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Public Attributes

uint64_t m_aBaseSlotDuration
 Length of a superframe slot in symbols. More...
 
uint64_t m_aBaseSuperframeDuration
 Length of a superframe in symbols. More...
 
uint64_t m_aNumSuperframeSlots
 Number of a superframe slots per superframe. More...
 
uint64_t m_macBeaconOrder
 Specification of how often the coordinator transmits its beacon. More...
 
uint64_t m_macBeaconTxTime
 The time that the device transmitted its last beacon frame, in symbol periods. More...
 
SequenceNumber8 m_macDsn
 Sequence number added to transmitted data or MAC command frame, 00-ff. More...
 
uint8_t m_macMaxFrameRetries
 The maximum number of retries allowed after a transmission failure. More...
 
uint16_t m_macPanId
 16 bits id of PAN on which this device is operating. More...
 
bool m_macPromiscuousMode
 Indicates if MAC sublayer is in receive all mode. More...
 
bool m_macRxOnWhenIdle
 Indication of whether the MAC sublayer is to enable its receiver during idle periods. More...
 
uint64_t m_macSuperframeOrder
 The length of the active portion of the outgoing superframe, including the beacon frame. More...
 
uint64_t m_macSyncSymbolOffset
 Symbol boundary is same as m_macBeaconTxTime. More...
 

Static Public Attributes

static const uint32_t aMinMPDUOverhead = 9
 The minimum number of octets added by the MAC sublayer to the PSDU. More...
 

Protected Member Functions

virtual void DoDispose (void)
 This method is called by Object::Dispose or by the object's destructor, whichever comes first. More...
 
virtual void DoInitialize (void)
 This method is called only once by Object::Initialize. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 
virtual void NotifyNewAggregate (void)
 This method is invoked whenever two sets of objects are aggregated together. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 
virtual void NotifyConstructionCompleted (void)
 This method is invoked once all member attributes have been initialized. More...
 

Private Member Functions

void AckWaitTimeout (void)
 Handle an ACK timeout with a packet retransmission, if there are retransmission left, or a packet drop. More...
 
void ChangeMacState (LrWpanMacState newState)
 Change the current MAC state to the given new state. More...
 
void CheckQueue (void)
 Check the transmission queue. More...
 
bool PrepareRetransmission (void)
 Check for remaining retransmissions for the packet currently being sent. More...
 
void RemoveFirstTxQElement ()
 Remove the tip of the transmission queue, including clean up related to the last packet transmission. More...
 
void SendAck (uint8_t seqno)
 Send an acknowledgment packet for the given sequence number. More...
 

Private Attributes

EventId m_ackWaitTimeout
 Scheduler event for the ACK timeout of the currently transmitted data packet. More...
 
LrWpanAssociationStatus m_associationStatus
 The current association status of the MAC layer. More...
 
Ptr< LrWpanCsmaCam_csmaCa
 The CSMA/CA implementation used by this MAC. More...
 
LrWpanMacState m_lrWpanMacState
 The current state of the MAC layer. More...
 
TracedCallback< Ptr< const
Packet > > 
m_macPromiscRxTrace
 The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition). More...
 
TracedCallback< Ptr< const
Packet > > 
m_macRxDropTrace
 The trace source fired for packets successfully received by the device but dropped before being forwarded up to higher layers (at the L2/L3 transition). More...
 
TracedCallback< Ptr< const
Packet > > 
m_macRxTrace
 The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition). More...
 
TracedCallback< LrWpanMacState,
LrWpanMacState
m_macStateLogger
 
TracedCallback< Ptr< const
Packet > > 
m_macTxDequeueTrace
 The trace source fired when packets are dequeued from the L3/l2 transmission queue. More...
 
TracedCallback< Ptr< const
Packet > > 
m_macTxDropTrace
 The trace source fired when packets are dropped due to missing ACKs or because of transmission failures in L1. More...
 
TracedCallback< Ptr< const
Packet > > 
m_macTxEnqueueTrace
 The trace source fired when packets come into the "top" of the device at the L3/L2 transition, when being queued for transmission. More...
 
TracedCallback< Ptr< const
Packet > > 
m_macTxOkTrace
 The trace source fired when packets where successfully transmitted, that is an acknowledgment was received, if requested, or the packet was successfully sent by L1, if no ACK was requested. More...
 
TracedCallback< Ptr< const
Packet > > 
m_macTxTrace
 The trace source fired when packets are being sent down to L1. More...
 
McpsDataConfirmCallback m_mcpsDataConfirmCallback
 This callback is used to report data transmission request status to the upper layers. More...
 
McpsDataIndicationCallback m_mcpsDataIndicationCallback
 This callback is used to notify incoming packets to the upper layers. More...
 
uint8_t m_numCsmacaRetry
 The number of CSMA/CA retries used for sending the current packet. More...
 
Ptr< LrWpanPhym_phy
 The PHY associated with this MAC. More...
 
TracedCallback< Ptr< const
Packet > > 
m_promiscSnifferTrace
 A trace source that emulates a promiscuous mode protocol sniffer connected to the device. More...
 
uint8_t m_retransmission
 The number of already used retransmission for the currently transmitted packet. More...
 
Mac64Address m_selfExt
 The extended address used by this MAC. More...
 
TracedCallback< Ptr< const
Packet >, uint8_t, uint8_t > 
m_sentPktTrace
 The trace source fired when packets are considered as successfully sent or the transmission has been given up. More...
 
EventId m_setMacState
 Scheduler event for a deferred MAC state change. More...
 
Mac16Address m_shortAddress
 The short address used by this MAC. More...
 
TracedCallback< Ptr< const
Packet > > 
m_snifferTrace
 A trace source that emulates a non-promiscuous protocol sniffer connected to the device. More...
 
Ptr< Packetm_txPkt
 The packet which is currently being sent by the MAC layer. More...
 
std::deque< TxQueueElement * > m_txQueue
 The transmit queue used by the MAC. More...
 

Detailed Description

Class that implements the LR-WPAN Mac state machine.

Config Paths

ns3::LrWpanMac is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3::LrWpanNetDevice/Mac

Attributes

  • PanId: 16-bit identifier of the associated PAN

TraceSources

  • MacTxEnqueue: Trace source indicating a packet has was enqueued in the transaction queue
  • MacTxDequeue: Trace source indicating a packet has was dequeued from the transaction queue
  • MacTx: Trace source indicating a packet has arrived for transmission by this device
  • MacTxOk: Trace source indicating a packet has been successfully sent
  • MacTxDrop: Trace source indicating a packet has been dropped during transmission
  • MacPromiscRx: A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a promiscuous trace,
  • MacRx: A packet has been received by this device, has been passed up from the physical layer and is being forwarded up the local protocol stack. This is a non-promiscuous trace,
  • MacRxDrop: Trace source indicating a packet was received, but dropped before being forwarded up the stack
  • Sniffer: Trace source simulating a non-promiscuous packet sniffer attached to the device
  • PromiscSniffer: Trace source simulating a promiscuous packet sniffer attached to the device
  • MacState: The state of LrWpan Mac
  • MacSentPkt: Trace source reporting some information about the sent packet

Definition at line 163 of file lr-wpan-mac.h.

Constructor & Destructor Documentation

ns3::LrWpanMac::~LrWpanMac ( void  )
virtual

Definition at line 125 of file lr-wpan-mac.cc.

Member Function Documentation

void ns3::LrWpanMac::AckWaitTimeout ( void  )
private

Handle an ACK timeout with a packet retransmission, if there are retransmission left, or a packet drop.

Definition at line 706 of file lr-wpan-mac.cc.

References ns3::MAC_CSMA, ns3::MAC_IDLE, NS_LOG_FUNCTION, PrepareRetransmission(), and SetLrWpanMacState().

Referenced by PdDataConfirm().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::ChangeMacState ( LrWpanMacState  newState)
private

Change the current MAC state to the given new state.

Parameters
newStatethe new state

Definition at line 987 of file lr-wpan-mac.cc.

References m_lrWpanMacState, m_macStateLogger, and NS_LOG_LOGIC.

Referenced by LrWpanMac(), PdDataIndication(), SendAck(), and SetLrWpanMacState().

+ Here is the caller graph for this function:

void ns3::LrWpanMac::CheckQueue ( void  )
private

Check the transmission queue.

If there are packets in the transmission queue and the MAC is idle, pick the first one and initiate a packet transmission.

Definition at line 394 of file lr-wpan-mac.cc.

References ns3::EventId::IsRunning(), m_lrWpanMacState, m_setMacState, m_txPkt, m_txQueue, ns3::MAC_CSMA, ns3::MAC_IDLE, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), SetLrWpanMacState(), and ns3::LrWpanMac::TxQueueElement::txQPkt.

Referenced by McpsDataRequest(), and SetLrWpanMacState().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::DoDispose ( void  )
protectedvirtual

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

It is safe to call GetObject from within this method.

Reimplemented from ns3::Object.

Definition at line 145 of file lr-wpan-mac.cc.

References ns3::Object::DoDispose(), m_csmaCa, m_mcpsDataConfirmCallback, m_mcpsDataIndicationCallback, m_phy, m_txPkt, and m_txQueue.

+ Here is the call graph for this function:

void ns3::LrWpanMac::DoInitialize ( void  )
protectedvirtual

This method is called only once by Object::Initialize.

If the user calls Object::Initialize multiple times, DoInitialize is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject and AggregateObject from within this method.

Reimplemented from ns3::Object.

Definition at line 130 of file lr-wpan-mac.cc.

References ns3::Object::DoInitialize(), ns3::IEEE_802_15_4_PHY_RX_ON, ns3::IEEE_802_15_4_PHY_TRX_OFF, m_macRxOnWhenIdle, and m_phy.

+ Here is the call graph for this function:

LrWpanAssociationStatus ns3::LrWpanMac::GetAssociationStatus ( void  ) const

Get the current association status.

Returns
current association status

Definition at line 963 of file lr-wpan-mac.cc.

References m_associationStatus.

Mac64Address ns3::LrWpanMac::GetExtendedAddress ( void  ) const

Get the extended address of this MAC.

Returns
the extended address

Definition at line 214 of file lr-wpan-mac.cc.

References m_selfExt, and NS_LOG_FUNCTION.

Referenced by McpsDataRequest().

+ Here is the caller graph for this function:

uint64_t ns3::LrWpanMac::GetMacAckWaitDuration ( void  ) const

Get the macAckWaitDuration attribute value.

Returns
the maximum number symbols to wait for an acknowledgment frame

Definition at line 997 of file lr-wpan-mac.cc.

References m_csmaCa, and m_phy.

Referenced by PdDataConfirm().

+ Here is the caller graph for this function:

uint8_t ns3::LrWpanMac::GetMacMaxFrameRetries ( void  ) const

Get the macMaxFrameRetries attribute value.

Returns
the maximum number of retries

Definition at line 1004 of file lr-wpan-mac.cc.

References m_macMaxFrameRetries.

uint16_t ns3::LrWpanMac::GetPanId ( void  ) const

Get the PAN id used by this MAC.

Returns
the PAN id.

Definition at line 975 of file lr-wpan-mac.cc.

References m_macPanId.

Referenced by McpsDataRequest().

+ Here is the caller graph for this function:

Ptr< LrWpanPhy > ns3::LrWpanMac::GetPhy ( void  )

Get the underlying PHY of the MAC.

Returns
the PHY

Definition at line 420 of file lr-wpan-mac.cc.

References m_phy.

bool ns3::LrWpanMac::GetRxOnWhenIdle ( void  )

Check if the receiver will be enabled when the MAC is idle.

Returns
true, if the receiver is enabled during idle periods, false otherwise

Definition at line 167 of file lr-wpan-mac.cc.

References m_macRxOnWhenIdle.

Mac16Address ns3::LrWpanMac::GetShortAddress ( void  ) const

Get the short address of this MAC.

Returns
the short address

Definition at line 207 of file lr-wpan-mac.cc.

References m_shortAddress, and NS_LOG_FUNCTION.

Referenced by McpsDataRequest().

+ Here is the caller graph for this function:

TypeId ns3::LrWpanMac::GetTypeId ( void  )
static
void ns3::LrWpanMac::McpsDataRequest ( McpsDataRequestParams  params,
Ptr< Packet p 
)

IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.

Parameters
paramsthe request parameters
pthe packet to be transmitted

Definition at line 220 of file lr-wpan-mac.cc.

References ns3::Packet::AddHeader(), ns3::ADDR_MODE_RESERVED, ns3::Packet::AddTrailer(), ns3::LrWpanPhy::aMaxPhyPacketSize, aMinMPDUOverhead, CheckQueue(), ns3::Node::ChecksumEnabled(), ns3::LrWpanMacTrailer::EnableFcs(), ns3::EXT_ADDR, GetExtendedAddress(), GetPanId(), GetShortAddress(), ns3::Packet::GetSize(), ns3::SequenceNumber< NUMERIC_TYPE, SIGNED_TYPE >::GetValue(), ns3::IEEE_802_15_4_FRAME_TOO_LONG, ns3::IEEE_802_15_4_INVALID_ADDRESS, ns3::IEEE_802_15_4_INVALID_PARAMETER, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), ns3::LrWpanMacHeader::LRWPAN_MAC_DATA, m_csmaCa, ns3::McpsDataRequestParams::m_dstAddr, ns3::McpsDataRequestParams::m_dstAddrMode, ns3::McpsDataRequestParams::m_dstPanId, m_macDsn, m_macTxEnqueueTrace, m_mcpsDataConfirmCallback, ns3::McpsDataRequestParams::m_msduHandle, ns3::McpsDataConfirmParams::m_msduHandle, ns3::McpsDataRequestParams::m_srcAddrMode, ns3::McpsDataConfirmParams::m_status, ns3::McpsDataRequestParams::m_txOptions, m_txQueue, ns3::NO_PANID_ADDR, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::LrWpanMacTrailer::SetFcs(), ns3::SHORT_ADDR, ns3::TX_OPTION_ACK, ns3::TX_OPTION_GTS, ns3::TX_OPTION_INDIRECT, ns3::LrWpanMac::TxQueueElement::txQMsduHandle, and ns3::LrWpanMac::TxQueueElement::txQPkt.

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::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 MAC (receiving)

Parameters
psduLengthnumber of bytes in the PSDU
pthe packet to be transmitted
lqiLink quality (LQI) value measured during reception of the PPDU

Definition at line 438 of file lr-wpan-mac.cc.

References ns3::EventId::Cancel(), ChangeMacState(), ns3::LrWpanMacTrailer::CheckFcs(), ns3::Node::ChecksumEnabled(), ns3::Packet::Copy(), ns3::LrWpanMacTrailer::EnableFcs(), ns3::LrWpanMacHeader::GetDstAddrMode(), ns3::LrWpanMacHeader::GetDstPanId(), ns3::LrWpanMacHeader::GetExtDstAddr(), ns3::LrWpanMacHeader::GetFrameVer(), ns3::LrWpanMacHeader::GetSeqNum(), ns3::LrWpanMacHeader::GetShortDstAddr(), ns3::LrWpanMacHeader::GetShortSrcAddr(), ns3::LrWpanMacHeader::GetSrcAddrMode(), ns3::LrWpanMacHeader::GetSrcPanId(), ns3::LrWpanMacHeader::GetType(), ns3::IEEE_802_15_4_SUCCESS, ns3::LrWpanMacHeader::IsAcknowledgment(), ns3::LrWpanMacHeader::IsAckReq(), ns3::LrWpanMacHeader::IsCommand(), ns3::LrWpanMacHeader::IsData(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), ns3::LrWpanMacHeader::LRWPAN_MAC_BEACON, ns3::LrWpanMacHeader::LRWPAN_MAC_COMMAND, ns3::LrWpanMacHeader::LRWPAN_MAC_DATA, ns3::LrWpanMacHeader::LRWPAN_MAC_RESERVED, m_ackWaitTimeout, m_csmaCa, ns3::McpsDataIndicationParams::m_dsn, ns3::McpsDataIndicationParams::m_dstAddr, ns3::McpsDataIndicationParams::m_dstAddrMode, ns3::McpsDataIndicationParams::m_dstPanId, m_lrWpanMacState, m_macPanId, m_macPromiscRxTrace, m_macPromiscuousMode, m_macRxDropTrace, m_macRxTrace, m_macTxOkTrace, m_mcpsDataConfirmCallback, m_mcpsDataIndicationCallback, ns3::McpsDataIndicationParams::m_mpduLinkQuality, ns3::McpsDataConfirmParams::m_msduHandle, m_promiscSnifferTrace, m_selfExt, m_setMacState, m_shortAddress, ns3::McpsDataIndicationParams::m_srcAddr, ns3::McpsDataIndicationParams::m_srcAddrMode, ns3::McpsDataIndicationParams::m_srcPanId, ns3::McpsDataConfirmParams::m_status, m_txPkt, m_txQueue, ns3::MAC_ACK_PENDING, ns3::MAC_CSMA, ns3::MAC_IDLE, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_FUNCTION, ns3::Packet::PeekHeader(), PrepareRetransmission(), RemoveFirstTxQElement(), ns3::Packet::RemoveHeader(), ns3::Packet::RemoveTrailer(), ns3::Simulator::ScheduleNow(), SendAck(), SetLrWpanMacState(), ns3::SHORT_ADDR, and ns3::LrWpanMac::TxQueueElement::txQMsduHandle.

Referenced by ns3::LrWpanNetDevice::CompleteConfig().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::PlmeCcaConfirm ( LrWpanPhyEnumeration  status)

IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.

Parameters
statusTRX_OFF, BUSY or IDLE

Definition at line 835 of file lr-wpan-mac.cc.

References m_csmaCa, and NS_LOG_FUNCTION.

void ns3::LrWpanMac::PlmeEdConfirm ( LrWpanPhyEnumeration  status,
uint8_t  energyLevel 
)

IEEE 802.15.4-2006 section 6.2.2.4 PLME-ED.confirm status and energy level.

Parameters
statusSUCCESS, TRX_OFF or TX_ON
energyLevel0x00-0xff ED level for the channel

Definition at line 843 of file lr-wpan-mac.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::LrWpanNetDevice::CompleteConfig().

+ Here is the caller graph for this function:

void ns3::LrWpanMac::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 section 6.4.2.

Parameters
statusSUCCESS or UNSUPPORTED_ATTRIBUTE
idthe attributed identifier
attributethe attribute value

Definition at line 850 of file lr-wpan-mac.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::LrWpanNetDevice::CompleteConfig().

+ Here is the caller graph for this function:

void ns3::LrWpanMac::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 section 6.4.2.

Parameters
statusSUCCESS, UNSUPPORTED_ATTRIBUTE, INVALID_PARAMETER, or READ_ONLY
idthe attributed identifier

Definition at line 896 of file lr-wpan-mac.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::LrWpanNetDevice::CompleteConfig().

+ Here is the caller graph for this function:

void ns3::LrWpanMac::PlmeSetTRXStateConfirm ( LrWpanPhyEnumeration  status)

IEEE 802.15.4-2006 section 6.2.2.8 PLME-SET-TRX-STATE.confirm Set PHY state.

Parameters
statusin RX_ON,TRX_OFF,FORCE_TRX_OFF,TX_ON

Definition at line 858 of file lr-wpan-mac.cc.

References ns3::Packet::GetSize(), ns3::IEEE_802_15_4_PHY_RX_ON, ns3::IEEE_802_15_4_PHY_SUCCESS, ns3::IEEE_802_15_4_PHY_TRX_OFF, ns3::IEEE_802_15_4_PHY_TX_ON, m_csmaCa, m_lrWpanMacState, m_macTxTrace, m_phy, m_promiscSnifferTrace, m_snifferTrace, m_txPkt, ns3::MAC_ACK_PENDING, ns3::MAC_CSMA, ns3::MAC_IDLE, ns3::MAC_SENDING, NS_ASSERT, NS_FATAL_ERROR, and NS_LOG_FUNCTION.

Referenced by ns3::LrWpanNetDevice::CompleteConfig().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ns3::LrWpanMac::PrepareRetransmission ( void  )
private

Check for remaining retransmissions for the packet currently being sent.

Drop the packet, if there are no retransmissions left.

Returns
true, if the packet should be retransmitted, false otherwise.

Definition at line 724 of file lr-wpan-mac.cc.

References ns3::IEEE_802_15_4_NO_ACK, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_csmaCa, m_macMaxFrameRetries, m_macTxDropTrace, m_mcpsDataConfirmCallback, ns3::McpsDataConfirmParams::m_msduHandle, m_numCsmacaRetry, m_retransmission, ns3::McpsDataConfirmParams::m_status, m_txQueue, NS_LOG_FUNCTION, RemoveFirstTxQElement(), ns3::LrWpanMac::TxQueueElement::txQMsduHandle, and ns3::LrWpanMac::TxQueueElement::txQPkt.

Referenced by AckWaitTimeout(), and PdDataIndication().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::RemoveFirstTxQElement ( )
private

Remove the tip of the transmission queue, including clean up related to the last packet transmission.

Definition at line 682 of file lr-wpan-mac.cc.

References ns3::Packet::Copy(), ns3::LrWpanMacHeader::GetShortDstAddr(), m_csmaCa, m_macTxDequeueTrace, m_numCsmacaRetry, m_retransmission, m_sentPktTrace, m_txPkt, m_txQueue, ns3::Packet::RemoveHeader(), and ns3::LrWpanMac::TxQueueElement::txQPkt.

Referenced by PdDataConfirm(), PdDataIndication(), PrepareRetransmission(), and SetLrWpanMacState().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::SendAck ( uint8_t  seqno)
private

Send an acknowledgment packet for the given sequence number.

Parameters
seqnothe sequence number for the ACK

Definition at line 653 of file lr-wpan-mac.cc.

References ns3::Packet::AddHeader(), ns3::Packet::AddTrailer(), ChangeMacState(), ns3::Node::ChecksumEnabled(), ns3::LrWpanMacTrailer::EnableFcs(), ns3::IEEE_802_15_4_PHY_TX_ON, ns3::LrWpanMacHeader::LRWPAN_MAC_ACKNOWLEDGMENT, m_lrWpanMacState, m_phy, m_txPkt, ns3::MAC_IDLE, ns3::MAC_SENDING, NS_ASSERT, NS_LOG_FUNCTION, and ns3::LrWpanMacTrailer::SetFcs().

Referenced by PdDataIndication().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::LrWpanMac::SetAssociationStatus ( LrWpanAssociationStatus  status)

Set the current association status.

Parameters
statusnew association status

Definition at line 969 of file lr-wpan-mac.cc.

References m_associationStatus.

void ns3::LrWpanMac::SetCsmaCa ( Ptr< LrWpanCsmaCa csmaCa)

Set the CSMA/CA implementation to be used by the MAC.

Parameters
csmaCathe CSMA/CA implementation

Definition at line 408 of file lr-wpan-mac.cc.

References m_csmaCa.

void ns3::LrWpanMac::SetExtendedAddress ( Mac64Address  address)

Set the extended address of this MAC.

Parameters
addressthe new address

Definition at line 199 of file lr-wpan-mac.cc.

References first::address, and m_selfExt.

void ns3::LrWpanMac::SetMacMaxFrameRetries ( uint8_t  retries)

Set the macMaxFrameRetries attribute value.

Parameters
retriesthe maximum number of retries

Definition at line 1010 of file lr-wpan-mac.cc.

References m_macMaxFrameRetries.

void ns3::LrWpanMac::SetMcpsDataConfirmCallback ( McpsDataConfirmCallback  c)

Set the callback for the confirmation of a data transmission request.

The callback implements MCPS-DATA.confirm SAP of IEEE 802.15.4-2006, section 7.1.1.2.

Parameters
cthe callback

Definition at line 432 of file lr-wpan-mac.cc.

References m_mcpsDataConfirmCallback.

void ns3::LrWpanMac::SetMcpsDataIndicationCallback ( McpsDataIndicationCallback  c)

Set the callback for the indication of an incoming data packet.

The callback implements MCPS-DATA.indication SAP of IEEE 802.15.4-2006, section 7.1.1.3.

Parameters
cthe callback

Definition at line 426 of file lr-wpan-mac.cc.

References m_mcpsDataIndicationCallback.

void ns3::LrWpanMac::SetPanId ( uint16_t  panId)

Set the PAN id used by this MAC.

Parameters
panIdthe new PAN id.

Definition at line 981 of file lr-wpan-mac.cc.

References m_macPanId.

void ns3::LrWpanMac::SetPhy ( Ptr< LrWpanPhy phy)

Set the underlying PHY for the MAC.

Parameters
phythe PHY

Definition at line 414 of file lr-wpan-mac.cc.

References m_phy.

void ns3::LrWpanMac::SetRxOnWhenIdle ( bool  rxOnWhenIdle)

Set if the receiver should be enabled when the MAC is idle.

Parameters
rxOnWhenIdleset to true to enable the receiver during idle periods

Definition at line 173 of file lr-wpan-mac.cc.

References ns3::IEEE_802_15_4_PHY_RX_ON, ns3::IEEE_802_15_4_PHY_TRX_OFF, m_lrWpanMacState, m_macRxOnWhenIdle, m_phy, ns3::MAC_IDLE, and NS_LOG_FUNCTION.

void ns3::LrWpanMac::SetShortAddress ( Mac16Address  address)

Set the short address of this MAC.

Parameters
addressthe new address

Definition at line 192 of file lr-wpan-mac.cc.

References first::address, and m_shortAddress.

Member Data Documentation

const uint32_t ns3::LrWpanMac::aMinMPDUOverhead = 9
static

The minimum number of octets added by the MAC sublayer to the PSDU.

See IEEE 802.15.4-2006, section 7.4.1, Table 85

Definition at line 177 of file lr-wpan-mac.h.

Referenced by McpsDataRequest().

uint64_t ns3::LrWpanMac::m_aBaseSlotDuration

Length of a superframe slot in symbols.

Defaults to 60 symbols in each superframe slot. See IEEE 802.15.4-2006, section 7.4.1, Table 85.

Definition at line 382 of file lr-wpan-mac.h.

uint64_t ns3::LrWpanMac::m_aBaseSuperframeDuration

Length of a superframe in symbols.

Defaults to aBaseSlotDuration * aNumSuperframeSlots in symbols. See IEEE 802.15.4-2006, section 7.4.1, Table 85.

Definition at line 395 of file lr-wpan-mac.h.

EventId ns3::LrWpanMac::m_ackWaitTimeout
private

Scheduler event for the ACK timeout of the currently transmitted data packet.

Definition at line 732 of file lr-wpan-mac.h.

Referenced by PdDataConfirm(), and PdDataIndication().

uint64_t ns3::LrWpanMac::m_aNumSuperframeSlots

Number of a superframe slots per superframe.

Defaults to 16. See IEEE 802.15.4-2006, section 7.4.1, Table 85.

Definition at line 388 of file lr-wpan-mac.h.

LrWpanAssociationStatus ns3::LrWpanMac::m_associationStatus
private

The current association status of the MAC layer.

Definition at line 692 of file lr-wpan-mac.h.

Referenced by GetAssociationStatus(), LrWpanMac(), and SetAssociationStatus().

Ptr<LrWpanCsmaCa> ns3::LrWpanMac::m_csmaCa
private
LrWpanMacState ns3::LrWpanMac::m_lrWpanMacState
private
uint64_t ns3::LrWpanMac::m_macBeaconOrder

Specification of how often the coordinator transmits its beacon.

0 - 15 with 15 means no beacons are being sent. See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 416 of file lr-wpan-mac.h.

uint64_t ns3::LrWpanMac::m_macBeaconTxTime

The time that the device transmitted its last beacon frame, in symbol periods.

Only 24 bits used. See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 403 of file lr-wpan-mac.h.

SequenceNumber8 ns3::LrWpanMac::m_macDsn

Sequence number added to transmitted data or MAC command frame, 00-ff.

See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 444 of file lr-wpan-mac.h.

Referenced by LrWpanMac(), and McpsDataRequest().

uint8_t ns3::LrWpanMac::m_macMaxFrameRetries

The maximum number of retries allowed after a transmission failure.

See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 450 of file lr-wpan-mac.h.

Referenced by GetMacMaxFrameRetries(), LrWpanMac(), PrepareRetransmission(), and SetMacMaxFrameRetries().

uint16_t ns3::LrWpanMac::m_macPanId

16 bits id of PAN on which this device is operating.

0xffff means not asscoiated. See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 438 of file lr-wpan-mac.h.

Referenced by GetPanId(), GetTypeId(), LrWpanMac(), PdDataIndication(), and SetPanId().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macPromiscRxTrace
private

The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition).

This is a promiscuous trace.

See also
class CallBackTraceSource

Definition at line 595 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and PdDataIndication().

bool ns3::LrWpanMac::m_macPromiscuousMode

Indicates if MAC sublayer is in receive all mode.

True mean accept all frames from PHY. See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 431 of file lr-wpan-mac.h.

Referenced by LrWpanMac(), and PdDataIndication().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macRxDropTrace
private

The trace source fired for packets successfully received by the device but dropped before being forwarded up to higher layers (at the L2/L3 transition).

See also
class CallBackTraceSource

Definition at line 613 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and PdDataIndication().

bool ns3::LrWpanMac::m_macRxOnWhenIdle

Indication of whether the MAC sublayer is to enable its receiver during idle periods.

See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 457 of file lr-wpan-mac.h.

Referenced by DoInitialize(), GetRxOnWhenIdle(), LrWpanMac(), SetLrWpanMacState(), and SetRxOnWhenIdle().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macRxTrace
private

The trace source fired for packets successfully received by the device immediately before being forwarded up to higher layers (at the L2/L3 transition).

This is a non-promiscuous trace.

See also
class CallBackTraceSource

Definition at line 604 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and PdDataIndication().

TracedCallback<LrWpanMacState, LrWpanMacState> ns3::LrWpanMac::m_macStateLogger
private

Definition at line 659 of file lr-wpan-mac.h.

Referenced by ChangeMacState(), and GetTypeId().

uint64_t ns3::LrWpanMac::m_macSuperframeOrder

The length of the active portion of the outgoing superframe, including the beacon frame.

0 - 15 with 15 means the superframe will not be active after the beacon. See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 424 of file lr-wpan-mac.h.

uint64_t ns3::LrWpanMac::m_macSyncSymbolOffset

Symbol boundary is same as m_macBeaconTxTime.

See IEEE 802.15.4-2006, section 7.4.2, Table 86.

Definition at line 409 of file lr-wpan-mac.h.

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macTxDequeueTrace
private

The trace source fired when packets are dequeued from the L3/l2 transmission queue.

See also
class CallBackTraceSource

Definition at line 562 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and RemoveFirstTxQElement().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macTxDropTrace
private

The trace source fired when packets are dropped due to missing ACKs or because of transmission failures in L1.

See also
class CallBackTraceSource

Definition at line 586 of file lr-wpan-mac.h.

Referenced by GetTypeId(), PdDataConfirm(), PrepareRetransmission(), and SetLrWpanMacState().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macTxEnqueueTrace
private

The trace source fired when packets come into the "top" of the device at the L3/L2 transition, when being queued for transmission.

See also
class CallBackTraceSource

Definition at line 554 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and McpsDataRequest().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macTxOkTrace
private

The trace source fired when packets where successfully transmitted, that is an acknowledgment was received, if requested, or the packet was successfully sent by L1, if no ACK was requested.

See also
class CallBackTraceSource

Definition at line 578 of file lr-wpan-mac.h.

Referenced by GetTypeId(), PdDataConfirm(), and PdDataIndication().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_macTxTrace
private

The trace source fired when packets are being sent down to L1.

See also
class CallBackTraceSource

Definition at line 569 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and PlmeSetTRXStateConfirm().

McpsDataConfirmCallback ns3::LrWpanMac::m_mcpsDataConfirmCallback
private

This callback is used to report data transmission request status to the upper layers.

See IEEE 802.15.4-2006, section 7.1.1.2.

Definition at line 682 of file lr-wpan-mac.h.

Referenced by DoDispose(), McpsDataRequest(), PdDataConfirm(), PdDataIndication(), PrepareRetransmission(), SetLrWpanMacState(), and SetMcpsDataConfirmCallback().

McpsDataIndicationCallback ns3::LrWpanMac::m_mcpsDataIndicationCallback
private

This callback is used to notify incoming packets to the upper layers.

See IEEE 802.15.4-2006, section 7.1.1.3.

Definition at line 675 of file lr-wpan-mac.h.

Referenced by DoDispose(), PdDataIndication(), and SetMcpsDataIndicationCallback().

uint8_t ns3::LrWpanMac::m_numCsmacaRetry
private

The number of CSMA/CA retries used for sending the current packet.

Definition at line 726 of file lr-wpan-mac.h.

Referenced by LrWpanMac(), PrepareRetransmission(), and RemoveFirstTxQElement().

Ptr<LrWpanPhy> ns3::LrWpanMac::m_phy
private
TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_promiscSnifferTrace
private

A trace source that emulates a promiscuous mode protocol sniffer connected to the device.

This trace source fire on packets destined for any host just like your average everyday packet sniffer.

On the transmit size, this trace hook will fire after a packet is dequeued from the device queue for transmission. In Linux, for example, this would correspond to the point just before a device hard_start_xmit where dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET ETH_P_ALL handlers.

On the receive side, this trace hook will fire when a packet is received, just before the receive callback is executed. In Linux, for example, this would correspond to the point at which the packet is dispatched to packet sniffers in netif_receive_skb.

See also
class CallBackTraceSource

Definition at line 653 of file lr-wpan-mac.h.

Referenced by GetTypeId(), PdDataIndication(), and PlmeSetTRXStateConfirm().

uint8_t ns3::LrWpanMac::m_retransmission
private

The number of already used retransmission for the currently transmitted packet.

Definition at line 721 of file lr-wpan-mac.h.

Referenced by LrWpanMac(), PrepareRetransmission(), and RemoveFirstTxQElement().

Mac64Address ns3::LrWpanMac::m_selfExt
private

The extended address used by this MAC.

Extended addresses are currently not really supported.

Definition at line 710 of file lr-wpan-mac.h.

Referenced by GetExtendedAddress(), LrWpanMac(), PdDataIndication(), and SetExtendedAddress().

TracedCallback<Ptr<const Packet>, uint8_t, uint8_t > ns3::LrWpanMac::m_sentPktTrace
private

The trace source fired when packets are considered as successfully sent or the transmission has been given up.

Only non-broadcast packets are traced.

The data should represent: packet, number of retries, total number of csma backoffs

See also
class CallBackTraceSource

Definition at line 546 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and RemoveFirstTxQElement().

EventId ns3::LrWpanMac::m_setMacState
private

Scheduler event for a deferred MAC state change.

Definition at line 737 of file lr-wpan-mac.h.

Referenced by CheckQueue(), PdDataConfirm(), and PdDataIndication().

Mac16Address ns3::LrWpanMac::m_shortAddress
private

The short address used by this MAC.

Currently we do not have complete extended address support in the MAC, nor do we have the association primitives, so this address has to be configured manually.

Definition at line 704 of file lr-wpan-mac.h.

Referenced by GetShortAddress(), LrWpanMac(), PdDataIndication(), and SetShortAddress().

TracedCallback<Ptr<const Packet> > ns3::LrWpanMac::m_snifferTrace
private

A trace source that emulates a non-promiscuous protocol sniffer connected to the device.

Unlike your average everyday sniffer, this trace source will not fire on PACKET_OTHERHOST events.

On the transmit size, this trace hook will fire after a packet is dequeued from the device queue for transmission. In Linux, for example, this would correspond to the point just before a device hard_start_xmit where dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET ETH_P_ALL handlers.

On the receive side, this trace hook will fire when a packet is received, just before the receive callback is executed. In Linux, for example, this would correspond to the point at which the packet is dispatched to packet sniffers in netif_receive_skb.

See also
class CallBackTraceSource

Definition at line 633 of file lr-wpan-mac.h.

Referenced by GetTypeId(), and PlmeSetTRXStateConfirm().

Ptr<Packet> ns3::LrWpanMac::m_txPkt
private

The packet which is currently being sent by the MAC layer.

Definition at line 697 of file lr-wpan-mac.h.

Referenced by CheckQueue(), DoDispose(), LrWpanMac(), PdDataConfirm(), PdDataIndication(), PlmeSetTRXStateConfirm(), RemoveFirstTxQElement(), SendAck(), and SetLrWpanMacState().

std::deque<TxQueueElement*> ns3::LrWpanMac::m_txQueue
private

The documentation for this class was generated from the following files: