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
#include "
capability-information.h
"
21
#include "ns3/log.h"
22
23
NS_LOG_COMPONENT_DEFINE
(
"CapabilityInformation"
);
24
25
namespace
ns3 {
26
27
CapabilityInformation::CapabilityInformation
()
28
: m_capability (0)
29
{
30
NS_LOG_FUNCTION
(
this
);
31
}
32
33
void
34
CapabilityInformation::SetEss
(
void
)
35
{
36
NS_LOG_FUNCTION
(
this
);
37
Set
(0);
38
Clear
(1);
39
}
40
void
41
CapabilityInformation::SetIbss
(
void
)
42
{
43
NS_LOG_FUNCTION
(
this
);
44
Clear
(0);
45
Set
(1);
46
}
47
48
bool
49
CapabilityInformation::IsEss
(
void
)
const
50
{
51
NS_LOG_FUNCTION
(
this
);
52
return
Is
(0);
53
}
54
bool
55
CapabilityInformation::IsIbss
(
void
)
const
56
{
57
NS_LOG_FUNCTION
(
this
);
58
return
Is
(1);
59
}
60
61
void
62
CapabilityInformation::Set
(uint8_t n)
63
{
64
NS_LOG_FUNCTION
(
this
<< static_cast<uint32_t> (n));
65
uint32_t mask = 1 << n;
66
m_capability
|= mask;
67
}
68
69
void
70
CapabilityInformation::Clear
(uint8_t n)
71
{
72
NS_LOG_FUNCTION
(
this
<< static_cast<uint32_t> (n));
73
uint32_t mask = 1 << n;
74
m_capability
&= ~mask;
75
}
76
77
bool
78
CapabilityInformation::Is
(uint8_t n)
const
79
{
80
NS_LOG_FUNCTION
(
this
<< static_cast<uint32_t> (n));
81
uint32_t mask = 1 << n;
82
return
(
m_capability
& mask) == mask;
83
}
84
85
86
uint32_t
87
CapabilityInformation::GetSerializedSize
(
void
)
const
88
{
89
NS_LOG_FUNCTION
(
this
);
90
return
2;
91
}
92
Buffer::Iterator
93
CapabilityInformation::Serialize
(
Buffer::Iterator
start
)
const
94
{
95
NS_LOG_FUNCTION
(
this
<< &start);
96
start.
WriteHtolsbU16
(
m_capability
);
97
return
start
;
98
}
99
Buffer::Iterator
100
CapabilityInformation::Deserialize
(
Buffer::Iterator
start
)
101
{
102
NS_LOG_FUNCTION
(
this
<< &start);
103
m_capability
= start.
ReadLsbtohU16
();
104
return
start
;
105
}
106
107
108
}
// 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:55
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
Definition:
log.h:345
ns3::CapabilityInformation::SetIbss
void SetIbss(void)
Set the Independent BSS (IBSS) bit in the capability information field.
Definition:
capability-information.cc:41
ns3::CapabilityInformation::Deserialize
Buffer::Iterator Deserialize(Buffer::Iterator start)
Deserialize capability information from the given buffer.
Definition:
capability-information.cc:100
ns3::CapabilityInformation::m_capability
uint16_t m_capability
Definition:
capability-information.h:110
ns3::CapabilityInformation::Serialize
Buffer::Iterator Serialize(Buffer::Iterator start) const
Serialize capability information to the given buffer.
Definition:
capability-information.cc:93
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:78
ns3::CapabilityInformation::SetEss
void SetEss(void)
Set the Extended Service Set (ESS) bit in the capability information field.
Definition:
capability-information.cc:34
capability-information.h
ns3::CapabilityInformation::CapabilityInformation
CapabilityInformation()
Definition:
capability-information.cc:27
NS_LOG_COMPONENT_DEFINE
NS_LOG_COMPONENT_DEFINE("CapabilityInformation")
ns3::CapabilityInformation::Set
void Set(uint8_t n)
Set bit n to 1.
Definition:
capability-information.cc:62
ns3::Buffer::Iterator::WriteHtolsbU16
void WriteHtolsbU16(uint16_t data)
Definition:
buffer.cc:935
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:49
ns3::CapabilityInformation::GetSerializedSize
uint32_t GetSerializedSize(void) const
Return the serialized size of capability information.
Definition:
capability-information.cc:87
ns3::Buffer::Iterator::ReadLsbtohU16
uint16_t ReadLsbtohU16(void)
Definition:
buffer.cc:1090
ns3::CapabilityInformation::Clear
void Clear(uint8_t n)
Set bit n to 0.
Definition:
capability-information.cc:70
src
wifi
model
capability-information.cc
Generated on Sat Apr 19 2014 14:07:10 for ns-3 by
1.8.6