fwRPC
 All Files Functions Variables
fwRPC_server.ctl File Reference

Functions

void fwRPC_registerFunction (string funcName, string stub, string lib, int timeout=-1, dyn_int paramType=makeDynInt(ANYTYPE_VAR), bool exclusive=false)
 
anytype fwRPC_makeResult (anytype hdl, bool success, anytype result)
 
bool fwRPC_isValidResult (anytype result)
 

Variables

public const int fwRPC_RESULT_HDL = 1
 
public const int fwRPC_RESULT_STATUS = 2
 
public const int fwRPC_RESULT_VALUE = 3
 

Detailed Description

This library contains the set of functions for server-side RPC function registration and sending results. Part of the server-side RPC library.

Author
Victor Rodrigues (CERN, BE-ICS-SDS)

Function Documentation

bool fwRPC_isValidResult ( anytype  result)

Check if the given parameter is a valid result object.

Parameters
result(IN, anytype) result object to check
Returns
true if valid false otherwise
Exceptions
nothing
anytype fwRPC_makeResult ( anytype  hdl,
bool  success,
anytype  result 
)

Build a result object to be returned from the executed RPC function. The result parameter must not be an empty string.

Parameters
hdl(IN, anytype) request handle
success(IN, bool) whether or not the result was a success
result(IN, anytype) the result or error object in case of non success
Returns
result object
Exceptions
ifresult is an empty string
void fwRPC_registerFunction ( string  funcName,
string  stub,
string  lib,
int  timeout = -1,
dyn_int  paramType = makeDynInt(ANYTYPE_VAR),
bool  exclusive = false 
)

Register a function with the RPC service. The function must have a wrapping stub, which is called whenever a new request is received for the function to register. The stub should have the following signature, and should return a result using the fwRPC_sendResult() function.

void stub(anytype callHandle, anytype params)

Optionally, a timeout value can be set, in seconds, that will cause the execution of the procedure to be halted if the total time surpasses the timeout value. If set to -1, then no timeout is checked.

Parameters
funcName(IN, string) name of the function
stub(IN, string) name of the function stub to call
lib(IN, string) file name of the lib required for import
timeout(IN, int) timeout value in seconds
paramType(IN, dyn_int) list of accepted parameter types.
exclusive(IN, bool) whether or not the function requires exclusive execution in it's own CTRL manager
Returns
nothing
Exceptions
ifthe stub name is invalid if the valid param list is empty