Giter Club home page Giter Club logo

rpc-generator's Introduction

RPC-Generator

A python script that generates code to call functions from one device on another device using a network.

Current State

The project is in a usable state.

Idea

The RPC-generator implements serializing and deserializing of function calls and their arguments. When communicating with a device you normally need to make up a protocol, give each message an ID and serialize, deserialize and interpret arguments. This work is done for you by the RPC generator. You specify a server header whos functions should be made available to the client and the RPC-generator generates code for the client to call a remote function and code for the server to parse requests and execute them. You can use the RPC-generator twice to allow both participants to call functions of the other.

Dependencies

Required

Recommended

Internally used

Platform

  • A C-compiler is required for both the client and the server
  • Python is required on the build machine
  • The platform must implement threads, mutexes and network functions to allow sending and listening at the same time

Functionality

Given a server and client config the RPC-Generator will produce the following files:

  • RPC_server.h - Function declarations similar to those in server.h that allow to call the functions across networks.
  • RPC_server.c - Implementation for the RPC-functionality
  • RPC_types.h - Declaration of types used by the RPC
  • RPC_network.h - Declarations of network functions that need to be implemented by the user. See examples for an implementation for TCP sockets
  • RPC_server.xml - XML-representation of how function calls are represented by bytes (useful to be read by programs)
  • RPC_server.html - HTML-representation of how function calls are represented by bytes (useful to be read by humans)
  • RPC_server.css - Styling for server.html
  • RPC_parse.c -Parser for the server that evaluates requests and calls the appropriate functions

Getting started

Generate a project using CMake inside Testprojects/ClientServer/Project or Testprojects/AliceBob/Project. Compile and run the ClientServer testproject to see one way communication and the AliceBob testproject to see 2-way communication over TCP sockets. Next you can add suitable functions in server.h and their implementation in the server to make them available. Next you may want to replace the network implementation inside network.cpp with communication over USB, Bluetooth, Comports or other network devices.

TODO

  • Add support for unions
  • Add python script to read .xml file to implement encode/decode functionality
  • Copy comments from source to header
  • Add documentation for pragmas
  • Benchmark performance, possibly make comparison to other RPC-generators
  • Improve smartness of enum values to take #defines and variables into account
  • Implement any bit length integer support
  • Implement pointer support

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.