A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
lte-enb-rrc.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  * Marco Miozzo <mmiozzo@cttc.es>
20  * Manuel Requena <manuel.requena@cttc.es>
21  */
22 
23 #include "ns3/fatal-error.h"
24 #include "ns3/log.h"
25 #include "ns3/abort.h"
26 #include "ns3/pointer.h"
27 #include "ns3/object-map.h"
28 #include "ns3/object-factory.h"
29 #include "ns3/simulator.h"
30 
31 #include "lte-enb-rrc.h"
32 
33 #include "lte-enb-net-device.h"
34 #include "lte-radio-bearer-info.h"
35 #include "eps-bearer-tag.h"
36 #include "ff-mac-csched-sap.h"
37 #include "epc-enb-s1-sap.h"
38 
39 #include "lte-rlc.h"
40 #include "lte-rlc-tm.h"
41 #include "lte-rlc-um.h"
42 #include "lte-rlc-am.h"
43 #include "lte-pdcp.h"
44 #include "lte-pdcp-sap.h"
45 
46 #include <ns3/simulator.h>
47 
48 
49 
50 
51 NS_LOG_COMPONENT_DEFINE ("LteEnbRrc");
52 
53 
54 namespace ns3 {
55 
56 
57 // ///////////////////////////
58 // CMAC SAP forwarder
59 // ///////////////////////////
60 
62 {
63 public:
65 
66  virtual uint16_t AllocateTemporaryCellRnti ();
67  virtual void NotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success);
68  virtual void RrcConfigurationUpdateInd (UeConfig params);
69 
70 private:
72 };
73 
75  : m_rrc (rrc)
76 {
77 }
78 
79 uint16_t
81 {
83 }
84 
85 void
86 EnbRrcMemberLteEnbCmacSapUser::NotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success)
87 {
88  m_rrc->DoNotifyLcConfigResult (rnti, lcid, success);
89 }
90 
91 void
93 {
95 }
96 
97 
99  {
100  "INITIAL_RANDOM_ACCESS",
101  "CONNECTION_SETUP",
102  "CONNECTION_REJECTED",
103  "CONNECTED_NORMALLY",
104  "CONNECTION_RECONFIGURATION",
105  "CONNECTION_REESTABLISHMENT",
106  "HANDOVER_PREPARATION",
107  "HANDOVER_JOINING",
108  "HANDOVER_PATH_SWITCH",
109  "HANDOVER_LEAVING",
110  };
111 
113 {
114  return std::string (g_ueManagerStateName[s]);
115 }
116 
117 
118 
120 // UeManager
122 
123 
124 NS_OBJECT_ENSURE_REGISTERED (UeManager);
125 
126 
128 {
129  NS_FATAL_ERROR ("this constructor is not espected to be used");
130 }
131 
132 
134  : m_lastAllocatedDrbid (0),
135  m_rnti (rnti),
136  m_imsi (0),
137  m_lastRrcTransactionIdentifier (0),
138  m_rrc (rrc),
139  m_state (s),
140  m_pendingRrcConnectionReconfiguration (false),
141  m_sourceX2apId (0),
142  m_sourceCellId (0),
143  m_needTransmissionModeConfiguration (false)
144 {
145  NS_LOG_FUNCTION (this);
146 }
147 
148 void
150 {
151  NS_LOG_FUNCTION (this);
153 
155  m_physicalConfigDedicated.antennaInfo.transmissionMode = m_rrc->m_defaultTransmissionMode;
160 
161  m_rrc->m_cmacSapProvider->AddUe (m_rnti);
162  m_rrc->m_cphySapProvider->AddUe (m_rnti);
163 
164  // setup the eNB side of SRB0
165  {
166  uint8_t lcid = 0;
167 
168  Ptr<LteRlc> rlc = CreateObject<LteRlcTm> ()->GetObject<LteRlc> ();
169  rlc->SetLteMacSapProvider (m_rrc->m_macSapProvider);
170  rlc->SetRnti (m_rnti);
171  rlc->SetLcId (lcid);
172 
173  m_srb0 = CreateObject<LteSignalingRadioBearerInfo> ();
174  m_srb0->m_rlc = rlc;
175  m_srb0->m_srbIdentity = 0;
176  // no need to store logicalChannelConfig as SRB0 is pre-configured
177 
179  lcinfo.rnti = m_rnti;
180  lcinfo.lcId = lcid;
181  // leave the rest of lcinfo empty as CCCH (LCID 0) is pre-configured
182  m_rrc->m_cmacSapProvider->AddLc (lcinfo, rlc->GetLteMacSapUser ());
183 
184  }
185 
186  // setup the eNB side of SRB1; the UE side will be set up upon RRC connection establishment
187  {
188  uint8_t lcid = 1;
189 
190  Ptr<LteRlc> rlc = CreateObject<LteRlcAm> ()->GetObject<LteRlc> ();
191  rlc->SetLteMacSapProvider (m_rrc->m_macSapProvider);
192  rlc->SetRnti (m_rnti);
193  rlc->SetLcId (lcid);
194 
195  Ptr<LtePdcp> pdcp = CreateObject<LtePdcp> ();
196  pdcp->SetRnti (m_rnti);
197  pdcp->SetLcId (lcid);
198  pdcp->SetLtePdcpSapUser (m_drbPdcpSapUser);
199  pdcp->SetLteRlcSapProvider (rlc->GetLteRlcSapProvider ());
200  rlc->SetLteRlcSapUser (pdcp->GetLteRlcSapUser ());
201 
202  m_srb1 = CreateObject<LteSignalingRadioBearerInfo> ();
203  m_srb1->m_rlc = rlc;
204  m_srb1->m_pdcp = pdcp;
205  m_srb1->m_srbIdentity = 1;
206  m_srb1->m_logicalChannelConfig.priority = 0;
207  m_srb1->m_logicalChannelConfig.prioritizedBitRateKbps = 100;
208  m_srb1->m_logicalChannelConfig.bucketSizeDurationMs = 100;
209  m_srb1->m_logicalChannelConfig.logicalChannelGroup = 0;
210 
212  lcinfo.rnti = m_rnti;
213  lcinfo.lcId = lcid;
214  lcinfo.lcGroup = 0; // all SRBs always mapped to LCG 0
215  lcinfo.qci = EpsBearer::GBR_CONV_VOICE; // not sure why the FF API requires a CQI even for SRBs...
216  lcinfo.isGbr = true;
217  lcinfo.mbrUl = 1e6;
218  lcinfo.mbrDl = 1e6;
219  lcinfo.gbrUl = 1e4;
220  lcinfo.gbrDl = 1e4;
221  m_rrc->m_cmacSapProvider->AddLc (lcinfo, rlc->GetLteMacSapUser ());
222  }
223 
225  ueParams.srb0SapProvider = m_srb0->m_rlc->GetLteRlcSapProvider ();
226  ueParams.srb1SapProvider = m_srb1->m_pdcp->GetLtePdcpSapProvider ();
227  m_rrc->m_rrcSapUser->SetupUe (m_rnti, ueParams);
228 
229  // configure MAC (and scheduler)
231  req.m_rnti = m_rnti;
233  m_rrc->m_cmacSapProvider->UeUpdateConfigurationReq (req);
234 
235  // configure PHY
236  m_rrc->m_cphySapProvider->SetTransmissionMode (m_rnti, m_physicalConfigDedicated.antennaInfo.transmissionMode);
237  m_rrc->m_cphySapProvider->SetSrsConfigurationIndex (m_rnti, m_physicalConfigDedicated.soundingRsUlConfigDedicated.srsConfigIndex);
238 
239  // schedule this UeManager instance to be deleted if the UE does not give any sign of life within a reasonable time
240  Time maxConnectionDelay;
241  switch (m_state)
242  {
244  m_connectionTimeout = Simulator::Schedule (m_rrc->m_connectionTimeoutDuration,
246  m_rrc, m_rnti);
247  break;
248 
249  case HANDOVER_JOINING:
250  m_handoverJoiningTimeout = Simulator::Schedule (m_rrc->m_handoverJoiningTimeoutDuration,
252  m_rrc, m_rnti);
253  break;
254 
255  default:
256  NS_FATAL_ERROR ("unexpected state " << ToString (m_state));
257  break;
258  }
259 
260  m_servingCellMeasures = CreateObject<UeMeasure> ();
261  m_servingCellMeasures->m_cellId = m_rrc->m_cellId;
262  m_servingCellMeasures->m_rsrp = 0;
263  m_servingCellMeasures->m_rsrq = 0;
264 
265 }
266 
267 
269 {
270 }
271 
272 void
274 {
275  delete m_drbPdcpSapUser;
276  // delete eventual X2-U TEIDs
277  for (std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.begin ();
278  it != m_drbMap.end ();
279  ++it)
280  {
281  m_rrc->m_x2uTeidInfoMap.erase (it->second->m_gtpTeid);
282  }
283 
285 }
286 
288 {
289  static TypeId tid = TypeId ("ns3::UeManager")
290  .SetParent<Object> ()
291  .AddConstructor<UeManager> ()
292  .AddAttribute ("DataRadioBearerMap", "List of UE DataRadioBearerInfo by DRBID.",
293  ObjectMapValue (),
295  MakeObjectMapChecker<LteDataRadioBearerInfo> ())
296  .AddAttribute ("Srb0", "SignalingRadioBearerInfo for SRB0",
297  PointerValue (),
298  MakePointerAccessor (&UeManager::m_srb0),
299  MakePointerChecker<LteSignalingRadioBearerInfo> ())
300  .AddAttribute ("Srb1", "SignalingRadioBearerInfo for SRB1",
301  PointerValue (),
302  MakePointerAccessor (&UeManager::m_srb1),
303  MakePointerChecker<LteSignalingRadioBearerInfo> ())
304  .AddAttribute ("C-RNTI",
305  "Cell Radio Network Temporary Identifier",
306  TypeId::ATTR_GET, // read-only attribute
307  UintegerValue (0), // unused, read-only attribute
308  MakeUintegerAccessor (&UeManager::m_rnti),
309  MakeUintegerChecker<uint16_t> ())
310  .AddTraceSource ("StateTransition",
311  "fired upon every UE state transition seen by the UeManager at the eNB RRC",
313  ;
314  return tid;
315 }
316 
317 void
318 UeManager::SetSource (uint16_t sourceCellId, uint16_t sourceX2apId)
319 {
320  m_sourceX2apId = sourceX2apId;
321  m_sourceCellId = sourceCellId;
322 }
323 
324 void
325 UeManager::SetImsi (uint64_t imsi)
326 {
327  m_imsi = imsi;
328 }
329 
330 void
331 UeManager::SetupDataRadioBearer (EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress)
332 {
333  NS_LOG_FUNCTION (this << (uint32_t) m_rnti);
334 
335  Ptr<LteDataRadioBearerInfo> drbInfo = CreateObject<LteDataRadioBearerInfo> ();
336  uint8_t drbid = AddDataRadioBearerInfo (drbInfo);
337  uint8_t lcid = Drbid2Lcid (drbid);
338  uint8_t bid = Drbid2Bid (drbid);
339  NS_ASSERT_MSG ( bearerId == 0 || bid == bearerId, "bearer ID mismatch (" << (uint32_t) bid << " != " << (uint32_t) bearerId << ", the assumption that ID are allocated in the same way by MME and RRC is not valid any more");
340  drbInfo->m_epsBearerIdentity = bid;
341  drbInfo->m_drbIdentity = drbid;
342  drbInfo->m_logicalChannelIdentity = lcid;
343  drbInfo->m_gtpTeid = gtpTeid;
344  drbInfo->m_transportLayerAddress = transportLayerAddress;
345 
346  if (m_state == HANDOVER_JOINING)
347  {
348  // setup TEIDs for receiving data eventually forwarded over X2-U
349  LteEnbRrc::X2uTeidInfo x2uTeidInfo;
350  x2uTeidInfo.rnti = m_rnti;
351  x2uTeidInfo.drbid = drbid;
352  std::pair<std::map<uint32_t, LteEnbRrc::X2uTeidInfo>::iterator, bool>
353  ret = m_rrc->m_x2uTeidInfoMap.insert (std::pair<uint32_t, LteEnbRrc::X2uTeidInfo> (gtpTeid, x2uTeidInfo));
354  NS_ASSERT_MSG (ret.second == true, "overwriting a pre-existing entry in m_x2uTeidInfoMap");
355  }
356 
357  TypeId rlcTypeId = m_rrc->GetRlcType (bearer);
358 
359  ObjectFactory rlcObjectFactory;
360  rlcObjectFactory.SetTypeId (rlcTypeId);
361  Ptr<LteRlc> rlc = rlcObjectFactory.Create ()->GetObject<LteRlc> ();
362  rlc->SetLteMacSapProvider (m_rrc->m_macSapProvider);
363  rlc->SetRnti (m_rnti);
364 
365  drbInfo->m_rlc = rlc;
366 
367  rlc->SetLcId (lcid);
368 
369  // we need PDCP only for real RLC, i.e., RLC/UM or RLC/AM
370  // if we are using RLC/SM we don't care of anything above RLC
371  if (rlcTypeId != LteRlcSm::GetTypeId ())
372  {
373  Ptr<LtePdcp> pdcp = CreateObject<LtePdcp> ();
374  pdcp->SetRnti (m_rnti);
375  pdcp->SetLcId (lcid);
376  pdcp->SetLtePdcpSapUser (m_drbPdcpSapUser);
377  pdcp->SetLteRlcSapProvider (rlc->GetLteRlcSapProvider ());
378  rlc->SetLteRlcSapUser (pdcp->GetLteRlcSapUser ());
379  drbInfo->m_pdcp = pdcp;
380  }
381 
383  lcinfo.rnti = m_rnti;
384  lcinfo.lcId = lcid;
385  lcinfo.lcGroup = m_rrc->GetLogicalChannelGroup (bearer);
386  lcinfo.qci = bearer.qci;
387  lcinfo.isGbr = bearer.IsGbr ();
388  lcinfo.mbrUl = bearer.gbrQosInfo.mbrUl;
389  lcinfo.mbrDl = bearer.gbrQosInfo.mbrDl;
390  lcinfo.gbrUl = bearer.gbrQosInfo.gbrUl;
391  lcinfo.gbrDl = bearer.gbrQosInfo.gbrDl;
392  m_rrc->m_cmacSapProvider->AddLc (lcinfo, rlc->GetLteMacSapUser ());
393 
394  if (rlcTypeId == LteRlcAm::GetTypeId ())
395  {
396  drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::AM;
397  }
398  else
399  {
400  drbInfo->m_rlcConfig.choice = LteRrcSap::RlcConfig::UM_BI_DIRECTIONAL;
401  }
402 
403  drbInfo->m_logicalChannelIdentity = lcid;
404  drbInfo->m_logicalChannelConfig.priority = m_rrc->GetLogicalChannelPriority (bearer);
405  drbInfo->m_logicalChannelConfig.logicalChannelGroup = m_rrc->GetLogicalChannelGroup (bearer);
406  if (bearer.IsGbr ())
407  {
408  drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = bearer.gbrQosInfo.gbrUl;
409  }
410  else
411  {
412  drbInfo->m_logicalChannelConfig.prioritizedBitRateKbps = 0;
413  }
414  drbInfo->m_logicalChannelConfig.bucketSizeDurationMs = 1000;
415 
417 }
418 
419 void
421 {
422  NS_LOG_FUNCTION (this << (uint32_t) m_rnti);
423  for (std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.begin ();
424  it != m_drbMap.end ();
425  ++it)
426  {
427  m_drbsToBeStarted.push_back (it->first);
428  }
429 }
430 
431 void
433 {
434  NS_LOG_FUNCTION (this << (uint32_t) m_rnti);
435  for (std::list <uint8_t>::iterator drbIdIt = m_drbsToBeStarted.begin ();
436  drbIdIt != m_drbsToBeStarted.end ();
437  ++drbIdIt)
438  {
439  std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator drbIt = m_drbMap.find (*drbIdIt);
440  NS_ASSERT (drbIt != m_drbMap.end ());
441  drbIt->second->m_rlc->Initialize ();
442  if (drbIt->second->m_pdcp)
443  {
444  drbIt->second->m_pdcp->Initialize ();
445  }
446  }
447  m_drbsToBeStarted.clear ();
448 }
449 
450 
451 void
453 {
454  NS_LOG_FUNCTION (this << (uint32_t) m_rnti << (uint32_t) drbid);
455  uint8_t lcid = Drbid2Lcid (drbid);
456  std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.find (drbid);
457  NS_ASSERT_MSG (it != m_drbMap.end (), "request to remove radio bearer with unknown drbid " << drbid);
458 
459  // first delete eventual X2-U TEIDs
460  m_rrc->m_x2uTeidInfoMap.erase (it->second->m_gtpTeid);
461 
462  m_drbMap.erase (it);
463  m_rrc->m_cmacSapProvider->ReleaseLc (m_rnti, lcid);
464 
466  rrcd.havePhysicalConfigDedicated = false;
467  rrcd.drbToReleaseList.push_back (drbid);
468 
470  msg.haveMeasConfig = false;
471  msg.haveMobilityControlInfo = false;
472 
473  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration (m_rnti, msg);
474 }
475 
476 
477 void
479 {
480  NS_LOG_FUNCTION (this);
481  switch (m_state)
482  {
484  case CONNECTION_SETUP:
488  case HANDOVER_JOINING:
489  case HANDOVER_LEAVING:
490  // a previous reconfiguration still ongoing, we need to wait for it to be finished
492  break;
493 
494  case CONNECTED_NORMALLY:
495  {
498  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration (m_rnti, msg);
501  }
502  break;
503 
504  default:
505  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
506  break;
507  }
508 }
509 
510 void
511 UeManager::PrepareHandover (uint16_t cellId)
512 {
513  NS_LOG_FUNCTION (this << cellId);
514  switch (m_state)
515  {
516  case CONNECTED_NORMALLY:
517  {
518  m_targetCellId = cellId;
520  params.oldEnbUeX2apId = m_rnti;
522  params.sourceCellId = m_rrc->m_cellId;
523  params.targetCellId = cellId;
524  params.mmeUeS1apId = m_imsi;
525  params.ueAggregateMaxBitRateDownlink = 200 * 1000;
526  params.ueAggregateMaxBitRateUplink = 100 * 1000;
527  params.bearers = GetErabList ();
528 
531  hpi.asConfig.sourceDlCarrierFreq = m_rrc->m_dlEarfcn;
540  LteEnbCmacSapProvider::RachConfig rc = m_rrc->m_cmacSapProvider->GetRachConfig ();
546  params.rrcContext = m_rrc->m_rrcSapUser->EncodeHandoverPreparationInformation (hpi);
547 
548  NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
549  NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
550  NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
551  NS_LOG_LOGIC ("mmeUeS1apId = " << params.mmeUeS1apId);
552  NS_LOG_LOGIC ("rrcContext = " << params.rrcContext);
553 
554  m_rrc->m_x2SapProvider->SendHandoverRequest (params);
556  }
557  break;
558 
559  default:
560  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
561  break;
562  }
563 
564 }
565 
566 void
568 {
569  NS_LOG_FUNCTION (this);
570 
571  NS_ASSERT_MSG (params.notAdmittedBearers.empty (), "not admission of some bearers upon handover is not supported");
572  NS_ASSERT_MSG (params.admittedBearers.size () == m_drbMap.size (), "not enough bearers in admittedBearers");
573 
574  // note: the Handover command from the target eNB to the source eNB
575  // is expected to be sent transparently to the UE; however, here we
576  // decode the message and eventually reencode it. This way we can
577  // support both a real RRC protocol implementation and an ideal one
578  // without actual RRC protocol encoding.
579 
580  Ptr<Packet> encodedHandoverCommand = params.rrcContext;
581  LteRrcSap::RrcConnectionReconfiguration handoverCommand = m_rrc->m_rrcSapUser->DecodeHandoverCommand (encodedHandoverCommand);
582  m_rrc->m_rrcSapUser->SendRrcConnectionReconfiguration (m_rnti, handoverCommand);
584  m_handoverLeavingTimeout = Simulator::Schedule (m_rrc->m_handoverLeavingTimeoutDuration,
586  m_rrc, m_rnti);
587  NS_ASSERT (handoverCommand.haveMobilityControlInfo);
588  m_rrc->m_handoverStartTrace (m_imsi, m_rrc->m_cellId, m_rnti, handoverCommand.mobilityControlInfo.targetPhysCellId);
589 
591  sst.oldEnbUeX2apId = params.oldEnbUeX2apId;
592  sst.newEnbUeX2apId = params.newEnbUeX2apId;
593  sst.sourceCellId = params.sourceCellId;
594  sst.targetCellId = params.targetCellId;
595  for ( std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator drbIt = m_drbMap.begin ();
596  drbIt != m_drbMap.end ();
597  ++drbIt)
598  {
599  // SN status transfer is only for AM RLC
600  if (0 != drbIt->second->m_rlc->GetObject<LteRlcAm> ())
601  {
602  LtePdcp::Status status = drbIt->second->m_pdcp->GetStatus ();
604  i.dlPdcpSn = status.txSn;
605  i.ulPdcpSn = status.rxSn;
606  sst.erabsSubjectToStatusTransferList.push_back (i);
607  }
608  }
609  m_rrc->m_x2SapProvider->SendSnStatusTransfer (sst);
610 }
611 
612 
615 {
616  NS_LOG_FUNCTION (this);
618 }
619 
622 {
623  NS_LOG_FUNCTION (this);
625 }
626 
627 void
629 {
630  NS_LOG_FUNCTION (this << p << (uint16_t) bid);
631  switch (m_state)
632  {
634  case CONNECTION_SETUP:
635  NS_LOG_WARN ("not connected, discarding packet");
636  return;
637  break;
638 
639  case CONNECTED_NORMALLY:
643  case HANDOVER_JOINING:
645  {
646  NS_LOG_LOGIC ("queueing data on PDCP for transmission over the air");
648  params.pdcpSdu = p;
649  params.rnti = m_rnti;
650  params.lcid = Bid2Lcid (bid);
651  uint8_t drbid = Bid2Drbid (bid);
652  LtePdcpSapProvider* pdcpSapProvider = GetDataRadioBearerInfo (drbid)->m_pdcp->GetLtePdcpSapProvider ();
653  pdcpSapProvider->TransmitPdcpSdu (params);
654  }
655  break;
656 
657  case HANDOVER_LEAVING:
658  {
659  NS_LOG_LOGIC ("forwarding data to target eNB over X2-U");
660  uint8_t drbid = Bid2Drbid (bid);
661  EpcX2Sap::UeDataParams params;
662  params.sourceCellId = m_rrc->m_cellId;
663  params.targetCellId = m_targetCellId;
664  params.gtpTeid = GetDataRadioBearerInfo (drbid)->m_gtpTeid;
665  params.ueData = p;
666  m_rrc->m_x2SapProvider->SendUeData (params);
667  }
668  break;
669 
670  default:
671  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
672  break;
673  }
674 }
675 
676 std::vector<EpcX2Sap::ErabToBeSetupItem>
678 {
679  NS_LOG_FUNCTION (this);
680  std::vector<EpcX2Sap::ErabToBeSetupItem> ret;
681  for (std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.begin ();
682  it != m_drbMap.end ();
683  ++it)
684  {
686  etbsi.erabId = it->second->m_epsBearerIdentity;
687  etbsi.erabLevelQosParameters = it->second->m_epsBearer;
688  etbsi.dlForwarding = false;
689  etbsi.transportLayerAddress = it->second->m_transportLayerAddress;
690  etbsi.gtpTeid = it->second->m_gtpTeid;
691  ret.push_back (etbsi);
692  }
693  return ret;
694 }
695 
696 void
698 {
699  NS_LOG_FUNCTION (this);
700  switch (m_state)
701  {
703  NS_LOG_INFO ("Send UE CONTEXT RELEASE from target eNB to source eNB");
704  EpcX2SapProvider::UeContextReleaseParams ueCtxReleaseParams;
705  ueCtxReleaseParams.oldEnbUeX2apId = m_sourceX2apId;
706  ueCtxReleaseParams.newEnbUeX2apId = m_rnti;
707  ueCtxReleaseParams.sourceCellId = m_sourceCellId;
708  m_rrc->m_x2SapProvider->SendUeContextRelease (ueCtxReleaseParams);
710  m_rrc->m_handoverEndOkTrace (m_imsi, m_rrc->m_cellId, m_rnti);
711  break;
712 
713  default:
714  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
715  break;
716  }
717 }
718 
719 void
721 {
722  NS_LOG_FUNCTION (this << cellId);
723  switch (m_state)
724  {
725  case HANDOVER_PREPARATION:
726  NS_ASSERT (cellId == m_targetCellId);
727  NS_LOG_INFO ("target eNB sent HO preparation failure, aborting HO");
729  break;
730 
731  default:
732  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
733  break;
734  }
735 }
736 
737 void
739 {
740  NS_LOG_FUNCTION (this);
741  for (std::vector<EpcX2Sap::ErabsSubjectToStatusTransferItem>::iterator erabIt
742  = params.erabsSubjectToStatusTransferList.begin ();
743  erabIt != params.erabsSubjectToStatusTransferList.end ();
744  ++erabIt)
745  {
746  // LtePdcp::Status status;
747  // status.txSn = erabIt->dlPdcpSn;
748  // status.rxSn = erabIt->ulPdcpSn;
749  // uint8_t drbId = Bid2Drbid (erabIt->erabId);
750  // std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator drbIt = m_drbMap.find (drbId);
751  // NS_ASSERT_MSG (drbIt != m_drbMap.end (), "could not find DRBID " << (uint32_t) drbId);
752  // drbIt->second->m_pdcp->SetStatus (status);
753  }
754 }
755 
756 void
758 {
759  NS_LOG_FUNCTION (this);
760  NS_ASSERT_MSG (m_state == HANDOVER_LEAVING, "method unexpected in state " << ToString (m_state));
762 }
763 
764 
765 // methods forwarded from RRC SAP
766 
767 void
769 {
770  NS_LOG_FUNCTION (this);
771  m_srb0->m_rlc->SetLteRlcSapUser (params.srb0SapUser);
772  m_srb1->m_pdcp->SetLtePdcpSapUser (params.srb1SapUser);
773 }
774 
775 void
777 {
778  NS_LOG_FUNCTION (this);
779  switch (m_state)
780  {
781  case INITIAL_RANDOM_ACCESS:
782  {
783  if (m_rrc->m_admitRrcConnectionRequest == true)
784  {
786  m_imsi = msg.ueIdentity;
787  if (m_rrc->m_s1SapProvider != 0)
788  {
789  m_rrc->m_s1SapProvider->InitialUeMessage (m_imsi, m_rnti);
790  }
794  m_rrc->m_rrcSapUser->SendRrcConnectionSetup (m_rnti, msg2);
797  }
798  else
799  {
801  NS_LOG_INFO ("rejecting connection request for RNTI " << m_rnti);
803  rejectMsg.waitTime = 3;
804  m_rrc->m_rrcSapUser->SendRrcConnectionReject (m_rnti, rejectMsg);
805  m_connectionRejectedTimeout = Simulator::Schedule (m_rrc->m_connectionRejectedTimeoutDuration,
807  m_rrc, m_rnti);
809  }
810  }
811  break;
812 
813  default:
814  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
815  break;
816  }
817 }
818 
819 void
821 {
822  NS_LOG_FUNCTION (this);
823  switch (m_state)
824  {
825  case CONNECTION_SETUP:
828  m_rrc->m_connectionEstablishedTrace (m_imsi, m_rrc->m_cellId, m_rnti);
829  break;
830 
831  default:
832  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
833  break;
834  }
835 }
836 
837 void
839 {
840  NS_LOG_FUNCTION (this);
841  switch (m_state)
842  {
846  {
847  // configure MAC (and scheduler)
849  req.m_rnti = m_rnti;
851  m_rrc->m_cmacSapProvider->UeUpdateConfigurationReq (req);
852 
853  // configure PHY
854  m_rrc->m_cphySapProvider->SetTransmissionMode (req.m_rnti, req.m_transmissionMode);
855 
857  }
859  m_rrc->m_connectionReconfigurationTrace (m_imsi, m_rrc->m_cellId, m_rnti);
860  break;
861 
862  case HANDOVER_LEAVING:
863  NS_LOG_INFO ("ignoring RecvRrcConnectionReconfigurationCompleted in state " << ToString (m_state));
864  break;
865 
866  case HANDOVER_JOINING:
867  {
869  NS_LOG_INFO ("Send PATH SWITCH REQUEST to the MME");
871  params.rnti = m_rnti;
872  params.cellId = m_rrc->m_cellId;
873  params.mmeUeS1Id = m_imsi;
875  for (std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.begin ();
876  it != m_drbMap.end ();
877  ++it)
878  {
880  b.epsBearerId = it->second->m_epsBearerIdentity;
881  b.teid = it->second->m_gtpTeid;
882  params.bearersToBeSwitched.push_back (b);
883  }
884  m_rrc->m_s1SapProvider->PathSwitchRequest (params);
885  }
886  break;
887 
888  default:
889  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
890  break;
891  }
892 }
893 
894 void
896 {
897  NS_LOG_FUNCTION (this);
898  switch (m_state)
899  {
900  case CONNECTED_NORMALLY:
901  break;
902 
903  case HANDOVER_LEAVING:
905  break;
906 
907  default:
908  NS_FATAL_ERROR ("method unexpected in state " << ToString (m_state));
909  break;
910  }
911 
915  m_rrc->m_rrcSapUser->SendRrcConnectionReestablishment (m_rnti, msg2);
917 }
918 
919 void
921 {
922  NS_LOG_FUNCTION (this);
924 }
925 
926 void
928 {
929  NS_LOG_FUNCTION (this);
930  NS_LOG_LOGIC ("measId " << (uint16_t) msg.measResults.measId
931  << " haveMeasResultNeighCells " << msg.measResults.haveMeasResultNeighCells
932  << " measResultListEutra " << msg.measResults.measResultListEutra.size ());
933  NS_LOG_LOGIC ("serving cellId " << m_rrc->m_cellId
934  << " RSRP " << (uint16_t) msg.measResults.rsrpResult
935  << " RSRQ " << (uint16_t) msg.measResults.rsrqResult);
936 
937  for (std::list <LteRrcSap::MeasResultEutra>::iterator it = msg.measResults.measResultListEutra.begin ();
938  it != msg.measResults.measResultListEutra.end ();
939  ++it)
940  {
941  NS_LOG_LOGIC ("neighbour cellId " << it->physCellId
942  << " RSRP " << (it->haveRsrpResult ? (uint16_t) it->rsrpResult : 255)
943  << " RSRQ " << (it->haveRsrqResult ? (uint16_t) it->rsrqResult : 255));
944  }
945 
946  m_rrc->m_recvMeasurementReportTrace (m_imsi, m_rrc->m_cellId, m_rnti, msg);
947 
948  // Just these two measId are supported
949  NS_ASSERT_MSG ((msg.measResults.measId == 1) || (msg.measResults.measId == 2),
950  "Measure identity is unknown");
951 
953  if (msg.measResults.measId == 1)
954  {
955  // Keep new RSRQ value reported for the serving cell
958 
959  // Serving cell is worse than a handover threshold.
960  // This handover threshold is independent from the event A2 threshold
961  if (m_servingCellMeasures->m_rsrq <= m_rrc->m_servingCellHandoverThreshold)
962  {
963  // Find the best neighbour cell (eNB)
964  Ptr<UeMeasure> bestNeighbour = 0;
965  uint8_t bestNeighbourRsrq = 0;
966  NS_LOG_LOGIC ("Number of neighbour cells = " << m_neighbourCellMeasures.size ());
967  for (std::map <uint16_t, Ptr<UeMeasure> >::iterator it = m_neighbourCellMeasures.begin ();
968  it != m_neighbourCellMeasures.end ();
969  ++it)
970  {
971  if (it->second->m_rsrq > bestNeighbourRsrq)
972  {
973  Ptr<NeighbourRelation> neighbourRelation = m_rrc->m_neighbourRelationTable[it->second->m_cellId];
974  if ((neighbourRelation->m_noHo == false) &&
975  (neighbourRelation->m_noX2 == false))
976  {
977  bestNeighbour = it->second;
978  bestNeighbourRsrq = it->second->m_rsrq;
979  }
980  }
981  }
982 
983  // Trigger Handover, if needed
984  if (bestNeighbour)
985  {
986  uint16_t targetCellId = bestNeighbour->m_cellId;
987  NS_LOG_LOGIC ("Best neighbour cellId " << targetCellId);
988  if ( (bestNeighbour->m_rsrq - m_servingCellMeasures->m_rsrq >= m_rrc->m_neighbourCellHandoverOffset) &&
990  {
991  NS_LOG_LOGIC ("Trigger Handover to cellId " << targetCellId);
992  NS_LOG_LOGIC ("target cell RSRQ " << (uint16_t) bestNeighbour->m_rsrq);
993  NS_LOG_LOGIC ("serving cell RSRQ " << (uint16_t) m_servingCellMeasures->m_rsrq);
994  PrepareHandover (targetCellId);
995  }
996  }
997  }
998  }
1000  else if (msg.measResults.measId == 2)
1001  {
1002  // Update the NRT
1004  {
1005  for (std::list <LteRrcSap::MeasResultEutra>::iterator it = msg.measResults.measResultListEutra.begin ();
1006  it != msg.measResults.measResultListEutra.end ();
1007  ++it)
1008  {
1009  // Keep new RSRQ value reported for the neighbour cell
1010  NS_ASSERT_MSG (it->haveRsrqResult == true, "RSRQ measure missing for cellId " << it->physCellId);
1011 
1012  // Update Neighbour Relation Table
1013  if (m_rrc->m_neighbourRelationTable.find (it->physCellId) != m_rrc->m_neighbourRelationTable.end ())
1014  {
1015  // Update neighbour info
1016  Ptr<NeighbourRelation> neighbourRelation = m_rrc->m_neighbourRelationTable[it->physCellId];
1017  NS_ASSERT_MSG (neighbourRelation->m_physCellId == it->physCellId,
1018  "Wrong cellId " << neighbourRelation->m_physCellId);
1019 
1020  if (neighbourRelation->m_noX2 == false)
1021  {
1022  neighbourRelation->m_noHo = false;
1023  }
1024  neighbourRelation->m_detectedAsNeighbour = true;
1025  }
1026  else // new neighbour
1027  {
1028  Ptr<NeighbourRelation> neighbourRelation = CreateObject <NeighbourRelation> ();
1029  neighbourRelation->m_physCellId = it->physCellId;
1030  neighbourRelation->m_noRemove = false;
1031  neighbourRelation->m_noHo = true;
1032  neighbourRelation->m_noX2 = true;
1033  neighbourRelation->m_detectedAsNeighbour = true;
1034  m_rrc->m_neighbourRelationTable[it->physCellId] = neighbourRelation;
1035  }
1036 
1037  // Update measure info of the neighbour cell
1038  Ptr<UeMeasure> neighbourCellMeasures;
1039  if (m_neighbourCellMeasures.find (it->physCellId) != m_neighbourCellMeasures.end ())
1040  {
1041  neighbourCellMeasures = m_neighbourCellMeasures[it->physCellId];
1042  neighbourCellMeasures->m_cellId = it->physCellId;
1043  neighbourCellMeasures->m_rsrq = it->rsrqResult;
1044  neighbourCellMeasures->m_rsrp = 0;
1045  }
1046  else
1047  {
1048  neighbourCellMeasures = CreateObject <UeMeasure> ();
1049  neighbourCellMeasures->m_cellId = it->physCellId;
1050  neighbourCellMeasures->m_rsrq = it->rsrqResult;
1051  neighbourCellMeasures->m_rsrp = 0;
1052  m_neighbourCellMeasures[it->physCellId] = neighbourCellMeasures;
1053  }
1054  }
1055  }
1056  else
1057  {
1058  NS_LOG_LOGIC ("WARNING");
1059 // NS_ASSERT_MSG ("Event A4 received without measure results for neighbour cells");
1060  // TODO Remove neighbours in the neighbourCellMeasures table
1061  }
1062  }
1063 }
1064 
1065 
1066 // methods forwarded from CMAC SAP
1067 
1068 void
1070 {
1071  NS_LOG_FUNCTION (this << m_rnti);
1072  // at this stage used only by the scheduler for updating txMode
1073 
1075 
1077 
1078  // reconfigure the UE RRC
1080 }
1081 
1082 
1083 // methods forwarded from PDCP SAP
1084 
1085 void
1087 {
1088  NS_LOG_FUNCTION (this);
1089  if (params.lcid > 2)
1090  {
1091  // data radio bearer
1092  EpsBearerTag tag;
1093  tag.SetRnti (params.rnti);
1094  tag.SetBid (Lcid2Bid (params.lcid));
1095  params.pdcpSdu->AddPacketTag (tag);
1096  m_rrc->m_forwardUpCallback (params.pdcpSdu);
1097  }
1098 }
1099 
1100 
1101 uint16_t
1103 {
1104  return m_rnti;
1105 }
1106 
1107 uint64_t
1109 {
1110  return m_imsi;
1111 }
1112 
1113 uint16_t
1115 {
1117 }
1118 
1119 void
1121 {
1122  NS_LOG_FUNCTION (this);
1124  m_rrc->m_cphySapProvider->SetSrsConfigurationIndex (m_rnti, srsConfIndex);
1125  switch (m_state)
1126  {
1127  case INITIAL_RANDOM_ACCESS:
1128  // do nothing, srs conf index will be correctly enforced upon
1129  // RRC connection establishment
1130  break;
1131 
1132  default:
1134  break;
1135  }
1136 }
1137 
1140 {
1141  return m_state;
1142 }
1143 
1144 uint8_t
1146 {
1147  NS_LOG_FUNCTION (this);
1148  const uint8_t MAX_DRB_ID = 32;
1149  for (uint8_t drbid = (m_lastAllocatedDrbid + 1) % MAX_DRB_ID;
1150  drbid != m_lastAllocatedDrbid;
1151  drbid = (drbid + 1) % MAX_DRB_ID)
1152  {
1153  if (drbid != 0) // 0 is not allowed
1154  {
1155  if (m_drbMap.find (drbid) == m_drbMap.end ())
1156  {
1157  m_drbMap.insert (std::pair<uint8_t, Ptr<LteDataRadioBearerInfo> > (drbid, drbInfo));
1158  drbInfo->m_drbIdentity = drbid;
1159  m_lastAllocatedDrbid = drbid;
1160  return drbid;
1161  }
1162  }
1163  }
1164  NS_FATAL_ERROR ("no more data radio bearer ids available");
1165  return 0;
1166 }
1167 
1170 {
1171  NS_LOG_FUNCTION (this << (uint32_t) drbid);
1172  NS_ASSERT (0 != drbid);
1173  std::map<uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.find (drbid);
1174  NS_ABORT_IF (it == m_drbMap.end ());
1175  return it->second;
1176 }
1177 
1178 
1179 void
1181 {
1182  NS_LOG_FUNCTION (this << (uint32_t) drbid);
1183  std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.find (drbid);
1184  NS_ASSERT_MSG (it != m_drbMap.end (), "request to remove radio bearer with unknown drbid " << drbid);
1185  m_drbMap.erase (it);
1186 }
1187 
1188 
1191 {
1196  msg.haveMobilityControlInfo = false;
1197  msg.haveMeasConfig = true;
1198  msg.measConfig = BuildMeasConfig ();
1199 
1200  return msg;
1201 }
1202 
1205 {
1206  // Just intra-frequency measurements are supported,
1207  // so just one measurement object is created
1208  LteRrcSap::MeasObjectToAddMod measObject;
1209  measObject.measObjectId = 1;
1210  measObject.measObjectEutra.carrierFreq = m_rrc->m_dlEarfcn;
1211  measObject.measObjectEutra.allowedMeasBandwidth = m_rrc->m_dlBandwidth;
1212  measObject.measObjectEutra.presenceAntennaPort1 = false;
1213  measObject.measObjectEutra.neighCellConfig = 0;
1214  measObject.measObjectEutra.offsetFreq = 0;
1215  measObject.measObjectEutra.haveCellForWhichToReportCGI = false;
1216 
1217  // Just event A2 and event A4 are supported
1218  LteRrcSap::ReportConfigToAddMod reportConfigA2;
1219  reportConfigA2.reportConfigId = 1;
1223  reportConfigA2.reportConfigEutra.threshold1.range = m_rrc->m_eventA2Threshold;
1224  reportConfigA2.reportConfigEutra.hysteresis = 0;
1225  reportConfigA2.reportConfigEutra.timeToTrigger = 0;
1230  reportConfigA2.reportConfigEutra.reportAmount = 255;
1231 
1232  LteRrcSap::ReportConfigToAddMod reportConfigA4;
1233  reportConfigA4.reportConfigId = 2;
1237  reportConfigA4.reportConfigEutra.threshold1.range = m_rrc->m_eventA4Threshold;
1238  reportConfigA4.reportConfigEutra.hysteresis = 0;
1239  reportConfigA4.reportConfigEutra.timeToTrigger = 0;
1244  reportConfigA4.reportConfigEutra.reportAmount = 255;
1245 
1246  LteRrcSap::MeasIdToAddMod measId[2];
1247  measId[0].measId = 1;
1248  measId[0].measObjectId = 1;
1249  measId[0].reportConfigId = 1;
1250  measId[1].measId = 2;
1251  measId[1].measObjectId = 1;
1252  measId[1].reportConfigId = 2;
1253 
1254  LteRrcSap::MeasConfig measConfig;
1255  measConfig.measObjectToAddModList.push_back (measObject);
1256  measConfig.reportConfigToAddModList.push_back (reportConfigA2);
1257  measConfig.reportConfigToAddModList.push_back (reportConfigA4);
1258  measConfig.measIdToAddModList.push_back (measId[0]);
1259  measConfig.measIdToAddModList.push_back (measId[1]);
1260  measConfig.haveQuantityConfig = true;
1261  measConfig.quantityConfig.filterCoefficientRSRP = 4; // default = fc4 (See TS 36.331)
1262  measConfig.quantityConfig.filterCoefficientRSRQ = 4; // default = fc4 (See TS 36.331)
1263  measConfig.haveMeasGapConfig = false;
1264  measConfig.haveSmeasure = false;
1265  measConfig.haveSpeedStatePars = false;
1266 
1267  return measConfig;
1268 }
1269 
1272 {
1274 
1275  if (m_srb1 != 0)
1276  {
1278  stam.srbIdentity = m_srb1->m_srbIdentity;
1279  stam.logicalChannelConfig = m_srb1->m_logicalChannelConfig;
1280  rrcd.srbToAddModList.push_back (stam);
1281  }
1282 
1283  for (std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >::iterator it = m_drbMap.begin ();
1284  it != m_drbMap.end ();
1285  ++it)
1286  {
1288  dtam.epsBearerIdentity = it->second->m_epsBearerIdentity;
1289  dtam.drbIdentity = it->second->m_drbIdentity;
1290  dtam.rlcConfig = it->second->m_rlcConfig;
1291  dtam.logicalChannelIdentity = it->second->m_logicalChannelIdentity;
1292  dtam.logicalChannelConfig = it->second->m_logicalChannelConfig;
1293  rrcd.drbToAddModList.push_back (dtam);
1294  }
1295 
1296  rrcd.havePhysicalConfigDedicated = true;
1298  return rrcd;
1299 }
1300 
1301 uint8_t
1303 {
1305 }
1306 
1307 uint8_t
1309 {
1310  NS_ASSERT (lcid > 2);
1311  return lcid - 2;
1312 }
1313 
1314 uint8_t
1315 UeManager::Drbid2Lcid (uint8_t drbid)
1316 {
1317  return drbid + 2;
1318 }
1319 uint8_t
1320 UeManager::Lcid2Bid (uint8_t lcid)
1321 {
1322  NS_ASSERT (lcid > 2);
1323  return lcid - 2;
1324 }
1325 
1326 uint8_t
1327 UeManager::Bid2Lcid (uint8_t bid)
1328 {
1329  return bid + 2;
1330 }
1331 
1332 uint8_t
1333 UeManager::Drbid2Bid (uint8_t drbid)
1334 {
1335  return drbid;
1336 }
1337 
1338 uint8_t
1340 {
1341  return bid;
1342 }
1343 
1344 
1345 void
1347 {
1348  NS_LOG_FUNCTION (this << newState);
1349  State oldState = m_state;
1350  m_state = newState;
1351  NS_LOG_INFO ("IMSI " << m_imsi << " RNTI " << m_rnti << " UeManager " << ToString (oldState) << " --> " << ToString (newState));
1352  m_stateTransitionTrace (m_imsi, m_rrc->m_cellId, m_rnti, oldState, newState);
1353 
1354  switch (newState)
1355  {
1356  case INITIAL_RANDOM_ACCESS:
1357  case HANDOVER_JOINING:
1358  NS_FATAL_ERROR ("cannot switch to an initial state");
1359  break;
1360 
1361  case CONNECTION_SETUP:
1362  break;
1363 
1364  case CONNECTED_NORMALLY:
1365  {
1367  {
1369  }
1370  }
1371  break;
1372 
1374  break;
1375 
1377  break;
1378 
1379  case HANDOVER_LEAVING:
1380  break;
1381 
1382  default:
1383  break;
1384  }
1385 }
1386 
1387 
1388 
1389 // ///////////////////////////
1390 // eNB RRC methods
1391 // ///////////////////////////
1392 
1394 
1396  : m_x2SapProvider (0),
1397  m_cmacSapProvider (0),
1398  m_rrcSapUser (0),
1399  m_macSapProvider (0),
1400  m_s1SapProvider (0),
1401  m_cphySapProvider (0),
1402  m_configured (false),
1403  m_lastAllocatedRnti (0),
1404  m_srsCurrentPeriodicityId (0),
1405  m_lastAllocatedConfigurationIndex (0),
1406  m_reconfigureUes (false)
1407 {
1408  NS_LOG_FUNCTION (this);
1414 
1415 
1416 }
1417 
1418 
1420 {
1421  NS_LOG_FUNCTION (this);
1422 }
1423 
1424 
1425 void
1427 {
1428  NS_LOG_FUNCTION (this);
1429  m_ueMap.clear ();
1430  delete m_cmacSapUser;
1431  delete m_rrcSapProvider;
1432  delete m_x2SapUser;
1433  delete m_s1SapUser;
1434  delete m_cphySapUser;
1435 }
1436 
1437 TypeId
1439 {
1440  NS_LOG_FUNCTION ("LteEnbRrc::GetTypeId");
1441  static TypeId tid = TypeId ("ns3::LteEnbRrc")
1442  .SetParent<Object> ()
1443  .AddConstructor<LteEnbRrc> ()
1444  .AddAttribute ("UeMap", "List of UeManager by C-RNTI.",
1445  ObjectMapValue (),
1447  MakeObjectMapChecker<UeManager> ())
1448  .AddAttribute ("DefaultTransmissionMode",
1449  "The default UEs' transmission mode (0: SISO)",
1450  UintegerValue (0), // default tx-mode
1451  MakeUintegerAccessor (&LteEnbRrc::m_defaultTransmissionMode),
1452  MakeUintegerChecker<uint8_t> ())
1453  .AddAttribute ("EpsBearerToRlcMapping",
1454  "Specify which type of RLC will be used for each type of EPS bearer. ",
1457  MakeEnumChecker (RLC_SM_ALWAYS, "RlcSmAlways",
1458  RLC_UM_ALWAYS, "RlcUmAlways",
1459  RLC_AM_ALWAYS, "RlcAmAlways",
1460  PER_BASED, "PacketErrorRateBased"))
1461  .AddAttribute ("SystemInformationPeriodicity",
1462  "The interval for sending system information (Time value)",
1463  TimeValue (MilliSeconds (80)),
1464  MakeTimeAccessor (&LteEnbRrc::m_systemInformationPeriodicity),
1465  MakeTimeChecker ())
1466  .AddAttribute ("SrsPeriodicity",
1467  "The SRS periodicity in milliseconds",
1468  UintegerValue (40),
1469  MakeUintegerAccessor (&LteEnbRrc::SetSrsPeriodicity,
1471  MakeUintegerChecker<uint32_t> ())
1472  .AddAttribute ("ConnectionTimeoutDuration",
1473  "After a RA attempt, if no RRC Connection Request is received before this time, the UE context is destroyed. Must account for reception of RAR and transmission of RRC CONNECTION REQUEST over UL GRANT.",
1474  TimeValue (MilliSeconds (15)),
1475  MakeTimeAccessor (&LteEnbRrc::m_connectionTimeoutDuration),
1476  MakeTimeChecker ())
1477  .AddAttribute ("ConnectionRejectedTimeoutDuration",
1478  "Time to wait between sending a RRC CONNECTION REJECT and destroying the UE context",
1479  TimeValue (MilliSeconds (30)),
1481  MakeTimeChecker ())
1482  .AddAttribute ("HandoverJoiningTimeoutDuration",
1483  "After accepting a handover request, if no RRC Connection Reconfiguration Completed is received before this time, the UE context is destroyed. Must account for reception of X2 HO REQ ACK by source eNB, transmission of the Handover Command, non-contention-based random access and reception of the RRC Connection Reconfiguration Completed message.",
1484  TimeValue (MilliSeconds (200)),
1485  MakeTimeAccessor (&LteEnbRrc::m_handoverJoiningTimeoutDuration),
1486  MakeTimeChecker ())
1487  .AddAttribute ("HandoverLeavingTimeoutDuration",
1488  "After issuing a Handover Command, if neither RRC Connection Reestablishment nor X2 UE Context Release has been previously received, the UE context is destroyed.",
1489  TimeValue (MilliSeconds (500)),
1490  MakeTimeAccessor (&LteEnbRrc::m_handoverLeavingTimeoutDuration),
1491  MakeTimeChecker ())
1492  .AddAttribute ("AdmitHandoverRequest",
1493  "Whether to admit an X2 handover request from another eNB",
1494  BooleanValue (true),
1495  MakeBooleanAccessor (&LteEnbRrc::m_admitHandoverRequest),
1496  MakeBooleanChecker ())
1497  .AddAttribute ("AdmitRrcConnectionRequest",
1498  "Whether to admit a connection request from a Ue",
1499  BooleanValue (true),
1500  MakeBooleanAccessor (&LteEnbRrc::m_admitRrcConnectionRequest),
1501  MakeBooleanChecker ())
1502  .AddAttribute ("EventA2Threshold",
1503  "Threshold of the event A2 (Serving becomes worse than threshold)",
1504  UintegerValue (34),
1505  MakeUintegerAccessor (&LteEnbRrc::m_eventA2Threshold),
1506  MakeUintegerChecker<uint8_t> ())
1507  .AddAttribute ("EventA4Threshold",
1508  "Threshold of the event A4 (Neighbour becomes better than threshold)",
1509  UintegerValue (0),
1510  MakeUintegerAccessor (&LteEnbRrc::m_eventA4Threshold),
1511  MakeUintegerChecker<uint8_t> ())
1512  .AddAttribute ("ServingCellHandoverThreshold",
1513  "If serving cell is worse than this threshold, neighbour cells are consider for Handover",
1514  UintegerValue (15),
1515  MakeUintegerAccessor (&LteEnbRrc::m_servingCellHandoverThreshold),
1516  MakeUintegerChecker<uint8_t> ())
1517  .AddAttribute ("NeighbourCellHandoverOffset",
1518  "Minimum offset between serving and best neighbour cell to trigger the Handover",
1519  UintegerValue (1),
1520  MakeUintegerAccessor (&LteEnbRrc::m_neighbourCellHandoverOffset),
1521  MakeUintegerChecker<uint8_t> ())
1522  .AddTraceSource ("NewUeContext",
1523  "trace fired upon creation of a new UE context",
1525  .AddTraceSource ("ConnectionEstablished",
1526  "trace fired upon successful RRC connection establishment",
1528  .AddTraceSource ("ConnectionReconfiguration",
1529  "trace fired upon RRC connection reconfiguration",
1531  .AddTraceSource ("HandoverStart",
1532  "trace fired upon start of a handover procedure",
1534  .AddTraceSource ("HandoverEndOk",
1535  "trace fired upon successful termination of a handover procedure",
1537  .AddTraceSource ("RecvMeasurementReport",
1538  "trace fired when measurement report is received",
1540  ;
1541  return tid;
1542 }
1543 
1544 void
1546 {
1547  NS_LOG_FUNCTION (this << s);
1548  m_x2SapProvider = s;
1549 }
1550 
1551 EpcX2SapUser*
1553 {
1554  NS_LOG_FUNCTION (this);
1555  return m_x2SapUser;
1556 }
1557 
1558 void
1560 {
1561  NS_LOG_FUNCTION (this << s);
1562  m_cmacSapProvider = s;
1563 }
1564 
1567 {
1568  NS_LOG_FUNCTION (this);
1569  return m_cmacSapUser;
1570 }
1571 
1572 void
1574 {
1575  NS_LOG_FUNCTION (this << s);
1576  m_rrcSapUser = s;
1577 }
1578 
1581 {
1582  NS_LOG_FUNCTION (this);
1583  return m_rrcSapProvider;
1584 }
1585 
1586 void
1588 {
1589  NS_LOG_FUNCTION (this);
1590  m_macSapProvider = s;
1591 }
1592 
1593 void
1595 {
1596  m_s1SapProvider = s;
1597 }
1598 
1599 
1602 {
1603  return m_s1SapUser;
1604 }
1605 
1606 void
1608 {
1609  NS_LOG_FUNCTION (this << s);
1610  m_cphySapProvider = s;
1611 }
1612 
1615 {
1616  NS_LOG_FUNCTION (this);
1617  return m_cphySapUser;
1618 }
1619 
1622 {
1623  NS_LOG_FUNCTION (this << (uint32_t) rnti);
1624  NS_ASSERT (0 != rnti);
1625  std::map<uint16_t, Ptr<UeManager> >::iterator it = m_ueMap.find (rnti);
1626  NS_ASSERT_MSG (it != m_ueMap.end (), "RNTI " << rnti << " not found in eNB with cellId " << m_cellId);
1627  return it->second;
1628 }
1629 
1630 void
1631 LteEnbRrc::ConfigureCell (uint8_t ulBandwidth, uint8_t dlBandwidth, uint16_t ulEarfcn, uint16_t dlEarfcn, uint16_t cellId)
1632 {
1633  NS_LOG_FUNCTION (this);
1635  m_cmacSapProvider->ConfigureMac (ulBandwidth, dlBandwidth);
1636  m_cphySapProvider->SetBandwidth (ulBandwidth, dlBandwidth);
1637  m_cphySapProvider->SetEarfcn (ulEarfcn, dlEarfcn);
1638  m_dlEarfcn = dlEarfcn;
1639  m_ulEarfcn = ulEarfcn;
1640  m_dlBandwidth = dlBandwidth;
1641  m_ulBandwidth = ulBandwidth;
1642  m_cellId = cellId;
1643  m_cphySapProvider->SetCellId (cellId);
1645  mib.dlBandwidth = m_dlBandwidth;
1647  m_configured = true;
1648 
1649  // the first time System Information is sent
1650  Simulator::Schedule (MilliSeconds (16), &LteEnbRrc::SendSystemInformation, this);
1651 }
1652 
1653 
1654 void
1655 LteEnbRrc::SetCellId (uint16_t cellId)
1656 {
1657  m_cellId = cellId;
1658 }
1659 
1660 bool
1662 {
1663  NS_LOG_FUNCTION (this << packet);
1664 
1665  EpsBearerTag tag;
1666  bool found = packet->RemovePacketTag (tag);
1667  NS_ASSERT_MSG (found, "no EpsBearerTag found in packet to be sent");
1668  Ptr<UeManager> ueManager = GetUeManager (tag.GetRnti ());
1669  ueManager->SendData (tag.GetBid (), packet);
1670 
1671  return true;
1672 }
1673 
1674 void
1676 {
1677  m_forwardUpCallback = cb;
1678 }
1679 
1680 void
1682 {
1683  NS_LOG_FUNCTION (this << rnti);
1685  "ConnectionTimeout in unexpected state " << ToString (GetUeManager (rnti)->GetState ()));
1686  RemoveUe (rnti);
1687 }
1688 
1689 void
1691 {
1692  NS_LOG_FUNCTION (this << rnti);
1694  "ConnectionTimeout in unexpected state " << ToString (GetUeManager (rnti)->GetState ()));
1695  RemoveUe (rnti);
1696 }
1697 
1698 void
1700 {
1701  NS_LOG_FUNCTION (this << rnti);
1702  NS_ASSERT_MSG (GetUeManager (rnti)->GetState () == UeManager::HANDOVER_JOINING,
1703  "HandoverJoiningTimeout in unexpected state " << ToString (GetUeManager (rnti)->GetState ()));
1704  RemoveUe (rnti);
1705 }
1706 
1707 void
1709 {
1710  NS_LOG_FUNCTION (this << rnti);
1711  NS_ASSERT_MSG (GetUeManager (rnti)->GetState () == UeManager::HANDOVER_LEAVING,
1712  "HandoverLeavingTimeout in unexpected state " << ToString (GetUeManager (rnti)->GetState ()));
1713  RemoveUe (rnti);
1714 }
1715 
1716 void
1717 LteEnbRrc::SendHandoverRequest (uint16_t rnti, uint16_t cellId)
1718 {
1719  NS_LOG_FUNCTION (this << rnti << cellId);
1720  NS_LOG_LOGIC ("Request to send HANDOVER REQUEST");
1722 
1723  Ptr<UeManager> ueManager = GetUeManager (rnti);
1724  ueManager->PrepareHandover (cellId);
1725 
1726 }
1727 
1728 void
1730 {
1731  NS_LOG_FUNCTION (this << rnti);
1732  GetUeManager (rnti)->CompleteSetupUe (params);
1733 }
1734 
1735 void
1737 {
1738  NS_LOG_FUNCTION (this << rnti);
1739 
1740  GetUeManager (rnti)->RecvRrcConnectionRequest (msg);
1741 }
1742 
1743 void
1745 {
1746  NS_LOG_FUNCTION (this << rnti);
1747  GetUeManager (rnti)->RecvRrcConnectionSetupCompleted (msg);
1748 }
1749 
1750 void
1752 {
1753  NS_LOG_FUNCTION (this << rnti);
1754  GetUeManager (rnti)->RecvRrcConnectionReconfigurationCompleted (msg);
1755 }
1756 
1757 void
1759 {
1760  NS_LOG_FUNCTION (this << rnti);
1761  GetUeManager (rnti)->RecvRrcConnectionReestablishmentRequest (msg);
1762 }
1763 
1764 void
1766 {
1767  NS_LOG_FUNCTION (this << rnti);
1768  GetUeManager (rnti)->RecvRrcConnectionReestablishmentComplete (msg);
1769 }
1770 
1771 void
1773 {
1774  NS_LOG_FUNCTION (this << rnti);
1775  GetUeManager (rnti)->RecvMeasurementReport (msg);
1776 }
1777 
1778 void
1780 {
1781  Ptr<UeManager> ueManager = GetUeManager (request.rnti);
1782  ueManager->SetupDataRadioBearer (request.bearer, request.bearerId, request.gtpTeid, request.transportLayerAddress);
1783 }
1784 
1785 void
1787 {
1788  Ptr<UeManager> ueManager = GetUeManager (params.rnti);
1789  ueManager->SendUeContextRelease ();
1790 }
1791 
1792 void
1794 {
1795  NS_LOG_FUNCTION (this);
1796 
1797  NS_LOG_LOGIC ("Recv X2 message: HANDOVER REQUEST");
1798 
1799  NS_LOG_LOGIC ("oldEnbUeX2apId = " << req.oldEnbUeX2apId);
1800  NS_LOG_LOGIC ("sourceCellId = " << req.sourceCellId);
1801  NS_LOG_LOGIC ("targetCellId = " << req.targetCellId);
1802  NS_LOG_LOGIC ("mmeUeS1apId = " << req.mmeUeS1apId);
1803 
1804  NS_ASSERT (req.targetCellId == m_cellId);
1805 
1806  if (m_admitHandoverRequest == false)
1807  {
1808  NS_LOG_INFO ("rejecting handover request from cellId " << req.sourceCellId);
1810  res.oldEnbUeX2apId = req.oldEnbUeX2apId;
1811  res.sourceCellId = req.sourceCellId ;
1812  res.targetCellId = req.targetCellId ;
1813  res.cause = 0;
1814  res.criticalityDiagnostics = 0;
1816  return;
1817  }
1818 
1819  uint16_t rnti = AddUe (UeManager::HANDOVER_JOINING);
1821  if (anrcrv.valid == false)
1822  {
1823  NS_LOG_INFO (this << "failed to allocate a preamble for non-contention based RA => cannot accept HO");
1824  RemoveUe (rnti);
1825  NS_FATAL_ERROR ("should trigger HO Preparation Failure, but it is not implemented");
1826  return;
1827  }
1828 
1829  Ptr<UeManager> ueManager = GetUeManager (rnti);
1830  ueManager->SetSource (req.sourceCellId, req.oldEnbUeX2apId);
1831  ueManager->SetImsi (req.mmeUeS1apId);
1832 
1834  ackParams.oldEnbUeX2apId = req.oldEnbUeX2apId;
1835  ackParams.newEnbUeX2apId = rnti;
1836  ackParams.sourceCellId = req.sourceCellId;
1837  ackParams.targetCellId = req.targetCellId;
1838 
1839  for (std::vector <EpcX2Sap::ErabToBeSetupItem>::iterator it = req.bearers.begin ();
1840  it != req.bearers.end ();
1841  ++it)
1842  {
1843  ueManager->SetupDataRadioBearer (it->erabLevelQosParameters, it->erabId, it->gtpTeid, it->transportLayerAddress);
1845  i.erabId = it->erabId;
1846  ackParams.admittedBearers.push_back (i);
1847  }
1848 
1849  LteRrcSap::RrcConnectionReconfiguration handoverCommand = ueManager->GetRrcConnectionReconfigurationForHandover ();
1850  handoverCommand.haveMobilityControlInfo = true;
1851  handoverCommand.mobilityControlInfo.targetPhysCellId = m_cellId;
1852  handoverCommand.mobilityControlInfo.haveCarrierFreq = true;
1855  handoverCommand.mobilityControlInfo.haveCarrierBandwidth = true;
1858  handoverCommand.mobilityControlInfo.newUeIdentity = rnti;
1859  handoverCommand.mobilityControlInfo.haveRachConfigDedicated = true;
1862 
1867 
1868  Ptr<Packet> encodedHandoverCommand = m_rrcSapUser->EncodeHandoverCommand (handoverCommand);
1869 
1870  ackParams.rrcContext = encodedHandoverCommand;
1871 
1872  NS_LOG_LOGIC ("Send X2 message: HANDOVER REQUEST ACK");
1873 
1874  NS_LOG_LOGIC ("oldEnbUeX2apId = " << ackParams.oldEnbUeX2apId);
1875  NS_LOG_LOGIC ("newEnbUeX2apId = " << ackParams.newEnbUeX2apId);
1876  NS_LOG_LOGIC ("sourceCellId = " << ackParams.sourceCellId);
1877  NS_LOG_LOGIC ("targetCellId = " << ackParams.targetCellId);
1878 
1880 }
1881 
1882 void
1884 {
1885  NS_LOG_FUNCTION (this);
1886 
1887  NS_LOG_LOGIC ("Recv X2 message: HANDOVER REQUEST ACK");
1888 
1889  NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
1890  NS_LOG_LOGIC ("newEnbUeX2apId = " << params.newEnbUeX2apId);
1891  NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
1892  NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
1893 
1894  uint16_t rnti = params.oldEnbUeX2apId;
1895  Ptr<UeManager> ueManager = GetUeManager (rnti);
1896  ueManager->RecvHandoverRequestAck (params);
1897 }
1898 
1899 void
1901 {
1902  NS_LOG_FUNCTION (this);
1903 
1904  NS_LOG_LOGIC ("Recv X2 message: HANDOVER PREPARATION FAILURE");
1905 
1906  NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
1907  NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
1908  NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
1909  NS_LOG_LOGIC ("cause = " << params.cause);
1910  NS_LOG_LOGIC ("criticalityDiagnostics = " << params.criticalityDiagnostics);
1911 
1912  uint16_t rnti = params.oldEnbUeX2apId;
1913  Ptr<UeManager> ueManager = GetUeManager (rnti);
1914  ueManager->RecvHandoverPreparationFailure (params.targetCellId);
1915 }
1916 
1917 void
1919 {
1920  NS_LOG_FUNCTION (this);
1921 
1922  NS_LOG_LOGIC ("Recv X2 message: SN STATUS TRANSFER");
1923 
1924  NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
1925  NS_LOG_LOGIC ("newEnbUeX2apId = " << params.newEnbUeX2apId);
1926  NS_LOG_LOGIC ("erabsSubjectToStatusTransferList size = " << params.erabsSubjectToStatusTransferList.size ());
1927 
1928  uint16_t rnti = params.newEnbUeX2apId;
1929  Ptr<UeManager> ueManager = GetUeManager (rnti);
1930  ueManager->RecvSnStatusTransfer (params);
1931 }
1932 
1933 void
1935 {
1936  NS_LOG_FUNCTION (this);
1937 
1938  NS_LOG_LOGIC ("Recv X2 message: UE CONTEXT RELEASE");
1939 
1940  NS_LOG_LOGIC ("oldEnbUeX2apId = " << params.oldEnbUeX2apId);
1941  NS_LOG_LOGIC ("newEnbUeX2apId = " << params.newEnbUeX2apId);
1942 
1943  uint16_t rnti = params.oldEnbUeX2apId;
1944  GetUeManager (rnti)->RecvUeContextRelease (params);
1945  RemoveUe (rnti);
1946 }
1947 
1948 void
1950 {
1951  NS_LOG_FUNCTION (this);
1952 
1953  NS_LOG_LOGIC ("Recv X2 message: LOAD INFORMATION");
1954 
1955  NS_LOG_LOGIC ("Number of cellInformationItems = " << params.cellInformationList.size ());
1956 
1957  NS_ASSERT ("Processing of LOAD INFORMATION X2 message IS NOT IMPLEMENTED");
1958 }
1959 
1960 void
1962 {
1963  NS_LOG_FUNCTION (this);
1964 
1965  NS_LOG_LOGIC ("Recv X2 message: RESOURCE STATUS UPDATE");
1966 
1967  NS_LOG_LOGIC ("Number of cellMeasurementResultItems = " << params.cellMeasurementResultList.size ());
1968 
1969  NS_ASSERT ("Processing of RESOURCE STATUS UPDATE X2 message IS NOT IMPLEMENTED");
1970 }
1971 
1972 void
1974 {
1975  NS_LOG_FUNCTION (this);
1976 
1977  NS_LOG_LOGIC ("Recv UE DATA FORWARDING through X2 interface");
1978  NS_LOG_LOGIC ("sourceCellId = " << params.sourceCellId);
1979  NS_LOG_LOGIC ("targetCellId = " << params.targetCellId);
1980  NS_LOG_LOGIC ("gtpTeid = " << params.gtpTeid);
1981  NS_LOG_LOGIC ("ueData = " << params.ueData);
1982  NS_LOG_LOGIC ("ueData size = " << params.ueData->GetSize ());
1983 
1984  std::map<uint32_t, X2uTeidInfo>::iterator
1985  teidInfoIt = m_x2uTeidInfoMap.find (params.gtpTeid);
1986  if (teidInfoIt != m_x2uTeidInfoMap.end ())
1987  {
1988  GetUeManager (teidInfoIt->second.rnti)->SendData (teidInfoIt->second.drbid, params.ueData);
1989  }
1990  else
1991  {
1992  NS_FATAL_ERROR ("X2-U data received but no X2uTeidInfo found");
1993  }
1994 }
1995 
1996 
1997 uint16_t
1999 {
2000  NS_LOG_FUNCTION (this);
2002 }
2003 
2004 void
2006 {
2007  Ptr<UeManager> ueManager = GetUeManager (cmacParams.m_rnti);
2008  ueManager->CmacUeConfigUpdateInd (cmacParams);
2009 }
2010 
2011 void
2012 LteEnbRrc::DoNotifyLcConfigResult (uint16_t rnti, uint8_t lcid, bool success)
2013 {
2014  NS_LOG_FUNCTION (this << (uint32_t) rnti);
2015  NS_FATAL_ERROR ("not implemented");
2016 }
2017 
2018 
2019 
2020 uint16_t
2022 {
2023  NS_LOG_FUNCTION (this);
2024  bool found = false;
2025  uint16_t rnti;
2026  for (rnti = m_lastAllocatedRnti + 1;
2027  (rnti != m_lastAllocatedRnti - 1) && (!found);
2028  ++rnti)
2029  {
2030  if ((rnti != 0) && (m_ueMap.find (rnti) == m_ueMap.end ()))
2031  {
2032  found = true;
2033  break;
2034  }
2035  }
2036 
2037  NS_ASSERT_MSG (found, "no more RNTIs available (do you have more than 65535 UEs in a cell?)");
2038  m_lastAllocatedRnti = rnti;
2039  Ptr<UeManager> ueManager = CreateObject<UeManager> (this, rnti, state);
2040  m_ueMap.insert (std::pair<uint16_t, Ptr<UeManager> > (rnti, ueManager));
2041  ueManager->Initialize ();
2042  NS_LOG_DEBUG (this << " New UE RNTI " << rnti << " cellId " << m_cellId << " srs CI " << ueManager->GetSrsConfigurationIndex ());
2043  m_newUeContextTrace (m_cellId, rnti);
2044  return rnti;
2045 }
2046 
2047 void
2048 LteEnbRrc::RemoveUe (uint16_t rnti)
2049 {
2050  NS_LOG_FUNCTION (this << (uint32_t) rnti);
2051  std::map <uint16_t, Ptr<UeManager> >::iterator it = m_ueMap.find (rnti);
2052  NS_ASSERT_MSG (it != m_ueMap.end (), "request to remove UE info with unknown rnti " << rnti);
2053  uint16_t srsCi = (*it).second->GetSrsConfigurationIndex ();
2054  m_ueMap.erase (it);
2055  m_cmacSapProvider->RemoveUe (rnti);
2056  m_cphySapProvider->RemoveUe (rnti);
2057  if (m_s1SapProvider != 0)
2058  {
2060  }
2061  // need to do this after UeManager has been deleted
2062  RemoveSrsConfigurationIndex (srsCi);
2063  }
2064 
2065 TypeId
2067 {
2068  switch (m_epsBearerToRlcMapping)
2069  {
2070  case RLC_SM_ALWAYS:
2071  return LteRlcSm::GetTypeId ();
2072  break;
2073 
2074  case RLC_UM_ALWAYS:
2075  return LteRlcUm::GetTypeId ();
2076  break;
2077 
2078  case RLC_AM_ALWAYS:
2079  return LteRlcAm::GetTypeId ();
2080  break;
2081 
2082  case PER_BASED:
2083  if (bearer.GetPacketErrorLossRate () > 1.0e-5)
2084  {
2085  return LteRlcUm::GetTypeId ();
2086  }
2087  else
2088  {
2089  return LteRlcAm::GetTypeId ();
2090  }
2091  break;
2092 
2093  default:
2094  return LteRlcSm::GetTypeId ();
2095  break;
2096  }
2097 }
2098 
2099 
2100 void
2101 LteEnbRrc::AddX2Neighbour (uint16_t cellId)
2102 {
2103  NS_LOG_FUNCTION (cellId);
2105  "There is already an entry in the Neighbour Relation Table for cellId " << cellId);
2106 
2107  Ptr<NeighbourRelation> neighbourRelation = CreateObject <NeighbourRelation> ();
2108  neighbourRelation->m_physCellId = cellId;
2109  neighbourRelation->m_noRemove = true;
2110  neighbourRelation->m_noHo = true;
2111  neighbourRelation->m_noX2 = false;
2112  neighbourRelation->m_detectedAsNeighbour = false;
2113  m_neighbourRelationTable[cellId] = neighbourRelation;
2114 }
2115 
2116 
2117 // from 3GPP TS 36.213 table 8.2-1 UE Specific SRS Periodicity
2118 const uint8_t SRS_ENTRIES = 9;
2119 uint16_t g_srsPeriodicity[SRS_ENTRIES] = {0, 2, 5, 10, 20, 40, 80, 160, 320};
2120 uint16_t g_srsCiLow[SRS_ENTRIES] = {0, 0, 2, 7, 17, 37, 77, 157, 317};
2121 uint16_t g_srsCiHigh[SRS_ENTRIES] = {0, 1, 6, 16, 36, 76, 156, 316, 636};
2122 
2123 void
2125 {
2126  NS_LOG_FUNCTION (this << p);
2127  for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
2128  {
2129  if (g_srsPeriodicity[id] == p)
2130  {
2132  return;
2133  }
2134  }
2135  // no match found
2136  std::ostringstream allowedValues;
2137  for (uint32_t id = 1; id < SRS_ENTRIES; ++id)
2138  {
2139  allowedValues << g_srsPeriodicity[id] << " ";
2140  }
2141  NS_FATAL_ERROR ("illecit SRS periodicity value " << p << ". Allowed values: " << allowedValues.str ());
2142 }
2143 
2144 uint32_t
2146 {
2147  NS_LOG_FUNCTION (this);
2151 }
2152 
2153 
2154 uint16_t
2156 {
2158  // SRS
2161  NS_LOG_DEBUG (this << " SRS p " << g_srsPeriodicity[m_srsCurrentPeriodicityId] << " set " << m_ueSrsConfigurationIndexSet.size ());
2163  {
2164  NS_FATAL_ERROR ("too many UEs (" << m_ueSrsConfigurationIndexSet.size () + 1
2165  << ") for current SRS periodicity "
2167  << ", consider increasing the value of ns3::LteEnbRrc::SrsPeriodicity");
2168  }
2169 
2170  if (m_ueSrsConfigurationIndexSet.empty ())
2171  {
2172  // first entry
2175  }
2176  else
2177  {
2178  // find a CI from the available ones
2179  std::set<uint16_t>::reverse_iterator rit = m_ueSrsConfigurationIndexSet.rbegin ();
2180  NS_ASSERT (rit != m_ueSrsConfigurationIndexSet.rend ());
2181  NS_LOG_DEBUG (this << " lower bound " << (*rit) << " of " << g_srsCiHigh[m_srsCurrentPeriodicityId]);
2182  if ((*rit) < g_srsCiHigh[m_srsCurrentPeriodicityId])
2183  {
2184  // got it from the upper bound
2185  m_lastAllocatedConfigurationIndex = (*rit) + 1;
2187  }
2188  else
2189  {
2190  // look for released ones
2191  for (uint16_t srcCi = g_srsCiLow[m_srsCurrentPeriodicityId]; srcCi < g_srsCiHigh[m_srsCurrentPeriodicityId]; srcCi++)
2192  {
2193  std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find (srcCi);
2194  if (it==m_ueSrsConfigurationIndexSet.end ())
2195  {
2197  m_ueSrsConfigurationIndexSet.insert (srcCi);
2198  break;
2199  }
2200  }
2201  }
2202  }
2204 
2205 }
2206 
2207 
2208 void
2210 {
2211  NS_LOG_FUNCTION (this << srcCi);
2212  std::set<uint16_t>::iterator it = m_ueSrsConfigurationIndexSet.find (srcCi);
2213  NS_ASSERT_MSG (it != m_ueSrsConfigurationIndexSet.end (), "request to remove unkwown SRS CI " << srcCi);
2214  m_ueSrsConfigurationIndexSet.erase (it);
2215 }
2216 
2217 uint8_t
2219 {
2220  if (bearer.IsGbr ())
2221  {
2222  return 1;
2223  }
2224  else
2225  {
2226  return 2;
2227  }
2228 }
2229 
2230 uint8_t
2232 {
2233  return bearer.qci;
2234 }
2235 
2236 void
2238 {
2239 // NS_LOG_FUNCTION (this);
2240  // for simplicity, we use the same periodicity for all sibs
2241  // note that in real systems the periodicy of each sibs could be different
2243  si.haveSib2 = true;
2246 
2248  LteRrcSap::RachConfigCommon rachConfigCommon;
2250  rachConfigCommon.raSupervisionInfo.preambleTransMax = rc.preambleTransMax;
2252  si.sib2.radioResourceConfigCommon.rachConfigCommon = rachConfigCommon;
2253 
2256 }
2257 
2258 } // namespace ns3
2259 
enum ns3::LteRrcSap::ReportConfigEutra::@73 reportQuantity
Callback< void, Ptr< Packet > > m_forwardUpCallback
Definition: lte-enb-rrc.h:799
const uint8_t SRS_ENTRIES
virtual void SetMasterInformationBlock(LteRrcSap::MasterInformationBlock mib)=0
TracedCallback< uint64_t, uint16_t, uint16_t, State, State > m_stateTransitionTrace
Definition: lte-enb-rrc.h:429
TracedCallback< uint64_t, uint16_t, uint16_t > m_handoverEndOkTrace
Definition: lte-enb-rrc.h:876
SystemInformationBlockType2 sourceSystemInformationBlockType2
Definition: lte-rrc-sap.h:448
void SetEpcX2SapProvider(EpcX2SapProvider *s)
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
Ptr< LteSignalingRadioBearerInfo > m_srb1
Definition: lte-enb-rrc.h:418
void SendHandoverRequest(uint16_t rnti, uint16_t cellId)
uint16_t g_srsPeriodicity[SRS_ENTRIES]
void SendSystemInformation()
LteRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo()
Definition: lte-enb-rrc.cc:614
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:311
static const uint8_t MaxReportCells
Definition: lte-rrc-sap.h:59
uint16_t AddUe(UeManager::State state)
Ptr< const AttributeChecker > MakeEnumChecker(int v1, std::string n1, int v2, std::string n2, int v3, std::string n3, int v4, std::string n4, int v5, std::string n5, int v6, std::string n6, int v7, std::string n7, int v8, std::string n8, int v9, std::string n9, int v10, std::string n10, int v11, std::string n11, int v12, std::string n12, int v13, std::string n13, int v14, std::string n14, int v15, std::string n15, int v16, std::string n16, int v17, std::string n17, int v18, std::string n18, int v19, std::string n19, int v20, std::string n20, int v21, std::string n21, int v22, std::string n22)
Definition: enum.cc:178
Hold a bool native type.
Definition: boolean.h:38
Callback template class.
Definition: callback.h:920
void RecordDataRadioBearersToBeStarted()
Definition: lte-enb-rrc.cc:420
virtual void DoDispose()
Definition: lte-enb-rrc.cc:273
uint16_t m_dlBandwidth
Definition: lte-enb-rrc.h:822
void RecvUeContextRelease(EpcX2SapUser::UeContextReleaseParams params)
Definition: lte-enb-rrc.cc:757
void SetSource(uint16_t sourceCellId, uint16_t sourceX2apId)
Definition: lte-enb-rrc.cc:318
std::list< MeasObjectToAddMod > measObjectToAddModList
Definition: lte-rrc-sap.h:359
void RecvHandoverPreparationFailure(uint16_t cellId)
Definition: lte-enb-rrc.cc:720
NS_LOG_COMPONENT_DEFINE("LteEnbRrc")
void DoNotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
SoundingRsUlConfigDedicated soundingRsUlConfigDedicated
Definition: lte-rrc-sap.h:130
virtual void SetEarfcn(uint16_t ulEarfcn, uint16_t dlEarfcn)=0
static TypeId GetTypeId(void)
Definition: lte-rlc.cc:183
void SetCellId(uint16_t m_cellId)
uint8_t GetLogicalChannelGroup(EpsBearer bearer)
void AddX2Neighbour(uint16_t cellId)
QuantityConfig quantityConfig
Definition: lte-rrc-sap.h:365
uint8_t Drbid2Bid(uint8_t drbid)
enum ns3::LteRrcSap::ReportConfigEutra::@70 eventId
uint16_t txSn
TX sequence number.
Definition: lte-pdcp.h:97
bool m_admitHandoverRequest
Definition: lte-enb-rrc.h:850
std::vector< CellMeasurementResultItem > cellMeasurementResultList
Definition: epc-x2-sap.h:316
friend class EnbRrcMemberLteEnbCmacSapUser
Definition: lte-enb-rrc.h:456
std::list< MeasResultEutra > measResultListEutra
Definition: lte-rrc-sap.h:477
Parameters of the HANDOVER REQUEST message.
Definition: epc-x2-sap.h:225
enum ns3::LteRrcSap::ReportConfigEutra::@69 triggerType
void DoRecvRrcConnectionReconfigurationCompleted(uint16_t rnti, LteRrcSap::RrcConnectionReconfigurationCompleted msg)
void AddPacketTag(const Tag &tag) const
Definition: packet.cc:841
uint16_t GetRnti(void)
static TypeId GetTypeId(void)
uint16_t m_sourceCellId
Definition: lte-enb-rrc.h:431
virtual ~LteEnbRrc()
#define NS_ASSERT(condition)
Definition: assert.h:64
uint16_t m_rnti
Definition: lte-enb-rrc.h:420
std::list< SrbToAddMod > srbToAddModList
Definition: lte-rrc-sap.h:180
uint8_t Lcid2Bid(uint8_t lcid)
virtual void SendHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
EpcX2SapUser * GetEpcX2SapUser()
RadioResourceConfigDedicated radioResourceConfigDedicated
Definition: lte-rrc-sap.h:506
uint8_t m_eventA4Threshold
Definition: lte-enb-rrc.h:853
void SetLteEnbCphySapProvider(LteEnbCphySapProvider *s)
bool m_needTransmissionModeConfiguration
Definition: lte-enb-rrc.h:434
uint16_t m_lastAllocatedRnti
Definition: lte-enb-rrc.h:824
uint16_t GetNewSrsConfigurationIndex(void)
void SetTypeId(TypeId tid)
std::list< BearerToBeSwitched > bearersToBeSwitched
uint32_t GetSize(void) const
Definition: packet.h:650
LteEnbCmacSapUser * GetLteEnbCmacSapUser()
uint16_t m_ulBandwidth
Definition: lte-enb-rrc.h:823
uint8_t m_lastRrcTransactionIdentifier
Definition: lte-enb-rrc.h:422
uint16_t m_srsCurrentPeriodicityId
Definition: lte-enb-rrc.h:844
void SetLteEnbRrcSapUser(LteEnbRrcSapUser *s)
void SetLteEnbCmacSapProvider(LteEnbCmacSapProvider *s)
#define NS_LOG_INFO(msg)
Definition: log.h:264
uint16_t DoAllocateTemporaryCellRnti()
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberContainer)
Definition: object-map.h:51
uint64_t m_imsi
Definition: lte-enb-rrc.h:421
virtual uint16_t AllocateTemporaryCellRnti()
Definition: lte-enb-rrc.cc:80
uint8_t m_eventA2Threshold
Definition: lte-enb-rrc.h:852
Time m_handoverLeavingTimeoutDuration
Definition: lte-enb-rrc.h:861
void SetBid(uint8_t bid)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Definition: simulator.h:824
uint8_t GetBid(void) const
Time m_connectionRejectedTimeoutDuration
Definition: lte-enb-rrc.h:859
LteMacSapProvider * m_macSapProvider
Definition: lte-enb-rrc.h:810
LteEnbRrcSapProvider * m_rrcSapProvider
Definition: lte-enb-rrc.h:808
RachConfigDedicated rachConfigDedicated
Definition: lte-rrc-sap.h:402
uint16_t GetRnti(void) const
bool IsGbr() const
Definition: eps-bearer.cc:61
void RemoveSrsConfigurationIndex(uint16_t srcCi)
virtual void RrcConfigurationUpdateInd(UeConfig params)
Definition: lte-enb-rrc.cc:92
void SetImsi(uint64_t imsi)
Definition: lte-enb-rrc.cc:325
void SetLteMacSapProvider(LteMacSapProvider *s)
void SendUeContextRelease()
Definition: lte-enb-rrc.cc:697
LteRrcSap::RrcConnectionReconfiguration GetRrcConnectionReconfigurationForHandover()
Definition: lte-enb-rrc.cc:621
void SwitchToState(State s)
void RecvRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Definition: lte-enb-rrc.cc:838
void ReleaseDataRadioBearer(uint8_t drbid)
Definition: lte-enb-rrc.cc:452
double GetPacketErrorLossRate() const
Definition: eps-bearer.cc:144
uint8_t AddDataRadioBearerInfo(Ptr< LteDataRadioBearerInfo > radioBearerInfo)
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:72
EpcX2SapUser * m_x2SapUser
Definition: lte-enb-rrc.h:801
LteEnbRrcSapUser * m_rrcSapUser
Definition: lte-enb-rrc.h:807
uint16_t m_dlEarfcn
Definition: lte-enb-rrc.h:820
Ptr< LteEnbRrc > m_rrc
Definition: lte-enb-rrc.h:424
EpcEnbS1SapProvider * m_s1SapProvider
Definition: lte-enb-rrc.h:812
void SetForwardUpCallback(Callback< void, Ptr< Packet > > cb)
void DoRecvRrcConnectionSetupCompleted(uint16_t rnti, LteRrcSap::RrcConnectionSetupCompleted msg)
void DoRecvRrcConnectionReestablishmentComplete(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentComplete msg)
void DoCompleteSetupUe(uint16_t rnti, LteEnbRrcSapProvider::CompleteSetupUeParameters params)
SystemInformationBlockType1 sourceSystemInformationBlockType1
Definition: lte-rrc-sap.h:447
TracedCallback< uint16_t, uint16_t > m_newUeContextTrace
Definition: lte-enb-rrc.h:868
EventId m_connectionTimeout
Definition: lte-enb-rrc.h:436
LteEnbCmacSapUser * m_cmacSapUser
Definition: lte-enb-rrc.h:804
Ptr< UeManager > GetUeManager(uint16_t rnti)
bool m_admitRrcConnectionRequest
Definition: lte-enb-rrc.h:851
LtePdcpSapUser * m_drbPdcpSapUser
Definition: lte-enb-rrc.h:426
uint16_t GetSrsConfigurationIndex(void)
EventId m_connectionRejectedTimeout
Definition: lte-enb-rrc.h:437
virtual void UeContextRelease(uint16_t rnti)=0
hold variables of type 'enum'
Definition: enum.h:37
LteRrcSap::RrcConnectionReconfiguration BuildRrcConnectionReconfiguration()
Ptr< LteSignalingRadioBearerInfo > m_srb0
Definition: lte-enb-rrc.h:417
void DoRecvRrcConnectionRequest(uint16_t rnti, LteRrcSap::RrcConnectionRequest msg)
hold objects of type ns3::Time
Definition: nstime.h:828
uint16_t m_ulEarfcn
Definition: lte-enb-rrc.h:821
static TypeId GetTypeId(void)
Definition: lte-rlc-um.cc:55
void SetSrsConfigurationIndex(uint16_t srsConfIndex)
LogicalChannelConfig logicalChannelConfig
Definition: lte-rrc-sap.h:139
Ptr< Object > Create(void) const
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionEstablishedTrace
Definition: lte-enb-rrc.h:870
Parameters of the HANDOVER PREPARATION FAILURE message.
Definition: epc-x2-sap.h:259
Hold an unsigned integer type.
Definition: uinteger.h:46
Ptr< SampleEmitter > s
virtual void SetCellId(uint16_t cellId)=0
GbrQosInformation gbrQosInfo
Definition: eps-bearer.h:90
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
void DoPathSwitchRequestAcknowledge(EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters params)
virtual void SetBandwidth(uint8_t ulBandwidth, uint8_t dlBandwidth)=0
virtual void NotifyLcConfigResult(uint16_t rnti, uint8_t lcid, bool success)
Definition: lte-enb-rrc.cc:86
std::vector< ErabAdmittedItem > admittedBearers
Definition: epc-x2-sap.h:249
std::vector< CellInformationItem > cellInformationList
Definition: epc-x2-sap.h:303
std::list< MeasIdToAddMod > measIdToAddModList
Definition: lte-rrc-sap.h:363
Parameters of the SN STATUS TRANSFER message.
Definition: epc-x2-sap.h:273
PhysicalConfigDedicated physicalConfigDedicated
Definition: lte-rrc-sap.h:184
LteEnbCphySapProvider * m_cphySapProvider
Definition: lte-enb-rrc.h:816
uint8_t Drbid2Lcid(uint8_t drbid)
uint16_t rxSn
RX sequence number.
Definition: lte-pdcp.h:98
void SendData(uint8_t bid, Ptr< Packet > p)
Definition: lte-enb-rrc.cc:628
uint64_t GetImsi(void)
#define NS_LOG_LOGIC(msg)
Definition: log.h:334
virtual RachConfig GetRachConfig()=0
RadioResourceConfigDedicated radioResourceConfigDedicated
Definition: lte-rrc-sap.h:490
void DoRecvUeContextRelease(EpcX2SapUser::UeContextReleaseParams params)
#define NS_ABORT_IF(cond)
Abnormal program termination if cond is true.
Definition: abort.h:69
uint8_t m_lastAllocatedDrbid
Definition: lte-enb-rrc.h:419
uint8_t Bid2Lcid(uint8_t bid)
uint16_t m_sourceX2apId
Definition: lte-enb-rrc.h:430
Parameters for [re]configuring the UE.
std::map< uint32_t, X2uTeidInfo > m_x2uTeidInfoMap
Definition: lte-enb-rrc.h:835
TracedCallback< uint64_t, uint16_t, uint16_t, LteRrcSap::MeasurementReport > m_recvMeasurementReportTrace
Definition: lte-enb-rrc.h:879
virtual ~UeManager(void)
Definition: lte-enb-rrc.cc:268
const char * g_ueManagerStateName[UeManager::NUM_STATES]
Definition: lte-enb-rrc.cc:98
uint8_t m_servingCellHandoverThreshold
Definition: lte-enb-rrc.h:854
RadioResourceConfigDedicated sourceRadioResourceConfig
Definition: lte-rrc-sap.h:444
void SetupDataRadioBearer(EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress)
Definition: lte-enb-rrc.cc:331
void RemoveDataRadioBearerInfo(uint8_t drbid)
static TypeId GetTypeId(void)
Definition: lte-enb-rrc.cc:287
void RecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
Definition: lte-enb-rrc.cc:738
EpcX2SapProvider * m_x2SapProvider
Definition: lte-enb-rrc.h:802
Parameters of the RESOURCE STATUS UPDATE message.
Definition: epc-x2-sap.h:311
hold objects of type Ptr
Definition: pointer.h:33
void ConnectionTimeout(uint16_t rnti)
virtual void SendHandoverRequestAck(HandoverRequestAckParams params)=0
LteRrcSap::RadioResourceConfigDedicated BuildRadioResourceConfigDedicated()
enum ns3::EpsBearer::Qci qci
EventId m_handoverLeavingTimeout
Definition: lte-enb-rrc.h:439
std::map< uint16_t, Ptr< NeighbourRelation > > m_neighbourRelationTable
Definition: lte-enb-rrc.h:864
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Ptr< UeMeasure > m_servingCellMeasures
Definition: lte-enb-rrc.h:441
Parameters of the UE CONTEXT RELEASE message.
Definition: epc-x2-sap.h:287
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
Definition: epc-x2-sap.h:243
void RecvRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Definition: lte-enb-rrc.cc:820
RadioResourceConfigDedicated radioResourceConfigDedicated
Definition: lte-rrc-sap.h:524
std::list< uint8_t > m_drbsToBeStarted
Definition: lte-enb-rrc.h:433
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
TracedCallback< uint64_t, uint16_t, uint16_t, uint16_t > m_handoverStartTrace
Definition: lte-enb-rrc.h:874
uint16_t g_srsCiLow[SRS_ENTRIES]
std::vector< EpcX2Sap::ErabToBeSetupItem > GetErabList()
Definition: lte-enb-rrc.cc:677
void ScheduleRrcConnectionReconfiguration()
Definition: lte-enb-rrc.cc:478
Parameters for [re]configuring the UE.
Time m_systemInformationPeriodicity
Definition: lte-enb-rrc.h:841
LteEnbRrcSapProvider * GetLteEnbRrcSapProvider()
RadioResourceConfigCommonSib radioResourceConfigCommon
Definition: lte-rrc-sap.h:431
std::vector< ErabToBeSetupItem > bearers
Definition: epc-x2-sap.h:234
uint8_t m_defaultTransmissionMode
Definition: lte-enb-rrc.h:837
void DoRecvResourceStatusUpdate(EpcX2SapUser::ResourceStatusUpdateParams params)
void DoRecvUeData(EpcX2SapUser::UeDataParams params)
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition: enum.h:118
RadioResourceConfigCommon radioResourceConfigCommon
Definition: lte-rrc-sap.h:400
EnbRrcMemberLteEnbCmacSapUser(LteEnbRrc *rrc)
Definition: lte-enb-rrc.cc:74
enum ns3::LteRrcSap::ReportConfigEutra::@72 triggerQuantity
void PrepareHandover(uint16_t cellId)
Definition: lte-enb-rrc.cc:511
CarrierBandwidthEutra carrierBandwidth
Definition: lte-rrc-sap.h:398
void RecvRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Definition: lte-enb-rrc.cc:920
#define NS_ASSERT_MSG(condition, message)
Definition: assert.h:86
EpcEnbS1SapUser * m_s1SapUser
Definition: lte-enb-rrc.h:813
std::set< uint16_t > m_ueSrsConfigurationIndexSet
Definition: lte-enb-rrc.h:845
void SetSrsPeriodicity(uint32_t p)
virtual void DoDispose(void)
TypeId GetRlcType(EpsBearer bearer)
LogicalChannelConfig logicalChannelConfig
Definition: lte-rrc-sap.h:148
void HandoverJoiningTimeout(uint16_t rnti)
uint16_t g_srsCiHigh[SRS_ENTRIES]
instantiate subclasses of ns3::Object.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
std::string ToString(EpcUeNas::State s)
Definition: epc-ue-nas.cc:47
bool m_pendingRrcConnectionReconfiguration
Definition: lte-enb-rrc.h:427
std::vector< ErabNotAdmittedItem > notAdmittedBearers
Definition: epc-x2-sap.h:250
void DoRrcConfigurationUpdateInd(LteEnbCmacSapUser::UeConfig params)
virtual void ConfigureMac(uint8_t ulBandwidth, uint8_t dlBandwidth)=0
void DoRecvHandoverPreparationFailure(EpcX2SapUser::HandoverPreparationFailureParams params)
#define NS_LOG_WARN(msg)
Definition: log.h:246
void StartDataRadioBearers()
Definition: lte-enb-rrc.cc:432
enum ns3::LteRrcSap::ThresholdEutra::@68 choice
virtual AllocateNcRaPreambleReturnValue AllocateNcRaPreamble(uint16_t rnti)=0
EpcEnbS1SapUser * GetS1SapUser()
std::list< DrbToAddMod > drbToAddModList
Definition: lte-rrc-sap.h:181
void RecvRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Definition: lte-enb-rrc.cc:895
bool RemovePacketTag(Tag &tag)
Definition: packet.cc:848
LteEnbCmacSapProvider * m_cmacSapProvider
Definition: lte-enb-rrc.h:805
LteRrcSap::PhysicalConfigDedicated m_physicalConfigDedicated
Definition: lte-enb-rrc.h:423
std::map< uint16_t, Ptr< UeManager > > m_ueMap
Definition: lte-enb-rrc.h:826
#define NS_LOG_DEBUG(msg)
Definition: log.h:255
Parameters of the LOAD INFORMATION message.
Definition: epc-x2-sap.h:300
virtual Ptr< Packet > EncodeHandoverCommand(RrcConnectionReconfiguration msg)=0
void RecvRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
Definition: lte-enb-rrc.cc:776
void SetRnti(uint16_t tid)
enum ns3::LteRrcSap::ReportConfigEutra::@74 reportInterval
LteRrcSap::MeasConfig BuildMeasConfig()
SystemInformationBlockType2 sib2
Definition: lte-rrc-sap.h:438
void Cancel(void)
Definition: event-id.cc:47
std::map< uint8_t, Ptr< LteDataRadioBearerInfo > > m_drbMap
Definition: lte-enb-rrc.h:416
TracedCallback< uint64_t, uint16_t, uint16_t > m_connectionReconfigurationTrace
Definition: lte-enb-rrc.h:872
uint8_t GetLogicalChannelPriority(EpsBearer bearer)
bool valid
true if a valid RA config was allocated, false otherwise
uint8_t GetNewRrcTransactionIdentifier()
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. Both limits are inclusive.
Definition: time.cc:404
void DoRecvSnStatusTransfer(EpcX2SapUser::SnStatusTransferParams params)
LteEnbCphySapUser * GetLteEnbCphySapUser()
void ConnectionRejectedTimeout(uint16_t rnti)
uint32_t GetSrsPeriodicity() const
Ptr< LteDataRadioBearerInfo > GetDataRadioBearerInfo(uint8_t drbid)
uint8_t m_neighbourCellHandoverOffset
Definition: lte-enb-rrc.h:855
Time m_handoverJoiningTimeoutDuration
Definition: lte-enb-rrc.h:860
uint16_t m_lastAllocatedConfigurationIndex
Definition: lte-enb-rrc.h:846
virtual void SendSystemInformation(SystemInformation msg)=0
virtual void RemoveUe(uint16_t rnti)=0
void HandoverLeavingTimeout(uint16_t rnti)
a base class which provides memory management and object aggregation
Definition: object.h:63
contain a set of ns3::Object pointers.
void ConfigureCell(uint8_t ulBandwidth, uint8_t dlBandwidth, uint16_t ulEarfcn, uint16_t dlEarfcn, uint16_t cellId)
void DoRecvRrcConnectionReestablishmentRequest(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentRequest msg)
enum ns3::LteRrcSap::SoundingRsUlConfigDedicated::@67 type
void RemoveUe(uint16_t rnti)
void DoRecvMeasurementReport(uint16_t rnti, LteRrcSap::MeasurementReport msg)
void CmacUeConfigUpdateInd(LteEnbCmacSapUser::UeConfig cmacParams)
Parameters of the UE DATA primitive.
Definition: epc-x2-sap.h:325
enum LteEpsBearerToRlcMapping_t m_epsBearerToRlcMapping
Definition: lte-enb-rrc.h:839
Ptr< T > GetObject(void) const
Definition: object.h:360
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
Definition: epc-x2-sap.h:279
void RecvMeasurementReport(LteRrcSap::MeasurementReport msg)
Definition: lte-enb-rrc.cc:927
a unique identifier for an interface.
Definition: type-id.h:49
uint16_t m_targetCellId
Definition: lte-enb-rrc.h:432
std::list< ReportConfigToAddMod > reportConfigToAddModList
Definition: lte-rrc-sap.h:361
TypeId SetParent(TypeId tid)
Definition: type-id.cc:610
uint8_t Bid2Drbid(uint8_t bid)
static TypeId GetTypeId(void)
Definition: lte-rlc-am.cc:86
void SetS1SapProvider(EpcEnbS1SapProvider *s)
uint8_t Lcid2Drbid(uint8_t lcid)
virtual void RemoveUe(uint16_t rnti)=0
LteEnbCphySapUser * m_cphySapUser
Definition: lte-enb-rrc.h:815
void DoDataRadioBearerSetupRequest(EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params)
void DoRecvLoadInformation(EpcX2SapUser::LoadInformationParams params)
RaSupervisionInfo raSupervisionInfo
Definition: lte-rrc-sap.h:165
void RecvHandoverRequestAck(EpcX2SapUser::HandoverRequestAckParams params)
Definition: lte-enb-rrc.cc:567
bool SendData(Ptr< Packet > p)
EventId m_handoverJoiningTimeout
Definition: lte-enb-rrc.h:438
Time m_connectionTimeoutDuration
Definition: lte-enb-rrc.h:858
void CompleteSetupUe(LteEnbRrcSapProvider::CompleteSetupUeParameters params)
Definition: lte-enb-rrc.cc:768
uint16_t m_cellId
Definition: lte-enb-rrc.h:819
virtual void DoInitialize()
Definition: lte-enb-rrc.cc:149
MasterInformationBlock sourceMasterInformationBlock
Definition: lte-rrc-sap.h:446
std::map< uint16_t, Ptr< UeMeasure > > m_neighbourCellMeasures
Definition: lte-enb-rrc.h:443
void DoRecvHandoverRequestAck(EpcX2SapUser::HandoverRequestAckParams params)
void DoRecvHandoverRequest(EpcX2SapUser::HandoverRequestParams params)