diff --git a/CHANGES.md b/CHANGES.md index 4edc15746..56c8a6fe6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -49,7 +49,7 @@ Changes from ns-3.38 to ns-3-dev * (sixlowpan) The spelling of the function `SixLowPanNetDevice::Fragments::GetFraments` from `sixlowpan-net-device.cc` was corrected to `SixLowPanNetDevice::Fragments::GetFragments`; this will affect existing users who were using the function with the misspelling. * (lr-wpan) Updated `LrWpanPhy::PlmeSetAttribute` and `LrWpanPhy::PlmeGetAttribute` (Request and Confirm) to use smart pointers. * (lr-wpan) Modified `LrWpanPhy::PlmeGetAttributeRequest` to include support for a few attributes (none were supported before the change). -* (lr-wpan) Added `macShortAddress` and `macExtendendAddress` to the attributes that can be use with MLME-GET and MLME-SET functions. +* (lr-wpan) Added `macShortAddress`, `macExtendendAddress` and `macPanId` to the attributes that can be use with MLME-GET and MLME-SET functions. ### Changes to build system diff --git a/src/lr-wpan/model/lr-wpan-mac.cc b/src/lr-wpan/model/lr-wpan-mac.cc index 2ad126fe4..56b1558ff 100644 --- a/src/lr-wpan/model/lr-wpan-mac.cc +++ b/src/lr-wpan/model/lr-wpan-mac.cc @@ -900,6 +900,8 @@ void LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr attribute) { MlmeSetConfirmParams confirmParams; + confirmParams.m_status = MLMESET_SUCCESS; + switch (id) { case macBeaconPayload: @@ -909,7 +911,6 @@ LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, PtrmacBeaconPayload; m_macBeaconPayloadLength = attribute->macBeaconPayload->GetSize(); } @@ -918,10 +919,14 @@ LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, PtrmacShortAddress; + break; case macExtendedAddress: confirmParams.m_status = MLMESET_READ_ONLY; + break; + case macPanId: + m_macPanId = macPanId; + break; default: // TODO: Add support for setting other attributes confirmParams.m_status = MLMESET_UNSUPPORTED_ATTRIBUTE; @@ -955,6 +960,9 @@ LrWpanMac::MlmeGetRequest(LrWpanMacPibAttributeIdentifier id) case macExtendedAddress: attributes->macExtendedAddress = m_selfExt; break; + case macPanId: + attributes->macPanId = m_macPanId; + break; default: status = MLMEGET_UNSUPPORTED_ATTRIBUTE; break; diff --git a/src/lr-wpan/model/lr-wpan-mac.h b/src/lr-wpan/model/lr-wpan-mac.h index 42f0c8488..9becb4380 100644 --- a/src/lr-wpan/model/lr-wpan-mac.h +++ b/src/lr-wpan/model/lr-wpan-mac.h @@ -346,6 +346,7 @@ enum LrWpanMacPibAttributeIdentifier macBeaconPayloadLength = 1, macShortAddress = 2, macExtendedAddress = 3, + macPanId = 4, unsupported = 255 // TODO: complete other MAC pib attributes }; @@ -361,6 +362,7 @@ struct LrWpanMacPibAttributes : public SimpleRefCount uint8_t macBeaconPayloadLength{0}; //!< The length in octets of the beacon payload. Mac16Address macShortAddress; //!< The 16 bit mac short address Mac64Address macExtendedAddress; //!< The EUI-64 bit address + uint16_t macPanId; //!< The identifier of the PAN // TODO: complete other MAC pib attributes };