From 7ce8782ecd95e94e2a7377b2a4e9fc2cc4d50912 Mon Sep 17 00:00:00 2001 From: Manuel Requena Date: Tue, 20 Nov 2012 22:03:30 +0100 Subject: [PATCH] Add Load Informatin X2 message header --- src/lte/model/epc-x2-header.cc | 225 +++++++++++++++++++++++++++++++++ src/lte/model/epc-x2-header.h | 44 ++++++- 2 files changed, 262 insertions(+), 7 deletions(-) diff --git a/src/lte/model/epc-x2-header.cc b/src/lte/model/epc-x2-header.cc index c3f031f3e..0001442b8 100644 --- a/src/lte/model/epc-x2-header.cc +++ b/src/lte/model/epc-x2-header.cc @@ -154,6 +154,7 @@ EpcX2HandoverRequestHeader::EpcX2HandoverRequestHeader () m_cause (0xfffa), m_targetCellId (0xfffa) { + m_erabsToBeSetupList.clear (); } EpcX2HandoverRequestHeader::~EpcX2HandoverRequestHeader () @@ -745,5 +746,229 @@ EpcX2UeContextReleaseHeader::GetNumberOfIes () const return m_numberOfIes; } +///////////////////////////////// + +NS_OBJECT_ENSURE_REGISTERED (EpcX2LoadInformationHeader); + +EpcX2LoadInformationHeader::EpcX2LoadInformationHeader () + : m_numberOfIes (1), + m_headerLength (6) +{ + m_cellInformationList.clear (); +} + +EpcX2LoadInformationHeader::~EpcX2LoadInformationHeader () +{ + m_numberOfIes = 0; + m_headerLength = 0; + m_cellInformationList.clear (); +} + +TypeId +EpcX2LoadInformationHeader::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::EpcX2LoadInformationHeader") + .SetParent
() + .AddConstructor () + ; + return tid; +} + +TypeId +EpcX2LoadInformationHeader::GetInstanceTypeId (void) const +{ + return GetTypeId (); +} + +uint32_t +EpcX2LoadInformationHeader::GetSerializedSize (void) const +{ + return m_headerLength; +} + +void +EpcX2LoadInformationHeader::Serialize (Buffer::Iterator start) const +{ + Buffer::Iterator i = start; + + i.WriteHtonU16 (6); // id = CELL_INFORMATION + i.WriteU8 (1 << 6); // criticality = IGNORE + i.WriteU8 (4); // length of CELL_INFORMATION_ID + + std::vector ::size_type sz = m_cellInformationList.size (); + i.WriteHtonU16 (sz); // number of cellInformationItems + + for (int j = 0; j < (int) sz; j++) + { + i.WriteHtonU16 (m_cellInformationList [j].sourceCellId); + + std::vector ::size_type sz2; + sz2 = m_cellInformationList [j].ulInterferenceOverloadIndicationList.size (); + i.WriteHtonU16 (sz2); // number of UlInterferenceOverloadIndicationItem + + for (int k = 0; k < (int) sz2; k++) + { + i.WriteU8 (m_cellInformationList [j].ulInterferenceOverloadIndicationList [k]); + } + + std::vector ::size_type sz3; + sz3 = m_cellInformationList [j].ulHighInterferenceInformationList.size (); + i.WriteHtonU16 (sz3); // number of UlHighInterferenceInformationItem + + for (int k = 0; k < (int) sz3; k++) + { + i.WriteHtonU16 (m_cellInformationList [j].ulHighInterferenceInformationList [k].targetCellId); + + std::vector ::size_type sz4; + sz4 = m_cellInformationList [j].ulHighInterferenceInformationList [k].ulHighInterferenceIndicationList.size (); + i.WriteHtonU16 (sz4); + + for (int m = 0; m < (int) sz4; m++) + { + i.WriteU8 (m_cellInformationList [j].ulHighInterferenceInformationList [k].ulHighInterferenceIndicationList [m]); + } + } + + std::vector ::size_type sz5; + sz5 = m_cellInformationList [j].relativeNarrowbandTxBand.rntpPerPrbList.size (); + i.WriteHtonU16 (sz5); + + for (int k = 0; k < (int) sz5; k++) + { + i.WriteU8 (m_cellInformationList [j].relativeNarrowbandTxBand.rntpPerPrbList [k]); + } + + i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.rntpThreshold); + i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.antennaPorts); + i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.pB); + i.WriteHtonU16 (m_cellInformationList [j].relativeNarrowbandTxBand.pdcchInterferenceImpact); + } +} + +uint32_t +EpcX2LoadInformationHeader::Deserialize (Buffer::Iterator start) +{ + Buffer::Iterator i = start; + + m_headerLength = 0; + m_numberOfIes = 0; + + i.ReadNtohU16 (); + i.ReadU8 (); + i.ReadU8 (); + int sz = i.ReadNtohU16 (); + m_headerLength += 6; + m_numberOfIes++; + + for (int j = 0; j < sz; j++) + { + EpcX2Sap::CellInformationItem cellInfoItem; + cellInfoItem.sourceCellId = i.ReadNtohU16 (); + m_headerLength += 2; + + int sz2 = i.ReadNtohU16 (); + m_headerLength += 2; + for (int k = 0; k < sz2; k++) + { + EpcX2Sap::UlInterferenceOverloadIndicationItem item = (EpcX2Sap::UlInterferenceOverloadIndicationItem) i.ReadU8 (); + cellInfoItem.ulInterferenceOverloadIndicationList.push_back (item); + } + m_headerLength += sz2; + + int sz3 = i.ReadNtohU16 (); + m_headerLength += 2; + for (int k = 0; k < sz3; k++) + { + EpcX2Sap::UlHighInterferenceInformationItem item; + item.targetCellId = i.ReadNtohU16 (); + m_headerLength += 2; + + int sz4 = i.ReadNtohU16 (); + m_headerLength += 2; + for (int m = 0; m < sz4; m++) + { + item.ulHighInterferenceIndicationList.push_back (i.ReadU8 ()); + } + m_headerLength += sz4; + + cellInfoItem.ulHighInterferenceInformationList.push_back (item); + } + + int sz5 = i.ReadNtohU16 (); + m_headerLength += 2; + for (int k = 0; k < sz5; k++) + { + cellInfoItem.relativeNarrowbandTxBand.rntpPerPrbList.push_back (i.ReadU8 ()); + } + m_headerLength += sz5; + + cellInfoItem.relativeNarrowbandTxBand.rntpThreshold = i.ReadNtohU16 (); + cellInfoItem.relativeNarrowbandTxBand.antennaPorts = i.ReadNtohU16 (); + cellInfoItem.relativeNarrowbandTxBand.pB = i.ReadNtohU16 (); + cellInfoItem.relativeNarrowbandTxBand.pdcchInterferenceImpact = i.ReadNtohU16 (); + m_headerLength += 8; + + m_cellInformationList.push_back (cellInfoItem); + } + + return GetSerializedSize (); +} + +void +EpcX2LoadInformationHeader::Print (std::ostream &os) const +{ + os << "NumOfCellInformationItems=" << m_cellInformationList.size (); +} + +std::vector +EpcX2LoadInformationHeader::GetCellInformationList () const +{ + return m_cellInformationList; +} + +void +EpcX2LoadInformationHeader::SetCellInformationList (std::vector cellInformationList) +{ + m_cellInformationList = cellInformationList; + m_headerLength += 2; + + std::vector ::size_type sz = m_cellInformationList.size (); + for (int j = 0; j < (int) sz; j++) + { + m_headerLength += 2; + + std::vector ::size_type sz2; + sz2 = m_cellInformationList [j].ulInterferenceOverloadIndicationList.size (); + m_headerLength += 2 + sz2; + + std::vector ::size_type sz3; + sz3 = m_cellInformationList [j].ulHighInterferenceInformationList.size (); + m_headerLength += 2; + + for (int k = 0; k < (int) sz3; k++) + { + std::vector ::size_type sz4; + sz4 = m_cellInformationList [j].ulHighInterferenceInformationList [k].ulHighInterferenceIndicationList.size (); + m_headerLength += 2 + 2 + sz4; + } + + std::vector ::size_type sz5; + sz5 = m_cellInformationList [j].relativeNarrowbandTxBand.rntpPerPrbList.size (); + m_headerLength += 2 + sz5 + 8; + } +} + +uint32_t +EpcX2LoadInformationHeader::GetLengthOfIes () const +{ + return m_headerLength; +} + +uint32_t +EpcX2LoadInformationHeader::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 0ffef2c5f..20f0f63ed 100644 --- a/src/lte/model/epc-x2-header.h +++ b/src/lte/model/epc-x2-header.h @@ -56,6 +56,7 @@ public: enum ProcedureCode_t { HandoverPreparation = 0, + LoadInformation = 2, UeContextRelease = 5 }; @@ -81,7 +82,7 @@ class EpcX2HandoverRequestHeader : public Header public: EpcX2HandoverRequestHeader (); virtual ~EpcX2HandoverRequestHeader (); - + static TypeId GetTypeId (void); virtual TypeId GetInstanceTypeId (void) const; virtual uint32_t GetSerializedSize (void) const; @@ -92,7 +93,7 @@ public: uint16_t GetOldEnbUeX2apId () const; void SetOldEnbUeX2apId (uint16_t x2apId); - + uint16_t GetCause () const; void SetCause (uint16_t cause); @@ -136,8 +137,8 @@ public: virtual void Serialize (Buffer::Iterator start) const; virtual uint32_t Deserialize (Buffer::Iterator start); virtual void Print (std::ostream &os) const; - - + + uint16_t GetOldEnbUeX2apId () const; void SetOldEnbUeX2apId (uint16_t x2apId); @@ -169,15 +170,15 @@ class EpcX2UeContextReleaseHeader : public Header public: EpcX2UeContextReleaseHeader (); virtual ~EpcX2UeContextReleaseHeader (); - + 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; - - + + uint16_t GetOldEnbUeX2apId () const; void SetOldEnbUeX2apId (uint16_t x2apId); @@ -195,6 +196,35 @@ private: uint16_t m_newEnbUeX2apId; }; + +class EpcX2LoadInformationHeader : public Header +{ +public: + EpcX2LoadInformationHeader (); + virtual ~EpcX2LoadInformationHeader (); + + 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; + + + std::vector GetCellInformationList () const; + void SetCellInformationList (std::vector cellInformationList); + + uint32_t GetLengthOfIes () const; + uint32_t GetNumberOfIes () const; + +private: + uint32_t m_numberOfIes; + uint32_t m_headerLength; + + std::vector m_cellInformationList; +}; + + } // namespace ns3 #endif // EPC_X2_HEADER_H