Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Enumerations | Functions
rpcprotocol.h File Reference
#include <list>
#include <map>
#include <stdint.h>
#include <string>
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_utils.h"
#include "json/json_spirit_writer_template.h"
+ Include dependency graph for rpcprotocol.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SSLIOStreamDevice< Protocol >
 

Enumerations

enum  HTTPStatusCode {
  HTTP_OK = 200,
  HTTP_BAD_REQUEST = 400,
  HTTP_UNAUTHORIZED = 401,
  HTTP_FORBIDDEN = 403,
  HTTP_NOT_FOUND = 404,
  HTTP_INTERNAL_SERVER_ERROR = 500
}
 
enum  RPCErrorCode {
  RPC_INVALID_REQUEST = -32600,
  RPC_METHOD_NOT_FOUND = -32601,
  RPC_INVALID_PARAMS = -32602,
  RPC_INTERNAL_ERROR = -32603,
  RPC_PARSE_ERROR = -32700,
  RPC_MISC_ERROR = -1,
  RPC_FORBIDDEN_BY_SAFE_MODE = -2,
  RPC_TYPE_ERROR = -3,
  RPC_INVALID_ADDRESS_OR_KEY = -5,
  RPC_OUT_OF_MEMORY = -7,
  RPC_INVALID_PARAMETER = -8,
  RPC_DATABASE_ERROR = -20,
  RPC_DESERIALIZATION_ERROR = -22,
  RPC_TRANSACTION_ERROR = -25,
  RPC_TRANSACTION_REJECTED = -26,
  RPC_TRANSACTION_ALREADY_IN_CHAIN = -27,
  RPC_CLIENT_NOT_CONNECTED = -9,
  RPC_CLIENT_IN_INITIAL_DOWNLOAD = -10,
  RPC_CLIENT_NODE_ALREADY_ADDED = -23,
  RPC_CLIENT_NODE_NOT_ADDED = -24,
  RPC_WALLET_ERROR = -4,
  RPC_WALLET_INSUFFICIENT_FUNDS = -6,
  RPC_WALLET_INVALID_ACCOUNT_NAME = -11,
  RPC_WALLET_KEYPOOL_RAN_OUT = -12,
  RPC_WALLET_UNLOCK_NEEDED = -13,
  RPC_WALLET_PASSPHRASE_INCORRECT = -14,
  RPC_WALLET_WRONG_ENC_STATE = -15,
  RPC_WALLET_ENCRYPTION_FAILED = -16,
  RPC_WALLET_ALREADY_UNLOCKED = -17
}
 

Functions

std::string HTTPPost (const std::string &strMsg, const std::map< std::string, std::string > &mapRequestHeaders)
 
std::string HTTPReply (int nStatus, const std::string &strMsg, bool keepalive)
 
bool ReadHTTPRequestLine (std::basic_istream< char > &stream, int &proto, std::string &http_method, std::string &http_uri)
 
int ReadHTTPStatus (std::basic_istream< char > &stream, int &proto)
 
int ReadHTTPHeaders (std::basic_istream< char > &stream, std::map< std::string, std::string > &mapHeadersRet)
 
int ReadHTTPMessage (std::basic_istream< char > &stream, std::map< std::string, std::string > &mapHeadersRet, std::string &strMessageRet, int nProto)
 
std::string JSONRPCRequest (const std::string &strMethod, const json_spirit::Array &params, const json_spirit::Value &id)
 
json_spirit::Object JSONRPCReplyObj (const json_spirit::Value &result, const json_spirit::Value &error, const json_spirit::Value &id)
 
std::string JSONRPCReply (const json_spirit::Value &result, const json_spirit::Value &error, const json_spirit::Value &id)
 
json_spirit::Object JSONRPCError (int code, const std::string &message)
 

Enumeration Type Documentation

Enumerator
HTTP_OK 
HTTP_BAD_REQUEST 
HTTP_UNAUTHORIZED 
HTTP_FORBIDDEN 
HTTP_NOT_FOUND 
HTTP_INTERNAL_SERVER_ERROR 

Definition at line 23 of file rpcprotocol.h.

Enumerator
RPC_INVALID_REQUEST 
RPC_METHOD_NOT_FOUND 
RPC_INVALID_PARAMS 
RPC_INTERNAL_ERROR 
RPC_PARSE_ERROR 
RPC_MISC_ERROR 
RPC_FORBIDDEN_BY_SAFE_MODE 
RPC_TYPE_ERROR 
RPC_INVALID_ADDRESS_OR_KEY 
RPC_OUT_OF_MEMORY 
RPC_INVALID_PARAMETER 
RPC_DATABASE_ERROR 
RPC_DESERIALIZATION_ERROR 
RPC_TRANSACTION_ERROR 
RPC_TRANSACTION_REJECTED 
RPC_TRANSACTION_ALREADY_IN_CHAIN 
RPC_CLIENT_NOT_CONNECTED 
RPC_CLIENT_IN_INITIAL_DOWNLOAD 
RPC_CLIENT_NODE_ALREADY_ADDED 
RPC_CLIENT_NODE_NOT_ADDED 
RPC_WALLET_ERROR 
RPC_WALLET_INSUFFICIENT_FUNDS 
RPC_WALLET_INVALID_ACCOUNT_NAME 
RPC_WALLET_KEYPOOL_RAN_OUT 
RPC_WALLET_UNLOCK_NEEDED 
RPC_WALLET_PASSPHRASE_INCORRECT 
RPC_WALLET_WRONG_ENC_STATE 
RPC_WALLET_ENCRYPTION_FAILED 
RPC_WALLET_ALREADY_UNLOCKED 

Definition at line 34 of file rpcprotocol.h.

Function Documentation

std::string HTTPPost ( const std::string &  strMsg,
const std::map< std::string, std::string > &  mapRequestHeaders 
)

Definition at line 35 of file rpcprotocol.cpp.

References FormatFullVersion(), and PAIRTYPE.

Referenced by CallRPC().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string HTTPReply ( int  nStatus,
const std::string &  strMsg,
bool  keepalive 
)

Definition at line 57 of file rpcprotocol.cpp.

References FormatFullVersion(), HTTP_BAD_REQUEST, HTTP_FORBIDDEN, HTTP_INTERNAL_SERVER_ERROR, HTTP_NOT_FOUND, HTTP_OK, HTTP_UNAUTHORIZED, rfc1123Time(), and strprintf.

Referenced by ErrorReply(), RPCAcceptHandler(), and ServiceConnection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

json_spirit::Object JSONRPCError ( int  code,
const std::string &  message 
)

Definition at line 247 of file rpcprotocol.cpp.

References error().

Referenced by AccountFromValue(), addnode(), AmountFromValue(), backupwallet(), check_prop_valid(), createrawtransaction(), decoderawtransaction(), dumpprivkey(), dumpwallet(), encryptwallet(), EnsureWalletIsUnlocked(), CRPCTable::execute(), getaccount(), GetAccountAddress(), getactivecrowdsales_MP(), getaddednodeinfo(), getallbalancesforaddress_MP(), getallbalancesforid_MP(), getbalance_MP(), getblock(), getblocktemplate(), getcrowdsale_MP(), getgrants_MP(), getinfo_MP(), getnewaddress(), getproperty_MP(), getrawchangeaddress(), getrawtransaction(), getreceivedbyaddress(), getsto_MP(), gettrade_MP(), gettransaction(), gettransaction_MP(), importprivkey(), importwallet(), JSONRPCExecOne(), keypoolrefill(), listblocktransactions_MP(), listsinceblock(), listtransactions(), listtransactions_MP(), lockunspent(), movecmd(), JSONRequest::parse(), ParseHashV(), ParseHexV(), RPCTypeCheck(), send_MP(), sendfrom(), sendmany(), sendrawtransaction(), sendrawtx_MP(), sendtoaddress(), sendtoowners_MP(), ServiceConnection(), setaccount(), signmessage(), signrawtransaction(), submitblock(), verifymessage(), walletlock(), walletpassphrase(), and walletpassphrasechange().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string JSONRPCReply ( const json_spirit::Value &  result,
const json_spirit::Value &  error,
const json_spirit::Value &  id 
)
json_spirit::Object JSONRPCReplyObj ( const json_spirit::Value &  result,
const json_spirit::Value &  error,
const json_spirit::Value &  id 
)
std::string JSONRPCRequest ( const std::string &  strMethod,
const json_spirit::Array &  params,
const json_spirit::Value &  id 
)
int ReadHTTPHeaders ( std::basic_istream< char > &  stream,
std::map< std::string, std::string > &  mapHeadersRet 
)

Definition at line 151 of file rpcprotocol.cpp.

References atoi().

Referenced by ReadHTTPMessage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ReadHTTPMessage ( std::basic_istream< char > &  stream,
std::map< std::string, std::string > &  mapHeadersRet,
std::string &  strMessageRet,
int  nProto 
)

Definition at line 177 of file rpcprotocol.cpp.

References HTTP_INTERNAL_SERVER_ERROR, HTTP_OK, MAX_SIZE, and ReadHTTPHeaders().

Referenced by CallRPC(), and ServiceConnection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ReadHTTPRequestLine ( std::basic_istream< char > &  stream,
int proto,
std::string &  http_method,
std::string &  http_uri 
)

Definition at line 101 of file rpcprotocol.cpp.

References atoi().

Referenced by ServiceConnection().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int ReadHTTPStatus ( std::basic_istream< char > &  stream,
int proto 
)

Definition at line 136 of file rpcprotocol.cpp.

References atoi(), and HTTP_INTERNAL_SERVER_ERROR.

Referenced by CallRPC().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: