This repository contains resources to provide inter-process communication through gRPC Remote Procedure Calls in the context of Dynamic Binary Hardware Injection (DBHI). gRPC supports cross-platform client and server bindings for many languages. We used go(lang) to write both a buffered channel (FIFO) server and two example clients. The server provides a go channel for each identifier added to the list through the API. Then, read and write methods are available for clients to interchange information with FIFO-alike interfaces. Moreover, helper functions for clients can be built to a shared library and it can be used in third-party applications (probably written in C/C++).
lib/: definition of the API. Language-specific sources are generated withprotoc(see run).server/: server that implements the API defined inlib/lib.proto, and provides channels as FIFO interfaces.client/:*.go: helper functions that depend onlib, and functions exported to C.gen/: client that waits until two channels exist in the server, then pushes data to a channel, and expects to get the same number of elements (each of them multiplied by three) from a different channel. It is expected to be used in order to test the server along witheg. This is written in golang, and depends onlib.eg-*/: client that receives any number of elements from a channel and returns each element multiplied by three to a different channel. It is expected to be used in order to test the server along withgen. Two functionally equivalent versions are provided:eg-go/in golang. In order to run/build it,client/client.gomust be copied toclient/eg-go/.eg-cin C. In order to build it,libgrpc-go.soandlibgrpc-go.hmust be generated first (see run).
In order to build all the pieces, protoc, golang and gcc are required. If docker is available, image aptman/dbhi:stretch-gRPC can be used. Start a container as follows:
# WORK_DIR="/go/src/github.com/dbhi/gRPC"
# $(command -v winpty) docker run --rm -itv "/$(pwd):/$WORK_DIR" -w "/$WORK_DIR" aptman/dbhi:stretch-gRPC bashEither after installing the dependencies natively or after starting the container, execute ./run to build all the pieces. The artifacts (server, three clients, shared library and header file) will be output to ./dist/.