A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 NS_LOG_COMPONENT_DEFINE ("LteRrcProtocolReal");
36 
37 
38 namespace ns3 {
39 
40 
41 const Time RRC_REAL_MSG_DELAY = MilliSeconds (0);
42 
44  ;
45 
47  : m_ueRrcSapProvider (0),
48  m_enbRrcSapProvider (0)
49 {
53 }
54 
56 {
57 }
58 
59 void
61 {
62  NS_LOG_FUNCTION (this);
63  delete m_ueRrcSapUser;
66  m_rrc = 0;
67 }
68 
69 TypeId
71 {
72  static TypeId tid = TypeId ("ns3::LteUeRrcProtocolReal")
73  .SetParent<Object> ()
74  .AddConstructor<LteUeRrcProtocolReal> ()
75  ;
76  return tid;
77 }
78 
79 void
81 {
83 }
84 
87 {
88  return m_ueRrcSapUser;
89 }
90 
91 void
93 {
94  m_rrc = rrc;
95 }
96 
97 void
99 {
100  NS_LOG_FUNCTION (this);
101 
105 }
106 
107 void
109 {
110  // initialize the RNTI and get the EnbLteRrcSapProvider for the
111  // eNB we are currently attached to
112  m_rnti = m_rrc->GetRnti ();
114 
115  Ptr<Packet> packet = Create<Packet> ();
116 
117  RrcConnectionRequestHeader rrcConnectionRequestHeader;
118  rrcConnectionRequestHeader.SetMessage (msg);
119 
120  packet->AddHeader (rrcConnectionRequestHeader);
121 
122  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
123  transmitPdcpPduParameters.pdcpPdu = packet;
124  transmitPdcpPduParameters.rnti = m_rnti;
125  transmitPdcpPduParameters.lcid = 0;
126 
127  m_setupParameters.srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
128 }
129 
130 void
132 {
133  Ptr<Packet> packet = Create<Packet> ();
134 
135  RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
136  rrcConnectionSetupCompleteHeader.SetMessage (msg);
137 
138  packet->AddHeader (rrcConnectionSetupCompleteHeader);
139 
140  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
141  transmitPdcpSduParameters.pdcpSdu = packet;
142  transmitPdcpSduParameters.rnti = m_rnti;
143  transmitPdcpSduParameters.lcid = 1;
144 
146  {
147  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
148  }
149 }
150 
151 void
153 {
154  // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
155  // eNB we are currently attached to
156  m_rnti = m_rrc->GetRnti ();
158 
159  Ptr<Packet> packet = Create<Packet> ();
160 
161  RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
162  rrcConnectionReconfigurationCompleteHeader.SetMessage (msg);
163 
164  packet->AddHeader (rrcConnectionReconfigurationCompleteHeader);
165 
166  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
167  transmitPdcpSduParameters.pdcpSdu = packet;
168  transmitPdcpSduParameters.rnti = m_rnti;
169  transmitPdcpSduParameters.lcid = 1;
170 
171  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
172 }
173 
174 void
176 {
177  // re-initialize the RNTI and get the EnbLteRrcSapProvider for the
178  // eNB we are currently attached to
179  m_rnti = m_rrc->GetRnti ();
181 
182  Ptr<Packet> packet = Create<Packet> ();
183 
184  MeasurementReportHeader measurementReportHeader;
185  measurementReportHeader.SetMessage (msg);
186 
187  packet->AddHeader (measurementReportHeader);
188 
189  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
190  transmitPdcpSduParameters.pdcpSdu = packet;
191  transmitPdcpSduParameters.rnti = m_rnti;
192  transmitPdcpSduParameters.lcid = 1;
193 
194  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
195 }
196 
197 void
199 {
200  Ptr<Packet> packet = Create<Packet> ();
201 
202  RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
203  rrcConnectionReestablishmentRequestHeader.SetMessage (msg);
204 
205  packet->AddHeader (rrcConnectionReestablishmentRequestHeader);
206 
207  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
208  transmitPdcpPduParameters.pdcpPdu = packet;
209  transmitPdcpPduParameters.rnti = m_rnti;
210  transmitPdcpPduParameters.lcid = 0;
211 
212  m_setupParameters.srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
213 }
214 
215 void
217 {
218  Ptr<Packet> packet = Create<Packet> ();
219 
220  RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
221  rrcConnectionReestablishmentCompleteHeader.SetMessage (msg);
222 
223  packet->AddHeader (rrcConnectionReestablishmentCompleteHeader);
224 
225  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
226  transmitPdcpSduParameters.pdcpSdu = packet;
227  transmitPdcpSduParameters.rnti = m_rnti;
228  transmitPdcpSduParameters.lcid = 1;
229 
230  m_setupParameters.srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
231 }
232 
233 
234 void
236 {
237  uint16_t cellId = m_rrc->GetCellId ();
238 
239  // walk list of all nodes to get the peer eNB
240  Ptr<LteEnbNetDevice> enbDev;
241  NodeList::Iterator listEnd = NodeList::End ();
242  bool found = false;
243  for (NodeList::Iterator i = NodeList::Begin ();
244  (i != listEnd) && (!found);
245  ++i)
246  {
247  Ptr<Node> node = *i;
248  int nDevs = node->GetNDevices ();
249  for (int j = 0;
250  (j < nDevs) && (!found);
251  j++)
252  {
253  enbDev = node->GetDevice (j)->GetObject <LteEnbNetDevice> ();
254  if (enbDev == 0)
255  {
256  continue;
257  }
258  else
259  {
260  if (enbDev->GetCellId () == cellId)
261  {
262  found = true;
263  break;
264  }
265  }
266  }
267  }
268  NS_ASSERT_MSG (found, " Unable to find eNB with CellId =" << cellId);
269  m_enbRrcSapProvider = enbDev->GetRrc ()->GetLteEnbRrcSapProvider ();
270  Ptr<LteEnbRrcProtocolReal> enbRrcProtocolReal = enbDev->GetRrc ()->GetObject<LteEnbRrcProtocolReal> ();
271  enbRrcProtocolReal->SetUeRrcSapProvider (m_rnti, m_ueRrcSapProvider);
272 }
273 
274 void
276 {
277  // Get type of message received
278  RrcDlCcchMessage rrcDlCcchMessage;
279  p->PeekHeader (rrcDlCcchMessage);
280 
281  // Declare possible headers to receive
282  RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
283  RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
284  RrcConnectionSetupHeader rrcConnectionSetupHeader;
285  RrcConnectionRejectHeader rrcConnectionRejectHeader;
286 
287  // Declare possible messages
288  LteRrcSap::RrcConnectionReestablishment rrcConnectionReestablishmentMsg;
289  LteRrcSap::RrcConnectionReestablishmentReject rrcConnectionReestablishmentRejectMsg;
290  LteRrcSap::RrcConnectionSetup rrcConnectionSetupMsg;
291  LteRrcSap::RrcConnectionReject rrcConnectionRejectMsg;
292 
293  // Deserialize packet and call member recv function with appropiate structure
294  switch ( rrcDlCcchMessage.GetMessageType () )
295  {
296  case 0:
297  // RrcConnectionReestablishment
298  p->RemoveHeader (rrcConnectionReestablishmentHeader);
299  rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.GetMessage ();
300  m_ueRrcSapProvider->RecvRrcConnectionReestablishment (rrcConnectionReestablishmentMsg);
301  break;
302  case 1:
303  // RrcConnectionReestablishmentReject
304  p->RemoveHeader (rrcConnectionReestablishmentRejectHeader);
305  rrcConnectionReestablishmentRejectMsg = rrcConnectionReestablishmentRejectHeader.GetMessage ();
306  // m_ueRrcSapProvider->RecvRrcConnectionReestablishmentReject (rrcConnectionReestablishmentRejectMsg);
307  break;
308  case 2:
309  // RrcConnectionReject
310  p->RemoveHeader (rrcConnectionRejectHeader);
311  rrcConnectionRejectMsg = rrcConnectionRejectHeader.GetMessage ();
312  m_ueRrcSapProvider->RecvRrcConnectionReject (rrcConnectionRejectMsg);
313  break;
314  case 3:
315  // RrcConnectionSetup
316  p->RemoveHeader (rrcConnectionSetupHeader);
317  rrcConnectionSetupMsg = rrcConnectionSetupHeader.GetMessage ();
318  m_ueRrcSapProvider->RecvRrcConnectionSetup (rrcConnectionSetupMsg);
319  break;
320  }
321 }
322 
323 void
325 {
326  // Get type of message received
327  RrcDlDcchMessage rrcDlDcchMessage;
328  params.pdcpSdu->PeekHeader (rrcDlDcchMessage);
329 
330  // Declare possible headers to receive
331  RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
332  RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
333 
334  // Declare possible messages to receive
335  LteRrcSap::RrcConnectionReconfiguration rrcConnectionReconfigurationMsg;
336  LteRrcSap::RrcConnectionRelease rrcConnectionReleaseMsg;
337 
338  // Deserialize packet and call member recv function with appropiate structure
339  switch ( rrcDlDcchMessage.GetMessageType () )
340  {
341  case 4:
342  params.pdcpSdu->RemoveHeader (rrcConnectionReconfigurationHeader);
343  rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.GetMessage ();
344  m_ueRrcSapProvider->RecvRrcConnectionReconfiguration (rrcConnectionReconfigurationMsg);
345  break;
346  case 5:
347  params.pdcpSdu->RemoveHeader (rrcConnectionReleaseHeader);
348  rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.GetMessage ();
349  //m_ueRrcSapProvider->RecvRrcConnectionRelease (rrcConnectionReleaseMsg);
350  break;
351  }
352 }
353 
355  ;
356 
358  : m_enbRrcSapProvider (0)
359 {
360  NS_LOG_FUNCTION (this);
362 }
363 
365 {
366  NS_LOG_FUNCTION (this);
367 }
368 
369 void
371 {
372  NS_LOG_FUNCTION (this);
373  delete m_enbRrcSapUser;
374  for (std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
375  it = m_completeSetupUeParametersMap.begin ();
376  it != m_completeSetupUeParametersMap.end ();
377  ++it)
378  {
379  delete it->second.srb0SapUser;
380  delete it->second.srb1SapUser;
381  }
383 }
384 
385 TypeId
387 {
388  static TypeId tid = TypeId ("ns3::LteEnbRrcProtocolReal")
389  .SetParent<Object> ()
390  .AddConstructor<LteEnbRrcProtocolReal> ()
391  ;
392  return tid;
393 }
394 
395 void
397 {
399 }
400 
403 {
404  return m_enbRrcSapUser;
405 }
406 
407 void
409 {
410  m_cellId = cellId;
411 }
412 
415 {
416  std::map<uint16_t, LteUeRrcSapProvider*>::const_iterator it;
417  it = m_enbRrcSapProviderMap.find (rnti);
418  NS_ASSERT_MSG (it != m_enbRrcSapProviderMap.end (), "could not find RNTI = " << rnti);
419  return it->second;
420 }
421 
422 void
424 {
425  std::map<uint16_t, LteUeRrcSapProvider*>::iterator it;
426  it = m_enbRrcSapProviderMap.find (rnti);
427  NS_ASSERT_MSG (it != m_enbRrcSapProviderMap.end (), "could not find RNTI = " << rnti);
428  it->second = p;
429 }
430 
431 void
433 {
434  NS_LOG_FUNCTION (this << rnti);
435 
436  // // walk list of all nodes to get the peer UE RRC SAP Provider
437  // Ptr<LteUeRrc> ueRrc;
438  // NodeList::Iterator listEnd = NodeList::End ();
439  // bool found = false;
440  // for (NodeList::Iterator i = NodeList::Begin (); (i != listEnd) && (found == false); i++)
441  // {
442  // Ptr<Node> node = *i;
443  // int nDevs = node->GetNDevices ();
444  // for (int j = 0; j < nDevs; j++)
445  // {
446  // Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
447  // if (!ueDev)
448  // {
449  // continue;
450  // }
451  // else
452  // {
453  // ueRrc = ueDev->GetRrc ();
454  // if ((ueRrc->GetRnti () == rnti) && (ueRrc->GetCellId () == m_cellId))
455  // {
456  // found = true;
457  // break;
458  // }
459  // }
460  // }
461  // }
462  // NS_ASSERT_MSG (found , " Unable to find UE with RNTI=" << rnti << " cellId=" << m_cellId);
463  // m_enbRrcSapProviderMap[rnti] = ueRrc->GetLteUeRrcSapProvider ();
464 
465  // just create empty entry, the UeRrcSapProvider will be set by the
466  // ue upon connection request or connection reconfiguration
467  // completed
468  m_enbRrcSapProviderMap[rnti] = 0;
469 
470  // Store SetupUeParameters
471  m_setupUeParametersMap[rnti] = params;
472 
473  LteEnbRrcSapProvider::CompleteSetupUeParameters completeSetupUeParameters;
474  std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
475  csupIt = m_completeSetupUeParametersMap.find (rnti);
476  if (csupIt == m_completeSetupUeParametersMap.end ())
477  {
478  // Create LteRlcSapUser, LtePdcpSapUser
479  LteRlcSapUser* srb0SapUser = new RealProtocolRlcSapUser (this,rnti);
481  completeSetupUeParameters.srb0SapUser = srb0SapUser;
482  completeSetupUeParameters.srb1SapUser = srb1SapUser;
483  // Store LteRlcSapUser, LtePdcpSapUser
484  m_completeSetupUeParametersMap[rnti] = completeSetupUeParameters;
485  }
486  else
487  {
488  completeSetupUeParameters = csupIt->second;
489  }
490  m_enbRrcSapProvider->CompleteSetupUe (rnti, completeSetupUeParameters);
491 }
492 
493 void
495 {
496  NS_LOG_FUNCTION (this << rnti);
497  std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
498  it = m_completeSetupUeParametersMap.find (rnti);
500  delete it->second.srb0SapUser;
501  delete it->second.srb1SapUser;
503  m_enbRrcSapProviderMap.erase (rnti);
504  m_setupUeParametersMap.erase (rnti);
505 }
506 
507 void
509 {
510  NS_LOG_FUNCTION (this << m_cellId);
511  // walk list of all nodes to get UEs with this cellId
512  Ptr<LteUeRrc> ueRrc;
513  for (NodeList::Iterator i = NodeList::Begin (); i != NodeList::End (); ++i)
514  {
515  Ptr<Node> node = *i;
516  int nDevs = node->GetNDevices ();
517  for (int j = 0; j < nDevs; ++j)
518  {
519  Ptr<LteUeNetDevice> ueDev = node->GetDevice (j)->GetObject <LteUeNetDevice> ();
520  if (ueDev != 0)
521  {
522  Ptr<LteUeRrc> ueRrc = ueDev->GetRrc ();
523  NS_LOG_LOGIC ("considering UE IMSI " << ueDev->GetImsi () << " that has cellId " << ueRrc->GetCellId ());
524  if (ueRrc->GetCellId () == m_cellId)
525  {
526  NS_LOG_LOGIC ("sending SI to IMSI " << ueDev->GetImsi ());
527  ueRrc->GetLteUeRrcSapProvider ()->RecvSystemInformation (msg);
530  ueRrc->GetLteUeRrcSapProvider (),
531  msg);
532  }
533  }
534  }
535  }
536 }
537 
538 void
540 {
541  Ptr<Packet> packet = Create<Packet> ();
542 
543  RrcConnectionSetupHeader rrcConnectionSetupHeader;
544  rrcConnectionSetupHeader.SetMessage (msg);
545 
546  packet->AddHeader (rrcConnectionSetupHeader);
547 
548  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
549  transmitPdcpPduParameters.pdcpPdu = packet;
550  transmitPdcpPduParameters.rnti = rnti;
551  transmitPdcpPduParameters.lcid = 0;
552 
553  if (m_setupUeParametersMap.find (rnti) == m_setupUeParametersMap.end () )
554  {
555  std::cout << "RNTI not found in Enb setup parameters Map!" << std::endl;
556  }
557  else
558  {
559  m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
560  }
561 }
562 
563 void
565 {
566  Ptr<Packet> packet = Create<Packet> ();
567 
568  RrcConnectionRejectHeader rrcConnectionRejectHeader;
569  rrcConnectionRejectHeader.SetMessage (msg);
570 
571  packet->AddHeader (rrcConnectionRejectHeader);
572 
573  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
574  transmitPdcpPduParameters.pdcpPdu = packet;
575  transmitPdcpPduParameters.rnti = rnti;
576  transmitPdcpPduParameters.lcid = 0;
577 
578  m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
579 }
580 
581 void
583 {
584  Ptr<Packet> packet = Create<Packet> ();
585 
586  RrcConnectionReconfigurationHeader rrcConnectionReconfigurationHeader;
587  rrcConnectionReconfigurationHeader.SetMessage (msg);
588 
589  packet->AddHeader (rrcConnectionReconfigurationHeader);
590 
591  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
592  transmitPdcpSduParameters.pdcpSdu = packet;
593  transmitPdcpSduParameters.rnti = rnti;
594  transmitPdcpSduParameters.lcid = 1;
595 
596  m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
597 }
598 
599 void
601 {
602  Ptr<Packet> packet = Create<Packet> ();
603 
604  RrcConnectionReestablishmentHeader rrcConnectionReestablishmentHeader;
605  rrcConnectionReestablishmentHeader.SetMessage (msg);
606 
607  packet->AddHeader (rrcConnectionReestablishmentHeader);
608 
609  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
610  transmitPdcpPduParameters.pdcpPdu = packet;
611  transmitPdcpPduParameters.rnti = rnti;
612  transmitPdcpPduParameters.lcid = 0;
613 
614  m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
615 }
616 
617 void
619 {
620  Ptr<Packet> packet = Create<Packet> ();
621 
622  RrcConnectionReestablishmentRejectHeader rrcConnectionReestablishmentRejectHeader;
623  rrcConnectionReestablishmentRejectHeader.SetMessage (msg);
624 
625  packet->AddHeader (rrcConnectionReestablishmentRejectHeader);
626 
627  LteRlcSapProvider::TransmitPdcpPduParameters transmitPdcpPduParameters;
628  transmitPdcpPduParameters.pdcpPdu = packet;
629  transmitPdcpPduParameters.rnti = rnti;
630  transmitPdcpPduParameters.lcid = 0;
631 
632  m_setupUeParametersMap[rnti].srb0SapProvider->TransmitPdcpPdu (transmitPdcpPduParameters);
633 }
634 
635 void
637 {
638  Ptr<Packet> packet = Create<Packet> ();
639 
640  RrcConnectionReleaseHeader rrcConnectionReleaseHeader;
641  rrcConnectionReleaseHeader.SetMessage (msg);
642 
643  packet->AddHeader (rrcConnectionReleaseHeader);
644 
645  LtePdcpSapProvider::TransmitPdcpSduParameters transmitPdcpSduParameters;
646  transmitPdcpSduParameters.pdcpSdu = packet;
647  transmitPdcpSduParameters.rnti = rnti;
648  transmitPdcpSduParameters.lcid = 1;
649 
650  m_setupUeParametersMap[rnti].srb1SapProvider->TransmitPdcpSdu (transmitPdcpSduParameters);
651 }
652 
653 void
655 {
656  // Get type of message received
657  RrcUlCcchMessage rrcUlCcchMessage;
658  p->PeekHeader (rrcUlCcchMessage);
659 
660  // Declare possible headers to receive
661  RrcConnectionReestablishmentRequestHeader rrcConnectionReestablishmentRequestHeader;
662  RrcConnectionRequestHeader rrcConnectionRequestHeader;
663 
664  // Deserialize packet and call member recv function with appropiate structure
665  switch ( rrcUlCcchMessage.GetMessageType () )
666  {
667  case 0:
668  p->RemoveHeader (rrcConnectionReestablishmentRequestHeader);
669  LteRrcSap::RrcConnectionReestablishmentRequest rrcConnectionReestablishmentRequestMsg;
670  rrcConnectionReestablishmentRequestMsg = rrcConnectionReestablishmentRequestHeader.GetMessage ();
671  m_enbRrcSapProvider->RecvRrcConnectionReestablishmentRequest (rnti,rrcConnectionReestablishmentRequestMsg);
672  break;
673  case 1:
674  p->RemoveHeader (rrcConnectionRequestHeader);
675  LteRrcSap::RrcConnectionRequest rrcConnectionRequestMsg;
676  rrcConnectionRequestMsg = rrcConnectionRequestHeader.GetMessage ();
677  m_enbRrcSapProvider->RecvRrcConnectionRequest (rnti,rrcConnectionRequestMsg);
678  break;
679  }
680 }
681 
682 void
684 {
685  // Get type of message received
686  RrcUlDcchMessage rrcUlDcchMessage;
687  params.pdcpSdu->PeekHeader (rrcUlDcchMessage);
688 
689  // Declare possible headers to receive
690  MeasurementReportHeader measurementReportHeader;
691  RrcConnectionReconfigurationCompleteHeader rrcConnectionReconfigurationCompleteHeader;
692  RrcConnectionReestablishmentCompleteHeader rrcConnectionReestablishmentCompleteHeader;
693  RrcConnectionSetupCompleteHeader rrcConnectionSetupCompleteHeader;
694 
695  // Declare possible messages to receive
696  LteRrcSap::MeasurementReport measurementReportMsg;
697  LteRrcSap::RrcConnectionReconfigurationCompleted rrcConnectionReconfigurationCompleteMsg;
698  LteRrcSap::RrcConnectionReestablishmentComplete rrcConnectionReestablishmentCompleteMsg;
699  LteRrcSap::RrcConnectionSetupCompleted rrcConnectionSetupCompletedMsg;
700 
701  // Deserialize packet and call member recv function with appropiate structure
702  switch ( rrcUlDcchMessage.GetMessageType () )
703  {
704  case 1:
705  params.pdcpSdu->RemoveHeader (measurementReportHeader);
706  measurementReportMsg = measurementReportHeader.GetMessage ();
707  m_enbRrcSapProvider->RecvMeasurementReport (params.rnti,measurementReportMsg);
708  break;
709  case 2:
710  params.pdcpSdu->RemoveHeader (rrcConnectionReconfigurationCompleteHeader);
711  rrcConnectionReconfigurationCompleteMsg = rrcConnectionReconfigurationCompleteHeader.GetMessage ();
712  m_enbRrcSapProvider->RecvRrcConnectionReconfigurationCompleted (params.rnti,rrcConnectionReconfigurationCompleteMsg);
713  break;
714  case 3:
715  params.pdcpSdu->RemoveHeader (rrcConnectionReestablishmentCompleteHeader);
716  rrcConnectionReestablishmentCompleteMsg = rrcConnectionReestablishmentCompleteHeader.GetMessage ();
717  m_enbRrcSapProvider->RecvRrcConnectionReestablishmentComplete (params.rnti,rrcConnectionReestablishmentCompleteMsg);
718  break;
719  case 4:
720  params.pdcpSdu->RemoveHeader (rrcConnectionSetupCompleteHeader);
721  rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.GetMessage ();
722  m_enbRrcSapProvider->RecvRrcConnectionSetupCompleted (params.rnti, rrcConnectionSetupCompletedMsg);
723  break;
724  }
725 }
726 
729 {
731  h.SetMessage (msg);
732 
733  Ptr<Packet> p = Create<Packet> ();
734  p->AddHeader (h);
735  return p;
736 }
737 
740 {
742  p->RemoveHeader (h);
744  return msg;
745 }
746 
749 {
751  h.SetMessage (msg);
752  Ptr<Packet> p = Create<Packet> ();
753  p->AddHeader (h);
754  return p;
755 }
756 
759 {
761  p->RemoveHeader (h);
763  return msg;
764 }
765 
767 
769  : m_pdcp (pdcp),
770  m_rnti (rnti)
771 {
772 }
773 
775 {
776 }
777 
778 void
780 {
782 }
783 
784 } // namespace ns3
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
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:268
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:66
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)
LtePdcpSapProvider * srb1SapProvider
Definition: lte-rrc-sap.h:614
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
void DoSendMeasurementReport(LteRrcSap::MeasurementReport msg)
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
#define NS_LOG_FUNCTION(parameters)
Definition: log.h:345
virtual void RecvRrcConnectionSetupCompleted(uint16_t rnti, RrcConnectionSetupCompleted msg)=0
Receive an RRCConnectionSetupComplete message from a UE during an RRC connection establishment proced...
Part of the RRC protocol.
Definition: lte-rrc-sap.h:676
LteUeRrcSapProvider * m_ueRrcSapProvider
void DoSendRrcConnectionReject(uint16_t rnti, LteRrcSap::RrcConnectionReject msg)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
void DoSendRrcConnectionRelease(uint16_t rnti, LteRrcSap::RrcConnectionRelease msg)
Part of the RRC protocol.
Definition: lte-rrc-sap.h:840
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)
Definition: assert.h:64
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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...
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:1107
Ptr< Packet > DoEncodeHandoverCommand(LteRrcSap::RrcConnectionReconfiguration msg)
LteUeRrcSapProvider::CompleteSetupParameters m_completeSetupParameters
LteRrcSap::RrcConnectionReconfiguration DoDecodeHandoverCommand(Ptr< Packet > p)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Definition: simulator.h:824
Ptr< Packet > DoEncodeHandoverPreparationInformation(LteRrcSap::HandoverPreparationInfo msg)
LteRrcSap::RrcConnectionReestablishment GetMessage() const
Returns a RrcConnectionReestablishment IE from the values in the class attributes.
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 ...
LteRrcSap::RrcConnectionRelease GetMessage() const
Returns a RrcConnectionRelease IE from the values in the class attributes.
LteUeRrcSapProvider * GetUeRrcSapProvider(uint16_t rnti)
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
LteRrcSap::RrcConnectionReestablishmentRequest GetMessage() const
Returns a RrcConnectionReestablishmentRequest IE from the values in the class attributes.
std::map< uint16_t, LteEnbRrcSapUser::SetupUeParameters > m_setupUeParametersMap
LteRrcSap::HandoverPreparationInfo GetMessage() const
Returns a HandoverPreparationInfo IE from the values in the class attributes.
std::map< uint16_t, LteUeRrcSapProvider * > m_enbRrcSapProviderMap
This class manages the serialization/deserialization of RrcConnectionSetupComplete IE...
virtual void RecvRrcConnectionReject(RrcConnectionReject msg)=0
Receive an RRCConnectionReject message from the serving eNodeB during an RRC connection establishment...
void SetMessage(LteRrcSap::RrcConnectionRelease msg)
Receives a RrcConnectionRelease IE and stores the contents into 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)
This class manages the serialization/deserialization of RrcConnectionSetup IE.
void DoSendRrcConnectionSetup(uint16_t rnti, LteRrcSap::RrcConnectionSetup msg)
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)
void DoSendRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
static Iterator End(void)
Definition: node-list.cc:188
const Time RRC_REAL_MSG_DELAY
virtual void RecvRrcConnectionReconfiguration(RrcConnectionReconfiguration msg)=0
Receive an RRCConnectionReconfiguration message from the serving eNodeB during an RRC connection reco...
LteRrcSap::RrcConnectionReestablishmentReject GetMessage() const
Returns a RrcConnectionReestablishmentReject IE from the values in the class attributes.
std::map< uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters > m_completeSetupUeParametersMap
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)
uint16_t rnti
the C-RNTI identifying the UE
Definition: lte-pdcp-sap.h:46
Ptr< NetDevice > GetDevice(uint32_t index) const
Definition: node.cc:132
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
void SetMessage(LteRrcSap::RrcConnectionReject msg)
Receives a RrcConnectionReject IE and stores the contents into the class attributes.
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
Definition: lte-pdcp-sap.h:43
LteEnbRrcSapUser * GetLteEnbRrcSapUser()
#define NS_LOG_LOGIC(msg)
Definition: log.h:368
This class manages the serialization/deserialization of RRCConnectionReestablishmentRequest IE...
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.
uint32_t GetNDevices(void) const
Definition: node.cc:140
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Definition: packet.cc:277
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:752
void DoSendRrcConnectionReestablishmentReject(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentReject msg)
LteRrcSap::RrcConnectionRequest GetMessage() const
Returns a RrcConnectionRequest IE from the values in the class attributes.
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
Definition: node-list.h:43
virtual void CompleteSetup(CompleteSetupParameters params)=0
void DoSendRrcConnectionReconfiguration(uint16_t rnti, LteRrcSap::RrcConnectionReconfiguration msg)
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)
This class manages the serialization/deserialization of RrcConnectionRequest IE.
LteRrcSap::MeasurementReport GetMessage() const
Returns a MeasurementReport IE from the values in the class attributes.
This class manages the serialization/deserialization of HandoverPreparationInfo IE.
This class manages the serialization/deserialization of RrcConnectionRelease IE.
LteEnbRrcSapProvider * m_enbRrcSapProvider
virtual void RecvSystemInformation(SystemInformation msg)=0
Receive a SystemInformation message from the serving eNodeB during a system information acquisition p...
LteRrcSap::RrcConnectionSetup GetMessage() const
Returns a RrcConnectionSetup IE from the values in the class attributes.
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
void SetMessage(LteRrcSap::HandoverPreparationInfo msg)
Receives a HandoverPreparationInfo IE and stores the contents into the class attributes.
void DoSendRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
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)
This class manages the serialization/deserialization of MeasurementReport IE.
Parameters for LteRlcSapProvider::TransmitPdcpPdu.
Definition: lte-rlc-sap.h:43
#define NS_ASSERT_MSG(condition, message)
Definition: assert.h:86
void DoSendRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
LteRrcSap::RrcConnectionReconfigurationCompleted GetMessage() const
Returns a RrcConnectionReconfigurationCompleted IE from the values in the class attributes.
This class manages the serialization/deserialization of RrcConnectionReconfiguration IE...
LteUeRrcSapUser::SetupParameters m_setupParameters
void DoSendRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
LteRrcSap::RrcConnectionReconfiguration GetMessage() const
Returns a RrcConnectionReconfiguration IE from the values in the class attributes.
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:182
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)
This class manages the serialization/deserialization of RrcConnectionReestablishmentReject IE...
This class manages the serialization/deserialization of RrcConnectionReestablishmentComplete IE...
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)
LteEnbRrcSapProvider * m_enbRrcSapProvider
LteRrcSap::RrcConnectionReestablishmentComplete GetMessage() const
Returns a RrcConnectionReestablishmentComplete 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 RrcConnectionReestablishment IE...
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
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
Template for the implementation of the LteUeRrcSapUser as a member of an owner class of type C to whi...
Definition: lte-rrc-sap.h:928
NS_LOG_COMPONENT_DEFINE("LteRrcProtocolReal")
a base class which provides memory management and object aggregation
Definition: object.h:63
LteUeRrcSapUser * GetLteUeRrcSapUser()
Part of the RRC protocol.
Definition: lte-rrc-sap.h:608
LteEnbRrcProtocolReal * m_pdcp
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
Definition: lte-pdcp-sap.h:47
void SetLteUeRrcSapProvider(LteUeRrcSapProvider *p)
The eNodeB device implementation.
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
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:49
LteRrcSap::RrcConnectionReject GetMessage() const
Returns a RrcConnectionReject IE from the values in the class attributes.
TypeId SetParent(TypeId tid)
Definition: type-id.cc:611
LteRrcSap::RrcConnectionSetupCompleted GetMessage() const
Returns a RrcConnectionSetupCompleted IE from the values in the class attributes. ...
void DoSetupUe(uint16_t rnti, LteEnbRrcSapUser::SetupUeParameters params)
void SetUeRrc(Ptr< LteUeRrc > rrc)
This class manages the serialization/deserialization of RrcConnectionSetupComplete IE...
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:253
The LteUeNetDevice class implements the UE net device.
void DoSendSystemInformation(LteRrcSap::SystemInformation msg)