A Discrete-Event Network Simulator
API
sta-wifi-mac.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006, 2009 INRIA
4  * Copyright (c) 2009 MIRKO BANCHI
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Mirko Banchi <mk.banchi@gmail.com>
21  */
22 #ifndef STA_WIFI_MAC_H
23 #define STA_WIFI_MAC_H
24 
25 #include "regular-wifi-mac.h"
26 #include "ns3/event-id.h"
27 #include "ns3/packet.h"
28 #include "ns3/traced-callback.h"
29 #include "supported-rates.h"
30 #include "amsdu-subframe-header.h"
31 #include "capability-information.h"
32 
33 namespace ns3 {
34 
35 class MgtAddBaRequestHeader;
36 
42 class StaWifiMac : public RegularWifiMac
43 {
44 public:
45  static TypeId GetTypeId (void);
46 
47  StaWifiMac ();
48  virtual ~StaWifiMac ();
49 
58  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
59 
64  void SetMaxMissedBeacons (uint32_t missed);
78  void SetAssocRequestTimeout (Time timeout);
79 
83  void StartActiveAssociation (void);
84 
85 
86 private:
90  enum MacState
91  {
97  };
98 
104  void SetActiveProbing (bool enable);
110  bool GetActiveProbing (void) const;
111 
112  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
113 
118  void SendProbeRequest (void);
123  void SendAssociationRequest (void);
128  void TryToEnsureAssociated (void);
133  void AssocRequestTimeout (void);
138  void ProbeRequestTimeout (void);
144  bool IsAssociated (void) const;
150  bool IsWaitAssocResp (void) const;
154  void MissedBeacons (void);
160  void RestartBeaconWatchdog (Time delay);
167  SupportedRates GetSupportedRates (void) const;
173  void SetState (enum MacState value);
183  void SetEdcaParameters (AcIndex ac, uint8_t cwMin, uint8_t cwMax, uint8_t aifsn, Time txopLimit);
190 
200 
203 };
204 
205 } //namespace ns3
206 
207 #endif /* STA_WIFI_MAC_H */
bool IsWaitAssocResp(void) const
Return whether we are waiting for an association response from an AP.
TracedCallback< Mac48Address > m_deAssocLogger
Definition: sta-wifi-mac.h:202
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Time m_assocRequestTimeout
Definition: sta-wifi-mac.h:193
virtual void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
This method acts as the MacRxMiddle receive callback and is invoked to notify us that a frame has bee...
void SendAssociationRequest(void)
Forward an association request packet to the DCF.
void AssocRequestTimeout(void)
This method is called after the association timeout occurred.
Time m_probeRequestTimeout
Definition: sta-wifi-mac.h:192
void SetProbeRequestTimeout(Time timeout)
Forward calls to a chain of Callback.
TracedCallback< Mac48Address > m_assocLogger
Definition: sta-wifi-mac.h:201
EventId m_assocRequestEvent
Definition: sta-wifi-mac.h:195
ns3::Time timeout
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Capability information.
void SetAssocRequestTimeout(Time timeout)
void SendProbeRequest(void)
Forward a probe request packet to the DCF.
base class for all MAC-level wifi objects.
void ProbeRequestTimeout(void)
This method is called after the probe request timeout occurred.
MacState
The current MAC state of the STA.
Definition: sta-wifi-mac.h:90
void MissedBeacons(void)
This method is called after we have not received a beacon from the AP.
bool GetActiveProbing(void) const
Return whether active probing is enabled.
void SetState(enum MacState value)
Set the current MAC state.
uint32_t m_maxMissedBeacons
Definition: sta-wifi-mac.h:198
void StartActiveAssociation(void)
Start an active association sequence immediately.
void SetMaxMissedBeacons(uint32_t missed)
EventId m_beaconWatchdog
Definition: sta-wifi-mac.h:196
virtual ~StaWifiMac()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Definition: sta-wifi-mac.cc:65
an EUI-48 address
Definition: mac48-address.h:43
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current STA.
void TryToEnsureAssociated(void)
Try to ensure that we are associated with an AP by taking an appropriate action depending on the curr...
void SetActiveProbing(bool enable)
Enable or disable active probing.
An identifier for simulation events.
Definition: event-id.h:53
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
enum MacState m_state
Definition: sta-wifi-mac.h:191
Time m_beaconWatchdogEnd
Definition: sta-wifi-mac.h:197
EventId m_probeRequestEvent
Definition: sta-wifi-mac.h:194
bool IsAssociated(void) const
Return whether we are associated with an AP.
a unique identifier for an interface.
Definition: type-id.h:58
void SetEdcaParameters(AcIndex ac, uint8_t cwMin, uint8_t cwMax, uint8_t aifsn, Time txopLimit)
Set the EDCA parameters.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:36
Implements the IEEE 802.11 MAC header.
The Wifi MAC high model for a non-AP STA in a BSS.
Definition: sta-wifi-mac.h:42