#include <torrent_info.hpp>
Public Types | |
| typedef std::vector < file_entry >::const_iterator | file_iterator |
| typedef std::vector < file_entry > ::const_reverse_iterator | reverse_file_iterator |
| typedef std::vector< std::pair < std::string, int > > | nodes_t |
Public Member Functions | |
| torrent_info () | |
| torrent_info (sha1_hash const &info_hash) | |
| torrent_info (entry const &torrent_file) | |
| ~torrent_info () | |
| entry | create_torrent () const |
| entry | create_info_metadata () const |
| void | set_comment (char const *str) |
| void | set_creator (char const *str) |
| void | set_piece_size (int size) |
| void | set_hash (int index, sha1_hash const &h) |
| void | add_tracker (std::string const &url, int tier=0) |
| void | add_file (boost::filesystem::path file, size_type size) |
| void | add_url_seed (std::string const &url) |
| std::vector< file_slice > | map_block (int piece, size_type offset, int size) const |
| peer_request | map_file (int file, size_type offset, int size) const |
| std::vector< std::string > const & | url_seeds () const |
| file_iterator | begin_files () const |
| file_iterator | end_files () const |
| reverse_file_iterator | rbegin_files () const |
| reverse_file_iterator | rend_files () const |
| int | num_files () const |
| const file_entry & | file_at (int index) const |
| const std::vector < announce_entry > & | trackers () const |
| size_type | total_size () const |
| size_type | piece_length () const |
| int | num_pieces () const |
| const sha1_hash & | info_hash () const |
| const std::string & | name () const |
| void | print (std::ostream &os) const |
| bool | is_valid () const |
| bool | priv () const |
| void | set_priv (bool v) |
| void | convert_file_names () |
| size_type | piece_size (int index) const |
| const sha1_hash & | hash_for_piece (int index) const |
| boost::optional < boost::posix_time::ptime > | creation_date () const |
| const std::string & | creator () const |
| const std::string & | comment () const |
| nodes_t const & | nodes () const |
| void | add_node (std::pair< std::string, int > const &node) |
| void | parse_info_section (entry const &e) |
Private Member Functions | |
| void | read_torrent_info (const entry &libtorrent) |
Private Attributes | |
| std::vector< announce_entry > | m_urls |
| std::vector< std::string > | m_url_seeds |
| size_type | m_piece_length |
| std::vector< sha1_hash > | m_piece_hash |
| std::vector< file_entry > | m_files |
| nodes_t | m_nodes |
| size_type | m_total_size |
| sha1_hash | m_info_hash |
| std::string | m_name |
| boost::posix_time::ptime | m_creation_date |
| std::string | m_comment |
| std::string | m_created_by |
| bool | m_multifile |
| bool | m_private |
| entry | m_extra_info |
Definition at line 95 of file torrent_info.hpp.
| typedef std::vector<file_entry>::const_iterator libtorrent::torrent_info::file_iterator |
Definition at line 119 of file torrent_info.hpp.
| typedef std::vector<file_entry>::const_reverse_iterator libtorrent::torrent_info::reverse_file_iterator |
Definition at line 120 of file torrent_info.hpp.
| typedef std::vector<std::pair<std::string, int> > libtorrent::torrent_info::nodes_t |
Definition at line 167 of file torrent_info.hpp.
| libtorrent::torrent_info::torrent_info | ( | ) |
Definition at line 226 of file torrent_info.cpp.
| libtorrent::torrent_info::torrent_info | ( | sha1_hash const & | info_hash | ) |
Definition at line 214 of file torrent_info.cpp.
| libtorrent::torrent_info::torrent_info | ( | entry const & | torrent_file | ) |
| libtorrent::torrent_info::~torrent_info | ( | ) |
Definition at line 238 of file torrent_info.cpp.
| entry libtorrent::torrent_info::create_torrent | ( | ) | const |
Definition at line 609 of file torrent_info.cpp.
References libtorrent::bencode(), create_info_metadata(), libtorrent::entry::list(), libtorrent::entry::list_t, m_comment, m_created_by, m_creation_date, m_files, m_info_hash, m_nodes, m_piece_length, m_private, m_url_seeds, m_urls, nodes(), and trackers().
Referenced by vmsBtFileImpl::get_TorrentBuffer(), main(), run_storage_tests(), and setup_transfer().
| entry libtorrent::torrent_info::create_info_metadata | ( | ) | const |
Definition at line 550 of file torrent_info.cpp.
References simple_client::info, asio::placeholders::iterator, libtorrent::entry::list(), m_extra_info, m_files, m_multifile, m_name, m_piece_hash, piece_length(), pieces(), and libtorrent::entry::string().
Referenced by create_torrent(), and parse_info_section().
| void libtorrent::torrent_info::set_comment | ( | char const * | str | ) |
| void libtorrent::torrent_info::set_creator | ( | char const * | str | ) |
| void libtorrent::torrent_info::set_piece_size | ( | int | size | ) |
Definition at line 241 of file torrent_info.cpp.
References m_piece_hash, m_piece_length, m_total_size, and num_pieces().
Referenced by main(), setup_transfer(), and test_main().
| void libtorrent::torrent_info::set_hash | ( | int | index, | |
| sha1_hash const & | h | |||
| ) |
Definition at line 702 of file torrent_info.cpp.
References m_piece_hash.
Referenced by main(), run_storage_tests(), and setup_transfer().
| void libtorrent::torrent_info::add_tracker | ( | std::string const & | url, | |
| int | tier = 0 | |||
| ) |
Definition at line 478 of file torrent_info.cpp.
References asio::detail::socket_ops::bind(), simple_client::e, m_urls, and libtorrent::announce_entry::tier.
Referenced by main(), setup_transfer(), and libtorrent::torrent::torrent().
| void libtorrent::torrent_info::add_file | ( | boost::filesystem::path | file, | |
| size_type | size | |||
| ) |
Definition at line 489 of file torrent_info.cpp.
References asio::detail::socket_ops::bind(), libtorrent::big_number::clear(), simple_client::e, m_files, m_multifile, m_name, m_piece_hash, m_piece_length, m_total_size, num_pieces(), libtorrent::file_entry::offset, libtorrent::file_entry::path, and libtorrent::file_entry::size.
Referenced by add_files(), setup_transfer(), and test_main().
| void libtorrent::torrent_info::add_url_seed | ( | std::string const & | url | ) |
| std::vector< file_slice > libtorrent::torrent_info::map_block | ( | int | piece, | |
| size_type | offset, | |||
| int | size | |||
| ) | const |
Definition at line 754 of file torrent_info.cpp.
References begin_files(), end_files(), libtorrent::file_slice::file_index, m_piece_length, m_total_size, num_files(), libtorrent::file_slice::offset, and libtorrent::file_slice::size.
Referenced by libtorrent::web_peer_connection::write_request().
| peer_request libtorrent::torrent_info::map_file | ( | int | file, | |
| size_type | offset, | |||
| int | size | |||
| ) | const |
Definition at line 791 of file torrent_info.cpp.
References libtorrent::peer_request::length, m_files, libtorrent::peer_request::piece, piece_length(), and libtorrent::peer_request::start.
Referenced by libtorrent::torrent::file_progress(), and libtorrent::web_peer_connection::on_receive().
| std::vector<std::string> const& libtorrent::torrent_info::url_seeds | ( | ) | const [inline] |
Definition at line 117 of file torrent_info.hpp.
Referenced by libtorrent::torrent::init(), and read_torrent_info().
| file_iterator libtorrent::torrent_info::begin_files | ( | ) | const [inline] |
Definition at line 123 of file torrent_info.hpp.
Referenced by libtorrent::aux::session_impl::add_torrent(), libtorrent::piece_manager::impl::check_files(), libtorrent::get_filesizes(), map_block(), libtorrent::match_filesizes(), libtorrent::aux::piece_checker_data::parse_resume_data(), and print().
| file_iterator libtorrent::torrent_info::end_files | ( | ) | const [inline] |
Definition at line 124 of file torrent_info.hpp.
Referenced by libtorrent::aux::session_impl::add_torrent(), libtorrent::piece_manager::impl::check_files(), libtorrent::get_filesizes(), map_block(), libtorrent::match_filesizes(), libtorrent::aux::piece_checker_data::parse_resume_data(), and print().
| reverse_file_iterator libtorrent::torrent_info::rbegin_files | ( | ) | const [inline] |
Definition at line 125 of file torrent_info.hpp.
| reverse_file_iterator libtorrent::torrent_info::rend_files | ( | ) | const [inline] |
Definition at line 126 of file torrent_info.hpp.
| int libtorrent::torrent_info::num_files | ( | ) | const [inline] |
Definition at line 128 of file torrent_info.hpp.
Referenced by libtorrent::torrent_handle::file_progress(), file_progress(), libtorrent::torrent::file_progress(), libtorrent::torrent::filter_files(), vmsBtFileImpl::get_FileCount(), libtorrent::torrent::init(), map_block(), libtorrent::match_filesizes(), and libtorrent::aux::piece_checker_data::parse_resume_data().
| const file_entry& libtorrent::torrent_info::file_at | ( | int | index | ) | const [inline] |
Definition at line 130 of file torrent_info.hpp.
Referenced by libtorrent::torrent::file_progress(), libtorrent::torrent::filter_files(), vmsBtFileImpl::get_FileName(), vmsBtFileImpl::get_FileSize(), libtorrent::web_peer_connection::on_receive(), and libtorrent::web_peer_connection::write_request().
| const std::vector<announce_entry>& libtorrent::torrent_info::trackers | ( | ) | const [inline] |
Definition at line 133 of file torrent_info.hpp.
Referenced by begin_trackers(), create_torrent(), end_trackers(), vmsBtDownloadImpl::get_CurrentTracker(), vmsBtFileImpl::get_TrackerCount(), vmsBtFileImpl::get_TrackerUrl(), vmsBtDownloadImpl::OnTrackerAlert(), print(), libtorrent::aux::session_impl::remove_torrent(), and libtorrent::torrent::should_request().
| size_type libtorrent::torrent_info::total_size | ( | ) | const [inline] |
Definition at line 135 of file torrent_info.hpp.
Referenced by libtorrent::torrent::bytes_done(), libtorrent::torrent::bytes_left(), libtorrent::torrent::check_invariant(), vmsBtFileImpl::get_TotalFilesSize(), libtorrent::torrent::init(), piece_size(), libtorrent::torrent::quantized_bytes_done(), and libtorrent::torrent::status().
| size_type libtorrent::torrent_info::piece_length | ( | ) | const [inline] |
Definition at line 136 of file torrent_info.hpp.
Referenced by libtorrent::piece_manager::impl::allocate_slots(), libtorrent::torrent::bytes_done(), calculate_block_size(), libtorrent::piece_manager::impl::check_fastresume(), libtorrent::piece_manager::impl::check_files(), libtorrent::torrent::check_invariant(), create_info_metadata(), libtorrent::torrent::filter_files(), libtorrent::piece_manager::impl::identify_data(), libtorrent::torrent::init(), map_file(), libtorrent::web_peer_connection::on_receive(), libtorrent::aux::piece_checker_data::parse_resume_data(), piece_size(), print(), libtorrent::torrent::quantized_bytes_done(), libtorrent::request_a_block(), libtorrent::torrent::status(), and libtorrent::web_peer_connection::write_request().
| int libtorrent::torrent_info::num_pieces | ( | ) | const [inline] |
Definition at line 137 of file torrent_info.hpp.
Referenced by add_file(), libtorrent::piece_manager::impl::allocate_slot_for_piece(), libtorrent::torrent::announce_piece(), libtorrent::torrent::bytes_done(), libtorrent::piece_manager::impl::check_fastresume(), libtorrent::piece_manager::impl::check_files(), libtorrent::piece_manager::impl::check_invariant(), libtorrent::piece_picker::check_invariant(), libtorrent::torrent::check_invariant(), libtorrent::torrent::filter_files(), libtorrent::torrent::filter_piece(), libtorrent::torrent::filtered_pieces(), vmsBtFileImpl::get_PieceCount(), libtorrent::piece_manager::impl::identify_data(), libtorrent::torrent::init(), libtorrent::torrent::is_piece_filtered(), main(), parse_info_section(), libtorrent::aux::piece_checker_data::parse_resume_data(), libtorrent::piece_manager::impl::piece_crc(), libtorrent::torrent::piece_failed(), piece_size(), print(), libtorrent::torrent::quantized_bytes_done(), run_storage_tests(), set_piece_size(), setup_transfer(), libtorrent::piece_manager::impl::slot_for_piece(), libtorrent::torrent::status(), and libtorrent::torrent::verify_piece().
| const sha1_hash& libtorrent::torrent_info::info_hash | ( | ) | const [inline] |
Definition at line 138 of file torrent_info.hpp.
References m_info_hash.
Referenced by libtorrent::aux::session_impl::add_torrent(), libtorrent::torrent::generate_tracker_request(), libtorrent::torrent::get_handle(), vmsBtFileImpl::get_InfoHash(), libtorrent::torrent::on_dht_announce(), libtorrent::aux::piece_checker_data::parse_resume_data(), libtorrent::aux::session_impl::remove_torrent(), libtorrent::torrent::set_metadata(), setup_transfer(), and libtorrent::torrent::torrent().
| const std::string& libtorrent::torrent_info::name | ( | ) | const [inline] |
Definition at line 139 of file torrent_info.hpp.
Referenced by vmsBtFileImpl::get_TorrentName(), and libtorrent::torrent::name().
| void libtorrent::torrent_info::print | ( | std::ostream & | os | ) | const |
Definition at line 714 of file torrent_info.cpp.
References begin_files(), end_files(), m_comment, m_creation_date, m_private, num_pieces(), piece_length(), and trackers().
| bool libtorrent::torrent_info::is_valid | ( | ) | const [inline] |
Definition at line 141 of file torrent_info.hpp.
Referenced by libtorrent::torrent::check_invariant(), libtorrent::torrent::init(), and libtorrent::torrent::should_announce_dht().
| bool libtorrent::torrent_info::priv | ( | ) | const [inline] |
Definition at line 143 of file torrent_info.hpp.
Referenced by libtorrent::create_ut_pex_plugin(), parse_info_section(), and libtorrent::torrent::should_announce_dht().
| void libtorrent::torrent_info::set_priv | ( | bool | v | ) | [inline] |
Definition at line 144 of file torrent_info.hpp.
| void libtorrent::torrent_info::convert_file_names | ( | ) |
Definition at line 709 of file torrent_info.cpp.
| size_type libtorrent::torrent_info::piece_size | ( | int | index | ) | const |
Definition at line 734 of file torrent_info.cpp.
References num_pieces(), piece_length(), and total_size().
Referenced by libtorrent::piece_manager::impl::allocate_slot_for_piece(), libtorrent::piece_manager::impl::allocate_slots(), libtorrent::torrent::bytes_done(), libtorrent::piece_manager::impl::check_files(), libtorrent::torrent::file_progress(), vmsBtFileImpl::get_PieceSize(), libtorrent::piece_manager::impl::identify_data(), main(), libtorrent::piece_manager::impl::piece_crc(), libtorrent::torrent::piece_failed(), libtorrent::torrent::quantized_bytes_done(), libtorrent::torrent::status(), and libtorrent::torrent::verify_piece().
| const sha1_hash& libtorrent::torrent_info::hash_for_piece | ( | int | index | ) | const [inline] |
Definition at line 150 of file torrent_info.hpp.
Referenced by libtorrent::piece_manager::impl::check_files(), and libtorrent::torrent::verify_piece().
| boost::optional< ptime > libtorrent::torrent_info::creation_date | ( | ) | const |
| const std::string& libtorrent::torrent_info::creator | ( | ) | const [inline] |
Definition at line 160 of file torrent_info.hpp.
| const std::string& libtorrent::torrent_info::comment | ( | ) | const [inline] |
| nodes_t const& libtorrent::torrent_info::nodes | ( | ) | const [inline] |
Definition at line 169 of file torrent_info.hpp.
Referenced by libtorrent::aux::session_impl::add_torrent(), create_torrent(), and nodes().
| void libtorrent::torrent_info::add_node | ( | std::pair< std::string, int > const & | node | ) |
| void libtorrent::torrent_info::parse_info_section | ( | entry const & | e | ) |
Definition at line 267 of file torrent_info.cpp.
References libtorrent::bencode(), create_info_metadata(), libtorrent::entry::dict(), simple_client::e, extract_files(), libtorrent::hasher::final(), libtorrent::entry::find_key(), simple_client::h, libtorrent::entry::int_t, libtorrent::entry::integer(), asio::placeholders::iterator, libtorrent::entry::list(), m_extra_info, m_files, m_info_hash, m_multifile, m_name, m_piece_hash, m_piece_length, m_private, m_total_size, num_pieces(), libtorrent::file_entry::offset, libtorrent::file_entry::path, priv(), libtorrent::file_entry::size, libtorrent::entry::string(), and libtorrent::hasher::update().
Referenced by read_torrent_info(), and libtorrent::torrent::set_metadata().
| void libtorrent::torrent_info::read_torrent_info | ( | const entry & | libtorrent | ) | [private] |
Definition at line 364 of file torrent_info.cpp.
References libtorrent::dht::distance(), simple_client::e, libtorrent::entry::find_key(), asio::placeholders::iterator, l, libtorrent::entry::list(), libtorrent::entry::list_t, m_comment, m_created_by, m_creation_date, m_nodes, m_url_seeds, m_urls, parse_info_section(), libtorrent::entry::string(), libtorrent::entry::string_t, libtorrent::entry::type(), and url_seeds().
Referenced by torrent_info().
std::vector<announce_entry> libtorrent::torrent_info::m_urls [private] |
Definition at line 181 of file torrent_info.hpp.
Referenced by add_tracker(), create_torrent(), and read_torrent_info().
std::vector<std::string> libtorrent::torrent_info::m_url_seeds [private] |
Definition at line 183 of file torrent_info.hpp.
Referenced by add_url_seed(), create_torrent(), and read_torrent_info().
Definition at line 188 of file torrent_info.hpp.
Referenced by add_file(), create_torrent(), map_block(), parse_info_section(), and set_piece_size().
std::vector<sha1_hash> libtorrent::torrent_info::m_piece_hash [private] |
Definition at line 191 of file torrent_info.hpp.
Referenced by add_file(), create_info_metadata(), parse_info_section(), set_hash(), and set_piece_size().
std::vector<file_entry> libtorrent::torrent_info::m_files [private] |
Definition at line 194 of file torrent_info.hpp.
Referenced by add_file(), create_info_metadata(), create_torrent(), map_file(), and parse_info_section().
nodes_t libtorrent::torrent_info::m_nodes [private] |
Definition at line 196 of file torrent_info.hpp.
Referenced by add_node(), create_torrent(), and read_torrent_info().
Definition at line 199 of file torrent_info.hpp.
Referenced by add_file(), map_block(), parse_info_section(), and set_piece_size().
sha1_hash libtorrent::torrent_info::m_info_hash [mutable, private] |
Definition at line 204 of file torrent_info.hpp.
Referenced by create_torrent(), and parse_info_section().
std::string libtorrent::torrent_info::m_name [private] |
Definition at line 206 of file torrent_info.hpp.
Referenced by add_file(), create_info_metadata(), and parse_info_section().
boost::posix_time::ptime libtorrent::torrent_info::m_creation_date [private] |
Definition at line 211 of file torrent_info.hpp.
Referenced by create_torrent(), creation_date(), print(), and read_torrent_info().
std::string libtorrent::torrent_info::m_comment [private] |
Definition at line 215 of file torrent_info.hpp.
Referenced by create_torrent(), print(), read_torrent_info(), and set_comment().
std::string libtorrent::torrent_info::m_created_by [private] |
Definition at line 219 of file torrent_info.hpp.
Referenced by create_torrent(), read_torrent_info(), and set_creator().
bool libtorrent::torrent_info::m_multifile [private] |
Definition at line 226 of file torrent_info.hpp.
Referenced by add_file(), create_info_metadata(), and parse_info_section().
bool libtorrent::torrent_info::m_private [private] |
Definition at line 230 of file torrent_info.hpp.
Referenced by create_torrent(), parse_info_section(), and print().
entry libtorrent::torrent_info::m_extra_info [private] |
Definition at line 236 of file torrent_info.hpp.
Referenced by create_info_metadata(), and parse_info_section().
1.5.6