PRCYCoin  2.0.0.7rc1
P2P Digital Currency
protocol.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2014 The Bitcoin developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef BITCOIN_RPCPROTOCOL_H
7 #define BITCOIN_RPCPROTOCOL_H
8 
9 #include "fs.h"
10 
11 #include <list>
12 #include <map>
13 #include <stdint.h>
14 #include <string>
15 
16 #include <univalue.h>
17 
20  HTTP_OK = 200,
28 };
29 
37  RPC_PARSE_ERROR = -32700,
38 
51  RPC_IN_WARMUP = -28,
53 
58 
66 
80 };
81 
82 std::string JSONRPCRequest(const std::string& strMethod, const UniValue& params, const UniValue& id);
83 UniValue JSONRPCReplyObj(const UniValue& result, const UniValue& error, const UniValue& id);
84 std::string JSONRPCReply(const UniValue& result, const UniValue& error, const UniValue& id);
85 UniValue JSONRPCError(int code, const std::string& message);
86 
88 fs::path GetAuthCookieFile();
90 bool GenerateAuthCookie(std::string *cookie_out);
92 bool GetAuthCookie(std::string *cookie_out);
94 void DeleteAuthCookie();
95 
96 #endif // BITCOIN_RPCPROTOCOL_H
RPC_METHOD_NOT_FOUND
@ RPC_METHOD_NOT_FOUND
Definition: protocol.h:34
RPC_INVALID_REQUEST
@ RPC_INVALID_REQUEST
Standard JSON-RPC 2.0 errors.
Definition: protocol.h:33
RPC_VERIFY_REJECTED
@ RPC_VERIFY_REJECTED
General error during transaction or block submission.
Definition: protocol.h:49
RPC_MISC_ERROR
@ RPC_MISC_ERROR
General application defined errors.
Definition: protocol.h:40
HTTP_SERVICE_UNAVAILABLE
@ HTTP_SERVICE_UNAVAILABLE
Definition: protocol.h:27
GenerateAuthCookie
bool GenerateAuthCookie(std::string *cookie_out)
Generate a new RPC authentication cookie and write it to disk.
Definition: protocol.cpp:82
RPC_INTERNAL_ERROR
@ RPC_INTERNAL_ERROR
Definition: protocol.h:36
RPC_WALLET_ALREADY_UNLOCKED
@ RPC_WALLET_ALREADY_UNLOCKED
Failed to encrypt the wallet.
Definition: protocol.h:76
HTTP_BAD_METHOD
@ HTTP_BAD_METHOD
Definition: protocol.h:25
RPC_WALLET_WRONG_ENC_STATE
@ RPC_WALLET_WRONG_ENC_STATE
The wallet passphrase entered was incorrect.
Definition: protocol.h:74
fs.h
RPC_PRIVACY_DECOY_MIN
@ RPC_PRIVACY_DECOY_MIN
Privacy wallet is existed.
Definition: protocol.h:78
RPC_TRANSACTION_REJECTED
@ RPC_TRANSACTION_REJECTED
Definition: protocol.h:56
RPC_VERIFY_ERROR
@ RPC_VERIFY_ERROR
Error parsing or validating structure in raw format.
Definition: protocol.h:48
HTTPStatusCode
HTTPStatusCode
HTTP status codes.
Definition: protocol.h:19
RPC_INVALID_PARAMETER
@ RPC_INVALID_PARAMETER
Ran out of memory during operation.
Definition: protocol.h:45
HTTP_BAD_REQUEST
@ HTTP_BAD_REQUEST
Definition: protocol.h:21
JSONRPCReply
std::string JSONRPCReply(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: protocol.cpp:54
RPC_CLIENT_IN_INITIAL_DOWNLOAD
@ RPC_CLIENT_IN_INITIAL_DOWNLOAD
PRCY is not connected.
Definition: protocol.h:61
RPC_FORBIDDEN_BY_SAFE_MODE
@ RPC_FORBIDDEN_BY_SAFE_MODE
std::exception thrown in command handling
Definition: protocol.h:41
RPC_WALLET_KEYPOOL_RAN_OUT
@ RPC_WALLET_KEYPOOL_RAN_OUT
Invalid account name.
Definition: protocol.h:71
GetAuthCookie
bool GetAuthCookie(std::string *cookie_out)
Read the RPC authentication cookie from disk.
Definition: protocol.cpp:107
RPC_WALLET_INVALID_ACCOUNT_NAME
@ RPC_WALLET_INVALID_ACCOUNT_NAME
Not enough funds in wallet or account.
Definition: protocol.h:70
RPC_TRANSACTION_ALREADY_IN_CHAIN
@ RPC_TRANSACTION_ALREADY_IN_CHAIN
Definition: protocol.h:57
UniValue
Definition: univalue.h:19
RPC_DESERIALIZATION_ERROR
@ RPC_DESERIALIZATION_ERROR
Database error.
Definition: protocol.h:47
HTTP_FORBIDDEN
@ HTTP_FORBIDDEN
Definition: protocol.h:23
GetAuthCookieFile
fs::path GetAuthCookieFile()
Get name of RPC authentication cookie file.
Definition: protocol.cpp:76
RPC_WALLET_PASSPHRASE_INCORRECT
@ RPC_WALLET_PASSPHRASE_INCORRECT
Enter the wallet passphrase with unlockwallet first.
Definition: protocol.h:73
univalue.h
RPC_DATABASE_ERROR
@ RPC_DATABASE_ERROR
Invalid, missing or duplicate parameter.
Definition: protocol.h:46
RPC_WALLET_UNLOCK_NEEDED
@ RPC_WALLET_UNLOCK_NEEDED
Keypool ran out, call keypoolrefill first.
Definition: protocol.h:72
RPC_WALLET_ENCRYPTION_FAILED
@ RPC_WALLET_ENCRYPTION_FAILED
Command given in wrong wallet encryption state (encrypting an encrypted wallet etc....
Definition: protocol.h:75
RPC_INVALID_BLOCK_HEIGHT
@ RPC_INVALID_BLOCK_HEIGHT
Client still warming up.
Definition: protocol.h:52
RPC_IN_WARMUP
@ RPC_IN_WARMUP
Transaction already in chain.
Definition: protocol.h:51
HTTP_UNAUTHORIZED
@ HTTP_UNAUTHORIZED
Definition: protocol.h:22
RPC_WALLET_ERROR
@ RPC_WALLET_ERROR
Invalid IP/Subnet.
Definition: protocol.h:68
RPC_INVALID_ADDRESS_OR_KEY
@ RPC_INVALID_ADDRESS_OR_KEY
Unexpected type was passed as parameter.
Definition: protocol.h:43
RPC_OUT_OF_MEMORY
@ RPC_OUT_OF_MEMORY
Invalid address or key.
Definition: protocol.h:44
HTTP_OK
@ HTTP_OK
Definition: protocol.h:20
RPC_WALLET_INSUFFICIENT_FUNDS
@ RPC_WALLET_INSUFFICIENT_FUNDS
Unspecified problem with wallet (key not found etc.)
Definition: protocol.h:69
RPCErrorCode
RPCErrorCode
PRCY RPC error codes.
Definition: protocol.h:31
RPC_CLIENT_NODE_ALREADY_ADDED
@ RPC_CLIENT_NODE_ALREADY_ADDED
Still downloading initial blocks.
Definition: protocol.h:62
HTTP_NOT_FOUND
@ HTTP_NOT_FOUND
Definition: protocol.h:24
RPC_CLIENT_NODE_NOT_ADDED
@ RPC_CLIENT_NODE_NOT_ADDED
Node is already added.
Definition: protocol.h:63
DeleteAuthCookie
void DeleteAuthCookie()
Delete RPC authentication cookie from disk.
Definition: protocol.cpp:123
RPC_CLIENT_NODE_NOT_CONNECTED
@ RPC_CLIENT_NODE_NOT_CONNECTED
Node has not been added before.
Definition: protocol.h:64
JSONRPCReplyObj
UniValue JSONRPCReplyObj(const UniValue &result, const UniValue &error, const UniValue &id)
Definition: protocol.cpp:42
RPC_VERIFY_ALREADY_IN_CHAIN
@ RPC_VERIFY_ALREADY_IN_CHAIN
Transaction or block was rejected by network rules.
Definition: protocol.h:50
RPC_TYPE_ERROR
@ RPC_TYPE_ERROR
Server is in safe mode, and command is not allowed in safe mode.
Definition: protocol.h:42
RPC_PRIVACY_WALLET_EXISTED
@ RPC_PRIVACY_WALLET_EXISTED
Wallet is already unlocked.
Definition: protocol.h:77
JSONRPCRequest
std::string JSONRPCRequest(const std::string &strMethod, const UniValue &params, const UniValue &id)
JSON-RPC protocol.
Definition: protocol.cpp:33
RPC_INVALID_PARAMS
@ RPC_INVALID_PARAMS
Definition: protocol.h:35
RPC_ERROR_CODE_UNKNOWN_ERROR
@ RPC_ERROR_CODE_UNKNOWN_ERROR
Definition: protocol.h:79
JSONRPCError
UniValue JSONRPCError(int code, const std::string &message)
Definition: protocol.cpp:60
RPC_PARSE_ERROR
@ RPC_PARSE_ERROR
Definition: protocol.h:37
error
bool error(const char *fmt, const Args &... args)
Definition: util.h:61
RPC_TRANSACTION_ERROR
@ RPC_TRANSACTION_ERROR
Invalid block height.
Definition: protocol.h:55
RPC_CLIENT_INVALID_IP_OR_SUBNET
@ RPC_CLIENT_INVALID_IP_OR_SUBNET
Node to disconnect not found in connected nodes.
Definition: protocol.h:65
RPC_CLIENT_NOT_CONNECTED
@ RPC_CLIENT_NOT_CONNECTED
P2P client errors.
Definition: protocol.h:60
HTTP_INTERNAL_SERVER_ERROR
@ HTTP_INTERNAL_SERVER_ERROR
Definition: protocol.h:26