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 * 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-rrc-header.h"
26#include "lte-ue-net-device.h"
27#include "lte-ue-rrc.h"
28
29#include <ns3/fatal-error.h>
30#include <ns3/log.h>
31#include <ns3/node-list.h>
32#include <ns3/node.h>
33#include <ns3/nstime.h>
34#include <ns3/simulator.h>
35
36namespace ns3
37{
38
39NS_LOG_COMPONENT_DEFINE("LteRrcProtocolReal");
40
43
45
47 : m_ueRrcSapProvider(nullptr),
48 m_enbRrcSapProvider(nullptr)
49{
55}
56
58{
59}
60
61void
63{
64 NS_LOG_FUNCTION(this);
65 delete m_ueRrcSapUser;
68 m_rrc = nullptr;
69}
70
73{
74 static TypeId tid = TypeId("ns3::LteUeRrcProtocolReal")
76 .SetGroupName("Lte")
77 .AddConstructor<LteUeRrcProtocolReal>();
78 return tid;
79}
80
81void
83{
85}
86
89{
90 return m_ueRrcSapUser;
91}
92
93void
95{
96 m_rrc = rrc;
97}
98
99void
101{
102 NS_LOG_FUNCTION(this);
103
104 m_setupParameters.srb0SapProvider = params.srb0SapProvider;
105 m_setupParameters.srb1SapProvider = params.srb1SapProvider;
107}
108
109void
111{
112 // initialize the RNTI and get the EnbLteRrcSapProvider for the
113 // eNB we are currently attached to
114 m_rnti = m_rrc->GetRnti();
116
117 Ptr<Packet> packet = Create<Packet>();
118
119 RrcConnectionRequestHeader rrcConnectionRequestHeader;
120 rrcConnectionRequestHeader.SetMessage(msg);
121
122 packet->AddHeader(rrcConnectionRequestHeader);
123
124 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
125 transmitPdcpPduParameters.pdcpPdu = packet;
126 transmitPdcpPduParameters.rnti = m_rnti;
127 transmitPdcpPduParameters.lcid = 0;
128
129 m_setupParameters.srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
130}
131
132void
135{
136 Ptr<Packet> packet = Create<Packet>();
137
138 RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
139 rrcConnectionSetupCompleteHeader.SetMessage(msg);
140
141 packet->AddHeader(rrcConnectionSetupCompleteHeader);
142
143 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
144 transmitPdcpSduParameters.pdcpSdu = packet;
145 transmitPdcpSduParameters.rnti = m_rnti;
146 transmitPdcpSduParameters.lcid = 1;
147
149 {
150 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
151 }
152}
153
154void
157{
158 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
159 // eNB we are currently attached to
160 m_rnti = m_rrc->GetRnti();
162
163 Ptr<Packet> packet = Create<Packet>();
164
165 RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
166 rrcConnectionReconfigurationCompleteHeader.SetMessage(msg);
167
168 packet->AddHeader(rrcConnectionReconfigurationCompleteHeader);
169
170 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
171 transmitPdcpSduParameters.pdcpSdu = packet;
172 transmitPdcpSduParameters.rnti = m_rnti;
173 transmitPdcpSduParameters.lcid = 1;
174
175 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
176}
177
178void
180{
181 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
182 // eNB we are currently attached to
183 m_rnti = m_rrc->GetRnti();
185
186 Ptr<Packet> packet = Create<Packet>();
187
188 MeasurementReportHeader measurementReportHeader;
189 measurementReportHeader.SetMessage(msg);
190
191 packet->AddHeader(measurementReportHeader);
192
193 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
194 transmitPdcpSduParameters.pdcpSdu = packet;
195 transmitPdcpSduParameters.rnti = m_rnti;
196 transmitPdcpSduParameters.lcid = 1;
197
198 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
199}
200
201void
203{
204 NS_LOG_FUNCTION(this << rnti);
205 uint16_t cellId = m_rrc->GetCellId();
206 // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
207 // eNB we are currently attached to or attempting random access to
208 // a target eNB
209 m_rnti = m_rrc->GetRnti();
210
211 NS_LOG_DEBUG("RNTI " << rnti << " sending UE context remove request to cell id " << cellId);
212 NS_ABORT_MSG_IF(m_rnti != rnti, "RNTI mismatch");
213
214 SetEnbRrcSapProvider(); // the provider has to be reset since the cell might
215 // have changed due to handover
216 // ideally informing eNB
220 rnti);
221}
222
223void
226{
227 Ptr<Packet> packet = Create<Packet>();
228
229 RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
230 rrcConnectionReestablishmentRequestHeader.SetMessage(msg);
231
232 packet->AddHeader(rrcConnectionReestablishmentRequestHeader);
233
234 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
235 transmitPdcpPduParameters.pdcpPdu = packet;
236 transmitPdcpPduParameters.rnti = m_rnti;
237 transmitPdcpPduParameters.lcid = 0;
238
239 m_setupParameters.srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
240}
241
242void
245{
246 Ptr<Packet> packet = Create<Packet>();
247
248 RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
249 rrcConnectionReestablishmentCompleteHeader.SetMessage(msg);
250
251 packet->AddHeader(rrcConnectionReestablishmentCompleteHeader);
252
253 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
254 transmitPdcpSduParameters.pdcpSdu = packet;
255 transmitPdcpSduParameters.rnti = m_rnti;
256 transmitPdcpSduParameters.lcid = 1;
257
258 m_setupParameters.srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
259}
260
261void
263{
264 NS_LOG_FUNCTION(this);
265
266 uint16_t cellId = m_rrc->GetCellId();
267
268 NS_LOG_DEBUG("RNTI " << m_rnti << " connected to cell " << cellId);
269
270 // walk list of all nodes to get the peer eNB
273 bool found = false;
274 for (NodeList::Iterator i = NodeList::Begin(); (i != listEnd) && (!found); ++i)
275 {
276 Ptr<Node> node = *i;
277 int nDevs = node->GetNDevices();
278 for (int j = 0; (j < nDevs) && (!found); j++)
279 {
280 enbDev = node->GetDevice(j)->GetObject<LteEnbNetDevice>();
281 if (!enbDev)
282 {
283 continue;
284 }
285 else
286 {
287 if (enbDev->HasCellId(cellId))
288 {
289 found = true;
290 break;
291 }
292 }
293 }
294 }
295 NS_ASSERT_MSG(found, " Unable to find eNB with CellId =" << cellId);
296 m_enbRrcSapProvider = enbDev->GetRrc()->GetLteEnbRrcSapProvider();
297 Ptr<LteEnbRrcProtocolReal> enbRrcProtocolReal =
298 enbDev->GetRrc()->GetObject<LteEnbRrcProtocolReal>();
299 enbRrcProtocolReal->SetUeRrcSapProvider(m_rnti, m_ueRrcSapProvider);
300}
301
302void
304{
305 // Get type of message received
306 RrcDlCcchMessage rrcDlCcchMessage;
307 p->PeekHeader(rrcDlCcchMessage);
308
309 // Declare possible headers to receive
310 RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
311 RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
312 RrcConnectionSetupHeader rrcConnectionSetupHeader;
313 RrcConnectionRejectHeader rrcConnectionRejectHeader;
314
315 // Declare possible messages
316 LteRrcSap::RrcConnectionReestablishment rrcConnectionReestablishmentMsg;
317 LteRrcSap::RrcConnectionReestablishmentReject rrcConnectionReestablishmentRejectMsg;
318 LteRrcSap::RrcConnectionSetup rrcConnectionSetupMsg;
319 LteRrcSap::RrcConnectionReject rrcConnectionRejectMsg;
320
321 // Deserialize packet and call member recv function with appropriate structure
322 switch (rrcDlCcchMessage.GetMessageType())
323 {
324 case 0:
325 // RrcConnectionReestablishment
326 p->RemoveHeader(rrcConnectionReestablishmentHeader);
327 rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.GetMessage();
328 m_ueRrcSapProvider->RecvRrcConnectionReestablishment(rrcConnectionReestablishmentMsg);
329 break;
330 case 1:
331 // RrcConnectionReestablishmentReject
332 p->RemoveHeader(rrcConnectionReestablishmentRejectHeader);
333 rrcConnectionReestablishmentRejectMsg =
334 rrcConnectionReestablishmentRejectHeader.GetMessage();
335 // m_ueRrcSapProvider->RecvRrcConnectionReestablishmentReject
336 // (rrcConnectionReestablishmentRejectMsg);
337 break;
338 case 2:
339 // RrcConnectionReject
340 p->RemoveHeader(rrcConnectionRejectHeader);
341 rrcConnectionRejectMsg = rrcConnectionRejectHeader.GetMessage();
342 m_ueRrcSapProvider->RecvRrcConnectionReject(rrcConnectionRejectMsg);
343 break;
344 case 3:
345 // RrcConnectionSetup
346 p->RemoveHeader(rrcConnectionSetupHeader);
347 rrcConnectionSetupMsg = rrcConnectionSetupHeader.GetMessage();
348 m_ueRrcSapProvider->RecvRrcConnectionSetup(rrcConnectionSetupMsg);
349 break;
350 }
351}
352
353void
355{
356 // Get type of message received
357 RrcDlDcchMessage rrcDlDcchMessage;
358 params.pdcpSdu->PeekHeader(rrcDlDcchMessage);
359
360 // Declare possible headers to receive
361 RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
362 RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
363
364 // Declare possible messages to receive
365 LteRrcSap::RrcConnectionReconfiguration rrcConnectionReconfigurationMsg;
366 LteRrcSap::RrcConnectionRelease rrcConnectionReleaseMsg;
367
368 // Deserialize packet and call member recv function with appropriate structure
369 switch (rrcDlDcchMessage.GetMessageType())
370 {
371 case 4:
372 params.pdcpSdu->RemoveHeader(rrcConnectionReconfigurationHeader);
373 rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.GetMessage();
374 m_ueRrcSapProvider->RecvRrcConnectionReconfiguration(rrcConnectionReconfigurationMsg);
375 break;
376 case 5:
377 params.pdcpSdu->RemoveHeader(rrcConnectionReleaseHeader);
378 rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.GetMessage();
379 // m_ueRrcSapProvider->RecvRrcConnectionRelease (rrcConnectionReleaseMsg);
380 break;
381 }
382}
383
385
387 : m_enbRrcSapProvider(nullptr)
388{
389 NS_LOG_FUNCTION(this);
391}
392
394{
395 NS_LOG_FUNCTION(this);
396}
397
398void
400{
401 NS_LOG_FUNCTION(this);
402 delete m_enbRrcSapUser;
403 for (std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator it =
406 ++it)
407 {
408 delete it->second.srb0SapUser;
409 delete it->second.srb1SapUser;
410 }
412}
413
414TypeId
416{
417 static TypeId tid = TypeId("ns3::LteEnbRrcProtocolReal")
418 .SetParent<Object>()
419 .SetGroupName("Lte")
420 .AddConstructor<LteEnbRrcProtocolReal>();
421 return tid;
422}
423
424void
426{
428}
429
432{
433 return m_enbRrcSapUser;
434}
435
436void
438{
439 m_cellId = cellId;
440}
441
444{
445 std::map<uint16_t, LteUeRrcSapProvider*>::const_iterator it;
446 it = m_enbRrcSapProviderMap.find(rnti);
447 NS_ASSERT_MSG(it != m_enbRrcSapProviderMap.end(), "could not find RNTI = " << rnti);
448 return it->second;
449}
450
451void
453{
454 std::map<uint16_t, LteUeRrcSapProvider*>::iterator it;
455 it = m_enbRrcSapProviderMap.find(rnti);
456 // assign UE RRC only if the RNTI is found at eNB
457 if (it != m_enbRrcSapProviderMap.end())
458 {
459 it->second = p;
460 }
461}
462
463void
465{
466 NS_LOG_FUNCTION(this << rnti);
467
468 // // walk list of all nodes to get the peer UE RRC SAP Provider
469 // Ptr<LteUeRrc> ueRrc;
470 // NodeList::Iterator listEnd = NodeList::End ();
471 // bool found = false;
472 // for (NodeList::Iterator i = NodeList::Begin (); (i != listEnd) && (found == false); i++)
473 // {
474 // Ptr<Node> node = *i;
475 // int nDevs = node->GetNDevices ();
476 // for (int j = 0; j < nDevs; j++)
477 // {
478 // Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
479 // if (!ueDev)
480 // {
481 // continue;
482 // }
483 // else
484 // {
485 // ueRrc = ueDev->GetRrc ();
486 // if ((ueRrc->GetRnti () == rnti) && (ueRrc->GetCellId () == m_cellId))
487 // {
488 // found = true;
489 // break;
490 // }
491 // }
492 // }
493 // }
494 // NS_ASSERT_MSG (found , " Unable to find UE with RNTI=" << rnti << " cellId=" << m_cellId);
495 // m_enbRrcSapProviderMap[rnti] = ueRrc->GetLteUeRrcSapProvider ();
496
497 // just create empty entry, the UeRrcSapProvider will be set by the
498 // ue upon connection request or connection reconfiguration
499 // completed
500 m_enbRrcSapProviderMap[rnti] = nullptr;
501
502 // Store SetupUeParameters
503 m_setupUeParametersMap[rnti] = params;
504
505 LteEnbRrcSapProvider::CompleteSetupUeParameters completeSetupUeParameters;
506 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator csupIt =
508 if (csupIt == m_completeSetupUeParametersMap.end())
509 {
510 // Create LteRlcSapUser, LtePdcpSapUser
511 LteRlcSapUser* srb0SapUser = new RealProtocolRlcSapUser(this, rnti);
512 LtePdcpSapUser* srb1SapUser =
514 completeSetupUeParameters.srb0SapUser = srb0SapUser;
515 completeSetupUeParameters.srb1SapUser = srb1SapUser;
516 // Store LteRlcSapUser, LtePdcpSapUser
517 m_completeSetupUeParametersMap[rnti] = completeSetupUeParameters;
518 }
519 else
520 {
521 completeSetupUeParameters = csupIt->second;
522 }
523 m_enbRrcSapProvider->CompleteSetupUe(rnti, completeSetupUeParameters);
524}
525
526void
528{
529 NS_LOG_FUNCTION(this << rnti);
530 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator it =
533 delete it->second.srb0SapUser;
534 delete it->second.srb1SapUser;
536 m_enbRrcSapProviderMap.erase(rnti);
537 m_setupUeParametersMap.erase(rnti);
538}
539
540void
542{
543 NS_LOG_FUNCTION(this << cellId);
544 // walk list of all nodes to get UEs with this cellId
545 Ptr<LteUeRrc> ueRrc;
546 for (NodeList::Iterator i = NodeList::Begin(); i != NodeList::End(); ++i)
547 {
548 Ptr<Node> node = *i;
549 int nDevs = node->GetNDevices();
550 for (int j = 0; j < nDevs; ++j)
551 {
552 Ptr<LteUeNetDevice> ueDev = node->GetDevice(j)->GetObject<LteUeNetDevice>();
553 if (ueDev)
554 {
555 Ptr<LteUeRrc> ueRrc = ueDev->GetRrc();
556 NS_LOG_LOGIC("considering UE IMSI " << ueDev->GetImsi() << " that has cellId "
557 << ueRrc->GetCellId());
558 if (ueRrc->GetCellId() == cellId)
559 {
560 NS_LOG_LOGIC("sending SI to IMSI " << ueDev->GetImsi());
561
562 Simulator::ScheduleWithContext(node->GetId(),
565 ueRrc->GetLteUeRrcSapProvider(),
566 msg);
567 }
568 }
569 }
570 }
571}
572
573void
575{
576 Ptr<Packet> packet = Create<Packet>();
577
578 RrcConnectionSetupHeader rrcConnectionSetupHeader;
579 rrcConnectionSetupHeader.SetMessage(msg);
580
581 packet->AddHeader(rrcConnectionSetupHeader);
582
583 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
584 transmitPdcpPduParameters.pdcpPdu = packet;
585 transmitPdcpPduParameters.rnti = rnti;
586 transmitPdcpPduParameters.lcid = 0;
587
588 m_setupUeParametersMap.at(rnti).srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
589}
590
591void
593{
594 Ptr<Packet> packet = Create<Packet>();
595
596 RrcConnectionRejectHeader rrcConnectionRejectHeader;
597 rrcConnectionRejectHeader.SetMessage(msg);
598
599 packet->AddHeader(rrcConnectionRejectHeader);
600
601 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
602 transmitPdcpPduParameters.pdcpPdu = packet;
603 transmitPdcpPduParameters.rnti = rnti;
604 transmitPdcpPduParameters.lcid = 0;
605
606 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
607}
608
609void
611 uint16_t rnti,
613{
614 Ptr<Packet> packet = Create<Packet>();
615
616 RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
617 rrcConnectionReconfigurationHeader.SetMessage(msg);
618
619 packet->AddHeader(rrcConnectionReconfigurationHeader);
620
621 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
622 transmitPdcpSduParameters.pdcpSdu = packet;
623 transmitPdcpSduParameters.rnti = rnti;
624 transmitPdcpSduParameters.lcid = 1;
625
626 m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu(transmitPdcpSduParameters);
627}
628
629void
631 uint16_t rnti,
633{
634 Ptr<Packet> packet = Create<Packet>();
635
636 RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
637 rrcConnectionReestablishmentHeader.SetMessage(msg);
638
639 packet->AddHeader(rrcConnectionReestablishmentHeader);
640
641 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
642 transmitPdcpPduParameters.pdcpPdu = packet;
643 transmitPdcpPduParameters.rnti = rnti;
644 transmitPdcpPduParameters.lcid = 0;
645
646 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
647}
648
649void
651 uint16_t rnti,
653{
654 Ptr<Packet> packet = Create<Packet>();
655
656 RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
657 rrcConnectionReestablishmentRejectHeader.SetMessage(msg);
658
659 packet->AddHeader(rrcConnectionReestablishmentRejectHeader);
660
661 LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
662 transmitPdcpPduParameters.pdcpPdu = packet;
663 transmitPdcpPduParameters.rnti = rnti;
664 transmitPdcpPduParameters.lcid = 0;
665
666 m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu(transmitPdcpPduParameters);
667}
668
669void
672{
673 // The code below is commented so RRC connection release can be sent in an ideal way
674 /*
675 Ptr<Packet> packet = Create<Packet> ();
676
677 RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
678 rrcConnectionReleaseHeader.SetMessage (msg);
679
680 packet->AddHeader (rrcConnectionReleaseHeader);
681
682 LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
683 transmitPdcpSduParameters.pdcpSdu = packet;
684 transmitPdcpSduParameters.rnti = rnti;
685 transmitPdcpSduParameters.lcid = 1;
686
687 m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
688 */
697 NS_LOG_FUNCTION(this << rnti);
701 msg);
702}
703
704void
706{
707 // Get type of message received
708 RrcUlCcchMessage rrcUlCcchMessage;
709 p->PeekHeader(rrcUlCcchMessage);
710
711 // Declare possible headers to receive
712 RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
713 RrcConnectionRequestHeader rrcConnectionRequestHeader;
714
715 // Deserialize packet and call member recv function with appropriate structure
716 switch (rrcUlCcchMessage.GetMessageType())
717 {
718 case 0:
719 p->RemoveHeader(rrcConnectionReestablishmentRequestHeader);
720 LteRrcSap::RrcConnectionReestablishmentRequest rrcConnectionReestablishmentRequestMsg;
721 rrcConnectionReestablishmentRequestMsg =
722 rrcConnectionReestablishmentRequestHeader.GetMessage();
724 rnti,
725 rrcConnectionReestablishmentRequestMsg);
726 break;
727 case 1:
728 p->RemoveHeader(rrcConnectionRequestHeader);
729 LteRrcSap::RrcConnectionRequest rrcConnectionRequestMsg;
730 rrcConnectionRequestMsg = rrcConnectionRequestHeader.GetMessage();
731 m_enbRrcSapProvider->RecvRrcConnectionRequest(rnti, rrcConnectionRequestMsg);
732 break;
733 }
734}
735
736void
738{
739 // Get type of message received
740 RrcUlDcchMessage rrcUlDcchMessage;
741 params.pdcpSdu->PeekHeader(rrcUlDcchMessage);
742
743 // Declare possible headers to receive
744 MeasurementReportHeader measurementReportHeader;
745 RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
746 RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
747 RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
748
749 // Declare possible messages to receive
750 LteRrcSap::MeasurementReport measurementReportMsg;
751 LteRrcSap::RrcConnectionReconfigurationCompleted rrcConnectionReconfigurationCompleteMsg;
752 LteRrcSap::RrcConnectionReestablishmentComplete rrcConnectionReestablishmentCompleteMsg;
753 LteRrcSap::RrcConnectionSetupCompleted rrcConnectionSetupCompletedMsg;
754
755 // Deserialize packet and call member recv function with appropriate structure
756 switch (rrcUlDcchMessage.GetMessageType())
757 {
758 case 1:
759 params.pdcpSdu->RemoveHeader(measurementReportHeader);
760 measurementReportMsg = measurementReportHeader.GetMessage();
761 m_enbRrcSapProvider->RecvMeasurementReport(params.rnti, measurementReportMsg);
762 break;
763 case 2:
764 params.pdcpSdu->RemoveHeader(rrcConnectionReconfigurationCompleteHeader);
765 rrcConnectionReconfigurationCompleteMsg =
766 rrcConnectionReconfigurationCompleteHeader.GetMessage();
768 params.rnti,
769 rrcConnectionReconfigurationCompleteMsg);
770 break;
771 case 3:
772 params.pdcpSdu->RemoveHeader(rrcConnectionReestablishmentCompleteHeader);
773 rrcConnectionReestablishmentCompleteMsg =
774 rrcConnectionReestablishmentCompleteHeader.GetMessage();
776 params.rnti,
777 rrcConnectionReestablishmentCompleteMsg);
778 break;
779 case 4:
780 params.pdcpSdu->RemoveHeader(rrcConnectionSetupCompleteHeader);
781 rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.GetMessage();
783 rrcConnectionSetupCompletedMsg);
784 break;
785 }
786}
787
791{
793 h.SetMessage(msg);
794
795 Ptr<Packet> p = Create<Packet>();
796 p->AddHeader(h);
797 return p;
798}
799
802{
804 p->RemoveHeader(h);
806 return msg;
807}
808
811{
813 h.SetMessage(msg);
814 Ptr<Packet> p = Create<Packet>();
815 p->AddHeader(h);
816 return p;
817}
818
821{
823 p->RemoveHeader(h);
825 return msg;
826}
827
829
831 : m_pdcp(pdcp),
832 m_rnti(rnti)
833{
834}
835
837{
838}
839
840void
842{
844}
845
846} // 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.
Definition: lte-rrc-sap.h:1244
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:1124
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.
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.
Ptr< LteUeRrc > m_rrc
the RRC
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.
Definition: lte-rrc-sap.h:1045
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:960
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: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
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() 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: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:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:936
#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:46
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
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:1248
SetupUeParameters structure.
Definition: lte-rrc-sap.h:1128
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
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:942
MeasurementReport structure.
Definition: lte-rrc-sap.h:948
RrcConnectionReconfigurationCompleted structure.
Definition: lte-rrc-sap.h:898
RrcConnectionReconfiguration structure.
Definition: lte-rrc-sap.h:881
RrcConnectionReestablishmentComplete structure.
Definition: lte-rrc-sap.h:919
RrcConnectionReestablishment structure.
Definition: lte-rrc-sap.h:911
RrcConnectionReestablishmentReject structure.
Definition: lte-rrc-sap.h:925
RrcConnectionReestablishmentRequest structure.
Definition: lte-rrc-sap.h:904
RrcConnectionReject structure.
Definition: lte-rrc-sap.h:936
RrcConnectionRelease structure.
Definition: lte-rrc-sap.h:930
RrcConnectionRequest structure.
Definition: lte-rrc-sap.h:730
RrcConnectionSetupCompleted structure.
Definition: lte-rrc-sap.h:744
RrcConnectionSetup structure.
Definition: lte-rrc-sap.h:736
SystemInformation structure.
Definition: lte-rrc-sap.h:643
LtePdcpSapUser * srb1SapUser
SRB1 SAP user.
Definition: lte-rrc-sap.h:1051
SetupParameters structure.
Definition: lte-rrc-sap.h:964
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
Definition: lte-rrc-sap.h:965
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
Definition: lte-rrc-sap.h:966