25 #include "ns3/simulator.h"
26 #include "ns3/string.h"
27 #include "ns3/pointer.h"
28 #include "ns3/boolean.h"
29 #include "ns3/trace-source-accessor.h"
69 .SetGroupName (
"Wifi")
71 .AddAttribute (
"ProbeRequestTimeout",
"The interval between two consecutive probe request attempts.",
75 .AddAttribute (
"AssocRequestTimeout",
"The interval between two consecutive assoc request attempts.",
79 .AddAttribute (
"MaxMissedBeacons",
80 "Number of beacons which much be consecutively missed before "
81 "we attempt to restart association.",
84 MakeUintegerChecker<uint32_t> ())
85 .AddAttribute (
"ActiveProbing",
86 "If true, we send probe requests. If false, we don't."
87 "NOTE: if more than one STA in your simulation is using active probing, "
88 "you should enable it at a different simulation time for each STA, "
89 "otherwise all the STAs will start sending probes at the same time resulting in collisions. "
90 "See bug 1060 for more info.",
94 .AddTraceSource (
"Assoc",
"Associated with an access point.",
96 "ns3::Mac48Address::TracedCallback")
97 .AddTraceSource (
"DeAssoc",
"Association with an access point lost.",
99 "ns3::Mac48Address::TracedCallback")
105 : m_state (BEACON_MISSED),
106 m_probeRequestEvent (),
107 m_assocRequestEvent (),
108 m_beaconWatchdogEnd (
Seconds (0.0))
200 m_dca->Queue (packet, hdr);
241 m_dca->Queue (packet, hdr);
421 m_dca->Queue (packet, hdr);
446 NS_LOG_LOGIC (
"Received data frame while not associated: ignore");
452 NS_LOG_LOGIC (
"Received data frame not from the DS: ignore");
458 NS_LOG_LOGIC (
"Received data frame not from the BSS we are associated with: ignore");
492 bool goodBeacon =
false;
684 uint64_t maxSupportedRate = 0;
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.
virtual uint32_t GetNumberOfTransmitAntennas(void) const =0
void SetTxMcsSetDefined(uint8_t txmcssetdefined)
TracedCallback< Mac48Address > m_deAssocLogger
void SetShortGuardIntervalFor80Mhz(uint8_t shortguardinterval)
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...
Simulation virtual time values and global simulation resolution.
bool IsSupportedTxMcs(uint8_t mcs) const
Time m_assocRequestTimeout
void AddSupportedMcs(Mac48Address address, WifiMode mcs)
Record the MCS index supported by the station.
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...
#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.
void SetGreenfield(uint8_t greenfield)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void SetTxMcsMap(uint16_t map)
void SetHtSupported(uint8_t htsupported)
virtual uint32_t GetNModes(void) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
void SetRxMcsBitmask(uint8_t index)
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
void SetProbeRequestTimeout(Time timeout)
void SetMaxMpduLength(uint8_t length)
EdcaQueues m_edca
This is a map from Access Category index to the corresponding channel access function.
enum WifiModulationClass GetModulationClass() const
virtual uint8_t GetNMcs(void) const =0
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
bool IsNull(void) const
Check for null implementation.
#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.
#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 NotifyRxDrop(Ptr< const Packet > packet)
virtual bool GetLdpc(void) const =0
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...
TracedCallback< Mac48Address > m_assocLogger
EventId m_assocRequestEvent
void SetVhtSupported(uint8_t vhtsupported)
Ptr< WifiPhy > m_phy
Wifi PHY.
void SetRxLdpc(uint8_t rxldpc)
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
virtual Ssid GetSsid(void) const
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...
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...
void SetShortGuardIntervalFor160Mhz(uint8_t shortguardinterval)
virtual WifiMode GetMcs(uint8_t mcs) const =0
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
uint8_t QosUtilsGetTidForPacket(Ptr< const Packet > packet)
If a qos tag is attached to the packet, returns a value < 8.
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.
virtual void SetBssid(Mac48Address bssid)
void SetLSigProtectionSupport(uint8_t lsigprotection)
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.
virtual uint32_t GetChannelWidth(void) const =0
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...
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.
void SetShortGuardInterval20(uint8_t shortguardinterval)
VhtCapabilities GetVhtCapabilities(void) const
Return the VHT capability of the current STA.
AttributeValue implementation for Time.
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.
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.
void SetMaxAmsduLength(uint8_t maxamsdulength)
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.
uint8_t GetMcsValue(void) const
static Mac48Address GetBroadcast(void)
void SetMaxAmpduLength(uint8_t maxampdulength)
bool IsSupportedMcs(uint8_t mcs)
virtual bool GetGuardInterval(void) const =0
Mac48Address GetAddress(void) const
Return the MAC address of this MacLow.
bool GetActiveProbing(void) const
Return whether active probing is enabled.
void SetState(enum MacState value)
Set the current MAC state.
virtual uint32_t GetNBssMembershipSelectors(void) const =0
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Ptr< MacLow > m_low
MacLow (RTS, CTS, DATA, ACK etc.)
void SetBasicRate(uint32_t bs)
Set the given rate to basic rates.
void SetSupportedChannelWidthSet(uint8_t channelwidthset)
HtCapabilities GetHtCapabilities(void) const
Return the HT capability of the current STA.
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.
void SetRxHighestSupportedDataRate(uint16_t maxsupportedrate)
uint32_t m_maxMissedBeacons
void StartActiveAssociation(void)
Start an active association sequence immediately.
void SetMaxMissedBeacons(uint32_t missed)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...
virtual uint32_t GetBssMembershipSelector(uint32_t selector) const =0
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Ptr< const AttributeChecker > MakeBooleanChecker(void)
static TypeId GetTypeId(void)
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
virtual WifiMode GetMode(uint32_t mode) const =0
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
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.
void AddSupportedPlcpPreamble(Mac48Address address, bool isShortPreambleSupported)
Record whether the short PLCP preamble is supported by the station.
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.
virtual Mac48Address GetBssid(void) const
virtual bool GetShortPlcpPreamble(void) const =0
void SetRxMcsMap(uint16_t map)
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
virtual 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.
virtual void Enqueue(Ptr< const Packet > packet, Mac48Address to)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
void SetLdpc(uint8_t ldpc)
bool IsSupportedRate(uint32_t bs) const
Check if the given rate is supported.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
void SetTxMaxNSpatialStreams(uint8_t maxtxspatialstreams)
EventId m_probeRequestEvent
Ptr< WifiRemoteStationManager > m_stationManager
Remote station manager (rate control, RTS/CTS/fragmentation thresholds etc.)
bool IsAssociated(void) const
Return whether we are associated with an AP.
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...
void SetShortGuardInterval40(uint8_t shortguardinterval)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual bool GetGreenfield(void) const =0
void AddHeader(const Header &header)
Add header to this packet.
void AddStationVhtCapabilities(Mac48Address from, VhtCapabilities vhtcapabilities)
Records VHT capabilities of the remote station.
void SetSupportedChannelWidth(uint8_t supportedchannelwidth)
The Wifi MAC high model for a non-AP STA in a BSS.
void SetMaxAmpduLengthExponent(uint8_t exponent)