otAddUnicastAddress Doesn't Hold onto External Pointers (#504)

* Modify ot*UnicastAddress functions to use internal memory instead of holding onto an external memory address.
This commit is contained in:
Nick Banks
2016-09-02 16:17:08 -07:00
committed by Jonathan Hui
parent 73060ae8e1
commit 511ade5293
9 changed files with 190 additions and 107 deletions
+11 -10
View File
@@ -651,26 +651,27 @@ const otNetifAddress *otGetUnicastAddresses(void);
/**
* Add a Network Interface Address to the Thread interface.
*
* The passed in instance @p aAddress will be added and stored by the Thread interface, so the caller should ensure
* that the address instance remains valid (not de-alloacted) and is not modified after a successful call to this
* method.
* The passed in instance @p aAddress will be copied by the Thread interface. The Thread interface only
* supports a fixed number of externally added unicast addresses. See OPENTHREAD_CONFIG_MAX_EXT_IP_ADDRS.
*
* @param[in] aAddress A pointer to a Network Interface Address.
*
* @retval kThreadErrorNone Successfully added the Network Interface Address.
* @retval kThreadErrorBusy The Network Interface Address pointed to by @p aAddress is already added.
* @retval kThreadErrorNone Successfully added (or updated) the Network Interface Address.
* @retval kThreadError_InvalidArgs The IP Address indicated by @p aAddress is an internal address.
* @retval kThreadError_NoBufs The Network Interface is already storing the maximum allowed external addresses.
*/
ThreadError otAddUnicastAddress(otNetifAddress *aAddress);
ThreadError otAddUnicastAddress(const otNetifAddress *aAddress);
/**
* Remove a Network Interface Address from the Thread interface.
*
* @param[in] aAddress A pointer to a Network Interface Address.
* @param[in] aAddress A pointer to an IP Address.
*
* @retval kThreadErrorNone Successfully removed the Network Interface Address.
* @retval kThreadErrorNotFound The Network Interface Address point to by @p aAddress was not added.
* @retval kThreadErrorNone Successfully removed the Network Interface 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 otRemoveUnicastAddress(otNetifAddress *aAddress);
ThreadError otRemoveUnicastAddress(const otIp6Address *aAddress);
/**
* This function pointer is called to notify certain configuration or state changes within OpenThread.