A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 * Copyright (c) 2009 MIRKO BANCHI
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8 * Mirko Banchi <mk.banchi@gmail.com>
9 */
10
11#ifndef WIFI_HELPER_H
12#define WIFI_HELPER_H
13
14#include "wifi-mac-helper.h"
15
16#include "ns3/qos-utils.h"
17#include "ns3/trace-helper.h"
18#include "ns3/wifi-net-device.h"
19#include "ns3/wifi-phy.h"
20
21#include <functional>
22#include <map>
23#include <optional>
24#include <vector>
25
26namespace ns3
27{
28
29class Node;
30class RadiotapHeader;
31class QueueItem;
32
33/**
34 * @brief create PHY objects
35 *
36 * This base class must be implemented by new PHY implementation which wish to integrate
37 * with the \ref ns3::WifiHelper class.
38 */
40{
41 public:
42 /**
43 * Constructor
44 *
45 * @param nLinks the number of links to configure (>1 only for 11be devices)
46 */
47 WifiPhyHelper(uint8_t nLinks = 1);
48 ~WifiPhyHelper() override;
49
50 /**
51 * @param node the node on which the PHY object(s) will reside
52 * @param device the device within which the PHY object(s) will reside
53 *
54 * @returns new PHY objects.
55 *
56 * Subclasses must implement this method to allow the ns3::WifiHelper class
57 * to create PHY objects from ns3::WifiHelper::Install.
58 */
59 virtual std::vector<Ptr<WifiPhy>> Create(Ptr<Node> node, Ptr<WifiNetDevice> device) const = 0;
60
61 /**
62 * @param name the name of the attribute to set
63 * @param v the value of the attribute
64 *
65 * Set an attribute of all the underlying PHY object.
66 */
67 void Set(std::string name, const AttributeValue& v);
68
69 /**
70 * @param name the name of the attribute to set
71 * @param v the value of the attribute
72 * @param linkId ID of the link to configure (>0 only for 11be devices)
73 *
74 * Set an attribute of the given underlying PHY object.
75 */
76 void Set(uint8_t linkId, std::string name, const AttributeValue& v);
77
78 /**
79 * Helper function used to set the interference helper.
80 *
81 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
82 * @param type the type of interference helper
83 * @param args A sequence of name-value pairs of the attributes to set.
84 */
85 template <typename... Args>
86 void SetInterferenceHelper(std::string type, Args&&... args);
87
88 /**
89 * Helper function used to set the error rate model.
90 *
91 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
92 * @param type the type of error rate model
93 * @param args A sequence of name-value pairs of the attributes to set.
94 */
95 template <typename... Args>
96 void SetErrorRateModel(std::string type, Args&&... args);
97
98 /**
99 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
100 * @param linkId ID of the link to configure (>0 only for 11be devices)
101 * @param type the type of the error rate model to set.
102 * @param args A sequence of name-value pairs of the attributes to set.
103 *
104 * Set the error rate model and its attributes to use for the given link when Install is called.
105 */
106 template <typename... Args>
107 void SetErrorRateModel(uint8_t linkId, std::string type, Args&&... args);
108
109 /**
110 * Helper function used to set the frame capture model.
111 *
112 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
113 * @param type the type of frame capture model
114 * @param args A sequence of name-value pairs of the attributes to set.
115 */
116 template <typename... Args>
117 void SetFrameCaptureModel(std::string type, Args&&... args);
118
119 /**
120 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
121 * @param linkId ID of the link to configure (>0 only for 11be devices)
122 * @param type the type of the frame capture model to set.
123 * @param args A sequence of name-value pairs of the attributes to set.
124 *
125 * Set the frame capture model and its attributes to use for the given link when Install is
126 * called.
127 */
128 template <typename... Args>
129 void SetFrameCaptureModel(uint8_t linkId, std::string type, Args&&... args);
130
131 /**
132 * Helper function used to set the preamble detection model.
133 *
134 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
135 * @param type the type of preamble detection model
136 * @param args A sequence of name-value pairs of the attributes to set.
137 */
138 template <typename... Args>
139 void SetPreambleDetectionModel(std::string type, Args&&... args);
140
141 /**
142 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
143 * @param linkId ID of the link to configure (>0 only for 11be devices)
144 * @param type the type of the preamble detection model to set.
145 * @param args A sequence of name-value pairs of the attributes to set.
146 *
147 * Set the preamble detection model and its attributes to use for the given link when Install is
148 * called.
149 */
150 template <typename... Args>
151 void SetPreambleDetectionModel(uint8_t linkId, std::string type, Args&&... args);
152
153 /**
154 * Disable the preamble detection model on all links.
155 */
157
158 /**
159 * An enumeration of the pcap data link types (DLTs) which this helper
160 * supports. See http://wiki.wireshark.org/Development/LibpcapFileFormat
161 * for more information on these formats.
162 */
164 {
166 PcapHelper::DLT_IEEE802_11, /**< IEEE 802.11 Wireless LAN headers on packets */
168 PcapHelper::DLT_PRISM_HEADER, /**< Include Prism monitor mode information */
170 PcapHelper::DLT_IEEE802_11_RADIO /**< Include Radiotap link layer information */
171 };
172
173 /**
174 * An enumeration of the PCAP capture types.
175 * The PCAP capture type only matters for multi-link devices.
176 */
178 {
179 PCAP_PER_DEVICE, /**< Single capture file per device */
180 PCAP_PER_PHY, /**< Single capture file per PHY */
181 PCAP_PER_LINK, /**< Single capture file per link */
182 };
183
184 /**
185 * structure holding the information about PCAP files generated for a given device
186 */
188 {
189 /**
190 * Constructor
191 *
192 * @param filename the common file name of the PCAP files
193 * @param dlt the selected data link type of the pcap file
194 * @param type the selected PCAP capture type
195 * @param dev the WifiNetDevice for which the PCAP files are generated
196 */
197 PcapFilesInfo(const std::string& filename,
201 : commonFilename{filename},
202 pcapDlt{dlt},
203 pcapType{type},
204 device{dev},
205 files{}
206 {
207 }
208
209 std::string commonFilename; ///< common file name of the PCAP files
210 PcapHelper::DataLinkType pcapDlt; ///< the selected data link type of the pcap file
211 WifiPhyHelper::PcapCaptureType pcapType; ///< the selected PCAP capture type
212 Ptr<WifiNetDevice> device; ///< the WifiNetDevice for which the PCAP files are generated
213 std::map<uint8_t, Ptr<PcapFileWrapper>> files; ///< PCAP files indexed by PHY ID
214 };
215
216 /**
217 * Set the data link type of PCAP traces to be used. This function has to be
218 * called before EnablePcap(), so that the header of the pcap file can be
219 * written correctly.
220 *
221 * @see SupportedPcapDataLinkTypes
222 *
223 * @param dlt The data link type of the pcap file (and packets) to be used
224 */
226
227 /**
228 * Get the data link type of PCAP traces to be used.
229 *
230 * @see SupportedPcapDataLinkTypes
231 *
232 * @returns The data link type of the pcap file (and packets) to be used
233 */
235
236 /**
237 * Set the PCAP capture type to be used. This function has to be called before EnablePcap().
238 *
239 * @see PcapCaptureType
240 *
241 * @param type The PCAP capture type
242 */
244
245 /**
246 * Get the PCAP capture type to be used.
247 *
248 * @see PcapCaptureType
249 *
250 * @return The PCAP capture type to be used
251 */
253
254 protected:
255 /**
256 * @param info the information needed to write to the correct PCAP file
257 * @param phyId the ID of the PHY that raised the event
258 * @param packet the packet
259 * @param channelFreqMhz the channel frequency
260 * @param txVector the TXVECTOR
261 * @param aMpdu the A-MPDU information
262 * @param staId the STA-ID (only used for MU)
263 *
264 * Handle TX pcap.
265 */
266 static void PcapSniffTxEvent(const std::shared_ptr<PcapFilesInfo>& info,
267 uint8_t phyId,
268 Ptr<const Packet> packet,
269 uint16_t channelFreqMhz,
270 WifiTxVector txVector,
271 MpduInfo aMpdu,
272 uint16_t staId = SU_STA_ID);
273 /**
274 * @param info the information needed to write to the correct PCAP file
275 * @param phyId the ID of the PHY that raised the event
276 * @param packet the packet
277 * @param channelFreqMhz the channel frequency
278 * @param txVector the TXVECTOR
279 * @param aMpdu the A-MPDU information
280 * @param signalNoise the RX signal and noise information
281 * @param staId the STA-ID (only used for MU)
282 *
283 * Handle RX pcap.
284 */
285 static void PcapSniffRxEvent(const std::shared_ptr<PcapFilesInfo>& info,
286 uint8_t phyId,
287 Ptr<const Packet> packet,
288 uint16_t channelFreqMhz,
289 WifiTxVector txVector,
290 MpduInfo aMpdu,
291 SignalNoiseDbm signalNoise,
292 uint16_t staId = SU_STA_ID);
293
294 std::vector<ObjectFactory> m_phys; ///< PHY objects
295 ObjectFactory m_interferenceHelper; ///< interference helper
296 std::vector<ObjectFactory> m_errorRateModel; ///< error rate model
297 std::vector<ObjectFactory> m_frameCaptureModel; ///< frame capture model
298 std::vector<ObjectFactory> m_preambleDetectionModel; ///< preamble detection model
299
300 private:
301 /**
302 * Get the PCAP file to write to from a list of PCAP files indexed by PHY ID.
303 * If PCAP files are generated per link, it might create a new file if a link
304 * has swapped to a new ID.
305 *
306 * @param info the information needed to write to the correct PCAP file
307 * @param phyId the ID of the PHY that raised the event
308 * @return the PCAP file to write to
309 */
310 static Ptr<PcapFileWrapper> GetOrCreatePcapFile(const std::shared_ptr<PcapFilesInfo>& info,
311 uint8_t phyId);
312
313 /**
314 * Get the Radiotap header for a received packet.
315 *
316 * @param packet the packet
317 * @param channelFreqMhz the channel frequency
318 * @param p20Index the index of the primary20 channel
319 * @param txVector the TXVECTOR
320 * @param aMpdu the A-MPDU information
321 * @param staId the STA-ID
322 * @param signalNoise the rx signal and noise information (for receiver only)
323 * @return the radiotap header
324 */
326 Ptr<Packet> packet,
327 uint16_t channelFreqMhz,
328 uint8_t p20Index,
329 const WifiTxVector& txVector,
330 MpduInfo aMpdu,
331 uint16_t staId,
332 std::optional<SignalNoiseDbm> signalNoise = std::nullopt);
333
334 /**
335 * @brief Enable pcap output the indicated net device.
336 *
337 * NetDevice-specific implementation mechanism for hooking the trace and
338 * writing to the trace file.
339 *
340 * @param prefix Filename prefix to use for pcap files.
341 * @param nd Net device for which you want to enable tracing.
342 * @param promiscuous If true capture all possible packets available at the device.
343 * @param explicitFilename Treat the prefix as an explicit filename if true
344 */
345 void EnablePcapInternal(std::string prefix,
347 bool promiscuous,
348 bool explicitFilename) override;
349
350 /**
351 * @brief Enable ASCII trace output on the indicated net device.
352 *
353 * NetDevice-specific implementation mechanism for hooking the trace and
354 * writing to the trace file.
355 *
356 * @param stream The output stream object to use when logging ASCII traces.
357 * @param prefix Filename prefix to use for ASCII trace files.
358 * @param nd Net device for which you want to enable tracing.
359 * @param explicitFilename Treat the prefix as an explicit filename if true
360 */
362 std::string prefix,
364 bool explicitFilename) override;
365
366 PcapHelper::DataLinkType m_pcapDlt; ///< PCAP data link type
367 PcapCaptureType m_pcapType; ///< PCAP capture type
368};
369
370/**
371 * @brief helps to create WifiNetDevice objects
372 *
373 * This class can help to create a large set of similar
374 * WifiNetDevice objects and to configure a large set of
375 * their attributes during creation.
376 */
378{
379 public:
380 virtual ~WifiHelper();
381
382 /**
383 * Create a Wifi helper in an empty state: all its parameters
384 * must be set before calling ns3::WifiHelper::Install
385 *
386 * The default state is defined as being an Adhoc MAC layer with an ARF rate control algorithm
387 * and both objects using their default attribute values.
388 * By default, configure MAC and PHY for 802.11ax.
389 */
390 WifiHelper();
391
392 /**
393 * Helper function used to set the station manager
394 *
395 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
396 * @param type the type of station manager
397 * @param args A sequence of name-value pairs of the attributes to set.
398 */
399 template <typename... Args>
400 void SetRemoteStationManager(std::string type, Args&&... args);
401
402 /**
403 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
404 * @param linkId ID of the link to configure (>0 only for 11be devices)
405 * @param type the type of the preamble detection model to set.
406 * @param args A sequence of name-value pairs of the attributes to set.
407 *
408 * Set the remote station manager model and its attributes to use for the given link.
409 * If the helper stored a remote station manager model for the first N links only
410 * (corresponding to link IDs from 0 to N-1) and the given linkId is M >= N, then a
411 * remote station manager model using the given attributes is configured for all links
412 * with ID from N to M.
413 */
414 template <typename... Args>
415 void SetRemoteStationManager(uint8_t linkId, std::string type, Args&&... args);
416
417 /**
418 * Helper function used to set the OBSS-PD algorithm
419 *
420 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
421 * @param type the type of OBSS-PD algorithm
422 * @param args A sequence of name-value pairs of the attributes to set.
423 */
424 template <typename... Args>
425 void SetObssPdAlgorithm(std::string type, Args&&... args);
426
427 /// Callback invoked to determine the MAC queue selected for a given packet
428 typedef std::function<std::size_t(Ptr<QueueItem>)> SelectQueueCallback;
429
430 /**
431 * @param f the select queue callback
432 *
433 * Set the select queue callback to set on the NetDevice queue interface aggregated
434 * to the WifiNetDevice, in case WifiMac with QoS enabled is used
435 */
437
438 /**
439 * Disable flow control only if you know what you are doing. By disabling
440 * flow control, this NetDevice will be sent packets even if there is no
441 * room for them (such packets will be likely dropped by this NetDevice).
442 * Also, any queue disc installed on this NetDevice will have no effect,
443 * as every packet enqueued to the traffic control layer queue disc will
444 * be immediately dequeued.
445 */
446 void DisableFlowControl();
447
448 /**
449 * @param phy the PHY helper to create PHY objects
450 * @param mac the MAC helper to create MAC objects
451 * @param first lower bound on the set of nodes on which a wifi device must be created
452 * @param last upper bound on the set of nodes on which a wifi device must be created
453 * @returns a device container which contains all the devices created by this method.
454 */
455 NetDeviceContainer virtual Install(const WifiPhyHelper& phy,
456 const WifiMacHelper& mac,
458 NodeContainer::Iterator last) const;
459 /**
460 * @param phy the PHY helper to create PHY objects
461 * @param mac the MAC helper to create MAC objects
462 * @param c the set of nodes on which a wifi device must be created
463 * @returns a device container which contains all the devices created by this method.
464 */
465 virtual NetDeviceContainer Install(const WifiPhyHelper& phy,
466 const WifiMacHelper& mac,
467 NodeContainer c) const;
468 /**
469 * @param phy the PHY helper to create PHY objects
470 * @param mac the MAC helper to create MAC objects
471 * @param node the node on which a wifi device must be created
472 * @returns a device container which contains all the devices created by this method.
473 */
474 virtual NetDeviceContainer Install(const WifiPhyHelper& phy,
475 const WifiMacHelper& mac,
476 Ptr<Node> node) const;
477 /**
478 * @param phy the PHY helper to create PHY objects
479 * @param mac the MAC helper to create MAC objects
480 * @param nodeName the name of node on which a wifi device must be created
481 * @returns a device container which contains all the devices created by this method.
482 */
483 virtual NetDeviceContainer Install(const WifiPhyHelper& phy,
484 const WifiMacHelper& mac,
485 std::string nodeName) const;
486 /**
487 * @param standard the standard to configure during installation
488 *
489 * This method sets standards-compliant defaults for WifiMac
490 * parameters such as SIFS time, slot time, timeout values, etc.,
491 * based on the standard selected. It results in
492 * WifiMac::ConfigureStandard(standard) being called on each
493 * installed MAC object.
494 *
495 * The default standard of 802.11ax will be applied if SetStandard()
496 * is not called.
497 *
498 * Note that WifiMac::ConfigureStandard () will overwrite certain
499 * defaults in the attribute system, so if a user wants to manipulate
500 * any default values affected by ConfigureStandard() while using this
501 * helper, the user should use a post-install configuration such as
502 * Config::Set() on any objects that this helper creates, such as:
503 * @code
504 * Config::Set ("/NodeList/0/DeviceList/0/$ns3::WifiNetDevice/Mac/Slot", TimeValue (MicroSeconds
505 * (slot))); \endcode
506 *
507 * \sa WifiMac::ConfigureStandard
508 * \sa Config::Set
509 */
510 virtual void SetStandard(WifiStandard standard);
511
512 /**
513 * @param standard String representation of the Wi-Fi standard
514 *
515 * This method overloads WifiHelper::SetStandard(WifiStandard standard) by allowing
516 * selected string names. For example, the strings "802.11ax", "11ax", and "HE"
517 * are equivalent and map to WIFI_STANDARD_80211ax. See the documentation of the specified
518 * function to see how it interacts with attribute configuration.
519 * \sa WifiHelper::SetStandard(WifiStandard standard)
520 */
521 void SetStandard(const std::string& standard);
522
523 /**
524 * Helper function used to configure the HT options listed as attributes of
525 * the HtConfiguration class.
526 *
527 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
528 * @param args A sequence of name-value pairs of the attributes to set.
529 */
530 template <typename... Args>
531 void ConfigHtOptions(Args&&... args);
532
533 /**
534 * Helper function used to configure the VHT options listed as attributes of
535 * the VhtConfiguration class.
536 *
537 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
538 * @param args A sequence of name-value pairs of the attributes to set.
539 */
540 template <typename... Args>
541 void ConfigVhtOptions(Args&&... args);
542
543 /**
544 * Helper function used to configure the HE options listed as attributes of
545 * the HeConfiguration class.
546 *
547 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
548 * @param args A sequence of name-value pairs of the attributes to set.
549 */
550 template <typename... Args>
551 void ConfigHeOptions(Args&&... args);
552
553 /**
554 * Helper function used to configure the EHT options listed as attributes of
555 * the EhtConfiguration class.
556 *
557 * @tparam Args \deduced Template type parameter pack for the sequence of name-value pairs.
558 * @param args A sequence of name-value pairs of the attributes to set.
559 */
560 template <typename... Args>
561 void ConfigEhtOptions(Args&&... args);
562
563 /**
564 * Helper to enable all WifiNetDevice log components with one statement
565 * @param logLevel (optional) log level setting
566 */
567 static void EnableLogComponents(LogLevel logLevel = LOG_LEVEL_ALL);
568
569 /**
570 * Assign a fixed random variable stream number to the random variables
571 * used by the PHY and MAC aspects of the Wifi models. Each device in
572 * container c has fixed stream numbers assigned to its random variables.
573 * The Wifi channel (e.g. propagation loss model) is excluded.
574 * Return the number of streams (possibly zero) that
575 * have been assigned. The Install() method should have previously been
576 * called by the user.
577 *
578 * @param c NetDeviceContainer of the set of net devices for which the
579 * WifiNetDevice should be modified to use fixed streams
580 * @param stream first stream index to use
581 * @return the number of stream indices assigned by this helper
582 */
583 static int64_t AssignStreams(NetDeviceContainer c, int64_t stream);
584
585 protected:
586 mutable std::vector<ObjectFactory> m_stationManager; ///< station manager
587 WifiStandard m_standard; ///< wifi standard
588 ObjectFactory m_htConfig; ///< HT configuration
589 ObjectFactory m_vhtConfig; ///< VHT configuration
590 ObjectFactory m_heConfig; ///< HE configuration
591 ObjectFactory m_ehtConfig; ///< EHT configuration
592 SelectQueueCallback m_selectQueueCallback; ///< select queue callback
593 ObjectFactory m_obssPdAlgorithm; ///< OBSS_PD algorithm
594 bool m_enableFlowControl; //!< whether to enable flow control
595};
596
597} // namespace ns3
598
599/***************************************************************
600 * Implementation of the templates declared above.
601 ***************************************************************/
602
603namespace ns3
604{
605
606template <typename... Args>
607void
608WifiPhyHelper::SetInterferenceHelper(std::string type, Args&&... args)
609{
611 m_interferenceHelper.Set(args...);
612}
613
614template <typename... Args>
615void
616WifiPhyHelper::SetErrorRateModel(std::string type, Args&&... args)
617{
618 for (std::size_t linkId = 0; linkId < m_phys.size(); linkId++)
619 {
620 SetErrorRateModel(linkId, type, std::forward<Args>(args)...);
621 }
622}
623
624template <typename... Args>
625void
626WifiPhyHelper::SetErrorRateModel(uint8_t linkId, std::string type, Args&&... args)
627{
628 m_errorRateModel.at(linkId).SetTypeId(type);
629 m_errorRateModel.at(linkId).Set(args...);
630}
631
632template <typename... Args>
633void
634WifiPhyHelper::SetFrameCaptureModel(std::string type, Args&&... args)
635{
636 for (std::size_t linkId = 0; linkId < m_phys.size(); linkId++)
637 {
638 SetFrameCaptureModel(linkId, type, std::forward<Args>(args)...);
639 }
640}
641
642template <typename... Args>
643void
644WifiPhyHelper::SetFrameCaptureModel(uint8_t linkId, std::string type, Args&&... args)
645{
646 m_frameCaptureModel.at(linkId).SetTypeId(type);
647 m_frameCaptureModel.at(linkId).Set(args...);
648}
649
650template <typename... Args>
651void
652WifiPhyHelper::SetPreambleDetectionModel(std::string type, Args&&... args)
653{
654 for (std::size_t linkId = 0; linkId < m_phys.size(); linkId++)
655 {
656 SetPreambleDetectionModel(linkId, type, std::forward<Args>(args)...);
657 }
658}
659
660template <typename... Args>
661void
662WifiPhyHelper::SetPreambleDetectionModel(uint8_t linkId, std::string type, Args&&... args)
663{
664 m_preambleDetectionModel.at(linkId).SetTypeId(type);
665 m_preambleDetectionModel.at(linkId).Set(args...);
666}
667
668template <typename... Args>
669void
670WifiHelper::SetRemoteStationManager(std::string type, Args&&... args)
671{
672 SetRemoteStationManager(0, type, std::forward<Args>(args)...);
673}
674
675template <typename... Args>
676void
677WifiHelper::SetRemoteStationManager(uint8_t linkId, std::string type, Args&&... args)
678{
679 if (m_stationManager.size() > linkId)
680 {
681 m_stationManager[linkId] = ObjectFactory(type, std::forward<Args>(args)...);
682 }
683 else
684 {
685 m_stationManager.resize(linkId + 1, ObjectFactory(type, std::forward<Args>(args)...));
686 }
687}
688
689template <typename... Args>
690void
691WifiHelper::SetObssPdAlgorithm(std::string type, Args&&... args)
692{
694 m_obssPdAlgorithm.Set(args...);
695}
696
697template <typename... Args>
698void
700{
701 m_htConfig.Set(args...);
702}
703
704template <typename... Args>
705void
707{
708 m_vhtConfig.Set(args...);
709}
710
711template <typename... Args>
712void
714{
715 m_heConfig.Set(args...);
716}
717
718template <typename... Args>
719void
721{
722 m_ehtConfig.Set(args...);
723}
724
725} // namespace ns3
726
727#endif /* WIFI_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices.
Hold a value for an Attribute.
Definition attribute.h:59
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Base class providing common user-level pcap operations for helpers representing net devices.
DataLinkType
This enumeration holds the data link types that will be written to the pcap file.
Smart pointer class similar to boost::intrusive_ptr.
Radiotap header implementation.
helps to create WifiNetDevice objects
virtual ~WifiHelper()
void SetRemoteStationManager(std::string type, Args &&... args)
Helper function used to set the station manager.
void ConfigEhtOptions(Args &&... args)
Helper function used to configure the EHT options listed as attributes of the EhtConfiguration class.
void SetObssPdAlgorithm(std::string type, Args &&... args)
Helper function used to set the OBSS-PD algorithm.
void ConfigHtOptions(Args &&... args)
Helper function used to configure the HT options listed as attributes of the HtConfiguration class.
ObjectFactory m_htConfig
HT configuration.
void ConfigHeOptions(Args &&... args)
Helper function used to configure the HE options listed as attributes of the HeConfiguration class.
ObjectFactory m_obssPdAlgorithm
OBSS_PD algorithm.
ObjectFactory m_ehtConfig
EHT configuration.
void ConfigVhtOptions(Args &&... args)
Helper function used to configure the VHT options listed as attributes of the VhtConfiguration class.
ObjectFactory m_vhtConfig
VHT configuration.
static void EnableLogComponents(LogLevel logLevel=LOG_LEVEL_ALL)
Helper to enable all WifiNetDevice log components with one statement.
void SetSelectQueueCallback(SelectQueueCallback f)
std::vector< ObjectFactory > m_stationManager
station manager
WifiStandard m_standard
wifi standard
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
virtual void SetStandard(WifiStandard standard)
ObjectFactory m_heConfig
HE configuration.
virtual NetDeviceContainer Install(const WifiPhyHelper &phy, const WifiMacHelper &mac, NodeContainer::Iterator first, NodeContainer::Iterator last) const
void DisableFlowControl()
Disable flow control only if you know what you are doing.
SelectQueueCallback m_selectQueueCallback
select queue callback
bool m_enableFlowControl
whether to enable flow control
WifiHelper()
Create a Wifi helper in an empty state: all its parameters must be set before calling ns3::WifiHelper...
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the MAC queue selected for a given packet.
create MAC layers for a ns3::WifiNetDevice.
create PHY objects
Definition wifi-helper.h:40
void SetPcapCaptureType(PcapCaptureType type)
Set the PCAP capture type to be used.
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ASCII trace output on the indicated net device.
WifiPhyHelper(uint8_t nLinks=1)
Constructor.
static void PcapSniffTxEvent(const std::shared_ptr< PcapFilesInfo > &info, uint8_t phyId, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId=SU_STA_ID)
void Set(std::string name, const AttributeValue &v)
~WifiPhyHelper() override
void DisablePreambleDetectionModel()
Disable the preamble detection model on all links.
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
void SetInterferenceHelper(std::string type, Args &&... args)
Helper function used to set the interference helper.
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output the indicated net device.
PcapHelper::DataLinkType m_pcapDlt
PCAP data link type.
std::vector< ObjectFactory > m_frameCaptureModel
frame capture model
std::vector< ObjectFactory > m_preambleDetectionModel
preamble detection model
PcapHelper::DataLinkType GetPcapDataLinkType() const
Get the data link type of PCAP traces to be used.
void SetFrameCaptureModel(std::string type, Args &&... args)
Helper function used to set the frame capture model.
PcapCaptureType m_pcapType
PCAP capture type.
PcapCaptureType GetPcapCaptureType() const
Get the PCAP capture type to be used.
std::vector< ObjectFactory > m_phys
PHY objects.
static void PcapSniffRxEvent(const std::shared_ptr< PcapFilesInfo > &info, uint8_t phyId, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId=SU_STA_ID)
void SetPreambleDetectionModel(std::string type, Args &&... args)
Helper function used to set the preamble detection model.
static RadiotapHeader GetRadiotapHeader(Ptr< Packet > packet, uint16_t channelFreqMhz, uint8_t p20Index, const WifiTxVector &txVector, MpduInfo aMpdu, uint16_t staId, std::optional< SignalNoiseDbm > signalNoise=std::nullopt)
Get the Radiotap header for a received packet.
static Ptr< PcapFileWrapper > GetOrCreatePcapFile(const std::shared_ptr< PcapFilesInfo > &info, uint8_t phyId)
Get the PCAP file to write to from a list of PCAP files indexed by PHY ID.
SupportedPcapDataLinkTypes
An enumeration of the pcap data link types (DLTs) which this helper supports.
@ DLT_IEEE802_11
IEEE 802.11 Wireless LAN headers on packets.
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
@ DLT_PRISM_HEADER
Include Prism monitor mode information.
std::vector< ObjectFactory > m_errorRateModel
error rate model
virtual std::vector< Ptr< WifiPhy > > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const =0
PcapCaptureType
An enumeration of the PCAP capture types.
@ PCAP_PER_PHY
Single capture file per PHY.
@ PCAP_PER_DEVICE
Single capture file per device.
@ PCAP_PER_LINK
Single capture file per link.
ObjectFactory m_interferenceHelper
interference helper
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
Definition first.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LogLevel
Logging severity classes and levels.
Definition log.h:83
@ LOG_LEVEL_ALL
Print everything.
Definition log.h:105
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
MpduInfo structure.
Definition wifi-types.h:72
SignalNoiseDbm structure.
Definition wifi-types.h:65
structure holding the information about PCAP files generated for a given device
std::string commonFilename
common file name of the PCAP files
WifiPhyHelper::PcapCaptureType pcapType
the selected PCAP capture type
Ptr< WifiNetDevice > device
the WifiNetDevice for which the PCAP files are generated
std::map< uint8_t, Ptr< PcapFileWrapper > > files
PCAP files indexed by PHY ID.
PcapFilesInfo(const std::string &filename, PcapHelper::DataLinkType dlt, WifiPhyHelper::PcapCaptureType type, Ptr< WifiNetDevice > dev)
Constructor.
PcapHelper::DataLinkType pcapDlt
the selected data link type of the pcap file