BitShares-Core  6.1.0
BitShares blockchain implementation and command-line interface 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)

Definition at line 5068 of file node.cpp.

◆ ~node()

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

Definition at line 5074 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 5100 of file node.cpp.

◆ add_seed_node()

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

Definition at line 5432 of file node.cpp.

◆ add_seed_nodes()

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

Definition at line 5419 of file node.cpp.

◆ broadcast()

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

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

Definition at line 5145 of file node.cpp.

◆ broadcast_transaction()

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

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 5196 of file node.cpp.

◆ close()

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

Definition at line 5222 of file node.cpp.

◆ connect_to_endpoint()

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

Attempt to connect to the specified endpoint immediately.

Definition at line 5105 of file node.cpp.

◆ connect_to_p2p_network()

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

Definition at line 5095 of file node.cpp.

◆ get_actual_listening_endpoint()

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

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 5130 of file node.cpp.

◆ get_advanced_node_parameters()

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

Definition at line 5170 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 5181 of file node.cpp.

◆ get_call_statistics()

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

Definition at line 5207 of file node.cpp.

◆ get_connected_peers()

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

Definition at line 5135 of file node.cpp.

◆ get_connection_count()

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

return the number of peers we're actively connected to

Definition at line 5140 of file node.cpp.

◆ get_node_id()

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

Definition at line 5186 of file node.cpp.

◆ get_potential_peers()

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

Definition at line 5160 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 5175 of file node.cpp.

◆ is_connected()

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

Definition at line 5155 of file node.cpp.

◆ listen_to_p2p_network()

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

Definition at line 5090 of file node.cpp.

◆ load_configuration()

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

Definition at line 5085 of file node.cpp.

◆ network_get_info()

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

Definition at line 5212 of file node.cpp.

◆ network_get_usage_stats()

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

Definition at line 5217 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

acceptset to true to listen for incoming connections, false otherwise

Definition at line 5120 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 5165 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 5437 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 5191 of file node.cpp.

◆ set_connect_to_new_peers()

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

Definition at line 5125 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.

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

Definition at line 5115 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.

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

Definition at line 5110 of file node.cpp.

◆ set_node_delegate()

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

Definition at line 5079 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 5201 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

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 5150 of file node.cpp.

Member Data Documentation

◆ my

node_impl_ptr graphene::net::node::my

Definition at line 323 of file node.hpp.

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