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 位址是否代表本機編織布料內的節點位址。
IsLocalFabricAddress(const IPAddress & addr) const
bool
決定 IP 位址是否代表本機節點的編織布料位址。
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 Security Session 從序列化狀態還原。
SelectNodeAddress(uint64_t nodeId, uint16_t subnet) const
傳回指定節點中具備 Weave ULA 的 IP 位址。
SelectNodeAddress(uint64_t nodeId) const
傳回指定節點中具備 Weave ULA 的 IP 位址。
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

公開類型

對等索引類型

uint8_t PeerIndexType

工作階段結束日期

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

狀態

 State

公開屬性

自動建立金鑰

bool AutoCreateKeys

DebugFabricId

uint64_t DebugFabricId

預設子網路

uint16_t DefaultSubnet

Fabric 編號

uint64_t FabricId

GroupKeyStore

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

ListenIPv4Addr

IPAddress ListenIPv4Addr

ListenIPv6Addr

IPAddress ListenIPv6Addr

本機節點 ID

uint64_t LocalNodeId

記錄鍵

bool LogKeys

最大 UNMcgIdRcvd

uint32_t MaxUnencUDPMsgIdRcvd[WEAVE_CONFIG_MAX_PEER_NODES]

郵件圖層

WeaveMessageLayer * MessageLayer

最近使用的索引

PeerIndexType MostRecentlyUsedIndexes[WEAVE_CONFIG_MAX_PEER_NODES]

節點編號

uint64_t NodeId[WEAVE_CONFIG_MAX_PEER_NODES]

配對代碼

const char * PairingCode

狀態

uint8_t State

取消註冊

WeaveSessionState::ReceiveFlagsType UnencRcvFlags[WEAVE_CONFIG_MAX_PEER_NODES]

使用測試金鑰

bool UseTestKey

公開函式

新增共用工作階段結尾節點

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

新增共用工作階段結尾節點

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
)

尋找工作階段鍵

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

這個方法會尋找工作階段金鑰項目。

詳細資料
參數
[in] keyId
編組金鑰 ID。
[in] peerNodeId
對等點的節點 ID。
[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
成功。

尋找共用工作階段

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
)

取得密碼

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

取得工作階段金鑰

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

取得工作階段狀態

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
成功。

處理連線已關閉

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 位址是否代表本機編織布料內的節點位址。

本地 Fabric 地址

bool IsLocalFabricAddress(
  const IPAddress & addr
) const 

決定 IP 位址是否代表本機節點的編織布料位址。

共用工作階段

bool IsSharedSession(
  uint16_t keyId,
  uint64_t peerNodeId
)

這個方法會檢查是否與指定的對等點和 keyId 相關聯的安全工作階段。

詳細資料
參數
[in] keyId
工作階段金鑰識別碼。
[in] peerNodeId
對等點的節點 ID。
傳回值
bool
是否分享指定的工作階段。

加入現有組合

WEAVE_ERROR JoinExistingFabric(
  const uint8_t *fabricState,
  uint32_t fabricStateLen
)

註冊工作階段結束回呼

WEAVE_ERROR RegisterSessionEndCallback(
  SessionEndCbCtxt *sessionEndCb
)

移除 IdleSessionKeys

bool RemoveIdleSessionKeys()

移除工作階段鍵

WEAVE_ERROR RemoveSessionKey(
  uint16_t keyId,
  uint64_t peerNodeId
)

移除工作階段鍵

void RemoveSessionKey(
  WeaveSessionKey *sessionKey,
  bool wasIdle
)

移除共用工作階段結束時間節點

void RemoveSharedSessionEndNodes(
  const WeaveSessionKey *sessionKey
)

還原工作階段

WEAVE_ERROR RestoreSession(
  uint8_t *serializedSession,
  uint16_t serializedSessionLen
)

將先前暫停的 Weave Security Session 從序列化狀態還原。

選取節點位址

IPAddress SelectNodeAddress(
  uint64_t nodeId,
  uint16_t subnet
) const 

傳回指定節點中具備 Weave ULA 的 IP 位址。

這個變化版本可以指定子網路。

詳細資料
參數
[in] nodeId
相關節點的節點編號。
[in] subnet
所需 ULA 子網路。
傳回值
IPAddress
IPAddress 物件。

選取節點位址

IPAddress SelectNodeAddress(
  uint64_t nodeId
) const 

傳回指定節點中具備 Weave ULA 的 IP 位址。

這個變化版本會使用本機節點的預設子網路。

詳細資料
參數
[in] nodeId
相關節點的節點編號。
傳回值
IPAddress
IPAddress 物件。

設定委派

void SetDelegate(
  FabricStateDelegate *aDelegate
)

這個方法會設定委派物件。

每當 FabricId 變更時 (例如,當我們加入/建立佈局或離開布料 (清除布料狀態) 時,就會叫用委派的回呼方法

如果先前設定的是委派代表,則再次呼叫此方法將覆寫先前的委派設定。

詳細資料
參數
[in] aDelegate
委派物件。如果不需要委派,則可以是 NULL。

設定工作階段金鑰

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

設定工作階段金鑰

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

停用

WEAVE_ERROR Shutdown(
  void
)

暫停工作階段

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

將有效的 Weave 安全性工作階段停權並序列化。

將已識別的 Weave 安全性工作階段狀態序列化為提供的緩衝區,並將工作階段暫停,不再傳送或接收其他訊息。

這種方法旨在避免在睡眠時保留 RAM 的裝置,讓這些裝置保持運作中的工作階段狀態,這樣就不需要在醒來時重新建立工作階段。

瓦韋法 (State)

 WeaveFabricState(
  void
)