28 #include <boost/asio.hpp> 29 #include <boost/utility.hpp> 49 namespace eth {
class Interface; }
50 namespace shh {
class Interface; }
51 namespace bzz {
class Interface;
class Client; }
62 virtual std::vector<p2p::PeerSessionInfo> peers() = 0;
65 virtual size_t peerCount()
const = 0;
71 virtual void addNode(
p2p::NodeID const& _node, bi::tcp::endpoint
const& _hostEndpoint) = 0;
74 virtual void requirePeer(
p2p::NodeID const& _node, bi::tcp::endpoint
const& _endpoint) = 0;
80 virtual void setIdealPeerCount(
size_t _n) = 0;
82 virtual bool haveNetwork()
const = 0;
96 virtual void startNetwork() = 0;
99 virtual void stopNetwork() = 0;
102 virtual bool isNetworkStarted()
const = 0;
105 virtual std::string enode()
const = 0;
125 std::string
const& _clientVersion,
126 std::string
const& _dbPath,
129 std::set<std::string>
const& _interfaces = {
"eth",
"shh",
"bzz"},
132 bool _testing = false
141 std::shared_ptr<shh::WhisperHost>
whisper()
const {
auto w = m_whisper.lock();
if (!w) BOOST_THROW_EXCEPTION(
InterfaceNotSupported(
"shh"));
return w; }
145 static std::string composeClientVersion(std::string
const& _client);
151 std::vector<p2p::PeerSessionInfo> peers()
override;
154 size_t peerCount()
const override;
160 virtual void addNode(
p2p::NodeID const& _node, bi::tcp::endpoint
const& _hostEndpoint)
override;
172 void requirePeer(
p2p::NodeID const& _node, bi::tcp::endpoint
const& _endpoint)
override;
181 void setIdealPeerCount(
size_t _n)
override;
184 void setPeerStretch(
size_t _n);
198 std::string
enode()
const override {
return m_net.enode(); }
286 std::vector<p2p::PeerSessionInfo> peers();
289 size_t peerCount()
const;
292 void connect(std::string
const& _seedHost,
unsigned short _port = 30303);
EthereumSlave(RPCSlave *)
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
std::string const & clientVersion() const
void stopNetwork() override
Stop the network subsystem.
p2p::NodeID id() const override
eth::Client * ethereum() const
The Host class Capabilities should be registered prior to startNetwork, since m_capabilities is not t...
void requirePeer(p2p::NodeID const &_node, std::string const &_hostString)
Require connection to peer.
Main API hub for interfacing with Web 3 components.
u256 networkId() const override
Get network id.
std::string m_clientVersion
Our end-application client's name/version.
Main API hub for interfacing with Web 3 components.
std::unique_ptr< eth::Client > m_ethereum
Client for Ethereum ("eth") protocol.
EthereumMaster(RPCMaster *)
std::vector< Peer > Peers
bzz::Interface * swarm() const
std::shared_ptr< shh::WhisperHost > whisper() const
std::weak_ptr< shh::WhisperHost > m_whisper
Client for Whisper ("shh") protocol.
bool haveNetwork() const override
p2p::Host m_net
Should run in background and send us events when blocks found and allow us to send blocks as required...
std::vector< byte > bytes
vector_ref< byte const > bytesConstRef
p2p::NodeInfo nodeInfo() const override
Get information concerning this node.
Main API hub for interfacing with Ethereum.
p2p::Peers nodes() const override
Gets the nodes.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
Main API hub for interfacing with Ethereum.
void addNode(std::string const &_hostString)
Add node to connect to.
bool isNetworkStarted() const override
Is network working? there may not be any peers yet.
static bi::tcp::endpoint resolveHost(std::string const &_host)
Resolve "host:port" string as TCP endpoint. Returns unspecified endpoint on failure.
eth::Interface * ethereum() const
std::string enode() const override
Get enode string.
void addNode(p2p::NodeID const &_node, std::string const &_hostString)
Add node to connect to.
WhisperMaster(RPCMaster *)
shh::Interface * whisper() const
void addNode(bi::tcp::endpoint const &_endpoint)
Add node to connect to.
void startNetwork() override
Start the network subsystem.