A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
seq-ts-size-header.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 INRIA
4
* Copyright (c) 2018 Natale Patriciello <natale.patriciello@gmail.com>
5
* (added timestamp and size fields)
6
*
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation;
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
*
20
*/
21
22
#include "ns3/log.h"
23
#include "
seq-ts-size-header.h
"
24
25
namespace
ns3
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"SeqTsSizeHeader"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(SeqTsSizeHeader);
30
31
SeqTsSizeHeader::SeqTsSizeHeader
()
32
:
SeqTsHeader
()
33
{
34
NS_LOG_FUNCTION
(
this
);
35
}
36
37
TypeId
38
SeqTsSizeHeader::GetTypeId
(
void
)
39
{
40
static
TypeId
tid =
TypeId
(
"ns3::SeqTsSizeHeader"
)
41
.
SetParent
<
SeqTsHeader
> ()
42
.SetGroupName (
"Applications"
)
43
.AddConstructor<
SeqTsSizeHeader
> ()
44
;
45
return
tid;
46
}
47
48
TypeId
49
SeqTsSizeHeader::GetInstanceTypeId
(
void
)
const
50
{
51
return
GetTypeId
();
52
}
53
54
void
55
SeqTsSizeHeader::SetSize
(uint64_t size)
56
{
57
m_size
= size;
58
}
59
60
uint64_t
61
SeqTsSizeHeader::GetSize
(
void
)
const
62
{
63
return
m_size
;
64
}
65
66
void
67
SeqTsSizeHeader::Print
(std::ostream &os)
const
68
{
69
NS_LOG_FUNCTION
(
this
<< &os);
70
os <<
"(size="
<<
m_size
<<
") AND "
;
71
SeqTsHeader::Print
(os);
72
}
73
74
uint32_t
75
SeqTsSizeHeader::GetSerializedSize
(
void
)
const
76
{
77
return
SeqTsHeader::GetSerializedSize
() + 8;
78
}
79
80
void
81
SeqTsSizeHeader::Serialize
(
Buffer::Iterator
start
)
const
82
{
83
NS_LOG_FUNCTION
(
this
<< &
start
);
84
Buffer::Iterator
i =
start
;
85
i.
WriteHtonU64
(
m_size
);
86
SeqTsHeader::Serialize
(i);
87
}
88
89
uint32_t
90
SeqTsSizeHeader::Deserialize
(
Buffer::Iterator
start
)
91
{
92
NS_LOG_FUNCTION
(
this
<< &
start
);
93
Buffer::Iterator
i =
start
;
94
m_size
= i.
ReadNtohU64
();
95
SeqTsHeader::Deserialize
(i);
96
return
GetSerializedSize
();
97
}
98
99
}
// namespace ns3
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:99
ns3::Buffer::Iterator::WriteHtonU64
void WriteHtonU64(uint64_t data)
Definition:
buffer.cc:941
ns3::Buffer::Iterator::ReadNtohU64
uint64_t ReadNtohU64(void)
Definition:
buffer.cc:1044
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::SeqTsHeader
Packet header to carry sequence number and timestamp.
Definition:
seq-ts-header.h:45
ns3::SeqTsHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Definition:
seq-ts-header.cc:89
ns3::SeqTsHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Definition:
seq-ts-header.cc:82
ns3::SeqTsHeader::Print
virtual void Print(std::ostream &os) const
Definition:
seq-ts-header.cc:76
ns3::SeqTsSizeHeader
Header with a sequence, a timestamp, and a "size" attribute.
Definition:
seq-ts-size-header.h:38
ns3::SeqTsSizeHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const override
Get the most derived TypeId for this Object.
Definition:
seq-ts-size-header.cc:49
ns3::SeqTsSizeHeader::Print
virtual void Print(std::ostream &os) const override
Definition:
seq-ts-size-header.cc:67
ns3::SeqTsSizeHeader::SeqTsSizeHeader
SeqTsSizeHeader()
constructor
Definition:
seq-ts-size-header.cc:31
ns3::SeqTsSizeHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const override
Definition:
seq-ts-size-header.cc:75
ns3::SeqTsSizeHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const override
Definition:
seq-ts-size-header.cc:81
ns3::SeqTsSizeHeader::SetSize
void SetSize(uint64_t size)
Set the size information that the header will carry.
Definition:
seq-ts-size-header.cc:55
ns3::SeqTsSizeHeader::GetSize
uint64_t GetSize(void) const
Get the size information that the header is carrying.
Definition:
seq-ts-size-header.cc:61
ns3::SeqTsSizeHeader::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
seq-ts-size-header.cc:38
ns3::SeqTsSizeHeader::m_size
uint64_t m_size
The 'size' information that the header is carrying.
Definition:
seq-ts-size-header.h:71
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:922
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
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:244
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
visualizer.core.start
def start()
Definition:
core.py:1853
seq-ts-size-header.h
src
applications
model
seq-ts-size-header.cc
Generated on Tue Feb 6 2024 19:21:15 for ns-3 by
1.9.1