A Discrete-Event Network Simulator
API
lte-enb-rrc.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3  * Copyright (c) 2018 Fraunhofer ESK : RLF extensions
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  * Authors:
19  * Nicola Baldo <nbaldo@cttc.es>
20  * Marco Miozzo <mmiozzo@cttc.es>
21  * Manuel Requena <manuel.requena@cttc.es>
22  * Modified by:
23  * Danilo Abrignani <danilo.abrignani@unibo.it> (Carrier Aggregation - GSoC 2015),
24  * Biljana Bojovic <biljana.bojovic@cttc.es> (Carrier Aggregation)
25  * Vignesh Babu <ns3-dev@esk.fraunhofer.de> (RLF extensions)
26  */
27 
28 #include "lte-enb-rrc.h"
29 
30 #include "component-carrier-enb.h"
31 #include "eps-bearer-tag.h"
32 #include "lte-pdcp.h"
33 #include "lte-radio-bearer-info.h"
34 #include "lte-rlc-am.h"
35 #include "lte-rlc-tm.h"
36 #include "lte-rlc-um.h"
37 #include "lte-rlc.h"
38 
39 #include <ns3/abort.h>
40 #include <ns3/fatal-error.h>
41 #include <ns3/log.h>
42 #include <ns3/object-factory.h>
43 #include <ns3/object-map.h>
44 #include <ns3/packet.h>
45 #include <ns3/pointer.h>
46 #include <ns3/simulator.h>
47 
48 namespace ns3
49 {
50 
51 NS_LOG_COMPONENT_DEFINE("LteEnbRrc");
52 
54 // CMAC SAP forwarder
56 
61 {
62  public:
69  EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc* rrc, uint8_t componentCarrierId);
70 
71  uint16_t AllocateTemporaryCellRnti() override;
72  void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override;
74  bool IsRandomAccessCompleted(uint16_t rnti) override;
75 
76  private:
79 };
80 
82  uint8_t componentCarrierId)
83  : m_rrc(rrc),
84  m_componentCarrierId{componentCarrierId}
85 {
86 }
87 
88 uint16_t
90 {
92 }
93 
94 void
95 EnbRrcMemberLteEnbCmacSapUser::NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
96 {
97  m_rrc->DoNotifyLcConfigResult(rnti, lcid, success);
98 }
99 
100 void
102 {
104 }
105 
106 bool
108 {
109  return m_rrc->IsRandomAccessCompleted(rnti);
110 }
111 
113 // UeManager
115 
117 static const std::string g_ueManagerStateName[UeManager::NUM_STATES] = {
118  "INITIAL_RANDOM_ACCESS",
119  "CONNECTION_SETUP",
120  "CONNECTION_REJECTED",
121  "ATTACH_REQUEST",
122  "CONNECTED_NORMALLY",
123  "CONNECTION_RECONFIGURATION",
124  "CONNECTION_REESTABLISHMENT",
125  "HANDOVER_PREPARATION",
126  "HANDOVER_JOINING",
127  "HANDOVER_PATH_SWITCH",
128  "HANDOVER_LEAVING",
129 };
130 
135 static const std::string&
137 {
138  return g_ueManagerStateName[s];
139 }
140 
141 NS_OBJECT_ENSURE_REGISTERED(UeManager);
142 
144 {
145  NS_FATAL_ERROR("this constructor is not expected to be used");
146 }
147 
148 UeManager::UeManager(Ptr<LteEnbRrc> rrc, uint16_t rnti, State s, uint8_t componentCarrierId)
149  : m_lastAllocatedDrbid(0),
150  m_rnti(rnti),
151  m_imsi(0),
152  m_componentCarrierId(componentCarrierId),
153  m_lastRrcTransactionIdentifier(0),
154  m_rrc(rrc),
155  m_state(s),
156  m_pendingRrcConnectionReconfiguration(false),
157  m_sourceX2apId(0),
158  m_sourceCellId(0),
159  m_needPhyMacConfiguration(false),
160  m_caSupportConfigured(false),
161  m_pendingStartDataRadioBearers(false)
162 {
163  NS_LOG_FUNCTION(this);
164 }
165 
166 void
168 {
169  NS_LOG_FUNCTION(this);
171 
173  m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
176  m_rrc->GetNewSrsConfigurationIndex();
182 
183  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
184  {
185  m_rrc->m_cmacSapProvider.at(i)->AddUe(m_rnti);
186  m_rrc->m_cphySapProvider.at(i)->AddUe(m_rnti);
187  }
188 
189  // setup the eNB side of SRB0
190  {
191  uint8_t lcid = 0;
192 
193  Ptr<LteRlc> rlc = CreateObject<LteRlcTm>()->GetObject<LteRlc>();
194  rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
195  rlc->SetRnti(m_rnti);
196  rlc->SetLcId(lcid);
197 
198  m_srb0 = CreateObject<LteSignalingRadioBearerInfo>();
199  m_srb0->m_rlc = rlc;
200  m_srb0->m_srbIdentity = 0;
201  // no need to store logicalChannelConfig as SRB0 is pre-configured
202 
204  lcinfo.rnti = m_rnti;
205  lcinfo.lcId = lcid;
206  // Initialise the rest of lcinfo structure even if CCCH (LCID 0) is pre-configured, and only
207  // m_rnti and lcid will be used from passed lcinfo structure. See FF LTE MAC Scheduler
208  // Iinterface Specification v1.11, 4.3.4 logicalChannelConfigListElement
209  lcinfo.lcGroup = 0;
210  lcinfo.qci = 0;
211  lcinfo.resourceType = 0;
212  lcinfo.mbrUl = 0;
213  lcinfo.mbrDl = 0;
214  lcinfo.gbrUl = 0;
215  lcinfo.gbrDl = 0;
216 
217  // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
218  LteMacSapUser* lteMacSapUser =
219  m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
220  // Signal Channel are only on Primary Carrier
221  m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, lteMacSapUser);
222  m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, lteMacSapUser);
223  }
224 
225  // setup the eNB side of SRB1; the UE side will be set up upon RRC connection establishment
226  {
227  uint8_t lcid = 1;
228 
229  Ptr<LteRlc> rlc = CreateObject<LteRlcAm>()->GetObject<LteRlc>();
230  rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
231  rlc->SetRnti(m_rnti);
232  rlc->SetLcId(lcid);
233 
234  Ptr<LtePdcp> pdcp = CreateObject<LtePdcp>();
235  pdcp->SetRnti(m_rnti);
236  pdcp->SetLcId(lcid);
237  pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
238  pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
239  rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
240 
241  m_srb1 = CreateObject<LteSignalingRadioBearerInfo>();
242  m_srb1->m_rlc = rlc;
243  m_srb1->m_pdcp = pdcp;
244  m_srb1->m_srbIdentity = 1;
245  m_srb1->m_logicalChannelConfig.priority = 1;
246  m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
247  m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
248  m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
249 
251  lcinfo.rnti = m_rnti;
252  lcinfo.lcId = lcid;
253  lcinfo.lcGroup = 0; // all SRBs always mapped to LCG 0
254  lcinfo.qci =
255  EpsBearer::GBR_CONV_VOICE; // not sure why the FF API requires a CQI even for SRBs...
256  lcinfo.resourceType = 1; // GBR resource type
257  lcinfo.mbrUl = 1e6;
258  lcinfo.mbrDl = 1e6;
259  lcinfo.gbrUl = 1e4;
260  lcinfo.gbrDl = 1e4;
261  // MacSapUserForRlc in the ComponentCarrierManager MacSapUser
262  LteMacSapUser* MacSapUserForRlc =
263  m_rrc->m_ccmRrcSapProvider->ConfigureSignalBearer(lcinfo, rlc->GetLteMacSapUser());
264  // Signal Channel are only on Primary Carrier
265  m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->AddLc(lcinfo, MacSapUserForRlc);
266  m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, MacSapUserForRlc);
267  }
268 
270  ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider();
271  ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider();
272  m_rrc->m_rrcSapUser->SetupUe(m_rnti, ueParams);
273 
274  // configure MAC (and scheduler)
276  req.m_rnti = m_rnti;
278 
279  // configure PHY
280  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
281  {
282  m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
283  m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(
284  m_rnti,
286  m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(
287  m_rnti,
289  }
290  // schedule this UeManager instance to be deleted if the UE does not give any sign of life
291  // within a reasonable time
292  Time maxConnectionDelay;
293  switch (m_state)
294  {
296  m_connectionRequestTimeout = Simulator::Schedule(m_rrc->m_connectionRequestTimeoutDuration,
298  m_rrc,
299  m_rnti);
300  break;
301 
302  case HANDOVER_JOINING:
303  m_handoverJoiningTimeout = Simulator::Schedule(m_rrc->m_handoverJoiningTimeoutDuration,
305  m_rrc,
306  m_rnti);
307  break;
308 
309  default:
310  NS_FATAL_ERROR("unexpected state " << ToString(m_state));
311  break;
312  }
313  m_caSupportConfigured = false;
314 }
315 
317 {
318 }
319 
320 void
322 {
323  delete m_drbPdcpSapUser;
324  // delete eventual X2-U TEIDs
325  for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
326  {
327  m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
328  }
329 }
330 
331 TypeId
333 {
334  static TypeId tid =
335  TypeId("ns3::UeManager")
336  .SetParent<Object>()
337  .AddConstructor<UeManager>()
338  .AddAttribute("DataRadioBearerMap",
339  "List of UE DataRadioBearerInfo by DRBID.",
340  ObjectMapValue(),
342  MakeObjectMapChecker<LteDataRadioBearerInfo>())
343  .AddAttribute("Srb0",
344  "SignalingRadioBearerInfo for SRB0",
345  PointerValue(),
347  MakePointerChecker<LteSignalingRadioBearerInfo>())
348  .AddAttribute("Srb1",
349  "SignalingRadioBearerInfo for SRB1",
350  PointerValue(),
352  MakePointerChecker<LteSignalingRadioBearerInfo>())
353  .AddAttribute("C-RNTI",
354  "Cell Radio Network Temporary Identifier",
355  TypeId::ATTR_GET, // read-only attribute
356  UintegerValue(0), // unused, read-only attribute
358  MakeUintegerChecker<uint16_t>())
359  .AddTraceSource("StateTransition",
360  "fired upon every UE state transition seen by the "
361  "UeManager at the eNB RRC",
363  "ns3::UeManager::StateTracedCallback")
364  .AddTraceSource("DrbCreated",
365  "trace fired after DRB is created",
367  "ns3::UeManager::ImsiCidRntiLcIdTracedCallback");
368  return tid;
369 }
370 
371 void
372 UeManager::SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
373 {
374  m_sourceX2apId = sourceX2apId;
375  m_sourceCellId = sourceCellId;
376 }
377 
378 void
379 UeManager::SetImsi(uint64_t imsi)
380 {
381  m_imsi = imsi;
382 }
383 
384 void
386 {
387  NS_LOG_FUNCTION(this << m_rnti);
388 
389  if (m_state == ATTACH_REQUEST)
390  {
392  }
393  else
394  {
395  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
396  }
397 }
398 
399 void
401  uint8_t bearerId,
402  uint32_t gtpTeid,
403  Ipv4Address transportLayerAddress)
404 {
405  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
406 
407  Ptr<LteDataRadioBearerInfo> drbInfo = CreateObject<LteDataRadioBearerInfo>();
408  uint8_t drbid = AddDataRadioBearerInfo(drbInfo);
409  uint8_t lcid = Drbid2Lcid(drbid);
410  uint8_t bid = Drbid2Bid(drbid);
411  NS_ASSERT_MSG(bearerId == 0 || bid == bearerId,
412  "bearer ID mismatch (" << (uint32_t)bid << " != " << (uint32_t)bearerId
413  << ", the assumption that ID are allocated in the same "
414  "way by MME and RRC is not valid any more");
415  drbInfo->m_epsBearer = bearer;
416  drbInfo->m_epsBearerIdentity = bid;
417  drbInfo->m_drbIdentity = drbid;
418  drbInfo->m_logicalChannelIdentity = lcid;
419  drbInfo->m_gtpTeid = gtpTeid;
420  drbInfo->m_transportLayerAddress = transportLayerAddress;
421 
422  if (m_state == HANDOVER_JOINING)
423  {
424  // setup TEIDs for receiving data eventually forwarded over X2-U
425  LteEnbRrc::X2uTeidInfo x2uTeidInfo;
426  x2uTeidInfo.rnti = m_rnti;
427  x2uTeidInfo.drbid = drbid;
428  auto ret = m_rrc->m_x2uTeidInfoMap.insert(
429  std::pair<uint32_t, LteEnbRrc::X2uTeidInfo>(gtpTeid, x2uTeidInfo));
430  NS_ASSERT_MSG(ret.second == true, "overwriting a pre-existing entry in m_x2uTeidInfoMap");
431  }
432 
433  TypeId rlcTypeId = m_rrc->GetRlcType(bearer);
434 
435  ObjectFactory rlcObjectFactory;
436  rlcObjectFactory.SetTypeId(rlcTypeId);
437  Ptr<LteRlc> rlc = rlcObjectFactory.Create()->GetObject<LteRlc>();
438  rlc->SetLteMacSapProvider(m_rrc->m_macSapProvider);
439  rlc->SetRnti(m_rnti);
441 
442  drbInfo->m_rlc = rlc;
443 
444  rlc->SetLcId(lcid);
445 
446  // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
447  // if we are using RLC/SM we don't care of anything above RLC
448  if (rlcTypeId != LteRlcSm::GetTypeId())
449  {
450  Ptr<LtePdcp> pdcp = CreateObject<LtePdcp>();
451  pdcp->SetRnti(m_rnti);
452  pdcp->SetLcId(lcid);
453  pdcp->SetLtePdcpSapUser(m_drbPdcpSapUser);
454  pdcp->SetLteRlcSapProvider(rlc->GetLteRlcSapProvider());
455  rlc->SetLteRlcSapUser(pdcp->GetLteRlcSapUser());
456  drbInfo->m_pdcp = pdcp;
457  }
458 
459  m_drbCreatedTrace(m_imsi, m_rrc->ComponentCarrierToCellId(m_componentCarrierId), m_rnti, lcid);
460 
461  std::vector<LteCcmRrcSapProvider::LcsConfig> lcOnCcMapping =
462  m_rrc->m_ccmRrcSapProvider->SetupDataRadioBearer(bearer,
463  bearerId,
464  m_rnti,
465  lcid,
466  m_rrc->GetLogicalChannelGroup(bearer),
467  rlc->GetLteMacSapUser());
468  // LteEnbCmacSapProvider::LcInfo lcinfo;
469  // lcinfo.rnti = m_rnti;
470  // lcinfo.lcId = lcid;
471  // lcinfo.lcGroup = m_rrc->GetLogicalChannelGroup (bearer);
472  // lcinfo.qci = bearer.qci;
473  // lcinfo.resourceType = bearer.GetResourceType();
474  // lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
475  // lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
476  // lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
477  // lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
478  // use a for cycle to send the AddLc to the appropriate Mac Sap
479  // if the sap is not initialized the appropriated method has to be called
480  auto itLcOnCcMapping = lcOnCcMapping.begin();
481  NS_ASSERT_MSG(itLcOnCcMapping != lcOnCcMapping.end(), "Problem");
482  for (itLcOnCcMapping = lcOnCcMapping.begin(); itLcOnCcMapping != lcOnCcMapping.end();
483  ++itLcOnCcMapping)
484  {
485  NS_LOG_DEBUG(this << " RNTI " << itLcOnCcMapping->lc.rnti << "Lcid "
486  << (uint16_t)itLcOnCcMapping->lc.lcId << " lcGroup "
487  << (uint16_t)itLcOnCcMapping->lc.lcGroup << " ComponentCarrierId "
488  << itLcOnCcMapping->componentCarrierId);
489  uint8_t index = itLcOnCcMapping->componentCarrierId;
490  LteEnbCmacSapProvider::LcInfo lcinfo = itLcOnCcMapping->lc;
491  LteMacSapUser* msu = itLcOnCcMapping->msu;
492  m_rrc->m_cmacSapProvider.at(index)->AddLc(lcinfo, msu);
493  m_rrc->m_ccmRrcSapProvider->AddLc(lcinfo, msu);
494  }
495 
496  if (rlcTypeId == LteRlcAm::GetTypeId())
497  {
498  drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::AM;
499  }
500  else
501  {
502  drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
503  }
504 
505  drbInfo->m_logicalChannelIdentity = lcid;
506  drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority(bearer);
507  drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup(bearer);
508  if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
509  {
510  drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.gbrQosInfo.gbrUl;
511  }
512  else
513  {
514  drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
515  }
516  drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
517 
519 }
520 
521 void
523 {
524  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
525  for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
526  {
527  m_drbsToBeStarted.push_back(it->first);
528  }
529 }
530 
531 void
533 {
534  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
535  for (auto drbIdIt = m_drbsToBeStarted.begin(); drbIdIt != m_drbsToBeStarted.end(); ++drbIdIt)
536  {
537  auto drbIt = m_drbMap.find(*drbIdIt);
538  NS_ASSERT(drbIt != m_drbMap.end());
539  drbIt->second->m_rlc->Initialize();
540  if (drbIt->second->m_pdcp)
541  {
542  drbIt->second->m_pdcp->Initialize();
543  }
544  }
545  m_drbsToBeStarted.clear();
546 }
547 
548 void
550 {
551  NS_LOG_FUNCTION(this << (uint32_t)m_rnti << (uint32_t)drbid);
552  uint8_t lcid = Drbid2Lcid(drbid);
553  auto it = m_drbMap.find(drbid);
554  NS_ASSERT_MSG(it != m_drbMap.end(),
555  "request to remove radio bearer with unknown drbid " << drbid);
556 
557  // first delete eventual X2-U TEIDs
558  m_rrc->m_x2uTeidInfoMap.erase(it->second->m_gtpTeid);
559 
560  m_drbMap.erase(it);
561  std::vector<uint8_t> ccToRelease =
562  m_rrc->m_ccmRrcSapProvider->ReleaseDataRadioBearer(m_rnti, lcid);
563  auto itCcToRelease = ccToRelease.begin();
564  NS_ASSERT_MSG(itCcToRelease != ccToRelease.end(),
565  "request to remove radio bearer with unknown drbid (ComponentCarrierManager)");
566  for (itCcToRelease = ccToRelease.begin(); itCcToRelease != ccToRelease.end(); ++itCcToRelease)
567  {
568  m_rrc->m_cmacSapProvider.at(*itCcToRelease)->ReleaseLc(m_rnti, lcid);
569  }
571  rrcd.havePhysicalConfigDedicated = false;
572  rrcd.drbToReleaseList.push_back(drbid);
573  // populating RadioResourceConfigDedicated information element as per 3GPP TS 36.331
574  // version 9.2.0
575  rrcd.havePhysicalConfigDedicated = true;
577 
578  // populating RRCConnectionReconfiguration message as per 3GPP TS 36.331 version 9.2.0 Release 9
580  msg.haveMeasConfig = false;
581  msg.haveMobilityControlInfo = false;
582  msg.radioResourceConfigDedicated = rrcd;
584  // ToDo: Resend in any case this configuration
585  // needs to be initialized
586  msg.haveNonCriticalExtension = false;
587  // RRC Connection Reconfiguration towards UE
588  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
589 }
590 
591 void
592 LteEnbRrc::DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
593 {
594  NS_LOG_FUNCTION(this << imsi << rnti << (uint16_t)bearerId);
595 
596  // check if the RNTI to be removed is not stale
597  if (HasUeManager(rnti))
598  {
599  Ptr<UeManager> ueManager = GetUeManager(rnti);
600  // Bearer de-activation towards UE
601  ueManager->ReleaseDataRadioBearer(bearerId);
602  // Bearer de-activation indication towards epc-enb application
603  m_s1SapProvider->DoSendReleaseIndication(imsi, rnti, bearerId);
604  }
605 }
606 
607 void
609 {
610  NS_LOG_FUNCTION(this << m_rnti);
611 
612  // release the bearer info for the UE at SGW/PGW
613  if (m_rrc->m_s1SapProvider != nullptr) // if EPC is enabled
614  {
615  for (const auto& it : m_drbMap)
616  {
617  NS_LOG_DEBUG("Sending release of bearer id : "
618  << (uint16_t)(it.first)
619  << "LCID : " << (uint16_t)(it.second->m_logicalChannelIdentity));
620  // Bearer de-activation indication towards epc-enb application
621  m_rrc->m_s1SapProvider->DoSendReleaseIndication(GetImsi(), rnti, it.first);
622  }
623  }
624 }
625 
626 void
628 {
629  NS_LOG_FUNCTION(this);
630  switch (m_state)
631  {
633  case CONNECTION_SETUP:
634  case ATTACH_REQUEST:
638  case HANDOVER_JOINING:
639  case HANDOVER_LEAVING:
640  // a previous reconfiguration still ongoing, we need to wait for it to be finished
642  break;
643 
644  case CONNECTED_NORMALLY: {
647  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, msg);
650  }
651  break;
652 
653  default:
654  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
655  break;
656  }
657 }
658 
659 void
661 {
662  NS_LOG_FUNCTION(this << cellId);
663  switch (m_state)
664  {
665  case CONNECTED_NORMALLY: {
666  m_targetCellId = cellId;
667 
668  auto sourceComponentCarrier = DynamicCast<ComponentCarrierEnb>(
669  m_rrc->m_componentCarrierPhyConf.at(m_componentCarrierId));
670  NS_ASSERT(m_targetCellId != sourceComponentCarrier->GetCellId());
671 
672  if (m_rrc->HasCellId(cellId))
673  {
674  // Intra-eNB handover
675  NS_LOG_DEBUG("Intra-eNB handover for cellId " << cellId);
676  uint8_t componentCarrierId = m_rrc->CellToComponentCarrierId(cellId);
677  uint16_t rnti = m_rrc->AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
679  m_rrc->m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
680  if (!anrcrv.valid)
681  {
682  NS_LOG_INFO(this << " failed to allocate a preamble for non-contention based RA => "
683  "cannot perform HO");
684  NS_FATAL_ERROR("should trigger HO Preparation Failure, but it is not implemented");
685  return;
686  }
687 
688  Ptr<UeManager> ueManager = m_rrc->GetUeManager(rnti);
689  ueManager->SetSource(sourceComponentCarrier->GetCellId(), m_rnti);
690  ueManager->SetImsi(m_imsi);
691 
692  // Setup data radio bearers
693  for (auto& it : m_drbMap)
694  {
695  ueManager->SetupDataRadioBearer(it.second->m_epsBearer,
696  it.second->m_epsBearerIdentity,
697  it.second->m_gtpTeid,
698  it.second->m_transportLayerAddress);
699  }
700 
702  GetRrcConnectionReconfigurationForHandover(componentCarrierId);
703 
704  handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
705  handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
707  anrcrv.raPreambleId;
709  anrcrv.raPrachMaskIndex;
710 
712  m_rrc->m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
714  .preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
716  .raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
718  .raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
719 
720  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
721 
722  // We skip handover preparation
724  m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
726  m_rrc,
727  m_rnti);
728  m_rrc->m_handoverStartTrace(m_imsi,
729  sourceComponentCarrier->GetCellId(),
730  m_rnti,
731  handoverCommand.mobilityControlInfo.targetPhysCellId);
732  }
733  else
734  {
735  // Inter-eNB aka X2 handover
736  NS_LOG_DEBUG("Inter-eNB handover (i.e., X2) for cellId " << cellId);
738  params.oldEnbUeX2apId = m_rnti;
740  params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
741  params.targetCellId = cellId;
742  params.mmeUeS1apId = m_imsi;
743  params.ueAggregateMaxBitRateDownlink = 200 * 1000;
744  params.ueAggregateMaxBitRateUplink = 100 * 1000;
745  params.bearers = GetErabList();
746 
749  hpi.asConfig.sourceDlCarrierFreq = sourceComponentCarrier->GetDlEarfcn();
750  hpi.asConfig.sourceMeasConfig = m_rrc->m_ueMeasConfig;
754  sourceComponentCarrier->GetDlBandwidth();
758  .cellAccessRelatedInfo.plmnIdentityInfo.plmnIdentity;
760  m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
762  m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIndication;
764  m_rrc->m_sib1.at(m_componentCarrierId).cellAccessRelatedInfo.csgIdentity;
766  m_rrc->m_cmacSapProvider.at(m_componentCarrierId)->GetRachConfig();
768  .rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
774  .rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
776  sourceComponentCarrier->GetUlEarfcn();
778  sourceComponentCarrier->GetUlBandwidth();
779  params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation(hpi);
780 
781  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
782  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
783  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
784  NS_LOG_LOGIC("mmeUeS1apId = " << params.mmeUeS1apId);
785  NS_LOG_LOGIC("rrcContext = " << params.rrcContext);
786 
787  m_rrc->m_x2SapProvider->SendHandoverRequest(params);
789  }
790  }
791  break;
792 
793  default:
794  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
795  break;
796  }
797 }
798 
799 void
801 {
802  NS_LOG_FUNCTION(this);
803 
804  NS_ASSERT_MSG(params.notAdmittedBearers.empty(),
805  "not admission of some bearers upon handover is not supported");
806  NS_ASSERT_MSG(params.admittedBearers.size() == m_drbMap.size(),
807  "not enough bearers in admittedBearers");
808 
809  // note: the Handover command from the target eNB to the source eNB
810  // is expected to be sent transparently to the UE; however, here we
811  // decode the message and eventually re-encode it. This way we can
812  // support both a real RRC protocol implementation and an ideal one
813  // without actual RRC protocol encoding.
814 
815  Ptr<Packet> encodedHandoverCommand = params.rrcContext;
817  m_rrc->m_rrcSapUser->DecodeHandoverCommand(encodedHandoverCommand);
818  if (handoverCommand.haveNonCriticalExtension)
819  {
820  // Total number of component carriers =
821  // handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 (Primary carrier)
822  if (handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1 !=
823  m_rrc->m_numberOfComponentCarriers)
824  {
825  // Currently handover is only possible if source and target eNBs have equal number of
826  // component carriers
827  NS_FATAL_ERROR("The source and target eNBs have unequal number of component carriers. "
828  "Target eNB CCs = "
829  << handoverCommand.nonCriticalExtension.sCellToAddModList.size() + 1
830  << " Source eNB CCs = " << m_rrc->m_numberOfComponentCarriers);
831  }
832  }
833  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration(m_rnti, handoverCommand);
835  m_handoverLeavingTimeout = Simulator::Schedule(m_rrc->m_handoverLeavingTimeoutDuration,
837  m_rrc,
838  m_rnti);
839  NS_ASSERT(handoverCommand.haveMobilityControlInfo);
840  m_rrc->m_handoverStartTrace(m_imsi,
841  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
842  m_rnti,
843  handoverCommand.mobilityControlInfo.targetPhysCellId);
844 
845  // Set the target cell ID and the RNTI so that handover cancel message can be sent if required
846  m_targetX2apId = params.newEnbUeX2apId;
847  m_targetCellId = params.targetCellId;
848 
850  sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
851  sst.newEnbUeX2apId = params.newEnbUeX2apId;
852  sst.sourceCellId = params.sourceCellId;
853  sst.targetCellId = params.targetCellId;
854  for (auto drbIt = m_drbMap.begin(); drbIt != m_drbMap.end(); ++drbIt)
855  {
856  // SN status transfer is only for AM RLC
857  if (drbIt->second->m_rlc->GetObject<LteRlcAm>())
858  {
859  LtePdcp::Status status = drbIt->second->m_pdcp->GetStatus();
861  i.dlPdcpSn = status.txSn;
862  i.ulPdcpSn = status.rxSn;
863  sst.erabsSubjectToStatusTransferList.push_back(i);
864  }
865  }
866  m_rrc->m_x2SapProvider->SendSnStatusTransfer(sst);
867 }
868 
871 {
872  NS_LOG_FUNCTION(this);
874 }
875 
878 {
879  NS_LOG_FUNCTION(this);
880 
882 
883  auto targetComponentCarrier =
884  DynamicCast<ComponentCarrierEnb>(m_rrc->m_componentCarrierPhyConf.at(componentCarrierId));
885  result.haveMobilityControlInfo = true;
886  result.mobilityControlInfo.targetPhysCellId = targetComponentCarrier->GetCellId();
887  result.mobilityControlInfo.haveCarrierFreq = true;
888  result.mobilityControlInfo.carrierFreq.dlCarrierFreq = targetComponentCarrier->GetDlEarfcn();
889  result.mobilityControlInfo.carrierFreq.ulCarrierFreq = targetComponentCarrier->GetUlEarfcn();
892  targetComponentCarrier->GetDlBandwidth();
894  targetComponentCarrier->GetUlBandwidth();
895 
896  if (m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
897  {
898  // Release sCells
899  result.haveNonCriticalExtension = true;
900 
901  for (auto& it : m_rrc->m_componentCarrierPhyConf)
902  {
903  uint8_t ccId = it.first;
904 
905  if (ccId == m_componentCarrierId)
906  {
907  // Skip primary CC.
908  continue;
909  }
910  else if (ccId < m_componentCarrierId)
911  {
912  // Shift all IDs below PCC forward so PCC can use CC ID 1.
913  result.nonCriticalExtension.sCellToReleaseList.push_back(ccId + 1);
914  }
915  }
916  }
917  else
918  {
919  result.haveNonCriticalExtension = false;
920  }
921 
922  return result;
923 }
924 
925 void
927 {
928  NS_LOG_FUNCTION(this << p << (uint16_t)bid);
930  params.pdcpSdu = p;
931  params.rnti = m_rnti;
932  params.lcid = Bid2Lcid(bid);
933  uint8_t drbid = Bid2Drbid(bid);
934  // Transmit PDCP sdu only if DRB ID found in drbMap
935  auto it = m_drbMap.find(drbid);
936  if (it != m_drbMap.end())
937  {
939  if (bearerInfo)
940  {
941  NS_LOG_INFO("Send packet to PDCP layer");
942  LtePdcpSapProvider* pdcpSapProvider = bearerInfo->m_pdcp->GetLtePdcpSapProvider();
943  pdcpSapProvider->TransmitPdcpSdu(params);
944  }
945  }
946 }
947 
948 void
950 {
951  NS_LOG_FUNCTION(this << p << (uint16_t)bid);
952  switch (m_state)
953  {
955  case CONNECTION_SETUP:
956  NS_LOG_WARN("not connected, discarding packet");
957  return;
958 
959  case CONNECTED_NORMALLY:
963  case HANDOVER_PATH_SWITCH: {
964  NS_LOG_INFO("queueing data on PDCP for transmission over the air");
965  SendPacket(bid, p);
966  }
967  break;
968 
969  case HANDOVER_JOINING: {
970  // Buffer data until RRC Connection Reconfiguration Complete message is received
971  NS_LOG_INFO("buffering data");
972  m_packetBuffer.emplace_back(bid, p);
973  }
974  break;
975 
976  case HANDOVER_LEAVING: {
977  NS_LOG_INFO("forwarding data to target eNB over X2-U");
978  uint8_t drbid = Bid2Drbid(bid);
980  params.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
981  params.targetCellId = m_targetCellId;
982  params.gtpTeid = GetDataRadioBearerInfo(drbid)->m_gtpTeid;
983  params.ueData = p;
984  m_rrc->m_x2SapProvider->SendUeData(params);
985  }
986  break;
987 
988  default:
989  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
990  break;
991  }
992 }
993 
994 std::vector<EpcX2Sap::ErabToBeSetupItem>
996 {
997  NS_LOG_FUNCTION(this);
998  std::vector<EpcX2Sap::ErabToBeSetupItem> ret;
999  for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1000  {
1002  etbsi.erabId = it->second->m_epsBearerIdentity;
1003  etbsi.erabLevelQosParameters = it->second->m_epsBearer;
1004  etbsi.dlForwarding = false;
1005  etbsi.transportLayerAddress = it->second->m_transportLayerAddress;
1006  etbsi.gtpTeid = it->second->m_gtpTeid;
1007  ret.push_back(etbsi);
1008  }
1009  return ret;
1010 }
1011 
1012 void
1014 {
1015  NS_LOG_FUNCTION(this);
1016  switch (m_state)
1017  {
1018  case HANDOVER_PATH_SWITCH:
1019  NS_LOG_INFO("Send UE CONTEXT RELEASE from target eNB to source eNB");
1020  EpcX2SapProvider::UeContextReleaseParams ueCtxReleaseParams;
1021  ueCtxReleaseParams.oldEnbUeX2apId = m_sourceX2apId;
1022  ueCtxReleaseParams.newEnbUeX2apId = m_rnti;
1023  ueCtxReleaseParams.sourceCellId = m_sourceCellId;
1024  ueCtxReleaseParams.targetCellId = m_targetCellId;
1025  if (!m_rrc->HasCellId(m_sourceCellId))
1026  {
1027  m_rrc->m_x2SapProvider->SendUeContextRelease(ueCtxReleaseParams);
1028  }
1029  else
1030  {
1031  NS_LOG_INFO("Not sending UE CONTEXT RELEASE because handover is internal");
1032  m_rrc->DoRecvUeContextRelease(ueCtxReleaseParams);
1033  }
1035  m_rrc->m_handoverEndOkTrace(m_imsi,
1036  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1037  m_rnti);
1038  break;
1039 
1040  default:
1041  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1042  break;
1043  }
1044 }
1045 
1046 void
1048 {
1049  NS_LOG_FUNCTION(this << cellId);
1050  switch (m_state)
1051  {
1052  case HANDOVER_PREPARATION:
1053  NS_ASSERT(cellId == m_targetCellId);
1054  NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1056  break;
1057  case HANDOVER_LEAVING: // case added to tackle HO leaving timer expiration
1058  NS_ASSERT(cellId == m_targetCellId);
1059  NS_LOG_INFO("target eNB sent HO preparation failure, aborting HO");
1062  break;
1063 
1064  default:
1065  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1066  break;
1067  }
1068 }
1069 
1070 void
1072 {
1073  NS_LOG_FUNCTION(this);
1074  for (auto erabIt = params.erabsSubjectToStatusTransferList.begin();
1075  erabIt != params.erabsSubjectToStatusTransferList.end();
1076  ++erabIt)
1077  {
1078  // LtePdcp::Status status;
1079  // status.txSn = erabIt->dlPdcpSn;
1080  // status.rxSn = erabIt->ulPdcpSn;
1081  // uint8_t drbId = Bid2Drbid (erabIt->erabId);
1082  // auto drbIt = m_drbMap.find (drbId);
1083  // NS_ASSERT_MSG (drbIt != m_drbMap.end (), "could not find DRBID " << (uint32_t) drbId);
1084  // drbIt->second->m_pdcp->SetStatus (status);
1085  }
1086 }
1087 
1088 void
1090 {
1091  NS_LOG_FUNCTION(this);
1092  NS_ASSERT_MSG(m_state == HANDOVER_LEAVING, "method unexpected in state " << ToString(m_state));
1094 }
1095 
1096 void
1098 {
1099  NS_LOG_FUNCTION(this);
1100  NS_ASSERT_MSG(m_state == HANDOVER_JOINING, "method unexpected in state " << ToString(m_state));
1102 }
1103 
1104 void
1106 {
1107  // TODO implement in the 3gpp way, see Section 5.3.8 of 3GPP TS 36.331.
1108  NS_LOG_FUNCTION(this << (uint32_t)m_rnti);
1109  // De-activation towards UE, it will deactivate all bearers
1112  m_rrc->m_rrcSapUser->SendRrcConnectionRelease(m_rnti, msg);
1113 
1119  m_rrc->DoRecvIdealUeContextRemoveRequest(m_rnti);
1120 }
1121 
1122 // methods forwarded from RRC SAP
1123 
1124 void
1126 {
1127  NS_LOG_FUNCTION(this);
1128  m_srb0->m_rlc->SetLteRlcSapUser(params.srb0SapUser);
1129  m_srb1->m_pdcp->SetLtePdcpSapUser(params.srb1SapUser);
1130 }
1131 
1132 void
1134 {
1135  NS_LOG_FUNCTION(this);
1136  switch (m_state)
1137  {
1138  case INITIAL_RANDOM_ACCESS: {
1140 
1141  if (m_rrc->m_admitRrcConnectionRequest)
1142  {
1143  m_imsi = msg.ueIdentity;
1144 
1145  // send RRC CONNECTION SETUP to UE
1149  m_rrc->m_rrcSapUser->SendRrcConnectionSetup(m_rnti, msg2);
1150 
1152  m_connectionSetupTimeout = Simulator::Schedule(m_rrc->m_connectionSetupTimeoutDuration,
1154  m_rrc,
1155  m_rnti);
1157  }
1158  else
1159  {
1160  NS_LOG_INFO("rejecting connection request for RNTI " << m_rnti);
1161 
1162  // send RRC CONNECTION REJECT to UE
1164  rejectMsg.waitTime = 3;
1165  m_rrc->m_rrcSapUser->SendRrcConnectionReject(m_rnti, rejectMsg);
1166 
1168  Simulator::Schedule(m_rrc->m_connectionRejectedTimeoutDuration,
1170  m_rrc,
1171  m_rnti);
1173  }
1174  }
1175  break;
1176 
1177  default:
1178  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1179  break;
1180  }
1181 }
1182 
1183 void
1185 {
1186  NS_LOG_FUNCTION(this);
1187  switch (m_state)
1188  {
1189  case CONNECTION_SETUP:
1191  if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1192  {
1193  m_pendingRrcConnectionReconfiguration = true; // Force Reconfiguration
1195  }
1196 
1197  if (m_rrc->m_s1SapProvider != nullptr)
1198  {
1199  m_rrc->m_s1SapProvider->InitialUeMessage(m_imsi, m_rnti);
1201  }
1202  else
1203  {
1205  }
1206  m_rrc->m_connectionEstablishedTrace(m_imsi,
1207  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1208  m_rnti);
1209  break;
1210 
1211  default:
1212  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1213  break;
1214  }
1215 }
1216 
1217 void
1220 {
1221  NS_LOG_FUNCTION(this);
1222  switch (m_state)
1223  {
1227  {
1228  // configure MAC (and scheduler)
1230  req.m_rnti = m_rnti;
1232  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1233  {
1234  m_rrc->m_cmacSapProvider.at(i)->UeUpdateConfigurationReq(req);
1235 
1236  // configure PHY
1237  m_rrc->m_cphySapProvider.at(i)->SetTransmissionMode(req.m_rnti,
1238  req.m_transmissionMode);
1241  m_rrc->m_cphySapProvider.at(i)->SetPa(m_rnti, paDouble);
1242  }
1243 
1244  m_needPhyMacConfiguration = false;
1245  }
1247  m_rrc->m_connectionReconfigurationTrace(
1248  m_imsi,
1249  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1250  m_rnti);
1251  break;
1252 
1253  // This case is added to NS-3 in order to handle bearer de-activation scenario for CONNECTED
1254  // state UE
1255  case CONNECTED_NORMALLY:
1256  NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1257  << ToString(m_state));
1258  break;
1259 
1260  case HANDOVER_LEAVING:
1261  NS_LOG_INFO("ignoring RecvRrcConnectionReconfigurationCompleted in state "
1262  << ToString(m_state));
1263  break;
1264 
1265  case HANDOVER_JOINING: {
1267 
1268  while (!m_packetBuffer.empty())
1269  {
1270  NS_LOG_LOGIC("dequeueing data from buffer");
1271  std::pair<uint8_t, Ptr<Packet>> bidPacket = m_packetBuffer.front();
1272  uint8_t bid = bidPacket.first;
1273  Ptr<Packet> p = bidPacket.second;
1274 
1275  NS_LOG_LOGIC("queueing data on PDCP for transmission over the air");
1276  SendPacket(bid, p);
1277 
1278  m_packetBuffer.pop_front();
1279  }
1280 
1281  NS_LOG_INFO("Send PATH SWITCH REQUEST to the MME");
1283  params.rnti = m_rnti;
1284  params.cellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1285  params.mmeUeS1Id = m_imsi;
1287  for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1288  {
1290  b.epsBearerId = it->second->m_epsBearerIdentity;
1291  b.teid = it->second->m_gtpTeid;
1292  params.bearersToBeSwitched.push_back(b);
1293  }
1294  m_rrc->m_s1SapProvider->PathSwitchRequest(params);
1295  }
1296  break;
1297 
1298  default:
1299  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1300  break;
1301  }
1302 }
1303 
1304 void
1307 {
1308  NS_LOG_FUNCTION(this);
1309  switch (m_state)
1310  {
1311  case CONNECTED_NORMALLY:
1312  break;
1313 
1314  case HANDOVER_LEAVING:
1316  break;
1317 
1318  default:
1319  NS_FATAL_ERROR("method unexpected in state " << ToString(m_state));
1320  break;
1321  }
1322 
1326  m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment(m_rnti, msg2);
1328 }
1329 
1330 void
1333 {
1334  NS_LOG_FUNCTION(this);
1336 }
1337 
1338 void
1340 {
1341  uint8_t measId = msg.measResults.measId;
1342  NS_LOG_FUNCTION(this << (uint16_t)measId);
1343  NS_LOG_LOGIC(
1344  "measId " << (uint16_t)measId << " haveMeasResultNeighCells "
1345  << msg.measResults.haveMeasResultNeighCells << " measResultListEutra "
1346  << msg.measResults.measResultListEutra.size() << " haveMeasResultServFreqList "
1347  << msg.measResults.haveMeasResultServFreqList << " measResultServFreqList "
1348  << msg.measResults.measResultServFreqList.size());
1349  NS_LOG_LOGIC("serving cellId "
1350  << m_rrc->ComponentCarrierToCellId(m_componentCarrierId) << " RSRP "
1351  << (uint16_t)msg.measResults.measResultPCell.rsrpResult << " RSRQ "
1352  << (uint16_t)msg.measResults.measResultPCell.rsrqResult);
1353 
1354  for (auto it = msg.measResults.measResultListEutra.begin();
1355  it != msg.measResults.measResultListEutra.end();
1356  ++it)
1357  {
1358  NS_LOG_LOGIC("neighbour cellId " << it->physCellId << " RSRP "
1359  << (it->haveRsrpResult ? (uint16_t)it->rsrpResult : 255)
1360  << " RSRQ "
1361  << (it->haveRsrqResult ? (uint16_t)it->rsrqResult : 255));
1362  }
1363 
1364  if ((m_rrc->m_handoverManagementSapProvider != nullptr) &&
1365  (m_rrc->m_handoverMeasIds.find(measId) != m_rrc->m_handoverMeasIds.end()))
1366  {
1367  // this measurement was requested by the handover algorithm
1368  m_rrc->m_handoverManagementSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1369  }
1370 
1371  if ((m_rrc->m_ccmRrcSapProvider != nullptr) &&
1372  (m_rrc->m_componentCarrierMeasIds.find(measId) != m_rrc->m_componentCarrierMeasIds.end()))
1373  {
1374  // this measurement was requested by the handover algorithm
1375  m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1376  }
1377 
1378  if ((m_rrc->m_anrSapProvider != nullptr) &&
1379  (m_rrc->m_anrMeasIds.find(measId) != m_rrc->m_anrMeasIds.end()))
1380  {
1381  // this measurement was requested by the ANR function
1382  m_rrc->m_anrSapProvider->ReportUeMeas(msg.measResults);
1383  }
1384 
1385  if ((!m_rrc->m_ffrRrcSapProvider.empty()) &&
1386  (m_rrc->m_ffrMeasIds.find(measId) != m_rrc->m_ffrMeasIds.end()))
1387  {
1388  // this measurement was requested by the FFR function
1389  m_rrc->m_ffrRrcSapProvider.at(0)->ReportUeMeas(m_rnti, msg.measResults);
1390  }
1392  {
1393  for (const auto& it : msg.measResults.measResultServFreqList)
1394  {
1398  m_rrc->m_ffrRrcSapProvider.at(it.servFreqId)->ReportUeMeas(m_rnti, msg.measResults);
1399  }
1400  }
1401 
1404  m_rrc->m_ccmRrcSapProvider->ReportUeMeas(m_rnti, msg.measResults);
1405  // fire a trace source
1406  m_rrc->m_recvMeasurementReportTrace(m_imsi,
1407  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1408  m_rnti,
1409  msg);
1410 
1411 } // end of UeManager::RecvMeasurementReport
1412 
1413 // methods forwarded from CMAC SAP
1414 
1415 void
1417 {
1418  NS_LOG_FUNCTION(this << m_rnti);
1419  // at this stage used only by the scheduler for updating txMode
1420 
1422 
1424 
1425  // reconfigure the UE RRC
1427 }
1428 
1429 // methods forwarded from PDCP SAP
1430 
1431 void
1433 {
1434  NS_LOG_FUNCTION(this);
1435  if (params.lcid > 2)
1436  {
1437  // data radio bearer
1438  EpsBearerTag tag;
1439  tag.SetRnti(params.rnti);
1440  tag.SetBid(Lcid2Bid(params.lcid));
1441  params.pdcpSdu->AddPacketTag(tag);
1442  m_rrc->m_forwardUpCallback(params.pdcpSdu);
1443  }
1444 }
1445 
1446 uint16_t
1448 {
1449  return m_rnti;
1450 }
1451 
1452 uint64_t
1454 {
1455  return m_imsi;
1456 }
1457 
1458 uint8_t
1460 {
1461  return m_componentCarrierId;
1462 }
1463 
1464 uint16_t
1466 {
1468 }
1469 
1470 void
1472 {
1473  NS_LOG_FUNCTION(this);
1475  for (uint16_t i = 0; i < m_rrc->m_numberOfComponentCarriers; i++)
1476  {
1477  m_rrc->m_cphySapProvider.at(i)->SetSrsConfigurationIndex(m_rnti, srsConfIndex);
1478  }
1479  switch (m_state)
1480  {
1481  case INITIAL_RANDOM_ACCESS:
1482  // do nothing, srs conf index will be correctly enforced upon
1483  // RRC connection establishment
1484  break;
1485 
1486  default:
1488  break;
1489  }
1490 }
1491 
1494 {
1495  return m_state;
1496 }
1497 
1498 void
1500 {
1501  NS_LOG_FUNCTION(this);
1502  m_physicalConfigDedicated.pdschConfigDedicated = pdschConfigDedicated;
1503 
1505 
1506  // reconfigure the UE RRC
1508 }
1509 
1510 void
1512 {
1513  NS_LOG_FUNCTION(this);
1519 }
1520 
1523 {
1524  NS_LOG_FUNCTION(this);
1526  res.oldEnbUeX2apId = m_sourceX2apId;
1527  res.sourceCellId = m_sourceCellId;
1528  res.targetCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1529  res.cause = 0;
1530  res.criticalityDiagnostics = 0;
1531 
1532  return res;
1533 }
1534 
1537 {
1538  NS_LOG_FUNCTION(this);
1540  res.oldEnbUeX2apId = m_rnti; // source cell rnti
1541  res.newEnbUeX2apId = m_targetX2apId;
1542  res.sourceCellId = m_rrc->ComponentCarrierToCellId(m_componentCarrierId);
1543  res.targetCellId = m_targetCellId;
1544  res.cause = 0;
1545 
1546  return res;
1547 }
1548 
1549 uint8_t
1551 {
1552  NS_LOG_FUNCTION(this);
1553  const uint8_t MAX_DRB_ID = 32;
1554  for (int drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID; drbid != m_lastAllocatedDrbid;
1555  drbid = (drbid + 1) % MAX_DRB_ID)
1556  {
1557  if (drbid != 0) // 0 is not allowed
1558  {
1559  if (m_drbMap.find(drbid) == m_drbMap.end())
1560  {
1561  m_drbMap.insert(std::pair<uint8_t, Ptr<LteDataRadioBearerInfo>>(drbid, drbInfo));
1562  drbInfo->m_drbIdentity = drbid;
1563  m_lastAllocatedDrbid = drbid;
1564  return drbid;
1565  }
1566  }
1567  }
1568  NS_FATAL_ERROR("no more data radio bearer ids available");
1569  return 0;
1570 }
1571 
1574 {
1575  NS_LOG_FUNCTION(this << (uint32_t)drbid);
1576  NS_ASSERT(0 != drbid);
1577  auto it = m_drbMap.find(drbid);
1578  NS_ABORT_IF(it == m_drbMap.end());
1579  return it->second;
1580 }
1581 
1582 void
1584 {
1585  NS_LOG_FUNCTION(this << (uint32_t)drbid);
1586  auto it = m_drbMap.find(drbid);
1587  NS_ASSERT_MSG(it != m_drbMap.end(),
1588  "request to remove radio bearer with unknown drbid " << drbid);
1589  m_drbMap.erase(it);
1590 }
1591 
1594 {
1595  NS_LOG_FUNCTION(this);
1600  msg.haveMobilityControlInfo = false;
1601  msg.haveMeasConfig = true;
1602  msg.measConfig = m_rrc->m_ueMeasConfig;
1603  if (!m_caSupportConfigured && m_rrc->m_numberOfComponentCarriers > 1)
1604  {
1605  m_caSupportConfigured = true;
1606  NS_LOG_FUNCTION(this << "CA not configured. Configure now!");
1607  msg.haveNonCriticalExtension = true;
1609  NS_LOG_FUNCTION(this << " haveNonCriticalExtension " << msg.haveNonCriticalExtension);
1610  }
1611  else
1612  {
1613  msg.haveNonCriticalExtension = false;
1614  }
1615 
1616  return msg;
1617 }
1618 
1621 {
1622  NS_LOG_FUNCTION(this);
1624 
1625  if (m_srb1)
1626  {
1628  stam.srbIdentity = m_srb1->m_srbIdentity;
1629  stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1630  rrcd.srbToAddModList.push_back(stam);
1631  }
1632 
1633  for (auto it = m_drbMap.begin(); it != m_drbMap.end(); ++it)
1634  {
1636  dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1637  dtam.drbIdentity = it->second->m_drbIdentity;
1638  dtam.rlcConfig = it->second->m_rlcConfig;
1639  dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1640  dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1641  rrcd.drbToAddModList.push_back(dtam);
1642  }
1643 
1644  rrcd.havePhysicalConfigDedicated = true;
1646  return rrcd;
1647 }
1648 
1649 uint8_t
1651 {
1652  NS_LOG_FUNCTION(this);
1656 }
1657 
1658 uint8_t
1660 {
1661  NS_ASSERT(lcid > 2);
1662  return lcid - 2;
1663 }
1664 
1665 uint8_t
1667 {
1668  return drbid + 2;
1669 }
1670 
1671 uint8_t
1672 UeManager::Lcid2Bid(uint8_t lcid)
1673 {
1674  NS_ASSERT(lcid > 2);
1675  return lcid - 2;
1676 }
1677 
1678 uint8_t
1680 {
1681  return bid + 2;
1682 }
1683 
1684 uint8_t
1685 UeManager::Drbid2Bid(uint8_t drbid)
1686 {
1687  return drbid;
1688 }
1689 
1690 uint8_t
1692 {
1693  return bid;
1694 }
1695 
1696 void
1698 {
1699  NS_LOG_FUNCTION(this << ToString(newState));
1700  State oldState = m_state;
1701  m_state = newState;
1702  NS_LOG_INFO(this << " IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager "
1703  << ToString(oldState) << " --> " << ToString(newState));
1705  m_rrc->ComponentCarrierToCellId(m_componentCarrierId),
1706  m_rnti,
1707  oldState,
1708  newState);
1709 
1710  switch (newState)
1711  {
1712  case INITIAL_RANDOM_ACCESS:
1713  case HANDOVER_JOINING:
1714  NS_FATAL_ERROR("cannot switch to an initial state");
1715  break;
1716 
1717  case CONNECTION_SETUP:
1718  break;
1719 
1720  case ATTACH_REQUEST:
1721  break;
1722 
1723  case CONNECTED_NORMALLY: {
1725  {
1727  }
1729  {
1731  }
1732  }
1733  break;
1734 
1736  break;
1737 
1739  break;
1740 
1741  case HANDOVER_LEAVING:
1742  break;
1743 
1744  default:
1745  break;
1746  }
1747 }
1748 
1751 {
1752  NS_LOG_FUNCTION(this);
1754 
1755  for (auto& it : m_rrc->m_componentCarrierPhyConf)
1756  {
1757  uint8_t ccId = it.first;
1758 
1759  if (ccId == m_componentCarrierId)
1760  {
1761  // Skip primary CC.
1762  continue;
1763  }
1764  else if (ccId < m_componentCarrierId)
1765  {
1766  // Shift all IDs below PCC forward so PCC can use CC ID 1.
1767  ccId++;
1768  }
1769 
1770  Ptr<ComponentCarrierBaseStation> eNbCcm = it.second;
1771  LteRrcSap::SCellToAddMod component;
1772  component.sCellIndex = ccId;
1773  component.cellIdentification.physCellId = eNbCcm->GetCellId();
1774  component.cellIdentification.dlCarrierFreq = eNbCcm->GetDlEarfcn();
1777  eNbCcm->GetDlBandwidth();
1779  .antennaPortsCount = 0;
1781  .referenceSignalPower = m_rrc->m_cphySapProvider.at(0)->GetReferenceSignalPower();
1785  eNbCcm->GetUlEarfcn();
1787  eNbCcm->GetUlBandwidth();
1789  0;
1790  // component.radioResourceConfigCommonSCell.ulConfiguration.soundingRsUlConfigCommon.type =
1791  // LteRrcSap::SoundingRsUlConfigDedicated::SETUP;
1793  .srsBandwidthConfig = 0;
1795  .srsSubframeConfig = 0;
1797 
1798  component.haveRadioResourceConfigDedicatedSCell = true;
1800  .haveNonUlConfiguration = true;
1802  .haveAntennaInfoDedicated = true;
1804  .transmissionMode = m_rrc->m_defaultTransmissionMode;
1808  .havePdschConfigDedicated = true;
1812  .haveUlConfiguration = true;
1816  .transmissionMode = m_rrc->m_defaultTransmissionMode;
1829 
1830  ncec.sCellToAddModList.push_back(component);
1831  }
1832 
1833  return ncec;
1834 }
1835 
1837 // eNB RRC methods
1839 
1841 
1843  : m_x2SapProvider(nullptr),
1844  m_cmacSapProvider(0),
1845  m_handoverManagementSapProvider(nullptr),
1846  m_ccmRrcSapProvider(nullptr),
1847  m_anrSapProvider(nullptr),
1848  m_ffrRrcSapProvider(0),
1849  m_rrcSapUser(nullptr),
1850  m_macSapProvider(nullptr),
1851  m_s1SapProvider(nullptr),
1852  m_cphySapProvider(0),
1853  m_configured(false),
1854  m_lastAllocatedRnti(0),
1855  m_srsCurrentPeriodicityId(0),
1856  m_lastAllocatedConfigurationIndex(0),
1857  m_reconfigureUes(false),
1858  m_numberOfComponentCarriers(0),
1859  m_carriersConfigured(false)
1860 {
1861  NS_LOG_FUNCTION(this);
1862  m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, 0));
1871 }
1872 
1873 void
1875 {
1876  NS_ASSERT_MSG(!m_carriersConfigured, "Secondary carriers can be configured only once.");
1877  m_componentCarrierPhyConf = ccPhyConf;
1879  " Number of component carriers "
1880  "are not equal to the number of he component carrier configuration provided");
1881 
1882  for (uint16_t i = 1; i < m_numberOfComponentCarriers; i++)
1883  {
1885  m_cmacSapUser.push_back(new EnbRrcMemberLteEnbCmacSapUser(this, i));
1887  }
1888  m_carriersConfigured = true;
1890 }
1891 
1893 {
1894  NS_LOG_FUNCTION(this);
1895 }
1896 
1897 void
1899 {
1900  NS_LOG_FUNCTION(this);
1901  for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
1902  {
1903  delete m_cphySapUser[i];
1904  delete m_cmacSapUser[i];
1905  delete m_ffrRrcSapUser[i];
1906  }
1907  // delete m_cphySapUser;
1908  m_cphySapUser.erase(m_cphySapUser.begin(), m_cphySapUser.end());
1909  m_cphySapUser.clear();
1910  // delete m_cmacSapUser;
1911  m_cmacSapUser.erase(m_cmacSapUser.begin(), m_cmacSapUser.end());
1912  m_cmacSapUser.clear();
1913  // delete m_ffrRrcSapUser;
1914  m_ffrRrcSapUser.erase(m_ffrRrcSapUser.begin(), m_ffrRrcSapUser.end());
1915  m_ffrRrcSapUser.clear();
1916  m_ueMap.clear();
1918  delete m_ccmRrcSapUser;
1919  delete m_anrSapUser;
1920  delete m_rrcSapProvider;
1921  delete m_x2SapUser;
1922  delete m_s1SapUser;
1923 }
1924 
1925 TypeId
1927 {
1928  static TypeId tid =
1929  TypeId("ns3::LteEnbRrc")
1930  .SetParent<Object>()
1931  .SetGroupName("Lte")
1932  .AddConstructor<LteEnbRrc>()
1933  .AddAttribute("UeMap",
1934  "List of UeManager by C-RNTI.",
1935  ObjectMapValue(),
1937  MakeObjectMapChecker<UeManager>())
1938  .AddAttribute("DefaultTransmissionMode",
1939  "The default UEs' transmission mode (0: SISO)",
1940  UintegerValue(0), // default tx-mode
1942  MakeUintegerChecker<uint8_t>())
1943  .AddAttribute(
1944  "EpsBearerToRlcMapping",
1945  "Specify which type of RLC will be used for each type of EPS bearer.",
1947  MakeEnumAccessor<LteEpsBearerToRlcMapping_t>(&LteEnbRrc::m_epsBearerToRlcMapping),
1949  "RlcSmAlways",
1950  RLC_UM_ALWAYS,
1951  "RlcUmAlways",
1952  RLC_AM_ALWAYS,
1953  "RlcAmAlways",
1954  PER_BASED,
1955  "PacketErrorRateBased"))
1956  .AddAttribute("SystemInformationPeriodicity",
1957  "The interval for sending system information (Time value)",
1958  TimeValue(MilliSeconds(80)),
1960  MakeTimeChecker())
1961 
1962  // SRS related attributes
1963  .AddAttribute(
1964  "SrsPeriodicity",
1965  "The SRS periodicity in milliseconds",
1966  UintegerValue(40),
1968  MakeUintegerChecker<uint32_t>())
1969 
1970  // Timeout related attributes
1971  .AddAttribute("ConnectionRequestTimeoutDuration",
1972  "After a RA attempt, if no RRC CONNECTION REQUEST is "
1973  "received before this time, the UE context is destroyed. "
1974  "Must account for reception of RAR and transmission of "
1975  "RRC CONNECTION REQUEST over UL GRANT. The value of this"
1976  "timer should not be greater than T300 timer at UE RRC",
1977  TimeValue(MilliSeconds(15)),
1980  .AddAttribute("ConnectionSetupTimeoutDuration",
1981  "After accepting connection request, if no RRC CONNECTION "
1982  "SETUP COMPLETE is received before this time, the UE "
1983  "context is destroyed. Must account for the UE's reception "
1984  "of RRC CONNECTION SETUP and transmission of RRC CONNECTION "
1985  "SETUP COMPLETE.",
1986  TimeValue(MilliSeconds(150)),
1988  MakeTimeChecker())
1989  .AddAttribute("ConnectionRejectedTimeoutDuration",
1990  "Time to wait between sending a RRC CONNECTION REJECT and "
1991  "destroying the UE context",
1992  TimeValue(MilliSeconds(30)),
1994  MakeTimeChecker())
1995  .AddAttribute("HandoverJoiningTimeoutDuration",
1996  "After accepting a handover request, if no RRC CONNECTION "
1997  "RECONFIGURATION COMPLETE is received before this time, the "
1998  "UE context is destroyed. Must account for reception of "
1999  "X2 HO REQ ACK by source eNB, transmission of the Handover "
2000  "Command, non-contention-based random access and reception "
2001  "of the RRC CONNECTION RECONFIGURATION COMPLETE message.",
2002  TimeValue(MilliSeconds(200)),
2004  MakeTimeChecker())
2005  .AddAttribute("HandoverLeavingTimeoutDuration",
2006  "After issuing a Handover Command, if neither RRC "
2007  "CONNECTION RE-ESTABLISHMENT nor X2 UE Context Release has "
2008  "been previously received, the UE context is destroyed.",
2009  TimeValue(MilliSeconds(500)),
2011  MakeTimeChecker())
2012 
2013  // Cell selection related attribute
2014  .AddAttribute("QRxLevMin",
2015  "One of information transmitted within the SIB1 message, "
2016  "indicating the required minimum RSRP level that any UE must "
2017  "receive from this cell before it is allowed to camp to this "
2018  "cell. The default value -70 corresponds to -140 dBm and is "
2019  "the lowest possible value as defined by Section 6.3.4 of "
2020  "3GPP TS 36.133. This restriction, however, only applies to "
2021  "initial cell selection and EPC-enabled simulation.",
2023  IntegerValue(-70),
2025  MakeIntegerChecker<int8_t>(-70, -22))
2026  .AddAttribute("NumberOfComponentCarriers",
2027  "Number of Component Carriers",
2028  UintegerValue(1),
2030  MakeIntegerChecker<int16_t>(MIN_NO_CC, MAX_NO_CC))
2031 
2032  // Handover related attributes
2033  .AddAttribute("AdmitHandoverRequest",
2034  "Whether to admit an X2 handover request from another eNB",
2035  BooleanValue(true),
2038  .AddAttribute("AdmitRrcConnectionRequest",
2039  "Whether to admit a connection request from a UE",
2040  BooleanValue(true),
2043 
2044  // UE measurements related attributes
2045  .AddAttribute("RsrpFilterCoefficient",
2046  "Determines the strength of smoothing effect induced by "
2047  "layer 3 filtering of RSRP in all attached UE; "
2048  "if set to 0, no layer 3 filtering is applicable",
2049  // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2050  UintegerValue(4),
2052  MakeUintegerChecker<uint8_t>(0))
2053  .AddAttribute("RsrqFilterCoefficient",
2054  "Determines the strength of smoothing effect induced by "
2055  "layer 3 filtering of RSRQ in all attached UE; "
2056  "if set to 0, no layer 3 filtering is applicable",
2057  // i.e. the variable k in 3GPP TS 36.331 section 5.5.3.2
2058  UintegerValue(4),
2060  MakeUintegerChecker<uint8_t>(0))
2061 
2062  // Trace sources
2063  .AddTraceSource("NewUeContext",
2064  "Fired upon creation of a new UE context.",
2066  "ns3::LteEnbRrc::NewUeContextTracedCallback")
2067  .AddTraceSource("ConnectionEstablished",
2068  "Fired upon successful RRC connection establishment.",
2070  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2071  .AddTraceSource("ConnectionReconfiguration",
2072  "trace fired upon RRC connection reconfiguration",
2074  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2075  .AddTraceSource("HandoverStart",
2076  "trace fired upon start of a handover procedure",
2078  "ns3::LteEnbRrc::HandoverStartTracedCallback")
2079  .AddTraceSource("HandoverEndOk",
2080  "trace fired upon successful termination of a handover procedure",
2082  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2083  .AddTraceSource("RecvMeasurementReport",
2084  "trace fired when measurement report is received",
2086  "ns3::LteEnbRrc::ReceiveReportTracedCallback")
2087  .AddTraceSource("NotifyConnectionRelease",
2088  "trace fired when an UE is released",
2090  "ns3::LteEnbRrc::ConnectionHandoverTracedCallback")
2091  .AddTraceSource("RrcTimeout",
2092  "trace fired when a timer expires",
2094  "ns3::LteEnbRrc::TimerExpiryTracedCallback")
2095  .AddTraceSource(
2096  "HandoverFailureNoPreamble",
2097  "trace fired upon handover failure due to non-allocation of non-contention based "
2098  "preamble at eNB for UE to handover due to max count reached",
2100  "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2101  .AddTraceSource(
2102  "HandoverFailureMaxRach",
2103  "trace fired upon handover failure due to max RACH attempts from UE to target eNB",
2105  "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2106  .AddTraceSource(
2107  "HandoverFailureLeaving",
2108  "trace fired upon handover failure due to handover leaving timeout at source eNB",
2110  "ns3::LteEnbRrc::HandoverFailureTracedCallback")
2111  .AddTraceSource(
2112  "HandoverFailureJoining",
2113  "trace fired upon handover failure due to handover joining timeout at target eNB",
2115  "ns3::LteEnbRrc::HandoverFailureTracedCallback");
2116  return tid;
2117 }
2118 
2119 void
2121 {
2122  NS_LOG_FUNCTION(this << s);
2123  m_x2SapProvider = s;
2124 }
2125 
2126 EpcX2SapUser*
2128 {
2129  NS_LOG_FUNCTION(this);
2130  return m_x2SapUser;
2131 }
2132 
2133 void
2135 {
2136  NS_LOG_FUNCTION(this << s);
2137  m_cmacSapProvider.at(0) = s;
2138 }
2139 
2140 void
2142 {
2143  NS_LOG_FUNCTION(this << s);
2144  if (m_cmacSapProvider.size() > pos)
2145  {
2146  m_cmacSapProvider.at(pos) = s;
2147  }
2148  else
2149  {
2150  m_cmacSapProvider.push_back(s);
2151  NS_ABORT_IF(m_cmacSapProvider.size() - 1 != pos);
2152  }
2153 }
2154 
2157 {
2158  NS_LOG_FUNCTION(this);
2159  return m_cmacSapUser.at(0);
2160 }
2161 
2164 {
2165  NS_LOG_FUNCTION(this);
2166  return m_cmacSapUser.at(pos);
2167 }
2168 
2169 void
2171 {
2172  NS_LOG_FUNCTION(this << s);
2174 }
2175 
2178 {
2179  NS_LOG_FUNCTION(this);
2181 }
2182 
2183 void
2185 {
2186  NS_LOG_FUNCTION(this << s);
2187  m_ccmRrcSapProvider = s;
2188 }
2189 
2192 {
2193  NS_LOG_FUNCTION(this);
2194  return m_ccmRrcSapUser;
2195 }
2196 
2197 void
2199 {
2200  NS_LOG_FUNCTION(this << s);
2201  m_anrSapProvider = s;
2202 }
2203 
2206 {
2207  NS_LOG_FUNCTION(this);
2208  return m_anrSapUser;
2209 }
2210 
2211 void
2213 {
2214  NS_LOG_FUNCTION(this << s);
2215  if (!m_ffrRrcSapProvider.empty())
2216  {
2217  m_ffrRrcSapProvider.at(0) = s;
2218  }
2219  else
2220  {
2221  m_ffrRrcSapProvider.push_back(s);
2222  }
2223 }
2224 
2225 void
2227 {
2228  NS_LOG_FUNCTION(this << s);
2229  if (m_ffrRrcSapProvider.size() > index)
2230  {
2231  m_ffrRrcSapProvider.at(index) = s;
2232  }
2233  else
2234  {
2235  m_ffrRrcSapProvider.push_back(s);
2236  NS_ABORT_MSG_IF(m_ffrRrcSapProvider.size() - 1 != index,
2237  "You meant to store the pointer at position "
2238  << static_cast<uint32_t>(index) << " but it went to "
2239  << m_ffrRrcSapProvider.size() - 1);
2240  }
2241 }
2242 
2245 {
2246  NS_LOG_FUNCTION(this);
2247  return m_ffrRrcSapUser.at(0);
2248 }
2249 
2252 {
2253  NS_LOG_FUNCTION(this);
2255  "Invalid component carrier index:"
2256  << index << " provided in order to obtain FfrRrcSapUser.");
2257  return m_ffrRrcSapUser.at(index);
2258 }
2259 
2260 void
2262 {
2263  NS_LOG_FUNCTION(this << s);
2264  m_rrcSapUser = s;
2265 }
2266 
2269 {
2270  NS_LOG_FUNCTION(this);
2271  return m_rrcSapProvider;
2272 }
2273 
2274 void
2276 {
2277  NS_LOG_FUNCTION(this);
2278  m_macSapProvider = s;
2279 }
2280 
2281 void
2283 {
2284  m_s1SapProvider = s;
2285 }
2286 
2289 {
2290  return m_s1SapUser;
2291 }
2292 
2293 void
2295 {
2296  NS_LOG_FUNCTION(this << s);
2297  if (!m_cphySapProvider.empty())
2298  {
2299  m_cphySapProvider.at(0) = s;
2300  }
2301  else
2302  {
2303  m_cphySapProvider.push_back(s);
2304  }
2305 }
2306 
2309 {
2310  NS_LOG_FUNCTION(this);
2311  return m_cphySapUser.at(0);
2312 }
2313 
2314 void
2316 {
2317  NS_LOG_FUNCTION(this << s);
2318  if (m_cphySapProvider.size() > pos)
2319  {
2320  m_cphySapProvider.at(pos) = s;
2321  }
2322  else
2323  {
2324  m_cphySapProvider.push_back(s);
2325  NS_ABORT_IF(m_cphySapProvider.size() - 1 != pos);
2326  }
2327 }
2328 
2331 {
2332  NS_LOG_FUNCTION(this);
2333  return m_cphySapUser.at(pos);
2334 }
2335 
2336 bool
2337 LteEnbRrc::HasUeManager(uint16_t rnti) const
2338 {
2339  NS_LOG_FUNCTION(this << (uint32_t)rnti);
2340  auto it = m_ueMap.find(rnti);
2341  return (it != m_ueMap.end());
2342 }
2343 
2346 {
2347  NS_LOG_FUNCTION(this << (uint32_t)rnti);
2348  NS_ASSERT(0 != rnti);
2349  auto it = m_ueMap.find(rnti);
2350  NS_ASSERT_MSG(it != m_ueMap.end(), "UE manager for RNTI " << rnti << " not found");
2351  return it->second;
2352 }
2353 
2354 std::vector<uint8_t>
2356 {
2357  NS_LOG_FUNCTION(this);
2358 
2359  // SANITY CHECK
2360 
2361  NS_ASSERT_MSG(
2364  "Measurement identities and reporting configuration should not have different quantity");
2365 
2366  if (Simulator::Now() != Seconds(0))
2367  {
2368  NS_FATAL_ERROR("AddUeMeasReportConfig may not be called after the simulation has run");
2369  }
2370 
2371  // INPUT VALIDATION
2372 
2373  switch (config.triggerQuantity)
2374  {
2378  {
2380  "The given triggerQuantity (RSRP) does not match with the given threshold2.choice");
2381  }
2382 
2388  {
2390  "The given triggerQuantity (RSRP) does not match with the given threshold1.choice");
2391  }
2392  break;
2393 
2397  {
2399  "The given triggerQuantity (RSRQ) does not match with the given threshold2.choice");
2400  }
2401 
2407  {
2409  "The given triggerQuantity (RSRQ) does not match with the given threshold1.choice");
2410  }
2411  break;
2412 
2413  default:
2414  NS_FATAL_ERROR("unsupported triggerQuantity");
2415  break;
2416  }
2417 
2419  {
2420  NS_FATAL_ERROR("Only REPORT_STRONGEST_CELLS purpose is supported");
2421  }
2422 
2424  {
2425  NS_LOG_WARN("reportQuantity = BOTH will be used instead of the given reportQuantity");
2426  }
2427 
2428  uint8_t nextId = m_ueMeasConfig.reportConfigToAddModList.size() + 1;
2429 
2430  // create the reporting configuration
2431  LteRrcSap::ReportConfigToAddMod reportConfig;
2432  reportConfig.reportConfigId = nextId;
2433  reportConfig.reportConfigEutra = config;
2434 
2435  // add reporting configuration to UE measurement configuration
2436  m_ueMeasConfig.reportConfigToAddModList.push_back(reportConfig);
2437 
2438  std::vector<uint8_t> measIds;
2439 
2440  // create measurement identities, linking reporting configuration to all objects
2441  for (uint16_t componentCarrier = 0; componentCarrier < m_numberOfComponentCarriers;
2442  componentCarrier++)
2443  {
2444  LteRrcSap::MeasIdToAddMod measIdToAddMod;
2445 
2446  uint8_t measId = m_ueMeasConfig.measIdToAddModList.size() + 1;
2447 
2448  measIdToAddMod.measId = measId;
2449  measIdToAddMod.measObjectId = componentCarrier + 1;
2450  measIdToAddMod.reportConfigId = nextId;
2451 
2452  m_ueMeasConfig.measIdToAddModList.push_back(measIdToAddMod);
2453  measIds.push_back(measId);
2454  }
2455 
2456  return measIds;
2457 }
2458 
2459 void
2461 {
2462  auto it = ccPhyConf.begin();
2463  NS_ASSERT(it != ccPhyConf.end());
2464  uint16_t ulBandwidth = it->second->GetUlBandwidth();
2465  uint16_t dlBandwidth = it->second->GetDlBandwidth();
2466  uint32_t ulEarfcn = it->second->GetUlEarfcn();
2467  uint32_t dlEarfcn = it->second->GetDlEarfcn();
2468  NS_LOG_FUNCTION(this << ulBandwidth << dlBandwidth << ulEarfcn << dlEarfcn);
2470 
2471  for (const auto& it : ccPhyConf)
2472  {
2473  m_cphySapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2474  it.second->GetDlBandwidth());
2475  m_cphySapProvider.at(it.first)->SetEarfcn(it.second->GetUlEarfcn(),
2476  it.second->GetDlEarfcn());
2477  m_cphySapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2478  m_cmacSapProvider.at(it.first)->ConfigureMac(it.second->GetUlBandwidth(),
2479  it.second->GetDlBandwidth());
2480  if (m_ffrRrcSapProvider.size() > it.first)
2481  {
2482  m_ffrRrcSapProvider.at(it.first)->SetCellId(it.second->GetCellId());
2483  m_ffrRrcSapProvider.at(it.first)->SetBandwidth(it.second->GetUlBandwidth(),
2484  it.second->GetDlBandwidth());
2485  }
2486  }
2487 
2488  m_dlEarfcn = dlEarfcn;
2489  m_ulEarfcn = ulEarfcn;
2490  m_dlBandwidth = dlBandwidth;
2491  m_ulBandwidth = ulBandwidth;
2492 
2493  /*
2494  * Initializing the list of measurement objects.
2495  * Only intra-frequency measurements are supported,
2496  * so one measurement object is created for each carrier frequency.
2497  */
2498  for (const auto& it : ccPhyConf)
2499  {
2500  LteRrcSap::MeasObjectToAddMod measObject;
2501  measObject.measObjectId = it.first + 1;
2502  measObject.measObjectEutra.carrierFreq = it.second->GetDlEarfcn();
2503  measObject.measObjectEutra.allowedMeasBandwidth = it.second->GetDlBandwidth();
2504  measObject.measObjectEutra.presenceAntennaPort1 = false;
2505  measObject.measObjectEutra.neighCellConfig = 0;
2506  measObject.measObjectEutra.offsetFreq = 0;
2507  measObject.measObjectEutra.haveCellForWhichToReportCGI = false;
2508 
2509  m_ueMeasConfig.measObjectToAddModList.push_back(measObject);
2510  }
2511 
2516  m_ueMeasConfig.haveSmeasure = false;
2518 
2519  m_sib1.clear();
2520  m_sib1.reserve(ccPhyConf.size());
2521  for (const auto& it : ccPhyConf)
2522  {
2523  // Enabling MIB transmission
2525  mib.dlBandwidth = it.second->GetDlBandwidth();
2526  mib.systemFrameNumber = 0;
2527  m_cphySapProvider.at(it.first)->SetMasterInformationBlock(mib);
2528 
2529  // Enabling SIB1 transmission with default values
2531  sib1.cellAccessRelatedInfo.cellIdentity = it.second->GetCellId();
2532  sib1.cellAccessRelatedInfo.csgIndication = false;
2535  sib1.cellSelectionInfo.qQualMin = -34; // not used, set as minimum value
2536  sib1.cellSelectionInfo.qRxLevMin = m_qRxLevMin; // set as minimum value
2537  m_sib1.push_back(sib1);
2538  m_cphySapProvider.at(it.first)->SetSystemInformationBlockType1(sib1);
2539  }
2540  /*
2541  * Enabling transmission of other SIB. The first time System Information is
2542  * transmitted is arbitrarily assumed to be at +0.016s, and then it will be
2543  * regularly transmitted every 80 ms by default (set the
2544  * SystemInformationPeriodicity attribute to configure this).
2545  */
2547 
2548  m_configured = true;
2549 }
2550 
2551 void
2552 LteEnbRrc::SetCellId(uint16_t cellId)
2553 {
2554  // update SIB1
2555  m_sib1.at(0).cellAccessRelatedInfo.cellIdentity = cellId;
2556  m_cphySapProvider.at(0)->SetSystemInformationBlockType1(m_sib1.at(0));
2557 }
2558 
2559 void
2560 LteEnbRrc::SetCellId(uint16_t cellId, uint8_t ccIndex)
2561 {
2562  // update SIB1
2563  m_sib1.at(ccIndex).cellAccessRelatedInfo.cellIdentity = cellId;
2564  m_cphySapProvider.at(ccIndex)->SetSystemInformationBlockType1(m_sib1.at(ccIndex));
2565 }
2566 
2567 uint8_t
2569 {
2570  NS_LOG_FUNCTION(this << cellId);
2571  for (auto& it : m_componentCarrierPhyConf)
2572  {
2573  if (it.second->GetCellId() == cellId)
2574  {
2575  return it.first;
2576  }
2577  }
2578  NS_FATAL_ERROR("Cell " << cellId << " not found in CC map");
2579 }
2580 
2581 uint16_t
2582 LteEnbRrc::ComponentCarrierToCellId(uint8_t componentCarrierId)
2583 {
2584  NS_LOG_FUNCTION(this << +componentCarrierId);
2585  return m_componentCarrierPhyConf.at(componentCarrierId)->GetCellId();
2586 }
2587 
2588 bool
2589 LteEnbRrc::HasCellId(uint16_t cellId) const
2590 {
2591  for (auto& it : m_componentCarrierPhyConf)
2592  {
2593  if (it.second->GetCellId() == cellId)
2594  {
2595  return true;
2596  }
2597  }
2598  return false;
2599 }
2600 
2601 bool
2603 {
2604  NS_LOG_FUNCTION(this << packet);
2605  EpsBearerTag tag;
2606  bool found = packet->RemovePacketTag(tag);
2607  NS_ASSERT_MSG(found, "no EpsBearerTag found in packet to be sent");
2608  Ptr<UeManager> ueManager = GetUeManager(tag.GetRnti());
2609 
2610  NS_LOG_INFO("Sending a packet of " << packet->GetSize() << " bytes to IMSI "
2611  << ueManager->GetImsi() << ", RNTI " << ueManager->GetRnti()
2612  << ", BID " << (uint16_t)tag.GetBid());
2613  ueManager->SendData(tag.GetBid(), packet);
2614 
2615  return true;
2616 }
2617 
2618 void
2620 {
2621  m_forwardUpCallback = cb;
2622 }
2623 
2624 void
2626 {
2627  NS_LOG_FUNCTION(this << rnti);
2629  "ConnectionRequestTimeout in unexpected state "
2630  << ToString(GetUeManager(rnti)->GetState()));
2631  m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2632  rnti,
2633  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2634  "ConnectionRequestTimeout");
2635  RemoveUe(rnti);
2636 }
2637 
2638 void
2640 {
2641  NS_LOG_FUNCTION(this << rnti);
2643  "ConnectionSetupTimeout in unexpected state "
2644  << ToString(GetUeManager(rnti)->GetState()));
2645  m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2646  rnti,
2647  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2648  "ConnectionSetupTimeout");
2649  RemoveUe(rnti);
2650 }
2651 
2652 void
2654 {
2655  NS_LOG_FUNCTION(this << rnti);
2657  "ConnectionRejectedTimeout in unexpected state "
2658  << ToString(GetUeManager(rnti)->GetState()));
2659  m_rrcTimeoutTrace(GetUeManager(rnti)->GetImsi(),
2660  rnti,
2661  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()),
2662  "ConnectionRejectedTimeout");
2663  RemoveUe(rnti);
2664 }
2665 
2666 void
2668 {
2669  NS_LOG_FUNCTION(this << rnti);
2671  "HandoverJoiningTimeout in unexpected state "
2672  << ToString(GetUeManager(rnti)->GetState()));
2674  GetUeManager(rnti)->GetImsi(),
2675  rnti,
2676  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2677  // check if the RNTI to be removed is not stale
2678  if (HasUeManager(rnti))
2679  {
2687  Ptr<UeManager> ueManager = GetUeManager(rnti);
2688  EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2690  RemoveUe(rnti);
2691  }
2692 }
2693 
2694 void
2696 {
2697  NS_LOG_FUNCTION(this << rnti);
2699  "HandoverLeavingTimeout in unexpected state "
2700  << ToString(GetUeManager(rnti)->GetState()));
2702  GetUeManager(rnti)->GetImsi(),
2703  rnti,
2704  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2705  // check if the RNTI to be removed is not stale
2706  if (HasUeManager(rnti))
2707  {
2713  Ptr<UeManager> ueManager = GetUeManager(rnti);
2714  EpcX2Sap::HandoverCancelParams msg = ueManager->BuildHoCancelMsg();
2716  ueManager->SendRrcConnectionRelease();
2717  }
2718 }
2719 
2720 void
2721 LteEnbRrc::SendHandoverRequest(uint16_t rnti, uint16_t cellId)
2722 {
2723  NS_LOG_FUNCTION(this << rnti << cellId);
2724  NS_LOG_LOGIC("Request to send HANDOVER REQUEST");
2726 
2727  Ptr<UeManager> ueManager = GetUeManager(rnti);
2728  ueManager->PrepareHandover(cellId);
2729 }
2730 
2731 void
2733 {
2734  NS_LOG_FUNCTION(this << rnti);
2735  GetUeManager(rnti)->CompleteSetupUe(params);
2736 }
2737 
2738 void
2740 {
2741  NS_LOG_FUNCTION(this << rnti);
2742  GetUeManager(rnti)->RecvRrcConnectionRequest(msg);
2743 }
2744 
2745 void
2748 {
2749  NS_LOG_FUNCTION(this << rnti);
2750  GetUeManager(rnti)->RecvRrcConnectionSetupCompleted(msg);
2751 }
2752 
2753 void
2755  uint16_t rnti,
2757 {
2758  NS_LOG_FUNCTION(this << rnti);
2759  GetUeManager(rnti)->RecvRrcConnectionReconfigurationCompleted(msg);
2760 }
2761 
2762 void
2764  uint16_t rnti,
2766 {
2767  NS_LOG_FUNCTION(this << rnti);
2768  GetUeManager(rnti)->RecvRrcConnectionReestablishmentRequest(msg);
2769 }
2770 
2771 void
2773  uint16_t rnti,
2775 {
2776  NS_LOG_FUNCTION(this << rnti);
2777  GetUeManager(rnti)->RecvRrcConnectionReestablishmentComplete(msg);
2778 }
2779 
2780 void
2782 {
2783  NS_LOG_FUNCTION(this << rnti);
2784  GetUeManager(rnti)->RecvMeasurementReport(msg);
2785 }
2786 
2787 void
2789 {
2790  NS_LOG_FUNCTION(this);
2791  Ptr<UeManager> ueManager = GetUeManager(msg.rnti);
2792  ueManager->InitialContextSetupRequest();
2793 }
2794 
2795 void
2797 {
2798  NS_LOG_FUNCTION(this << rnti);
2799 
2800  // check if the RNTI to be removed is not stale
2801  if (HasUeManager(rnti))
2802  {
2803  Ptr<UeManager> ueManager = GetUeManager(rnti);
2804 
2805  if (ueManager->GetState() == UeManager::HANDOVER_JOINING)
2806  {
2808  GetUeManager(rnti)->GetImsi(),
2809  rnti,
2810  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2817  EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2819  }
2820 
2821  GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
2822  // delete the UE context at the eNB
2823  RemoveUe(rnti);
2824  }
2825 }
2826 
2827 void
2830 {
2831  NS_LOG_FUNCTION(this);
2832  Ptr<UeManager> ueManager = GetUeManager(request.rnti);
2833  ueManager->SetupDataRadioBearer(request.bearer,
2834  request.bearerId,
2835  request.gtpTeid,
2836  request.transportLayerAddress);
2837 }
2838 
2839 void
2842 {
2843  NS_LOG_FUNCTION(this);
2844  Ptr<UeManager> ueManager = GetUeManager(params.rnti);
2845  ueManager->SendUeContextRelease();
2846 }
2847 
2848 void
2850 {
2851  NS_LOG_FUNCTION(this);
2852 
2853  NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST");
2854 
2855  NS_LOG_LOGIC("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
2856  NS_LOG_LOGIC("sourceCellId = " << req.sourceCellId);
2857  NS_LOG_LOGIC("targetCellId = " << req.targetCellId);
2858  NS_LOG_LOGIC("mmeUeS1apId = " << req.mmeUeS1apId);
2859 
2860  // if no SRS index is available, then do not accept the handover
2862  {
2863  NS_LOG_INFO("rejecting handover request from cellId " << req.sourceCellId);
2865  res.oldEnbUeX2apId = req.oldEnbUeX2apId;
2866  res.sourceCellId = req.sourceCellId;
2867  res.targetCellId = req.targetCellId;
2868  res.cause = 0;
2869  res.criticalityDiagnostics = 0;
2871  return;
2872  }
2873 
2874  uint8_t componentCarrierId = CellToComponentCarrierId(req.targetCellId);
2875  uint16_t rnti = AddUe(UeManager::HANDOVER_JOINING, componentCarrierId);
2876  Ptr<UeManager> ueManager = GetUeManager(rnti);
2877  ueManager->SetSource(req.sourceCellId, req.oldEnbUeX2apId);
2878  ueManager->SetImsi(req.mmeUeS1apId);
2880  m_cmacSapProvider.at(componentCarrierId)->AllocateNcRaPreamble(rnti);
2881  if (!anrcrv.valid)
2882  {
2883  NS_LOG_INFO(
2884  this
2885  << " failed to allocate a preamble for non-contention based RA => cannot accept HO");
2887  GetUeManager(rnti)->GetImsi(),
2888  rnti,
2889  ComponentCarrierToCellId(GetUeManager(rnti)->GetComponentCarrierId()));
2895  Ptr<UeManager> ueManager = GetUeManager(rnti);
2896  EpcX2Sap::HandoverPreparationFailureParams msg = ueManager->BuildHoPrepFailMsg();
2898  RemoveUe(rnti); // remove the UE from the target eNB
2899  return;
2900  }
2901 
2903  ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
2904  ackParams.newEnbUeX2apId = rnti;
2905  ackParams.sourceCellId = req.sourceCellId;
2906  ackParams.targetCellId = req.targetCellId;
2907 
2908  for (auto it = req.bearers.begin(); it != req.bearers.end(); ++it)
2909  {
2910  ueManager->SetupDataRadioBearer(it->erabLevelQosParameters,
2911  it->erabId,
2912  it->gtpTeid,
2913  it->transportLayerAddress);
2915  i.erabId = it->erabId;
2916  ackParams.admittedBearers.push_back(i);
2917  }
2918 
2919  LteRrcSap::RrcConnectionReconfiguration handoverCommand =
2920  ueManager->GetRrcConnectionReconfigurationForHandover(componentCarrierId);
2921 
2922  handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
2923  handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
2926  anrcrv.raPrachMaskIndex;
2927 
2929  m_cmacSapProvider.at(componentCarrierId)->GetRachConfig();
2931  .numberOfRaPreambles = rc.numberOfRaPreambles;
2933  .preambleTransMax = rc.preambleTransMax;
2935  .raResponseWindowSize = rc.raResponseWindowSize;
2937  .connEstFailCount = rc.connEstFailCount;
2938 
2939  Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand(handoverCommand);
2940 
2941  ackParams.rrcContext = encodedHandoverCommand;
2942 
2943  NS_LOG_LOGIC("Send X2 message: HANDOVER REQUEST ACK");
2944 
2945  NS_LOG_LOGIC("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
2946  NS_LOG_LOGIC("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
2947  NS_LOG_LOGIC("sourceCellId = " << ackParams.sourceCellId);
2948  NS_LOG_LOGIC("targetCellId = " << ackParams.targetCellId);
2949 
2951 }
2952 
2953 void
2955 {
2956  NS_LOG_FUNCTION(this);
2957 
2958  NS_LOG_LOGIC("Recv X2 message: HANDOVER REQUEST ACK");
2959 
2960  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2961  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
2962  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2963  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2964 
2965  uint16_t rnti = params.oldEnbUeX2apId;
2966  Ptr<UeManager> ueManager = GetUeManager(rnti);
2967  ueManager->RecvHandoverRequestAck(params);
2968 }
2969 
2970 void
2972 {
2973  NS_LOG_FUNCTION(this);
2974 
2975  NS_LOG_LOGIC("Recv X2 message: HANDOVER PREPARATION FAILURE");
2976 
2977  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
2978  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
2979  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
2980  NS_LOG_LOGIC("cause = " << params.cause);
2981  NS_LOG_LOGIC("criticalityDiagnostics = " << params.criticalityDiagnostics);
2982 
2983  uint16_t rnti = params.oldEnbUeX2apId;
2984 
2985  // check if the RNTI is not stale
2986  if (HasUeManager(rnti))
2987  {
2988  Ptr<UeManager> ueManager = GetUeManager(rnti);
2989  ueManager->RecvHandoverPreparationFailure(params.targetCellId);
2990  }
2991 }
2992 
2993 void
2995 {
2996  NS_LOG_FUNCTION(this);
2997 
2998  NS_LOG_LOGIC("Recv X2 message: SN STATUS TRANSFER");
2999 
3000  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3001  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3002  NS_LOG_LOGIC("erabsSubjectToStatusTransferList size = "
3003  << params.erabsSubjectToStatusTransferList.size());
3004 
3005  uint16_t rnti = params.newEnbUeX2apId;
3006 
3007  // check if the RNTI to receive SN transfer for is not stale
3008  if (HasUeManager(rnti))
3009  {
3010  Ptr<UeManager> ueManager = GetUeManager(rnti);
3011  ueManager->RecvSnStatusTransfer(params);
3012  }
3013 }
3014 
3015 void
3017 {
3018  NS_LOG_FUNCTION(this);
3019 
3020  NS_LOG_LOGIC("Recv X2 message: UE CONTEXT RELEASE");
3021 
3022  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3023  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3024 
3025  uint16_t rnti = params.oldEnbUeX2apId;
3026 
3027  // check if the RNTI to be removed is not stale
3028  if (HasUeManager(rnti))
3029  {
3030  GetUeManager(rnti)->RecvUeContextRelease(params);
3031  RemoveUe(rnti);
3032  }
3033 }
3034 
3035 void
3037 {
3038  NS_LOG_FUNCTION(this);
3039 
3040  NS_LOG_LOGIC("Recv X2 message: LOAD INFORMATION");
3041 
3042  NS_LOG_LOGIC("Number of cellInformationItems = " << params.cellInformationList.size());
3043 
3045  m_ffrRrcSapProvider.at(0)->RecvLoadInformation(params);
3046 }
3047 
3048 void
3050 {
3051  NS_LOG_FUNCTION(this);
3052 
3053  NS_LOG_LOGIC("Recv X2 message: RESOURCE STATUS UPDATE");
3054 
3055  NS_LOG_LOGIC(
3056  "Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size());
3057 
3058  NS_ASSERT("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
3059 }
3060 
3061 void
3063 {
3064  NS_LOG_FUNCTION(this);
3065 
3066  NS_LOG_LOGIC("Recv UE DATA FORWARDING through X2 interface");
3067  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3068  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3069  NS_LOG_LOGIC("gtpTeid = " << params.gtpTeid);
3070  NS_LOG_LOGIC("ueData = " << params.ueData);
3071  NS_LOG_LOGIC("ueData size = " << params.ueData->GetSize());
3072 
3073  auto teidInfoIt = m_x2uTeidInfoMap.find(params.gtpTeid);
3074  if (teidInfoIt != m_x2uTeidInfoMap.end())
3075  {
3076  GetUeManager(teidInfoIt->second.rnti)->SendData(teidInfoIt->second.drbid, params.ueData);
3077  }
3078  else
3079  {
3080  NS_FATAL_ERROR("X2-U data received but no X2uTeidInfo found");
3081  }
3082 }
3083 
3084 void
3086 {
3087  NS_LOG_FUNCTION(this);
3088 
3089  NS_LOG_LOGIC("Recv X2 message: HANDOVER CANCEL");
3090 
3091  NS_LOG_LOGIC("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
3092  NS_LOG_LOGIC("newEnbUeX2apId = " << params.newEnbUeX2apId);
3093  NS_LOG_LOGIC("sourceCellId = " << params.sourceCellId);
3094  NS_LOG_LOGIC("targetCellId = " << params.targetCellId);
3095  NS_LOG_LOGIC("cause = " << params.cause);
3096 
3097  uint16_t rnti = params.newEnbUeX2apId;
3098  if (HasUeManager(rnti))
3099  {
3100  Ptr<UeManager> ueManager = GetUeManager(rnti);
3101  ueManager->RecvHandoverCancel(params);
3102  GetUeManager(rnti)->RecvIdealUeContextRemoveRequest(rnti);
3103  }
3104 }
3105 
3106 uint16_t
3107 LteEnbRrc::DoAllocateTemporaryCellRnti(uint8_t componentCarrierId)
3108 {
3109  NS_LOG_FUNCTION(this << +componentCarrierId);
3110  // if no SRS index is available, then do not create a new UE context.
3111  if (IsMaxSrsReached())
3112  {
3113  NS_LOG_WARN("Not enough SRS configuration indices, UE context not created");
3114  return 0; // return 0 since new RNTI was not assigned for the received preamble
3115  }
3116  return AddUe(UeManager::INITIAL_RANDOM_ACCESS, componentCarrierId);
3117 }
3118 
3119 void
3121 {
3122  Ptr<UeManager> ueManager = GetUeManager(cmacParams.m_rnti);
3123  ueManager->CmacUeConfigUpdateInd(cmacParams);
3124 }
3125 
3126 void
3127 LteEnbRrc::DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
3128 {
3129  NS_LOG_FUNCTION(this << (uint32_t)rnti);
3130  NS_FATAL_ERROR("not implemented");
3131 }
3132 
3133 std::vector<uint8_t>
3135 {
3136  NS_LOG_FUNCTION(this);
3137  std::vector<uint8_t> measIds = AddUeMeasReportConfig(reportConfig);
3138  m_handoverMeasIds.insert(measIds.begin(), measIds.end());
3139  return measIds;
3140 }
3141 
3142 uint8_t
3144 {
3145  NS_LOG_FUNCTION(this);
3146  uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3147  m_componentCarrierMeasIds.insert(measId);
3148  return measId;
3149 }
3150 
3151 void
3152 LteEnbRrc::DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
3153 {
3154  m_numberOfComponentCarriers = numberOfComponentCarriers;
3155 }
3156 
3157 void
3158 LteEnbRrc::DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
3159 {
3160  NS_LOG_FUNCTION(this << rnti << targetCellId);
3161 
3162  bool isHandoverAllowed = true;
3163 
3164  Ptr<UeManager> ueManager = GetUeManager(rnti);
3165  NS_ASSERT_MSG(ueManager, "Cannot find UE context with RNTI " << rnti);
3166 
3167  if (m_anrSapProvider != nullptr && !HasCellId(targetCellId))
3168  {
3169  // ensure that proper neighbour relationship exists between source and target cells
3170  bool noHo = m_anrSapProvider->GetNoHo(targetCellId);
3171  bool noX2 = m_anrSapProvider->GetNoX2(targetCellId);
3172  NS_LOG_DEBUG(this << " cellId="
3173  << ComponentCarrierToCellId(ueManager->GetComponentCarrierId())
3174  << " targetCellId=" << targetCellId << " NRT.NoHo=" << noHo
3175  << " NRT.NoX2=" << noX2);
3176 
3177  if (noHo || noX2)
3178  {
3179  isHandoverAllowed = false;
3180  NS_LOG_LOGIC(this << " handover to cell " << targetCellId << " is not allowed by ANR");
3181  }
3182  }
3183 
3184  if (ueManager->GetState() != UeManager::CONNECTED_NORMALLY)
3185  {
3186  isHandoverAllowed = false;
3187  NS_LOG_LOGIC(this << " handover is not allowed because the UE"
3188  << " rnti=" << rnti << " is in " << ToString(ueManager->GetState())
3189  << " state");
3190  }
3191 
3192  if (isHandoverAllowed)
3193  {
3194  // initiate handover execution
3195  ueManager->PrepareHandover(targetCellId);
3196  }
3197 }
3198 
3199 uint8_t
3201 {
3202  NS_LOG_FUNCTION(this);
3203  uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3204  m_anrMeasIds.insert(measId);
3205  return measId;
3206 }
3207 
3208 uint8_t
3210 {
3211  NS_LOG_FUNCTION(this);
3212  uint8_t measId = AddUeMeasReportConfig(reportConfig).at(0);
3213  m_ffrMeasIds.insert(measId);
3214  return measId;
3215 }
3216 
3217 void
3219  LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
3220 {
3221  NS_LOG_FUNCTION(this);
3222  Ptr<UeManager> ueManager = GetUeManager(rnti);
3223  ueManager->SetPdschConfigDedicated(pdschConfigDedicated);
3224 }
3225 
3226 void
3228 {
3229  NS_LOG_FUNCTION(this);
3230 
3232 }
3233 
3234 uint16_t
3235 LteEnbRrc::AddUe(UeManager::State state, uint8_t componentCarrierId)
3236 {
3237  NS_LOG_FUNCTION(this);
3238  bool found = false;
3239  uint16_t rnti;
3240  for (rnti = m_lastAllocatedRnti + 1; (rnti != m_lastAllocatedRnti - 1) && (!found); ++rnti)
3241  {
3242  if ((rnti != 0) && (m_ueMap.find(rnti) == m_ueMap.end()))
3243  {
3244  found = true;
3245  break;
3246  }
3247  }
3248 
3249  NS_ASSERT_MSG(found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
3250  m_lastAllocatedRnti = rnti;
3251  Ptr<UeManager> ueManager = CreateObject<UeManager>(this, rnti, state, componentCarrierId);
3252  m_ccmRrcSapProvider->AddUe(rnti, (uint8_t)state);
3253  m_ueMap.insert(std::pair<uint16_t, Ptr<UeManager>>(rnti, ueManager));
3254  ueManager->Initialize();
3255  const uint16_t cellId = ComponentCarrierToCellId(componentCarrierId);
3256  NS_LOG_DEBUG(this << " New UE RNTI " << rnti << " cellId " << cellId << " srs CI "
3257  << ueManager->GetSrsConfigurationIndex());
3258  m_newUeContextTrace(cellId, rnti);
3259  return rnti;
3260 }
3261 
3262 void
3263 LteEnbRrc::RemoveUe(uint16_t rnti)
3264 {
3265  NS_LOG_FUNCTION(this << (uint32_t)rnti);
3266  auto it = m_ueMap.find(rnti);
3267  NS_ASSERT_MSG(it != m_ueMap.end(), "request to remove UE info with unknown rnti " << rnti);
3268  uint64_t imsi = it->second->GetImsi();
3269  uint16_t srsCi = (*it).second->GetSrsConfigurationIndex();
3270  // cancel pending events
3271  it->second->CancelPendingEvents();
3272  // fire trace upon connection release
3274  ComponentCarrierToCellId(it->second->GetComponentCarrierId()),
3275  rnti);
3276  m_ueMap.erase(it);
3277  for (uint16_t i = 0; i < m_numberOfComponentCarriers; i++)
3278  {
3279  m_cmacSapProvider.at(i)->RemoveUe(rnti);
3280  m_cphySapProvider.at(i)->RemoveUe(rnti);
3281  }
3282  if (m_s1SapProvider != nullptr)
3283  {
3285  }
3287  // need to do this after UeManager has been deleted
3288  if (srsCi != 0)
3289  {
3291  }
3292 
3293  m_rrcSapUser->RemoveUe(rnti); // Remove UE context at RRC protocol
3294 }
3295 
3296 TypeId
3298 {
3299  switch (m_epsBearerToRlcMapping)
3300  {
3301  case RLC_SM_ALWAYS:
3302  return LteRlcSm::GetTypeId();
3303 
3304  case RLC_UM_ALWAYS:
3305  return LteRlcUm::GetTypeId();
3306 
3307  case RLC_AM_ALWAYS:
3308  return LteRlcAm::GetTypeId();
3309 
3310  case PER_BASED:
3311  if (bearer.GetPacketErrorLossRate() > 1.0e-5)
3312  {
3313  return LteRlcUm::GetTypeId();
3314  }
3315  else
3316  {
3317  return LteRlcAm::GetTypeId();
3318  }
3319 
3320  default:
3321  return LteRlcSm::GetTypeId();
3322  }
3323 }
3324 
3325 void
3327 {
3328  NS_LOG_FUNCTION(this << cellId);
3329 
3330  if (m_anrSapProvider != nullptr)
3331  {
3333  }
3334 }
3335 
3336 void
3337 LteEnbRrc::SetCsgId(uint32_t csgId, bool csgIndication)
3338 {
3339  NS_LOG_FUNCTION(this << csgId << csgIndication);
3340  for (std::size_t componentCarrierId = 0; componentCarrierId < m_sib1.size();
3341  componentCarrierId++)
3342  {
3343  m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIdentity = csgId;
3344  m_sib1.at(componentCarrierId).cellAccessRelatedInfo.csgIndication = csgIndication;
3345  m_cphySapProvider.at(componentCarrierId)
3346  ->SetSystemInformationBlockType1(m_sib1.at(componentCarrierId));
3347  }
3348 }
3349 
3351 static const uint8_t SRS_ENTRIES = 9;
3356 static const uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
3362 static const uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
3368 static const uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
3369 
3370 void
3372 {
3373  NS_LOG_FUNCTION(this << p);
3374  for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3375  {
3376  if (g_srsPeriodicity[id] == p)
3377  {
3379  return;
3380  }
3381  }
3382  // no match found
3383  std::ostringstream allowedValues;
3384  for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
3385  {
3386  allowedValues << g_srsPeriodicity[id] << " ";
3387  }
3388  NS_FATAL_ERROR("illecit SRS periodicity value " << p
3389  << ". Allowed values: " << allowedValues.str());
3390 }
3391 
3392 uint32_t
3394 {
3395  NS_LOG_FUNCTION(this);
3399 }
3400 
3401 uint16_t
3403 {
3405  // SRS
3408  NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3409  << m_ueSrsConfigurationIndexSet.size());
3411  {
3412  NS_FATAL_ERROR("too many UEs ("
3413  << m_ueSrsConfigurationIndexSet.size() + 1
3414  << ") for current SRS periodicity "
3416  << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
3417  }
3418 
3419  if (m_ueSrsConfigurationIndexSet.empty())
3420  {
3421  // first entry
3424  }
3425  else
3426  {
3427  // find a CI from the available ones
3428  auto rit = m_ueSrsConfigurationIndexSet.rbegin();
3429  NS_ASSERT(rit != m_ueSrsConfigurationIndexSet.rend());
3430  NS_LOG_DEBUG(this << " lower bound " << (*rit) << " of "
3432  if ((*rit) < g_srsCiHigh[m_srsCurrentPeriodicityId])
3433  {
3434  // got it from the upper bound
3435  m_lastAllocatedConfigurationIndex = (*rit) + 1;
3437  }
3438  else
3439  {
3440  // look for released ones
3441  for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId];
3443  srcCi++)
3444  {
3445  auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3446  if (it == m_ueSrsConfigurationIndexSet.end())
3447  {
3449  m_ueSrsConfigurationIndexSet.insert(srcCi);
3450  break;
3451  }
3452  }
3453  }
3454  }
3456 }
3457 
3458 void
3460 {
3461  NS_LOG_FUNCTION(this << srcCi);
3462  auto it = m_ueSrsConfigurationIndexSet.find(srcCi);
3464  "request to remove unknown SRS CI " << srcCi);
3465  m_ueSrsConfigurationIndexSet.erase(it);
3466 }
3467 
3468 bool
3470 {
3473  NS_LOG_DEBUG(this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set "
3474  << m_ueSrsConfigurationIndexSet.size());
3476 }
3477 
3478 uint8_t
3480 {
3481  if (bearer.GetResourceType() > 0) // 1, 2 for GBR and DC-GBR
3482  {
3483  return 1;
3484  }
3485  else
3486  {
3487  return 2;
3488  }
3489 }
3490 
3491 uint8_t
3493 {
3494  return bearer.qci;
3495 }
3496 
3497 void
3499 {
3500  // NS_LOG_FUNCTION (this);
3501 
3502  for (auto& it : m_componentCarrierPhyConf)
3503  {
3504  uint8_t ccId = it.first;
3505 
3507  si.haveSib2 = true;
3508  si.sib2.freqInfo.ulCarrierFreq = it.second->GetUlEarfcn();
3509  si.sib2.freqInfo.ulBandwidth = it.second->GetUlBandwidth();
3511  m_cphySapProvider.at(ccId)->GetReferenceSignalPower();
3513 
3514  LteEnbCmacSapProvider::RachConfig rc = m_cmacSapProvider.at(ccId)->GetRachConfig();
3515  LteRrcSap::RachConfigCommon rachConfigCommon;
3516  rachConfigCommon.preambleInfo.numberOfRaPreambles = rc.numberOfRaPreambles;
3517  rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
3518  rachConfigCommon.raSupervisionInfo.raResponseWindowSize = rc.raResponseWindowSize;
3519  rachConfigCommon.txFailParam.connEstFailCount = rc.connEstFailCount;
3520  si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
3521 
3522  m_rrcSapUser->SendSystemInformation(it.second->GetCellId(), si);
3523  }
3524 
3525  /*
3526  * For simplicity, we use the same periodicity for all SIBs. Note that in real
3527  * systems the periodicy of each SIBs could be different.
3528  */
3530 }
3531 
3532 bool
3534 {
3535  NS_LOG_FUNCTION(this << (uint32_t)rnti);
3536  Ptr<UeManager> ueManager = GetUeManager(rnti);
3537  switch (ueManager->GetState())
3538  {
3541  return true;
3542  default:
3543  return false;
3544  }
3545 }
3546 
3547 } // namespace ns3
Callback template class.
Definition: callback.h:438
Class for forwarding CMAC SAP User functions.
Definition: lte-enb-rrc.cc:61
bool IsRandomAccessCompleted(uint16_t rnti) override
Is random access completed function.
Definition: lte-enb-rrc.cc:107
EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc *rrc, uint8_t componentCarrierId)
Constructor.
Definition: lte-enb-rrc.cc:81
void RrcConfigurationUpdateInd(UeConfig params) override
Notify the RRC of a UE config updated requested by the MAC (normally, by the scheduler)
Definition: lte-enb-rrc.cc:101
uint16_t AllocateTemporaryCellRnti() override
request the allocation of a Temporary C-RNTI
Definition: lte-enb-rrc.cc:89
uint8_t m_componentCarrierId
Component carrier ID.
Definition: lte-enb-rrc.cc:78
void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success) override
notify the result of the last LC config operation
Definition: lte-enb-rrc.cc:95
Hold variables of type enum.
Definition: enum.h:62
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
virtual void UeContextRelease(uint16_t rnti)=0
Release UE context at the S1 Application of the source eNB after reception of the UE CONTEXT RELEASE ...
virtual void DoSendReleaseIndication(uint64_t imsi, uint16_t rnti, uint8_t bearerId)=0
Triggers epc-enb-application to send ERAB Release Indication message towards MME.
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
@ HandoverDesirableForRadioReason
Definition: epc-x2-sap.h:220
These service primitives of this part of the X2 SAP are provided by the X2 entity and issued by RRC e...
Definition: epc-x2-sap.h:359
virtual void SendHandoverRequestAck(HandoverRequestAckParams params)=0
Send handover request ack function.
virtual void SendHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
Send handover preparation failure function.
virtual void SendHandoverCancel(HandoverCancelParams params)=0
Send handover Cancel to the target eNB.
virtual void SendLoadInformation(LoadInformationParams params)=0
Send load information function.
These service primitives of this part of the X2 SAP are provided by the RRC entity and issued by the ...
Definition: epc-x2-sap.h:427
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
uint8_t GetResourceType() const
Definition: eps-bearer.cc:126
uint16_t GetPacketDelayBudgetMs() const
Definition: eps-bearer.cc:138
double GetPacketErrorLossRate() const
Definition: eps-bearer.cc:144
Qci qci
Qos class indicator.
Definition: eps-bearer.h:151
GbrQosInformation gbrQosInfo
GBR QOS information.
Definition: eps-bearer.h:153
@ GBR_CONV_VOICE
GBR Conversational Voice.
Definition: eps-bearer.h:107
Tag used to define the RNTI and EPS bearer ID for packets interchanged between the EpcEnbApplication ...
uint8_t GetBid() const
Get Bearer Id function.
uint16_t GetRnti() const
Get RNTI function.
void SetRnti(uint16_t rnti)
Set the RNTI to the given value.
void SetBid(uint8_t bid)
Set the bearer id to the given value.
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
Hold a signed integer type.
Definition: integer.h:45
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
Service Access Point (SAP) offered by the ANR instance to the eNodeB RRC instance.
Definition: lte-anr-sap.h:37
virtual void AddNeighbourRelation(uint16_t cellId)=0
Add a new Neighbour Relation entry.
virtual bool GetNoX2(uint16_t cellId) const =0
Get the value of No X2 field of a neighbouring cell from the Neighbour Relation Table (NRT).
virtual bool GetNoHo(uint16_t cellId) const =0
Get the value of No HO field of a neighbouring cell from the Neighbour Relation Table (NRT).
Service Access Point (SAP) offered by the eNodeB RRC instance to the ANR instance.
Definition: lte-anr-sap.h:95
Service Access Point (SAP) offered by the Component Carrier Manager (CCM) instance to the eNodeB RRC ...
virtual void AddUe(uint16_t rnti, uint8_t state)=0
Add a new UE in the LteEnbComponentCarrierManager.
virtual void RemoveUe(uint16_t rnti)=0
Remove an existing UE.
Service Access Point (SAP) offered by the eNodeB RRC instance to the component carrier manager (CCM) ...
Service Access Point (SAP) offered by the eNB MAC to the eNB RRC See Femto Forum MAC Scheduler Interf...
Service Access Point (SAP) offered by the MAC to the RRC See Femto Forum MAC Scheduler Interface Spec...
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
Service Access Point (SAP) offered by the UE PHY to the UE RRC for control purposes.
The LTE Radio Resource Control entity at the eNB.
Definition: lte-enb-rrc.h:656
~LteEnbRrc() override
Destructor.
LteEnbRrcSapProvider * GetLteEnbRrcSapProvider()
void SetCsgId(uint32_t csgId, bool csgIndication)
Associate this RRC entity with a particular CSG information.
void RemoveUe(uint16_t rnti)
remove a UE from the cell
void DoSetPdschConfigDedicated(uint16_t rnti, LteRrcSap::PdschConfigDedicated pa)
Set PDSCH config dedicated function.
std::map< uint8_t, Ptr< ComponentCarrierBaseStation > > m_componentCarrierPhyConf
component carrier phy configuration
Definition: lte-enb-rrc.h:1787
void SetSrsPeriodicity(uint32_t p)
bool IsRandomAccessCompleted(uint16_t rnti)
Is random access completed function.
uint8_t GetLogicalChannelGroup(EpsBearer bearer)
int8_t m_qRxLevMin
The QRxLevMin attribute.
Definition: lte-enb-rrc.h:1655
std::set< uint16_t > m_ueSrsConfigurationIndexSet
UE SRS configuration index set.
Definition: lte-enb-rrc.h:1646
TracedCallback< uint64_t, uint16_t, uint16_t, uint16_t > m_handoverStartTrace
The HandoverStart trace source.
Definition: lte-enb-rrc.h:1732
void DoSetNumberOfComponentCarriers(uint16_t numberOfComponentCarriers)
Set number of component carriers.
void DoSendReleaseDataRadioBearer(uint64_t imsi, uint16_t rnti, uint8_t bearerId)
This function acts as an interface to trigger Release indication messages towards eNB and EPC.
Definition: lte-enb-rrc.cc:592
void SendSystemInformation()
method used to periodically send System Information
void DoRecvRrcConnectionRequest(uint16_t rnti, LteRrcSap::RrcConnectionRequest msg)
Part of the RRC protocol.
std::set< uint8_t > m_ffrMeasIds
List of measurement identities which are intended for FFR purpose.
Definition: lte-enb-rrc.h:1613
friend class MemberEpcEnbS1SapUser< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:668
Callback< void, Ptr< Packet > > m_forwardUpCallback
forward up callback function
Definition: lte-enb-rrc.h:1531
void DoRecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
Receive SN status transfer function.
void DoRecvHandoverRequest(EpcX2SapUser::HandoverRequestParams params)
Receive handover request function.
LteEnbRrc()
create an RRC instance for use within an eNB
std::set< uint8_t > m_anrMeasIds
List of measurement identities which are intended for ANR purpose.
Definition: lte-enb-rrc.h:1611
uint8_t DoAddUeMeasReportConfigForFfr(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for FFR function.
LteMacSapProvider * m_macSapProvider
Interface to the eNodeB MAC instance, to be used by RLC instances.
Definition: lte-enb-rrc.h:1569
uint32_t GetSrsPeriodicity() const
bool SendData(Ptr< Packet > p)
Enqueue an IP data packet on the proper bearer for downlink transmission.
void ConfigureCell(std::map< uint8_t, Ptr< ComponentCarrierBaseStation >> ccPhyConf)
Configure cell-specific parameters.
EpcEnbS1SapUser * GetS1SapUser()
void AddX2Neighbour(uint16_t cellId)
Add a neighbour with an X2 interface.
LteCcmRrcSapUser * m_ccmRrcSapUser
Receive API calls from the LteEnbComponentCarrierManager instance.
Definition: lte-enb-rrc.h:1549
Time m_connectionRequestTimeoutDuration
The ConnectionRequestTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1684
void HandoverLeavingTimeout(uint16_t rnti)
Method triggered when a UE is expected to leave a cell for a handover but no feedback is received in ...
void SetForwardUpCallback(Callback< void, Ptr< Packet >> cb)
set the callback used to forward data packets up the stack
LteHandoverManagementSapUser * m_handoverManagementSapUser
Receive API calls from the handover algorithm instance.
Definition: lte-enb-rrc.h:1544
static TypeId GetTypeId()
Get the type ID.
void DoRecvMeasurementReport(uint16_t rnti, LteRrcSap::MeasurementReport msg)
Part of the RRC protocol.
void SetLteAnrSapProvider(LteAnrSapProvider *s)
set the ANR SAP this RRC should interact with
void DoRecvHandoverRequestAck(EpcX2SapUser::HandoverRequestAckParams params)
Receive handover request acknowledge function.
LteEnbCphySapUser * GetLteEnbCphySapUser()
bool HasUeManager(uint16_t rnti) const
uint8_t m_rsrqFilterCoefficient
The RsrqFilterCoefficient attribute.
Definition: lte-enb-rrc.h:1677
std::vector< uint8_t > DoAddUeMeasReportConfigForHandover(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for handover function.
void DoRecvResourceStatusUpdate(EpcX2SapUser::ResourceStatusUpdateParams params)
Receive resource status update function.
uint16_t AddUe(UeManager::State state, uint8_t componentCarrierId)
Allocate a new RNTI for a new UE.
void DoSendLoadInformation(EpcX2Sap::LoadInformationParams params)
Send load information function.
uint8_t GetLogicalChannelPriority(EpsBearer bearer)
void DoCompleteSetupUe(uint16_t rnti, LteEnbRrcSapProvider::CompleteSetupUeParameters params)
Part of the RRC protocol.
uint16_t GetNewSrsConfigurationIndex()
Allocate a new SRS configuration index for a new UE.
uint8_t m_defaultTransmissionMode
The DefaultTransmissionMode attribute.
Definition: lte-enb-rrc.h:1631
Time m_connectionRejectedTimeoutDuration
The ConnectionRejectedTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1696
Time m_connectionSetupTimeoutDuration
The ConnectionSetupTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1691
std::set< uint8_t > m_handoverMeasIds
List of measurement identities which are intended for handover purpose.
Definition: lte-enb-rrc.h:1609
void DoPathSwitchRequestAcknowledge(EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters params)
Path switch request acknowledge function.
std::vector< uint8_t > AddUeMeasReportConfig(LteRrcSap::ReportConfigEutra config)
Add a new UE measurement reporting configuration.
bool m_admitHandoverRequest
The AdmitHandoverRequest attribute.
Definition: lte-enb-rrc.h:1660
uint16_t m_ulBandwidth
Uplink transmission bandwidth configuration in number of Resource Blocks.
Definition: lte-enb-rrc.h:1590
LteAnrSapUser * m_anrSapUser
Receive API calls from the ANR instance.
Definition: lte-enb-rrc.h:1554
LteHandoverManagementSapProvider * m_handoverManagementSapProvider
Interface to the handover algorithm instance.
Definition: lte-enb-rrc.h:1546
friend class EpcX2SpecificEpcX2SapUser< LteEnbRrc >
allow MemberEpcEnbS1SapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:670
uint8_t DoAddUeMeasReportConfigForComponentCarrier(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for component carrier function.
std::vector< LteFfrRrcSapProvider * > m_ffrRrcSapProvider
Interface to the FFR algorithm instance.
Definition: lte-enb-rrc.h:1561
uint8_t DoAddUeMeasReportConfigForAnr(LteRrcSap::ReportConfigEutra reportConfig)
Add UE measure report config for ANR function.
LteEnbRrcSapUser * m_rrcSapUser
Interface to send messages to UE over the RRC protocol.
Definition: lte-enb-rrc.h:1564
std::map< uint16_t, Ptr< UeManager > > m_ueMap
The UeMap attribute.
Definition: lte-enb-rrc.h:1600
void HandoverJoiningTimeout(uint16_t rnti)
Method triggered when a UE is expected to join the cell for a handover but does not do so in a reason...
LteEpsBearerToRlcMapping_t m_epsBearerToRlcMapping
The EpsBearerToRlcMapping attribute.
Definition: lte-enb-rrc.h:1636
Ptr< UeManager > GetUeManager(uint16_t rnti)
LteCcmRrcSapProvider * m_ccmRrcSapProvider
Interface to the LteEnbComponentCarrierManager instance.
Definition: lte-enb-rrc.h:1551
void DoRecvRrcConnectionReestablishmentComplete(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentComplete msg)
Part of the RRC protocol.
void DoRrcConfigurationUpdateInd(LteEnbCmacSapUser::UeConfig params)
RRC configuration update indication function.
TracedCallback< uint64_t, uint16_t, uint16_t, LteRrcSap::MeasurementReport > m_recvMeasurementReportTrace
The RecvMeasurementReport trace source.
Definition: lte-enb-rrc.h:1743
LteAnrSapProvider * m_anrSapProvider
Interface to the ANR instance.
Definition: lte-enb-rrc.h:1556
std::set< uint8_t > m_componentCarrierMeasIds
List of measurement identities which are intended for component carrier management purposes.
Definition: lte-enb-rrc.h:1615
std::vector< LteEnbCphySapProvider * > m_cphySapProvider
Interface to the eNodeB PHY instances.
Definition: lte-enb-rrc.h:1579
void SetLteMacSapProvider(LteMacSapProvider *s)
set the MAC SAP provider.
uint16_t m_lastAllocatedConfigurationIndex
last allocated configuration index
Definition: lte-enb-rrc.h:1647
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureMaxRachTrace
The 'HandoverFailureMaxRach' Trace source.
Definition: lte-enb-rrc.h:1768
friend class MemberLteCcmRrcSapUser< LteEnbRrc >
allow MemberLteCcmRrcSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:674
LteRrcSap::MeasConfig m_ueMeasConfig
List of measurement configuration which are active in every UE attached to this eNodeB instance.
Definition: lte-enb-rrc.h:1606
void ConfigureCarriers(std::map< uint8_t, Ptr< ComponentCarrierBaseStation >> ccPhyConf)
Configure carriers.
friend class MemberLteEnbRrcSapProvider< LteEnbRrc >
allow MemberLteEnbRrcSapProvider<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:666
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureNoPreambleTrace
The 'HandoverFailureNoPreamble' Trace source.
Definition: lte-enb-rrc.h:1762
TracedCallback< uint16_t, uint16_t > m_newUeContextTrace
The NewUeContext trace source.
Definition: lte-enb-rrc.h:1717
Time m_systemInformationPeriodicity
The SystemInformationPeriodicity attribute.
Definition: lte-enb-rrc.h:1641
void DoRecvRrcConnectionReconfigurationCompleted(uint16_t rnti, LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Part of the RRC protocol.
void SetLteEnbRrcSapUser(LteEnbRrcSapUser *s)
set the RRC SAP this RRC should interact with
friend class MemberLteAnrSapUser< LteEnbRrc >
allow MemberLteAnrSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:662
void DoRecvHandoverPreparationFailure(EpcX2SapUser::HandoverPreparationFailureParams params)
Receive handover preparation failure function.
LteHandoverManagementSapUser * GetLteHandoverManagementSapUser()
Get the Handover Management SAP offered by this RRC.
EpcX2SapUser * GetEpcX2SapUser()
Get the X2 SAP offered by this RRC.
std::vector< LteEnbCmacSapUser * > m_cmacSapUser
Receive API calls from the eNodeB MAC instance.
Definition: lte-enb-rrc.h:1539
void DoInitialContextSetupRequest(EpcEnbS1SapUser::InitialContextSetupRequestParameters params)
Initial context setup request function.
uint32_t m_dlEarfcn
Downlink E-UTRA Absolute Radio Frequency Channel Number.
Definition: lte-enb-rrc.h:1584
void SendHandoverRequest(uint16_t rnti, uint16_t cellId)
Send a HandoverRequest through the X2 SAP interface.
uint16_t m_numberOfComponentCarriers
number of component carriers
Definition: lte-enb-rrc.h:1782
void DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
Notify LC config result function.
TypeId GetRlcType(EpsBearer bearer)
uint8_t m_rsrpFilterCoefficient
The RsrpFilterCoefficient attribute.
Definition: lte-enb-rrc.h:1671
EpcEnbS1SapProvider * m_s1SapProvider
Interface to send messages to core network over the S1 protocol.
Definition: lte-enb-rrc.h:1572
uint16_t m_lastAllocatedRnti
Last allocated RNTI.
Definition: lte-enb-rrc.h:1592
uint32_t m_ulEarfcn
Uplink E-UTRA Absolute Radio Frequency Channel Number.
Definition: lte-enb-rrc.h:1586
uint16_t ComponentCarrierToCellId(uint8_t componentCarrierId)
convert the component carrier id to cell id
LteFfrRrcSapUser * GetLteFfrRrcSapUser()
Get the FFR SAP offered by this RRC.
void SetS1SapProvider(EpcEnbS1SapProvider *s)
Set the S1 SAP Provider.
bool HasCellId(uint16_t cellId) const
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionReconfigurationTrace
The ConnectionReconfiguration trace source.
Definition: lte-enb-rrc.h:1727
EpcX2SapUser * m_x2SapUser
Interface to receive messages from neighbour eNodeB over the X2 interface.
Definition: lte-enb-rrc.h:1534
bool m_admitRrcConnectionRequest
The AdmitRrcConnectionRequest attribute.
Definition: lte-enb-rrc.h:1665
void DoRecvUeData(EpcX2SapUser::UeDataParams params)
Receive UE data function.
uint16_t m_srsCurrentPeriodicityId
The SrsPeriodicity attribute.
Definition: lte-enb-rrc.h:1645
void DoRecvRrcConnectionReestablishmentRequest(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentRequest msg)
Part of the RRC protocol.
bool m_configured
True if ConfigureCell() has been completed.
Definition: lte-enb-rrc.h:1582
void ConnectionSetupTimeout(uint16_t rnti)
Method triggered when a UE is expected to complete a connection setup procedure but does not do so in...
friend class EnbRrcMemberLteEnbCmacSapUser
allow EnbRrcMemberLteEnbCmacSapUser class friend access
Definition: lte-enb-rrc.h:658
friend class MemberLteHandoverManagementSapUser< LteEnbRrc >
allow MemberLteHandoverManagementSapUser<LteEnbRrc> class friend access
Definition: lte-enb-rrc.h:660
LteEnbCmacSapUser * GetLteEnbCmacSapUser()
Get the CMAC SAP offered by this RRC.
void DoRecvRrcConnectionSetupCompleted(uint16_t rnti, LteRrcSap::RrcConnectionSetupCompleted msg)
Part of the RRC protocol.
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionReleaseTrace
The NotifyConnectionRelease trace source.
Definition: lte-enb-rrc.h:1749
void ConnectionRejectedTimeout(uint16_t rnti)
Method triggered a while after sending RRC Connection Rejected.
void DoRecvUeContextRelease(EpcX2SapUser::UeContextReleaseParams params)
Receive UE context release function.
Time m_handoverLeavingTimeoutDuration
The HandoverLeavingTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1711
std::map< uint32_t, X2uTeidInfo > m_x2uTeidInfoMap
TEID, RNTI, DRBID.
Definition: lte-enb-rrc.h:1625
void DoRecvLoadInformation(EpcX2SapUser::LoadInformationParams params)
Receive load information function.
void ConnectionRequestTimeout(uint16_t rnti)
Method triggered when a UE is expected to request for connection but does not do so in a reasonable t...
uint16_t DoAllocateTemporaryCellRnti(uint8_t componentCarrierId)
Allocate temporary cell RNTI function.
std::vector< LteEnbCphySapUser * > m_cphySapUser
Receive API calls from the eNodeB PHY instances.
Definition: lte-enb-rrc.h:1577
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureJoiningTrace
The 'HandoverFailureJoining' Trace source.
Definition: lte-enb-rrc.h:1780
void SetLteHandoverManagementSapProvider(LteHandoverManagementSapProvider *s)
set the Handover Management SAP this RRC should interact with
void SetLteFfrRrcSapProvider(LteFfrRrcSapProvider *s)
set the FFR SAP this RRC should interact with
LteCcmRrcSapUser * GetLteCcmRrcSapUser()
Get the Component Carrier Management SAP offered by this RRC.
void SetLteEnbCphySapProvider(LteEnbCphySapProvider *s)
set the CPHY SAP this RRC should use to interact with the PHY
void DoDispose() override
Destructor implementation.
std::vector< LteFfrRrcSapUser * > m_ffrRrcSapUser
Receive API calls from the FFR algorithm instance.
Definition: lte-enb-rrc.h:1559
bool IsMaxSrsReached()
EpcX2SapProvider * m_x2SapProvider
Interface to send messages to neighbour eNodeB over the X2 interface.
Definition: lte-enb-rrc.h:1536
std::vector< LteEnbCmacSapProvider * > m_cmacSapProvider
Interface to the eNodeB MAC instance.
Definition: lte-enb-rrc.h:1541
std::vector< LteRrcSap::SystemInformationBlockType1 > m_sib1
The System Information Block Type 1 that is currently broadcasted over BCH.
Definition: lte-enb-rrc.h:1595
void DoDataRadioBearerSetupRequest(EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params)
Data radio beaerer setup request function.
LteAnrSapUser * GetLteAnrSapUser()
Get the ANR SAP offered by this RRC.
void SetLteCcmRrcSapProvider(LteCcmRrcSapProvider *s)
set the Component Carrier Management SAP this RRC should interact with
LteEnbRrcSapProvider * m_rrcSapProvider
Interface to receive messages from UE over the RRC protocol.
Definition: lte-enb-rrc.h:1566
bool m_carriersConfigured
are carriers configured
Definition: lte-enb-rrc.h:1784
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionEstablishedTrace
The ConnectionEstablished trace source.
Definition: lte-enb-rrc.h:1722
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverFailureLeavingTrace
The 'HandoverFailureLeaving' Trace source.
Definition: lte-enb-rrc.h:1774
TracedCallback< uint64_t, uint16_t, uint16_t, std::string > m_rrcTimeoutTrace
The 'TimerExpiry' Trace source.
Definition: lte-enb-rrc.h:1755
void DoTriggerHandover(uint16_t rnti, uint16_t targetCellId)
Trigger handover function.
void DoRecvIdealUeContextRemoveRequest(uint16_t rnti)
Part of the RRC protocol.
void SetCellId(uint16_t m_cellId)
set the cell id of this eNB
EpcEnbS1SapUser * m_s1SapUser
Interface to receive messages from core network over the S1 protocol.
Definition: lte-enb-rrc.h:1574
void RemoveSrsConfigurationIndex(uint16_t srcCi)
remove a previously allocated SRS configuration index
Time m_handoverJoiningTimeoutDuration
The HandoverJoiningTimeoutDuration attribute.
Definition: lte-enb-rrc.h:1705
void SetLteEnbCmacSapProvider(LteEnbCmacSapProvider *s)
set the CMAC SAP this RRC should interact with
uint16_t m_dlBandwidth
Downlink transmission bandwidth configuration in number of Resource Blocks.
Definition: lte-enb-rrc.h:1588
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverEndOkTrace
The HandoverEndOk trace source.
Definition: lte-enb-rrc.h:1737
uint8_t CellToComponentCarrierId(uint16_t cellId)
convert the cell id to component carrier id
void SetEpcX2SapProvider(EpcX2SapProvider *s)
Set the X2 SAP this RRC should interact with.
void DoRecvHandoverCancel(EpcX2SapUser::HandoverCancelParams params)
Receive Handover Cancel function.
Part of the RRC protocol.
Definition: lte-rrc-sap.h:1244
Part of the RRC protocol.
Definition: lte-rrc-sap.h:1124
virtual Ptr< Packet > EncodeHandoverCommand(RrcConnectionReconfiguration msg)=0
Encode handover command.
virtual void SendSystemInformation(uint16_t cellId, SystemInformation msg)=0
Send a SystemInformation message to all attached UEs during a system information acquisition procedur...
virtual void RemoveUe(uint16_t rnti)=0
Remove UE function.
Service Access Point (SAP) offered by the Frequency Reuse algorithm instance to the eNodeB RRC instan...
Service Access Point (SAP) offered by the eNodeB RRC instance to the Frequency Reuse algorithm instan...
Service Access Point (SAP) offered by the handover algorithm instance to the eNodeB RRC instance.
Service Access Point (SAP) offered by the eNodeB RRC instance to the handover algorithm instance.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:96
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
Definition: lte-pdcp-sap.h:36
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
Send RRC PDU parameters to the PDCP for transmission.
LTE RLC Acknowledged Mode (AM), see 3GPP TS 36.322.
Definition: lte-rlc-am.h:38
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc-am.cc:87
This abstract base class defines the API to interact with the Radio Link Control (LTE_RLC) in LTE,...
Definition: lte-rlc.h:49
void SetPacketDelayBudgetMs(uint16_t packetDelayBudget)
Definition: lte-rlc.cc:148
void SetLteRlcSapUser(LteRlcSapUser *s)
Definition: lte-rlc.cc:155
void SetRnti(uint16_t rnti)
Definition: lte-rlc.cc:134
void SetLteMacSapProvider(LteMacSapProvider *s)
Definition: lte-rlc.cc:169
LteMacSapUser * GetLteMacSapUser()
Definition: lte-rlc.cc:176
void SetLcId(uint8_t lcId)
Definition: lte-rlc.cc:141
LteRlcSapProvider * GetLteRlcSapProvider()
Definition: lte-rlc.cc:162
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc.cc:197
static TypeId GetTypeId()
Get the type ID.
Definition: lte-rlc-um.cc:56
static double ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)
Convert PDSCH config dedicated function.
Definition: lte-rrc-sap.h:189
Template for the implementation of the LteEnbCphySapUser as a member of an owner class of type C to w...
Template for the implementation of the LteFfrRrcSapUser as a member of an owner class of type C to wh...
Instantiate subclasses of ns3::Object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
A base class which provides memory management and object aggregation.
Definition: object.h:89
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
virtual void DoInitialize()
Initialize() implementation.
Definition: object.cc:359
bool RemovePacketTag(Tag &tag)
Remove a packet tag.
Definition: packet.cc:967
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:861
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
@ ATTR_GET
The attribute can be read.
Definition: type-id.h:64
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
Definition: type-id.h:66
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
bool m_pendingStartDataRadioBearers
Pending start data radio bearers.
Definition: lte-enb-rrc.h:635
void RecvRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentRequest interface.
void InitialContextSetupRequest()
Process Initial context setup request message from the MME.
Definition: lte-enb-rrc.cc:385
void RecvUeContextRelease(EpcX2SapUser::UeContextReleaseParams params)
Take the necessary actions in response to the reception of an X2 UE CONTEXT RELEASE message.
void RecordDataRadioBearersToBeStarted()
Start all configured data radio bearers.
Definition: lte-enb-rrc.cc:522
std::map< uint8_t, Ptr< LteDataRadioBearerInfo > > m_drbMap
The DataRadioBearerMap attribute.
Definition: lte-enb-rrc.h:539
Ptr< LteSignalingRadioBearerInfo > m_srb1
The Srb1 attribute.
Definition: lte-enb-rrc.h:548
void PrepareHandover(uint16_t cellId)
Start the handover preparation and send the handover request.
Definition: lte-enb-rrc.cc:660
void SetImsi(uint64_t imsi)
Set the IMSI.
Definition: lte-enb-rrc.cc:379
void SendData(uint8_t bid, Ptr< Packet > p)
Send a data packet over the appropriate Data Radio Bearer.
Definition: lte-enb-rrc.cc:949
void SendRrcConnectionRelease()
This function acts as an interface to trigger the connection release towards eNB, EPC and UE.
EpcX2Sap::HandoverCancelParams BuildHoCancelMsg()
build handover cancel message
void CompleteSetupUe(LteEnbRrcSapProvider::CompleteSetupUeParameters params)
Implement the LteEnbRrcSapProvider::CompleteSetupUe interface.
bool m_needPhyMacConfiguration
need Phy MAC configuration
Definition: lte-enb-rrc.h:595
State
The state of the UeManager at the eNB RRC.
Definition: lte-enb-rrc.h:78
@ CONNECTION_REESTABLISHMENT
Definition: lte-enb-rrc.h:85
@ CONNECTION_RECONFIGURATION
Definition: lte-enb-rrc.h:84
LteRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo()
Definition: lte-enb-rrc.cc:870
void CmacUeConfigUpdateInd(LteEnbCmacSapUser::UeConfig cmacParams)
CMAC UE config update indication function.
void RecvHandoverCancel(EpcX2SapUser::HandoverCancelParams params)
Take the necessary actions in response to the reception of an X2 UE CONTEXT RELEASE message.
void DoDispose() override
Destructor implementation.
Definition: lte-enb-rrc.cc:321
LteRrcSap::RrcConnectionReconfiguration BuildRrcConnectionReconfiguration()
EventId m_handoverJoiningTimeout
Time limit before a handover joining timeout occurs.
Definition: lte-enb-rrc.h:622
uint8_t AddDataRadioBearerInfo(Ptr< LteDataRadioBearerInfo > radioBearerInfo)
Add a new LteDataRadioBearerInfo structure to the UeManager.
uint16_t GetSrsConfigurationIndex() const
uint8_t Lcid2Bid(uint8_t lcid)
uint16_t m_rnti
The C-RNTI attribute.
Definition: lte-enb-rrc.h:553
void RecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
Take the necessary actions in response to the reception of an X2 SN STATUS TRANSFER message.
~UeManager() override
Definition: lte-enb-rrc.cc:316
uint8_t Bid2Lcid(uint8_t bid)
LteRrcSap::PhysicalConfigDedicated m_physicalConfigDedicated
physical config dedicated
Definition: lte-enb-rrc.h:566
void RecvRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionSetupCompleted interface.
std::list< uint8_t > m_drbsToBeStarted
DRBS to be started.
Definition: lte-enb-rrc.h:594
uint8_t m_lastAllocatedDrbid
last allocated Data Radio Bearer ID
Definition: lte-enb-rrc.h:533
uint8_t GetComponentCarrierId() const
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
EventId m_connectionRejectedTimeout
The delay before a connection rejected timeout occurs.
Definition: lte-enb-rrc.h:615
void RemoveDataRadioBearerInfo(uint8_t drbid)
remove the LteDataRadioBearerInfo corresponding to a bearer being released
void SetupDataRadioBearer(EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress)
Setup a new data radio bearer, including both the configuration within the eNB and the necessary RRC ...
Definition: lte-enb-rrc.cc:400
void RecvRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReconfigurationCompleted interface.
TracedCallback< uint64_t, uint16_t, uint16_t, uint8_t > m_drbCreatedTrace
The DrbCreated trace source.
Definition: lte-enb-rrc.h:588
State GetState() const
uint16_t m_targetX2apId
target X2 ap ID
Definition: lte-enb-rrc.h:591
uint8_t Drbid2Bid(uint8_t drbid)
static TypeId GetTypeId()
Get the type ID.
Definition: lte-enb-rrc.cc:332
Ptr< LteSignalingRadioBearerInfo > m_srb0
The Srb0 attribute.
Definition: lte-enb-rrc.h:544
uint64_t GetImsi() const
EventId m_connectionRequestTimeout
Time limit before a connection request timeout occurs.
Definition: lte-enb-rrc.h:603
uint64_t m_imsi
International Mobile Subscriber Identity assigned to this UE.
Definition: lte-enb-rrc.h:558
uint8_t GetNewRrcTransactionIdentifier()
bool m_caSupportConfigured
Define if the Carrier Aggregation was already configure for the current UE on not.
Definition: lte-enb-rrc.h:632
uint16_t m_targetCellId
target cell ID
Definition: lte-enb-rrc.h:593
void SetSrsConfigurationIndex(uint16_t srsConfIndex)
Set the SRS configuration index and do the necessary reconfiguration.
uint16_t GetRnti() const
Ptr< LteDataRadioBearerInfo > GetDataRadioBearerInfo(uint8_t drbid)
void SendPacket(uint8_t bid, Ptr< Packet > p)
Send a data packet over the appropriate Data Radio Bearer.
Definition: lte-enb-rrc.cc:926
void SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
Set the identifiers of the source eNB for the case where a UE joins the current eNB as part of a hand...
Definition: lte-enb-rrc.cc:372
LteRrcSap::NonCriticalExtensionConfiguration BuildNonCriticalExtensionConfigurationCa()
std::list< std::pair< uint8_t, Ptr< Packet > > > m_packetBuffer
Packet buffer for when UE is doing the handover.
Definition: lte-enb-rrc.h:646
friend class LtePdcpSpecificLtePdcpSapUser< UeManager >
allow LtePdcpSpecificLtePdcpSapUser<UeManager> class friend access
Definition: lte-enb-rrc.h:70
uint8_t m_lastRrcTransactionIdentifier
last RRC transaction identifier
Definition: lte-enb-rrc.h:564
uint8_t m_componentCarrierId
ID of the primary CC for this UE.
Definition: lte-enb-rrc.h:562
State m_state
The current UeManager state.
Definition: lte-enb-rrc.h:570
void RecvMeasurementReport(LteRrcSap::MeasurementReport msg)
Implement the LteEnbRrcSapProvider::RecvMeasurementReport interface.
void DoInitialize() override
Initialize() implementation.
Definition: lte-enb-rrc.cc:167
Ptr< LteEnbRrc > m_rrc
Pointer to the parent eNodeB RRC.
Definition: lte-enb-rrc.h:568
TracedCallback< uint64_t, uint16_t, uint16_t, State, State > m_stateTransitionTrace
The StateTransition trace source.
Definition: lte-enb-rrc.h:581
bool m_pendingRrcConnectionReconfiguration
pending RRC connection reconfiguration
Definition: lte-enb-rrc.h:574
void ReleaseDataRadioBearer(uint8_t drbid)
Release a given radio bearer.
Definition: lte-enb-rrc.cc:549
void RecvRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentComplete interface.
uint8_t Bid2Drbid(uint8_t bid)
LteRrcSap::RrcConnectionReconfiguration GetRrcConnectionReconfigurationForHandover(uint8_t componentCarrierId)
Definition: lte-enb-rrc.cc:877
void StartDataRadioBearers()
Start the data radio bearers that have been previously recorded to be started using RecordDataRadioBe...
Definition: lte-enb-rrc.cc:532
void SendUeContextRelease()
send the UE CONTEXT RELEASE X2 message to the source eNB, thus successfully terminating an X2 handove...
void RecvHandoverRequestAck(EpcX2SapUser::HandoverRequestAckParams params)
take the necessary actions in response to the reception of an X2 HANDOVER REQUEST ACK message
Definition: lte-enb-rrc.cc:800
LteRrcSap::RadioResourceConfigDedicated BuildRadioResourceConfigDedicated()
void CancelPendingEvents()
Cancel all timers which are running for the UE.
uint8_t Lcid2Drbid(uint8_t lcid)
void ScheduleRrcConnectionReconfiguration()
schedule an RRC Connection Reconfiguration procedure with the UE
Definition: lte-enb-rrc.cc:627
uint16_t m_sourceCellId
source cell ID
Definition: lte-enb-rrc.h:592
void RecvHandoverPreparationFailure(uint16_t cellId)
Take the necessary actions in response to the reception of an X2 HO preparation failure message.
EpcX2Sap::HandoverPreparationFailureParams BuildHoPrepFailMsg()
build handover preparation failure message
EventId m_handoverLeavingTimeout
Time limit before a handover leaving timeout occurs.
Definition: lte-enb-rrc.h:629
uint16_t m_sourceX2apId
source X2 ap ID
Definition: lte-enb-rrc.h:590
std::vector< EpcX2Sap::ErabToBeSetupItem > GetErabList()
Definition: lte-enb-rrc.cc:995
void RecvRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
Implement the LteEnbRrcSapProvider::RecvRrcConnectionRequest interface.
uint8_t Drbid2Lcid(uint8_t drbid)
LtePdcpSapUser * m_drbPdcpSapUser
DRB PDCP SAP user.
Definition: lte-enb-rrc.h:572
void SwitchToState(State s)
Switch the UeManager to the given state.
void SetPdschConfigDedicated(LteRrcSap::PdschConfigDedicated pdschConfigDedicated)
Configure PdschConfigDedicated (i.e.
EventId m_connectionSetupTimeout
Time limit before a connection setup timeout occurs.
Definition: lte-enb-rrc.h:609
void RecvIdealUeContextRemoveRequest(uint16_t rnti)
Implement the LteEnbRrcSapProvider::RecvIdealUeContextRemoveRequest interface.
Definition: lte-enb-rrc.cc:608
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:76
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeBooleanChecker()
Definition: boolean.cc:124
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1414
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:227
static const std::string & ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:48
Ptr< const AttributeAccessor > MakeIntegerAccessor(T1 a1)
Definition: integer.h:46
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Definition: object-map.h:40
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition: enum.h:194
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
constexpr uint32_t MIN_NO_CC
Minimum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:36
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Definition: boolean.h:86
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:39
static const std::string g_ueManagerStateName[UeManager::NUM_STATES]
Map each of UE Manager states to its string representation.
Definition: lte-enb-rrc.cc:117
static const uint16_t g_srsCiLow[SRS_ENTRIES]
The lower bound (inclusive) of the SRS configuration indices (ISRS) which use the corresponding SRS p...
static const uint16_t g_srsCiHigh[SRS_ENTRIES]
The upper bound (inclusive) of the SRS configuration indices (ISRS) which use the corresponding SRS p...
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Definition: uinteger.h:46
static const uint8_t SRS_ENTRIES
Number of distinct SRS periodicity plus one.
static const uint16_t g_srsPeriodicity[SRS_ENTRIES]
Sounding Reference Symbol (SRS) periodicity (TSRS) in milliseconds.
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-map.h:76
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
PathSwitchRequestParameters structure.
Parameters passed to DataRadioBearerSetupRequest ()
EpsBearer bearer
the characteristics of the bearer to be setup
uint16_t rnti
the RNTI identifying the UE for which the DataRadioBearer is to be created
uint32_t gtpTeid
S1-bearer GTP tunnel endpoint identifier, see 36.423 9.2.1.
Ipv4Address transportLayerAddress
IP Address of the SGW, see 36.423 9.2.1.
Parameters passed to InitialContextSetupRequest ()
PathSwitchRequestAcknowledgeParameters structure.
E-RABs admitted item as it is used in the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:76
uint16_t erabId
E-RAB ID.
Definition: epc-x2-sap.h:77
E-RABs to be setup item as it is used in the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:60
bool dlForwarding
DL forwarding.
Definition: epc-x2-sap.h:63
Ipv4Address transportLayerAddress
transport layer address
Definition: epc-x2-sap.h:64
EpsBearer erabLevelQosParameters
E-RAB level QOS parameters.
Definition: epc-x2-sap.h:62
ErabsSubjectToStatusTransferItem structure.
Definition: epc-x2-sap.h:102
Parameters of the HANDOVER CANCEL message.
Definition: epc-x2-sap.h:345
Parameters of the HANDOVER PREPARATION FAILURE message.
Definition: epc-x2-sap.h:264
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:248
std::vector< ErabAdmittedItem > admittedBearers
admitted bearers
Definition: epc-x2-sap.h:253
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:251
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:250
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:252
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:249
Ptr< Packet > rrcContext
RRC context.
Definition: epc-x2-sap.h:255
Parameters of the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:230
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:231
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:233
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:234
uint32_t mmeUeS1apId
MME UE S1 AP ID.
Definition: epc-x2-sap.h:235
std::vector< ErabToBeSetupItem > bearers
bearers
Definition: epc-x2-sap.h:238
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:306
Parameters of the RESOURCE STATUS UPDATE message.
Definition: epc-x2-sap.h:317
Parameters of the SN STATUS TRANSFER message.
Definition: epc-x2-sap.h:278
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:280
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
ERABs subject to status transfer list.
Definition: epc-x2-sap.h:284
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:279
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:282
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:281
Parameters of the UE CONTEXT RELEASE message.
Definition: epc-x2-sap.h:293
uint16_t newEnbUeX2apId
new ENB UE X2 AP ID
Definition: epc-x2-sap.h:295
uint16_t oldEnbUeX2apId
old ENB UE X2 AP ID
Definition: epc-x2-sap.h:294
uint16_t sourceCellId
source cell ID
Definition: epc-x2-sap.h:296
uint16_t targetCellId
target cell ID
Definition: epc-x2-sap.h:297
Parameters of the UE DATA primitive.
Definition: epc-x2-sap.h:332
uint64_t gbrUl
Guaranteed Bit Rate (bit/s) in uplink.
Definition: eps-bearer.h:43
AllocateNcRaPreambleReturnValue structure.
bool valid
true if a valid RA config was allocated, false otherwise
Logical Channel information to be passed to CmacSapProvider::ConfigureLc.
uint64_t gbrUl
guaranteed bitrate in uplink
uint8_t qci
QoS Class Identifier.
uint64_t mbrDl
maximum bitrate in downlink
uint64_t mbrUl
maximum bitrate in uplink
uint8_t lcGroup
logical channel group
uint8_t resourceType
0 if the bearer is NON-GBR, 1 if the bearer is GBR, 2 if the bearer in DC-GBR
uint64_t gbrDl
guaranteed bitrate in downlink
uint8_t lcId
logical channel identifier
uint16_t rnti
C-RNTI identifying the UE.
struct defining the RACH configuration of the MAC
Parameters for [re]configuring the UE.
uint16_t m_rnti
UE id within this cell.
uint8_t m_transmissionMode
Transmission mode 1..7
Parameters for [re]configuring the UE.
uint16_t m_rnti
UE id within this cell.
uint8_t m_transmissionMode
Transmission mode 1..7
X2uTeidInfo structure.
Definition: lte-enb-rrc.h:1619
CompleteSetupUeParameters structure.
Definition: lte-rrc-sap.h:1248
SetupUeParameters structure.
Definition: lte-rrc-sap.h:1128
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
Definition: lte-rrc-sap.h:1130
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
Definition: lte-rrc-sap.h:1129
Status variables of the PDCP.
Definition: lte-pdcp.h:102
uint16_t rxSn
RX sequence number.
Definition: lte-pdcp.h:104
uint16_t txSn
TX sequence number.
Definition: lte-pdcp.h:103
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
Definition: lte-pdcp-sap.h:44
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
Definition: lte-pdcp-sap.h:77
uint16_t antennaPortsCount
antenna ports count
Definition: lte-rrc-sap.h:758
uint8_t transmissionMode
transmission mode
Definition: lte-rrc-sap.h:151
RadioResourceConfigDedicated sourceRadioResourceConfig
source radio resource config
Definition: lte-rrc-sap.h:652
MasterInformationBlock sourceMasterInformationBlock
source master information block
Definition: lte-rrc-sap.h:654
uint16_t sourceUeIdentity
source UE identity
Definition: lte-rrc-sap.h:653
MeasConfig sourceMeasConfig
source measure config
Definition: lte-rrc-sap.h:651
uint32_t sourceDlCarrierFreq
source DL carrier frequency
Definition: lte-rrc-sap.h:659
SystemInformationBlockType1 sourceSystemInformationBlockType1
source system information block type 1
Definition: lte-rrc-sap.h:656
SystemInformationBlockType2 sourceSystemInformationBlockType2
source system information block type 2
Definition: lte-rrc-sap.h:658
uint16_t dlBandwidth
DL bandwidth.
Definition: lte-rrc-sap.h:580
uint16_t ulBandwidth
UL bandwidth.
Definition: lte-rrc-sap.h:581
uint32_t dlCarrierFreq
DL carrier frequency.
Definition: lte-rrc-sap.h:573
uint32_t ulCarrierFreq
UL carrier frequency.
Definition: lte-rrc-sap.h:574
uint32_t dlCarrierFreq
ARFCN - valueEUTRA.
Definition: lte-rrc-sap.h:752
uint32_t physCellId
physical cell ID
Definition: lte-rrc-sap.h:751
int8_t qRxLevMin
INTEGER (-70..-22), actual value = IE value * 2 [dBm].
Definition: lte-rrc-sap.h:81
int8_t qQualMin
INTEGER (-34..-3), actual value = IE value [dB].
Definition: lte-rrc-sap.h:82
DrbToAddMod structure.
Definition: lte-rrc-sap.h:245
uint8_t epsBearerIdentity
EPS bearer identity.
Definition: lte-rrc-sap.h:246
RlcConfig rlcConfig
RLC config.
Definition: lte-rrc-sap.h:248
uint8_t logicalChannelIdentity
logical channel identify
Definition: lte-rrc-sap.h:249
uint8_t drbIdentity
DRB identity.
Definition: lte-rrc-sap.h:247
LogicalChannelConfig logicalChannelConfig
logical channel config
Definition: lte-rrc-sap.h:250
uint32_t ulCarrierFreq
UL carrier frequency.
Definition: lte-rrc-sap.h:88
uint16_t ulBandwidth
UL bandwidth.
Definition: lte-rrc-sap.h:89
HandoverPreparationInfo structure.
Definition: lte-rrc-sap.h:942
MasterInformationBlock structure.
Definition: lte-rrc-sap.h:622
uint16_t systemFrameNumber
system frame number
Definition: lte-rrc-sap.h:624
std::list< MeasObjectToAddMod > measObjectToAddModList
measure object to add mod list
Definition: lte-rrc-sap.h:555
bool haveMeasGapConfig
have measure gap config?
Definition: lte-rrc-sap.h:562
QuantityConfig quantityConfig
quantity config
Definition: lte-rrc-sap.h:561
bool haveSmeasure
have S measure?
Definition: lte-rrc-sap.h:564
bool haveSpeedStatePars
have speed state parameters?
Definition: lte-rrc-sap.h:566
std::list< ReportConfigToAddMod > reportConfigToAddModList
report config to add mod list
Definition: lte-rrc-sap.h:557
std::list< MeasIdToAddMod > measIdToAddModList
measure ID to add mod list
Definition: lte-rrc-sap.h:559
bool haveQuantityConfig
have quantity config?
Definition: lte-rrc-sap.h:560
MeasIdToAddMod structure.
Definition: lte-rrc-sap.h:488
uint8_t measObjectId
measure object ID
Definition: lte-rrc-sap.h:490
uint8_t reportConfigId
report config ID
Definition: lte-rrc-sap.h:491
bool haveCellForWhichToReportCGI
have cell for which to report CGI?
Definition: lte-rrc-sap.h:346
uint16_t allowedMeasBandwidth
allowed measure bandwidth
Definition: lte-rrc-sap.h:338
int8_t offsetFreq
offset frequency
Definition: lte-rrc-sap.h:341
uint8_t neighCellConfig
neighbor cell config
Definition: lte-rrc-sap.h:340
bool presenceAntennaPort1
antenna port 1 present?
Definition: lte-rrc-sap.h:339
uint32_t carrierFreq
carrier frequency
Definition: lte-rrc-sap.h:337
MeasObjectToAddMod structure.
Definition: lte-rrc-sap.h:474
uint8_t measObjectId
measure object ID
Definition: lte-rrc-sap.h:475
MeasObjectEutra measObjectEutra
measure object eutra
Definition: lte-rrc-sap.h:476
uint8_t rsrqResult
the RSRQ result
Definition: lte-rrc-sap.h:675
uint8_t rsrpResult
the RSRP result
Definition: lte-rrc-sap.h:674
uint8_t measId
measure ID
Definition: lte-rrc-sap.h:718
bool haveMeasResultNeighCells
have measure result neighbor cells
Definition: lte-rrc-sap.h:720
std::list< MeasResultEutra > measResultListEutra
measure result list eutra
Definition: lte-rrc-sap.h:721
bool haveMeasResultServFreqList
has measResultServFreqList-r10
Definition: lte-rrc-sap.h:722
std::list< MeasResultServFreq > measResultServFreqList
MeasResultServFreqList-r10.
Definition: lte-rrc-sap.h:723
MeasResultPCell measResultPCell
measurement result primary cell
Definition: lte-rrc-sap.h:719
MeasurementReport structure.
Definition: lte-rrc-sap.h:948
MeasResults measResults
measure results
Definition: lte-rrc-sap.h:949
RadioResourceConfigCommon radioResourceConfigCommon
radio resource config common
Definition: lte-rrc-sap.h:600
RachConfigDedicated rachConfigDedicated
RACH config dedicated.
Definition: lte-rrc-sap.h:602
bool haveRachConfigDedicated
Have RACH config dedicated?
Definition: lte-rrc-sap.h:601
uint16_t newUeIdentity
new UE identity
Definition: lte-rrc-sap.h:599
bool haveCarrierBandwidth
have carrier bandwidth?
Definition: lte-rrc-sap.h:597
bool haveCarrierFreq
have carrier frequency?
Definition: lte-rrc-sap.h:595
CarrierBandwidthEutra carrierBandwidth
carrier bandwidth
Definition: lte-rrc-sap.h:598
CarrierFreqEutra carrierFreq
carrier frequency
Definition: lte-rrc-sap.h:596
uint16_t targetPhysCellId
target Phy cell ID
Definition: lte-rrc-sap.h:594
NonCriticalExtensionConfiguration structure.
Definition: lte-rrc-sap.h:874
std::list< uint8_t > sCellToReleaseList
SCell to release list.
Definition: lte-rrc-sap.h:876
std::list< SCellToAddMod > sCellToAddModList
SCell to add mod list.
Definition: lte-rrc-sap.h:875
AntennaInfoCommon antennaInfoCommon
2: Physical configuration, general antennaInfoCommon-r10
Definition: lte-rrc-sap.h:780
PdschConfigCommon pdschConfigCommon
4: Physical configuration, physical channels pdsch-ConfigCommon-r10
Definition: lte-rrc-sap.h:784
uint16_t dlBandwidth
1: Cell characteristics
Definition: lte-rrc-sap.h:778
int8_t referenceSignalPower
INTEGER (-60..50),.
Definition: lte-rrc-sap.h:157
int8_t pb
INTEGER (0..3),.
Definition: lte-rrc-sap.h:158
PdschConfigDedicated structure.
Definition: lte-rrc-sap.h:163
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
Definition: lte-rrc-sap.h:233
bool haveAntennaInfoDedicated
have antenna info dedicated?
Definition: lte-rrc-sap.h:230
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
Definition: lte-rrc-sap.h:229
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
Definition: lte-rrc-sap.h:227
bool havePdschConfigDedicated
have PDSCH config dedicated?
Definition: lte-rrc-sap.h:232
AntennaInfoDedicated antennaInfo
antenna info
Definition: lte-rrc-sap.h:231
PuschConfigDedicatedSCell pushConfigDedicatedSCell
PUSCH config dedicated SCell.
Definition: lte-rrc-sap.h:836
AntennaInfoDedicated antennaInfoUl
antenna info UL
Definition: lte-rrc-sap.h:835
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
sounding RS UL config dedicated
Definition: lte-rrc-sap.h:841
PdschConfigDedicated pdschConfigDedicated
PDSCH config dedicated.
Definition: lte-rrc-sap.h:830
bool haveSoundingRsUlConfigDedicated
have sounding RS UL config dedicated?
Definition: lte-rrc-sap.h:839
bool haveUlConfiguration
have UL configuration?
Definition: lte-rrc-sap.h:833
bool haveAntennaInfoUlDedicated
have antenna info UL dedicated?
Definition: lte-rrc-sap.h:834
bool havePdschConfigDedicated
have PDSCH config dedicated?
Definition: lte-rrc-sap.h:829
bool crossCarrierSchedulingConfig
currently implemented as boolean variable --> implementing crossCarrierScheduling is out of the scope...
Definition: lte-rrc-sap.h:826
bool haveNonUlConfiguration
have non UL configuration?
Definition: lte-rrc-sap.h:823
AntennaInfoDedicated antennaInfo
antenna info dedicated
Definition: lte-rrc-sap.h:825
bool haveAntennaInfoDedicated
have antenna info dedicated?
Definition: lte-rrc-sap.h:824
UlPowerControlDedicatedSCell ulPowerControlDedicatedSCell
UL power control dedicated SCell.
Definition: lte-rrc-sap.h:838
uint32_t plmnIdentity
PLMN identity.
Definition: lte-rrc-sap.h:66
uint8_t numberOfRaPreambles
number of RA preambles
Definition: lte-rrc-sap.h:256
uint16_t nPuschIdentity
3GPP TS 36.331 v.11.10 R11 page 216
Definition: lte-rrc-sap.h:809
uint8_t filterCoefficientRSRQ
filter coefficient RSRQ
Definition: lte-rrc-sap.h:308
uint8_t filterCoefficientRSRP
filter coefficient RSRP
Definition: lte-rrc-sap.h:307
uint8_t raResponseWindowSize
RA response window size.
Definition: lte-rrc-sap.h:263
uint8_t preambleTransMax
preamble transmit maximum
Definition: lte-rrc-sap.h:262
RachConfigCommon structure.
Definition: lte-rrc-sap.h:275
TxFailParam txFailParam
txFailParams
Definition: lte-rrc-sap.h:278
PreambleInfo preambleInfo
preamble info
Definition: lte-rrc-sap.h:276
RaSupervisionInfo raSupervisionInfo
RA supervision info.
Definition: lte-rrc-sap.h:277
uint8_t raPreambleIndex
RA preamble index.
Definition: lte-rrc-sap.h:587
uint8_t raPrachMaskIndex
RA PRACH mask index.
Definition: lte-rrc-sap.h:588
RachConfigCommon rachConfigCommon
RACH config common.
Definition: lte-rrc-sap.h:284
NonUlConfiguration nonUlConfiguration
non UL configuration
Definition: lte-rrc-sap.h:848
bool haveUlConfiguration
have UL configuration
Definition: lte-rrc-sap.h:849
bool haveNonUlConfiguration
have non UL configuration?
Definition: lte-rrc-sap.h:847
UlConfiguration ulConfiguration
UL configuration.
Definition: lte-rrc-sap.h:850
RachConfigCommon rachConfigCommon
RACH config common.
Definition: lte-rrc-sap.h:290
PdschConfigCommon pdschConfigCommon
PDSCH config common.
Definition: lte-rrc-sap.h:291
RadioResourceConfigDedicated structure.
Definition: lte-rrc-sap.h:296
PhysicalConfigDedicated physicalConfigDedicated
physical config dedicated
Definition: lte-rrc-sap.h:301
std::list< uint8_t > drbToReleaseList
DRB to release list.
Definition: lte-rrc-sap.h:299
bool havePhysicalConfigDedicated
have physical config dedicated?
Definition: lte-rrc-sap.h:300
std::list< DrbToAddMod > drbToAddModList
DRB to add mod list.
Definition: lte-rrc-sap.h:298
std::list< SrbToAddMod > srbToAddModList
SRB to add mod list.
Definition: lte-rrc-sap.h:297
PhysicalConfigDedicatedSCell physicalConfigDedicatedSCell
physical config dedicated SCell
Definition: lte-rrc-sap.h:857
Specifies criteria for triggering of an E-UTRA measurement reporting event.
Definition: lte-rrc-sap.h:373
@ BOTH
Both the RSRP and RSRQ quantities are to be included in the measurement report.
Definition: lte-rrc-sap.h:434
ThresholdEutra threshold2
Threshold for event A5.
Definition: lte-rrc-sap.h:394
enum ns3::LteRrcSap::ReportConfigEutra::@66 reportQuantity
Report type enumeration.
enum ns3::LteRrcSap::ReportConfigEutra::@64 eventId
Event enumeration.
@ EVENT_A2
Event A2: Serving becomes worse than absolute threshold.
Definition: lte-rrc-sap.h:385
@ EVENT_A4
Event A4: Neighbour becomes better than absolute threshold.
Definition: lte-rrc-sap.h:387
@ EVENT_A1
Event A1: Serving becomes better than absolute threshold.
Definition: lte-rrc-sap.h:384
@ EVENT_A5
Event A5: PCell becomes worse than absolute threshold1 AND Neighbour becomes better than another abso...
Definition: lte-rrc-sap.h:388
ThresholdEutra threshold1
Threshold for event A1, A2, A4, and A5.
Definition: lte-rrc-sap.h:393
enum ns3::LteRrcSap::ReportConfigEutra::@65 triggerQuantity
Trigger type enumeration.
@ RSRP
Reference Signal Received Power.
Definition: lte-rrc-sap.h:425
@ RSRQ
Reference Signal Received Quality.
Definition: lte-rrc-sap.h:426
ReportConfigToAddMod structure.
Definition: lte-rrc-sap.h:481
uint8_t reportConfigId
report config ID
Definition: lte-rrc-sap.h:482
ReportConfigEutra reportConfigEutra
report config eutra
Definition: lte-rrc-sap.h:483
RrcConnectionReconfigurationCompleted structure.
Definition: lte-rrc-sap.h:898
RrcConnectionReconfiguration structure.
Definition: lte-rrc-sap.h:881
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:882
bool haveMobilityControlInfo
have mobility control info
Definition: lte-rrc-sap.h:885
NonCriticalExtensionConfiguration nonCriticalExtension
3GPP TS 36.331 v.11.10 R11 Sec.
Definition: lte-rrc-sap.h:893
bool haveRadioResourceConfigDedicated
have radio resource config dedicated
Definition: lte-rrc-sap.h:887
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
Definition: lte-rrc-sap.h:889
bool haveNonCriticalExtension
have critical extension?
Definition: lte-rrc-sap.h:890
MobilityControlInfo mobilityControlInfo
mobility control info
Definition: lte-rrc-sap.h:886
RrcConnectionReestablishmentComplete structure.
Definition: lte-rrc-sap.h:919
RrcConnectionReestablishment structure.
Definition: lte-rrc-sap.h:911
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
Definition: lte-rrc-sap.h:914
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:912
RrcConnectionReestablishmentRequest structure.
Definition: lte-rrc-sap.h:904
RrcConnectionReject structure.
Definition: lte-rrc-sap.h:936
RrcConnectionRelease structure.
Definition: lte-rrc-sap.h:930
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:931
RrcConnectionRequest structure.
Definition: lte-rrc-sap.h:730
RrcConnectionSetupCompleted structure.
Definition: lte-rrc-sap.h:744
RrcConnectionSetup structure.
Definition: lte-rrc-sap.h:736
uint8_t rrcTransactionIdentifier
RRC transaction identifier.
Definition: lte-rrc-sap.h:737
RadioResourceConfigDedicated radioResourceConfigDedicated
radio resource config dedicated
Definition: lte-rrc-sap.h:739
SCellToAddMod structure.
Definition: lte-rrc-sap.h:862
RadioResourceConfigDedicatedSCell radioResourceConfigDedicatedSCell
radio resource config dedicated SCell
Definition: lte-rrc-sap.h:869
uint32_t sCellIndex
SCell index.
Definition: lte-rrc-sap.h:863
bool haveRadioResourceConfigDedicatedSCell
have radio resource config dedicated SCell?
Definition: lte-rrc-sap.h:867
CellIdentification cellIdentification
cell identification
Definition: lte-rrc-sap.h:864
RadioResourceConfigCommonSCell radioResourceConfigCommonSCell
radio resource config common SCell
Definition: lte-rrc-sap.h:866
uint8_t srsSubframeConfig
SRS subframe config.
Definition: lte-rrc-sap.h:129
uint16_t srsBandwidthConfig
SRS bandwidth config.
Definition: lte-rrc-sap.h:128
uint16_t srsConfigIndex
SRS config index.
Definition: lte-rrc-sap.h:145
SrbToAddMod structure.
Definition: lte-rrc-sap.h:238
LogicalChannelConfig logicalChannelConfig
logical channel config
Definition: lte-rrc-sap.h:240
uint8_t srbIdentity
SB identity.
Definition: lte-rrc-sap.h:239
SystemInformationBlockType1 structure.
Definition: lte-rrc-sap.h:629
CellSelectionInfo cellSelectionInfo
cell selection info
Definition: lte-rrc-sap.h:631
CellAccessRelatedInfo cellAccessRelatedInfo
cell access related info
Definition: lte-rrc-sap.h:630
RadioResourceConfigCommonSib radioResourceConfigCommon
radio resource config common
Definition: lte-rrc-sap.h:637
SystemInformation structure.
Definition: lte-rrc-sap.h:643
SystemInformationBlockType2 sib2
SIB2.
Definition: lte-rrc-sap.h:645
enum ns3::LteRrcSap::ThresholdEutra::@62 choice
Threshold enumeration.
@ THRESHOLD_RSRP
RSRP is used for the threshold.
Definition: lte-rrc-sap.h:364
@ THRESHOLD_RSRQ
RSRQ is used for the threshold.
Definition: lte-rrc-sap.h:365
uint8_t connEstFailCount
Number of times that the UE detects T300 expiry on the same cell.
Definition: lte-rrc-sap.h:269
UlPowerControlCommonSCell ulPowerControlCommonSCell
3GPP TS 36.331 v.11.10 R11 pag.223
Definition: lte-rrc-sap.h:793
FreqInfo ulFreqInfo
UL frequency info.
Definition: lte-rrc-sap.h:792
SoundingRsUlConfigCommon soundingRsUlConfigCommon
sounding RS UL config common
Definition: lte-rrc-sap.h:794
PrachConfigSCell prachConfigSCell
PRACH config SCell.
Definition: lte-rrc-sap.h:795
uint16_t pSrsOffset
3GPP TS 36.331 v.11.10 R11 page 234
Definition: lte-rrc-sap.h:816