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:
44 
49  static TypeId GetTypeId (void);
50 
56  DcfState (Ptr<DcaTxop> txop);
57  virtual ~DcfState ();
58 
62  bool IsEdca (void) const;
63 
70  void SetAifsn (uint32_t aifsn);
76  void SetCwMin (uint32_t minCw);
82  void SetCwMax (uint32_t maxCw);
88  void SetTxopLimit (Time txopLimit);
94  uint32_t GetAifsn (void) const;
100  uint32_t GetCwMin (void) const;
106  uint32_t GetCwMax (void) const;
112  Time GetTxopLimit (void) const;
113 
120  void ResetCw (void);
126  void UpdateFailedCw (void);
133  void StartBackoffNow (uint32_t nSlots);
138  uint32_t GetCw (void) const;
143  bool IsAccessRequested (void) const;
144 
145 
146 protected:
148  friend class DcfManager;
149 
150  // Inherited from ns3::Object
151  void DoDispose (void);
152 
158  uint32_t GetBackoffSlots (void) const;
164  Time GetBackoffStart (void) const;
171  void UpdateBackoffSlotsNow (uint32_t nSlots, Time backoffUpdateBound);
175  void NotifyAccessRequested (void);
179  void NotifyAccessGranted (void);
183  void NotifyCollision (void);
187  void NotifyInternalCollision (void);
191  void NotifyChannelSwitching (void);
195  void NotifySleep (void);
199  void NotifyWakeUp (void);
200 
201  uint32_t m_aifsn;
202  uint32_t m_backoffSlots;
203 
209  uint32_t m_cwMin;
210  uint32_t m_cwMax;
211  uint32_t m_cw;
215 };
216 
217 } //namespace ns3
218 
219 #endif /* DCF_STATE_H */
uint32_t m_cwMin
the CW minimum
Definition: dcf-state.h:209
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 congestion 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:238
Ptr< DcaTxop > m_txop
the DCA TXOP
Definition: dcf-state.h:214
bool m_accessRequested
flag whether channel access is already requested
Definition: dcf-state.h:213
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:202
Time m_txopLimit
the txop limit time
Definition: dcf-state.h:212
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 congestion window size.
Definition: dcf-state.cc:124
void SetCwMin(uint32_t minCw)
Set the minimum congestion 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:210
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:211
void SetCwMax(uint32_t maxCw)
Set the maximum congestion 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:201
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:245
void NotifyCollision(void)
Notify that collision has occurred.
Definition: dcf-state.cc:210
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:208
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