Google is committed to advancing racial equity for Black communities. See how.

nl::Weave::Profiles::BDX_Development::BdxNode

Summary

Constructors and Destructors

BdxNode(void)
Default constructor that sets all members to NULL.

Public functions

AllowBdxTransferToRun(bool aEnable)
void
Use to enable/disable the BDX server without fully shutting it down and restarting.
AwaitBdxReceiveInit(ReceiveInitHandler aReceiveInitHandler)
AwaitBdxSendInit(SendInitHandler aSendInitHandler)
CanBdxTransferRun(void)
bool
Returns true if the BDX server is allowed to start a transfer at this time, false otherwise.
Init(WeaveExchangeManager *anExchangeMgr)
Put all transfers in a default state ready for use, store the WeaveExchangeManager and any other necessary Weave resources, and sets allowBdxTransferToRun(true).
InitBdxReceive(BDXTransfer & aXfer, bool aICanDrive, bool aUCanDrive, bool aAsyncOk, ReferencedTLVData *aMetaData)
InitBdxSend(BDXTransfer & aXfer, bool aICanDrive, bool aUCanDrive, bool aAsyncOk, ReferencedTLVData *aMetaData)
InitBdxSend(BDXTransfer & aXfer, bool aICanDrive, bool aUCanDrive, bool aAsyncOk, SendInit::MetaDataTLVWriteCallback aMetaDataWriteCallback, void *aMetaDataAppState)
IsInitialized(void)
bool
Returns true if this BdxNode has already been initialized.
NewTransfer(Binding *aBinding, BDXHandlers aBDXHandlers, ReferencedString & aFileDesignator, void *anAppState, BDXTransfer *& aXfer)
Get and set up a new BDXTransfer from transfer pool if available, or set to NULL otherwise and return an error.
NewTransfer(WeaveConnection *aCon, BDXHandlers aBDXHandlers, ReferencedString & aFileDesignator, void *anAppState, BDXTransfer *& aXfer)
Get and set up a new BDXTransfer from transfer pool if available, or set to NULL otherwise and return an error.
Shutdown(void)
Shuts down all transfers and releases any Weave resources (currently sets mExchangeMgr to NULL).

Public static functions

HandleReceiveInit(ExchangeContext *anEc, const IPPacketInfo *aPktInfo, const WeaveMessageInfo *aWeaveMsgInfo, uint32_t aProfileId, uint8_t aMessageType, PacketBuffer *aPacketBuffer)
void
HandleSendInit(ExchangeContext *anEc, const IPPacketInfo *aPktInfo, const WeaveMessageInfo *aWeaveMsgInfo, uint32_t aProfileId, uint8_t aMessageType, PacketBuffer *aPacketBuffer)
void
ShutdownTransfer(BDXTransfer *aXfer)
void
Shutdown the given transfer object and return it to pool.

Public functions

AllowBdxTransferToRun

void AllowBdxTransferToRun(
  bool aEnable
)

Use to enable/disable the BDX server without fully shutting it down and restarting.

Details
Parameters
[in] aEnable
Enable (true) or disable (false)

AwaitBdxReceiveInit

WEAVE_ERROR AwaitBdxReceiveInit(
  ReceiveInitHandler aReceiveInitHandler
)

AwaitBdxSendInit

WEAVE_ERROR AwaitBdxSendInit(
  SendInitHandler aSendInitHandler
)

BdxNode

 BdxNode(
  void
)

Default constructor that sets all members to NULL.

Don't try to do anything with the server until you've at least called init().

CanBdxTransferRun

bool CanBdxTransferRun(
  void
)

Returns true if the BDX server is allowed to start a transfer at this time, false otherwise.

Details
Returns
true if BDX transfer is allowed, false if not

Init

WEAVE_ERROR Init(
  WeaveExchangeManager *anExchangeMgr
)

Put all transfers in a default state ready for use, store the WeaveExchangeManager and any other necessary Weave resources, and sets allowBdxTransferToRun(true).

Details
Parameters
[in] anExchangeMgr
An exchange manager to use for this bulk transfer operation.
Return Values
WEAVE_NO_ERROR
if successful
WEAVE_ERROR_INCORRECT_STATE
if mExchangeMgr isn't null, already initialized

InitBdxReceive

WEAVE_ERROR InitBdxReceive(
  BDXTransfer & aXfer,
  bool aICanDrive,
  bool aUCanDrive,
  bool aAsyncOk,
  ReferencedTLVData *aMetaData
)

InitBdxSend

WEAVE_ERROR InitBdxSend(
  BDXTransfer & aXfer,
  bool aICanDrive,
  bool aUCanDrive,
  bool aAsyncOk,
  ReferencedTLVData *aMetaData
)

InitBdxSend

WEAVE_ERROR InitBdxSend(
  BDXTransfer & aXfer,
  bool aICanDrive,
  bool aUCanDrive,
  bool aAsyncOk,
  SendInit::MetaDataTLVWriteCallback aMetaDataWriteCallback,
  void *aMetaDataAppState
)

IsInitialized

bool IsInitialized(
  void
)

Returns true if this BdxNode has already been initialized.

Details
Returns
true if this object has been initialized

NewTransfer

WEAVE_ERROR NewTransfer(
  Binding *aBinding,
  BDXHandlers aBDXHandlers,
  ReferencedString & aFileDesignator,
  void *anAppState,
  BDXTransfer *& aXfer
)

Get and set up a new BDXTransfer from transfer pool if available, or set to NULL otherwise and return an error.

Details
Parameters
[in] aBinding
The Binding to the node we will initiate the transfer with. It's used to create an associated ExchangeContext for this transfer.
[in] aBDXHandlers
A structure of BDX callback handlers to be called during the transfer
[in] aFileDesignator
The file designator for the file that will be transferred.
[in] anAppState
An application-specific state object to be attached to the BDXTransfer for use by the user application and associated callbacks.
[in] aXfer
A passed-by-reference pointer that will point to the new BDXTransfer object if one is available, else NULL.
Return Values
WEAVE_NO_ERROR
If we successfully found a new BDXTransfer.
WEAVE_ERROR_NO_MEMORY
If unable to create ExchangeContext
WEAVE_ERROR_TOO_MANY_CONNECTIONS
If too many transfers are currently active and aXfer is NULL
WEAVE_ERROR_INCORRECT_STATE
If aBinding is not prepared

NewTransfer

WEAVE_ERROR NewTransfer(
  WeaveConnection *aCon,
  BDXHandlers aBDXHandlers,
  ReferencedString & aFileDesignator,
  void *anAppState,
  BDXTransfer *& aXfer
)

Get and set up a new BDXTransfer from transfer pool if available, or set to NULL otherwise and return an error.

Details
Parameters
[in] aCon
The WeaveConnection to the node we will initiate the transfer with. It's used to create an associated ExchangeContext for this transfer.
[in] aBDXHandlers
A structure of BDX callback handlers to be called during the transfer
[in] aFileDesignator
The file designator for the file that will be transferred.
[in] anAppState
An application-specific state object to be attached to the BDXTransfer for use by the user application and associated callbacks.
[in] aXfer
A passed-by-reference pointer that will point to the new BDXTransfer object if one is available, else NULL.
Return Values
WEAVE_NO_ERROR
If we successfully found a new BDXTransfer.
WEAVE_ERROR_NO_MEMORY
If unable to create ExchangeContext
WEAVE_ERROR_TOO_MANY_CONNECTIONS
If too many transfers are currently active and aXfer is NULL
WEAVE_ERROR_INCORRECT_STATE
If mExchangeMgr has not been set yet or if aCon has not successfully connected

Shutdown

WEAVE_ERROR Shutdown(
  void
)

Shuts down all transfers and releases any Weave resources (currently sets mExchangeMgr to NULL).

Sets AllowBdxTransferToRun(false) and disconnects any current callbacks (for example, SendInitHandler).

Details
Returns
WEAVE_NO_ERROR if successfully shut down, other error if AwaitBdxSend/ReceiveInit returns an error

Public static functions

HandleReceiveInit

void HandleReceiveInit(
  ExchangeContext *anEc,
  const IPPacketInfo *aPktInfo,
  const WeaveMessageInfo *aWeaveMsgInfo,
  uint32_t aProfileId,
  uint8_t aMessageType,
  PacketBuffer *aPacketBuffer
)

HandleSendInit

void HandleSendInit(
  ExchangeContext *anEc,
  const IPPacketInfo *aPktInfo,
  const WeaveMessageInfo *aWeaveMsgInfo,
  uint32_t aProfileId,
  uint8_t aMessageType,
  PacketBuffer *aPacketBuffer
)

ShutdownTransfer

void ShutdownTransfer(
  BDXTransfer *aXfer
)

Shutdown the given transfer object and return it to pool.

This simply defers to BDXTransfer::Shutdown()

Details
Parameters
[in] aXfer
The BDXTransfer to shut down