[message] add API functions to enable multicast looping of a message (#9524)

At the moment, C API does not allow to get/set the configuration flag
which the message to be looped back to the Thread interface. It is
important within the context of sending already prepared IPv6 mutlicast
packets with `otIp6Send()`.
This commit is contained in:
Konrad Derda
2023-11-20 19:22:19 -08:00
committed by GitHub
parent 9165bc62d7
commit 30c94db4a4
3 changed files with 30 additions and 1 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 (375)
#define OPENTHREAD_API_VERSION (376)
/**
* @addtogroup api-instance
+22
View File
@@ -211,6 +211,28 @@ bool otMessageIsLoopbackToHostAllowed(const otMessage *aMessage);
*/
void otMessageSetLoopbackToHostAllowed(otMessage *aMessage, bool aAllowLoopbackToHost);
/**
* Indicates whether the given message may be looped back in a case of a multicast destination address.
*
* If @p aMessage is used along with an `otMessageInfo`, the `mMulticastLoop` field from `otMessageInfo` structure
* takes precedence and will be used instead of the the value set on @p aMessage.
*
* This API is mainly intended for use along with `otIp6Send()` which expects an already prepared IPv6 message.
*
* @param[in] aMessage A pointer to the message.
*
*/
bool otMessageIsMulticastLoopEnabled(otMessage *aMessage);
/**
* Controls whether the given message may be looped back in a case of a multicast destination address.
*
* @param[in] aMessage A pointer to the message.
* @param[in] aEnabled The configuration value.
*
*/
void otMessageSetMulticastLoopEnabled(otMessage *aMessage, bool aEnabled);
/**
* Gets the message origin.
*
+7
View File
@@ -62,6 +62,13 @@ void otMessageSetLoopbackToHostAllowed(otMessage *aMessage, bool aAllowLoopbackT
return AsCoreType(aMessage).SetLoopbackToHostAllowed(aAllowLoopbackToHost);
}
bool otMessageIsMulticastLoopEnabled(otMessage *aMessage) { return AsCoreType(aMessage).GetMulticastLoop(); }
void otMessageSetMulticastLoopEnabled(otMessage *aMessage, bool aEnabled)
{
AsCoreType(aMessage).SetMulticastLoop(aEnabled);
}
otMessageOrigin otMessageGetOrigin(const otMessage *aMessage) { return MapEnum(AsCoreType(aMessage).GetOrigin()); }
void otMessageSetOrigin(otMessage *aMessage, otMessageOrigin aOrigin)