A Discrete-Event Network Simulator
API
ns3::LrWpanCsmaCa Class Reference

This class is a helper for the LrWpanMac to manage the Csma/CA state machine according to IEEE 802.15.4-2006, section 7.5.1.4. More...

#include "lr-wpan-csmaca.h"

+ Inheritance diagram for ns3::LrWpanCsmaCa:
+ Collaboration diagram for ns3::LrWpanCsmaCa:

Public Member Functions

 LrWpanCsmaCa (void)
 Default constructor. More...
 
virtual ~LrWpanCsmaCa (void)
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
void Cancel (void)
 Cancel CSMA-CA algorithm. More...
 
void CanProceed (void)
 In the slotted CSMA-CA, after random backoff, determine if the remaining CSMA-CA operation can proceed, i.e. More...
 
void DeferCsmaTimeout (void)
 The CSMA algorithm call this function at the end of the CAP to return the MAC state back to to IDLE after a transmission was deferred due to the lack of time in the CAP. More...
 
bool GetBatteryLifeExtension (void)
 Get the value of the Battery Life Extension. More...
 
Ptr< LrWpanMacGetMac (void) const
 Get the MAC to which this CSMA/CA implementation is attached to. More...
 
uint8_t GetMacMaxBE (void) const
 Get the maximum backoff exponent value. More...
 
uint8_t GetMacMaxCSMABackoffs (void) const
 Get the maximum number of backoffs. More...
 
uint8_t GetMacMinBE (void) const
 Get the minimum backoff exponent value. More...
 
uint8_t GetNB (void)
 Get the number of CSMA retries. More...
 
Time GetTimeToNextSlot (void) const
 Locates the time to the next backoff period boundary and returns the amount of time left (in symbols). More...
 
uint64_t GetUnitBackoffPeriod (void) const
 Get the number of symbols forming the basic time period used by the CSMA-CA algorithm. More...
 
bool IsSlottedCsmaCa (void) const
 Check if the slotted CSMA/CA version is being used. More...
 
bool IsUnSlottedCsmaCa (void) const
 Check if the unslotted CSMA/CA version is being used. More...
 
void PlmeCcaConfirm (LrWpanPhyEnumeration status)
 IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status. More...
 
void RandomBackoffDelay (void)
 In step 2 of the CSMA-CA, perform a random backoff in the range of 0 to 2^BE -1. More...
 
void RequestCCA (void)
 Request the Phy to perform CCA (Step 3) More...
 
void SetBatteryLifeExtension (bool batteryLifeExtension)
 Set the value of the Battery Life Extension. More...
 
void SetLrWpanMacStateCallback (LrWpanMacStateCallback macState)
 Set the callback function to the MAC. More...
 
void SetLrWpanMacTransCostCallback (LrWpanMacTransCostCallback trans)
 Set the callback function to report a transaction cost in slotted CSMA-CA. More...
 
void SetMac (Ptr< LrWpanMac > mac)
 Set the MAC to which this CSMA/CA implementation is attached to. More...
 
void SetMacMaxBE (uint8_t macMaxBE)
 Set the maximum backoff exponent value. More...
 
void SetMacMaxCSMABackoffs (uint8_t macMaxCSMABackoffs)
 Set the maximum number of backoffs. More...
 
void SetMacMinBE (uint8_t macMinBE)
 Set the minimum backoff exponent value. More...
 
void SetSlottedCsmaCa (void)
 Configure for the use of the slotted CSMA/CA version. More...
 
void SetUnitBackoffPeriod (uint64_t unitBackoffPeriod)
 Set the number of symbols forming the basic time period used by the CSMA-CA algorithm. More...
 
void SetUnSlottedCsmaCa (void)
 Configure for the use of the unslotted CSMA/CA version. More...
 
void Start (void)
 Start CSMA-CA algorithm (step 1), initialize NB, BE for both slotted and unslotted CSMA-CA. More...
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default 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 operator. 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
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

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::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Private Member Functions

 LrWpanCsmaCa (LrWpanCsmaCa const &)
 Copy constructor - defined and not implemented. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
uint32_t GetBackoffPeriodsLeftInCap ()
 Get the periods left in the CAP portion of the Outgoing or Incoming frame. More...
 
LrWpanCsmaCaoperator= (LrWpanCsmaCa const &)
 Copy constructor - defined and not implemented. More...
 

Private Attributes

uint64_t m_aUnitBackoffPeriod
 Number of symbols per CSMA/CA time unit, default 20 symbols. More...
 
uint8_t m_BE
 Backoff exponent. More...
 
EventId m_canProceedEvent
 Scheduler event for checking if we can complete the transmission before the end of the CAP. More...
 
bool m_ccaRequestRunning
 Flag indicating that the PHY is currently running a CCA. More...
 
bool m_coorDest
 Indicates whether the CSMA procedure is targeted for a message to be sent to the coordinator. More...
 
uint8_t m_CW
 Contention window length (used in slotted ver only). More...
 
EventId m_endCapEvent
 Scheduler event for the end of the current CAP. More...
 
bool m_isSlotted
 Beacon-enabled slotted or nonbeacon-enabled unslotted CSMA-CA. More...
 
LrWpanMacStateCallback m_lrWpanMacStateCallback
 The callback to inform the configured MAC of the CSMA/CA result. More...
 
LrWpanMacTransCostCallback m_lrWpanMacTransCostCallback
 The callback to inform the cost of a transaction in slotted CSMA-CA. More...
 
Ptr< LrWpanMacm_mac
 The MAC instance for which this CSMA/CA implemenation is configured. More...
 
bool m_macBattLifeExt
 Battery Life Extension. More...
 
uint8_t m_macMaxBE
 Maximum backoff exponent. More...
 
uint8_t m_macMaxCSMABackoffs
 Maximum number of backoffs. More...
 
uint8_t m_macMinBE
 Minimum backoff exponent. More...
 
uint8_t m_NB
 Number of backoffs for the current transmission. More...
 
Ptr< UniformRandomVariablem_random
 Uniform random variable stream. More...
 
EventId m_randomBackoffEvent
 Scheduler event for the start of the next random backoff/slot. More...
 
uint64_t m_randomBackoffPeriodsLeft
 Count the number of remaining random backoff periods left to delay. More...
 
EventId m_requestCcaEvent
 Scheduler event when to start the CCA after a random backoff. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Detailed Description

This class is a helper for the LrWpanMac to manage the Csma/CA state machine according to IEEE 802.15.4-2006, section 7.5.1.4.


Introspection did not find any typical Config paths.


No Attributes are defined for this type.
No TraceSources are defined for this type.
Size of this type is 200 bytes (on a 64-bit architecture).

Definition at line 56 of file lr-wpan-csmaca.h.

Constructor & Destructor Documentation

◆ LrWpanCsmaCa() [1/2]

ns3::LrWpanCsmaCa::LrWpanCsmaCa ( void  )

◆ ~LrWpanCsmaCa()

ns3::LrWpanCsmaCa::~LrWpanCsmaCa ( void  )
virtual

Definition at line 70 of file lr-wpan-csmaca.cc.

References m_mac.

◆ LrWpanCsmaCa() [2/2]

ns3::LrWpanCsmaCa::LrWpanCsmaCa ( LrWpanCsmaCa const &  )
private

Copy constructor - defined and not implemented.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::LrWpanCsmaCa::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model.

Return the number of streams that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 542 of file lr-wpan-csmaca.cc.

References m_random, NS_LOG_FUNCTION, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ Cancel()

void ns3::LrWpanCsmaCa::Cancel ( void  )

Cancel CSMA-CA algorithm.

Definition at line 265 of file lr-wpan-csmaca.cc.

References ns3::EventId::Cancel(), m_canProceedEvent, m_randomBackoffEvent, and m_requestCcaEvent.

Referenced by DoDispose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CanProceed()

void ns3::LrWpanCsmaCa::CanProceed ( void  )

In the slotted CSMA-CA, after random backoff, determine if the remaining CSMA-CA operation can proceed, i.e.

can the entire transactions can be transmitted before the end of the CAP. This step is performed between step 2 and 3. This step is NOT performed for the unslotted CSMA-CA. If it can proceed function RequestCCA() is called.

Definition at line 361 of file lr-wpan-csmaca.cc.

References DeferCsmaTimeout(), GetBackoffPeriodsLeftInCap(), ns3::Time::GetSeconds(), GetUnitBackoffPeriod(), ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), m_CW, m_endCapEvent, m_lrWpanMacTransCostCallback, m_mac, m_randomBackoffPeriodsLeft, m_requestCcaEvent, ns3::MicroSeconds(), NS_LOG_DEBUG, NS_LOG_FUNCTION, RequestCCA(), ns3::Simulator::Schedule(), and ns3::Simulator::ScheduleNow().

Referenced by RandomBackoffDelay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DeferCsmaTimeout()

void ns3::LrWpanCsmaCa::DeferCsmaTimeout ( void  )

The CSMA algorithm call this function at the end of the CAP to return the MAC state back to to IDLE after a transmission was deferred due to the lack of time in the CAP.

Definition at line 443 of file lr-wpan-csmaca.cc.

References m_lrWpanMacStateCallback, ns3::MAC_CSMA_DEFERRED, and NS_LOG_FUNCTION.

Referenced by CanProceed(), and RandomBackoffDelay().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::LrWpanCsmaCa::DoDispose ( void  )
privatevirtual

Destructor implementation.

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

Subclasses are expected to implement their real destruction code in an overridden 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 76 of file lr-wpan-csmaca.cc.

References Cancel(), m_lrWpanMacStateCallback, m_lrWpanMacTransCostCallback, and m_mac.

+ Here is the call graph for this function:

◆ GetBackoffPeriodsLeftInCap()

uint32_t ns3::LrWpanCsmaCa::GetBackoffPeriodsLeftInCap ( )
private

Get the periods left in the CAP portion of the Outgoing or Incoming frame.

Returns
num of backoff periods left in the CAP

Definition at line 329 of file lr-wpan-csmaca.cc.

References ns3::Time::GetMicroSeconds(), m_aUnitBackoffPeriod, m_coorDest, m_mac, and ns3::Simulator::Now().

Referenced by CanProceed(), and RandomBackoffDelay().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetBatteryLifeExtension()

bool ns3::LrWpanCsmaCa::GetBatteryLifeExtension ( void  )

Get the value of the Battery Life Extension.

Returns
true or false to Battery Life Extension support

Definition at line 556 of file lr-wpan-csmaca.cc.

References m_macBattLifeExt.

◆ GetMac()

Ptr< LrWpanMac > ns3::LrWpanCsmaCa::GetMac ( void  ) const

Get the MAC to which this CSMA/CA implementation is attached to.

Returns
the used MAC

Definition at line 92 of file lr-wpan-csmaca.cc.

References m_mac.

◆ GetMacMaxBE()

uint8_t ns3::LrWpanCsmaCa::GetMacMaxBE ( void  ) const

Get the maximum backoff exponent value.

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

Returns
the maximum backoff exponent value

Definition at line 147 of file lr-wpan-csmaca.cc.

References m_macMaxBE, and NS_LOG_FUNCTION.

◆ GetMacMaxCSMABackoffs()

uint8_t ns3::LrWpanCsmaCa::GetMacMaxCSMABackoffs ( void  ) const

Get the maximum number of backoffs.

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

Returns
the maximum number of backoffs

Definition at line 161 of file lr-wpan-csmaca.cc.

References m_macMaxCSMABackoffs, and NS_LOG_FUNCTION.

◆ GetMacMinBE()

uint8_t ns3::LrWpanCsmaCa::GetMacMinBE ( void  ) const

Get the minimum backoff exponent value.

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

Returns
the minimum backoff exponent value

Definition at line 133 of file lr-wpan-csmaca.cc.

References m_macMinBE, and NS_LOG_FUNCTION.

◆ GetNB()

uint8_t ns3::LrWpanCsmaCa::GetNB ( void  )

Get the number of CSMA retries.

Returns
the number of CSMA retries

Definition at line 550 of file lr-wpan-csmaca.cc.

References m_NB.

◆ GetTimeToNextSlot()

Time ns3::LrWpanCsmaCa::GetTimeToNextSlot ( void  ) const

Locates the time to the next backoff period boundary and returns the amount of time left (in symbols).

Returns
time offset to the next slot

Definition at line 183 of file lr-wpan-csmaca.cc.

References ns3::Time::GetSeconds(), m_aUnitBackoffPeriod, m_coorDest, m_mac, ns3::MicroSeconds(), ns3::Simulator::Now(), NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by Start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId ns3::LrWpanCsmaCa::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 41 of file lr-wpan-csmaca.cc.

References ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ GetUnitBackoffPeriod()

uint64_t ns3::LrWpanCsmaCa::GetUnitBackoffPeriod ( void  ) const

Get the number of symbols forming the basic time period used by the CSMA-CA algorithm.

See IEEE 802.15.4-2006, section 7.4.1, Table 85.

Returns
the period length in symbols

Definition at line 175 of file lr-wpan-csmaca.cc.

References m_aUnitBackoffPeriod, and NS_LOG_FUNCTION.

Referenced by CanProceed(), and RandomBackoffDelay().

+ Here is the caller graph for this function:

◆ IsSlottedCsmaCa()

bool ns3::LrWpanCsmaCa::IsSlottedCsmaCa ( void  ) const

Check if the slotted CSMA/CA version is being used.

Returns
true, if slotted CSMA/CA is used, false otherwise.

Definition at line 112 of file lr-wpan-csmaca.cc.

References m_isSlotted, and NS_LOG_FUNCTION.

Referenced by PlmeCcaConfirm(), and Start().

+ Here is the caller graph for this function:

◆ IsUnSlottedCsmaCa()

bool ns3::LrWpanCsmaCa::IsUnSlottedCsmaCa ( void  ) const

Check if the unslotted CSMA/CA version is being used.

Returns
true, if unslotted CSMA/CA is used, false otherwise.

Definition at line 119 of file lr-wpan-csmaca.cc.

References m_isSlotted, and NS_LOG_FUNCTION.

Referenced by RandomBackoffDelay().

+ Here is the caller graph for this function:

◆ operator=()

LrWpanCsmaCa& ns3::LrWpanCsmaCa::operator= ( LrWpanCsmaCa const &  )
private

Copy constructor - defined and not implemented.

Returns

◆ PlmeCcaConfirm()

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

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

Parameters
statusTRX_OFF, BUSY or IDLE

When Phy has completed CCA, it calls back here which in turn execute the final steps of the CSMA-CA algorithm. It checks to see if the Channel is idle, if so check the Contention window before permitting transmission (step 5). If channel is busy, either backoff and perform CCA again or treat as channel access failure (step 4).

Definition at line 450 of file lr-wpan-csmaca.cc.

References ns3::CHANNEL_ACCESS_FAILURE, ns3::CHANNEL_IDLE, ns3::IEEE_802_15_4_PHY_IDLE, ns3::Callback< R, T1, T2, T3, T4, T5, T6, T7, T8, T9 >::IsNull(), IsSlottedCsmaCa(), m_BE, m_ccaRequestRunning, m_CW, m_lrWpanMacStateCallback, m_macMaxBE, m_macMaxCSMABackoffs, m_NB, m_randomBackoffEvent, m_requestCcaEvent, min, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_LOGIC(), RandomBackoffDelay(), RequestCCA(), and ns3::Simulator::ScheduleNow().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RandomBackoffDelay()

void ns3::LrWpanCsmaCa::RandomBackoffDelay ( void  )

In step 2 of the CSMA-CA, perform a random backoff in the range of 0 to 2^BE -1.

Definition at line 275 of file lr-wpan-csmaca.cc.

References CanProceed(), DeferCsmaTimeout(), GetBackoffPeriodsLeftInCap(), ns3::Time::GetSeconds(), GetUnitBackoffPeriod(), ns3::UniformRandomVariable::GetValue(), IsUnSlottedCsmaCa(), m_BE, m_canProceedEvent, m_endCapEvent, m_mac, m_random, m_randomBackoffPeriodsLeft, m_requestCcaEvent, ns3::MicroSeconds(), NS_LOG_DEBUG, NS_LOG_FUNCTION, RequestCCA(), and ns3::Simulator::Schedule().

Referenced by PlmeCcaConfirm(), and Start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RequestCCA()

void ns3::LrWpanCsmaCa::RequestCCA ( void  )

Request the Phy to perform CCA (Step 3)

Definition at line 435 of file lr-wpan-csmaca.cc.

References m_ccaRequestRunning, m_mac, and NS_LOG_FUNCTION.

Referenced by CanProceed(), PlmeCcaConfirm(), and RandomBackoffDelay().

+ Here is the caller graph for this function:

◆ SetBatteryLifeExtension()

void ns3::LrWpanCsmaCa::SetBatteryLifeExtension ( bool  batteryLifeExtension)

Set the value of the Battery Life Extension.

Parameters
batteryLifeExtensionthe Battery Life Extension value active or inactive

Definition at line 535 of file lr-wpan-csmaca.cc.

References m_macBattLifeExt.

◆ SetLrWpanMacStateCallback()

void ns3::LrWpanCsmaCa::SetLrWpanMacStateCallback ( LrWpanMacStateCallback  macState)

Set the callback function to the MAC.

Used at the end of a Channel Assessment, as part of the interconnections between the CSMA-CA and the MAC. The callback lets MAC know a channel is either idle or busy.

Parameters
macStatethe mac state callback

Definition at line 528 of file lr-wpan-csmaca.cc.

References m_lrWpanMacStateCallback, and NS_LOG_FUNCTION.

◆ SetLrWpanMacTransCostCallback()

void ns3::LrWpanCsmaCa::SetLrWpanMacTransCostCallback ( LrWpanMacTransCostCallback  trans)

Set the callback function to report a transaction cost in slotted CSMA-CA.

The callback is triggered in CanProceed() after calculating the transaction cost (2 CCA checks,transmission cost, turnAroundTime, ifs) in the boundary of an Active Period.

Parameters
transthe transaction cost callback

Definition at line 520 of file lr-wpan-csmaca.cc.

References m_lrWpanMacTransCostCallback, and NS_LOG_FUNCTION.

◆ SetMac()

void ns3::LrWpanCsmaCa::SetMac ( Ptr< LrWpanMac mac)

Set the MAC to which this CSMA/CA implementation is attached to.

Parameters
macthe used MAC

Definition at line 86 of file lr-wpan-csmaca.cc.

References m_mac, and third::mac.

◆ SetMacMaxBE()

void ns3::LrWpanCsmaCa::SetMacMaxBE ( uint8_t  macMaxBE)

Set the maximum backoff exponent value.

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

Parameters
macMaxBEthe maximum backoff exponent value

Definition at line 140 of file lr-wpan-csmaca.cc.

References m_macMinBE, and NS_LOG_FUNCTION.

◆ SetMacMaxCSMABackoffs()

void ns3::LrWpanCsmaCa::SetMacMaxCSMABackoffs ( uint8_t  macMaxCSMABackoffs)

Set the maximum number of backoffs.

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

Parameters
macMaxCSMABackoffsthe maximum number of backoffs

Definition at line 154 of file lr-wpan-csmaca.cc.

References m_macMaxCSMABackoffs, and NS_LOG_FUNCTION.

◆ SetMacMinBE()

void ns3::LrWpanCsmaCa::SetMacMinBE ( uint8_t  macMinBE)

Set the minimum backoff exponent value.

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

Parameters
macMinBEthe minimum backoff exponent value

Definition at line 126 of file lr-wpan-csmaca.cc.

References m_macMinBE, and NS_LOG_FUNCTION.

◆ SetSlottedCsmaCa()

void ns3::LrWpanCsmaCa::SetSlottedCsmaCa ( void  )

Configure for the use of the slotted CSMA/CA version.

Definition at line 98 of file lr-wpan-csmaca.cc.

References m_isSlotted, and NS_LOG_FUNCTION.

◆ SetUnitBackoffPeriod()

void ns3::LrWpanCsmaCa::SetUnitBackoffPeriod ( uint64_t  unitBackoffPeriod)

Set the number of symbols forming the basic time period used by the CSMA-CA algorithm.

See IEEE 802.15.4-2006, section 7.4.1, Table 85.

Parameters
unitBackoffPeriodthe period length in symbols

Definition at line 168 of file lr-wpan-csmaca.cc.

References m_aUnitBackoffPeriod, and NS_LOG_FUNCTION.

◆ SetUnSlottedCsmaCa()

void ns3::LrWpanCsmaCa::SetUnSlottedCsmaCa ( void  )

Configure for the use of the unslotted CSMA/CA version.

Definition at line 105 of file lr-wpan-csmaca.cc.

References m_isSlotted, and NS_LOG_FUNCTION.

◆ Start()

void ns3::LrWpanCsmaCa::Start ( void  )

Start CSMA-CA algorithm (step 1), initialize NB, BE for both slotted and unslotted CSMA-CA.

For slotted CSMA-CA initializes CW and starts the backoff slot count.

Definition at line 224 of file lr-wpan-csmaca.cc.

References GetTimeToNextSlot(), IsSlottedCsmaCa(), m_BE, m_coorDest, m_CW, m_mac, m_macBattLifeExt, m_macMinBE, m_NB, m_randomBackoffEvent, min, NS_LOG_FUNCTION, RandomBackoffDelay(), ns3::Simulator::Schedule(), and ns3::Simulator::ScheduleNow().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_aUnitBackoffPeriod

uint64_t ns3::LrWpanCsmaCa::m_aUnitBackoffPeriod
private

Number of symbols per CSMA/CA time unit, default 20 symbols.

Definition at line 320 of file lr-wpan-csmaca.h.

Referenced by GetBackoffPeriodsLeftInCap(), GetTimeToNextSlot(), GetUnitBackoffPeriod(), LrWpanCsmaCa(), and SetUnitBackoffPeriod().

◆ m_BE

uint8_t ns3::LrWpanCsmaCa::m_BE
private

Backoff exponent.

Definition at line 300 of file lr-wpan-csmaca.h.

Referenced by LrWpanCsmaCa(), PlmeCcaConfirm(), RandomBackoffDelay(), and Start().

◆ m_canProceedEvent

EventId ns3::LrWpanCsmaCa::m_canProceedEvent
private

Scheduler event for checking if we can complete the transmission before the end of the CAP.

Definition at line 345 of file lr-wpan-csmaca.h.

Referenced by Cancel(), and RandomBackoffDelay().

◆ m_ccaRequestRunning

bool ns3::LrWpanCsmaCa::m_ccaRequestRunning
private

Flag indicating that the PHY is currently running a CCA.

Used to prevent reporting the channel status to the MAC while canceling the CSMA algorithm.

Definition at line 350 of file lr-wpan-csmaca.h.

Referenced by LrWpanCsmaCa(), PlmeCcaConfirm(), and RequestCCA().

◆ m_coorDest

bool ns3::LrWpanCsmaCa::m_coorDest
private

Indicates whether the CSMA procedure is targeted for a message to be sent to the coordinator.

Used to run slotted CSMA/CA on the incoming or outgoing superframe according to the target.

Definition at line 356 of file lr-wpan-csmaca.h.

Referenced by GetBackoffPeriodsLeftInCap(), GetTimeToNextSlot(), LrWpanCsmaCa(), and Start().

◆ m_CW

uint8_t ns3::LrWpanCsmaCa::m_CW
private

Contention window length (used in slotted ver only).

Definition at line 296 of file lr-wpan-csmaca.h.

Referenced by CanProceed(), LrWpanCsmaCa(), PlmeCcaConfirm(), and Start().

◆ m_endCapEvent

EventId ns3::LrWpanCsmaCa::m_endCapEvent
private

Scheduler event for the end of the current CAP.

Definition at line 336 of file lr-wpan-csmaca.h.

Referenced by CanProceed(), and RandomBackoffDelay().

◆ m_isSlotted

bool ns3::LrWpanCsmaCa::m_isSlotted
private

Beacon-enabled slotted or nonbeacon-enabled unslotted CSMA-CA.

Definition at line 284 of file lr-wpan-csmaca.h.

Referenced by IsSlottedCsmaCa(), IsUnSlottedCsmaCa(), LrWpanCsmaCa(), SetSlottedCsmaCa(), and SetUnSlottedCsmaCa().

◆ m_lrWpanMacStateCallback

LrWpanMacStateCallback ns3::LrWpanCsmaCa::m_lrWpanMacStateCallback
private

The callback to inform the configured MAC of the CSMA/CA result.

Definition at line 280 of file lr-wpan-csmaca.h.

Referenced by DeferCsmaTimeout(), DoDispose(), PlmeCcaConfirm(), and SetLrWpanMacStateCallback().

◆ m_lrWpanMacTransCostCallback

LrWpanMacTransCostCallback ns3::LrWpanCsmaCa::m_lrWpanMacTransCostCallback
private

The callback to inform the cost of a transaction in slotted CSMA-CA.

Definition at line 276 of file lr-wpan-csmaca.h.

Referenced by CanProceed(), DoDispose(), and SetLrWpanMacTransCostCallback().

◆ m_mac

Ptr<LrWpanMac> ns3::LrWpanCsmaCa::m_mac
private

The MAC instance for which this CSMA/CA implemenation is configured.

Definition at line 288 of file lr-wpan-csmaca.h.

Referenced by CanProceed(), DoDispose(), GetBackoffPeriodsLeftInCap(), GetMac(), GetTimeToNextSlot(), RandomBackoffDelay(), RequestCCA(), SetMac(), Start(), and ~LrWpanCsmaCa().

◆ m_macBattLifeExt

bool ns3::LrWpanCsmaCa::m_macBattLifeExt
private

Battery Life Extension.

Definition at line 304 of file lr-wpan-csmaca.h.

Referenced by GetBatteryLifeExtension(), LrWpanCsmaCa(), SetBatteryLifeExtension(), and Start().

◆ m_macMaxBE

uint8_t ns3::LrWpanCsmaCa::m_macMaxBE
private

Maximum backoff exponent.

3 - 8, default 5

Definition at line 312 of file lr-wpan-csmaca.h.

Referenced by GetMacMaxBE(), LrWpanCsmaCa(), and PlmeCcaConfirm().

◆ m_macMaxCSMABackoffs

uint8_t ns3::LrWpanCsmaCa::m_macMaxCSMABackoffs
private

Maximum number of backoffs.

0 - 5, default 4

Definition at line 316 of file lr-wpan-csmaca.h.

Referenced by GetMacMaxCSMABackoffs(), LrWpanCsmaCa(), PlmeCcaConfirm(), and SetMacMaxCSMABackoffs().

◆ m_macMinBE

uint8_t ns3::LrWpanCsmaCa::m_macMinBE
private

Minimum backoff exponent.

0 - macMaxBE, default 3

Definition at line 308 of file lr-wpan-csmaca.h.

Referenced by GetMacMinBE(), LrWpanCsmaCa(), SetMacMaxBE(), SetMacMinBE(), and Start().

◆ m_NB

uint8_t ns3::LrWpanCsmaCa::m_NB
private

Number of backoffs for the current transmission.

Definition at line 292 of file lr-wpan-csmaca.h.

Referenced by GetNB(), LrWpanCsmaCa(), PlmeCcaConfirm(), and Start().

◆ m_random

Ptr<UniformRandomVariable> ns3::LrWpanCsmaCa::m_random
private

Uniform random variable stream.

Definition at line 328 of file lr-wpan-csmaca.h.

Referenced by AssignStreams(), LrWpanCsmaCa(), and RandomBackoffDelay().

◆ m_randomBackoffEvent

EventId ns3::LrWpanCsmaCa::m_randomBackoffEvent
private

Scheduler event for the start of the next random backoff/slot.

Definition at line 332 of file lr-wpan-csmaca.h.

Referenced by Cancel(), PlmeCcaConfirm(), and Start().

◆ m_randomBackoffPeriodsLeft

uint64_t ns3::LrWpanCsmaCa::m_randomBackoffPeriodsLeft
private

Count the number of remaining random backoff periods left to delay.

Definition at line 324 of file lr-wpan-csmaca.h.

Referenced by CanProceed(), LrWpanCsmaCa(), and RandomBackoffDelay().

◆ m_requestCcaEvent

EventId ns3::LrWpanCsmaCa::m_requestCcaEvent
private

Scheduler event when to start the CCA after a random backoff.

Definition at line 340 of file lr-wpan-csmaca.h.

Referenced by Cancel(), CanProceed(), PlmeCcaConfirm(), and RandomBackoffDelay().


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