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-echo-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 INRIA
3
* Copyright (c) 2016 Universita' di Firenze (added echo fields)
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: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19
*/
20
21
#ifndef SEQ_TS_ECHO_HEADER_H
22
#define SEQ_TS_ECHO_HEADER_H
23
24
#include "ns3/header.h"
25
#include "ns3/nstime.h"
26
27
namespace
ns3
28
{
29
/**
30
* \ingroup applications
31
* \class SeqTsEchoHeader
32
* \brief Packet header to carry sequence number and two timestamps
33
*
34
* The header is made of a 32bits sequence number followed by
35
* two 64bits time stamps (Transmit and Receive).
36
*/
37
class
SeqTsEchoHeader
:
public
Header
38
{
39
public
:
40
/**
41
* \brief Get the type ID.
42
* \return the object TypeId
43
*/
44
static
TypeId
GetTypeId
();
45
46
/**
47
* \brief constructor
48
*/
49
SeqTsEchoHeader
();
50
51
/**
52
* \param seq the sequence number
53
*/
54
void
SetSeq
(
uint32_t
seq);
55
56
/**
57
* \return the sequence number
58
*/
59
uint32_t
GetSeq
()
const
;
60
61
/**
62
* \return A time value set by the sender
63
*/
64
Time
GetTsValue
()
const
;
65
66
/**
67
* \return A time value echoing the received timestamp
68
*/
69
Time
GetTsEchoReply
()
const
;
70
71
/**
72
* \brief Set the sender's time value
73
* \param ts Time value to set
74
*/
75
void
SetTsValue
(
Time
ts);
76
77
/**
78
* \brief Upon SeqTsEchoHeader reception, the host answers via echoing
79
* back the received timestamp
80
* \param ts received timestamp. If not called, will contain 0
81
*/
82
void
SetTsEchoReply
(
Time
ts);
83
84
// Inherited
85
TypeId
GetInstanceTypeId
()
const override
;
86
void
Print
(std::ostream& os)
const override
;
87
uint32_t
GetSerializedSize
()
const override
;
88
void
Serialize
(
Buffer::Iterator
start)
const override
;
89
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
90
91
private
:
92
uint32_t
m_seq
;
//!< Sequence number
93
Time
m_tsValue
;
//!< Sender's timestamp
94
Time
m_tsEchoReply
;
//!< Receiver's timestamp
95
};
96
97
}
// namespace ns3
98
99
#endif
/* SEQ_TS_ECHO_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::SeqTsEchoHeader
Packet header to carry sequence number and two timestamps.
Definition:
seq-ts-echo-header.h:38
ns3::SeqTsEchoHeader::GetTsEchoReply
Time GetTsEchoReply() const
Definition:
seq-ts-echo-header.cc:79
ns3::SeqTsEchoHeader::m_tsEchoReply
Time m_tsEchoReply
Receiver's timestamp.
Definition:
seq-ts-echo-header.h:94
ns3::SeqTsEchoHeader::m_tsValue
Time m_tsValue
Sender's timestamp.
Definition:
seq-ts-echo-header.h:93
ns3::SeqTsEchoHeader::SetTsValue
void SetTsValue(Time ts)
Set the sender's time value.
Definition:
seq-ts-echo-header.cc:58
ns3::SeqTsEchoHeader::GetTsValue
Time GetTsValue() const
Definition:
seq-ts-echo-header.cc:65
ns3::SeqTsEchoHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
seq-ts-echo-header.cc:110
ns3::SeqTsEchoHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
seq-ts-echo-header.cc:96
ns3::SeqTsEchoHeader::GetSeq
uint32_t GetSeq() const
Definition:
seq-ts-echo-header.cc:51
ns3::SeqTsEchoHeader::m_seq
uint32_t m_seq
Sequence number.
Definition:
seq-ts-echo-header.h:92
ns3::SeqTsEchoHeader::SetSeq
void SetSeq(uint32_t seq)
Definition:
seq-ts-echo-header.cc:44
ns3::SeqTsEchoHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition:
seq-ts-echo-header.cc:117
ns3::SeqTsEchoHeader::SeqTsEchoHeader
SeqTsEchoHeader()
constructor
Definition:
seq-ts-echo-header.cc:35
ns3::SeqTsEchoHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
seq-ts-echo-header.cc:86
ns3::SeqTsEchoHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition:
seq-ts-echo-header.cc:127
ns3::SeqTsEchoHeader::SetTsEchoReply
void SetTsEchoReply(Time ts)
Upon SeqTsEchoHeader reception, the host answers via echoing back the received timestamp.
Definition:
seq-ts-echo-header.cc:72
ns3::SeqTsEchoHeader::Print
void Print(std::ostream &os) const override
Definition:
seq-ts-echo-header.cc:102
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
model
seq-ts-echo-header.h
Generated on Tue May 28 2024 23:34:09 for ns-3 by
1.9.6