lr-wpan: Status enumeration fixes

This commit is contained in:
Alberto Gallegos Ramonet
2024-01-12 17:57:56 +09:00
parent 6636d62509
commit a56892a5f4
15 changed files with 181 additions and 357 deletions

View File

@@ -37,6 +37,7 @@ Changes from ns-3.40 to ns-3-dev
* (wifi) The default value for `WifiRemoteStationManager::RtsCtsThreshold` has been increased from 65535 to 4692480.
* (lr-wpan) Add the capability to see the enum values of the MAC transition states in log prints for easier debugging.
* (sixlowpan) Remove `ForceEtherType` and `EtherType` attributes, and use RFC 7973 EtherType for interfaces supporting an EtherType.
* (lr-wpan) Group MAC status enumerations into a single `LrWpanMacStatus` enumeration in `lr-wpan-mac-base.h.`
### Changes to build system

View File

@@ -29,6 +29,7 @@ Release 3-dev
- (wifi) - Align default RTS threshold to 802.11-2020
- (wifi) - Added EHT support for Ideal rate manager
- (wifi) - Reduce error rate model precision to fix infinite loop when Ideal rate manager is used with EHT
- (lr-wpan) !1794 - Group MAC primitives status enumerations into a single enumeration
### Bugs fixed

View File

@@ -56,7 +56,7 @@ using namespace ns3;
static void
ScanConfirm(Ptr<LrWpanNetDevice> device, MlmeScanConfirmParams params)
{
if (params.m_status == MLMESCAN_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
std::cout << Simulator::Now().As(Time::S) << "| Active scan status SUCCESSFUL (Completed)"
<< "\n";

View File

@@ -88,7 +88,7 @@ ScanConfirm(Ptr<LrWpanNetDevice> device, MlmeScanConfirmParams params)
// with the highest LQI value obtained from a passive scan and make
// sure this coordinator allows association.
if (params.m_status == MLMESCAN_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
// Select the coordinator with the highest LQI from the PAN Descriptor List
int maxLqi = 0;
@@ -209,7 +209,7 @@ AssociateIndication(Ptr<LrWpanNetDevice> device, MlmeAssociateIndicationParams p
MlmeAssociateResponseParams assocRespParams;
assocRespParams.m_extDevAddr = params.m_extDevAddr;
assocRespParams.m_status = LrWpanAssociationStatus::ASSOCIATED;
assocRespParams.m_status = LrWpanMacStatus::SUCCESS;
CapabilityField capability;
capability.SetCapability(params.capabilityInfo);
@@ -248,14 +248,14 @@ CommStatusIndication(Ptr<LrWpanNetDevice> device, MlmeCommStatusIndicationParams
// and is only here for demonstration purposes.
switch (params.m_status)
{
case LrWpanMlmeCommStatus::MLMECOMMSTATUS_TRANSACTION_EXPIRED:
case LrWpanMacStatus::TRANSACTION_EXPIRED:
std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
<< " [" << device->GetMac()->GetShortAddress() << " | "
<< device->GetMac()->GetExtendedAddress() << "]"
<< " MLME-comm-status.indication: Transaction for device " << params.m_dstExtAddr
<< " EXPIRED in pending transaction list\n";
break;
case LrWpanMlmeCommStatus::MLMECOMMSTATUS_NO_ACK:
case LrWpanMacStatus::NO_ACK:
std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
<< " [" << device->GetMac()->GetShortAddress() << " | "
<< device->GetMac()->GetExtendedAddress() << "]"
@@ -263,7 +263,7 @@ CommStatusIndication(Ptr<LrWpanNetDevice> device, MlmeCommStatusIndicationParams
<< " device registered in the pending transaction list\n";
break;
case LrWpanMlmeCommStatus::MLMECOMMSTATUS_CHANNEL_ACCESS_FAILURE:
case LrWpanMacStatus::CHANNEL_ACCESS_FAILURE:
std::cout << Simulator::Now().As(Time::S) << " Coordinator " << device->GetNode()->GetId()
<< " [" << device->GetMac()->GetShortAddress() << " | "
<< device->GetMac()->GetExtendedAddress() << "]"
@@ -282,7 +282,7 @@ AssociateConfirm(Ptr<LrWpanNetDevice> device, MlmeAssociateConfirmParams params)
// Used by device higher layer to inform the results of a
// association procedure from its mac layer.This is implemented by other protocol stacks
// and is only here for demonstration purposes.
if (params.m_status == LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
<< device->GetMac()->GetShortAddress() << " | "
@@ -292,7 +292,7 @@ AssociateConfirm(Ptr<LrWpanNetDevice> device, MlmeAssociateConfirmParams params)
<< " | CoordShort: " << device->GetMac()->GetCoordShortAddress()
<< " | CoordExt: " << device->GetMac()->GetCoordExtAddress() << ")\n";
}
else if (params.m_status == LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_NO_ACK)
else if (params.m_status == LrWpanMacStatus::NO_ACK)
{
std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
<< device->GetMac()->GetShortAddress() << " | "
@@ -311,7 +311,7 @@ AssociateConfirm(Ptr<LrWpanNetDevice> device, MlmeAssociateConfirmParams params)
static void
PollConfirm(Ptr<LrWpanNetDevice> device, MlmePollConfirmParams params)
{
if (params.m_status == LrWpanMlmePollConfirmStatus::MLMEPOLL_CHANNEL_ACCESS_FAILURE)
if (params.m_status == LrWpanMacStatus::CHANNEL_ACCESS_FAILURE)
{
std::cout
<< Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
@@ -319,14 +319,14 @@ PollConfirm(Ptr<LrWpanNetDevice> device, MlmePollConfirmParams params)
<< device->GetMac()->GetExtendedAddress() << "]"
<< " MLME-poll.confirm: CHANNEL ACCESS problem when sending a data request command.\n";
}
else if (params.m_status == LrWpanMlmePollConfirmStatus::MLMEPOLL_NO_ACK)
else if (params.m_status == LrWpanMacStatus::NO_ACK)
{
std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
<< device->GetMac()->GetShortAddress() << " | "
<< device->GetMac()->GetExtendedAddress() << "]"
<< " MLME-poll.confirm: Data Request Command FAILED (NO ACK).\n";
}
else if (params.m_status != LrWpanMlmePollConfirmStatus::MLMEPOLL_SUCCESS)
else if (params.m_status != LrWpanMacStatus::SUCCESS)
{
std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
<< device->GetMac()->GetShortAddress() << " | "

View File

@@ -56,7 +56,7 @@ using namespace ns3;
static void
ScanConfirm(MlmeScanConfirmParams params)
{
if (params.m_status == MLMESCAN_SUCCESS && params.m_scanType == MLMESCAN_ED)
if (params.m_status == LrWpanMacStatus::SUCCESS && params.m_scanType == MLMESCAN_ED)
{
std::cout << Simulator::Now().As(Time::S) << "| Scan status SUCCESSFUL\n";
std::cout << "Results for Energy Scan:"

View File

@@ -64,7 +64,7 @@ TransEndIndication(McpsDataConfirmParams params)
{
// In the case of transmissions with the Ack flag activated, the transaction is only
// successful if the Ack was received.
if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
NS_LOG_UNCOND(Simulator::Now().GetSeconds() << " secs | Transmission successfully sent");
}
@@ -80,7 +80,7 @@ DataIndicationCoordinator(McpsDataIndicationParams params, Ptr<Packet> p)
void
StartConfirm(MlmeStartConfirmParams params)
{
if (params.m_status == MLMESTART_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
NS_LOG_UNCOND(Simulator::Now().GetSeconds() << "Beacon status SUCCESSFUL");
}

View File

@@ -68,7 +68,7 @@ using namespace ns3;
static void
ScanConfirm(Ptr<LrWpanNetDevice> device, MlmeScanConfirmParams params)
{
if (params.m_status == MLMESCAN_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
<< device->GetMac()->GetShortAddress() << " | "
@@ -76,7 +76,7 @@ ScanConfirm(Ptr<LrWpanNetDevice> device, MlmeScanConfirmParams params)
<< "] MLME-SCAN.confirm: Active scan status SUCCESSFUL "
<< "(Coordinator found and address assigned) \n";
}
else if (params.m_status == MLMESCAN_NO_BEACON)
else if (params.m_status == LrWpanMacStatus::NO_BEACON)
{
std::cout << Simulator::Now().As(Time::S) << " Node " << device->GetNode()->GetId() << " ["
<< device->GetMac()->GetShortAddress() << " | "

View File

@@ -28,9 +28,65 @@
#include <ns3/packet.h>
#include <ns3/ptr.h>
#include <cstdint>
namespace ns3
{
/**
* \ingroup lr-wpan
*
* The status of a confirm or an indication primitive as a result of a previous request.
* Represent the value of status in IEEE 802.15.4-2011 primitives.
* (Tables 6, 12, 18, 20, 31, 33, 35, 37, 39, 47)
*
* Status codes values only appear in IEEE 802.15.4-2006, Table 78
* See also NXP JN5169 IEEE 802.15.4 Stack User Guide
* (Table 6: Status Enumerations and Section 6.1.23)
*
*/
enum class LrWpanMacStatus : std::uint8_t
{
SUCCESS = 0, //!< The operation was completed successfully.
FULL_CAPACITY = 0x01, //!< PAN at capacity. Association Status field (std. 2006, Table 83)
ACCESS_DENIED = 0x02, //!< PAN access denied. Association Status field (std. 2006, Table 83)
COUNTER_ERROR = 0xdb, //!< The frame counter of the received frame is invalid.
IMPROPER_KEY_TYPE = 0xdc, //!< The key is not allowed to be used with that frame type.
IMPROPER_SECURITY_LEVEL = 0xdd, //!< Insufficient security level expected by the recipient.
UNSUPPORTED_LEGACY = 0xde, //!< Deprecated security used in IEEE 802.15.4-2003
UNSUPPORTED_SECURITY = 0xdf, //!< The security applied is not supported.
BEACON_LOSS = 0xe0, //!< The beacon was lost following a synchronization request.
CHANNEL_ACCESS_FAILURE = 0xe1, //!< A Tx could not take place due to activity in the CH.
DENIED = 0xe2, //!< The GTS request has been denied by the PAN coordinator.
DISABLE_TRX_FAILURE = 0xe3, //!< The attempt to disable the transceier has failed.
SECURITY_ERROR = 0xe4, // Cryptographic process of the frame failed(FAILED_SECURITY_CHECK).
FRAME_TOO_LONG = 0xe5, //!< Frame more than aMaxPHYPacketSize or too large for CAP or GTS.
INVALID_GTS = 0xe6, //!< Missing GTS transmit or undefined direction.
INVALID_HANDLE = 0xe7, //!< When purging from TX queue handle was not found.
INVALID_PARAMETER = 0xe8, //!< Primitive parameter not supported or out of range.
NO_ACK = 0xe9, //!< No acknowledgment was received after macMaxFrameRetries.
NO_BEACON = 0xea, //!< A scan operation failed to find any network beacons.
NO_DATA = 0xeb, //!< No response data were available following a request.
NO_SHORT_ADDRESS = 0xec, //!< Failure due to unallocated 16-bit short address.
OUT_OF_CAP = 0xed, //!< (Deprecated) See IEEE 802.15.4-2003
PAN_ID_CONFLICT = 0xee, //!< PAN id conflict detected and informed to the coordinator.
REALIGMENT = 0xef, //!< A coordinator realigment command has been received.
TRANSACTION_EXPIRED = 0xf0, //!< The transaction expired and its information discarded.
TRANSACTION_OVERFLOW = 0xf1, //!< There is no capacity to store the transaction.
TX_ACTIVE = 0xf2, //!< The transceiver was already enabled.
UNAVAILABLE_KEY = 0xf3, //!< Unavailable key, unknown or blacklisted.
UNSUPPORTED_ATTRIBUTE = 0xf4, //!< SET/GET request issued with a non supported ID.
INVALID_ADDRESS = 0xf5, //!< Invalid source or destination address.
ON_TIME_TOO_LONG = 0xf6, //!< RX enable request fail due to syms. longer than Bcn. interval
PAST_TIME = 0xf7, //!< Rx enable request fail due to lack of time in superframe.
TRACKING_OFF = 0xf8, //!< This device is currently not tracking beacons.
INVALID_INDEX = 0xf9, //!< A MAC PIB write failed because specified index is out of range.
LIMIT_REACHED = 0xfa, //!< PAN descriptors stored reached max capacity.
READ_ONLY = 0xfb, //!< SET/GET request issued for a read only attribute.
SCAN_IN_PROGRESS = 0xfc, //!< Scan failed because already performing another scan.
SUPERFRAME_OVERLAP = 0xfd //!< Coordinator sperframe and this device superframe tx overlap.
};
/**
* \ingroup lr-wpan
*
@@ -44,20 +100,6 @@ enum LrWpanAddressMode
EXT_ADDR = 3
};
/**
* \ingroup lr-wpan
*
* table 83 of 802.15.4
*/
enum LrWpanAssociationStatus
{
ASSOCIATED = 0,
PAN_AT_CAPACITY = 1,
PAN_ACCESS_DENIED = 2,
ASSOCIATED_WITHOUT_ADDRESS = 0xfe,
DISASSOCIATED = 0xff
};
/**
* \ingroup lr-wpan
*
@@ -160,8 +202,9 @@ struct MlmeAssociateResponseParams
Mac64Address m_extDevAddr; //!< The extended address of the device requesting association
Mac16Address m_assocShortAddr; //!< The short address allocated by the coordinator on successful
//!< assoc. FF:FF = Unsuccessful
LrWpanAssociationStatus m_status{DISASSOCIATED}; //!< The status of the association attempt (As
//!< defined on Table 83 IEEE 802.15.4-2006)
LrWpanMacStatus m_status{
LrWpanMacStatus::ACCESS_DENIED}; //!< The status of the association
//!< attempt (As defined on Table 83 IEEE 802.15.4-2006)
};
/**
@@ -238,27 +281,6 @@ struct LrWpanMacPibAttributes : public SimpleRefCount<LrWpanMacPibAttributes>
// TODO: complete other MAC pib attributes
};
/**
* \ingroup lr-wpan
*
* Table 42 of 802.15.4-2006
*/
enum LrWpanMcpsDataConfirmStatus
{
IEEE_802_15_4_SUCCESS = 0,
IEEE_802_15_4_TRANSACTION_OVERFLOW = 1,
IEEE_802_15_4_TRANSACTION_EXPIRED = 2,
IEEE_802_15_4_CHANNEL_ACCESS_FAILURE = 3,
IEEE_802_15_4_INVALID_ADDRESS = 4,
IEEE_802_15_4_INVALID_GTS = 5,
IEEE_802_15_4_NO_ACK = 6,
IEEE_802_15_4_COUNTER_ERROR = 7,
IEEE_802_15_4_FRAME_TOO_LONG = 8,
IEEE_802_15_4_UNAVAILABLE_KEY = 9,
IEEE_802_15_4_UNSUPPORTED_SECURITY = 10,
IEEE_802_15_4_INVALID_PARAMETER = 11
};
/**
* \ingroup lr-wpan
*
@@ -266,10 +288,9 @@ enum LrWpanMcpsDataConfirmStatus
*/
struct McpsDataConfirmParams
{
uint8_t m_msduHandle{0}; //!< MSDU handle
LrWpanMcpsDataConfirmStatus m_status{
IEEE_802_15_4_INVALID_PARAMETER}; //!< The status
//!< of the last MSDU transmission
uint8_t m_msduHandle{0}; //!< MSDU handle
LrWpanMacStatus m_status{LrWpanMacStatus::INVALID_PARAMETER}; //!< The status
//!< of the last MSDU transmission
};
/**
@@ -305,23 +326,6 @@ struct MlmeAssociateIndicationParams
//!< (Not officially supported in the standard but found in implementations)
};
/**
* \ingroup lr-wpan
*
* Table 18 of IEEE 802.15.4-2011
*/
enum LrWpanMlmeCommStatus
{
MLMECOMMSTATUS_SUCCESS = 0,
MLMECOMMSTATUS_TRANSACTION_OVERFLOW = 1,
MLMECOMMSTATUS_TRANSACTION_EXPIRED = 2,
MLMECOMMSTATUS_CHANNEL_ACCESS_FAILURE = 3,
MLMECOMMSTATUS_NO_ACK = 4,
MLMECOMMSTATUS_COUNTER_ERROR = 5,
MLMECOMMSTATUS_FRAME_TOO_LONG = 6,
MLMECOMMSTATUS_INVALID_PARAMETER = 7
};
/**
* \ingroup lr-wpan
*
@@ -341,7 +345,7 @@ struct MlmeCommStatusIndicationParams
//!< which the frame was intended.
Mac64Address m_dstExtAddr; //!< The extended address of the device for
//!< which the frame was intended.
LrWpanMlmeCommStatus m_status{MLMECOMMSTATUS_INVALID_PARAMETER}; //!< The communication status
LrWpanMacStatus m_status{LrWpanMacStatus::INVALID_PARAMETER}; //!< The communication status
};
/**
@@ -354,25 +358,6 @@ struct MlmeOrphanIndicationParams
Mac64Address m_orphanAddr; //!< The address of the orphaned device.
};
/**
* \ingroup lr-wpan
*
* Table 35 of IEEE 802.15.4-2011
*/
enum LrWpanMlmeStartConfirmStatus
{
MLMESTART_SUCCESS = 0,
MLMESTART_NO_SHORT_ADDRESS = 1,
MLMESTART_SUPERFRAME_OVERLAP = 2,
MLMESTART_TRACKING_OFF = 3,
MLMESTART_INVALID_PARAMETER = 4,
MLMESTART_COUNTER_ERROR = 5,
MLMESTART_FRAME_TOO_LONG = 6,
MLMESTART_UNAVAILABLE_KEY = 7,
MLMESTART_UNSUPPORTED_SECURITY = 8,
MLMESTART_CHANNEL_ACCESS_FAILURE = 9
};
/**
* \ingroup lr-wpan
*
@@ -380,26 +365,8 @@ enum LrWpanMlmeStartConfirmStatus
*/
struct MlmeStartConfirmParams
{
LrWpanMlmeStartConfirmStatus m_status{MLMESTART_INVALID_PARAMETER}; //!< The status of
//!< a MLME-start.request
};
/**
* \ingroup lr-wpan
*
* Table 31 of IEEE 802.15.4-2011
*/
enum LrWpanMlmeScanConfirmStatus
{
MLMESCAN_SUCCESS = 0,
MLMESCAN_LIMIT_REACHED = 1,
MLMESCAN_NO_BEACON = 2,
MLMESCAN_SCAN_IN_PROGRESS = 3,
MLMESCAN_COUNTER_ERROR = 4,
MLMESCAN_FRAME_TOO_LONG = 5,
MLMESCAN_UNAVAILABLE_KEY = 6,
MLMESCAN_UNSUPPORTED_SECURITY = 7,
MLMESCAN_INVALID_PARAMETER = 8
LrWpanMacStatus m_status{LrWpanMacStatus::INVALID_PARAMETER}; //!< The status of
//!< a MLME-start.request
};
/**
@@ -436,40 +403,22 @@ struct PanDescriptor
*/
struct MlmeScanConfirmParams
{
LrWpanMlmeScanConfirmStatus m_status{MLMESCAN_INVALID_PARAMETER}; //!< The status the request.
LrWpanMlmeScanType m_scanType{MLMESCAN_PASSIVE}; //!< Indicates the type of scan
//!< performed (ED,ACTIVE,PASSIVE,ORPHAN).
uint32_t m_chPage{0}; //!< The channel page on which the scan was performed.
std::vector<uint8_t> m_unscannedCh; //!< A list of channels given in the request which
//!< were not scanned (Not valid for ED scans).
uint8_t m_resultListSize{0}; //!< The number of elements returned in the appropriate
//!< result list. (Not valid for Orphan scan).
std::vector<uint8_t> m_energyDetList; //!< A list of energy measurements, one for each
//!< channel searched during ED scan
//!< (Not valid for Active, Passive or Orphan Scans)
LrWpanMacStatus m_status{
LrWpanMacStatus::INVALID_PARAMETER}; //!< The status of the scan request.
uint8_t m_scanType{MLMESCAN_PASSIVE}; //!< Indicates the type of scan
//!< performed (ED,ACTIVE,PASSIVE,ORPHAN).
uint32_t m_chPage{0}; //!< The channel page on which the scan was performed.
std::vector<uint8_t> m_unscannedCh; //!< A list of channels given in the request which
//!< were not scanned (Not valid for ED scans).
uint8_t m_resultListSize{0}; //!< The number of elements returned in the appropriate
//!< result list. (Not valid for Orphan scan).
std::vector<uint8_t> m_energyDetList; //!< A list of energy measurements, one for each
//!< channel searched during ED scan
//!< (Not valid for Active, Passive or Orphan Scans)
std::vector<PanDescriptor> m_panDescList; //!< A list of PAN descriptor, one for each beacon
//!< found (Not valid for ED and Orphan scans).
};
/**
* \ingroup lr-wpan
*
* Table 12 of IEEE 802.15.4-2011
*/
enum LrWpanMlmeAssociateConfirmStatus
{
MLMEASSOC_SUCCESS = 0,
MLMEASSOC_FULL_CAPACITY = 1,
MLMEASSOC_ACCESS_DENIED = 2,
MLMEASSOC_CHANNEL_ACCESS_FAILURE = 3,
MLMEASSOC_NO_ACK = 4,
MLMEASSOC_NO_DATA = 5,
MLMEASSOC_COUNTER_ERROR = 6,
MLMEASSOC_FRAME_TOO_LONG = 7,
MLMEASSOC_UNSUPPORTED_LEGACY = 8,
MLMEASSOC_INVALID_PARAMETER = 9
};
/**
* \ingroup lr-wpan
*
@@ -478,8 +427,8 @@ enum LrWpanMlmeAssociateConfirmStatus
struct MlmeAssociateConfirmParams
{
Mac16Address m_assocShortAddr; //!< The short address used in the association request
LrWpanMlmeAssociateConfirmStatus m_status{MLMEASSOC_INVALID_PARAMETER};
//!< The status of a MLME-associate.request
LrWpanMacStatus m_status{LrWpanMacStatus::INVALID_PARAMETER}; //!< The status of
//!< a MLME-associate.request
};
/**
@@ -495,19 +444,6 @@ struct MlmeBeaconNotifyIndicationParams
Ptr<Packet> m_sdu; //!< The set of octets comprising the beacon payload.
};
/**
* \ingroup lr-wpan
*
* Table 37 of IEEE 802.15.4-2011
*/
enum LrWpanSyncLossReason
{
MLMESYNCLOSS_PAN_ID_CONFLICT = 0,
MLMESYNCLOSS_REALIGMENT = 1,
MLMESYNCLOSS_BEACON_LOST = 2,
MLMESYNCLOSS_SUPERFRAME_OVERLAP = 3
};
/**
* \ingroup lr-wpan
*
@@ -515,39 +451,14 @@ enum LrWpanSyncLossReason
*/
struct MlmeSyncLossIndicationParams
{
LrWpanSyncLossReason m_lossReason{MLMESYNCLOSS_PAN_ID_CONFLICT}; //!< The reason for the lost
//!< of synchronization.
LrWpanMacStatus m_lossReason{LrWpanMacStatus::PAN_ID_CONFLICT}; //!< The reason for the lost
//!< of synchronization.
uint16_t m_panId{0}; //!< The PAN identifier with which the device lost synchronization or to
//!< which it was realigned.
uint8_t m_logCh{11}; //!< The channel number on which the device lost synchronization or to
//!< which it was realigned.
};
/**
* \ingroup lr-wpan
*
* Table 33 of IEEE 802.15.4-2011
*/
enum LrWpanMlmeSetConfirmStatus
{
MLMESET_SUCCESS = 0,
MLMESET_READ_ONLY = 1,
MLMESET_UNSUPPORTED_ATTRIBUTE = 2,
MLMESET_INVALID_INDEX = 3,
MLMESET_INVALID_PARAMETER = 4
};
/**
* \ingroup lr-wpan
*
* Table 20 of IEEE 802.15.4-2011
*/
enum LrWpanMlmeGetConfirmStatus
{
MLMEGET_SUCCESS = 0,
MLMEGET_UNSUPPORTED_ATTRIBUTE = 1
};
/**
* \ingroup lr-wpan
*
@@ -555,30 +466,12 @@ enum LrWpanMlmeGetConfirmStatus
*/
struct MlmeSetConfirmParams
{
LrWpanMlmeSetConfirmStatus m_status{MLMESET_UNSUPPORTED_ATTRIBUTE}; //!< The result of
//!< the request to write
//!< the PIB attribute.
LrWpanMacStatus m_status{LrWpanMacStatus::UNSUPPORTED_ATTRIBUTE}; //!< The result of
//!< the request to write
//!< the PIB attribute.
LrWpanMacPibAttributeIdentifier id; //!< The id of the PIB attribute that was written.
};
/**
* \ingroup lr-wpan
*
* Table 39 of IEEE 802.15.4-2011
*/
enum LrWpanMlmePollConfirmStatus
{
MLMEPOLL_SUCCESS = 0,
MLMEPOLL_CHANNEL_ACCESS_FAILURE = 2,
MLMEPOLL_NO_ACK = 3,
MLMEPOLL_NO_DATA = 4,
MLMEPOLL_COUNTER_ERROR = 5,
MLMEPOLL_FRAME_TOO_LONG = 6,
MLMEPOLL_UNAVAILABLE_KEY = 7,
MLMEPOLL_UNSUPPORTED_SECURITY = 8,
MLMEPOLL_INVALID_PARAMETER = 9
};
/**
* \ingroup lr-wpan
*
@@ -586,9 +479,9 @@ enum LrWpanMlmePollConfirmStatus
*/
struct MlmePollConfirmParams
{
LrWpanMlmePollConfirmStatus m_status{MLMEPOLL_INVALID_PARAMETER}; //!< The confirmation
//!< status resulting from a
//!< MLME-poll.request.
LrWpanMacStatus m_status{LrWpanMacStatus::INVALID_PARAMETER}; //!< The confirmation
//!< status resulting from a
//!< MLME-poll.request.
};
/**
@@ -708,10 +601,8 @@ using MlmeSetConfirmCallback = Callback<void, MlmeSetConfirmParams>;
* the higher layer to get a PIB. It returns a status of the outcome of the
* write attempt.
*/
using MlmeGetConfirmCallback = Callback<void,
LrWpanMlmeGetConfirmStatus,
LrWpanMacPibAttributeIdentifier,
Ptr<LrWpanMacPibAttributes>>;
using MlmeGetConfirmCallback =
Callback<void, LrWpanMacStatus, LrWpanMacPibAttributeIdentifier, Ptr<LrWpanMacPibAttributes>>;
/**
* \ingroup lr-wpan

View File

@@ -244,7 +244,7 @@ CommandPayloadHeader::Deserialize(Buffer::Iterator start)
break;
case ASSOCIATION_RESP:
ReadFrom(i, m_shortAddr);
m_assocStatus = static_cast<AssocStatus>(i.ReadU8());
m_assocStatus = i.ReadU8();
break;
case DISASSOCIATION_NOTIF:
break;
@@ -394,7 +394,7 @@ CommandPayloadHeader::SetShortAddr(Mac16Address shortAddr)
}
void
CommandPayloadHeader::SetAssociationStatus(AssocStatus status)
CommandPayloadHeader::SetAssociationStatus(uint8_t status)
{
NS_ASSERT(m_cmdFrameId == ASSOCIATION_RESP);
m_assocStatus = status;
@@ -406,7 +406,7 @@ CommandPayloadHeader::GetShortAddr() const
return m_shortAddr;
}
CommandPayloadHeader::AssocStatus
uint8_t
CommandPayloadHeader::GetAssociationStatus() const
{
NS_ASSERT(m_cmdFrameId == ASSOCIATION_RESP);

View File

@@ -123,17 +123,6 @@ class CommandPayloadHeader : public Header
CMD_RESERVED = 0xff //!< Reserved
};
/**
* Association Status Field values.
* See IEEE 802.15.4-2011, Table 6
*/
enum AssocStatus
{
SUCCESSFUL = 0x00, //!< Association successful
FULL_CAPACITY = 0x01, //!< PAN at capacity
ACCESS_DENIED = 0x02 //!< PAN access denied
};
CommandPayloadHeader();
/**
* Constructor
@@ -192,7 +181,7 @@ class CommandPayloadHeader : public Header
* Set status resulting from the association attempt (Association Response Command).
* \param status The status resulting from the association attempt
*/
void SetAssociationStatus(AssocStatus status);
void SetAssociationStatus(uint8_t status);
/**
* Get the Short address assigned by the coordinator
* (Association Response and Coordinator Realigment commands).
@@ -203,7 +192,7 @@ class CommandPayloadHeader : public Header
* Get the status resulting from an association request (Association Response Command).
* \return The resulting status from an association request
*/
AssocStatus GetAssociationStatus() const;
uint8_t GetAssociationStatus() const;
/**
* Get the command frame type ID
* \return The command type ID from the command payload header
@@ -247,7 +236,7 @@ class CommandPayloadHeader : public Header
uint16_t m_panid; //!< The PAN identifier (Coordinator realigment command)
uint8_t m_logCh; //!< The channel number (Coordinator realigment command)
uint8_t m_logChPage; //!< The channel page number (Coordinator realigment command)
AssocStatus m_assocStatus; //!< Association Status (Association Response Command)
uint8_t m_assocStatus; //!< Association Status (Association Response Command)
};
} // namespace ns3

View File

@@ -214,7 +214,6 @@ LrWpanMac::LrWpanMac()
m_macCoordShortAddress = Mac16Address("ff:ff");
m_macCoordExtendedAddress = Mac64Address("ff:ff:ff:ff:ff:ff:ff:ed");
m_deviceCapability = DeviceType::FFD;
m_associationStatus = ASSOCIATED;
m_selfExt = Mac64Address::Allocate();
m_macPromiscuousMode = false;
m_macMaxFrameRetries = 3;
@@ -403,7 +402,7 @@ LrWpanMac::McpsDataRequest(McpsDataRequestParams params, Ptr<Packet> p)
// The frame could still be too large once headers are put on
// in which case the phy will reject it instead
NS_LOG_ERROR(this << " packet too big: " << p->GetSize());
confirmParams.m_status = IEEE_802_15_4_FRAME_TOO_LONG;
confirmParams.m_status = LrWpanMacStatus::FRAME_TOO_LONG;
if (!m_mcpsDataConfirmCallback.IsNull())
{
m_mcpsDataConfirmCallback(confirmParams);
@@ -414,7 +413,7 @@ LrWpanMac::McpsDataRequest(McpsDataRequestParams params, Ptr<Packet> p)
if ((params.m_srcAddrMode == NO_PANID_ADDR) && (params.m_dstAddrMode == NO_PANID_ADDR))
{
NS_LOG_ERROR(this << " Can not send packet with no Address field");
confirmParams.m_status = IEEE_802_15_4_INVALID_ADDRESS;
confirmParams.m_status = LrWpanMacStatus::INVALID_ADDRESS;
if (!m_mcpsDataConfirmCallback.IsNull())
{
m_mcpsDataConfirmCallback(confirmParams);
@@ -441,7 +440,7 @@ LrWpanMac::McpsDataRequest(McpsDataRequestParams params, Ptr<Packet> p)
default:
NS_LOG_ERROR(this << " Can not send packet with incorrect Source Address mode = "
<< params.m_srcAddrMode);
confirmParams.m_status = IEEE_802_15_4_INVALID_ADDRESS;
confirmParams.m_status = LrWpanMacStatus::INVALID_ADDRESS;
if (!m_mcpsDataConfirmCallback.IsNull())
{
m_mcpsDataConfirmCallback(confirmParams);
@@ -468,7 +467,7 @@ LrWpanMac::McpsDataRequest(McpsDataRequestParams params, Ptr<Packet> p)
default:
NS_LOG_ERROR(this << " Can not send packet with incorrect Destination Address mode = "
<< params.m_dstAddrMode);
confirmParams.m_status = IEEE_802_15_4_INVALID_ADDRESS;
confirmParams.m_status = LrWpanMacStatus::INVALID_ADDRESS;
if (!m_mcpsDataConfirmCallback.IsNull())
{
m_mcpsDataConfirmCallback(confirmParams);
@@ -592,7 +591,7 @@ LrWpanMac::MlmeStartRequest(MlmeStartRequestParams params)
if (GetShortAddress() == Mac16Address("ff:ff"))
{
NS_LOG_ERROR(this << " Invalid MAC short address");
confirmParams.m_status = MLMESTART_NO_SHORT_ADDRESS;
confirmParams.m_status = LrWpanMacStatus::NO_SHORT_ADDRESS;
if (!m_mlmeStartConfirmCallback.IsNull())
{
m_mlmeStartConfirmCallback(confirmParams);
@@ -602,7 +601,7 @@ LrWpanMac::MlmeStartRequest(MlmeStartRequestParams params)
if ((params.m_bcnOrd > 15) || (params.m_sfrmOrd > params.m_bcnOrd))
{
confirmParams.m_status = MLMESTART_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
if (!m_mlmeStartConfirmCallback.IsNull())
{
m_mlmeStartConfirmCallback(confirmParams);
@@ -633,7 +632,7 @@ LrWpanMac::MlmeScanRequest(MlmeScanRequestParams params)
{
if (!m_mlmeScanConfirmCallback.IsNull())
{
confirmParams.m_status = MLMESCAN_SCAN_IN_PROGRESS;
confirmParams.m_status = LrWpanMacStatus::SCAN_IN_PROGRESS;
m_mlmeScanConfirmCallback(confirmParams);
}
NS_LOG_ERROR(this << " A channel scan is already in progress");
@@ -644,7 +643,7 @@ LrWpanMac::MlmeScanRequest(MlmeScanRequestParams params)
{
if (!m_mlmeScanConfirmCallback.IsNull())
{
confirmParams.m_status = MLMESCAN_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeScanConfirmCallback(confirmParams);
}
NS_LOG_ERROR(this << "Invalid scan duration or unsupported scan type");
@@ -723,7 +722,7 @@ LrWpanMac::MlmeAssociateRequest(MlmeAssociateRequestParams params)
{
MlmeAssociateConfirmParams confirmParams;
confirmParams.m_assocShortAddr = Mac16Address("FF:FF");
confirmParams.m_status = MLMEASSOC_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeAssociateConfirmCallback(confirmParams);
}
}
@@ -779,24 +778,7 @@ LrWpanMac::MlmeAssociateResponse(MlmeAssociateResponseParams params)
CommandPayloadHeader macPayload(CommandPayloadHeader::ASSOCIATION_RESP);
macPayload.SetShortAddr(params.m_assocShortAddr);
switch (params.m_status)
{
case LrWpanAssociationStatus::ASSOCIATED:
macPayload.SetAssociationStatus(CommandPayloadHeader::SUCCESSFUL);
break;
case LrWpanAssociationStatus::PAN_AT_CAPACITY:
macPayload.SetAssociationStatus(CommandPayloadHeader::FULL_CAPACITY);
break;
case LrWpanAssociationStatus::PAN_ACCESS_DENIED:
macPayload.SetAssociationStatus(CommandPayloadHeader::ACCESS_DENIED);
break;
case LrWpanAssociationStatus::ASSOCIATED_WITHOUT_ADDRESS:
NS_LOG_ERROR("Error, Associated without address");
break;
case LrWpanAssociationStatus::DISASSOCIATED:
NS_LOG_ERROR("Error, device not associated");
break;
}
macPayload.SetAssociationStatus(static_cast<uint8_t>(params.m_status));
macHdr.SetSecDisable();
macHdr.SetAckReq();
@@ -936,14 +918,14 @@ void
LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr<LrWpanMacPibAttributes> attribute)
{
MlmeSetConfirmParams confirmParams;
confirmParams.m_status = MLMESET_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
switch (id)
{
case macBeaconPayload:
if (attribute->macBeaconPayload->GetSize() > lrwpan::aMaxBeaconPayloadLength)
{
confirmParams.m_status = MLMESET_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
}
else
{
@@ -952,20 +934,20 @@ LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr<LrWpanMacPibAt
}
break;
case macBeaconPayloadLength:
confirmParams.m_status = MLMESET_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
break;
case macShortAddress:
m_shortAddress = attribute->macShortAddress;
break;
case macExtendedAddress:
confirmParams.m_status = MLMESET_READ_ONLY;
confirmParams.m_status = LrWpanMacStatus::READ_ONLY;
break;
case macPanId:
m_macPanId = macPanId;
break;
default:
// TODO: Add support for setting other attributes
confirmParams.m_status = MLMESET_UNSUPPORTED_ATTRIBUTE;
confirmParams.m_status = LrWpanMacStatus::UNSUPPORTED_ATTRIBUTE;
break;
}
@@ -979,7 +961,7 @@ LrWpanMac::MlmeSetRequest(LrWpanMacPibAttributeIdentifier id, Ptr<LrWpanMacPibAt
void
LrWpanMac::MlmeGetRequest(LrWpanMacPibAttributeIdentifier id)
{
LrWpanMlmeGetConfirmStatus status = MLMEGET_SUCCESS;
LrWpanMacStatus status = LrWpanMacStatus::SUCCESS;
Ptr<LrWpanMacPibAttributes> attributes = Create<LrWpanMacPibAttributes>();
switch (id)
@@ -1006,7 +988,7 @@ LrWpanMac::MlmeGetRequest(LrWpanMacPibAttributeIdentifier id)
attributes->pCurrentPage = m_phy->GetCurrentPage();
break;
default:
status = MLMEGET_UNSUPPORTED_ATTRIBUTE;
status = LrWpanMacStatus::UNSUPPORTED_ATTRIBUTE;
break;
}
@@ -1313,7 +1295,7 @@ LrWpanMac::LostAssocRespCommand()
{
MlmeAssociateConfirmParams confirmParams;
confirmParams.m_assocShortAddr = Mac16Address("FF:FF");
confirmParams.m_status = MLMEASSOC_NO_DATA;
confirmParams.m_status = LrWpanMacStatus::NO_DATA;
m_mlmeAssociateConfirmCallback(confirmParams);
}
}
@@ -1367,7 +1349,7 @@ LrWpanMac::EndStartRequest()
if (!m_mlmeStartConfirmCallback.IsNull())
{
MlmeStartConfirmParams confirmParams;
confirmParams.m_status = MLMESTART_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmeStartConfirmCallback(confirmParams);
}
@@ -1450,12 +1432,12 @@ LrWpanMac::EndChannelScan()
{
confirmParams.m_panDescList = m_panDescriptorList;
}
confirmParams.m_status = MLMESCAN_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
break;
case MLMESCAN_ACTIVE:
if (m_panDescriptorList.empty())
{
confirmParams.m_status = MLMESCAN_NO_BEACON;
confirmParams.m_status = LrWpanMacStatus::NO_BEACON;
}
else
{
@@ -1463,12 +1445,12 @@ LrWpanMac::EndChannelScan()
{
confirmParams.m_panDescList = m_panDescriptorList;
}
confirmParams.m_status = MLMESCAN_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
}
break;
case MLMESCAN_ORPHAN:
confirmParams.m_panDescList = {};
confirmParams.m_status = MLMESCAN_NO_BEACON;
confirmParams.m_status = LrWpanMacStatus::NO_BEACON;
confirmParams.m_resultListSize = 0;
// The device lost track of the coordinator and was unable
// to locate it, disassociate from the network.
@@ -1532,7 +1514,7 @@ LrWpanMac::EndChannelEnergyScan()
// All channels scanned, report success
MlmeScanConfirmParams confirmParams;
confirmParams.m_status = MLMESCAN_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
confirmParams.m_chPage = m_phy->GetCurrentPage();
confirmParams.m_scanType = m_scanParams.m_scanType;
confirmParams.m_energyDetList = m_energyDetectList;
@@ -1707,7 +1689,7 @@ LrWpanMac::BeaconSearchTimeout()
{
MlmeSyncLossIndicationParams syncLossParams;
// syncLossParams.m_logCh =
syncLossParams.m_lossReason = MLMESYNCLOSS_BEACON_LOST;
syncLossParams.m_lossReason = LrWpanMacStatus::BEACON_LOSS;
syncLossParams.m_panId = m_macPanId;
m_mlmeSyncLossIndicationCallback(syncLossParams);
@@ -2356,7 +2338,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
MlmeScanConfirmParams confirmParams;
confirmParams.m_scanType = m_scanParams.m_scanType;
confirmParams.m_chPage = m_scanParams.m_chPage;
confirmParams.m_status = MLMESCAN_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmeScanConfirmCallback(confirmParams);
}
m_scanParams = {};
@@ -2436,8 +2418,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
commStatusParams.m_srcExtAddr = macHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = macHdr.GetExtDstAddr();
commStatusParams.m_status =
LrWpanMlmeCommStatus::MLMECOMMSTATUS_SUCCESS;
commStatusParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
// Remove element from Pending Transaction List
@@ -2459,8 +2440,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
if (!m_mlmePollConfirmCallback.IsNull())
{
MlmePollConfirmParams pollConfirmParams;
pollConfirmParams.m_status =
LrWpanMlmePollConfirmStatus::MLMEPOLL_SUCCESS;
pollConfirmParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmePollConfirmCallback(pollConfirmParams);
}
break;
@@ -2478,8 +2458,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
commStatusParams.m_srcExtAddr = macHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = macHdr.GetExtDstAddr();
commStatusParams.m_status =
LrWpanMlmeCommStatus::MLMECOMMSTATUS_SUCCESS;
commStatusParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
}
@@ -2497,7 +2476,7 @@ LrWpanMac::PdDataIndication(uint32_t psduLength, Ptr<Packet> p, uint8_t lqi)
Ptr<TxQueueElement> txQElement = m_txQueue.front();
McpsDataConfirmParams confirmParams;
confirmParams.m_msduHandle = txQElement->txQMsduHandle;
confirmParams.m_status = IEEE_802_15_4_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
m_mcpsDataConfirmCallback(confirmParams);
}
}
@@ -2586,7 +2565,7 @@ LrWpanMac::EnqueueTxQElement(Ptr<TxQueueElement> txQElement)
{
McpsDataConfirmParams confirmParams;
confirmParams.m_msduHandle = txQElement->txQMsduHandle;
confirmParams.m_status = IEEE_802_15_4_TRANSACTION_OVERFLOW;
confirmParams.m_status = LrWpanMacStatus::TRANSACTION_OVERFLOW;
m_mcpsDataConfirmCallback(confirmParams);
}
NS_LOG_DEBUG("TX Queue with size " << m_txQueue.size() << " is full, dropping packet");
@@ -2701,7 +2680,7 @@ LrWpanMac::PrepareRetransmission()
{
MlmeAssociateConfirmParams confirmParams;
confirmParams.m_assocShortAddr = Mac16Address("FF:FF");
confirmParams.m_status = MLMEASSOC_NO_ACK;
confirmParams.m_status = LrWpanMacStatus::NO_ACK;
m_mlmeAssociateConfirmCallback(confirmParams);
}
break;
@@ -2716,7 +2695,7 @@ LrWpanMac::PrepareRetransmission()
commStatusParams.m_srcExtAddr = macHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = macHdr.GetExtDstAddr();
commStatusParams.m_status = LrWpanMlmeCommStatus::MLMECOMMSTATUS_NO_ACK;
commStatusParams.m_status = LrWpanMacStatus::NO_ACK;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
RemovePendTxQElement(m_txPkt->Copy());
@@ -2736,7 +2715,7 @@ LrWpanMac::PrepareRetransmission()
if (!m_mlmePollConfirmCallback.IsNull())
{
MlmePollConfirmParams pollConfirmParams;
pollConfirmParams.m_status = LrWpanMlmePollConfirmStatus::MLMEPOLL_NO_ACK;
pollConfirmParams.m_status = LrWpanMacStatus::NO_ACK;
m_mlmePollConfirmCallback(pollConfirmParams);
}
break;
@@ -2757,7 +2736,7 @@ LrWpanMac::PrepareRetransmission()
{
McpsDataConfirmParams confirmParams;
confirmParams.m_msduHandle = txQElement->txQMsduHandle;
confirmParams.m_status = IEEE_802_15_4_NO_ACK;
confirmParams.m_status = LrWpanMacStatus::NO_ACK;
m_mcpsDataConfirmCallback(confirmParams);
}
}
@@ -2833,7 +2812,7 @@ LrWpanMac::EnqueueInd(Ptr<Packet> p)
commStatusParams.m_srcExtAddr = peekedMacHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = peekedMacHdr.GetExtDstAddr();
commStatusParams.m_status = MLMECOMMSTATUS_TRANSACTION_OVERFLOW;
commStatusParams.m_status = LrWpanMacStatus::TRANSACTION_OVERFLOW;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
m_macIndTxDropTrace(p);
@@ -2880,8 +2859,7 @@ LrWpanMac::PurgeInd()
commStatusParams.m_srcExtAddr = peekedMacHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = peekedMacHdr.GetExtDstAddr();
commStatusParams.m_status =
LrWpanMlmeCommStatus::MLMECOMMSTATUS_TRANSACTION_EXPIRED;
commStatusParams.m_status = LrWpanMacStatus::TRANSACTION_EXPIRED;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
}
@@ -2891,7 +2869,7 @@ LrWpanMac::PurgeInd()
if (!m_mcpsDataConfirmCallback.IsNull())
{
McpsDataConfirmParams confParams;
confParams.m_status = IEEE_802_15_4_TRANSACTION_EXPIRED;
confParams.m_status = LrWpanMacStatus::TRANSACTION_EXPIRED;
m_mcpsDataConfirmCallback(confParams);
}
}
@@ -3055,7 +3033,7 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status)
if (!m_mlmeStartConfirmCallback.IsNull())
{
MlmeStartConfirmParams mlmeConfirmParams;
mlmeConfirmParams.m_status = MLMESTART_SUCCESS;
mlmeConfirmParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmeStartConfirmCallback(mlmeConfirmParams);
}
}
@@ -3105,7 +3083,7 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status)
commStatusParams.m_dstExtAddr = macHdr.GetExtDstAddr();
commStatusParams.m_dstShortAddr = macHdr.GetShortDstAddr();
commStatusParams.m_status = LrWpanMlmeCommStatus::MLMECOMMSTATUS_SUCCESS;
commStatusParams.m_status = LrWpanMacStatus::SUCCESS;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
}
@@ -3123,7 +3101,7 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status)
NS_ASSERT_MSG(!m_txQueue.empty(), "TxQsize = 0");
Ptr<TxQueueElement> txQElement = m_txQueue.front();
confirmParams.m_msduHandle = txQElement->txQMsduHandle;
confirmParams.m_status = IEEE_802_15_4_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
m_mcpsDataConfirmCallback(confirmParams);
}
ifsWaitTime = Seconds(static_cast<double>(GetIfsSize()) / symbolRate);
@@ -3168,20 +3146,18 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status)
{
MlmeAssociateConfirmParams confirmParams;
switch (receivedMacPayload.GetAssociationStatus())
switch (static_cast<LrWpanMacStatus>(receivedMacPayload.GetAssociationStatus()))
{
case CommandPayloadHeader::SUCCESSFUL:
case LrWpanMacStatus::SUCCESS:
// The assigned short address by the coordinator
SetShortAddress(receivedMacPayload.GetShortAddr());
m_macPanId = receivedMacHdr.GetSrcPanId();
confirmParams.m_status =
LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_SUCCESS;
confirmParams.m_status = LrWpanMacStatus::SUCCESS;
confirmParams.m_assocShortAddr = GetShortAddress();
break;
case CommandPayloadHeader::FULL_CAPACITY:
confirmParams.m_status =
LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_FULL_CAPACITY;
case LrWpanMacStatus::FULL_CAPACITY:
confirmParams.m_status = LrWpanMacStatus::FULL_CAPACITY;
m_macPanId = 0xffff;
m_macCoordShortAddress = Mac16Address("FF:FF");
m_macCoordExtendedAddress = Mac64Address("ff:ff:ff:ff:ff:ff:ff:ed");
@@ -3191,9 +3167,9 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status)
m_incomingBeaconOrder = 15;
m_incomingSuperframeOrder = 15;
break;
case CommandPayloadHeader::ACCESS_DENIED:
confirmParams.m_status =
LrWpanMlmeAssociateConfirmStatus::MLMEASSOC_ACCESS_DENIED;
case LrWpanMacStatus::ACCESS_DENIED:
default:
confirmParams.m_status = LrWpanMacStatus::ACCESS_DENIED;
m_macPanId = 0xffff;
m_macCoordShortAddress = Mac16Address("FF:FF");
m_macCoordExtendedAddress = Mac64Address("ff:ff:ff:ff:ff:ff:ff:ed");
@@ -3234,7 +3210,7 @@ LrWpanMac::PdDataConfirm(LrWpanPhyEnumeration status)
{
McpsDataConfirmParams confirmParams;
confirmParams.m_msduHandle = txQElement->txQMsduHandle;
confirmParams.m_status = IEEE_802_15_4_FRAME_TOO_LONG;
confirmParams.m_status = LrWpanMacStatus::FRAME_TOO_LONG;
m_mcpsDataConfirmCallback(confirmParams);
}
RemoveFirstTxQElement();
@@ -3380,7 +3356,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
MlmeScanConfirmParams confirmParams;
confirmParams.m_scanType = m_scanParams.m_scanType;
confirmParams.m_chPage = m_scanParams.m_chPage;
confirmParams.m_status = MLMESCAN_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeScanConfirmCallback(confirmParams);
}
NS_LOG_ERROR(this << "Channel Scan: Invalid channel page");
@@ -3434,7 +3410,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
MlmeScanConfirmParams confirmParams;
confirmParams.m_scanType = m_scanParams.m_scanType;
confirmParams.m_chPage = m_scanParams.m_chPage;
confirmParams.m_status = MLMESCAN_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
if (!m_mlmeScanConfirmCallback.IsNull())
{
m_mlmeScanConfirmCallback(confirmParams);
@@ -3450,7 +3426,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
MlmeScanConfirmParams confirmParams;
confirmParams.m_scanType = m_scanParams.m_scanType;
confirmParams.m_chPage = m_scanParams.m_chPage;
confirmParams.m_status = MLMESCAN_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeScanConfirmCallback(confirmParams);
}
NS_LOG_ERROR("Channel " << m_channelScanIndex
@@ -3472,7 +3448,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
if (!m_mlmeStartConfirmCallback.IsNull())
{
MlmeStartConfirmParams confirmParams;
confirmParams.m_status = MLMESTART_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeStartConfirmCallback(confirmParams);
}
NS_LOG_ERROR("Invalid page parameter in MLME-start");
@@ -3490,7 +3466,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
if (!m_mlmeStartConfirmCallback.IsNull())
{
MlmeStartConfirmParams confirmParams;
confirmParams.m_status = MLMESTART_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeStartConfirmCallback(confirmParams);
}
NS_LOG_ERROR("Invalid channel parameter in MLME-start");
@@ -3521,7 +3497,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
{
MlmeAssociateConfirmParams confirmParams;
confirmParams.m_assocShortAddr = Mac16Address("FF:FF");
confirmParams.m_status = MLMEASSOC_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeAssociateConfirmCallback(confirmParams);
}
NS_LOG_ERROR("Invalid page parameter in MLME-associate");
@@ -3549,7 +3525,7 @@ LrWpanMac::PlmeSetAttributeConfirm(LrWpanPhyEnumeration status, LrWpanPibAttribu
{
MlmeAssociateConfirmParams confirmParams;
confirmParams.m_assocShortAddr = Mac16Address("FF:FF");
confirmParams.m_status = MLMEASSOC_INVALID_PARAMETER;
confirmParams.m_status = LrWpanMacStatus::INVALID_PARAMETER;
m_mlmeAssociateConfirmCallback(confirmParams);
}
NS_LOG_ERROR("Invalid channel parameter in MLME-associate");
@@ -3626,7 +3602,7 @@ LrWpanMac::SetLrWpanMacState(LrWpanMacState macState)
{
MlmeAssociateConfirmParams confirmParams;
confirmParams.m_assocShortAddr = Mac16Address("FF:FF");
confirmParams.m_status = MLMEASSOC_CHANNEL_ACCESS_FAILURE;
confirmParams.m_status = LrWpanMacStatus::CHANNEL_ACCESS_FAILURE;
m_mlmeAssociateConfirmCallback(confirmParams);
}
break;
@@ -3640,8 +3616,7 @@ LrWpanMac::SetLrWpanMacState(LrWpanMacState macState)
commStatusParams.m_srcExtAddr = macHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = macHdr.GetExtDstAddr();
commStatusParams.m_status =
LrWpanMlmeCommStatus::MLMECOMMSTATUS_CHANNEL_ACCESS_FAILURE;
commStatusParams.m_status = LrWpanMacStatus::CHANNEL_ACCESS_FAILURE;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
RemovePendTxQElement(m_txPkt->Copy());
@@ -3660,8 +3635,7 @@ LrWpanMac::SetLrWpanMacState(LrWpanMacState macState)
if (!m_mlmePollConfirmCallback.IsNull())
{
MlmePollConfirmParams pollConfirmParams;
pollConfirmParams.m_status =
LrWpanMlmePollConfirmStatus::MLMEPOLL_CHANNEL_ACCESS_FAILURE;
pollConfirmParams.m_status = LrWpanMacStatus::CHANNEL_ACCESS_FAILURE;
m_mlmePollConfirmCallback(pollConfirmParams);
}
break;
@@ -3675,8 +3649,7 @@ LrWpanMac::SetLrWpanMacState(LrWpanMacState macState)
commStatusParams.m_srcExtAddr = macHdr.GetExtSrcAddr();
commStatusParams.m_dstAddrMode = LrWpanMacHeader::EXTADDR;
commStatusParams.m_dstExtAddr = macHdr.GetExtDstAddr();
commStatusParams.m_status =
LrWpanMlmeCommStatus::MLMECOMMSTATUS_CHANNEL_ACCESS_FAILURE;
commStatusParams.m_status = LrWpanMacStatus::CHANNEL_ACCESS_FAILURE;
m_mlmeCommStatusIndicationCallback(commStatusParams);
}
break;
@@ -3712,7 +3685,7 @@ LrWpanMac::SetLrWpanMacState(LrWpanMacState macState)
{
McpsDataConfirmParams confirmParams;
confirmParams.m_msduHandle = m_txQueue.front()->txQMsduHandle;
confirmParams.m_status = IEEE_802_15_4_CHANNEL_ACCESS_FAILURE;
confirmParams.m_status = LrWpanMacStatus::CHANNEL_ACCESS_FAILURE;
m_mcpsDataConfirmCallback(confirmParams);
}
// remove the copy of the packet that was just sent
@@ -3749,18 +3722,6 @@ LrWpanMac::SetLrWpanMacState(LrWpanMacState macState)
}
}
LrWpanAssociationStatus
LrWpanMac::GetAssociationStatus() const
{
return m_associationStatus;
}
void
LrWpanMac::SetAssociationStatus(LrWpanAssociationStatus status)
{
m_associationStatus = status;
}
void
LrWpanMac::SetTxQMaxSize(uint32_t queueSize)
{

View File

@@ -359,20 +359,6 @@ class LrWpanMac : public LrWpanMacBase
*/
void SetLrWpanMacState(LrWpanMacState macState);
/**
* Get the current association status.
*
* \return current association status
*/
LrWpanAssociationStatus GetAssociationStatus() const;
/**
* Set the current association status.
*
* \param status new association status
*/
void SetAssociationStatus(LrWpanAssociationStatus status);
/**
* Set the max size of the transmit queue.
*
@@ -1160,11 +1146,6 @@ class LrWpanMac : public LrWpanMacBase
*/
TracedValue<SuperframeStatus> m_outSuperframeStatus;
/**
* The current association status of the MAC layer.
*/
LrWpanAssociationStatus m_associationStatus;
/**
* The packet which is currently being sent by the MAC layer.
*/

View File

@@ -103,11 +103,11 @@ TestRxOffWhenIdleAfterCsmaFailure::DataIndication(McpsDataIndicationParams param
void
TestRxOffWhenIdleAfterCsmaFailure::DataConfirm(McpsDataConfirmParams params)
{
if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Success");
}
else if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_CHANNEL_ACCESS_FAILURE)
else if (params.m_status == LrWpanMacStatus::CHANNEL_ACCESS_FAILURE)
{
NS_LOG_DEBUG("LrWpanMcpsDataConfirmStatus = Channel Access Failure");
}
@@ -336,7 +336,7 @@ TestActiveScanPanDescriptors::~TestActiveScanPanDescriptors()
void
TestActiveScanPanDescriptors::ScanConfirm(MlmeScanConfirmParams params)
{
if (params.m_status == MLMESCAN_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
m_panDescriptorList = params.m_panDescList;
}
@@ -573,7 +573,7 @@ TestOrphanScan::~TestOrphanScan()
void
TestOrphanScan::ScanConfirm(MlmeScanConfirmParams params)
{
if (params.m_status == MLMESCAN_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
m_orphanScanSuccess = true;
}

View File

@@ -125,7 +125,7 @@ LrWpanSlottedCsmacaTestCase::TransEndIndication(LrWpanSlottedCsmacaTestCase* tes
{
// In the case of transmissions with the acknowledgment flag activated, the transmission is only
// successful if the acknowledgment was received.
if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
NS_LOG_UNCOND(Simulator::Now().GetSeconds() << "s Transmission successfully sent");
testcase->m_sentTime = Simulator::Now();

View File

@@ -35,7 +35,7 @@ DataSentMacConfirm(Ptr<LrWpanNetDevice> device, McpsDataConfirmParams params)
{
// In the case of transmissions with the Ack flag activated, the transaction is only
// successful if the Ack was received.
if (params.m_status == LrWpanMcpsDataConfirmStatus::IEEE_802_15_4_SUCCESS)
if (params.m_status == LrWpanMacStatus::SUCCESS)
{
std::cout << Simulator::Now().As(Time::S) << " | Node " << device->GetNode()->GetId()
<< " | Transmission successfully sent\n";