Branch data Line data Source code
# 1 : : // Copyright (c) 2021 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 : : #include <memory> # 9 : : # 10 : : namespace node { # 11 : : struct NodeContext; # 12 : : } // namespace node # 13 : : # 14 : : namespace interfaces { # 15 : : class Chain; # 16 : : class Echo; # 17 : : class Ipc; # 18 : : class Node; # 19 : : class WalletLoader; # 20 : : # 21 : : //! Initial interface created when a process is first started, and used to give # 22 : : //! and get access to other interfaces (Node, Chain, Wallet, etc). # 23 : : //! # 24 : : //! There is a different Init interface implementation for each process # 25 : : //! (bitcoin-gui, bitcoin-node, bitcoin-wallet, bitcoind, bitcoin-qt) and each # 26 : : //! implementation can implement the make methods for interfaces it supports. # 27 : : //! The default make methods all return null. # 28 : : class Init # 29 : : { # 30 : : public: # 31 : 891 : virtual ~Init() = default; # 32 : : virtual std::unique_ptr<Node> makeNode(); # 33 : : virtual std::unique_ptr<Chain> makeChain(); # 34 : : virtual std::unique_ptr<WalletLoader> makeWalletLoader(Chain& chain); # 35 : : virtual std::unique_ptr<Echo> makeEcho(); # 36 : : virtual Ipc* ipc(); # 37 : : }; # 38 : : # 39 : : //! Return implementation of Init interface for the node process. If the argv # 40 : : //! indicates that this is a child process spawned to handle requests from a # 41 : : //! parent process, this blocks and handles requests, then returns null and a # 42 : : //! status code to exit with. If this returns non-null, the caller can start up # 43 : : //! normally and use the Init object to spawn and connect to other processes # 44 : : //! while it is running. # 45 : : std::unique_ptr<Init> MakeNodeInit(node::NodeContext& node, int argc, char* argv[], int& exit_status); # 46 : : # 47 : : //! Return implementation of Init interface for the wallet process. # 48 : : std::unique_ptr<Init> MakeWalletInit(int argc, char* argv[], int& exit_status); # 49 : : # 50 : : //! Return implementation of Init interface for the gui process. # 51 : : std::unique_ptr<Init> MakeGuiInit(int argc, char* argv[]); # 52 : : } // namespace interfaces # 53 : : # 54 : : #endif // BITCOIN_INTERFACES_INIT_H