libsparklepaw
PawSD library
Loading...
Searching...
No Matches
sprkl_transport Struct Reference

Generic transport vtable. More...

#include <libsparklepaw/transport.h>

Data Fields

void * opaque
 Instance-specific data.
int(* sendrequest )(struct sprkl_transport *, struct sprkl_request *)
 Sends a request through the transport.
int(* recvrequest )(struct sprkl_transport *, struct sprkl_request *)
 Waits for and receives a request through the transport.
int(* sendresponse )(struct sprkl_transport *, struct sprkl_response *)
 Sends a response through the transport.
int(* recvresponse )(struct sprkl_transport *, struct sprkl_response *)
 Waits for and receives a response through the transport.
char *(* strerror )(struct sprkl_transport *, int)
 Converts an error number to a string representation.

Detailed Description

Generic transport vtable.

Generally you shouldn't use the contained functions directly, instead invoke them via their wrappers, e.g. sprkl_transport_sendrequest().

Todo
Non-blocking version?

Field Documentation

◆ recvrequest

int(* sprkl_transport::recvrequest) (struct sprkl_transport *, struct sprkl_request *)

Waits for and receives a request through the transport.

Parameters
1Reference to this transport itself.
2Empty request object to fill the data into.
Returns
0 if successful or some number otherwise.

◆ recvresponse

int(* sprkl_transport::recvresponse) (struct sprkl_transport *, struct sprkl_response *)

Waits for and receives a response through the transport.

Parameters
1Reference to this transport itself.
2Empty response object to fill the data into. (verb preset by caller)
Returns
0 if successful or some number otherwise.

◆ sendrequest

int(* sprkl_transport::sendrequest) (struct sprkl_transport *, struct sprkl_request *)

Sends a request through the transport.

Parameters
1Reference to this transport itself.
2The request to send.
Returns
0 if successful or some number otherwise.

◆ sendresponse

int(* sprkl_transport::sendresponse) (struct sprkl_transport *, struct sprkl_response *)

Sends a response through the transport.

Parameters
1Reference to this transport itself.
2The response to send.
Returns
0 if successful or some number otherwise.

◆ strerror

char *(* sprkl_transport::strerror) (struct sprkl_transport *, int)

Converts an error number to a string representation.

Parameters
1Reference to this transport itself.
2The error number as returned by one of the other virtual functions.
Returns
Null-terminated string pointer that should not be freed by the caller.

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