You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1011 B

#ifndef JSON_RPC_HH
#define JSON_RPC_HH
#include "json_spirit/json_spirit_value.h"
#include "function_map.hh"
namespace js = json_spirit;
enum class JSON_RPC
PARSE_ERROR = -32700,
class JsonAdapterBase;
7 years ago
// Server side:
7 years ago
// parse the JSON-RPC 2.0 compatible "request", call the C function
// and create an appropiate "response" object (containing a result or an error)
js::Object call(const FunctionMap& fm, const js::Object& request, JsonAdapterBase* ja);
// create a JSON-RPC 2.0 compatible result response object
//js::Object make_result(const js::Value& result, int id);
// create a JSON-RPC 2.0 compatible error response object
js::Object make_error(JSON_RPC error_code, const std::string& error_message, const js::Value& data, int id);
// for events to clients:
js::Object make_request(const std::string& functionName, const js::Array& parameters);
7 years ago
#endif // JSON_RPC_HH