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