Electroneum
Loading...
Searching...
No Matches
daemon_messages.h
Go to the documentation of this file.
1// Copyright (c) 2016-2019, 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 <unordered_map>
32#include <vector>
33
34#include "message.h"
39
40#define BEGIN_RPC_MESSAGE_CLASS(classname) \
41class classname \
42{ \
43 public: \
44 static const char* const name;
45
46#define BEGIN_RPC_MESSAGE_REQUEST \
47 class Request : public Message \
48 { \
49 public: \
50 Request() { } \
51 ~Request() { } \
52 rapidjson::Value toJson(rapidjson::Document& doc) const; \
53 void fromJson(rapidjson::Value& val);
54
55#define BEGIN_RPC_MESSAGE_RESPONSE \
56 class Response : public Message \
57 { \
58 public: \
59 Response() { } \
60 ~Response() { } \
61 rapidjson::Value toJson(rapidjson::Document& doc) const; \
62 void fromJson(rapidjson::Value& val);
63
64#define END_RPC_MESSAGE_REQUEST };
65#define END_RPC_MESSAGE_RESPONSE };
66#define END_RPC_MESSAGE_CLASS };
67
68// NOTE: when using a type with multiple template parameters,
69// replace any comma in the template specifier with the macro
70// above, or the preprocessor will eat the comma in a bad way.
71#define RPC_MESSAGE_MEMBER(type, name) type name = {}
72
73
74namespace cryptonote
75{
76
77namespace rpc
78{
79
87
88
91 RPC_MESSAGE_MEMBER(std::list<crypto::hash>, block_ids);
93 RPC_MESSAGE_MEMBER(bool, prune);
96 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_with_transactions>, blocks);
97 RPC_MESSAGE_MEMBER(uint64_t, start_height);
98 RPC_MESSAGE_MEMBER(uint64_t, current_height);
99 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::block_output_indices>, output_indices);
102
103
106 RPC_MESSAGE_MEMBER(std::list<crypto::hash>, known_hashes);
107 RPC_MESSAGE_MEMBER(uint64_t, start_height);
110 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, hashes);
111 RPC_MESSAGE_MEMBER(uint64_t, start_height);
112 RPC_MESSAGE_MEMBER(uint64_t, current_height);
115
116
117BEGIN_RPC_MESSAGE_CLASS(GetTransactions);
119 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, tx_hashes);
122 using txes_map = std::unordered_map<crypto::hash, transaction_info>;
124 RPC_MESSAGE_MEMBER(std::vector<crypto::hash>, missed_hashes);
127
128
136 RPC_MESSAGE_MEMBER(std::vector<crypto::key_image>, key_images);
139 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, spent_status);
142
143
144BEGIN_RPC_MESSAGE_CLASS(GetTxGlobalOutputIndices);
149 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, output_indices);
152
153
154BEGIN_RPC_MESSAGE_CLASS(GetRandomOutputsForAmounts);
156 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
160 RPC_MESSAGE_MEMBER(std::vector<amount_with_random_outputs>, amounts_with_outputs);
163
167 RPC_MESSAGE_MEMBER(bool, relay);
170 RPC_MESSAGE_MEMBER(bool, relayed);
173
176 RPC_MESSAGE_MEMBER(std::string, tx_as_hex);
177 RPC_MESSAGE_MEMBER(bool, relay);
179 using Response = SendRawTx::Response;
181
184 RPC_MESSAGE_MEMBER(std::string, miner_address);
186 RPC_MESSAGE_MEMBER(bool, do_background_mining);
187 RPC_MESSAGE_MEMBER(bool, ignore_battery);
192
200
207
212 RPC_MESSAGE_MEMBER(bool, active);
214 RPC_MESSAGE_MEMBER(uint64_t, threads_count);
216 RPC_MESSAGE_MEMBER(bool, is_background_mining_enabled);
219
226
235
236BEGIN_RPC_MESSAGE_CLASS(GetBlockTemplate);
242
249
250BEGIN_RPC_MESSAGE_CLASS(GetLastBlockHeader);
257
258BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHash);
266
267BEGIN_RPC_MESSAGE_CLASS(GetBlockHeaderByHeight);
275
276BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersByHeight);
278 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, heights);
281 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::BlockHeaderResponse>, headers);
284
291
296 RPC_MESSAGE_MEMBER(std::vector<peer>, white_list);
297 RPC_MESSAGE_MEMBER(std::vector<peer>, gray_list);
300
307
315
316BEGIN_RPC_MESSAGE_CLASS(GetTransactionPool);
320 RPC_MESSAGE_MEMBER(std::vector<cryptonote::rpc::tx_in_pool>, transactions);
324
331
332BEGIN_RPC_MESSAGE_CLASS(GetBlockHeadersRange);
338
345
352
359
368
375
382
383BEGIN_RPC_MESSAGE_CLASS(FlushTransactionPool);
389
390BEGIN_RPC_MESSAGE_CLASS(GetOutputHistogram);
392 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
395 RPC_MESSAGE_MEMBER(bool, unlocked);
399 RPC_MESSAGE_MEMBER(std::vector<output_amount_count>, histogram);
402
405 RPC_MESSAGE_MEMBER(std::vector<output_amount_and_index>, outputs);
408 RPC_MESSAGE_MEMBER(std::vector<output_key_mask_unlocked>, keys);
411
419
422 RPC_MESSAGE_MEMBER(uint64_t, num_grace_blocks);
425 RPC_MESSAGE_MEMBER(uint64_t, estimated_base_fee);
428 RPC_MESSAGE_MEMBER(uint8_t, hard_fork_version);
431
432BEGIN_RPC_MESSAGE_CLASS(GetOutputDistribution);
434 RPC_MESSAGE_MEMBER(std::vector<uint64_t>, amounts);
437 RPC_MESSAGE_MEMBER(bool, cumulative);
440 RPC_MESSAGE_MEMBER(std::vector<output_distribution>, distributions);
443
444} // namespace rpc
445
446} // namespace cryptonote
uint64_t height
uint8_t version
#define BEGIN_RPC_MESSAGE_CLASS(classname)
#define BEGIN_RPC_MESSAGE_REQUEST
#define RPC_MESSAGE_MEMBER(type, name)
POD_CLASS hash
Definition hash.h:50
SendRawTx::Response Response
std::unordered_map< crypto::key_image, std::vector< crypto::hash > > key_images_with_tx_hashes
std::unordered_map< crypto::hash, transaction_info > txes_map
Holds cryptonote related classes and helpers.
Definition ban.cpp:40
CXA_THROW_INFO_T * info
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
struct hash_func hashes[]
const char * address
Definition multisig.cpp:37