nl::Weave::ExchangeContext

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

This class represents an ongoing conversation (ExchangeContext) between two or more nodes.

Summary

It defines methods for encoding and communicating Weave messages within an ExchangeContext over various transport mechanisms, for example, TCP, UDP, or Weave Reliable Messaging.

Public types

@34{
  kSendFlag_AutoRetrans = 0x0001,
  kSendFlag_ExpectResponse = 0x0002,
  kSendFlag_RetransmissionTrickle = 0x0004,
  kSendFlag_DelaySend = 0x0008,
  kSendFlag_ReuseMessageId = 0x0010,
  kSendFlag_ReuseSourceId = 0x0020,
  kSendFlag_RetainBuffer = 0x0040,
  kSendFlag_AlreadyEncoded = 0x0080,
  kSendFlag_DefaultMulticastSourceAddress = 0x0100,
  kSendFlag_FromInitiator = 0x0200,
  kSendFlag_RequestAck = 0x0400,
  kSendFlag_NoAutoRequestAck = 0x0800,
  kSendFlag_MulticastFromLinkLocal = kSendFlag_DefaultMulticastSourceAddress
}
enum
@35{
  kGetPeerDescription_MaxLength = nl::Weave::kWeavePeerDescription_MaxLength
}
enum
ConnectionClosedFunct)(ExchangeContext *ec, WeaveConnection *con, WEAVE_ERROR conErr) typedef
void(*
This function is the application callback to invoke when an existing Weave connection has been closed.
KeyErrorFunct)(ExchangeContext *ec, WEAVE_ERROR keyErr) typedef
void(*
Type of key error message handling function.
MessageReceiveFunct)(ExchangeContext *ec, const IPPacketInfo *pktInfo, const WeaveMessageInfo *msgInfo, uint32_t profileId, uint8_t msgType, PacketBuffer *payload) typedef
void(*
This function is the application callback for handling a received Weave message.
ResponseTimeoutFunct)(ExchangeContext *ec) typedef
void(*
This function is the application callback to invoke when the timeout for the receipt of a response message has expired.
RetransmissionTimeoutFunct)(ExchangeContext *ec) typedef
void(*
This function is the application callback to invoke when the timeout for the retransmission of a previously sent message has expired.
Timeout typedef
uint32_t
Type used to express the timeout in this ExchangeContext, in milliseconds.
WRMPAckRcvdFunct)(ExchangeContext *ec, void *msgCtxt) typedef
void(*
This function is the application callback to invoke when an Acknowledgment is received for a Weave message that requested one as part of the Weave Reliable Messaging Protocol.
WRMPPauseRcvdFunct)(ExchangeContext *ec, uint32_t pauseTime) typedef
void(*
This function is the application callback to invoke when a Throttle message or Delayed Delivery message is received as part of the Weave Reliable Messaging Protocol.
WRMPSendErrorFunct)(ExchangeContext *ec, WEAVE_ERROR err, void *msgCtxt) typedef
void(*
This function is the application callback to invoke when an error is encountered while sending a Weave message.

Public attributes

AllowDuplicateMsgs
bool
Boolean indicator of whether duplicate messages are allowed for a given exchange.
AppState
void *
Pointer to application-specific state object.
Con
[READ ONLY] Associated Weave connection.
EncryptionType
uint8_t
Encryption type to use when sending a message.
ExchangeId
uint16_t
[READ ONLY] Assigned exchange ID.
ExchangeMgr
[READ ONLY] Owning exchange manager.
KeyId
uint16_t
Encryption key to use when sending a message.
OnAckRcvd
Application callback for received acknowledgment.
OnConnectionClosed
OnDDRcvd
Application callback for received Delayed Delivery message.
OnKeyError
This function is the application callback to invoke when key error message has been received from the peer.
OnMessageReceived
OnResponseTimeout
OnRetransmissionTimeout
OnSendError
Application callback for error while sending.
OnThrottleRcvd
Application callback for received Throttle message.
PeerAddr
IPAddress
[READ ONLY] IP address of peer node.
PeerIntf
InterfaceId
[READ ONLY] Outbound interface to be used when sending messages to the peer.
PeerNodeId
uint64_t
[READ ONLY] Node ID of peer node.
PeerPort
uint16_t
[READ ONLY] Port of peer node.
ResponseTimeout
Maximum time to wait for response (in milliseconds); 0 disables response timeout.
RetransInterval
uint32_t
Time between retransmissions (in milliseconds); 0 disables retransmissions.
mMsgProtocolVersion
uint16_t
Message Protocol version for the ExchangeContext.
mWRMPConfig
WRMP configuration.

Public functions

Abort(void)
void
Abort the Exchange context immediately and release all references to it.
AddRef(void)
void
Increment the reference counter for the exchange context by one.
AutoRequestAck() const
bool
Returns whether an acknowledgment will be requested whenever a message is sent.
CancelRetrans(void)
void
Cancel the Trickle retransmission mechanism.
Close(void)
void
Gracefully close an exchange context.
EncodeExchHeader(WeaveExchangeHeader *exchangeHeader, uint32_t profileId, uint8_t msgType, PacketBuffer *msgBuf, uint16_t sendFlags)
Encode the exchange header into a message buffer.
GetAutoReleaseKey() const
bool
Return whether the encryption key associated with the exchange should be released when the exchange is freed.
GetCurrentRetransmitTimeout(void)
uint32_t
Get the current retransmit timeout.
GetPeerDescription(char *buf, uint32_t bufSize) const
void
Constructs a string describing the peer node and its associated address / connection information.
HandleTrickleMessage(const IPPacketInfo *pktInfo, const WeaveMessageInfo *msgInfo)
void
Handle trickle message within the exchange context.
HasPeerRequestedAck(void) const
bool
Determine whether peer requested acknowledgment for at least one message on this exchange.
HasRcvdMsgFromPeer(void) const
bool
Determine whether at least one message has been received on this exchange from peer.
IsAckPending(void) const
bool
Determine whether there is already an acknowledgment pending to be sent to the peer on this exchange.
IsConnectionClosed(void) const
bool
Determine whether the ExchangeContext has an associated active WeaveConnection.
IsInitiator(void) const
bool
Determine whether the context is the initiator of the exchange.
IsResponseExpected(void) const
bool
Determine whether a response is expected for messages sent over this exchange.
Release(void)
void
Release reference to this exchange context.
SendCommonNullMessage(void)
Send a Common::Null message.
SendMessage(uint32_t profileId, uint8_t msgType, PacketBuffer *msgPayload, uint16_t sendFlags, void *msgCtxt)
Send a Weave message on this exchange.
SendMessage(uint32_t profileId, uint8_t msgType, PacketBuffer *msgBuf, uint16_t sendFlags, WeaveMessageInfo *msgInfo, void *msgCtxt)
Send a Weave message on this exchange.
SetAckPending(bool inAckPending)
void
Set if an acknowledgment needs to be sent back to the peer on this exchange.
SetAutoReleaseKey(bool autoReleaseKey)
void
Set whether the encryption key associated with the exchange should be released when the exchange is freed.
SetAutoRequestAck(bool autoReqAck)
void
Set whether an acknowledgment should be requested whenever a message is sent.
SetConnectionClosed(bool inConnectionClosed)
void
Set the kFlagConnectionClosed flag bit.
SetDropAck(bool inDropAck)
void
Set whether the WeaveExchangeManager should not send acknowledgements for this context.
SetInitiator(bool inInitiator)
void
Set the kFlagInitiator flag bit.
SetMsgRcvdFromPeer(bool inMsgRcvdFromPeer)
void
Set if a message has been received from the peer on this exchange.
SetPeerRequestedAck(bool inPeerRequestedAck)
void
Set if an acknowledgment was requested in the last message received on this exchange.
SetResponseExpected(bool inResponseExpected)
void
Set whether a response is expected on this exchange.
SetShouldAutoReleaseConnection(bool autoReleaseCon)
void
Set whether the Weave connection associated with the exchange should be released when the exchange is freed.
SetupTrickleRetransmit(uint32_t retransInterval, uint8_t threshold, uint32_t timeout)
Setup the trickle retransmission mechanism by setting the corresponding retransmission interval and rebroadcast threshold.
ShouldAutoReleaseConnection() const
bool
Return whether the Weave connection associated with the exchange should be released when the exchange is freed.
ShouldDropAck(void) const
bool
Determine whether the WeaveExchangeManager should not send an acknowledgement.
StartTimerT(void)
Start the Trickle rebroadcast algorithm's periodic retransmission timer mechanism.
TeardownTrickleRetransmit(void)
void
Tear down the Trickle retransmission mechanism by canceling the periodic timers within Trickle and freeing the message buffer holding the Weave message.
UseEphemeralUDPPort(void) const
bool
Return whether outbound messages sent via the exchange should be sent from the local ephemeral UDP port.
WRMPFlushAcks(void)
WRMPSendDelayedDelivery(uint32_t PauseTimeMillis, uint64_t DelayedNodeId)
Send a Delayed Delivery message to notify a sender node that its previously sent message would experience an expected delay before being delivered to the recipient.
WRMPSendThrottleFlow(uint32_t PauseTimeMillis)
Send a Throttle Flow message to the peer node requesting it to throttle its sending of messages.

Public types

@34

 @34
Properties
kSendFlag_AlreadyEncoded

Used to indicate that the message is already encoded.

kSendFlag_AutoRetrans

Used to indicate that automatic retransmission is enabled.

kSendFlag_DefaultMulticastSourceAddress

Used to indicate that default IPv6 source address selection should be used when sending IPv6 multicast messages.

kSendFlag_DelaySend

Used to indicate that the sending of the current message needs to be delayed.

kSendFlag_ExpectResponse

Used to indicate that a response is expected within a specified timeout.

kSendFlag_FromInitiator

Used to indicate that the current message is the initiator of the exchange.

kSendFlag_MulticastFromLinkLocal

Deprecated alias for kSendFlag_DefaultMulticastSourceAddress.

kSendFlag_NoAutoRequestAck

Suppress the auto-request acknowledgment feature when sending a message.

kSendFlag_RequestAck

Used to send a WRM message requesting an acknowledgment.

kSendFlag_RetainBuffer

Used to indicate that the message buffer should not be freed after sending.

kSendFlag_RetransmissionTrickle

Used to indicate the requirement of retransmissions for Trickle.

kSendFlag_ReuseMessageId

Used to indicate that the message ID in the message header can be reused.

kSendFlag_ReuseSourceId

Used to indicate that the source node ID in the message header can be reused.

@35

 @35
Properties
kGetPeerDescription_MaxLength

Maximum length of string (including NUL character) returned by GetPeerDescription().

ConnectionClosedFunct

void(* ConnectionClosedFunct)(ExchangeContext *ec, WeaveConnection *con, WEAVE_ERROR conErr)

This function is the application callback to invoke when an existing Weave connection has been closed.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.
[in] con
A pointer to the WeaveConnection object.
[in] conErr
The WEAVE_ERROR type that was reported when the connection was closed.

KeyErrorFunct

void(* KeyErrorFunct)(ExchangeContext *ec, WEAVE_ERROR keyErr)

Type of key error message handling function.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.
[in] keyErr
The WEAVE_ERROR type that was reported in the key error message.

MessageReceiveFunct

void(* MessageReceiveFunct)(ExchangeContext *ec, const IPPacketInfo *pktInfo, const WeaveMessageInfo *msgInfo, uint32_t profileId, uint8_t msgType, PacketBuffer *payload)

This function is the application callback for handling a received Weave message.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.
[in] pktInfo
A pointer to the IPPacketInfo object.
[in] msgInfo
A pointer to the WeaveMessageInfo object.
[in] profileId
The profile identifier of the received message.
[in] msgType
The message type of the corresponding profile.
[in] payload
A pointer to the PacketBuffer object holding the message payload.

ResponseTimeoutFunct

void(* ResponseTimeoutFunct)(ExchangeContext *ec)

This function is the application callback to invoke when the timeout for the receipt of a response message has expired.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.

RetransmissionTimeoutFunct

void(* RetransmissionTimeoutFunct)(ExchangeContext *ec)

This function is the application callback to invoke when the timeout for the retransmission of a previously sent message has expired.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.

Timeout

uint32_t Timeout

Type used to express the timeout in this ExchangeContext, in milliseconds.

WRMPAckRcvdFunct

void(* WRMPAckRcvdFunct)(ExchangeContext *ec, void *msgCtxt)

This function is the application callback to invoke when an Acknowledgment is received for a Weave message that requested one as part of the Weave Reliable Messaging Protocol.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.
[in] msgCtxt
A pointer to some specific context object associated with the original message being acknowledged.

WRMPPauseRcvdFunct

void(* WRMPPauseRcvdFunct)(ExchangeContext *ec, uint32_t pauseTime)

This function is the application callback to invoke when a Throttle message or Delayed Delivery message is received as part of the Weave Reliable Messaging Protocol.

Each of these messages are accompanied with a time value (in milliseconds) that signifies the time to pause sending of Weave messages on this ExchangeContext.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.
[in] pauseTime
Time to pause transmission (in milliseconds).

WRMPSendErrorFunct

void(* WRMPSendErrorFunct)(ExchangeContext *ec, WEAVE_ERROR err, void *msgCtxt)

This function is the application callback to invoke when an error is encountered while sending a Weave message.

Details
Parameters
[in] ec
A pointer to the ExchangeContext object.
[in] err
The WEAVE_ERROR type that was encountered during the sending of the message.
[in] msgCtxt
A pointer to some specific context object associated with the original message being reported on.

Public attributes

AllowDuplicateMsgs

bool AllowDuplicateMsgs

Boolean indicator of whether duplicate messages are allowed for a given exchange.

AppState

void * AppState

Pointer to application-specific state object.

Con

WeaveConnection * Con

[READ ONLY] Associated Weave connection.

EncryptionType

uint8_t EncryptionType

Encryption type to use when sending a message.

ExchangeId

uint16_t ExchangeId

[READ ONLY] Assigned exchange ID.

ExchangeMgr

WeaveExchangeManager * ExchangeMgr

[READ ONLY] Owning exchange manager.

KeyId

uint16_t KeyId

Encryption key to use when sending a message.

OnAckRcvd

WRMPAckRcvdFunct OnAckRcvd

Application callback for received acknowledgment.

OnConnectionClosed

ConnectionClosedFunct OnConnectionClosed

OnDDRcvd

WRMPPauseRcvdFunct OnDDRcvd

Application callback for received Delayed Delivery message.

OnKeyError

KeyErrorFunct OnKeyError

This function is the application callback to invoke when key error message has been received from the peer.

OnMessageReceived

MessageReceiveFunct OnMessageReceived

OnResponseTimeout

ResponseTimeoutFunct OnResponseTimeout

OnRetransmissionTimeout

RetransmissionTimeoutFunct OnRetransmissionTimeout

OnSendError

WRMPSendErrorFunct OnSendError

Application callback for error while sending.

OnThrottleRcvd

WRMPPauseRcvdFunct OnThrottleRcvd

Application callback for received Throttle message.

PeerAddr

IPAddress PeerAddr

[READ ONLY] IP address of peer node.

PeerIntf

InterfaceId PeerIntf

[READ ONLY] Outbound interface to be used when sending messages to the peer.

(Only meaningful for UDP.)

PeerNodeId

uint64_t PeerNodeId

[READ ONLY] Node ID of peer node.

PeerPort

uint16_t PeerPort

[READ ONLY] Port of peer node.

ResponseTimeout

Timeout ResponseTimeout

Maximum time to wait for response (in milliseconds); 0 disables response timeout.

RetransInterval

uint32_t RetransInterval

Time between retransmissions (in milliseconds); 0 disables retransmissions.

mMsgProtocolVersion

uint16_t mMsgProtocolVersion

Message Protocol version for the ExchangeContext.

mWRMPConfig

WRMPConfig mWRMPConfig

WRMP configuration.

Public functions

Abort

void Abort(
  void
)

Abort the Exchange context immediately and release all references to it.

AddRef

void AddRef(
  void
)

Increment the reference counter for the exchange context by one.

AutoRequestAck

bool AutoRequestAck() const 

Returns whether an acknowledgment will be requested whenever a message is sent.

CancelRetrans

void CancelRetrans(
  void
)

Cancel the Trickle retransmission mechanism.

Close

void Close(
  void
)

Gracefully close an exchange context.

This call decrements the reference count and releases the exchange when the reference count goes to zero.

EncodeExchHeader

WEAVE_ERROR EncodeExchHeader(
  WeaveExchangeHeader *exchangeHeader,
  uint32_t profileId,
  uint8_t msgType,
  PacketBuffer *msgBuf,
  uint16_t sendFlags
)

Encode the exchange header into a message buffer.

Details
Parameters
[in] exchangeHeader
A pointer to the Weave Exchange header object.
[in] profileId
The profile identifier of the Weave message to be sent.
[in] msgType
The message type of the corresponding profile.
[in] msgBuf
A pointer to the PacketBuffer needed for the Weave message.
[in] sendFlags
Flags set by the application for the Weave message being sent.
Return Values
WEAVE_ERROR_BUFFER_TOO_SMALL
If the message buffer does not have sufficient space for encoding the exchange header.
WEAVE_NO_ERROR
If encoding of the message was successful.

GetAutoReleaseKey

bool GetAutoReleaseKey() const 

Return whether the encryption key associated with the exchange should be released when the exchange is freed.

GetCurrentRetransmitTimeout

uint32_t GetCurrentRetransmitTimeout(
  void
)

Get the current retransmit timeout.

It would be either the initial or the active retransmit timeout based on whether the ExchangeContext has an active message exchange going with its peer.

Details
Returns
the current retransmit time.

GetPeerDescription

void GetPeerDescription(
  char *buf,
  uint32_t bufSize
) const 

Constructs a string describing the peer node and its associated address / connection information.

Details
Parameters
[in] buf
A pointer to a buffer into which the string should be written. The supplied buffer should be at least as big as kGetPeerDescription_MaxLength. If a smaller buffer is given the string will be truncated to fit. The output will include a NUL termination character in all cases.
[in] bufSize
The size of the buffer pointed at by buf.

HandleTrickleMessage

void HandleTrickleMessage(
  const IPPacketInfo *pktInfo,
  const WeaveMessageInfo *msgInfo
)

Handle trickle message within the exchange context.

Details
Parameters
[in] pktInfo
A pointer to the IPPacketInfo object.
[in] msgInfo
A pointer to the Weave message info structure.

HasPeerRequestedAck

bool HasPeerRequestedAck(
  void
) const 

Determine whether peer requested acknowledgment for at least one message on this exchange.

Details
Returns
Returns 'true' if acknowledgment requested, else 'false'.

HasRcvdMsgFromPeer

bool HasRcvdMsgFromPeer(
  void
) const 

Determine whether at least one message has been received on this exchange from peer.

Details
Returns
Returns 'true' if message received, else 'false'.

IsAckPending

bool IsAckPending(
  void
) const 

Determine whether there is already an acknowledgment pending to be sent to the peer on this exchange.

IsConnectionClosed

bool IsConnectionClosed(
  void
) const 

Determine whether the ExchangeContext has an associated active WeaveConnection.

Details
Returns
Returns 'true' if connection is closed, else 'false'.

IsInitiator

bool IsInitiator(
  void
) const 

Determine whether the context is the initiator of the exchange.

Details
Returns
Returns 'true' if it is the initiator, else 'false'.

IsResponseExpected

bool IsResponseExpected(
  void
) const 

Determine whether a response is expected for messages sent over this exchange.

Details
Returns
Returns 'true' if response expected, else 'false'.

Release

void Release(
  void
)

Release reference to this exchange context.

If count is down to one then close the context, reset all application callbacks, and stop all timers.

SendCommonNullMessage

WEAVE_ERROR SendCommonNullMessage(
  void
)

Send a Common::Null message.

Details
Return Values
WEAVE_ERROR_NO_MEMORY
If no available PacketBuffers.
WEAVE_NO_ERROR
If the method succeeded or the error wasn't critical.
other
Another critical error returned by SendMessage().

SendMessage

WEAVE_ERROR SendMessage(
  uint32_t profileId,
  uint8_t msgType,
  PacketBuffer *msgPayload,
  uint16_t sendFlags,
  void *msgCtxt
)

Send a Weave message on this exchange.

Details
Parameters
[in] profileId
The profile identifier of the Weave message to be sent.
[in] msgType
The message type of the corresponding profile.
[in] msgBuf
A pointer to the PacketBuffer object holding the Weave message.
[in] sendFlags
Flags set by the application for the Weave message being sent.
[in] msgCtxt
A pointer to an application-specific context object to be associated with the message being sent.
Return Values
WEAVE_ERROR_INVALID_ARGUMENT
if an invalid argument was passed to this SendMessage API.
WEAVE_ERROR_SEND_THROTTLED
if this exchange context has been throttled when using the Weave reliable messaging protocol.
WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE
if there is a mismatch in the specific send operation and the Weave message protocol version that is supported. For example, this error would be generated if Weave Reliable Messaging semantics are being attempted when the Weave message protocol version is V1.
WEAVE_ERROR_NOT_CONNECTED
if the context was associated with a connection that is now closed.
WEAVE_ERROR_INCORRECT_STATE
if the state of the exchange context is incorrect.
WEAVE_NO_ERROR
if the Weave layer successfully sent the message down to the network layer.

SendMessage

WEAVE_ERROR SendMessage(
  uint32_t profileId,
  uint8_t msgType,
  PacketBuffer *msgBuf,
  uint16_t sendFlags,
  WeaveMessageInfo *msgInfo,
  void *msgCtxt
)

Send a Weave message on this exchange.

Details
Parameters
[in] profileId
The profile identifier of the Weave message to be sent.
[in] msgType
The message type of the corresponding profile.
[in] msgBuf
A pointer to the PacketBuffer object holding the Weave message.
[in] sendFlags
Flags set by the application for the Weave message being sent.
[in] msgInfo
A pointer to the WeaveMessageInfo object.
[in] msgCtxt
A pointer to an application-specific context object to be associated with the message being sent.
Return Values
WEAVE_ERROR_INVALID_ARGUMENT
if an invalid argument was passed to this SendMessage API.
WEAVE_ERROR_SEND_THROTTLED
if this exchange context has been throttled when using the Weave reliable messaging protocol.
WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE
if there is a mismatch in the specific send operation and the Weave message protocol version that is supported. For example, this error would be generated if Weave Reliable Messaging semantics are being attempted when the Weave message protocol version is V1.
WEAVE_ERROR_NOT_CONNECTED
if the context was associated with a connection that is now closed.
WEAVE_ERROR_INCORRECT_STATE
if the state of the exchange context is incorrect.
WEAVE_NO_ERROR
if the Weave layer successfully sent the message down to the network layer.

SetAckPending

void SetAckPending(
  bool inAckPending
)

Set if an acknowledgment needs to be sent back to the peer on this exchange.

Details
Parameters
[in] inAckPending
A Boolean indicating whether (true) or not (false) an acknowledgment should be sent back in response to a received message.

SetAutoReleaseKey

void SetAutoReleaseKey(
  bool autoReleaseKey
)

Set whether the encryption key associated with the exchange should be released when the exchange is freed.

Details
Parameters
[in] autoReleaseKey
True if the message encryption key should be automatically released.

SetAutoRequestAck

void SetAutoRequestAck(
  bool autoReqAck
)

Set whether an acknowledgment should be requested whenever a message is sent.

Details
Parameters
[in] autoReqAck
A Boolean indicating whether or not an acknowledgment should be requested whenever a message is sent.

SetConnectionClosed

void SetConnectionClosed(
  bool inConnectionClosed
)

Set the kFlagConnectionClosed flag bit.

This flag is set when a WeaveConnection associated with an ExchangeContext is closed.

Details
Parameters
[in] inConnectionClosed
A Boolean indicating whether (true) or not (false) the context was associated with a connection.

SetDropAck

void SetDropAck(
  bool inDropAck
)

Set whether the WeaveExchangeManager should not send acknowledgements for this context.

For internal, debug use only.

Details
Parameters
[in] inDropAck
A Boolean indicating whether (true) or not (false) the acknowledgements should be not sent for the exchange.

SetInitiator

void SetInitiator(
  bool inInitiator
)

Set the kFlagInitiator flag bit.

This flag is set by the node that initiates an exchange.

Details
Parameters
[in] inInitiator
A Boolean indicating whether (true) or not (false) the context is the initiator of the exchange.

SetMsgRcvdFromPeer

void SetMsgRcvdFromPeer(
  bool inMsgRcvdFromPeer
)

Set if a message has been received from the peer on this exchange.

Details
Parameters
[in] inMsgRcvdFromPeer
A Boolean indicating whether (true) or not (false) a message has been received from the peer on this exchange context.

SetPeerRequestedAck

void SetPeerRequestedAck(
  bool inPeerRequestedAck
)

Set if an acknowledgment was requested in the last message received on this exchange.

Details
Parameters
[in] inPeerRequestedAck
A Boolean indicating whether (true) or not (false) an acknowledgment was requested in the last received message.

SetResponseExpected

void SetResponseExpected(
  bool inResponseExpected
)

Set whether a response is expected on this exchange.

Details
Parameters
[in] inResponseExpected
A Boolean indicating whether (true) or not (false) a response is expected on this exchange.

SetShouldAutoReleaseConnection

void SetShouldAutoReleaseConnection(
  bool autoReleaseCon
)

Set whether the Weave connection associated with the exchange should be released when the exchange is freed.

Details
Parameters
[in] autoReleaseCon
True if the Weave connection should be automatically released.

SetupTrickleRetransmit

WEAVE_ERROR SetupTrickleRetransmit(
  uint32_t retransInterval,
  uint8_t threshold,
  uint32_t timeout
)

Setup the trickle retransmission mechanism by setting the corresponding retransmission interval and rebroadcast threshold.

Details
Parameters
[in] retransInterval
The retransmit interval of the Trickle rebroadcast algorithm.
[in] threshold
The maximum number of times a message is rebroadcast.
[in] timeout
The maximum time to wait before canceling the Trickle retransmission timer.
Returns
WEAVE_NO_ERROR if Trickle setup was successful, else an INET_ERROR mapped into a WEAVE_ERROR.

ShouldAutoReleaseConnection

bool ShouldAutoReleaseConnection() const 

Return whether the Weave connection associated with the exchange should be released when the exchange is freed.

ShouldDropAck

bool ShouldDropAck(
  void
) const 

Determine whether the WeaveExchangeManager should not send an acknowledgement.

For internal, debug use only.

StartTimerT

WEAVE_ERROR StartTimerT(
  void
)

Start the Trickle rebroadcast algorithm's periodic retransmission timer mechanism.

Details
Returns
WEAVE_NO_ERROR if successful, else an INET_ERROR mapped into a WEAVE_ERROR.

TeardownTrickleRetransmit

void TeardownTrickleRetransmit(
  void
)

Tear down the Trickle retransmission mechanism by canceling the periodic timers within Trickle and freeing the message buffer holding the Weave message.

UseEphemeralUDPPort

bool UseEphemeralUDPPort(
  void
) const 

Return whether outbound messages sent via the exchange should be sent from the local ephemeral UDP port.

WRMPFlushAcks

WEAVE_ERROR WRMPFlushAcks(
  void
)

WRMPSendDelayedDelivery

WEAVE_ERROR WRMPSendDelayedDelivery(
  uint32_t PauseTimeMillis,
  uint64_t DelayedNodeId
)

Send a Delayed Delivery message to notify a sender node that its previously sent message would experience an expected delay before being delivered to the recipient.

One of the possible causes for messages to be delayed before being delivered is when the recipient end node is sleepy. This message is potentially generated by a suitable intermediate node in the send path who has enough knowledge of the recipient to infer about the delayed delivery. Upon receiving this message, the sender would re-adjust its retransmission timers for messages that seek acknowledgments back.

Details
Parameters
[in] pauseTimeMillis
The time (in milliseconds) that the previously sent message is expected to be delayed before being delivered.
[in] delayedNodeId
The node identifier of the peer node to whom the mesage delivery would be delayed.
Return Values
WEAVE_ERROR_INVALID_ARGUMENT
if an invalid argument was passed to this SendMessage API.
WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE
if there is a mismatch in the specific send operation and the Weave message protocol version that is supported. For example, this error would be generated if Weave Reliable Messaging semantics are being attempted when the Weave message protocol version is V1.
WEAVE_ERROR_NOT_CONNECTED
if the context was associated with a connection that is now closed.
WEAVE_ERROR_INCORRECT_STATE
if the state of the exchange context is incorrect.
WEAVE_NO_ERROR
if the Weave layer successfully sent the message down to the network layer.

WRMPSendThrottleFlow

WEAVE_ERROR WRMPSendThrottleFlow(
  uint32_t PauseTimeMillis
)

Send a Throttle Flow message to the peer node requesting it to throttle its sending of messages.

Details
Parameters
[in] pauseTimeMillis
The time (in milliseconds) that the recipient is expected to throttle its sending.
Return Values
WEAVE_ERROR_INVALID_ARGUMENT
If an invalid argument was passed to this SendMessage API.
WEAVE_ERROR_SEND_THROTTLED
If this exchange context has been throttled when using the Weave reliable messaging protocol.
WEAVE_ERROR_WRONG_MSG_VERSION_FOR_EXCHANGE
If there is a mismatch in the specific send operation and the Weave message protocol version that is supported. For example, this error would be generated if Weave Reliable Messaging semantics are being attempted when the Weave message protocol version is V1.
WEAVE_ERROR_NOT_CONNECTED
If the context was associated with a connection that is now closed.
WEAVE_ERROR_INCORRECT_STATE
If the state of the exchange context is incorrect.
WEAVE_NO_ERROR
If the Weave layer successfully sent the message down to the network layer.