104 m_lastRxReceivedOk (true),
219 retval =
Max (retval, c);
318 NS_LOG_DEBUG (
"Internal collision (currently transmitting)");
367 std::vector<Ptr<DcfState> > internalCollisionStates;
368 for (States::iterator j = i; j !=
m_states.end (); j++, k++)
374 NS_LOG_DEBUG (
"dcf " << k <<
" needs access. backoff expired. internal collision. slots=" <<
381 internalCollisionStates.push_back (otherState);
393 for (std::vector<
Ptr<DcfState> >::iterator k = internalCollisionStates.begin ();
394 k != internalCollisionStates.end (); k++)
396 (*k)->NotifyInternalCollision ();
440 ackTimeoutAccessStart,
441 ctsTimeoutAccessStart,
444 NS_LOG_INFO (
"access grant start=" << accessGrantedStart <<
445 ", rx access start=" << rxAccessStart <<
446 ", busy access start=" << busyAccessStart <<
447 ", tx access start=" << txAccessStart <<
448 ", nav access start=" << navAccessStart);
449 return accessGrantedStart;
459 return mostRecentEvent;
477 for (States::iterator i =
m_states.begin (); i !=
m_states.end (); i++, k++)
484 uint32_t nus = (
Simulator::Now () - backoffStart).GetMicroSeconds ();
502 NS_LOG_DEBUG (
"dcf " << k <<
" dec backoff slots=" << n);
517 bool accessTimeoutNeeded =
false;
527 accessTimeoutNeeded =
true;
528 expectedBackoffEnd =
std::min (expectedBackoffEnd, tmp);
532 NS_LOG_DEBUG (
"Access timeout needed: " << accessTimeoutNeeded);
533 if (accessTimeoutNeeded)
535 NS_LOG_DEBUG (
"expected backoff end=" << expectedBackoffEnd);
655 if (remainingSlots > 0)
718 if (remainingSlots > 0)
738 if (remainingSlots > 0)
775 if (newNavEnd > lastNavEnd)
778 m_lastNavDuration = duration;
ns3::DcfManager * m_dcf
DcfManager to forward events to.
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
void NotifyWakeupNow(void)
Notify the DCF that the device has been resumed from sleep mode.
Simulation virtual time values and global simulation resolution.
void NotifySleep(void)
Notify that the device has started to sleep.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void NotifyInternalCollision(void)
Notify that internal collision has occurred.
Time GetBackoffStartFor(Ptr< DcfState > state)
Return the time when the backoff procedure started for the given DcfState.
bool m_lastRxReceivedOk
the last receive OK
void NotifyMaybeCcaBusyStart(Time duration)
void NotifySwitchingStart(Time duration)
void NotifyAccessGranted(void)
Notify that access has been granted.
bool m_off
flag whether it is in off state
Time m_eifsNoDifs
EIFS no DIFS time.
Time GetBackoffStart(void) const
Return the time when the backoff procedure started.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Time m_lastBusyStart
the last busy start time
Time m_lastAckTimeoutEnd
the last ACK timeout end time
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void NotifyWakeUp(void)
Notify that the device has started to wake up.
void NotifyOff(void)
Notify listeners that we went to switch off.
void UpdateBackoff(void)
Update backoff slots for all DcfStates.
Time m_lastCtsTimeoutEnd
the last CTS timeout end time
void UnregisterListener(WifiPhyListener *listener)
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
bool m_accessRequested
flag whether channel access is already requested
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
Time m_lastSwitchingDuration
the last switching duration time
PhyListener(ns3::DcfManager *dcf)
Create a PhyListener for the given DcfManager.
void NotifyRxEndError(void)
We have received the last bit of a packet for which NotifyRxStart was invoked first and...
Time GetBackoffEndFor(Ptr< DcfState > state)
Return the time when the backoff procedure ended (or will ended) for the given DcfState.
void DoGrantAccess(void)
Grant access to DCF.
void NotifyNavResetNow(Time duration)
void NotifyCtsTimeoutStartNow(Time duration)
Notify that CTS timer has started for the given duration.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void NotifyRxEndOkNow(void)
Notify the DCF that a packet reception was just completed successfully.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
PhyListener * m_phyListener
the phy listener
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Time GetAccessGrantStart(void) const
Access will never be granted to the medium before the time returned by this method.
receive notifications about phy events.
void NotifyTxStartNow(Time duration)
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for Phy events.
void NotifyAckTimeoutStartNow(Time duration)
Notify that ACK timer has started for the given duration.
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
int64x64_t Max(const int64x64_t &a, const int64x64_t &b)
Maximum.
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
void NotifyWakeup(void)
Notify listeners that we woke up.
bool IsAccessRequested(void) const
void NotifyTxStart(Time duration, double txPowerDbm)
uint32_t GetBackoffSlots(void) const
Return the current number of backoff slots.
void NotifySleep(void)
Notify listeners that we went to sleep.
void NotifyOn(void)
Notify that the device has started to switch on.
Time m_lastBusyDuration
the last busy duration time
double f(double x, void *params)
void RegisterDcf(Ptr< DcfManager > dcf)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void NotifyOn(void)
Notify listeners that we went to switch on.
void NotifyAccessRequested(void)
Notify that access request has been received.
void Add(Ptr< DcfState > dcf)
void NotifyRxEndErrorNow(void)
Notify the DCF that a packet reception was just completed unsuccessfully.
Time m_lastSwitchingStart
the last switching start time
void SetEifsNoDifs(Time eifsNoDifs)
bool m_sleeping
flag whether it is in sleeping state
Time m_lastRxEnd
the last receive end time
static Time Now(void)
Return the current simulation virtual time.
void NotifyMaybeCcaBusyStartNow(Time duration)
void AccessTimeout(void)
Called when access timeout should occur (e.g.
Time m_lastNavStart
the last NAV start time
Time m_lastNavDuration
the last NAV duration time
void NotifyRxStart(Time duration)
void SetSlot(Time slotTime)
void NotifyAckTimeoutResetNow()
Notify that ACK timer has resetted.
void RegisterListener(WifiPhyListener *listener)
void DoDispose(void)
Destructor implementation.
void NotifyOnNow(void)
Notify the DCF that the device has been resumed from off mode.
TimeWithUnit As(const enum Unit unit) const
Attach a unit to a Time, to facilitate output in a specific unit.
void NotifyNavStartNow(Time duration)
void NotifyChannelSwitching(void)
Notify that the device is switching channel.
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
void NotifyRxStartNow(Time duration)
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound)
Update backoff slots that nSlots has passed.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
bool m_rxing
flag whether it is in receiving state
Time GetEifsNoDifs() const
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
void RequestAccess(Ptr< DcfState > state)
void NotifySleepNow(void)
Notify the DCF that the device has been put in sleep mode.
void NotifyCtsTimeoutResetNow()
Notify that CTS timer has resetted.
void NotifyCollision(void)
Notify that collision has occurred.
States m_states
the DCF states
void NotifyOff(void)
Notify that the device has started to switch off.
bool IsBusy(void) const
Check if the device is busy sending or receiving, or NAV or CCA busy.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time m_lastTxDuration
the last transmit duration time
void DoRestartAccessTimeoutIfNeeded(void)
EventId m_accessTimeout
the access timeout ID
Time m_lastTxStart
the last transmit start time
void NotifyOffNow(void)
Notify the DCF that the device has been put in off mode.
bool IsWithinAifs(Ptr< DcfState > state) const
Check if the device is between frames (in DIFS or AIFS interval)
void NotifySwitchingStartNow(Time duration)
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
void NotifyRxEndOk(void)
We have received the last bit of a packet for which NotifyRxStart was invoked first and...
static Time GetMaximumSimulationTime(void)
Get the maximum representable simulation time.
uint32_t m_slotTimeUs
the slot time in microseconds
Time MostRecent(Time a, Time b) const
Return the most recent time.
Time m_lastRxDuration
the last receive duration time
Time m_lastRxStart
the last receive start time