A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
capability-information.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#include "
capability-information.h
"
22
#include "ns3/log.h"
23
24
namespace
ns3 {
25
26
NS_LOG_COMPONENT_DEFINE
(
"CapabilityInformation"
);
27
28
CapabilityInformation::CapabilityInformation
()
29
: m_capability (0)
30
{
31
NS_LOG_FUNCTION
(
this
);
32
}
33
34
void
35
CapabilityInformation::SetEss
(
void
)
36
{
37
NS_LOG_FUNCTION
(
this
);
38
Set
(0);
39
Clear
(1);
40
}
41
42
void
43
CapabilityInformation::SetIbss
(
void
)
44
{
45
NS_LOG_FUNCTION
(
this
);
46
Clear
(0);
47
Set
(1);
48
}
49
50
void
51
CapabilityInformation::SetShortPreamble
(
bool
shortPreamble)
52
{
53
NS_LOG_FUNCTION
(
this
);
54
if
(shortPreamble)
55
{
56
Set
(5);
57
}
58
}
59
60
void
61
CapabilityInformation::SetShortSlotTime
(
bool
shortSlotTime)
62
{
63
NS_LOG_FUNCTION
(
this
);
64
if
(shortSlotTime)
65
{
66
Set
(10);
67
}
68
}
69
70
bool
71
CapabilityInformation::IsEss
(
void
)
const
72
{
73
NS_LOG_FUNCTION
(
this
);
74
return
Is
(0);
75
}
76
77
bool
78
CapabilityInformation::IsIbss
(
void
)
const
79
{
80
NS_LOG_FUNCTION
(
this
);
81
return
Is
(1);
82
}
83
84
bool
85
CapabilityInformation::IsShortPreamble
(
void
)
const
86
{
87
NS_LOG_FUNCTION
(
this
);
88
return
Is
(5);
89
}
90
91
bool
92
CapabilityInformation::IsShortSlotTime
(
void
)
const
93
{
94
NS_LOG_FUNCTION
(
this
);
95
return
Is
(10);
96
}
97
98
void
99
CapabilityInformation::Set
(uint8_t n)
100
{
101
NS_LOG_FUNCTION
(
this
<< static_cast<uint32_t> (n));
102
uint32_t mask = 1 << n;
103
m_capability
|= mask;
104
}
105
106
void
107
CapabilityInformation::Clear
(uint8_t n)
108
{
109
NS_LOG_FUNCTION
(
this
<< static_cast<uint32_t> (n));
110
uint32_t mask = 1 << n;
111
m_capability
&= ~mask;
112
}
113
114
bool
115
CapabilityInformation::Is
(uint8_t n)
const
116
{
117
NS_LOG_FUNCTION
(
this
<< static_cast<uint32_t> (n));
118
uint32_t mask = 1 << n;
119
return
(
m_capability
& mask) == mask;
120
}
121
122
uint32_t
123
CapabilityInformation::GetSerializedSize
(
void
)
const
124
{
125
NS_LOG_FUNCTION
(
this
);
126
return
2;
127
}
128
129
Buffer::Iterator
130
CapabilityInformation::Serialize
(
Buffer::Iterator
start
)
const
131
{
132
NS_LOG_FUNCTION
(
this
<< &start);
133
start.
WriteHtolsbU16
(
m_capability
);
134
return
start
;
135
}
136
137
Buffer::Iterator
138
CapabilityInformation::Deserialize
(
Buffer::Iterator
start
)
139
{
140
NS_LOG_FUNCTION
(
this
<< &start);
141
m_capability
= start.
ReadLsbtohU16
();
142
return
start
;
143
}
144
145
}
//namespace ns3
ns3::CapabilityInformation::IsIbss
bool IsIbss(void) const
Check if the Independent BSS (IBSS) bit in the capability information field is set to 1...
Definition:
capability-information.cc:78
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Definition:
log-macros-enabled.h:213
ns3::CapabilityInformation::SetIbss
void SetIbss(void)
Set the Independent BSS (IBSS) bit in the capability information field.
Definition:
capability-information.cc:43
ns3::CapabilityInformation::Deserialize
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize capability information from the given buffer.
Definition:
capability-information.cc:138
ns3::CapabilityInformation::m_capability
uint16_t m_capability
Definition:
capability-information.h:146
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:201
ns3::CapabilityInformation::Serialize
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize capability information to the given buffer.
Definition:
capability-information.cc:130
visualizer.core.start
def start
Definition:
core.py:1482
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:98
ns3::CapabilityInformation::Is
bool Is(uint8_t n) const
Check if bit n is set to 1.
Definition:
capability-information.cc:115
ns3::CapabilityInformation::SetEss
void SetEss(void)
Set the Extended Service Set (ESS) bit in the capability information field.
Definition:
capability-information.cc:35
capability-information.h
ns3::CapabilityInformation::CapabilityInformation
CapabilityInformation()
Definition:
capability-information.cc:28
ns3::CapabilityInformation::SetShortPreamble
void SetShortPreamble(bool shortPreamble)
Set the short preamble bit in the capability information field.
Definition:
capability-information.cc:51
ns3::CapabilityInformation::Set
void Set(uint8_t n)
Set bit n to 1.
Definition:
capability-information.cc:99
ns3::Buffer::Iterator::WriteHtolsbU16
void WriteHtolsbU16(uint16_t data)
Definition:
buffer.cc:910
ns3::CapabilityInformation::IsShortSlotTime
bool IsShortSlotTime(void) const
Check if the short slot time in the capability information field is set to 1.
Definition:
capability-information.cc:92
ns3::CapabilityInformation::IsEss
bool IsEss(void) const
Check if the Extended Service Set (ESS) bit in the capability information field is set to 1...
Definition:
capability-information.cc:71
ns3::CapabilityInformation::GetSerializedSize
uint32_t GetSerializedSize(void) const
Return the serialized size of capability information.
Definition:
capability-information.cc:123
ns3::Buffer::Iterator::ReadLsbtohU16
uint16_t ReadLsbtohU16(void)
Definition:
buffer.cc:1065
ns3::CapabilityInformation::Clear
void Clear(uint8_t n)
Set bit n to 0.
Definition:
capability-information.cc:107
ns3::CapabilityInformation::SetShortSlotTime
void SetShortSlotTime(bool shortSlotTime)
Set the short slot time bit in the capability information field.
Definition:
capability-information.cc:61
ns3::CapabilityInformation::IsShortPreamble
bool IsShortPreamble(void) const
Check if the short preamble bit in the capability information field is set to 1.
Definition:
capability-information.cc:85
src
wifi
model
capability-information.cc
Generated on Wed Jul 6 2016 17:11:42 for ns-3 by
1.8.6