A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
lte-enb-rrc.h
Go to the documentation of this file.
1
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2011, 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
* Marco Miozzo <mmiozzo@cttc.es>
20
* Manuel Requena <manuel.requena@cttc.es>
21
*/
22
23
#ifndef LTE_ENB_RRC_H
24
#define LTE_ENB_RRC_H
25
26
#include <ns3/nstime.h>
27
#include <ns3/object.h>
28
#include <ns3/packet.h>
29
#include <ns3/lte-enb-cmac-sap.h>
30
#include <ns3/lte-mac-sap.h>
31
#include <ns3/ff-mac-sched-sap.h>
32
#include <ns3/lte-pdcp-sap.h>
33
#include <ns3/epc-x2-sap.h>
34
#include <ns3/epc-enb-s1-sap.h>
35
#include <ns3/lte-enb-cphy-sap.h>
36
#include <ns3/lte-rrc-sap.h>
37
#include <ns3/traced-callback.h>
38
#include <ns3/event-id.h>
39
40
#include <map>
41
#include <set>
42
43
namespace
ns3 {
44
45
class
LteRadioBearerInfo;
46
class
LteSignalingRadioBearerInfo;
47
class
LteDataRadioBearerInfo;
48
class
EpcEnbS1SapUser;
49
class
EpcEnbS1SapProvider;
50
class
LteUeRrc;
51
class
LteEnbRrc;
52
53
58
class
NeighbourRelation
:
public
Object
59
{
60
public
:
61
uint16_t
m_physCellId
;
62
bool
m_noRemove
;
63
bool
m_noHo
;
64
bool
m_noX2
;
65
bool
m_detectedAsNeighbour
;
66
};
67
72
class
UeMeasure
:
public
Object
73
{
74
public
:
75
uint16_t
m_cellId
;
76
uint8_t
m_rsrp
;
77
uint8_t
m_rsrq
;
78
};
79
80
85
class
UeManager
:
public
Object
86
{
87
friend
class
LtePdcpSpecificLtePdcpSapUser
<
UeManager
>;
88
89
public
:
90
91
96
enum
State
97
{
98
INITIAL_RANDOM_ACCESS
= 0,
99
CONNECTION_SETUP
,
100
CONNECTION_REJECTED
,
101
CONNECTED_NORMALLY
,
102
CONNECTION_RECONFIGURATION
,
103
CONNECTION_REESTABLISHMENT
,
104
HANDOVER_PREPARATION
,
105
HANDOVER_JOINING
,
106
HANDOVER_PATH_SWITCH
,
107
HANDOVER_LEAVING
,
108
NUM_STATES
109
};
110
111
UeManager
();
112
122
UeManager
(
Ptr<LteEnbRrc>
rrc, uint16_t rnti,
State
s
);
123
124
virtual
~UeManager
(
void
);
125
126
// inherited from Object
127
protected
:
128
virtual
void
DoInitialize
();
129
virtual
void
DoDispose
();
130
public
:
131
static
TypeId
GetTypeId
(
void
);
132
140
void
SetSource
(uint16_t sourceCellId, uint16_t sourceX2apId);
141
147
void
SetImsi
(uint64_t imsi);
148
159
void
SetupDataRadioBearer
(
EpsBearer
bearer, uint8_t bearerId, uint32_t gtpTeid,
Ipv4Address
transportLayerAddress);
160
166
void
RecordDataRadioBearersToBeStarted
();
167
173
void
StartDataRadioBearers
();
174
181
void
ReleaseDataRadioBearer
(uint8_t drbid);
182
187
void
ScheduleRrcConnectionReconfiguration
();
188
194
void
PrepareHandover
(uint16_t cellId);
195
201
void
RecvHandoverRequestAck
(
EpcX2SapUser::HandoverRequestAckParams
params);
202
208
LteRrcSap::RadioResourceConfigDedicated
GetRadioResourceConfigForHandoverPreparationInfo
();
209
219
LteRrcSap::RrcConnectionReconfiguration
GetRrcConnectionReconfigurationForHandover
();
220
227
void
SendData
(uint8_t bid,
Ptr<Packet>
p);
228
233
std::vector<EpcX2Sap::ErabToBeSetupItem>
GetErabList
();
234
240
void
SendUeContextRelease
();
241
247
void
RecvHandoverPreparationFailure
(uint16_t cellId);
248
254
void
RecvSnStatusTransfer
(
EpcX2SapUser::SnStatusTransferParams
params);
255
261
void
RecvUeContextRelease
(
EpcX2SapUser::UeContextReleaseParams
params);
262
263
// methods forwarded from RRC SAP
264
void
CompleteSetupUe
(
LteEnbRrcSapProvider::CompleteSetupUeParameters
params);
265
void
RecvRrcConnectionRequest
(
LteRrcSap::RrcConnectionRequest
msg);
266
void
RecvRrcConnectionSetupCompleted
(
LteRrcSap::RrcConnectionSetupCompleted
msg);
267
void
RecvRrcConnectionReconfigurationCompleted
(
LteRrcSap::RrcConnectionReconfigurationCompleted
msg);
268
void
RecvRrcConnectionReestablishmentRequest
(
LteRrcSap::RrcConnectionReestablishmentRequest
msg);
269
void
RecvRrcConnectionReestablishmentComplete
(
LteRrcSap::RrcConnectionReestablishmentComplete
msg);
270
void
RecvMeasurementReport
(
LteRrcSap::MeasurementReport
msg);
271
272
273
// methods forwarded from CMAC SAP
274
void
CmacUeConfigUpdateInd
(
LteEnbCmacSapUser::UeConfig
cmacParams);
275
276
277
// methods forwarded from PDCP SAP
278
void
DoReceivePdcpSdu
(
LtePdcpSapUser::ReceivePdcpSduParameters
params);
279
285
uint16_t
GetRnti
(
void
);
286
291
uint64_t
GetImsi
(
void
);
292
297
uint16_t
GetSrsConfigurationIndex
(
void
);
298
304
void
SetSrsConfigurationIndex
(uint16_t srsConfIndex);
305
310
State
GetState
();
311
312
313
private
:
314
322
uint8_t
AddDataRadioBearerInfo
(
Ptr<LteDataRadioBearerInfo>
radioBearerInfo);
323
329
Ptr<LteDataRadioBearerInfo>
GetDataRadioBearerInfo
(uint8_t drbid);
330
336
void
RemoveDataRadioBearerInfo
(uint8_t drbid);
337
343
LteRrcSap::RrcConnectionReconfiguration
BuildRrcConnectionReconfiguration
();
344
350
LteRrcSap::RadioResourceConfigDedicated
BuildRadioResourceConfigDedicated
();
351
357
LteRrcSap::MeasConfig
BuildMeasConfig
();
358
359
364
uint8_t
GetNewRrcTransactionIdentifier
();
365
371
uint8_t
Lcid2Drbid
(uint8_t lcid);
372
378
uint8_t
Drbid2Lcid
(uint8_t drbid);
379
385
uint8_t
Lcid2Bid
(uint8_t lcid);
386
392
uint8_t
Bid2Lcid
(uint8_t bid);
393
399
uint8_t
Drbid2Bid
(uint8_t drbid);
400
406
uint8_t
Bid2Drbid
(uint8_t bid);
407
413
void
SwitchToState
(
State
s
);
414
415
416
std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >
m_drbMap
;
417
Ptr<LteSignalingRadioBearerInfo>
m_srb0
;
418
Ptr<LteSignalingRadioBearerInfo>
m_srb1
;
419
uint8_t
m_lastAllocatedDrbid
;
420
uint16_t
m_rnti
;
421
uint64_t
m_imsi
;
422
uint8_t
m_lastRrcTransactionIdentifier
;
423
LteRrcSap::PhysicalConfigDedicated
m_physicalConfigDedicated
;
424
Ptr<LteEnbRrc>
m_rrc
;
425
State
m_state
;
426
LtePdcpSapUser
*
m_drbPdcpSapUser
;
427
bool
m_pendingRrcConnectionReconfiguration
;
428
// imsi cellid rnti old new
429
TracedCallback<uint64_t, uint16_t, uint16_t, State, State>
m_stateTransitionTrace
;
430
uint16_t
m_sourceX2apId
;
431
uint16_t
m_sourceCellId
;
432
uint16_t
m_targetCellId
;
433
std::list<uint8_t>
m_drbsToBeStarted
;
434
bool
m_needTransmissionModeConfiguration
;
435
436
EventId
m_connectionTimeout
;
437
EventId
m_connectionRejectedTimeout
;
438
EventId
m_handoverJoiningTimeout
;
439
EventId
m_handoverLeavingTimeout
;
440
441
Ptr<UeMeasure>
m_servingCellMeasures
;
442
// cellid
443
std::map<uint16_t, Ptr<UeMeasure> >
m_neighbourCellMeasures
;
444
445
};
446
447
453
class
LteEnbRrc
:
public
Object
454
{
455
456
friend
class
EnbRrcMemberLteEnbCmacSapUser
;
457
friend
class
MemberLteEnbRrcSapProvider
<
LteEnbRrc
>;
458
friend
class
MemberEpcEnbS1SapUser
<
LteEnbRrc
>;
459
friend
class
EpcX2SpecificEpcX2SapUser
<
LteEnbRrc
>;
460
friend
class
UeManager
;
461
462
public
:
467
LteEnbRrc
();
468
472
virtual
~LteEnbRrc
();
473
474
475
// inherited from Object
476
protected
:
477
virtual
void
DoDispose
(
void
);
478
public
:
479
static
TypeId
GetTypeId
(
void
);
480
481
486
void
SetEpcX2SapProvider
(
EpcX2SapProvider
*
s
);
487
492
EpcX2SapUser
*
GetEpcX2SapUser
();
493
494
500
void
SetLteEnbCmacSapProvider
(
LteEnbCmacSapProvider
*
s
);
501
506
LteEnbCmacSapUser
*
GetLteEnbCmacSapUser
();
507
508
514
void
SetLteEnbRrcSapUser
(
LteEnbRrcSapUser
*
s
);
515
521
LteEnbRrcSapProvider
*
GetLteEnbRrcSapProvider
();
522
530
void
SetLteMacSapProvider
(
LteMacSapProvider
*
s
);
531
532
538
void
SetS1SapProvider
(
EpcEnbS1SapProvider
*
s
);
539
544
EpcEnbS1SapUser
*
GetS1SapUser
();
545
546
552
void
SetLteEnbCphySapProvider
(
LteEnbCphySapProvider
*
s
);
553
559
LteEnbCphySapUser
*
GetLteEnbCphySapUser
();
560
568
Ptr<UeManager>
GetUeManager
(uint16_t rnti);
569
579
void
ConfigureCell
(uint8_t ulBandwidth,
580
uint8_t dlBandwidth,
581
uint16_t ulEarfcn,
582
uint16_t dlEarfcn,
583
uint16_t cellId);
584
590
void
SetCellId
(uint16_t
m_cellId
);
591
601
bool
SendData
(
Ptr<Packet>
p);
602
609
void
SetForwardUpCallback
(
Callback
<
void
,
Ptr<Packet>
> cb);
610
617
void
ConnectionTimeout
(uint16_t rnti);
618
624
void
ConnectionRejectedTimeout
(uint16_t rnti);
625
632
void
HandoverJoiningTimeout
(uint16_t rnti);
633
640
void
HandoverLeavingTimeout
(uint16_t rnti);
641
652
void
SendHandoverRequest
(uint16_t rnti, uint16_t cellId);
653
658
enum
LteEpsBearerToRlcMapping_t
{
RLC_SM_ALWAYS
= 1,
659
RLC_UM_ALWAYS
= 2,
660
RLC_AM_ALWAYS
= 3,
661
PER_BASED
= 4};
662
663
private
:
664
665
666
// methods forwarded from RRC SAP
667
668
void
DoCompleteSetupUe
(uint16_t rnti,
LteEnbRrcSapProvider::CompleteSetupUeParameters
params);
669
void
DoRecvRrcConnectionRequest
(uint16_t rnti,
LteRrcSap::RrcConnectionRequest
msg);
670
void
DoRecvRrcConnectionSetupCompleted
(uint16_t rnti,
LteRrcSap::RrcConnectionSetupCompleted
msg);
671
void
DoRecvRrcConnectionReconfigurationCompleted
(uint16_t rnti,
LteRrcSap::RrcConnectionReconfigurationCompleted
msg);
672
void
DoRecvRrcConnectionReestablishmentRequest
(uint16_t rnti,
LteRrcSap::RrcConnectionReestablishmentRequest
msg);
673
void
DoRecvRrcConnectionReestablishmentComplete
(uint16_t rnti,
LteRrcSap::RrcConnectionReestablishmentComplete
msg);
674
void
DoRecvMeasurementReport
(uint16_t rnti,
LteRrcSap::MeasurementReport
msg);
675
676
677
// S1 SAP methods
678
void
DoDataRadioBearerSetupRequest
(
EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters
params);
679
void
DoPathSwitchRequestAcknowledge
(
EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters
params);
680
// X2 SAP methods
681
void
DoRecvHandoverRequest
(
EpcX2SapUser::HandoverRequestParams
params);
682
void
DoRecvHandoverRequestAck
(
EpcX2SapUser::HandoverRequestAckParams
params);
683
void
DoRecvHandoverPreparationFailure
(
EpcX2SapUser::HandoverPreparationFailureParams
params);
684
void
DoRecvSnStatusTransfer
(
EpcX2SapUser::SnStatusTransferParams
params);
685
void
DoRecvUeContextRelease
(
EpcX2SapUser::UeContextReleaseParams
params);
686
void
DoRecvLoadInformation
(
EpcX2SapUser::LoadInformationParams
params);
687
void
DoRecvResourceStatusUpdate
(
EpcX2SapUser::ResourceStatusUpdateParams
params);
688
void
DoRecvUeData
(
EpcX2SapUser::UeDataParams
params);
689
690
691
// CMAC SAP methods
692
uint16_t
DoAllocateTemporaryCellRnti
();
693
void
DoNotifyLcConfigResult
(uint16_t rnti, uint8_t lcid,
bool
success);
694
void
DoRrcConfigurationUpdateInd
(
LteEnbCmacSapUser::UeConfig
params);
695
696
697
// Internal methods
698
708
uint16_t
AddUe
(
UeManager::State
state);
709
715
void
RemoveUe
(uint16_t rnti);
716
717
724
TypeId
GetRlcType
(
EpsBearer
bearer);
725
726
727
728
public
:
729
735
void
AddX2Neighbour
(uint16_t cellId);
736
741
void
SetSrsPeriodicity
(uint32_t p);
742
747
uint32_t
GetSrsPeriodicity
()
const
;
748
749
private
:
750
759
uint16_t
GetNewSrsConfigurationIndex
(
void
);
760
769
void
RemoveSrsConfigurationIndex
(uint16_t srcCi);
770
771
772
780
uint8_t
GetLogicalChannelGroup
(
EpsBearer
bearer);
781
790
uint8_t
GetLogicalChannelPriority
(
EpsBearer
bearer);
791
792
797
void
SendSystemInformation
();
798
799
Callback <void, Ptr<Packet>
>
m_forwardUpCallback
;
800
801
EpcX2SapUser
*
m_x2SapUser
;
802
EpcX2SapProvider
*
m_x2SapProvider
;
803
804
LteEnbCmacSapUser
*
m_cmacSapUser
;
805
LteEnbCmacSapProvider
*
m_cmacSapProvider
;
806
807
LteEnbRrcSapUser
*
m_rrcSapUser
;
808
LteEnbRrcSapProvider
*
m_rrcSapProvider
;
809
810
LteMacSapProvider
*
m_macSapProvider
;
811
812
EpcEnbS1SapProvider
*
m_s1SapProvider
;
813
EpcEnbS1SapUser
*
m_s1SapUser
;
814
815
LteEnbCphySapUser
*
m_cphySapUser
;
816
LteEnbCphySapProvider
*
m_cphySapProvider
;
817
818
bool
m_configured
;
819
uint16_t
m_cellId
;
820
uint16_t
m_dlEarfcn
;
821
uint16_t
m_ulEarfcn
;
822
uint16_t
m_dlBandwidth
;
823
uint16_t
m_ulBandwidth
;
824
uint16_t
m_lastAllocatedRnti
;
825
826
std::map<uint16_t, Ptr<UeManager> >
m_ueMap
;
827
828
struct
X2uTeidInfo
829
{
830
uint16_t
rnti
;
831
uint8_t
drbid
;
832
};
833
834
// TEID RNTI, DRBID
835
std::map<uint32_t, X2uTeidInfo>
m_x2uTeidInfoMap
;
836
837
uint8_t
m_defaultTransmissionMode
;
838
839
enum
LteEpsBearerToRlcMapping_t
m_epsBearerToRlcMapping
;
840
841
Time
m_systemInformationPeriodicity
;
842
843
// SRS related attributes
844
uint16_t
m_srsCurrentPeriodicityId
;
845
std::set<uint16_t>
m_ueSrsConfigurationIndexSet
;
846
uint16_t
m_lastAllocatedConfigurationIndex
;
847
bool
m_reconfigureUes
;
848
849
// Handover related attributes
850
bool
m_admitHandoverRequest
;
851
bool
m_admitRrcConnectionRequest
;
852
uint8_t
m_eventA2Threshold
;
853
uint8_t
m_eventA4Threshold
;
854
uint8_t
m_servingCellHandoverThreshold
;
855
uint8_t
m_neighbourCellHandoverOffset
;
856
857
// timeouts
858
Time
m_connectionTimeoutDuration
;
859
Time
m_connectionRejectedTimeoutDuration
;
860
Time
m_handoverJoiningTimeoutDuration
;
861
Time
m_handoverLeavingTimeoutDuration
;
862
863
// cellid
864
std::map<uint16_t, Ptr<NeighbourRelation> >
m_neighbourRelationTable
;
865
866
867
// cellid rnti
868
TracedCallback<uint16_t, uint16_t>
m_newUeContextTrace
;
869
// imsi cellid rnti
870
TracedCallback<uint64_t, uint16_t, uint16_t>
m_connectionEstablishedTrace
;
871
// imsi cellid rnti
872
TracedCallback<uint64_t, uint16_t, uint16_t>
m_connectionReconfigurationTrace
;
873
// imsi cellid rnti targetCellId
874
TracedCallback<uint64_t, uint16_t, uint16_t, uint16_t>
m_handoverStartTrace
;
875
// imsi cellid rnti
876
TracedCallback<uint64_t, uint16_t, uint16_t>
m_handoverEndOkTrace
;
877
878
// imsi cellid rnti
879
TracedCallback<uint64_t, uint16_t, uint16_t, LteRrcSap::MeasurementReport>
m_recvMeasurementReportTrace
;
880
881
};
882
883
884
}
// namespace ns3
885
886
#endif // LTE_ENB_RRC_H
src
lte
model
lte-enb-rrc.h
Generated on Fri Aug 30 2013 01:42:55 for ns-3 by
1.8.1.2