A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
wifi-protection.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Stefano Avallone <stavallo@unina.it>
19
*/
20
21
#include "
wifi-protection.h
"
22
#include "
wifi-utils.h
"
23
24
namespace
ns3
{
25
26
/*
27
* WifiProtection
28
*/
29
30
WifiProtection::WifiProtection
(
Method
m)
31
: method (m),
32
protectionTime (
Time
::
Min
())
// uninitialized
33
{
34
}
35
36
WifiProtection::~WifiProtection
()
37
{
38
}
39
40
41
/*
42
* WifiNoProtection
43
*/
44
45
WifiNoProtection::WifiNoProtection
()
46
:
WifiProtection
(
NONE
)
47
{
48
protectionTime
=
Seconds
(0);
49
}
50
51
std::unique_ptr<WifiProtection>
52
WifiNoProtection::Copy
(
void
)
const
53
{
54
return
std::unique_ptr<WifiProtection> (
new
WifiNoProtection
(*
this
));
55
}
56
57
void
58
WifiNoProtection::Print
(std::ostream &os)
const
59
{
60
os <<
"NONE"
;
61
}
62
63
64
/*
65
* WifiRtsCtsProtection
66
*/
67
68
WifiRtsCtsProtection::WifiRtsCtsProtection
()
69
:
WifiProtection
(RTS_CTS)
70
{
71
}
72
73
std::unique_ptr<WifiProtection>
74
WifiRtsCtsProtection::Copy
(
void
)
const
75
{
76
return
std::unique_ptr<WifiProtection> (
new
WifiRtsCtsProtection
(*
this
));
77
}
78
79
void
80
WifiRtsCtsProtection::Print
(std::ostream &os)
const
81
{
82
os <<
"RTS_CTS"
;
83
}
84
85
86
/*
87
* WifiCtsToSelfProtection
88
*/
89
90
WifiCtsToSelfProtection::WifiCtsToSelfProtection
()
91
:
WifiProtection
(CTS_TO_SELF)
92
{
93
}
94
95
std::unique_ptr<WifiProtection>
96
WifiCtsToSelfProtection::Copy
(
void
)
const
97
{
98
return
std::unique_ptr<WifiProtection> (
new
WifiCtsToSelfProtection
(*
this
));
99
}
100
101
void
102
WifiCtsToSelfProtection::Print
(std::ostream &os)
const
103
{
104
os <<
"CTS_TO_SELF"
;
105
}
106
107
108
std::ostream &
operator <<
(std::ostream &os,
const
WifiProtection
* protection)
109
{
110
protection->
Print
(os);
111
return
os;
112
}
113
114
}
//namespace ns3
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:103
ns3::Min
int64x64_t Min(const int64x64_t &a, const int64x64_t &b)
Minimum.
Definition:
int64x64.h:218
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition:
nstime.h:1244
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MessageParserState::NONE
@ NONE
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition:
angles.cc:139
ns3::WifiCtsToSelfProtection
WifiCtsToSelfProtection specifies that CTS-to-self protection method is used.
Definition:
wifi-protection.h:113
ns3::WifiCtsToSelfProtection::Copy
std::unique_ptr< WifiProtection > Copy(void) const override
Clone this object.
Definition:
wifi-protection.cc:96
ns3::WifiCtsToSelfProtection::Print
void Print(std::ostream &os) const override
Print the object contents.
Definition:
wifi-protection.cc:102
ns3::WifiCtsToSelfProtection::WifiCtsToSelfProtection
WifiCtsToSelfProtection()
Definition:
wifi-protection.cc:90
ns3::WifiNoProtection
WifiNoProtection specifies that no protection method is used.
Definition:
wifi-protection.h:82
ns3::WifiNoProtection::Print
void Print(std::ostream &os) const override
Print the object contents.
Definition:
wifi-protection.cc:58
ns3::WifiNoProtection::WifiNoProtection
WifiNoProtection()
Definition:
wifi-protection.cc:45
ns3::WifiNoProtection::Copy
std::unique_ptr< WifiProtection > Copy(void) const override
Clone this object.
Definition:
wifi-protection.cc:52
ns3::WifiProtection
WifiProtection is an abstract base struct.
Definition:
wifi-protection.h:40
ns3::WifiProtection::protectionTime
Time protectionTime
time required by the protection method
Definition:
wifi-protection.h:72
ns3::WifiProtection::~WifiProtection
virtual ~WifiProtection()
Definition:
wifi-protection.cc:36
ns3::WifiProtection::Method
Method
Available protection methods.
Definition:
wifi-protection.h:46
ns3::WifiProtection::Print
virtual void Print(std::ostream &os) const =0
Print the object contents.
ns3::WifiProtection::WifiProtection
WifiProtection(Method m)
Constructor.
Definition:
wifi-protection.cc:30
ns3::WifiRtsCtsProtection
WifiRtsCtsProtection specifies that RTS/CTS protection method is used.
Definition:
wifi-protection.h:96
ns3::WifiRtsCtsProtection::Print
void Print(std::ostream &os) const override
Print the object contents.
Definition:
wifi-protection.cc:80
ns3::WifiRtsCtsProtection::Copy
std::unique_ptr< WifiProtection > Copy(void) const override
Clone this object.
Definition:
wifi-protection.cc:74
ns3::WifiRtsCtsProtection::WifiRtsCtsProtection
WifiRtsCtsProtection()
Definition:
wifi-protection.cc:68
wifi-protection.h
wifi-utils.h
src
wifi
model
wifi-protection.cc
Generated on Tue Feb 6 2024 19:21:30 for ns-3 by
1.9.1