A Discrete-Event Network Simulator
API
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 SupportedRates 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.GetSsid().IsEqual(GetSsid()))
463 {
464 SupportedRates rates = beacon_hdr.GetSupportedRates();
465
466 for (const auto& mode : GetWifiPhy()->GetModeList())
467 {
469 uint64_t rate = mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1);
470 if (rates.IsSupportedRate(rate))
471 {
473 if (rates.IsBasicRate(rate))
474 {
476 }
477 }
478 }
479 }
480 }
481 else
482 {
483 m_stats.recvBytes += packet->GetSize();
485 }
486 // Filter frame through all installed plugins
487 for (PluginList::iterator i = m_plugins.begin(); i != m_plugins.end(); ++i)
488 {
489 bool drop = !((*i)->Receive(packet, *hdr));
490 if (drop)
491 {
492 return; // plugin drops frame
493 }
494 }
495 // Check if QoS tag exists and add it:
496 if (hdr->IsQosData())
497 {
498 SocketPriorityTag priorityTag;
499 priorityTag.SetPriority(hdr->GetQosTid());
500 packet->ReplacePacketTag(priorityTag);
501 }
502 // Forward data up
503 if (hdr->IsData())
504 {
505 ForwardUp(packet, hdr->GetAddr4(), hdr->GetAddr3());
506 }
507
508 // We don't bother invoking WifiMac::Receive() here, because
509 // we've explicitly handled all the frames we care about. This is in
510 // contrast to most classes which derive from WifiMac.
511}
512
515{
516 uint32_t metric = 1;
517 if (!m_linkMetricCallback.IsNull())
518 {
519 metric = m_linkMetricCallback(peerAddress, this);
520 }
521 return metric;
522}
523
524void
527{
529}
530
531void
533{
534 m_mpAddress = a;
535}
536
539{
540 return m_mpAddress;
541}
542
543// Statistics:
545 : recvBeacons(0),
546 sentFrames(0),
547 sentBytes(0),
548 recvFrames(0),
549 recvBytes(0)
550{
551}
552
553void
555{
556 os << "<Statistics "
558 "rxBeacons=\""
559 << recvBeacons
560 << "\" "
561 "txFrames=\""
562 << sentFrames
563 << "\" "
564 "txBytes=\""
565 << sentBytes
566 << "\" "
567 "rxFrames=\""
568 << recvFrames
569 << "\" "
570 "rxBytes=\""
571 << recvBytes << "\"/>" << std::endl;
572}
573
574void
575MeshWifiInterfaceMac::Report(std::ostream& os) const
576{
577 os << "<Interface "
578 "BeaconInterval=\""
580 << "\" "
581 "Channel=\""
583 << "\" "
584 "Address = \""
585 << GetAddress() << "\">" << std::endl;
586 m_stats.Print(os);
587 os << "</Interface>" << std::endl;
588}
589
590void
592{
594}
595
596void
598{
601 m_standard = standard;
602}
603
604void
606{
608 // We use the single DCF provided by WifiMac for the purpose of
609 // Beacon transmission. For this we need to reconfigure the channel
610 // access parameters slightly, and do so here.
611 m_txop = CreateObject<Txop>();
612 m_txop->SetWifiMac(this);
615 m_txop->SetMinCw(0);
616 m_txop->SetMaxCw(0);
617 m_txop->SetAifsn(1);
618 m_scheduler->SetWifiMac(this);
619}
620} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
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
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.
bool CheckSupportedRates(SupportedRates rates) const
Check supported rates.
Time m_beaconInterval
Beaconing interval.
void SetLinkMetricCallback(Callback< uint32_t, Mac48Address, Ptr< MeshWifiInterfaceMac > > cb)
Set the link metric callback.
void ConfigureStandard(enum WifiStandard standard) override
Finish configuration based on the WifiStandard being provided.
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.
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.
SupportedRates GetSupportedRates() const
Get 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.
virtual void SetParent(Ptr< MeshWifiInterfaceMac > parent)=0
Each plugin must be installed on an interface to work.
Implement the header for management frames of type beacon.
Definition: mgt-headers.h:1222
const Ssid & GetSsid() const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:310
const SupportedRates & GetSupportedRates() const
Return the supported rates.
Definition: mgt-headers.cc:322
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:258
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:986
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:305
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:994
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
bool IsEqual(const Ssid &o) const
Check if the two SSIDs are equal.
Definition: ssid.cc:55
The Supported Rates Information Element.
void SetBasicRate(uint64_t bs)
Set the given rate to basic rates.
bool IsBasicRate(uint64_t bs) const
Check if the given rate is a basic rate.
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.
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:1425
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:256
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:195
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:188
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:353
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:227
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:505
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
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:92
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:1011
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Definition: wifi-mac.h:640
Ptr< WifiMacQueueScheduler > m_scheduler
wifi MAC queue scheduler
Definition: wifi-mac.h:641
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:723
Ssid GetSsid() const
Definition: wifi-mac.cc:455
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:410
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
Definition: wifi-mac.cc:949
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:639
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:429
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: wifi-mac.cc:1080
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Definition: wifi-mac.cc:881
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:1105
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
Definition: wifi-mac.cc:621
Mac48Address GetAddress() const
Definition: wifi-mac.cc:442
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: wifi-mac.cc:893
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:489
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:368
represent a single transmission mode
Definition: wifi-mode.h:50
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:1004
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:950
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:974
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:869
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 AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1426
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:160
#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:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
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:132
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:74
@ WIFI_STANDARD_80211a
@ AC_BE
Best Effort.
Definition: qos-utils.h:76
@ AC_VO
Voice.
Definition: qos-utils.h:82
@ AC_BK
Background.
Definition: qos-utils.h:78
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ MESH
Definition: wifi-mac.h:63
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535
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.
void Print(std::ostream &os) const
Print statistics.