[mle] add discovery request callback (#5131)

This commit allows notifying the application a discovery request is
received, which is useful if the application wants to be more active
when a joiner comes.
This commit is contained in:
Yakun Xu
2020-08-11 10:22:10 -07:00
committed by GitHub
parent 644e0a30f7
commit 66dcbac15d
9 changed files with 124 additions and 15 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ extern "C" {
* @note This number versions both OpenThread platform and user APIs.
*
*/
#define OPENTHREAD_API_VERSION (22)
#define OPENTHREAD_API_VERSION (23)
/**
* @addtogroup api-instance
+31
View File
@@ -805,6 +805,37 @@ void otThreadRegisterParentResponseCallback(otInstance * aInst
otThreadParentResponseCallback aCallback,
void * aContext);
/**
* This structure represents the Thread Discovery Request data.
*
*/
typedef struct otThreadDiscoveryRequestInfo
{
otExtAddress mExtAddress; ///< IEEE 802.15.4 Extended Address of the requester
uint8_t mVersion : 4; ///< Thread version.
bool mIsJoiner : 1; ///< Whether is from joiner.
} otThreadDiscoveryRequestInfo;
/**
* This function pointer is called every time an MLE Discovery Request message is received.
*
* @param[in] aInfo A pointer to the Discovery Request info data.
* @param[in] aContext A pointer to callback application-specific context.
*
*/
typedef void (*otThreadDiscoveryRequestCallback)(const otThreadDiscoveryRequestInfo *aInfo, void *aContext);
/**
* This function sets a callback to receive MLE Discovery Request data.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aCallback A pointer to a function that is called upon receiving an MLE Discovery Request message.
* @param[in] aContext A pointer to callback application-specific context.
*
*/
void otThreadSetDiscoveryRequestCallback(otInstance * aInstnace,
otThreadDiscoveryRequestCallback aCallback,
void * aContext);
/**
* @}
*