A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
dca-txop.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005 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 DCA_TXOP_H
22 #define DCA_TXOP_H
23 
24 #include <stdint.h>
25 #include "ns3/callback.h"
26 #include "ns3/packet.h"
27 #include "ns3/nstime.h"
28 #include "ns3/object.h"
29 #include "ns3/wifi-mac-header.h"
30 #include "ns3/wifi-mode.h"
31 #include "ns3/wifi-remote-station-manager.h"
32 #include "ns3/dcf.h"
33 
34 namespace ns3 {
35 
36 class DcfState;
37 class DcfManager;
38 class WifiMacQueue;
39 class MacLow;
40 class WifiMacParameters;
41 class MacTxMiddle;
42 class RandomStream;
43 class MacStation;
44 class MacStations;
45 
67 class DcaTxop : public Dcf
68 {
69 public:
70  static TypeId GetTypeId (void);
71 
74 
75  DcaTxop ();
76  ~DcaTxop ();
77 
78  void SetLow (Ptr<MacLow> low);
79  void SetManager (DcfManager *manager);
81 
86  void SetTxOkCallback (TxOk callback);
91  void SetTxFailedCallback (TxFailed callback);
92 
94  virtual void SetMinCw (uint32_t minCw);
95  virtual void SetMaxCw (uint32_t maxCw);
96  virtual void SetAifsn (uint32_t aifsn);
97  virtual uint32_t GetMinCw (void) const;
98  virtual uint32_t GetMaxCw (void) const;
99  virtual uint32_t GetAifsn (void) const;
100 
108  void Queue (Ptr<const Packet> packet, const WifiMacHeader &hdr);
109 
118  int64_t AssignStreams (int64_t stream);
119 
120 private:
121  class TransmissionListener;
122  class NavListener;
123  class PhyListener;
124  class Dcf;
125  friend class Dcf;
126  friend class TransmissionListener;
127 
128  DcaTxop &operator = (const DcaTxop &);
129  DcaTxop (const DcaTxop &o);
130 
131  // Inherited from ns3::Object
132  Ptr<MacLow> Low (void);
133  void DoInitialize ();
134  /* dcf notifications forwarded here */
135  bool NeedsAccess (void) const;
136  void NotifyAccessGranted (void);
137  void NotifyInternalCollision (void);
138  void NotifyCollision (void);
142  void NotifyChannelSwitching (void);
143  /* event handlers */
144  void GotCts (double snr, WifiMode txMode);
145  void MissedCts (void);
146  void GotAck (double snr, WifiMode txMode);
147  void MissedAck (void);
148  void StartNext (void);
149  void Cancel (void);
150  void EndTxNoAck (void);
151 
152  void RestartAccessIfNeeded (void);
153  void StartAccessIfNeeded (void);
154  bool NeedRts (Ptr<const Packet> packet, const WifiMacHeader *header);
155  bool NeedRtsRetransmission (void);
156  bool NeedDataRetransmission (void);
157  bool NeedFragmentation (void);
158  uint32_t GetNextFragmentSize (void);
159  uint32_t GetFragmentSize (void);
160  uint32_t GetFragmentOffset (void);
161  bool IsLastFragment (void);
162  void NextFragment (void);
164  virtual void DoDispose (void);
165 
176 
181 };
182 
183 } // namespace ns3
184 
185 
186 
187 #endif /* DCA_TXOP_H */
void NotifyInternalCollision(void)
Definition: dca-txop.cc:483
DcaTxop & operator=(const DcaTxop &)
virtual uint32_t GetMaxCw(void) const
Definition: dca-txop.cc:230
Callback< void, const WifiMacHeader & > TxFailed
Definition: dca-txop.h:73
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
uint32_t GetFragmentOffset(void)
Definition: dca-txop.cc:364
uint8_t m_fragmentNumber
Definition: dca-txop.h:180
bool m_accessOngoing
Definition: dca-txop.h:177
void SetTxFailedCallback(TxFailed callback)
Definition: dca-txop.cc:192
virtual void SetMaxCw(uint32_t maxCw)
Definition: dca-txop.cc:212
void StartNext(void)
Definition: dca-txop.cc:588
Ptr< MacLow > m_low
Definition: dca-txop.h:172
Ptr< MacLow > Low(void)
Definition: dca-txop.cc:288
TxOk m_txOkCallback
Definition: dca-txop.h:168
virtual uint32_t GetAifsn(void) const
Definition: dca-txop.cc:236
int64_t AssignStreams(int64_t stream)
Definition: dca-txop.cc:255
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:91
static TypeId GetTypeId(void)
Definition: dca-txop.cc:118
void SetTxOkCallback(TxOk callback)
Definition: dca-txop.cc:186
Ptr< Packet > GetFragmentPacket(WifiMacHeader *hdr)
Definition: dca-txop.cc:372
void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
Definition: dca-txop.cc:243
void SetLow(Ptr< MacLow > low)
Definition: dca-txop.cc:174
bool NeedFragmentation(void)
Definition: dca-txop.cc:326
Ptr< WifiMacQueue > m_queue
Definition: dca-txop.h:170
void Cancel(void)
Definition: dca-txop.cc:612
void GotCts(double snr, WifiMode txMode)
Definition: dca-txop.cc:506
void NotifyChannelSwitching(void)
Definition: dca-txop.cc:498
void MissedCts(void)
Definition: dca-txop.cc:512
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
Definition: dcf-manager.h:173
bool IsLastFragment(void)
Definition: dca-txop.cc:348
Ptr< WifiRemoteStationManager > m_stationManager
Definition: dca-txop.h:173
bool NeedRts(Ptr< const Packet > packet, const WifiMacHeader *header)
Definition: dca-txop.cc:295
virtual void SetAifsn(uint32_t aifsn)
Definition: dca-txop.cc:218
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Definition: dca-txop.cc:180
Callback< void, const WifiMacHeader & > TxOk
Definition: dca-txop.h:72
void DoInitialize()
Definition: dca-txop.cc:303
bool NeedsAccess(void) const
Definition: dca-txop.cc:393
WifiMacHeader m_currentHdr
Definition: dca-txop.h:179
Ptr< WifiMacQueue > GetQueue() const
Definition: dca-txop.cc:199
bool NeedRtsRetransmission(void)
Definition: dca-txop.cc:311
Ptr< const Packet > m_currentPacket
Definition: dca-txop.h:178
MacTxMiddle * m_txMiddle
Definition: dca-txop.h:171
DcfManager * m_manager
Definition: dca-txop.h:167
virtual void SetMinCw(uint32_t minCw)
Definition: dca-txop.cc:206
void GotAck(double snr, WifiMode txMode)
Definition: dca-txop.cc:536
void SetManager(DcfManager *manager)
Definition: dca-txop.cc:166
uint32_t GetNextFragmentSize(void)
Definition: dca-txop.cc:356
virtual void DoDispose(void)
Definition: dca-txop.cc:149
void NotifyCollision(void)
Definition: dca-txop.cc:489
void StartAccessIfNeeded(void)
Definition: dca-txop.cc:275
void NextFragment(void)
Definition: dca-txop.cc:334
TransmissionListener * m_transmissionListener
Definition: dca-txop.h:174
void RestartAccessIfNeeded(void)
Definition: dca-txop.cc:263
void MissedAck(void)
Definition: dca-txop.cc:562
handle packet fragmentation and retransmissions.This class implements the packet fragmentation and re...
Definition: dca-txop.h:67
bool NeedDataRetransmission(void)
Definition: dca-txop.cc:319
virtual uint32_t GetMinCw(void) const
Definition: dca-txop.cc:224
Dcf * m_dcf
Definition: dca-txop.h:166
uint32_t GetFragmentSize(void)
Definition: dca-txop.cc:341
a unique identifier for an interface.
Definition: type-id.h:49
void NotifyAccessGranted(void)
Definition: dca-txop.cc:399
void EndTxNoAck(void)
Definition: dca-txop.cc:644
RandomStream * m_rng
Definition: dca-txop.h:175
TxFailed m_txFailedCallback
Definition: dca-txop.h:169