From 84b4e827574b967b672e709f99df2766a8e95a49 Mon Sep 17 00:00:00 2001 From: ZorazeAli Date: Mon, 25 Mar 2019 14:18:07 +0100 Subject: [PATCH] lte: Add EpcX2HandoverCancelHeader --- src/lte/model/epc-x2-header.cc | 126 +++++++++++++++++++++++++++++++++ src/lte/model/epc-x2-header.h | 76 +++++++++++++++++++- 2 files changed, 201 insertions(+), 1 deletion(-) diff --git a/src/lte/model/epc-x2-header.cc b/src/lte/model/epc-x2-header.cc index 5959d6376..eb8fd0c61 100644 --- a/src/lte/model/epc-x2-header.cc +++ b/src/lte/model/epc-x2-header.cc @@ -1489,4 +1489,130 @@ EpcX2ResourceStatusUpdateHeader::GetNumberOfIes () const return m_numberOfIes; } +/////////////////////////////////////////////////////////////////////////////// + +NS_OBJECT_ENSURE_REGISTERED (EpcX2HandoverCancelHeader); + +EpcX2HandoverCancelHeader::EpcX2HandoverCancelHeader () + : m_numberOfIes (3), + m_headerLength (6), + m_oldEnbUeX2apId (0xfffa), + m_newEnbUeX2apId (0xfffa), + m_cause (0xfffa) +{ +} + +EpcX2HandoverCancelHeader::~EpcX2HandoverCancelHeader () +{ + m_numberOfIes = 0; + m_headerLength = 0; + m_oldEnbUeX2apId = 0xfffb; + m_newEnbUeX2apId = 0xfffb; + m_cause = 0xfffb; +} + +TypeId +EpcX2HandoverCancelHeader::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::EpcX2HandoverCancelHeader") + .SetParent
() + .SetGroupName("Lte") + .AddConstructor () + ; + return tid; +} + +TypeId +EpcX2HandoverCancelHeader::GetInstanceTypeId (void) const +{ + return GetTypeId (); +} + +uint32_t +EpcX2HandoverCancelHeader::GetSerializedSize (void) const +{ + return m_headerLength; +} + +void +EpcX2HandoverCancelHeader::Serialize (Buffer::Iterator start) const +{ + Buffer::Iterator i = start; + + i.WriteHtonU16 (m_oldEnbUeX2apId); + i.WriteHtonU16 (m_newEnbUeX2apId); + i.WriteHtonU16 (m_cause); +} + +uint32_t +EpcX2HandoverCancelHeader::Deserialize (Buffer::Iterator start) +{ + Buffer::Iterator i = start; + + m_oldEnbUeX2apId = i.ReadNtohU16 (); + m_newEnbUeX2apId = i.ReadNtohU16 (); + m_cause = i.ReadNtohU16 (); + m_numberOfIes = 3; + m_headerLength = 6; + + return GetSerializedSize (); +} + +void +EpcX2HandoverCancelHeader::Print (std::ostream &os) const +{ + os << "OldEnbUeX2apId=" << m_oldEnbUeX2apId; + os << " NewEnbUeX2apId=" << m_newEnbUeX2apId; + os << " Cause = " << m_cause; +} + +uint16_t +EpcX2HandoverCancelHeader::GetOldEnbUeX2apId () const +{ + return m_oldEnbUeX2apId; +} + +void +EpcX2HandoverCancelHeader::SetOldEnbUeX2apId (uint16_t x2apId) +{ + m_oldEnbUeX2apId = x2apId; +} + +uint16_t +EpcX2HandoverCancelHeader::GetNewEnbUeX2apId () const +{ + return m_newEnbUeX2apId; +} + +void +EpcX2HandoverCancelHeader::SetNewEnbUeX2apId (uint16_t x2apId) +{ + m_newEnbUeX2apId = x2apId; +} + +uint16_t +EpcX2HandoverCancelHeader::GetCause () const +{ + return m_cause; +} + +void +EpcX2HandoverCancelHeader::SetCause (uint16_t cause) +{ + m_cause = cause; +} + +uint32_t +EpcX2HandoverCancelHeader::GetLengthOfIes () const +{ + return m_headerLength; +} + +uint32_t +EpcX2HandoverCancelHeader::GetNumberOfIes () const +{ + return m_numberOfIes; +} + + } // namespace ns3 diff --git a/src/lte/model/epc-x2-header.h b/src/lte/model/epc-x2-header.h index 63292813a..50da51a9f 100644 --- a/src/lte/model/epc-x2-header.h +++ b/src/lte/model/epc-x2-header.h @@ -82,9 +82,10 @@ public: void SetNumberOfIes (uint32_t numberOfIes); - /// Procedure code enumeration + /// Procedure code enumeration 9.3.7 enum ProcedureCode_t { HandoverPreparation = 0, + HandoverCancel = 1, LoadIndication = 2, SnStatusTransfer = 4, UeContextRelease = 5, @@ -653,6 +654,79 @@ private: std::vector m_cellMeasurementResultList; ///< cell measurement result list }; +/** + * EpcX2HandoverCancelHeader + */ +class EpcX2HandoverCancelHeader : public Header +{ +public: + EpcX2HandoverCancelHeader (); + virtual ~EpcX2HandoverCancelHeader (); + + /** + * \brief Get the type ID. + * \return the object TypeId + */ + static TypeId GetTypeId (void); + virtual TypeId GetInstanceTypeId (void) const; + virtual uint32_t GetSerializedSize (void) const; + virtual void Serialize (Buffer::Iterator start) const; + virtual uint32_t Deserialize (Buffer::Iterator start); + virtual void Print (std::ostream &os) const; + + /** + * \brief Get old ENB UE X2 AP ID function + * \returns the old ENB UE X2 AP ID + */ + uint16_t GetOldEnbUeX2apId () const; + /** + * \brief Set old ENB UE X2 AP ID function + * \param x2apId the old ENB UE X2 AP ID + */ + void SetOldEnbUeX2apId (uint16_t x2apId); + + /** + * \brief Get new ENB UE X2 AP ID function + * \returns the new ENB UE X2 AP ID + */ + uint16_t GetNewEnbUeX2apId () const; + /** + * \brief Set new ENB UE X2 AP ID function + * \param x2apId the new ENB UE X2 AP ID + */ + void SetNewEnbUeX2apId (uint16_t x2apId); + + /** + * \brief Get cause function + * \returns the cause + */ + uint16_t GetCause () const; + /** + * \brief Set cause function + * \param cause + */ + void SetCause (uint16_t cause); + + /** + * \brief Get length of IEs function + * \returns the length of IEs + */ + uint32_t GetLengthOfIes () const; + /** + * \brief Get number of IEs function + * \returns the number of IEs + */ + uint32_t GetNumberOfIes () const; + +private: + uint32_t m_numberOfIes; ///< number of IEs + uint32_t m_headerLength; ///< header length + + uint16_t m_oldEnbUeX2apId; ///< old ENB UE X2 AP ID + uint16_t m_newEnbUeX2apId; ///< new ENB UE X2 AP ID + uint16_t m_cause; ///< cause +}; + } // namespace ns3