lr-wpan: Added macPanId to MAC SET GET attributes

This commit is contained in:
Alberto Gallegos Ramonet
2023-04-03 17:39:17 +09:00
parent a3777c82f3
commit 5cbd4b9c8f
3 changed files with 13 additions and 3 deletions

View File

@@ -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

View File

@@ -900,6 +900,8 @@ void
LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr<LrWpanMacPibAttributes> attribute)
{
MlmeSetConfirmParams confirmParams;
confirmParams.m_status = MLMESET_SUCCESS;
switch (id)
{
case macBeaconPayload:
@@ -909,7 +911,6 @@ LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr<LrWpanMacPibAt
}
else
{
confirmParams.m_status = MLMESET_SUCCESS;
m_macBeaconPayload = attribute->macBeaconPayload;
m_macBeaconPayloadLength = attribute->macBeaconPayload->GetSize();
}
@@ -918,10 +919,14 @@ LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr<LrWpanMacPibAt
confirmParams.m_status = MLMESET_INVALID_PARAMETER;
break;
case macShortAddress:
confirmParams.m_status = MLMESET_SUCCESS;
m_shortAddress = attribute->macShortAddress;
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;

View File

@@ -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<LrWpanMacPibAttributes>
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
};