I am looking for an RPC (Remote Procedure Call) stub generator that generates C code that allows me to call functions from one device (embedded) on a different device (PC) over some data link (USB or Bluetooth).
A client header file with functions that the client provides:
void startMeasurement(); uint32 getNumberOfDataPoints(); void getData(uint8 *data, uint16 length);
A server header file with functions that the server provides:
int displayResult(char *text); struct Configuration getConfiguration();
void sendData(const void *data, int length);
An implementation of the client functions for the server (server stub) and an implementation of the server functions for the client (client stub).
void receiveData(const void *data, int length);in both stubs that turn the bytes back into function calls.
When the client calls
int i = displayResult("Hello World!");the auto-generated stub version is called, puts the call (function number?) and the parameter data into bytes and sends them with my
sendDatafunction. On the server side my network function receives some bytes and calls the auto generated
receiveDatafunction which unpacks the bytes and calls my
displayResultfunction with the correct arguments, takes the return value, sends it back over the network where the client stub receives it and returns to my code with the return value.
The tool must take care of annoying little details such as endianness, padding in structs, compatibility with 8/16/32/64 bit code and that it may get 15 bytes when 16 were required, so it must buffer the data, may then get another 15 bytes which may complete multiple calls at once.
Error correction, a timeout and a reset function to recover from a disconnect.
Generating a hash over the input (ideally over the input that matters, so that changing a comment does not change the hash) and putting it into both stubs (as
#defines) so that I can check if the stubs fit to each other.
Favor client performance over server performance.
It is acceptable if the tool restricts the types I can use to, for example, uint8/16/32 and variable length arrays of those.