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 DoStart ();
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 */