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 
65  void SetMaxMissedBeacons (uint32_t missed);
79  void SetAssocRequestTimeout (Time timeout);
80 
84  void StartActiveAssociation (void);
85 
86 
87 private:
91  enum MacState
92  {
98  };
99 
105  void SetActiveProbing (bool enable);
111  bool GetActiveProbing (void) const;
112 
113  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
114 
119  void SendProbeRequest (void);
124  void SendAssociationRequest (void);
129  void TryToEnsureAssociated (void);
134  void AssocRequestTimeout (void);
139  void ProbeRequestTimeout (void);
145  bool IsAssociated (void) const;
151  bool IsWaitAssocResp (void) const;
155  void MissedBeacons (void);
161  void RestartBeaconWatchdog (Time delay);
168  SupportedRates GetSupportedRates (void) const;
174  void SetState (MacState value);
184  void SetEdcaParameters (AcIndex ac, uint8_t cwMin, uint8_t cwMax, uint8_t aifsn, Time txopLimit);
191 
201 
204 };
205 
206 } //namespace ns3
207 
208 #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
deassoc logger
Definition: sta-wifi-mac.h:203
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:194
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 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:193
void SetProbeRequestTimeout(Time timeout)
Forward calls to a chain of Callback.
TracedCallback< Mac48Address > m_assocLogger
assoc logger
Definition: sta-wifi-mac.h:202
EventId m_assocRequestEvent
assoc request event
Definition: sta-wifi-mac.h:196
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:91
MacState m_state
MAC state.
Definition: sta-wifi-mac.h:192
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:199
void StartActiveAssociation(void)
Start an active association sequence immediately.
void SetMaxMissedBeacons(uint32_t missed)
EventId m_beaconWatchdog
beacon watchdog
Definition: sta-wifi-mac.h:197
virtual ~StaWifiMac()
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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:198
bool m_activeProbing
active probing
Definition: sta-wifi-mac.h:200
EventId m_probeRequestEvent
probe request event
Definition: sta-wifi-mac.h:195
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:38
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:39