A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-protection.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#ifndef WIFI_PROTECTION_H
10#define WIFI_PROTECTION_H
11
12#include "ctrl-headers.h"
13#include "wifi-tx-vector.h"
14
15#include "ns3/nstime.h"
16
17#include <memory>
18#include <optional>
19
20namespace ns3
21{
22
23/**
24 * @ingroup wifi
25 *
26 * WifiProtection is an abstract base struct. Each derived struct defines a protection
27 * method and stores the information needed to perform protection according to
28 * that method.
29 */
31{
32 /**
33 * @enum Method
34 * @brief Available protection methods
35 */
43
44 /**
45 * Constructor.
46 * @param m the protection method for this object
47 */
49 virtual ~WifiProtection();
50
51 /**
52 * Clone this object.
53 * @return a pointer to the cloned object
54 */
55 virtual std::unique_ptr<WifiProtection> Copy() const = 0;
56
57 /**
58 * @brief Print the object contents.
59 * @param os output stream in which the data should be printed.
60 */
61 virtual void Print(std::ostream& os) const = 0;
62
63 const Method method; //!< protection method
64 std::optional<Time> protectionTime; //!< time required by the protection method
65};
66
67/**
68 * @ingroup wifi
69 *
70 * WifiNoProtection specifies that no protection method is used.
71 */
73{
75
76 std::unique_ptr<WifiProtection> Copy() const override;
77 void Print(std::ostream& os) const override;
78};
79
80/**
81 * @ingroup wifi
82 *
83 * WifiRtsCtsProtection specifies that RTS/CTS protection method is used.
84 */
86{
88
89 std::unique_ptr<WifiProtection> Copy() const override;
90 void Print(std::ostream& os) const override;
91
92 WifiTxVector rtsTxVector; //!< RTS TXVECTOR
93 WifiTxVector ctsTxVector; //!< CTS TXVECTOR
94};
95
96/**
97 * @ingroup wifi
98 *
99 * WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
100 */
102{
104
105 std::unique_ptr<WifiProtection> Copy() const override;
106 void Print(std::ostream& os) const override;
107
108 WifiTxVector ctsTxVector; //!< CTS TXVECTOR
109};
110
111/**
112 * @ingroup wifi
113 *
114 * WifiMuRtsCtsProtection specifies that MU-RTS/CTS protection method is used.
115 */
117{
119
120 // Overridden from WifiProtection
121 std::unique_ptr<WifiProtection> Copy() const override;
122 void Print(std::ostream& os) const override;
123
125 WifiTxVector muRtsTxVector; //!< MU-RTS TXVECTOR
126};
127
128/**
129 * @brief Stream insertion operator.
130 *
131 * @param os the output stream
132 * @param protection the protection method
133 * @returns a reference to the stream
134 */
135std::ostream& operator<<(std::ostream& os, const WifiProtection* protection);
136
137} // namespace ns3
138
139#endif /* WIFI_PROTECTION_H */
Headers for Trigger frames.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.
WifiTxVector ctsTxVector
CTS TXVECTOR.
void Print(std::ostream &os) const override
Print the object contents.
WifiMuRtsCtsProtection specifies that MU-RTS/CTS protection method is used.
CtrlTriggerHeader muRts
MU-RTS.
WifiTxVector muRtsTxVector
MU-RTS TXVECTOR.
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.
void Print(std::ostream &os) const override
Print the object contents.
WifiNoProtection specifies that no protection method is used.
void Print(std::ostream &os) const override
Print the object contents.
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.
WifiProtection is an abstract base struct.
virtual std::unique_ptr< WifiProtection > Copy() const =0
Clone this object.
std::optional< Time > protectionTime
time required by the protection method
Method
Available protection methods.
virtual void Print(std::ostream &os) const =0
Print the object contents.
const Method method
protection method
WifiRtsCtsProtection specifies that RTS/CTS protection method is used.
void Print(std::ostream &os) const override
Print the object contents.
WifiTxVector ctsTxVector
CTS TXVECTOR.
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.
WifiTxVector rtsTxVector
RTS TXVECTOR.