5G-LENA nr-v3.3-81-g75c7590d
The 5G/NR module for the ns-3 simulator
Loading...
Searching...
No Matches
nr-eps-bearer-tag.cc
1// Copyright (c) 2011,2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
2//
3// SPDX-License-Identifier: GPL-2.0-only
4//
5// Author: Marco Miozzo <marco.miozzo@cttc.es>
6// Nicola Baldo <nbaldo@cttc.es>
7
8#include "nr-eps-bearer-tag.h"
9
10#include "ns3/tag.h"
11#include "ns3/uinteger.h"
12
13namespace ns3
14{
15
16NS_OBJECT_ENSURE_REGISTERED(NrEpsBearerTag);
17
18TypeId
20{
21 static TypeId tid =
22 TypeId("ns3::NrEpsBearerTag")
23 .SetParent<Tag>()
24 .SetGroupName("Nr")
25 .AddConstructor<NrEpsBearerTag>()
26 .AddAttribute("rnti",
27 "The rnti that indicates the UE which packet belongs",
28 UintegerValue(0),
29 MakeUintegerAccessor(&NrEpsBearerTag::GetRnti),
30 MakeUintegerChecker<uint16_t>())
31 .AddAttribute("bid",
32 "The EPS bearer id within the UE to which the packet belongs",
33 UintegerValue(0),
34 MakeUintegerAccessor(&NrEpsBearerTag::GetBid),
35 MakeUintegerChecker<uint8_t>());
36 return tid;
37}
38
39TypeId
40NrEpsBearerTag::GetInstanceTypeId() const
41{
42 return GetTypeId();
43}
44
46 : m_rnti(0),
47 m_bid(0)
48{
49}
50
51NrEpsBearerTag::NrEpsBearerTag(uint16_t rnti, uint8_t bid)
52 : m_rnti(rnti),
53 m_bid(bid)
54{
55}
56
57void
59{
60 m_rnti = rnti;
61}
62
63void
65{
66 m_bid = bid;
67}
68
69uint32_t
70NrEpsBearerTag::GetSerializedSize() const
71{
72 return 3;
73}
74
75void
76NrEpsBearerTag::Serialize(TagBuffer i) const
77{
78 i.WriteU16(m_rnti);
79 i.WriteU8(m_bid);
80}
81
82void
83NrEpsBearerTag::Deserialize(TagBuffer i)
84{
85 m_rnti = (uint16_t)i.ReadU16();
86 m_bid = (uint8_t)i.ReadU8();
87}
88
89uint16_t
91{
92 return m_rnti;
93}
94
95uint8_t
97{
98 return m_bid;
99}
100
101void
102NrEpsBearerTag::Print(std::ostream& os) const
103{
104 os << "rnti=" << m_rnti << ", bid=" << (uint16_t)m_bid;
105}
106
107} // namespace ns3
uint16_t GetRnti() const
void SetBid(uint8_t bid)
void SetRnti(uint16_t rnti)
static TypeId GetTypeId()
Get the type ID.