22 #include "ns3/inet-socket-address.h"
23 #include "ns3/packet.h"
25 #include "ns3/epc-gtpu-header.h"
27 #include "ns3/epc-x2-header.h"
28 #include "ns3/epc-x2.h"
86 : m_x2cUdpPort (4444),
135 NS_LOG_FUNCTION (
this << localCellId << localX2Address << remoteCellId << remoteX2Address);
156 "Mapping for remoteCellId = " << remoteCellId <<
" is already known");
157 m_x2InterfaceSockets [remoteCellId] = Create<X2IfaceInfo> (remoteX2Address, localX2cSocket, localX2uSocket);
160 "Mapping for control plane localSocket = " << localX2cSocket <<
" is already known");
163 NS_ASSERT_MSG (m_x2InterfaceCellIds.find (localX2uSocket) == m_x2InterfaceCellIds.end (),
164 "Mapping for data plane localSocket = " << localX2uSocket <<
" is already known");
165 m_x2InterfaceCellIds [localX2uSocket] = Create<X2CellInfo> (localCellId, remoteCellId);
179 "Missing infos of local and remote CellId");
199 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
216 NS_LOG_LOGIC (
"cellsInfo->m_localCellId = " << cellsInfo->m_localCellId);
218 "TargetCellId mismatches with localCellId");
229 NS_LOG_INFO (
"X2 HandoverRequestAck header: " << x2HoReqAckHeader);
249 NS_LOG_LOGIC (
"Recv X2 message: HANDOVER PREPARATION FAILURE");
254 NS_LOG_INFO (
"X2 HandoverPreparationFailure header: " << x2HoPrepFailHeader);
281 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
300 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
327 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
343 NS_LOG_LOGIC (
"Recv X2 message: RESOURCE STATUS UPDATE");
348 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResStatUpdHeader);
374 NS_LOG_LOGIC (
"Recv UE DATA through X2-U interface from Socket");
379 "Missing infos of local and remote CellId");
411 "Missing infos for targetCellId = " << params.
targetCellId);
413 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
414 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
438 NS_LOG_INFO (
"X2 HandoverRequest header: " << x2HoReqHeader);
462 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
470 NS_LOG_INFO (
"Send X2 message: HANDOVER REQUEST ACK");
486 NS_LOG_INFO (
"X2 HandoverAck header: " << x2HoAckHeader);
512 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
520 NS_LOG_INFO (
"Send X2 message: HANDOVER PREPARATION FAILURE");
535 NS_LOG_INFO (
"X2 HandoverPrepFail header: " << x2HoPrepFailHeader);
560 "Socket infos not defined for targetCellId = " << params.
targetCellId);
568 NS_LOG_INFO (
"Send X2 message: SN STATUS TRANSFER");
583 NS_LOG_INFO (
"X2 SnStatusTransfer header: " << x2SnStatusXferHeader);
587 packet->
AddHeader (x2SnStatusXferHeader);
606 "Socket infos not defined for sourceCellId = " << params.
sourceCellId);
614 NS_LOG_INFO (
"Send X2 message: UE CONTEXT RELEASE");
628 NS_LOG_INFO (
"X2 UeContextRelease header: " << x2UeCtxReleaseHeader);
632 packet->
AddHeader (x2UeCtxReleaseHeader);
650 "Missing infos for targetCellId = " << params.
targetCellId);
652 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
653 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
671 NS_LOG_INFO (
"X2 LoadInformation header: " << x2LoadInfoHeader);
696 "Missing infos for targetCellId = " << params.
targetCellId);
698 Ptr<Socket> sourceSocket = socketInfo->m_localCtrlPlaneSocket;
699 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
704 NS_LOG_INFO (
"Send X2 message: RESOURCE STATUS UPDATE");
719 NS_LOG_INFO (
"X2 ResourceStatusUpdate header: " << x2ResourceStatUpdHeader);
723 packet->
AddHeader (x2ResourceStatUpdHeader);
743 "Missing infos for targetCellId = " << params.
targetCellId);
745 Ptr<Socket> sourceSocket = socketInfo->m_localUserPlaneSocket;
746 Ipv4Address targetIpAddr = socketInfo->m_remoteIpAddr;
759 NS_LOG_INFO (
"Forward UE DATA through X2 interface");
uint32_t RemoveHeader(Header &header)
virtual void DoSendHandoverRequest(EpcX2SapProvider::HandoverRequestParams params)
virtual ~X2IfaceInfo(void)
#define NS_LOG_FUNCTION(parameters)
uint16_t GetOldEnbUeX2apId() const
uint32_t GetLengthOfIes() const
Ptr< Socket > m_localUserPlaneSocket
X2CellInfo & operator=(const X2CellInfo &)
std::vector< EpcX2Sap::ErabNotAdmittedItem > GetNotAdmittedBearers() const
std::vector< CellMeasurementResultItem > cellMeasurementResultList
virtual void RecvUeContextRelease(UeContextReleaseParams params)=0
Parameters of the HANDOVER REQUEST message.
uint32_t GetLengthOfIes() const
void SetCause(uint16_t cause)
static TypeId GetTypeId(void)
virtual void RecvSnStatusTransfer(SnStatusTransferParams params)=0
#define NS_ASSERT(condition)
virtual void RecvHandoverRequest(HandoverRequestParams params)=0
#define NS_LOG_COMPONENT_DEFINE(name)
virtual void DoSendLoadInformation(EpcX2SapProvider::LoadInformationParams params)
uint32_t GetSize(void) const
void RecvFromX2uSocket(Ptr< Socket > socket)
virtual ~X2CellInfo(void)
virtual void DoSendUeData(EpcX2SapProvider::UeDataParams params)
virtual void DoSendUeContextRelease(EpcX2SapProvider::UeContextReleaseParams params)
uint16_t GetNewEnbUeX2apId() const
uint64_t ueAggregateMaxBitRateUplink
uint32_t GetMmeUeS1apId() const
virtual void DoSendSnStatusTransfer(EpcX2SapProvider::SnStatusTransferParams params)
uint16_t GetCriticalityDiagnostics() const
uint64_t GetUeAggregateMaxBitRateUplink() const
uint16_t GetTargetCellId() const
std::vector< EpcX2Sap::ErabToBeSetupItem > GetBearers() const
uint16_t GetOldEnbUeX2apId() const
virtual void DoSendResourceStatusUpdate(EpcX2SapProvider::ResourceStatusUpdateParams params)
void SetTargetCellId(uint16_t targetCellId)
X2IfaceInfo & operator=(const X2IfaceInfo &)
uint64_t ueAggregateMaxBitRateDownlink
void RecvFromX2cSocket(Ptr< Socket > socket)
void SetUeAggregateMaxBitRateUplink(uint64_t bitRate)
Parameters of the HANDOVER PREPARATION FAILURE message.
Ptr< Socket > m_localCtrlPlaneSocket
uint16_t enb2MeasurementId
uint32_t GetNumberOfIes() const
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
std::vector< ErabAdmittedItem > admittedBearers
Parameters of the SN STATUS TRANSFER message.
void SetOldEnbUeX2apId(uint16_t x2apId)
virtual void DoSendHandoverRequestAck(EpcX2SapProvider::HandoverRequestAckParams params)
uint32_t GetNumberOfIes() const
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
std::map< uint16_t, Ptr< X2IfaceInfo > > m_x2InterfaceSockets
uint32_t GetNumberOfIes() const
X2IfaceInfo(Ipv4Address remoteIpAddr, Ptr< Socket > localCtrlPlaneSocket, Ptr< Socket > localUserPlaneSocket)
#define NS_LOG_LOGIC(msg)
void SetUeAggregateMaxBitRateDownlink(uint64_t bitRate)
virtual void RecvHandoverPreparationFailure(HandoverPreparationFailureParams params)=0
X2CellInfo(uint16_t localCellId, uint16_t remoteCellId)
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
Parameters of the RESOURCE STATUS UPDATE message.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
Parameters of the UE CONTEXT RELEASE message.
void SetNotAdmittedBearers(std::vector< EpcX2Sap::ErabNotAdmittedItem > bearers)
Parameters of the HANDOVER REQUEST ACKNOWLEDGE message.
virtual void RecvUeData(UeDataParams params)=0
std::vector< ErabToBeSetupItem > bearers
EpcX2SapUser * m_x2SapUser
#define NS_ASSERT_MSG(condition, message)
virtual void DoSendHandoverPreparationFailure(EpcX2SapProvider::HandoverPreparationFailureParams params)
uint16_t GetCause() const
Ipv4 addresses are stored in host order in this class.
EpcX2SapProvider * GetEpcX2SapProvider()
uint16_t enb1MeasurementId
uint32_t GetLengthOfIes() const
void SetEpcX2SapUser(EpcX2SapUser *s)
std::vector< ErabNotAdmittedItem > notAdmittedBearers
void SetNewEnbUeX2apId(uint16_t x2apId)
uint16_t GetOldEnbUeX2apId() const
uint16_t criticalityDiagnostics
void SetAdmittedBearers(std::vector< EpcX2Sap::ErabAdmittedItem > bearers)
uint16_t GetCause() const
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
void SetBearers(std::vector< EpcX2Sap::ErabToBeSetupItem > bearers)
std::vector< EpcX2Sap::ErabAdmittedItem > GetAdmittedBearers() const
uint64_t GetUeAggregateMaxBitRateDownlink() const
EpcX2SapProvider * m_x2SapProvider
void SetOldEnbUeX2apId(uint16_t x2apId)
std::map< Ptr< Socket >, Ptr< X2CellInfo > > m_x2InterfaceCellIds
a base class which provides memory management and object aggregation
virtual void RecvLoadInformation(LoadInformationParams params)=0
void AddX2Interface(uint16_t enb1CellId, Ipv4Address enb1X2Address, uint16_t enb2CellId, Ipv4Address enb2X2Address)
void SetOldEnbUeX2apId(uint16_t x2apId)
void SetCause(uint16_t cause)
virtual void DoDispose(void)
virtual void RecvHandoverRequestAck(HandoverRequestAckParams params)=0
Parameters of the UE DATA primitive.
Ipv4Address m_remoteIpAddr
std::vector< ErabsSubjectToStatusTransferItem > erabsSubjectToStatusTransferList
a unique identifier for an interface.
void SetCriticalityDiagnostics(uint16_t criticalityDiagnostics)
TypeId SetParent(TypeId tid)
void AddHeader(const Header &header)
virtual void RecvResourceStatusUpdate(ResourceStatusUpdateParams params)=0
static TypeId LookupByName(std::string name)
void SetMmeUeS1apId(uint32_t mmeUeS1apId)