A Discrete-Event Network Simulator
API
lte-rrc-protocol-real.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Nicola Baldo <nbaldo@cttc.es>
19  * Lluis Parcerisa <lparcerisa@cttc.cat>
20  */
21 
22 #include <ns3/fatal-error.h>
23 #include <ns3/log.h>
24 #include <ns3/nstime.h>
25 #include <ns3/node-list.h>
26 #include <ns3/node.h>
27 #include <ns3/simulator.h>
28 
29 #include "lte-rrc-protocol-real.h"
30 #include "lte-ue-rrc.h"
31 #include "lte-enb-rrc.h"
32 #include "lte-enb-net-device.h"
33 #include "lte-ue-net-device.h"
34 
35 namespace ns3 {
36 
37 NS_LOG_COMPONENT_DEFINE ("LteRrcProtocolReal");
38 
41 
43 
45  : m_ueRrcSapProvider (0),
46  m_enbRrcSapProvider (0)
47 {
51 }
52 
54 {
55 }
56 
57 void
59 {
60  NS_LOG_FUNCTION (this);
61  delete m_ueRrcSapUser;
64  m_rrc = 0;
65 }
66 
67 TypeId
69 {
70  static TypeId tid = TypeId ("ns3::LteUeRrcProtocolReal")
71  .SetParent<Object> ()
72  .SetGroupName("Lte")
73  .AddConstructor<LteUeRrcProtocolReal> ()
74  ;
75  return tid;
76 }
77 
78 void
80 {
82 }
83 
86 {
87  return m_ueRrcSapUser;
88 }
89 
90 void
92 {
93  m_rrc = rrc;
94 }
95 
96 void
98 {
99  NS_LOG_FUNCTION (this);
100 
104 }
105 
106 void
108 {
109  // initialize the RNTI and get the EnbLteRrcSapProvider for the
110  // eNB we are currently attached to
111  m_rnti = m_rrc->GetRnti ();
113 
114  Ptr<Packet> packet = Create<Packet> ();
115 
116  RrcConnectionRequestHeader rrcConnectionRequestHeader;
117  rrcConnectionRequestHeader.SetMessage (msg);
118 
119  packet->AddHeader (rrcConnectionRequestHeader);
120 
121  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
122  transmitPdcpPduParameters.pdcpPdu = packet;
123  transmitPdcpPduParameters.rnti = m_rnti;
124  transmitPdcpPduParameters.lcid = 0;
125 
126  m_setupParameters.srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
127 }
128 
129 void
131 {
132  Ptr<Packet> packet = Create<Packet> ();
133 
134  RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
135  rrcConnectionSetupCompleteHeader.SetMessage (msg);
136 
137  packet->AddHeader (rrcConnectionSetupCompleteHeader);
138 
139  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
140  transmitPdcpSduParameters.pdcpSdu = packet;
141  transmitPdcpSduParameters.rnti = m_rnti;
142  transmitPdcpSduParameters.lcid = 1;
143 
145  {
146  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
147  }
148 }
149 
150 void
152 {
153  // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
154  // eNB we are currently attached to
155  m_rnti = m_rrc->GetRnti ();
157 
158  Ptr<Packet> packet = Create<Packet> ();
159 
160  RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
161  rrcConnectionReconfigurationCompleteHeader.SetMessage (msg);
162 
163  packet->AddHeader (rrcConnectionReconfigurationCompleteHeader);
164 
165  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
166  transmitPdcpSduParameters.pdcpSdu = packet;
167  transmitPdcpSduParameters.rnti = m_rnti;
168  transmitPdcpSduParameters.lcid = 1;
169 
170  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
171 }
172 
173 void
175 {
176  // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
177  // eNB we are currently attached to
178  m_rnti = m_rrc->GetRnti ();
180 
181  Ptr<Packet> packet = Create<Packet> ();
182 
183  MeasurementReportHeader measurementReportHeader;
184  measurementReportHeader.SetMessage (msg);
185 
186  packet->AddHeader (measurementReportHeader);
187 
188  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
189  transmitPdcpSduParameters.pdcpSdu = packet;
190  transmitPdcpSduParameters.rnti = m_rnti;
191  transmitPdcpSduParameters.lcid = 1;
192 
193  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
194 }
195 
196 void
198 {
199  Ptr<Packet> packet = Create<Packet> ();
200 
201  RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
202  rrcConnectionReestablishmentRequestHeader.SetMessage (msg);
203 
204  packet->AddHeader (rrcConnectionReestablishmentRequestHeader);
205 
206  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
207  transmitPdcpPduParameters.pdcpPdu = packet;
208  transmitPdcpPduParameters.rnti = m_rnti;
209  transmitPdcpPduParameters.lcid = 0;
210 
211  m_setupParameters.srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
212 }
213 
214 void
216 {
217  Ptr<Packet> packet = Create<Packet> ();
218 
219  RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
220  rrcConnectionReestablishmentCompleteHeader.SetMessage (msg);
221 
222  packet->AddHeader (rrcConnectionReestablishmentCompleteHeader);
223 
224  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
225  transmitPdcpSduParameters.pdcpSdu = packet;
226  transmitPdcpSduParameters.rnti = m_rnti;
227  transmitPdcpSduParameters.lcid = 1;
228 
229  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
230 }
231 
232 
233 void
235 {
236  uint16_t cellId = m_rrc->GetCellId ();
237 
238  // walk list of all nodes to get the peer eNB
239  Ptr<LteEnbNetDevice> enbDev;
240  NodeList::Iterator listEnd = NodeList::End ();
241  bool found = false;
242  for (NodeList::Iterator i = NodeList::Begin ();
243  (i != listEnd) && (!found);
244  ++i)
245  {
246  Ptr<Node> node = *i;
247  int nDevs = node->GetNDevices ();
248  for (int j = 0;
249  (j < nDevs) && (!found);
250  j++)
251  {
252  enbDev = node->GetDevice (j)->GetObject <LteEnbNetDevice> ();
253  if (enbDev == 0)
254  {
255  continue;
256  }
257  else
258  {
259  if (enbDev->HasCellId (cellId))
260  {
261  found = true;
262  break;
263  }
264  }
265  }
266  }
267  NS_ASSERT_MSG (found, " Unable to find eNB with CellId =" << cellId);
268  m_enbRrcSapProvider = enbDev->GetRrc ()->GetLteEnbRrcSapProvider ();
269  Ptr<LteEnbRrcProtocolReal> enbRrcProtocolReal = enbDev->GetRrc ()->GetObject<LteEnbRrcProtocolReal> ();
270  enbRrcProtocolReal->SetUeRrcSapProvider (m_rnti, m_ueRrcSapProvider);
271 }
272 
273 void
275 {
276  // Get type of message received
277  RrcDlCcchMessage rrcDlCcchMessage;
278  p->PeekHeader (rrcDlCcchMessage);
279 
280  // Declare possible headers to receive
281  RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
282  RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
283  RrcConnectionSetupHeader rrcConnectionSetupHeader;
284  RrcConnectionRejectHeader rrcConnectionRejectHeader;
285 
286  // Declare possible messages
287  LteRrcSap::RrcConnectionReestablishment rrcConnectionReestablishmentMsg;
288  LteRrcSap::RrcConnectionReestablishmentReject rrcConnectionReestablishmentRejectMsg;
289  LteRrcSap::RrcConnectionSetup rrcConnectionSetupMsg;
290  LteRrcSap::RrcConnectionReject rrcConnectionRejectMsg;
291 
292  // Deserialize packet and call member recv function with appropriate structure
293  switch ( rrcDlCcchMessage.GetMessageType () )
294  {
295  case 0:
296  // RrcConnectionReestablishment
297  p->RemoveHeader (rrcConnectionReestablishmentHeader);
298  rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.GetMessage ();
299  m_ueRrcSapProvider->RecvRrcConnectionReestablishment (rrcConnectionReestablishmentMsg);
300  break;
301  case 1:
302  // RrcConnectionReestablishmentReject
303  p->RemoveHeader (rrcConnectionReestablishmentRejectHeader);
304  rrcConnectionReestablishmentRejectMsg = rrcConnectionReestablishmentRejectHeader.GetMessage ();
305  // m_ueRrcSapProvider->RecvRrcConnectionReestablishmentReject (rrcConnectionReestablishmentRejectMsg);
306  break;
307  case 2:
308  // RrcConnectionReject
309  p->RemoveHeader (rrcConnectionRejectHeader);
310  rrcConnectionRejectMsg = rrcConnectionRejectHeader.GetMessage ();
311  m_ueRrcSapProvider->RecvRrcConnectionReject (rrcConnectionRejectMsg);
312  break;
313  case 3:
314  // RrcConnectionSetup
315  p->RemoveHeader (rrcConnectionSetupHeader);
316  rrcConnectionSetupMsg = rrcConnectionSetupHeader.GetMessage ();
317  m_ueRrcSapProvider->RecvRrcConnectionSetup (rrcConnectionSetupMsg);
318  break;
319  }
320 }
321 
322 void
324 {
325  // Get type of message received
326  RrcDlDcchMessage rrcDlDcchMessage;
327  params.pdcpSdu->PeekHeader (rrcDlDcchMessage);
328 
329  // Declare possible headers to receive
330  RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
331  RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
332 
333  // Declare possible messages to receive
334  LteRrcSap::RrcConnectionReconfiguration rrcConnectionReconfigurationMsg;
335  LteRrcSap::RrcConnectionRelease rrcConnectionReleaseMsg;
336 
337  // Deserialize packet and call member recv function with appropriate structure
338  switch ( rrcDlDcchMessage.GetMessageType () )
339  {
340  case 4:
341  params.pdcpSdu->RemoveHeader (rrcConnectionReconfigurationHeader);
342  rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.GetMessage ();
343  m_ueRrcSapProvider->RecvRrcConnectionReconfiguration (rrcConnectionReconfigurationMsg);
344  break;
345  case 5:
346  params.pdcpSdu->RemoveHeader (rrcConnectionReleaseHeader);
347  rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.GetMessage ();
348  //m_ueRrcSapProvider->RecvRrcConnectionRelease (rrcConnectionReleaseMsg);
349  break;
350  }
351 }
352 
354 
356  : m_enbRrcSapProvider (0)
357 {
358  NS_LOG_FUNCTION (this);
360 }
361 
363 {
364  NS_LOG_FUNCTION (this);
365 }
366 
367 void
369 {
370  NS_LOG_FUNCTION (this);
371  delete m_enbRrcSapUser;
372  for (std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
373  it = m_completeSetupUeParametersMap.begin ();
374  it != m_completeSetupUeParametersMap.end ();
375  ++it)
376  {
377  delete it->second.srb0SapUser;
378  delete it->second.srb1SapUser;
379  }
381 }
382 
383 TypeId
385 {
386  static TypeId tid = TypeId ("ns3::LteEnbRrcProtocolReal")
387  .SetParent<Object> ()
388  .SetGroupName("Lte")
389  .AddConstructor<LteEnbRrcProtocolReal> ()
390  ;
391  return tid;
392 }
393 
394 void
396 {
398 }
399 
402 {
403  return m_enbRrcSapUser;
404 }
405 
406 void
408 {
409  m_cellId = cellId;
410 }
411 
414 {
415  std::map<uint16_t, LteUeRrcSapProvider*>::const_iterator it;
416  it = m_enbRrcSapProviderMap.find (rnti);
417  NS_ASSERT_MSG (it != m_enbRrcSapProviderMap.end (), "could not find RNTI = " << rnti);
418  return it->second;
419 }
420 
421 void
423 {
424  std::map<uint16_t, LteUeRrcSapProvider*>::iterator it;
425  it = m_enbRrcSapProviderMap.find (rnti);
426  NS_ASSERT_MSG (it != m_enbRrcSapProviderMap.end (), "could not find RNTI = " << rnti);
427  it->second = p;
428 }
429 
430 void
432 {
433  NS_LOG_FUNCTION (this << rnti);
434 
435  // // walk list of all nodes to get the peer UE RRC SAP Provider
436  // Ptr<LteUeRrc> ueRrc;
437  // NodeList::Iterator listEnd = NodeList::End ();
438  // bool found = false;
439  // for (NodeList::Iterator i = NodeList::Begin (); (i != listEnd) && (found == false); i++)
440  // {
441  // Ptr<Node> node = *i;
442  // int nDevs = node->GetNDevices ();
443  // for (int j = 0; j < nDevs; j++)
444  // {
445  // Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
446  // if (!ueDev)
447  // {
448  // continue;
449  // }
450  // else
451  // {
452  // ueRrc = ueDev->GetRrc ();
453  // if ((ueRrc->GetRnti () == rnti) && (ueRrc->GetCellId () == m_cellId))
454  // {
455  // found = true;
456  // break;
457  // }
458  // }
459  // }
460  // }
461  // NS_ASSERT_MSG (found , " Unable to find UE with RNTI=" << rnti << " cellId=" << m_cellId);
462  // m_enbRrcSapProviderMap[rnti] = ueRrc->GetLteUeRrcSapProvider ();
463 
464  // just create empty entry, the UeRrcSapProvider will be set by the
465  // ue upon connection request or connection reconfiguration
466  // completed
467  m_enbRrcSapProviderMap[rnti] = 0;
468 
469  // Store SetupUeParameters
470  m_setupUeParametersMap[rnti] = params;
471 
472  LteEnbRrcSapProvider::CompleteSetupUeParameters completeSetupUeParameters;
473  std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
474  csupIt = m_completeSetupUeParametersMap.find (rnti);
475  if (csupIt == m_completeSetupUeParametersMap.end ())
476  {
477  // Create LteRlcSapUser, LtePdcpSapUser
478  LteRlcSapUser* srb0SapUser = new RealProtocolRlcSapUser (this,rnti);
480  completeSetupUeParameters.srb0SapUser = srb0SapUser;
481  completeSetupUeParameters.srb1SapUser = srb1SapUser;
482  // Store LteRlcSapUser, LtePdcpSapUser
483  m_completeSetupUeParametersMap[rnti] = completeSetupUeParameters;
484  }
485  else
486  {
487  completeSetupUeParameters = csupIt->second;
488  }
489  m_enbRrcSapProvider->CompleteSetupUe (rnti, completeSetupUeParameters);
490 }
491 
492 void
494 {
495  NS_LOG_FUNCTION (this << rnti);
496  std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
497  it = m_completeSetupUeParametersMap.find (rnti);
499  delete it->second.srb0SapUser;
500  delete it->second.srb1SapUser;
502  m_enbRrcSapProviderMap.erase (rnti);
503  m_setupUeParametersMap.erase (rnti);
504 }
505 
506 void
508 {
509  NS_LOG_FUNCTION (this << cellId);
510  // walk list of all nodes to get UEs with this cellId
511  Ptr<LteUeRrc> ueRrc;
512  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
513  {
514  Ptr<Node> node = *i;
515  int nDevs = node->GetNDevices ();
516  for (int j = 0; j < nDevs; ++j)
517  {
518  Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
519  if (ueDev != 0)
520  {
521  Ptr<LteUeRrc> ueRrc = ueDev->GetRrc ();
522  NS_LOG_LOGIC ("considering UE IMSI " << ueDev->GetImsi () << " that has cellId " << ueRrc->GetCellId ());
523  if (ueRrc->GetCellId () == cellId)
524  {
525  NS_LOG_LOGIC ("sending SI to IMSI " << ueDev->GetImsi ());
526  ueRrc->GetLteUeRrcSapProvider ()->RecvSystemInformation (msg);
529  ueRrc->GetLteUeRrcSapProvider (),
530  msg);
531  }
532  }
533  }
534  }
535 }
536 
537 void
539 {
540  Ptr<Packet> packet = Create<Packet> ();
541 
542  RrcConnectionSetupHeader rrcConnectionSetupHeader;
543  rrcConnectionSetupHeader.SetMessage (msg);
544 
545  packet->AddHeader (rrcConnectionSetupHeader);
546 
547  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
548  transmitPdcpPduParameters.pdcpPdu = packet;
549  transmitPdcpPduParameters.rnti = rnti;
550  transmitPdcpPduParameters.lcid = 0;
551 
552  m_setupUeParametersMap.at (rnti).srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
553 }
554 
555 void
557 {
558  Ptr<Packet> packet = Create<Packet> ();
559 
560  RrcConnectionRejectHeader rrcConnectionRejectHeader;
561  rrcConnectionRejectHeader.SetMessage (msg);
562 
563  packet->AddHeader (rrcConnectionRejectHeader);
564 
565  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
566  transmitPdcpPduParameters.pdcpPdu = packet;
567  transmitPdcpPduParameters.rnti = rnti;
568  transmitPdcpPduParameters.lcid = 0;
569 
570  m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
571 }
572 
573 void
575 {
576  Ptr<Packet> packet = Create<Packet> ();
577 
578  RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
579  rrcConnectionReconfigurationHeader.SetMessage (msg);
580 
581  packet->AddHeader (rrcConnectionReconfigurationHeader);
582 
583  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
584  transmitPdcpSduParameters.pdcpSdu = packet;
585  transmitPdcpSduParameters.rnti = rnti;
586  transmitPdcpSduParameters.lcid = 1;
587 
588  m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
589 }
590 
591 void
593 {
594  Ptr<Packet> packet = Create<Packet> ();
595 
596  RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
597  rrcConnectionReestablishmentHeader.SetMessage (msg);
598 
599  packet->AddHeader (rrcConnectionReestablishmentHeader);
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 
609 void
611 {
612  Ptr<Packet> packet = Create<Packet> ();
613 
614  RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
615  rrcConnectionReestablishmentRejectHeader.SetMessage (msg);
616 
617  packet->AddHeader (rrcConnectionReestablishmentRejectHeader);
618 
619  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
620  transmitPdcpPduParameters.pdcpPdu = packet;
621  transmitPdcpPduParameters.rnti = rnti;
622  transmitPdcpPduParameters.lcid = 0;
623 
624  m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
625 }
626 
627 void
629 {
630  Ptr<Packet> packet = Create<Packet> ();
631 
632  RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
633  rrcConnectionReleaseHeader.SetMessage (msg);
634 
635  packet->AddHeader (rrcConnectionReleaseHeader);
636 
637  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
638  transmitPdcpSduParameters.pdcpSdu = packet;
639  transmitPdcpSduParameters.rnti = rnti;
640  transmitPdcpSduParameters.lcid = 1;
641 
642  m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
643 }
644 
645 void
647 {
648  // Get type of message received
649  RrcUlCcchMessage rrcUlCcchMessage;
650  p->PeekHeader (rrcUlCcchMessage);
651 
652  // Declare possible headers to receive
653  RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
654  RrcConnectionRequestHeader rrcConnectionRequestHeader;
655 
656  // Deserialize packet and call member recv function with appropriate structure
657  switch ( rrcUlCcchMessage.GetMessageType () )
658  {
659  case 0:
660  p->RemoveHeader (rrcConnectionReestablishmentRequestHeader);
661  LteRrcSap::RrcConnectionReestablishmentRequest rrcConnectionReestablishmentRequestMsg;
662  rrcConnectionReestablishmentRequestMsg = rrcConnectionReestablishmentRequestHeader.GetMessage ();
663  m_enbRrcSapProvider->RecvRrcConnectionReestablishmentRequest (rnti,rrcConnectionReestablishmentRequestMsg);
664  break;
665  case 1:
666  p->RemoveHeader (rrcConnectionRequestHeader);
667  LteRrcSap::RrcConnectionRequest rrcConnectionRequestMsg;
668  rrcConnectionRequestMsg = rrcConnectionRequestHeader.GetMessage ();
669  m_enbRrcSapProvider->RecvRrcConnectionRequest (rnti,rrcConnectionRequestMsg);
670  break;
671  }
672 }
673 
674 void
676 {
677  // Get type of message received
678  RrcUlDcchMessage rrcUlDcchMessage;
679  params.pdcpSdu->PeekHeader (rrcUlDcchMessage);
680 
681  // Declare possible headers to receive
682  MeasurementReportHeader measurementReportHeader;
683  RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
684  RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
685  RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
686 
687  // Declare possible messages to receive
688  LteRrcSap::MeasurementReport measurementReportMsg;
689  LteRrcSap::RrcConnectionReconfigurationCompleted rrcConnectionReconfigurationCompleteMsg;
690  LteRrcSap::RrcConnectionReestablishmentComplete rrcConnectionReestablishmentCompleteMsg;
691  LteRrcSap::RrcConnectionSetupCompleted rrcConnectionSetupCompletedMsg;
692 
693  // Deserialize packet and call member recv function with appropriate structure
694  switch ( rrcUlDcchMessage.GetMessageType () )
695  {
696  case 1:
697  params.pdcpSdu->RemoveHeader (measurementReportHeader);
698  measurementReportMsg = measurementReportHeader.GetMessage ();
699  m_enbRrcSapProvider->RecvMeasurementReport (params.rnti,measurementReportMsg);
700  break;
701  case 2:
702  params.pdcpSdu->RemoveHeader (rrcConnectionReconfigurationCompleteHeader);
703  rrcConnectionReconfigurationCompleteMsg = rrcConnectionReconfigurationCompleteHeader.GetMessage ();
704  m_enbRrcSapProvider->RecvRrcConnectionReconfigurationCompleted (params.rnti,rrcConnectionReconfigurationCompleteMsg);
705  break;
706  case 3:
707  params.pdcpSdu->RemoveHeader (rrcConnectionReestablishmentCompleteHeader);
708  rrcConnectionReestablishmentCompleteMsg = rrcConnectionReestablishmentCompleteHeader.GetMessage ();
709  m_enbRrcSapProvider->RecvRrcConnectionReestablishmentComplete (params.rnti,rrcConnectionReestablishmentCompleteMsg);
710  break;
711  case 4:
712  params.pdcpSdu->RemoveHeader (rrcConnectionSetupCompleteHeader);
713  rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.GetMessage ();
714  m_enbRrcSapProvider->RecvRrcConnectionSetupCompleted (params.rnti, rrcConnectionSetupCompletedMsg);
715  break;
716  }
717 }
718 
721 {
723  h.SetMessage (msg);
724 
725  Ptr<Packet> p = Create<Packet> ();
726  p->AddHeader (h);
727  return p;
728 }
729 
732 {
734  p->RemoveHeader (h);
736  return msg;
737 }
738 
741 {
743  h.SetMessage (msg);
744  Ptr<Packet> p = Create<Packet> ();
745  p->AddHeader (h);
746  return p;
747 }
748 
751 {
753  p->RemoveHeader (h);
755  return msg;
756 }
757 
759 
761  : m_pdcp (pdcp),
762  m_rnti (rnti)
763 {
764 }
765 
767 {
768 }
769 
770 void
772 {
774 }
775 
776 } // namespace ns3
virtual void DoDispose(void)
Destructor implementation.
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
RrcConnectionRequest structure.
Definition: lte-rrc-sap.h:685
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
virtual void ReceivePdcpPdu(Ptr< Packet > p)
Called by the RLC entity to notify the PDCP entity of the reception of a new PDCP PDU...
void DoSetup(LteUeRrcSapUser::SetupParameters params)
Setup function.
LteRrcSap::RrcConnectionReject GetMessage() const
Returns a RrcConnectionReject IE from the values in the class attributes.
LtePdcpSapProvider * srb1SapProvider
SRB1 SAP provider.
Definition: lte-rrc-sap.h:916
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
LteRrcSap::HandoverPreparationInfo GetMessage() const
Returns a HandoverPreparationInfo IE from the values in the class attributes.
void DoSendMeasurementReport(LteRrcSap::MeasurementReport msg)
Send measurement report function.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void RecvRrcConnectionSetupCompleted(uint16_t rnti, RrcConnectionSetupCompleted msg)=0
Receive an RRCConnectionSetupComplete message from a UE during an RRC connection establishment proced...
LteRrcSap::RrcConnectionReestablishmentReject GetMessage() const
Returns a RrcConnectionReestablishmentReject IE from the values in the class attributes.
Part of the RRC protocol.
Definition: lte-rrc-sap.h:982
LteUeRrcSapProvider * m_ueRrcSapProvider
UE RRC SAP provider.
MeasurementReport structure.
Definition: lte-rrc-sap.h:894
void DoSendRrcConnectionReject(uint16_t rnti, LteRrcSap::RrcConnectionReject msg)
Send RRC connection reject function.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
virtual void DoDispose(void)
Destructor implementation.
void DoSendRrcConnectionRelease(uint16_t rnti, LteRrcSap::RrcConnectionRelease msg)
Send RRC connection release function.
friend class RealProtocolRlcSapUser
allow RealProtocolRlcSapUser class friend access
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
Definition: node.cc:142
LteRlcSpecificLteRlcSapUser class.
Definition: lte-rlc-sap.h:124
Part of the RRC protocol.
Definition: lte-rrc-sap.h:1182
void SetMessage(LteRrcSap::RrcConnectionRequest msg)
Receives a RrcConnectionRequest IE and stores the contents into the class attributes.
void SetMessage(LteRrcSap::RrcConnectionSetupCompleted msg)
Receives a RrcConnectionSetupCompleted IE and stores the contents into the class attributes.
void SetMessage(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Receives a RrcConnectionReestablishmentRequest IE and stores the contents into the class attributes...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition: assert.h:67
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1022
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
void SetMessage(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Receives a RrcConnectionReestablishmentComplete IE and stores the contents into the class attributes...
static TypeId GetTypeId(void)
Get the type ID.
void SetMessage(LteRrcSap::RrcConnectionReestablishment msg)
Receives a RrcConnectionReestablishment IE and stores the contents into the class attributes...
Template for the implementation of the LteEnbRrcSapUser as a member of an owner class of type C to wh...
Definition: lte-rrc-sap.h:1465
Ptr< Packet > DoEncodeHandoverCommand(LteRrcSap::RrcConnectionReconfiguration msg)
Encode handover command function.
LteUeRrcSapProvider::CompleteSetupParameters m_completeSetupParameters
complete setup parameters
LteRrcSap::RrcConnectionReconfiguration DoDecodeHandoverCommand(Ptr< Packet > p)
Decode handover command function.
Ptr< Packet > DoEncodeHandoverPreparationInformation(LteRrcSap::HandoverPreparationInfo msg)
Encode handover preparation information function.
SetupParameters structure.
Definition: lte-rrc-sap.h:913
int GetMessageType()
Get message type.
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 ...
LtePdcpSapUser * srb1SapUser
SRB1 SAP user.
Definition: lte-rrc-sap.h:989
LteUeRrcSapProvider * GetUeRrcSapProvider(uint16_t rnti)
Get UE RRC SAP provider function.
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
std::map< uint16_t, LteEnbRrcSapUser::SetupUeParameters > m_setupUeParametersMap
setup UE parameters map
std::map< uint16_t, LteUeRrcSapProvider * > m_enbRrcSapProviderMap
ENB RRC SAP provider map.
LteUeRrcSapUser * m_ueRrcSapUser
UE RRC SAP user.
This class manages the serialization/deserialization of RrcConnectionSetupComplete IE...
LteRrcSap::RrcConnectionSetupCompleted GetMessage() const
Returns a RrcConnectionSetupCompleted IE from the values in the class attributes. ...
virtual void RecvRrcConnectionReject(RrcConnectionReject msg)=0
Receive an RRCConnectionReject message from the serving eNodeB during an RRC connection establishment...
SystemInformation structure.
Definition: lte-rrc-sap.h:601
void SetMessage(LteRrcSap::RrcConnectionRelease msg)
Receives a RrcConnectionRelease IE and stores the contents into the class attributes.
LteRrcSap::RrcConnectionReestablishment GetMessage() const
Returns a RrcConnectionReestablishment IE from the values in the class attributes.
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
Definition: lte-pdcp-sap.h:76
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-pdcp-sap.h:79
void SetLteEnbRrcSapProvider(LteEnbRrcSapProvider *p)
Set LTE ENB RRC SAP provider function.
This class manages the serialization/deserialization of RrcConnectionSetup IE.
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1381
void DoSendRrcConnectionSetup(uint16_t rnti, LteRrcSap::RrcConnectionSetup msg)
Send RRC connection setup function.
void SetMessage(LteRrcSap::RrcConnectionReestablishmentReject msg)
Receives a RrcConnectionReestablishmentReject IE and stores the contents into the class attributes...
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
void SetUeRrcSapProvider(uint16_t rnti, LteUeRrcSapProvider *p)
Set UE RRC SAP provider function.
RrcConnectionReestablishment structure.
Definition: lte-rrc-sap.h:858
LteRrcSap::RrcConnectionReestablishmentComplete GetMessage() const
Returns a RrcConnectionReestablishmentComplete IE from the values in the class attributes.
void DoSendRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
Send RRC connection reestablishment request function.
static Iterator End(void)
Definition: node-list.cc:235
const Time RRC_REAL_MSG_DELAY
RRC real message delay.
virtual void RecvRrcConnectionReconfiguration(RrcConnectionReconfiguration msg)=0
Receive an RRCConnectionReconfiguration message from the serving eNodeB during an RRC connection reco...
std::map< uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters > m_completeSetupUeParametersMap
complete setup UE parameters map
This class manages the serialization/deserialization of RrcConnectionReject IE.
virtual void RecvRrcConnectionReestablishment(RrcConnectionReestablishment msg)=0
Receive an RRCConnectionReestablishment message from the serving eNodeB during an RRC connection re-e...
void DoReceivePdcpPdu(Ptr< Packet > p)
Receive PDCP PDU function.
RrcConnectionReconfiguration structure.
Definition: lte-rrc-sap.h:829
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-pdcp-sap.h:46
SetupUeParameters structure.
Definition: lte-rrc-sap.h:1067
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:290
void SetMessage(LteRrcSap::RrcConnectionReject msg)
Receives a RrcConnectionReject IE and stores the contents into the class attributes.
RrcConnectionReconfigurationCompleted structure.
Definition: lte-rrc-sap.h:844
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
Definition: lte-pdcp-sap.h:43
void SetEnbRrcSapProvider()
Set ENB RRC SAP provider.
LteRrcSap::RrcConnectionSetup GetMessage() const
Returns a RrcConnectionSetup IE from the values in the class attributes.
LteEnbRrcSapUser * GetLteEnbRrcSapUser()
Get LTE ENB RRC SAP user function.
This class manages the serialization/deserialization of RRCConnectionReestablishmentRequest IE...
RrcConnectionSetupCompleted structure.
Definition: lte-rrc-sap.h:698
HandoverPreparationInfo structure.
Definition: lte-rrc-sap.h:888
RrcConnectionSetup structure.
Definition: lte-rrc-sap.h:691
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-rlc-sap.h:47
void SetMessage(LteRrcSap::MeasurementReport msg)
Receives a MeasurementReport IE and stores the contents into the class attributes.
RrcConnectionReestablishmentRequest structure.
Definition: lte-rrc-sap.h:851
void SetMessage(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Receives a RrcConnectionReconfigurationCompleted IE and stores the contents into the class attributes...
Part of the RRC protocol.
Definition: lte-rrc-sap.h:1063
void DoSendRrcConnectionReestablishmentReject(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentReject msg)
Send RRC connection reestabishment reject function.
LteRrcSap::RrcConnectionReestablishmentRequest GetMessage() const
Returns a RrcConnectionReestablishmentRequest IE from the values in the class attributes.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void RecvRrcConnectionSetup(RrcConnectionSetup msg)=0
Receive an RRCConnectionSetup message from the serving eNodeB during an RRC connection establishment ...
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-list.h:44
RrcConnectionReject structure.
Definition: lte-rrc-sap.h:882
virtual void CompleteSetup(CompleteSetupParameters params)=0
Complete setup function.
Ptr< LteUeRrc > m_rrc
the RRC
void DoSendRrcConnectionReconfiguration(uint16_t rnti, LteRrcSap::RrcConnectionReconfiguration msg)
Send RRC connection reconfiguration function.
virtual void RecvRrcConnectionRequest(uint16_t rnti, RrcConnectionRequest msg)=0
Receive an RRCConnectionRequest message from a UE during an RRC connection establishment procedure (S...
void DoSendRrcConnectionReestablishment(uint16_t rnti, LteRrcSap::RrcConnectionReestablishment msg)
Send RRC connection reestabishment function.
This class manages the serialization/deserialization of RrcConnectionRequest IE.
This class manages the serialization/deserialization of HandoverPreparationInfo IE.
This class manages the serialization/deserialization of RrcConnectionRelease IE.
LtePdcpSpecificLtePdcpSapUser class.
Definition: lte-pdcp-sap.h:132
LteEnbRrcSapProvider * m_enbRrcSapProvider
ENB RRC SAP provider.
virtual void RecvSystemInformation(SystemInformation msg)=0
Receive a SystemInformation message from the serving eNodeB during a system information acquisition p...
RrcConnectionReestablishmentReject structure.
Definition: lte-rrc-sap.h:871
LteRlcSapUser * srb0SapUser
SRB0 SAP user.
Definition: lte-rrc-sap.h:988
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
void SetMessage(LteRrcSap::HandoverPreparationInfo msg)
Receives a HandoverPreparationInfo IE and stores the contents into the class attributes.
void DoSendRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
Send RRC connection reestablishment complete function.
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
Send a RRC PDU to the RDCP for transmission This method is to be called when upper RRC entity has a R...
void DoSendRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Send RRC connection setup completed function.
This class manages the serialization/deserialization of MeasurementReport IE.
LteRrcSap::RrcConnectionRequest GetMessage() const
Returns a RrcConnectionRequest IE from the values in the class attributes.
Parameters for LteRlcSapProvider::TransmitPdcpPdu.
Definition: lte-rlc-sap.h:43
LteRrcSap::MeasurementReport GetMessage() const
Returns a MeasurementReport IE from the values in the class attributes.
void DoSendRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
Send RRC connection reconfiguration setup completed function.
static TypeId GetTypeId(void)
Get the type ID.
This class manages the serialization/deserialization of RrcConnectionReconfiguration IE...
LteUeRrcSapUser::SetupParameters m_setupParameters
setup parameters
void DoSendRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
Send RRC connection request function.
virtual void RecvRrcConnectionReestablishmentRequest(uint16_t rnti, RrcConnectionReestablishmentRequest msg)=0
Receive an RRCConnectionReestablishmentRequest message from a UE during an RRC connection re-establis...
void SetMessage(LteRrcSap::RrcConnectionSetup msg)
Receives a RrcConnectionSetup IE and stores the contents into the class attributes.
static Iterator Begin(void)
Definition: node-list.cc:229
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36.323 Packet Data Convergence Protocol (PDCP) specification.
Definition: lte-pdcp-sap.h:68
void DoReceivePdcpPdu(uint16_t rnti, Ptr< Packet > p)
Receive PDCP PDU function.
This class manages the serialization/deserialization of RrcConnectionReestablishmentReject IE...
LteRlcSapProvider * srb0SapProvider
SRB0 SAP provider.
Definition: lte-rrc-sap.h:915
CompleteSetupUeParameters structure.
Definition: lte-rrc-sap.h:1186
LteEnbRrcSapUser * m_enbRrcSapUser
ENB RRC SAP user.
This class manages the serialization/deserialization of RrcConnectionReestablishmentComplete IE...
RrcConnectionReestablishmentComplete structure.
Definition: lte-rrc-sap.h:865
virtual void RecvMeasurementReport(uint16_t rnti, MeasurementReport msg)=0
Receive a MeasurementReport message from a UE during a measurement reporting procedure (Section 5...
LteRrcSap::HandoverPreparationInfo DoDecodeHandoverPreparationInformation(Ptr< Packet > p)
Decode handover preparation information function.
LteEnbRrcSapProvider * m_enbRrcSapProvider
ENB RRC SAP provider.
void SetMessage(LteRrcSap::RrcConnectionReconfiguration msg)
Receives a RrcConnectionReconfiguration IE and stores the contents into the class attributes...
This class manages the serialization/deserialization of RrcConnectionReestablishment IE...
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Receive PDCP SDU function.
void SetCellId(uint16_t cellId)
Set cell ID function.
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-rlc-sap.h:46
virtual void RecvRrcConnectionReestablishmentComplete(uint16_t rnti, RrcConnectionReestablishmentComplete msg)=0
Receive an RRCConnectionReestablishmentComplete message from a UE during an RRC connection re-establi...
virtual void CompleteSetupUe(uint16_t rnti, CompleteSetupUeParameters params)=0
Complete setup UE function.
Template for the implementation of the LteUeRrcSapUser as a member of an owner class of type C to whi...
Definition: lte-rrc-sap.h:1276
LteRrcSap::RrcConnectionReconfiguration GetMessage() const
Returns a RrcConnectionReconfiguration IE from the values in the class attributes.
A base class which provides memory management and object aggregation.
Definition: object.h:87
LteUeRrcSapUser * GetLteUeRrcSapUser()
Get LTE UE RRC SAP user function.
Part of the RRC protocol.
Definition: lte-rrc-sap.h:909
RrcConnectionRelease structure.
Definition: lte-rrc-sap.h:876
LteEnbRrcProtocolReal * m_pdcp
PDCP.
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-pdcp-sap.h:47
void SetLteUeRrcSapProvider(LteUeRrcSapProvider *p)
Set LTE UE RRC SAP provider function.
void DoSendSystemInformation(uint16_t cellId, LteRrcSap::SystemInformation msg)
Send system information function.
The eNodeB device implementation.
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
LteRrcSap::RrcConnectionReconfigurationCompleted GetMessage() const
Returns a RrcConnectionReconfigurationCompleted IE from the values in the class attributes.
LteRrcSap::RrcConnectionRelease GetMessage() const
Returns a RrcConnectionRelease IE from the values in the class attributes.
virtual void RecvRrcConnectionReconfigurationCompleted(uint16_t rnti, RrcConnectionReconfigurationCompleted msg)=0
Receive an RRCConnectionReconfigurationComplete message from a UE during an RRC connection reconfigur...
a unique identifier for an interface.
Definition: type-id.h:58
Ptr< LteEnbRrc > GetRrc() const
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
bool HasCellId(uint16_t cellId) const
void DoSetupUe(uint16_t rnti, LteEnbRrcSapUser::SetupUeParameters params)
Setup UE function.
void DoRemoveUe(uint16_t rnti)
Remove UE function.
void SetUeRrc(Ptr< LteUeRrc > rrc)
Set UE RRC function.
This class manages the serialization/deserialization of RrcConnectionSetupComplete IE...
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
uint32_t GetNDevices(void) const
Definition: node.cc:150
The LteUeNetDevice class implements the UE net device.