nl::Weave::WeaveFabricState

#include <src/lib/core/WeaveFabricState.h>

前向声明 WeaveFabricState

摘要

构造函数和析构函数

WeaveFabricState(void)

公共类型

PeerIndexType typedef
uint8_t
SessionEndCbFunct)(uint16_t keyId, uint64_t peerNodeId, void *context) typedef
void(*
State 枚举

公共属性

AutoCreateKeys
bool
DebugFabricId
uint64_t
DefaultSubnet
uint16_t
FabricId
uint64_t
GroupKeyStore
ListenIPv4Addr
IPAddress
ListenIPv6Addr
IPAddress
LocalNodeId
uint64_t
LogKeys
bool
MaxUnencUDPMsgIdRcvd[WEAVE_CONFIG_MAX_PEER_NODES]
uint32_t
MessageLayer
MostRecentlyUsedIndexes[WEAVE_CONFIG_MAX_PEER_NODES]
PeerIndexType
NodeId[WEAVE_CONFIG_MAX_PEER_NODES]
uint64_t
PairingCode
const char *
State
uint8_t
UnencRcvFlags[WEAVE_CONFIG_MAX_PEER_NODES]
WeaveSessionState::ReceiveFlagsType
UseTestKey
bool

公共函数

AddSharedSessionEndNode(uint64_t endNodeId, uint64_t terminatingNodeId, uint16_t keyId)
AddSharedSessionEndNode(WeaveSessionKey *sessionKey, uint64_t endNodeId)
此方法会将新的结束节点添加到共享的端点记录中。
AllocSessionKey(uint64_t peerNodeId, uint16_t keyId, WeaveConnection *boundCon, WeaveSessionKey *& sessionKey)
ClearFabricState(void)
void
CreateFabric(void)
FindSessionKey(uint16_t keyId, uint64_t peerNodeId, bool create, WeaveSessionKey *& retRec)
此方法会查找会话密钥条目。
FindSharedSession(uint64_t terminatingNodeId, WeaveAuthMode authMode, uint8_t encType)
在会话密钥表中搜索已建立的共享会话密钥,该密钥定位到指定终止节点且与指定的身份验证模式和加密类型匹配。
GetFabricState(uint8_t *buf, uint32_t bufSize, uint32_t & fabricStateLen)
GetPassword(uint8_t pwSrc, const char *& ps, uint16_t & pwLen)
GetSessionKey(uint16_t keyId, uint64_t peerNodeId, WeaveSessionKey *& outSessionKey)
GetSessionState(uint64_t remoteNodeId, uint16_t keyId, uint8_t encType, WeaveConnection *con, WeaveSessionState & outSessionState)
GetSharedSessionEndNodeIds(const WeaveSessionKey *sessionKey, uint64_t *endNodeIds, uint8_t endNodeIdsBufSize, uint8_t & endNodeIdsCount)
此方法会返回共享指定会话的所有结束节点 ID。
HandleConnectionClosed(WeaveConnection *con)
void
Init(void)
Init(nl::Weave::Profiles::Security::AppKeys::GroupKeyStoreBase *groupKeyStore)
IsFabricAddress(const IPAddress & addr) const
bool
确定 IP 地址是否代表本地 Weave 结构中节点的地址。
IsLocalFabricAddress(const IPAddress & addr) const
bool
确定 IP 地址是否代表本地节点的 Weave 结构地址。
IsSharedSession(uint16_t keyId, uint64_t peerNodeId)
bool
此方法会检查与指定的对等方和 keyId 关联的安全会话是否已共享。
JoinExistingFabric(const uint8_t *fabricState, uint32_t fabricStateLen)
RegisterSessionEndCallback(SessionEndCbCtxt *sessionEndCb)
RemoveIdleSessionKeys()
bool
RemoveSessionKey(uint16_t keyId, uint64_t peerNodeId)
RemoveSessionKey(WeaveSessionKey *sessionKey, bool wasIdle)
void
RemoveSharedSessionEndNodes(const WeaveSessionKey *sessionKey)
void
RestoreSession(uint8_t *serializedSession, uint16_t serializedSessionLen)
从序列化状态恢复之前暂停的 Weave 安全会话。
SelectNodeAddress(uint64_t nodeId, uint16_t subnet) const
返回一个 IPAddress,其中包含指定节点的 Weave ULA。
SelectNodeAddress(uint64_t nodeId) const
返回一个 IPAddress,其中包含指定节点的 Weave ULA。
SetDelegate(FabricStateDelegate *aDelegate)
void
此方法可设置委托对象。
SetSessionKey(uint16_t keyId, uint64_t peerNodeId, uint8_t encType, WeaveAuthMode authMode, const WeaveEncryptionKey *encKey)
SetSessionKey(WeaveSessionKey *sessionKey, uint8_t encType, WeaveAuthMode authMode, const WeaveEncryptionKey *encKey)
Shutdown(void)
SuspendSession(uint16_t keyId, uint64_t peerNodeId, uint8_t *buf, uint16_t bufSize, uint16_t & serializedSessionLen)
暂停并序列化活跃的 Weave 安全会话的状态。

结构体

nl::Weave::WeaveFabricState::SessionEndCbCtxt

公共类型

PeerIndexType

uint8_t PeerIndexType

SessionEndCbFunct

void(* SessionEndCbFunct)(uint16_t keyId, uint64_t peerNodeId, void *context)

状态

 State

公共属性

AutoCreateKeys

bool AutoCreateKeys

DebugFabricId

uint64_t DebugFabricId

DefaultSubnet

uint16_t DefaultSubnet

FabricId

uint64_t FabricId

GroupKeyStore

nl::Weave::Profiles::Security::AppKeys::GroupKeyStoreBase * GroupKeyStore

ListenIPv4Addr

IPAddress ListenIPv4Addr

ListenIPv6Addr

IPAddress ListenIPv6Addr

LocalNodeId

uint64_t LocalNodeId

LogKeys

bool LogKeys

MaxUnencUDPMsgIdRcvd

uint32_t MaxUnencUDPMsgIdRcvd[WEAVE_CONFIG_MAX_PEER_NODES]

MessageLayer

WeaveMessageLayer * MessageLayer

MostRecentlyUsedIndexes

PeerIndexType MostRecentlyUsedIndexes[WEAVE_CONFIG_MAX_PEER_NODES]

NodeId

uint64_t NodeId[WEAVE_CONFIG_MAX_PEER_NODES]

PairingCode

const char * PairingCode

状态

uint8_t State

UnencRcvFlags

WeaveSessionState::ReceiveFlagsType UnencRcvFlags[WEAVE_CONFIG_MAX_PEER_NODES]

UseTestKey

bool UseTestKey

公共函数

AddSharedSessionEndNode

WEAVE_ERROR AddSharedSessionEndNode(
  uint64_t endNodeId,
  uint64_t terminatingNodeId,
  uint16_t keyId
)

AddSharedSessionEndNode

WEAVE_ERROR AddSharedSessionEndNode(
  WeaveSessionKey *sessionKey,
  uint64_t endNodeId
)

此方法会将新的结束节点添加到共享的端点记录中。

具体说明
参数
[in] sessionKey
WeaveSessionKey 对象,代表应添加新结束节点的会话。
[in] endNodeId
要添加的会话结束节点的节点 ID。
返回值
WEAVE_ERROR_TOO_MANY_SHARED_SESSION_END_NODES
如果共享端点节点列表中没有新条目的可用空间。
WEAVE_NO_ERROR
成功时。

AllocSessionKey

WEAVE_ERROR AllocSessionKey(
  uint64_t peerNodeId,
  uint16_t keyId,
  WeaveConnection *boundCon,
  WeaveSessionKey *& sessionKey
)

ClearFabricState

void ClearFabricState(
  void
)

CreateFabric

WEAVE_ERROR CreateFabric(
  void
)

FindSessionKey

WEAVE_ERROR FindSessionKey(
  uint16_t keyId,
  uint64_t peerNodeId,
  bool create,
  WeaveSessionKey *& retRec
)

此方法会查找会话密钥条目。

具体说明
参数
[in] keyId
Weave 密钥标识符。
[in] peerNodeId
对等方的节点标识符。
[in] create
一个布尔值,用于指示在未找到指定键时是否应创建新键。
[out] retRec
WeaveSessionKey 对象的指针引用。
返回值
WEAVE_ERROR_WRONG_KEY_TYPE
如果指定的密钥不是会话密钥类型。
WEAVE_ERROR_INVALID_ARGUMENT
如果输入参数包含错误的值。
WEAVE_ERROR_KEY_NOT_FOUND
如果未找到指定的键。
WEAVE_ERROR_TOO_MANY_KEYS
如果没有创建新的会话密钥的自由条目。
WEAVE_NO_ERROR
成功时。

FindSharedSession

WeaveSessionKey * FindSharedSession(
  uint64_t terminatingNodeId,
  WeaveAuthMode authMode,
  uint8_t encType
)

在会话密钥表中搜索已建立的共享会话密钥,该密钥定位到指定终止节点且与指定的身份验证模式和加密类型匹配。

具体说明
参数
[in] terminatingNodeId
会话终止器的节点标识符。
[in] authMode
所需的会话身份验证模式。
[in] encType
所需的邮件加密类型。
返回值
WeaveSessionKey
* 指向表示匹配共享会话的 WeaveSessionKey 对象的指针;如果未找到匹配会话,则为 NULL。

GetFabricState

WEAVE_ERROR GetFabricState(
  uint8_t *buf,
  uint32_t bufSize,
  uint32_t & fabricStateLen
)

GetPassword

WEAVE_ERROR GetPassword(
  uint8_t pwSrc,
  const char *& ps,
  uint16_t & pwLen
)

GetSessionKey

WEAVE_ERROR GetSessionKey(
  uint16_t keyId,
  uint64_t peerNodeId,
  WeaveSessionKey *& outSessionKey
)

GetSessionState

WEAVE_ERROR GetSessionState(
  uint64_t remoteNodeId,
  uint16_t keyId,
  uint8_t encType,
  WeaveConnection *con,
  WeaveSessionState & outSessionState
)

GetSharedSessionEndNodeIds

WEAVE_ERROR GetSharedSessionEndNodeIds(
  const WeaveSessionKey *sessionKey,
  uint64_t *endNodeIds,
  uint8_t endNodeIdsBufSize,
  uint8_t & endNodeIdsCount
)

此方法会返回共享指定会话的所有结束节点 ID。

具体说明
参数
[in] sessionKey
指向会话密钥对象的指针。
[in] endNodeIds
指向节点 ID 缓冲区的指针。
[in] endNodeIdsMaxCount
缓冲区中可容纳的最大节点 ID 数量。
[out] endNodeIdsCount
找到的共享指定会话的结束节点 ID 的数量。
返回值
WEAVE_ERROR_BUFFER_TOO_SMALL
如果提供了结束节点 ID,则缓冲区空间不够大。
WEAVE_NO_ERROR
成功时。

HandleConnectionClosed

void HandleConnectionClosed(
  WeaveConnection *con
)

Init

WEAVE_ERROR Init(
  void
)

Init

WEAVE_ERROR Init(
  nl::Weave::Profiles::Security::AppKeys::GroupKeyStoreBase *groupKeyStore
)

IsFabricAddress

bool IsFabricAddress(
  const IPAddress & addr
) const 

确定 IP 地址是否代表本地 Weave 结构中节点的地址。

IsLocalFabricAddress

bool IsLocalFabricAddress(
  const IPAddress & addr
) const 

确定 IP 地址是否代表本地节点的 Weave 结构地址。

IsSharedSession

bool IsSharedSession(
  uint16_t keyId,
  uint64_t peerNodeId
)

此方法会检查与指定的对等方和 keyId 关联的安全会话是否已共享。

具体说明
参数
[in] keyId
会话密钥标识符。
[in] peerNodeId
对等方的节点标识符。
返回值
bool
是否共享指定的会话。

JoinExistingFabric

WEAVE_ERROR JoinExistingFabric(
  const uint8_t *fabricState,
  uint32_t fabricStateLen
)

RegisterSessionEndCallback

WEAVE_ERROR RegisterSessionEndCallback(
  SessionEndCbCtxt *sessionEndCb
)

RemoveIdleSessionKeys

bool RemoveIdleSessionKeys()

RemoveSessionKey

WEAVE_ERROR RemoveSessionKey(
  uint16_t keyId,
  uint64_t peerNodeId
)

RemoveSessionKey

void RemoveSessionKey(
  WeaveSessionKey *sessionKey,
  bool wasIdle
)

RemoveSharedSessionEndNodes

void RemoveSharedSessionEndNodes(
  const WeaveSessionKey *sessionKey
)

RestoreSession

WEAVE_ERROR RestoreSession(
  uint8_t *serializedSession,
  uint16_t serializedSessionLen
)

从序列化状态恢复之前暂停的 Weave 安全会话。

SelectNodeAddress

IPAddress SelectNodeAddress(
  uint64_t nodeId,
  uint16_t subnet
) const 

返回一个 IPAddress,其中包含指定节点的 Weave ULA。

此变体允许指定子网。

具体说明
参数
[in] nodeId
相关节点的节点 ID 号。
[in] subnet
ULA 所需的子网。
返回值
IPAddress
一个 IPAddress 对象。

SelectNodeAddress

IPAddress SelectNodeAddress(
  uint64_t nodeId
) const 

返回一个 IPAddress,其中包含指定节点的 Weave ULA。

此变体使用本地节点的默认子网。

具体说明
参数
[in] nodeId
相关节点的节点 ID 号。
返回值
IPAddress
一个 IPAddress 对象。

SetDelegate

void SetDelegate(
  FabricStateDelegate *aDelegate
)

此方法可设置委托对象。

每当 FabricId 更改时(即我们加入/创建 Fabric 时,或当我们退出 Fabric 状态时)时,都会调用委托的回调方法(清除 Fabric 状态)

如果之前已设置委托,则对此方法的第二次调用会覆盖之前的委托。

具体说明
参数
[in] aDelegate
委托对象。如果不需要委托,它可以为 NULL。

SetSessionKey

WEAVE_ERROR SetSessionKey(
  uint16_t keyId,
  uint64_t peerNodeId,
  uint8_t encType,
  WeaveAuthMode authMode,
  const WeaveEncryptionKey *encKey
)

SetSessionKey

WEAVE_ERROR SetSessionKey(
  WeaveSessionKey *sessionKey,
  uint8_t encType,
  WeaveAuthMode authMode,
  const WeaveEncryptionKey *encKey
)

关停

WEAVE_ERROR Shutdown(
  void
)

SuspendSession

WEAVE_ERROR SuspendSession(
  uint16_t keyId,
  uint64_t peerNodeId,
  uint8_t *buf,
  uint16_t bufSize,
  uint16_t & serializedSessionLen
)

暂停并序列化活跃的 Weave 安全会话的状态。

将已识别的 Weave 安全会话的状态序列化到提供的缓冲区中,并暂停会话,从而无法再发送或接收消息。

此方法旨在供在休眠状态下不保留 RAM 的设备使用,允许它们保持活动会话的状态,从而避免在唤醒时重新建立会话。

WeaveFabricState

 WeaveFabricState(
  void
)