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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Marco Miozzo <marco.miozzo@cttc.es>
7 * Nicola Baldo <nbaldo@cttc.es>
8 */
9
10#include "eps-bearer-tag.h"
11
12#include "ns3/tag.h"
13#include "ns3/uinteger.h"
14
15namespace ns3
16{
17
18NS_OBJECT_ENSURE_REGISTERED(EpsBearerTag);
19
20TypeId
22{
23 static TypeId tid =
24 TypeId("ns3::EpsBearerTag")
25 .SetParent<Tag>()
26 .SetGroupName("Lte")
27 .AddConstructor<EpsBearerTag>()
28 .AddAttribute("rnti",
29 "The rnti that indicates the UE which packet belongs",
33 .AddAttribute("bid",
34 "The EPS bearer id within the UE to which the packet belongs",
38 return tid;
39}
40
43{
44 return GetTypeId();
45}
46
48 : m_rnti(0),
49 m_bid(0)
50{
51}
52
53EpsBearerTag::EpsBearerTag(uint16_t rnti, uint8_t bid)
54 : m_rnti(rnti),
55 m_bid(bid)
56{
57}
58
59void
61{
62 m_rnti = rnti;
63}
64
65void
67{
68 m_bid = bid;
69}
70
73{
74 return 3;
75}
76
77void
83
84void
86{
87 m_rnti = (uint16_t)i.ReadU16();
88 m_bid = (uint8_t)i.ReadU8();
89}
90
91uint16_t
93{
94 return m_rnti;
95}
96
97uint8_t
99{
100 return m_bid;
101}
102
103void
104EpsBearerTag::Print(std::ostream& os) const
105{
106 os << "rnti=" << m_rnti << ", bid=" << (uint16_t)m_bid;
107}
108
109} // 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:41
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition tag-buffer.h:161
TAG_BUFFER_INLINE uint8_t ReadU8()
Definition tag-buffer.h:185
TAG_BUFFER_INLINE uint16_t ReadU16()
Definition tag-buffer.h:195
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition tag-buffer.h:169
tag a set of bytes in a packet
Definition tag.h:28
a unique identifier for an interface.
Definition type-id.h:48
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeUintegerChecker()
Definition uinteger.h:85
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition uinteger.h:35