Bitcoin Core  0.15.99
P2P Digital Currency
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
RPCConsole Class Reference

Local Bitcoin RPC console. More...

#include <rpcconsole.h>

Inheritance diagram for RPCConsole:
[legend]
Collaboration diagram for RPCConsole:
[legend]

Public Types

enum  MessageClass {
  MC_ERROR, MC_DEBUG, CMD_REQUEST, CMD_REPLY,
  CMD_ERROR
}
 
enum  TabTypes { TAB_INFO = 0, TAB_CONSOLE = 1, TAB_GRAPH = 2, TAB_PEERS = 3 }
 

Public Slots

void clear (bool clearHistory=true)
 
void fontBigger ()
 
void fontSmaller ()
 
void setFontSize (int newSize)
 
void message (int category, const QString &message, bool html=false)
 Append the message to the message widget. More...
 
void setNumConnections (int count)
 Set number of connections shown in the UI. More...
 
void setNetworkActive (bool networkActive)
 Set network state shown in the UI. More...
 
void setNumBlocks (int count, const QDateTime &blockDate, double nVerificationProgress, bool headers)
 Set number of blocks and last block date shown in the UI. More...
 
void setMempoolSize (long numberOfTxs, size_t dynUsage)
 Set size (number of transactions and memory usage) of the mempool in the UI. More...
 
void browseHistory (int offset)
 Go forward or back in history. More...
 
void scrollToEnd ()
 Scroll console view to end. More...
 
void peerSelected (const QItemSelection &selected, const QItemSelection &deselected)
 Handle selection of peer in peers list. More...
 
void peerLayoutAboutToChange ()
 Handle selection caching before update. More...
 
void peerLayoutChanged ()
 Handle updated peer information. More...
 
void disconnectSelectedNode ()
 Disconnect a selected node on the Peers tab. More...
 
void banSelectedNode (int bantime)
 Ban a selected node on the Peers tab. More...
 
void unbanSelectedNode ()
 Unban a selected node on the Bans tab. More...
 
void setTabFocus (enum TabTypes tabType)
 set which tab has the focus (is visible) More...
 

Signals

void stopExecutor ()
 
void cmdRequest (const QString &command, const QString &walletID)
 

Public Member Functions

 RPCConsole (interfaces::Node &node, const PlatformStyle *platformStyle, QWidget *parent)
 
 ~RPCConsole ()
 
void setClientModel (ClientModel *model)
 
void addWallet (WalletModel *const walletModel)
 

Static Public Member Functions

static bool RPCParseCommandLine (interfaces::Node *node, std::string &strResult, const std::string &strCommand, bool fExecute, std::string *const pstrFilteredOut=nullptr, const std::string *walletID=nullptr)
 Split shell command line into a list of arguments and optionally execute the command(s). More...
 
static bool RPCExecuteCommandLine (interfaces::Node &node, std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr, const std::string *walletID=nullptr)
 

Protected Member Functions

virtual bool eventFilter (QObject *obj, QEvent *event)
 
void keyPressEvent (QKeyEvent *)
 

Private Types

enum  ColumnWidths {
  ADDRESS_COLUMN_WIDTH = 200, SUBVERSION_COLUMN_WIDTH = 150, PING_COLUMN_WIDTH = 80, BANSUBNET_COLUMN_WIDTH = 200,
  BANTIME_COLUMN_WIDTH = 250
}
 

Private Slots

void on_lineEdit_returnPressed ()
 
void on_tabWidget_currentChanged (int index)
 
void on_openDebugLogfileButton_clicked ()
 open the debug.log from the current datadir More...
 
void on_sldGraphRange_valueChanged (int value)
 change the time range of the network traffic graph More...
 
void updateTrafficStats (quint64 totalBytesIn, quint64 totalBytesOut)
 update traffic statistics More...
 
void resizeEvent (QResizeEvent *event)
 
void showEvent (QShowEvent *event)
 
void hideEvent (QHideEvent *event)
 
void showPeersTableContextMenu (const QPoint &point)
 Show custom context menu on Peers tab. More...
 
void showBanTableContextMenu (const QPoint &point)
 Show custom context menu on Bans tab. More...
 
void showOrHideBanTableIfRequired ()
 Hides ban table if no bans are present. More...
 
void clearSelectedNode ()
 clear the selected node More...
 

Private Member Functions

void startExecutor ()
 
void setTrafficGraphRange (int mins)
 
void updateNodeDetail (const CNodeCombinedStats *stats)
 show detailed information on ui about selected node More...
 
void updateNetworkState ()
 Update UI with latest network info from model. More...
 

Private Attributes

interfaces::Nodem_node
 
Ui::RPCConsole *const ui
 
ClientModelclientModel = nullptr
 
QStringList history
 
int historyPtr = 0
 
QString cmdBeforeBrowsing
 
QList< NodeIdcachedNodeids
 
const PlatformStyle *const platformStyle
 
RPCTimerInterfacerpcTimerInterface = nullptr
 
QMenu * peersTableContextMenu = nullptr
 
QMenu * banTableContextMenu = nullptr
 
int consoleFontSize = 0
 
QCompleter * autoCompleter = nullptr
 
QThread thread
 
QString m_last_wallet_id
 

Detailed Description

Local Bitcoin RPC console.

Definition at line 36 of file rpcconsole.h.

Member Enumeration Documentation

Enumerator
ADDRESS_COLUMN_WIDTH 
SUBVERSION_COLUMN_WIDTH 
PING_COLUMN_WIDTH 
BANSUBNET_COLUMN_WIDTH 
BANTIME_COLUMN_WIDTH 

Definition at line 137 of file rpcconsole.h.

Enumerator
MC_ERROR 
MC_DEBUG 
CMD_REQUEST 
CMD_REPLY 
CMD_ERROR 

Definition at line 52 of file rpcconsole.h.

Enumerator
TAB_INFO 
TAB_CONSOLE 
TAB_GRAPH 
TAB_PEERS 

Definition at line 60 of file rpcconsole.h.

Constructor & Destructor Documentation

RPCConsole::RPCConsole ( interfaces::Node node,
const PlatformStyle platformStyle,
QWidget *  parent 
)
explicit

Definition at line 455 of file rpcconsole.cpp.

Here is the call graph for this function:

RPCConsole::~RPCConsole ( )

Definition at line 512 of file rpcconsole.cpp.

Here is the call graph for this function:

Member Function Documentation

void RPCConsole::addWallet ( WalletModel *const  walletModel)

Here is the caller graph for this function:

void RPCConsole::banSelectedNode ( int  bantime)
slot

Ban a selected node on the Peers tab.

Definition at line 1203 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::browseHistory ( int  offset)
slot

Go forward or back in history.

Definition at line 942 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::clear ( bool  clearHistory = true)
slot

Definition at line 764 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::clearSelectedNode ( )
privateslot

clear the selected node

Definition at line 1251 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::cmdRequest ( const QString &  command,
const QString &  walletID 
)
signal

Here is the caller graph for this function:

void RPCConsole::disconnectSelectedNode ( )
slot

Disconnect a selected node on the Peers tab.

Definition at line 1189 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool RPCConsole::eventFilter ( QObject *  obj,
QEvent *  event 
)
protectedvirtual

Definition at line 521 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::fontBigger ( )
slot

Definition at line 729 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::fontSmaller ( )
slot

Definition at line 734 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::hideEvent ( QHideEvent *  event)
privateslot

Definition at line 1164 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::keyPressEvent ( QKeyEvent *  event)
protected

Definition at line 815 of file rpcconsole.cpp.

void RPCConsole::message ( int  category,
const QString &  message,
bool  html = false 
)
slot

Append the message to the message widget.

Definition at line 823 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::on_lineEdit_returnPressed ( )
privateslot

Definition at line 883 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::on_openDebugLogfileButton_clicked ( )
privateslot

open the debug.log from the current datadir

Definition at line 992 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::on_sldGraphRange_valueChanged ( int  value)
privateslot

change the time range of the network traffic graph

Definition at line 1003 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::on_tabWidget_currentChanged ( int  index)
privateslot

Definition at line 984 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::peerLayoutAboutToChange ( )
slot

Handle selection caching before update.

Definition at line 1034 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::peerLayoutChanged ( )
slot

Handle updated peer information.

Definition at line 1045 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::peerSelected ( const QItemSelection &  selected,
const QItemSelection &  deselected 
)
slot

Handle selection of peer in peers list.

Definition at line 1022 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::resizeEvent ( QResizeEvent *  event)
privateslot

Definition at line 1148 of file rpcconsole.cpp.

static bool RPCConsole::RPCExecuteCommandLine ( interfaces::Node node,
std::string &  strResult,
const std::string &  strCommand,
std::string *const  pstrFilteredOut = nullptr,
const std::string *  walletID = nullptr 
)
inlinestatic

Definition at line 45 of file rpcconsole.h.

Here is the caller graph for this function:

bool RPCConsole::RPCParseCommandLine ( interfaces::Node node,
std::string &  strResult,
const std::string &  strCommand,
bool  fExecute,
std::string *const  pstrFilteredOut = nullptr,
const std::string *  walletID = nullptr 
)
static

Split shell command line into a list of arguments and optionally execute the command(s).

Aims to emulate bash and friends.

  • Command nesting is possible with parenthesis; for example: validateaddress(getnewaddress())
  • Arguments are delimited with whitespace or comma
  • Extra whitespace at the beginning and end and between arguments will be ignored
  • Text can be "double" or 'single' quoted
  • The backslash \ is used as escape character
    • Outside quotes, any character can be escaped
    • Within double quotes, only escape " and backslashes before a \c " or another backslash
    • Within single quotes, no escaping is possible and no special interpretation takes place
Parameters
[in]nodeoptional node to execute command on
[out]resultstringified Result from the executed command(chain)
[in]strCommandCommand line to split
[in]fExecuteset true if you want the command to be executed
[out]pstrFilteredOutCommand line, filtered to remove any sensitive data

Definition at line 157 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::scrollToEnd ( )
slot

Scroll console view to end.

Definition at line 997 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::setClientModel ( ClientModel model)

Definition at line 565 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::setFontSize ( int  newSize)
slot

Definition at line 739 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::setMempoolSize ( long  numberOfTxs,
size_t  dynUsage 
)
slot

Set size (number of transactions and memory usage) of the mempool in the UI.

Definition at line 873 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::setNetworkActive ( bool  networkActive)
slot

Set network state shown in the UI.

Definition at line 860 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::setNumBlocks ( int  count,
const QDateTime &  blockDate,
double  nVerificationProgress,
bool  headers 
)
slot

Set number of blocks and last block date shown in the UI.

Definition at line 865 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::setNumConnections ( int  count)
slot

Set number of connections shown in the UI.

Definition at line 852 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::setTabFocus ( enum TabTypes  tabType)
slot

set which tab has the focus (is visible)

Definition at line 1269 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::setTrafficGraphRange ( int  mins)
private

Definition at line 1010 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::showBanTableContextMenu ( const QPoint &  point)
privateslot

Show custom context menu on Bans tab.

Definition at line 1182 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::showEvent ( QShowEvent *  event)
privateslot

Definition at line 1153 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::showOrHideBanTableIfRequired ( )
privateslot

Hides ban table if no bans are present.

Definition at line 1259 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::showPeersTableContextMenu ( const QPoint &  point)
privateslot

Show custom context menu on Peers tab.

Definition at line 1175 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::startExecutor ( )
private

Definition at line 963 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::stopExecutor ( )
signal

Here is the caller graph for this function:

void RPCConsole::unbanSelectedNode ( )
slot

Unban a selected node on the Bans tab.

Definition at line 1230 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::updateNetworkState ( )
private

Update UI with latest network info from model.

Definition at line 839 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::updateNodeDetail ( const CNodeCombinedStats stats)
private

show detailed information on ui about selected node

Definition at line 1102 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void RPCConsole::updateTrafficStats ( quint64  totalBytesIn,
quint64  totalBytesOut 
)
privateslot

update traffic statistics

Definition at line 1016 of file rpcconsole.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

QCompleter* RPCConsole::autoCompleter = nullptr
private

Definition at line 159 of file rpcconsole.h.

QMenu* RPCConsole::banTableContextMenu = nullptr
private

Definition at line 157 of file rpcconsole.h.

QList<NodeId> RPCConsole::cachedNodeids
private

Definition at line 153 of file rpcconsole.h.

ClientModel* RPCConsole::clientModel = nullptr
private

Definition at line 149 of file rpcconsole.h.

QString RPCConsole::cmdBeforeBrowsing
private

Definition at line 152 of file rpcconsole.h.

int RPCConsole::consoleFontSize = 0
private

Definition at line 158 of file rpcconsole.h.

QStringList RPCConsole::history
private

Definition at line 150 of file rpcconsole.h.

int RPCConsole::historyPtr = 0
private

Definition at line 151 of file rpcconsole.h.

QString RPCConsole::m_last_wallet_id
private

Definition at line 161 of file rpcconsole.h.

interfaces::Node& RPCConsole::m_node
private

Definition at line 147 of file rpcconsole.h.

QMenu* RPCConsole::peersTableContextMenu = nullptr
private

Definition at line 156 of file rpcconsole.h.

const PlatformStyle* const RPCConsole::platformStyle
private

Definition at line 154 of file rpcconsole.h.

RPCTimerInterface* RPCConsole::rpcTimerInterface = nullptr
private

Definition at line 155 of file rpcconsole.h.

QThread RPCConsole::thread
private

Definition at line 160 of file rpcconsole.h.

Ui::RPCConsole* const RPCConsole::ui
private

Definition at line 148 of file rpcconsole.h.


The documentation for this class was generated from the following files: