]> Git Repo - VerusCoin.git/blame - src/rpcprotocol.h
Auto merge of #2259 - nathan-at-least:simplify-joinsplit-priority2, r=ebfull
[VerusCoin.git] / src / rpcprotocol.h
CommitLineData
fb78cc23 1// Copyright (c) 2010 Satoshi Nakamoto
f914f1a7 2// Copyright (c) 2009-2014 The Bitcoin Core developers
72fb3d29 3// Distributed under the MIT software license, see the accompanying
fb78cc23
WL
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
84738627
PJ
6#ifndef BITCOIN_RPCPROTOCOL_H
7#define BITCOIN_RPCPROTOCOL_H
fb78cc23
WL
8
9#include <list>
10#include <map>
11#include <stdint.h>
12#include <string>
e957192c 13#include <boost/filesystem.hpp>
fb78cc23 14
a10a6e2a 15#include <univalue.h>
fb78cc23 16
72fb3d29 17//! HTTP status codes
fb78cc23
WL
18enum HTTPStatusCode
19{
20 HTTP_OK = 200,
21 HTTP_BAD_REQUEST = 400,
22 HTTP_UNAUTHORIZED = 401,
23 HTTP_FORBIDDEN = 403,
24 HTTP_NOT_FOUND = 404,
afd64f76 25 HTTP_BAD_METHOD = 405,
fb78cc23 26 HTTP_INTERNAL_SERVER_ERROR = 500,
78bdc810 27 HTTP_SERVICE_UNAVAILABLE = 503,
fb78cc23
WL
28};
29
72fb3d29 30//! Bitcoin RPC error codes
fb78cc23
WL
31enum RPCErrorCode
32{
72fb3d29 33 //! Standard JSON-RPC 2.0 errors
fb78cc23
WL
34 RPC_INVALID_REQUEST = -32600,
35 RPC_METHOD_NOT_FOUND = -32601,
36 RPC_INVALID_PARAMS = -32602,
37 RPC_INTERNAL_ERROR = -32603,
38 RPC_PARSE_ERROR = -32700,
39
72fb3d29
MF
40 //! General application defined errors
41 RPC_MISC_ERROR = -1, //! std::exception thrown in command handling
42 RPC_FORBIDDEN_BY_SAFE_MODE = -2, //! Server is in safe mode, and command is not allowed in safe mode
43 RPC_TYPE_ERROR = -3, //! Unexpected type was passed as parameter
44 RPC_INVALID_ADDRESS_OR_KEY = -5, //! Invalid address or key
45 RPC_OUT_OF_MEMORY = -7, //! Ran out of memory during operation
46 RPC_INVALID_PARAMETER = -8, //! Invalid, missing or duplicate parameter
47 RPC_DATABASE_ERROR = -20, //! Database error
48 RPC_DESERIALIZATION_ERROR = -22, //! Error parsing or validating structure in raw format
49 RPC_VERIFY_ERROR = -25, //! General error during transaction or block submission
50 RPC_VERIFY_REJECTED = -26, //! Transaction or block was rejected by network rules
51 RPC_VERIFY_ALREADY_IN_CHAIN = -27, //! Transaction already in chain
52 RPC_IN_WARMUP = -28, //! Client still warming up
d29a2917 53
72fb3d29 54 //! Aliases for backward compatibility
d29a2917
LD
55 RPC_TRANSACTION_ERROR = RPC_VERIFY_ERROR,
56 RPC_TRANSACTION_REJECTED = RPC_VERIFY_REJECTED,
57 RPC_TRANSACTION_ALREADY_IN_CHAIN= RPC_VERIFY_ALREADY_IN_CHAIN,
fb78cc23 58
72fb3d29
MF
59 //! P2P client errors
60 RPC_CLIENT_NOT_CONNECTED = -9, //! Bitcoin is not connected
61 RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10, //! Still downloading initial blocks
62 RPC_CLIENT_NODE_ALREADY_ADDED = -23, //! Node is already added
63 RPC_CLIENT_NODE_NOT_ADDED = -24, //! Node has not been added before
94ee48c4 64 RPC_CLIENT_NODE_NOT_CONNECTED = -29, //! Node to disconnect not found in connected nodes
1cad8c9f 65 RPC_CLIENT_INVALID_IP_OR_SUBNET = -30, //! Invalid IP/Subnet
fb78cc23 66
72fb3d29
MF
67 //! Wallet errors
68 RPC_WALLET_ERROR = -4, //! Unspecified problem with wallet (key not found etc.)
69 RPC_WALLET_INSUFFICIENT_FUNDS = -6, //! Not enough funds in wallet or account
7b3351ff 70 RPC_WALLET_ACCOUNTS_UNSUPPORTED = -11, //! Accounts are unsupported
72fb3d29
MF
71 RPC_WALLET_KEYPOOL_RAN_OUT = -12, //! Keypool ran out, call keypoolrefill first
72 RPC_WALLET_UNLOCK_NEEDED = -13, //! Enter the wallet passphrase with walletpassphrase first
73 RPC_WALLET_PASSPHRASE_INCORRECT = -14, //! The wallet passphrase entered was incorrect
74 RPC_WALLET_WRONG_ENC_STATE = -15, //! Command given in wrong wallet encryption state (encrypting an encrypted wallet etc.)
75 RPC_WALLET_ENCRYPTION_FAILED = -16, //! Failed to encrypt the wallet
76 RPC_WALLET_ALREADY_UNLOCKED = -17, //! Wallet is already unlocked
fb78cc23
WL
77};
78
851f58f9
JS
79std::string JSONRPCRequest(const std::string& strMethod, const UniValue& params, const UniValue& id);
80UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
81std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
82UniValue JSONRPCError(int code, const std::string& message);
fb78cc23 83
e957192c
WL
84/** Get name of RPC authentication cookie file */
85boost::filesystem::path GetAuthCookieFile();
86/** Generate a new RPC authentication cookie and write it to disk */
87bool GenerateAuthCookie(std::string *cookie_out);
88/** Read the RPC authentication cookie from disk */
89bool GetAuthCookie(std::string *cookie_out);
90/** Delete RPC authentication cookie from disk */
91void DeleteAuthCookie();
92
84738627 93#endif // BITCOIN_RPCPROTOCOL_H
This page took 0.118506 seconds and 4 git commands to generate.