A Discrete-Event Network Simulator
API
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 {
37 class SeqTsEchoHeader : public Header
38 {
39  public:
44  static TypeId GetTypeId();
45 
50 
54  void SetSeq(uint32_t seq);
55 
59  uint32_t GetSeq() const;
60 
64  Time GetTsValue() const;
65 
69  Time GetTsEchoReply() const;
70 
75  void SetTsValue(Time ts);
76 
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;
95 };
96 
97 } // namespace ns3
98 
99 #endif /* SEQ_TS_ECHO_HEADER_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Packet header to carry sequence number and two timestamps.
Time m_tsEchoReply
Receiver's timestamp.
Time m_tsValue
Sender's timestamp.
void SetTsValue(Time ts)
Set the sender's time value.
uint32_t GetSerializedSize() const override
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSeq() const
uint32_t m_seq
Sequence number.
void SetSeq(uint32_t seq)
void Serialize(Buffer::Iterator start) const override
static TypeId GetTypeId()
Get the type ID.
void SetTsEchoReply(Time ts)
Upon SeqTsEchoHeader reception, the host answers via echoing back the received timestamp.
void Print(std::ostream &os) const override
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.