A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-radio-bearer-tag.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7 */
8
10
11#include "ns3/tag.h"
12#include "ns3/uinteger.h"
13
14namespace ns3
15{
16
17NS_OBJECT_ENSURE_REGISTERED(LteRadioBearerTag);
18
19TypeId
21{
22 static TypeId tid =
23 TypeId("ns3::LteRadioBearerTag")
24 .SetParent<Tag>()
25 .SetGroupName("Lte")
26 .AddConstructor<LteRadioBearerTag>()
27 .AddAttribute("rnti",
28 "The rnti that indicates the UE to which packet belongs",
32 .AddAttribute(
33 "lcid",
34 "The id within the UE identifying the logical channel to which the packet belongs",
38 return tid;
39}
40
46
48 : m_rnti(0),
49 m_lcid(0),
50 m_layer(0)
51{
52}
53
54LteRadioBearerTag::LteRadioBearerTag(uint16_t rnti, uint8_t lcid)
55 : m_rnti(rnti),
56 m_lcid(lcid)
57{
58}
59
60LteRadioBearerTag::LteRadioBearerTag(uint16_t rnti, uint8_t lcid, uint8_t layer)
61 : m_rnti(rnti),
62 m_lcid(lcid),
63 m_layer(layer)
64{
65}
66
67void
69{
70 m_rnti = rnti;
71}
72
73void
75{
76 m_lcid = lcid;
77}
78
79void
81{
82 m_layer = layer;
83}
84
87{
88 return 4;
89}
90
91void
93{
94 i.WriteU16(m_rnti);
95 i.WriteU8(m_lcid);
96 i.WriteU8(m_layer);
97}
98
99void
101{
102 m_rnti = (uint16_t)i.ReadU16();
103 m_lcid = (uint8_t)i.ReadU8();
104 m_layer = (uint8_t)i.ReadU8();
105}
106
107uint16_t
109{
110 return m_rnti;
111}
112
113uint8_t
115{
116 return m_lcid;
117}
118
119uint8_t
121{
122 return m_layer;
123}
124
125void
126LteRadioBearerTag::Print(std::ostream& os) const
127{
128 os << "rnti=" << m_rnti << ", lcid=" << (uint16_t)m_lcid << ", layer=" << (uint16_t)m_layer;
129}
130
131} // namespace ns3
Tag used to define the RNTI and LC id for each MAC packet transmitted.
uint32_t GetSerializedSize() const override
void Serialize(TagBuffer i) const override
void SetLayer(uint8_t layer)
Set the layer id to the given value.
uint16_t GetRnti() const
Get RNTI function.
void Print(std::ostream &os) const override
uint8_t GetLcid() const
Get LCID function.
static TypeId GetTypeId()
Get the type ID.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
LteRadioBearerTag()
Create an empty LteRadioBearerTag.
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
void SetLcid(uint8_t lcid)
Set the LC id to the given value.
uint8_t GetLayer() const
Get layer function.
void Deserialize(TagBuffer i) override
read and write tag data
Definition tag-buffer.h:41
tag a set of bytes in a packet
Definition tag.h:28
a unique identifier for an interface.
Definition type-id.h:49
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
Hold an unsigned integer type.
Definition uinteger.h:34
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35