/usr/include/ns3/regular-wifi-mac.h is in libns3-dev 3.13+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2008 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef REGULAR_WIFI_MAC_H
#define REGULAR_WIFI_MAC_H
#include "ns3/wifi-mac.h"
#include "dca-txop.h"
#include "edca-txop-n.h"
#include "wifi-remote-station-manager.h"
#include "ssid.h"
#include "qos-utils.h"
#include <map>
namespace ns3 {
class Dcf;
class MacLow;
class MacRxMiddle;
class MacTxMiddle;
class DcfManager;
/**
* \brief base class for all MAC-level wifi objects.
* \ingroup wifi
*
* This class encapsulates all the low-level MAC functionality
* DCA, EDCA, etc) and all the high-level MAC functionality
* (association/disassociation state machines).
*
*/
class RegularWifiMac : public WifiMac
{
public:
static TypeId GetTypeId (void);
RegularWifiMac ();
virtual ~RegularWifiMac ();
/**
* \param slotTime the slot duration
*/
void SetSlot (Time slotTime);
/**
* \param sifs the sifs duration
*/
void SetSifs (Time sifs);
/**
* \param eifsNoDifs the duration of an EIFS minus DIFS.
*
* This value is used to calculate the EIFS depending
* on AIFSN.
*/
void SetEifsNoDifs (Time eifsNoDifs);
/**
* \param pifs the pifs duration.
*/
void SetPifs (Time pifs);
/**
* \param ctsTimeout the duration of a CTS timeout.
*/
void SetCtsTimeout (Time ctsTimeout);
/**
* \param ackTimeout the duration of an ACK timeout.
*/
void SetAckTimeout (Time ackTimeout);
/**
* \returns the current PIFS duration.
*/
Time GetPifs (void) const;
/**
* \returns the current SIFS duration.
*/
Time GetSifs (void) const;
/**
* \returns the current slot duration.
*/
Time GetSlot (void) const;
/**
* \returns the current EIFS minus DIFS duration
*/
Time GetEifsNoDifs (void) const;
/**
* \returns the current CTS timeout duration.
*/
Time GetCtsTimeout (void) const;
/**
* \returns the current ACK timeout duration.
*/
Time GetAckTimeout (void) const;
/**
* \returns the MAC address associated to this MAC layer.
*/
virtual Mac48Address GetAddress (void) const;
/**
* \returns the ssid which this MAC layer is going to try to stay in.
*/
virtual Ssid GetSsid (void) const;
/**
* \param address the current address of this MAC layer.
*/
virtual void SetAddress (Mac48Address address);
/**
* \param ssid the current ssid of this MAC layer.
*/
virtual void SetSsid (Ssid ssid);
/**
* \param bssid the BSSID of the network that this device belongs to.
*/
virtual void SetBssid (Mac48Address bssid);
/**
* \returns the bssid of the network this device belongs to.
*/
virtual Mac48Address GetBssid (void) const;
/**
* \brief Sets the interface in promiscuous mode.
*
* Enables promiscuous mode on the interface. Note that any further
* filtering on the incoming frame path may affect the overall
* behavior.
*/
virtual void SetPromisc (void);
/**
* \param packet the packet to send.
* \param to the address to which the packet should be sent.
* \param from the address from which the packet should be sent.
*
* The packet should be enqueued in a tx queue, and should be
* dequeued as soon as the channel access function determines that
* access is granted to this MAC. The extra parameter "from" allows
* this device to operate in a bridged mode, forwarding received
* frames without altering the source address.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
virtual bool SupportsSendFrom (void) const;
/**
* \param packet the packet to send.
* \param to the address to which the packet should be sent.
*
* The packet should be enqueued in a tx queue, and should be
* dequeued as soon as the channel access function determines that
* access is granted to this MAC.
*/
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to) = 0;
/**
* \param phy the physical layer attached to this MAC.
*/
virtual void SetWifiPhy (Ptr<WifiPhy> phy);
/**
* \returns the physical layer attached to this MAC.
*/
virtual Ptr<WifiPhy> GetWifiPhy () const;
/**
* \param stationManager the station manager attached to this MAC.
*/
virtual void SetWifiRemoteStationManager (Ptr<WifiRemoteStationManager> stationManager);
/**
* \returns the station manager attached to this MAC.
*/
virtual Ptr<WifiRemoteStationManager> GetWifiRemoteStationManager () const;
/**
* This type defines the callback of a higher layer that a
* WifiMac(-derived) object invokes to pass a packet up the stack.
*
* \param packet the packet that has been received.
* \param from the MAC address of the device that sent the packet.
* \param to the MAC address ot the device that the packet is
* destined for.
*/
typedef Callback<void, Ptr<Packet>, Mac48Address, Mac48Address> ForwardUpCallback;
/**
* \param upCallback the callback to invoke when a packet must be
* forwarded up the stack.
*/
virtual void SetForwardUpCallback (ForwardUpCallback upCallback);
/**
* \param linkUp the callback to invoke when the link becomes up.
*/
virtual void SetLinkUpCallback (Callback<void> linkUp);
/**
* \param linkDown the callback to invoke when the link becomes down.
*/
virtual void SetLinkDownCallback (Callback<void> linkDown);
/* Next functions are not pure virtual so non Qos WifiMacs are not
* forced to implement them.
*/
virtual void SetBasicBlockAckTimeout (Time blockAckTimeout);
virtual Time GetBasicBlockAckTimeout (void) const;
virtual void SetCompressedBlockAckTimeout (Time blockAckTimeout);
virtual Time GetCompressedBlockAckTimeout (void) const;
protected:
virtual void DoStart ();
virtual void DoDispose ();
MacRxMiddle *m_rxMiddle;
MacTxMiddle *m_txMiddle;
Ptr<MacLow> m_low;
DcfManager *m_dcfManager;
Ptr<WifiPhy> m_phy;
Ptr<WifiRemoteStationManager> m_stationManager;
ForwardUpCallback m_forwardUp;
Callback<void> m_linkUp;
Callback<void> m_linkDown;
Ssid m_ssid;
/** This holds a pointer to the DCF instance for this WifiMac - used
for transmission of frames to non-QoS peers. */
Ptr<DcaTxop> m_dca;
/** This type defines a mapping between an Access Category index,
and a pointer to the corresponding channel access function */
typedef std::map<AcIndex, Ptr<EdcaTxopN> > EdcaQueues;
/** This is a map from Access Category index to the corresponding
channel access function */
EdcaQueues m_edca;
/**
* \param standard the phy standard to be used
*
* This method is called by ns3::WifiMac::ConfigureStandard to
* complete the configuration process for a requested phy standard.
*
* This method may be overriden by a derived class (e.g., in order
* to apply DCF or EDCA parameters specific to the usage model it is
* dealing with), in which case the reimplementation may choose to
* deal with certain values in the WifiPhyStandard enumeration, and
* chain up to this implementation to deal with the remainder.
*/
virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
/**
* This method is invoked by a subclass to specify what type of
* station it is implementing. This is something that the channel
* access functions (instantiated within this class as EdcaTxopN's)
* need to know.
*
* \param type the type of station.
*/
void SetTypeOfStation (TypeOfStation type);
/**
* This method acts as the MacRxMiddle receive callback and is
* invoked to notify us that a frame has been received. The
* implementation is intended to capture logic that is going to be
* common to all (or most) derived classes. Specifically, handling
* of Block Ack managment frames is dealt with here.
*
* This method will need, however, to be overriden by derived
* classes so that they can perform their data handling before
* invoking the base version.
*
* \param packet the packet that has been received.
* \param hdr a pointer to the MAC header of the received frame.
*/
virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
virtual void TxOk (const WifiMacHeader &hdr);
virtual void TxFailed (const WifiMacHeader &hdr);
void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
/**
* This method can be called to de-aggregate an A-MSDU and forward
* the constituent packets up the stack.
*
* \param aggregatedPacket the Packet containing the A-MSDU.
* \param hdr a pointer to the MAC header for \c aggregatedPacket.
*/
virtual void DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket,
const WifiMacHeader *hdr);
/**
* This method can be called to accept a received ADDBA Request. An
* ADDBA Response will be constructed and queued for transmission.
*
* \param reqHdr a pointer to the received ADDBA Request header.
* \param originator the MAC address of the originator.
*/
virtual void SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr,
Mac48Address originator);
/**
* This Boolean is set \c true iff this WifiMac is to model
* 802.11e/WMM style Quality of Service. It is exposed through the
* attribute system.
*
* At the moment, this flag is the sole selection between QoS and
* non-QoS operation for the STA (whether IBSS, AP, or
* non-AP). Ultimately, we will want a QoS-enabled STA to be able to
* fall back to non-QoS operation with a non-QoS peer. This'll
* require further intelligence - i.e., per-association QoS
* state. Having a big switch seems like a good intermediate stage,
* however.
*/
bool m_qosSupported;
/** Set accessor for the \c m_qosSupported member */
void SetQosSupported (bool enable);
/** Get accessor for the \c m_qosSupported member */
bool GetQosSupported () const;
private:
RegularWifiMac (const RegularWifiMac &);
RegularWifiMac & operator= (const RegularWifiMac &);
/**
* This method is a private utility invoked to configure the channel
* access function for the specified Access Category.
*
* \param ac the Access Category index of the queue to initialise.
*/
void SetupEdcaQueue (enum AcIndex ac);
/** Accessor for the DCF object */
Ptr<DcaTxop> GetDcaTxop (void) const;
/** Accessor for the AC_VO channel access function */
Ptr<EdcaTxopN> GetVOQueue (void) const;
/** Accessor for the AC_VI channel access function */
Ptr<EdcaTxopN> GetVIQueue (void) const;
/** Accessor for the AC_BE channel access function */
Ptr<EdcaTxopN> GetBEQueue (void) const;
/** Accessor for the AC_BK channel access function */
Ptr<EdcaTxopN> GetBKQueue (void) const;
TracedCallback<const WifiMacHeader &> m_txOkCallback;
TracedCallback<const WifiMacHeader &> m_txErrCallback;
};
} // namespace ns3
#endif /* REGULAR_WIFI_MAC_H */
|