cis_config
Public Attributes | List of all members
psiRpc_t Struct Reference

Remote Procedure Call (RPC) structure. Contains information required to coordinate sending/receiving response/requests from/to an RPC server/client. More...

#include <PsiInterface.h>

Public Attributes

psiInput_t _input
 Input queue structure.
 
psiOutput_t _output
 Output queue structure.
 
char * _inFmt
 Format string used for input queue.
 
char * _outFmt
 Format string used for output queue.
 

Detailed Description

Remote Procedure Call (RPC) structure. Contains information required to coordinate sending/receiving response/requests from/to an RPC server/client.

Remote Procedure Call (RPC) IO

Handle IO case of a server receiving input from clients, performing some calculation, and then sending a response back to the client.

Server Usage:

  1. One-time: Create server channels with format specifiers for input and output. psiRpc_t srv = psiRpcServer("srv_name", "%d", "%d %d");
  2. Prepare: Allocate space for recovered variables from request. int a;
  3. Receive request: int ret = rpcRecv(srv, &a);
  4. Process: Do tasks the server should do with input to produce output. int b = 2*a; int c = 3*a;
  1. Send response: ret = rpcSend(srv, b, c);

Client Usage:

  1. One-time: Create client channels to desired server with format specifiers for output and input (should be the same arguments as for the server except for name). psiRpc_t cli = psiRpcClient("cli_name", "%d", "%d %d");
  2. Prepare: Allocate space for recovered variables from response. int b, c;
  3. Call server: int ret = rpcCall(cli, 1, &b, &c);

Clients can also send several requests at once before receiving any responses. This allows the server to be processing the next requests while the client handles the previous response, thereby increasing efficiency. The responses are assumed to be in the same order as the generating requests (i.e. first come, first served).


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