3

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).

Input

  • 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();
    
  • Network function:

    void sendData(const void *data, int length);
    

Output

  • An implementation of the client functions for the server (server stub) and an implementation of the server functions for the client (client stub).

  • A function void receiveData(const void *data, int length); in both stubs that turn the bytes back into function calls.

Functionality

  • 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 sendData function. On the server side my network function receives some bytes and calls the auto generated receiveData function which unpacks the bytes and calls my displayResult function 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.

Optional features

  • 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.

Research

  • rpcgen does almost what I want, except it is fixed to TCP/IP which I cannot use and I have to manually version control my functions.

  • simple-rpc-cpp I cannot use boost::serialization on the embedded side and it does not handle endianness.

  • ZeroRPC would be great if it were in C and without TCP/IP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.