A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
seq-ts-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef SEQ_TS_HEADER_H
10#define SEQ_TS_HEADER_H
11
12#include "ns3/header.h"
13#include "ns3/nstime.h"
14
15namespace ns3
16{
17/**
18 * @ingroup applications
19 *
20 * @brief Packet header to carry sequence number and timestamp
21 *
22 * The header is used as a payload in applications (typically UDP) to convey
23 * a 32 bit sequence number followed by a 64 bit timestamp (12 bytes total).
24 *
25 * The timestamp is not set explicitly but automatically set to the
26 * simulation time upon creation.
27 *
28 * If you need space for an application data unit size field (e.g. for
29 * stream-based protocols like TCP), use ns3::SeqTsSizeHeader.
30 *
31 * \sa ns3::SeqTsSizeHeader
32 */
33class SeqTsHeader : public Header
34{
35 public:
37
38 /**
39 * @param seq the sequence number
40 */
41 void SetSeq(uint32_t seq);
42 /**
43 * @return the sequence number
44 */
45 uint32_t GetSeq() const;
46 /**
47 * @return the time stamp
48 */
49 Time GetTs() const;
50
51 /**
52 * @brief Get the type ID.
53 * @return the object TypeId
54 */
55 static TypeId GetTypeId();
56
57 TypeId GetInstanceTypeId() const override;
58 void Print(std::ostream& os) const override;
59 uint32_t GetSerializedSize() const override;
60 void Serialize(Buffer::Iterator start) const override;
62
63 private:
64 uint32_t m_seq; //!< Sequence number
65 uint64_t m_ts; //!< Timestamp
66};
67
68} // namespace ns3
69
70#endif /* SEQ_TS_HEADER_H */
iterator in a Buffer instance
Definition buffer.h:89
Protocol header serialization and deserialization.
Definition header.h:33
Packet header to carry sequence number and timestamp.
static TypeId GetTypeId()
Get the type ID.
uint64_t m_ts
Timestamp.
void Serialize(Buffer::Iterator start) const override
uint32_t m_seq
Sequence number.
void Print(std::ostream &os) const override
void SetSeq(uint32_t seq)
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSerializedSize() const override
uint32_t Deserialize(Buffer::Iterator start) override
Time GetTs() const
uint32_t GetSeq() const
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.