[config] announce sender (#4020)

This commit is contained in:
Jonathan Hui
2019-07-31 14:16:30 -07:00
parent d823575caf
commit 0ded98b011
9 changed files with 94 additions and 53 deletions
+1 -1
View File
@@ -402,7 +402,7 @@ build_samr21() {
--disable-tests || die
make -j 8 || die
export CPPFLAGS="-DOPENTHREAD_CONFIG_ENABLE_TIME_SYNC=1 -DOPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER=1"
export CPPFLAGS="-DOPENTHREAD_CONFIG_ENABLE_TIME_SYNC=1 -DOPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE=1"
git checkout -- . || die
git clean -xfd || die
+1
View File
@@ -318,6 +318,7 @@ HEADERS_COMMON = \
common/timer.hpp \
common/tlvs.hpp \
common/trickle_timer.hpp \
config/announce_sender.h \
config/openthread-core-config-check.h \
config/openthread-core-default-config.h \
crypto/aes_ccm.hpp \
+1 -1
View File
@@ -83,7 +83,7 @@ Instance::Instance(void)
#if OPENTHREAD_ENABLE_CHANNEL_MANAGER
, mChannelManager(*this)
#endif
#if OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#if OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
, mAnnounceSender(*this)
#endif
#endif // OPENTHREAD_MTD || OPENTHREAD_FTD
+2 -2
View File
@@ -355,7 +355,7 @@ private:
Utils::ChannelManager mChannelManager;
#endif
#if OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#if OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
AnnounceSender mAnnounceSender;
#endif
@@ -664,7 +664,7 @@ template <> inline MeshCoP::BorderAgent &Instance::Get(void)
}
#endif
#if OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#if OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
template <> inline AnnounceSender &Instance::Get(void)
{
return mAnnounceSender;
+83
View File
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2019, 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 compile-time configurations for the DNS Client.
*
*/
#ifndef CONFIG_ANNOUNCE_SENDER_H_
#define CONFIG_ANNOUNCE_SENDER_H_
/**
* @def OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
*
* Define as 1 to enable `AnnounceSender` which will periodically send MLE Announce message on all channels.
*
* The list of channels is determined from the Operational Dataset's ChannelMask. The period intervals are determined
* by `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER` and `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED`
* configuration options.
*
*/
#ifndef OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
#define OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE 0
#endif
/**
* @def OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER
*
* Specifies the time interval (in milliseconds) between `AnnounceSender` transmit cycles on a device in Router role.
*
* In a cycle, the `AnnounceSender` sends MLE Announcement on all channels in Active Operational Dataset's ChannelMask.
* The transmissions on different channels happen uniformly over the given interval (i.e., if there are 16 channels,
* there will be 16 MLE Announcement messages each on one channel with `interval / 16` between two consecutive MLE
* Announcement transmissions).
*
* Applicable only if `AnnounceSender` feature is enabled (see `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE`).
*
*/
#ifndef OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER
#define OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER 688000 // 668 seconds = 11 min and 28 sec.
#endif
/**
* @def OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED
*
* Specifies the time interval (in milliseconds) between `AnnounceSender` transmit cycles on a device in REED role.
*
* This is similar to `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER` but used when device is in REED role.
*
* Applicable only if `AnnounceSender` feature is enabled (see `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE`).
*
*/
#ifndef OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED
#define OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED (668000 * 3)
#endif
#endif // CONFIG_ANNOUNCE_SENDER_H_
@@ -1528,51 +1528,6 @@
#define OPENTHREAD_CONFIG_SEND_UNICAST_ANNOUNCE_RESPONSE 1
#endif
/**
* @def OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
*
* Define as 1 to enable `AnnounceSender` which will periodically send MLE Announce message on all channels.
*
* The list of channels is determined from the Operational Dataset's ChannelMask. The period intervals are determined
* by `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER` and `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED`
* configuration options.
*
*/
#ifndef OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#define OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER 0
#endif
/**
* @def OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER
*
* Specifies the time interval (in milliseconds) between `AnnounceSender` transmit cycles on a device in Router role.
*
* In a cycle, the `AnnounceSender` sends MLE Announcement on all channels in Active Operational Dataset's ChannelMask.
* The transmissions on different channels happen uniformly over the given interval (i.e., if there are 16 channels,
* there will be 16 MLE Announcement messages each on one channel with `interval / 16` between two consecutive MLE
* Announcement transmissions).
*
* Applicable only if `AnnounceSender` feature is enabled (see `OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER`).
*
*/
#ifndef OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER
#define OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER 688000 // 668 seconds = 11 min and 28 sec.
#endif
/**
* @def OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED
*
* Specifies the time interval (in milliseconds) between `AnnounceSender` transmit cycles on a device in REED role.
*
* This is similar to `OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_ROUTER` but used when device is in REED role.
*
* Applicable only if `AnnounceSender` feature is enabled (see `OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER`).
*
*/
#ifndef OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED
#define OPENTHREAD_CONFIG_ANNOUNCE_SENDER_INTERVAL_REED (668000 * 3)
#endif
/**
* @def OPENTHREAD_CONFIG_NCP_ENABLE_PEEK_POKE
*
+2
View File
@@ -44,6 +44,8 @@
#include "config/openthread-core-default-config.h"
#include "config/announce_sender.h"
#if OPENTHREAD_ENABLE_APPLICATION_COAP_SECURE || OPENTHREAD_ENABLE_BORDER_AGENT || OPENTHREAD_ENABLE_COMMISSIONER || \
OPENTHREAD_ENABLE_JOINER
#define OPENTHREAD_CONFIG_DTLS_ENABLE 1
+2 -2
View File
@@ -110,7 +110,7 @@ exit:
return;
}
#if OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#if OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
AnnounceSender::AnnounceSender(Instance &aInstance)
: AnnounceSenderBase(aInstance, &AnnounceSender::HandleTimer)
@@ -191,6 +191,6 @@ void AnnounceSender::HandleStateChanged(otChangedFlags aFlags)
}
}
#endif // OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#endif // OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
} // namespace ot
+2 -2
View File
@@ -130,7 +130,7 @@ private:
TimerMilli mTimer;
};
#if OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#if OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
/**
* This class implements an AnnounceSender.
@@ -165,7 +165,7 @@ private:
Notifier::Callback mNotifierCallback;
};
#endif // OPENTHREAD_CONFIG_ENABLE_ANNOUNCE_SENDER
#endif // OPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE
/**
* @}