PebbleOS
Loading...
Searching...
No Matches
Data Fields
ReceiverImplementation Struct Reference

Buffers inbound message payloads and schedules endpoint handlers. More...

#include <session_receive_router.h>

Data Fields

Receiver *(* prepare )(CommSession *session, const PebbleProtocolEndpoint *endpoint, size_t total_payload_length)
 Prepare a Receiver context for a new message.
 
void(* write )(Receiver *receiver, const uint8_t *data, size_t length)
 Write payload data of the current message.
 
void(* finish )(Receiver *receiver)
 Signal that the whole payload has been written.
 
void(* cleanup )(Receiver *receiver)
 Discard the current message because the session closed.
 

Detailed Description

Buffers inbound message payloads and schedules endpoint handlers.

Message receiver implementation, see struct ReceiverImplementation.

A receiver creates a Receiver context (prepare), buffers payload data (write) and schedules the endpoint handler (finish). It can be specific to one endpoint (Put Bytes needs a large buffer) or shared by endpoints with similar buffering needs.

Several sessions may be writing partial messages concurrently; the receiver must handle that. All callbacks are mandatory.

Field Documentation

◆ cleanup

void(* ReceiverImplementation::cleanup) (Receiver *receiver)

Discard the current message because the session closed.

Releases the Receiver context without calling the endpoint handler.

Parameters
receiverReceiver context.

◆ finish

void(* ReceiverImplementation::finish) (Receiver *receiver)

Signal that the whole payload has been written.

Schedules the endpoint handler and releases the Receiver context.

Parameters
receiverReceiver context.

◆ prepare

Receiver *(* ReceiverImplementation::prepare) (CommSession *session, const PebbleProtocolEndpoint *endpoint, size_t total_payload_length)

Prepare a Receiver context for a new message.

The endpoint's receiver_opt is available through endpoint.

Parameters
sessionSession receiving the message.
endpointDestination endpoint.
total_payload_lengthPayload length in bytes.
Returns
Receiver context, or NULL to drop the message (e.g. not enough space).

◆ write

void(* ReceiverImplementation::write) (Receiver *receiver, const uint8_t *data, size_t length)

Write payload data of the current message.

Parameters
receiverReceiver context.
dataPayload data.
lengthLength of data in bytes.

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