Raven Core  3.0.0
P2P Digital Currency
protocol.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 The Bitcoin Core developers
3 // Copyright (c) 2017-2019 The Raven Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef RAVEN_RPCPROTOCOL_H
8 #define RAVEN_RPCPROTOCOL_H
9 
10 #include "fs.h"
11 
12 #include <list>
13 #include <map>
14 #include <stdint.h>
15 #include <string>
16 
17 #include <univalue.h>
18 
21 {
22  HTTP_OK = 200,
30 };
31 
34 {
36  // RPC_INVALID_REQUEST is internally mapped to HTTP_BAD_REQUEST (400).
37  // It should not be used for application-layer errors.
39  // RPC_METHOD_NOT_FOUND is internally mapped to HTTP_NOT_FOUND (404).
40  // It should not be used for application-layer errors.
43  // RPC_INTERNAL_ERROR should only be used for genuine errors in ravend
44  // (for example datadir corruption).
46  RPC_PARSE_ERROR = -32700,
47 
60  RPC_IN_WARMUP = -28,
62 
67 
76 
89 };
90 
91 UniValue JSONRPCRequestObj(const std::string& strMethod, const UniValue& params, const UniValue& id);
92 UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
93 std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
94 UniValue JSONRPCError(int code, const std::string& message);
95 
97 bool GenerateAuthCookie(std::string *cookie_out);
99 bool GetAuthCookie(std::string *cookie_out);
101 void DeleteAuthCookie();
103 std::vector<UniValue> JSONRPCProcessBatchReply(const UniValue &in, size_t num);
104 
105 #endif // RAVEN_RPCPROTOCOL_H
No wallet specified (error when there are multiple wallets loaded)
Definition: protocol.h:88
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: protocol.cpp:37
Aliases for backward compatibility.
Definition: protocol.h:64
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: protocol.cpp:49
Node has not been added before.
Definition: protocol.h:72
Keypool ran out, call keypoolrefill first.
Definition: protocol.h:81
Ran out of memory during operation.
Definition: protocol.h:53
Enter the wallet passphrase with walletpassphrase first.
Definition: protocol.h:82
bool GenerateAuthCookie(std::string *cookie_out)
Generate a new RPC authentication cookie and write it to disk.
Definition: protocol.cpp:82
Wallet is already unlocked.
Definition: protocol.h:86
Transaction or block was rejected by network rules.
Definition: protocol.h:58
HTTPStatusCode
HTTP status codes.
Definition: protocol.h:20
bool GetAuthCookie(std::string *cookie_out)
Read the RPC authentication cookie from disk.
Definition: protocol.cpp:114
Client still warming up.
Definition: protocol.h:60
Invalid, missing or duplicate parameter.
Definition: protocol.h:54
UniValue JSONRPCRequestObj(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition: protocol.cpp:28
General error during transaction or block submission.
Definition: protocol.h:57
The wallet passphrase entered was incorrect.
Definition: protocol.h:83
Transaction already in chain.
Definition: protocol.h:59
Unexpected type was passed as parameter.
Definition: protocol.h:51
Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.)
Definition: protocol.h:84
General application defined errors.
Definition: protocol.h:49
Invalid address or key.
Definition: protocol.h:52
Invalid IP/Subnet.
Definition: protocol.h:74
Invalid wallet specified.
Definition: protocol.h:87
Invalid account name.
Definition: protocol.h:80
RPC method is deprecated.
Definition: protocol.h:61
void DeleteAuthCookie()
Delete RPC authentication cookie from disk.
Definition: protocol.cpp:130
Database error.
Definition: protocol.h:55
Failed to encrypt the wallet.
Definition: protocol.h:85
std::vector< UniValue > JSONRPCProcessBatchReply(const UniValue &in, size_t num)
Parse JSON-RPC batch reply into a vector.
Definition: protocol.cpp:139
Not enough funds in wallet or account.
Definition: protocol.h:79
Node to disconnect not found in connected nodes.
Definition: protocol.h:73
Node is already added.
Definition: protocol.h:71
Server is in safe mode, and command is not allowed in safe mode.
Definition: protocol.h:50
UniValue JSONRPCError(int code, const std::string &message)
Definition: protocol.cpp:55
bool error(const char *fmt, const Args &... args)
Definition: util.h:168
Standard JSON-RPC 2.0 errors.
Definition: protocol.h:38
Wallet errors.
Definition: protocol.h:78
No valid connection manager instance found.
Definition: protocol.h:75
RPCErrorCode
Raven RPC error codes.
Definition: protocol.h:33
Still downloading initial blocks.
Definition: protocol.h:70
P2P client errors.
Definition: protocol.h:69
Error parsing or validating structure in raw format.
Definition: protocol.h:56