nl::Weave::Profiles::BDX_Development::SendInit

#include <src/lib/profiles/bulk-data-transfer/Development/BDXMessages.h>

The SendInit message is used to start an exchange when the sender is the initiator.

Summary

Inheritance

Direct Known Subclasses: nl::Weave::Profiles::BDX_Development::ReceiveInit

Constructors and Destructors

SendInit(void)

Public types

MetaDataTLVWriteCallback)(uint8_t *aBuffer, uint16_t aBufferLength, uint16_t &aNumBytesWritten, void *aAppState) typedef
MetaDataTLVWriteCallback provides a means by which a client can supply a SendInit with any metadata they want.

Public attributes

mAsynchronousModeSupported
bool
True if we can support async mode.
mDefiniteLength
bool
True if the length field is present.
mFileDesignator
String containing pre-negotiated information.
mLength
uint64_t
Proposed length of data in transfer, 0 for indefinite.
mMaxBlockSize
uint16_t
Proposed max block size to use in transfer.
mMetaData
Optional TLV Metadata.
mMetaDataAppState
void *
Optional app state for TLV Metadata.
mMetaDataWriteCallback
Optional function to write out TLV Metadata.
mReceiverDriveSupported
bool
True if we can support receiver drive.
mSenderDriveSupported
bool
True if we can support sender drive.
mStartOffset
uint64_t
Proposed start offset of data.
mStartOffsetPresent
bool
True if the start offset field is present.
mVersion
uint8_t
Version of the BDX protocol we decided on.
mWideRange
bool
True if offset and length are 64 bits.

Public functions

init(uint8_t aVersion, bool aSenderDrive, bool aReceiverDrive, bool aAsynchMode, uint16_t aMaxBlockSize, uint64_t aStartOffset, uint64_t aLength, ReferencedString & aFileDesignator, ReferencedTLVData *aMetaData)
Initialize a "wide" SendInit.
init(uint8_t aVersion, bool aSenderDrive, bool aReceiverDrive, bool aAsynchMode, uint16_t aMaxBlockSize, uint32_t aStartOffset, uint32_t aLength, ReferencedString & aFileDesignator, ReferencedTLVData *aMetaData)
Initialize a "non-wide" SendInit (32 bit start offset, 32 bit length)
init(uint8_t aVersion, bool aSenderDrive, bool aReceiverDrive, bool aAsynchMode, uint16_t aMaxBlockSize, uint64_t aStartOffset, uint64_t aLength, ReferencedString & aFileDesignator, MetaDataTLVWriteCallback aMetaDataWriteCallback, void *aMetaDataAppState)
Initialize a "wide" SendInit.
init(uint8_t aVersion, bool aSenderDrive, bool aReceiverDrive, bool aAsynchMode, uint16_t aMaxBlockSize, uint32_t aStartOffset, uint32_t aLength, ReferencedString & aFileDesignator, MetaDataTLVWriteCallback aMetaDataWriteCallback, void *aMetaDataAppState)
Initialize a "non-wide" SendInit (32 bit start offset, 32 bit length)
operator==(const SendInit &) const
bool
Equality comparison between SendInit messages.
pack(PacketBuffer *aBuffer)
Pack a send init message into an PacketBuffer.
packedLength(void)
uint16_t
Returns the packed length of this send init message.

Public static functions

parse(PacketBuffer *aBuffer, SendInit & aRequest)
Parse data from an PacketBuffer into a SendInit message format.

Public types

MetaDataTLVWriteCallback

WEAVE_ERROR(* MetaDataTLVWriteCallback)(uint8_t *aBuffer, uint16_t aBufferLength, uint16_t &aNumBytesWritten, void *aAppState)

MetaDataTLVWriteCallback provides a means by which a client can supply a SendInit with any metadata they want.

The client is free to supply pre-encoded TLV (faster), encode on-the-fly (uses less memory), lazy-encode (a littl faster on startup), etc. as they see fit.

In all cases, it is assumed that the data produced by the callback is constant for a given SendInit, i.e. does not change no matter when it is called. This is because the callback is also used to compute the length of any such written-out TLV, which could be requested at any time.

Details
Parameters
[in] aBuffer
The destination buffer, into which some TLV can be written
[in] aBufferLength
The length (in bytes) of the destination buffer
[in,out] aNumBytesWritten
The the number of bytes written to the destination buffer
[in] aAppState
User-provided app state
Return Values
WEAVE_ERROR
Any error encountered.

Public attributes

mAsynchronousModeSupported

bool mAsynchronousModeSupported

True if we can support async mode.

mDefiniteLength

bool mDefiniteLength

True if the length field is present.

mFileDesignator

ReferencedString mFileDesignator

String containing pre-negotiated information.

mLength

uint64_t mLength

Proposed length of data in transfer, 0 for indefinite.

mMaxBlockSize

uint16_t mMaxBlockSize

Proposed max block size to use in transfer.

mMetaData

ReferencedTLVData mMetaData

Optional TLV Metadata.

mMetaDataAppState

void * mMetaDataAppState

Optional app state for TLV Metadata.

mMetaDataWriteCallback

MetaDataTLVWriteCallback mMetaDataWriteCallback

Optional function to write out TLV Metadata.

mReceiverDriveSupported

bool mReceiverDriveSupported

True if we can support receiver drive.

mSenderDriveSupported

bool mSenderDriveSupported

True if we can support sender drive.

mStartOffset

uint64_t mStartOffset

Proposed start offset of data.

mStartOffsetPresent

bool mStartOffsetPresent

True if the start offset field is present.

mVersion

uint8_t mVersion

Version of the BDX protocol we decided on.

mWideRange

bool mWideRange

True if offset and length are 64 bits.

Public functions

SendInit

 SendInit(
  void
)

init

WEAVE_ERROR init(
  uint8_t aVersion,
  bool aSenderDrive,
  bool aReceiverDrive,
  bool aAsynchMode,
  uint16_t aMaxBlockSize,
  uint64_t aStartOffset,
  uint64_t aLength,
  ReferencedString & aFileDesignator,
  ReferencedTLVData *aMetaData
)

Initialize a "wide" SendInit.

Details
Parameters
[in] aVersion
Version of BDX that we are using
[in] aSenderDrive
True if the sender is driving
[in] aReceiverDrive
True if the receiver is driving
[in] aAsynchMode
True if the device supports asynchronous mode
[in] aMaxBlockSize
Proposal for a maximum block size for this transfer
[in] aStartOffset
Start offset in the file that we should start at
[in] aLength
Length of the file to be transferred - 0 means it has indefinite length
[in] aFileDesignator
A string that identifies the data to be transferred
[in] aMetaData
(optional) Additional data in TLV format
Returns
WEAVE_NO_ERROR if successful

init

WEAVE_ERROR init(
  uint8_t aVersion,
  bool aSenderDrive,
  bool aReceiverDrive,
  bool aAsynchMode,
  uint16_t aMaxBlockSize,
  uint32_t aStartOffset,
  uint32_t aLength,
  ReferencedString & aFileDesignator,
  ReferencedTLVData *aMetaData
)

Initialize a "non-wide" SendInit (32 bit start offset, 32 bit length)

Details
Parameters
[in] aVersion
Version of BDX that we are using
[in] aSenderDrive
True if the sender is driving
[in] aReceiverDrive
True if the receiver is driving
[in] aAsynchMode
True if the device supports asynchronous mode
[in] aMaxBlockSize
Proposal for a maximum block size for this transfer
[in] aStartOffset
Start offset in the file that we should start at
[in] aLength
Length of the file to be transferred - 0 means it has indefinite length
[in] aFileDesignator
A string that identifies the data to be transferred
[in] aMetaData
(optional) Additional data in TLV format
Returns
WEAVE_NO_ERROR if successful

init

WEAVE_ERROR init(
  uint8_t aVersion,
  bool aSenderDrive,
  bool aReceiverDrive,
  bool aAsynchMode,
  uint16_t aMaxBlockSize,
  uint64_t aStartOffset,
  uint64_t aLength,
  ReferencedString & aFileDesignator,
  MetaDataTLVWriteCallback aMetaDataWriteCallback,
  void *aMetaDataAppState
)

Initialize a "wide" SendInit.

Details
Parameters
[in] aVersion
Version of BDX that we are using
[in] aSenderDrive
True if the sender is driving
[in] aReceiverDrive
True if the receiver is driving
[in] aAsynchMode
True if the device supports asynchronous mode
[in] aMaxBlockSize
Proposal for a maximum block size for this transfer
[in] aStartOffset
Start offset in the file that we should start at
[in] aLength
Length of the file to be transferred - 0 means it has indefinite length
[in] aFileDesignator
A string that identifies the data to be transferred
[in] aMetaDataWriteCallback
(optional) A function to write out additional data in TLV format
[in] aMetaDataAppState
An optional context to be passed into the aMetaDataWriteCallback
Returns
WEAVE_NO_ERROR if successful

init

WEAVE_ERROR init(
  uint8_t aVersion,
  bool aSenderDrive,
  bool aReceiverDrive,
  bool aAsynchMode,
  uint16_t aMaxBlockSize,
  uint32_t aStartOffset,
  uint32_t aLength,
  ReferencedString & aFileDesignator,
  MetaDataTLVWriteCallback aMetaDataWriteCallback,
  void *aMetaDataAppState
)

Initialize a "non-wide" SendInit (32 bit start offset, 32 bit length)

Details
Parameters
[in] aVersion
Version of BDX that we are using
[in] aSenderDrive
True if the sender is driving
[in] aReceiverDrive
True if the receiver is driving
[in] aAsynchMode
True if the device supports asynchronous mode
[in] aMaxBlockSize
Proposal for a maximum block size for this transfer
[in] aStartOffset
Start offset in the file that we should start at
[in] aLength
Length of the file to be transferred - 0 means it has indefinite length
[in] aFileDesignator
A string that identifies the data to be transferred
[in] aMetaDataWriteCallback
(optional) A function to write out additional data in TLV format
[in] aMetaDataAppState
(optional) A context to be passed back into the callback function
Returns
WEAVE_NO_ERROR if successful

operator==

bool operator==(
  const SendInit &
) const 

Equality comparison between SendInit messages.

Details
Parameters
[in] another
Another SendInit message to compare this one to
Returns
true iff they have all the same fields.

pack

WEAVE_ERROR pack(
  PacketBuffer *aBuffer
)

Pack a send init message into an PacketBuffer.

Details
Parameters
[out] aBuffer
An PacketBuffer to pack the SendInit message in
Return Values
WEAVE_NO_ERROR
If successful
WEAVE_ERROR_BUFFER_TOO_SMALL
If buffer is too small

packedLength

uint16_t packedLength(
  void
)

Returns the packed length of this send init message.

Details
Returns
length of the message when packed

Public static functions

parse

WEAVE_ERROR parse(
  PacketBuffer *aBuffer,
  SendInit & aRequest
)

Parse data from an PacketBuffer into a SendInit message format.

Details
Parameters
[in] aBuffer
Pointer to an PacketBuffer which has the data we want to parse out
[out] aRequest
Pointer to a SendInit object where we should store the results
Return Values
WEAVE_NO_ERROR
If successful
WEAVE_ERROR_BUFFER_TOO_SMALL
If buffer is too small