A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
lte
model
eps-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,2012 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
* Nicola Baldo <nbaldo@cttc.es>
20
*/
21
22
23
#include "
eps-bearer-tag.h
"
24
#include "ns3/tag.h"
25
#include "ns3/uinteger.h"
26
27
namespace
ns3
{
28
29
NS_OBJECT_ENSURE_REGISTERED
(EpsBearerTag);
30
31
TypeId
32
EpsBearerTag::GetTypeId
(
void
)
33
{
34
static
TypeId
tid =
TypeId
(
"ns3::EpsBearerTag"
)
35
.
SetParent
<
Tag
> ()
36
.SetGroupName(
"Lte"
)
37
.AddConstructor<
EpsBearerTag
> ()
38
.AddAttribute (
"rnti"
,
"The rnti that indicates the UE which packet belongs"
,
39
UintegerValue
(0),
40
MakeUintegerAccessor
(&
EpsBearerTag::GetRnti
),
41
MakeUintegerChecker<uint16_t> ())
42
.AddAttribute (
"bid"
,
"The EPS bearer id within the UE to which the packet belongs"
,
43
UintegerValue
(0),
44
MakeUintegerAccessor
(&
EpsBearerTag::GetBid
),
45
MakeUintegerChecker<uint8_t> ())
46
;
47
return
tid;
48
}
49
50
TypeId
51
EpsBearerTag::GetInstanceTypeId
(
void
)
const
52
{
53
return
GetTypeId
();
54
}
55
56
EpsBearerTag::EpsBearerTag
()
57
: m_rnti (0),
58
m_bid (0)
59
{
60
}
61
EpsBearerTag::EpsBearerTag
(uint16_t rnti, uint8_t bid)
62
: m_rnti (rnti),
63
m_bid (bid)
64
{
65
}
66
67
void
68
EpsBearerTag::SetRnti
(uint16_t rnti)
69
{
70
m_rnti
= rnti;
71
}
72
73
void
74
EpsBearerTag::SetBid
(uint8_t bid)
75
{
76
m_bid
= bid;
77
}
78
79
uint32_t
80
EpsBearerTag::GetSerializedSize
(
void
)
const
81
{
82
return
3;
83
}
84
85
void
86
EpsBearerTag::Serialize
(
TagBuffer
i)
const
87
{
88
i.
WriteU16
(
m_rnti
);
89
i.
WriteU8
(
m_bid
);
90
}
91
92
void
93
EpsBearerTag::Deserialize
(
TagBuffer
i)
94
{
95
m_rnti
= (uint16_t) i.
ReadU16
();
96
m_bid
= (uint8_t) i.
ReadU8
();
97
}
98
99
uint16_t
100
EpsBearerTag::GetRnti
()
const
101
{
102
return
m_rnti
;
103
}
104
105
uint8_t
106
EpsBearerTag::GetBid
()
const
107
{
108
return
m_bid
;
109
}
110
111
void
112
EpsBearerTag::Print
(std::ostream &os)
const
113
{
114
os <<
"rnti="
<<
m_rnti
<<
", bid="
<< (uint16_t)
m_bid
;
115
}
116
117
}
// 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::EpsBearerTag::GetSerializedSize
virtual uint32_t GetSerializedSize() const
Definition:
eps-bearer-tag.cc:80
ns3::EpsBearerTag
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
Definition:
eps-bearer-tag.h:36
ns3::EpsBearerTag::m_rnti
uint16_t m_rnti
RNTI value.
Definition:
eps-bearer-tag.h:90
ns3::EpsBearerTag::SetBid
void SetBid(uint8_t bid)
Set the bearer id to the given value.
Definition:
eps-bearer-tag.cc:74
ns3::EpsBearerTag::Serialize
virtual void Serialize(TagBuffer i) const
Definition:
eps-bearer-tag.cc:86
eps-bearer-tag.h
ns3::TagBuffer::ReadU8
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition:
tag-buffer.h:195
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:44
ns3::EpsBearerTag::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Definition:
eps-bearer-tag.cc:51
ns3::TagBuffer::WriteU16
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition:
tag-buffer.h:180
ns3::EpsBearerTag::EpsBearerTag
EpsBearerTag()
Create an empty EpsBearerTag.
Definition:
eps-bearer-tag.cc:56
ns3::EpsBearerTag::SetRnti
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
Definition:
eps-bearer-tag.cc:68
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:36
ns3::EpsBearerTag::GetBid
uint8_t GetBid(void) const
Get Bearer Id function.
Definition:
eps-bearer-tag.cc:106
ns3::EpsBearerTag::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
eps-bearer-tag.cc:32
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TagBuffer::WriteU8
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition:
tag-buffer.h:172
ns3::EpsBearerTag::Print
virtual void Print(std::ostream &os) const
Definition:
eps-bearer-tag.cc:112
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:51
ns3::EpsBearerTag::Deserialize
virtual void Deserialize(TagBuffer i)
Definition:
eps-bearer-tag.cc:93
ns3::EpsBearerTag::m_bid
uint8_t m_bid
Bearer Id value.
Definition:
eps-bearer-tag.h:91
ns3::TagBuffer::ReadU16
TAG_BUFFER_INLINE uint16_t ReadU16(void)
Definition:
tag-buffer.h:205
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::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:915
ns3::EpsBearerTag::GetRnti
uint16_t GetRnti(void) const
Get RNTI function.
Definition:
eps-bearer-tag.cc:100
Generated on Wed Nov 7 2018 10:01:59 for ns-3 by
1.8.14