BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
Public Member Functions | Static Public Member Functions | 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 ()
void set_node_delegate (node_delegate *del)
void load_configuration (const fc::path &configuration_directory)
virtual void listen_to_p2p_network ()
virtual void connect_to_p2p_network ()
void add_node (const fc::ip::endpoint &ep)
void add_seed_nodes (std::vector< std::string > seeds)
void add_seed_node (const std::string &in)
virtual void connect_to_endpoint (const fc::ip::endpoint &ep)
void listen_on_endpoint (const fc::ip::endpoint &ep, bool wait_if_not_available)
void accept_incoming_connections (bool accept)
void listen_on_port (uint16_t port, bool wait_if_not_available)
virtual fc::ip::endpoint get_actual_listening_endpoint () const
std::vector< peer_statusget_connected_peers () const
virtual uint32_t get_connection_count () const
virtual void broadcast (const message &item_to_broadcast)
virtual void broadcast_transaction (const signed_transaction &trx)
virtual void sync_from (const item_id &current_head_block, const std::vector< uint32_t > &hard_fork_block_numbers)
bool is_connected () const
void set_advanced_node_parameters (const fc::variant_object &params)
fc::variant_object get_advanced_node_parameters ()
message_propagation_data get_transaction_propagation_data (const graphene::protocol::transaction_id_type &transaction_id)
message_propagation_data get_block_propagation_data (const graphene::protocol::block_id_type &block_id)
node_id_t get_node_id () const
void set_allowed_peers (const std::vector< node_id_t > &allowed_peers)
void clear_peer_database ()
void set_total_bandwidth_limit (uint32_t upload_bytes_per_second, uint32_t download_bytes_per_second)
fc::variant_object network_get_info () const
fc::variant_object network_get_usage_stats () const
std::vector< potential_peer_recordget_potential_peers () const
void disable_peer_advertising ()
fc::variant_object get_call_statistics () const

Static Public Member Functions

static std::vector< fc::ip::endpointresolve_string_to_ip_endpoints (const std::string &in)
 Helper to convert a string to a collection of endpoints. More...

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 192 of file node.hpp.

Constructor & Destructor Documentation

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

Definition at line 4888 of file node.cpp.

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

Definition at line 4893 of file node.cpp.

Member Function Documentation

void graphene::net::node::accept_incoming_connections ( bool  accept)

Call with true to enable listening for incoming connections

Definition at line 4933 of file node.cpp.

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

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

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

Definition at line 5334 of file node.cpp.

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

Definition at line 5321 of file node.cpp.

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

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

Reimplemented in graphene::net::simulated_network.

Definition at line 4958 of file node.cpp.

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

Definition at line 283 of file node.hpp.

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

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

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

Definition at line 5039 of file node.cpp.

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

Attempt to connect to the specified endpoint immediately.

Reimplemented in graphene::net::simulated_network.

Definition at line 4923 of file node.cpp.

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

Reimplemented in graphene::net::simulated_network.

Definition at line 4913 of file node.cpp.

void graphene::net::node::disable_peer_advertising ( )

Definition at line 5019 of file node.cpp.

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 listen_on_endpoint, unless we were unable to bind to that port.

Reimplemented in graphene::net::simulated_network.

Definition at line 4943 of file node.cpp.

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

Definition at line 4983 of file node.cpp.

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

Definition at line 4993 of file node.cpp.

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

Definition at line 5024 of file node.cpp.

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

Definition at line 4948 of file node.cpp.

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

return the number of peers we're actively connected to

Reimplemented in graphene::net::simulated_network.

Definition at line 4953 of file node.cpp.

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

Definition at line 4998 of file node.cpp.

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

Definition at line 4973 of file node.cpp.

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

Definition at line 4988 of file node.cpp.

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

Definition at line 4968 of file node.cpp.

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

Specifies the network interface and port upon which incoming connections should be accepted.

Definition at line 4928 of file node.cpp.

void graphene::net::node::listen_on_port ( uint16_t  port,
bool  wait_if_not_available 

Specifies the port upon which incoming connections should be accepted.

portthe port to listen on
wait_if_not_availableif true and the port is not available, enter a sleep and retry loop to wait for it to become available. If false and the port is not available, just choose a random available port

Definition at line 4938 of file node.cpp.

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

Reimplemented in graphene::net::simulated_network.

Definition at line 4908 of file node.cpp.

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

Definition at line 4903 of file node.cpp.

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

Definition at line 5029 of file node.cpp.

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

Definition at line 5034 of file node.cpp.

std::vector< fc::ip::endpoint > graphene::net::node::resolve_string_to_ip_endpoints ( const std::string &  in)

Helper to convert a string to a collection of endpoints.

This converts a string (i.e. "" to a collection of endpoints. NOTE: Throws an exception if not in correct format or was unable to resolve URL.

inthe incoming string
a vector of endpoints

Definition at line 5292 of file node.cpp.

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

Definition at line 4978 of file node.cpp.

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

Definition at line 5003 of file node.cpp.

void graphene::net::node::set_node_delegate ( node_delegate del)

Definition at line 4897 of file node.cpp.

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

Definition at line 5013 of file node.cpp.

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

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

Reimplemented in graphene::net::simulated_network.

Definition at line 4963 of file node.cpp.

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