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 * 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 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef WIFI_PROTECTION_H
21#define WIFI_PROTECTION_H
22
23#include "ctrl-headers.h"
24#include "wifi-tx-vector.h"
25
26#include "ns3/nstime.h"
27
28#include <memory>
29#include <optional>
30
31namespace ns3
32{
33
34/**
35 * \ingroup wifi
36 *
37 * WifiProtection is an abstract base struct. Each derived struct defines a protection
38 * method and stores the information needed to perform protection according to
39 * that method.
40 */
42{
43 /**
44 * \enum Method
45 * \brief Available protection methods
46 */
47 enum Method
48 {
49 NONE = 0,
53 };
54
55 /**
56 * Constructor.
57 * \param m the protection method for this object
58 */
60 virtual ~WifiProtection();
61
62 /**
63 * Clone this object.
64 * \return a pointer to the cloned object
65 */
66 virtual std::unique_ptr<WifiProtection> Copy() const = 0;
67
68 /**
69 * \brief Print the object contents.
70 * \param os output stream in which the data should be printed.
71 */
72 virtual void Print(std::ostream& os) const = 0;
73
74 const Method method; //!< protection method
75 std::optional<Time> protectionTime; //!< time required by the protection method
76};
77
78/**
79 * \ingroup wifi
80 *
81 * WifiNoProtection specifies that no protection method is used.
82 */
84{
86
87 std::unique_ptr<WifiProtection> Copy() const override;
88 void Print(std::ostream& os) const override;
89};
90
91/**
92 * \ingroup wifi
93 *
94 * WifiRtsCtsProtection specifies that RTS/CTS protection method is used.
95 */
97{
99
100 std::unique_ptr<WifiProtection> Copy() const override;
101 void Print(std::ostream& os) const override;
102
103 WifiTxVector rtsTxVector; //!< RTS TXVECTOR
104 WifiTxVector ctsTxVector; //!< CTS TXVECTOR
105};
106
107/**
108 * \ingroup wifi
109 *
110 * WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
111 */
113{
115
116 std::unique_ptr<WifiProtection> Copy() const override;
117 void Print(std::ostream& os) const override;
118
119 WifiTxVector ctsTxVector; //!< CTS TXVECTOR
120};
121
122/**
123 * \ingroup wifi
124 *
125 * WifiMuRtsCtsProtection specifies that MU-RTS/CTS protection method is used.
126 */
128{
130
131 // Overridden from WifiProtection
132 std::unique_ptr<WifiProtection> Copy() const override;
133 void Print(std::ostream& os) const override;
134
136 WifiTxVector muRtsTxVector; //!< MU-RTS TXVECTOR
137};
138
139/**
140 * \brief Stream insertion operator.
141 *
142 * \param os the output stream
143 * \param protection the protection method
144 * \returns a reference to the stream
145 */
146std::ostream& operator<<(std::ostream& os, const WifiProtection* protection);
147
148} // namespace ns3
149
150#endif /* WIFI_PROTECTION_H */
Headers for Trigger frames.
Definition: ctrl-headers.h:942
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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:159
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.