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
non-inheritance.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2023 Universita' degli Studi di Napoli Federico II
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Stefano Avallone <stavallo@unina.it>
7
*/
8
9
#include "
non-inheritance.h
"
10
11
#include <algorithm>
12
#include <iterator>
13
14
namespace
ns3
15
{
16
17
WifiInformationElementId
18
NonInheritance::ElementId
()
const
19
{
20
return
IE_EXTENSION
;
21
}
22
23
WifiInformationElementId
24
NonInheritance::ElementIdExt
()
const
25
{
26
return
IE_EXT_NON_INHERITANCE
;
27
}
28
29
void
30
NonInheritance::Print
(std::ostream& os)
const
31
{
32
os <<
"NonInheritance=["
;
33
std::copy(
m_elemIdList
.cbegin(),
m_elemIdList
.cend(), std::ostream_iterator<uint16_t>(os,
" "
));
34
os <<
"]["
;
35
std::copy(
m_elemIdExtList
.cbegin(),
36
m_elemIdExtList
.cend(),
37
std::ostream_iterator<uint16_t>(os,
" "
));
38
os <<
"]"
;
39
}
40
41
uint16_t
42
NonInheritance::GetInformationFieldSize
()
const
43
{
44
uint16_t size = 1;
// Element ID Extension
45
size += 1
/* Length */
+
m_elemIdList
.size();
46
size += 1
/* Length */
+
m_elemIdExtList
.size();
47
return
size;
48
}
49
50
void
51
NonInheritance::SerializeInformationField
(
Buffer::Iterator
start)
const
52
{
53
start.WriteU8(
m_elemIdList
.size());
54
for
(
const
auto
id
:
m_elemIdList
)
55
{
56
start.WriteU8(
id
);
57
}
58
start.WriteU8(
m_elemIdExtList
.size());
59
for
(
const
auto
id
:
m_elemIdExtList
)
60
{
61
start.WriteU8(
id
);
62
}
63
}
64
65
uint16_t
66
NonInheritance::DeserializeInformationField
(
Buffer::Iterator
start, uint16_t length)
67
{
68
auto
i = start;
69
auto
count = i.ReadU8();
70
for
(uint8_t j = 0; j < count; j++)
71
{
72
m_elemIdList
.emplace(i.ReadU8());
73
}
74
count = i.ReadU8();
75
for
(uint8_t j = 0; j < count; j++)
76
{
77
m_elemIdExtList
.emplace(i.ReadU8());
78
}
79
return
i.GetDistanceFrom(start);
80
}
81
82
void
83
NonInheritance::Add
(uint8_t elemId, uint8_t elemIdExt)
84
{
85
elemId !=
IE_EXTENSION
?
m_elemIdList
.insert(elemId) :
m_elemIdExtList
.insert(elemIdExt);
86
}
87
88
bool
89
NonInheritance::IsPresent
(uint8_t elemId, uint8_t elemIdExt)
const
90
{
91
return
elemId !=
IE_EXTENSION
?
m_elemIdList
.count(elemId) == 1
92
:
m_elemIdExtList
.count(elemIdExt) == 1;
93
}
94
95
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::NonInheritance::DeserializeInformationField
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override
Deserialize information (i.e., the body of the IE, not including the Element ID and length octets)
Definition
non-inheritance.cc:66
ns3::NonInheritance::m_elemIdList
std::set< uint8_t > m_elemIdList
list of unique Element ID values (in increasing order)
Definition
non-inheritance.h:47
ns3::NonInheritance::IsPresent
bool IsPresent(uint8_t elemId, uint8_t elemIdExt=0) const
Definition
non-inheritance.cc:89
ns3::NonInheritance::Add
void Add(uint8_t elemId, uint8_t elemIdExt=0)
Add the Information Element specified by the given Element ID and Element ID Extension.
Definition
non-inheritance.cc:83
ns3::NonInheritance::Print
void Print(std::ostream &os) const override
Generate human-readable form of IE.
Definition
non-inheritance.cc:30
ns3::NonInheritance::GetInformationFieldSize
uint16_t GetInformationFieldSize() const override
Length of serialized information (i.e., the length of the body of the IE, not including the Element I...
Definition
non-inheritance.cc:42
ns3::NonInheritance::SerializeInformationField
void SerializeInformationField(Buffer::Iterator start) const override
Serialize information (i.e., the body of the IE, not including the Element ID and length octets)
Definition
non-inheritance.cc:51
ns3::NonInheritance::ElementIdExt
WifiInformationElementId ElementIdExt() const override
Get the wifi information element ID extension.
Definition
non-inheritance.cc:24
ns3::NonInheritance::ElementId
WifiInformationElementId ElementId() const override
Get the wifi information element ID.
Definition
non-inheritance.cc:18
ns3::NonInheritance::m_elemIdExtList
std::set< uint8_t > m_elemIdExtList
list of unique Element ID Extension values
Definition
non-inheritance.h:48
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiInformationElementId
uint8_t WifiInformationElementId
This type is used to represent an Information Element ID.
Definition
wifi-information-element.h:34
non-inheritance.h
IE_EXTENSION
#define IE_EXTENSION
Definition
wifi-information-element.h:218
IE_EXT_NON_INHERITANCE
#define IE_EXT_NON_INHERITANCE
Definition
wifi-information-element.h:225
src
wifi
model
non-inheritance.cc
Generated on Fri Nov 8 2024 13:59:07 for ns-3 by
1.11.0