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
22
namespace
ns3 {
23
24
CapabilityInformation::CapabilityInformation
()
25
: m_capability (0)
26
{
27
}
28
29
void
30
CapabilityInformation::SetEss
(
void
)
31
{
32
Set
(0);
33
Clear
(1);
34
}
35
void
36
CapabilityInformation::SetIbss
(
void
)
37
{
38
Clear
(0);
39
Set
(1);
40
}
41
42
bool
43
CapabilityInformation::IsEss
(
void
)
const
44
{
45
return
Is
(0);
46
}
47
bool
48
CapabilityInformation::IsIbss
(
void
)
const
49
{
50
return
Is
(1);
51
}
52
53
void
54
CapabilityInformation::Set
(uint8_t n)
55
{
56
uint32_t mask = 1 << n;
57
m_capability
|= mask;
58
}
59
60
void
61
CapabilityInformation::Clear
(uint8_t n)
62
{
63
uint32_t mask = 1 << n;
64
m_capability
&= ~mask;
65
}
66
67
bool
68
CapabilityInformation::Is
(uint8_t n)
const
69
{
70
uint32_t mask = 1 << n;
71
return
(
m_capability
& mask) == mask;
72
}
73
74
75
uint32_t
76
CapabilityInformation::GetSerializedSize
(
void
)
const
77
{
78
return
2;
79
}
80
Buffer::Iterator
81
CapabilityInformation::Serialize
(
Buffer::Iterator
start
)
const
82
{
83
start.
WriteHtolsbU16
(
m_capability
);
84
return
start
;
85
}
86
Buffer::Iterator
87
CapabilityInformation::Deserialize
(
Buffer::Iterator
start
)
88
{
89
m_capability
= start.
ReadLsbtohU16
();
90
return
start
;
91
}
92
93
94
}
// namespace ns3
src
wifi
model
capability-information.cc
Generated on Fri Dec 21 2012 19:00:48 for ns-3 by
1.8.1.2