Monero
Loading...
Searching...
No Matches
daemon_messages.h
Go to the documentation of this file.
1// Copyright (c) 2016-2022, The Monero Project
2//
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without modification, are
6// permitted provided that the following conditions are met:
7//
8// 1. Redistributions of source code must retain the above copyright notice, this list of
9// conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12// of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14//
15// 3. Neither the name of the copyright holder nor the names of its contributors may be
16// used to endorse or promote products derived from this software without specific
17// prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29#pragma once
30
31#include <rapidjson/writer.h>
32#include <unordered_map>
33#include <vector>
34
35#include "byte_stream.h"
36#include "message.h"
41
42#define BEGIN_RPC_MESSAGE_CLASS(classname) \
43class classname \
44{ \
45 public:
46
47#define BEGIN_RPC_MESSAGE_REQUEST \
48 class Request final : public Message \
49 { \
50 public: \
51 Request() { } \
52 ~Request() { } \
53 void doToJson(rapidjson::Writer<epee::byte_stream>& dest) const override final; \
54 void fromJson(const rapidjson::Value& val) override final;
55
56#define BEGIN_RPC_MESSAGE_RESPONSE \
57 class Response final : public Message \
58 { \
59 public: \
60 Response() { } \
61 ~Response() { } \
62 void doToJson(rapidjson::Writer<epee::byte_stream>& dest) const override final; \
63 void fromJson(const rapidjson::Value& val) override final;
64
65#define END_RPC_MESSAGE_REQUEST };
66#define END_RPC_MESSAGE_RESPONSE };
67#define END_RPC_MESSAGE_CLASS };
68
69// NOTE: when using a type with multiple template parameters,
70// replace any comma in the template specifier with the macro
71// above, or the preprocessor will eat the comma in a bad way.
72#define RPC_MESSAGE_MEMBER(type, name) type name = {}
73
74
75namespace cryptonote
76{
77
78namespace rpc
79{
80
88
89
92 RPC_MESSAGE_MEMBER(std::list<crypto::hash>, block_ids);
97 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_with_transactions>, blocks);
98 RPC_MESSAGE_MEMBER(uint64_t, start_height);
99 RPC_MESSAGE_MEMBER(uint64_t, current_height);
100 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_output_indices>, output_indices);
101 RPC_MESSAGE_MEMBER(uint64_t, max_block_count);
104
105
108 RPC_MESSAGE_MEMBER(std::list<crypto::hash>, known_hashes);
109 RPC_MESSAGE_MEMBER(uint64_t, start_height);
112 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, hashes);
113 RPC_MESSAGE_MEMBER(uint64_t, start_height);
114 RPC_MESSAGE_MEMBER(uint64_t, current_height);
117
118
119BEGIN_RPC_MESSAGE_CLASS(GetTransactions);
121 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, tx_hashes);
124 using txes_map = std::unordered_map<crypto::hash, transaction_info>;
126 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, missed_hashes);
129
130
138 RPC_MESSAGE_MEMBER(std::vector<crypto::key_image>, key_images);
141 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, spent_status);
144
145
146BEGIN_RPC_MESSAGE_CLASS(GetTxGlobalOutputIndices);
151 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, output_indices);
154
155
156BEGIN_RPC_MESSAGE_CLASS(GetRandomOutputsForAmounts);
158 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
162 RPC_MESSAGE_MEMBER(std::vector<amount_with_random_outputs>, amounts_with_outputs);
165
169 RPC_MESSAGE_MEMBER(bool, relay);
172 RPC_MESSAGE_MEMBER(bool, relayed);
175
178 RPC_MESSAGE_MEMBER(std::string, tx_as_hex);
179 RPC_MESSAGE_MEMBER(bool, relay);
181 using Response = SendRawTx::Response;
183
186 RPC_MESSAGE_MEMBER(std::string, miner_address);
188 RPC_MESSAGE_MEMBER(bool, do_background_mining);
189 RPC_MESSAGE_MEMBER(bool, ignore_battery);
194
202
209
214 RPC_MESSAGE_MEMBER(bool, active);
216 RPC_MESSAGE_MEMBER(uint64_t, threads_count);
218 RPC_MESSAGE_MEMBER(bool, is_background_mining_enabled);
221
228
237
238BEGIN_RPC_MESSAGE_CLASS(GetBlockTemplate);
244
251
252BEGIN_RPC_MESSAGE_CLASS(GetLastBlockHeader);
259
260BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHash);
268
269BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHeight);
277
278BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersByHeight);
280 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, heights);
283 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::BlockHeaderResponse>, headers);
286
293
298 RPC_MESSAGE_MEMBER(std::vector<peer>, white_list);
299 RPC_MESSAGE_MEMBER(std::vector<peer>, gray_list);
302
309
317
318BEGIN_RPC_MESSAGE_CLASS(GetTransactionPool);
322 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::tx_in_pool>, transactions);
326
333
334BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersRange);
340
347
354
361
370
377
384
385BEGIN_RPC_MESSAGE_CLASS(FlushTransactionPool);
391
392BEGIN_RPC_MESSAGE_CLASS(GetOutputHistogram);
394 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
397 RPC_MESSAGE_MEMBER(bool, unlocked);
401 RPC_MESSAGE_MEMBER(std::vector<output_amount_count>, histogram);
404
407 RPC_MESSAGE_MEMBER(std::vector<output_amount_and_index>, outputs);
410 RPC_MESSAGE_MEMBER(std::vector<output_key_mask_unlocked>, keys);
413
421
424 RPC_MESSAGE_MEMBER(uint64_t, num_grace_blocks);
427 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, fees);
428 RPC_MESSAGE_MEMBER(uint64_t, estimated_base_fee);
431 RPC_MESSAGE_MEMBER(uint8_t, hard_fork_version);
434
435BEGIN_RPC_MESSAGE_CLASS(GetOutputDistribution);
437 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
440 RPC_MESSAGE_MEMBER(bool, cumulative);
443 RPC_MESSAGE_MEMBER(std::vector<output_distribution>, distributions);
446
447} // namespace rpc
448
449} // namespace cryptonote
static void prune(MDB_env *env0, MDB_env *env1)
Definition blockchain_prune.cpp:249
static boost::multiprecision::uint128_t fees
Definition blockchain_stats.cpp:58
Definition cryptonote_basic.h:205
std::tuple< uint64_t, uint64_t, std::vector< tools::wallet2::transfer_details > > outputs
Definition cold-outputs.cpp:53
#define BEGIN_RPC_MESSAGE_CLASS(classname)
Definition daemon_messages.h:42
#define BEGIN_RPC_MESSAGE_REQUEST
Definition daemon_messages.h:47
#define RPC_MESSAGE_MEMBER(type, name)
Definition daemon_messages.h:72
static MDB_envinfo info
Definition mdb_load.c:37
static int version
Definition mdb_load.c:29
uint32_t address
Definition getifaddr.c:269
Definition blocks.cpp:13
POD_CLASS hash
Definition hash.h:49
END_RPC_MESSAGE_CLASS
Definition daemon_messages.h:87
SendRawTx::Response Response
Definition daemon_messages.h:181
END_RPC_MESSAGE_REQUEST
Definition daemon_messages.h:83
BEGIN_RPC_MESSAGE_RESPONSE
Definition daemon_messages.h:84
BEGIN_RPC_MESSAGE_REQUEST
Definition daemon_messages.h:82
END_RPC_MESSAGE_RESPONSE
Definition daemon_messages.h:86
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
Definition message_data_structs.h:107
STATUS
Definition daemon_messages.h:132
@ SPENT_IN_POOL
Definition daemon_messages.h:135
@ SPENT_IN_BLOCKCHAIN
Definition daemon_messages.h:134
@ UNSPENT
Definition daemon_messages.h:133
std::unordered_map< crypto::hash, transaction_info > txes_map
Definition daemon_messages.h:124
Holds cryptonote related classes and helpers.
Definition blockchain_db.cpp:45
Definition speed.py:1
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
unsigned __int64 uint64_t
Definition stdint.h:136
signed char int8_t
Definition stdint.h:121
Definition message_data_structs.h:161
Definition message_data_structs.h:176
Definition message_data_structs.h:131
Definition minissdpd.c:66
struct hash_func hashes[]
cryptonote::transaction tx
Definition transaction.cpp:40