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
22
23#include "mesh-wifi-beacon.h"
24
25#include "ns3/boolean.h"
26#include "ns3/channel-access-manager.h"
27#include "ns3/double.h"
28#include "ns3/log.h"
29#include "ns3/mac-tx-middle.h"
30#include "ns3/pointer.h"
31#include "ns3/qos-txop.h"
32#include "ns3/random-variable-stream.h"
33#include "ns3/simulator.h"
34#include "ns3/socket.h"
35#include "ns3/trace-source-accessor.h"
36#include "ns3/wifi-mac-queue-scheduler.h"
37#include "ns3/wifi-mac-queue.h"
38#include "ns3/wifi-net-device.h"
39#include "ns3/wifi-utils.h"
40#include "ns3/yans-wifi-phy.h"
41
42namespace ns3
43{
44
45NS_LOG_COMPONENT_DEFINE("MeshWifiInterfaceMac");
46
47NS_OBJECT_ENSURE_REGISTERED(MeshWifiInterfaceMac);
48
49TypeId
51{
52 static TypeId tid =
53 TypeId("ns3::MeshWifiInterfaceMac")
55 .SetGroupName("Mesh")
56 .AddConstructor<MeshWifiInterfaceMac>()
57 .AddAttribute("BeaconInterval",
58 "Beacon Interval",
59 TimeValue(Seconds(0.5)),
60
63 .AddAttribute("RandomStart",
64 "Window when beacon generating starts (uniform random) in seconds",
65 TimeValue(Seconds(0.5)),
68 .AddAttribute("BeaconGeneration",
69 "Enable/Disable Beaconing.",
70 BooleanValue(true),
74 return tid;
75}
76
78 : m_standard(WIFI_STANDARD_80211a)
79{
80 NS_LOG_FUNCTION(this);
81
82 // Let the lower layers know that we are acting as a mesh node
84 m_coefficient = CreateObject<UniformRandomVariable>();
85}
86
88{
89 NS_LOG_FUNCTION(this);
90}
91
92//-----------------------------------------------------------------------------
93// WifiMac inherited
94//-----------------------------------------------------------------------------
95bool
97{
98 return true;
99}
100
101void
103{
104 NS_LOG_FUNCTION(this << packet << to << from);
105 ForwardDown(packet, from, to);
106}
107
108void
110{
111 NS_LOG_FUNCTION(this << packet << to);
112 ForwardDown(packet, GetAddress(), to);
113}
114
115bool
117{
118 return true;
119}
120
121void
123{
124 NS_LOG_FUNCTION(this);
126
127 // The approach taken here is that, from the point of view of a mesh
128 // node, the link is always up, so we immediately invoke the
129 // callback if one is set
130 linkUp();
131}
132
133void
135{
136 NS_LOG_FUNCTION(this);
137 m_plugins.clear();
139
141}
142
143void
145{
146 NS_LOG_FUNCTION(this);
148 if (m_beaconEnable)
149 {
150 Time randomStart = Seconds(m_coefficient->GetValue());
151 // Now start sending beacons after some random delay (to avoid collisions)
155 m_tbtt = Simulator::Now() + randomStart;
156 }
157 else
158 {
159 // stop sending beacons
161 }
162}
163
164int64_t
166{
167 NS_LOG_FUNCTION(this << stream);
168 int64_t currentStream = stream + WifiMac::AssignStreams(stream);
169 m_coefficient->SetStream(currentStream++);
170 for (auto i = m_plugins.begin(); i < m_plugins.end(); i++)
171 {
172 currentStream += (*i)->AssignStreams(currentStream);
173 }
174 return (currentStream - stream);
175}
176
177//-----------------------------------------------------------------------------
178// Plugins
179//-----------------------------------------------------------------------------
180void
182{
183 NS_LOG_FUNCTION(this);
184
185 plugin->SetParent(this);
186 m_plugins.push_back(plugin);
187}
188
189//-----------------------------------------------------------------------------
190// Switch channels
191//-----------------------------------------------------------------------------
192uint16_t
194{
195 NS_LOG_FUNCTION(this);
196 NS_ASSERT(GetWifiPhy()); // need PHY to set/get channel
197 return GetWifiPhy()->GetChannelNumber();
198}
199
200void
202{
203 NS_LOG_FUNCTION(this);
204 NS_ASSERT(GetWifiPhy()); // need PHY to set/get channel
205 /**
206 * \todo
207 * Correct channel switching is:
208 *
209 * 1. Interface down, e.g. to stop packets from layer 3
210 * 2. Wait before all output queues will be empty
211 * 3. Switch PHY channel
212 * 4. Interface up
213 *
214 * Now we use dirty channel switch -- just change frequency
215 */
217 WifiPhy::ChannelTuple{new_id, 0, GetWifiPhy()->GetPhyBand(), 0});
218 // Don't know NAV on new channel
220}
221
222//-----------------------------------------------------------------------------
223// Forward frame down
224//-----------------------------------------------------------------------------
225void
227{
228 WifiMacHeader hdr;
230 hdr.SetAddr2(GetAddress());
231 hdr.SetAddr3(to);
232 hdr.SetAddr4(from);
233 hdr.SetDsFrom();
234 hdr.SetDsTo();
235 // Fill QoS fields:
237 hdr.SetQosNoEosp();
238 hdr.SetQosNoAmsdu();
239 hdr.SetQosTxopLimit(0);
240 // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
241 hdr.SetAddr1(Mac48Address());
242 // Filter packet through all installed plugins
243 for (auto i = m_plugins.end() - 1; i != m_plugins.begin() - 1; i--)
244 {
245 bool drop = !((*i)->UpdateOutcomingFrame(packet, hdr, from, to));
246 if (drop)
247 {
248 return; // plugin drops frame
249 }
250 }
251 // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
252 NS_ASSERT(hdr.GetAddr1() != Mac48Address());
253 // Queue frame
254 if (GetWifiRemoteStationManager()->IsBrandNew(hdr.GetAddr1()))
255 {
256 // in adhoc mode, we assume that every destination
257 // supports all the rates we support.
258 for (const auto& mode : GetWifiPhy()->GetModeList())
259 {
260 GetWifiRemoteStationManager()->AddSupportedMode(hdr.GetAddr1(), mode);
261 }
262 GetWifiRemoteStationManager()->RecordDisassociated(hdr.GetAddr1());
263 }
264 // Classify: application may have set a tag, which is removed here
265 AcIndex ac;
267 if (packet->RemovePacketTag(tag))
268 {
269 hdr.SetQosTid(tag.GetPriority());
271 }
272 else
273 {
274 // No tag found; set to best effort
275 ac = AC_BE;
276 hdr.SetQosTid(0);
277 }
279 m_stats.sentBytes += packet->GetSize();
280 NS_ASSERT(GetQosTxop(ac) != nullptr);
281 GetQosTxop(ac)->Queue(packet, hdr);
282}
283
284void
286{
287 // Filter management frames:
288 WifiMacHeader header = hdr;
289 for (auto i = m_plugins.end() - 1; i != m_plugins.begin() - 1; i--)
290 {
291 bool drop = !((*i)->UpdateOutcomingFrame(packet, header, Mac48Address(), Mac48Address()));
292 if (drop)
293 {
294 return; // plugin drops frame
295 }
296 }
298 m_stats.sentBytes += packet->GetSize();
299 if ((GetQosTxop(AC_VO) == nullptr) || (GetQosTxop(AC_BK) == nullptr))
300 {
301 NS_FATAL_ERROR("Voice or Background queue is not set up!");
302 }
303 /*
304 * When we send a management frame - it is better to enqueue it to
305 * priority queue. But when we send a broadcast management frame,
306 * like PREQ, little MinCw value may cause collisions during
307 * retransmissions (two neighbor stations may choose the same window
308 * size, and two packets will be collided). So, broadcast management
309 * frames go to BK queue.
310 */
312 {
313 GetQosTxop(AC_VO)->Queue(packet, header);
314 }
315 else
316 {
317 GetQosTxop(AC_BK)->Queue(packet, header);
318 }
319}
320
323{
324 // set the set of supported rates and make sure that we indicate
325 // the Basic Rate set in this set of supported rates.
326 AllSupportedRates rates;
327 for (const auto& mode : GetWifiPhy()->GetModeList())
328 {
330 rates.AddSupportedRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1));
331 }
332 // set the basic rates
333 for (uint32_t j = 0; j < GetWifiRemoteStationManager()->GetNBasicModes(); j++)
334 {
335 WifiMode mode = GetWifiRemoteStationManager()->GetBasicMode(j);
337 rates.SetBasicRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1));
338 }
339 return rates;
340}
341
342bool
344{
345 for (uint32_t i = 0; i < GetWifiRemoteStationManager()->GetNBasicModes(); i++)
346 {
347 WifiMode mode = GetWifiRemoteStationManager()->GetBasicMode(i);
349 if (!rates.IsSupportedRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1)))
350 {
351 return false;
352 }
353 }
354 return true;
355}
356
357//-----------------------------------------------------------------------------
358// Beacons
359//-----------------------------------------------------------------------------
360void
362{
363 NS_LOG_FUNCTION(this << interval);
364 m_randomStart = interval;
365}
366
367void
369{
370 NS_LOG_FUNCTION(this << interval);
371 m_beaconInterval = interval;
372}
373
374Time
376{
377 return m_beaconInterval;
378}
379
380void
382{
383 NS_LOG_FUNCTION(this << enable);
384 m_beaconEnable = enable;
385}
386
387bool
389{
391}
392
393Time
395{
396 return m_tbtt;
397}
398
399void
401{
402 // User of ShiftTbtt () must take care don't shift it to the past
403 NS_ASSERT(GetTbtt() + shift > Simulator::Now());
404
405 m_tbtt += shift;
406 // Shift scheduled event
410}
411
412void
414{
418}
419
420void
422{
423 NS_LOG_FUNCTION(this);
424 NS_LOG_DEBUG(GetAddress() << " is sending beacon");
425
427
428 // Form & send beacon
430
431 // Ask all plugins to add their specific information elements to beacon
432 for (auto i = m_plugins.begin(); i != m_plugins.end(); ++i)
433 {
434 (*i)->UpdateBeacon(beacon);
435 }
437
439}
440
441void
443{
444 const WifiMacHeader* hdr = &mpdu->GetHeader();
445 Ptr<Packet> packet = mpdu->GetPacket()->Copy();
446 // Process beacon
447 if ((hdr->GetAddr1() != GetAddress()) && (hdr->GetAddr1() != Mac48Address::GetBroadcast()))
448 {
449 return;
450 }
451 if (hdr->IsBeacon())
452 {
454 MgtBeaconHeader beacon_hdr;
455
456 packet->PeekHeader(beacon_hdr);
457
458 NS_LOG_DEBUG("Beacon received from " << hdr->GetAddr2() << " I am " << GetAddress()
459 << " at " << Simulator::Now().GetMicroSeconds()
460 << " microseconds");
461
462 // update supported rates
463 if (beacon_hdr.Get<Ssid>()->IsEqual(GetSsid()))
464 {
465 NS_ASSERT(beacon_hdr.Get<SupportedRates>());
466 auto rates = AllSupportedRates{*beacon_hdr.Get<SupportedRates>(),
467 beacon_hdr.Get<ExtendedSupportedRatesIE>()};
468
469 for (const auto& mode : GetWifiPhy()->GetModeList())
470 {
472 uint64_t rate = mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1);
473 if (rates.IsSupportedRate(rate))
474 {
475 GetWifiRemoteStationManager()->AddSupportedMode(hdr->GetAddr2(), mode);
476 if (rates.IsBasicRate(rate))
477 {
478 GetWifiRemoteStationManager()->AddBasicMode(mode);
479 }
480 }
481 }
482 }
483 }
484 else
485 {
486 m_stats.recvBytes += packet->GetSize();
488 }
489 // Filter frame through all installed plugins
490 for (auto i = m_plugins.begin(); i != m_plugins.end(); ++i)
491 {
492 bool drop = !((*i)->Receive(packet, *hdr));
493 if (drop)
494 {
495 return; // plugin drops frame
496 }
497 }
498 // Check if QoS tag exists and add it:
499 if (hdr->IsQosData())
500 {
501 SocketPriorityTag priorityTag;
502 priorityTag.SetPriority(hdr->GetQosTid());
503 packet->ReplacePacketTag(priorityTag);
504 }
505 // Forward data up
506 if (hdr->IsData())
507 {
508 ForwardUp(packet, hdr->GetAddr4(), hdr->GetAddr3());
509 }
510
511 // We don't bother invoking WifiMac::Receive() here, because
512 // we've explicitly handled all the frames we care about. This is in
513 // contrast to most classes which derive from WifiMac.
514}
515
518{
519 uint32_t metric = 1;
520 if (!m_linkMetricCallback.IsNull())
521 {
522 metric = m_linkMetricCallback(peerAddress, this);
523 }
524 return metric;
525}
526
527void
530{
532}
533
534void
536{
537 m_mpAddress = a;
538}
539
542{
543 return m_mpAddress;
544}
545
546// Statistics:
548 : recvBeacons(0),
549 sentFrames(0),
550 sentBytes(0),
551 recvFrames(0),
552 recvBytes(0)
553{
554}
555
556void
558{
559 os << "<Statistics "
560 /// \todo txBeacons
561 "rxBeacons=\""
562 << recvBeacons
563 << "\" "
564 "txFrames=\""
565 << sentFrames
566 << "\" "
567 "txBytes=\""
568 << sentBytes
569 << "\" "
570 "rxFrames=\""
571 << recvFrames
572 << "\" "
573 "rxBytes=\""
574 << recvBytes << "\"/>" << std::endl;
575}
576
577void
578MeshWifiInterfaceMac::Report(std::ostream& os) const
579{
580 os << "<Interface "
581 "BeaconInterval=\""
583 << "\" "
584 "Channel=\""
586 << "\" "
587 "Address = \""
588 << GetAddress() << "\">" << std::endl;
589 m_stats.Print(os);
590 os << "</Interface>" << std::endl;
591}
592
593void
595{
597}
598
599void
601{
604 m_standard = standard;
605}
606
607void
609{
611 // We use the single DCF provided by WifiMac for the purpose of
612 // Beacon transmission. For this we need to reconfigure the channel
613 // access parameters slightly, and do so here.
614 m_txop = CreateObject<Txop>();
615 m_txop->SetWifiMac(this);
618 m_txop->SetMinCw(0);
619 m_txop->SetMaxCw(0);
620 m_txop->SetAifsn(1);
621 m_scheduler->SetWifiMac(this);
622}
623} // namespace ns3
AttributeValue implementation for Boolean.
Definition: boolean.h:37
Callback template class.
Definition: callback.h:438
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.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
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.
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:512
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:211
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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:571
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:285
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
indicates whether the socket has a priority set.
Definition: socket.h:1318
uint8_t GetPriority() const
Get the tag's priority.
Definition: socket.cc:860
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:854
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:403
int64_t GetMicroSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:413
AttributeValue implementation for Time.
Definition: nstime.h:1406
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:266
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:208
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:201
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:364
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:236
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:522
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
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.
virtual 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:99
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:1236
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Definition: wifi-mac.h:908
Ptr< WifiMacQueueScheduler > m_scheduler
wifi MAC queue scheduler
Definition: wifi-mac.h:909
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:762
Ssid GetSsid() const
Definition: wifi-mac.cc:479
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:429
Ptr< WifiPhy > GetWifiPhy(uint8_t linkId=SINGLE_LINK_OP_ID) const
Definition: wifi-mac.cc:1185
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:907
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: wifi-mac.cc:351
Ptr< WifiNetDevice > GetDevice() const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:453
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: wifi-mac.cc:1305
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId=0) const
Definition: wifi-mac.cc:920
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:1521
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
Definition: wifi-mac.cc:660
Mac48Address GetAddress() const
Definition: wifi-mac.cc:466
LinkEntity & GetLink(uint8_t linkId) const
Get a reference to the link associated with the given ID.
Definition: wifi-mac.cc:938
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:513
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:387
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:1119
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1042
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1066
std::tuple< uint8_t, uint16_t, WifiPhyBand, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:903
std::list< WifiMode > GetModeList() const
The WifiPhy::GetModeList() method is used (e.g., by a WifiRemoteStationManager) to determine the set ...
Definition: wifi-phy.cc:1985
#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:81
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1427
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1407
#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:1319
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:73
@ MESH
Definition: wifi-mac.h:71
@ WIFI_STANDARD_80211a
@ AC_BE
Best Effort.
Definition: qos-utils.h:75
@ AC_VO
Voice.
Definition: qos-utils.h:81
@ AC_BK
Background.
Definition: qos-utils.h:77
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:192
@ 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.