A Discrete-Event Network Simulator
API
dcf-state.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 DCF_STATE_H
22 #define DCF_STATE_H
23 
24 #include "ns3/nstime.h"
25 #include "ns3/simulator.h"
26 
27 namespace ns3 {
28 
29 class DcaTxop;
30 
41 class DcfState : public Object
42 {
43 public:
48  static TypeId GetTypeId (void);
49 
55  DcfState (Ptr<DcaTxop> txop);
56  virtual ~DcfState ();
57 
61  bool IsEdca (void) const;
62 
69  void SetAifsn (uint32_t aifsn);
75  void SetCwMin (uint32_t minCw);
81  void SetCwMax (uint32_t maxCw);
87  void SetTxopLimit (Time txopLimit);
93  uint32_t GetAifsn (void) const;
99  uint32_t GetCwMin (void) const;
105  uint32_t GetCwMax (void) const;
111  Time GetTxopLimit (void) const;
112 
119  void ResetCw (void);
125  void UpdateFailedCw (void);
132  void StartBackoffNow (uint32_t nSlots);
137  uint32_t GetCw (void) const;
142  bool IsAccessRequested (void) const;
143 
144 
145 protected:
147  friend class DcfManager;
148 
149  // Inherited from ns3::Object
150  void DoDispose (void);
151 
157  uint32_t GetBackoffSlots (void) const;
163  Time GetBackoffStart (void) const;
170  void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound);
174  void NotifyAccessRequested (void);
178  void NotifyAccessGranted (void);
182  void NotifyCollision (void);
186  void NotifyInternalCollision (void);
190  void NotifyChannelSwitching (void);
194  void NotifySleep (void);
198  void NotifyOff (void);
202  void NotifyWakeUp (void);
206  void NotifyOn (void);
207 
208  uint32_t m_aifsn;
209  uint32_t m_backoffSlots;
210 
216  uint32_t m_cwMin;
217  uint32_t m_cwMax;
218  uint32_t m_cw;
222 };
223 
224 } //namespace ns3
225 
226 #endif /* DCF_STATE_H */
uint32_t m_cwMin
the CW minimum
Definition: dcf-state.h:216
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
Definition: dcf-state.cc:74
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void NotifySleep(void)
Notify that the device has started to sleep.
Definition: dcf-state.cc:231
DcfState(Ptr< DcaTxop > txop)
Constructor.
Definition: dcf-state.cc:41
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void NotifyInternalCollision(void)
Notify that internal collision has occurred.
Definition: dcf-state.cc:217
uint32_t GetCwMin(void) const
Return the minimum contention window size.
Definition: dcf-state.cc:118
void NotifyAccessGranted(void)
Notify that access has been granted.
Definition: dcf-state.cc:201
Time GetBackoffStart(void) const
Return the time when the backoff procedure started.
Definition: dcf-state.cc:182
void NotifyWakeUp(void)
Notify that the device has started to wake up.
Definition: dcf-state.cc:245
Ptr< DcaTxop > m_txop
the DCA TXOP
Definition: dcf-state.h:221
bool m_accessRequested
flag whether channel access is already requested
Definition: dcf-state.h:220
void SetAifsn(uint32_t aifsn)
Definition: dcf-state.cc:67
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
Definition: dcf-state.cc:130
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: dcf-state.cc:112
uint32_t m_backoffSlots
the backoff slots
Definition: dcf-state.h:209
Time m_txopLimit
the txop limit time
Definition: dcf-state.h:219
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:51
keep track of the state needed for a single DCF function.
Definition: dcf-state.h:41
bool IsAccessRequested(void) const
Definition: dcf-state.cc:188
void DoDispose(void)
Destructor implementation.
Definition: dcf-state.cc:59
uint32_t GetBackoffSlots(void) const
Return the current number of backoff slots.
Definition: dcf-state.cc:176
virtual ~DcfState()
Definition: dcf-state.cc:53
uint32_t GetCwMax(void) const
Return the maximum contention window size.
Definition: dcf-state.cc:124
void NotifyOn(void)
Notify that the device has started to switch on.
Definition: dcf-state.cc:252
void SetCwMin(uint32_t minCw)
Set the minimum contention window size.
Definition: dcf-state.cc:82
void StartBackoffNow(uint32_t nSlots)
Definition: dcf-state.cc:154
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_cwMax
the CW maximum
Definition: dcf-state.h:217
void NotifyAccessRequested(void)
Notify that access request has been received.
Definition: dcf-state.cc:194
uint32_t m_cw
the current CW
Definition: dcf-state.h:218
void SetCwMax(uint32_t maxCw)
Set the maximum contention window size.
Definition: dcf-state.cc:94
void NotifyChannelSwitching(void)
Notify that the device is switching channel.
Definition: dcf-state.cc:224
uint32_t GetCw(void) const
Definition: dcf-state.cc:170
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
Definition: dcf-state.cc:106
uint32_t m_aifsn
the AIFSN
Definition: dcf-state.h:208
void UpdateBackoffSlotsNow(uint32_t nSlots, Time backoffUpdateBound)
Update backoff slots that nSlots has passed.
Definition: dcf-state.cc:145
static TypeId GetTypeId(void)
Get the type ID.
Definition: dcf-state.cc:32
bool IsEdca(void) const
Definition: dcf-state.cc:259
void NotifyCollision(void)
Notify that collision has occurred.
Definition: dcf-state.cc:210
void NotifyOff(void)
Notify that the device has started to switch off.
Definition: dcf-state.cc:238
Time m_backoffStart
the backoffStart variable is used to keep track of the time at which a backoff was started or the tim...
Definition: dcf-state.h:215
A base class which provides memory management and object aggregation.
Definition: object.h:87
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
Definition: dcf-state.cc:137
a unique identifier for an interface.
Definition: type-id.h:58