A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-protection.cc
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#include "wifi-protection.h"
21
22#include "wifi-utils.h"
23
24namespace ns3
25{
26
27/*
28 * WifiProtection
29 */
30
32 : method(m)
33{
34}
35
37{
38}
39
40/*
41 * WifiNoProtection
42 */
43
45 : WifiProtection(NONE)
46{
48}
49
50std::unique_ptr<WifiProtection>
52{
53 return std::make_unique<WifiNoProtection>(*this);
54}
55
56void
57WifiNoProtection::Print(std::ostream& os) const
58{
59 os << "NONE";
60}
61
62/*
63 * WifiRtsCtsProtection
64 */
65
67 : WifiProtection(RTS_CTS)
68{
69}
70
71std::unique_ptr<WifiProtection>
73{
74 return std::make_unique<WifiRtsCtsProtection>(*this);
75}
76
77void
78WifiRtsCtsProtection::Print(std::ostream& os) const
79{
80 os << "RTS_CTS";
81}
82
83/*
84 * WifiCtsToSelfProtection
85 */
86
88 : WifiProtection(CTS_TO_SELF)
89{
90}
91
92std::unique_ptr<WifiProtection>
94{
95 return std::make_unique<WifiCtsToSelfProtection>(*this);
96}
97
98void
99WifiCtsToSelfProtection::Print(std::ostream& os) const
100{
101 os << "CTS_TO_SELF";
102}
103
104/*
105 * WifiMuRtsCtsProtection
106 */
107
109 : WifiProtection(MU_RTS_CTS)
110{
111}
112
113std::unique_ptr<WifiProtection>
115{
116 return std::make_unique<WifiMuRtsCtsProtection>(*this);
117}
118
119void
120WifiMuRtsCtsProtection::Print(std::ostream& os) const
121{
122 os << "MU_RTS_CTS";
123}
124
125std::ostream&
126operator<<(std::ostream& os, const WifiProtection* protection)
127{
128 protection->Print(os);
129 return os;
130}
131
132} // namespace ns3
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1319
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
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.
void Print(std::ostream &os) const override
Print the object contents.
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.
void Print(std::ostream &os) const override
Print the object contents.
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.
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.
WifiProtection(Method m)
Constructor.
void Print(std::ostream &os) const override
Print the object contents.
std::unique_ptr< WifiProtection > Copy() const override
Clone this object.