Remove Preferred and Valid Lifetimes from otNetifAddress. (#1110)

- Replace Preferred and Valid Lifetimes with a flag.
- Introduce new otDhcpAddress type for maintaining Preferred and Valid Lifetimes.
- Reduces RAM usage by 128 bytes.
This commit is contained in:
Jonathan Hui
2017-01-04 13:37:25 -08:00
committed by GitHub
parent 85ee5e6493
commit d61b878d34
17 changed files with 90 additions and 66 deletions
+14 -1
View File
@@ -35,6 +35,8 @@
#ifndef OPENTHREAD_DHCP6_CLIENT_H_
#define OPENTHREAD_DHCP6_CLIENT_H_
#include <openthread-types.h>
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,6 +48,17 @@ extern "C" {
*
*/
/**
* This structure represents a DHCPv6 address.
*
*/
typedef struct otDhcpAddress
{
otNetifAddress mAddress; ///< The network interface address.
uint32_t mPreferredLifetime; ///< The preferred lifetime.
uint32_t mValidLifetime; ///< The valid lifetime.
} otDhcpAddress;
/**
* Update all automatically created IPv6 addresses for prefixes from current Network Data with DHCP procedure.
*
@@ -55,7 +68,7 @@ extern "C" {
* @param[in] aContext A pointer to data passed to aIidCreate function.
*
*/
void otDhcp6ClientUpdate(otInstance *aInstance, otNetifAddress *aAddresses, uint32_t aNumAddresses, void *aContext);
void otDhcp6ClientUpdate(otInstance *aInstance, otDhcpAddress *aAddresses, uint32_t aNumAddresses, void *aContext);
/**
* @}
+3 -3
View File
@@ -900,11 +900,11 @@ typedef struct otBufferInfo
typedef struct otNetifAddress
{
otIp6Address mAddress; ///< The IPv6 unicast address.
uint32_t mPreferredLifetime; ///< The Preferred Lifetime.
uint32_t mValidLifetime; ///< The Valid lifetime.
uint8_t mPrefixLength; ///< The Prefix length.
unsigned int mScopeOverride : 4; ///< The IPv6 scope of this address.
bool mPreferred : 1; ///< TRUE if the address is preferred, FALSE otherwise.
bool mValid : 1; ///< TRUE if the address is valid, FALSE otherwise.
bool mScopeOverrideValid : 1; ///< TRUE if the mScopeOverride value is valid, FALSE othewrise.
unsigned int mScopeOverride : 4; ///< The IPv6 scope of this address.
struct otNetifAddress *mNext; ///< A pointer to the next network interface address.
} otNetifAddress;