diff --git a/CHANGES.md b/CHANGES.md index e98765c96..8fa67544b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -27,6 +27,11 @@ Changes from ns-3.42 to ns-3-dev * (lr-wpan) Removes the word `address` from the CSMA-CA logs prefix when `LOG_PREFIX_FUNC` is used. * (wifi) The `WifiHelper::AssignStreams()` method has been made static. * (lr-wpan) Added `AssignStreams` function to the MAC. +* (lr-wpan) Attribute `macRxOnWhenIdle` added to the supported attributes in `MacPibAttributes`. +* (lr-wpan) Attribute `macPromiscuousMode` added to the supported attributes in `MacPibAttributes`. +* (lr-wpan) Attribute `macAssociatePermit` added to the supported attributes in `MacPibAttributes`. +* (lr-wpan) Attribute `pCurrentChannel` added to the supported attributes in `MacPibAttributes`. +* (lr-wpan) Attribute `pCurrentPage` added to the supported attributes in `MacPibAttributes`. ### Changes to build system diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 8a79a9833..6e7bdec4f 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -34,6 +34,8 @@ been tested on Linux. As of this release, the latest known version to work with ### New user-visible features +- (lr-wpan) !2082 - MAC SET GET attributes added + ### Bugs fixed - (lr-wpan) !2001 - Beacon improvements and fixes diff --git a/src/lr-wpan/model/lr-wpan-mac-base.h b/src/lr-wpan/model/lr-wpan-mac-base.h index c28938e54..ca5cc403b 100644 --- a/src/lr-wpan/model/lr-wpan-mac-base.h +++ b/src/lr-wpan/model/lr-wpan-mac-base.h @@ -316,8 +316,13 @@ struct MacPibAttributes : public SimpleRefCount Mac16Address macShortAddress; //!< The 16 bit mac short address Mac64Address macExtendedAddress; //!< The EUI-64 bit address uint16_t macPanId{0xffff}; //!< The identifier of the PAN - uint8_t pCurrentChannel{11}; //!< The current logical channel in used in the PHY - uint8_t pCurrentPage{0}; //!< The current logical page in use in the PHY + bool macAssociationPermit{true}; //!< Indication of whether the coordinator is allowing + //!< association. + bool macRxOnWhenIdle{true}; //!< Indication of whether the MAC is enabled during idle periods. + bool macPromiscuousMode{false}; //!< Indication of whether the mac is in promiscuous mode + //!< (Receive all mode). + uint8_t pCurrentChannel{11}; //!< The current logical channel in used in the PHY + uint8_t pCurrentPage{0}; //!< The current logical page in use in the PHY // TODO: complete other MAC pib attributes }; diff --git a/src/lr-wpan/model/lr-wpan-mac.cc b/src/lr-wpan/model/lr-wpan-mac.cc index 930bfe884..0c37f2f4f 100644 --- a/src/lr-wpan/model/lr-wpan-mac.cc +++ b/src/lr-wpan/model/lr-wpan-mac.cc @@ -918,6 +918,9 @@ LrWpanMac::MlmeSetRequest(MacPibAttributeIdentifier id, Ptr at switch (id) { + case macAssociationPermit: + m_macAssociationPermit = attribute->macAssociationPermit; + break; case macBeaconPayload: if (attribute->macBeaconPayload.size() > aMaxBeaconPayloadLength) { @@ -947,6 +950,24 @@ LrWpanMac::MlmeSetRequest(MacPibAttributeIdentifier id, Ptr at case macPanId: m_macPanId = macPanId; break; + case macPromiscuousMode: + m_macPromiscuousMode = attribute->macPromiscuousMode; + break; + case macRxOnWhenIdle: + m_macRxOnWhenIdle = attribute->macRxOnWhenIdle; + break; + case pCurrentChannel: { + Ptr pibAttr = Create(); + pibAttr->phyCurrentChannel = attribute->pCurrentChannel; + m_phy->PlmeSetAttributeRequest(PhyPibAttributeIdentifier::phyCurrentChannel, pibAttr); + break; + } + case pCurrentPage: { + Ptr pibAttr = Create(); + pibAttr->phyCurrentPage = attribute->pCurrentPage; + m_phy->PlmeSetAttributeRequest(PhyPibAttributeIdentifier::phyCurrentPage, pibAttr); + break; + } default: // TODO: Add support for setting other attributes confirmParams.m_status = MacStatus::UNSUPPORTED_ATTRIBUTE; @@ -968,12 +989,21 @@ LrWpanMac::MlmeGetRequest(MacPibAttributeIdentifier id) switch (id) { + case macAssociationPermit: + attributes->macAssociationPermit = m_macAssociationPermit; + break; case macBeaconPayload: attributes->macBeaconPayload = m_macBeaconPayload; break; case macBeaconPayloadLength: attributes->macBeaconPayloadLength = m_macBeaconPayloadLength; break; + case macPromiscuousMode: + attributes->macPromiscuousMode = m_macPromiscuousMode; + break; + case macRxOnWhenIdle: + attributes->macRxOnWhenIdle = m_macRxOnWhenIdle; + break; case macShortAddress: attributes->macShortAddress = m_shortAddress; break; @@ -3598,6 +3628,32 @@ LrWpanMac::PlmeSetAttributeConfirm(PhyEnumeration status, PhyPibAttributeIdentif NS_LOG_ERROR("Invalid channel parameter in MLME-associate"); } } + else + { + if (!m_mlmeSetConfirmCallback.IsNull()) + { + MlmeSetConfirmParams confirmParams; + if (status == PhyEnumeration::IEEE_802_15_4_PHY_SUCCESS) + { + confirmParams.m_status = MacStatus::SUCCESS; + } + else + { + confirmParams.m_status = MacStatus::UNSUPPORTED_ATTRIBUTE; + } + + if (id == PhyPibAttributeIdentifier::phyCurrentChannel) + { + confirmParams.id = MacPibAttributeIdentifier::pCurrentChannel; + } + else if (id == PhyPibAttributeIdentifier::phyCurrentPage) + { + confirmParams.id = MacPibAttributeIdentifier::pCurrentPage; + } + + m_mlmeSetConfirmCallback(confirmParams); + } + } } void