nl::Weave::WeaveServerBase

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

Common, base object for implementing Weave profile unsolicited responders (servers) that encapsulates validating authenticated requests and sending status reports and provides common data member storage for fabric state and an exchange manager.

Summary

Inheritance

Direct Known Subclasses:
  nl::Weave::Profiles::DeviceControl::DeviceControlServer
  nl::Weave::Profiles::DeviceDescription::DeviceDescriptionServer
  nl::Weave::Profiles::FabricProvisioning::FabricProvisioningServer
  nl::Weave::Profiles::Heartbeat::WeaveHeartbeatReceiver
  nl::Weave::Profiles::NetworkProvisioning::NetworkProvisioningServer
  nl::Weave::Profiles::ServiceProvisioning::ServiceProvisioningServer
  nl::Weave::Profiles::TokenPairing::TokenPairingServer
  nl::Weave::Profiles::Vendor::Nestlabs::DropcamLegacyPairing::DropcamLegacyPairingServer
  nl::Weave::Profiles::WeaveEchoServer

Public attributes

ExchangeMgr
[READ ONLY] Exchange manager object
FabricState
[READ ONLY] Fabric state object

Public static functions

SendStatusReport(ExchangeContext *ec, uint32_t statusProfileId, uint16_t statusCode, WEAVE_ERROR sysError)
Send a Weave status report with default message flags to the initiator on the specified exchange containing the status code in the specified profile and system error.
SendStatusReport(ExchangeContext *ec, uint32_t statusProfileId, uint16_t statusCode, WEAVE_ERROR sysError, uint16_t sendFlags)
Send a Weave status report with the provided message flags to the initiator on the specified exchange containing the status code in the specified profile and system error.

Protected functions

EnforceAccessControl(ExchangeContext *ec, uint32_t msgProfileId, uint8_t msgType, const WeaveMessageInfo *msgInfo, WeaveServerDelegateBase *delegate)
bool
Determine whether an incoming request message to a Weave server should be accepted or discarded.
WeaveServerBase(void)

Public attributes

ExchangeMgr

WeaveExchangeManager * ExchangeMgr

[READ ONLY] Exchange manager object

FabricState

WeaveFabricState * FabricState

[READ ONLY] Fabric state object

Public static functions

SendStatusReport

WEAVE_ERROR SendStatusReport(
  ExchangeContext *ec,
  uint32_t statusProfileId,
  uint16_t statusCode,
  WEAVE_ERROR sysError
)

Send a Weave status report with default message flags to the initiator on the specified exchange containing the status code in the specified profile and system error.

Details
Parameters
[in] ec
A pointer to the exchange context to send the status report on.
[in] statusProfileId
The profile for the specified status code.
[in] statusCode
The status code to send.
[in] sysError
The system error associated or correlated with the status code.

SendStatusReport

WEAVE_ERROR SendStatusReport(
  ExchangeContext *ec,
  uint32_t statusProfileId,
  uint16_t statusCode,
  WEAVE_ERROR sysError,
  uint16_t sendFlags
)

Send a Weave status report with the provided message flags to the initiator on the specified exchange containing the status code in the specified profile and system error.

Details
Parameters
[in] ec
A pointer to the exchange context to send the status report on.
[in] statusProfileId
The profile for the specified status code.
[in] statusCode
The status code to send.
[in] sysError
The system error associated or correlated with the status code.
[in] sendFlags
Flags set by the application for the Weave status report being sent.

Protected functions

EnforceAccessControl

bool EnforceAccessControl(
  ExchangeContext *ec,
  uint32_t msgProfileId,
  uint8_t msgType,
  const WeaveMessageInfo *msgInfo,
  WeaveServerDelegateBase *delegate
)

Determine whether an incoming request message to a Weave server should be accepted or discarded.

This method is intended to be used by Weave server implementations to implement extensible access control policy for incoming request messages. Server implementations that rely on delegate objects should call this method early in message processing to determine whether message processing should continue.

This method calls the virtual WeaveServerDelegateBase::EnforceAccessControl() method on the supplied delegate to evaluate access control policy for the message. Weave server delegate classes, and application-specific delegates derived from the standard server classes, should override the virtual method to enforce specific access control policies.

Details
Parameters
[in] ec
The ExchangeContext over which the message was received.
[in] msgProfileId
The profile id of the received message.
[in] msgType
The message type of the received message.
[in] msgInfo
A WeaveMessageInfo structure containing information about the received message.
[in] delegate
The delegate object supplied by the application that can be used to override the default message access control policy.
Return Values
true
If the message should be accepted and processed as normal.
false
If message processing should stop and the message the should be discarded.

WeaveServerBase

 WeaveServerBase(
  void
)