Dash Core  0.12.2.1
P2P Digital Currency
protocol.cpp File Reference
#include "rpc/protocol.h"
#include "random.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
#include "utiltime.h"
#include "version.h"
#include <stdint.h>
#include <fstream>

Go to the source code of this file.

Functions

string JSONRPCRequest (const string &strMethod, const UniValue &params, const UniValue &id)
 
UniValue JSONRPCReplyObj (const UniValue &result, const UniValue &error, const UniValue &id)
 
string JSONRPCReply (const UniValue &result, const UniValue &error, const UniValue &id)
 
UniValue JSONRPCError (int code, const string &message)
 
boost::filesystem::path GetAuthCookieFile ()
 
bool GenerateAuthCookie (std::string *cookie_out)
 
bool GetAuthCookie (std::string *cookie_out)
 
void DeleteAuthCookie ()
 

Variables

static const std::string COOKIEAUTH_USER = "__cookie__"
 
static const std::string COOKIEAUTH_FILE = ".cookie"
 

Function Documentation

◆ DeleteAuthCookie()

void DeleteAuthCookie ( )

Delete RPC authentication cookie from disk

Definition at line 122 of file protocol.cpp.

◆ GenerateAuthCookie()

bool GenerateAuthCookie ( std::string *  cookie_out)

Generate a new RPC authentication cookie and write it to disk

the umask determines what permissions are used to create this file - these are set to 077 in init.cpp unless overridden with -sysperms.

Definition at line 79 of file protocol.cpp.

Referenced by InitRPCAuthentication().

◆ GetAuthCookie()

bool GetAuthCookie ( std::string *  cookie_out)

Read the RPC authentication cookie from disk

Definition at line 106 of file protocol.cpp.

Referenced by CallRPC().

◆ GetAuthCookieFile()

boost::filesystem::path GetAuthCookieFile ( )

Get name of RPC authentication cookie file

Definition at line 72 of file protocol.cpp.

Referenced by DeleteAuthCookie(), GenerateAuthCookie(), and GetAuthCookie().

◆ JSONRPCError()

UniValue JSONRPCError ( int  code,
const string &  message 
)

Definition at line 57 of file protocol.cpp.

Referenced by abandontransaction(), AccountFromValue(), addnode(), AmountFromValue(), backupwallet(), BIP22ValidationResult(), clearbanned(), createrawtransaction(), decoderawtransaction(), disconnectnode(), dumphdinfo(), dumpprivkey(), dumpwallet(), encryptwallet(), EnsureWalletIsAvailable(), EnsureWalletIsUnlocked(), CRPCTable::execute(), fundrawtransaction(), generate(), getaccount(), GetAccountAddress(), getaddednodeinfo(), getaddressbalance(), getaddressdeltas(), getAddressesFromParams(), getaddressmempool(), getaddresstxids(), getaddressutxos(), getblock(), getblockhash(), getblockhashes(), getblockheader(), getblockheaders(), getblocktemplate(), getconnectioncount(), getnettotals(), getnewaddress(), getpeerinfo(), getrawchangeaddress(), getrawtransaction(), getreceivedbyaddress(), getspentinfo(), getsuperblockbudget(), gettransaction(), gettxoutproof(), gobject(), HTTPReq_JSONRPC(), importaddress(), importelectrumwallet(), importprivkey(), importpubkey(), ImportScript(), importwallet(), instantsendtoaddress(), invalidateblock(), JSONRPCExecOne(), keypoolrefill(), listbanned(), listsinceblock(), listtransactions(), listunspent(), lockunspent(), masternode(), masternodebroadcast(), movecmd(), OnRPCPreCommand(), JSONRequest::parse(), ParseHashV(), ParseHexV(), ping(), reconsiderblock(), resendwallettransactions(), RPCRunLater(), RPCTypeCheck(), RPCTypeCheckObj(), sendfrom(), sendmany(), SendMoney(), sendrawtransaction(), sendtoaddress(), setaccount(), setban(), setgenerate(), setnetworkactive(), signmessage(), signrawtransaction(), spork(), submitblock(), verifymessage(), verifytxoutproof(), voteraw(), walletlock(), walletpassphrase(), and walletpassphrasechange().

◆ JSONRPCReply()

string JSONRPCReply ( const UniValue result,
const UniValue error,
const UniValue id 
)

Definition at line 51 of file protocol.cpp.

Referenced by HTTPReq_JSONRPC(), and JSONErrorReply().

◆ JSONRPCReplyObj()

UniValue JSONRPCReplyObj ( const UniValue result,
const UniValue error,
const UniValue id 
)

Definition at line 39 of file protocol.cpp.

Referenced by JSONRPCExecOne(), and JSONRPCReply().

◆ JSONRPCRequest()

string JSONRPCRequest ( const string &  strMethod,
const UniValue params,
const UniValue id 
)

JSON-RPC protocol. Bitcoin speaks version 1.0 for maximum compatibility, but uses JSON-RPC 1.1/2.0 standards for parts of the 1.0 standard that were unspecified (HTTP errors and contents of 'error').

1.0 spec: http://json-rpc.org/wiki/specification 1.2 spec: http://jsonrpc.org/historical/json-rpc-over-http.html

Definition at line 30 of file protocol.cpp.

Referenced by CallRPC().

Variable Documentation

◆ COOKIEAUTH_FILE

const std::string COOKIEAUTH_FILE = ".cookie"
static

Default name for auth cookie file

Definition at line 70 of file protocol.cpp.

Referenced by GetAuthCookieFile().

◆ COOKIEAUTH_USER

const std::string COOKIEAUTH_USER = "__cookie__"
static

Username used when cookie authentication is in use (arbitrary, only for recognizability in debugging/logging purposes)

Definition at line 68 of file protocol.cpp.

Referenced by GenerateAuthCookie().