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 
23 #ifndef LTE_RRC_SAP_H
24 #define LTE_RRC_SAP_H
25 
26 #include <stdint.h>
27 #include <list>
28 
29 #include <ns3/ptr.h>
30 #include <ns3/simulator.h>
31 
32 namespace ns3 {
33 
34 class LteRlcSapUser;
35 class LtePdcpSapUser;
36 class LteRlcSapProvider;
37 class LtePdcpSapProvider;
38 class Packet;
39 
40 /**
41  * \ingroup lte
42  *
43  * \brief Class holding definition common to all UE/eNodeB SAP Users/Providers.
44  *
45  * See 3GPP TS 36.331 for reference.
46  *
47  * Note that only those values that are (expected to be) used by the
48  * ns-3 model are mentioned here. The naming of the variables that are
49  * defined here is the same of 36.331, except for removal of "-" and
50  * conversion to CamelCase or ALL_CAPS where needed in order to follow
51  * the ns-3 coding style. Due to the 1-to-1 mapping with TS 36.331,
52  * detailed doxygen documentation is omitted, so please refer to
53  * 36.331 for the meaning of these data structures / fields.
54  *
55  */
56 class LteRrcSap
57 {
58 public:
59   virtual ~LteRrcSap ();
60 
61   /// Constraint values
62   static const uint8_t MaxReportCells = 8;
63 
64   // Information Elements
65   /// PlmnIdentityInfo structure
66   struct PlmnIdentityInfo
67   {
68     uint32_t plmnIdentity; ///< PLMN identity
69   };
70 
71   /// CellAccessRelatedInfo structure
72   struct CellAccessRelatedInfo
73   {
74     PlmnIdentityInfo plmnIdentityInfo; ///< PLMN identity info
75     uint32_t cellIdentity; ///< cell identity
76     bool csgIndication; ///< CSG indication
77     uint32_t csgIdentity; ///< CSG identity
78   };
79 
80   /// CellSelectionInfo structure
81   struct CellSelectionInfo
82   {
83     int8_t qRxLevMin; ///< INTEGER (-70..-22), actual value = IE value * 2 [dBm].
84     int8_t qQualMin; ///< INTEGER (-34..-3), actual value = IE value [dB].
85   };
86 
87   /// FreqInfo structure
88   struct FreqInfo
89   {
90     uint32_t ulCarrierFreq; ///< UL carrier frequency
91     uint16_t ulBandwidth; ///< UL bandwidth
92   };
93 
94   /// RlcConfig structure
95   struct RlcConfig
96   {
97     /// the direction choice
98     enum direction
99     {
100       AM,
101       UM_BI_DIRECTIONAL,
102       UM_UNI_DIRECTIONAL_UL,
103       UM_UNI_DIRECTIONAL_DL
104     } choice; ///< direction choice
105   };
106 
107   /// LogicalChannelConfig structure
108   struct LogicalChannelConfig
109   {
110     uint8_t priority; ///< priority
111     uint16_t prioritizedBitRateKbps; ///< prioritized bit rate Kbps
112     uint16_t bucketSizeDurationMs; ///< bucket size duration ms
113     uint8_t logicalChannelGroup; ///< logical channel group
114   };
115 
116   /// SoundingRsUlConfigCommon structure
117   struct SoundingRsUlConfigCommon
118   {
119     /// the config action
120     enum action
121     {
122       SETUP, RESET
123     } type; ///< action type
124     uint16_t srsBandwidthConfig; ///< SRS bandwidth config
125     uint8_t srsSubframeConfig; ///< SRS subframe config
126   };
127 
128   /// SoundingRsUlConfigDedicated structure
129   struct SoundingRsUlConfigDedicated
130   {
131     /// the config action
132     enum action
133     {
134       SETUP, RESET
135     } type; ///< action type
136     uint16_t srsBandwidth; ///< SRS bandwidth
137     uint16_t srsConfigIndex; ///< SRS config index
138   };
139 
140   /// AntennaInfoDedicated structure
141   struct AntennaInfoDedicated
142   {
143     uint8_t transmissionMode; ///< transmission mode
144   };
145 
146   /// PdschConfigCommon structure
147   struct PdschConfigCommon
148   {
149     int8_t referenceSignalPower;  ///< INTEGER (-60..50),
150     int8_t pb;                    ///< INTEGER (0..3),
151   };
152 
153   /// PdschConfigDedicated structure
154   struct PdschConfigDedicated
155   {
156     /**
157      * P_A values, TS 36.331 6.3.2 PDSCH-Config
158      * ENUMERATED { dB-6, dB-4dot77, dB-3, dB-1dot77, dB0, dB1, dB2, dB3 }
159      */
160     enum db
161     {
162       dB_6,
163       dB_4dot77,
164       dB_3,
165       dB_1dot77,
166       dB0,
167       dB1,
168       dB2,
169       dB3
170     };
171     uint8_t pa; ///< P_A value
172   };
173 
174   /**
175    * Convert PDSCH config dedicated function
176    *
177    * \param pdschConfigDedicated PdschConfigDedicated
178    * \returns double value
179    */
ConvertPdschConfigDedicated2Double(PdschConfigDedicated pdschConfigDedicated)180   static double ConvertPdschConfigDedicated2Double (PdschConfigDedicated pdschConfigDedicated)
181   {
182     double pa = 0;
183     switch (pdschConfigDedicated.pa)
184       {
185       case PdschConfigDedicated::dB_6:
186         pa = -6;
187         break;
188       case PdschConfigDedicated::dB_4dot77:
189         pa = -4.77;
190         break;
191       case PdschConfigDedicated::dB_3:
192         pa = -3;
193         break;
194       case PdschConfigDedicated::dB_1dot77:
195         pa = -1.77;
196         break;
197       case PdschConfigDedicated::dB0:
198         pa = 0;
199         break;
200       case PdschConfigDedicated::dB1:
201         pa = 1;
202         break;
203       case PdschConfigDedicated::dB2:
204         pa = 2;
205         break;
206       case PdschConfigDedicated::dB3:
207         pa = 3;
208         break;
209       default:
210         break;
211       }
212     return pa;
213   }
214 
215   /// PhysicalConfigDedicated structure
216   struct PhysicalConfigDedicated
217   {
218     bool haveSoundingRsUlConfigDedicated; ///< have sounding RS UL config dedicated?
219     SoundingRsUlConfigDedicated soundingRsUlConfigDedicated; ///< sounding RS UL config dedicated
220     bool haveAntennaInfoDedicated; ///< have antenna info dedicated?
221     AntennaInfoDedicated antennaInfo; ///< antenna info
222     bool havePdschConfigDedicated; ///< have PDSCH config dedicated?
223     PdschConfigDedicated pdschConfigDedicated; ///< PDSCH config dedicated
224   };
225 
226 
227   /// SrbToAddMod structure
228   struct SrbToAddMod
229   {
230     uint8_t srbIdentity; ///< SB identity
231     LogicalChannelConfig logicalChannelConfig; ///< logical channel config
232   };
233 
234   /// DrbToAddMod structure
235   struct DrbToAddMod
236   {
237     uint8_t epsBearerIdentity; ///< EPS bearer identity
238     uint8_t drbIdentity; ///< DRB identity
239     RlcConfig rlcConfig; ///< RLC config
240     uint8_t logicalChannelIdentity; ///< logical channel identify
241     LogicalChannelConfig logicalChannelConfig; ///< logical channel config
242   };
243 
244   /// PreambleInfo structure
245   struct PreambleInfo
246   {
247     uint8_t numberOfRaPreambles; ///< number of RA preambles
248   };
249 
250   /// RaSupervisionInfo structure
251   struct RaSupervisionInfo
252   {
253     uint8_t preambleTransMax; ///< preamble transmit maximum
254     uint8_t raResponseWindowSize; ///< RA response window size
255   };
256 
257   ///TxFailParams structure
258   struct TxFailParam
259   {
260     uint8_t connEstFailCount {0}; ///< Number of times that the UE detects T300 expiry on the same cell
261   };
262 
263   /// RachConfigCommon structure
264   struct RachConfigCommon
265   {
266     PreambleInfo preambleInfo; ///< preamble info
267     RaSupervisionInfo raSupervisionInfo; ///< RA supervision info
268     TxFailParam txFailParam; ///< txFailParams
269   };
270 
271   /// RadioResourceConfigCommon structure
272   struct RadioResourceConfigCommon
273   {
274     RachConfigCommon rachConfigCommon; ///< RACH config common
275   };
276 
277   /// RadioResourceConfigCommonSib structure
278   struct RadioResourceConfigCommonSib
279   {
280     RachConfigCommon rachConfigCommon; ///< RACH config common
281     PdschConfigCommon pdschConfigCommon; ///< PDSCH config common
282   };
283 
284   /// RadioResourceConfigDedicated structure
285   struct RadioResourceConfigDedicated
286   {
287     std::list<SrbToAddMod> srbToAddModList; ///< SRB to add mod list
288     std::list<DrbToAddMod> drbToAddModList; ///< DRB to add mod list
289     std::list<uint8_t> drbToReleaseList; ///< DRB to release list
290     bool havePhysicalConfigDedicated; ///< have physical config dedicated?
291     PhysicalConfigDedicated physicalConfigDedicated; ///< physical config dedicated
292   };
293 
294   /// QuantityConfig structure
295   struct QuantityConfig
296   {
297     uint8_t filterCoefficientRSRP; ///< filter coefficient RSRP
298     uint8_t filterCoefficientRSRQ; ///< filter coefficient RSRQ
299   };
300 
301   /// CellsToAddMod structure
302   struct CellsToAddMod
303   {
304     uint8_t cellIndex; ///< cell index
305     uint16_t physCellId; ///< Phy cell ID
306     int8_t cellIndividualOffset; ///< cell individual offset
307   };
308 
309   /// PhysCellIdRange structure
310   struct PhysCellIdRange
311   {
312     uint16_t start; ///< starting cell ID
313     bool haveRange; ///< has a range?
314     uint16_t range; ///< the range
315   };
316 
317   /// BlackCellsToAddMod structure
318   struct BlackCellsToAddMod
319   {
320     uint8_t cellIndex; ///< cell index
321     PhysCellIdRange physCellIdRange; ///< Phy cell ID range
322   };
323 
324   /// MeasObjectEutra structure
325   struct MeasObjectEutra
326   {
327     uint32_t carrierFreq; ///< carrier frequency
328     uint16_t allowedMeasBandwidth; ///< allowed measure bandwidth
329     bool presenceAntennaPort1; ///< antenna port 1 present?
330     uint8_t neighCellConfig; ///< neighbor cell config
331     int8_t offsetFreq; ///< offset frequency
332     std::list<uint8_t> cellsToRemoveList; ///< cells to remove list
333     std::list<CellsToAddMod> cellsToAddModList; ///< cells to add mod list
334     std::list<uint8_t> blackCellsToRemoveList; ///< black cells to remove list
335     std::list<BlackCellsToAddMod> blackCellsToAddModList; ///< black cells to add mod list
336     bool haveCellForWhichToReportCGI; ///< have cell for which to report CGI?
337     uint16_t cellForWhichToReportCGI; ///< cell for which to report CGI
338   };
339 
340   /**
341    * \brief Threshold for event evaluation.
342    *
343    * For RSRP-based threshold, the actual value is (value - 140) dBm. While for
344    * RSRQ-based threshold, the actual value is (value - 40) / 2 dB. This is in
345    * accordance with section 9.1.4 and 9.1.7 of 3GPP TS 36.133.
346    *
347    * \sa ns3::EutranMeasurementMapping
348    */
349   struct ThresholdEutra
350   {
351     /// Threshold enumeration
352     enum
353     {
354       THRESHOLD_RSRP, ///< RSRP is used for the threshold.
355       THRESHOLD_RSRQ ///< RSRQ is used for the threshold.
356     } choice;
357     uint8_t range; ///< Value range used in RSRP/RSRQ threshold.
358   };
359 
360   /// Specifies criteria for triggering of an E-UTRA measurement reporting event.
361   struct ReportConfigEutra
362   {
363     /// Trigger enumeration
364     enum
365     {
366       EVENT,      ///< event report
367       PERIODICAL  ///< periodical report
368     } triggerType; ///< trigger type
369 
370     /// Event enumeration
371     enum
372     {
373       EVENT_A1, ///< Event A1: Serving becomes better than absolute threshold.
374       EVENT_A2, ///< Event A2: Serving becomes worse than absolute threshold.
375       EVENT_A3, ///< Event A3: Neighbour becomes amount of offset better than PCell.
376       EVENT_A4, ///< Event A4: Neighbour becomes better than absolute threshold.
377       EVENT_A5  ///< Event A5: PCell becomes worse than absolute `threshold1` AND Neighbour becomes better than another absolute `threshold2`.
378 
379     } eventId; ///< Choice of E-UTRA event triggered reporting criteria.
380 
381     ThresholdEutra threshold1; ///< Threshold for event A1, A2, A4, and A5.
382     ThresholdEutra threshold2; ///< Threshold for event A5.
383 
384     /// Indicates whether or not the UE shall initiate the measurement reporting procedure when the leaving condition is met for a cell in `cellsTriggeredList`, as specified in 5.5.4.1 of 3GPP TS 36.331.
385     bool reportOnLeave;
386 
387     /// Offset value for Event A3. An integer between -30 and 30. The actual value is (value * 0.5) dB.
388     int8_t a3Offset;
389 
390     /// Parameter used within the entry and leave condition of an event triggered reporting condition. The actual value is (value * 0.5) dB.
391     uint8_t hysteresis;
392 
393     /// Time during which specific criteria for the event needs to be met in order to trigger a measurement report.
394     uint16_t timeToTrigger;
395 
396     /// the report purpose
397     enum report
398     {
399       REPORT_STRONGEST_CELLS,
400       REPORT_CGI
401     } purpose; ///< purpose
402 
403     /// Trigger type enumeration
404     enum
405     {
406       RSRP, ///< Reference Signal Received Power
407       RSRQ ///< Reference Signal Received Quality
408     } triggerQuantity; ///< The quantities used to evaluate the triggering condition for the event, see 3GPP TS 36.214.
409 
410     /// Report type enumeration
411     enum
412     {
413       SAME_AS_TRIGGER_QUANTITY,
414       BOTH ///< Both the RSRP and RSRQ quantities are to be included in the measurement report.
415     } reportQuantity; ///< The quantities to be included in the measurement report, always assumed to be BOTH.
416 
417     /// Maximum number of cells, excluding the serving cell, to be included in the measurement report.
418     uint8_t maxReportCells;
419 
420     /// Report interval enumeration
421     enum
422     {
423       MS120,
424       MS240,
425       MS480,
426       MS640,
427       MS1024,
428       MS2048,
429       MS5120,
430       MS10240,
431       MIN1,
432       MIN6,
433       MIN12,
434       MIN30,
435       MIN60,
436       SPARE3,
437       SPARE2,
438       SPARE1
439     } reportInterval; ///< Indicates the interval between periodical reports.
440 
441     /// Number of measurement reports applicable, always assumed to be infinite.
442     uint8_t reportAmount;
443 
444     /// Report config eutra function
445     ReportConfigEutra ();
446 
447   }; // end of struct ReportConfigEutra
448 
449   /// MeasObjectToAddMod structure
450   struct MeasObjectToAddMod
451   {
452     uint8_t measObjectId; ///< measure object ID
453     MeasObjectEutra measObjectEutra; ///< measure object eutra
454   };
455 
456   /// ReportConfigToAddMod structure
457   struct ReportConfigToAddMod
458   {
459     uint8_t reportConfigId; ///< report config ID
460     ReportConfigEutra reportConfigEutra; ///< report config eutra
461   };
462 
463   /// MeasIdToAddMod structure
464   struct MeasIdToAddMod
465   {
466     uint8_t measId; ///< measure ID
467     uint8_t measObjectId; ///< measure object ID
468     uint8_t reportConfigId; ///< report config ID
469   };
470 
471   /// MeasGapConfig structure
472   struct MeasGapConfig
473   {
474     /// the action type
475     enum action
476     {
477       SETUP, RESET
478     } type; ///< action type
479     /// the gap offest
480     enum gap
481     {
482       GP0, GP1
483     } gapOffsetChoice; ///< gap offset
484     uint8_t gapOffsetValue; ///< gap offset value
485   };
486 
487   /// MobilityStateParameters structure
488   struct MobilityStateParameters
489   {
490     uint8_t tEvaluation; ///< evaluation
491     uint8_t tHystNormal; ///< hyst normal
492     uint8_t nCellChangeMedium; ///< cell change medium
493     uint8_t nCellChangeHigh; ///< cell change high
494   };
495 
496   /// SpeedStateScaleFactors structure
497   struct SpeedStateScaleFactors
498   {
499     // 25 = oDot25, 50 = oDot5, 75 = oDot75, 100 = lDot0
500     uint8_t sfMedium; ///< scale factor medium
501     uint8_t sfHigh; ///< scale factor high
502   };
503 
504   /// SpeedStatePars structure
505   struct SpeedStatePars
506   {
507     /// the action type
508     enum action
509     {
510       SETUP,
511       RESET
512     } type; ///< action type
513     MobilityStateParameters mobilityStateParameters; ///< mobility state parameters
514     SpeedStateScaleFactors timeToTriggerSf; ///< time to trigger scale factors
515   };
516 
517   /// MeasConfig structure
518   struct MeasConfig
519   {
520     std::list<uint8_t> measObjectToRemoveList; ///< measure object to remove list
521     std::list<MeasObjectToAddMod> measObjectToAddModList; ///< measure object to add mod list
522     std::list<uint8_t> reportConfigToRemoveList; ///< report config to remove list
523     std::list<ReportConfigToAddMod> reportConfigToAddModList; ///< report config to add mod list
524     std::list<uint8_t> measIdToRemoveList; ///< measure ID to remove list
525     std::list<MeasIdToAddMod> measIdToAddModList; ///< measure ID to add mod list
526     bool haveQuantityConfig; ///< have quantity config?
527     QuantityConfig quantityConfig; ///< quantity config
528     bool haveMeasGapConfig; ///< have measure gap config?
529     MeasGapConfig measGapConfig; ///< measure gap config
530     bool haveSmeasure; ///< have S measure?
531     uint8_t sMeasure; ///< S measure
532     bool haveSpeedStatePars; ///< have speed state parameters?
533     SpeedStatePars speedStatePars; ///< speed state parameters
534   };
535 
536   /// CarrierFreqEutra structure
537   struct CarrierFreqEutra
538   {
539     uint32_t dlCarrierFreq; ///< DL carrier frequency
540     uint32_t ulCarrierFreq; ///< UL carrier frequency
541   };
542 
543   /// CarrierBandwidthEutra structure
544   struct CarrierBandwidthEutra
545   {
546     uint16_t dlBandwidth; ///< DL bandwidth
547     uint16_t ulBandwidth; ///< UL bandwidth
548   };
549 
550   /// RachConfigDedicated structure
551   struct RachConfigDedicated
552   {
553     uint8_t raPreambleIndex; ///< RA preamble index
554     uint8_t raPrachMaskIndex; ///< RA PRACH mask index
555   };
556 
557   /// MobilityControlInfo structure
558   struct MobilityControlInfo
559   {
560     uint16_t targetPhysCellId; ///< target Phy cell ID
561     bool haveCarrierFreq; ///< have carrier frequency?
562     CarrierFreqEutra carrierFreq; ///< carrier frequency
563     bool haveCarrierBandwidth; ///< have carrier bandwidth?
564     CarrierBandwidthEutra carrierBandwidth; ///< carrier bandwidth
565     uint16_t newUeIdentity; ///< new UE identity
566     RadioResourceConfigCommon radioResourceConfigCommon; ///< radio resource config common
567     bool haveRachConfigDedicated; ///< Have RACH config dedicated?
568     RachConfigDedicated rachConfigDedicated; ///< RACH config dedicated
569   };
570 
571   /// ReestabUeIdentity structure
572   struct ReestabUeIdentity
573   {
574     uint16_t cRnti; ///< RNTI
575     uint16_t physCellId; ///< Phy cell ID
576   };
577 
578   /// ReestablishmentCause enumeration
579   enum ReestablishmentCause
580   {
581     RECONFIGURATION_FAILURE,
582     HANDOVER_FAILURE,
583     OTHER_FAILURE
584   };
585 
586   /// MasterInformationBlock structure
587   struct MasterInformationBlock
588   {
589     uint16_t dlBandwidth; ///< DL bandwidth
590     uint16_t systemFrameNumber; ///< system frame number
591   };
592 
593   /// SystemInformationBlockType1 structure
594   struct SystemInformationBlockType1
595   {
596     CellAccessRelatedInfo cellAccessRelatedInfo; ///< cell access related info
597     CellSelectionInfo cellSelectionInfo; ///< cell selection info
598   };
599 
600   /// SystemInformationBlockType2 structure
601   struct SystemInformationBlockType2
602   {
603     RadioResourceConfigCommonSib radioResourceConfigCommon; ///< radio resource config common
604     FreqInfo freqInfo; ///< frequency info
605   };
606 
607   /// SystemInformation structure
608   struct SystemInformation
609   {
610     bool haveSib2; ///< have SIB2?
611     SystemInformationBlockType2 sib2; ///< SIB2
612   };
613 
614   /// AsConfig structure
615   struct AsConfig
616   {
617     MeasConfig sourceMeasConfig; ///< source measure config
618     RadioResourceConfigDedicated sourceRadioResourceConfig; ///< source radio resource config
619     uint16_t sourceUeIdentity; ///< source UE identity
620     MasterInformationBlock sourceMasterInformationBlock; ///< source master information block
621     SystemInformationBlockType1 sourceSystemInformationBlockType1; ///< source system information block type 1
622     SystemInformationBlockType2 sourceSystemInformationBlockType2; ///< source system information block type 2
623     uint32_t sourceDlCarrierFreq; ///< source DL carrier frequency
624   };
625 
626   /// CgiInfo structure
627   struct CgiInfo
628   {
629     uint32_t plmnIdentity; ///< PLMN identity
630     uint32_t cellIdentity; ///< cell identity
631     uint16_t trackingAreaCode; ///< tracking area code
632     std::list<uint32_t> plmnIdentityList; ///< PLMN identity list
633   };
634 
635   /// MeasResultEutra structure
636   struct MeasResultEutra
637   {
638     uint16_t physCellId; ///< Phy cell ID
639     bool haveCgiInfo; ///< have CGI info?
640     CgiInfo cgiInfo; ///< CGI info
641     bool haveRsrpResult; ///< have RSRP result
642     uint8_t rsrpResult; ///< RSRP result
643     bool haveRsrqResult; ///< have RSRQ result?
644     uint8_t rsrqResult; ///< RSRQ result
645   };
646 
647   /// MeasResultScell structure
648   struct MeasResultScell
649   {
650     uint16_t servFreqId; ///< service frequency ID
651     bool haveRsrpResult; ///< have RSRP result?
652     uint8_t rsrpResult; ///< the RSRP result
653     bool haveRsrqResult; ///< have RSRQ result?
654     uint8_t rsrqResult; ///< the RSRQ result
655   };
656 
657   /// MeasResultBestNeighCell structure
658   struct MeasResultBestNeighCell
659   {
660     uint16_t servFreqId; ///< service frequency ID
661     uint16_t physCellId; ///< physical cell ID
662     bool haveRsrpResult; ///< have RSRP result?
663     uint8_t rsrpResult; ///< the RSRP result
664     bool haveRsrqResult; ///< have RSRQ result?
665     uint8_t rsrqResult; ///< the RSRQ result
666   };
667 
668   /// MeasResultServFreqList
669   struct MeasResultServFreqList
670   {
671     bool haveMeasurementResultsServingSCells; ///< have measure results serving Scells
672     std::list<MeasResultScell> measResultScell; ///< measure results Scells
673     bool haveMeasurementResultsNeighCell; ///< always false since not implemented
674     std::list<MeasResultBestNeighCell> measResultBestNeighCell; ///< measure result best neighbor cell
675   };
676 
677   /// MeasResults structure
678   struct MeasResults
679   {
680     uint8_t measId; ///< measure ID
681     uint8_t rsrpResult; ///< RSRP result
682     uint8_t rsrqResult; ///< RSRQ result
683     bool haveMeasResultNeighCells; ///< have measure result neighbor cells
684     std::list<MeasResultEutra> measResultListEutra; ///< measure result list eutra
685     bool haveScellsMeas; ///< has SCells measure
686     MeasResultServFreqList measScellResultList; ///< measure SCell result list
687   };
688 
689   // Messages
690 
691   /// RrcConnectionRequest structure
692   struct RrcConnectionRequest
693   {
694     uint64_t ueIdentity; ///< UE identity
695   };
696 
697   /// RrcConnectionSetup structure
698   struct RrcConnectionSetup
699   {
700     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
701     RadioResourceConfigDedicated radioResourceConfigDedicated; ///< radio resource config dedicated
702   };
703 
704   /// RrcConnectionSetupCompleted structure
705   struct RrcConnectionSetupCompleted
706   {
707     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
708   };
709 
710 
711   /// CellIdentification structure
712   struct CellIdentification
713   {
714     uint32_t physCellId; ///< physical cell ID
715     uint32_t dlCarrierFreq; ///<  ARFCN - valueEUTRA
716   };
717 
718   /// AntennaInfoCommon structure
719   struct AntennaInfoCommon
720   {
721     uint16_t antennaPortsCount; ///< antenna ports count
722   };
723 
724   /// UlPowerControlCommonSCell structure
725   struct UlPowerControlCommonSCell
726   {
727     uint16_t alpha; ///< alpha value
728   };
729 
730   /// PrachConfigSCell structure
731   struct PrachConfigSCell
732   {
733     uint16_t index; ///< the index
734   };
735 
736   /// NonUlConfiguration structure
737   struct NonUlConfiguration
738   {
739     // 3GPP TS 36.311 v.11.10 R11 pag.220
740     /// 1: Cell characteristics
741     uint16_t dlBandwidth;
742     /// 2: Physical configuration, general antennaInfoCommon-r10
743     AntennaInfoCommon antennaInfoCommon;
744     // 3: Physical configuration, control phich-Config-r10
745     // Not Implemented
746     /// 4: Physical configuration, physical channels pdsch-ConfigCommon-r10
747     PdschConfigCommon pdschConfigCommon;
748     // 5: tdd-Config-r10
749     //Not Implemented
750   };
751 
752   /// UlConfiguration structure
753   struct UlConfiguration
754   {
755     FreqInfo ulFreqInfo; ///< UL frequency info
756     UlPowerControlCommonSCell ulPowerControlCommonSCell; ///< 3GPP TS 36.331 v.11.10 R11 pag.223
757     SoundingRsUlConfigCommon soundingRsUlConfigCommon; ///< sounding RS UL config common
758     PrachConfigSCell prachConfigSCell; ///< PRACH config SCell
759     //PushConfigCommon pushConfigCommon; //NOT IMPLEMENTED!
760   };
761 
762   /// AntennaInfoUl structure
763   struct AntennaInfoUl
764   {
765     uint8_t transmissionMode; ///< transmission mode
766   };
767 
768   /// PuschConfigDedicatedSCell structure
769   struct PuschConfigDedicatedSCell
770   {
771     /// 3GPP TS 36.331 v.11.10 R11 page 216
772     uint16_t nPuschIdentity;
773   };
774 
775   /// UlPowerControlDedicatedSCell structure
776   struct UlPowerControlDedicatedSCell
777   {
778     /// 3GPP TS 36.331 v.11.10 R11 page 234
779     uint16_t pSrsOffset;
780   };
781 
782   /// PhysicalConfigDedicatedSCell structure
783   struct PhysicalConfigDedicatedSCell
784   {
785     // Non-Ul Configuration
786     bool haveNonUlConfiguration; ///< have non UL configuration?
787     bool haveAntennaInfoDedicated; ///< have antenna info dedicated?
788     AntennaInfoDedicated antennaInfo; ///< antenna info dedicated
789     bool crossCarrierSchedulingConfig; ///< currently implemented as boolean variable --> implementing crossCarrierScheduling is out of the scope of this GSoC proposal
790     bool havePdschConfigDedicated; ///< have PDSCH config dedicated?
791     PdschConfigDedicated pdschConfigDedicated; ///< PDSCH config dedicated
792 
793     // Ul Configuration
794     bool haveUlConfiguration; ///< have UL configuration?
795     bool haveAntennaInfoUlDedicated; ///< have antenna info UL dedicated?
796     AntennaInfoDedicated antennaInfoUl; ///< antenna info UL
797     PuschConfigDedicatedSCell pushConfigDedicatedSCell; ///< PUSCH config dedicated SCell
798     UlPowerControlDedicatedSCell  ulPowerControlDedicatedSCell; ///< UL power control dedicated SCell
799     bool haveSoundingRsUlConfigDedicated; ///< have sounding RS UL config dedicated?
800     SoundingRsUlConfigDedicated soundingRsUlConfigDedicated; ///< sounding RS UL config dedicated
801   };
802 
803   /// RadioResourceConfigCommonSCell
804   struct RadioResourceConfigCommonSCell
805   {
806     bool haveNonUlConfiguration; ///< have non UL configuration?
807     NonUlConfiguration nonUlConfiguration; ///< non UL configuration
808     bool haveUlConfiguration; ///< have UL configuration
809     UlConfiguration ulConfiguration; ///< UL configuration
810   };
811 
812   /// RadioResourceConfigDedicatedSCell structure
813   struct RadioResourceConfigDedicatedSCell
814   {
815     PhysicalConfigDedicatedSCell physicalConfigDedicatedSCell; ///< physical config dedicated SCell
816   };
817 
818   /// SCellToAddMod structure
819   struct SCellToAddMod
820   {
821     uint32_t sCellIndex; ///< SCell index
822     CellIdentification cellIdentification; ///< cell identification
823     RadioResourceConfigCommonSCell radioResourceConfigCommonSCell; ///< radio resource config common SCell
824     bool haveRadioResourceConfigDedicatedSCell; ///< have radio resource config dedicated SCell?
825     RadioResourceConfigDedicatedSCell radioResourceConfigDedicateSCell; ///< radio resource config dedicated SCell
826   };
827 
828   /// NonCriticalExtensionConfiguration structure
829   struct NonCriticalExtensionConfiguration
830   {
831     std::list<SCellToAddMod> sCellsToAddModList; ///< SCell to add mod list
832     std::list<uint32_t> sCellToReleaseList; ///< SCell to release list
833   };
834 
835   /// RrcConnectionReconfiguration structure
836   struct RrcConnectionReconfiguration
837   {
838     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
839     bool haveMeasConfig; ///< have measure config
840     MeasConfig measConfig; ///< measure config
841     bool haveMobilityControlInfo; ///< have mobility control info
842     MobilityControlInfo mobilityControlInfo; ///< mobility control info
843     bool haveRadioResourceConfigDedicated; ///< have radio resource config dedicated
844     RadioResourceConfigDedicated radioResourceConfigDedicated; ///< radio resource config dedicated
845     bool haveNonCriticalExtension; ///< have critical extension?
846     /// 3GPP TS 36.331 v.11.10 R11 Sec. 6.2.2 pag. 147 (also known as ETSI TS 136 331 v.11.10 Feb-2015)
847     NonCriticalExtensionConfiguration nonCriticalExtension;
848  };
849 
850   /// RrcConnectionReconfigurationCompleted structure
851   struct RrcConnectionReconfigurationCompleted
852   {
853     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
854   };
855 
856 
857   /// RrcConnectionReestablishmentRequest structure
858   struct RrcConnectionReestablishmentRequest
859   {
860     ReestabUeIdentity ueIdentity; ///< UE identity
861     ReestablishmentCause reestablishmentCause; ///< reestablishment cause
862   };
863 
864   /// RrcConnectionReestablishment structure
865   struct RrcConnectionReestablishment
866   {
867     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
868     RadioResourceConfigDedicated radioResourceConfigDedicated; ///< radio resource config dedicated
869   };
870 
871   /// RrcConnectionReestablishmentComplete structure
872   struct RrcConnectionReestablishmentComplete
873   {
874     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
875   };
876 
877   /// RrcConnectionReestablishmentReject structure
878   struct RrcConnectionReestablishmentReject
879   {
880   };
881 
882   /// RrcConnectionRelease structure
883   struct RrcConnectionRelease
884   {
885     uint8_t rrcTransactionIdentifier; ///< RRC transaction identifier
886   };
887 
888   /// RrcConnectionReject structure
889   struct RrcConnectionReject
890   {
891     uint8_t waitTime; ///< wait time
892   };
893 
894   /// HandoverPreparationInfo structure
895   struct HandoverPreparationInfo
896   {
897     AsConfig asConfig; ///< AS config
898   };
899 
900   /// MeasurementReport structure
901   struct MeasurementReport
902   {
903     MeasResults measResults; ///< measure results
904   };
905 
906 };
907 
908 
909 
910 /**
911  * \brief Part of the RRC protocol. This Service Access Point (SAP) is used by
912  *        the UE RRC to send messages to the eNB. Each method defined in this
913  *        class corresponds to the transmission of a message that is defined in
914  *        Section 6.2.2 of TS 36.331.
915  */
916 class LteUeRrcSapUser : public LteRrcSap
917 {
918 public:
919   /// SetupParameters structure
920   struct SetupParameters
921   {
922     LteRlcSapProvider* srb0SapProvider; ///< SRB0 SAP provider
923     LtePdcpSapProvider* srb1SapProvider; ///< SRB1 SAP provider
924   };
925 
926   /**
927    * \brief Setup function
928    * \param params the setup parameters
929    */
930   virtual void Setup (SetupParameters params) = 0;
931 
932   /**
933    * \brief Send an _RRCConnectionRequest message to the serving eNodeB
934    *        during an RRC connection establishment procedure
935    *        (Section 5.3.3 of TS 36.331).
936    * \param msg the message
937    */
938   virtual void SendRrcConnectionRequest (RrcConnectionRequest msg) = 0;
939 
940   /**
941    * \brief Send an _RRCConnectionSetupComplete_ message to the serving eNodeB
942    *        during an RRC connection establishment procedure
943    *        (Section 5.3.3 of TS 36.331).
944    * \param msg the message
945    */
946   virtual void SendRrcConnectionSetupCompleted (RrcConnectionSetupCompleted msg) = 0;
947 
948   /**
949    * \brief Send an _RRCConnectionReconfigurationComplete_ message to the serving eNodeB
950    *        during an RRC connection reconfiguration procedure
951    *        (Section 5.3.5 of TS 36.331).
952    * \param msg the message
953    */
954   virtual void SendRrcConnectionReconfigurationCompleted (RrcConnectionReconfigurationCompleted msg) = 0;
955 
956   /**
957    * \brief Send an _RRCConnectionReestablishmentRequest_ message to the serving eNodeB
958    *        during an RRC connection re-establishment procedure
959    *        (Section 5.3.7 of TS 36.331).
960    * \param msg the message
961    */
962   virtual void SendRrcConnectionReestablishmentRequest (RrcConnectionReestablishmentRequest msg) = 0;
963 
964   /**
965    * \brief Send an _RRCConnectionReestablishmentComplete_ message to the serving eNodeB
966    *        during an RRC connection re-establishment procedure
967    *        (Section 5.3.7 of TS 36.331).
968    * \param msg the message
969    */
970   virtual void SendRrcConnectionReestablishmentComplete (RrcConnectionReestablishmentComplete msg) = 0;
971 
972   /**
973    * \brief Send a _MeasurementReport_ message to the serving eNodeB
974    *        during a measurement reporting procedure
975    *        (Section 5.5.5 of TS 36.331).
976    * \param msg the message
977    */
978   virtual void SendMeasurementReport (MeasurementReport msg) = 0;
979 
980   /**
981    * \brief Send UE context remove request function
982    *
983    * Request eNodeB to remove UE context once radio link failure or
984    * random access failure is detected. It is needed since no RLF
985    * detection mechanism at eNodeB is implemented.
986    *
987    * \param rnti the C-RNTI of the UE
988    */
989    virtual void SendIdealUeContextRemoveRequest (uint16_t rnti) = 0;
990 
991 };
992 
993 
994 /**
995  * \brief Part of the RRC protocol. This Service Access Point (SAP) is used to
996  *        let the UE RRC receive a message from the eNB RRC. Each method defined
997  *        in this class corresponds to the reception of a message that is
998  *        defined in Section 6.2.2 of TS 36.331.
999  */
1000 class LteUeRrcSapProvider : public LteRrcSap
1001 {
1002 public:
1003   /// CompleteSetupParameters structure
1004   struct CompleteSetupParameters
1005   {
1006     LteRlcSapUser* srb0SapUser; ///< SRB0 SAP user
1007     LtePdcpSapUser* srb1SapUser; ///< SRB1 SAP user
1008   };
1009 
1010   /**
1011    * \brief Complete setup function
1012    * \param params the complete setup parameters
1013    */
1014   virtual void CompleteSetup (CompleteSetupParameters params) = 0;
1015 
1016   /**
1017    * \brief Receive a _SystemInformation_ message from the serving eNodeB
1018    *        during a system information acquisition procedure
1019    *        (Section 5.2.2 of TS 36.331).
1020    * \param msg the message
1021    */
1022   virtual void RecvSystemInformation (SystemInformation msg) = 0;
1023 
1024   /**
1025    * \brief Receive an _RRCConnectionSetup_ message from the serving eNodeB
1026    *        during an RRC connection establishment procedure
1027    *        (Section 5.3.3 of TS 36.331).
1028    * \param msg the message
1029    */
1030   virtual void RecvRrcConnectionSetup (RrcConnectionSetup msg) = 0;
1031 
1032   /**
1033    * \brief Receive an _RRCConnectionReconfiguration_ message from the serving eNodeB
1034    *        during an RRC connection reconfiguration procedure
1035    *        (Section 5.3.5 of TS 36.331).
1036    * \param msg the message
1037    */
1038   virtual void RecvRrcConnectionReconfiguration (RrcConnectionReconfiguration msg) = 0;
1039 
1040   /**
1041    * \brief Receive an _RRCConnectionReestablishment_ message from the serving eNodeB
1042    *        during an RRC connection re-establishment procedure
1043    *        (Section 5.3.7 of TS 36.331).
1044    * \param msg the message
1045    */
1046   virtual void RecvRrcConnectionReestablishment (RrcConnectionReestablishment msg) = 0;
1047 
1048   /**
1049    * \brief Receive an _RRCConnectionReestablishmentReject_ message from the serving eNodeB
1050    *        during an RRC connection re-establishment procedure
1051    *        (Section 5.3.7 of TS 36.331).
1052    * \param msg the message
1053    */
1054   virtual void RecvRrcConnectionReestablishmentReject (RrcConnectionReestablishmentReject msg) = 0;
1055 
1056   /**
1057    * \brief Receive an _RRCConnectionRelease_ message from the serving eNodeB
1058    *        during an RRC connection release procedure
1059    *        (Section 5.3.8 of TS 36.331).
1060    * \param msg the message
1061    */
1062   virtual void RecvRrcConnectionRelease (RrcConnectionRelease msg) = 0;
1063 
1064   /**
1065    * \brief Receive an _RRCConnectionReject_ message from the serving eNodeB
1066    *        during an RRC connection establishment procedure
1067    *        (Section 5.3.3 of TS 36.331).
1068    * \param msg the message
1069    */
1070   virtual void RecvRrcConnectionReject (RrcConnectionReject msg) = 0;
1071 
1072 };
1073 
1074 
1075 /**
1076  * \brief Part of the RRC protocol. This Service Access Point (SAP) is used by
1077  *        the eNB RRC to send messages to the UE RRC.  Each method defined in
1078  *        this class corresponds to the transmission of a message that is
1079  *        defined in Section 6.2.2 of TS 36.331.
1080  */
1081 class LteEnbRrcSapUser : public LteRrcSap
1082 {
1083 public:
1084   /// SetupUeParameters structure
1085   struct SetupUeParameters
1086   {
1087     LteRlcSapProvider* srb0SapProvider; ///< SRB0 SAP provider
1088     LtePdcpSapProvider* srb1SapProvider; ///< SRB1 SAP provider
1089   };
1090 
1091   /**
1092    * \brief Setup UE function
1093    * \param rnti the RNTI
1094    * \param params the setup UE parameters
1095    */
1096   virtual void SetupUe (uint16_t rnti, SetupUeParameters params) = 0;
1097   /**
1098    * \brief Remove UE function
1099    * \param rnti the RNTI
1100    */
1101   virtual void RemoveUe (uint16_t rnti) = 0;
1102 
1103   /**
1104    * \brief Send a _SystemInformation_ message to all attached UEs
1105    *        during a system information acquisition procedure
1106    *        (Section 5.2.2 of TS 36.331).
1107    * \param cellId cell ID
1108    * \param msg the message
1109    */
1110   virtual void SendSystemInformation (uint16_t cellId, SystemInformation msg) = 0;
1111 
1112   /**
1113    * \brief Send an _RRCConnectionSetup_ message to a UE
1114    *        during an RRC connection establishment procedure
1115    *        (Section 5.3.3 of TS 36.331).
1116    * \param rnti the RNTI of the destination UE
1117    * \param msg the message
1118    */
1119   virtual void SendRrcConnectionSetup (uint16_t rnti, RrcConnectionSetup msg) = 0;
1120 
1121   /**
1122    * \brief Send an _RRCConnectionReconfiguration_ message to a UE
1123    *        during an RRC connection reconfiguration procedure
1124    *        (Section 5.3.5 of TS 36.331).
1125    * \param rnti the RNTI of the destination UE
1126    * \param msg the message
1127    */
1128   virtual void SendRrcConnectionReconfiguration (uint16_t rnti, RrcConnectionReconfiguration msg) = 0;
1129 
1130   /**
1131    * \brief Send an _RRCConnectionReestablishment_ message to a UE
1132    *        during an RRC connection re-establishment procedure
1133    *        (Section 5.3.7 of TS 36.331).
1134    * \param rnti the RNTI of the destination UE
1135    * \param msg the message
1136    */
1137   virtual void SendRrcConnectionReestablishment (uint16_t rnti, RrcConnectionReestablishment msg) = 0;
1138 
1139   /**
1140    * \brief Send an _RRCConnectionReestablishmentReject_ message to a UE
1141    *        during an RRC connection re-establishment procedure
1142    *        (Section 5.3.7 of TS 36.331).
1143    * \param rnti the RNTI of the destination UE
1144    * \param msg the message
1145    */
1146   virtual void SendRrcConnectionReestablishmentReject (uint16_t rnti, RrcConnectionReestablishmentReject msg) = 0;
1147 
1148   /**
1149    * \brief Send an _RRCConnectionRelease_ message to a UE
1150    *        during an RRC connection release procedure
1151    *        (Section 5.3.8 of TS 36.331).
1152    * \param rnti the RNTI of the destination UE
1153    * \param msg the message
1154    */
1155   virtual void SendRrcConnectionRelease (uint16_t rnti, RrcConnectionRelease msg) = 0;
1156 
1157   /**
1158    * \brief Send an _RRCConnectionReject_ message to a UE
1159    *        during an RRC connection establishment procedure
1160    *        (Section 5.3.3 of TS 36.331).
1161    * \param rnti the RNTI of the destination UE
1162    * \param msg the message
1163    */
1164   virtual void SendRrcConnectionReject (uint16_t rnti, RrcConnectionReject msg) = 0;
1165 
1166   /**
1167    * \brief Encode handover prepration information
1168    * \param msg HandoverPreparationInfo
1169    * \returns the packet
1170    */
1171   virtual Ptr<Packet> EncodeHandoverPreparationInformation (HandoverPreparationInfo msg) = 0;
1172   /**
1173    * \brief Decode handover prepration information
1174    * \param p the packet
1175    * \returns HandoverPreparationInfo
1176    */
1177   virtual HandoverPreparationInfo DecodeHandoverPreparationInformation (Ptr<Packet> p) = 0;
1178   /**
1179    * \brief Encode handover command
1180    * \param msg RrcConnectionReconfiguration
1181    * \returns the packet
1182    */
1183   virtual Ptr<Packet> EncodeHandoverCommand (RrcConnectionReconfiguration msg) = 0;
1184   /**
1185    * \brief Decode handover command
1186    * \param p the packet
1187    * \returns RrcConnectionReconfiguration
1188    */
1189   virtual RrcConnectionReconfiguration DecodeHandoverCommand (Ptr<Packet> p) = 0;
1190 
1191 };
1192 
1193 
1194 /**
1195  * \brief Part of the RRC protocol. This Service Access Point (SAP) is used to
1196  *        let the eNB RRC receive a message from a UE RRC.  Each method defined
1197  *        in this class corresponds to the reception of a message that is
1198  *        defined in Section 6.2.2 of TS 36.331.
1199  */
1200 class LteEnbRrcSapProvider : public LteRrcSap
1201 {
1202 public:
1203   /// CompleteSetupUeParameters structure
1204   struct CompleteSetupUeParameters
1205   {
1206     LteRlcSapUser* srb0SapUser; ///< SRB0 SAP user
1207     LtePdcpSapUser* srb1SapUser; ///< SRB1 SAP user
1208   };
1209 
1210   /**
1211    * \brief Complete setup UE function
1212    * \param rnti the RNTI of UE which sent the message
1213    * \param params CompleteSetupUeParameters
1214    */
1215   virtual void CompleteSetupUe (uint16_t rnti, CompleteSetupUeParameters params) = 0;
1216 
1217   /**
1218    * \brief Receive an _RRCConnectionRequest_ message from a UE
1219    *        during an RRC connection establishment procedure
1220    *        (Section 5.3.3 of TS 36.331).
1221    * \param rnti the RNTI of UE which sent the message
1222    * \param msg the message
1223    */
1224   virtual void RecvRrcConnectionRequest (uint16_t rnti,
1225                                          RrcConnectionRequest msg) = 0;
1226 
1227   /**
1228    * \brief Receive an _RRCConnectionSetupComplete_ message from a UE
1229    *        during an RRC connection establishment procedure
1230    *        (Section 5.3.3 of TS 36.331).
1231    * \param rnti the RNTI of UE which sent the message
1232    * \param msg the message
1233    */
1234   virtual void RecvRrcConnectionSetupCompleted (uint16_t rnti,
1235                                                 RrcConnectionSetupCompleted msg) = 0;
1236 
1237   /**
1238    * \brief Receive an _RRCConnectionReconfigurationComplete_ message from a UE
1239    *        during an RRC connection reconfiguration procedure
1240    *        (Section 5.3.5 of TS 36.331).
1241    * \param rnti the RNTI of UE which sent the message
1242    * \param msg the message
1243    */
1244   virtual void RecvRrcConnectionReconfigurationCompleted (uint16_t rnti,
1245                                                           RrcConnectionReconfigurationCompleted msg) = 0;
1246 
1247   /**
1248    * \brief Receive an _RRCConnectionReestablishmentRequest_ message from a UE
1249    *        during an RRC connection re-establishment procedure
1250    *        (Section 5.3.7 of TS 36.331).
1251    * \param rnti the RNTI of UE which sent the message
1252    * \param msg the message
1253    */
1254   virtual void RecvRrcConnectionReestablishmentRequest (uint16_t rnti,
1255                                                         RrcConnectionReestablishmentRequest msg) = 0;
1256 
1257   /**
1258    * \brief Receive an _RRCConnectionReestablishmentComplete_ message from a UE
1259    *        during an RRC connection re-establishment procedure
1260    *        (Section 5.3.7 of TS 36.331).
1261    * \param rnti the RNTI of UE which sent the message
1262    * \param msg the message
1263    */
1264   virtual void RecvRrcConnectionReestablishmentComplete (uint16_t rnti,
1265                                                          RrcConnectionReestablishmentComplete msg) = 0;
1266 
1267   /**
1268    * \brief Receive a _MeasurementReport_ message from a UE
1269    *        during a measurement reporting procedure
1270    *        (Section 5.5.5 of TS 36.331).
1271    * \param rnti the RNTI of UE which sent the message
1272    * \param msg the message
1273    */
1274   virtual void RecvMeasurementReport (uint16_t rnti, MeasurementReport msg) = 0;
1275 
1276   /**
1277    * \brief Receive ideal UE context remove request from the UE RRC.
1278    *
1279    * Receive the notification from UE to remove the UE context
1280    * once radio link failure or random access failure is detected.
1281    * It is needed since no RLF detection mechanism at eNodeB is implemented.
1282    *
1283    * \param rnti the C-RNTI of the UE
1284    */
1285   virtual void RecvIdealUeContextRemoveRequest (uint16_t rnti) = 0;
1286 
1287 };
1288 
1289 
1290 
1291 
1292 
1293 
1294 ////////////////////////////////////
1295 //   templates
1296 ////////////////////////////////////
1297 
1298 
1299 /**
1300  * Template for the implementation of the LteUeRrcSapUser as a member
1301  * of an owner class of type C to which all methods are forwarded
1302  *
1303  */
1304 template <class C>
1305 class MemberLteUeRrcSapUser : public LteUeRrcSapUser
1306 {
1307 public:
1308   /**
1309    * Constructor
1310    *
1311    * \param owner the owner class
1312    */
1313   MemberLteUeRrcSapUser (C* owner);
1314 
1315   // inherited from LteUeRrcSapUser
1316   virtual void Setup (SetupParameters params);
1317   virtual void SendRrcConnectionRequest (RrcConnectionRequest msg);
1318   virtual void SendRrcConnectionSetupCompleted (RrcConnectionSetupCompleted msg);
1319   virtual void SendRrcConnectionReconfigurationCompleted (RrcConnectionReconfigurationCompleted msg);
1320   virtual void SendRrcConnectionReestablishmentRequest (RrcConnectionReestablishmentRequest msg);
1321   virtual void SendRrcConnectionReestablishmentComplete (RrcConnectionReestablishmentComplete msg);
1322   virtual void SendMeasurementReport (MeasurementReport msg);
1323   virtual void SendIdealUeContextRemoveRequest (uint16_t rnti);
1324 
1325 private:
1326   MemberLteUeRrcSapUser ();
1327   C* m_owner; ///< the owner class
1328 };
1329 
1330 template <class C>
MemberLteUeRrcSapUser(C * owner)1331 MemberLteUeRrcSapUser<C>::MemberLteUeRrcSapUser (C* owner)
1332   : m_owner (owner)
1333 {
1334 }
1335 
1336 template <class C>
MemberLteUeRrcSapUser()1337 MemberLteUeRrcSapUser<C>::MemberLteUeRrcSapUser ()
1338 {
1339 }
1340 
1341 template <class C>
1342 void
Setup(SetupParameters params)1343 MemberLteUeRrcSapUser<C>::Setup (SetupParameters params)
1344 {
1345   m_owner->DoSetup (params);
1346 }
1347 
1348 template <class C>
1349 void
SendRrcConnectionRequest(RrcConnectionRequest msg)1350 MemberLteUeRrcSapUser<C>::SendRrcConnectionRequest (RrcConnectionRequest msg)
1351 {
1352   m_owner->DoSendRrcConnectionRequest (msg);
1353 }
1354 
1355 template <class C>
1356 void
SendRrcConnectionSetupCompleted(RrcConnectionSetupCompleted msg)1357 MemberLteUeRrcSapUser<C>::SendRrcConnectionSetupCompleted (RrcConnectionSetupCompleted msg)
1358 {
1359   m_owner->DoSendRrcConnectionSetupCompleted (msg);
1360 }
1361 
1362 template <class C>
1363 void
SendRrcConnectionReconfigurationCompleted(RrcConnectionReconfigurationCompleted msg)1364 MemberLteUeRrcSapUser<C>::SendRrcConnectionReconfigurationCompleted (RrcConnectionReconfigurationCompleted msg)
1365 {
1366   m_owner->DoSendRrcConnectionReconfigurationCompleted (msg);
1367 }
1368 
1369 template <class C>
1370 void
SendRrcConnectionReestablishmentRequest(RrcConnectionReestablishmentRequest msg)1371 MemberLteUeRrcSapUser<C>::SendRrcConnectionReestablishmentRequest (RrcConnectionReestablishmentRequest msg)
1372 {
1373   m_owner->DoSendRrcConnectionReestablishmentRequest (msg);
1374 }
1375 
1376 template <class C>
1377 void
SendRrcConnectionReestablishmentComplete(RrcConnectionReestablishmentComplete msg)1378 MemberLteUeRrcSapUser<C>::SendRrcConnectionReestablishmentComplete (RrcConnectionReestablishmentComplete msg)
1379 {
1380   m_owner->DoSendRrcConnectionReestablishmentComplete (msg);
1381 }
1382 
1383 template <class C>
1384 void
SendMeasurementReport(MeasurementReport msg)1385 MemberLteUeRrcSapUser<C>::SendMeasurementReport (MeasurementReport msg)
1386 {
1387   m_owner->DoSendMeasurementReport (msg);
1388 }
1389 
1390 template <class C>
1391 void
SendIdealUeContextRemoveRequest(uint16_t rnti)1392 MemberLteUeRrcSapUser<C>::SendIdealUeContextRemoveRequest (uint16_t rnti)
1393 {
1394   m_owner->DoSendIdealUeContextRemoveRequest (rnti);
1395 }
1396 
1397 /**
1398  * Template for the implementation of the LteUeRrcSapProvider as a member
1399  * of an owner class of type C to which all methods are forwarded
1400  *
1401  */
1402 template <class C>
1403 class MemberLteUeRrcSapProvider : public LteUeRrcSapProvider
1404 {
1405 public:
1406   /**
1407    * Constructor
1408    *
1409    * \param owner the owner class
1410    */
1411   MemberLteUeRrcSapProvider (C* owner);
1412 
1413   // methods inherited from LteUeRrcSapProvider go here
1414   virtual void CompleteSetup (CompleteSetupParameters params);
1415   virtual void RecvSystemInformation (SystemInformation msg);
1416   virtual void RecvRrcConnectionSetup (RrcConnectionSetup msg);
1417   virtual void RecvRrcConnectionReconfiguration (RrcConnectionReconfiguration msg);
1418   virtual void RecvRrcConnectionReestablishment (RrcConnectionReestablishment msg);
1419   virtual void RecvRrcConnectionReestablishmentReject (RrcConnectionReestablishmentReject msg);
1420   virtual void RecvRrcConnectionRelease (RrcConnectionRelease msg);
1421   virtual void RecvRrcConnectionReject (RrcConnectionReject msg);
1422 
1423 private:
1424   MemberLteUeRrcSapProvider ();
1425   C* m_owner; ///< the owner class
1426 };
1427 
1428 template <class C>
MemberLteUeRrcSapProvider(C * owner)1429 MemberLteUeRrcSapProvider<C>::MemberLteUeRrcSapProvider (C* owner)
1430   : m_owner (owner)
1431 {
1432 }
1433 
1434 template <class C>
MemberLteUeRrcSapProvider()1435 MemberLteUeRrcSapProvider<C>::MemberLteUeRrcSapProvider ()
1436 {
1437 }
1438 
1439 template <class C>
1440 void
CompleteSetup(CompleteSetupParameters params)1441 MemberLteUeRrcSapProvider<C>::CompleteSetup (CompleteSetupParameters params)
1442 {
1443   m_owner->DoCompleteSetup (params);
1444 }
1445 
1446 template <class C>
1447 void
RecvSystemInformation(SystemInformation msg)1448 MemberLteUeRrcSapProvider<C>::RecvSystemInformation (SystemInformation msg)
1449 {
1450   Simulator::ScheduleNow (&C::DoRecvSystemInformation, m_owner, msg);
1451 }
1452 
1453 template <class C>
1454 void
RecvRrcConnectionSetup(RrcConnectionSetup msg)1455 MemberLteUeRrcSapProvider<C>::RecvRrcConnectionSetup (RrcConnectionSetup msg)
1456 {
1457   Simulator::ScheduleNow (&C::DoRecvRrcConnectionSetup, m_owner, msg);
1458 }
1459 
1460 template <class C>
1461 void
RecvRrcConnectionReconfiguration(RrcConnectionReconfiguration msg)1462 MemberLteUeRrcSapProvider<C>::RecvRrcConnectionReconfiguration (RrcConnectionReconfiguration msg)
1463 {
1464   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReconfiguration, m_owner, msg);
1465 }
1466 
1467 template <class C>
1468 void
RecvRrcConnectionReestablishment(RrcConnectionReestablishment msg)1469 MemberLteUeRrcSapProvider<C>::RecvRrcConnectionReestablishment (RrcConnectionReestablishment msg)
1470 {
1471   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReestablishment, m_owner, msg);
1472 }
1473 
1474 template <class C>
1475 void
RecvRrcConnectionReestablishmentReject(RrcConnectionReestablishmentReject msg)1476 MemberLteUeRrcSapProvider<C>::RecvRrcConnectionReestablishmentReject (RrcConnectionReestablishmentReject msg)
1477 {
1478   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReestablishmentReject, m_owner, msg);
1479 }
1480 
1481 template <class C>
1482 void
RecvRrcConnectionRelease(RrcConnectionRelease msg)1483 MemberLteUeRrcSapProvider<C>::RecvRrcConnectionRelease (RrcConnectionRelease msg)
1484 {
1485   Simulator::ScheduleNow (&C::DoRecvRrcConnectionRelease, m_owner, msg);
1486 }
1487 
1488 template <class C>
1489 void
RecvRrcConnectionReject(RrcConnectionReject msg)1490 MemberLteUeRrcSapProvider<C>::RecvRrcConnectionReject (RrcConnectionReject msg)
1491 {
1492   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReject, m_owner, msg);
1493 }
1494 
1495 
1496 /**
1497  * Template for the implementation of the LteEnbRrcSapUser as a member
1498  * of an owner class of type C to which all methods are forwarded
1499  *
1500  */
1501 template <class C>
1502 class MemberLteEnbRrcSapUser : public LteEnbRrcSapUser
1503 {
1504 public:
1505   /**
1506    * Constructor
1507    *
1508    * \param owner the owner class
1509    */
1510   MemberLteEnbRrcSapUser (C* owner);
1511 
1512   // inherited from LteEnbRrcSapUser
1513 
1514   virtual void SetupUe (uint16_t rnti, SetupUeParameters params);
1515   virtual void RemoveUe (uint16_t rnti);
1516   virtual void SendSystemInformation (uint16_t cellId, SystemInformation msg);
1517   virtual void SendRrcConnectionSetup (uint16_t rnti, RrcConnectionSetup msg);
1518   virtual void SendRrcConnectionReconfiguration (uint16_t rnti, RrcConnectionReconfiguration msg);
1519   virtual void SendRrcConnectionReestablishment (uint16_t rnti, RrcConnectionReestablishment msg);
1520   virtual void SendRrcConnectionReestablishmentReject (uint16_t rnti, RrcConnectionReestablishmentReject msg);
1521   virtual void SendRrcConnectionRelease (uint16_t rnti, RrcConnectionRelease msg);
1522   virtual void SendRrcConnectionReject (uint16_t rnti, RrcConnectionReject msg);
1523   virtual Ptr<Packet> EncodeHandoverPreparationInformation (HandoverPreparationInfo msg);
1524   virtual HandoverPreparationInfo DecodeHandoverPreparationInformation (Ptr<Packet> p);
1525   virtual Ptr<Packet> EncodeHandoverCommand (RrcConnectionReconfiguration msg);
1526   virtual RrcConnectionReconfiguration DecodeHandoverCommand (Ptr<Packet> p);
1527 
1528 private:
1529   MemberLteEnbRrcSapUser ();
1530   C* m_owner; ///< the owner class
1531 };
1532 
1533 template <class C>
MemberLteEnbRrcSapUser(C * owner)1534 MemberLteEnbRrcSapUser<C>::MemberLteEnbRrcSapUser (C* owner)
1535   : m_owner (owner)
1536 {
1537 }
1538 
1539 template <class C>
MemberLteEnbRrcSapUser()1540 MemberLteEnbRrcSapUser<C>::MemberLteEnbRrcSapUser ()
1541 {
1542 }
1543 
1544 template <class C>
1545 void
SetupUe(uint16_t rnti,SetupUeParameters params)1546 MemberLteEnbRrcSapUser<C>::SetupUe (uint16_t rnti, SetupUeParameters params)
1547 {
1548   m_owner->DoSetupUe (rnti, params);
1549 }
1550 
1551 template <class C>
1552 void
RemoveUe(uint16_t rnti)1553 MemberLteEnbRrcSapUser<C>::RemoveUe (uint16_t rnti)
1554 {
1555   m_owner->DoRemoveUe (rnti);
1556 }
1557 
1558 template <class C>
1559 void
SendSystemInformation(uint16_t cellId,SystemInformation msg)1560 MemberLteEnbRrcSapUser<C>::SendSystemInformation (uint16_t cellId, SystemInformation msg)
1561 {
1562   m_owner->DoSendSystemInformation (cellId, msg);
1563 }
1564 
1565 template <class C>
1566 void
SendRrcConnectionSetup(uint16_t rnti,RrcConnectionSetup msg)1567 MemberLteEnbRrcSapUser<C>::SendRrcConnectionSetup (uint16_t rnti, RrcConnectionSetup msg)
1568 {
1569   m_owner->DoSendRrcConnectionSetup (rnti, msg);
1570 }
1571 
1572 template <class C>
1573 void
SendRrcConnectionReconfiguration(uint16_t rnti,RrcConnectionReconfiguration msg)1574 MemberLteEnbRrcSapUser<C>::SendRrcConnectionReconfiguration (uint16_t rnti, RrcConnectionReconfiguration msg)
1575 {
1576   m_owner->DoSendRrcConnectionReconfiguration (rnti, msg);
1577 }
1578 
1579 template <class C>
1580 void
SendRrcConnectionReestablishment(uint16_t rnti,RrcConnectionReestablishment msg)1581 MemberLteEnbRrcSapUser<C>::SendRrcConnectionReestablishment (uint16_t rnti, RrcConnectionReestablishment msg)
1582 {
1583   m_owner->DoSendRrcConnectionReestablishment (rnti, msg);
1584 }
1585 
1586 template <class C>
1587 void
SendRrcConnectionReestablishmentReject(uint16_t rnti,RrcConnectionReestablishmentReject msg)1588 MemberLteEnbRrcSapUser<C>::SendRrcConnectionReestablishmentReject (uint16_t rnti, RrcConnectionReestablishmentReject msg)
1589 {
1590   m_owner->DoSendRrcConnectionReestablishmentReject (rnti, msg);
1591 }
1592 
1593 template <class C>
1594 void
SendRrcConnectionRelease(uint16_t rnti,RrcConnectionRelease msg)1595 MemberLteEnbRrcSapUser<C>::SendRrcConnectionRelease (uint16_t rnti, RrcConnectionRelease msg)
1596 {
1597   m_owner->DoSendRrcConnectionRelease (rnti, msg);
1598 }
1599 
1600 template <class C>
1601 void
SendRrcConnectionReject(uint16_t rnti,RrcConnectionReject msg)1602 MemberLteEnbRrcSapUser<C>::SendRrcConnectionReject (uint16_t rnti, RrcConnectionReject msg)
1603 {
1604   m_owner->DoSendRrcConnectionReject (rnti, msg);
1605 }
1606 
1607 template <class C>
1608 Ptr<Packet>
EncodeHandoverPreparationInformation(HandoverPreparationInfo msg)1609 MemberLteEnbRrcSapUser<C>::EncodeHandoverPreparationInformation (HandoverPreparationInfo msg)
1610 {
1611   return m_owner->DoEncodeHandoverPreparationInformation (msg);
1612 }
1613 
1614 template <class C>
1615 LteRrcSap::HandoverPreparationInfo
DecodeHandoverPreparationInformation(Ptr<Packet> p)1616 MemberLteEnbRrcSapUser<C>::DecodeHandoverPreparationInformation (Ptr<Packet> p)
1617 {
1618   return m_owner->DoDecodeHandoverPreparationInformation (p);
1619 }
1620 
1621 
1622 template <class C>
1623 Ptr<Packet>
EncodeHandoverCommand(RrcConnectionReconfiguration msg)1624 MemberLteEnbRrcSapUser<C>::EncodeHandoverCommand (RrcConnectionReconfiguration msg)
1625 {
1626   return m_owner->DoEncodeHandoverCommand (msg);
1627 }
1628 
1629 template <class C>
1630 LteRrcSap::RrcConnectionReconfiguration
DecodeHandoverCommand(Ptr<Packet> p)1631 MemberLteEnbRrcSapUser<C>::DecodeHandoverCommand (Ptr<Packet> p)
1632 {
1633   return m_owner->DoDecodeHandoverCommand (p);
1634 }
1635 
1636 /**
1637  * Template for the implementation of the LteEnbRrcSapProvider as a member
1638  * of an owner class of type C to which all methods are forwarded
1639  *
1640  */
1641 template <class C>
1642 class MemberLteEnbRrcSapProvider : public LteEnbRrcSapProvider
1643 {
1644 public:
1645   /**
1646    * Constructor
1647    *
1648    * \param owner
1649    */
1650   MemberLteEnbRrcSapProvider (C* owner);
1651 
1652   // methods inherited from LteEnbRrcSapProvider go here
1653 
1654   virtual void CompleteSetupUe (uint16_t rnti, CompleteSetupUeParameters params);
1655   virtual void RecvRrcConnectionRequest (uint16_t rnti, RrcConnectionRequest msg);
1656   virtual void RecvRrcConnectionSetupCompleted (uint16_t rnti, RrcConnectionSetupCompleted msg);
1657   virtual void RecvRrcConnectionReconfigurationCompleted (uint16_t rnti, RrcConnectionReconfigurationCompleted msg);
1658   virtual void RecvRrcConnectionReestablishmentRequest (uint16_t rnti, RrcConnectionReestablishmentRequest msg);
1659   virtual void RecvRrcConnectionReestablishmentComplete (uint16_t rnti, RrcConnectionReestablishmentComplete msg);
1660   virtual void RecvMeasurementReport (uint16_t rnti, MeasurementReport msg);
1661   virtual void RecvIdealUeContextRemoveRequest (uint16_t rnti);
1662 
1663 private:
1664   MemberLteEnbRrcSapProvider ();
1665   C* m_owner; ///< the owner class
1666 };
1667 
1668 template <class C>
MemberLteEnbRrcSapProvider(C * owner)1669 MemberLteEnbRrcSapProvider<C>::MemberLteEnbRrcSapProvider (C* owner)
1670   : m_owner (owner)
1671 {
1672 }
1673 
1674 template <class C>
MemberLteEnbRrcSapProvider()1675 MemberLteEnbRrcSapProvider<C>::MemberLteEnbRrcSapProvider ()
1676 {
1677 }
1678 
1679 template <class C>
1680 void
CompleteSetupUe(uint16_t rnti,CompleteSetupUeParameters params)1681 MemberLteEnbRrcSapProvider<C>::CompleteSetupUe (uint16_t rnti, CompleteSetupUeParameters params)
1682 {
1683   m_owner->DoCompleteSetupUe (rnti, params);
1684 }
1685 
1686 template <class C>
1687 void
RecvRrcConnectionRequest(uint16_t rnti,RrcConnectionRequest msg)1688 MemberLteEnbRrcSapProvider<C>::RecvRrcConnectionRequest (uint16_t rnti, RrcConnectionRequest msg)
1689 {
1690   Simulator::ScheduleNow (&C::DoRecvRrcConnectionRequest, m_owner, rnti, msg);
1691 }
1692 
1693 template <class C>
1694 void
RecvRrcConnectionSetupCompleted(uint16_t rnti,RrcConnectionSetupCompleted msg)1695 MemberLteEnbRrcSapProvider<C>::RecvRrcConnectionSetupCompleted (uint16_t rnti, RrcConnectionSetupCompleted msg)
1696 {
1697   Simulator::ScheduleNow (&C::DoRecvRrcConnectionSetupCompleted, m_owner, rnti, msg);
1698 }
1699 
1700 template <class C>
1701 void
RecvRrcConnectionReconfigurationCompleted(uint16_t rnti,RrcConnectionReconfigurationCompleted msg)1702 MemberLteEnbRrcSapProvider<C>::RecvRrcConnectionReconfigurationCompleted (uint16_t rnti, RrcConnectionReconfigurationCompleted msg)
1703 {
1704   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReconfigurationCompleted, m_owner, rnti, msg);
1705 }
1706 
1707 template <class C>
1708 void
RecvRrcConnectionReestablishmentRequest(uint16_t rnti,RrcConnectionReestablishmentRequest msg)1709 MemberLteEnbRrcSapProvider<C>::RecvRrcConnectionReestablishmentRequest (uint16_t rnti, RrcConnectionReestablishmentRequest msg)
1710 {
1711   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReestablishmentRequest, m_owner, rnti, msg);
1712 }
1713 
1714 template <class C>
1715 void
RecvRrcConnectionReestablishmentComplete(uint16_t rnti,RrcConnectionReestablishmentComplete msg)1716 MemberLteEnbRrcSapProvider<C>::RecvRrcConnectionReestablishmentComplete (uint16_t rnti, RrcConnectionReestablishmentComplete msg)
1717 {
1718   Simulator::ScheduleNow (&C::DoRecvRrcConnectionReestablishmentComplete, m_owner, rnti, msg);
1719 }
1720 
1721 template <class C>
1722 void
RecvMeasurementReport(uint16_t rnti,MeasurementReport msg)1723 MemberLteEnbRrcSapProvider<C>::RecvMeasurementReport (uint16_t rnti, MeasurementReport msg)
1724 {
1725   Simulator::ScheduleNow (&C::DoRecvMeasurementReport, m_owner, rnti, msg);
1726 }
1727 
1728 template <class C>
RecvIdealUeContextRemoveRequest(uint16_t rnti)1729 void MemberLteEnbRrcSapProvider<C>::RecvIdealUeContextRemoveRequest (uint16_t rnti)
1730 {
1731   Simulator::ScheduleNow (&C::DoRecvIdealUeContextRemoveRequest, m_owner, rnti);
1732 }
1733 
1734 
1735 
1736 
1737 
1738 
1739 
1740 
1741 
1742 
1743 
1744 
1745 
1746 
1747 } // namespace ns3
1748 
1749 
1750 #endif // LTE_RRC_SAP_H
1751 
1752 
1753 
1754 
1755