OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari | 3 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include <ns3/lte-enb-mac.h> | 35 #include <ns3/lte-enb-mac.h> |
36 #include <ns3/lte-enb-net-device.h> | 36 #include <ns3/lte-enb-net-device.h> |
37 #include <ns3/lte-enb-rrc.h> | 37 #include <ns3/lte-enb-rrc.h> |
38 #include <ns3/lte-ue-net-device.h> | 38 #include <ns3/lte-ue-net-device.h> |
39 #include <ns3/lte-enb-phy.h> | 39 #include <ns3/lte-enb-phy.h> |
40 #include <ns3/ff-mac-scheduler.h> | 40 #include <ns3/ff-mac-scheduler.h> |
41 #include <ns3/lte-handover-algorithm.h> | 41 #include <ns3/lte-handover-algorithm.h> |
42 #include <ns3/lte-anr.h> | 42 #include <ns3/lte-anr.h> |
43 #include <ns3/lte-ffr-algorithm.h> | 43 #include <ns3/lte-ffr-algorithm.h> |
44 #include <ns3/ipv4-l3-protocol.h> | 44 #include <ns3/ipv4-l3-protocol.h> |
| 45 #include <ns3/ipv6-l3-protocol.h> |
45 #include <ns3/abort.h> | 46 #include <ns3/abort.h> |
46 #include <ns3/log.h> | 47 #include <ns3/log.h> |
47 | 48 |
48 namespace ns3 { | 49 namespace ns3 { |
49 | 50 |
50 NS_LOG_COMPONENT_DEFINE ("LteEnbNetDevice"); | 51 NS_LOG_COMPONENT_DEFINE ("LteEnbNetDevice"); |
51 | 52 |
52 NS_OBJECT_ENSURE_REGISTERED ( LteEnbNetDevice); | 53 NS_OBJECT_ENSURE_REGISTERED ( LteEnbNetDevice); |
53 | 54 |
54 TypeId LteEnbNetDevice::GetTypeId (void) | 55 TypeId LteEnbNetDevice::GetTypeId (void) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 MakePointerAccessor (&LteEnbNetDevice::m_scheduler), | 90 MakePointerAccessor (&LteEnbNetDevice::m_scheduler), |
90 MakePointerChecker <FfMacScheduler> ()) | 91 MakePointerChecker <FfMacScheduler> ()) |
91 .AddAttribute ("LteEnbPhy", | 92 .AddAttribute ("LteEnbPhy", |
92 "The PHY associated to this EnbNetDevice", | 93 "The PHY associated to this EnbNetDevice", |
93 PointerValue (), | 94 PointerValue (), |
94 MakePointerAccessor (&LteEnbNetDevice::m_phy), | 95 MakePointerAccessor (&LteEnbNetDevice::m_phy), |
95 MakePointerChecker <LteEnbPhy> ()) | 96 MakePointerChecker <LteEnbPhy> ()) |
96 .AddAttribute ("UlBandwidth", | 97 .AddAttribute ("UlBandwidth", |
97 "Uplink Transmission Bandwidth Configuration in number of Res
ource Blocks", | 98 "Uplink Transmission Bandwidth Configuration in number of Res
ource Blocks", |
98 UintegerValue (25), | 99 UintegerValue (25), |
99 MakeUintegerAccessor (&LteEnbNetDevice::SetUlBandwidth, | 100 MakeUintegerAccessor (&LteEnbNetDevice::SetUlBandwidth, |
100 &LteEnbNetDevice::GetUlBandwidth), | 101 &LteEnbNetDevice::GetUlBandwidth), |
101 MakeUintegerChecker<uint8_t> ()) | 102 MakeUintegerChecker<uint8_t> ()) |
102 .AddAttribute ("DlBandwidth", | 103 .AddAttribute ("DlBandwidth", |
103 "Downlink Transmission Bandwidth Configuration in number of R
esource Blocks", | 104 "Downlink Transmission Bandwidth Configuration in number of R
esource Blocks", |
104 UintegerValue (25), | 105 UintegerValue (25), |
105 MakeUintegerAccessor (&LteEnbNetDevice::SetDlBandwidth, | 106 MakeUintegerAccessor (&LteEnbNetDevice::SetDlBandwidth, |
106 &LteEnbNetDevice::GetDlBandwidth), | 107 &LteEnbNetDevice::GetDlBandwidth), |
107 MakeUintegerChecker<uint8_t> ()) | 108 MakeUintegerChecker<uint8_t> ()) |
108 .AddAttribute ("CellId", | 109 .AddAttribute ("CellId", |
109 "Cell Identifier", | 110 "Cell Identifier", |
110 UintegerValue (0), | 111 UintegerValue (0), |
111 MakeUintegerAccessor (&LteEnbNetDevice::m_cellId), | 112 MakeUintegerAccessor (&LteEnbNetDevice::m_cellId), |
112 MakeUintegerChecker<uint16_t> ()) | 113 MakeUintegerChecker<uint16_t> ()) |
113 .AddAttribute ("DlEarfcn", | 114 .AddAttribute ("DlEarfcn", |
114 "Downlink E-UTRA Absolute Radio Frequency Channel Number (EAR
FCN) " | 115 "Downlink E-UTRA Absolute Radio Frequency Channel Number (EAR
FCN) " |
115 "as per 3GPP 36.101 Section 5.7.3. ", | 116 "as per 3GPP 36.101 Section 5.7.3. ", |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 { | 205 { |
205 return m_rrc; | 206 return m_rrc; |
206 } | 207 } |
207 | 208 |
208 uint16_t | 209 uint16_t |
209 LteEnbNetDevice::GetCellId () const | 210 LteEnbNetDevice::GetCellId () const |
210 { | 211 { |
211 return m_cellId; | 212 return m_cellId; |
212 } | 213 } |
213 | 214 |
214 uint8_t | 215 uint8_t |
215 LteEnbNetDevice::GetUlBandwidth () const | 216 LteEnbNetDevice::GetUlBandwidth () const |
216 { | 217 { |
217 return m_ulBandwidth; | 218 return m_ulBandwidth; |
218 } | 219 } |
219 | 220 |
220 void | 221 void |
221 LteEnbNetDevice::SetUlBandwidth (uint8_t bw) | 222 LteEnbNetDevice::SetUlBandwidth (uint8_t bw) |
222 { | 223 { |
223 NS_LOG_FUNCTION (this << uint16_t (bw)); | 224 NS_LOG_FUNCTION (this << uint16_t (bw)); |
224 switch (bw) | 225 switch (bw) |
225 { | 226 { |
226 case 6: | 227 case 6: |
227 case 15: | 228 case 15: |
228 case 25: | 229 case 25: |
229 case 50: | 230 case 50: |
230 case 75: | 231 case 75: |
231 case 100: | 232 case 100: |
232 m_ulBandwidth = bw; | 233 m_ulBandwidth = bw; |
233 break; | 234 break; |
234 | 235 |
235 default: | 236 default: |
236 NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); | 237 NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); |
237 break; | 238 break; |
238 } | 239 } |
239 } | 240 } |
240 | 241 |
241 uint8_t | 242 uint8_t |
242 LteEnbNetDevice::GetDlBandwidth () const | 243 LteEnbNetDevice::GetDlBandwidth () const |
243 { | 244 { |
244 return m_dlBandwidth; | 245 return m_dlBandwidth; |
245 } | 246 } |
246 | 247 |
247 void | 248 void |
248 LteEnbNetDevice::SetDlBandwidth (uint8_t bw) | 249 LteEnbNetDevice::SetDlBandwidth (uint8_t bw) |
249 { | 250 { |
250 NS_LOG_FUNCTION (this << uint16_t (bw)); | 251 NS_LOG_FUNCTION (this << uint16_t (bw)); |
251 switch (bw) | 252 switch (bw) |
252 { | 253 { |
253 case 6: | 254 case 6: |
254 case 15: | 255 case 15: |
255 case 25: | 256 case 25: |
256 case 50: | 257 case 50: |
257 case 75: | 258 case 75: |
258 case 100: | 259 case 100: |
259 m_dlBandwidth = bw; | 260 m_dlBandwidth = bw; |
260 break; | 261 break; |
261 | 262 |
262 default: | 263 default: |
263 NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); | 264 NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); |
264 break; | 265 break; |
265 } | 266 } |
266 } | 267 } |
267 | 268 |
268 uint16_t | 269 uint16_t |
269 LteEnbNetDevice::GetDlEarfcn () const | 270 LteEnbNetDevice::GetDlEarfcn () const |
270 { | 271 { |
271 return m_dlEarfcn; | 272 return m_dlEarfcn; |
272 } | 273 } |
273 | 274 |
274 void | 275 void |
275 LteEnbNetDevice::SetDlEarfcn (uint16_t earfcn) | 276 LteEnbNetDevice::SetDlEarfcn (uint16_t earfcn) |
276 { | 277 { |
277 NS_LOG_FUNCTION (this << earfcn); | 278 NS_LOG_FUNCTION (this << earfcn); |
278 m_dlEarfcn = earfcn; | 279 m_dlEarfcn = earfcn; |
279 } | 280 } |
280 | 281 |
281 uint16_t | 282 uint16_t |
282 LteEnbNetDevice::GetUlEarfcn () const | 283 LteEnbNetDevice::GetUlEarfcn () const |
283 { | 284 { |
284 return m_ulEarfcn; | 285 return m_ulEarfcn; |
285 } | 286 } |
286 | 287 |
287 void | 288 void |
288 LteEnbNetDevice::SetUlEarfcn (uint16_t earfcn) | 289 LteEnbNetDevice::SetUlEarfcn (uint16_t earfcn) |
289 { | 290 { |
290 NS_LOG_FUNCTION (this << earfcn); | 291 NS_LOG_FUNCTION (this << earfcn); |
291 m_ulEarfcn = earfcn; | 292 m_ulEarfcn = earfcn; |
292 } | 293 } |
293 | 294 |
294 uint32_t | 295 uint32_t |
295 LteEnbNetDevice::GetCsgId () const | 296 LteEnbNetDevice::GetCsgId () const |
296 { | 297 { |
297 return m_csgId; | 298 return m_csgId; |
298 } | 299 } |
299 | 300 |
(...skipping 13 matching lines...) Expand all Loading... |
313 | 314 |
314 void | 315 void |
315 LteEnbNetDevice::SetCsgIndication (bool csgIndication) | 316 LteEnbNetDevice::SetCsgIndication (bool csgIndication) |
316 { | 317 { |
317 NS_LOG_FUNCTION (this << csgIndication); | 318 NS_LOG_FUNCTION (this << csgIndication); |
318 m_csgIndication = csgIndication; | 319 m_csgIndication = csgIndication; |
319 UpdateConfig (); // propagate the change to RRC level | 320 UpdateConfig (); // propagate the change to RRC level |
320 } | 321 } |
321 | 322 |
322 | 323 |
323 void | 324 void |
324 LteEnbNetDevice::DoInitialize (void) | 325 LteEnbNetDevice::DoInitialize (void) |
325 { | 326 { |
326 NS_LOG_FUNCTION (this); | 327 NS_LOG_FUNCTION (this); |
327 m_isConstructed = true; | 328 m_isConstructed = true; |
328 UpdateConfig (); | 329 UpdateConfig (); |
329 m_phy->Initialize (); | 330 m_phy->Initialize (); |
330 m_mac->Initialize (); | 331 m_mac->Initialize (); |
331 m_rrc->Initialize (); | 332 m_rrc->Initialize (); |
332 m_handoverAlgorithm->Initialize (); | 333 m_handoverAlgorithm->Initialize (); |
333 | 334 |
334 if (m_anr != 0) | 335 if (m_anr != 0) |
335 { | 336 { |
336 m_anr->Initialize (); | 337 m_anr->Initialize (); |
337 } | 338 } |
338 | 339 |
339 m_ffrAlgorithm->Initialize (); | 340 m_ffrAlgorithm->Initialize (); |
340 } | 341 } |
341 | 342 |
342 | 343 |
343 bool | 344 bool |
344 LteEnbNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protoco
lNumber) | 345 LteEnbNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protoco
lNumber) |
345 { | 346 { |
346 NS_LOG_FUNCTION (this << packet << dest << protocolNumber); | 347 NS_LOG_FUNCTION (this << packet << dest << protocolNumber); |
347 NS_ASSERT_MSG (protocolNumber == Ipv4L3Protocol::PROT_NUMBER, "unsupported pro
tocol " << protocolNumber << ", only IPv4 is supported"); | 348 |
| 349 if ( (protocolNumber != Ipv4L3Protocol::PROT_NUMBER) && |
| 350 (protocolNumber != Ipv6L3Protocol::PROT_NUMBER) ) |
| 351 { |
| 352 NS_LOG_LOGIC("Discarding packet for unsupported protocol " << protocolNumb
er); |
| 353 // Let ICMPv6 go through ? |
| 354 if(!ns3::lteUseIpv6)······ |
| 355 return false; |
| 356 } |
| 357 |
348 return m_rrc->SendData (packet); | 358 return m_rrc->SendData (packet); |
349 } | 359 } |
350 | 360 |
351 | 361 |
352 void | 362 void |
353 LteEnbNetDevice::UpdateConfig (void) | 363 LteEnbNetDevice::UpdateConfig (void) |
354 { | 364 { |
355 NS_LOG_FUNCTION (this); | 365 NS_LOG_FUNCTION (this); |
356 | 366 |
357 if (m_isConstructed) | 367 if (m_isConstructed) |
(...skipping 15 matching lines...) Expand all Loading... |
373 { | 383 { |
374 /* | 384 /* |
375 * Lower layers are not ready yet, so do nothing now and expect | 385 * Lower layers are not ready yet, so do nothing now and expect |
376 * ``DoInitialize`` to re-invoke this function. | 386 * ``DoInitialize`` to re-invoke this function. |
377 */ | 387 */ |
378 } | 388 } |
379 } | 389 } |
380 | 390 |
381 | 391 |
382 } // namespace ns3 | 392 } // namespace ns3 |
OLD | NEW |