A Discrete-Event Network Simulator
API
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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Nicola Baldo <nbaldo@cttc.es>
18 * Lluis Parcerisa <lparcerisa@cttc.cat>
19 */
20
22
23#include "lte-enb-net-device.h"
24#include "lte-enb-rrc.h"
25#include "lte-ue-net-device.h"
26#include "lte-ue-rrc.h"
27
28#include <ns3/fatal-error.h>
29#include <ns3/log.h>
30#include <ns3/node-list.h>
31#include <ns3/node.h>
32#include <ns3/nstime.h>
33#include <ns3/simulator.h>
34
35namespace ns3
36{
37
38NS_LOG_COMPONENT_DEFINE("LteRrcProtocolReal");
39
42
44
46 : m_ueRrcSapProvider(nullptr),
47 m_enbRrcSapProvider(nullptr)
48{
54}
55
57{
58}
59
60void
62{
63 NS_LOG_FUNCTION(this);
64 delete m_ueRrcSapUser;
67 m_rrc = nullptr;
68}
69
72{
73 static TypeId tid = TypeId("ns3::LteUeRrcProtocolReal")
75 .SetGroupName("Lte")
76 .AddConstructor<LteUeRrcProtocolReal>();
77 return tid;
78}
79
80void
82{
84}
85
88{
89 return m_ueRrcSapUser;
90}
91
92void
94{
95 m_rrc = rrc;
96}
97
98void
100{
101 NS_LOG_FUNCTION(this);
102
106}
107
108void
110{
111 // initialize the RNTI and get the EnbLteRrcSapProvider for the
112 // eNB we are currently attached to
113 m_rnti = m_rrc->GetRnti();
115
116 Ptr<Packet> packet = Create<Packet>();
117
118 RrcConnectionRequestHeader rrcConnectionRequestHeader;
119 rrcConnectionRequestHeader.SetMessage(msg);
120
121 packet->AddHeader(rrcConnectionRequestHeader);
122
123 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
124 transmitPdcpPduParameters.pdcpPdu = packet;
125 transmitPdcpPduParameters.rnti = m_rnti;
126 transmitPdcpPduParameters.lcid = 0;
127
128 m_setupParameters.srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
129}
130
131void
133{
134 Ptr<Packet> packet = Create<Packet>();
135
136 RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
137 rrcConnectionSetupCompleteHeader.SetMessage(msg);
138
139 packet->AddHeader(rrcConnectionSetupCompleteHeader);
140
141 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
142 transmitPdcpSduParameters.pdcpSdu = packet;
143 transmitPdcpSduParameters.rnti = m_rnti;
144 transmitPdcpSduParameters.lcid = 1;
145
147 {
148 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
149 }
150}
151
152void
155{
156 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
157 // eNB we are currently attached to
158 m_rnti = m_rrc->GetRnti();
160
161 Ptr<Packet> packet = Create<Packet>();
162
163 RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
164 rrcConnectionReconfigurationCompleteHeader.SetMessage(msg);
165
166 packet->AddHeader(rrcConnectionReconfigurationCompleteHeader);
167
168 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
169 transmitPdcpSduParameters.pdcpSdu = packet;
170 transmitPdcpSduParameters.rnti = m_rnti;
171 transmitPdcpSduParameters.lcid = 1;
172
173 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
174}
175
176void
178{
179 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
180 // eNB we are currently attached to
181 m_rnti = m_rrc->GetRnti();
183
184 Ptr<Packet> packet = Create<Packet>();
185
186 MeasurementReportHeader measurementReportHeader;
187 measurementReportHeader.SetMessage(msg);
188
189 packet->AddHeader(measurementReportHeader);
190
191 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
192 transmitPdcpSduParameters.pdcpSdu = packet;
193 transmitPdcpSduParameters.rnti = m_rnti;
194 transmitPdcpSduParameters.lcid = 1;
195
196 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
197}
198
199void
201{
202 NS_LOG_FUNCTION(this << rnti);
203 uint16_t cellId = m_rrc->GetCellId();
204 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
205 // eNB we are currently attached to or attempting random access to
206 // a target eNB
207 m_rnti = m_rrc->GetRnti();
208
209 NS_LOG_DEBUG("RNTI " << rnti << " sending UE context remove request to cell id " << cellId);
210 NS_ABORT_MSG_IF(m_rnti != rnti, "RNTI mismatch");
211
212 SetEnbRrcSapProvider(); // the provider has to be reset since the cell might
213 // have changed due to handover
214 // ideally informing eNB
218 rnti);
219}
220
221void
224{
225 Ptr<Packet> packet = Create<Packet>();
226
227 RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
228 rrcConnectionReestablishmentRequestHeader.SetMessage(msg);
229
230 packet->AddHeader(rrcConnectionReestablishmentRequestHeader);
231
232 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
233 transmitPdcpPduParameters.pdcpPdu = packet;
234 transmitPdcpPduParameters.rnti = m_rnti;
235 transmitPdcpPduParameters.lcid = 0;
236
237 m_setupParameters.srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
238}
239
240void
243{
244 Ptr<Packet> packet = Create<Packet>();
245
246 RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
247 rrcConnectionReestablishmentCompleteHeader.SetMessage(msg);
248
249 packet->AddHeader(rrcConnectionReestablishmentCompleteHeader);
250
251 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
252 transmitPdcpSduParameters.pdcpSdu = packet;
253 transmitPdcpSduParameters.rnti = m_rnti;
254 transmitPdcpSduParameters.lcid = 1;
255
256 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
257}
258
259void
261{
262 NS_LOG_FUNCTION(this);
263
264 uint16_t cellId = m_rrc->GetCellId();
265
266 NS_LOG_DEBUG("RNTI " << m_rnti << " connected to cell " << cellId);
267
268 // walk list of all nodes to get the peer eNB
271 bool found = false;
272 for (NodeList::Iterator i = NodeList::Begin(); (i != listEnd) && (!found); ++i)
273 {
274 Ptr<Node> node = *i;
275 int nDevs = node->GetNDevices();
276 for (int j = 0; (j < nDevs) && (!found); j++)
277 {
278 enbDev = node->GetDevice(j)->GetObject<LteEnbNetDevice>();
279 if (!enbDev)
280 {
281 continue;
282 }
283 else
284 {
285 if (enbDev->HasCellId(cellId))
286 {
287 found = true;
288 break;
289 }
290 }
291 }
292 }
293 NS_ASSERT_MSG(found, " Unable to find eNB with CellId =" << cellId);
294 m_enbRrcSapProvider = enbDev->GetRrc()->GetLteEnbRrcSapProvider();
295 Ptr<LteEnbRrcProtocolReal> enbRrcProtocolReal =
296 enbDev->GetRrc()->GetObject<LteEnbRrcProtocolReal>();
297 enbRrcProtocolReal->SetUeRrcSapProvider(m_rnti, m_ueRrcSapProvider);
298}
299
300void
302{
303 // Get type of message received
304 RrcDlCcchMessage rrcDlCcchMessage;
305 p->PeekHeader(rrcDlCcchMessage);
306
307 // Declare possible headers to receive
308 RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
309 RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
310 RrcConnectionSetupHeader rrcConnectionSetupHeader;
311 RrcConnectionRejectHeader rrcConnectionRejectHeader;
312
313 // Declare possible messages
314 LteRrcSap::RrcConnectionReestablishment rrcConnectionReestablishmentMsg;
315 LteRrcSap::RrcConnectionReestablishmentReject rrcConnectionReestablishmentRejectMsg;
316 LteRrcSap::RrcConnectionSetup rrcConnectionSetupMsg;
317 LteRrcSap::RrcConnectionReject rrcConnectionRejectMsg;
318
319 // Deserialize packet and call member recv function with appropriate structure
320 switch (rrcDlCcchMessage.GetMessageType())
321 {
322 case 0:
323 // RrcConnectionReestablishment
324 p->RemoveHeader(rrcConnectionReestablishmentHeader);
325 rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.GetMessage();
326 m_ueRrcSapProvider->RecvRrcConnectionReestablishment(rrcConnectionReestablishmentMsg);
327 break;
328 case 1:
329 // RrcConnectionReestablishmentReject
330 p->RemoveHeader(rrcConnectionReestablishmentRejectHeader);
331 rrcConnectionReestablishmentRejectMsg =
332 rrcConnectionReestablishmentRejectHeader.GetMessage();
333 // m_ueRrcSapProvider->RecvRrcConnectionReestablishmentReject
334 // (rrcConnectionReestablishmentRejectMsg);
335 break;
336 case 2:
337 // RrcConnectionReject
338 p->RemoveHeader(rrcConnectionRejectHeader);
339 rrcConnectionRejectMsg = rrcConnectionRejectHeader.GetMessage();
340 m_ueRrcSapProvider->RecvRrcConnectionReject(rrcConnectionRejectMsg);
341 break;
342 case 3:
343 // RrcConnectionSetup
344 p->RemoveHeader(rrcConnectionSetupHeader);
345 rrcConnectionSetupMsg = rrcConnectionSetupHeader.GetMessage();
346 m_ueRrcSapProvider->RecvRrcConnectionSetup(rrcConnectionSetupMsg);
347 break;
348 }
349}
350
351void
353{
354 // Get type of message received
355 RrcDlDcchMessage rrcDlDcchMessage;
356 params.pdcpSdu->PeekHeader(rrcDlDcchMessage);
357
358 // Declare possible headers to receive
359 RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
360 RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
361
362 // Declare possible messages to receive
363 LteRrcSap::RrcConnectionReconfiguration rrcConnectionReconfigurationMsg;
364 LteRrcSap::RrcConnectionRelease rrcConnectionReleaseMsg;
365
366 // Deserialize packet and call member recv function with appropriate structure
367 switch (rrcDlDcchMessage.GetMessageType())
368 {
369 case 4:
370 params.pdcpSdu->RemoveHeader(rrcConnectionReconfigurationHeader);
371 rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.GetMessage();
372 m_ueRrcSapProvider->RecvRrcConnectionReconfiguration(rrcConnectionReconfigurationMsg);
373 break;
374 case 5:
375 params.pdcpSdu->RemoveHeader(rrcConnectionReleaseHeader);
376 rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.GetMessage();
377 // m_ueRrcSapProvider->RecvRrcConnectionRelease (rrcConnectionReleaseMsg);
378 break;
379 }
380}
381
383
385 : m_enbRrcSapProvider(nullptr)
386{
387 NS_LOG_FUNCTION(this);
389}
390
392{
393 NS_LOG_FUNCTION(this);
394}
395
396void
398{
399 NS_LOG_FUNCTION(this);
400 delete m_enbRrcSapUser;
401 for (std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator it =
404 ++it)
405 {
406 delete it->second.srb0SapUser;
407 delete it->second.srb1SapUser;
408 }
410}
411
412TypeId
414{
415 static TypeId tid = TypeId("ns3::LteEnbRrcProtocolReal")
416 .SetParent<Object>()
417 .SetGroupName("Lte")
418 .AddConstructor<LteEnbRrcProtocolReal>();
419 return tid;
420}
421
422void
424{
426}
427
430{
431 return m_enbRrcSapUser;
432}
433
434void
436{
437 m_cellId = cellId;
438}
439
442{
443 std::map<uint16_t, LteUeRrcSapProvider*>::const_iterator it;
444 it = m_enbRrcSapProviderMap.find(rnti);
445 NS_ASSERT_MSG(it != m_enbRrcSapProviderMap.end(), "could not find RNTI = " << rnti);
446 return it->second;
447}
448
449void
451{
452 std::map<uint16_t, LteUeRrcSapProvider*>::iterator it;
453 it = m_enbRrcSapProviderMap.find(rnti);
454 // assign UE RRC only if the RNTI is found at eNB
455 if (it != m_enbRrcSapProviderMap.end())
456 {
457 it->second = p;
458 }
459}
460
461void
463{
464 NS_LOG_FUNCTION(this << rnti);
465
466 // // walk list of all nodes to get the peer UE RRC SAP Provider
467 // Ptr<LteUeRrc> ueRrc;
468 // NodeList::Iterator listEnd = NodeList::End ();
469 // bool found = false;
470 // for (NodeList::Iterator i = NodeList::Begin (); (i != listEnd) && (found == false); i++)
471 // {
472 // Ptr<Node> node = *i;
473 // int nDevs = node->GetNDevices ();
474 // for (int j = 0; j < nDevs; j++)
475 // {
476 // Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
477 // if (!ueDev)
478 // {
479 // continue;
480 // }
481 // else
482 // {
483 // ueRrc = ueDev->GetRrc ();
484 // if ((ueRrc->GetRnti () == rnti) && (ueRrc->GetCellId () == m_cellId))
485 // {
486 // found = true;
487 // break;
488 // }
489 // }
490 // }
491 // }
492 // NS_ASSERT_MSG (found , " Unable to find UE with RNTI=" << rnti << " cellId=" << m_cellId);
493 // m_enbRrcSapProviderMap[rnti] = ueRrc->GetLteUeRrcSapProvider ();
494
495 // just create empty entry, the UeRrcSapProvider will be set by the
496 // ue upon connection request or connection reconfiguration
497 // completed
498 m_enbRrcSapProviderMap[rnti] = nullptr;
499
500 // Store SetupUeParameters
501 m_setupUeParametersMap[rnti] = params;
502
503 LteEnbRrcSapProvider::CompleteSetupUeParameters completeSetupUeParameters;
504 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator csupIt =
506 if (csupIt == m_completeSetupUeParametersMap.end())
507 {
508 // Create LteRlcSapUser, LtePdcpSapUser
509 LteRlcSapUser* srb0SapUser = new RealProtocolRlcSapUser(this, rnti);
510 LtePdcpSapUser* srb1SapUser =
512 completeSetupUeParameters.srb0SapUser = srb0SapUser;
513 completeSetupUeParameters.srb1SapUser = srb1SapUser;
514 // Store LteRlcSapUser, LtePdcpSapUser
515 m_completeSetupUeParametersMap[rnti] = completeSetupUeParameters;
516 }
517 else
518 {
519 completeSetupUeParameters = csupIt->second;
520 }
521 m_enbRrcSapProvider->CompleteSetupUe(rnti, completeSetupUeParameters);
522}
523
524void
526{
527 NS_LOG_FUNCTION(this << rnti);
528 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator it =
531 delete it->second.srb0SapUser;
532 delete it->second.srb1SapUser;
534 m_enbRrcSapProviderMap.erase(rnti);
535 m_setupUeParametersMap.erase(rnti);
536}
537
538void
540{
541 NS_LOG_FUNCTION(this << cellId);
542 // walk list of all nodes to get UEs with this cellId
543 Ptr<LteUeRrc> ueRrc;
544 for (NodeList::Iterator i = NodeList::Begin(); i != NodeList::End(); ++i)
545 {
546 Ptr<Node> node = *i;
547 int nDevs = node->GetNDevices();
548 for (int j = 0; j < nDevs; ++j)
549 {
550 Ptr<LteUeNetDevice> ueDev = node->GetDevice(j)->GetObject<LteUeNetDevice>();
551 if (ueDev)
552 {
553 Ptr<LteUeRrc> ueRrc = ueDev->GetRrc();
554 NS_LOG_LOGIC("considering UE IMSI " << ueDev->GetImsi() << " that has cellId "
555 << ueRrc->GetCellId());
556 if (ueRrc->GetCellId() == cellId)
557 {
558 NS_LOG_LOGIC("sending SI to IMSI " << ueDev->GetImsi());
559
563 ueRrc->GetLteUeRrcSapProvider(),
564 msg);
565 }
566 }
567 }
568 }
569}
570
571void
573{
574 Ptr<Packet> packet = Create<Packet>();
575
576 RrcConnectionSetupHeader rrcConnectionSetupHeader;
577 rrcConnectionSetupHeader.SetMessage(msg);
578
579 packet->AddHeader(rrcConnectionSetupHeader);
580
581 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
582 transmitPdcpPduParameters.pdcpPdu = packet;
583 transmitPdcpPduParameters.rnti = rnti;
584 transmitPdcpPduParameters.lcid = 0;
585
586 m_setupUeParametersMap.at(rnti).srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
587}
588
589void
591{
592 Ptr<Packet> packet = Create<Packet>();
593
594 RrcConnectionRejectHeader rrcConnectionRejectHeader;
595 rrcConnectionRejectHeader.SetMessage(msg);
596
597 packet->AddHeader(rrcConnectionRejectHeader);
598
599 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
600 transmitPdcpPduParameters.pdcpPdu = packet;
601 transmitPdcpPduParameters.rnti = rnti;
602 transmitPdcpPduParameters.lcid = 0;
603
604 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
605}
606
607void
609 uint16_t rnti,
611{
612 Ptr<Packet> packet = Create<Packet>();
613
614 RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
615 rrcConnectionReconfigurationHeader.SetMessage(msg);
616
617 packet->AddHeader(rrcConnectionReconfigurationHeader);
618
619 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
620 transmitPdcpSduParameters.pdcpSdu = packet;
621 transmitPdcpSduParameters.rnti = rnti;
622 transmitPdcpSduParameters.lcid = 1;
623
624 m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
625}
626
627void
629 uint16_t rnti,
631{
632 Ptr<Packet> packet = Create<Packet>();
633
634 RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
635 rrcConnectionReestablishmentHeader.SetMessage(msg);
636
637 packet->AddHeader(rrcConnectionReestablishmentHeader);
638
639 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
640 transmitPdcpPduParameters.pdcpPdu = packet;
641 transmitPdcpPduParameters.rnti = rnti;
642 transmitPdcpPduParameters.lcid = 0;
643
644 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
645}
646
647void
649 uint16_t rnti,
651{
652 Ptr<Packet> packet = Create<Packet>();
653
654 RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
655 rrcConnectionReestablishmentRejectHeader.SetMessage(msg);
656
657 packet->AddHeader(rrcConnectionReestablishmentRejectHeader);
658
659 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
660 transmitPdcpPduParameters.pdcpPdu = packet;
661 transmitPdcpPduParameters.rnti = rnti;
662 transmitPdcpPduParameters.lcid = 0;
663
664 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
665}
666
667void
670{
671 // The code below is commented so RRC connection release can be sent in an ideal way
672 /*
673 Ptr<Packet> packet = Create<Packet> ();
674
675 RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
676 rrcConnectionReleaseHeader.SetMessage (msg);
677
678 packet->AddHeader (rrcConnectionReleaseHeader);
679
680 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
681 transmitPdcpSduParameters.pdcpSdu = packet;
682 transmitPdcpSduParameters.rnti = rnti;
683 transmitPdcpSduParameters.lcid = 1;
684
685 m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
686 */
695 NS_LOG_FUNCTION(this << rnti);
699 msg);
700}
701
702void
704{
705 // Get type of message received
706 RrcUlCcchMessage rrcUlCcchMessage;
707 p->PeekHeader(rrcUlCcchMessage);
708
709 // Declare possible headers to receive
710 RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
711 RrcConnectionRequestHeader rrcConnectionRequestHeader;
712
713 // Deserialize packet and call member recv function with appropriate structure
714 switch (rrcUlCcchMessage.GetMessageType())
715 {
716 case 0:
717 p->RemoveHeader(rrcConnectionReestablishmentRequestHeader);
718 LteRrcSap::RrcConnectionReestablishmentRequest rrcConnectionReestablishmentRequestMsg;
719 rrcConnectionReestablishmentRequestMsg =
720 rrcConnectionReestablishmentRequestHeader.GetMessage();
722 rnti,
723 rrcConnectionReestablishmentRequestMsg);
724 break;
725 case 1:
726 p->RemoveHeader(rrcConnectionRequestHeader);
727 LteRrcSap::RrcConnectionRequest rrcConnectionRequestMsg;
728 rrcConnectionRequestMsg = rrcConnectionRequestHeader.GetMessage();
729 m_enbRrcSapProvider->RecvRrcConnectionRequest(rnti, rrcConnectionRequestMsg);
730 break;
731 }
732}
733
734void
736{
737 // Get type of message received
738 RrcUlDcchMessage rrcUlDcchMessage;
739 params.pdcpSdu->PeekHeader(rrcUlDcchMessage);
740
741 // Declare possible headers to receive
742 MeasurementReportHeader measurementReportHeader;
743 RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
744 RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
745 RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
746
747 // Declare possible messages to receive
748 LteRrcSap::MeasurementReport measurementReportMsg;
749 LteRrcSap::RrcConnectionReconfigurationCompleted rrcConnectionReconfigurationCompleteMsg;
750 LteRrcSap::RrcConnectionReestablishmentComplete rrcConnectionReestablishmentCompleteMsg;
751 LteRrcSap::RrcConnectionSetupCompleted rrcConnectionSetupCompletedMsg;
752
753 // Deserialize packet and call member recv function with appropriate structure
754 switch (rrcUlDcchMessage.GetMessageType())
755 {
756 case 1:
757 params.pdcpSdu->RemoveHeader(measurementReportHeader);
758 measurementReportMsg = measurementReportHeader.GetMessage();
759 m_enbRrcSapProvider->RecvMeasurementReport(params.rnti, measurementReportMsg);
760 break;
761 case 2:
762 params.pdcpSdu->RemoveHeader(rrcConnectionReconfigurationCompleteHeader);
763 rrcConnectionReconfigurationCompleteMsg =
764 rrcConnectionReconfigurationCompleteHeader.GetMessage();
766 params.rnti,
767 rrcConnectionReconfigurationCompleteMsg);
768 break;
769 case 3:
770 params.pdcpSdu->RemoveHeader(rrcConnectionReestablishmentCompleteHeader);
771 rrcConnectionReestablishmentCompleteMsg =
772 rrcConnectionReestablishmentCompleteHeader.GetMessage();
774 params.rnti,
775 rrcConnectionReestablishmentCompleteMsg);
776 break;
777 case 4:
778 params.pdcpSdu->RemoveHeader(rrcConnectionSetupCompleteHeader);
779 rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.GetMessage();
781 rrcConnectionSetupCompletedMsg);
782 break;
783 }
784}
785
789{
791 h.SetMessage(msg);
792
793 Ptr<Packet> p = Create<Packet>();
794 p->AddHeader(h);
795 return p;
796}
797
800{
802 p->RemoveHeader(h);
804 return msg;
805}
806
809{
811 h.SetMessage(msg);
812 Ptr<Packet> p = Create<Packet>();
813 p->AddHeader(h);
814 return p;
815}
816
819{
821 p->RemoveHeader(h);
823 return msg;
824}
825
827
829 : m_pdcp(pdcp),
830 m_rnti(rnti)
831{
832}
833
835{
836}
837
838void
840{
842}
843
844} // 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.
bool HasCellId(uint16_t cellId) const
Ptr< LteEnbRrc > GetRrc() const
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.
Definition: lte-rrc-sap.h:1230
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.
Definition: lte-rrc-sap.h:1110
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....
Definition: lte-pdcp-sap.h:69
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:67
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.
void DoSendRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Send RRC connection setup completed function.
friend class MemberLteUeRrcSapUser< LteUeRrcProtocolReal >
allow MemberLteUeRrcSapUser<LteUeRrcProtocolReal> class friend access
void DoReceivePdcpPdu(Ptr< Packet > p)
Receive PDCP PDU function.
Ptr< LteUeRrc > m_rrc
the RRC
void DoSendRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Send RRC connection reestablishment complete function.
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
void DoSetup(LteUeRrcSapUser::SetupParameters params)
Setup 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
void DoSendRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Send RRC connection reestablishment request function.
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.
Definition: lte-rrc-sap.h:1031
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.
Definition: lte-rrc-sap.h:946
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.
uint32_t GetNDevices() const
Definition: node.cc:162
uint32_t GetId() const
Definition: node.cc:117
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:152
static Iterator Begin()
Definition: node-list.cc:237
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-list.h:44
static Iterator End()
Definition: node-list.cc:244
A base class which provides memory management and object aggregation.
Definition: object.h:89
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:294
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:268
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:305
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
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()
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:568
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition: simulator.h:587
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
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.
Definition: lte-rrc-sap.h:1234
SetupUeParameters structure.
Definition: lte-rrc-sap.h:1114
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
Definition: lte-pdcp-sap.h:44
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-pdcp-sap.h:47
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-pdcp-sap.h:46
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
Definition: lte-pdcp-sap.h:77
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-pdcp-sap.h:79
Parameters for LteRlcSapProvider::TransmitPdcpPdu.
Definition: lte-rlc-sap.h:44
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-rlc-sap.h:47
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-rlc-sap.h:46
HandoverPreparationInfo structure.
Definition: lte-rrc-sap.h:928
MeasurementReport structure.
Definition: lte-rrc-sap.h:934
RrcConnectionReconfigurationCompleted structure.
Definition: lte-rrc-sap.h:884
RrcConnectionReconfiguration structure.
Definition: lte-rrc-sap.h:867
RrcConnectionReestablishmentComplete structure.
Definition: lte-rrc-sap.h:905
RrcConnectionReestablishment structure.
Definition: lte-rrc-sap.h:897
RrcConnectionReestablishmentReject structure.
Definition: lte-rrc-sap.h:911
RrcConnectionReestablishmentRequest structure.
Definition: lte-rrc-sap.h:890
RrcConnectionReject structure.
Definition: lte-rrc-sap.h:922
RrcConnectionRelease structure.
Definition: lte-rrc-sap.h:916
RrcConnectionRequest structure.
Definition: lte-rrc-sap.h:716
RrcConnectionSetupCompleted structure.
Definition: lte-rrc-sap.h:730
RrcConnectionSetup structure.
Definition: lte-rrc-sap.h:722
SystemInformation structure.
Definition: lte-rrc-sap.h:629
LtePdcpSapUser * srb1SapUser
SRB1 SAP user.
Definition: lte-rrc-sap.h:1037
SetupParameters structure.
Definition: lte-rrc-sap.h:950
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
Definition: lte-rrc-sap.h:951
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
Definition: lte-rrc-sap.h:952