A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lte-radio-bearer-tag.cc
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  .AddConstructor<LteRadioBearerTag> ()
36  .AddAttribute ("rnti", "The rnti that indicates the UE to which packet belongs",
37  UintegerValue (0),
38  MakeUintegerAccessor (&LteRadioBearerTag::GetRnti),
39  MakeUintegerChecker<uint16_t> ())
40  .AddAttribute ("lcid", "The id whithin the UE identifying the logical channel to which the packet belongs",
41  UintegerValue (0),
42  MakeUintegerAccessor (&LteRadioBearerTag::GetLcid),
43  MakeUintegerChecker<uint8_t> ())
44  ;
45  return tid;
46 }
47 
48 TypeId
50 {
51  return GetTypeId ();
52 }
53 
55  : m_rnti (0),
56  m_lcid (0),
57  m_layer (0)
58 {
59 }
60 LteRadioBearerTag::LteRadioBearerTag (uint16_t rnti, uint8_t lcid)
61  : m_rnti (rnti),
62  m_lcid (lcid)
63 {
64 }
65 
66 LteRadioBearerTag::LteRadioBearerTag (uint16_t rnti, uint8_t lcid, uint8_t layer)
67 : m_rnti (rnti),
68  m_lcid (lcid),
69  m_layer (layer)
70 {
71 }
72 
73 void
75 {
76  m_rnti = rnti;
77 }
78 
79 void
81 {
82  m_lcid = lcid;
83 }
84 
85 void
87 {
88  m_layer = layer;
89 }
90 
91 uint32_t
93 {
94  return 4;
95 }
96 
97 void
99 {
100  i.WriteU16 (m_rnti);
101  i.WriteU8 (m_lcid);
102  i.WriteU8 (m_layer);
103 }
104 
105 void
107 {
108  m_rnti = (uint16_t) i.ReadU16 ();
109  m_lcid = (uint8_t) i.ReadU8 ();
110  m_layer = (uint8_t) i.ReadU8 ();
111 }
112 
113 uint16_t
114 LteRadioBearerTag::GetRnti () const
115 {
116  return m_rnti;
117 }
118 
119 uint8_t
120 LteRadioBearerTag::GetLcid () const
121 {
122  return m_lcid;
123 }
124 
125 uint8_t
126 LteRadioBearerTag::GetLayer () const
127 {
128  return m_layer;
129 }
130 
131 void
132 LteRadioBearerTag::Print (std::ostream &os) const
133 {
134  os << "rnti=" << m_rnti << ", lcid=" << (uint16_t) m_lcid << ", layer=" << (uint16_t)m_layer;
135 }
136 
137 } // namespace ns3
virtual uint32_t GetSerializedSize() const
void SetRnti(uint16_t tid)
TAG_BUFFER_INLINE uint8_t ReadU8(void)
Definition: tag-buffer.h:179
virtual void Print(std::ostream &os) const
TAG_BUFFER_INLINE void WriteU16(uint16_t v)
Definition: tag-buffer.h:164
virtual void Deserialize(TagBuffer i)
TAG_BUFFER_INLINE void WriteU8(uint8_t v)
Definition: tag-buffer.h:156
void SetLcid(uint8_t lcid)
read and write tag data
Definition: tag-buffer.h:51
virtual TypeId GetInstanceTypeId(void) const
TAG_BUFFER_INLINE uint16_t ReadU16(void)
Definition: tag-buffer.h:189
virtual void Serialize(TagBuffer i) const
void SetLayer(uint8_t lcid)