Electroneum
rpc_command_executor.h
Go to the documentation of this file.
1 
9 // Copyrights(c) 2017-2021, The Electroneum Project
10 // Copyrights(c) 2014-2019, The Monero Project
11 //
12 // All rights reserved.
13 //
14 // Redistribution and use in source and binary forms, with or without modification, are
15 // permitted provided that the following conditions are met:
16 //
17 // 1. Redistributions of source code must retain the above copyright notice, this list of
18 // conditions and the following disclaimer.
19 //
20 // 2. Redistributions in binary form must reproduce the above copyright notice, this list
21 // of conditions and the following disclaimer in the documentation and/or other
22 // materials provided with the distribution.
23 //
24 // 3. Neither the name of the copyright holder nor the names of its contributors may be
25 // used to endorse or promote products derived from this software without specific
26 // prior written permission.
27 //
28 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
29 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
31 // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
36 // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
39 
40 #pragma once
41 
42 #include <boost/optional/optional_fwd.hpp>
43 
44 #include "common/common_fwd.h"
45 #include "common/rpc_client.h"
47 #include "net/net_fwd.h"
48 #include "rpc/core_rpc_server.h"
49 
50 #undef ELECTRONEUM_DEFAULT_LOG_CATEGORY
51 #define ELECTRONEUM_DEFAULT_LOG_CATEGORY "daemon"
52 
53 namespace daemonize {
54 
56 private:
57  tools::t_rpc_client* m_rpc_client;
58  cryptonote::core_rpc_server* m_rpc_server;
59  bool m_is_rpc;
60 
61 public:
63  uint32_t ip
64  , uint16_t port
65  , const boost::optional<tools::login>& user
66  , const epee::net_utils::ssl_options_t& ssl_options
67  , bool is_rpc = true
68  , cryptonote::core_rpc_server* rpc_server = NULL
69  );
70 
72 
73  bool print_peer_list(bool white = true, bool gray = true, size_t limit = 0);
74 
75  bool print_peer_list_stats();
76 
77  bool save_blockchain();
78 
79  bool show_hash_rate();
80 
81  bool hide_hash_rate();
82 
83  bool show_difficulty();
84 
85  bool show_status();
86 
87  bool print_connections();
88 
89  bool print_blockchain_info(uint64_t start_block_index, uint64_t end_block_index);
90 
91  bool set_log_level(int8_t level);
92 
93  bool set_log_categories(const std::string &categories);
94 
95  bool print_height();
96 
97  bool print_block_by_hash(crypto::hash block_hash, bool include_hex);
98 
99  bool print_block_by_height(uint64_t height, bool include_hex);
100 
101  bool print_transaction(crypto::hash transaction_hash, bool include_hex, bool include_json);
102 
103  bool is_key_image_spent(const crypto::key_image &ki);
104 
106 
108 
110 
112 
113  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);
114 
115  bool stop_mining();
116 
117  bool mining_status();
118 
119  bool stop_daemon();
120 
121  bool print_status();
122 
123  bool get_limit();
124 
125  bool get_limit_up();
126 
127  bool get_limit_down();
128 
129  bool set_limit(int64_t limit_down, int64_t limit_up);
130 
131  bool out_peers(uint64_t limit);
132 
133  bool in_peers(uint64_t limit);
134 
135  bool start_save_graph();
136 
137  bool stop_save_graph();
138 
140 
141  bool print_bans();
142 
143  bool ban(const std::string &ip, time_t seconds);
144 
145  bool unban(const std::string &ip);
146 
147  bool flush_txpool(const std::string &txid);
148 
149  bool output_histogram(const std::vector<uint64_t> &amounts, uint64_t min_count, uint64_t max_count);
150 
152 
153  bool alt_chain_info(const std::string &tip);
154 
156 
157  bool update(const std::string &command);
158 
159  bool relay_tx(const std::string &txid);
160 
161  bool sync_info();
162 
164 
165  bool prune_blockchain();
166 
168 
169  bool print_net_stats();
170 
171  bool set_validator_key(const std::string &key);
172 
174 
176 };
177 
178 } // namespace daemonize
bool output_histogram(const std::vector< uint64_t > &amounts, uint64_t min_count, uint64_t max_count)
bool update(const std::string &command)
bool print_blockchain_info(uint64_t start_block_index, uint64_t end_block_index)
bool relay_tx(const std::string &txid)
bool set_log_categories(const std::string &categories)
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)
::std::string string
Definition: gtest-port.h:1097
uint64_t height
Definition: blockchain.cpp:91
uint64_t num_blocks(const std::vector< test_event_entry > &events)
Definition: chaingen.cpp:1044
const char * key
Definition: hmac_keccak.cpp:39
unsigned short uint16_t
Definition: stdint.h:125
bool set_limit(int64_t limit_down, int64_t limit_up)
unsigned char uint8_t
Definition: stdint.h:124
bool set_validator_key(const std::string &key)
bool print_blockchain_dynamic_stats(uint64_t nblocks)
bool sign_message(const std::string privateKey, const std::string message)
std::string privateKey
bool print_coinbase_tx_sum(uint64_t height, uint64_t count)
mdb_size_t count(MDB_cursor *cur)
unsigned int uint32_t
Definition: stdint.h:126
unsigned __int64 uint64_t
Definition: stdint.h:136
bool ban(const std::string &ip, time_t seconds)
signed char int8_t
Definition: stdint.h:121
version
Supported socks variants.
Definition: socks.h:57
std::string message("Message requiring signing")
boost::endian::big_uint32_t ip
Definition: socks.cpp:61
boost::endian::big_uint16_t port
Definition: socks.cpp:60
bool print_block_by_hash(crypto::hash block_hash, bool include_hex)
POD_CLASS key_image
Definition: crypto.h:102
signed __int64 int64_t
Definition: stdint.h:135
bool is_key_image_spent(const crypto::key_image &ki)
bool is_public_output_spent(const cryptonote::txin_to_key_public &txin)
bool flush_txpool(const std::string &txid)
t_rpc_command_executor(uint32_t ip, uint16_t port, const boost::optional< tools::login > &user, const epee::net_utils::ssl_options_t &ssl_options, bool is_rpc=true, cryptonote::core_rpc_server *rpc_server=NULL)
POD_CLASS hash
Definition: hash.h:50
bool print_peer_list(bool white=true, bool gray=true, size_t limit=0)
const char * address
Definition: multisig.cpp:37
bool alt_chain_info(const std::string &tip)
bool print_block_by_height(uint64_t height, bool include_hex)
bool print_transaction(crypto::hash transaction_hash, bool include_hex, bool include_json)