tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | List of all members
tvm::runtime::micro_rpc::Unframer Class Reference

#include <framing.h>

Collaboration diagram for tvm::runtime::micro_rpc::Unframer:

Public Member Functions

 Unframer (WriteStream *stream)
 
tvm_crt_error_t Write (const uint8_t *data, size_t data_size_bytes, size_t *bytes_consumed)
 Push data into unframer and try to decode one packet. More...
 
void Reset ()
 Reset unframer to initial state. More...
 
size_t BytesNeeded ()
 Return an underestimate of the number of bytes needed from the wire. More...
 

Constructor & Destructor Documentation

◆ Unframer()

tvm::runtime::micro_rpc::Unframer::Unframer ( WriteStream stream)
inlineexplicit

Member Function Documentation

◆ BytesNeeded()

size_t tvm::runtime::micro_rpc::Unframer::BytesNeeded ( )

Return an underestimate of the number of bytes needed from the wire.

◆ Reset()

void tvm::runtime::micro_rpc::Unframer::Reset ( )

Reset unframer to initial state.

◆ Write()

tvm_crt_error_t tvm::runtime::micro_rpc::Unframer::Write ( const uint8_t *  data,
size_t  data_size_bytes,
size_t *  bytes_consumed 
)

Push data into unframer and try to decode one packet.

This function will return when exactly one packet has been decoded. It may not consume all of data in this case, and valid bytes may remain at the end of data.

Parameters
dataThe new data to unframe and send downstream.
data_size_bytesThe number of valid bytes in data.
bytes_consumedPointer written with the number of bytes consumed from data.
Returns
  • kTvmErrorNoError when successful – continue writing data.
  • kTvmErrorFramingInvalidState when the Unframer was in or enters an invalid state (probably indicates memory corruption).
  • kTvmErrorFramingShortPacket when a new packet started before the current one ended.
  • kTvmErrorFramingInvalidEscape when an invalid escape sequence was seen

The documentation for this class was generated from the following file: