24 #ifndef LR_WPAN_CSMACA_H
25 #define LR_WPAN_CSMACA_H
27 #include <ns3/object.h>
28 #include <ns3/event-id.h>
29 #include <ns3/lr-wpan-mac.h>
33 class UniformRandomVariable;
247 uint8_t
GetNB (
void);
An identifier for simulation events.
This class is a helper for the LrWpanMac to manage the Csma/CA state machine according to IEEE 802....
static TypeId GetTypeId(void)
Get the type ID.
bool GetBatteryLifeExtension(void)
Get the value of the Battery Life Extension.
uint64_t m_aUnitBackoffPeriod
Number of symbols per CSMA/CA time unit, default 20 symbols.
Ptr< LrWpanMac > m_mac
The MAC instance for which this CSMA/CA implemenation is configured.
void SetBatteryLifeExtension(bool batteryLifeExtension)
Set the value of the Battery Life Extension.
void PlmeCcaConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.
void RandomBackoffDelay(void)
In step 2 of the CSMA-CA, perform a random backoff in the range of 0 to 2^BE -1.
uint8_t GetMacMinBE(void) const
Get the minimum backoff exponent value.
bool m_isSlotted
Beacon-enabled slotted or nonbeacon-enabled unslotted CSMA-CA.
uint8_t m_BE
Backoff exponent.
LrWpanCsmaCa & operator=(LrWpanCsmaCa const &)
Copy constructor - defined and not implemented.
EventId m_canProceedEvent
Scheduler event for checking if we can complete the transmission before the end of the CAP.
EventId m_randomBackoffEvent
Scheduler event for the start of the next random backoff/slot.
LrWpanCsmaCa(void)
Default constructor.
void SetMac(Ptr< LrWpanMac > mac)
Set the MAC to which this CSMA/CA implementation is attached to.
LrWpanMacStateCallback m_lrWpanMacStateCallback
The callback to inform the configured MAC of the CSMA/CA result.
void SetUnSlottedCsmaCa(void)
Configure for the use of the unslotted CSMA/CA version.
uint64_t GetUnitBackoffPeriod(void) const
Get the number of symbols forming the basic time period used by the CSMA-CA algorithm.
void Start(void)
Start CSMA-CA algorithm (step 1), initialize NB, BE for both slotted and unslotted CSMA-CA.
LrWpanMacTransCostCallback m_lrWpanMacTransCostCallback
The callback to inform the cost of a transaction in slotted CSMA-CA.
uint8_t GetMacMaxCSMABackoffs(void) const
Get the maximum number of backoffs.
EventId m_requestCcaEvent
Scheduler event when to start the CCA after a random backoff.
bool m_coorDest
Indicates whether the CSMA procedure is targeted for a message to be sent to the coordinator.
void SetLrWpanMacTransCostCallback(LrWpanMacTransCostCallback trans)
Set the callback function to report a transaction cost in slotted CSMA-CA.
bool IsUnSlottedCsmaCa(void) const
Check if the unslotted CSMA/CA version is being used.
void Cancel(void)
Cancel CSMA-CA algorithm.
void SetMacMaxBE(uint8_t macMaxBE)
Set the maximum backoff exponent value.
uint8_t m_macMaxBE
Maximum backoff exponent.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC to which this CSMA/CA implementation is attached to.
void SetMacMinBE(uint8_t macMinBE)
Set the minimum backoff exponent value.
uint8_t m_CW
Contention window length (used in slotted ver only).
uint8_t m_macMinBE
Minimum backoff exponent.
bool IsSlottedCsmaCa(void) const
Check if the slotted CSMA/CA version is being used.
uint8_t GetNB(void)
Get the number of CSMA retries.
void SetUnitBackoffPeriod(uint64_t unitBackoffPeriod)
Set the number of symbols forming the basic time period used by the CSMA-CA algorithm.
bool m_macBattLifeExt
Battery Life Extension.
void CanProceed(void)
In the slotted CSMA-CA, after random backoff, determine if the remaining CSMA-CA operation can procee...
void DeferCsmaTimeout(void)
The CSMA algorithm call this function at the end of the CAP to return the MAC state back to to IDLE a...
EventId m_endCapEvent
Scheduler event for the end of the current CAP.
virtual ~LrWpanCsmaCa(void)
uint64_t m_randomBackoffPeriodsLeft
Count the number of remaining random backoff periods left to delay.
Time GetTimeLeftInCap()
Get the time left in the CAP portion of the Outgoing or Incoming superframe.
virtual void DoDispose(void)
Destructor implementation.
bool m_ccaRequestRunning
Flag indicating that the PHY is currently running a CCA.
void RequestCCA(void)
Request the Phy to perform CCA (Step 3)
void SetLrWpanMacStateCallback(LrWpanMacStateCallback macState)
Set the callback function to the MAC.
uint8_t GetMacMaxBE(void) const
Get the maximum backoff exponent value.
void SetSlottedCsmaCa(void)
Configure for the use of the slotted CSMA/CA version.
uint8_t m_NB
Number of backoffs for the current transmission.
Ptr< UniformRandomVariable > m_random
Uniform random variable stream.
void SetMacMaxCSMABackoffs(uint8_t macMaxCSMABackoffs)
Set the maximum number of backoffs.
LrWpanCsmaCa(LrWpanCsmaCa const &)
Copy constructor - defined and not implemented.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Time GetTimeToNextSlot(void) const
Locates the time to the next backoff period boundary in the SUPERFRAME and returns the amount of time...
uint8_t m_macMaxCSMABackoffs
Maximum number of backoffs.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Callback< void, uint32_t > LrWpanMacTransCostCallback
This method informs the transaction cost in a slotted CSMA-CA data transmission.
Callback< void, LrWpanMacState > LrWpanMacStateCallback
This method informs the MAC whether the channel is idle or busy.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Every class exported by the ns3 library is enclosed in the ns3 namespace.