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)
 

Public Member Functions

 RPCConsole (const PlatformStyle *platformStyle, QWidget *parent)
 
 ~RPCConsole ()
 
void setClientModel (ClientModel *model)
 

Static Public Member Functions

static bool RPCParseCommandLine (std::string &strResult, const std::string &strCommand, bool fExecute, std::string *const pstrFilteredOut=nullptr)
 Split shell command line into a list of arguments and optionally execute the command(s). More...
 
static bool RPCExecuteCommandLine (std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=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

Ui::RPCConsole * ui
 
ClientModelclientModel
 
QStringList history
 
int historyPtr
 
QString cmdBeforeBrowsing
 
QList< NodeIdcachedNodeids
 
const PlatformStyleplatformStyle
 
RPCTimerInterfacerpcTimerInterface
 
QMenu * peersTableContextMenu
 
QMenu * banTableContextMenu
 
int consoleFontSize
 
QCompleter * autoCompleter
 
QThread thread
 

Detailed Description

Local Bitcoin RPC console.

Definition at line 31 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 131 of file rpcconsole.h.

Enumerator
MC_ERROR 
MC_DEBUG 
CMD_REQUEST 
CMD_REPLY 
CMD_ERROR 

Definition at line 46 of file rpcconsole.h.

Enumerator
TAB_INFO 
TAB_CONSOLE 
TAB_GRAPH 
TAB_PEERS 

Definition at line 54 of file rpcconsole.h.

Constructor & Destructor Documentation

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

Definition at line 447 of file rpcconsole.cpp.

Here is the call graph for this function:

RPCConsole::~RPCConsole ( )

Definition at line 504 of file rpcconsole.cpp.

Here is the call graph for this function:

Member Function Documentation

void RPCConsole::banSelectedNode ( int  bantime)
slot

Ban a selected node on the Peers tab.

Definition at line 1162 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 898 of file rpcconsole.cpp.

Here is the caller graph for this function:

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

Definition at line 737 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 1211 of file rpcconsole.cpp.

Here is the caller graph for this function:

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

Here is the caller graph for this function:

void RPCConsole::disconnectSelectedNode ( )
slot

Disconnect a selected node on the Peers tab.

Definition at line 1145 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 513 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::fontBigger ( )
slot

Definition at line 702 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 707 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 1120 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::keyPressEvent ( QKeyEvent *  event)
protected

Definition at line 788 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 796 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 856 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 948 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 959 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::on_tabWidget_currentChanged ( int  index)
privateslot

Definition at line 940 of file rpcconsole.cpp.

Here is the call graph for this function:

void RPCConsole::peerLayoutAboutToChange ( )
slot

Handle selection caching before update.

Definition at line 990 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 1001 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 978 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 1104 of file rpcconsole.cpp.

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

Definition at line 40 of file rpcconsole.h.

Here is the caller graph for this function:

bool RPCConsole::RPCParseCommandLine ( std::string &  strResult,
const std::string &  strCommand,
bool  fExecute,
std::string *const  pstrFilteredOut = 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
[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 149 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 953 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::setClientModel ( ClientModel model)

Definition at line 557 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 712 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 846 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 833 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 838 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 825 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 1229 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::setTrafficGraphRange ( int  mins)
private

Definition at line 966 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 1138 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::showEvent ( QShowEvent *  event)
privateslot

Definition at line 1109 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 1219 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 1131 of file rpcconsole.cpp.

Here is the caller graph for this function:

void RPCConsole::startExecutor ( )
private

Definition at line 919 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 1189 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 812 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 1058 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 972 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
private

Definition at line 152 of file rpcconsole.h.

QMenu* RPCConsole::banTableContextMenu
private

Definition at line 150 of file rpcconsole.h.

QList<NodeId> RPCConsole::cachedNodeids
private

Definition at line 146 of file rpcconsole.h.

ClientModel* RPCConsole::clientModel
private

Definition at line 142 of file rpcconsole.h.

QString RPCConsole::cmdBeforeBrowsing
private

Definition at line 145 of file rpcconsole.h.

int RPCConsole::consoleFontSize
private

Definition at line 151 of file rpcconsole.h.

QStringList RPCConsole::history
private

Definition at line 143 of file rpcconsole.h.

int RPCConsole::historyPtr
private

Definition at line 144 of file rpcconsole.h.

QMenu* RPCConsole::peersTableContextMenu
private

Definition at line 149 of file rpcconsole.h.

const PlatformStyle* RPCConsole::platformStyle
private

Definition at line 147 of file rpcconsole.h.

RPCTimerInterface* RPCConsole::rpcTimerInterface
private

Definition at line 148 of file rpcconsole.h.

QThread RPCConsole::thread
private

Definition at line 153 of file rpcconsole.h.

Ui::RPCConsole* RPCConsole::ui
private

Definition at line 141 of file rpcconsole.h.


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