A Discrete-Event Network Simulator
API
channel-access-manager.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2005,2006 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */
20
21#ifndef CHANNEL_ACCESS_MANAGER_H
22#define CHANNEL_ACCESS_MANAGER_H
23
24#include <vector>
25#include <algorithm>
26#include "ns3/event-id.h"
27#include "ns3/nstime.h"
28
29namespace ns3 {
30
31class WifiPhy;
32class PhyListener;
33class Txop;
34class FrameExchangeManager;
35
52{
53public:
55 virtual ~ChannelAccessManager ();
56
75
86 void Add (Ptr<Txop> txop);
87
96
105 void RequestAccess (Ptr<Txop> txop);
106
115 Time GetAccessGrantStart (bool ignoreNav = false) const;
116
126 void DisableEdcaFor (Ptr<Txop> qosTxop, Time duration);
127
134 void NotifyRxStartNow (Time duration);
139 void NotifyRxEndOkNow (void);
144 void NotifyRxEndErrorNow (void);
152 void NotifyTxStartNow (Time duration);
158 void NotifyMaybeCcaBusyStartNow (Time duration);
166 void NotifySwitchingStartNow (Time duration);
170 void NotifySleepNow (void);
174 void NotifyOffNow (void);
178 void NotifyWakeupNow (void);
182 void NotifyOnNow (void);
188 void NotifyNavResetNow (Time duration);
194 void NotifyNavStartNow (Time duration);
200 void NotifyAckTimeoutStartNow (Time duration);
204 void NotifyAckTimeoutResetNow (void);
210 void NotifyCtsTimeoutStartNow (Time duration);
214 void NotifyCtsTimeoutResetNow (void);
215
223 bool IsBusy (void) const;
224
225
226protected:
227 void DoDispose (void) override;
228
229
230private:
234 void UpdateBackoff (void);
242 Time MostRecent (std::initializer_list<Time> list) const;
261
263
268 void AccessTimeout (void);
272 void DoGrantDcfAccess (void);
273
279 virtual Time GetSifs (void) const;
285 virtual Time GetSlot (void) const;
291 virtual Time GetEifsNoDifs (void) const;
292
296 typedef std::vector<Ptr<Txop>> Txops;
297
313 bool m_off;
321};
322
323} //namespace ns3
324
325#endif /* CHANNEL_ACCESS_MANAGER_H */
Manage a set of ns3::Txop.
Time MostRecent(std::initializer_list< Time > list) const
Return the most recent time.
void AccessTimeout(void)
Called when access timeout should occur (e.g.
bool m_off
flag whether it is in off state
void NotifyRxStartNow(Time duration)
void UpdateBackoff(void)
Update backoff slots for all Txops.
Time m_lastRxStart
the last receive start time
Time GetBackoffEndFor(Ptr< Txop > txop)
Return the time when the backoff procedure ended (or will ended) for the given Txop.
void DoDispose(void) override
Destructor implementation.
bool m_lastRxReceivedOk
the last receive OK
void NotifyCtsTimeoutResetNow(void)
Notify that CTS timer has reset.
void NotifyOnNow(void)
Notify the Txop that the device has been resumed from off mode.
Ptr< WifiPhy > m_phy
pointer to the PHY
void NotifyTxStartNow(Time duration)
Time m_lastRxDuration
the last receive duration time
Time m_lastSwitchingDuration
the last switching duration time
Time m_lastSwitchingStart
the last switching start time
Time m_lastAckTimeoutEnd
the last Ack timeout end time
Time m_eifsNoDifs
EIFS no DIFS time.
void NotifyAckTimeoutStartNow(Time duration)
Notify that ack timer has started for the given duration.
bool m_sleeping
flag whether it is in sleeping state
void NotifyRxEndOkNow(void)
Notify the Txop that a packet reception was just completed successfully.
void SetupFrameExchangeManager(Ptr< FrameExchangeManager > feManager)
Set up the Frame Exchange Manager.
void NotifyCtsTimeoutStartNow(Time duration)
Notify that CTS timer has started for the given duration.
void RequestAccess(Ptr< Txop > txop)
Time m_lastTxStart
the last transmit start time
bool IsBusy(void) const
Check if the device is busy sending or receiving, or NAV or CCA busy.
void NotifyMaybeCcaBusyStartNow(Time duration)
void RemovePhyListener(Ptr< WifiPhy > phy)
Remove current registered listener for PHY events.
void NotifySleepNow(void)
Notify the Txop that the device has been put in sleep mode.
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for PHY events.
Time m_lastCtsTimeoutEnd
the last CTS timeout end time
void NotifyWakeupNow(void)
Notify the Txop that the device has been resumed from sleep mode.
Ptr< FrameExchangeManager > m_feManager
pointer to the Frame Exchange Manager
void NotifyOffNow(void)
Notify the Txop that the device has been put in off mode.
Time m_lastBusyStart
the last busy start time
Time m_lastNavDuration
the last NAV duration time
PhyListener * m_phyListener
the PHY listener
virtual Time GetSlot(void) const
Return the slot duration for this PHY.
std::vector< Ptr< Txop > > Txops
typedef for a vector of Txops
void NotifySwitchingStartNow(Time duration)
void DisableEdcaFor(Ptr< Txop > qosTxop, Time duration)
void DoGrantDcfAccess(void)
Grant access to Txop using DCF/EDCF contention rules.
Txops m_txops
the vector of managed Txops
Time m_lastTxDuration
the last transmit duration time
virtual Time GetSifs(void) const
Return the Short Interframe Space (SIFS) for this PHY.
Time m_lastBusyDuration
the last busy duration time
void NotifyAckTimeoutResetNow(void)
Notify that ack timer has reset.
void NotifyNavResetNow(Time duration)
Time GetAccessGrantStart(bool ignoreNav=false) const
Access will never be granted to the medium before the time returned by this method.
bool NeedBackoffUponAccess(Ptr< Txop > txop)
Determine if a new backoff needs to be generated when a packet is queued for transmission.
virtual Time GetEifsNoDifs(void) const
Return the EIFS duration minus a DIFS.
Time GetBackoffStartFor(Ptr< Txop > txop)
Return the time when the backoff procedure started for the given Txop.
Time m_lastNavStart
the last NAV start time
void NotifyNavStartNow(Time duration)
EventId m_accessTimeout
the access timeout ID
void NotifyRxEndErrorNow(void)
Notify the Txop that a packet reception was just completed unsuccessfully.
An identifier for simulation events.
Definition: event-id.h:54
A base class which provides memory management and object aggregation.
Definition: object.h:88
Listener for PHY events.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:93
#define list