A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
capability-information.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#include "
capability-information.h
"
10
11
namespace
ns3
12
{
13
14
CapabilityInformation::CapabilityInformation
()
15
: m_capability(0)
16
{
17
}
18
19
void
20
CapabilityInformation::SetEss
()
21
{
22
Set
(0);
23
Clear
(1);
24
}
25
26
void
27
CapabilityInformation::SetIbss
()
28
{
29
Clear
(0);
30
Set
(1);
31
}
32
33
void
34
CapabilityInformation::SetShortPreamble
(
bool
shortPreamble)
35
{
36
if
(shortPreamble)
37
{
38
Set
(5);
39
}
40
}
41
42
void
43
CapabilityInformation::SetShortSlotTime
(
bool
shortSlotTime)
44
{
45
if
(shortSlotTime)
46
{
47
Set
(10);
48
}
49
}
50
51
void
52
CapabilityInformation::SetCfPollable
()
53
{
54
Set
(2);
55
}
56
57
bool
58
CapabilityInformation::IsEss
()
const
59
{
60
return
Is
(0);
61
}
62
63
bool
64
CapabilityInformation::IsIbss
()
const
65
{
66
return
Is
(1);
67
}
68
69
bool
70
CapabilityInformation::IsShortPreamble
()
const
71
{
72
return
Is
(5);
73
}
74
75
bool
76
CapabilityInformation::IsShortSlotTime
()
const
77
{
78
return
Is
(10);
79
}
80
81
bool
82
CapabilityInformation::IsCfPollable
()
const
83
{
84
return
Is
(2);
85
}
86
87
void
88
CapabilityInformation::Set
(uint8_t n)
89
{
90
uint32_t
mask = 1 << n;
91
m_capability
|= mask;
92
}
93
94
void
95
CapabilityInformation::Clear
(uint8_t n)
96
{
97
uint32_t
mask = 1 << n;
98
m_capability
&= ~mask;
99
}
100
101
bool
102
CapabilityInformation::Is
(uint8_t n)
const
103
{
104
uint32_t
mask = 1 << n;
105
return
(
m_capability
& mask) == mask;
106
}
107
108
uint32_t
109
CapabilityInformation::GetSerializedSize
()
const
110
{
111
return
2;
112
}
113
114
Buffer::Iterator
115
CapabilityInformation::Serialize
(
Buffer::Iterator
start)
const
116
{
117
start.
WriteHtolsbU16
(
m_capability
);
118
return
start;
119
}
120
121
Buffer::Iterator
122
CapabilityInformation::Deserialize
(
Buffer::Iterator
start)
123
{
124
m_capability
= start.ReadLsbtohU16();
125
return
start;
126
}
127
128
}
// namespace ns3
capability-information.h
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Buffer::Iterator::WriteHtolsbU16
void WriteHtolsbU16(uint16_t data)
Definition
buffer.cc:891
ns3::CapabilityInformation::SetEss
void SetEss()
Set the Extended Service Set (ESS) bit in the capability information field.
Definition
capability-information.cc:20
ns3::CapabilityInformation::IsShortSlotTime
bool IsShortSlotTime() const
Check if the short slot time in the capability information field is set to 1.
Definition
capability-information.cc:76
ns3::CapabilityInformation::m_capability
uint16_t m_capability
capability
Definition
capability-information.h:147
ns3::CapabilityInformation::GetSerializedSize
uint32_t GetSerializedSize() const
Return the serialized size of capability information.
Definition
capability-information.cc:109
ns3::CapabilityInformation::CapabilityInformation
CapabilityInformation()
Definition
capability-information.cc:14
ns3::CapabilityInformation::SetCfPollable
void SetCfPollable()
Set the CF-Pollable bit in the capability information field.
Definition
capability-information.cc:52
ns3::CapabilityInformation::Serialize
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize capability information to the given buffer.
Definition
capability-information.cc:115
ns3::CapabilityInformation::Set
void Set(uint8_t n)
Set bit n to 1.
Definition
capability-information.cc:88
ns3::CapabilityInformation::SetShortSlotTime
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
Definition
capability-information.cc:43
ns3::CapabilityInformation::IsEss
bool IsEss() const
Check if the Extended Service Set (ESS) bit in the capability information field is set to 1.
Definition
capability-information.cc:58
ns3::CapabilityInformation::IsIbss
bool IsIbss() const
Check if the Independent BSS (IBSS) bit in the capability information field is set to 1.
Definition
capability-information.cc:64
ns3::CapabilityInformation::Clear
void Clear(uint8_t n)
Set bit n to 0.
Definition
capability-information.cc:95
ns3::CapabilityInformation::SetShortPreamble
void SetShortPreamble(bool shortPreamble)
Set the short preamble bit in the capability information field.
Definition
capability-information.cc:34
ns3::CapabilityInformation::Is
bool Is(uint8_t n) const
Check if bit n is set to 1.
Definition
capability-information.cc:102
ns3::CapabilityInformation::SetIbss
void SetIbss()
Set the Independent BSS (IBSS) bit in the capability information field.
Definition
capability-information.cc:27
ns3::CapabilityInformation::Deserialize
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize capability information from the given buffer.
Definition
capability-information.cc:122
ns3::CapabilityInformation::IsCfPollable
bool IsCfPollable() const
Check if the CF-Pollable bit in the capability information field is set to 1.
Definition
capability-information.cc:82
ns3::CapabilityInformation::IsShortPreamble
bool IsShortPreamble() const
Check if the short preamble bit in the capability information field is set to 1.
Definition
capability-information.cc:70
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
wifi
model
capability-information.cc
Generated on Fri Nov 8 2024 13:59:07 for ns-3 by
1.11.0