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 
23 #ifndef STA_WIFI_MAC_H
24 #define STA_WIFI_MAC_H
25 
26 #include "regular-wifi-mac.h"
27 #include "supported-rates.h"
28 #include "capability-information.h"
29 
30 namespace ns3 {
31 
32 class MgtAddBaRequestHeader;
33 
39 class StaWifiMac : public RegularWifiMac
40 {
41 public:
46  static TypeId GetTypeId (void);
47 
48  StaWifiMac ();
49  virtual ~StaWifiMac ();
50 
59  void Enqueue (Ptr<const Packet> packet, Mac48Address to);
60 
64  void SetWifiPhy (const Ptr<WifiPhy> phy);
65 
66 
67 private:
71  enum MacState
72  {
78  };
79 
85  void SetActiveProbing (bool enable);
91  bool GetActiveProbing (void) const;
92 
93  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
94 
99  void SendProbeRequest (void);
108  void SendAssociationRequest (bool isReassoc);
113  void TryToEnsureAssociated (void);
118  void AssocRequestTimeout (void);
123  void ProbeRequestTimeout (void);
129  bool IsAssociated (void) const;
135  bool IsWaitAssocResp (void) const;
139  void MissedBeacons (void);
145  void RestartBeaconWatchdog (Time delay);
152  SupportedRates GetSupportedRates (void) const;
158  void SetState (MacState value);
168  void SetEdcaParameters (AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit);
175 
179  void PhyCapabilitiesChanged (void);
180 
190 
193 };
194 
195 } //namespace ns3
196 
197 #endif /* STA_WIFI_MAC_H */
bool IsWaitAssocResp(void) const
Return whether we are waiting for an association response from an AP.
void SetWifiPhy(const Ptr< WifiPhy > phy)
TracedCallback< Mac48Address > m_deAssocLogger
deassoc logger
Definition: sta-wifi-mac.h:192
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
assoc request timeout
Definition: sta-wifi-mac.h:183
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 SetEdcaParameters(AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit)
Set the EDCA parameters.
void SetState(MacState value)
Set the current MAC state.
void AssocRequestTimeout(void)
This method is called after the association timeout occurred.
Time m_probeRequestTimeout
probe request timeout
Definition: sta-wifi-mac.h:182
Forward calls to a chain of Callback.
TracedCallback< Mac48Address > m_assocLogger
assoc logger
Definition: sta-wifi-mac.h:191
EventId m_assocRequestEvent
assoc request event
Definition: sta-wifi-mac.h:185
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
Capability information.
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.
tuple phy
Definition: third.py:86
MacState
The current MAC state of the STA.
Definition: sta-wifi-mac.h:71
MacState m_state
MAC state.
Definition: sta-wifi-mac.h:181
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.
uint32_t m_maxMissedBeacons
maximum missed beacons
Definition: sta-wifi-mac.h:188
EventId m_beaconWatchdog
beacon watchdog
Definition: sta-wifi-mac.h:186
virtual ~StaWifiMac()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void PhyCapabilitiesChanged(void)
Indicate that PHY capabilities have changed.
static TypeId GetTypeId(void)
Get the type ID.
Definition: sta-wifi-mac.cc:51
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
void Enqueue(Ptr< const Packet > packet, Mac48Address to)
Time m_beaconWatchdogEnd
beacon watchdog end
Definition: sta-wifi-mac.h:187
bool m_activeProbing
active probing
Definition: sta-wifi-mac.h:189
EventId m_probeRequestEvent
probe request event
Definition: sta-wifi-mac.h:184
bool IsAssociated(void) const
Return whether we are associated with an AP.
a unique identifier for an interface.
Definition: type-id.h:58
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:38
Implements the IEEE 802.11 MAC header.
void SendAssociationRequest(bool isReassoc)
Forward an association or reassociation request packet to the DCF.
The Wifi MAC high model for a non-AP STA in a BSS.
Definition: sta-wifi-mac.h:39