Dash Core  0.12.2.1
P2P Digital Currency
server.cpp File Reference
#include "rpc/server.h"
#include "base58.h"
#include "init.h"
#include "random.h"
#include "sync.h"
#include "ui_interface.h"
#include "util.h"
#include "utilstrencodings.h"
#include <univalue.h>
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals2/signal.hpp>
#include <boost/thread.hpp>
#include <boost/algorithm/string/case_conv.hpp>

Go to the source code of this file.

Classes

struct  CRPCSignals
 

Functions

static std::string rpcWarmupStatus ("RPC server started")
 
void RPCTypeCheck (const UniValue &params, const list< UniValue::VType > &typesExpected, bool fAllowNull)
 
void RPCTypeCheckObj (const UniValue &o, const map< string, UniValue::VType > &typesExpected, bool fAllowNull)
 
CAmount AmountFromValue (const UniValue &value)
 
UniValue ValueFromAmount (const CAmount &amount)
 
uint256 ParseHashV (const UniValue &v, string strName)
 
uint256 ParseHashO (const UniValue &o, string strKey)
 
vector< unsigned char > ParseHexV (const UniValue &v, string strName)
 
vector< unsigned char > ParseHexO (const UniValue &o, string strKey)
 
UniValue help (const UniValue &params, bool fHelp)
 
UniValue stop (const UniValue &params, bool fHelp)
 
bool StartRPC ()
 
void InterruptRPC ()
 
void StopRPC ()
 
bool IsRPCRunning ()
 
void SetRPCWarmupStatus (const std::string &newStatus)
 
void SetRPCWarmupFinished ()
 
bool RPCIsInWarmup (std::string *outStatus)
 
static UniValue JSONRPCExecOne (const UniValue &req)
 
std::string JSONRPCExecBatch (const UniValue &vReq)
 
std::string HelpExampleCli (const std::string &methodname, const std::string &args)
 
std::string HelpExampleRpc (const std::string &methodname, const std::string &args)
 
void RPCRegisterTimerInterface (RPCTimerInterface *iface)
 
void RPCUnregisterTimerInterface (RPCTimerInterface *iface)
 
void RPCRunLater (const std::string &name, boost::function< void(void)> func, int64_t nSeconds)
 

Variables

static bool fRPCRunning = false
 
static bool fRPCInWarmup = true
 
static CCriticalSection cs_rpcWarmup
 
static std::vector< RPCTimerInterface * > timerInterfaces
 
static std::map< std::string, boost::shared_ptr< RPCTimerBase > > deadlineTimers
 
static struct CRPCSignals g_rpcSignals
 
static const CRPCCommand vRPCCommands []
 
const CRPCTable tableRPC
 

Function Documentation

◆ AmountFromValue()

CAmount AmountFromValue ( const UniValue value)

◆ help()

UniValue help ( const UniValue params,
bool  fHelp 
)

Definition at line 220 of file server.cpp.

Referenced by BitcoinGUI::createMenuBar(), and main().

◆ HelpExampleCli()

std::string HelpExampleCli ( const std::string &  methodname,
const std::string &  args 
)

Definition at line 581 of file server.cpp.

Referenced by abandontransaction(), addmultisigaddress(), addnode(), backupwallet(), clearbanned(), createmultisig(), createrawtransaction(), debug(), decoderawtransaction(), decodescript(), disconnectnode(), dumphdinfo(), dumpprivkey(), dumpwallet(), encryptwallet(), estimatefee(), estimatepriority(), estimatesmartfee(), estimatesmartpriority(), fundrawtransaction(), generate(), getaccount(), getaccountaddress(), getaddednodeinfo(), getaddressbalance(), getaddressdeltas(), getaddressesbyaccount(), getaddressmempool(), getaddresstxids(), getaddressutxos(), getbalance(), getbestblockhash(), getblock(), getblockchaininfo(), getblockcount(), getblockhash(), getblockhashes(), getblockheader(), getblockheaders(), getblocktemplate(), getchaintips(), getconnectioncount(), getdifficulty(), getgenerate(), getgovernanceinfo(), getinfo(), getmempoolinfo(), getmininginfo(), getnettotals(), getnetworkhashps(), getnetworkinfo(), getnewaddress(), getpeerinfo(), getrawchangeaddress(), getrawmempool(), getrawtransaction(), getreceivedbyaccount(), getreceivedbyaddress(), getspentinfo(), getsuperblockbudget(), gettransaction(), gettxout(), gettxoutproof(), gettxoutsetinfo(), getwalletinfo(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), importwallet(), instantsendtoaddress(), invalidateblock(), keypoolrefill(), listaccounts(), listaddressgroupings(), listbanned(), listlockunspent(), listreceivedbyaccount(), listreceivedbyaddress(), listsinceblock(), listtransactions(), listunspent(), lockunspent(), movecmd(), ping(), prioritisetransaction(), reconsiderblock(), sendfrom(), sendmany(), sendrawtransaction(), sendtoaddress(), sentinelping(), setaccount(), setban(), setgenerate(), settxfee(), signmessage(), signrawtransaction(), submitblock(), validateaddress(), verifychain(), verifymessage(), verifytxoutproof(), walletlock(), walletpassphrase(), and walletpassphrasechange().

◆ HelpExampleRpc()

std::string HelpExampleRpc ( const std::string &  methodname,
const std::string &  args 
)

Definition at line 586 of file server.cpp.

Referenced by abandontransaction(), addmultisigaddress(), addnode(), backupwallet(), clearbanned(), createmultisig(), createrawtransaction(), debug(), decoderawtransaction(), decodescript(), disconnectnode(), dumphdinfo(), dumpprivkey(), dumpwallet(), encryptwallet(), getaccount(), getaccountaddress(), getaddednodeinfo(), getaddressbalance(), getaddressdeltas(), getaddressesbyaccount(), getaddressmempool(), getaddresstxids(), getaddressutxos(), getbalance(), getbestblockhash(), getblock(), getblockchaininfo(), getblockcount(), getblockhash(), getblockhashes(), getblockheader(), getblockheaders(), getblocktemplate(), getchaintips(), getconnectioncount(), getdifficulty(), getgenerate(), getgovernanceinfo(), getinfo(), getmempoolinfo(), getmininginfo(), getnettotals(), getnetworkhashps(), getnetworkinfo(), getnewaddress(), getpeerinfo(), getrawchangeaddress(), getrawmempool(), getrawtransaction(), getreceivedbyaccount(), getreceivedbyaddress(), getspentinfo(), getsuperblockbudget(), gettransaction(), gettxout(), gettxoutproof(), gettxoutsetinfo(), getwalletinfo(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), importwallet(), instantsendtoaddress(), invalidateblock(), keypoolrefill(), listaccounts(), listaddressgroupings(), listbanned(), listlockunspent(), listreceivedbyaccount(), listreceivedbyaddress(), listsinceblock(), listtransactions(), listunspent(), lockunspent(), movecmd(), ping(), prioritisetransaction(), reconsiderblock(), sendfrom(), sendmany(), sendrawtransaction(), sendtoaddress(), sentinelping(), setaccount(), setban(), setgenerate(), settxfee(), signmessage(), signrawtransaction(), submitblock(), validateaddress(), verifychain(), verifymessage(), verifytxoutproof(), walletlock(), walletpassphrase(), and walletpassphrasechange().

◆ InterruptRPC()

void InterruptRPC ( )

Definition at line 438 of file server.cpp.

Referenced by Interrupt().

◆ IsRPCRunning()

bool IsRPCRunning ( )

Query whether RPC is running

Definition at line 452 of file server.cpp.

Referenced by getblocktemplate().

◆ JSONRPCExecBatch()

std::string JSONRPCExecBatch ( const UniValue vReq)

Definition at line 532 of file server.cpp.

Referenced by HTTPReq_JSONRPC().

◆ JSONRPCExecOne()

static UniValue JSONRPCExecOne ( const UniValue req)
static

Definition at line 508 of file server.cpp.

Referenced by JSONRPCExecBatch().

◆ ParseHashO()

uint256 ParseHashO ( const UniValue o,
string  strKey 
)

Definition at line 143 of file server.cpp.

Referenced by createrawtransaction(), and signrawtransaction().

◆ ParseHashV()

uint256 ParseHashV ( const UniValue v,
string  strName 
)

Definition at line 132 of file server.cpp.

Referenced by getrawtransaction(), getspentinfo(), gobject(), ParseHashO(), and voteraw().

◆ ParseHexO()

vector<unsigned char> ParseHexO ( const UniValue o,
string  strKey 
)

Definition at line 156 of file server.cpp.

Referenced by signrawtransaction().

◆ ParseHexV()

vector<unsigned char> ParseHexV ( const UniValue v,
string  strName 
)

◆ RPCIsInWarmup()

bool RPCIsInWarmup ( std::string *  outStatus)

Definition at line 470 of file server.cpp.

Referenced by CheckWarmup().

◆ RPCRegisterTimerInterface()

void RPCRegisterTimerInterface ( RPCTimerInterface iface)

Register factory function for timers

Definition at line 592 of file server.cpp.

Referenced by RPCConsole::RPCConsole(), and StartHTTPRPC().

◆ RPCRunLater()

void RPCRunLater ( const std::string &  name,
boost::function< void(void)>  func,
int64_t  nSeconds 
)

Run func nSeconds from now. Overrides previous timer <name> (if any).

Definition at line 604 of file server.cpp.

Referenced by walletpassphrase().

◆ RPCTypeCheck()

◆ RPCTypeCheckObj()

void RPCTypeCheckObj ( const UniValue o,
const map< string, UniValue::VType > &  typesExpected,
bool  fAllowNull 
)

Definition at line 91 of file server.cpp.

Referenced by lockunspent(), and signrawtransaction().

◆ RPCUnregisterTimerInterface()

void RPCUnregisterTimerInterface ( RPCTimerInterface iface)

Unregister factory function for timers

Definition at line 597 of file server.cpp.

Referenced by StopHTTPRPC(), and RPCConsole::~RPCConsole().

◆ rpcWarmupStatus()

static std::string rpcWarmupStatus ( "RPC server started"  )
static

◆ SetRPCWarmupFinished()

void SetRPCWarmupFinished ( )

Definition at line 463 of file server.cpp.

Referenced by AppInit2().

◆ SetRPCWarmupStatus()

void SetRPCWarmupStatus ( const std::string &  newStatus)

Set the RPC warmup status. When this is done, all RPC calls will error out immediately with RPC_IN_WARMUP.

Definition at line 457 of file server.cpp.

Referenced by AppInit2().

◆ StartRPC()

bool StartRPC ( )

Definition at line 430 of file server.cpp.

Referenced by AppInitServers().

◆ stop()

UniValue stop ( const UniValue params,
bool  fHelp 
)

Definition at line 240 of file server.cpp.

Referenced by zapwallettxes.ZapWalletTXesTest::run_test().

◆ StopRPC()

void StopRPC ( )

Definition at line 445 of file server.cpp.

Referenced by PrepareShutdown().

◆ ValueFromAmount()

Variable Documentation

◆ cs_rpcWarmup

CCriticalSection cs_rpcWarmup
static

◆ deadlineTimers

std::map<std::string, boost::shared_ptr<RPCTimerBase> > deadlineTimers
static

Definition at line 40 of file server.cpp.

Referenced by RPCRunLater(), and StopRPC().

◆ fRPCInWarmup

bool fRPCInWarmup = true
static

Definition at line 33 of file server.cpp.

Referenced by CRPCTable::execute(), RPCIsInWarmup(), and SetRPCWarmupFinished().

◆ fRPCRunning

bool fRPCRunning = false
static

Definition at line 32 of file server.cpp.

Referenced by InterruptRPC(), IsRPCRunning(), and StartRPC().

◆ g_rpcSignals

◆ tableRPC

◆ timerInterfaces

std::vector<RPCTimerInterface*> timerInterfaces
static

Definition at line 37 of file server.cpp.

Referenced by RPCRegisterTimerInterface(), RPCRunLater(), and RPCUnregisterTimerInterface().

◆ vRPCCommands

const CRPCCommand vRPCCommands[]
static

Call Table

Definition at line 256 of file server.cpp.

Referenced by CRPCTable::CRPCTable().