22 #include <ns3/fatal-error.h>
24 #include <ns3/nstime.h>
25 #include <ns3/node-list.h>
27 #include <ns3/simulator.h>
47 : m_ueRrcSapProvider (0),
48 m_enbRrcSapProvider (0)
74 .AddConstructor<LteUeRrcProtocolReal> ()
120 packet->
AddHeader (rrcConnectionRequestHeader);
123 transmitPdcpPduParameters.
pdcpPdu = packet;
125 transmitPdcpPduParameters.
lcid = 0;
136 rrcConnectionSetupCompleteHeader.
SetMessage (msg);
138 packet->
AddHeader (rrcConnectionSetupCompleteHeader);
141 transmitPdcpSduParameters.
pdcpSdu = packet;
143 transmitPdcpSduParameters.
lcid = 1;
162 rrcConnectionReconfigurationCompleteHeader.
SetMessage (msg);
164 packet->
AddHeader (rrcConnectionReconfigurationCompleteHeader);
167 transmitPdcpSduParameters.
pdcpSdu = packet;
169 transmitPdcpSduParameters.
lcid = 1;
187 packet->
AddHeader (measurementReportHeader);
190 transmitPdcpSduParameters.
pdcpSdu = packet;
192 transmitPdcpSduParameters.
lcid = 1;
203 rrcConnectionReestablishmentRequestHeader.
SetMessage (msg);
205 packet->
AddHeader (rrcConnectionReestablishmentRequestHeader);
208 transmitPdcpPduParameters.
pdcpPdu = packet;
210 transmitPdcpPduParameters.
lcid = 0;
221 rrcConnectionReestablishmentCompleteHeader.
SetMessage (msg);
223 packet->
AddHeader (rrcConnectionReestablishmentCompleteHeader);
226 transmitPdcpSduParameters.
pdcpSdu = packet;
228 transmitPdcpSduParameters.
lcid = 1;
237 uint16_t cellId =
m_rrc->GetCellId ();
244 (i != listEnd) && (!found);
250 (j < nDevs) && (!found);
260 if (enbDev->GetCellId () == cellId)
268 NS_ASSERT_MSG (found,
" Unable to find eNB with CellId =" << cellId);
299 rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.
GetMessage ();
304 p->
RemoveHeader (rrcConnectionReestablishmentRejectHeader);
305 rrcConnectionReestablishmentRejectMsg = rrcConnectionReestablishmentRejectHeader.
GetMessage ();
311 rrcConnectionRejectMsg = rrcConnectionRejectHeader.
GetMessage ();
317 rrcConnectionSetupMsg = rrcConnectionSetupHeader.
GetMessage ();
343 rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.
GetMessage ();
348 rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.
GetMessage ();
358 : m_enbRrcSapProvider (0)
374 for (std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
379 delete it->second.srb0SapUser;
380 delete it->second.srb1SapUser;
388 static TypeId tid =
TypeId (
"ns3::LteEnbRrcProtocolReal")
390 .AddConstructor<LteEnbRrcProtocolReal> ()
416 std::map<uint16_t, LteUeRrcSapProvider*>::const_iterator it;
425 std::map<uint16_t, LteUeRrcSapProvider*>::iterator it;
474 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
481 completeSetupUeParameters.
srb0SapUser = srb0SapUser;
482 completeSetupUeParameters.
srb1SapUser = srb1SapUser;
488 completeSetupUeParameters = csupIt->second;
497 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
500 delete it->second.srb0SapUser;
501 delete it->second.srb1SapUser;
517 for (
int j = 0; j < nDevs; ++j)
523 NS_LOG_LOGIC (
"considering UE IMSI " << ueDev->GetImsi () <<
" that has cellId " << ueRrc->GetCellId ());
524 if (ueRrc->GetCellId () ==
m_cellId)
526 NS_LOG_LOGIC (
"sending SI to IMSI " << ueDev->GetImsi ());
527 ueRrc->GetLteUeRrcSapProvider ()->RecvSystemInformation (msg);
530 ueRrc->GetLteUeRrcSapProvider (),
546 packet->
AddHeader (rrcConnectionSetupHeader);
549 transmitPdcpPduParameters.
pdcpPdu = packet;
550 transmitPdcpPduParameters.
rnti = rnti;
551 transmitPdcpPduParameters.
lcid = 0;
555 std::cout <<
"RNTI not found in Enb setup parameters Map!" << std::endl;
571 packet->
AddHeader (rrcConnectionRejectHeader);
574 transmitPdcpPduParameters.
pdcpPdu = packet;
575 transmitPdcpPduParameters.
rnti = rnti;
576 transmitPdcpPduParameters.
lcid = 0;
587 rrcConnectionReconfigurationHeader.
SetMessage (msg);
589 packet->
AddHeader (rrcConnectionReconfigurationHeader);
592 transmitPdcpSduParameters.
pdcpSdu = packet;
593 transmitPdcpSduParameters.
rnti = rnti;
594 transmitPdcpSduParameters.
lcid = 1;
605 rrcConnectionReestablishmentHeader.
SetMessage (msg);
607 packet->
AddHeader (rrcConnectionReestablishmentHeader);
610 transmitPdcpPduParameters.
pdcpPdu = packet;
611 transmitPdcpPduParameters.
rnti = rnti;
612 transmitPdcpPduParameters.
lcid = 0;
623 rrcConnectionReestablishmentRejectHeader.
SetMessage (msg);
625 packet->
AddHeader (rrcConnectionReestablishmentRejectHeader);
628 transmitPdcpPduParameters.
pdcpPdu = packet;
629 transmitPdcpPduParameters.
rnti = rnti;
630 transmitPdcpPduParameters.
lcid = 0;
643 packet->
AddHeader (rrcConnectionReleaseHeader);
646 transmitPdcpSduParameters.
pdcpSdu = packet;
647 transmitPdcpSduParameters.
rnti = rnti;
648 transmitPdcpSduParameters.
lcid = 1;
668 p->
RemoveHeader (rrcConnectionReestablishmentRequestHeader);
670 rrcConnectionReestablishmentRequestMsg = rrcConnectionReestablishmentRequestHeader.
GetMessage ();
676 rrcConnectionRequestMsg = rrcConnectionRequestHeader.
GetMessage ();
706 measurementReportMsg = measurementReportHeader.
GetMessage ();
711 rrcConnectionReconfigurationCompleteMsg = rrcConnectionReconfigurationCompleteHeader.
GetMessage ();
716 rrcConnectionReestablishmentCompleteMsg = rrcConnectionReestablishmentCompleteHeader.
GetMessage ();
721 rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.
GetMessage ();
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Service Access Point (SAP) offered by the UM-RLC and AM-RLC entities to the PDCP entity See 3GPP 36...
virtual void ReceivePdcpPdu(Ptr< Packet > p)
Called by the RLC entity to notify the PDCP entity of the reception of a new PDCP PDU...
void DoSetup(LteUeRrcSapUser::SetupParameters params)
Ptr< Packet > pdcpPdu
the PDCP PDU
LtePdcpSapProvider * srb1SapProvider
keep track of time values and allow control of global simulation resolution
void DoSendMeasurementReport(LteRrcSap::MeasurementReport msg)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
virtual void RecvRrcConnectionSetupCompleted(uint16_t rnti, RrcConnectionSetupCompleted msg)=0
Receive an RRCConnectionSetupComplete message from a UE during an RRC connection establishment proced...
Part of the RRC protocol.
LteUeRrcSapProvider * m_ueRrcSapProvider
void DoSendRrcConnectionReject(uint16_t rnti, LteRrcSap::RrcConnectionReject msg)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
void DoSendRrcConnectionRelease(uint16_t rnti, LteRrcSap::RrcConnectionRelease msg)
friend class RealProtocolRlcSapUser
Part of the RRC protocol.
virtual ~LteEnbRrcProtocolReal()
LteRlcSapUser * srb0SapUser
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
static TypeId GetTypeId(void)
Template for the implementation of the LteEnbRrcSapUser as a member of an owner class of type C to wh...
Ptr< Packet > DoEncodeHandoverCommand(LteRrcSap::RrcConnectionReconfiguration msg)
LteUeRrcSapProvider::CompleteSetupParameters m_completeSetupParameters
LteRrcSap::RrcConnectionReconfiguration DoDecodeHandoverCommand(Ptr< Packet > p)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
Ptr< Packet > DoEncodeHandoverPreparationInformation(LteRrcSap::HandoverPreparationInfo msg)
virtual void TransmitPdcpPdu(TransmitPdcpPduParameters params)=0
Send a PDCP PDU to the RLC for transmission This method is to be called when upper PDCP entity has a ...
LtePdcpSapUser * srb1SapUser
LteUeRrcSapProvider * GetUeRrcSapProvider(uint16_t rnti)
Models the transmission of RRC messages from the UE to the eNB in a real fashion, by creating real RR...
std::map< uint16_t, LteEnbRrcSapUser::SetupUeParameters > m_setupUeParametersMap
LteRrcSap::HandoverPreparationInfo GetMessage() const
Returns a HandoverPreparationInfo IE from the values in the class attributes.
std::map< uint16_t, LteUeRrcSapProvider * > m_enbRrcSapProviderMap
LteUeRrcSapUser * m_ueRrcSapUser
Ptr< Packet > pdcpSdu
the RRC PDU
virtual void RecvRrcConnectionReject(RrcConnectionReject msg)=0
Receive an RRCConnectionReject message from the serving eNodeB during an RRC connection establishment...
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
uint16_t rnti
the C-RNTI identifying the UE
void SetLteEnbRrcSapProvider(LteEnbRrcSapProvider *p)
void DoSendRrcConnectionSetup(uint16_t rnti, LteRrcSap::RrcConnectionSetup msg)
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
virtual ~LteUeRrcProtocolReal()
void SetUeRrcSapProvider(uint16_t rnti, LteUeRrcSapProvider *p)
void DoSendRrcConnectionReestablishmentRequest(LteRrcSap::RrcConnectionReestablishmentRequest msg)
static Iterator End(void)
const Time RRC_REAL_MSG_DELAY
virtual void RecvRrcConnectionReconfiguration(RrcConnectionReconfiguration msg)=0
Receive an RRCConnectionReconfiguration message from the serving eNodeB during an RRC connection reco...
std::map< uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters > m_completeSetupUeParametersMap
virtual void RecvRrcConnectionReestablishment(RrcConnectionReestablishment msg)=0
Receive an RRCConnectionReestablishment message from the serving eNodeB during an RRC connection re-e...
void DoReceivePdcpPdu(Ptr< Packet > p)
uint16_t rnti
the C-RNTI identifying the UE
Ptr< NetDevice > GetDevice(uint32_t index) const
This class only serves to discriminate which message type has been received in downlink (eNb to ue) f...
Parameters for LtePdcpSapProvider::TransmitPdcpSdu.
void SetEnbRrcSapProvider()
LteEnbRrcSapUser * GetLteEnbRrcSapUser()
#define NS_LOG_LOGIC(msg)
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
uint32_t GetNDevices(void) const
uint32_t PeekHeader(Header &header) const
Deserialize but does not remove the header from the internal buffer.
Part of the RRC protocol.
void DoSendRrcConnectionReestablishmentReject(uint16_t rnti, LteRrcSap::RrcConnectionReestablishmentReject msg)
Ptr< Packet > pdcpSdu
the RRC PDU
virtual void RecvRrcConnectionSetup(RrcConnectionSetup msg)=0
Receive an RRCConnectionSetup message from the serving eNodeB during an RRC connection establishment ...
std::vector< Ptr< Node > >::const_iterator Iterator
virtual void CompleteSetup(CompleteSetupParameters params)=0
void DoSendRrcConnectionReconfiguration(uint16_t rnti, LteRrcSap::RrcConnectionReconfiguration msg)
virtual void RecvRrcConnectionRequest(uint16_t rnti, RrcConnectionRequest msg)=0
Receive an RRCConnectionRequest message from a UE during an RRC connection establishment procedure (S...
void DoSendRrcConnectionReestablishment(uint16_t rnti, LteRrcSap::RrcConnectionReestablishment msg)
This class manages the serialization/deserialization of HandoverPreparationInfo IE.
LtePdcpSapUser * srb1SapUser
LteEnbRrcSapProvider * m_enbRrcSapProvider
virtual void RecvSystemInformation(SystemInformation msg)=0
Receive a SystemInformation message from the serving eNodeB during a system information acquisition p...
LteRlcSapUser * srb0SapUser
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
void SetMessage(LteRrcSap::HandoverPreparationInfo msg)
Receives a HandoverPreparationInfo IE and stores the contents into the class attributes.
void DoSendRrcConnectionReestablishmentComplete(LteRrcSap::RrcConnectionReestablishmentComplete msg)
virtual void TransmitPdcpSdu(TransmitPdcpSduParameters params)=0
Send a RRC PDU to the RDCP for transmission This method is to be called when upper RRC entity has a R...
void DoSendRrcConnectionSetupCompleted(LteRrcSap::RrcConnectionSetupCompleted msg)
Parameters for LteRlcSapProvider::TransmitPdcpPdu.
#define NS_ASSERT_MSG(condition, message)
void DoSendRrcConnectionReconfigurationCompleted(LteRrcSap::RrcConnectionReconfigurationCompleted msg)
static TypeId GetTypeId(void)
LteUeRrcSapUser::SetupParameters m_setupParameters
void DoSendRrcConnectionRequest(LteRrcSap::RrcConnectionRequest msg)
virtual void RecvRrcConnectionReestablishmentRequest(uint16_t rnti, RrcConnectionReestablishmentRequest msg)=0
Receive an RRCConnectionReestablishmentRequest message from a UE during an RRC connection re-establis...
static Iterator Begin(void)
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36.323 Packet Data Convergence Protocol (PDCP) specification.
void DoReceivePdcpPdu(uint16_t rnti, Ptr< Packet > p)
LteRlcSapProvider * srb0SapProvider
LteEnbRrcSapUser * m_enbRrcSapUser
virtual void RecvMeasurementReport(uint16_t rnti, MeasurementReport msg)=0
Receive a MeasurementReport message from a UE during a measurement reporting procedure (Section 5...
LteRrcSap::HandoverPreparationInfo DoDecodeHandoverPreparationInformation(Ptr< Packet > p)
LteEnbRrcSapProvider * m_enbRrcSapProvider
void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
void SetCellId(uint16_t cellId)
uint16_t rnti
the C-RNTI identifying the UE
virtual void RecvRrcConnectionReestablishmentComplete(uint16_t rnti, RrcConnectionReestablishmentComplete msg)=0
Receive an RRCConnectionReestablishmentComplete message from a UE during an RRC connection re-establi...
virtual void CompleteSetupUe(uint16_t rnti, CompleteSetupUeParameters params)=0
Template for the implementation of the LteUeRrcSapUser as a member of an owner class of type C to whi...
NS_LOG_COMPONENT_DEFINE("LteRrcProtocolReal")
a base class which provides memory management and object aggregation
LteUeRrcSapUser * GetLteUeRrcSapUser()
Part of the RRC protocol.
LteEnbRrcProtocolReal * m_pdcp
uint8_t lcid
the logical channel id corresponding to the sending RLC instance
void SetLteUeRrcSapProvider(LteUeRrcSapProvider *p)
The eNodeB device implementation.
This class only serves to discriminate which message type has been received in uplink (ue to eNb) for...
virtual void RecvRrcConnectionReconfigurationCompleted(uint16_t rnti, RrcConnectionReconfigurationCompleted msg)=0
Receive an RRCConnectionReconfigurationComplete message from a UE during an RRC connection reconfigur...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void DoSetupUe(uint16_t rnti, LteEnbRrcSapUser::SetupUeParameters params)
void DoRemoveUe(uint16_t rnti)
void SetUeRrc(Ptr< LteUeRrc > rrc)
void AddHeader(const Header &header)
Add header to this packet.
The LteUeNetDevice class implements the UE net device.
void DoSendSystemInformation(LteRrcSap::SystemInformation msg)