A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20  * Author: 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 
27 #include "ns3/event-id.h"
28 #include "ns3/packet.h"
29 #include "ns3/traced-callback.h"
30 
31 #include "supported-rates.h"
32 #include "amsdu-subframe-header.h"
33 
34 namespace ns3 {
35 
36 class MgtAddBaRequestHeader;
37 
43 class StaWifiMac : public RegularWifiMac
44 {
45 public:
46  static TypeId GetTypeId (void);
47 
48  StaWifiMac ();
49  virtual ~StaWifiMac ();
50 
59  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
60 
65  void SetMaxMissedBeacons (uint32_t missed);
79  void SetAssocRequestTimeout (Time timeout);
80 
84  void StartActiveAssociation (void);
85 
86 private:
90  enum MacState
91  {
97  };
98 
104  void SetActiveProbing (bool enable);
110  bool GetActiveProbing (void) const;
111  virtual void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
112 
117  void SendProbeRequest (void);
122  void SendAssociationRequest (void);
127  void TryToEnsureAssociated (void);
132  void AssocRequestTimeout (void);
137  void ProbeRequestTimeout (void);
143  bool IsAssociated (void) const;
149  bool IsWaitAssocResp (void) const;
153  void MissedBeacons (void);
159  void RestartBeaconWatchdog (Time delay);
166  SupportedRates GetSupportedRates (void) const;
172  void SetState (enum MacState value);
173 
179  HtCapabilities GetHtCapabilities (void) const;
180 
181 
191 
194 };
195 
196 } // namespace ns3
197 
198 #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:193
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:79
Time m_assocRequestTimeout
Definition: sta-wifi-mac.h:184
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:183
void SetProbeRequestTimeout(Time timeout)
forward calls to a chain of CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
The Ht Capabilities Information ElementThis class knows how to serialise and deserialise the Ht Capab...
TracedCallback< Mac48Address > m_assocLogger
Definition: sta-wifi-mac.h:192
EventId m_assocRequestEvent
Definition: sta-wifi-mac.h:186
ns3::Time timeout
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
void SetAssocRequestTimeout(Time timeout)
MacState
The current MAC state of the STA.
Definition: sta-wifi-mac.h:90
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.
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.
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the current AP.
uint32_t m_maxMissedBeacons
Definition: sta-wifi-mac.h:189
void StartActiveAssociation(void)
Start an active association sequence immediately.
void SetMaxMissedBeacons(uint32_t missed)
EventId m_beaconWatchdog
Definition: sta-wifi-mac.h:187
virtual ~StaWifiMac()
static TypeId GetTypeId(void)
Definition: sta-wifi-mac.cc:66
an EUI-48 address
Definition: mac48-address.h:41
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
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:46
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
enum MacState m_state
Definition: sta-wifi-mac.h:182
Time m_beaconWatchdogEnd
Definition: sta-wifi-mac.h:188
EventId m_probeRequestEvent
Definition: sta-wifi-mac.h:185
bool IsAssociated(void) const
Return whether we are associated with an AP.
a unique identifier for an interface.
Definition: type-id.h:49
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:43