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
seq-ts-size-header.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 INRIA
3
* Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
4
* (added timestamp and size fields)
5
*
6
* SPDX-License-Identifier: GPL-2.0-only
7
*
8
*/
9
10
#include "
seq-ts-size-header.h
"
11
12
#include "ns3/log.h"
13
14
namespace
ns3
15
{
16
17
NS_LOG_COMPONENT_DEFINE
(
"SeqTsSizeHeader"
);
18
19
NS_OBJECT_ENSURE_REGISTERED
(SeqTsSizeHeader);
20
21
SeqTsSizeHeader::SeqTsSizeHeader
()
22
:
SeqTsHeader
()
23
{
24
NS_LOG_FUNCTION
(
this
);
25
}
26
27
TypeId
28
SeqTsSizeHeader::GetTypeId
()
29
{
30
static
TypeId
tid =
TypeId
(
"ns3::SeqTsSizeHeader"
)
31
.
SetParent
<
SeqTsHeader
>()
32
.SetGroupName(
"Applications"
)
33
.AddConstructor<
SeqTsSizeHeader
>();
34
return
tid;
35
}
36
37
TypeId
38
SeqTsSizeHeader::GetInstanceTypeId
()
const
39
{
40
return
GetTypeId
();
41
}
42
43
void
44
SeqTsSizeHeader::SetSize
(uint64_t size)
45
{
46
m_size
= size;
47
}
48
49
uint64_t
50
SeqTsSizeHeader::GetSize
()
const
51
{
52
return
m_size
;
53
}
54
55
void
56
SeqTsSizeHeader::Print
(std::ostream& os)
const
57
{
58
NS_LOG_FUNCTION
(
this
<< &os);
59
os <<
"(size="
<<
m_size
<<
") AND "
;
60
SeqTsHeader::Print
(os);
61
}
62
63
uint32_t
64
SeqTsSizeHeader::GetSerializedSize
()
const
65
{
66
return
SeqTsHeader::GetSerializedSize
() + 8;
67
}
68
69
void
70
SeqTsSizeHeader::Serialize
(
Buffer::Iterator
start)
const
71
{
72
NS_LOG_FUNCTION
(
this
<< &start);
73
Buffer::Iterator
i = start;
74
i.
WriteHtonU64
(
m_size
);
75
SeqTsHeader::Serialize
(i);
76
}
77
78
uint32_t
79
SeqTsSizeHeader::Deserialize
(
Buffer::Iterator
start)
80
{
81
NS_LOG_FUNCTION
(
this
<< &start);
82
Buffer::Iterator
i = start;
83
m_size
= i.
ReadNtohU64
();
84
SeqTsHeader::Deserialize
(i);
85
return
GetSerializedSize
();
86
}
87
88
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Buffer::Iterator::WriteHtonU64
void WriteHtonU64(uint64_t data)
Definition
buffer.cc:923
ns3::Buffer::Iterator::ReadNtohU64
uint64_t ReadNtohU64()
Definition
buffer.cc:1030
ns3::SeqTsHeader
Packet header to carry sequence number and timestamp.
Definition
seq-ts-header.h:34
ns3::SeqTsHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
seq-ts-header.cc:82
ns3::SeqTsHeader::Print
void Print(std::ostream &os) const override
Definition
seq-ts-header.cc:68
ns3::SeqTsHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
seq-ts-header.cc:75
ns3::SeqTsHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
seq-ts-header.cc:91
ns3::SeqTsSizeHeader
Header with a sequence, a timestamp, and a "size" attribute.
Definition
seq-ts-size-header.h:27
ns3::SeqTsSizeHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
seq-ts-size-header.cc:64
ns3::SeqTsSizeHeader::GetSize
uint64_t GetSize() const
Get the size information that the header is carrying.
Definition
seq-ts-size-header.cc:50
ns3::SeqTsSizeHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
seq-ts-size-header.cc:79
ns3::SeqTsSizeHeader::Print
void Print(std::ostream &os) const override
Definition
seq-ts-size-header.cc:56
ns3::SeqTsSizeHeader::SeqTsSizeHeader
SeqTsSizeHeader()
constructor
Definition
seq-ts-size-header.cc:21
ns3::SeqTsSizeHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
seq-ts-size-header.cc:38
ns3::SeqTsSizeHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
seq-ts-size-header.cc:28
ns3::SeqTsSizeHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
seq-ts-size-header.cc:70
ns3::SeqTsSizeHeader::SetSize
void SetSize(uint64_t size)
Set the size information that the header will carry.
Definition
seq-ts-size-header.cc:44
ns3::SeqTsSizeHeader::m_size
uint64_t m_size
The 'size' information that the header is carrying.
Definition
seq-ts-size-header.h:60
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
seq-ts-size-header.h
src
applications
model
seq-ts-size-header.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0