From b1baa7da52a9f913304de21ec7748a812edb1ae3 Mon Sep 17 00:00:00 2001 From: rongli Date: Sat, 14 Oct 2017 00:33:23 +0800 Subject: [PATCH] [mac] rename mRxWhitelistFiltered to mRxAddressFiltered (#2263) --- examples/drivers/windows/otApi/otApi.cpp | 8 ++------ include/openthread/types.h | 11 +++-------- src/cli/README.md | 2 +- src/cli/cli.cpp | 2 +- src/core/common/logging.cpp | 8 ++------ src/core/mac/mac.cpp | 8 ++++---- src/core/mac/mac_filter.cpp | 4 ++-- src/core/mac/mac_filter.hpp | 3 +-- src/ncp/ncp_base_mtd.cpp | 2 +- 9 files changed, 17 insertions(+), 31 deletions(-) diff --git a/examples/drivers/windows/otApi/otApi.cpp b/examples/drivers/windows/otApi/otApi.cpp index 7d7675e02..e30390ff2 100644 --- a/examples/drivers/windows/otApi/otApi.cpp +++ b/examples/drivers/windows/otApi/otApi.cpp @@ -3510,8 +3510,8 @@ otThreadErrorToString( retval = "InvalidSourceAddress"; break; - case OT_ERROR_WHITELIST_FILTERED: - retval = "WhitelistFiltered"; + case OT_ERROR_ADDRESS_FILTERED: + retval = "AddressFiltered"; break; case OT_ERROR_DESTINATION_ADDRESS_FILTERED: @@ -3526,10 +3526,6 @@ otThreadErrorToString( retval = "Already"; break; - case OT_ERROR_BLACKLIST_FILTERED: - retval = "BlacklistFiltered"; - break; - case OT_ERROR_IP6_ADDRESS_CREATION_FAILURE: retval = "Ipv6AddressCreationFailure"; break; diff --git a/include/openthread/types.h b/include/openthread/types.h index fae567c68..1d1875801 100644 --- a/include/openthread/types.h +++ b/include/openthread/types.h @@ -203,9 +203,9 @@ typedef enum otError OT_ERROR_INVALID_SOURCE_ADDRESS = 20, /** - * Received a frame filtered by the whitelist. + * Received a frame filtered by the address filter (whitelisted or blacklisted). */ - OT_ERROR_WHITELIST_FILTERED = 21, + OT_ERROR_ADDRESS_FILTERED = 21, /** * Received a frame filtered by the destination address check. @@ -222,11 +222,6 @@ typedef enum otError */ OT_ERROR_ALREADY = 24, - /** - * Received a frame filtered by the blacklist. - */ - OT_ERROR_BLACKLIST_FILTERED = 25, - /** * The creation of IPv6 address failed. */ @@ -962,7 +957,7 @@ typedef struct otMacCounters uint32_t mRxBeacon; ///< The number of received beacon. uint32_t mRxBeaconRequest; ///< The number of received beacon request. uint32_t mRxOther; ///< The number of received other types of frames. - uint32_t mRxWhitelistFiltered; ///< The number of received packets filtered by whitelist. + uint32_t mRxAddressFiltered; ///< The number of received packets filtered by address filter (whitelist or blacklist). uint32_t mRxDestAddrFiltered; ///< The number of received packets filtered by destination check. uint32_t mRxDuplicated; ///< The number of received duplicated packets. uint32_t mRxErrNoFrame; ///< The number of received packets that do not contain contents. diff --git a/src/cli/README.md b/src/cli/README.md index 04d0cdca6..53924c1a9 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -427,7 +427,7 @@ RxTotal: 2 RxBeacon: 0 RxBeaconRequest: 0 RxOther: 0 - RxWhitelistFiltered: 0 + RxAddressFiltered: 0 RxDestAddrFiltered: 0 RxDuplicated: 0 RxErrNoFrame: 0 diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 721612e27..e3f3be8c8 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -688,7 +688,7 @@ void Interpreter::ProcessCounters(int argc, char *argv[]) mServer->OutputFormat(" RxBeacon: %d\r\n", counters->mRxBeacon); mServer->OutputFormat(" RxBeaconRequest: %d\r\n", counters->mRxBeaconRequest); mServer->OutputFormat(" RxOther: %d\r\n", counters->mRxOther); - mServer->OutputFormat(" RxWhitelistFiltered: %d\r\n", counters->mRxWhitelistFiltered); + mServer->OutputFormat(" RxAddressFiltered: %d\r\n", counters->mRxAddressFiltered); mServer->OutputFormat(" RxDestAddrFiltered: %d\r\n", counters->mRxDestAddrFiltered); mServer->OutputFormat(" RxDuplicated: %d\r\n", counters->mRxDuplicated); mServer->OutputFormat(" RxErrNoFrame: %d\r\n", counters->mRxErrNoFrame); diff --git a/src/core/common/logging.cpp b/src/core/common/logging.cpp index 470912a09..c2f0a4107 100644 --- a/src/core/common/logging.cpp +++ b/src/core/common/logging.cpp @@ -358,8 +358,8 @@ const char *otThreadErrorToString(otError aError) retval = "InvalidSourceAddress"; break; - case OT_ERROR_WHITELIST_FILTERED: - retval = "WhitelistFiltered"; + case OT_ERROR_ADDRESS_FILTERED: + retval = "AddressFiltered"; break; case OT_ERROR_DESTINATION_ADDRESS_FILTERED: @@ -374,10 +374,6 @@ const char *otThreadErrorToString(otError aError) retval = "Already"; break; - case OT_ERROR_BLACKLIST_FILTERED: - retval = "BlacklistFiltered"; - break; - case OT_ERROR_IP6_ADDRESS_CREATION_FAILURE: retval = "Ipv6AddressCreationFailure"; break; diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index ccaeee1a8..2714c45c5 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -1795,8 +1795,8 @@ exit: mCounters.mRxErrInvalidSrcAddr++; break; - case OT_ERROR_WHITELIST_FILTERED: - mCounters.mRxWhitelistFiltered++; + case OT_ERROR_ADDRESS_FILTERED: + mCounters.mRxAddressFiltered++; break; case OT_ERROR_DESTINATION_ADDRESS_FILTERED: @@ -1893,10 +1893,10 @@ void Mac::FillMacCountersTlv(NetworkDiagnostic::MacCountersTlv &aMacCounters) co aMacCounters.SetIfOutErrors(mCounters.mTxErrCca); aMacCounters.SetIfInUcastPkts(mCounters.mRxUnicast); aMacCounters.SetIfInBroadcastPkts(mCounters.mRxBroadcast); - aMacCounters.SetIfInDiscards(mCounters.mRxWhitelistFiltered + mCounters.mRxDestAddrFiltered + mCounters.mRxDuplicated); + aMacCounters.SetIfInDiscards(mCounters.mRxAddressFiltered + mCounters.mRxDestAddrFiltered + mCounters.mRxDuplicated); aMacCounters.SetIfOutUcastPkts(mCounters.mTxUnicast); aMacCounters.SetIfOutBroadcastPkts(mCounters.mTxBroadcast); - aMacCounters.SetIfOutDiscards(0); + aMacCounters.SetIfOutDiscards(mCounters.mTxErrBusyChannel); } void Mac::ResetCounters(void) diff --git a/src/core/mac/mac_filter.cpp b/src/core/mac/mac_filter.cpp index aa31bfcc3..38efa8d97 100644 --- a/src/core/mac/mac_filter.cpp +++ b/src/core/mac/mac_filter.cpp @@ -268,11 +268,11 @@ otError Filter::Apply(const ExtAddress &aExtAddress, int8_t &aRss) // check AddressFilter. if (mAddressMode == OT_MAC_FILTER_ADDRESS_MODE_WHITELIST) { - VerifyOrExit(entry != NULL && entry->mFiltered, error = OT_ERROR_WHITELIST_FILTERED); + VerifyOrExit(entry != NULL && entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED); } else if (mAddressMode == OT_MAC_FILTER_ADDRESS_MODE_BLACKLIST) { - VerifyOrExit(entry == NULL || !entry->mFiltered, error = OT_ERROR_BLACKLIST_FILTERED); + VerifyOrExit(entry == NULL || !entry->mFiltered, error = OT_ERROR_ADDRESS_FILTERED); } // not override the default RssIn setting if no specific RssIn on the Extended Address. diff --git a/src/core/mac/mac_filter.hpp b/src/core/mac/mac_filter.hpp index 0d84848f9..ec7753036 100644 --- a/src/core/mac/mac_filter.hpp +++ b/src/core/mac/mac_filter.hpp @@ -197,8 +197,7 @@ public: * @param[out] aRss A reference to where the received signal strength to be placed. * * @retval OT_ERROR_NONE Successfully applied the filter rules on @p aExtAddress. - * @retval OT_ERROR_WHITELIST_FILTERED Whitelist is enabled and @p aExtAddress is not in the whitelist - * @retval OT_ERROR_BLACKLIST_FILTERED Blacklist is enabled and @p aExtAddress is in the blacklist + * @retval OT_ERROR_ADDRESS_FILTERED Address filter (whitelist or blacklist) is enabled and @p aExtAddress is filtered. * */ otError Apply(const ExtAddress &aExtAddress, int8_t &aRss); diff --git a/src/ncp/ncp_base_mtd.cpp b/src/ncp/ncp_base_mtd.cpp index 2188441c5..0930f3750 100644 --- a/src/ncp/ncp_base_mtd.cpp +++ b/src/ncp/ncp_base_mtd.cpp @@ -1443,7 +1443,7 @@ otError NcpBase::GetPropertyHandler_CNTR_RX_PKT_OTHER(void) otError NcpBase::GetPropertyHandler_CNTR_RX_PKT_FILT_WL(void) { - return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxWhitelistFiltered); + return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxAddressFiltered); } otError NcpBase::GetPropertyHandler_CNTR_RX_PKT_FILT_DA(void)