nl::Weave::Binding::Configuration

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

提供声明式样式的接口,用于配置和准备 Binding 对象。

摘要

配置 Binding 时,应用必须至少调用以下每个配置组中的一个方法:“目标”、“传输”和“安全性”。您可以根据需要调用其他方法,以覆盖默认行为。

如果调用了互斥配置(例如,Transport_TCP(),后跟 Transport_UDP(),则最后调用的进程胜出。

公共函数

ConfigureFromMessage(const WeaveMessageInfo *aMsgInfo, const Inet::IPPacketInfo *aPacketInfo)
配置绑定以允许与已接收消息的发送者进行通信。
DNS_Options(uint8_t dnsOptions)
解析对等方的主机名时,请使用指定的 DNS 选项。
Exchange_ResponseTimeoutMsec(uint32_t aResponseTimeoutMsec)
为通过此 Binding 对象创建的广告交易平台上下文设置默认响应超时时间。
GetError(void) const
返回配置 Binding 时发生的任何错误。
PrepareBinding(void)
准备绑定以便与对等端进行通信。
Security_AppGroupKey(uint32_t aAppGroupGlobalId, uint32_t aRootKeyId, bool aUseRotatingKey)
与对等设备通信时,发送和接收针对特定 Weave 应用组加密的消息。
Security_AuthenticationMode(WeaveAuthMode aAuthMode)
设置请求的身份验证模式,用于对对等方进行身份验证。
Security_CASESession(void)
与对等节点通信时,使用与对等节点建立的 CASE 会话密钥来发送和接收加密的消息。
Security_EncryptionType(uint8_t aEncType)
与对等设备通信时,收发使用指定消息加密类型加密的消息。
Security_Key(uint32_t aKeyId)
与对等方通信时,收发使用指定密钥加密的消息。
Security_None(void)
与对等设备通信时,发送和接收数据均不会加密(即
Security_PASESession(uint8_t aPasswordSource)
与对等节点通信时,使用与对等节点建立的 PASE 会话密钥来发送和接收加密的消息。
Security_SharedCASESession(void)
与对等设备通信时,使用与 Nest 核心路由器建立的共享 CASE 会话密钥来发送和接收加密的消息。
Security_SharedCASESession(uint64_t aRouterNodeId)
与对等设备通信时,使用与特定路由器节点建立的共享 CASE 会话密钥来发送和接收加密的消息。
Security_TAKESession()
与对等节点通信时,使用与对等节点建立的 TAKE 会话密钥收发加密消息。
TargetAddress_IP(nl::Inet::IPAddress aPeerAddress, uint16_t aPeerPort, InterfaceId aInterfaceId)
与对等方通信时,使用特定的 IP 地址、端口和网络接口。
TargetAddress_IP(const char *aHostName, uint16_t aPeerPort, InterfaceId aInterfaceId)
与对等设备通信时,使用特定的主机名、端口和网络接口。
TargetAddress_IP(const char *aHostName, size_t aHostNameLen, uint16_t aPeerPort, InterfaceId aInterfaceId)
与对等设备通信时,使用特定的主机名、端口和网络接口。
TargetAddress_WeaveFabric(uint16_t aSubnetId)
与对等方通信时,使用根据对等方的节点 ID 和指定子网得出的 Weave 结构地址。
TargetAddress_WeaveService(void)
与对等设备通信时,请使用从对等设备节点 ID 派生的 Weave 服务结构地址。
Target_NodeId(uint64_t aPeerNodeId)
配置绑定以与特定 Weave 节点 ID 进行通信。
Target_ServiceEndpoint(uint64_t aPeerNodeId)
配置绑定以与特定 Weave 服务端点进行通信。
Transport_DefaultWRMPConfig(const WRMPConfig & aWRMPConfig)
为通过此 Binding 对象创建的广告交易平台上下文设置默认 WRMP 配置。
Transport_ExistingConnection(WeaveConnection *apConnection)
使用现有的 Weave 连接与对等设备通信。
Transport_TCP(void)
使用 TCP 与对等端通信。
Transport_UDP(void)
使用 UDP 与对等端通信。
Transport_UDP_PathMTU(uint32_t aPathMTU)
设置传输到对等端的 UDP 数据包的预期路径 MTU。
Transport_UDP_WRM(void)
与对等设备通信时使用 Weave Reliable Messaging 协议。

公共函数

ConfigureFromMessage

Configuration & ConfigureFromMessage(
  const WeaveMessageInfo *aMsgInfo,
  const Inet::IPPacketInfo *aPacketInfo
)

配置绑定以允许与已接收消息的发送者进行通信。

具体说明
参数
[in] aMsgInfo
与所接收消息关联的消息信息结构。
[in] aPacketInfo
已接收消息的数据包信息。

DNS_Options

Configuration & DNS_Options(
  uint8_t dnsOptions
)

解析对等方的主机名时,请使用指定的 DNS 选项。

具体说明
参数
[in] dnsOptions
一个整数值,用于控制主机名解析的执行方式。值应该是 #::nl::Inet::DNSOptions 枚举中的值之一。
返回值
对绑定对象的引用。

Exchange_ResponseTimeoutMsec

Configuration & Exchange_ResponseTimeoutMsec(
  uint32_t aResponseTimeoutMsec
)

为通过此 Binding 对象创建的广告交易平台上下文设置默认响应超时时间。

具体说明
参数
[in] aResponseTimeoutMsec
默认响应时间(以毫秒为单位)。
返回值
对绑定对象的引用。

GetError

WEAVE_ERROR GetError(
  void
) const 

返回配置 Binding 时发生的任何错误。

PrepareBinding

WEAVE_ERROR PrepareBinding(
  void
)

准备绑定以便与对等端进行通信。

Security_AppGroupKey

Configuration & Security_AppGroupKey(
  uint32_t aAppGroupGlobalId,
  uint32_t aRootKeyId,
  bool aUseRotatingKey
)

与对等设备通信时,发送和接收针对特定 Weave 应用组加密的消息。

具体说明
参数
[in] aAppGroupGlobalId
应加密其消息的应用组的全局 ID。
[in] aRootKeyId
用于为指定的 Weave 应用组派生加密密钥的根密钥。
[in] aUseRotatingKey
如果 Weave 应用组使用轮替消息密钥,则为 true。
返回值
Binding 对象的引用。

Security_AuthenticationMode

Configuration & Security_AuthenticationMode(
  WeaveAuthMode aAuthMode
)

设置请求的身份验证模式,用于对对等方进行身份验证。

具体说明
参数
[in] aAuthMode
请求的身份验证模式。
返回值
Binding 对象的引用。

Security_CASESession

Configuration & Security_CASESession(
  void
)

与对等节点通信时,使用与对等节点建立的 CASE 会话密钥来发送和接收加密的消息。

如果必要的会话不可用,则系统将在准备绑定时自动建立该会话。

具体说明
返回值
对绑定对象的引用。

Security_EncryptionType

Configuration & Security_EncryptionType(
  uint8_t aEncType
)

与对等设备通信时,收发使用指定消息加密类型加密的消息。

具体说明
参数
[in] aEncType
Weave 消息加密类型。
返回值
Binding 对象的引用。

Security_Key

Configuration & Security_Key(
  uint32_t aKeyId
)

与对等方通信时,收发使用指定密钥加密的消息。

具体说明
参数
[in] aKeyId
加密密钥的 ID。指定的密钥必须适合 Weave 消息加密。
返回值
Binding 对象的引用。

Security_None

Configuration & Security_None(
  void
)

与对等设备通信时,发送和接收数据均不会加密(即

不安全)消息。

具体说明
返回值
对绑定对象的引用。

Security_PASESession

Configuration & Security_PASESession(
  uint8_t aPasswordSource
)

与对等节点通信时,使用与对等节点建立的 PASE 会话密钥来发送和接收加密的消息。

如果必要的会话不可用,则系统将在准备绑定时自动建立该会话。

具体说明
参数
[in] aPasswordSource
在建立 PASE 会话期间使用的密码来源。
返回值
对绑定对象的引用。

Security_SharedCASESession

Configuration & Security_SharedCASESession(
  void
)

与对等设备通信时,使用与 Nest 核心路由器建立的共享 CASE 会话密钥来发送和接收加密的消息。

如果必要的会话不可用,则系统将在准备绑定时自动建立该会话。

具体说明
返回值
对绑定对象的引用。

Security_SharedCASESession

Configuration & Security_SharedCASESession(
  uint64_t aRouterNodeId
)

与对等设备通信时,使用与特定路由器节点建立的共享 CASE 会话密钥来发送和接收加密的消息。

如果必要的会话不可用,则系统将在准备绑定时自动建立该会话。

具体说明
参数
[in] aRouterNodeId
应与路由器建立共享 CASE 会话的 Weave 节点 ID。
返回值
对绑定对象的引用。

Security_TAKESession

Configuration & Security_TAKESession()

与对等节点通信时,使用与对等节点建立的 TAKE 会话密钥收发加密消息。

如果必要的会话不可用,则系统将在准备绑定时自动建立该会话。

具体说明
返回值
对绑定对象的引用。

TargetAddress_IP

Configuration & TargetAddress_IP(
  nl::Inet::IPAddress aPeerAddress,
  uint16_t aPeerPort,
  InterfaceId aInterfaceId
)

与对等方通信时,使用特定的 IP 地址、端口和网络接口。

具体说明
参数
[in] aPeerAddress
对等方的 IP 地址
[in] aPeerPort
远程端口
[in] aInterfaceId
用于通信的本地网络接口的 ID
返回值
对绑定对象的引用。

TargetAddress_IP

Configuration & TargetAddress_IP(
  const char *aHostName,
  uint16_t aPeerPort,
  InterfaceId aInterfaceId
)

与对等设备通信时,使用特定的主机名、端口和网络接口。

注意:调用方必须确保提供的主机名字符串在绑定准备阶段完成之前保持有效。

具体说明
参数
[in] aHostName
以 NULL 结束的字符串,包含对等方的主机名。
[in] aPeerPort
与对等端通信时使用的远程端口。
[in] aInterfaceId
用于通信的本地网络接口的 ID。
返回值
对绑定对象的引用。

TargetAddress_IP

Configuration & TargetAddress_IP(
  const char *aHostName,
  size_t aHostNameLen,
  uint16_t aPeerPort,
  InterfaceId aInterfaceId
)

与对等设备通信时,使用特定的主机名、端口和网络接口。

注意:调用方必须确保提供的主机名字符串在绑定准备阶段完成之前保持有效。

具体说明
参数
[in] aHostName
包含对等方主机名的字符串。此字符串无需以 NULL 结尾。
[in] aHostNameLen
aHostName 所指向的字符串的长度。
[in] aPeerPort
与对等端通信时使用的远程端口。
[in] aInterfaceId
用于通信的本地网络接口的 ID。
返回值
对绑定对象的引用。

TargetAddress_WeaveFabric

Configuration & TargetAddress_WeaveFabric(
  uint16_t aSubnetId
)

与对等方通信时,使用根据对等方的节点 ID 和指定子网得出的 Weave 结构地址。

具体说明
参数
[in] aSubnetId
子网 ID,用于形成对等方的 Weave 结构地址。
返回值
对绑定对象的引用。

TargetAddress_WeaveService

Configuration & TargetAddress_WeaveService(
  void
)

与对等设备通信时,请使用从对等设备节点 ID 派生的 Weave 服务结构地址。

具体说明
返回值
对绑定对象的引用。

Target_NodeId

Configuration & Target_NodeId(
  uint64_t aPeerNodeId
)

配置绑定以与特定 Weave 节点 ID 进行通信。

具体说明
参数
[in] aPeerNodeId
对等节点的节点 ID。
返回值
对绑定对象的引用。

Target_ServiceEndpoint

Configuration & Target_ServiceEndpoint(
  uint64_t aPeerNodeId
)

配置绑定以与特定 Weave 服务端点进行通信。

如果未以其他方式配置,对等地址将设置为服务端点的 Weave 结构地址。

具体说明
参数
[in] serviceEndpointId
将与之进行通信的服务端点的节点 ID。
返回值
对绑定对象的引用。

Transport_DefaultWRMPConfig

Configuration & Transport_DefaultWRMPConfig(
  const WRMPConfig & aWRMPConfig
)

为通过此 Binding 对象创建的广告交易平台上下文设置默认 WRMP 配置。

具体说明
参数
[in] aWRMPConfig
对新默认 WRMP 配置的引用。
返回值
对绑定对象的引用。

Transport_ExistingConnection

Configuration & Transport_ExistingConnection(
  WeaveConnection *apConnection
)

使用现有的 Weave 连接与对等设备通信。

注意:绑定准备成功时,连接对象上的引用计数将递增。因此,应用应负责确保连接对象在该时间之前一直保持活动状态。

具体说明
参数
[in] con
指向现有 Weave 连接的指针。
返回值
对绑定对象的引用。

Transport_TCP

Configuration & Transport_TCP(
  void
)

使用 TCP 与对等端通信。

具体说明
返回值
对绑定对象的引用。

Transport_UDP

Configuration & Transport_UDP(
  void
)

使用 UDP 与对等端通信。

具体说明
返回值
对绑定对象的引用。

Transport_UDP_PathMTU

Configuration & Transport_UDP_PathMTU(
  uint32_t aPathMTU
)

设置传输到对等端的 UDP 数据包的预期路径 MTU。

对于某些 Weave 协议,此参数将用于动态调整 Weave 消息载荷大小。

具体说明
参数
[in] aPathMTU
UDP 数据包传输到对等端的预期路径 MTU。
返回值
对绑定对象的引用。

Transport_UDP_WRM

Configuration & Transport_UDP_WRM(
  void
)

与对等设备通信时使用 Weave Reliable Messaging 协议。

具体说明
返回值
对绑定对象的引用。