5G-LENA nr-v4.0
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-pdcp-tag.cc
1// Copyright (c) 2011 CTTC
2//
3// SPDX-License-Identifier: GPL-2.0-only
4//
5// Author: Jaume Nin <jaume.nin@cttc.es>
6// Nicola Baldo <nbaldo@cttc.es>
7
8#include "nr-pdcp-tag.h"
9
10#include "ns3/tag.h"
11#include "ns3/uinteger.h"
12
13namespace ns3
14{
15
16NS_OBJECT_ENSURE_REGISTERED(NrPdcpTag);
17
19 : m_senderTimestamp(Seconds(0))
20{
21 // Nothing to do here
22}
23
24NrPdcpTag::NrPdcpTag(Time senderTimestamp)
25 : m_senderTimestamp(senderTimestamp)
26
27{
28 // Nothing to do here
29}
30
31TypeId
33{
34 static TypeId tid =
35 TypeId("ns3::NrPdcpTag").SetParent<Tag>().SetGroupName("Nr").AddConstructor<NrPdcpTag>();
36 return tid;
37}
38
39TypeId
40NrPdcpTag::GetInstanceTypeId() const
41{
42 return GetTypeId();
43}
44
45uint32_t
46NrPdcpTag::GetSerializedSize() const
47{
48 return sizeof(Time);
49}
50
51void
52NrPdcpTag::Serialize(TagBuffer i) const
53{
54 int64_t senderTimestamp = m_senderTimestamp.GetNanoSeconds();
55 i.Write((const uint8_t*)&senderTimestamp, sizeof(int64_t));
56}
57
58void
59NrPdcpTag::Deserialize(TagBuffer i)
60{
61 int64_t senderTimestamp;
62 i.Read((uint8_t*)&senderTimestamp, 8);
63 m_senderTimestamp = NanoSeconds(senderTimestamp);
64}
65
66void
67NrPdcpTag::Print(std::ostream& os) const
68{
69 os << m_senderTimestamp;
70}
71
72Time
74{
75 return m_senderTimestamp;
76}
77
78void
79NrPdcpTag::SetSenderTimestamp(Time senderTimestamp)
80{
81 this->m_senderTimestamp = senderTimestamp;
82}
83
84} // namespace ns3
static TypeId GetTypeId()
Get the type ID.
Time GetSenderTimestamp() const
void SetSenderTimestamp(Time senderTimestamp)