A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
Enumerator
a
b
c
d
e
f
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
Related Functions
:
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
Enumerator
c
e
i
l
o
r
s
t
v
Macros
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
flame-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 IITP RAS
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Kirill Andreev <andreev@iitp.ru>
18
*/
19
#include "
flame-header.h
"
20
21
#include "ns3/address-utils.h"
22
#include "ns3/assert.h"
23
#include "ns3/packet.h"
24
25
namespace
ns3
26
{
27
namespace
flame
28
{
29
30
NS_OBJECT_ENSURE_REGISTERED
(
FlameHeader
);
31
32
FlameHeader::FlameHeader
()
33
: m_cost(0),
34
m_seqno(0),
35
m_origDst(
Mac48Address
()),
36
m_origSrc(
Mac48Address
())
37
{
38
}
39
40
FlameHeader::~FlameHeader
()
41
{
42
}
43
44
TypeId
45
FlameHeader::GetTypeId
()
46
{
47
static
TypeId
tid =
TypeId
(
"ns3::flame::FlameHeader"
)
48
.
SetParent
<
Header
>()
49
.SetGroupName(
"Mesh"
)
50
.AddConstructor<
FlameHeader
>();
51
return
tid;
52
}
53
54
TypeId
55
FlameHeader::GetInstanceTypeId
()
const
56
{
57
return
GetTypeId
();
58
}
59
60
void
61
FlameHeader::Print
(std::ostream& os)
const
62
{
63
os <<
"Cost= "
<< (uint16_t)
m_cost
<<
", Sequence number= "
<<
m_seqno
64
<<
", Orig Destination= "
<<
m_origDst
<<
", Orig Source= "
<<
m_origSrc
;
65
}
66
67
uint32_t
68
FlameHeader::GetSerializedSize
()
const
69
{
70
return
1
// Reserved
71
+ 1
// Cost
72
+ 2
// Seqno
73
+ 6
// Orig Dst
74
+ 6
// Orig Src
75
+ 2
// Flame Port
76
;
77
}
78
79
void
80
FlameHeader::Serialize
(
Buffer::Iterator
start
)
const
81
{
82
Buffer::Iterator
i =
start
;
83
i.
WriteU8
(0);
// Reserved
84
i.
WriteU8
(
m_cost
);
// Cost
85
i.
WriteHtonU16
(
m_seqno
);
// Seqno
86
WriteTo
(i,
m_origDst
);
87
WriteTo
(i,
m_origSrc
);
88
i.
WriteHtonU16
(
m_protocol
);
89
}
90
91
uint32_t
92
FlameHeader::Deserialize
(
Buffer::Iterator
start
)
93
{
94
Buffer::Iterator
i =
start
;
95
i.
Next
(1);
96
m_cost
= i.
ReadU8
();
97
m_seqno
= i.
ReadNtohU16
();
98
ReadFrom
(i,
m_origDst
);
99
ReadFrom
(i,
m_origSrc
);
100
m_protocol
= i.
ReadNtohU16
();
101
return
i.
GetDistanceFrom
(
start
);
102
}
103
104
void
105
FlameHeader::AddCost
(uint8_t cost)
106
{
107
m_cost
= (((uint16_t)cost + (uint16_t)
m_cost
) > 255) ? 255 : cost +
m_cost
;
108
}
109
110
uint8_t
111
FlameHeader::GetCost
()
const
112
{
113
return
m_cost
;
114
}
115
116
void
117
FlameHeader::SetSeqno
(uint16_t seqno)
118
{
119
m_seqno
= seqno;
120
}
121
122
uint16_t
123
FlameHeader::GetSeqno
()
const
124
{
125
return
m_seqno
;
126
}
127
128
void
129
FlameHeader::SetOrigDst
(
Mac48Address
dst)
130
{
131
m_origDst
= dst;
132
}
133
134
Mac48Address
135
FlameHeader::GetOrigDst
()
const
136
{
137
return
m_origDst
;
138
}
139
140
void
141
FlameHeader::SetOrigSrc
(
Mac48Address
src)
142
{
143
m_origSrc
= src;
144
}
145
146
Mac48Address
147
FlameHeader::GetOrigSrc
()
const
148
{
149
return
m_origSrc
;
150
}
151
152
void
153
FlameHeader::SetProtocol
(uint16_t protocol)
154
{
155
m_protocol
= protocol;
156
}
157
158
uint16_t
159
FlameHeader::GetProtocol
()
const
160
{
161
return
m_protocol
;
162
}
163
164
bool
165
operator==
(
const
FlameHeader
& a,
const
FlameHeader
& b)
166
{
167
return
((a.
m_cost
== b.
m_cost
) && (a.
m_seqno
== b.
m_seqno
) && (a.
m_origDst
== b.
m_origDst
) &&
168
(a.
m_origSrc
== b.
m_origSrc
) && (a.
m_protocol
== b.
m_protocol
));
169
}
170
171
}
// namespace flame
172
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Buffer::Iterator::ReadU8
uint8_t ReadU8()
Definition:
buffer.h:1027
ns3::Buffer::Iterator::WriteU8
void WriteU8(uint8_t data)
Definition:
buffer.h:881
ns3::Buffer::Iterator::WriteHtonU16
void WriteHtonU16(uint16_t data)
Definition:
buffer.h:915
ns3::Buffer::Iterator::ReadNtohU16
uint16_t ReadNtohU16()
Definition:
buffer.h:954
ns3::Buffer::Iterator::GetDistanceFrom
uint32_t GetDistanceFrom(const Iterator &o) const
Definition:
buffer.cc:780
ns3::Buffer::Iterator::Next
void Next()
go forward by one byte
Definition:
buffer.h:853
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:931
ns3::flame::FlameHeader
Flame header.
Definition:
flame-header.h:40
ns3::flame::FlameHeader::m_cost
uint8_t m_cost
cost
Definition:
flame-header.h:110
ns3::flame::FlameHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
flame-header.cc:68
ns3::flame::FlameHeader::m_origDst
Mac48Address m_origDst
origin destination
Definition:
flame-header.h:112
ns3::flame::FlameHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
flame-header.cc:45
ns3::flame::FlameHeader::m_protocol
uint16_t m_protocol
protocol
Definition:
flame-header.h:114
ns3::flame::FlameHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
flame-header.cc:55
ns3::flame::FlameHeader::GetCost
uint8_t GetCost() const
Get cost value.
Definition:
flame-header.cc:111
ns3::flame::FlameHeader::m_seqno
uint16_t m_seqno
sequence number
Definition:
flame-header.h:111
ns3::flame::FlameHeader::FlameHeader
FlameHeader()
Definition:
flame-header.cc:32
ns3::flame::FlameHeader::GetOrigDst
Mac48Address GetOrigDst() const
Get origin destination address.
Definition:
flame-header.cc:135
ns3::flame::FlameHeader::GetOrigSrc
Mac48Address GetOrigSrc() const
Get origin source address.
Definition:
flame-header.cc:147
ns3::flame::FlameHeader::SetOrigSrc
void SetOrigSrc(Mac48Address OrigSrc)
Set origin source function.
Definition:
flame-header.cc:141
ns3::flame::FlameHeader::AddCost
void AddCost(uint8_t cost)
Add cost value.
Definition:
flame-header.cc:105
ns3::flame::FlameHeader::Print
void Print(std::ostream &os) const override
Definition:
flame-header.cc:61
ns3::flame::FlameHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition:
flame-header.cc:80
ns3::flame::FlameHeader::GetSeqno
uint16_t GetSeqno() const
Get sequence number value.
Definition:
flame-header.cc:123
ns3::flame::FlameHeader::SetOrigDst
void SetOrigDst(Mac48Address dst)
Set origin destination address.
Definition:
flame-header.cc:129
ns3::flame::FlameHeader::SetProtocol
void SetProtocol(uint16_t protocol)
Set protocol value.
Definition:
flame-header.cc:153
ns3::flame::FlameHeader::~FlameHeader
~FlameHeader() override
Definition:
flame-header.cc:40
ns3::flame::FlameHeader::m_origSrc
Mac48Address m_origSrc
origin source
Definition:
flame-header.h:113
ns3::flame::FlameHeader::GetProtocol
uint16_t GetProtocol() const
Get protocol value.
Definition:
flame-header.cc:159
ns3::flame::FlameHeader::SetSeqno
void SetSeqno(uint16_t seqno)
Set sequence number value.
Definition:
flame-header.cc:117
flame-header.h
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:46
ns3::flame::operator==
bool operator==(const FlameHeader &a, const FlameHeader &b)
Definition:
flame-header.cc:165
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WriteTo
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
Definition:
address-utils.cc:31
ns3::ReadFrom
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
Definition:
address-utils.cc:84
two-ray-to-three-gpp-ch-calibration.start
start
Definition:
two-ray-to-three-gpp-ch-calibration.py:520
src
mesh
model
flame
flame-header.cc
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1