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.

37 lines
1.0 KiB

#ifndef JSON_RPC_HH
#define JSON_RPC_HH
#include "json_spirit/json_spirit_value.h"
#include "context.hh"
#include "function_map.hh"
namespace js = json_spirit;
enum class JSON_RPC
PARSE_ERROR = -32700,
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, Context* context);
// 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);
7 years ago
// Client side:
js::Object make_request(const std::string& functionName, const js::Array& parameters, const std::string& securityContext);
#endif // JSON_RPC_HH