Electroneum
Loading...
Searching...
No Matches
daemon_handler.h
Go to the documentation of this file.
1// Copyright (c) 2017-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 "daemon_messages.h"
32#include "daemon_rpc_version.h"
33#include "rpc_handler.h"
36#include "p2p/net_node.h"
37
38namespace
39{
41} // anonymous namespace
42
43namespace cryptonote
44{
45
46namespace rpc
47{
48
50{
51 public:
52
53 DaemonHandler(cryptonote::core& c, t_p2p& p2p) : m_core(c), m_p2p(p2p) { }
54
56
57 void handle(const GetHeight::Request& req, GetHeight::Response& res);
58
59 void handle(const GetBlocksFast::Request& req, GetBlocksFast::Response& res);
60
61 void handle(const GetHashesFast::Request& req, GetHashesFast::Response& res);
62
63 void handle(const GetTransactions::Request& req, GetTransactions::Response& res);
64
65 void handle(const KeyImagesSpent::Request& req, KeyImagesSpent::Response& res);
66
67 void handle(const GetTxGlobalOutputIndices::Request& req, GetTxGlobalOutputIndices::Response& res);
68
69 void handle(const SendRawTx::Request& req, SendRawTx::Response& res);
70
71 void handle(const SendRawTxHex::Request& req, SendRawTxHex::Response& res);
72
73 void handle(const StartMining::Request& req, StartMining::Response& res);
74
75 void handle(const GetInfo::Request& req, GetInfo::Response& res);
76
77 void handle(const StopMining::Request& req, StopMining::Response& res);
78
79 void handle(const MiningStatus::Request& req, MiningStatus::Response& res);
80
81 void handle(const SaveBC::Request& req, SaveBC::Response& res);
82
83 void handle(const GetBlockHash::Request& req, GetBlockHash::Response& res);
84
85 void handle(const GetBlockTemplate::Request& req, GetBlockTemplate::Response& res);
86
87 void handle(const SubmitBlock::Request& req, SubmitBlock::Response& res);
88
89 void handle(const GetLastBlockHeader::Request& req, GetLastBlockHeader::Response& res);
90
91 void handle(const GetBlockHeaderByHash::Request& req, GetBlockHeaderByHash::Response& res);
92
93 void handle(const GetBlockHeaderByHeight::Request& req, GetBlockHeaderByHeight::Response& res);
94
95 void handle(const GetBlockHeadersByHeight::Request& req, GetBlockHeadersByHeight::Response& res);
96
97 void handle(const GetBlock::Request& req, GetBlock::Response& res);
98
99 void handle(const GetPeerList::Request& req, GetPeerList::Response& res);
100
101 void handle(const SetLogHashRate::Request& req, SetLogHashRate::Response& res);
102
103 void handle(const SetLogLevel::Request& req, SetLogLevel::Response& res);
104
105 void handle(const GetTransactionPool::Request& req, GetTransactionPool::Response& res);
106
107 void handle(const GetConnections::Request& req, GetConnections::Response& res);
108
109 void handle(const GetBlockHeadersRange::Request& req, GetBlockHeadersRange::Response& res);
110
111 void handle(const StopDaemon::Request& req, StopDaemon::Response& res);
112
113 void handle(const StartSaveGraph::Request& req, StartSaveGraph::Response& res);
114
115 void handle(const StopSaveGraph::Request& req, StopSaveGraph::Response& res);
116
117 void handle(const HardForkInfo::Request& req, HardForkInfo::Response& res);
118
119 void handle(const GetBans::Request& req, GetBans::Response& res);
120
121 void handle(const SetBans::Request& req, SetBans::Response& res);
122
123 void handle(const FlushTransactionPool::Request& req, FlushTransactionPool::Response& res);
124
125 void handle(const GetOutputHistogram::Request& req, GetOutputHistogram::Response& res);
126
127 void handle(const GetOutputKeys::Request& req, GetOutputKeys::Response& res);
128
129 void handle(const GetRPCVersion::Request& req, GetRPCVersion::Response& res);
130
131 void handle(const GetFeeEstimate::Request& req, GetFeeEstimate::Response& res);
132
133 void handle(const GetOutputDistribution::Request& req, GetOutputDistribution::Response& res);
134
135 std::string handle(const std::string& request);
136
137 private:
138
139 bool getBlockHeaderByHash(const crypto::hash& hash_in, cryptonote::rpc::BlockHeaderResponse& response);
140
141 void handleTxBlob(const std::string& tx_blob, bool relay, SendRawTx::Response& res);
142
143 cryptonote::core& m_core;
144 t_p2p& m_p2p;
145};
146
147} // namespace rpc
148
149} // namespace cryptonote
handles core cryptonote functionality
DaemonHandler(cryptonote::core &c, t_p2p &p2p)
void handle(const GetHeight::Request &req, GetHeight::Response &res)
This is the orginal cryptonote protocol network-events handler, modified by us.
const char * res
POD_CLASS hash
Definition hash.h:50
Holds cryptonote related classes and helpers.
Definition ban.cpp:40