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 "wifi-mac.h"
27#include "mgt-headers.h"
28
32
33namespace ns3 {
34
35class SupportedRates;
36class CapabilityInformation;
37
44struct ApInfo
45{
48 double m_snr;
52};
53
106class StaWifiMac : public WifiMac
107{
108public:
110 friend class ::TwoLevelAggregationTest;
112 friend class ::AmpduAggregationTest;
114 friend class ::HeAggregationTest;
119 static TypeId GetTypeId (void);
120
121 StaWifiMac ();
122 virtual ~StaWifiMac ();
123
132 void Enqueue (Ptr<Packet> packet, Mac48Address to) override;
133 bool CanForwardPacketsTo (Mac48Address to) const override;
134
138 void SetWifiPhy (const Ptr<WifiPhy> phy) override;
139
145 bool IsAssociated (void) const;
146
152 uint16_t GetAssociationId (void) const;
153
154 void NotifyChannelSwitching (void) override;
155
156private:
161 {
167 REFUSED
168 };
169
175 void SetActiveProbing (bool enable);
181 bool GetActiveProbing (void) const;
182
188 void Receive (Ptr<WifiMacQueueItem> mpdu) override;
220 void UpdateCandidateApList (ApInfo newApInfo);
221
226 void SendProbeRequest (void);
235 void SendAssociationRequest (bool isReassoc);
240 void TryToEnsureAssociated (void);
245 void AssocRequestTimeout (void);
250 void StartScanning (void);
256 void ScanningTimeout (void);
262 bool IsWaitAssocResp (void) const;
266 void MissedBeacons (void);
272 void RestartBeaconWatchdog (Time delay);
276 void Disassociated (void);
289 void SetState (MacState value);
299 void SetEdcaParameters (AcIndex ac, uint32_t cwMin, uint32_t cwMax, uint8_t aifsn, Time txopLimit);
309 void SetMuEdcaParameters (AcIndex ac, uint16_t cwMin, uint16_t cwMax, uint8_t aifsn, Time muEdcaTimer);
316
320 void PhyCapabilitiesChanged (void);
321
322 void DoInitialize (void) override;
323
325 uint16_t m_aid;
336 std::vector<ApInfo> m_candidateAps;
337 // Note: std::multiset<ApInfo> might be a candidate container to implement
338 // this sorted list, but we are using a std::vector because we want to sort
339 // based on SNR but find duplicates based on BSSID, and in practice this
340 // candidate vector should not be too large.
341
345};
346
347} //namespace ns3
348
349#endif /* STA_WIFI_MAC_H */
Ampdu Aggregation Test.
802.11ax aggregation test which permits 64 or 256 MPDUs in A-MPDU according to the negociated buffer ...
Two Level Aggregation Test.
An identifier for simulation events.
Definition: event-id.h:54
an EUI-48 address
Definition: mac48-address.h:44
Implement the header for management frames of type association and reassociation response.
Definition: mgt-headers.h:320
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:862
Implement the header for management frames of type probe response.
Definition: mgt-headers.h:633
The Wifi MAC high model for a non-AP STA in a BSS.
Definition: sta-wifi-mac.h:107
Time m_waitBeaconTimeout
wait beacon timeout
Definition: sta-wifi-mac.h:326
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current STA.
void ScanningTimeout(void)
This method is called after wait beacon timeout or wait probe request timeout has occurred.
bool m_activeProbing
active probing
Definition: sta-wifi-mac.h:335
virtual ~StaWifiMac()
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
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.
Time m_beaconWatchdogEnd
beacon watchdog end
Definition: sta-wifi-mac.h:333
void UpdateApInfoFromProbeResp(MgtProbeResponseHeader probeResp, Mac48Address apAddr, Mac48Address bssid)
Update AP's information from probe response.
TracedCallback< Mac48Address > m_deAssocLogger
disassociation logger
Definition: sta-wifi-mac.h:343
void NotifyChannelSwitching(void) override
Notify that channel has been switched.
void SendProbeRequest(void)
Forward a probe request packet to the DCF.
void UpdateApInfoFromBeacon(MgtBeaconHeader beacon, Mac48Address apAddr, Mac48Address bssid)
Update associated AP's information from beacon.
MacState
The current MAC state of the STA.
Definition: sta-wifi-mac.h:161
EventId m_beaconWatchdog
beacon watchdog
Definition: sta-wifi-mac.h:332
uint16_t GetAssociationId(void) const
Return the association ID.
void UpdateCandidateApList(ApInfo newApInfo)
Update list of candidate AP to associate.
void UpdateApInfoFromAssocResp(MgtAssocResponseHeader assocResp, Mac48Address apAddr)
Update AP's information from association response.
bool IsWaitAssocResp(void) const
Return whether we are waiting for an association response from an AP.
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates.
void TryToEnsureAssociated(void)
Try to ensure that we are associated with an AP by taking an appropriate action depending on the curr...
bool IsAssociated(void) const
Return whether we are associated with an AP.
void Disassociated(void)
Take actions after disassociation.
uint32_t m_maxMissedBeacons
maximum missed beacons
Definition: sta-wifi-mac.h:334
EventId m_waitBeaconEvent
wait beacon event
Definition: sta-wifi-mac.h:329
TracedCallback< Mac48Address > m_assocLogger
association logger
Definition: sta-wifi-mac.h:342
void AssocRequestTimeout(void)
This method is called after the association timeout occurred.
void Receive(Ptr< WifiMacQueueItem > mpdu) override
Handle a received packet.
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
void MissedBeacons(void)
This method is called after we have not received a beacon from the AP.
EventId m_probeRequestEvent
probe request event
Definition: sta-wifi-mac.h:330
static TypeId GetTypeId(void)
Get the type ID.
Definition: sta-wifi-mac.cc:42
void StartScanning(void)
Start the scanning process which trigger active or passive scanning based on the active probing flag.
uint16_t m_aid
Association AID.
Definition: sta-wifi-mac.h:325
MacState m_state
MAC state.
Definition: sta-wifi-mac.h:324
void Enqueue(Ptr< Packet > packet, Mac48Address to) override
void SetMuEdcaParameters(AcIndex ac, uint16_t cwMin, uint16_t cwMax, uint8_t aifsn, Time muEdcaTimer)
Set the MU EDCA parameters.
void SetWifiPhy(const Ptr< WifiPhy > phy) override
void PhyCapabilitiesChanged(void)
Indicate that PHY capabilities have changed.
TracedCallback< Time > m_beaconArrival
beacon arrival logger
Definition: sta-wifi-mac.h:344
Time m_assocRequestTimeout
association request timeout
Definition: sta-wifi-mac.h:328
void DoInitialize(void) override
Initialize() implementation.
Time m_probeRequestTimeout
probe request timeout
Definition: sta-wifi-mac.h:327
void SetActiveProbing(bool enable)
Enable or disable active probing.
std::vector< ApInfo > m_candidateAps
list of candidate APs to associate to
Definition: sta-wifi-mac.h:336
EventId m_assocRequestEvent
association request event
Definition: sta-wifi-mac.h:331
bool GetActiveProbing(void) const
Return whether active probing is enabled.
void SendAssociationRequest(bool isReassoc)
Forward an association or reassociation request packet to the DCF.
The Supported Rates Information Element.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:85
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:93
Struct to hold information regarding observed AP through active/passive scanning.
Definition: sta-wifi-mac.h:45
double m_snr
SNR in linear scale.
Definition: sta-wifi-mac.h:48
Mac48Address m_bssid
BSSID.
Definition: sta-wifi-mac.h:46
MgtProbeResponseHeader m_probeResp
Probe Response header.
Definition: sta-wifi-mac.h:51
Mac48Address m_apAddr
AP MAC address.
Definition: sta-wifi-mac.h:47
MgtBeaconHeader m_beacon
Beacon header.
Definition: sta-wifi-mac.h:50
bool m_activeProbing
Flag whether active probing is used or not.
Definition: sta-wifi-mac.h:49