BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
Public Member Functions | Protected Attributes | List of all members
graphene::net::node Class Reference

provides application independent P2P broadcast and data synchronization More...

#include <node.hpp>

Inheritance diagram for graphene::net::node:

Public Member Functions

 node (const std::string &user_agent)
 
virtual ~node ()
 
void close () const
 
void set_node_delegate (std::shared_ptr< node_delegate > del) const
 
void load_configuration (const fc::path &configuration_directory) const
 
virtual void listen_to_p2p_network () const
 
virtual void connect_to_p2p_network () const
 
void add_node (const fc::ip::endpoint &ep) const
 
void add_seed_nodes (const std::vector< std::string > &seeds) const
 
void add_seed_node (const std::string &in) const
 
virtual void connect_to_endpoint (const fc::ip::endpoint &ep) const
 
void set_listen_endpoint (const fc::ip::endpoint &ep, bool wait_if_not_available) const
 
void set_inbound_endpoint (const fc::ip::endpoint &ep) const
 
void set_accept_incoming_connections (bool accept) const
 
void set_connect_to_new_peers (bool connect) const
 
virtual fc::ip::endpoint get_actual_listening_endpoint () const
 
void set_advertise_algorithm (const std::string &algo, const std::vector< std::string > &advertise_or_exclude_list=std::vector< std::string >()) const
 
std::vector< peer_statusget_connected_peers () const
 
virtual uint32_t get_connection_count () const
 
virtual void broadcast (const message &item_to_broadcast) const
 
virtual void broadcast_transaction (const signed_transaction &trx) const
 
virtual void sync_from (const item_id &current_head_block, const std::vector< uint32_t > &hard_fork_block_numbers) const
 
bool is_connected () const
 
void set_advanced_node_parameters (const fc::variant_object &params) const
 
fc::variant_object get_advanced_node_parameters () const
 
message_propagation_data get_tx_propagation_data (const graphene::protocol::transaction_id_type &transaction_id) const
 
message_propagation_data get_block_propagation_data (const graphene::protocol::block_id_type &block_id) const
 
node_id_t get_node_id () const
 
void set_allowed_peers (const std::vector< node_id_t > &allowed_peers) const
 
void clear_peer_database () const
 
void set_total_bandwidth_limit (uint32_t upload_bytes_per_second, uint32_t download_bytes_per_second) const
 
fc::variant_object network_get_info () const
 
fc::variant_object network_get_usage_stats () const
 
std::vector< potential_peer_recordget_potential_peers () const
 
fc::variant_object get_call_statistics () const
 

Protected Attributes

node_impl_ptr my
 

Detailed Description

provides application independent P2P broadcast and data synchronization

Unanswered questions: when does the node start establishing network connections and accepting peers? we don't have enough info to start synchronizing until sync_from() is called, would we have any reason to connect before that?

Definition at line 190 of file node.hpp.

Constructor & Destructor Documentation

◆ node()

graphene::net::node::node ( const std::string &  user_agent)
explicit

Definition at line 5070 of file node.cpp.

◆ ~node()

graphene::net::node::~node ( )
virtual

Definition at line 5076 of file node.cpp.

Member Function Documentation

◆ add_node()

void graphene::net::node::add_node ( const fc::ip::endpoint ep) const

Add endpoint to internal level_map database of potential nodes to attempt to connect to. This database is consulted any time the number connected peers falls below the target.

Definition at line 5102 of file node.cpp.

◆ add_seed_node()

void graphene::net::node::add_seed_node ( const std::string &  in) const

Definition at line 5434 of file node.cpp.

◆ add_seed_nodes()

void graphene::net::node::add_seed_nodes ( const std::vector< std::string > &  seeds) const

Definition at line 5421 of file node.cpp.

◆ broadcast()

void graphene::net::node::broadcast ( const message item_to_broadcast) const
virtual

Add message to outgoing inventory list, notify peers that I have a message ready.

Definition at line 5147 of file node.cpp.

◆ broadcast_transaction()

virtual void graphene::net::node::broadcast_transaction ( const signed_transaction trx) const
inlinevirtual

Definition at line 285 of file node.hpp.

◆ clear_peer_database()

void graphene::net::node::clear_peer_database ( ) const

Instructs the node to forget everything in its peer database, mostly for debugging problems where nodes are failing to connect to the network

Definition at line 5198 of file node.cpp.

◆ close()

void graphene::net::node::close ( ) const

Definition at line 5224 of file node.cpp.

◆ connect_to_endpoint()

void graphene::net::node::connect_to_endpoint ( const fc::ip::endpoint ep) const
virtual

Attempt to connect to the specified endpoint immediately.

Definition at line 5107 of file node.cpp.

◆ connect_to_p2p_network()

void graphene::net::node::connect_to_p2p_network ( ) const
virtual

Definition at line 5097 of file node.cpp.

◆ get_actual_listening_endpoint()

fc::ip::endpoint graphene::net::node::get_actual_listening_endpoint ( ) const
virtual

Returns the endpoint the node is listening on. This is usually the same as the value previously passed in to set_listen_endpoint, unless we were unable to bind to that port.

Definition at line 5132 of file node.cpp.

◆ get_advanced_node_parameters()

fc::variant_object graphene::net::node::get_advanced_node_parameters ( ) const

Definition at line 5172 of file node.cpp.

◆ get_block_propagation_data()

message_propagation_data graphene::net::node::get_block_propagation_data ( const graphene::protocol::block_id_type block_id) const

Definition at line 5183 of file node.cpp.

◆ get_call_statistics()

fc::variant_object graphene::net::node::get_call_statistics ( ) const

Definition at line 5209 of file node.cpp.

◆ get_connected_peers()

std::vector< peer_status > graphene::net::node::get_connected_peers ( ) const
Returns
a list of peers that are currently connected.

Definition at line 5137 of file node.cpp.

◆ get_connection_count()

uint32_t graphene::net::node::get_connection_count ( ) const
virtual

return the number of peers we're actively connected to

Definition at line 5142 of file node.cpp.

◆ get_node_id()

node_id_t graphene::net::node::get_node_id ( ) const

Definition at line 5188 of file node.cpp.

◆ get_potential_peers()

std::vector< potential_peer_record > graphene::net::node::get_potential_peers ( ) const

Definition at line 5162 of file node.cpp.

◆ get_tx_propagation_data()

message_propagation_data graphene::net::node::get_tx_propagation_data ( const graphene::protocol::transaction_id_type transaction_id) const

Definition at line 5177 of file node.cpp.

◆ is_connected()

bool graphene::net::node::is_connected ( ) const

Definition at line 5157 of file node.cpp.

◆ listen_to_p2p_network()

void graphene::net::node::listen_to_p2p_network ( ) const
virtual

Definition at line 5092 of file node.cpp.

◆ load_configuration()

void graphene::net::node::load_configuration ( const fc::path configuration_directory) const

Definition at line 5087 of file node.cpp.

◆ network_get_info()

fc::variant_object graphene::net::node::network_get_info ( ) const

Definition at line 5214 of file node.cpp.

◆ network_get_usage_stats()

fc::variant_object graphene::net::node::network_get_usage_stats ( ) const

Definition at line 5219 of file node.cpp.

◆ set_accept_incoming_connections()

void graphene::net::node::set_accept_incoming_connections ( bool  accept) const

Enable or disable listening for incoming connections

Parameters
acceptset to true to listen for incoming connections, false otherwise

Definition at line 5122 of file node.cpp.

◆ set_advanced_node_parameters()

void graphene::net::node::set_advanced_node_parameters ( const fc::variant_object params) const

Definition at line 5167 of file node.cpp.

◆ set_advertise_algorithm()

void graphene::net::node::set_advertise_algorithm ( const std::string &  algo,
const std::vector< std::string > &  advertise_or_exclude_list = std::vector<std::string>() 
) const

Definition at line 5439 of file node.cpp.

◆ set_allowed_peers()

void graphene::net::node::set_allowed_peers ( const std::vector< node_id_t > &  allowed_peers) const

Definition at line 5193 of file node.cpp.

◆ set_connect_to_new_peers()

void graphene::net::node::set_connect_to_new_peers ( bool  connect) const

Definition at line 5127 of file node.cpp.

◆ set_inbound_endpoint()

void graphene::net::node::set_inbound_endpoint ( const fc::ip::endpoint ep) const

Specifies the IP address and port on the "external network" which other peers should connect to.

Note
If the address is unknown (E.G. dynamically allocated), specify 0.0.0.0 as the address.
Parameters
epthe endpoint (IP address and port)

Definition at line 5117 of file node.cpp.

◆ set_listen_endpoint()

void graphene::net::node::set_listen_endpoint ( const fc::ip::endpoint ep,
bool  wait_if_not_available 
) const

Specifies the IP address and port on the "local machine" that should accept incoming connections.

Note
To listen on all IPv4 addresses on the local machine, specify 0.0.0.0 as the address.
Parameters
epthe endpoint (IP address and port)
wait_if_not_availablekeep retrying if port is not available

Definition at line 5112 of file node.cpp.

◆ set_node_delegate()

void graphene::net::node::set_node_delegate ( std::shared_ptr< node_delegate del) const

Definition at line 5081 of file node.cpp.

◆ set_total_bandwidth_limit()

void graphene::net::node::set_total_bandwidth_limit ( uint32_t  upload_bytes_per_second,
uint32_t  download_bytes_per_second 
) const

Definition at line 5203 of file node.cpp.

◆ sync_from()

void graphene::net::node::sync_from ( const item_id current_head_block,
const std::vector< uint32_t > &  hard_fork_block_numbers 
) const
virtual

Node starts the process of fetching all items after item_id of the given item_type. During this process messages are not broadcast.

Definition at line 5152 of file node.cpp.

Member Data Documentation

◆ my

node_impl_ptr graphene::net::node::my
protected

Definition at line 323 of file node.hpp.


The documentation for this class was generated from the following files: