A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
mesh-wifi-interface-mac.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 IITP RAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Kirill Andreev <andreev@iitp.ru>
18 * Pavel Boyko <boyko@iitp.ru>
19 */
20
21#include "ns3/mesh-wifi-interface-mac.h"
22
23#include "ns3/boolean.h"
24#include "ns3/channel-access-manager.h"
25#include "ns3/double.h"
26#include "ns3/log.h"
27#include "ns3/mac-tx-middle.h"
28#include "ns3/mesh-wifi-beacon.h"
29#include "ns3/pointer.h"
30#include "ns3/qos-txop.h"
31#include "ns3/random-variable-stream.h"
32#include "ns3/simulator.h"
33#include "ns3/socket.h"
34#include "ns3/trace-source-accessor.h"
35#include "ns3/wifi-mac-queue-scheduler.h"
36#include "ns3/wifi-mac-queue.h"
37#include "ns3/wifi-net-device.h"
38#include "ns3/wifi-utils.h"
39#include "ns3/yans-wifi-phy.h"
40
41namespace ns3
42{
43
44NS_LOG_COMPONENT_DEFINE("MeshWifiInterfaceMac");
45
46NS_OBJECT_ENSURE_REGISTERED(MeshWifiInterfaceMac);
47
48TypeId
50{
51 static TypeId tid =
52 TypeId("ns3::MeshWifiInterfaceMac")
54 .SetGroupName("Mesh")
55 .AddConstructor<MeshWifiInterfaceMac>()
56 .AddAttribute("BeaconInterval",
57 "Beacon Interval",
58 TimeValue(Seconds(0.5)),
59
62 .AddAttribute("RandomStart",
63 "Window when beacon generating starts (uniform random) in seconds",
64 TimeValue(Seconds(0.5)),
67 .AddAttribute("BeaconGeneration",
68 "Enable/Disable Beaconing.",
69 BooleanValue(true),
73 return tid;
74}
75
77 : m_standard(WIFI_STANDARD_80211a)
78{
79 NS_LOG_FUNCTION(this);
80
81 // Let the lower layers know that we are acting as a mesh node
83 m_coefficient = CreateObject<UniformRandomVariable>();
84}
85
87{
88 NS_LOG_FUNCTION(this);
89}
90
91//-----------------------------------------------------------------------------
92// WifiMac inherited
93//-----------------------------------------------------------------------------
94bool
96{
97 return true;
98}
99
100void
102{
103 NS_LOG_FUNCTION(this << packet << to << from);
104 ForwardDown(packet, from, to);
105}
106
107void
109{
110 NS_LOG_FUNCTION(this << packet << to);
111 ForwardDown(packet, GetAddress(), to);
112}
113
114bool
116{
117 return true;
118}
119
120void
122{
123 NS_LOG_FUNCTION(this);
125
126 // The approach taken here is that, from the point of view of a mesh
127 // node, the link is always up, so we immediately invoke the
128 // callback if one is set
129 linkUp();
130}
131
132void
134{
135 NS_LOG_FUNCTION(this);
136 m_plugins.clear();
138
140}
141
142void
144{
145 NS_LOG_FUNCTION(this);
147 if (m_beaconEnable)
148 {
149 Time randomStart = Seconds(m_coefficient->GetValue());
150 // Now start sending beacons after some random delay (to avoid collisions)
154 m_tbtt = Simulator::Now() + randomStart;
155 }
156 else
157 {
158 // stop sending beacons
160 }
161}
162
163int64_t
165{
166 NS_LOG_FUNCTION(this << stream);
167 int64_t currentStream = stream;
168 m_coefficient->SetStream(currentStream++);
169 for (PluginList::const_iterator i = m_plugins.begin(); i < m_plugins.end(); i++)
170 {
171 currentStream += (*i)->AssignStreams(currentStream);
172 }
173 return (currentStream - stream);
174}
175
176//-----------------------------------------------------------------------------
177// Plugins
178//-----------------------------------------------------------------------------
179void
181{
182 NS_LOG_FUNCTION(this);
183
184 plugin->SetParent(this);
185 m_plugins.push_back(plugin);
186}
187
188//-----------------------------------------------------------------------------
189// Switch channels
190//-----------------------------------------------------------------------------
191uint16_t
193{
194 NS_LOG_FUNCTION(this);
195 NS_ASSERT(GetWifiPhy()); // need PHY to set/get channel
196 return GetWifiPhy()->GetChannelNumber();
197}
198
199void
201{
202 NS_LOG_FUNCTION(this);
203 NS_ASSERT(GetWifiPhy()); // need PHY to set/get channel
216 WifiPhy::ChannelTuple{new_id, 0, GetWifiPhy()->GetPhyBand(), 0});
217 // Don't know NAV on new channel
219}
220
221//-----------------------------------------------------------------------------
222// Forward frame down
223//-----------------------------------------------------------------------------
224void
226{
227 WifiMacHeader hdr;
229 hdr.SetAddr2(GetAddress());
230 hdr.SetAddr3(to);
231 hdr.SetAddr4(from);
232 hdr.SetDsFrom();
233 hdr.SetDsTo();
234 // Fill QoS fields:
236 hdr.SetQosNoEosp();
237 hdr.SetQosNoAmsdu();
238 hdr.SetQosTxopLimit(0);
239 // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
240 hdr.SetAddr1(Mac48Address());
241 // Filter packet through all installed plugins
242 for (PluginList::const_iterator i = m_plugins.end() - 1; i != m_plugins.begin() - 1; i--)
243 {
244 bool drop = !((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
245 if (drop)
246 {
247 return; // plugin drops frame
248 }
249 }
250 // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
251 NS_ASSERT(hdr.GetAddr1() != Mac48Address());
252 // Queue frame
253 if (GetWifiRemoteStationManager()->IsBrandNew(hdr.GetAddr1()))
254 {
255 // in adhoc mode, we assume that every destination
256 // supports all the rates we support.
257 for (const auto& mode : GetWifiPhy()->GetModeList())
258 {
260 }
262 }
263 // Classify: application may have set a tag, which is removed here
264 AcIndex ac;
266 if (packet->RemovePacketTag(tag))
267 {
268 hdr.SetQosTid(tag.GetPriority());
270 }
271 else
272 {
273 // No tag found; set to best effort
274 ac = AC_BE;
275 hdr.SetQosTid(0);
276 }
278 m_stats.sentBytes += packet->GetSize();
279 NS_ASSERT(GetQosTxop(ac) != nullptr);
280 GetQosTxop(ac)->Queue(packet, hdr);
281}
282
283void
285{
286 // Filter management frames:
287 WifiMacHeader header = hdr;
288 for (PluginList::const_iterator i = m_plugins.end() - 1; i != m_plugins.begin() - 1; i--)
289 {
290 bool drop = !((*i)->UpdateOutcomingFrame(packet, header, Mac48Address(), Mac48Address()));
291 if (drop)
292 {
293 return; // plugin drops frame
294 }
295 }
297 m_stats.sentBytes += packet->GetSize();
298 if ((GetQosTxop(AC_VO) == nullptr) || (GetQosTxop(AC_BK) == nullptr))
299 {
300 NS_FATAL_ERROR("Voice or Background queue is not set up!");
301 }
302 /*
303 * When we send a management frame - it is better to enqueue it to
304 * priority queue. But when we send a broadcast management frame,
305 * like PREQ, little MinCw value may cause collisions during
306 * retransmissions (two neighbor stations may choose the same window
307 * size, and two packets will be collided). So, broadcast management
308 * frames go to BK queue.
309 */
311 {
312 GetQosTxop(AC_VO)->Queue(packet, header);
313 }
314 else
315 {
316 GetQosTxop(AC_BK)->Queue(packet, header);
317 }
318}
319
322{
323 // set the set of supported rates and make sure that we indicate
324 // the Basic Rate set in this set of supported rates.
325 AllSupportedRates rates;
326 for (const auto& mode : GetWifiPhy()->GetModeList())
327 {
329 rates.AddSupportedRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1));
330 }
331 // set the basic rates
332 for (uint32_t j = 0; j < GetWifiRemoteStationManager()->GetNBasicModes(); j++)
333 {
336 rates.SetBasicRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1));
337 }
338 return rates;
339}
340
341bool
343{
344 for (uint32_t i = 0; i < GetWifiRemoteStationManager()->GetNBasicModes(); i++)
345 {
348 if (!rates.IsSupportedRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1)))
349 {
350 return false;
351 }
352 }
353 return true;
354}
355
356//-----------------------------------------------------------------------------
357// Beacons
358//-----------------------------------------------------------------------------
359void
361{
362 NS_LOG_FUNCTION(this << interval);
363 m_randomStart = interval;
364}
365
366void
368{
369 NS_LOG_FUNCTION(this << interval);
370 m_beaconInterval = interval;
371}
372
373Time
375{
376 return m_beaconInterval;
377}
378
379void
381{
382 NS_LOG_FUNCTION(this << enable);
383 m_beaconEnable = enable;
384}
385
386bool
388{
390}
391
392Time
394{
395 return m_tbtt;
396}
397
398void
400{
401 // User of ShiftTbtt () must take care don't shift it to the past
402 NS_ASSERT(GetTbtt() + shift > Simulator::Now());
403
404 m_tbtt += shift;
405 // Shift scheduled event
409}
410
411void
413{
417}
418
419void
421{
422 NS_LOG_FUNCTION(this);
423 NS_LOG_DEBUG(GetAddress() << " is sending beacon");
424
426
427 // Form & send beacon
429
430 // Ask all plugins to add their specific information elements to beacon
431 for (PluginList::const_iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
432 {
433 (*i)->UpdateBeacon(beacon);
434 }
436
438}
439
440void
442{
443 const WifiMacHeader* hdr = &mpdu->GetHeader();
444 Ptr<Packet> packet = mpdu->GetPacket()->Copy();
445 // Process beacon
446 if ((hdr->GetAddr1() != GetAddress()) && (hdr->GetAddr1() != Mac48Address::GetBroadcast()))
447 {
448 return;
449 }
450 if (hdr->IsBeacon())
451 {
453 MgtBeaconHeader beacon_hdr;
454
455 packet->PeekHeader(beacon_hdr);
456
457 NS_LOG_DEBUG("Beacon received from " << hdr->GetAddr2() << " I am " << GetAddress()
458 << " at " << Simulator::Now().GetMicroSeconds()
459 << " microseconds");
460
461 // update supported rates
462 if (beacon_hdr.Get<Ssid>()->IsEqual(GetSsid()))
463 {
464 NS_ASSERT(beacon_hdr.Get<SupportedRates>());
465 auto rates = AllSupportedRates{*beacon_hdr.Get<SupportedRates>(),
466 beacon_hdr.Get<ExtendedSupportedRatesIE>()};
467
468 for (const auto& mode : GetWifiPhy()->GetModeList())
469 {
471 uint64_t rate = mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1);
472 if (rates.IsSupportedRate(rate))
473 {
475 if (rates.IsBasicRate(rate))
476 {
478 }
479 }
480 }
481 }
482 }
483 else
484 {
485 m_stats.recvBytes += packet->GetSize();
487 }
488 // Filter frame through all installed plugins
489 for (PluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
490 {
491 bool drop = !((*i)->Receive(packet, *hdr));
492 if (drop)
493 {
494 return; // plugin drops frame
495 }
496 }
497 // Check if QoS tag exists and add it:
498 if (hdr->IsQosData())
499 {
500 SocketPriorityTag priorityTag;
501 priorityTag.SetPriority(hdr->GetQosTid());
502 packet->ReplacePacketTag(priorityTag);
503 }
504 // Forward data up
505 if (hdr->IsData())
506 {
507 ForwardUp(packet, hdr->GetAddr4(), hdr->GetAddr3());
508 }
509
510 // We don't bother invoking WifiMac::Receive() here, because
511 // we've explicitly handled all the frames we care about. This is in
512 // contrast to most classes which derive from WifiMac.
513}
514
517{
518 uint32_t metric = 1;
519 if (!m_linkMetricCallback.IsNull())
520 {
521 metric = m_linkMetricCallback(peerAddress, this);
522 }
523 return metric;
524}
525
526void
529{
531}
532
533void
535{
536 m_mpAddress = a;
537}
538
541{
542 return m_mpAddress;
543}
544
545// Statistics:
547 : recvBeacons(0),
548 sentFrames(0),
549 sentBytes(0),
550 recvFrames(0),
551 recvBytes(0)
552{
553}
554
555void
557{
558 os << "<Statistics "
560 "rxBeacons=\""
561 << recvBeacons
562 << "\" "
563 "txFrames=\""
564 << sentFrames
565 << "\" "
566 "txBytes=\""
567 << sentBytes
568 << "\" "
569 "rxFrames=\""
570 << recvFrames
571 << "\" "
572 "rxBytes=\""
573 << recvBytes << "\"/>" << std::endl;
574}
575
576void
577MeshWifiInterfaceMac::Report(std::ostream& os) const
578{
579 os << "<Interface "
580 "BeaconInterval=\""
582 << "\" "
583 "Channel=\""
585 << "\" "
586 "Address = \""
587 << GetAddress() << "\">" << std::endl;
588 m_stats.Print(os);
589 os << "</Interface>" << std::endl;
590}
591
592void
594{
596}
597
598void
600{
603 m_standard = standard;
604}
605
606void
608{
610 // We use the single DCF provided by WifiMac for the purpose of
611 // Beacon transmission. For this we need to reconfigure the channel
612 // access parameters slightly, and do so here.
613 m_txop = CreateObject<Txop>();
614 m_txop->SetWifiMac(this);
617 m_txop->SetMinCw(0);
618 m_txop->SetMaxCw(0);
619 m_txop->SetAifsn(1);
620 m_scheduler->SetWifiMac(this);
621}
622} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Callback template class.
Definition: callback.h:438
void NotifyNavResetNow(Time duration)
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:42
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:76
The Extended Supported Rates Information Element.
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address GetBroadcast()
Beacon is beacon header + list of arbitrary information elements.
WifiMacHeader CreateHeader(Mac48Address address, Mac48Address mpAddress)
Create Wifi header for beacon frame.
Ptr< Packet > CreatePacket()
Create frame = { beacon header + all information elements sorted by ElementId () }.
Basic MAC of mesh point Wi-Fi interface.
bool SupportsSendFrom() const override
void ForwardDown(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Send frame.
Time m_beaconInterval
Beaconing interval.
void SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
Set the link metric callback.
Mac48Address m_mpAddress
Mesh point address.
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
void SwitchFrequencyChannel(uint16_t new_id)
Switch frequency channel.
void ShiftTbtt(Time shift)
Shift TBTT.
Time GetTbtt() const
Next beacon frame time.
void SetRandomStartDelay(Time interval)
Set maximum initial random delay before first beacon.
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
void ResetStats()
Reset statistics function.
void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax) override
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > m_linkMetricCallback
linkMetricCallback
EventId m_beaconSendEvent
"Timer" for the next beacon
void InstallPlugin(Ptr< MeshWifiInterfaceMacPlugin > plugin)
Install plugin.
WifiStandard m_standard
Current standard: needed to configure metric.
void ScheduleNextBeacon()
Schedule next beacon.
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
uint16_t GetFrequencyChannel() const
Current channel Id.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
void DoInitialize() override
Initialize() implementation.
bool GetBeaconGeneration() const
Get current beaconing status.
AllSupportedRates GetSupportedRates() const
Get supported rates.
void SetMeshPointAddress(Mac48Address addr)
Set the mesh point address.
void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from) override
Mac48Address GetMeshPointAddress() const
Get the mesh point address.
void Report(std::ostream &os) const
Report statistics.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Time GetBeaconInterval() const
Get beacon interval.
bool m_beaconEnable
Beaconing interval.
void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId) override
Frame receive handler.
void SetLinkUpCallback(Callback< void > linkUp) override
Time m_randomStart
Maximum delay before first beacon.
static TypeId GetTypeId()
Get the type ID.
PluginList m_plugins
List of all installed plugins.
void ConfigureStandard(WifiStandard standard) override
Finish configuration based on the WifiStandard being provided.
bool CheckSupportedRates(AllSupportedRates rates) const
Check supported rates.
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
Time m_tbtt
Time for the next frame.
void DoDispose() override
Real d-tor.
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:516
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:200
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition: simulator.cc:276
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
indicates whether the socket has a priority set.
Definition: socket.h:1316
uint8_t GetPriority() const
Get the tag's priority.
Definition: socket.cc:858
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:852
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
Definition: ssid.cc:61
The Supported Rates Information Element.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:412
AttributeValue implementation for Time.
Definition: nstime.h:1423
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:252
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:191
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:184
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:349
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:223
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:501
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
Implements the IEEE 802.11 MAC header.
uint8_t GetQosTid() const
Return the Traffic ID of a QoS header.
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS Ack policy in the QoS control field.
Mac48Address GetAddr3() const
Return the address in the Address 3 field.
Mac48Address GetAddr4() const
Return the address in the Address 4 field.
bool IsBeacon() const
Return true if the header is a Beacon header.
Mac48Address GetAddr1() const
Return the address in the Address 1 field.
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
void SetQosNoAmsdu()
Set that A-MSDU is not present.
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
void SetAddr4(Mac48Address address)
Fill the Address 4 field with the given address.
Mac48Address GetAddr2() const
Return the address in the Address 2 field.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
bool IsData() const
Return true if the Type is DATA.
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
void SetDsFrom()
Set the From DS bit in the Frame Control field.
void SetDsTo()
Set the To DS bit in the Frame Control field.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
bool IsQosData() const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:94
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:1030
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Definition: wifi-mac.h:786
Ptr< WifiMacQueueScheduler > m_scheduler
wifi MAC queue scheduler
Definition: wifi-mac.h:787
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:748
Ssid GetSsid() const
Definition: wifi-mac.cc:463
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:418
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
Definition: wifi-mac.cc:978
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:785
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:437
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: wifi-mac.cc:1099
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Definition: wifi-mac.cc:910
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:1216
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
Definition: wifi-mac.cc:646
Mac48Address GetAddress() const
Definition: wifi-mac.cc:450
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: wifi-mac.cc:922
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:497
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:376
represent a single transmission mode
Definition: wifi-mode.h:51
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
void SetOperatingChannel(const ChannelTuple &channelTuple)
If the standard for this object has not been set yet, store the given channel settings.
Definition: wifi-phy.cc:1082
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1005
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1029
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:872
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1912
void AddBasicMode(WifiMode mode)
Invoked in a STA upon association to store the set of rates which belong to the BSSBasicRateSet of th...
uint8_t GetNBasicModes() const
Return the number of basic modes we support.
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...
WifiMode GetBasicMode(uint8_t i) const
Return a basic mode from the set of basic modes.
void RecordDisassociated(Mac48Address address)
Records that the STA was disassociated.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1444
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1424
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
AcIndex QosUtilsMapTidToAc(uint8_t tid)
Maps TID (Traffic ID) to Access classes.
Definition: qos-utils.cc:134
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:72
@ MESH
Definition: wifi-mac.h:66
@ WIFI_STANDARD_80211a
@ AC_BE
Best Effort.
Definition: qos-utils.h:74
@ AC_VO
Voice.
Definition: qos-utils.h:80
@ AC_BK
Background.
Definition: qos-utils.h:76
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
Definition: wifi-utils.h:140
@ WIFI_MAC_QOSDATA
uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr< WifiNetDevice > device)
Convert the guard interval to nanoseconds based on the WifiMode.
Struct containing all supported rates.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
bool IsSupportedRate(uint64_t bs) const
Check if the given rate is supported.
void Print(std::ostream &os) const
Print statistics.