Add support for PSKc TLV and Security Policy TLV (#558)

* Add support for PSKc TLV and Security Policy TLV
This commit is contained in:
Lu Wang
2016-09-12 08:42:29 -07:00
committed by Jonathan Hui
parent 70e9f76623
commit 7a807e99fa
5 changed files with 187 additions and 5 deletions
+38
View File
@@ -175,6 +175,40 @@ typedef struct otMeshLocalPrefix
uint8_t m8[OT_MESH_LOCAL_PREFIX_SIZE];
} otMeshLocalPrefix;
#define OT_PSKC_MAX_SIZE 16 ///< Maximum size of the PSKc (bytes)
/**
* This structure represents PSKc.
*
*/
typedef struct otPSKc
{
uint8_t m8[OT_PSKC_MAX_SIZE];
} otPSKc;
/**
* This structure represent Security Policy.
*
*/
typedef struct otSecurityPolicy
{
uint16_t mRotationTime;
uint8_t mFlags;
} otSecurityPolicy;
/**
* This enumeration represents flags that indicate security related behaviours within OpenThread.
*
*/
enum
{
OT_SECURITY_POLICY_OBTAIN_MASTER_KEY = 1 << 7, ///< Obtaining the Master Key
OT_SECURITY_POLICY_NATIVE_COMMISSIONING = 1 << 6, ///< Native Commissioning
OT_SECURITY_POLICY_ROUTERS = 1 << 5, ///< Routers enabled
OT_SECURITY_POLICY_EXTERNAL_COMMISSIONER = 1 << 4, ///< External Commissioner allowed
OT_SECURITY_POLICY_BEACONS = 1 << 3, ///< Beacons enabled
};
/**
* This type represents the IEEE 802.15.4 PAN ID.
*
@@ -309,6 +343,8 @@ typedef struct otOperationalDataset
uint32_t mDelay; ///< Delay Timer
otPanId mPanId; ///< PAN ID
uint16_t mChannel; ///< Channel
otPSKc mPSKc; ///< PSKc
otSecurityPolicy mSecurityPolicy; ///< Security Policy
bool mIsActiveTimestampSet : 1; ///< TRUE if Active Timestamp is set, FALSE otherwise.
bool mIsPendingTimestampSet : 1; ///< TRUE if Pending Timestamp is set, FALSE otherwise.
@@ -319,6 +355,8 @@ typedef struct otOperationalDataset
bool mIsDelaySet : 1; ///< TRUE if Delay Timer is set, FALSE otherwise.
bool mIsPanIdSet : 1; ///< TRUE if PAN ID is set, FALSE otherwise.
bool mIsChannelSet : 1; ///< TRUE if Channel is set, FALSE otherwise.
bool mIsPSKcSet : 1; ///< TRUE if PSKc is set, FALSE otherwise.
bool mIsSecurityPolicySet : 1; ///< TRUE if Security Policy is set, FALSE otherwise.
} otOperationalDataset;
/**