#include <node.hpp>
Public Types | |
| typedef routing_table::iterator | iterator |
| typedef table_t::iterator | data_iterator |
Public Member Functions | |
| node_impl (boost::function< void(msg const &)> const &f, dht_settings const &settings, boost::optional< node_id > node_id) | |
| virtual | ~node_impl () |
| void | refresh (node_id const &id, boost::function0< void > f) |
| void | bootstrap (std::vector< udp::endpoint > const &nodes, boost::function0< void > f) |
| void | find_node (node_id const &id, boost::function< void(std::vector< node_entry > const &)> f) |
| void | add_router_node (udp::endpoint router) |
| void | incoming (msg const &m) |
| void | refresh () |
| void | refresh_bucket (int bucket) |
| int | bucket_size (int bucket) |
| iterator | begin () const |
| iterator | end () const |
| node_id const & | nid () const |
| boost::tuple< int, int > | size () const |
| data_iterator | begin_data () |
| data_iterator | end_data () |
| int | data_size () const |
| void | print_state (std::ostream &os) const |
| void | announce (sha1_hash const &info_hash, int listen_port, boost::function< void(std::vector< tcp::endpoint > const &, sha1_hash const &)> f) |
| bool | verify_token (msg const &m) |
| entry | generate_token (msg const &m) |
| boost::posix_time::time_duration | connection_timeout () |
| boost::posix_time::time_duration | refresh_timeout () |
| void | new_write_key () |
| void | add_node (udp::endpoint node) |
| void | replacement_cache (bucket_t &nodes) const |
Protected Member Functions | |
| bool | on_find (msg const &m, std::vector< tcp::endpoint > &peers) const |
| void | on_announce (msg const &m, msg &reply) |
Protected Attributes | |
| dht_settings const & | m_settings |
| int | m_max_peers_reply |
Private Types | |
| typedef std::map< node_id, torrent_entry > | table_t |
Private Member Functions | |
| void | incoming_request (msg const &h) |
Private Attributes | |
| node_id | m_id |
| routing_table | m_table |
| rpc_manager | m_rpc |
| table_t | m_map |
| boost::posix_time::ptime | m_last_tracker_tick |
| int | m_secret [2] |
Definition at line 88 of file node.hpp.
typedef std::map<node_id, torrent_entry> libtorrent::dht::node_impl::table_t [private] |
| typedef table_t::iterator libtorrent::dht::node_impl::data_iterator |
| libtorrent::dht::node_impl::node_impl | ( | boost::function< void(msg const &)> const & | f, | |
| dht_settings const & | settings, | |||
| boost::optional< node_id > | node_id | |||
| ) |
| virtual libtorrent::dht::node_impl::~node_impl | ( | ) | [inline, virtual] |
| void libtorrent::dht::node_impl::refresh | ( | node_id const & | id, | |
| boost::function0< void > | f | |||
| ) |
Definition at line 143 of file node.cpp.
References libtorrent::dht::routing_table::begin(), libtorrent::dht::routing_table::bucket_size(), libtorrent::dht::routing_table::find_node(), libtorrent::dht::refresh::initiate(), m_rpc, m_settings, m_table, and libtorrent::dht_settings::search_branching.
| void libtorrent::dht::node_impl::bootstrap | ( | std::vector< udp::endpoint > const & | nodes, | |
| boost::function0< void > | f | |||
| ) |
Definition at line 155 of file node.cpp.
References libtorrent::dht::routing_table::begin(), libtorrent::dht::routing_table::bucket_size(), libtorrent::dht::refresh::initiate(), m_id, m_rpc, m_settings, m_table, and libtorrent::dht_settings::search_branching.
Referenced by libtorrent::dht::dht_tracker::dht_tracker().
| void libtorrent::dht::node_impl::find_node | ( | node_id const & | id, | |
| boost::function< void(std::vector< node_entry > const &)> | f | |||
| ) |
| void libtorrent::dht::node_impl::add_router_node | ( | udp::endpoint | router | ) |
Definition at line 325 of file node.cpp.
References libtorrent::dht::routing_table::add_router_node(), and m_table.
Referenced by libtorrent::dht::dht_tracker::on_router_name_lookup().
| void libtorrent::dht::node_impl::incoming | ( | msg const & | m | ) |
Definition at line 224 of file node.cpp.
References libtorrent::dht::rpc_manager::incoming(), m_rpc, and refresh().
Referenced by libtorrent::dht::dht_tracker::on_receive().
| void libtorrent::dht::node_impl::refresh | ( | ) |
Definition at line 165 of file node.cpp.
References libtorrent::dht::routing_table::begin(), asio::detail::socket_ops::bind(), libtorrent::dht::routing_table::bucket_size(), libtorrent::dht::routing_table::end(), libtorrent::dht::refresh::initiate(), m_id, m_rpc, m_settings, m_table, libtorrent::dht::nop(), libtorrent::dht_settings::search_branching, and libtorrent::dht::routing_table::size().
Referenced by incoming().
| void libtorrent::dht::node_impl::refresh_bucket | ( | int | bucket | ) |
Definition at line 186 of file node.cpp.
References libtorrent::dht::routing_table::begin(), asio::detail::socket_ops::bind(), libtorrent::dht::routing_table::bucket_size(), libtorrent::dht::distance_exp(), libtorrent::dht::routing_table::find_node(), libtorrent::dht::generate_id(), libtorrent::dht::refresh::initiate(), m_id, m_rpc, m_settings, m_table, mask, libtorrent::dht::nop(), libtorrent::dht_settings::search_branching, and libtorrent::dht::routing_table::touch_bucket().
Referenced by refresh_timeout().
| int libtorrent::dht::node_impl::bucket_size | ( | int | bucket | ) |
Definition at line 175 of file node.cpp.
References libtorrent::dht::routing_table::bucket_size(), and m_table.
| iterator libtorrent::dht::node_impl::begin | ( | ) | const [inline] |
Definition at line 112 of file node.hpp.
References libtorrent::dht::routing_table::begin(), and m_table.
Referenced by libtorrent::dht::dht_tracker::state().
| iterator libtorrent::dht::node_impl::end | ( | ) | const [inline] |
Definition at line 113 of file node.hpp.
References libtorrent::dht::routing_table::end(), and m_table.
Referenced by libtorrent::dht::announce_fun(), connection_timeout(), incoming_request(), on_find(), and libtorrent::dht::dht_tracker::state().
| node_id const& libtorrent::dht::node_impl::nid | ( | ) | const [inline] |
Definition at line 117 of file node.hpp.
References m_id.
Referenced by libtorrent::dht::dht_tracker::state().
| boost::tuple<int, int> libtorrent::dht::node_impl::size | ( | ) | const [inline] |
Definition at line 118 of file node.hpp.
References m_table, and libtorrent::dht::routing_table::size().
Referenced by libtorrent::dht::dht_tracker::dht_status(), and libtorrent::dht::dht_tracker::tick().
| data_iterator libtorrent::dht::node_impl::begin_data | ( | ) | [inline] |
Definition at line 120 of file node.hpp.
References m_map.
Referenced by connection_timeout(), and libtorrent::dht::dht_tracker::tick().
| data_iterator libtorrent::dht::node_impl::end_data | ( | ) | [inline] |
Definition at line 121 of file node.hpp.
References m_map.
Referenced by connection_timeout(), and libtorrent::dht::dht_tracker::tick().
| int libtorrent::dht::node_impl::data_size | ( | ) | const [inline] |
Definition at line 122 of file node.hpp.
References m_map.
Referenced by libtorrent::dht::dht_tracker::dht_status().
| void libtorrent::dht::node_impl::print_state | ( | std::ostream & | os | ) | const [inline] |
Definition at line 124 of file node.hpp.
References m_table, and libtorrent::dht::routing_table::print_state().
Referenced by libtorrent::dht::dht_tracker::tick().
| void libtorrent::dht::node_impl::announce | ( | sha1_hash const & | info_hash, | |
| int | listen_port, | |||
| boost::function< void(std::vector< tcp::endpoint > const &, sha1_hash const &)> | f | |||
| ) |
Definition at line 338 of file node.cpp.
References libtorrent::dht::announce_fun(), asio::detail::socket_ops::bind(), libtorrent::dht::routing_table::bucket_size(), libtorrent::dht::closest_nodes::initiate(), m_rpc, m_settings, m_table, and libtorrent::dht_settings::search_branching.
Referenced by libtorrent::dht::dht_tracker::announce().
Definition at line 102 of file node.cpp.
References libtorrent::dht::msg::addr, asio::ip::basic_endpoint< InternetProtocol >::address(), libtorrent::hasher::final(), simple_client::h, h2, libtorrent::dht::msg::info_hash, m_secret, libtorrent::big_number::size, libtorrent::entry::string(), libtorrent::entry::string_t, asio::ip::address::to_string(), libtorrent::entry::type(), libtorrent::hasher::update(), and libtorrent::dht::msg::write_token.
Referenced by on_announce(), and libtorrent::dht::dht_tracker::on_receive().
Definition at line 128 of file node.cpp.
References libtorrent::dht::msg::addr, asio::ip::basic_endpoint< InternetProtocol >::address(), libtorrent::big_number::begin(), libtorrent::hasher::final(), simple_client::h, libtorrent::dht::msg::info_hash, m_secret, libtorrent::big_number::size, asio::ip::address::to_string(), and libtorrent::hasher::update().
Referenced by incoming_request().
| time_duration libtorrent::dht::node_impl::connection_timeout | ( | ) |
Definition at line 382 of file node.cpp.
References begin_data(), end(), end_data(), asio::placeholders::iterator, m_last_tracker_tick, m_map, m_rpc, libtorrent::dht::torrent_entry::peers, libtorrent::dht::purge_peers(), and libtorrent::dht::rpc_manager::tick().
Referenced by libtorrent::dht::dht_tracker::connection_timeout().
| time_duration libtorrent::dht::node_impl::refresh_timeout | ( | ) |
Definition at line 349 of file node.cpp.
References m_table, libtorrent::dht::routing_table::next_refresh(), refresh_bucket(), and TORRENT_LOG.
Referenced by libtorrent::dht::dht_tracker::refresh_timeout().
| void libtorrent::dht::node_impl::new_write_key | ( | ) |
Definition at line 180 of file node.cpp.
References m_secret.
Referenced by libtorrent::dht::dht_tracker::tick().
| void libtorrent::dht::node_impl::add_node | ( | udp::endpoint | node | ) |
Definition at line 330 of file node.cpp.
References libtorrent::dht::rpc_manager::invoke(), m_rpc, and libtorrent::dht::messages::ping.
Referenced by libtorrent::dht::dht_tracker::add_node().
| void libtorrent::dht::node_impl::replacement_cache | ( | bucket_t & | nodes | ) | const [inline] |
Definition at line 147 of file node.hpp.
References m_table, and libtorrent::dht::routing_table::replacement_cache().
Referenced by libtorrent::dht::dht_tracker::state().
| bool libtorrent::dht::node_impl::on_find | ( | msg const & | m, | |
| std::vector< tcp::endpoint > & | peers | |||
| ) | const [protected] |
Definition at line 444 of file node.cpp.
References end(), libtorrent::dht::get_endpoint(), libtorrent::dht::msg::info_hash, asio::placeholders::iterator, m_map, m_settings, libtorrent::dht_settings::max_peers_reply, libtorrent::dht::torrent_entry::peers, libtorrent::random_sample_n(), and TORRENT_LOG.
Referenced by incoming_request().
Definition at line 412 of file node.cpp.
References libtorrent::dht::peer_entry::added, libtorrent::dht::peer_entry::addr, libtorrent::dht::msg::addr, asio::ip::basic_endpoint< InternetProtocol >::address(), simple_client::e, libtorrent::dht::messages::error, libtorrent::dht::msg::error_code, libtorrent::dht::msg::error_msg, libtorrent::dht::msg::id, libtorrent::dht::msg::info_hash, asio::placeholders::iterator, m_map, m_table, libtorrent::dht::msg::message_id, libtorrent::dht::routing_table::node_seen(), libtorrent::dht::torrent_entry::peers, asio::ip::basic_endpoint< InternetProtocol >::port(), and verify_token().
Referenced by incoming_request().
| void libtorrent::dht::node_impl::incoming_request | ( | msg const & | h | ) | [private] |
Definition at line 468 of file node.cpp.
References libtorrent::dht::messages::announce_peer, end(), libtorrent::dht::messages::find_node, libtorrent::dht::routing_table::find_node(), generate_token(), libtorrent::dht::messages::get_peers, libtorrent::dht::msg::id, libtorrent::dht::msg::info_hash, asio::placeholders::iterator, m_rpc, m_table, libtorrent::dht::msg::message_id, libtorrent::dht::routing_table::need_node(), libtorrent::dht::msg::nodes, on_announce(), on_find(), libtorrent::dht::msg::peers, libtorrent::dht::messages::ping, libtorrent::dht::rpc_manager::reply(), libtorrent::dht::rpc_manager::reply_with_ping(), TORRENT_LOG, and libtorrent::dht::msg::write_token.
dht_settings const& libtorrent::dht::node_impl::m_settings [protected] |
Definition at line 160 of file node.hpp.
Referenced by announce(), bootstrap(), on_find(), refresh(), and refresh_bucket().
int libtorrent::dht::node_impl::m_max_peers_reply [protected] |
node_id libtorrent::dht::node_impl::m_id [private] |
Definition at line 170 of file node.hpp.
Referenced by bootstrap(), nid(), refresh(), and refresh_bucket().
Definition at line 171 of file node.hpp.
Referenced by add_router_node(), announce(), begin(), bootstrap(), bucket_size(), end(), incoming_request(), on_announce(), print_state(), refresh(), refresh_bucket(), refresh_timeout(), replacement_cache(), and size().
rpc_manager libtorrent::dht::node_impl::m_rpc [private] |
Definition at line 172 of file node.hpp.
Referenced by add_node(), announce(), bootstrap(), connection_timeout(), incoming(), incoming_request(), refresh(), and refresh_bucket().
table_t libtorrent::dht::node_impl::m_map [private] |
Definition at line 173 of file node.hpp.
Referenced by begin_data(), connection_timeout(), data_size(), end_data(), on_announce(), and on_find().
boost::posix_time::ptime libtorrent::dht::node_impl::m_last_tracker_tick [private] |
int libtorrent::dht::node_impl::m_secret[2] [private] |
Definition at line 178 of file node.hpp.
Referenced by generate_token(), new_write_key(), node_impl(), and verify_token().
1.5.6