#include <framing.h>
|
typedef ssize_t(* | WriteFunc) (const uint8_t *data, size_t data_size_bytes) |
|
◆ WriteFunc
typedef ssize_t(* tvm::runtime::micro_rpc::Framer::WriteFunc) (const uint8_t *data, size_t data_size_bytes) |
◆ Framer()
tvm::runtime::micro_rpc::Framer::Framer |
( |
WriteStream * |
stream | ) |
|
|
inlineexplicit |
◆ FinishPacket()
◆ Reset()
void tvm::runtime::micro_rpc::Framer::Reset |
( |
| ) |
|
◆ StartPacket()
tvm_crt_error_t tvm::runtime::micro_rpc::Framer::StartPacket |
( |
size_t |
payload_size_bytes | ) |
|
Start framing and writing a new packet to the wire.
When transmitting payloads that are too large to be buffered, call this function first to send the packet header and length fields.
- Parameters
-
payload_size_bytes | Number of payload bytes included as part of this packet. |
- Returns
- kTvmErrorNoError when no error occurs
- kTvmErrorWriteStreamShortWrite if the WriteStream passed to constructor's Write() function returns 0.
- kTvmErrorWriteStreamShortWrite if the WriteStream passed to constructor's Write() function returns an invalid positive number.
- Any negative value (i.e. with bits in kTvmErrorSystemErrorMask set) returned by the WriteStream's Write() function.
◆ Write()
tvm_crt_error_t tvm::runtime::micro_rpc::Framer::Write |
( |
const uint8_t * |
payload, |
|
|
size_t |
payload_size_bytes |
|
) |
| |
Frame and write a full packet.
- Parameters
-
payload | The entire packet payload. |
payload_size_bytes | Number of bytes in the packet. |
- Returns
- kTvmErrorNoError when no error occurs
- kTvmErrorWriteStreamShortWrite if the WriteStream passed to constructor's Write() function returns 0.
- kTvmErrorWriteStreamShortWrite if the WriteStream passed to constructor's Write() function returns an invalid positive number.
- Any negative value (i.e. with bits in kTvmErrorSystemErrorMask set) returned by the WriteStream's Write() function.
◆ WritePayloadChunk()
tvm_crt_error_t tvm::runtime::micro_rpc::Framer::WritePayloadChunk |
( |
const uint8_t * |
payload_chunk, |
|
|
size_t |
payload_chunk_size_bytes |
|
) |
| |
Write payload data to the wire.
When transmitting payloads that are too large to be buffered, call this function after calling StartPacket to escape and transmit framed payloads. This function can be called multiple times for a single packet.
- Parameters
-
payload_chunk | A piece of the packet payload. |
payload_chunk_size_bytes | Number of valid bytes in payload_chunk. |
- Returns
- kTvmErrorNoError when no error occurs
- kTvmErrorFramingInvalidState when StartPacket() has not been called.
- kTvmErrorFramingPayloadOverflow when more bytes were requested to be written than were declared in the payload_size_bytes parameter given to StartPacket().
- kTvmErrorWriteStreamShortWrite if the WriteStream passed to constructor's Write() function returns 0.
- kTvmErrorWriteStreamShortWrite if the WriteStream passed to constructor's Write() function returns an invalid positive number.
- Any negative value (i.e. with bits in kTvmErrorSystemErrorMask set) returned by the WriteStream's Write() function.
The documentation for this class was generated from the following file: