diff --git a/configure.ac b/configure.ac
index f577d7e8d..e6cc6e021 100644
--- a/configure.ac
+++ b/configure.ac
@@ -563,6 +563,37 @@ AC_SUBST(OPENTHREAD_ENABLE_JAM_DETECTION)
AM_CONDITIONAL([OPENTHREAD_ENABLE_JAM_DETECTION], [test "${enable_jam_detection}" = "yes"])
AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_JAM_DETECTION],[${OPENTHREAD_ENABLE_JAM_DETECTION}],[Define to 1 if you want to use jam detection feature])
+#
+# MAC Whitelist and Blacklist
+#
+
+AC_ARG_ENABLE(mac_whitelist,
+ [AS_HELP_STRING([--enable-mac-whitelist],[Enable MAC whitelist/blacklist support @<:@default=yes@:>@.])],
+ [
+ case "${enableval}" in
+
+ no|yes)
+ enable_mac_whitelist=${enableval}
+ ;;
+
+ *)
+ AC_MSG_ERROR([Invalid value ${enable_mac_whitelist} for --enable-mac-whitelist])
+ ;;
+ esac
+ ],
+ [enable_mac_whitelist=yes])
+
+if test "$enable_mac_whitelist" = "yes"; then
+ OPENTHREAD_ENABLE_MAC_WHITELIST=1
+else
+ OPENTHREAD_ENABLE_MAC_WHITELIST=0
+fi
+
+AC_MSG_RESULT(${enable_mac_whitelist})
+AC_SUBST(OPENTHREAD_ENABLE_MAC_WHITELIST)
+AM_CONDITIONAL([OPENTHREAD_ENABLE_MAC_WHITELIST], [test "${enable_mac_whitelist}" = "yes"])
+AC_DEFINE_UNQUOTED([OPENTHREAD_ENABLE_MAC_WHITELIST],[${OPENTHREAD_ENABLE_MAC_WHITELIST}],[Define to 1 if you want to use MAC whitelist/blacklist feature])
+
#
# Diagnostics Library
#
@@ -1031,6 +1062,7 @@ AC_MSG_NOTICE([
OpenThread Joiner support : ${enable_joiner}
OpenThread DTLS support : ${enable_dtls}
OpenThread Jam Detection support : ${enable_jam_detection}
+ OpenThread MAC Whitelist support : ${enable_mac_whitelist}
OpenThread Diagnostics support : ${enable_diag}
OpenThread Legacy network support : ${enable_legacy}
OpenThread Cli logging support : ${enable_cli_logging}
diff --git a/etc/visual-studio/libopenthread.vcxproj b/etc/visual-studio/libopenthread.vcxproj
index e2072807f..8c52e33ed 100644
--- a/etc/visual-studio/libopenthread.vcxproj
+++ b/etc/visual-studio/libopenthread.vcxproj
@@ -143,8 +143,12 @@
+
+
+
+
diff --git a/etc/visual-studio/libopenthread.vcxproj.filters b/etc/visual-studio/libopenthread.vcxproj.filters
index c7adf3de2..db7e58b1d 100644
--- a/etc/visual-studio/libopenthread.vcxproj.filters
+++ b/etc/visual-studio/libopenthread.vcxproj.filters
@@ -314,6 +314,12 @@
Header Files\mac
+
+ Header Files\mac
+
+
+ Header Files\mac
+
Header Files\net
@@ -419,6 +425,12 @@
Header Files\mac
+
+ Header Files\mac
+
+
+ Header Files\mac
+
Header Files\meshcop
diff --git a/etc/visual-studio/libopenthread_k.vcxproj b/etc/visual-studio/libopenthread_k.vcxproj
index ece30b5c4..60c367a66 100644
--- a/etc/visual-studio/libopenthread_k.vcxproj
+++ b/etc/visual-studio/libopenthread_k.vcxproj
@@ -155,8 +155,12 @@
+
+
+
+
diff --git a/etc/visual-studio/libopenthread_k.vcxproj.filters b/etc/visual-studio/libopenthread_k.vcxproj.filters
index 876eb819a..58430a0a9 100644
--- a/etc/visual-studio/libopenthread_k.vcxproj.filters
+++ b/etc/visual-studio/libopenthread_k.vcxproj.filters
@@ -308,6 +308,12 @@
Header Files\mac
+
+ Header Files\mac
+
+
+ Header Files\mac
+
Header Files\net
@@ -410,6 +416,12 @@
Header Files\mac
+
+ Header Files\mac
+
+
+ Header Files\mac
+
Header Files\meshcop
diff --git a/include/openthread-windows-config.h b/include/openthread-windows-config.h
index 7599049ef..87b425a7a 100644
--- a/include/openthread-windows-config.h
+++ b/include/openthread-windows-config.h
@@ -50,6 +50,9 @@
/* Define to 1 to enable DHCPv6 SERVER. */
#define OPENTHREAD_ENABLE_DHCP6_SERVER 0
+/* Define to 1 to enable MAC whitelist/blacklist feature. */
+#define OPENTHREAD_ENABLE_MAC_WHITELIST 1
+
/* Name of package */
#define PACKAGE "openthread"
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index 6df8617d3..f2e21f318 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -58,8 +58,6 @@ SOURCES_COMMON = \
crypto/sha256.cpp \
mac/mac.cpp \
mac/mac_frame.cpp \
- mac/mac_whitelist.cpp \
- mac/mac_blacklist.cpp \
meshcop/dataset.cpp \
meshcop/dataset_manager.cpp \
meshcop/tlvs.cpp \
@@ -89,6 +87,13 @@ SOURCES_COMMON = \
utils/slaac_address.cpp \
$(NULL)
+if OPENTHREAD_ENABLE_MAC_WHITELIST
+SOURCES_COMMON += \
+ mac/mac_blacklist.cpp \
+ mac/mac_whitelist.cpp \
+ $(NULL)
+endif # OPENTHREAD_ENABLE_MAC_WHITELIST
+
if OPENTHREAD_ENABLE_COMMISSIONER
SOURCES_COMMON += \
coap/secure_coap_server.cpp \
@@ -180,9 +185,13 @@ noinst_HEADERS = \
crypto/mbedtls.hpp \
crypto/sha256.hpp \
mac/mac.hpp \
+ mac/mac_blacklist.hpp \
+ mac/mac_blacklist_impl.hpp \
+ mac/mac_blacklist_stub.hpp \
mac/mac_frame.hpp \
mac/mac_whitelist.hpp \
- mac/mac_blacklist.hpp \
+ mac/mac_whitelist_impl.hpp \
+ mac/mac_whitelist_stub.hpp \
meshcop/announce_begin_client.hpp \
meshcop/commissioner.hpp \
meshcop/dataset.hpp \
diff --git a/src/core/mac/mac_blacklist.hpp b/src/core/mac/mac_blacklist.hpp
index 92d28b6b7..e9198fcbe 100644
--- a/src/core/mac/mac_blacklist.hpp
+++ b/src/core/mac/mac_blacklist.hpp
@@ -26,136 +26,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/**
- * @file
- * This file includes definitions for IEEE 802.15.4 frame filtering based on MAC address.
- */
+#ifdef OPENTHREAD_CONFIG_FILE
+#include OPENTHREAD_CONFIG_FILE
+#else
+#include
+#endif
-#ifndef MAC_BLACKLIST_HPP_
-#define MAC_BLACKLIST_HPP_
-
-#include
-
-#include
-#include
-
-namespace Thread {
-namespace Mac {
-
-/**
- * @addtogroup core-mac
- *
- * @{
- *
- */
-
-/**
- * This class implements blacklist filtering on IEEE 802.15.4 frames.
- *
- */
-class Blacklist
-{
-public:
- typedef otMacBlacklistEntry Entry;
-
- enum
- {
- kMaxEntries = 32,
- };
-
- /**
- * This constructor initializes the blacklist filter.
- *
- */
- Blacklist(void);
-
- /**
- * This method enables the blacklist filter.
- *
- */
- void Enable(void);
-
- /**
- * This method disables the blacklist filter.
- *
- */
- void Disable(void);
-
- /**
- * This method indicates whether or not the blacklist filter is enabled.
- *
- * @retval TRUE If the blacklist filter is enabled.
- * @retval FALSE If the blacklist filter is disabled.
- *
- */
- bool IsEnabled(void) const;
-
- /**
- * This method returns the maximum number of blacklist entries.
- *
- * @returns The maximum number of blacklist entries.
- *
- */
- int GetMaxEntries(void) const;
-
- /**
- * This method gets a blacklist entry.
- *
- * @param[in] aIndex An index into the MAC blacklist table.
- * @param[out] aEntry A reference to where the information is placed.
- *
- * @retval kThreadError_None Successfully retrieved the MAC blacklist entry.
- * @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
- *
- */
- ThreadError GetEntry(uint8_t aIndex, Entry &aEntry) const;
-
- /**
- * This method adds an Extended Address to the blacklist filter.
- *
- * @param[in] aAddress A reference to the Extended Address.
- *
- * @returns A pointer to the blacklist entry or NULL if there are no available entries.
- *
- */
- Entry *Add(const ExtAddress &aAddress);
-
- /**
- * This method removes an Extended Address to the blacklist filter.
- *
- * @param[in] aAddress A reference to the Extended Address.
- *
- */
- void Remove(const ExtAddress &aAddress);
-
- /**
- * This method removes all entries from the blacklist filter.
- *
- */
- void Clear(void);
-
- /**
- * This method finds a blacklist entry.
- *
- * @param[in] aAddress A reference to the Extended Address.
- *
- * @returns A pointer to the blacklist entry or NULL if the entry could not be found.
- *
- */
- Entry *Find(const ExtAddress &aAddress);
-
-private:
- Entry mBlacklist[kMaxEntries];
-
- bool mEnabled;
-};
-
-/**
- * @}
- *
- */
-
-} // namespace Mac
-} // namespace Thread
-
-#endif // MAC_BLACKLIST_HPP_
+#if OPENTHREAD_ENABLE_MAC_WHITELIST
+#include "mac_blacklist_impl.hpp"
+#else
+#include "mac_blacklist_stub.hpp"
+#endif
diff --git a/src/core/mac/mac_blacklist_impl.hpp b/src/core/mac/mac_blacklist_impl.hpp
new file mode 100644
index 000000000..e1d6d6222
--- /dev/null
+++ b/src/core/mac/mac_blacklist_impl.hpp
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2016, The OpenThread Authors.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * This file includes definitions for IEEE 802.15.4 frame filtering based on MAC address.
+ */
+
+#ifndef MAC_BLACKLIST_HPP_
+#define MAC_BLACKLIST_HPP_
+
+#include
+
+#include
+#include
+
+namespace Thread {
+namespace Mac {
+
+/**
+ * @addtogroup core-mac
+ *
+ * @{
+ *
+ */
+
+/**
+ * This class implements blacklist filtering on IEEE 802.15.4 frames.
+ *
+ */
+class Blacklist
+{
+public:
+ typedef otMacBlacklistEntry Entry;
+
+ enum
+ {
+ kMaxEntries = OPENTHREAD_CONFIG_MAC_BLACKLIST_SIZE,
+ };
+
+ /**
+ * This constructor initializes the blacklist filter.
+ *
+ */
+ Blacklist(void);
+
+ /**
+ * This method enables the blacklist filter.
+ *
+ */
+ void Enable(void);
+
+ /**
+ * This method disables the blacklist filter.
+ *
+ */
+ void Disable(void);
+
+ /**
+ * This method indicates whether or not the blacklist filter is enabled.
+ *
+ * @retval TRUE If the blacklist filter is enabled.
+ * @retval FALSE If the blacklist filter is disabled.
+ *
+ */
+ bool IsEnabled(void) const;
+
+ /**
+ * This method returns the maximum number of blacklist entries.
+ *
+ * @returns The maximum number of blacklist entries.
+ *
+ */
+ int GetMaxEntries(void) const;
+
+ /**
+ * This method gets a blacklist entry.
+ *
+ * @param[in] aIndex An index into the MAC blacklist table.
+ * @param[out] aEntry A reference to where the information is placed.
+ *
+ * @retval kThreadError_None Successfully retrieved the MAC blacklist entry.
+ * @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
+ *
+ */
+ ThreadError GetEntry(uint8_t aIndex, Entry &aEntry) const;
+
+ /**
+ * This method adds an Extended Address to the blacklist filter.
+ *
+ * @param[in] aAddress A reference to the Extended Address.
+ *
+ * @returns A pointer to the blacklist entry or NULL if there are no available entries.
+ *
+ */
+ Entry *Add(const ExtAddress &aAddress);
+
+ /**
+ * This method removes an Extended Address to the blacklist filter.
+ *
+ * @param[in] aAddress A reference to the Extended Address.
+ *
+ */
+ void Remove(const ExtAddress &aAddress);
+
+ /**
+ * This method removes all entries from the blacklist filter.
+ *
+ */
+ void Clear(void);
+
+ /**
+ * This method finds a blacklist entry.
+ *
+ * @param[in] aAddress A reference to the Extended Address.
+ *
+ * @returns A pointer to the blacklist entry or NULL if the entry could not be found.
+ *
+ */
+ Entry *Find(const ExtAddress &aAddress);
+
+private:
+ Entry mBlacklist[kMaxEntries];
+
+ bool mEnabled;
+};
+
+/**
+ * @}
+ *
+ */
+
+} // namespace Mac
+} // namespace Thread
+
+#endif // MAC_BLACKLIST_HPP_
diff --git a/src/core/mac/mac_blacklist_stub.hpp b/src/core/mac/mac_blacklist_stub.hpp
new file mode 100644
index 000000000..58c180500
--- /dev/null
+++ b/src/core/mac/mac_blacklist_stub.hpp
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016, The OpenThread Authors.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * This file includes definitions for IEEE 802.15.4 frame filtering based on MAC address.
+ */
+
+#ifndef MAC_BLACKLIST_HPP_
+#define MAC_BLACKLIST_HPP_
+
+#include
+
+#include
+#include
+
+namespace Thread {
+namespace Mac {
+
+class Blacklist
+{
+public:
+ typedef otMacBlacklistEntry Entry;
+
+ Blacklist(void) { }
+
+ void Enable(void) { }
+
+ void Disable(void) { }
+
+ bool IsEnabled(void) const { return false; }
+
+ int GetMaxEntries(void) const { return 0; }
+
+ ThreadError GetEntry(uint8_t, Entry &) const { return kThreadError_NotImplemented; }
+
+ Entry *Add(const ExtAddress &) { return NULL; }
+
+ void Remove(const ExtAddress &) { }
+
+ void Clear(void) { }
+
+ Entry *Find(const ExtAddress &) { return NULL; }
+};
+
+} // namespace Mac
+} // namespace Thread
+
+#endif // MAC_BLACKLIST_HPP_
diff --git a/src/core/mac/mac_whitelist.hpp b/src/core/mac/mac_whitelist.hpp
index c2188557b..e345419fa 100644
--- a/src/core/mac/mac_whitelist.hpp
+++ b/src/core/mac/mac_whitelist.hpp
@@ -26,165 +26,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/**
- * @file
- * This file includes definitions for IEEE 802.15.4 frame filtering based on MAC address.
- */
+#ifdef OPENTHREAD_CONFIG_FILE
+#include OPENTHREAD_CONFIG_FILE
+#else
+#include
+#endif
-#ifndef MAC_WHITELIST_HPP_
-#define MAC_WHITELIST_HPP_
-
-#include
-
-#include
-#include
-
-namespace Thread {
-namespace Mac {
-
-/**
- * @addtogroup core-mac
- *
- * @{
- *
- */
-
-/**
- * This class implements whitelist filtering on IEEE 802.15.4 frames.
- *
- */
-class Whitelist
-{
-public:
- typedef otMacWhitelistEntry Entry;
-
- enum
- {
- kMaxEntries = 32,
- };
-
- /**
- * This constructor initializes the whitelist filter.
- *
- */
- Whitelist(void);
-
- /**
- * This method enables the whitelist filter.
- *
- */
- void Enable(void);
-
- /**
- * This method disables the whitelist filter.
- *
- */
- void Disable(void);
-
- /**
- * This method indicates whether or not the whitelist filter is enabled.
- *
- * @retval TRUE If the whitelist filter is enabled.
- * @retval FALSE If the whitelist filter is disabled.
- *
- */
- bool IsEnabled(void) const;
-
- /**
- * This method returns the maximum number of whitelist entries.
- *
- * @returns The maximum number of whitelist entries.
- *
- */
- int GetMaxEntries(void) const;
-
- /**
- * This method gets a whitelist entry.
- *
- * @param[in] aIndex An index into the MAC whitelist table.
- * @param[out] aEntry A reference to where the information is placed.
- *
- * @retval kThreadError_None Successfully retrieved the MAC whitelist entry.
- * @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
- *
- */
- ThreadError GetEntry(uint8_t aIndex, Entry &aEntry) const;
-
- /**
- * This method adds an Extended Address to the whitelist filter.
- *
- * @param[in] aAddress A reference to the Extended Address.
- *
- * @returns A pointer to the whitelist entry or NULL if there are no available entries.
- *
- */
- Entry *Add(const ExtAddress &aAddress);
-
- /**
- * This method removes an Extended Address to the whitelist filter.
- *
- * @param[in] aAddress A reference to the Extended Address.
- *
- */
- void Remove(const ExtAddress &aAddress);
-
- /**
- * This method removes all entries from the whitelist filter.
- *
- */
- void Clear(void);
-
- /**
- * This method finds a whitelist entry.
- *
- * @param[in] aAddress A reference to the Extended Address.
- *
- * @returns A pointer to the whitelist entry or NULL if the entry could not be found.
- *
- */
- Entry *Find(const ExtAddress &aAddress);
-
- /**
- * This method clears the fixed RSSI value and uses the measured value provided by the radio instead.
- *
- * @param[in] aEntry A reference to the whitelist entry.
- *
- */
- void ClearFixedRssi(Entry &aEntry);
-
- /**
- * This method indicates whether or not the fixed RSSI is set.
- *
- * @param[in] aEntry A reference to the whitelist entry.
- * @param[out] aRssi A reference to the RSSI variable.
- *
- * @retval kThreadError_None A fixed RSSI is set and written to @p aRssi.
- * @retval kThreadError_InvalidArg A fixed RSSI was not set.
- *
- */
- ThreadError GetFixedRssi(Entry &aEntry, int8_t &aRssi) const;
-
- /**
- * This method sets a fixed RSSI value for all received messages matching @p aEntry.
- *
- * @param[in] aEntry A reference to the whitelist entry.
- * @param[in] aRssi An RSSI value in dBm.
- *
- */
- void SetFixedRssi(Entry &aEntry, int8_t aRssi);
-
-private:
- Entry mWhitelist[kMaxEntries];
-
- bool mEnabled;
-};
-
-/**
- * @}
- *
- */
-
-} // namespace Mac
-} // namespace Thread
-
-#endif // MAC_WHITELIST_HPP_
+#if OPENTHREAD_ENABLE_MAC_WHITELIST
+#include "mac_whitelist_impl.hpp"
+#else
+#include "mac_whitelist_stub.hpp"
+#endif
diff --git a/src/core/mac/mac_whitelist_impl.hpp b/src/core/mac/mac_whitelist_impl.hpp
new file mode 100644
index 000000000..9eb4d75ca
--- /dev/null
+++ b/src/core/mac/mac_whitelist_impl.hpp
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2016, The OpenThread Authors.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * This file includes definitions for IEEE 802.15.4 frame filtering based on MAC address.
+ */
+
+#ifndef MAC_WHITELIST_HPP_
+#define MAC_WHITELIST_HPP_
+
+#include
+
+#include
+#include
+
+namespace Thread {
+namespace Mac {
+
+/**
+ * @addtogroup core-mac
+ *
+ * @{
+ *
+ */
+
+/**
+ * This class implements whitelist filtering on IEEE 802.15.4 frames.
+ *
+ */
+class Whitelist
+{
+public:
+ typedef otMacWhitelistEntry Entry;
+
+ enum
+ {
+ kMaxEntries = OPENTHREAD_CONFIG_MAC_WHITELIST_SIZE,
+ };
+
+ /**
+ * This constructor initializes the whitelist filter.
+ *
+ */
+ Whitelist(void);
+
+ /**
+ * This method enables the whitelist filter.
+ *
+ */
+ void Enable(void);
+
+ /**
+ * This method disables the whitelist filter.
+ *
+ */
+ void Disable(void);
+
+ /**
+ * This method indicates whether or not the whitelist filter is enabled.
+ *
+ * @retval TRUE If the whitelist filter is enabled.
+ * @retval FALSE If the whitelist filter is disabled.
+ *
+ */
+ bool IsEnabled(void) const;
+
+ /**
+ * This method returns the maximum number of whitelist entries.
+ *
+ * @returns The maximum number of whitelist entries.
+ *
+ */
+ int GetMaxEntries(void) const;
+
+ /**
+ * This method gets a whitelist entry.
+ *
+ * @param[in] aIndex An index into the MAC whitelist table.
+ * @param[out] aEntry A reference to where the information is placed.
+ *
+ * @retval kThreadError_None Successfully retrieved the MAC whitelist entry.
+ * @retval kThreadError_InvalidArgs @p aIndex is out of bounds or @p aEntry is NULL.
+ *
+ */
+ ThreadError GetEntry(uint8_t aIndex, Entry &aEntry) const;
+
+ /**
+ * This method adds an Extended Address to the whitelist filter.
+ *
+ * @param[in] aAddress A reference to the Extended Address.
+ *
+ * @returns A pointer to the whitelist entry or NULL if there are no available entries.
+ *
+ */
+ Entry *Add(const ExtAddress &aAddress);
+
+ /**
+ * This method removes an Extended Address to the whitelist filter.
+ *
+ * @param[in] aAddress A reference to the Extended Address.
+ *
+ */
+ void Remove(const ExtAddress &aAddress);
+
+ /**
+ * This method removes all entries from the whitelist filter.
+ *
+ */
+ void Clear(void);
+
+ /**
+ * This method finds a whitelist entry.
+ *
+ * @param[in] aAddress A reference to the Extended Address.
+ *
+ * @returns A pointer to the whitelist entry or NULL if the entry could not be found.
+ *
+ */
+ Entry *Find(const ExtAddress &aAddress);
+
+ /**
+ * This method clears the fixed RSSI value and uses the measured value provided by the radio instead.
+ *
+ * @param[in] aEntry A reference to the whitelist entry.
+ *
+ */
+ void ClearFixedRssi(Entry &aEntry);
+
+ /**
+ * This method indicates whether or not the fixed RSSI is set.
+ *
+ * @param[in] aEntry A reference to the whitelist entry.
+ * @param[out] aRssi A reference to the RSSI variable.
+ *
+ * @retval kThreadError_None A fixed RSSI is set and written to @p aRssi.
+ * @retval kThreadError_InvalidArg A fixed RSSI was not set.
+ *
+ */
+ ThreadError GetFixedRssi(Entry &aEntry, int8_t &aRssi) const;
+
+ /**
+ * This method sets a fixed RSSI value for all received messages matching @p aEntry.
+ *
+ * @param[in] aEntry A reference to the whitelist entry.
+ * @param[in] aRssi An RSSI value in dBm.
+ *
+ */
+ void SetFixedRssi(Entry &aEntry, int8_t aRssi);
+
+private:
+ Entry mWhitelist[kMaxEntries];
+
+ bool mEnabled;
+};
+
+/**
+ * @}
+ *
+ */
+
+} // namespace Mac
+} // namespace Thread
+
+#endif // MAC_WHITELIST_HPP_
diff --git a/src/core/mac/mac_whitelist_stub.hpp b/src/core/mac/mac_whitelist_stub.hpp
new file mode 100644
index 000000000..e68dd703c
--- /dev/null
+++ b/src/core/mac/mac_whitelist_stub.hpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016, The OpenThread Authors.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright holder nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @file
+ * This file includes definitions for IEEE 802.15.4 frame filtering based on MAC address.
+ */
+
+#ifndef MAC_WHITELIST_HPP_
+#define MAC_WHITELIST_HPP_
+
+#include
+
+#include
+#include
+
+namespace Thread {
+namespace Mac {
+
+class Whitelist
+{
+public:
+ typedef otMacWhitelistEntry Entry;
+
+ Whitelist(void) { }
+
+ void Enable(void) { }
+
+ void Disable(void) { }
+
+ bool IsEnabled(void) const { return false; }
+
+ int GetMaxEntries(void) const { return 0; }
+
+ ThreadError GetEntry(uint8_t, Entry &) const { return kThreadError_NotImplemented; }
+
+ Entry *Add(const ExtAddress &) { return NULL; }
+
+ void Remove(const ExtAddress &) { }
+
+ void Clear(void) { }
+
+ Entry *Find(const ExtAddress &) { return NULL; }
+
+ void ClearFixedRssi(Entry &) { }
+
+ ThreadError GetFixedRssi(Entry &, int8_t &) const { return kThreadError_NotImplemented; }
+
+ void SetFixedRssi(Entry &, int8_t) { }
+};
+
+} // namespace Mac
+} // namespace Thread
+
+#endif // MAC_WHITELIST_HPP_
diff --git a/src/core/openthread-core-default-config.h b/src/core/openthread-core-default-config.h
index fad48285a..0692c2af6 100644
--- a/src/core/openthread-core-default-config.h
+++ b/src/core/openthread-core-default-config.h
@@ -269,6 +269,25 @@
#define OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT 0
#endif // OPENTHREAD_CONFIG_PLATFORM_MESSAGE_MANAGEMENT
+/**
+ * @def OPENTHREAD_CONFIG_MAC_BLACKLIST_SIZE
+ *
+ * THe number if MAC blacklist entries.
+ *
+ */
+#ifndef OPENTHREAD_CONFIG_MAC_BLACKLIST_SIZE
+#define OPENTHREAD_CONFIG_MAC_BLACKLIST_SIZE 32
+#endif // OPENTHREAD_CONFIG_MAC_BLACKLIST_SIZE
+
+/**
+ * @def OPENTHREAD_CONFIG_MAC_WHITELIST_SIZE
+ *
+ * THe number if MAC whitelist entries.
+ *
+ */
+#ifndef OPENTHREAD_CONFIG_MAC_WHITELIST_SIZE
+#define OPENTHREAD_CONFIG_MAC_WHITELIST_SIZE 32
+#endif // OPENTHREAD_CONFIG_MAC_WHITELIST_SIZE
/**
* @def OPENTHREAD_CONFIG_LOG_LEVEL