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
57
class
UeManager
:
public
Object
58
{
59
friend
class
LtePdcpSpecificLtePdcpSapUser
<
UeManager
>;
60
61
public
:
62
63
68
enum
State
69
{
70
INITIAL_RANDOM_ACCESS
= 0,
71
CONNECTION_SETUP
,
72
CONNECTION_REJECTED
,
73
CONNECTED_NORMALLY
,
74
CONNECTION_RECONFIGURATION
,
75
CONNECTION_REESTABLISHMENT
,
76
HANDOVER_PREPARATION
,
77
HANDOVER_JOINING
,
78
HANDOVER_PATH_SWITCH
,
79
HANDOVER_LEAVING
,
80
NUM_STATES
81
};
82
83
UeManager
();
84
94
UeManager
(
Ptr<LteEnbRrc>
rrc, uint16_t rnti,
State
s);
95
96
virtual
~UeManager
(
void
);
97
98
// inherited from Object
99
protected
:
100
virtual
void
DoInitialize
();
101
virtual
void
DoDispose
();
102
public
:
103
static
TypeId
GetTypeId
(
void
);
104
112
void
SetSource
(uint16_t sourceCellId, uint16_t sourceX2apId);
113
119
void
SetImsi
(uint64_t imsi);
120
131
void
SetupDataRadioBearer
(
EpsBearer
bearer, uint8_t bearerId, uint32_t gtpTeid,
Ipv4Address
transportLayerAddress);
132
138
void
RecordDataRadioBearersToBeStarted
();
139
145
void
StartDataRadioBearers
();
146
153
void
ReleaseDataRadioBearer
(uint8_t drbid);
154
159
void
ScheduleRrcConnectionReconfiguration
();
160
166
void
PrepareHandover
(uint16_t cellId);
167
173
void
RecvHandoverRequestAck
(
EpcX2SapUser::HandoverRequestAckParams
params);
174
180
LteRrcSap::RadioResourceConfigDedicated
GetRadioResourceConfigForHandoverPreparationInfo
();
181
191
LteRrcSap::RrcConnectionReconfiguration
GetRrcConnectionReconfigurationForHandover
();
192
199
void
SendData
(uint8_t bid,
Ptr<Packet>
p);
200
205
std::vector<EpcX2Sap::ErabToBeSetupItem>
GetErabList
();
206
212
void
SendUeContextRelease
();
213
219
void
RecvHandoverPreparationFailure
(uint16_t cellId);
220
226
void
RecvSnStatusTransfer
(
EpcX2SapUser::SnStatusTransferParams
params);
227
228
229
// methods forwarded from RRC SAP
230
void
CompleteSetupUe
(
LteEnbRrcSapProvider::CompleteSetupUeParameters
params);
231
void
RecvRrcConnectionRequest
(
LteRrcSap::RrcConnectionRequest
msg);
232
void
RecvRrcConnectionSetupCompleted
(
LteRrcSap::RrcConnectionSetupCompleted
msg);
233
void
RecvRrcConnectionReconfigurationCompleted
(
LteRrcSap::RrcConnectionReconfigurationCompleted
msg);
234
void
RecvRrcConnectionReestablishmentRequest
(
LteRrcSap::RrcConnectionReestablishmentRequest
msg);
235
void
RecvRrcConnectionReestablishmentComplete
(
LteRrcSap::RrcConnectionReestablishmentComplete
msg);
236
void
RecvMeasurementReport
(
LteRrcSap::MeasurementReport
msg);
237
238
239
// methods forwarded from CMAC SAP
240
void
CmacUeConfigUpdateInd
(
LteEnbCmacSapUser::UeConfig
cmacParams);
241
242
243
// methods forwarded from PDCP SAP
244
void
DoReceivePdcpSdu
(
LtePdcpSapUser::ReceivePdcpSduParameters
params);
245
251
uint16_t
GetRnti
(
void
);
252
257
uint64_t
GetImsi
(
void
);
258
263
uint16_t
GetSrsConfigurationIndex
(
void
);
264
270
void
SetSrsConfigurationIndex
(uint16_t srsConfIndex);
271
276
State
GetState
();
277
278
279
private
:
280
288
uint8_t
AddDataRadioBearerInfo
(
Ptr<LteDataRadioBearerInfo>
radioBearerInfo);
289
295
Ptr<LteDataRadioBearerInfo>
GetDataRadioBearerInfo
(uint8_t drbid);
296
302
void
RemoveDataRadioBearerInfo
(uint8_t drbid);
303
309
LteRrcSap::RrcConnectionReconfiguration
BuildRrcConnectionReconfiguration
();
310
316
LteRrcSap::RadioResourceConfigDedicated
BuildRadioResourceConfigDedicated
();
317
318
323
uint8_t
GetNewRrcTransactionIdentifier
();
324
330
uint8_t
Lcid2Drbid
(uint8_t lcid);
331
337
uint8_t
Drbid2Lcid
(uint8_t drbid);
338
344
uint8_t
Lcid2Bid
(uint8_t lcid);
345
351
uint8_t
Bid2Lcid
(uint8_t bid);
352
358
uint8_t
Drbid2Bid
(uint8_t drbid);
359
365
uint8_t
Bid2Drbid
(uint8_t bid);
366
372
void
SwitchToState
(
State
s);
373
374
375
std::map <uint8_t, Ptr<LteDataRadioBearerInfo> >
m_drbMap
;
376
Ptr<LteSignalingRadioBearerInfo>
m_srb0
;
377
Ptr<LteSignalingRadioBearerInfo>
m_srb1
;
378
uint8_t
m_lastAllocatedDrbid
;
379
uint16_t
m_rnti
;
380
uint64_t
m_imsi
;
381
uint8_t
m_lastRrcTransactionIdentifier
;
382
LteRrcSap::PhysicalConfigDedicated
m_physicalConfigDedicated
;
383
Ptr<LteEnbRrc>
m_rrc
;
384
State
m_state
;
385
LtePdcpSapUser
*
m_drbPdcpSapUser
;
386
bool
m_pendingRrcConnectionReconfiguration
;
387
// imsi cellid rnti old new
388
TracedCallback<uint64_t, uint16_t, uint16_t, State, State>
m_stateTransitionTrace
;
389
uint16_t
m_sourceX2apId
;
390
uint16_t
m_sourceCellId
;
391
uint16_t
m_targetCellId
;
392
std::list<uint8_t>
m_drbsToBeStarted
;
393
bool
m_needTransmissionModeConfiguration
;
394
EventId
m_connectionTimeout
;
395
};
396
397
403
class
LteEnbRrc
:
public
Object
404
{
405
406
friend
class
EnbRrcMemberLteEnbCmacSapUser
;
407
friend
class
MemberLteEnbRrcSapProvider
<
LteEnbRrc
>;
408
friend
class
MemberEpcEnbS1SapUser
<
LteEnbRrc
>;
409
friend
class
EpcX2SpecificEpcX2SapUser
<
LteEnbRrc
>;
410
friend
class
UeManager
;
411
412
public
:
417
LteEnbRrc
();
418
422
virtual
~LteEnbRrc
();
423
424
425
// inherited from Object
426
protected
:
427
virtual
void
DoDispose
(
void
);
428
public
:
429
static
TypeId
GetTypeId
(
void
);
430
431
436
void
SetEpcX2SapProvider
(
EpcX2SapProvider
* s);
437
442
EpcX2SapUser
*
GetEpcX2SapUser
();
443
444
450
void
SetLteEnbCmacSapProvider
(
LteEnbCmacSapProvider
* s);
451
456
LteEnbCmacSapUser
*
GetLteEnbCmacSapUser
();
457
458
464
void
SetLteEnbRrcSapUser
(
LteEnbRrcSapUser
* s);
465
471
LteEnbRrcSapProvider
*
GetLteEnbRrcSapProvider
();
472
480
void
SetLteMacSapProvider
(
LteMacSapProvider
* s);
481
482
488
void
SetS1SapProvider
(
EpcEnbS1SapProvider
* s);
489
494
EpcEnbS1SapUser
*
GetS1SapUser
();
495
496
502
void
SetLteEnbCphySapProvider
(
LteEnbCphySapProvider
* s);
503
509
LteEnbCphySapUser
*
GetLteEnbCphySapUser
();
510
518
Ptr<UeManager>
GetUeManager
(uint16_t rnti);
519
529
void
ConfigureCell
(uint8_t ulBandwidth,
530
uint8_t dlBandwidth,
531
uint16_t ulEarfcn,
532
uint16_t dlEarfcn,
533
uint16_t cellId);
534
540
void
SetCellId
(uint16_t
m_cellId
);
541
551
bool
SendData
(
Ptr<Packet>
p);
552
559
void
SetForwardUpCallback
(
Callback
<
void
,
Ptr<Packet>
> cb);
560
567
void
ConnectionTimeout
(uint16_t rnti);
568
579
void
SendHandoverRequest
(uint16_t rnti, uint16_t cellId);
580
585
enum
LteEpsBearerToRlcMapping_t
{
RLC_SM_ALWAYS
= 1,
586
RLC_UM_ALWAYS
= 2,
587
RLC_AM_ALWAYS
= 3,
588
PER_BASED
= 4};
589
590
private
:
591
592
593
// methods forwarded from RRC SAP
594
595
void
DoCompleteSetupUe
(uint16_t rnti,
LteEnbRrcSapProvider::CompleteSetupUeParameters
params);
596
void
DoRecvRrcConnectionRequest
(uint16_t rnti,
LteRrcSap::RrcConnectionRequest
msg);
597
void
DoRecvRrcConnectionSetupCompleted
(uint16_t rnti,
LteRrcSap::RrcConnectionSetupCompleted
msg);
598
void
DoRecvRrcConnectionReconfigurationCompleted
(uint16_t rnti,
LteRrcSap::RrcConnectionReconfigurationCompleted
msg);
599
void
DoRecvRrcConnectionReestablishmentRequest
(uint16_t rnti,
LteRrcSap::RrcConnectionReestablishmentRequest
msg);
600
void
DoRecvRrcConnectionReestablishmentComplete
(uint16_t rnti,
LteRrcSap::RrcConnectionReestablishmentComplete
msg);
601
void
DoRecvMeasurementReport
(uint16_t rnti,
LteRrcSap::MeasurementReport
msg);
602
603
604
// S1 SAP methods
605
void
DoDataRadioBearerSetupRequest
(
EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters
params);
606
void
DoPathSwitchRequestAcknowledge
(
EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters
params);
607
// X2 SAP methods
608
void
DoRecvHandoverRequest
(
EpcX2SapUser::HandoverRequestParams
params);
609
void
DoRecvHandoverRequestAck
(
EpcX2SapUser::HandoverRequestAckParams
params);
610
void
DoRecvHandoverPreparationFailure
(
EpcX2SapUser::HandoverPreparationFailureParams
params);
611
void
DoRecvSnStatusTransfer
(
EpcX2SapUser::SnStatusTransferParams
params);
612
void
DoRecvUeContextRelease
(
EpcX2SapUser::UeContextReleaseParams
params);
613
void
DoRecvLoadInformation
(
EpcX2SapUser::LoadInformationParams
params);
614
void
DoRecvResourceStatusUpdate
(
EpcX2SapUser::ResourceStatusUpdateParams
params);
615
void
DoRecvUeData
(
EpcX2SapUser::UeDataParams
params);
616
617
618
// CMAC SAP methods
619
uint16_t
DoAllocateTemporaryCellRnti
();
620
void
DoNotifyLcConfigResult
(uint16_t rnti, uint8_t lcid,
bool
success);
621
void
DoRrcConfigurationUpdateInd
(
LteEnbCmacSapUser::UeConfig
params);
622
623
624
// Internal methods
625
635
uint16_t
AddUe
(
UeManager::State
state);
636
642
void
RemoveUe
(uint16_t rnti);
643
644
651
TypeId
GetRlcType
(
EpsBearer
bearer);
652
653
654
public
:
655
660
void
SetSrsPeriodicity
(uint32_t p);
661
666
uint32_t
GetSrsPeriodicity
()
const
;
667
668
private
:
669
678
uint16_t
GetNewSrsConfigurationIndex
(
void
);
679
688
void
RemoveSrsConfigurationIndex
(uint16_t srcCi);
689
690
691
699
uint8_t
GetLogicalChannelGroup
(
EpsBearer
bearer);
700
709
uint8_t
GetLogicalChannelPriority
(
EpsBearer
bearer);
710
711
716
void
SendSystemInformation
();
717
718
Callback <void, Ptr<Packet>
>
m_forwardUpCallback
;
719
720
EpcX2SapUser
*
m_x2SapUser
;
721
EpcX2SapProvider
*
m_x2SapProvider
;
722
723
LteEnbCmacSapUser
*
m_cmacSapUser
;
724
LteEnbCmacSapProvider
*
m_cmacSapProvider
;
725
726
LteEnbRrcSapUser
*
m_rrcSapUser
;
727
LteEnbRrcSapProvider
*
m_rrcSapProvider
;
728
729
LteMacSapProvider
*
m_macSapProvider
;
730
731
EpcEnbS1SapProvider
*
m_s1SapProvider
;
732
EpcEnbS1SapUser
*
m_s1SapUser
;
733
734
LteEnbCphySapUser
*
m_cphySapUser
;
735
LteEnbCphySapProvider
*
m_cphySapProvider
;
736
737
bool
m_configured
;
738
uint16_t
m_cellId
;
739
uint16_t
m_dlEarfcn
;
740
uint16_t
m_ulEarfcn
;
741
uint16_t
m_dlBandwidth
;
742
uint16_t
m_ulBandwidth
;
743
uint16_t
m_lastAllocatedRnti
;
744
745
std::map<uint16_t, Ptr<UeManager> >
m_ueMap
;
746
747
struct
X2uTeidInfo
748
{
749
uint16_t
rnti
;
750
uint8_t
drbid
;
751
};
752
753
// TEID RNTI, DRBID
754
std::map<uint32_t, X2uTeidInfo>
m_x2uTeidInfoMap
;
755
756
uint8_t
m_defaultTransmissionMode
;
757
758
enum
LteEpsBearerToRlcMapping_t
m_epsBearerToRlcMapping
;
759
760
Time
m_systemInformationPeriodicity
;
761
762
// SRS related attributes
763
uint16_t
m_srsCurrentPeriodicityId
;
764
std::set<uint16_t>
m_ueSrsConfigurationIndexSet
;
765
uint16_t
m_lastAllocatedConfigurationIndex
;
766
bool
m_reconfigureUes
;
767
768
bool
m_admitHandoverRequest
;
769
bool
m_admitRrcConnectionRequest
;
770
771
// cellid rnti
772
TracedCallback<uint16_t, uint16_t>
m_newUeContextTrace
;
773
// imsi cellid rnti
774
TracedCallback<uint64_t, uint16_t, uint16_t>
m_connectionEstablishedTrace
;
775
// imsi cellid rnti
776
TracedCallback<uint64_t, uint16_t, uint16_t>
m_connectionReconfigurationTrace
;
777
// imsi cellid rnti targetCellId
778
TracedCallback<uint64_t, uint16_t, uint16_t, uint16_t>
m_handoverStartTrace
;
779
// imsi cellid rnti
780
TracedCallback<uint64_t, uint16_t, uint16_t>
m_handoverEndOkTrace
;
781
782
};
783
784
785
}
// namespace ns3
786
787
#endif // LTE_ENB_RRC_H
src
lte
model
lte-enb-rrc.h
Generated on Tue May 14 2013 11:08:25 for ns-3 by
1.8.1.2