A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
eps-bearer-tag.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011,2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Marco Miozzo <marco.miozzo@cttc.es>
18 * Nicola Baldo <nbaldo@cttc.es>
19 */
20
21#include "eps-bearer-tag.h"
22
23#include "ns3/tag.h"
24#include "ns3/uinteger.h"
25
26namespace ns3
27{
28
29NS_OBJECT_ENSURE_REGISTERED(EpsBearerTag);
30
31TypeId
33{
34 static TypeId tid =
35 TypeId("ns3::EpsBearerTag")
36 .SetParent<Tag>()
37 .SetGroupName("Lte")
38 .AddConstructor<EpsBearerTag>()
39 .AddAttribute("rnti",
40 "The rnti that indicates the UE which packet belongs",
43 MakeUintegerChecker<uint16_t>())
44 .AddAttribute("bid",
45 "The EPS bearer id within the UE to which the packet belongs",
48 MakeUintegerChecker<uint8_t>());
49 return tid;
50}
51
54{
55 return GetTypeId();
56}
57
59 : m_rnti(0),
60 m_bid(0)
61{
62}
63
64EpsBearerTag::EpsBearerTag(uint16_t rnti, uint8_t bid)
65 : m_rnti(rnti),
66 m_bid(bid)
67{
68}
69
70void
72{
73 m_rnti = rnti;
74}
75
76void
78{
79 m_bid = bid;
80}
81
84{
85 return 3;
86}
87
88void
90{
92 i.WriteU8(m_bid);
93}
94
95void
97{
98 m_rnti = (uint16_t)i.ReadU16();
99 m_bid = (uint8_t)i.ReadU8();
100}
101
102uint16_t
104{
105 return m_rnti;
106}
107
108uint8_t
110{
111 return m_bid;
112}
113
114void
115EpsBearerTag::Print(std::ostream& os) const
116{
117 os << "rnti=" << m_rnti << ", bid=" << (uint16_t)m_bid;
118}
119
120} // namespace ns3
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint16_t m_rnti
RNTI value.
void Deserialize(TagBuffer i) override
uint8_t GetBid() const
Get Bearer Id function.
void Serialize(TagBuffer i) const override
static TypeId GetTypeId()
Get the type ID.
uint8_t m_bid
Bearer Id value.
void Print(std::ostream &os) const override
uint32_t GetSerializedSize() const override
uint16_t GetRnti() const
Get RNTI function.
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
void SetBid(uint8_t bid)
Set the bearer id to the given value.
EpsBearerTag()
Create an empty EpsBearerTag.
read and write tag data
Definition: tag-buffer.h:52
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:172
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition: tag-buffer.h:196
TAG_BUFFER_INLINE uint16_t ReadU16()
Definition: tag-buffer.h:206
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition: tag-buffer.h:180
tag a set of bytes in a packet
Definition: tag.h:39
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
Hold an unsigned integer type.
Definition: uinteger.h:45
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.