A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
lte
model
lte-radio-bearer-tag.cc
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
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: Marco Miozzo <marco.miozzo@cttc.es>
19
*/
20
21
22
#include "
lte-radio-bearer-tag.h
"
23
#include "ns3/tag.h"
24
#include "ns3/uinteger.h"
25
26
namespace
ns3
{
27
28
NS_OBJECT_ENSURE_REGISTERED
(LteRadioBearerTag);
29
30
TypeId
31
LteRadioBearerTag::GetTypeId
(
void
)
32
{
33
static
TypeId
tid =
TypeId
(
"ns3::LteRadioBearerTag"
)
34
.
SetParent
<
Tag
> ()
35
.SetGroupName(
"Lte"
)
36
.AddConstructor<
LteRadioBearerTag
> ()
37
.AddAttribute (
"rnti"
,
"The rnti that indicates the UE to which packet belongs"
,
38
UintegerValue
(0),
39
MakeUintegerAccessor
(&
LteRadioBearerTag::GetRnti
),
40
MakeUintegerChecker<uint16_t> ())
41
.AddAttribute (
"lcid"
,
"The id within the UE identifying the logical channel to which the packet belongs"
,
42
UintegerValue
(0),
43
MakeUintegerAccessor
(&
LteRadioBearerTag::GetLcid
),
44
MakeUintegerChecker<uint8_t> ())
45
;
46
return
tid;
47
}
48
49
TypeId
50
LteRadioBearerTag::GetInstanceTypeId
(
void
)
const
51
{
52
return
GetTypeId
();
53
}
54
55
LteRadioBearerTag::LteRadioBearerTag
()
56
: m_rnti (0),
57
m_lcid (0),
58
m_layer (0)
59
{
60
}
61
LteRadioBearerTag::LteRadioBearerTag
(uint16_t rnti, uint8_t lcid)
62
: m_rnti (rnti),
63
m_lcid (lcid)
64
{
65
}
66
67
LteRadioBearerTag::LteRadioBearerTag
(uint16_t rnti, uint8_t lcid, uint8_t layer)
68
: m_rnti (rnti),
69
m_lcid (lcid),
70
m_layer (layer)
71
{
72
}
73
74
void
75
LteRadioBearerTag::SetRnti
(uint16_t rnti)
76
{
77
m_rnti
= rnti;
78
}
79
80
void
81
LteRadioBearerTag::SetLcid
(uint8_t lcid)
82
{
83
m_lcid
= lcid;
84
}
85
86
void
87
LteRadioBearerTag::SetLayer
(uint8_t layer)
88
{
89
m_layer
= layer;
90
}
91
92
uint32_t
93
LteRadioBearerTag::GetSerializedSize
(
void
)
const
94
{
95
return
4;
96
}
97
98
void
99
LteRadioBearerTag::Serialize
(
TagBuffer
i)
const
100
{
101
i.
WriteU16
(
m_rnti
);
102
i.
WriteU8
(
m_lcid
);
103
i.
WriteU8
(
m_layer
);
104
}
105
106
void
107
LteRadioBearerTag::Deserialize
(
TagBuffer
i)
108
{
109
m_rnti
= (uint16_t) i.
ReadU16
();
110
m_lcid
= (uint8_t) i.
ReadU8
();
111
m_layer
= (uint8_t) i.
ReadU8
();
112
}
113
114
uint16_t
115
LteRadioBearerTag::GetRnti
()
const
116
{
117
return
m_rnti
;
118
}
119
120
uint8_t
121
LteRadioBearerTag::GetLcid
()
const
122
{
123
return
m_lcid
;
124
}
125
126
uint8_t
127
LteRadioBearerTag::GetLayer
()
const
128
{
129
return
m_layer
;
130
}
131
132
void
133
LteRadioBearerTag::Print
(std::ostream &os)
const
134
{
135
os <<
"rnti="
<<
m_rnti
<<
", lcid="
<< (uint16_t)
m_lcid
<<
", layer="
<< (uint16_t)
m_layer
;
136
}
137
138
}
// namespace ns3
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::LteRadioBearerTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
lte-radio-bearer-tag.cc:50
ns3::LteRadioBearerTag::SetRnti
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
Definition:
lte-radio-bearer-tag.cc:75
ns3::LteRadioBearerTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
lte-radio-bearer-tag.cc:31
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:195
ns3::LteRadioBearerTag::m_lcid
uint8_t m_lcid
LCID.
Definition:
lte-radio-bearer-tag.h:112
ns3::LteRadioBearerTag::GetRnti
uint16_t GetRnti(void) const
Get RNTI function.
Definition:
lte-radio-bearer-tag.cc:115
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:44
lte-radio-bearer-tag.h
ns3::TagBuffer::WriteU16
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition:
tag-buffer.h:180
ns3::LteRadioBearerTag::LteRadioBearerTag
LteRadioBearerTag()
Create an empty LteRadioBearerTag.
Definition:
lte-radio-bearer-tag.cc:55
ns3::LteRadioBearerTag::GetLayer
uint8_t GetLayer(void) const
Get layer function.
Definition:
lte-radio-bearer-tag.cc:127
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::LteRadioBearerTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
lte-radio-bearer-tag.cc:107
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::LteRadioBearerTag::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Definition:
lte-radio-bearer-tag.cc:93
ns3::LteRadioBearerTag::SetLayer
void SetLayer(uint8_t layer)
Set the layer id to the given value.
Definition:
lte-radio-bearer-tag.cc:87
ns3::LteRadioBearerTag::SetLcid
void SetLcid(uint8_t lcid)
Set the LC id to the given value.
Definition:
lte-radio-bearer-tag.cc:81
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::LteRadioBearerTag::GetLcid
uint8_t GetLcid(void) const
Get LCID function.
Definition:
lte-radio-bearer-tag.cc:121
ns3::LteRadioBearerTag
Tag used to define the RNTI and LC id for each MAC packet trasmitted.
Definition:
lte-radio-bearer-tag.h:34
ns3::LteRadioBearerTag::m_layer
uint8_t m_layer
layer
Definition:
lte-radio-bearer-tag.h:113
ns3::TagBuffer::ReadU16
TAG_BUFFER_INLINE uint16_t ReadU16(void)
Definition:
tag-buffer.h:205
ns3::LteRadioBearerTag::Print
virtual void Print(std::ostream &os) const
Definition:
lte-radio-bearer-tag.cc:133
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Definition:
uinteger.h:45
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::LteRadioBearerTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
lte-radio-bearer-tag.cc:99
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::LteRadioBearerTag::m_rnti
uint16_t m_rnti
RNTI.
Definition:
lte-radio-bearer-tag.h:111
Generated on Wed Nov 7 2018 10:02:01 for ns-3 by
1.8.14