| 1 | /************************************************************************* |
| 2 | * libjson-rpc-cpp |
| 3 | ************************************************************************* |
| 4 | * @file rpcprotocolserverv1.h |
| 5 | * @date 10/23/2014 |
| 6 | * @author Peter Spiess-Knafl <dev@spiessknafl.at> |
| 7 | * @license See attached LICENSE.txt |
| 8 | ************************************************************************/ |
| 9 | |
| 10 | #ifndef JSONRPC_CPP_RPCPROTOCOLSERVERV1_H |
| 11 | #define JSONRPC_CPP_RPCPROTOCOLSERVERV1_H |
| 12 | |
| 13 | #include "abstractprotocolhandler.h" |
| 14 | #include <jsonrpccpp/common/exception.h> |
| 15 | |
| 16 | namespace jsonrpc { |
| 17 | |
| 18 | class RpcProtocolServerV1 : public AbstractProtocolHandler { |
| 19 | public: |
| 20 | RpcProtocolServerV1(IProcedureInvokationHandler &handler); |
| 21 | |
| 22 | bool ValidateRequestFields(const Json::Value &request); |
| 23 | void HandleJsonRequest(const Json::Value &request, Json::Value &response); |
| 24 | void WrapResult(const Json::Value &request, Json::Value &response, Json::Value &retValue); |
| 25 | void WrapError(const Json::Value &request, int code, const std::string &message, Json::Value &result); |
| 26 | void WrapException(const Json::Value &request, const JsonRpcException &exception, Json::Value &result); |
| 27 | procedure_t GetRequestType(const Json::Value &request); |
| 28 | }; |
| 29 | |
| 30 | } // namespace jsonrpc |
| 31 | |
| 32 | #endif // JSONRPC_CPP_RPCPROTOCOLSERVERV1_H |
| 33 | |