A Discrete-Event Network Simulator
API
mesh-wifi-interface-mac.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2009 IITP RAS
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Kirill Andreev <andreev@iitp.ru>
19 * Pavel Boyko <boyko@iitp.ru>
20 */
21
22#include "ns3/mesh-wifi-interface-mac.h"
23#include "ns3/mesh-wifi-beacon.h"
24#include "ns3/log.h"
25#include "ns3/boolean.h"
26#include "ns3/random-variable-stream.h"
27#include "ns3/simulator.h"
28#include "ns3/yans-wifi-phy.h"
29#include "ns3/wifi-utils.h"
30#include "ns3/pointer.h"
31#include "ns3/double.h"
32#include "ns3/trace-source-accessor.h"
33#include "ns3/socket.h"
34#include "ns3/wifi-net-device.h"
35#include "ns3/channel-access-manager.h"
36#include "ns3/mac-tx-middle.h"
37#include "ns3/qos-txop.h"
38
39namespace ns3 {
40
41NS_LOG_COMPONENT_DEFINE ("MeshWifiInterfaceMac");
42
43NS_OBJECT_ENSURE_REGISTERED (MeshWifiInterfaceMac);
44
45TypeId
47{
48 static TypeId tid = TypeId ("ns3::MeshWifiInterfaceMac")
50 .SetGroupName ("Mesh")
51 .AddConstructor<MeshWifiInterfaceMac> ()
52 .AddAttribute ( "BeaconInterval",
53 "Beacon Interval",
54 TimeValue (Seconds (0.5)),
55
59 )
60 .AddAttribute ( "RandomStart",
61 "Window when beacon generating starts (uniform random) in seconds",
62 TimeValue (Seconds (0.5)),
66 )
67 .AddAttribute ( "BeaconGeneration",
68 "Enable/Disable Beaconing.",
69 BooleanValue (true),
73 )
74 ;
75 return tid;
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}
87{
88 NS_LOG_FUNCTION (this);
89}
90//-----------------------------------------------------------------------------
91// WifiMac inherited
92//-----------------------------------------------------------------------------
93bool
95{
96 return true;
97}
98void
100{
101 NS_LOG_FUNCTION (this << packet << to << from);
102 ForwardDown (packet, from, to);
103}
104void
106{
107 NS_LOG_FUNCTION (this << packet << to);
108 ForwardDown (packet, GetAddress (), to);
109}
110bool
112{
113 return true;
114}
115void
117{
118 NS_LOG_FUNCTION (this);
120
121 // The approach taken here is that, from the point of view of a mesh
122 // node, the link is always up, so we immediately invoke the
123 // callback if one is set
124 linkUp ();
125}
126void
128{
129 NS_LOG_FUNCTION (this);
130 m_plugins.clear ();
132
134}
135void
137{
138 NS_LOG_FUNCTION (this);
140 if (m_beaconEnable)
141 {
142 Time randomStart = Seconds (m_coefficient->GetValue ());
143 // Now start sending beacons after some random delay (to avoid collisions)
146 m_tbtt = Simulator::Now () + randomStart;
147 }
148 else
149 {
150 // stop sending beacons
152 }
153}
154
155int64_t
157{
158 NS_LOG_FUNCTION (this << stream);
159 int64_t currentStream = stream;
160 m_coefficient->SetStream (currentStream++);
161 for (PluginList::const_iterator i = m_plugins.begin (); i < m_plugins.end (); i++)
162 {
163 currentStream += (*i)->AssignStreams (currentStream);
164 }
165 return (currentStream - stream);
166}
167
168//-----------------------------------------------------------------------------
169// Plugins
170//-----------------------------------------------------------------------------
171void
173{
174 NS_LOG_FUNCTION (this);
175
176 plugin->SetParent (this);
177 m_plugins.push_back (plugin);
178}
179//-----------------------------------------------------------------------------
180// Switch channels
181//-----------------------------------------------------------------------------
182uint16_t
184{
185 NS_LOG_FUNCTION (this);
186 NS_ASSERT (GetWifiPhy () != 0); // need PHY to set/get channel
187 return GetWifiPhy ()->GetChannelNumber ();
188}
189
190void
192{
193 NS_LOG_FUNCTION (this);
194 NS_ASSERT (GetWifiPhy () != 0); // need PHY to set/get channel
207 // Don't know NAV on new channel
208 m_channelAccessManager->NotifyNavResetNow (Seconds (0));
209}
210//-----------------------------------------------------------------------------
211// Forward frame down
212//-----------------------------------------------------------------------------
213void
215{
216 WifiMacHeader hdr;
218 hdr.SetAddr2 (GetAddress ());
219 hdr.SetAddr3 (to);
220 hdr.SetAddr4 (from);
221 hdr.SetDsFrom ();
222 hdr.SetDsTo ();
223 // Fill QoS fields:
225 hdr.SetQosNoEosp ();
226 hdr.SetQosNoAmsdu ();
227 hdr.SetQosTxopLimit (0);
228 // Address 1 is unknown here. Routing plugin is responsible to correctly set it.
229 hdr.SetAddr1 (Mac48Address ());
230 // Filter packet through all installed plugins
231 for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
232 {
233 bool drop = !((*i)->UpdateOutcomingFrame (packet, hdr, from, to));
234 if (drop)
235 {
236 return; // plugin drops frame
237 }
238 }
239 // Assert that address1 is set. Assert will fail e.g. if there is no installed routing plugin.
240 NS_ASSERT (hdr.GetAddr1 () != Mac48Address ());
241 // Queue frame
242 if (GetWifiRemoteStationManager ()->IsBrandNew (hdr.GetAddr1 ()))
243 {
244 // in adhoc mode, we assume that every destination
245 // supports all the rates we support.
246 for (const auto & mode : GetWifiPhy ()->GetModeList ())
247 {
249 }
251 }
252 // Classify: application may have set a tag, which is removed here
253 AcIndex ac;
255 if (packet->RemovePacketTag (tag))
256 {
257 hdr.SetQosTid (tag.GetPriority ());
258 ac = QosUtilsMapTidToAc (tag.GetPriority ());
259 }
260 else
261 {
262 // No tag found; set to best effort
263 ac = AC_BE;
264 hdr.SetQosTid (0);
265 }
267 m_stats.sentBytes += packet->GetSize ();
268 NS_ASSERT (GetQosTxop (ac) != nullptr);
269 GetQosTxop (ac)->Queue (packet, hdr);
270}
271void
273{
274 //Filter management frames:
275 WifiMacHeader header = hdr;
276 for (PluginList::const_iterator i = m_plugins.end () - 1; i != m_plugins.begin () - 1; i--)
277 {
278 bool drop = !((*i)->UpdateOutcomingFrame (packet, header, Mac48Address (), Mac48Address ()));
279 if (drop)
280 {
281 return; // plugin drops frame
282 }
283 }
285 m_stats.sentBytes += packet->GetSize ();
286 if ((GetQosTxop (AC_VO) == nullptr) || (GetQosTxop (AC_BK) == nullptr))
287 {
288 NS_FATAL_ERROR ("Voice or Background queue is not set up!");
289 }
290 /*
291 * When we send a management frame - it is better to enqueue it to
292 * priority queue. But when we send a broadcast management frame,
293 * like PREQ, little MinCw value may cause collisions during
294 * retransmissions (two neighbor stations may choose the same window
295 * size, and two packets will be collided). So, broadcast management
296 * frames go to BK queue.
297 */
298 if (hdr.GetAddr1 () != Mac48Address::GetBroadcast ())
299 {
300 GetQosTxop (AC_VO)->Queue (packet, header);
301 }
302 else
303 {
304 GetQosTxop (AC_BK)->Queue (packet, header);
305 }
306}
309{
310 // set the set of supported rates and make sure that we indicate
311 // the Basic Rate set in this set of supported rates.
312 SupportedRates rates;
313 for (const auto & mode : GetWifiPhy ()->GetModeList ())
314 {
315 uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, GetWifiPhy ()->GetDevice ());
316 rates.AddSupportedRate (mode.GetDataRate (GetWifiPhy ()->GetChannelWidth (), gi, 1));
317 }
318 // set the basic rates
319 for (uint32_t j = 0; j < GetWifiRemoteStationManager ()->GetNBasicModes (); j++)
320 {
322 uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, GetWifiPhy ()->GetDevice ());
323 rates.SetBasicRate (mode.GetDataRate (GetWifiPhy ()->GetChannelWidth (), gi, 1));
324 }
325 return rates;
326}
327bool
329{
330 for (uint32_t i = 0; i < GetWifiRemoteStationManager ()->GetNBasicModes (); i++)
331 {
333 uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, GetWifiPhy ()->GetDevice ());
334 if (!rates.IsSupportedRate (mode.GetDataRate (GetWifiPhy ()->GetChannelWidth (), gi, 1)))
335 {
336 return false;
337 }
338 }
339 return true;
340}
341//-----------------------------------------------------------------------------
342// Beacons
343//-----------------------------------------------------------------------------
344void
346{
347 NS_LOG_FUNCTION (this << interval);
348 m_randomStart = interval;
349}
350void
352{
353 NS_LOG_FUNCTION (this << interval);
354 m_beaconInterval = interval;
355}
356Time
358{
359 return m_beaconInterval;
360}
361void
363{
364 NS_LOG_FUNCTION (this << enable);
365 m_beaconEnable = enable;
366}
367bool
369{
371}
372Time
374{
375 return m_tbtt;
376}
377void
379{
380 // User of ShiftTbtt () must take care don't shift it to the past
381 NS_ASSERT (GetTbtt () + shift > Simulator::Now ());
382
383 m_tbtt += shift;
384 // Shift scheduled event
387 this);
388}
389void
391{
394}
395void
397{
398 NS_LOG_FUNCTION (this);
399 NS_LOG_DEBUG (GetAddress () << " is sending beacon");
400
402
403 // Form & send beacon
405
406 // Ask all plugins to add their specific information elements to beacon
407 for (PluginList::const_iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
408 {
409 (*i)->UpdateBeacon (beacon);
410 }
412
414}
415void
417{
418 const WifiMacHeader* hdr = &mpdu->GetHeader ();
419 Ptr<Packet> packet = mpdu->GetPacket ()->Copy ();
420 // Process beacon
421 if ((hdr->GetAddr1 () != GetAddress ()) && (hdr->GetAddr1 () != Mac48Address::GetBroadcast ()))
422 {
423 return;
424 }
425 if (hdr->IsBeacon ())
426 {
428 MgtBeaconHeader beacon_hdr;
429
430 packet->PeekHeader (beacon_hdr);
431
432 NS_LOG_DEBUG ("Beacon received from " << hdr->GetAddr2 () << " I am " << GetAddress () << " at "
433 << Simulator::Now ().GetMicroSeconds () << " microseconds");
434
435 // update supported rates
436 if (beacon_hdr.GetSsid ().IsEqual (GetSsid ()))
437 {
438 SupportedRates rates = beacon_hdr.GetSupportedRates ();
439
440 for (const auto & mode : GetWifiPhy ()->GetModeList ())
441 {
442 uint16_t gi = ConvertGuardIntervalToNanoSeconds (mode, GetWifiPhy ()->GetDevice ());
443 uint64_t rate = mode.GetDataRate (GetWifiPhy ()->GetChannelWidth (), gi, 1);
444 if (rates.IsSupportedRate (rate))
445 {
447 if (rates.IsBasicRate (rate))
448 {
450 }
451 }
452 }
453 }
454 }
455 else
456 {
457 m_stats.recvBytes += packet->GetSize ();
459 }
460 // Filter frame through all installed plugins
461 for (PluginList::iterator i = m_plugins.begin (); i != m_plugins.end (); ++i)
462 {
463 bool drop = !((*i)->Receive (packet, *hdr));
464 if (drop)
465 {
466 return; // plugin drops frame
467 }
468 }
469 // Check if QoS tag exists and add it:
470 if (hdr->IsQosData ())
471 {
472 SocketPriorityTag priorityTag;
473 priorityTag.SetPriority (hdr->GetQosTid ());
474 packet->ReplacePacketTag (priorityTag);
475 }
476 // Forward data up
477 if (hdr->IsData ())
478 {
479 ForwardUp (packet, hdr->GetAddr4 (), hdr->GetAddr3 ());
480 }
481
482 // We don't bother invoking WifiMac::Receive() here, because
483 // we've explicitly handled all the frames we care about. This is in
484 // contrast to most classes which derive from WifiMac.
485}
488{
489 uint32_t metric = 1;
490 if (!m_linkMetricCallback.IsNull ())
491 {
492 metric = m_linkMetricCallback (peerAddress, this);
493 }
494 return metric;
495}
496void
498{
500}
501void
503{
504 m_mpAddress = a;
505}
508{
509 return m_mpAddress;
510}
511//Statistics:
513 : recvBeacons (0),
514 sentFrames (0),
515 sentBytes (0),
516 recvFrames (0),
517 recvBytes (0)
518{
519}
520void
522{
523 os << "<Statistics "
525 "rxBeacons=\"" << recvBeacons << "\" "
526 "txFrames=\"" << sentFrames << "\" "
527 "txBytes=\"" << sentBytes << "\" "
528 "rxFrames=\"" << recvFrames << "\" "
529 "rxBytes=\"" << recvBytes << "\"/>" << std::endl;
530}
531void
532MeshWifiInterfaceMac::Report (std::ostream & os) const
533{
534 os << "<Interface "
535 "BeaconInterval=\"" << GetBeaconInterval ().GetSeconds () << "\" "
536 "Channel=\"" << GetFrequencyChannel () << "\" "
537 "Address = \"" << GetAddress () << "\">" << std::endl;
538 m_stats.Print (os);
539 os << "</Interface>" << std::endl;
540}
541void
543{
544 m_stats = Statistics ();
545}
546
547void
549{
552 m_standard = standard;
553}
554
555void
557{
559 // We use the single DCF provided by WifiMac for the purpose of
560 // Beacon transmission. For this we need to reconfigure the channel
561 // access parameters slightly, and do so here.
562 m_txop = CreateObject<Txop> ();
564 m_txop->SetWifiMac (this);
566 m_txop->SetMinCw (0);
567 m_txop->SetMaxCw (0);
568 m_txop->SetAifsn (1);
569}
570} // namespace ns3
571
AttributeValue implementation for Boolean.
Definition: boolean.h:37
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
an EUI-48 address
Definition: mac48-address.h:44
static Mac48Address GetBroadcast(void)
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.
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.
Mac48Address m_mpAddress
Mesh point address.
void SetBeaconInterval(Time interval)
Set interval between two successive beacons.
virtual void SetLinkUpCallback(Callback< void > linkUp)
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.
void ResetStats()
Reset statistics function.
void Receive(Ptr< WifiMacQueueItem > mpdu)
Frame receive handler.
void SendManagementFrame(Ptr< Packet > frame, const WifiMacHeader &hdr)
To be used by plugins sending management frames.
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
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.
virtual bool CanForwardPacketsTo(Mac48Address to) const
Return true if packets can be forwarded to the given destination, false otherwise.
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
uint16_t GetFrequencyChannel() const
Current channel Id.
void SetBeaconGeneration(bool enable)
Enable/disable beacons.
bool GetBeaconGeneration() const
Get current beaconing status.
virtual void ConfigureStandard(enum WifiStandard standard)
Finish configuration based on the WifiStandard being provided.
void SetMeshPointAddress(Mac48Address addr)
Set the mesh point address.
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.
virtual bool SupportsSendFrom() const
bool m_beaconEnable
Beaconing interval.
Time m_randomStart
Maximum delay before first beacon.
static TypeId GetTypeId()
Get the type ID.
virtual void Enqueue(Ptr< Packet > packet, Mac48Address to, Mac48Address from)
PluginList m_plugins
List of all installed plugins.
virtual void DoDispose()
Real d-tor.
SupportedRates GetSupportedRates() const
Ptr< UniformRandomVariable > m_coefficient
Add randomness to beacon generation.
Time m_tbtt
Time for the next frame.
virtual void DoInitialize()
Initialize() implementation.
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:862
Ssid GetSsid(void) const
Return the Service Set Identifier (SSID).
Definition: mgt-headers.cc:202
SupportedRates GetSupportedRates(void) const
Return the supported rates.
Definition: mgt-headers.cc:214
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:256
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:963
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:970
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:856
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
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:268
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
indicates whether the socket has a priority set.
Definition: socket.h:1309
uint8_t GetPriority(void) const
Get the tag's priority.
Definition: socket.cc:848
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:842
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:103
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:387
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
AttributeValue implementation for Time.
Definition: nstime.h:1308
void SetMaxCw(uint32_t maxCw)
Set the maximum contention window size.
Definition: txop.cc:173
virtual void SetWifiMac(const Ptr< WifiMac > mac)
Set the wifi MAC this Txop is associated to.
Definition: txop.cc:136
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this Txop is associated to.
Definition: txop.cc:129
void SetAifsn(uint8_t aifsn)
Set the number of slots that make up an AIFS.
Definition: txop.cc:247
void SetMinCw(uint32_t minCw)
Set the minimum contention window size.
Definition: txop.cc:161
void SetChannelAccessManager(const Ptr< ChannelAccessManager > manager)
Set ChannelAccessManager this Txop is associated to.
Definition: txop.cc:122
virtual void Queue(Ptr< Packet > packet, const WifiMacHeader &hdr)
Definition: txop.cc:294
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
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.
Mac48Address GetAddr3(void) const
Return the address in the Address 3 field.
uint8_t GetQosTid(void) const
Return the Traffic ID of a QoS header.
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS Ack policy in the QoS control field.
Mac48Address GetAddr4(void) const
Return the address in the Address 4 field.
bool IsQosData(void) const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
void SetQosTxopLimit(uint8_t txop)
Set TXOP limit in the QoS control field.
void SetDsTo(void)
Set the To DS bit in the Frame Control field.
Mac48Address GetAddr2(void) const
Return the address in the Address 2 field.
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
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.
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
void SetQosNoEosp()
Un-set the end of service period (EOSP) bit in the QoS control field.
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
void SetQosNoAmsdu(void)
Set that A-MSDU is not present.
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
bool IsData(void) const
Return true if the Type is DATA.
void SetDsFrom(void)
Set the From DS bit in the Frame Control field.
void SetAddr3(Mac48Address address)
Fill the Address 3 field with the given address.
bool IsBeacon(void) const
Return true if the header is a Beacon header.
base class for all MAC-level wifi objects.
Definition: wifi-mac.h:85
bool GetQosSupported() const
Return whether the device supports QoS.
Definition: wifi-mac.cc:822
Ptr< Txop > m_txop
TXOP used for transmission of frames to non-QoS peers.
Definition: wifi-mac.h:523
Ssid GetSsid(void) const
Definition: wifi-mac.cc:416
virtual void ConfigureStandard(WifiStandard standard)
Definition: wifi-mac.cc:650
Mac48Address GetAddress(void) const
Definition: wifi-mac.cc:403
void SetTypeOfStation(TypeOfStation type)
This method is invoked by a subclass to specify what type of station it is implementing.
Definition: wifi-mac.cc:371
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const
Definition: wifi-mac.cc:757
Ptr< ChannelAccessManager > m_channelAccessManager
channel access manager
Definition: wifi-mac.h:521
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: wifi-mac.h:520
Ptr< WifiPhy > GetWifiPhy(void) const
Definition: wifi-mac.cc:776
virtual void SetLinkUpCallback(Callback< void > linkUp)
Definition: wifi-mac.cc:891
Ptr< WifiNetDevice > GetDevice(void) const
Return the device this PHY is associated with.
Definition: wifi-mac.cc:390
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Forward the packet up to the device.
Definition: wifi-mac.cc:916
virtual void ConfigureContentionWindow(uint32_t cwMin, uint32_t cwMax)
Definition: wifi-mac.cc:572
Ptr< QosTxop > GetQosTxop(AcIndex ac) const
Accessor for a specified EDCA object.
Definition: wifi-mac.cc:452
void DoDispose() override
Destructor implementation.
Definition: wifi-mac.cc:336
represent a single transmission mode
Definition: wifi-mode.h:48
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:114
uint8_t GetChannelNumber(void) const
Return current channel number.
Definition: wifi-phy.cc:895
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:870
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:913
std::tuple< uint8_t, uint16_t, int, uint8_t > ChannelTuple
Tuple identifying an operating channel.
Definition: wifi-phy.h:832
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(void) 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:67
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:85
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1309
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#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:1244
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:126
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:71
@ WIFI_STANDARD_80211a
@ AC_BE
Best Effort.
Definition: qos-utils.h:73
@ AC_VO
Voice.
Definition: qos-utils.h:79
@ AC_BK
Background.
Definition: qos-utils.h:75
Every class exported by the ns3 library is enclosed in the ns3 namespace.
@ MESH
Definition: wifi-mac.h:56
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:536
@ 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.