Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

rest.cpp File Reference
#include <chain.h>
#include <chainparams.h>
#include <core_io.h>
#include <primitives/block.h>
#include <primitives/transaction.h>
#include <validation.h>
#include <httpserver.h>
#include <rpc/blockchain.h>
#include <rpc/server.h>
#include <streams.h>
#include <sync.h>
#include <txmempool.h>
#include <utilstrencodings.h>
#include <version.h>
#include <boost/algorithm/string.hpp>
#include <univalue.h>
+ Include dependency graph for rest.cpp:

Go to the source code of this file.

Classes

struct  CCoin
 

Enumerations

enum  RetFormat { RF_UNDEF, RF_BINARY, RF_HEX, RF_JSON }
 

Functions

static bool RESTERR (HTTPRequest *req, enum HTTPStatusCode status, std::string message)
 
static enum RetFormat ParseDataFormat (std::string &param, const std::string &strReq)
 
static std::string AvailableDataFormatsString ()
 
static bool ParseHashStr (const std::string &strReq, uint256 &v)
 
static bool CheckWarmup (HTTPRequest *req)
 
static bool rest_headers (HTTPRequest *req, const std::string &strURIPart)
 
static bool rest_block (HTTPRequest *req, const std::string &strURIPart, bool showTxDetails)
 
static bool rest_block_extended (HTTPRequest *req, const std::string &strURIPart)
 
static bool rest_block_notxdetails (HTTPRequest *req, const std::string &strURIPart)
 
UniValue getblockchaininfo (const JSONRPCRequest &request)
 
static bool rest_chaininfo (HTTPRequest *req, const std::string &strURIPart)
 
static bool rest_mempool_info (HTTPRequest *req, const std::string &strURIPart)
 
static bool rest_mempool_contents (HTTPRequest *req, const std::string &strURIPart)
 
static bool rest_tx (HTTPRequest *req, const std::string &strURIPart)
 
static bool rest_getutxos (HTTPRequest *req, const std::string &strURIPart)
 
bool StartREST ()
 Start HTTP REST subsystem. More...
 
void InterruptREST ()
 Interrupt RPC REST subsystem. More...
 
void StopREST ()
 Stop HTTP REST subsystem. More...
 

Variables

static const size_t MAX_GETUTXOS_OUTPOINTS = 15
 
struct {
   enum RetFormat   rf
 
   const char *   name
 
rf_names []
 
struct {
   const char *   prefix
 
   bool(*   handler )(HTTPRequest *req, const
      std::string &strReq)
 
uri_prefixes []
 

Enumeration Type Documentation

◆ RetFormat

enum RetFormat
Enumerator
RF_UNDEF 
RF_BINARY 
RF_HEX 
RF_JSON 

Definition at line 27 of file rest.cpp.

Function Documentation

◆ AvailableDataFormatsString()

static std::string AvailableDataFormatsString ( )
static

Definition at line 91 of file rest.cpp.

References ARRAYLEN, name, and rf_names.

Referenced by rest_block(), rest_getutxos(), and rest_tx().

◆ CheckWarmup()

static bool CheckWarmup ( HTTPRequest req)
static

◆ getblockchaininfo()

◆ InterruptREST()

void InterruptREST ( )

Interrupt RPC REST subsystem.

Definition at line 594 of file rest.cpp.

Referenced by Interrupt().

◆ ParseDataFormat()

static enum RetFormat ParseDataFormat ( std::string &  param,
const std::string &  strReq 
)
static

◆ ParseHashStr()

static bool ParseHashStr ( const std::string &  strReq,
uint256 v 
)
static

Definition at line 107 of file rest.cpp.

References IsHex(), and base_blob< BITS >::SetHex().

Referenced by rest_block(), rest_headers(), and rest_tx().

◆ rest_block()

◆ rest_block_extended()

static bool rest_block_extended ( HTTPRequest req,
const std::string &  strURIPart 
)
static

Definition at line 262 of file rest.cpp.

References rest_block().

◆ rest_block_notxdetails()

static bool rest_block_notxdetails ( HTTPRequest req,
const std::string &  strURIPart 
)
static

Definition at line 267 of file rest.cpp.

References rest_block().

◆ rest_chaininfo()

static bool rest_chaininfo ( HTTPRequest req,
const std::string &  strURIPart 
)
static

◆ rest_getutxos()

◆ rest_headers()

◆ rest_mempool_contents()

static bool rest_mempool_contents ( HTTPRequest req,
const std::string &  strURIPart 
)
static

◆ rest_mempool_info()

static bool rest_mempool_info ( HTTPRequest req,
const std::string &  strURIPart 
)
static

◆ rest_tx()

◆ RESTERR()

static bool RESTERR ( HTTPRequest req,
enum HTTPStatusCode  status,
std::string  message 
)
static

◆ StartREST()

bool StartREST ( )

Start HTTP REST subsystem.

Precondition; HTTP and RPC has been started.

Definition at line 587 of file rest.cpp.

References ARRAYLEN, handler, prefix, RegisterHTTPHandler(), and uri_prefixes.

Referenced by AppInitServers().

◆ StopREST()

void StopREST ( )

Stop HTTP REST subsystem.

Precondition; HTTP and RPC has been stopped.

Definition at line 598 of file rest.cpp.

References ARRAYLEN, prefix, UnregisterHTTPHandler(), and uri_prefixes.

Referenced by PrepareShutdown().

Variable Documentation

◆ handler

bool(* handler) (HTTPRequest *req, const std::string &strReq)

Definition at line 575 of file rest.cpp.

Referenced by RegisterHTTPHandler(), registerSignalHandler(), and StartREST().

◆ MAX_GETUTXOS_OUTPOINTS

const size_t MAX_GETUTXOS_OUTPOINTS = 15
static

Definition at line 25 of file rest.cpp.

Referenced by rest_getutxos().

◆ name

◆ prefix

◆ rf

◆ rf_names

const { ... } rf_names[]
Initial value:
= {
{RF_UNDEF, ""},
{RF_BINARY, "bin"},
{RF_HEX, "hex"},
{RF_JSON, "json"},
}
Definition: rest.cpp:30
Definition: rest.cpp:31

Referenced by AvailableDataFormatsString(), and ParseDataFormat().

◆ uri_prefixes

const { ... } uri_prefixes[]
Initial value:
= {
{"/rest/tx/", rest_tx},
{"/rest/block/notxdetails/", rest_block_notxdetails},
{"/rest/block/", rest_block_extended},
{"/rest/chaininfo", rest_chaininfo},
{"/rest/mempool/info", rest_mempool_info},
{"/rest/mempool/contents", rest_mempool_contents},
{"/rest/headers/", rest_headers},
{"/rest/getutxos", rest_getutxos},
}
static bool rest_mempool_info(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:298
static bool rest_chaininfo(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:275
static bool rest_tx(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:342
static bool rest_headers(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:124
static bool rest_getutxos(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:391
static bool rest_mempool_contents(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:320
static bool rest_block_notxdetails(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:267
static bool rest_block_extended(HTTPRequest *req, const std::string &strURIPart)
Definition: rest.cpp:262

Referenced by StartREST(), and StopREST().

Released under the MIT license