author | Nicola Baldo <nbaldo@cttc.es> |
Tue, 10 May 2011 12:03:38 +0200 | |
changeset 8032 | ecc5171f1f96 |
parent 8007 | 845888b95c15 |
child 8148 | 09e2d03022a2 |
child 8153 | 1823fe30eb2f |
permissions | -rw-r--r-- |
7886 | 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: Nicola Baldo <nbaldo@cttc.es> |
|
19 |
*/ |
|
20 |
||
21 |
#include <ns3/fatal-error.h> |
|
22 |
#include <ns3/log.h> |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
23 |
#include "ns3/pointer.h" |
7886 | 24 |
|
25 |
#include "lte-enb-rrc.h" |
|
26 |
#include "lte-rlc.h" |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
27 |
#include "ns3/object-map.h" |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
28 |
#include "ns3/object-vector.h" |
7886 | 29 |
|
30 |
||
31 |
NS_LOG_COMPONENT_DEFINE ("LteEnbRrc"); |
|
32 |
||
33 |
namespace ns3 { |
|
34 |
||
35 |
||
36 |
||
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
37 |
|
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
38 |
|
7886 | 39 |
// /////////////////////////// |
40 |
// CMAC SAP forwarder |
|
41 |
// /////////////////////////// |
|
42 |
||
7888 | 43 |
class EnbRrcMemberLteEnbCmacSapUser : public LteEnbCmacSapUser |
7886 | 44 |
{ |
45 |
public: |
|
7888 | 46 |
EnbRrcMemberLteEnbCmacSapUser (LteEnbRrc* rrc); |
7886 | 47 |
|
48 |
virtual void NotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success); |
|
49 |
||
50 |
private: |
|
51 |
LteEnbRrc* m_rrc; |
|
52 |
}; |
|
53 |
||
7888 | 54 |
EnbRrcMemberLteEnbCmacSapUser::EnbRrcMemberLteEnbCmacSapUser (LteEnbRrc* rrc) |
7886 | 55 |
: m_rrc (rrc) |
56 |
{ |
|
57 |
} |
|
58 |
||
59 |
void |
|
7888 | 60 |
EnbRrcMemberLteEnbCmacSapUser::NotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success) |
7886 | 61 |
{ |
62 |
m_rrc->DoNotifyLcConfigResult (rnti, lcid, success); |
|
63 |
} |
|
64 |
||
65 |
||
66 |
||
67 |
// ///////////////////////////////////////// |
|
68 |
// per-UE radio bearer info management |
|
69 |
// ///////////////////////////////////////// |
|
70 |
||
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
71 |
class EnbRadioBearerInfo : public Object |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
72 |
{ |
7886 | 73 |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
74 |
public: |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
75 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
76 |
EnbRadioBearerInfo(void); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
77 |
virtual ~EnbRadioBearerInfo (void); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
78 |
static TypeId GetTypeId (void); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
79 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
80 |
void SetRlc(Ptr<LteRlc> rlc); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
81 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
82 |
private: |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
83 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
84 |
Ptr<LteRlc> m_rlc; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
85 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
86 |
}; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
87 |
|
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
88 |
NS_OBJECT_ENSURE_REGISTERED(EnbRadioBearerInfo); |
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
89 |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
90 |
EnbRadioBearerInfo::EnbRadioBearerInfo (void) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
91 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
92 |
// Nothing to do here |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
93 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
94 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
95 |
EnbRadioBearerInfo::~EnbRadioBearerInfo (void) |
7886 | 96 |
{ |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
97 |
// Nothing to do here |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
98 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
99 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
100 |
TypeId EnbRadioBearerInfo::GetTypeId (void) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
101 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
102 |
static TypeId |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
103 |
tid = |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
104 |
TypeId ("ns3::EnbRadioBearerInfo") |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
105 |
.SetParent<Object> () |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
106 |
.AddConstructor<EnbRadioBearerInfo> () |
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
107 |
.AddAttribute ("LteRlc", "RLC instance of the radio bearer.", |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
108 |
PointerValue (), |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
109 |
MakePointerAccessor (&EnbRadioBearerInfo::m_rlc), |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
110 |
MakePointerChecker<LteRlc> ()) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
111 |
; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
112 |
return tid; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
113 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
114 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
115 |
void EnbRadioBearerInfo::SetRlc(Ptr<LteRlc> rlc) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
116 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
117 |
m_rlc = rlc; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
118 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
119 |
|
7886 | 120 |
|
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
121 |
NS_OBJECT_ENSURE_REGISTERED(UeInfo); |
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
122 |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
123 |
UeInfo::UeInfo (void) : |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
124 |
m_lastAllocatedId (0) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
125 |
{ |
8007 | 126 |
m_imsi = 0; |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
127 |
} |
7886 | 128 |
|
8007 | 129 |
UeInfo::UeInfo (uint64_t imsi) : |
130 |
m_lastAllocatedId (0) |
|
131 |
{ |
|
132 |
m_imsi = imsi; |
|
133 |
} |
|
134 |
||
135 |
||
136 |
||
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
137 |
UeInfo::~UeInfo (void) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
138 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
139 |
// Nothing to do here |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
140 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
141 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
142 |
TypeId UeInfo::GetTypeId (void) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
143 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
144 |
static TypeId tid = TypeId ("ns3::UeInfo") |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
145 |
.SetParent<Object> () |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
146 |
.AddConstructor<UeInfo> () |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
147 |
.AddAttribute ("RadioBearerMap", "List of UE RadioBearerInfo by LCID.", |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
148 |
ObjectMapValue (), |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
149 |
MakeObjectMapAccessor (&UeInfo::m_rbMap), |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
150 |
MakeObjectMapChecker<EnbRadioBearerInfo> ()) |
8007 | 151 |
/* .AddAttribute("Imsi", |
152 |
"International Mobile Subscriber Identity assigned to this UE", |
|
153 |
UintegerValue (1), |
|
154 |
MakeUintegerAccessor (&UeInfo::m_imsi), |
|
155 |
MakeUintegerChecker<uint64_t> ())*/ |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
156 |
; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
157 |
return tid; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
158 |
} |
7886 | 159 |
|
8007 | 160 |
uint64_t |
161 |
UeInfo::GetImsi (void) |
|
162 |
{ |
|
163 |
return m_imsi; |
|
164 |
} |
|
165 |
||
7886 | 166 |
uint8_t |
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
167 |
UeInfo::AddRadioBearer (Ptr<EnbRadioBearerInfo> rbi) |
7886 | 168 |
{ |
169 |
NS_LOG_FUNCTION (this); |
|
170 |
for (uint8_t lcid = m_lastAllocatedId; lcid != m_lastAllocatedId - 1; ++lcid) |
|
171 |
{ |
|
172 |
if (lcid != 0) |
|
173 |
{ |
|
174 |
if (m_rbMap.find (lcid) == m_rbMap.end ()) |
|
175 |
{ |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
176 |
m_rbMap.insert (std::pair<uint8_t, Ptr<EnbRadioBearerInfo> >(lcid, rbi)); |
7886 | 177 |
m_lastAllocatedId = lcid; |
178 |
return lcid; |
|
179 |
} |
|
180 |
} |
|
181 |
} |
|
182 |
NS_LOG_WARN ("no more logical channel ids available"); |
|
183 |
return 0; |
|
184 |
} |
|
185 |
||
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
186 |
Ptr<EnbRadioBearerInfo> |
7886 | 187 |
UeInfo::GetRadioBerer (uint8_t lcid) |
188 |
{ |
|
189 |
NS_LOG_FUNCTION (this << (uint32_t) lcid); |
|
190 |
NS_ASSERT (0 != lcid); |
|
191 |
return m_rbMap.find (lcid)->second; |
|
192 |
} |
|
193 |
||
194 |
||
195 |
void |
|
196 |
UeInfo::RemoveRadioBearer (uint8_t lcid) |
|
197 |
{ |
|
198 |
NS_LOG_FUNCTION (this << (uint32_t) lcid); |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
199 |
std::map <uint8_t, Ptr<EnbRadioBearerInfo> >::iterator it = m_rbMap.find (lcid); |
7886 | 200 |
NS_ASSERT_MSG (it != m_rbMap.end (), "request to remove radio bearer with unknown lcid " << lcid); |
201 |
m_rbMap.erase (it); |
|
202 |
} |
|
203 |
||
204 |
||
205 |
||
206 |
||
207 |
||
208 |
// /////////////////////////// |
|
209 |
// eNB RRC methods |
|
210 |
// /////////////////////////// |
|
211 |
||
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
212 |
NS_OBJECT_ENSURE_REGISTERED (LteEnbRrc); |
7886 | 213 |
|
214 |
LteEnbRrc::LteEnbRrc () |
|
215 |
: m_cmacSapProvider (0), |
|
216 |
m_ffMacSchedSapProvider (0), |
|
217 |
m_macSapProvider (0), |
|
218 |
m_configured (false), |
|
219 |
m_lastAllocatedRnti (0) |
|
220 |
{ |
|
221 |
NS_LOG_FUNCTION (this); |
|
7888 | 222 |
m_cmacSapUser = new EnbRrcMemberLteEnbCmacSapUser (this); |
7886 | 223 |
} |
224 |
||
225 |
||
226 |
LteEnbRrc::~LteEnbRrc () |
|
227 |
{ |
|
228 |
NS_LOG_FUNCTION (this); |
|
229 |
} |
|
230 |
||
231 |
||
232 |
void |
|
233 |
LteEnbRrc::DoDispose () |
|
234 |
{ |
|
235 |
NS_LOG_FUNCTION (this); |
|
236 |
delete m_cmacSapUser; |
|
237 |
} |
|
238 |
||
239 |
TypeId |
|
240 |
LteEnbRrc::GetTypeId (void) |
|
241 |
{ |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
242 |
NS_LOG_FUNCTION ("LteEnbRrc::GetTypeId"); |
7886 | 243 |
static TypeId tid = TypeId ("ns3::LteEnbRrc") |
244 |
.SetParent<Object> () |
|
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
245 |
.AddConstructor<LteEnbRrc> () |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
246 |
.AddAttribute ("UeMap", "List of UE Info by C-RNTI.", |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
247 |
ObjectMapValue (), |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
248 |
MakeObjectMapAccessor (&LteEnbRrc::m_ueMap), |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
249 |
MakeObjectMapChecker<UeInfo> ()) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
250 |
; |
7886 | 251 |
return tid; |
252 |
} |
|
253 |
||
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
254 |
uint16_t |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
255 |
LteEnbRrc::GetLastAllocatedRnti() const |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
256 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
257 |
NS_LOG_FUNCTION (this); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
258 |
return m_lastAllocatedRnti; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
259 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
260 |
std::map<uint16_t,Ptr<UeInfo> > LteEnbRrc::GetUeMap(void) const |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
261 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
262 |
return m_ueMap; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
263 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
264 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
265 |
void LteEnbRrc::SetUeMap(std::map<uint16_t,Ptr<UeInfo> > ueMap) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
266 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
267 |
this->m_ueMap = ueMap; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
268 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
269 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
270 |
|
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
271 |
void |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
272 |
LteEnbRrc::SetLastAllocatedRnti(uint16_t lastAllocatedRnti) |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
273 |
{ |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
274 |
NS_LOG_FUNCTION (this << lastAllocatedRnti); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
275 |
m_lastAllocatedRnti = lastAllocatedRnti; |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
276 |
} |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
277 |
|
7886 | 278 |
|
279 |
||
280 |
void |
|
281 |
LteEnbRrc::SetLteEnbCmacSapProvider (LteEnbCmacSapProvider * s) |
|
282 |
{ |
|
283 |
NS_LOG_FUNCTION (this << s); |
|
284 |
m_cmacSapProvider = s; |
|
285 |
} |
|
286 |
||
287 |
LteEnbCmacSapUser* |
|
288 |
LteEnbRrc::GetLteEnbCmacSapUser () |
|
289 |
{ |
|
290 |
NS_LOG_FUNCTION (this); |
|
291 |
return m_cmacSapUser; |
|
292 |
} |
|
293 |
||
294 |
void |
|
295 |
LteEnbRrc::SetFfMacSchedSapProvider (FfMacSchedSapProvider * s) |
|
296 |
{ |
|
297 |
NS_LOG_FUNCTION (this); |
|
298 |
m_ffMacSchedSapProvider = s; |
|
299 |
} |
|
300 |
||
301 |
||
302 |
void |
|
303 |
LteEnbRrc::SetLteMacSapProvider (LteMacSapProvider * s) |
|
304 |
{ |
|
305 |
NS_LOG_FUNCTION (this); |
|
306 |
m_macSapProvider = s; |
|
307 |
} |
|
308 |
||
309 |
||
310 |
void |
|
311 |
LteEnbRrc::ConfigureCell (uint8_t ulBandwidth, uint8_t dlBandwidth) |
|
312 |
{ |
|
313 |
NS_LOG_FUNCTION (this); |
|
314 |
NS_ASSERT (!m_configured); |
|
315 |
m_cmacSapProvider->ConfigureMac (ulBandwidth, dlBandwidth); |
|
316 |
m_configured = true; |
|
317 |
} |
|
318 |
||
319 |
uint16_t |
|
8007 | 320 |
LteEnbRrc::AddUe (uint64_t imsi) |
7886 | 321 |
{ |
8032 | 322 |
NS_LOG_FUNCTION (this << imsi); |
7886 | 323 |
// no Call Admission Control for now |
8007 | 324 |
uint16_t rnti = CreateUeInfo (imsi); // side effect: create UeInfo for this UE |
7886 | 325 |
NS_ASSERT_MSG (rnti != 0, "CreateUeInfo returned RNTI==0"); |
326 |
m_cmacSapProvider->AddUe (rnti); |
|
327 |
return rnti; |
|
328 |
} |
|
329 |
||
330 |
void |
|
331 |
LteEnbRrc::RemoveUe (uint16_t rnti) |
|
332 |
{ |
|
333 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
334 |
RemoveUeInfo (rnti); |
|
335 |
NS_FATAL_ERROR ("missing RemoveUe method in CMAC SAP"); |
|
336 |
} |
|
337 |
||
338 |
uint8_t |
|
339 |
LteEnbRrc::SetupRadioBearer (uint16_t rnti, EpsBearer bearer) |
|
340 |
{ |
|
341 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
342 |
Ptr<UeInfo> ueInfo = GetUeInfo (rnti); |
|
343 |
||
344 |
// create RLC instance |
|
345 |
// for now we support RLC SM only |
|
346 |
||
7905
80557b09aa7f
Added missing NS_OBJECT_ENSURE_REGISTERED to all ns3::Objects created.
jnin
parents:
7903
diff
changeset
|
347 |
Ptr<LteRlc> rlc = CreateObject<LteRlcSm> (); |
7886 | 348 |
rlc->SetLteMacSapProvider (m_macSapProvider); |
349 |
rlc->SetRnti (rnti); |
|
350 |
||
7901
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
351 |
Ptr<EnbRadioBearerInfo> rbInfo = CreateObject<EnbRadioBearerInfo> (); |
2451f71f1ce4
Added attributes to enable access to RLC instances in Enb
jnin
parents:
7888
diff
changeset
|
352 |
rbInfo->SetRlc (rlc); |
7886 | 353 |
uint8_t lcid = ueInfo->AddRadioBearer (rbInfo); |
354 |
rlc->SetLcId (lcid); |
|
355 |
||
356 |
LteEnbCmacSapProvider::LcInfo lcinfo; |
|
357 |
lcinfo.rnti = rnti; |
|
358 |
lcinfo.lcId = lcid; |
|
359 |
lcinfo.lcGroup = 0; // TBD |
|
360 |
lcinfo.qci = bearer.qci; |
|
361 |
lcinfo.isGbr = bearer.IsGbr (); |
|
362 |
lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl; |
|
363 |
lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl; |
|
364 |
lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl; |
|
365 |
lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl; |
|
366 |
m_cmacSapProvider->AddLc (lcinfo, rlc->GetLteMacSapUser ()); |
|
367 |
||
368 |
return lcid; |
|
369 |
} |
|
370 |
||
371 |
void |
|
372 |
LteEnbRrc::ReleaseRadioBearer (uint16_t rnti, uint8_t lcId) |
|
373 |
{ |
|
374 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
375 |
Ptr<UeInfo> ueInfo = GetUeInfo (rnti); |
|
376 |
ueInfo->RemoveRadioBearer (lcId); |
|
377 |
} |
|
378 |
||
379 |
void |
|
380 |
LteEnbRrc::DoNotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success) |
|
381 |
{ |
|
382 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
383 |
NS_FATAL_ERROR ("not implemented"); |
|
384 |
} |
|
385 |
||
386 |
||
387 |
||
388 |
// ///////////////////////////////////////// |
|
389 |
// management of multiple UE info instances |
|
390 |
// ///////////////////////////////////////// |
|
391 |
||
392 |
||
393 |
uint16_t |
|
8007 | 394 |
LteEnbRrc::CreateUeInfo (uint64_t imsi) |
7886 | 395 |
{ |
8032 | 396 |
NS_LOG_FUNCTION (this << imsi); |
7886 | 397 |
for (uint16_t rnti = m_lastAllocatedRnti; rnti != m_lastAllocatedRnti - 1; ++rnti) |
398 |
{ |
|
399 |
if (rnti != 0) |
|
400 |
{ |
|
401 |
if (m_ueMap.find (rnti) == m_ueMap.end ()) |
|
402 |
{ |
|
403 |
m_lastAllocatedRnti = rnti; |
|
8007 | 404 |
m_ueMap.insert (std::pair<uint16_t, Ptr<UeInfo> > (rnti, CreateObject<UeInfo> (imsi))); |
7886 | 405 |
return rnti; |
406 |
} |
|
407 |
} |
|
408 |
} |
|
409 |
return 0; |
|
410 |
} |
|
411 |
||
412 |
Ptr<UeInfo> |
|
413 |
LteEnbRrc::GetUeInfo (uint16_t rnti) |
|
414 |
{ |
|
415 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
416 |
NS_ASSERT (0 != rnti); |
|
417 |
return m_ueMap.find (rnti)->second; |
|
418 |
} |
|
419 |
||
420 |
void |
|
421 |
LteEnbRrc::RemoveUeInfo (uint16_t rnti) |
|
422 |
{ |
|
423 |
NS_LOG_FUNCTION (this << (uint32_t) rnti); |
|
424 |
std::map <uint16_t, Ptr<UeInfo> >::iterator it = m_ueMap.find (rnti); |
|
425 |
NS_ASSERT_MSG (it != m_ueMap.end (), "request to remove UE info with unknown rnti " << rnti); |
|
426 |
m_ueMap.erase (it); |
|
427 |
} |
|
428 |
||
429 |
||
430 |
||
431 |
||
432 |
||
433 |
} // namespace ns3 |
|
434 |