IP: Add API to subscribe/unsubscribe to multicast addresses. (#899)

* IP: Add API to subscribe/unsubscribe to multicast addresses.

* CLI: Add commands to handle multicast addresses.
This commit is contained in:
Łukasz Duda
2016-11-02 11:24:35 -07:00
committed by Jonathan Hui
parent 30c9dfc0bc
commit bb97cbee17
10 changed files with 499 additions and 24 deletions
+12 -2
View File
@@ -841,18 +841,28 @@ typedef struct otMacCounters
*/
/**
* This structure represents an IPv6 network interface address.
* This structure represents an IPv6 network interface unicast address.
*
*/
typedef struct otNetifAddress
{
otIp6Address mAddress; ///< The IPv6 address.
otIp6Address mAddress; ///< The IPv6 unicast address.
uint32_t mPreferredLifetime; ///< The Preferred Lifetime.
uint32_t mValidLifetime; ///< The Valid lifetime.
uint8_t mPrefixLength; ///< The Prefix length.
struct otNetifAddress *mNext; ///< A pointer to the next network interface address.
} otNetifAddress;
/**
* This structure represents an IPv6 network interface multicast address.
*
*/
typedef struct otNetifMulticastAddress
{
otIp6Address mAddress; ///< The IPv6 multicast address.
struct otNetifMulticastAddress *mNext; ///< A pointer to the next network interface multicast address.
} otNetifMulticastAddress;
/**
* This enumeration represents the list of allowable values for an InterfaceId.
*/
+66
View File
@@ -790,6 +790,72 @@ ThreadError otAddUnicastAddress(otInstance *aInstance, const otNetifAddress *aAd
*/
ThreadError otRemoveUnicastAddress(otInstance *aInstance, const otIp6Address *aAddress);
/**
* Get the list of IPv6 multicast addresses subscribed to the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @returns A pointer to the first Network Interface Multicast Address.
*/
const otNetifMulticastAddress *otGetMulticastAddresses(otInstance *aInstance);
/**
* Subscribe the Thread interface to a Network Interface Multicast Address.
*
* The passed in instance @p aAddress will be copied by the Thread interface. The Thread interface only
* supports a fixed number of externally added multicast addresses. See OPENTHREAD_CONFIG_MAX_EXT_MULTICAST_IP_ADDRS.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aAddress A pointer to an IP Address.
*
* @retval kThreadErrorNone Successfully subscribed to the Network Interface Multicast Address.
* @retval kThreadError_InvalidArgs The IP Address indicated by @p aAddress is invalid address.
* @retval kThreadError_NoBufs The Network Interface is already storing the maximum allowed external multicast addresses.
*/
ThreadError otSubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress);
/**
* Unsubscribe the Thread interface to a Network Interface Multicast Address.
*
* @param[in] aInstance A pointer to an OpenThread instance.
* @param[in] aAddress A pointer to an IP Address.
*
* @retval kThreadErrorNone Successfully unsubscribed to the Network Interface Multicast Address.
* @retval kThreadError_InvalidArgs The IP Address indicated by @p aAddress is an internal address.
* @retval kThreadError_NotFound The IP Address indicated by @p aAddress was not found.
*/
ThreadError otUnsubscribeMulticastAddress(otInstance *aInstance, const otIp6Address *aAddress);
/**
* Check if multicast promiscuous mode is enabled on the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @sa otEnableMulticastPromiscuousMode
* @sa otDisableMulticastPromiscuousMode
*/
bool otIsMulticastPromiscuousModeEnabled(otInstance *aInstance);
/**
* Enable multicast promiscuous mode on the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @sa otIsMulticastPromiscuousModeEnabled
* @sa otDisableMulticastPromiscuousMode
*/
void otEnableMulticastPromiscuousMode(otInstance *aInstance);
/**
* Disable multicast promiscuous mode on the Thread interface.
*
* @param[in] aInstance A pointer to an OpenThread instance.
*
* @sa otIsMulticastPromiscuousModeEnabled
* @sa otEnableMulticastPromiscuousMode
*/
void otDisableMulticastPromiscuousMode(otInstance *aInstance);
/**
* This function pointer is called to create IPv6 IID during SLAAC procedure.
*