22 #include <ns3/fatal-error.h>
24 #include <ns3/nstime.h>
25 #include <ns3/node-list.h>
27 #include <ns3/simulator.h>
44 : m_ueRrcSapProvider (0),
45 m_enbRrcSapProvider (0)
71 .AddConstructor<LteUeRrcProtocolReal> ()
117 packet->
AddHeader (rrcConnectionRequestHeader);
120 transmitPdcpPduParameters.
pdcpPdu = packet;
122 transmitPdcpPduParameters.
lcid = 0;
133 rrcConnectionSetupCompleteHeader.
SetMessage (msg);
135 packet->
AddHeader (rrcConnectionSetupCompleteHeader);
138 transmitPdcpSduParameters.
pdcpSdu = packet;
140 transmitPdcpSduParameters.
lcid = 1;
159 rrcConnectionReconfigurationCompleteHeader.
SetMessage (msg);
161 packet->
AddHeader (rrcConnectionReconfigurationCompleteHeader);
164 transmitPdcpSduParameters.
pdcpSdu = packet;
166 transmitPdcpSduParameters.
lcid = 1;
184 packet->
AddHeader (measurementReportHeader);
187 transmitPdcpSduParameters.
pdcpSdu = packet;
189 transmitPdcpSduParameters.
lcid = 1;
200 rrcConnectionReestablishmentRequestHeader.
SetMessage (msg);
202 packet->
AddHeader (rrcConnectionReestablishmentRequestHeader);
205 transmitPdcpPduParameters.
pdcpPdu = packet;
207 transmitPdcpPduParameters.
lcid = 0;
218 rrcConnectionReestablishmentCompleteHeader.
SetMessage (msg);
220 packet->
AddHeader (rrcConnectionReestablishmentCompleteHeader);
223 transmitPdcpSduParameters.
pdcpSdu = packet;
225 transmitPdcpSduParameters.
lcid = 1;
234 uint16_t cellId =
m_rrc->GetCellId ();
241 (i != listEnd) && (!found);
247 (j < nDevs) && (!found);
265 NS_ASSERT_MSG (found,
" Unable to find eNB with CellId =" << cellId);
296 rrcConnectionReestablishmentMsg = rrcConnectionReestablishmentHeader.
GetMessage ();
301 p->
RemoveHeader (rrcConnectionReestablishmentRejectHeader);
302 rrcConnectionReestablishmentRejectMsg = rrcConnectionReestablishmentRejectHeader.
GetMessage ();
308 rrcConnectionRejectMsg = rrcConnectionRejectHeader.
GetMessage ();
314 rrcConnectionSetupMsg = rrcConnectionSetupHeader.
GetMessage ();
340 rrcConnectionReconfigurationMsg = rrcConnectionReconfigurationHeader.
GetMessage ();
345 rrcConnectionReleaseMsg = rrcConnectionReleaseHeader.
GetMessage ();
354 : m_enbRrcSapProvider (0)
370 for (std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
375 delete it->second.srb0SapUser;
376 delete it->second.srb1SapUser;
384 static TypeId tid =
TypeId (
"ns3::LteEnbRrcProtocolReal")
386 .AddConstructor<LteEnbRrcProtocolReal> ()
412 std::map<uint16_t, LteUeRrcSapProvider*>::const_iterator it;
421 std::map<uint16_t, LteUeRrcSapProvider*>::iterator it;
470 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
477 completeSetupUeParameters.
srb0SapUser = srb0SapUser;
478 completeSetupUeParameters.
srb1SapUser = srb1SapUser;
484 completeSetupUeParameters = csupIt->second;
493 std::map<uint16_t, LteEnbRrcSapProvider::CompleteSetupUeParameters>::iterator
496 delete it->second.srb0SapUser;
497 delete it->second.srb1SapUser;
513 for (
int j = 0; j < nDevs; ++j)
519 NS_LOG_LOGIC (
"considering UE IMSI " << ueDev->GetImsi () <<
" that has cellId " << ueRrc->GetCellId ());
520 if (ueRrc->GetCellId () ==
m_cellId)
522 NS_LOG_LOGIC (
"sending SI to IMSI " << ueDev->GetImsi ());
523 ueRrc->GetLteUeRrcSapProvider ()->RecvSystemInformation (msg);
526 ueRrc->GetLteUeRrcSapProvider (),
542 packet->
AddHeader (rrcConnectionSetupHeader);
545 transmitPdcpPduParameters.
pdcpPdu = packet;
546 transmitPdcpPduParameters.
rnti = rnti;
547 transmitPdcpPduParameters.
lcid = 0;
551 std::cout <<
"RNTI not found in Enb setup parameters Map!" << std::endl;
567 packet->
AddHeader (rrcConnectionRejectHeader);
570 transmitPdcpPduParameters.
pdcpPdu = packet;
571 transmitPdcpPduParameters.
rnti = rnti;
572 transmitPdcpPduParameters.
lcid = 0;
583 rrcConnectionReconfigurationHeader.
SetMessage (msg);
585 packet->
AddHeader (rrcConnectionReconfigurationHeader);
588 transmitPdcpSduParameters.
pdcpSdu = packet;
589 transmitPdcpSduParameters.
rnti = rnti;
590 transmitPdcpSduParameters.
lcid = 1;
601 rrcConnectionReestablishmentHeader.
SetMessage (msg);
603 packet->
AddHeader (rrcConnectionReestablishmentHeader);
606 transmitPdcpPduParameters.
pdcpPdu = packet;
607 transmitPdcpPduParameters.
rnti = rnti;
608 transmitPdcpPduParameters.
lcid = 0;
619 rrcConnectionReestablishmentRejectHeader.
SetMessage (msg);
621 packet->
AddHeader (rrcConnectionReestablishmentRejectHeader);
624 transmitPdcpPduParameters.
pdcpPdu = packet;
625 transmitPdcpPduParameters.
rnti = rnti;
626 transmitPdcpPduParameters.
lcid = 0;
639 packet->
AddHeader (rrcConnectionReleaseHeader);
642 transmitPdcpSduParameters.
pdcpSdu = packet;
643 transmitPdcpSduParameters.
rnti = rnti;
644 transmitPdcpSduParameters.
lcid = 1;
664 p->
RemoveHeader (rrcConnectionReestablishmentRequestHeader);
666 rrcConnectionReestablishmentRequestMsg = rrcConnectionReestablishmentRequestHeader.
GetMessage ();
672 rrcConnectionRequestMsg = rrcConnectionRequestHeader.
GetMessage ();
702 measurementReportMsg = measurementReportHeader.
GetMessage ();
707 rrcConnectionReconfigurationCompleteMsg = rrcConnectionReconfigurationCompleteHeader.
GetMessage ();
712 rrcConnectionReestablishmentCompleteMsg = rrcConnectionReestablishmentCompleteHeader.
GetMessage ();
717 rrcConnectionSetupCompletedMsg = rrcConnectionSetupCompleteHeader.
GetMessage ();
virtual void DoDispose(void)
Destructor implementation.
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
Simulation virtual time values and global simulation resolution.
void DoSendMeasurementReport(LteRrcSap::MeasurementReport msg)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
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)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint16_t GetCellId() const
virtual void DoDispose(void)
Destructor implementation.
void DoSendRrcConnectionRelease(uint16_t rnti, LteRrcSap::RrcConnectionRelease msg)
friend class RealProtocolRlcSapUser
Part of the RRC protocol.
virtual ~LteEnbRrcProtocolReal()
LteRlcSapUser * srb0SapUser
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
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
Retrieve the index-th NetDevice associated to this node.
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)
Use NS_LOG to output a message of level LOG_LOGIC.
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< LteEnbRrc > GetRrc() const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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
Node container 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)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
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...
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)