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
30namespace ns3
31{
32
33/**
34 * \ingroup wifi
35 *
36 * WifiProtection is an abstract base struct. Each derived struct defines a protection
37 * method and stores the information needed to perform protection according to
38 * that method.
39 */
41{
42 /**
43 * \enum Method
44 * \brief Available protection methods
45 */
46 enum Method
47 {
48 NONE = 0,
52 };
53
54 /**
55 * Constructor.
56 * \param m the protection method for this object
57 */
59 virtual ~WifiProtection();
60
61 /**
62 * Clone this object.
63 * \return a pointer to the cloned object
64 */
65 virtual std::unique_ptr<WifiProtection> Copy() const = 0;
66
67 /**
68 * \brief Print the object contents.
69 * \param os output stream in which the data should be printed.
70 */
71 virtual void Print(std::ostream& os) const = 0;
72
73 const Method method; //!< protection method
74 Time protectionTime; //!< time required by the protection method
75};
76
77/**
78 * \ingroup wifi
79 *
80 * WifiNoProtection specifies that no protection method is used.
81 */
83{
85
86 std::unique_ptr<WifiProtection> Copy() const override;
87 void Print(std::ostream& os) const override;
88};
89
90/**
91 * \ingroup wifi
92 *
93 * WifiRtsCtsProtection specifies that RTS/CTS protection method is used.
94 */
96{
98
99 std::unique_ptr<WifiProtection> Copy() const override;
100 void Print(std::ostream& os) const override;
101
102 WifiTxVector rtsTxVector; //!< RTS TXVECTOR
103 WifiTxVector ctsTxVector; //!< CTS TXVECTOR
104};
105
106/**
107 * \ingroup wifi
108 *
109 * WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
110 */
112{
114
115 std::unique_ptr<WifiProtection> Copy() const override;
116 void Print(std::ostream& os) const override;
117
118 WifiTxVector ctsTxVector; //!< CTS TXVECTOR
119};
120
121/**
122 * \ingroup wifi
123 *
124 * WifiMuRtsCtsProtection specifies that MU-RTS/CTS protection method is used.
125 */
127{
129
130 // Overridden from WifiProtection
131 std::unique_ptr<WifiProtection> Copy() const override;
132 void Print(std::ostream& os) const override;
133
135 WifiTxVector muRtsTxVector; //!< MU-RTS TXVECTOR
136};
137
138/**
139 * \brief Stream insertion operator.
140 *
141 * \param os the output stream
142 * \param protection the protection method
143 * \returns a reference to the stream
144 */
145std::ostream& operator<<(std::ostream& os, const WifiProtection* protection);
146
147} // namespace ns3
148
149#endif /* WIFI_PROTECTION_H */
Headers for Trigger frames.
Definition: ctrl-headers.h:942
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
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.
Time protectionTime
time required by the protection method
virtual std::unique_ptr< WifiProtection > Copy() const =0
Clone this object.
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.