lr-wpan: MAC SET GET attributes added

This commit is contained in:
Alberto Gallegos Ramonet
2024-07-29 17:27:03 +09:00
parent 74fd01a17e
commit 47ec2c5bfe
4 changed files with 70 additions and 2 deletions

View File

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

View File

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

View File

@@ -316,8 +316,13 @@ struct MacPibAttributes : public SimpleRefCount<MacPibAttributes>
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
};

View File

@@ -918,6 +918,9 @@ LrWpanMac::MlmeSetRequest(MacPibAttributeIdentifier id, Ptr<MacPibAttributes> 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<MacPibAttributes> at
case macPanId:
m_macPanId = macPanId;
break;
case macPromiscuousMode:
m_macPromiscuousMode = attribute->macPromiscuousMode;
break;
case macRxOnWhenIdle:
m_macRxOnWhenIdle = attribute->macRxOnWhenIdle;
break;
case pCurrentChannel: {
Ptr<PhyPibAttributes> pibAttr = Create<PhyPibAttributes>();
pibAttr->phyCurrentChannel = attribute->pCurrentChannel;
m_phy->PlmeSetAttributeRequest(PhyPibAttributeIdentifier::phyCurrentChannel, pibAttr);
break;
}
case pCurrentPage: {
Ptr<PhyPibAttributes> pibAttr = Create<PhyPibAttributes>();
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