A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
32 {
33  static TypeId tid = TypeId ("ns3::LteRadioBearerTag")
34  .SetParent<Tag> ()
35  .AddConstructor<LteRadioBearerTag> ()
36  .AddAttribute ("rnti", "The rnti that indicates the UE which packet belongs",
37  UintegerValue (0),
38  MakeUintegerAccessor (&LteRadioBearerTag::GetRnti),
39  MakeUintegerChecker<uint16_t> ())
40  .AddAttribute ("lcid", "The LC id that indicates the UE which 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 3;
95 }
96 
97 void
99 {
100  i.WriteU16 (m_rnti);
101  i.WriteU8 (m_lcid);
102 }
103 
104 void
106 {
107  m_rnti = (uint16_t) i.ReadU16 ();
108  m_lcid = (uint8_t) i.ReadU8 ();
109 }
110 
111 uint16_t
113 {
114  return m_rnti;
115 }
116 
117 uint8_t
119 {
120  return m_lcid;
121 }
122 
123 uint8_t
125 {
126  return m_layer;
127 }
128 
129 void
130 LteRadioBearerTag::Print (std::ostream &os) const
131 {
132  os << "rnti=" << m_rnti << ", lcid=" << (uint16_t) m_lcid;
133 }
134 
135 } // namespace ns3