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
* SPDX-License-Identifier: GPL-2.0-only
6
*
7
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
8
*/
9
10
#ifndef SEQ_TS_ECHO_HEADER_H
11
#define SEQ_TS_ECHO_HEADER_H
12
13
#include "ns3/header.h"
14
#include "ns3/nstime.h"
15
16
namespace
ns3
17
{
18
/**
19
* \ingroup applications
20
* \class SeqTsEchoHeader
21
* \brief Packet header to carry sequence number and two timestamps
22
*
23
* The header is made of a 32bits sequence number followed by
24
* two 64bits time stamps (Transmit and Receive).
25
*/
26
class
SeqTsEchoHeader
:
public
Header
27
{
28
public
:
29
/**
30
* \brief Get the type ID.
31
* \return the object TypeId
32
*/
33
static
TypeId
GetTypeId
();
34
35
/**
36
* \brief constructor
37
*/
38
SeqTsEchoHeader
();
39
40
/**
41
* \param seq the sequence number
42
*/
43
void
SetSeq
(
uint32_t
seq);
44
45
/**
46
* \return the sequence number
47
*/
48
uint32_t
GetSeq
()
const
;
49
50
/**
51
* \return A time value set by the sender
52
*/
53
Time
GetTsValue
()
const
;
54
55
/**
56
* \return A time value echoing the received timestamp
57
*/
58
Time
GetTsEchoReply
()
const
;
59
60
/**
61
* \brief Set the sender's time value
62
* \param ts Time value to set
63
*/
64
void
SetTsValue
(
Time
ts);
65
66
/**
67
* \brief Upon SeqTsEchoHeader reception, the host answers via echoing
68
* back the received timestamp
69
* \param ts received timestamp. If not called, will contain 0
70
*/
71
void
SetTsEchoReply
(
Time
ts);
72
73
// Inherited
74
TypeId
GetInstanceTypeId
()
const override
;
75
void
Print
(std::ostream& os)
const override
;
76
uint32_t
GetSerializedSize
()
const override
;
77
void
Serialize
(
Buffer::Iterator
start)
const override
;
78
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
79
80
private
:
81
uint32_t
m_seq
;
//!< Sequence number
82
Time
m_tsValue
;
//!< Sender's timestamp
83
Time
m_tsEchoReply
;
//!< Receiver's timestamp
84
};
85
86
}
// namespace ns3
87
88
#endif
/* SEQ_TS_ECHO_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::SeqTsEchoHeader
Packet header to carry sequence number and two timestamps.
Definition
seq-ts-echo-header.h:27
ns3::SeqTsEchoHeader::GetTsEchoReply
Time GetTsEchoReply() const
Definition
seq-ts-echo-header.cc:68
ns3::SeqTsEchoHeader::m_tsEchoReply
Time m_tsEchoReply
Receiver's timestamp.
Definition
seq-ts-echo-header.h:83
ns3::SeqTsEchoHeader::m_tsValue
Time m_tsValue
Sender's timestamp.
Definition
seq-ts-echo-header.h:82
ns3::SeqTsEchoHeader::SetTsValue
void SetTsValue(Time ts)
Set the sender's time value.
Definition
seq-ts-echo-header.cc:47
ns3::SeqTsEchoHeader::GetTsValue
Time GetTsValue() const
Definition
seq-ts-echo-header.cc:54
ns3::SeqTsEchoHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
seq-ts-echo-header.cc:99
ns3::SeqTsEchoHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
seq-ts-echo-header.cc:85
ns3::SeqTsEchoHeader::GetSeq
uint32_t GetSeq() const
Definition
seq-ts-echo-header.cc:40
ns3::SeqTsEchoHeader::m_seq
uint32_t m_seq
Sequence number.
Definition
seq-ts-echo-header.h:81
ns3::SeqTsEchoHeader::SetSeq
void SetSeq(uint32_t seq)
Definition
seq-ts-echo-header.cc:33
ns3::SeqTsEchoHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
seq-ts-echo-header.cc:106
ns3::SeqTsEchoHeader::SeqTsEchoHeader
SeqTsEchoHeader()
constructor
Definition
seq-ts-echo-header.cc:24
ns3::SeqTsEchoHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
seq-ts-echo-header.cc:75
ns3::SeqTsEchoHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
seq-ts-echo-header.cc:116
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:61
ns3::SeqTsEchoHeader::Print
void Print(std::ostream &os) const override
Definition
seq-ts-echo-header.cc:91
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
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 Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0