| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
#pragma once |
| 40 |
|
| 41 |
#include <boost/optional/optional_fwd.hpp> |
| 42 |
|
| 43 |
#include "common/common_fwd.h" |
| 44 |
#include "common/rpc_client.h" |
| 45 |
#include "cryptonote_basic/cryptonote_basic.h" |
| 46 |
#include "rpc/core_rpc_server.h" |
| 47 |
|
| 48 |
#undef MONERO_DEFAULT_LOG_CATEGORY |
| 49 |
#define MONERO_DEFAULT_LOG_CATEGORY "daemon" |
| 50 |
|
| 51 |
namespace daemonize { |
| 52 |
|
| 53 |
class t_rpc_command_executor final { |
| 54 |
private: |
| 55 |
tools::t_rpc_client* m_rpc_client; |
| 56 |
cryptonote::core_rpc_server* m_rpc_server; |
| 57 |
bool m_is_rpc; |
| 58 |
|
| 59 |
public: |
| 60 |
t_rpc_command_executor( |
| 61 |
uint32_t ip |
| 62 |
, uint16_t port |
| 63 |
, const boost::optional<tools::login>& user |
| 64 |
, const epee::net_utils::ssl_options_t& ssl_options |
| 65 |
, bool is_rpc = true |
| 66 |
, cryptonote::core_rpc_server* rpc_server = NULL |
| 67 |
); |
| 68 |
|
| 69 |
~t_rpc_command_executor(); |
| 70 |
|
| 71 |
bool print_peer_list(bool white = true, bool gray = true, size_t limit = 0, bool pruned_only = false, bool publicrpc_only = false); |
| 72 |
|
| 73 |
bool print_peer_list_stats(); |
| 74 |
|
| 75 |
bool save_blockchain(); |
| 76 |
|
| 77 |
bool show_hash_rate(); |
| 78 |
|
| 79 |
bool hide_hash_rate(); |
| 80 |
|
| 81 |
bool show_difficulty(); |
| 82 |
|
| 83 |
bool show_status(); |
| 84 |
|
| 85 |
bool print_connections(); |
| 86 |
|
| 87 |
bool print_blockchain_info(int64_t start_block_index, uint64_t end_block_index); |
| 88 |
|
| 89 |
bool set_log_level(int8_t level); |
| 90 |
|
| 91 |
bool set_log_categories(const std::string &categories); |
| 92 |
|
| 93 |
bool print_height(); |
| 94 |
|
| 95 |
bool print_block_by_hash(crypto::hash block_hash, bool include_hex); |
| 96 |
|
| 97 |
bool print_block_by_height(uint64_t height, bool include_hex); |
| 98 |
|
| 99 |
bool print_transaction(crypto::hash transaction_hash, bool include_metadata, bool include_hex, bool include_json); |
| 100 |
|
| 101 |
bool is_key_image_spent(const crypto::key_image &ki); |
| 102 |
|
| 103 |
bool print_transaction_pool_long(); |
| 104 |
|
| 105 |
bool print_transaction_pool_short(); |
| 106 |
|
| 107 |
bool print_transaction_pool_stats(); |
| 108 |
|
| 109 |
bool start_mining(cryptonote::account_public_address address, uint64_t num_threads, cryptonote::network_type nettype, bool do_background_mining = false, bool ignore_battery = false); |
| 110 |
|
| 111 |
bool stop_mining(); |
| 112 |
|
| 113 |
bool mining_status(); |
| 114 |
|
| 115 |
bool stop_daemon(); |
| 116 |
|
| 117 |
bool print_status(); |
| 118 |
|
| 119 |
bool get_limit(); |
| 120 |
|
| 121 |
bool get_limit_up(); |
| 122 |
|
| 123 |
bool get_limit_down(); |
| 124 |
|
| 125 |
bool set_limit(int64_t limit_down, int64_t limit_up); |
| 126 |
|
| 127 |
bool out_peers(bool set, uint32_t limit); |
| 128 |
|
| 129 |
bool in_peers(bool set, uint32_t limit); |
| 130 |
|
| 131 |
bool hard_fork_info(uint8_t version); |
| 132 |
|
| 133 |
bool print_bans(); |
| 134 |
|
| 135 |
bool ban(const std::string &address, time_t seconds); |
| 136 |
|
| 137 |
bool unban(const std::string &address); |
| 138 |
|
| 139 |
bool banned(const std::string &address); |
| 140 |
|
| 141 |
bool flush_txpool(const std::string &txid); |
| 142 |
|
| 143 |
bool output_histogram(const std::vector<uint64_t> &amounts, uint64_t min_count, uint64_t max_count); |
| 144 |
|
| 145 |
bool print_coinbase_tx_sum(uint64_t height, uint64_t count); |
| 146 |
|
| 147 |
bool alt_chain_info(const std::string &tip, size_t above, uint64_t last_blocks); |
| 148 |
|
| 149 |
bool print_blockchain_dynamic_stats(uint64_t nblocks); |
| 150 |
|
| 151 |
bool update(const std::string &command); |
| 152 |
|
| 153 |
bool relay_tx(const std::string &txid); |
| 154 |
|
| 155 |
bool sync_info(); |
| 156 |
|
| 157 |
bool pop_blocks(uint64_t num_blocks); |
| 158 |
|
| 159 |
bool prune_blockchain(); |
| 160 |
|
| 161 |
bool check_blockchain_pruning(); |
| 162 |
|
| 163 |
bool print_net_stats(); |
| 164 |
|
| 165 |
bool version(); |
| 166 |
|
| 167 |
bool set_bootstrap_daemon( |
| 168 |
const std::string &address, |
| 169 |
const std::string &username, |
| 170 |
const std::string &password, |
| 171 |
const std::string &proxy); |
| 172 |
|
| 173 |
bool rpc_payments(); |
| 174 |
|
| 175 |
bool flush_cache(bool invalid_blocks); |
| 176 |
}; |
| 177 |
|
| 178 |
} |