MCPcopy Create free account
hub / github.com/cinemast/libjson-rpc-cpp / ValidateRequest

Method ValidateRequest

src/jsonrpccpp/server/abstractprotocolhandler.cpp:54–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54int AbstractProtocolHandler::ValidateRequest(const Json::Value &request) {
55 int error = 0;
56 Procedure proc;
57 if (!this->ValidateRequestFields(request)) {
58 error = Errors::ERROR_RPC_INVALID_REQUEST;
59 } else {
60 map<string, Procedure>::iterator it = this->procedures.find(request[KEY_REQUEST_METHODNAME].asString());
61 if (it != this->procedures.end()) {
62 proc = it->second;
63 if (this->GetRequestType(request) == RPC_METHOD && proc.GetProcedureType() == RPC_NOTIFICATION) {
64 error = Errors::ERROR_SERVER_PROCEDURE_IS_NOTIFICATION;
65 } else if (this->GetRequestType(request) == RPC_NOTIFICATION && proc.GetProcedureType() == RPC_METHOD) {
66 error = Errors::ERROR_SERVER_PROCEDURE_IS_METHOD;
67 } else if (!proc.ValdiateParameters(request[KEY_REQUEST_PARAMETERS])) {
68 error = Errors::ERROR_RPC_INVALID_PARAMS;
69 }
70 } else {
71 error = Errors::ERROR_RPC_METHOD_NOT_FOUND;
72 }
73 }
74 return error;
75}

Callers 2

HandleJsonRequestMethod · 0.80
HandleSingleRequestMethod · 0.80

Calls 6

findMethod · 0.80
GetProcedureTypeMethod · 0.80
ValdiateParametersMethod · 0.80
ValidateRequestFieldsMethod · 0.45
endMethod · 0.45
GetRequestTypeMethod · 0.45

Tested by

no test coverage detected