Bitcoin Core 31.99.0
P2P Digital Currency
init.h
Go to the documentation of this file.
1// Copyright (c) 2021-present The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_INTERFACES_INIT_H
6#define BITCOIN_INTERFACES_INIT_H
7
8// This header is associated with several source files, and IWYU
9// reaches different conclusions across them about whether these
10// headers should be included or their classes forward-declared.
11// Keep the includes so the result is the same for every file.
12// IWYU pragma: begin_keep
13#include <interfaces/chain.h>
14#include <interfaces/echo.h>
15#include <interfaces/mining.h>
16#include <interfaces/node.h>
17#include <interfaces/rpc.h>
18#include <interfaces/wallet.h>
19// IWYU pragma: end_keep
20
21#include <memory>
22#include <stdexcept>
23
24namespace node {
25struct NodeContext;
26} // namespace node
27
28namespace interfaces {
29class Ipc;
30
38class Init
39{
40public:
41 virtual ~Init() = default;
42 virtual std::unique_ptr<Node> makeNode() { return nullptr; }
43 virtual std::unique_ptr<Chain> makeChain() { return nullptr; }
44 virtual std::unique_ptr<Mining> makeMining() { return nullptr; }
45 virtual std::unique_ptr<WalletLoader> makeWalletLoader(Chain& chain) { return nullptr; }
46 virtual std::unique_ptr<Echo> makeEcho() { return nullptr; }
47 virtual std::unique_ptr<Rpc> makeRpc() { return nullptr; }
48 virtual Ipc* ipc() { return nullptr; }
49 virtual bool canListenIpc() { return false; }
50 virtual const char* exeName() { return nullptr; }
51 virtual void makeMiningOld2() { throw std::runtime_error("Old mining interface (@2) not supported. Please update your client!"); }
52};
53
60std::unique_ptr<Init> MakeNodeInit(node::NodeContext& node, int argc, char* argv[], int& exit_status);
61
63std::unique_ptr<Init> MakeWalletInit(int argc, char* argv[], int& exit_status);
64
66std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[]);
67
85std::unique_ptr<Init> MakeBasicInit(const char* exe_name, const char* process_argv0="");
86} // namespace interfaces
87
88#endif // BITCOIN_INTERFACES_INIT_H
int exit_status
Interface giving clients (wallet processes, maybe other analysis tools in the future) ability to acce...
Definition: chain.h:117
Initial interface created when a process is first started, and used to give and get access to other i...
Definition: init.h:39
virtual std::unique_ptr< Rpc > makeRpc()
Definition: init.h:47
virtual std::unique_ptr< Echo > makeEcho()
Definition: init.h:46
virtual Ipc * ipc()
Definition: init.h:48
virtual std::unique_ptr< Chain > makeChain()
Definition: init.h:43
virtual bool canListenIpc()
Definition: init.h:49
virtual ~Init()=default
virtual std::unique_ptr< Node > makeNode()
Definition: init.h:42
virtual std::unique_ptr< Mining > makeMining()
Definition: init.h:44
virtual const char * exeName()
Definition: init.h:50
virtual std::unique_ptr< WalletLoader > makeWalletLoader(Chain &chain)
Definition: init.h:45
virtual void makeMiningOld2()
Definition: init.h:51
Interface providing access to interprocess-communication (IPC) functionality.
Definition: ipc.h:52
std::unique_ptr< Init > MakeBasicInit(const char *exe_name, const char *process_argv0)
Return implementation of Init interface for a basic IPC client that doesn't provide any IPC services ...
Definition: basic.cpp:25
std::unique_ptr< Init > MakeGuiInit(int argc, char *argv[])
Return implementation of Init interface for the gui process.
Definition: bitcoin-gui.cpp:55
std::unique_ptr< Init > MakeNodeInit(node::NodeContext &node, int argc, char *argv[], int &exit_status)
Return implementation of Init interface for the node process.
std::unique_ptr< Init > MakeWalletInit(int argc, char *argv[], int &exit_status)
Return implementation of Init interface for the wallet process.
Definition: messages.h:21
NodeContext struct containing references to chain state and connection state.
Definition: context.h:59