A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-rrc-protocol-real.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Nicola Baldo <nbaldo@cttc.es>
7 * Lluis Parcerisa <lparcerisa@cttc.cat>
8 */
9
11
12#include "lte-enb-net-device.h"
13#include "lte-enb-rrc.h"
14#include "lte-rrc-header.h"
15#include "lte-ue-net-device.h"
16#include "lte-ue-rrc.h"
17
18#include <ns3/fatal-error.h>
19#include <ns3/log.h>
20#include <ns3/node-list.h>
21#include <ns3/node.h>
22#include <ns3/nstime.h>
23#include <ns3/simulator.h>
24
25namespace ns3
26{
27
28NS_LOG_COMPONENT_DEFINE("LteRrcProtocolReal");
29
30/// RRC real message delay
32
34
45
49
50void
59
62{
63 static TypeId tid = TypeId("ns3::LteUeRrcProtocolReal")
65 .SetGroupName("Lte")
66 .AddConstructor<LteUeRrcProtocolReal>();
67 return tid;
68}
69
70void
75
81
82void
87
88void
97
98void
100{
101 // initialize the RNTI and get the EnbLteRrcSapProvider for the
102 // eNB we are currently attached to
103 m_rnti = m_rrc->GetRnti();
105
106 Ptr<Packet> packet = Create<Packet>();
107
108 RrcConnectionRequestHeader rrcConnectionRequestHeader;
109 rrcConnectionRequestHeader.SetMessage(msg);
110
111 packet->AddHeader(rrcConnectionRequestHeader);
112
113 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
114 transmitPdcpPduParameters.pdcpPdu = packet;
115 transmitPdcpPduParameters.rnti = m_rnti;
116 transmitPdcpPduParameters.lcid = 0;
117
118 m_setupParameters.srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
119}
120
121void
124{
125 Ptr<Packet> packet = Create<Packet>();
126
127 RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
128 rrcConnectionSetupCompleteHeader.SetMessage(msg);
129
130 packet->AddHeader(rrcConnectionSetupCompleteHeader);
131
132 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
133 transmitPdcpSduParameters.pdcpSdu = packet;
134 transmitPdcpSduParameters.rnti = m_rnti;
135 transmitPdcpSduParameters.lcid = 1;
136
138 {
139 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
140 }
141}
142
143void
146{
147 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
148 // eNB we are currently attached to
149 m_rnti = m_rrc->GetRnti();
151
152 Ptr<Packet> packet = Create<Packet>();
153
154 RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
155 rrcConnectionReconfigurationCompleteHeader.SetMessage(msg);
156
157 packet->AddHeader(rrcConnectionReconfigurationCompleteHeader);
158
159 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
160 transmitPdcpSduParameters.pdcpSdu = packet;
161 transmitPdcpSduParameters.rnti = m_rnti;
162 transmitPdcpSduParameters.lcid = 1;
163
164 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
165}
166
167void
169{
170 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
171 // eNB we are currently attached to
172 m_rnti = m_rrc->GetRnti();
174
175 Ptr<Packet> packet = Create<Packet>();
176
177 MeasurementReportHeader measurementReportHeader;
178 measurementReportHeader.SetMessage(msg);
179
180 packet->AddHeader(measurementReportHeader);
181
182 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
183 transmitPdcpSduParameters.pdcpSdu = packet;
184 transmitPdcpSduParameters.rnti = m_rnti;
185 transmitPdcpSduParameters.lcid = 1;
186
187 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
188}
189
190void
192{
193 NS_LOG_FUNCTION(this << rnti);
194 uint16_t cellId = m_rrc->GetCellId();
195 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
196 // eNB we are currently attached to or attempting random access to
197 // a target eNB
198 m_rnti = m_rrc->GetRnti();
199
200 NS_LOG_DEBUG("RNTI " << rnti << " sending UE context remove request to cell id " << cellId);
201 NS_ABORT_MSG_IF(m_rnti != rnti, "RNTI mismatch");
202
203 SetEnbRrcSapProvider(); // the provider has to be reset since the cell might
204 // have changed due to handover
205 // ideally informing eNB
209 rnti);
210}
211
212void
215{
216 Ptr<Packet> packet = Create<Packet>();
217
218 RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
219 rrcConnectionReestablishmentRequestHeader.SetMessage(msg);
220
221 packet->AddHeader(rrcConnectionReestablishmentRequestHeader);
222
223 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
224 transmitPdcpPduParameters.pdcpPdu = packet;
225 transmitPdcpPduParameters.rnti = m_rnti;
226 transmitPdcpPduParameters.lcid = 0;
227
228 m_setupParameters.srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
229}
230
231void
234{
235 Ptr<Packet> packet = Create<Packet>();
236
237 RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
238 rrcConnectionReestablishmentCompleteHeader.SetMessage(msg);
239
240 packet->AddHeader(rrcConnectionReestablishmentCompleteHeader);
241
242 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
243 transmitPdcpSduParameters.pdcpSdu = packet;
244 transmitPdcpSduParameters.rnti = m_rnti;
245 transmitPdcpSduParameters.lcid = 1;
246
247 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
248}
249
250void
252{
253 NS_LOG_FUNCTION(this);
254
255 uint16_t cellId = m_rrc->GetCellId();
256
257 NS_LOG_DEBUG("RNTI " << m_rnti << " connected to cell " << cellId);
258
259 // walk list of all nodes to get the peer eNB
261 auto listEnd = NodeList::End();
262 bool found = false;
263 for (auto i = NodeList::Begin(); (i != listEnd) && (!found); ++i)
264 {
265 Ptr<Node> node = *i;
266 int nDevs = node->GetNDevices();
267 for (int j = 0; (j < nDevs) && (!found); j++)
268 {
269 enbDev = node->GetDevice(j)->GetObject<LteEnbNetDevice>();
270 if (!enbDev)
271 {
272 continue;
273 }
274 else
275 {
276 if (enbDev->HasCellId(cellId))
277 {
278 found = true;
279 break;
280 }
281 }
282 }
283 }
284 NS_ASSERT_MSG(found, " Unable to find eNB with CellId =" << cellId);
285 m_enbRrcSapProvider = enbDev->GetRrc()->GetLteEnbRrcSapProvider();
286 Ptr<LteEnbRrcProtocolReal> enbRrcProtocolReal =
287 enbDev->GetRrc()->GetObject<LteEnbRrcProtocolReal>();
288 enbRrcProtocolReal->SetUeRrcSapProvider(m_rnti, m_ueRrcSapProvider);
289}
290
291void
293{
294 // Get type of message received
295 RrcDlCcchMessage rrcDlCcchMessage;
296 p->PeekHeader(rrcDlCcchMessage);
297
298 // Declare possible headers to receive
299 RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
300 RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
301 RrcConnectionSetupHeader rrcConnectionSetupHeader;
302 RrcConnectionRejectHeader rrcConnectionRejectHeader;
303
304 // Declare possible messages
305 LteRrcSap::RrcConnectionReestablishment rrcConnectionReestablishmentMsg;
306 LteRrcSap::RrcConnectionReestablishmentReject rrcConnectionReestablishmentRejectMsg;
307 LteRrcSap::RrcConnectionSetup rrcConnectionSetupMsg;
308 LteRrcSap::RrcConnectionReject rrcConnectionRejectMsg;
309
310 // Deserialize packet and call member recv function with appropriate structure
311 switch (rrcDlCcchMessage.GetMessageType())
312 {
313 case 0:
314 // RrcConnectionReestablishment
315 p->RemoveHeader(rrcConnectionReestablishmentHeader);
316 rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.GetMessage();
317 m_ueRrcSapProvider->RecvRrcConnectionReestablishment(rrcConnectionReestablishmentMsg);
318 break;
319 case 1:
320 // RrcConnectionReestablishmentReject
321 p->RemoveHeader(rrcConnectionReestablishmentRejectHeader);
322 rrcConnectionReestablishmentRejectMsg =
323 rrcConnectionReestablishmentRejectHeader.GetMessage();
324 // m_ueRrcSapProvider->RecvRrcConnectionReestablishmentReject
325 // (rrcConnectionReestablishmentRejectMsg);
326 break;
327 case 2:
328 // RrcConnectionReject
329 p->RemoveHeader(rrcConnectionRejectHeader);
330 rrcConnectionRejectMsg = rrcConnectionRejectHeader.GetMessage();
331 m_ueRrcSapProvider->RecvRrcConnectionReject(rrcConnectionRejectMsg);
332 break;
333 case 3:
334 // RrcConnectionSetup
335 p->RemoveHeader(rrcConnectionSetupHeader);
336 rrcConnectionSetupMsg = rrcConnectionSetupHeader.GetMessage();
337 m_ueRrcSapProvider->RecvRrcConnectionSetup(rrcConnectionSetupMsg);
338 break;
339 }
340}
341
342void
344{
345 // Get type of message received
346 RrcDlDcchMessage rrcDlDcchMessage;
347 params.pdcpSdu->PeekHeader(rrcDlDcchMessage);
348
349 // Declare possible headers to receive
350 RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
351 RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
352
353 // Declare possible messages to receive
354 LteRrcSap::RrcConnectionReconfiguration rrcConnectionReconfigurationMsg;
355 LteRrcSap::RrcConnectionRelease rrcConnectionReleaseMsg;
356
357 // Deserialize packet and call member recv function with appropriate structure
358 switch (rrcDlDcchMessage.GetMessageType())
359 {
360 case 4:
361 params.pdcpSdu->RemoveHeader(rrcConnectionReconfigurationHeader);
362 rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.GetMessage();
363 m_ueRrcSapProvider->RecvRrcConnectionReconfiguration(rrcConnectionReconfigurationMsg);
364 break;
365 case 5:
366 params.pdcpSdu->RemoveHeader(rrcConnectionReleaseHeader);
367 rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.GetMessage();
368 // m_ueRrcSapProvider->RecvRrcConnectionRelease (rrcConnectionReleaseMsg);
369 break;
370 }
371}
372
374
381
386
387void
389{
390 NS_LOG_FUNCTION(this);
391 delete m_enbRrcSapUser;
392 for (auto it = m_completeSetupUeParametersMap.begin();
394 ++it)
395 {
396 delete it->second.srb0SapUser;
397 delete it->second.srb1SapUser;
398 }
400}
401
402TypeId
404{
405 static TypeId tid = TypeId("ns3::LteEnbRrcProtocolReal")
406 .SetParent<Object>()
407 .SetGroupName("Lte")
408 .AddConstructor<LteEnbRrcProtocolReal>();
409 return tid;
410}
411
412void
417
423
424void
426{
427 m_cellId = cellId;
428}
429
432{
433 auto it = m_enbRrcSapProviderMap.find(rnti);
434 NS_ASSERT_MSG(it != m_enbRrcSapProviderMap.end(), "could not find RNTI = " << rnti);
435 return it->second;
436}
437
438void
440{
441 auto it = m_enbRrcSapProviderMap.find(rnti);
442 // assign UE RRC only if the RNTI is found at eNB
443 if (it != m_enbRrcSapProviderMap.end())
444 {
445 it->second = p;
446 }
447}
448
449void
451{
452 NS_LOG_FUNCTION(this << rnti);
453
454 // // walk list of all nodes to get the peer UE RRC SAP Provider
455 // Ptr<LteUeRrc> ueRrc;
456 // NodeList::Iterator listEnd = NodeList::End ();
457 // bool found = false;
458 // for (NodeList::Iterator i = NodeList::Begin (); (i != listEnd) && (found == false); i++)
459 // {
460 // Ptr<Node> node = *i;
461 // int nDevs = node->GetNDevices ();
462 // for (int j = 0; j < nDevs; j++)
463 // {
464 // Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
465 // if (!ueDev)
466 // {
467 // continue;
468 // }
469 // else
470 // {
471 // ueRrc = ueDev->GetRrc ();
472 // if ((ueRrc->GetRnti () == rnti) && (ueRrc->GetCellId () == m_cellId))
473 // {
474 // found = true;
475 // break;
476 // }
477 // }
478 // }
479 // }
480 // NS_ASSERT_MSG (found , " Unable to find UE with RNTI=" << rnti << " cellId=" << m_cellId);
481 // m_enbRrcSapProviderMap[rnti] = ueRrc->GetLteUeRrcSapProvider ();
482
483 // just create empty entry, the UeRrcSapProvider will be set by the
484 // ue upon connection request or connection reconfiguration
485 // completed
486 m_enbRrcSapProviderMap[rnti] = nullptr;
487
488 // Store SetupUeParameters
489 m_setupUeParametersMap[rnti] = params;
490
491 LteEnbRrcSapProvider::CompleteSetupUeParameters completeSetupUeParameters;
492 auto csupIt = m_completeSetupUeParametersMap.find(rnti);
493 if (csupIt == m_completeSetupUeParametersMap.end())
494 {
495 // Create LteRlcSapUser, LtePdcpSapUser
496 LteRlcSapUser* srb0SapUser = new RealProtocolRlcSapUser(this, rnti);
497 LtePdcpSapUser* srb1SapUser =
499 completeSetupUeParameters.srb0SapUser = srb0SapUser;
500 completeSetupUeParameters.srb1SapUser = srb1SapUser;
501 // Store LteRlcSapUser, LtePdcpSapUser
502 m_completeSetupUeParametersMap[rnti] = completeSetupUeParameters;
503 }
504 else
505 {
506 completeSetupUeParameters = csupIt->second;
507 }
508 m_enbRrcSapProvider->CompleteSetupUe(rnti, completeSetupUeParameters);
509}
510
511void
513{
514 NS_LOG_FUNCTION(this << rnti);
515 auto it = m_completeSetupUeParametersMap.find(rnti);
517 delete it->second.srb0SapUser;
518 delete it->second.srb1SapUser;
520 m_enbRrcSapProviderMap.erase(rnti);
521 m_setupUeParametersMap.erase(rnti);
522}
523
524void
526{
527 NS_LOG_FUNCTION(this << cellId);
528 // walk list of all nodes to get UEs with this cellId
529 Ptr<LteUeRrc> ueRrc;
530 for (auto i = NodeList::Begin(); i != NodeList::End(); ++i)
531 {
532 Ptr<Node> node = *i;
533 int nDevs = node->GetNDevices();
534 for (int j = 0; j < nDevs; ++j)
535 {
536 Ptr<LteUeNetDevice> ueDev = node->GetDevice(j)->GetObject<LteUeNetDevice>();
537 if (ueDev)
538 {
539 Ptr<LteUeRrc> ueRrc = ueDev->GetRrc();
540 NS_LOG_LOGIC("considering UE IMSI " << ueDev->GetImsi() << " that has cellId "
541 << ueRrc->GetCellId());
542 if (ueRrc->GetCellId() == cellId)
543 {
544 NS_LOG_LOGIC("sending SI to IMSI " << ueDev->GetImsi());
545
546 Simulator::ScheduleWithContext(node->GetId(),
549 ueRrc->GetLteUeRrcSapProvider(),
550 msg);
551 }
552 }
553 }
554 }
555}
556
557void
559{
560 Ptr<Packet> packet = Create<Packet>();
561
562 RrcConnectionSetupHeader rrcConnectionSetupHeader;
563 rrcConnectionSetupHeader.SetMessage(msg);
564
565 packet->AddHeader(rrcConnectionSetupHeader);
566
567 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
568 transmitPdcpPduParameters.pdcpPdu = packet;
569 transmitPdcpPduParameters.rnti = rnti;
570 transmitPdcpPduParameters.lcid = 0;
571
572 m_setupUeParametersMap.at(rnti).srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
573}
574
575void
577{
578 Ptr<Packet> packet = Create<Packet>();
579
580 RrcConnectionRejectHeader rrcConnectionRejectHeader;
581 rrcConnectionRejectHeader.SetMessage(msg);
582
583 packet->AddHeader(rrcConnectionRejectHeader);
584
585 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
586 transmitPdcpPduParameters.pdcpPdu = packet;
587 transmitPdcpPduParameters.rnti = rnti;
588 transmitPdcpPduParameters.lcid = 0;
589
590 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
591}
592
593void
595 uint16_t rnti,
597{
598 Ptr<Packet> packet = Create<Packet>();
599
600 RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
601 rrcConnectionReconfigurationHeader.SetMessage(msg);
602
603 packet->AddHeader(rrcConnectionReconfigurationHeader);
604
605 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
606 transmitPdcpSduParameters.pdcpSdu = packet;
607 transmitPdcpSduParameters.rnti = rnti;
608 transmitPdcpSduParameters.lcid = 1;
609
610 m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
611}
612
613void
615 uint16_t rnti,
617{
618 Ptr<Packet> packet = Create<Packet>();
619
620 RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
621 rrcConnectionReestablishmentHeader.SetMessage(msg);
622
623 packet->AddHeader(rrcConnectionReestablishmentHeader);
624
625 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
626 transmitPdcpPduParameters.pdcpPdu = packet;
627 transmitPdcpPduParameters.rnti = rnti;
628 transmitPdcpPduParameters.lcid = 0;
629
630 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
631}
632
633void
635 uint16_t rnti,
637{
638 Ptr<Packet> packet = Create<Packet>();
639
640 RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
641 rrcConnectionReestablishmentRejectHeader.SetMessage(msg);
642
643 packet->AddHeader(rrcConnectionReestablishmentRejectHeader);
644
645 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
646 transmitPdcpPduParameters.pdcpPdu = packet;
647 transmitPdcpPduParameters.rnti = rnti;
648 transmitPdcpPduParameters.lcid = 0;
649
650 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
651}
652
653void
656{
657 // The code below is commented so RRC connection release can be sent in an ideal way
658 /*
659 Ptr<Packet> packet = Create<Packet> ();
660
661 RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
662 rrcConnectionReleaseHeader.SetMessage (msg);
663
664 packet->AddHeader (rrcConnectionReleaseHeader);
665
666 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
667 transmitPdcpSduParameters.pdcpSdu = packet;
668 transmitPdcpSduParameters.rnti = rnti;
669 transmitPdcpSduParameters.lcid = 1;
670
671 m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
672 */
673 /**
674 * Send RRC connection release in an idle way to ensure UE goes
675 * to idle mode during handover failure and connection setup timeout.
676 * Implemented to avoid unnecessary triggering of assert msgs due to reception of
677 * msgs (SRS CQI reports) from UE after UE context is deleted at eNodeB.
678 * TODO: Detection of handover failure and connection setup timeout at UE,
679 * so that the RRC connection release can be sent through the physical channel again.
680 */
681 NS_LOG_FUNCTION(this << rnti);
685 msg);
686}
687
688void
690{
691 // Get type of message received
692 RrcUlCcchMessage rrcUlCcchMessage;
693 p->PeekHeader(rrcUlCcchMessage);
694
695 // Declare possible headers to receive
696 RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
697 RrcConnectionRequestHeader rrcConnectionRequestHeader;
698
699 // Deserialize packet and call member recv function with appropriate structure
700 switch (rrcUlCcchMessage.GetMessageType())
701 {
702 case 0:
703 p->RemoveHeader(rrcConnectionReestablishmentRequestHeader);
704 LteRrcSap::RrcConnectionReestablishmentRequest rrcConnectionReestablishmentRequestMsg;
705 rrcConnectionReestablishmentRequestMsg =
706 rrcConnectionReestablishmentRequestHeader.GetMessage();
708 rnti,
709 rrcConnectionReestablishmentRequestMsg);
710 break;
711 case 1:
712 p->RemoveHeader(rrcConnectionRequestHeader);
713 LteRrcSap::RrcConnectionRequest rrcConnectionRequestMsg;
714 rrcConnectionRequestMsg = rrcConnectionRequestHeader.GetMessage();
715 m_enbRrcSapProvider->RecvRrcConnectionRequest(rnti, rrcConnectionRequestMsg);
716 break;
717 }
718}
719
720void
722{
723 // Get type of message received
724 RrcUlDcchMessage rrcUlDcchMessage;
725 params.pdcpSdu->PeekHeader(rrcUlDcchMessage);
726
727 // Declare possible headers to receive
728 MeasurementReportHeader measurementReportHeader;
729 RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
730 RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
731 RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
732
733 // Declare possible messages to receive
734 LteRrcSap::MeasurementReport measurementReportMsg;
735 LteRrcSap::RrcConnectionReconfigurationCompleted rrcConnectionReconfigurationCompleteMsg;
736 LteRrcSap::RrcConnectionReestablishmentComplete rrcConnectionReestablishmentCompleteMsg;
737 LteRrcSap::RrcConnectionSetupCompleted rrcConnectionSetupCompletedMsg;
738
739 // Deserialize packet and call member recv function with appropriate structure
740 switch (rrcUlDcchMessage.GetMessageType())
741 {
742 case 1:
743 params.pdcpSdu->RemoveHeader(measurementReportHeader);
744 measurementReportMsg = measurementReportHeader.GetMessage();
745 m_enbRrcSapProvider->RecvMeasurementReport(params.rnti, measurementReportMsg);
746 break;
747 case 2:
748 params.pdcpSdu->RemoveHeader(rrcConnectionReconfigurationCompleteHeader);
749 rrcConnectionReconfigurationCompleteMsg =
750 rrcConnectionReconfigurationCompleteHeader.GetMessage();
752 params.rnti,
753 rrcConnectionReconfigurationCompleteMsg);
754 break;
755 case 3:
756 params.pdcpSdu->RemoveHeader(rrcConnectionReestablishmentCompleteHeader);
757 rrcConnectionReestablishmentCompleteMsg =
758 rrcConnectionReestablishmentCompleteHeader.GetMessage();
760 params.rnti,
761 rrcConnectionReestablishmentCompleteMsg);
762 break;
763 case 4:
764 params.pdcpSdu->RemoveHeader(rrcConnectionSetupCompleteHeader);
765 rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.GetMessage();
767 rrcConnectionSetupCompletedMsg);
768 break;
769 }
770}
771
783
792
802
811
812//////////////////////////////////////////////////////
813
815 : m_pdcp(pdcp),
816 m_rnti(rnti)
817{
818}
819
823
824void
829
830} // namespace ns3
This class manages the serialization/deserialization of HandoverPreparationInfo IE.
void SetMessage(LteRrcSap::HandoverPreparationInfo msg)
Receives a HandoverPreparationInfo IE and stores the contents into the class attributes.
LteRrcSap::HandoverPreparationInfo GetMessage() const
Returns a HandoverPreparationInfo IE from the values in the class attributes.
The eNodeB device implementation.
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
void DoSendRrcConnectionRelease(uint16_t rnti, LteRrcSap::RrcConnectionRelease msg)
Send RRC connection release function.
static TypeId GetTypeId()
Get the type ID.
std::map< uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters > m_completeSetupUeParametersMap
complete setup UE parameters map
friend class LtePdcpSpecificLtePdcpSapUser< LteEnbRrcProtocolReal >
allow LtePdcpSpecificLtePdcpSapUser<LteEnbRrcProtocolReal> class friend access
void DoSetupUe(uint16_t rnti, LteEnbRrcSapUser::SetupUeParameters params)
Setup UE function.
LteUeRrcSapProvider * GetUeRrcSapProvider(uint16_t rnti)
Get UE RRC SAP provider function.
void SetCellId(uint16_t cellId)
Set cell ID function.
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
void DoSendRrcConnectionReestablishmentReject(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentReject msg)
Send RRC connection reestabishment reject function.
void DoSendSystemInformation(uint16_t cellId, LteRrcSap::SystemInformation msg)
Send system information function.
void DoReceivePdcpPdu(uint16_t rnti, Ptr< Packet > p)
Receive PDCP PDU function.
LteEnbRrcSapProvider * m_enbRrcSapProvider
ENB RRC SAP provider.
Ptr< Packet > DoEncodeHandoverCommand(LteRrcSap::RrcConnectionReconfiguration msg)
Encode handover command function.
LteEnbRrcSapUser * GetLteEnbRrcSapUser()
Get LTE ENB RRC SAP user function.
void DoSendRrcConnectionSetup(uint16_t rnti, LteRrcSap::RrcConnectionSetup msg)
Send RRC connection setup function.
friend class MemberLteEnbRrcSapUser< LteEnbRrcProtocolReal >
allow MemberLteEnbRrcSapUser<LteEnbRrcProtocolReal> class friend access
void DoRemoveUe(uint16_t rnti)
Remove UE function.
Ptr< Packet > DoEncodeHandoverPreparationInformation(LteRrcSap::HandoverPreparationInfo msg)
Encode handover preparation information function.
void SetLteEnbRrcSapProvider(LteEnbRrcSapProvider *p)
Set LTE ENB RRC SAP provider function.
LteEnbRrcSapUser * m_enbRrcSapUser
ENB RRC SAP user.
void DoSendRrcConnectionReject(uint16_t rnti, LteRrcSap::RrcConnectionReject msg)
Send RRC connection reject function.
friend class RealProtocolRlcSapUser
allow RealProtocolRlcSapUser class friend access
void DoDispose() override
Destructor implementation.
std::map< uint16_t, LteEnbRrcSapUser::SetupUeParameters > m_setupUeParametersMap
setup UE parameters map
LteRrcSap::RrcConnectionReconfiguration DoDecodeHandoverCommand(Ptr< Packet > p)
Decode handover command function.
LteRrcSap::HandoverPreparationInfo DoDecodeHandoverPreparationInformation(Ptr< Packet > p)
Decode handover preparation information function.
void DoSendRrcConnectionReestablishment(uint16_t rnti, LteRrcSap::RrcConnectionReestablishment msg)
Send RRC connection reestabishment function.
void SetUeRrcSapProvider(uint16_t rnti, LteUeRrcSapProvider *p)
Set UE RRC SAP provider function.
void DoSendRrcConnectionReconfiguration(uint16_t rnti, LteRrcSap::RrcConnectionReconfiguration msg)
Send RRC connection reconfiguration function.
std::map< uint16_t, LteUeRrcSapProvider * > m_enbRrcSapProviderMap
ENB RRC SAP provider map.
Part of the RRC protocol.
virtual void RecvRrcConnectionReestablishmentRequest(uint16_t rnti, RrcConnectionReestablishmentRequest msg)=0
Receive an RRCConnectionReestablishmentRequest message from a UE during an RRC connection re-establis...
virtual void RecvRrcConnectionReestablishmentComplete(uint16_t rnti, RrcConnectionReestablishmentComplete msg)=0
Receive an RRCConnectionReestablishmentComplete message from a UE during an RRC connection re-establi...
virtual void RecvRrcConnectionReconfigurationCompleted(uint16_t rnti, RrcConnectionReconfigurationCompleted msg)=0
Receive an RRCConnectionReconfigurationComplete message from a UE during an RRC connection reconfigur...
virtual void RecvRrcConnectionRequest(uint16_t rnti, RrcConnectionRequest msg)=0
Receive an RRCConnectionRequest message from a UE during an RRC connection establishment procedure (S...
virtual void RecvRrcConnectionSetupCompleted(uint16_t rnti, RrcConnectionSetupCompleted msg)=0
Receive an RRCConnectionSetupComplete message from a UE during an RRC connection establishment proced...
virtual void RecvMeasurementReport(uint16_t rnti, MeasurementReport msg)=0
Receive a MeasurementReport message from a UE during a measurement reporting procedure (Section 5....
virtual void CompleteSetupUe(uint16_t rnti, CompleteSetupUeParameters params)=0
Complete setup UE function.
virtual void RecvIdealUeContextRemoveRequest(uint16_t rnti)=0
Receive ideal UE context remove request from the UE RRC.
Part of the RRC protocol.
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
Send RRC PDU parameters to the PDCP for transmission.
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
virtual void TransmitPdcpPdu(TransmitPdcpPduParameters params)=0
Send a PDCP PDU to the RLC for transmission This method is to be called when upper PDCP entity has a ...
Service Access Point (SAP) offered by the UM-RLC and AM-RLC entities to the PDCP entity See 3GPP 36....
Definition lte-rlc-sap.h:56
The LteUeNetDevice class implements the UE net device.
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
LteEnbRrcSapProvider * m_enbRrcSapProvider
ENB RRC SAP provider.
LteUeRrcSapProvider * m_ueRrcSapProvider
UE RRC SAP provider.
LteUeRrcSapUser::SetupParameters m_setupParameters
setup parameters
void SetEnbRrcSapProvider()
Set ENB RRC SAP provider.
void DoSendRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Send RRC connection reconfiguration setup completed function.
void SetLteUeRrcSapProvider(LteUeRrcSapProvider *p)
Set LTE UE RRC SAP provider function.
static TypeId GetTypeId()
Get the type ID.
friend class MemberLteUeRrcSapUser< LteUeRrcProtocolReal >
allow MemberLteUeRrcSapUser<LteUeRrcProtocolReal> class friend access
void DoSendRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg) const
Send RRC connection reestablishment request function.
void DoReceivePdcpPdu(Ptr< Packet > p)
Receive PDCP PDU function.
void DoSendRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg) const
Send RRC connection reestablishment complete function.
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
void DoSetup(LteUeRrcSapUser::SetupParameters params)
Setup function.
void DoSendRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg) const
Send RRC connection setup completed function.
void SetUeRrc(Ptr< LteUeRrc > rrc)
Set UE RRC function.
LteUeRrcSapUser * m_ueRrcSapUser
UE RRC SAP user.
void DoSendMeasurementReport(LteRrcSap::MeasurementReport msg)
Send measurement report function.
friend class LtePdcpSpecificLtePdcpSapUser< LteUeRrcProtocolReal >
allow LtePdcpSpecificLtePdcpSapUser<LteUeRrcProtocolReal> class friend access
LteUeRrcSapUser * GetLteUeRrcSapUser()
Get LTE UE RRC SAP user function.
void DoSendIdealUeContextRemoveRequest(uint16_t rnti)
Send ideal UE context remove request function.
void DoDispose() override
Destructor implementation.
void DoSendRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
Send RRC connection request function.
LteUeRrcSapProvider::CompleteSetupParameters m_completeSetupParameters
complete setup parameters
friend class LteRlcSpecificLteRlcSapUser< LteUeRrcProtocolReal >
allow LteRlcSpecificLteRlcSapUser<LteUeRrcProtocolReal> class friend access
Part of the RRC protocol.
virtual void RecvRrcConnectionReconfiguration(RrcConnectionReconfiguration msg)=0
Receive an RRCConnectionReconfiguration message from the serving eNodeB during an RRC connection reco...
virtual void RecvRrcConnectionReject(RrcConnectionReject msg)=0
Receive an RRCConnectionReject message from the serving eNodeB during an RRC connection establishment...
virtual void RecvSystemInformation(SystemInformation msg)=0
Receive a SystemInformation message from the serving eNodeB during a system information acquisition p...
virtual void CompleteSetup(CompleteSetupParameters params)=0
Complete setup function.
virtual void RecvRrcConnectionRelease(RrcConnectionRelease msg)=0
Receive an RRCConnectionRelease message from the serving eNodeB during an RRC connection release proc...
virtual void RecvRrcConnectionSetup(RrcConnectionSetup msg)=0
Receive an RRCConnectionSetup message from the serving eNodeB during an RRC connection establishment ...
virtual void RecvRrcConnectionReestablishment(RrcConnectionReestablishment msg)=0
Receive an RRCConnectionReestablishment message from the serving eNodeB during an RRC connection re-e...
Part of the RRC protocol.
This class manages the serialization/deserialization of MeasurementReport IE.
LteRrcSap::MeasurementReport GetMessage() const
Returns a MeasurementReport IE from the values in the class attributes.
void SetMessage(LteRrcSap::MeasurementReport msg)
Receives a MeasurementReport IE and stores the contents into the class attributes.
static Iterator Begin()
Definition node-list.cc:226
static Iterator End()
Definition node-list.cc:233
A base class which provides memory management and object aggregation.
Definition object.h:78
Smart pointer class similar to boost::intrusive_ptr.
LteEnbRrcProtocolReal * m_pdcp
PDCP.
void ReceivePdcpPdu(Ptr< Packet > p) override
Called by the RLC entity to notify the PDCP entity of the reception of a new PDCP PDU.
int GetMessageType() const
Get message type.
This class manages the serialization/deserialization of RrcConnectionSetupComplete IE.
LteRrcSap::RrcConnectionReconfigurationCompleted GetMessage() const
Returns a RrcConnectionReconfigurationCompleted IE from the values in the class attributes.
void SetMessage(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Receives a RrcConnectionReconfigurationCompleted IE and stores the contents into the class attributes...
This class manages the serialization/deserialization of RrcConnectionReconfiguration IE.
LteRrcSap::RrcConnectionReconfiguration GetMessage() const
Returns a RrcConnectionReconfiguration IE from the values in the class attributes.
void SetMessage(LteRrcSap::RrcConnectionReconfiguration msg)
Receives a RrcConnectionReconfiguration IE and stores the contents into the class attributes.
This class manages the serialization/deserialization of RrcConnectionReestablishmentComplete IE.
void SetMessage(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Receives a RrcConnectionReestablishmentComplete IE and stores the contents into the class attributes.
LteRrcSap::RrcConnectionReestablishmentComplete GetMessage() const
Returns a RrcConnectionReestablishmentComplete IE from the values in the class attributes.
This class manages the serialization/deserialization of RrcConnectionReestablishment IE.
LteRrcSap::RrcConnectionReestablishment GetMessage() const
Returns a RrcConnectionReestablishment IE from the values in the class attributes.
void SetMessage(LteRrcSap::RrcConnectionReestablishment msg)
Receives a RrcConnectionReestablishment IE and stores the contents into the class attributes.
This class manages the serialization/deserialization of RrcConnectionReestablishmentReject IE.
void SetMessage(LteRrcSap::RrcConnectionReestablishmentReject msg)
Receives a RrcConnectionReestablishmentReject IE and stores the contents into the class attributes.
LteRrcSap::RrcConnectionReestablishmentReject GetMessage() const
Returns a RrcConnectionReestablishmentReject IE from the values in the class attributes.
This class manages the serialization/deserialization of RRCConnectionReestablishmentRequest IE.
LteRrcSap::RrcConnectionReestablishmentRequest GetMessage() const
Returns a RrcConnectionReestablishmentRequest IE from the values in the class attributes.
void SetMessage(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Receives a RrcConnectionReestablishmentRequest IE and stores the contents into the class attributes.
This class manages the serialization/deserialization of RrcConnectionReject IE.
LteRrcSap::RrcConnectionReject GetMessage() const
Returns a RrcConnectionReject IE from the values in the class attributes.
void SetMessage(LteRrcSap::RrcConnectionReject msg)
Receives a RrcConnectionReject IE and stores the contents into the class attributes.
This class manages the serialization/deserialization of RrcConnectionRelease IE.
LteRrcSap::RrcConnectionRelease GetMessage() const
Returns a RrcConnectionRelease IE from the values in the class attributes.
This class manages the serialization/deserialization of RrcConnectionRequest IE.
void SetMessage(LteRrcSap::RrcConnectionRequest msg)
Receives a RrcConnectionRequest IE and stores the contents into the class attributes.
LteRrcSap::RrcConnectionRequest GetMessage() const
Returns a RrcConnectionRequest IE from the values in the class attributes.
This class manages the serialization/deserialization of RrcConnectionSetupComplete IE.
LteRrcSap::RrcConnectionSetupCompleted GetMessage() const
Returns a RrcConnectionSetupCompleted IE from the values in the class attributes.
void SetMessage(LteRrcSap::RrcConnectionSetupCompleted msg)
Receives a RrcConnectionSetupCompleted IE and stores the contents into the class attributes.
This class manages the serialization/deserialization of RrcConnectionSetup IE.
void SetMessage(LteRrcSap::RrcConnectionSetup msg)
Receives a RrcConnectionSetup IE and stores the contents into the class attributes.
LteRrcSap::RrcConnectionSetup GetMessage() const
Returns a RrcConnectionSetup IE from the values in the class attributes.
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:560
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:577
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#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:75
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:97
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition log.h:271
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1320
Every class exported by the ns3 library is enclosed in the ns3 namespace.
const Time RRC_REAL_MSG_DELAY
RRC real message delay.
CompleteSetupUeParameters structure.
SetupUeParameters structure.
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
uint16_t rnti
the C-RNTI identifying the UE
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
Parameters for LteRlcSapProvider::TransmitPdcpPdu.
Definition lte-rlc-sap.h:33
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition lte-rlc-sap.h:36
uint16_t rnti
the C-RNTI identifying the UE
Definition lte-rlc-sap.h:35
HandoverPreparationInfo structure.
MeasurementReport structure.
RrcConnectionReconfigurationCompleted structure.
RrcConnectionReconfiguration structure.
RrcConnectionReestablishmentComplete structure.
RrcConnectionReestablishment structure.
RrcConnectionReestablishmentReject structure.
RrcConnectionReestablishmentRequest structure.
RrcConnectionReject structure.
RrcConnectionRelease structure.
RrcConnectionRequest structure.
RrcConnectionSetupCompleted structure.
RrcConnectionSetup structure.
SystemInformation structure.
SetupParameters structure.
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.