25 #include "ns3/simulator.h"
55 .SetGroupName (
"Wifi")
57 .AddAttribute (
"ProbeRequestTimeout",
"The interval between two consecutive probe request attempts.",
61 .AddAttribute (
"AssocRequestTimeout",
"The interval between two consecutive assoc request attempts.",
65 .AddAttribute (
"MaxMissedBeacons",
66 "Number of beacons which much be consecutively missed before "
67 "we attempt to restart association.",
70 MakeUintegerChecker<uint32_t> ())
71 .AddAttribute (
"ActiveProbing",
72 "If true, we send probe requests. If false, we don't."
73 "NOTE: if more than one STA in your simulation is using active probing, "
74 "you should enable it at a different simulation time for each STA, "
75 "otherwise all the STAs will start sending probes at the same time resulting in collisions. "
76 "See bug 1060 for more info.",
80 .AddTraceSource (
"Assoc",
"Associated with an access point.",
82 "ns3::Mac48Address::TracedCallback")
83 .AddTraceSource (
"DeAssoc",
"Association with an access point lost.",
85 "ns3::Mac48Address::TracedCallback")
91 : m_state (BEACON_MISSED),
92 m_probeRequestEvent (),
93 m_assocRequestEvent (),
94 m_beaconWatchdogEnd (
Seconds (0))
190 m_dca->Queue (packet, hdr);
235 m_dca->Queue (packet, hdr);
415 m_dca->Queue (packet, hdr);
440 NS_LOG_LOGIC (
"Received data frame while not associated: ignore");
446 NS_LOG_LOGIC (
"Received data frame not from the DS: ignore");
452 NS_LOG_LOGIC (
"Received data frame not from the BSS we are associated with: ignore");
487 bool goodBeacon =
false;
495 bool bssMembershipSelectorMatch =
false;
501 NS_LOG_LOGIC (
"Beacon is matched to our BSS membership selector");
502 bssMembershipSelectorMatch =
true;
555 bool qosSupported =
false;
684 bool isErpAllowed =
false;
750 bool isErpAllowed =
false;
787 bool qosSupported =
false;
931 NS_LOG_DEBUG (
"Adding supported rate of " << modeDataRate);
static Time GetDelayLeft(const EventId &id)
Get the remaining time until this event will execute.
bool IsWaitAssocResp(void) const
Return whether we are waiting for an association response from an AP.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
TracedCallback< Mac48Address > m_deAssocLogger
deassoc logger
void AddSupportedRate(uint32_t bs)
Add the given rate to the supported rates.
SupportedRates GetSupportedRates(void) const
Return an instance of SupportedRates that contains all rates that we support including HT rates...
uint32_t GetNBssMembershipSelectors(void) const
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
Simulation virtual time values and global simulation resolution.
Time m_assocRequestTimeout
assoc request timeout
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
bool GetShortSlotTimeEnabled(void) const
Return whether the device uses short slot time.
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...
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
AttributeValue implementation for Boolean.
void SendAssociationRequest(void)
Forward an association request packet to the DCF.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
void SetState(MacState value)
Set the current MAC state.
void AssocRequestTimeout(void)
This method is called after the association timeout occurred.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Time m_probeRequestTimeout
probe request timeout
void SetProbeRequestTimeout(Time timeout)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
uint8_t GetViCWmax(void) const
Return the AC_VI CWmax field in the EdcaParameterSet information element.
uint8_t GetVoAifsn(void) const
Return the AC_VO AIFSN field in the EdcaParameterSet information element.
bool IsNull(void) const
Check for null implementation.
The VHT Operation Information ElementThis class knows how to serialise and deserialise the VHT Operat...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Callback< void > m_linkUp
Callback when a link is up.
void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
void SetSlot(Time slotTime)
void NotifyRxDrop(Ptr< const Packet > packet)
The HT Operation Information ElementThis class knows how to serialise and deserialise the HT Operatio...
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
virtual void DeaggregateAmsduAndForward(Ptr< Packet > aggregatedPacket, const WifiMacHeader *hdr)
This method can be called to de-aggregate an A-MSDU and forward the constituent packets up the stack...
uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
TracedCallback< Mac48Address > m_assocLogger
assoc logger
EventId m_assocRequestEvent
assoc request event
Ptr< WifiPhy > m_phy
Wifi PHY.
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
uint8_t GetVoCWmin(void) const
Return the AC_VO CWmin field in the EdcaParameterSet information element.
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capability of the device.
uint32_t GetBssMembershipSelector(uint32_t selector) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
void SetAssocRequestTimeout(Time timeout)
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...
HeCapabilities GetHeCapabilities(void) const
Return the HE capability of the device.
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a qos tag is attached to the packet, returns a value < 8.
uint8_t GetNonGfHtStasPresent(void) const
Return the non GF HT STAs present.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
uint16_t GetBeTXOPLimit(void) const
Return the AC_BE TXOP Limit field in the EdcaParameterSet information element.
uint8_t GetViCWmin(void) const
Return the AC_VI CWmin field in the EdcaParameterSet information element.
void SetShortSlotTimeEnabled(bool enable)
Enable or disable short slot time.
void SetBssid(Mac48Address bssid)
void SendProbeRequest(void)
Forward a probe request packet to the DCF.
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
base class for all MAC-level wifi objects.
void ProbeRequestTimeout(void)
This method is called after the probe request timeout occurred.
bool m_qosSupported
This Boolean is set true iff this WifiMac is to model 802.11e/WMM style Quality of Service...
uint8_t IsQosSupported(void) const
Is QOS supported function.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
uint16_t GetBkTXOPLimit(void) const
Return the AC_BK TXOP Limit field in the EdcaParameterSet information element.
AttributeValue implementation for Time.
uint8_t GetBeCWmin(void) const
Return the AC_BE CWmin field in the EdcaParameterSet information element.
MacState
The current MAC state of the STA.
Ptr< DcaTxop > m_dca
This holds a pointer to the DCF instance for this WifiMac - used for transmission of frames to non-Qo...
The IEEE 802.11ac VHT Capabilities.
MacState m_state
MAC state.
void NotifyTxDrop(Ptr< const Packet > packet)
Hold an unsigned integer type.
void MissedBeacons(void)
This method is called after we have not received a beacon from the AP.
uint64_t GetDataRate(uint8_t channelWidth, uint16_t guardInterval, uint8_t nss) const
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htcapabilities)
Records HT capabilities of the remote station.
bool m_vhtSupported
This Boolean is set true iff this WifiMac is to model 802.11ac.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
uint16_t GetVoTXOPLimit(void) const
Return the AC_VO TXOP Limit field in the EdcaParameterSet information element.
uint8_t GetMcsValue(void) const
static Mac48Address GetBroadcast(void)
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
uint8_t GetVoCWmax(void) const
Return the AC_VO CWmax field in the EdcaParameterSet information element.
bool GetActiveProbing(void) const
Return whether active probing is enabled.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities hecapabilities)
Records HE capabilities of the remote station.
uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
bool m_heSupported
This Boolean is set true iff this WifiMac is to model 802.11ax.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the device.
void SetQosSupport(Mac48Address from, bool qosSupported)
Records QoS support of the remote station.
Callback< void > m_linkDown
Callback when a link is down.
bool IsBasicRate(uint32_t bs) const
Check if the given rate is a basic rate.
uint32_t m_maxMissedBeacons
maximum missed beacons
void SetAifsn(uint32_t aifsn)
Set the number of slots that make up an AIFS.
void StartActiveAssociation(void)
Start an active association sequence immediately.
uint8_t GetRifsMode(void) const
Return the RIFS mode.
WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
void SetMaxMissedBeacons(uint32_t missed)
EventId m_beaconWatchdog
beacon watchdog
void AddBssMembershipSelectorRate(uint32_t bs)
Add a special value to the supported rate set, corresponding to a BSS membership selector.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t GetBeCWmax(void) const
Return the AC_BE CWmax field in the EdcaParameterSet information element.
The EDCA Parameter SetThis class knows how to serialise and deserialise the EDCA Parameter Set...
uint8_t GetBkCWmax(void) const
Return the AC_BK CWmax field in the EdcaParameterSet information element.
void AddSupportedMode(Mac48Address address, WifiMode mode)
Invoked in a STA or AP to store the set of modes supported by a destination which is also supported l...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
bool IsSupportedMcs(uint8_t mcs) const
Return the is MCS supported flag.
static TypeId GetTypeId(void)
Get the type ID.
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
void SetUseNonErpProtection(bool enable)
Enable or disable protection for non-ERP stations.
uint8_t GetBkCWmin(void) const
Return the AC_BK CWmin field in the EdcaParameterSet information element.
uint16_t GetViTXOPLimit(void) const
Return the AC_VI TXOP Limit field in the EdcaParameterSet information element.
uint8_t GetViAifsn(void) const
Return the AC_VI AIFSN field in the EdcaParameterSet information element.
void RestartBeaconWatchdog(Time delay)
Restarts the beacon timer.
CapabilityInformation GetCapabilities(void) const
Return the Capability information of the current STA.
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
void TryToEnsureAssociated(void)
Try to ensure that we are associated with an AP by taking an appropriate action depending on the curr...
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static Time Now(void)
Return the current simulation virtual time.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
bool m_htSupported
This Boolean is set true iff this WifiMac is to model 802.11n.
void SetActiveProbing(bool enable)
Enable or disable active probing.
Mac48Address GetBssid(void) const
uint8_t GetChannelWidth(void) const
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
void SetTxopLimit(Time txopLimit)
Set the TXOP limit.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Mac48Address GetAddress(void) const
Time Seconds(double value)
Construct a Time in the indicated unit.
bool IsSuccess(void) const
Return whether the status code is success.
bool IsSupportedRxMcs(uint8_t mcs) const
Is reeive MCS supported.
void Enqueue(Ptr< const Packet > packet, Mac48Address to)
void SetUseGreenfieldProtection(bool enable)
Enable or disable protection for stations that do not support HT greenfield format.
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
uint8_t GetBeAifsn(void) const
Return the AC_BE AIFSN field in the EdcaParameterSet information element.
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
uint8_t GetBkAifsn(void) const
Return the AC_BK AIFSN field in the EdcaParameterSet information element.
bool IsSupportedRxMcs(uint8_t mcs) const
Get the is receive MCS supported.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
bool GetShortSlotTimeSupported(void) const
Time m_beaconWatchdogEnd
beacon watchdog end
bool m_erpSupported
This Boolean is set true iff this WifiMac is to model 802.11g.
bool GetRifsSupported(void) const
bool m_activeProbing
active probing
WifiModulationClass GetModulationClass() const
EventId m_probeRequestEvent
probe request event
void SetShortPreambleEnabled(bool enable)
Enable or disable short PLCP preambles.
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
uint16_t GetRxHighestSupportedLgiDataRate() const
Get the receive highest supported LGI data rate.
bool GetShortPlcpPreambleSupported(void) const
Return whether short PLCP preamble is supported.
bool IsAssociated(void) const
Return whether we are associated with an AP.
The IEEE 802.11ax HE Capabilities.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
void SetEdcaParameters(AcIndex ac, uint8_t cwMin, uint8_t cwMax, uint8_t aifsn, Time txopLimit)
Set the EDCA parameters.
void RemoveAllSupportedMcs(Mac48Address address)
Invoked in a STA or AP to delete all of the suppported MCS by a destination.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
void SetRifsPermitted(bool allow)
Permit or prohibit RIFS.
void AddHeader(const Header &header)
Add header to this packet.
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtcapabilities)
Records VHT capabilities of the remote station.
WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
bool IsBssMembershipSelectorRate(uint32_t bs) const
Check if the given rate is a BSS membership selector value.
The Wifi MAC high model for a non-AP STA in a BSS.