replace the TORRENT_CFG ABI check with inline namespaces around the symbol that can change ABI based on build configuration options

This commit is contained in:
arvidn 2018-04-26 03:01:14 -04:00 committed by Arvid Norberg
parent 86f88dc90d
commit fe612ca167
160 changed files with 948 additions and 1150 deletions

View File

@ -31,7 +31,6 @@ set(libtorrent_include_files
broadcast_socket
bt_peer_connection
buffer
build_config
chained_buffer
choker
close_reason

View File

@ -662,6 +662,7 @@ SOURCES =
peer_connection_handle
i2p_stream
instantiate_connection
lazy_bdecode
natpmp
packet_buffer
piece_picker
@ -815,7 +816,6 @@ lib torrent
<dht>on:<source>src/kademlia/$(KADEMLIA_SOURCES).cpp
<dht>on:<source>ed25519/src/$(ED25519_SOURCES).cpp
<dht>on:<source>src/hasher512.cpp
<deprecated-functions>on:<source>src/lazy_bdecode.cpp
<conditional>@building
<conditional>@warnings

View File

@ -12,7 +12,7 @@ BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
# this is used to make bjam use the same version of python which is executing setup.py
LIBTORRENT_PYTHON_INTERPRETER = [ modules.peek : LIBTORRENT_PYTHON_INTERPRETER ] ;
feature visibility : default hidden : composite ;
feature visibility : default hidden : composite propagated ;
feature.compose <visibility>hidden : <cflags>-fvisibility=hidden <cxxflags>-fvisibility-inlines-hidden ;
feature libtorrent-link : shared static : composite propagated ;

View File

@ -228,7 +228,7 @@ namespace boost
POLY(session_stats_alert)
POLY(dht_get_peers_reply_alert)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
POLY(torrent_added_alert)
POLY(torrent_update_alert)
#endif
@ -257,13 +257,13 @@ void bind_alert()
.def("message", &alert::message)
.def("what", &alert::what)
.def("category", &alert::category)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("severity", &alert::severity)
#endif
.def("__str__", &alert::message)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum_<alert::severity_t>("severity_levels")
.value("debug", alert::debug)
.value("info", alert::info)
@ -282,7 +282,7 @@ void bind_alert()
s.attr("tracker_notification") = alert::tracker_notification;
s.attr("debug_notification") = alert::debug_notification;
s.attr("status_notification") = alert::status_notification;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
s.attr("progress_notification") = alert::progress_notification;
#endif
s.attr("ip_block_notification") = alert::ip_block_notification;
@ -356,14 +356,14 @@ void bind_alert()
class_<tracker_alert, bases<torrent_alert>, noncopyable>(
"tracker_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("url", &tracker_alert::url)
#endif
.add_property("local_endpoint", make_getter(&tracker_alert::local_endpoint, by_value()))
.def("tracker_url", &tracker_alert::tracker_url)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
class_<torrent_added_alert, bases<torrent_alert>, noncopyable>(
"torrent_added_alert", no_init)
;
@ -377,7 +377,7 @@ void bind_alert()
class_<read_piece_alert, bases<torrent_alert>, noncopyable>(
"read_piece_alert", nullptr, no_init)
.def_readonly("error", &read_piece_alert::error)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("ec", &read_piece_alert::ec)
#endif
.add_property("buffer", get_buffer)
@ -387,7 +387,7 @@ void bind_alert()
class_<peer_alert, bases<torrent_alert>, noncopyable>(
"peer_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("ip", make_getter(&peer_alert::ip, by_value()))
#endif
.add_property("endpoint", make_getter(&peer_alert::endpoint, by_value()))
@ -395,7 +395,7 @@ void bind_alert()
;
class_<tracker_error_alert, bases<tracker_alert>, noncopyable>(
"tracker_error_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("msg", &tracker_error_alert::msg)
.def_readonly("status_code", &tracker_error_alert::status_code)
#endif
@ -464,7 +464,7 @@ void bind_alert()
class_<block_downloading_alert, bases<peer_alert>, noncopyable>(
"block_downloading_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("peer_speedmsg", &block_downloading_alert::peer_speedmsg)
#endif
.add_property("block_index", make_getter(&block_downloading_alert::block_index, by_value()))
@ -473,7 +473,7 @@ void bind_alert()
class_<storage_moved_alert, bases<torrent_alert>, noncopyable>(
"storage_moved_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("path", &storage_moved_alert::path)
#endif
.def("storage_path", &storage_moved_alert::storage_path)
@ -484,7 +484,7 @@ void bind_alert()
.def_readonly("error", &storage_moved_failed_alert::error)
.def("file_path", &storage_moved_failed_alert::file_path)
.def_readonly("op", &storage_moved_failed_alert::op)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("operation", &storage_moved_failed_alert::operation)
#endif
;
@ -502,7 +502,7 @@ void bind_alert()
class_<url_seed_alert, bases<torrent_alert>, noncopyable>(
"url_seed_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("url", &url_seed_alert::url)
.def_readonly("msg", &url_seed_alert::msg)
#endif
@ -515,7 +515,7 @@ void bind_alert()
"file_error_alert", no_init)
.def_readonly("error", &file_error_alert::error)
.def("filename", &file_error_alert::filename)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("file", &file_error_alert::file)
.def_readonly("msg", &file_error_alert::msg)
#endif
@ -531,7 +531,7 @@ void bind_alert()
class_<listen_failed_alert, bases<alert>, noncopyable>(
"listen_failed_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("endpoint", make_getter(&listen_failed_alert::endpoint, by_value()))
#endif
.add_property("address", make_getter(&listen_failed_alert::address, by_value()))
@ -539,7 +539,7 @@ void bind_alert()
.def("listen_interface", &listen_failed_alert::listen_interface)
.def_readonly("error", &listen_failed_alert::error)
.def_readonly("op", &listen_failed_alert::op)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("operation", &listen_failed_alert::operation)
.def_readonly("sock_type", &listen_failed_alert::sock_type)
#endif
@ -548,18 +548,18 @@ void bind_alert()
class_<listen_succeeded_alert, bases<alert>, noncopyable>(
"listen_succeeded_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("endpoint", make_getter(&listen_succeeded_alert::endpoint, by_value()))
#endif
.add_property("address", make_getter(&listen_succeeded_alert::address, by_value()))
.def_readonly("port", &listen_succeeded_alert::port)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("sock_type", &listen_succeeded_alert::sock_type)
#endif
.def_readonly("socket_type", &listen_succeeded_alert::socket_type)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum_<listen_succeeded_alert::socket_type_t>("listen_succeded_alert_socket_type_t")
.value("tcp", listen_succeeded_alert::socket_type_t::tcp)
.value("tcp_ssl", listen_succeeded_alert::socket_type_t::tcp_ssl)
@ -593,7 +593,7 @@ void bind_alert()
.add_property("mapping", make_getter(&portmap_error_alert::mapping, by_value()))
.def_readonly("error", &portmap_error_alert::error)
.def_readonly("map_transport", &portmap_error_alert::map_transport)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("map_type", &portmap_error_alert::map_type)
.def_readonly("type", &portmap_error_alert::map_type)
.def_readonly("msg", &portmap_error_alert::msg)
@ -605,7 +605,7 @@ void bind_alert()
.def_readonly("external_port", &portmap_alert::external_port)
.def_readonly("map_protocol", &portmap_alert::map_protocol)
.def_readonly("map_transport", &portmap_alert::map_transport)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("type", &portmap_alert::map_type)
.def_readonly("map_type", &portmap_alert::map_type)
#endif
@ -615,7 +615,7 @@ void bind_alert()
class_<portmap_log_alert, bases<alert>, noncopyable>("portmap_log_alert", no_init)
.def_readonly("map_transport", &portmap_log_alert::map_transport)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("type", &portmap_log_alert::map_type)
.def_readonly("msg", &portmap_log_alert::msg)
.def_readonly("map_type", &portmap_log_alert::map_type)
@ -629,7 +629,7 @@ void bind_alert()
.def_readonly("error", &fastresume_rejected_alert::error)
.def("file_path", &fastresume_rejected_alert::file_path)
.def_readonly("op", &fastresume_rejected_alert::op)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("operation", &fastresume_rejected_alert::operation)
.def_readonly("msg", &fastresume_rejected_alert::msg)
#endif
@ -637,7 +637,7 @@ void bind_alert()
class_<peer_blocked_alert, bases<peer_alert>, noncopyable>(
"peer_blocked_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("ip", make_getter(&peer_blocked_alert::ip, by_value()))
#endif
.add_property("reason", &peer_blocked_alert::reason)
@ -661,7 +661,7 @@ void bind_alert()
class_<scrape_failed_alert, bases<tracker_alert>, noncopyable>(
"scrape_failed_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("msg", &scrape_failed_alert::msg)
#endif
.def("error_message", &scrape_failed_alert::error_message)
@ -682,7 +682,7 @@ void bind_alert()
class_<save_resume_data_alert, bases<torrent_alert>, noncopyable>(
"save_resume_data_alert", no_init)
.def_readonly("params", &save_resume_data_alert::params)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("resume_data", make_function(get_resume_data_entry, by_value()))
#endif
;
@ -695,7 +695,7 @@ void bind_alert()
class_<file_renamed_alert, bases<torrent_alert>, noncopyable>(
"file_renamed_alert", no_init)
.add_property("index", make_getter(&file_renamed_alert::index, by_value()))
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("name", &file_renamed_alert::name)
#endif
.def("new_name", &file_renamed_alert::new_name)
@ -763,7 +763,7 @@ void bind_alert()
.def_readonly("op", &peer_disconnected_alert::op)
.def_readonly("error", &peer_disconnected_alert::error)
.def_readonly("reason", &peer_disconnected_alert::reason)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("msg", &peer_disconnected_alert::msg)
#endif
;
@ -788,7 +788,7 @@ void bind_alert()
class_<torrent_delete_failed_alert, bases<torrent_alert>, noncopyable>(
"torrent_delete_failed_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("msg", &torrent_delete_failed_alert::msg)
#endif
.def_readonly("error", &torrent_delete_failed_alert::error)
@ -797,7 +797,7 @@ void bind_alert()
class_<save_resume_data_failed_alert, bases<torrent_alert>, noncopyable>(
"save_resume_data_failed_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("msg", &save_resume_data_failed_alert::msg)
#endif
.def_readonly("error", &save_resume_data_failed_alert::error)
@ -830,14 +830,14 @@ void bind_alert()
.value("upload_payload", stats_alert::upload_payload)
.value("upload_protocol", stats_alert::upload_protocol)
.value("upload_ip_protocol", stats_alert::upload_ip_protocol)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("upload_dht_protocol", stats_alert::upload_dht_protocol)
.value("upload_tracker_protocol", stats_alert::upload_tracker_protocol)
#endif
.value("download_payload", stats_alert::download_payload)
.value("download_protocol", stats_alert::download_protocol)
.value("download_ip_protocol", stats_alert::download_ip_protocol)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("download_dht_protocol", stats_alert::download_dht_protocol)
.value("download_tracker_protocol", stats_alert::download_tracker_protocol)
#endif
@ -860,14 +860,14 @@ void bind_alert()
class_<incoming_connection_alert, bases<alert>, noncopyable>(
"incoming_connection_alert", no_init)
.def_readonly("socket_type", &incoming_connection_alert::socket_type)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("ip", make_getter(&incoming_connection_alert::ip, by_value()))
#endif
.add_property("endpoint", make_getter(&incoming_connection_alert::endpoint, by_value()))
;
class_<torrent_need_cert_alert, bases<torrent_alert>, noncopyable>(
"torrent_need_cert_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("error", &torrent_need_cert_alert::error)
#endif
;
@ -878,7 +878,7 @@ void bind_alert()
.add_property("params", &add_torrent_alert::params)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
class_<torrent_update_alert, bases<torrent_alert>, noncopyable>(
"torrent_update_alert", no_init)
.def_readonly("old_ih", &torrent_update_alert::old_ih)
@ -890,7 +890,7 @@ void bind_alert()
"dht_outgoing_get_peers_alert", no_init)
.def_readonly("info_hash", &dht_outgoing_get_peers_alert::info_hash)
.def_readonly("obfuscated_info_hash", &dht_outgoing_get_peers_alert::obfuscated_info_hash)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("ip", make_getter(&dht_outgoing_get_peers_alert::ip, by_value()))
#endif
.add_property("endpoint", make_getter(&dht_outgoing_get_peers_alert::endpoint, by_value()))
@ -898,7 +898,7 @@ void bind_alert()
class_<log_alert, bases<alert>, noncopyable>(
"log_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("msg", &log_alert::msg)
#endif
.def("log_message", &log_alert::log_message)
@ -906,7 +906,7 @@ void bind_alert()
class_<torrent_log_alert, bases<torrent_alert>, noncopyable>(
"torrent_log_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("msg", &torrent_log_alert::msg)
#endif
.def("log_message", &torrent_log_alert::log_message)
@ -914,7 +914,7 @@ void bind_alert()
class_<peer_log_alert, bases<peer_alert>, noncopyable>(
"peer_log_alert", no_init)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("msg", &peer_log_alert::msg)
#endif
.def("log_message", &peer_log_alert::log_message)

View File

@ -433,7 +433,7 @@ void bind_converters()
to_python_converter<lt::aux::noexcept_movable<std::map<lt::file_index_t, std::string>>, map_to_dict<lt::aux::noexcept_movable<std::map<lt::file_index_t, std::string>>>>();
to_python_converter<std::map<lt::file_index_t, std::string>, map_to_dict<std::map<lt::file_index_t, std::string>>>();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
to_python_converter<lt::aux::noexcept_movable<std::vector<char>>, vector_to_list<lt::aux::noexcept_movable<std::vector<char>>>>();
list_to_vector<lt::aux::noexcept_movable<std::vector<char>>>();
#endif

View File

@ -57,7 +57,7 @@ namespace
ct.add_node(std::make_pair(addr, port));
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void add_file_deprecated(file_storage& ct, file_entry const& fe)
{
ct.add_file(fe);
@ -106,7 +106,7 @@ namespace
{
fs.add_file(file, size, flags, md, link);
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
void add_files_callback(file_storage& fs, std::string const& file
, boost::python::object cb, create_flags_t const flags)
@ -133,7 +133,7 @@ void bind_create_torrent()
{
void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name;
void (file_storage::*rename_file0)(file_index_t, std::string const&) = &file_storage::rename_file;
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
void (file_storage::*rename_file1)(file_index_t, std::wstring const&) = &file_storage::rename_file;
#endif
@ -151,7 +151,7 @@ void bind_create_torrent()
std::int64_t (file_storage::*file_storage_file_offset)(file_index_t) const = &file_storage::file_offset;
file_flags_t (file_storage::*file_storage_file_flags)(file_index_t) const = &file_storage::file_flags;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
file_entry (file_storage::*at)(int) const = &file_storage::at;
#endif
@ -161,13 +161,13 @@ void bind_create_torrent()
.def("is_valid", &file_storage::is_valid)
.def("add_file", add_file, (arg("path"), arg("size"), arg("flags") = 0, arg("mtime") = 0, arg("linkpath") = ""))
.def("num_files", &file_storage::num_files)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("at", at)
.def("add_file", add_file_deprecated, arg("entry"))
.def("__iter__", boost::python::range(&begin_files, &end_files))
.def("__len__", &file_storage::num_files)
.def("add_file", add_file_wstring, (arg("path"), arg("size"), arg("flags") = 0, arg("mtime") = 0, arg("linkpath") = ""))
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
.def("hash", file_storage_hash)
.def("symlink", file_storage_symlink, return_value_policy<copy_const_reference>())
.def("file_path", file_storage_file_path, (arg("idx"), arg("save_path") = ""))
@ -184,7 +184,7 @@ void bind_create_torrent()
.def("piece_size", &file_storage::piece_size)
.def("set_name", set_name0)
.def("rename_file", rename_file0)
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("set_name", set_name1)
.def("rename_file", rename_file1)
#endif
@ -239,7 +239,7 @@ void bind_create_torrent()
{
scope s = class_<dummy14>("create_torrent_flags_t");
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
s.attr("optimize") = create_torrent::optimize;
#endif
s.attr("optimize_alignment") = create_torrent::optimize_alignment;

View File

@ -158,7 +158,7 @@ using return_existing = return_value_policy<reference_existing_object>;
def("i2p_category", &i2p_category, return_existing());
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
def("get_libtorrent_category", &libtorrent_category, return_existing());
def("get_upnp_category", &upnp_category, return_existing());
def("get_http_category", &http_category, return_existing());
@ -167,7 +167,7 @@ using return_existing = return_value_policy<reference_existing_object>;
#if TORRENT_USE_I2P
def("get_i2p_category", &i2p_category, return_existing());
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
def("generic_category", &boost::system::generic_category, return_existing());

View File

@ -12,7 +12,7 @@ void bind_fingerprint()
def("generate_fingerprint", &generate_fingerprint);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@ -47,5 +47,5 @@ void bind_fingerprint()
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
}

View File

@ -17,7 +17,7 @@ extern void dict_to_add_torrent_params(dict params, add_torrent_params& p);
namespace {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
torrent_handle _add_magnet_uri(lt::session& s, std::string uri, dict params)
{
add_torrent_params p;
@ -61,7 +61,7 @@ namespace {
ret["name"] = p.name;
ret["save_path"] = p.save_path;
ret["storage_mode"] = p.storage_mode;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
ret["url"] = p.url;
ret["uuid"] = p.uuid;
#endif
@ -83,7 +83,7 @@ namespace {
void bind_magnet_uri()
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
def("add_magnet_uri", &_add_magnet_uri);
#endif
def("make_magnet_uri", make_magnet_uri0);

View File

@ -64,7 +64,7 @@ void bind_peer_info()
.def_readonly("total_upload", &peer_info::total_upload)
.def_readonly("pid", &peer_info::pid)
.add_property("pieces", get_pieces)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("upload_limit", &peer_info::upload_limit)
.def_readonly("download_limit", &peer_info::download_limit)
.def_readonly("load_balancing", &peer_info::load_balancing)
@ -111,7 +111,7 @@ void bind_peer_info()
pi.attr("local_connection") = peer_info::local_connection;
pi.attr("handshake") = peer_info::handshake;
pi.attr("connecting") = peer_info::connecting;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
pi.attr("queued") = peer_info::queued;
#endif
pi.attr("on_parole") = peer_info::on_parole;
@ -139,7 +139,7 @@ void bind_peer_info()
// read/write state
pi.attr("bw_idle") = peer_info::bw_idle;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
pi.attr("bw_torrent") = peer_info::bw_torrent;
pi.attr("bw_global") = peer_info::bw_global;
#endif

View File

@ -52,7 +52,7 @@ using namespace lt;
namespace
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct dummy {};
void listen_on(lt::session& s, int min_, int max_, char const* interface, int flags)
@ -74,7 +74,7 @@ namespace
s.apply_settings(p);
return;
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
#ifndef TORRENT_DISABLE_DHT
void add_dht_node(lt::session& s, tuple n)
@ -85,7 +85,7 @@ namespace
s.add_dht_node(std::make_pair(ip, port));
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void add_dht_router(lt::session& s, std::string router_, int port_)
{
allow_threading_guard guard;
@ -211,7 +211,7 @@ namespace
}
#ifndef BOOST_NO_EXCEPTIONS
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
torrent_handle add_torrent_depr(lt::session& s, torrent_info const& ti
, std::string const& save, entry const& resume
, storage_mode_t storage_mode, bool paused)
@ -261,7 +261,7 @@ namespace
p.save_path = extract<std::string>(value);
continue;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
else if(key == "resume_data")
{
std::string resume = extract<std::string>(value);
@ -321,7 +321,7 @@ namespace
p.trackerid = extract<std::string>(value);
continue;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
else if(key == "url")
{
p.url = extract<std::string>(value);
@ -374,7 +374,7 @@ namespace
s.async_add_torrent(p);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void start_natpmp(lt::session& s)
{
allow_threading_guard guard;
@ -386,7 +386,7 @@ namespace
allow_threading_guard guard;
s.start_upnp();
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
alert const*
wait_for_alert(lt::session& s, int ms)
@ -444,7 +444,7 @@ namespace
return cached_piece_info_list(cs.pieces);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
cache_status get_cache_status(lt::session& s)
{
cache_status ret;
@ -646,7 +646,7 @@ namespace
} // anonymous namespace
struct dummy1 {};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct dummy2 {};
#endif
struct dummy9 {};
@ -660,7 +660,7 @@ void bind_session()
sha1_hash (lt::session::*dht_put_immutable_item)(entry data) = &lt::session::dht_put_item;
#endif // TORRENT_DISABLE_DHT
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifndef TORRENT_DISABLE_DHT
void (lt::session::*start_dht0)() = &lt::session::start_dht;
void (lt::session::*start_dht1)(entry const&) = &lt::session::start_dht;
@ -730,7 +730,7 @@ void bind_session()
.def_readonly("branch_factor", &dht_lookup::branch_factor)
;
#endif // TORRENT_DISABLE_DHT
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
#define PROP(val) \
make_getter(val, return_value_policy<return_by_value>()), \
@ -778,7 +778,7 @@ void bind_session()
.add_property("merkle_tree", PROP(&add_torrent_params::merkle_tree))
.add_property("renamed_files", PROP(&add_torrent_params::renamed_files))
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readwrite("url", &add_torrent_params::url)
.def_readwrite("uuid", &add_torrent_params::uuid)
.add_property("resume_data", PROP(&add_torrent_params::resume_data))
@ -818,7 +818,7 @@ void bind_session()
s.attr("override_web_seeds") = torrent_flags::override_web_seeds;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
{
scope s = class_<dummy2>("add_torrent_params_flags_t");
s.attr("flag_seed_mode") = add_torrent_params::flag_seed_mode;
@ -844,7 +844,7 @@ void bind_session()
class_<cache_status>("cache_status")
.add_property("pieces", cache_status_pieces)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("blocks_written", &cache_status::blocks_written)
.def_readonly("writes", &cache_status::writes)
.def_readonly("blocks_read", &cache_status::blocks_read)
@ -923,7 +923,7 @@ void bind_session()
, arg("flags")=lt::session::start_default_features
| lt::session::add_default_plugins))
)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def(
init<fingerprint, session_flags_t, alert_category_t>((
arg("fingerprint")=fingerprint("LT",0,1,0,0)
@ -939,12 +939,12 @@ void bind_session()
.def("listen_port", allow_threads(&lt::session::listen_port))
#ifndef TORRENT_DISABLE_DHT
.def("add_dht_node", &add_dht_node)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def(
"add_dht_router", &add_dht_router
, (arg("router"), "port")
)
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
.def("is_dht_running", allow_threads(&lt::session::is_dht_running))
.def("set_dht_settings", allow_threads(&lt::session::set_dht_settings))
.def("get_dht_settings", allow_threads(&lt::session::get_dht_settings))
@ -960,7 +960,7 @@ void bind_session()
.def("async_add_torrent", &lt::session::async_add_torrent)
.def("add_torrent", allow_threads((lt::torrent_handle (session_handle::*)(add_torrent_params const&))&lt::session::add_torrent))
#ifndef BOOST_NO_EXCEPTIONS
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def(
"add_torrent", &add_torrent_depr
, (
@ -969,15 +969,15 @@ void bind_session()
arg("paused") = false
)
)
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
#endif // BOOST_NO_EXCEPTIONS
.def("remove_torrent", allow_threads(&lt::session::remove_torrent), arg("option") = 0)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("status", allow_threads(&lt::session::status))
#endif
.def("get_settings", &session_get_settings)
.def("apply_settings", &session_apply_settings)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifndef TORRENT_DISABLE_ENCRYPTION
.def("set_pe_settings", allow_threads(&lt::session::set_pe_settings))
.def("get_pe_settings", allow_threads(&lt::session::get_pe_settings))
@ -988,7 +988,7 @@ void bind_session()
.def("pop_alerts", &pop_alerts)
.def("wait_for_alert", &wait_for_alert, return_internal_reference<>())
.def("add_extension", &add_extension)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#if TORRENT_USE_I2P
.def("set_i2p_proxy", allow_threads(&lt::session::set_i2p_proxy))
.def("i2p_proxy", allow_threads(&lt::session::i2p_proxy))
@ -1012,7 +1012,7 @@ void bind_session()
.def("get_peer_class", &get_peer_class)
.def("set_peer_class", &set_peer_class)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("id", allow_threads(&lt::session::id))
.def(
"listen_on", &listen_on
@ -1059,7 +1059,7 @@ void bind_session()
.def("get_cache_status", &get_cache_status)
.def("get_cache_info", &get_cache_info2)
.def("set_peer_id", allow_threads(&lt::session::set_peer_id))
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
;
s.attr("tcp") = lt::portmap_protocol::tcp;
@ -1072,7 +1072,7 @@ void bind_session()
s.attr("reopen_map_ports") = lt::session::reopen_map_ports;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
{
scope s = class_<dummy>("protocol_type");
s.attr("udp") = lt::portmap_protocol::udp;
@ -1085,7 +1085,7 @@ void bind_session()
s.attr("save_settings") = lt::session::save_settings;
s.attr("save_dht_settings") = lt::session::save_dht_settings;
s.attr("save_dht_state") = lt::session::save_dht_state;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
s.attr("save_encryption_settings") = lt::session:: save_encryption_settings;
s.attr("save_as_map") = lt::session::save_as_map;
s.attr("save_i2p_proxy") = lt::session::save_i2p_proxy;
@ -1097,7 +1097,7 @@ void bind_session()
#endif
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum_<lt::session::listen_on_flags_t>("listen_on_flags_t")
.value("listen_reuse_address", lt::session::listen_reuse_address)
.value("listen_no_system_port", lt::session::listen_no_system_port)

View File

@ -12,7 +12,7 @@ void bind_session_settings()
{
enum_<settings_pack::choking_algorithm_t>("choking_algorithm_t")
.value("fixed_slots_choker", settings_pack::fixed_slots_choker)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("auto_expand_choker", settings_pack::rate_based_choker)
#endif
.value("rate_based_choker", settings_pack::rate_based_choker)
@ -32,7 +32,7 @@ void bind_session_settings()
enum_<settings_pack::io_buffer_mode_t>("io_buffer_mode_t")
.value("enable_os_cache", settings_pack::enable_os_cache)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("disable_os_cache_for_aligned_files", settings_pack::disable_os_cache_for_aligned_files)
#endif
.value("disable_os_cache", settings_pack::disable_os_cache)
@ -47,7 +47,7 @@ void bind_session_settings()
.value("pe_forced", settings_pack::pe_forced)
.value("pe_enabled", settings_pack::pe_enabled)
.value("pe_disabled", settings_pack::pe_disabled)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("forced", settings_pack::pe_forced)
.value("enabled", settings_pack::pe_enabled)
.value("disabled", settings_pack::pe_disabled)
@ -58,7 +58,7 @@ void bind_session_settings()
.value("pe_rc4", settings_pack::pe_rc4)
.value("pe_plaintext", settings_pack::pe_plaintext)
.value("pe_both", settings_pack::pe_both)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("rc4", settings_pack::pe_rc4)
.value("plaintext", settings_pack::pe_plaintext)
.value("both", settings_pack::pe_both)
@ -75,7 +75,7 @@ void bind_session_settings()
.value("i2p_proxy", settings_pack::i2p_proxy)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum_<proxy_settings::proxy_type>("proxy_type")
.value("none", proxy_settings::none)
.value("socks4", proxy_settings::socks4)
@ -101,7 +101,7 @@ void bind_session_settings()
class_<dht::dht_settings>("dht_settings")
.def_readwrite("max_peers_reply", &dht::dht_settings::max_peers_reply)
.def_readwrite("search_branching", &dht::dht_settings::search_branching)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readwrite("service_port", &dht::dht_settings::service_port)
#endif
.def_readwrite("max_fail_count", &dht::dht_settings::max_fail_count)
@ -122,7 +122,7 @@ void bind_session_settings()
;
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
class_<pe_settings>("pe_settings")
.def_readwrite("out_enc_policy", &pe_settings::out_enc_policy)
.def_readwrite("in_enc_policy", &pe_settings::in_enc_policy)

View File

@ -263,7 +263,7 @@ list trackers(torrent_handle& h)
d["source"] = i->source;
d["verified"] = i->verified;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
if (!i->endpoints.empty())
{
announce_endpoint const& aep = i->endpoints.front();
@ -344,7 +344,7 @@ list trackers(torrent_handle& h)
}
d["endpoints"] = aeps;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
d["send_stats"] = i->send_stats;
#endif
ret.append(d);
@ -395,7 +395,7 @@ void set_metadata(torrent_handle& handle, std::string const& buf)
handle.set_metadata(buf);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#if BOOST_VERSION > 104200
std::shared_ptr<const torrent_info> get_torrent_info(torrent_handle const& h)
@ -438,7 +438,7 @@ void bind_torrent_handle()
// arguments are: number of seconds and tracker index
void (torrent_handle::*force_reannounce0)(int, int) const = &torrent_handle::force_reannounce;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
bool (torrent_handle::*super_seeding0)() const = &torrent_handle::super_seeding;
void (torrent_handle::*super_seeding1)(bool) const = &torrent_handle::super_seeding;
#endif
@ -451,7 +451,7 @@ void bind_torrent_handle()
void (torrent_handle::*move_storage0)(std::string const&, lt::move_flags_t) const = &torrent_handle::move_storage;
void (torrent_handle::*rename_file0)(file_index_t, std::string const&) const = &torrent_handle::rename_file;
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void (torrent_handle::*move_storage1)(std::wstring const&, int) const = &torrent_handle::move_storage;
void (torrent_handle::*rename_file1)(file_index_t, std::wstring const&) const = &torrent_handle::rename_file;
#endif
@ -466,7 +466,7 @@ void bind_torrent_handle()
.value("dont_replace", move_flags_t::dont_replace)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum_<deprecated_move_flags_t>("deprecated_move_flags_t")
.value("always_replace_files", deprecated_move_flags_t::always_replace_files)
.value("fail_if_exist", deprecated_move_flags_t::fail_if_exist)
@ -549,7 +549,7 @@ void bind_torrent_handle()
.def("set_flags", _(set_flags1))
.def("unset_flags", _(&torrent_handle::unset_flags))
// deprecated
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("piece_priorities", &piece_priorities)
.def("file_priorities", &file_priorities)
.def("stop_when_ready", _(&torrent_handle::stop_when_ready))
@ -595,7 +595,7 @@ void bind_torrent_handle()
s.attr("sparse") = file_open_mode::sparse;
s.attr("no_atime") = file_open_mode::no_atime;
s.attr("random_access") = file_open_mode::random_access;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
s.attr("locked") = 0;
#endif
}

View File

@ -123,7 +123,7 @@ namespace
return result;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// Create getters for announce_entry data members with non-trivial types which need converting.
lt::time_point get_next_announce(announce_entry const& ae)
{ return ae.endpoints.empty() ? lt::time_point() : lt::time_point(ae.endpoints.front().next_announce); }
@ -151,7 +151,7 @@ namespace
int get_source(announce_entry const& ae) { return ae.source; }
bool get_verified(announce_entry const& ae) { return ae.verified; }
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
std::string get_message(announce_entry const& ae)
{ return ae.endpoints.empty() ? "" : ae.endpoints.front().message; }
error_code get_last_error(announce_entry const& ae)
@ -224,7 +224,7 @@ void bind_torrent_info()
return_value_policy<copy_const_reference> copy;
void (torrent_info::*rename_file0)(file_index_t, std::string const&) = &torrent_info::rename_file;
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void (torrent_info::*rename_file1)(file_index_t, std::wstring const&) = &torrent_info::rename_file;
#endif
@ -241,7 +241,7 @@ void bind_torrent_info()
.def("__init__", make_constructor(&file_constructor0))
.def(init<torrent_info const&>((arg("ti"))))
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def(init<std::wstring>((arg("file"))))
#endif
@ -271,11 +271,11 @@ void bind_torrent_info()
.def("remap_files", &torrent_info::remap_files)
.def("files", &torrent_info::files, return_internal_reference<>())
.def("orig_files", &torrent_info::orig_files, return_internal_reference<>())
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def("file_at", &torrent_info::file_at)
.def("file_at_offset", &torrent_info::file_at_offset)
.def("rename_file", rename_file1)
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
.def("is_valid", &torrent_info::is_valid)
.def("priv", &torrent_info::priv)
@ -293,7 +293,7 @@ void bind_torrent_info()
.def("map_file", &torrent_info::map_file)
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
class_<file_entry>("file_entry")
.def_readwrite("path", &file_entry::path)
.def_readwrite("symlink_path", &file_entry::symlink_path)
@ -311,7 +311,7 @@ void bind_torrent_info()
class_<announce_entry>("announce_entry", init<std::string const&>())
.def_readwrite("url", &announce_entry::url)
.def_readonly("trackerid", &announce_entry::trackerid)
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("message", &get_message)
.add_property("last_error", &get_last_error)
.add_property("next_announce", &get_next_announce)
@ -324,7 +324,7 @@ void bind_torrent_info()
.def_readwrite("fail_limit", &announce_entry::fail_limit)
.add_property("source", &get_source)
.add_property("verified", &get_verified)
#if !defined TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("fails", &get_fails)
.add_property("updating", &get_updating)
.add_property("start_sent", &get_start_sent)

View File

@ -24,7 +24,7 @@ void bind_torrent_status()
.def_readonly("info_hash", &torrent_status::info_hash)
.add_property("torrent_file", &get_torrent_file)
.def_readonly("state", &torrent_status::state)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("paused", &torrent_status::paused)
.def_readonly("stop_when_ready", &torrent_status::stop_when_ready)
.def_readonly("auto_managed", &torrent_status::auto_managed)
@ -36,7 +36,7 @@ void bind_torrent_status()
.def_readonly("progress", &torrent_status::progress)
.def_readonly("progress_ppm", &torrent_status::progress_ppm)
.add_property("next_announce", make_getter(&torrent_status::next_announce, by_value()))
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.add_property("announce_interval", make_getter(&torrent_status::announce_interval, by_value()))
#endif
.def_readonly("current_tracker", &torrent_status::current_tracker)
@ -78,7 +78,7 @@ void bind_torrent_status()
.def_readonly("all_time_download", &torrent_status::all_time_download)
.def_readonly("seed_rank", &torrent_status::seed_rank)
.def_readonly("has_incoming", &torrent_status::has_incoming)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("seed_mode", &torrent_status::seed_mode)
.def_readonly("upload_mode", &torrent_status::upload_mode)
.def_readonly("share_mode", &torrent_status::share_mode)
@ -101,11 +101,11 @@ void bind_torrent_status()
.def_readonly("last_seen_complete", &torrent_status::last_seen_complete)
.add_property("queue_position", make_getter(&torrent_status::queue_position, by_value()))
.def_readonly("need_save_resume", &torrent_status::need_save_resume)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("ip_filter_applies", &torrent_status::ip_filter_applies)
#endif
.def_readonly("moving_storage", &torrent_status::moving_storage)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.def_readonly("is_loaded", &torrent_status::is_loaded)
#endif
.def_readonly("announcing_to_trackers", &torrent_status::announcing_to_trackers)
@ -121,7 +121,7 @@ void bind_torrent_status()
;
enum_<torrent_status::state_t>("states")
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
.value("queued_for_checking", torrent_status::queued_for_checking)
#endif
.value("checking_files", torrent_status::checking_files)

View File

@ -64,7 +64,7 @@ struct bytes_from_python
}
};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
object client_fingerprint_(peer_id const& id)
{
boost::optional<fingerprint> result = client_fingerprint(id);
@ -90,7 +90,7 @@ void bind_utility()
to_python_converter<bytes, bytes_to_python>();
bytes_from_python();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
def("identify_client", &lt::identify_client);
def("client_fingerprint", &client_fingerprint_);
#endif

View File

@ -12,7 +12,7 @@ void bind_version()
{
scope().attr("__version__") = version();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
scope().attr("version") = LIBTORRENT_VERSION;
scope().attr("version_major") = LIBTORRENT_VERSION_MAJOR;
scope().attr("version_minor") = LIBTORRENT_VERSION_MINOR;

View File

@ -122,6 +122,7 @@ network
.. _`BEP 24`: https://bittorrent.org/beps/bep_0024.html
.. _`BEP 27`: https://bittorrent.org/beps/bep_0027.html
.. _`BEP 29`: https://bittorrent.org/beps/bep_0029.html
.. _`BEP 53`: https://bittorrent.org/beps/bep_0053.html
.. _`extension protocol`: extension_protocol.html
highlighted features

View File

@ -545,7 +545,7 @@ def consume_comment(lno, lines):
def trim_define(l):
return l.replace('#ifndef', '').replace('#ifdef', '') \
.replace('#if', '').replace('defined', '') \
.replace('TORRENT_USE_IPV6', '').replace('TORRENT_NO_DEPRECATE', '') \
.replace('TORRENT_USE_IPV6', '').replace('TORRENT_ABI_VERSION == 1', '') \
.replace('||', '').replace('&&', '').replace('(', '').replace(')','') \
.replace('!', '').replace('\\', '').strip()
@ -564,7 +564,7 @@ def consume_ifdef(lno, lines, warn_on_ifdefs = False):
l += lines[lno].strip()
if verbose: print 'prep %s' % lines[lno].trim()
define = trim_define(l)
if 'TORRENT_' in define:
if 'TORRENT_' in define and not 'TORRENT_ABI_VERSION' in define:
print '\x1b[31mWARNING: possible ABI breakage in public struct! "%s" \x1b[34m %s:%d\x1b[0m' % \
(define, filename, lno)
# we've already warned once, no need to do it twice
@ -576,7 +576,7 @@ def consume_ifdef(lno, lines, warn_on_ifdefs = False):
' TORRENT_USE_ASSERTS' in l or
' TORRENT_USE_INVARIANT_CHECKS' in l or
' TORRENT_ASIO_DEBUGGING' in l) or
l == '#ifndef TORRENT_NO_DEPRECATE'
l == '#if TORRENT_ABI_VERSION == 1'
):
while lno < len(lines):
l = lines[lno].strip()
@ -649,10 +649,6 @@ for filename in files:
lno = consume_block(lno, lines)
continue
if 'TORRENT_CFG' in l:
blanks += 1
if verbose: print 'xx %s' % l
continue
if 'TORRENT_DEPRECATED' in l:
if ('class ' in l or 'struct ' in l) and not ';' in l:
lno = consume_block(lno - 1, lines)

View File

@ -56,7 +56,7 @@ for l in f:
if 'enum string_types' in l: mode = 'string'
if 'enum bool_types' in l: mode = 'bool'
if 'enum int_types' in l: mode = 'int'
if '#ifndef TORRENT_NO_DEPRECATE' in l: mode += 'skip'
if '#if TORRENT_ABI_VERSION == 1' in l: mode += 'skip'
if '#endif' in l: mode = mode[0:-4]
if mode == '': continue

View File

@ -89,7 +89,7 @@ for l in f:
if '#endif' in l: mode = ''
continue
if 'TORRENT_NO_DEPRECATE' in l:
if 'TORRENT_ABI_VERSION == 1' in l:
mode = 'ignore'
continue

View File

@ -21,7 +21,6 @@ nobase_include_HEADERS = \
broadcast_socket.hpp \
bt_peer_connection.hpp \
buffer.hpp \
build_config.hpp \
chained_buffer.hpp \
choker.hpp \
close_reason.hpp \

View File

@ -56,6 +56,8 @@ namespace libtorrent {
struct torrent_plugin;
struct torrent_handle;
TORRENT_VERSION_NAMESPACE_2
// The add_torrent_params is a parameter pack for adding torrents to a
// session. The key fields when adding a torrent are:
//
@ -95,7 +97,7 @@ namespace libtorrent {
// These are all deprecated. use torrent_flags_t instead (in
// libtorrent/torrent_flags.hpp)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
using flags_t = torrent_flags_t;
@ -123,7 +125,7 @@ namespace libtorrent {
DECL_FLAG(merge_resume_http_seeds);
DECL_FLAG(default_flags);
#undef DECL_FLAG
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@ -334,7 +336,7 @@ namespace libtorrent {
std::time_t last_download = 0;
std::time_t last_upload = 0;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// ``url`` can be set to a magnet link, in order to download the .torrent
@ -369,17 +371,11 @@ namespace libtorrent {
// communicated forward into libtorrent via this field. If this is set, a
// fastresume_rejected_alert will be posted.
error_code internal_resume_data_error;
#else
// hidden
// to maintain ABI compatibility
std::string deprecated5;
std::string deprecated1;
std::string deprecated2;
aux::noexcept_movable<std::vector<char>> deprecated3;
error_code deprecated4;
#endif
#endif // TORRENT_ABI_VERSION
};
TORRENT_VERSION_NAMESPACE_2_END
}
#endif

View File

@ -90,7 +90,7 @@ namespace libtorrent {
alert& operator=(alert const&) = delete;
alert(alert&& rhs) noexcept = default;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// only here for backwards compatibility
enum TORRENT_DEPRECATED_ENUM severity_t { debug, info, warning, critical, fatal, none };
#endif
@ -128,7 +128,7 @@ namespace libtorrent {
// Enables alerts for when a torrent or the session changes state.
static constexpr alert_category_t status_notification = 6_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// Alerts for when blocks are requested and completed. Also when
// pieces are completed.
static constexpr alert_category_t TORRENT_DEPRECATED_MEMBER progress_notification = 7_bit;
@ -151,7 +151,7 @@ namespace libtorrent {
// the lasts stats alert.
static constexpr alert_category_t stats_notification = 11_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// Alerts on RSS related events, like feeds being updated, feed error
// conditions and successful RSS feed updates. Enabling this category
// will make you receive rss_alert alerts.
@ -267,7 +267,7 @@ namespace libtorrent {
// returns a bitmask specifying which categories this alert belong to.
virtual alert_category_t category() const noexcept = 0;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/aux_/disable_warnings_push.hpp"
@ -286,7 +286,7 @@ namespace libtorrent {
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
private:
time_point const m_timestamp;

View File

@ -59,7 +59,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/shared_array.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#define PROGRESS_NOTIFICATION | alert::progress_notification
#else
#define PROGRESS_NOTIFICATION
@ -68,7 +68,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED_EXPORT char const* operation_name(int op);
#endif
@ -82,6 +82,20 @@ namespace libtorrent {
alert_priority_critical
};
// struct to hold information about a single DHT routing table bucket
struct TORRENT_EXPORT dht_routing_bucket
{
// the total number of nodes and replacement nodes
// in the routing table
int num_nodes;
int num_replacements;
// number of seconds since last activity
int last_active;
};
TORRENT_VERSION_NAMESPACE_2
// This is a base class for alerts that are associated with a
// specific torrent. It contains a handle to the torrent.
struct TORRENT_EXPORT torrent_alert : alert
@ -90,7 +104,7 @@ namespace libtorrent {
torrent_alert(aux::stack_allocator& alloc, torrent_handle const& h);
torrent_alert(torrent_alert&&) noexcept = default;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
static const int TORRENT_DEPRECATED_MEMBER alert_type = 0;
#endif
@ -107,7 +121,7 @@ namespace libtorrent {
std::reference_wrapper<aux::stack_allocator const> m_alloc;
private:
aux::allocation_slot m_name_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
std::string TORRENT_DEPRECATED_MEMBER name;
#endif
@ -122,7 +136,7 @@ namespace libtorrent {
tcp::endpoint const& i, peer_id const& pi);
peer_alert(peer_alert&& rhs) noexcept = default;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
static const int TORRENT_DEPRECATED_MEMBER alert_type = 1;
#endif
@ -134,7 +148,7 @@ namespace libtorrent {
// the peer ID, if known.
peer_id pid;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// The peer's IP address and port.
aux::noexcept_movable<tcp::endpoint> TORRENT_DEPRECATED_MEMBER ip;
#endif
@ -149,7 +163,7 @@ namespace libtorrent {
tracker_alert(aux::stack_allocator& alloc, torrent_handle const& h
, tcp::endpoint const& ep, string_view u);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
static const int TORRENT_DEPRECATED_MEMBER alert_type = 2;
#endif
@ -163,7 +177,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_url_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// The tracker URL
std::string TORRENT_DEPRECATED_MEMBER url;
@ -184,7 +198,7 @@ namespace libtorrent {
#define TORRENT_DEFINE_ALERT_PRIO(name, seq, prio) \
TORRENT_DEFINE_ALERT_IMPL(name, seq, prio)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// The ``torrent_added_alert`` is posted once every time a torrent is successfully
// added. It doesn't contain any members of its own, but inherits the torrent handle
// from its base class.
@ -252,7 +266,7 @@ namespace libtorrent {
piece_index_t const piece;
int const size;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
error_code TORRENT_DEPRECATED_MEMBER ec;
#endif
};
@ -303,7 +317,7 @@ namespace libtorrent {
file_index_t const index;
private:
aux::allocation_slot m_name_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#if defined __clang__
#pragma clang diagnostic push
@ -488,7 +502,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_msg_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
int const TORRENT_DEPRECATED_MEMBER status_code;
std::string TORRENT_DEPRECATED_MEMBER msg;
@ -515,7 +529,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_msg_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// contains the warning message from the tracker.
std::string TORRENT_DEPRECATED_MEMBER msg;
@ -570,7 +584,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_msg_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// contains a message describing the error.
std::string TORRENT_DEPRECATED_MEMBER msg;
@ -720,7 +734,7 @@ namespace libtorrent {
// tells you what error caused this alert.
error_code const error;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
int const TORRENT_DEPRECATED_MEMBER operation;
std::string TORRENT_DEPRECATED_MEMBER msg;
#endif
@ -769,7 +783,7 @@ namespace libtorrent {
// the reason the peer disconnected (if specified)
close_reason_t const reason;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
int const TORRENT_DEPRECATED_MEMBER operation;
std::string TORRENT_DEPRECATED_MEMBER msg;
#endif
@ -957,7 +971,7 @@ namespace libtorrent {
int const block_index;
piece_index_t const piece_index;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
char const* TORRENT_DEPRECATED_MEMBER peer_speedmsg;
#endif
};
@ -1001,7 +1015,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_path_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
std::string TORRENT_DEPRECATED_MEMBER path;
#endif
@ -1030,7 +1044,7 @@ namespace libtorrent {
operation_t op;
private:
aux::allocation_slot m_file_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
char const* TORRENT_DEPRECATED_MEMBER operation;
// If the error happened for a specific file, ``file`` is its path.
@ -1081,7 +1095,7 @@ namespace libtorrent {
// the info hash of the torrent whose files failed to be deleted
sha1_hash info_hash;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
std::string TORRENT_DEPRECATED_MEMBER msg;
#endif
};
@ -1105,7 +1119,7 @@ namespace libtorrent {
// save the state to disk, you may pass it on to write_resume_data().
add_torrent_params params;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// points to the resume data.
std::shared_ptr<entry> TORRENT_DEPRECATED_MEMBER resume_data;
#endif
@ -1128,7 +1142,7 @@ namespace libtorrent {
// the error code from the resume_data failure
error_code const error;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
std::string TORRENT_DEPRECATED_MEMBER msg;
#endif
};
@ -1201,7 +1215,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_url_idx;
aux::allocation_slot m_msg_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// the HTTP seed that failed
std::string TORRENT_DEPRECATED_MEMBER url;
@ -1238,7 +1252,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_file_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
char const* TORRENT_DEPRECATED_MEMBER operation;
// the path to the file that was accessed when the error occurred.
@ -1366,7 +1380,7 @@ namespace libtorrent {
// listen on it.
struct TORRENT_EXPORT listen_failed_alert final : alert
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum socket_type_t : std::uint8_t
{
tcp TORRENT_DEPRECATED_ENUM,
@ -1422,9 +1436,9 @@ namespace libtorrent {
private:
std::reference_wrapper<aux::stack_allocator const> m_alloc;
aux::allocation_slot m_interface_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
enum op_t
enum TORRENT_DEPRECATED_ENUM op_t
{
parse_addr TORRENT_DEPRECATED_ENUM,
open TORRENT_DEPRECATED_ENUM,
@ -1452,7 +1466,7 @@ namespace libtorrent {
// successfully was opened for listening.
struct TORRENT_EXPORT listen_succeeded_alert final : alert
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum socket_type_t : std::uint8_t
{
tcp TORRENT_DEPRECATED_ENUM,
@ -1493,7 +1507,7 @@ namespace libtorrent {
// the type of listen socket this alert refers to.
libtorrent::socket_type_t const socket_type;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the endpoint libtorrent ended up listening on. The address
// refers to the local interface and the port is the listen port.
aux::noexcept_movable<tcp::endpoint> TORRENT_DEPRECATED_MEMBER endpoint;
@ -1531,7 +1545,7 @@ namespace libtorrent {
// tells you what failed.
error_code const error;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// is 0 for NAT-PMP and 1 for UPnP.
int const TORRENT_DEPRECATED_MEMBER map_type;
@ -1565,7 +1579,7 @@ namespace libtorrent {
portmap_transport const map_transport;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum TORRENT_DEPRECATED_ENUM protocol_t
{
tcp,
@ -1606,7 +1620,7 @@ namespace libtorrent {
std::reference_wrapper<aux::stack_allocator const> m_alloc;
aux::allocation_slot m_log_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
int const TORRENT_DEPRECATED_MEMBER map_type;
std::string TORRENT_DEPRECATED_MEMBER msg;
@ -1640,7 +1654,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_path_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// If the error happened in a disk operation. a 0-terminated string of
// the name of that operation. ``operation`` is nullptr otherwise.
@ -1743,7 +1757,7 @@ namespace libtorrent {
download_payload,
download_protocol,
upload_ip_protocol,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
upload_dht_protocol TORRENT_DEPRECATED_ENUM,
upload_tracker_protocol TORRENT_DEPRECATED_ENUM,
#else
@ -1751,7 +1765,7 @@ namespace libtorrent {
deprecated2,
#endif
download_ip_protocol,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
download_dht_protocol TORRENT_DEPRECATED_ENUM,
download_tracker_protocol TORRENT_DEPRECATED_ENUM,
#else
@ -1848,7 +1862,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_tracker_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// The tracker ID returned by the tracker
std::string TORRENT_DEPRECATED_MEMBER trackerid;
@ -1887,7 +1901,7 @@ namespace libtorrent {
private:
aux::allocation_slot m_file_idx;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
// the filename (or object) the error occurred on.
std::string TORRENT_DEPRECATED_MEMBER error_file;
@ -1909,7 +1923,7 @@ namespace libtorrent {
static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
error_code const TORRENT_DEPRECATED_MEMBER error;
#endif
};
@ -1950,7 +1964,7 @@ namespace libtorrent {
// is the IP address and port the connection came from.
aux::noexcept_movable<tcp::endpoint> endpoint;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// is the IP address and port the connection came from.
aux::noexcept_movable<tcp::endpoint> TORRENT_DEPRECATED_MEMBER ip;
#endif
@ -2002,7 +2016,7 @@ namespace libtorrent {
std::vector<torrent_status> status;
};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef _MSC_VER
#pragma warning(push, 1)
// warning C4996: X: was declared deprecated
@ -2029,7 +2043,7 @@ namespace libtorrent {
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// The session_stats_alert is posted when the user requests session statistics by
// calling post_session_stats() on the session object. Its category is
@ -2045,7 +2059,7 @@ namespace libtorrent {
{
session_stats_alert(aux::stack_allocator& alloc, counters const& cnt);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@ -2056,7 +2070,7 @@ namespace libtorrent {
#endif
#endif
TORRENT_DEFINE_ALERT_PRIO(session_stats_alert, 70, alert_priority_critical)
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
@ -2079,14 +2093,16 @@ namespace libtorrent {
// For more information, see the session-statistics_ section.
span<std::int64_t const> counters() const;
#ifdef TORRENT_NO_DEPRECATE
private:
#endif
// TODO: allocate this on the alert_stack in the future
#if TORRENT_ABI_VERSION == 1
std::array<std::int64_t, counters::num_counters> const TORRENT_DEPRECATED_MEMBER values;
#else
private:
std::reference_wrapper<aux::stack_allocator const> m_alloc;
aux::allocation_slot m_counters_idx;
#endif
};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// hidden
// When a torrent changes its info-hash, this alert is posted. This only
// happens in very specific cases. For instance, when a torrent is
@ -2125,7 +2141,7 @@ namespace libtorrent {
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// posted when something fails in the DHT. This is not necessarily a fatal
// error, but it could prevent proper operation
@ -2146,7 +2162,7 @@ namespace libtorrent {
// the operation that failed
operation_t op;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum op_t
{
unknown TORRENT_DEPRECATED_ENUM,
@ -2289,7 +2305,7 @@ namespace libtorrent {
// the endpoint we're sending this query to
aux::noexcept_movable<udp::endpoint> endpoint;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the endpoint we're sending this query to
aux::noexcept_movable<udp::endpoint> TORRENT_DEPRECATED_MEMBER ip;
#endif
@ -2313,7 +2329,7 @@ namespace libtorrent {
// returns the log message
char const* log_message() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// returns the log message
TORRENT_DEPRECATED
char const* msg() const;
@ -2342,7 +2358,7 @@ namespace libtorrent {
// returns the log message
char const* log_message() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// returns the log message
TORRENT_DEPRECATED
char const* msg() const;
@ -2389,7 +2405,7 @@ namespace libtorrent {
// returns the log message
char const* log_message() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// returns the log message
TORRENT_DEPRECATED
char const* msg() const;
@ -2463,18 +2479,6 @@ namespace libtorrent {
sha1_hash target;
};
// struct to hold information about a single DHT routing table bucket
struct TORRENT_EXPORT dht_routing_bucket
{
// the total number of nodes and replacement nodes
// in the routing table
int num_nodes;
int num_replacements;
// number of seconds since last activity
int last_active;
};
// contains current DHT state. Posted in response to session::post_dht_stats().
struct TORRENT_EXPORT dht_stats_alert final : alert
{
@ -2579,7 +2583,7 @@ namespace libtorrent {
std::reference_wrapper<aux::stack_allocator> m_alloc;
aux::allocation_slot m_msg_idx;
std::size_t const m_size;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
direction_t TORRENT_DEPRECATED_MEMBER dir;
#endif
@ -2601,7 +2605,7 @@ namespace libtorrent {
int num_peers() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
void peers(std::vector<tcp::endpoint>& v) const;
#endif
@ -2640,7 +2644,7 @@ namespace libtorrent {
std::reference_wrapper<aux::stack_allocator> m_alloc;
aux::allocation_slot m_response_idx;
int const m_response_size;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
public:
aux::noexcept_movable<udp::endpoint> TORRENT_DEPRECATED_MEMBER addr;
#endif
@ -2831,6 +2835,8 @@ namespace libtorrent {
piece_index_t const piece_index;
};
TORRENT_VERSION_NAMESPACE_2_END
#undef TORRENT_DEFINE_ALERT_IMPL
#undef TORRENT_DEFINE_ALERT
#undef TORRENT_DEFINE_ALERT_PRIO

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_ANNOUNCE_ENTRY_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/string_view.hpp"
@ -51,7 +52,11 @@ namespace libtorrent {
struct TORRENT_EXPORT announce_endpoint
{
friend class torrent;
#if TORRENT_ABI_VERSION == 1
friend struct announce_entry;
#else
friend struct v1_2::announce_entry;
#endif
// internal
explicit announce_endpoint(aux::listen_socket_handle const& s);
@ -135,6 +140,8 @@ namespace libtorrent {
bool is_working() const { return fails == 0; }
};
TORRENT_VERSION_NAMESPACE_2
// this class holds information about one bittorrent tracker, as it
// relates to a specific torrent.
struct TORRENT_EXPORT announce_entry
@ -184,7 +191,7 @@ namespace libtorrent {
// from this tracker.
bool verified:1;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// all of these will be set to false or 0
// use the corresponding members in announce_endpoint
@ -195,14 +202,6 @@ namespace libtorrent {
// internal
bool TORRENT_DEPRECATED_MEMBER triggered_manually:1;
bool TORRENT_DEPRECATED_MEMBER updating:1;
#else
// hidden
std::uint8_t deprecated_fails:7;
bool deprecated_send_stats:1;
bool deprecated_start_sent:1;
bool deprecated_complete_sent:1;
bool deprecated_triggered_manually:1;
bool deprecated_updating:1;
#endif
// reset announce counters and clears the started sent flag.
@ -210,7 +209,7 @@ namespace libtorrent {
// the tracker.
void reset();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2, use announce_endpoint::can_announce
// returns true if we can announce to this tracker now.
// The current time is passed in as ``now``. The ``is_seed``
@ -232,6 +231,8 @@ namespace libtorrent {
void trim();
};
TORRENT_VERSION_NAMESPACE_2_END
}
#endif

View File

@ -66,7 +66,7 @@ namespace libtorrent {
TORRENT_EXTRA_EXPORT string_view trim(string_view);
TORRENT_EXTRA_EXPORT string_view::size_type find(string_view haystack, string_view needle, string_view::size_type pos);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// convert a file://-URL to a proper path
TORRENT_EXTRA_EXPORT std::string resolve_file_url(std::string const& url);

View File

@ -67,7 +67,7 @@ namespace aux {
std::string username;
std::string password;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the type of proxy to use. Assign one of these to the
// proxy_settings::type field.
enum proxy_type

View File

@ -82,7 +82,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/portmap.hpp"
#include "libtorrent/aux_/lsd.hpp"
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/session_settings.hpp"
#endif
@ -344,7 +344,7 @@ namespace aux {
void incoming_connection(std::shared_ptr<socket_type> const& s);
std::weak_ptr<torrent> find_torrent(sha1_hash const& info_hash) const override;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
//deprecated in 1.2
TORRENT_DEPRECATED
@ -353,6 +353,10 @@ namespace aux {
TORRENT_DEPRECATED
std::weak_ptr<torrent> find_torrent(std::string const& uuid) const;
TORRENT_DEPRECATED
void insert_uuid_torrent(std::string uuid, std::shared_ptr<torrent> const& t) override
{ m_uuids.insert(std::make_pair(uuid, t)); }
#endif
#ifndef TORRENT_DISABLE_MUTABLE_TORRENTS
std::vector<std::shared_ptr<torrent>> find_collection(
@ -363,12 +367,7 @@ namespace aux {
void insert_torrent(sha1_hash const& ih, std::shared_ptr<torrent> const& t
, std::string uuid) override;
#ifndef TORRENT_NO_DEPRECATE
//deprecated in 1.2
TORRENT_DEPRECATED
void insert_uuid_torrent(std::string uuid, std::shared_ptr<torrent> const& t) override
{ m_uuids.insert(std::make_pair(uuid, t)); }
#endif
std::shared_ptr<torrent> delay_load_torrent(sha1_hash const& info_hash
, peer_connection* pc) override;
void set_queue_position(torrent* t, queue_position_t p) override;
@ -425,7 +424,7 @@ namespace aux {
void dht_direct_request(udp::endpoint const& ep, entry& e
, void* userdata = nullptr);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
entry dht_state() const;
TORRENT_DEPRECATED
@ -506,7 +505,7 @@ namespace aux {
add_torrent_impl(add_torrent_params& p, error_code& ec);
void async_add_torrent(add_torrent_params* params);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void on_async_load_torrent(add_torrent_params* params, error_code ec);
#endif
@ -527,7 +526,7 @@ namespace aux {
void pop_alerts(std::vector<alert*>* alerts);
alert* wait_for_alert(time_duration max_wait);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED void pop_alerts();
TORRENT_DEPRECATED alert const* pop_alert();
TORRENT_DEPRECATED std::size_t set_alert_queue_size_limit(std::size_t queue_size_limit_);
@ -580,7 +579,7 @@ namespace aux {
m_optimistic_unchoke_time_scaler = 0;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
session_status status() const;
peer_id deprecated_get_peer_id() const;
#endif
@ -714,7 +713,7 @@ namespace aux {
// the settings for the client
aux::session_settings m_settings;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void update_ssl_listen();
void update_dht_upload_rate_limit();
void update_local_download_rate();
@ -807,7 +806,7 @@ namespace aux {
// handles delayed alerts
mutable alert_manager m_alerts;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the alert pointers stored in m_alerts
mutable aux::vector<alert*> m_alert_pointers;
@ -869,7 +868,7 @@ namespace aux {
torrent_map m_obfuscated_torrents;
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
//deprecated in 1.2
std::map<std::string, std::shared_ptr<torrent>> m_uuids;
#endif
@ -1141,7 +1140,7 @@ namespace aux {
std::shared_ptr<upnp> m_upnp;
std::shared_ptr<lsd> m_lsd;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct work_thread_t
{
work_thread_t()
@ -1256,7 +1255,7 @@ namespace aux {
std::array<std::vector<std::shared_ptr<plugin>>, 4> m_ses_extensions;
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
user_load_function_t m_user_load_torrent;
#endif

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_SESSION_INTERFACE_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/io_service.hpp"
#include "libtorrent/time.hpp"
@ -64,9 +65,6 @@ namespace libtorrent {
class peer_connection;
class torrent;
#ifndef TORRENT_NO_DEPRECATE
struct pe_settings;
#endif
struct peer_class_set;
struct bandwidth_channel;
struct bandwidth_manager;
@ -78,12 +76,7 @@ namespace libtorrent {
struct tracker_request;
struct request_callback;
struct utp_socket_manager;
struct block_info;
struct external_ip;
struct torrent_handle;
struct ip_filter;
class port_filter;
struct settings_pack;
struct torrent_peer_allocator_interface;
struct counters;
struct resolver_interface;
@ -193,7 +186,7 @@ namespace aux {
, peer_connection* pc) = 0;
virtual void insert_torrent(sha1_hash const& ih, std::shared_ptr<torrent> const& t
, std::string uuid) = 0;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
//deprecated in 1.2
virtual void insert_uuid_torrent(std::string uuid, std::shared_ptr<torrent> const& t) = 0;
#endif

View File

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/span.hpp"
#include "libtorrent/aux_/typed_span.hpp"
#include "libtorrent/units.hpp"
@ -45,11 +46,8 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
class file_storage;
struct part_file;
struct storage_error;
struct stat_cache;
struct add_torrent_params;
// TODO: 3 remove this typedef, and use span<char const> for disk write
// operations

View File

@ -103,7 +103,7 @@ namespace libtorrent {
TORRENT_EXPORT boost::system::error_category& bdecode_category();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline boost::system::error_category& get_bdecode_category()
{ return bdecode_category(); }
@ -252,7 +252,7 @@ struct bdecode_token
// There are 5 different types of nodes, see type_t.
struct TORRENT_EXPORT bdecode_node
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED_EXPORT friend int bdecode(char const* start, char const* end, bdecode_node& ret
, error_code& ec, int* error_pos, int depth_limit
, int token_limit);

View File

@ -79,7 +79,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
using invalid_encoding = system_error;
#endif

View File

@ -136,7 +136,7 @@ namespace libtorrent {
char const* data() const { return m_buf ? reinterpret_cast<char const*>(&m_buf[1]) : nullptr; }
char* data() { return m_buf ? reinterpret_cast<char*>(&m_buf[1]) : nullptr; }
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
char const* bytes() const { return data(); }
#endif

View File

@ -471,7 +471,7 @@ namespace aux {
void clear(tailqueue<disk_io_job>& jobs);
void update_stats_counters(counters& c) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void get_stats(cache_status* ret) const;
#endif
void set_settings(aux::session_settings const& sett);

View File

@ -1,74 +0,0 @@
/*
Copyright (c) 2010-2018, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TORRENT_BUILD_CONFIG_HPP_INCLUDED
#define TORRENT_BUILD_CONFIG_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
// TODO: 2 instead of using a dummy function to cause link errors when
// incompatible build configurations are used, make the namespace name
// depend on the configuration, and have a using declaration in the headers
// to pull it into libtorrent.
#if TORRENT_USE_IPV6
#define TORRENT_CFG_IPV6 ipv6_
#else
#define TORRENT_CFG_IPV6 noipv6_
#endif
#ifdef TORRENT_NO_DEPRECATE
#define TORRENT_CFG_DEPR nodeprecate_
#else
#define TORRENT_CFG_DEPR deprecated_
#endif
#if defined TORRENT_EXPORT_EXTRA
#if TORRENT_USE_ASSERTS
#define TORRENT_CFG_ASSERTS asserts_
#else
#define TORRENT_CFG_ASSERTS noasserts_
#endif
#else
#define TORRENT_CFG_ASSERTS
#endif
#define TORRENT_CFG \
BOOST_PP_CAT(TORRENT_CFG_IPV6, \
BOOST_PP_CAT(TORRENT_CFG_DEPR, \
TORRENT_CFG_ASSERTS))
#define TORRENT_CFG_STRING BOOST_PP_STRINGIZE(TORRENT_CFG)
#endif

View File

@ -38,20 +38,17 @@ POSSIBILITY OF SUCH DAMAGE.
#define _FILE_OFFSET_BITS 64
#include <boost/config.hpp>
#include <boost/asio/detail/config.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
// TODO: don't include that here. Make each header that use the export macros
// include it instead. and move it to aux_
#include "libtorrent/export.hpp"
#ifdef __linux__
#include <linux/version.h> // for LINUX_VERSION_CODE and KERNEL_VERSION
#endif // __linux
#if !defined BOOST_ASIO_SEPARATE_COMPILATION && !defined BOOST_ASIO_DYN_LINK
#define BOOST_ASIO_SEPARATE_COMPILATION
#endif
#if defined __MINGW64__ || defined __MINGW32__
// GCC warns on format codes that are incompatible with glibc, which the windows
// format codes are. So we need to disable those for mingw targets
@ -249,6 +246,10 @@ POSSIBILITY OF SUCH DAMAGE.
# define TORRENT_USE_GETIPFORWARDTABLE 1
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
# if !defined TORRENT_USE_LIBCRYPTO && !defined TORRENT_USE_LIBGCRYPT
// unless some other crypto library has been specified, default to the native
// windows CryptoAPI
@ -614,6 +615,14 @@ constexpr std::size_t TORRENT_WRITE_HANDLER_MAX_SIZE = 342;
#endif
#endif // TORRENT_HAS_ARM_CRC32
#if TORRENT_USE_IPV6
#define TORRENT_IPV6_NAMESPACE inline namespace v6 {
#define TORRENT_IPV6_NAMESPACE_END }
#else
#define TORRENT_IPV6_NAMESPACE
#define TORRENT_IPV6_NAMESPACE_END
#endif
namespace libtorrent {}
// create alias

View File

@ -106,7 +106,7 @@ namespace libtorrent {
// files, to keep the impact down for clients that don't support
// them.
static constexpr create_flags_t optimize_alignment = 0_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// same as optimize_alignment, for backwards compatibility
static constexpr create_flags_t TORRENT_DEPRECATED_MEMBER optimize = 0_bit;
#endif
@ -420,7 +420,7 @@ namespace detail {
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED_EXPORT
void add_files(file_storage& fs, std::wstring const& wfile
@ -463,7 +463,7 @@ namespace detail {
{
set_piece_hashes_deprecated(t, p, detail::nop, ec);
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
}

View File

@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <string>
#include <memory>
#include "libtorrent/fwd.hpp"
#include "libtorrent/units.hpp"
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/aux_/vector.hpp"
@ -50,17 +51,9 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct storage_interface;
struct peer_request;
struct disk_observer;
struct add_torrent_params;
struct cache_status;
struct disk_buffer_holder;
struct counters;
struct settings_pack;
struct storage_params;
struct storage_error;
class file_storage;
struct storage_holder;
@ -96,7 +89,7 @@ namespace libtorrent {
// logic
constexpr file_open_mode_t random_access = 5_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// prevent the file from being opened by another process
// while it's still being held open by this handle
constexpr file_open_mode_t TORRENT_DEPRECATED locked = 6_bit;
@ -123,7 +116,7 @@ namespace libtorrent {
time_point last_use;
};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
using pool_file_status = open_file_state;
#endif

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_DISK_IO_JOB_HPP
#define TORRENT_DISK_IO_JOB_HPP
#include "libtorrent/fwd.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/tailqueue.hpp"
#include "libtorrent/peer_request.hpp"
@ -55,10 +56,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct storage_interface;
struct cached_piece_entry;
class torrent_info;
struct add_torrent_params;
enum class job_action_t : std::uint8_t
{

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_DISK_IO_THREAD
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/debug.hpp"
#include "libtorrent/storage.hpp"
#include "libtorrent/allocator.hpp"
@ -56,8 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
class alert;
struct add_torrent_params;
struct counters;
class alert_manager;
@ -104,7 +103,7 @@ namespace aux {
// initializes all counters to 0
cache_status()
: pieces()
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
, blocks_written(0)
, writes(0)
, blocks_read(0)
@ -142,14 +141,14 @@ namespace aux {
, num_writing_threads(0)
#endif
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
std::memset(num_fence_jobs, 0, sizeof(num_fence_jobs));
#endif
}
std::vector<cached_piece_info> pieces;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the total number of 16 KiB blocks written to disk
// since this session was started.
int blocks_written;

View File

@ -78,7 +78,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct lazy_entry;
// backwards compatibility
using type_error = system_error;
@ -190,7 +190,7 @@ namespace aux {
// copies the structure of the right hand side into this
// entry.
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
entry& operator=(lazy_entry const&);
#endif
entry& operator=(bdecode_node const&);

View File

@ -420,7 +420,7 @@ namespace libtorrent {
// invalid action field in udp tracker response
invalid_tracker_action,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// expected string in bencoded string
expected_string = 190,
// expected colon in bencoded string
@ -489,7 +489,7 @@ namespace libtorrent {
using system_error = boost::system::system_error;
#ifndef BOOST_NO_EXCEPTIONS
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline boost::system::error_category& get_libtorrent_category()
{ return libtorrent_category(); }
@ -523,7 +523,7 @@ namespace libtorrent {
// kind of operation failed.
operation_t operation;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// Returns a string literal representing the file operation
// that failed. If there were no failure, it returns
// an empty string.

View File

@ -35,6 +35,22 @@ POSSIBILITY OF SUCH DAMAGE.
#include <boost/config.hpp>
#if !defined TORRENT_ABI_VERSION
#ifdef TORRENT_NO_DEPRECATE
#define TORRENT_ABI_VERSION 2
#else
#define TORRENT_ABI_VERSION 1
#endif
#endif
#if TORRENT_ABI_VERSION >= 2
#define TORRENT_VERSION_NAMESPACE_2 inline namespace v1_2 {
#define TORRENT_VERSION_NAMESPACE_2_END }
#else
#define TORRENT_VERSION_NAMESPACE_2
#define TORRENT_VERSION_NAMESPACE_2_END
#endif
// backwards compatibility with older versions of boost
#if !defined BOOST_SYMBOL_EXPORT && !defined BOOST_SYMBOL_IMPORT
# if defined _MSC_VER || defined __MINGW32__
@ -74,7 +90,7 @@ POSSIBILITY OF SUCH DAMAGE.
#endif
// only export this type if deprecated functions are enabled
#ifdef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION >= 2
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXTRA_EXPORT
#else
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXPORT

View File

@ -166,6 +166,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/span.hpp"
#include "libtorrent/sha1_hash.hpp"
#include "libtorrent/string_view.hpp"
@ -174,18 +175,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct peer_plugin;
struct peer_request;
class entry;
struct bdecode_node;
struct bitfield;
class alert;
struct torrent_plugin;
struct add_torrent_params;
struct torrent_handle;
struct session_handle;
struct peer_connection_handle;
// these are flags that can be returned by implemented_features()
// indicating which callbacks this plugin is interested in
using feature_flags_t = flags::bitfield_flag<std::uint8_t, struct feature_flags_tag>;

View File

@ -90,15 +90,6 @@ namespace libtorrent {
// any file to stay open for too long, allowing the disk cache to accrue.
void close_oldest();
#if TORRENT_USE_ASSERTS
bool assert_idle_files(storage_index_t st) const;
// remember that this storage has had
// its files deleted. We may not open any
// files from it again
void mark_deleted(file_storage const& fs);
#endif
private:
file_handle remove_oldest(std::unique_lock<std::mutex>&);
@ -117,11 +108,9 @@ namespace libtorrent {
// maps storage pointer, file index pairs to the
// LRU entry for the file
std::map<std::pair<storage_index_t, file_index_t>, lru_file_entry> m_files;
#if TORRENT_USE_ASSERTS
std::vector<std::pair<std::string, void const*>> m_deleted_storages;
#endif
mutable std::mutex m_mutex;
};
}
#endif

View File

@ -49,7 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// information about a file in a file_storage
struct TORRENT_DEPRECATED_EXPORT file_entry
{
@ -103,7 +103,7 @@ namespace libtorrent {
// where the data for this file was found.
bool symlink_attribute:1;
};
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// internal
struct TORRENT_DEPRECATED_EXPORT internal_file_entry
@ -217,7 +217,7 @@ namespace libtorrent {
// not.
bool is_valid() const { return m_piece_length > 0; }
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
static constexpr file_flags_t TORRENT_DEPRECATED_MEMBER pad_file = 0_bit;
static constexpr file_flags_t TORRENT_DEPRECATED_MEMBER attribute_hidden = 1_bit;
static constexpr file_flags_t TORRENT_DEPRECATED_MEMBER attribute_executable = 2_bit;
@ -278,7 +278,7 @@ namespace libtorrent {
// that filenames are expected to be UTF-8 encoded.
void rename_file(file_index_t index, std::string const& new_filename);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
void add_file_borrow(char const* filename, int filename_len
, std::string const& path, std::int64_t file_size
@ -300,7 +300,7 @@ namespace libtorrent {
void set_name(std::wstring const& n);
void rename_file_deprecated(file_index_t index, std::wstring const& new_filename);
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// returns a list of file_slice objects representing the portions of
// files the specified piece index, byte offset and size range overlaps.
@ -323,7 +323,7 @@ namespace libtorrent {
// integer.
peer_request map_file(file_index_t file, std::int64_t offset, int size) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// all functions depending on internal_file_entry
// were deprecated in 1.0. Use the variants that take an
// index instead
@ -361,7 +361,7 @@ namespace libtorrent {
reverse_iterator rend_deprecated() const { return m_files.rend(); }
iterator file_at_offset_deprecated(std::int64_t offset) const;
file_entry at_deprecated(int index) const;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// returns the number of files in the file_storage
int num_files() const
@ -511,7 +511,7 @@ namespace libtorrent {
char const* file_name_ptr(file_index_t index) const;
int file_name_len(file_index_t index) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// these were deprecated in 1.0. Use the versions that take an index instead
TORRENT_DEPRECATED
sha1_hash hash(internal_file_entry const& fe) const;

View File

@ -82,7 +82,7 @@ namespace libtorrent {
{
fingerprint(const char* id_string, int major, int minor, int revision, int tag);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// generates the actual string put in the peer-id, and return it.
std::string to_string() const;
#endif

View File

@ -64,7 +64,7 @@ struct bitfield_flag
constexpr bitfield_flag() noexcept : m_val(0) {}
explicit constexpr bitfield_flag(UnderlyingType const val) noexcept : m_val(val) {}
constexpr bitfield_flag(bit_t const bit) noexcept : m_val(static_cast<UnderlyingType>(UnderlyingType{1} << static_cast<int>(bit))) {}
#ifdef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION >= 2
explicit constexpr operator UnderlyingType() const noexcept { return m_val; }
#else
constexpr operator UnderlyingType() const noexcept { return m_val; }

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2017-2018, Arvid Norberg
Copyright (c) 2017, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -33,15 +33,21 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_FWD_HPP
#define TORRENT_FWD_HPP
#include "libtorrent/config.hpp"
namespace libtorrent {
// include/libtorrent/add_torrent_params.hpp
TORRENT_VERSION_NAMESPACE_2
struct add_torrent_params;
TORRENT_VERSION_NAMESPACE_2_END
// include/libtorrent/alert.hpp
class alert;
// include/libtorrent/alert_types.hpp
struct dht_routing_bucket;
TORRENT_VERSION_NAMESPACE_2
struct torrent_alert;
struct peer_alert;
struct tracker_alert;
@ -121,7 +127,6 @@ struct torrent_log_alert;
struct peer_log_alert;
struct lsd_error_alert;
struct dht_lookup;
struct dht_routing_bucket;
struct dht_stats_alert;
struct incoming_request_alert;
struct dht_log_alert;
@ -134,10 +139,13 @@ struct dht_live_nodes_alert;
struct session_stats_header_alert;
struct dht_sample_infohashes_alert;
struct block_uploaded_alert;
TORRENT_VERSION_NAMESPACE_2_END
// include/libtorrent/announce_entry.hpp
struct announce_endpoint;
TORRENT_VERSION_NAMESPACE_2
struct announce_entry;
TORRENT_VERSION_NAMESPACE_2_END
// include/libtorrent/bdecode.hpp
struct bdecode_node;
@ -180,9 +188,29 @@ class hasher;
class hasher512;
// include/libtorrent/ip_filter.hpp
TORRENT_IPV6_NAMESPACE
struct ip_filter;
TORRENT_IPV6_NAMESPACE_END
class port_filter;
// include/libtorrent/kademlia/dht_settings.hpp
namespace dht {
struct dht_settings;
}
// include/libtorrent/kademlia/dht_state.hpp
namespace dht {
struct dht_state;
}
// include/libtorrent/kademlia/dht_storage.hpp
namespace dht {
struct dht_storage_counters;
}
namespace dht {
struct dht_storage_interface;
}
// include/libtorrent/peer_class.hpp
struct peer_class_info;
@ -194,7 +222,9 @@ struct peer_connection_handle;
struct bt_peer_connection_handle;
// include/libtorrent/peer_info.hpp
TORRENT_VERSION_NAMESPACE_2
struct peer_info;
TORRENT_VERSION_NAMESPACE_2_END
// include/libtorrent/peer_request.hpp
struct peer_request;
@ -226,8 +256,10 @@ struct storage_interface;
struct storage_params;
// include/libtorrent/torrent_handle.hpp
TORRENT_IPV6_NAMESPACE
struct block_info;
struct partial_piece_info;
TORRENT_IPV6_NAMESPACE_END
struct torrent_handle;
// include/libtorrent/torrent_info.hpp
@ -235,28 +267,18 @@ struct web_seed_entry;
class torrent_info;
// include/libtorrent/torrent_status.hpp
TORRENT_VERSION_NAMESPACE_2
struct torrent_status;
TORRENT_VERSION_NAMESPACE_2_END
namespace dht {
// include/libtorrent/kademlia/dht_settings.hpp
struct dht_settings;
// include/libtorrent/kademlia/dht_state.hpp
struct dht_state;
// include/libtorrent/kademlia/dht_storage.hpp
struct dht_storage_counters;
struct dht_storage_interface;
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// include/libtorrent/alert_types.hpp
TORRENT_VERSION_NAMESPACE_2
struct torrent_added_alert;
struct mmap_cache_alert;
struct torrent_update_alert;
TORRENT_VERSION_NAMESPACE_2_END
// include/libtorrent/file_storage.hpp
struct file_entry;
@ -269,7 +291,7 @@ struct lazy_entry;
// include/libtorrent/session_settings.hpp
struct pe_settings;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
}

View File

@ -50,7 +50,7 @@ namespace libtorrent {
// get the ``error_category`` for zip errors
TORRENT_EXPORT boost::system::error_category& gzip_category();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline boost::system::error_category& get_gzip_category()
{ return gzip_category(); }

View File

@ -65,7 +65,7 @@ namespace libtorrent {
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
TORRENT_DEPRECATED
inline void to_hex(char const* in, int len, char* out)

View File

@ -73,7 +73,7 @@ namespace libtorrent {
// returns the error category for I2P errors
TORRENT_EXPORT boost::system::error_category& i2p_category();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline boost::system::error_category& get_i2p_category()
{ return i2p_category(); }

View File

@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/optional.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@ -64,7 +64,7 @@ namespace aux {
TORRENT_DEPRECATED_EXPORT
std::string identify_client(const peer_id& p);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
@ -96,7 +96,7 @@ namespace aux {
#pragma warning(pop)
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
}

View File

@ -256,6 +256,8 @@ namespace detail {
}
TORRENT_IPV6_NAMESPACE
// The ``ip_filter`` class is a set of rules that uniquely categorizes all
// ip addresses as allowed or disallowed. The default constructor creates
// a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for
@ -320,6 +322,8 @@ private:
#endif
};
TORRENT_IPV6_NAMESPACE_END
// the port filter maps non-overlapping port ranges to flags. This
// is primarily used to indicate whether a range of ports should
// be connected to or not. The default is to have the full port

View File

@ -158,7 +158,7 @@ namespace dht {
// to clamp it in order to allow UDP packets go through
int max_infohashes_sample_count = 20;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the listen port for the dht. This is a UDP port. zero means use the
// same as the tcp interface
int service_port = 0;

View File

@ -78,7 +78,7 @@ namespace libtorrent { namespace dht {
//
struct TORRENT_EXPORT dht_storage_interface
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// This function returns the number of torrents tracked by
// the DHT at the moment. It's used to fill session_status.
// It's deprecated.

View File

@ -50,7 +50,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct counters;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct session_status;
#endif
}
@ -133,7 +133,7 @@ namespace libtorrent { namespace dht {
void direct_request(udp::endpoint const& ep, entry& e
, std::function<void(msg const&)> f);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void dht_status(session_status& s);
#endif
void dht_status(std::vector<dht_routing_bucket>& table

View File

@ -47,14 +47,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <libtorrent/kademlia/find_data.hpp>
#include <libtorrent/kademlia/item.hpp>
#include <libtorrent/fwd.hpp>
#include <libtorrent/socket.hpp> // for udp::endpoint
#include <libtorrent/string_view.hpp>
#include <libtorrent/aux_/listen_socket_handle.hpp>
namespace libtorrent {
struct counters;
struct dht_routing_bucket;
}
namespace libtorrent { namespace dht {
@ -112,7 +111,7 @@ public:
void unreachable(udp::endpoint const& ep);
void incoming(aux::listen_socket_handle const& s, msg const& m);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
int num_torrents() const { return int(m_storage.num_torrents()); }
int num_peers() const { return int(m_storage.num_peers()); }
#endif
@ -129,7 +128,7 @@ public:
std::int64_t num_global_nodes() const
{ return m_table.num_global_nodes(); }
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
int data_size() const { return int(m_storage.num_torrents()); }
#endif
@ -193,7 +192,7 @@ public:
std::tuple<int, int, int> get_stats_counters() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void status(libtorrent::session_status& s);
#endif

View File

@ -40,20 +40,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <tuple>
#include <array>
#include <libtorrent/fwd.hpp>
#include <libtorrent/kademlia/node_id.hpp>
#include <libtorrent/kademlia/node_entry.hpp>
#include <libtorrent/assert.hpp>
#include <libtorrent/time.hpp>
#include <libtorrent/aux_/vector.hpp>
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
struct session_status;
#endif
struct dht_routing_bucket;
}
namespace libtorrent { namespace dht {
struct dht_settings;
@ -148,7 +141,7 @@ public:
routing_table(routing_table const&) = delete;
routing_table& operator=(routing_table const&) = delete;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void status(session_status& s) const;
#endif

View File

@ -37,6 +37,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <set>
#include <memory>
#include <libtorrent/fwd.hpp>
#include <libtorrent/kademlia/node_id.hpp>
#include <libtorrent/kademlia/routing_table.hpp>
#include <libtorrent/kademlia/observer.hpp>
@ -46,8 +47,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct dht_lookup;
namespace dht {
class node;

View File

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_LAZY_ENTRY_HPP_INCLUDED
#define TORRENT_LAZY_ENTRY_HPP_INCLUDED
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include <utility>
#include <vector>
@ -408,6 +408,6 @@ namespace libtorrent {
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
#endif

View File

@ -52,7 +52,7 @@ namespace libtorrent {
TORRENT_EXPORT std::string make_magnet_uri(torrent_handle const& handle);
TORRENT_EXPORT std::string make_magnet_uri(torrent_info const& info);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifndef BOOST_NO_EXCEPTIONS
// deprecated in 0.14
TORRENT_DEPRECATED_EXPORT
@ -73,7 +73,7 @@ namespace libtorrent {
TORRENT_DEPRECATED_EXPORT
torrent_handle add_magnet_uri(session& ses, std::string const& uri
, add_torrent_params p, error_code& ec);
#endif
#endif // TORRENT_ABI_VERSION
// This function parses out information from the magnet link and populates the

View File

@ -140,7 +140,7 @@ namespace libtorrent {
// to its name. See peer_connection for the constants
TORRENT_EXPORT char const* operation_name(operation_t op);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
enum deprecated_operation_t : std::uint8_t
{
// the error was unexpected and it is unknown which operation caused it

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_PEER_CONNECTION_HANDLE_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/operations.hpp"
#include "libtorrent/alert_types.hpp"
@ -43,10 +44,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
class bt_peer_connection;
struct torrent_handle;
struct peer_plugin;
struct peer_info;
struct crypto_plugin;
struct TORRENT_EXPORT peer_connection_handle
{

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_PEER_CONNECTION_INTERFACE_HPP
#define TORRENT_PEER_CONNECTION_INTERFACE_HPP
#include "libtorrent/fwd.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/alert_types.hpp"
@ -42,7 +43,6 @@ namespace libtorrent {
struct torrent_peer;
class stat;
struct peer_info;
// TODO: make this interface smaller!
struct TORRENT_EXTRA_EXPORT peer_connection_interface

View File

@ -58,6 +58,8 @@ namespace libtorrent {
// direction
using bandwidth_state_flags_t = flags::bitfield_flag<std::uint8_t, struct bandwidth_state_flags_tag>;
TORRENT_VERSION_NAMESPACE_2
// holds information and statistics about one peer
// that libtorrent is connected to
struct TORRENT_EXPORT peer_info
@ -122,7 +124,7 @@ namespace libtorrent {
// being connected).
static constexpr peer_flags_t connecting = 7_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// The connection is currently queued for a connection
// attempt. This may happen if there is a limit set on
// the number of half-open TCP connections.
@ -313,12 +315,10 @@ namespace libtorrent {
// the kind of connection this peer uses. See connection_type_t.
int connection_type;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// an estimate of the rate this peer is downloading at, in
// bytes per second.
int remote_dl_rate;
#else
int deprecated_remote_dl_rate;
#endif
// the number of bytes this peer has pending in the disk-io thread.
@ -397,7 +397,7 @@ namespace libtorrent {
bandwidth_state_flags_t read_state;
bandwidth_state_flags_t write_state;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
static constexpr bandwidth_state_flags_t bw_torrent = bw_limit;
static constexpr bandwidth_state_flags_t bw_global = bw_limit;
@ -414,10 +414,11 @@ namespace libtorrent {
// have got this amount of free download.
std::int64_t load_balancing;
#endif
};
#ifndef TORRENT_NO_DEPRECATE
TORRENT_VERSION_NAMESPACE_2_END
#if TORRENT_ABI_VERSION == 1
// internal
struct TORRENT_EXTRA_EXPORT peer_list_entry
{

View File

@ -34,6 +34,8 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_POLICY_HPP_INCLUDED
#include <algorithm>
#include "libtorrent/fwd.hpp"
#include "libtorrent/string_util.hpp" // for allocate_string_copy
#include "libtorrent/request_blocks.hpp" // for source_rank
@ -53,8 +55,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct ip_filter;
class port_filter;
struct torrent_peer_allocator_interface;
// this object is used to communicate torrent state and

View File

@ -131,7 +131,7 @@ namespace libtorrent {
on_disk_queue_counter,
on_disk_counter,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
torrent_evicted_counter,
#endif

View File

@ -33,15 +33,13 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_READ_RESUME_DATA_HPP_INCLUDE
#define TORRENT_READ_RESUME_DATA_HPP_INCLUDE
#include "libtorrent/fwd.hpp"
#include "libtorrent/error_code.hpp"
#include "libtorrent/export.hpp"
#include "libtorrent/span.hpp"
namespace libtorrent {
struct add_torrent_params;
struct bdecode_node;
// these functions are used to parse resume data and populate the appropriate
// fields in an add_torrent_params object. This object can then be used to add
// the actual torrent_info object to and pass to session::add_torrent() or

View File

@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <thread>
#include "libtorrent/config.hpp"
#include "libtorrent/build_config.hpp"
#include "libtorrent/io_service.hpp"
#include "libtorrent/settings_pack.hpp"
#include "libtorrent/session_handle.hpp"
@ -44,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/kademlia/dht_state.hpp"
#include "libtorrent/kademlia/dht_storage.hpp"
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/fingerprint.hpp"
#include <cstdio> // for snprintf
#endif
@ -78,7 +77,7 @@ namespace libtorrent {
// upload rates by allowing large send buffers.
TORRENT_EXPORT settings_pack min_memory_usage();
TORRENT_EXPORT settings_pack high_performance_seed();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline void min_memory_usage(settings_pack& set)
{ set = min_memory_usage(); }
@ -87,16 +86,10 @@ namespace libtorrent {
{ set = high_performance_seed(); }
#endif
#ifndef TORRENT_CFG
#error TORRENT_CFG is not defined!
#endif
void TORRENT_EXPORT TORRENT_CFG();
namespace aux {
struct session_impl;
}
struct session_impl;
}
struct disk_interface;
struct counters;
@ -187,7 +180,6 @@ namespace aux {
// will take effect before the session starts up.
explicit session(session_params params = session_params())
{
TORRENT_CFG();
start(std::move(params), nullptr);
}
@ -206,7 +198,6 @@ namespace aux {
// destruct the session_proxy object.
session(session_params params, io_service& ios)
{
TORRENT_CFG();
start(std::move(params), &ios);
}
@ -224,7 +215,6 @@ namespace aux {
session(settings_pack pack
, session_flags_t const flags = start_default_features | add_default_plugins)
{
TORRENT_CFG();
start(flags, std::move(pack), nullptr);
}
@ -253,11 +243,10 @@ namespace aux {
, io_service& ios
, session_flags_t const flags = start_default_features | add_default_plugins)
{
TORRENT_CFG();
start(flags, std::move(pack), &ios);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
@ -275,7 +264,6 @@ namespace aux {
, session_flags_t const flags = start_default_features | add_default_plugins
, alert_category_t const alert_mask = alert::error_notification)
{
TORRENT_CFG();
settings_pack pack;
pack.set_int(settings_pack::alert_mask, int(alert_mask));
pack.set_str(settings_pack::peer_fingerprint, print.to_string());
@ -297,7 +285,6 @@ namespace aux {
, session_flags_t const flags = start_default_features | add_default_plugins
, alert_category_t const alert_mask = alert::error_notification)
{
TORRENT_CFG();
TORRENT_ASSERT(listen_port_range.first > 0);
TORRENT_ASSERT(listen_port_range.first <= listen_port_range.second);
@ -329,7 +316,7 @@ namespace aux {
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// The destructor of session will notify all trackers that our torrents
// have been shut down. If some trackers are down, they will time out.

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_SESSION_HANDLE_HPP_INCLUDED
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/add_torrent_params.hpp"
@ -50,22 +51,16 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/kademlia/dht_storage.hpp"
#include "libtorrent/kademlia/dht_settings.hpp"
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/session_settings.hpp"
#include <deque>
#endif
namespace libtorrent {
struct plugin;
struct torrent_plugin;
class torrent;
struct ip_filter;
class port_filter;
class alert;
struct settings_pack;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct session_status;
using user_load_function_t = std::function<void(sha1_hash const&
, std::vector<char>&, error_code&)>;
@ -95,7 +90,7 @@ namespace libtorrent {
// joining the DHT if provided at next session startup.
static constexpr save_state_flags_t save_dht_state = 2_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// save pe_settings
static constexpr save_state_flags_t TORRENT_DEPRECATED_MEMBER save_encryption_settings = 3_bit;
static constexpr save_state_flags_t TORRENT_DEPRECATED_MEMBER save_as_map = 4_bit;
@ -223,7 +218,7 @@ namespace libtorrent {
void async_add_torrent(add_torrent_params params);
#ifndef BOOST_NO_EXCEPTIONS
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 0.14
TORRENT_DEPRECATED
torrent_handle add_torrent(
@ -246,7 +241,7 @@ namespace libtorrent {
, bool paused = false
, storage_constructor_type sc = default_storage_constructor
, void* userdata = nullptr);
#endif
#endif // TORRENT_ABI_VERSION
#endif
// Pausing the session has the same effect as pausing every torrent in
@ -259,7 +254,7 @@ namespace libtorrent {
void resume();
bool is_paused() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// *the feature of dynamically loading/unloading torrents is deprecated
// and discouraged*
//
@ -310,7 +305,7 @@ namespace libtorrent {
void get_torrent_status(std::vector<torrent_status>* ret
, std::function<bool(torrent_status const&)> const& pred
, status_flags_t flags = {}) const;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
enum { disk_cache_no_pieces = 1 };
@ -319,7 +314,7 @@ namespace libtorrent {
// will not be set. This may significantly reduce the cost of this call.
void get_cache_info(cache_status* ret, torrent_handle h = torrent_handle(), int flags = 0) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``start_dht`` starts the dht node and makes the trackerless service
// available to torrents.
//
@ -362,7 +357,7 @@ namespace libtorrent {
// the routing table.
void add_dht_node(std::pair<std::string, int> const& node);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated, use settings_pack::dht_bootstrap_nodes instead
//
// ``add_dht_router`` adds the given endpoint to a list of DHT router
@ -466,7 +461,7 @@ namespace libtorrent {
// posted, regardless of the alert mask.
void dht_direct_request(udp::endpoint const& ep, entry const& e, void* userdata = nullptr);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 0.15
// use save_state and load_state instead
TORRENT_DEPRECATED
@ -516,7 +511,7 @@ namespace libtorrent {
torrent_handle const&, void*)> ext);
void add_extension(std::shared_ptr<plugin> ext);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// GeoIP support has been removed from libtorrent internals. If you
// still need to resolve peers, please do so on the client side, using
// libgeoip directly. This was removed in libtorrent 1.1
@ -556,7 +551,7 @@ namespace libtorrent {
TORRENT_DEPRECATED
void load_state(lazy_entry const& ses_state
, save_state_flags_t flags = save_state_flags_t::all());
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// Sets a filter that will be used to reject and accept incoming as well
// as outgoing connections based on their originating ip address. The
@ -575,7 +570,7 @@ namespace libtorrent {
// anti-virus software by connecting to SMTP, FTP ports.
void set_port_filter(port_filter const& f);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.1, use settings_pack::peer_fingerprint instead
TORRENT_DEPRECATED
void set_peer_id(peer_id const& pid);
@ -585,7 +580,7 @@ namespace libtorrent {
peer_id id() const;
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// sets the key sent to trackers. If it's not set, it is initialized
// by libtorrent. The key may be used by the tracker to identify the
@ -713,7 +708,7 @@ namespace libtorrent {
peer_class_info get_peer_class(peer_class_t cid) const;
void set_peer_class(peer_class_t cid, peer_class_info const& pci);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// if the listen port failed in some way you can retry to listen on
// another port- range with this function. If the listener succeeded and
// is currently listening, a call to this function will shut down the
@ -780,7 +775,7 @@ namespace libtorrent {
// shifting.
void remove_torrent(const torrent_handle& h, remove_flags_t options = {});
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in libtorrent 1.1. use settings_pack instead
TORRENT_DEPRECATED
void set_pe_settings(pe_settings const& settings);
@ -794,7 +789,7 @@ namespace libtorrent {
void apply_settings(settings_pack s);
settings_pack get_settings() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``set_i2p_proxy`` sets the i2p_ proxy, and tries to open a persistent
// connection to it. The only used fields in the proxy settings structs
// are ``hostname`` and ``port``.
@ -954,7 +949,7 @@ namespace libtorrent {
void set_alert_notify(std::function<void()> const& fun);
dropped_alerts_t dropped_alerts();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/aux_/disable_warnings_push.hpp"
TORRENT_DEPRECATED

View File

@ -33,7 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_SESSION_SETTINGS_HPP_INCLUDED
#define TORRENT_SESSION_SETTINGS_HPP_INCLUDED
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/config.hpp"
#include "libtorrent/settings_pack.hpp"
@ -109,5 +109,5 @@ namespace libtorrent {
};
}
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
#endif

View File

@ -36,14 +36,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include <vector>
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// for dht_lookup and dht_routing_bucket
#include "libtorrent/alert_types.hpp"
#endif
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// holds counters and gauges for the uTP sockets
// deprecated in 1.1 in favor of session_stats counters, which is a more
// flexible, extensible and performant mechanism for stats.
@ -224,7 +224,7 @@ namespace libtorrent {
int num_torrents;
int num_paused_torrents;
};
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
}

View File

@ -135,7 +135,7 @@ namespace libtorrent {
// omitted.
announce_ip,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``mmap_cache`` may be set to a filename where the disk cache will
// be mmapped to. This could be useful, for instance, to map the disk
// cache from regular rotating hard drives onto an SSD drive. Doing
@ -251,7 +251,7 @@ namespace libtorrent {
// in a swarm has the same IP address.
allow_multiple_connections_per_ip = bool_type_base,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// if set to true, upload, download and unchoke limits are ignored for
// peers on the local network. This option is *DEPRECATED*, please use
// set_peer_class_filter() instead.
@ -265,7 +265,7 @@ namespace libtorrent {
// but it might be necessary for collecting statistics in some cases.
send_redundant_have,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// if this is true, outgoing bitfields will never be fuil. If the
// client is seed, a few bits will be set to 0, and later filled in
// with have messages. This is to prevent certain ISPs from stopping
@ -301,7 +301,7 @@ namespace libtorrent {
// reading blocks back from the disk multiple times for popular
// pieces.
use_read_cache,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
use_write_cache TORRENT_DEPRECATED_ENUM,
// this will make the disk cache never flush a write piece if it would
@ -374,7 +374,7 @@ namespace libtorrent {
// out. This is the traditional definition of super seeding.
strict_super_seeding,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// if this is set to true, the memory allocated for the disk cache
// will be locked in physical RAM, never to be swapped out. Every time
// a disk buffer is allocated and freed, there will be the extra
@ -397,7 +397,7 @@ namespace libtorrent {
// to connect to i2p peers.
allow_i2p_mixed,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``low_prio_disk`` determines if the disk I/O should use a normal or
// low priority policy. This defaults to true, which means that it's
// low priority by default. Other processes doing disk I/O will
@ -418,7 +418,7 @@ namespace libtorrent {
// place.
volatile_read_cache,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``guided_read_cache`` enables the disk cache to adjust the size of
// a cache line generated by peers to depend on the upload rate you
// are sending to that peer. The intention is to optimize the RAM
@ -478,7 +478,7 @@ namespace libtorrent {
enable_outgoing_tcp,
enable_incoming_tcp,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``ignore_resume_timestamps`` determines if the storage, when
// loading resume data files, should verify that the file modification
// time with the timestamps in the resume data. This defaults to
@ -523,7 +523,7 @@ namespace libtorrent {
// libtorrent API.
report_web_seed_downloads,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// set to true if uTP connections should be rate limited This option
// is *DEPRECATED*, please use set_peer_class_filter() instead.
rate_limit_utp TORRENT_DEPRECATED_ENUM,
@ -531,7 +531,7 @@ namespace libtorrent {
deprecated2,
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// if this is true, the ``&ip=`` argument in tracker requests (unless
// otherwise specified) will be set to the intermediate IP address if
// the user is double NATed. If the user is not double NATed, this
@ -574,7 +574,7 @@ namespace libtorrent {
// is one). If no IP filter is set, this setting is irrelevant.
apply_ip_filter_to_trackers,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``use_disk_read_ahead`` defaults to true and will attempt to
// optimize disk reads by giving the operating system heads up of disk
// read requests as they are queued in the disk job queue.
@ -583,7 +583,7 @@ namespace libtorrent {
deprecated19,
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``lock_files`` determines whether or not to lock files which
// libtorrent is downloading to or seeding from. This is implemented
// using ``fcntl(F_SETLK)`` on unix systems and by not passing in
@ -595,7 +595,7 @@ namespace libtorrent {
deprecated26,
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``contiguous_recv_buffer`` determines whether or not libtorrent
// should receive data from peers into a contiguous intermediate
// buffer, to then copy blocks into disk buffers from, or to make many
@ -647,7 +647,7 @@ namespace libtorrent {
// failure is preferred, set this to false.
listen_system_port_fallback,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``use_disk_cache_pool`` enables using a pool allocator for disk
// cache blocks. Enabling it makes the cache perform better at high
// throughput. It also makes the cache less likely and slower at
@ -986,7 +986,7 @@ namespace libtorrent {
// On 32 bit builds, the effective cache size will be limited to 3/4 of
// 2 GiB to avoid exceeding the virtual address space limit.
cache_size,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
cache_buffer_chunk_size,
#else
deprecated25,
@ -1089,7 +1089,7 @@ namespace libtorrent {
active_lsd_limit,
active_limit,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``active_loaded_limit`` is the number of torrents that are allowed
// to be *loaded* at any given time. Note that a torrent can be active
// even though it's not loaded. If an unloaded torrents finds a peer
@ -1177,7 +1177,7 @@ namespace libtorrent {
// allowed to grow to.
max_peer_recv_buffer_size,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``file_checks_delay_per_block`` is the number of milliseconds to
// sleep in between disk read operations when checking torrents. This
// defaults to 0, but can be set to higher numbers to slow down the
@ -1237,7 +1237,7 @@ namespace libtorrent {
// to match the expiration time for tokens.
udp_tracker_token_expiry,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``default_cache_min_age`` is the minimum number of seconds any read
// cache line is kept in the cache. This defaults to one second but
// may be greater if ``guided_read_cache`` is enabled. Having a lower
@ -1313,7 +1313,7 @@ namespace libtorrent {
// to local peers, see peer-classes_.
upload_rate_limit,
download_rate_limit,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
local_upload_rate_limit TORRENT_DEPRECATED_ENUM,
local_download_rate_limit TORRENT_DEPRECATED_ENUM,
#else
@ -1321,7 +1321,7 @@ namespace libtorrent {
deprecated4,
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``dht_upload_rate_limit`` sets the rate limit on the DHT. This is
// specified in bytes per second and defaults to 4000. For busy boxes
// with lots of torrents that requires more DHT traffic, this should
@ -1336,7 +1336,7 @@ namespace libtorrent {
// what ``choking_algorithm`` is set to.
unchoke_slots_limit,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``half_open_limit`` sets the maximum number of half-open
// connections libtorrent will have when connecting to peers. A
// half-open connection is one where connect() has been called, but
@ -1404,7 +1404,7 @@ namespace libtorrent {
utp_fin_resends,
utp_num_resends,
utp_connect_timeout,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
utp_delayed_ack TORRENT_DEPRECATED_ENUM,
#else
deprecated6,
@ -1455,7 +1455,7 @@ namespace libtorrent {
// received by the metadata extension, i.e. magnet links.
max_metadata_size,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// DEPRECATED: use aio_threads instead
// ``hashing_threads`` is the number of threads to use for piece hash
@ -1499,7 +1499,7 @@ namespace libtorrent {
// SSL encryption as well.
network_threads,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ``ssl_listen`` sets the listen port for SSL connections. If this is
// set to 0, no SSL listen port is opened. Otherwise a socket is
// opened on this port. This setting is only taken into account when
@ -1690,7 +1690,7 @@ namespace libtorrent {
enum io_buffer_mode_t
{
enable_os_cache = 0,
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
disable_os_cache_for_aligned_files TORRENT_DEPRECATED_ENUM = 2,
#else
deprecated = 1,

View File

@ -108,7 +108,7 @@ namespace aux {
if (s == nullptr) clear();
else std::memcpy(m_number.data(), s, size());
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
explicit digest32(std::string const& s)
{

View File

@ -72,7 +72,7 @@ namespace socks_error {
// returns the error_category for SOCKS5 errors
TORRENT_EXPORT boost::system::error_category& socks_category();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline boost::system::error_category& get_socks_category()
{ return socks_category(); }

View File

@ -39,6 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <atomic>
#include <memory>
#include "libtorrent/fwd.hpp"
#include "libtorrent/aux_/disk_job_fence.hpp"
#include "libtorrent/aux_/storage_piece_set.hpp"
#include "libtorrent/storage_defs.hpp"
@ -127,9 +128,7 @@ POSSIBILITY OF SUCH DAMAGE.
// }
namespace libtorrent {
struct file_pool;
namespace aux { struct session_settings; }
struct add_torrent_params;
// The storage interface is a pure virtual class that can be implemented to
// customize how and where data for a torrent is stored. The default storage

View File

@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_STORAGE_DEFS_HPP_INCLUDE
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/units.hpp"
#include "libtorrent/aux_/vector.hpp"
#include "libtorrent/sha1_hash.hpp"
@ -44,9 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct TORRENT_EXPORT storage_interface;
class file_storage;
struct file_pool;
class torrent_info;
using storage_index_t = aux::strong_typedef<std::uint32_t, struct storage_index_tag_t>;
@ -93,7 +91,7 @@ namespace libtorrent {
dont_replace
};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
enum deprecated_move_flags_t
{

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <limits> // for numeric_limits
#include <memory> // for unique_ptr
#include "libtorrent/fwd.hpp"
#include "libtorrent/optional.hpp"
#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/entry.hpp"
@ -100,14 +101,7 @@ namespace ssl {
namespace libtorrent {
class http_parser;
struct storage_interface;
struct torrent_plugin;
template <typename Index> struct typed_bitfield;
struct announce_entry;
struct tracker_request;
struct add_torrent_params;
struct storage_interface;
class bt_peer_connection;
peer_id generate_peer_id(aux::session_settings const& sett);
@ -353,7 +347,10 @@ namespace libtorrent {
update_gauge();
}
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
void start_download_url();
#endif
// returns which stats gauge this torrent currently
// has incremented.
@ -554,11 +551,11 @@ namespace libtorrent {
bool delete_files(remove_flags_t options);
void peers_erased(std::vector<torrent_peer*> const& peers);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#if !TORRENT_NO_FPU
void file_progress_float(aux::vector<float, file_index_t>& fp);
#endif
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
void piece_availability(aux::vector<int, piece_index_t>& avail) const;
@ -590,7 +587,7 @@ namespace libtorrent {
void file_progress(aux::vector<std::int64_t, file_index_t>& fp, int flags = 0);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void use_interface(std::string net_interface);
#endif
@ -598,9 +595,9 @@ namespace libtorrent {
bool connect_to_peer(torrent_peer* peerinfo, bool ignore_limit = false);
int priority() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void set_priority(int prio);
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// --------------------------------------------
// BANDWIDTH MANAGEMENT
@ -697,7 +694,7 @@ namespace libtorrent {
peer_iterator begin() { return m_connections.begin(); }
peer_iterator end() { return m_connections.end(); }
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void get_full_peer_list(std::vector<peer_list_entry>* v) const;
#endif
void get_peer_info(std::vector<peer_info>* v);
@ -729,7 +726,7 @@ namespace libtorrent {
void update_scrape_state();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// if no password and username is set
// this will return an empty string, otherwise
// it will concatenate the login and password
@ -756,7 +753,7 @@ namespace libtorrent {
void dht_announce();
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// sets the username and password that will be sent to
// the tracker
void set_tracker_login(std::string const& name, std::string const& pw);
@ -986,7 +983,7 @@ namespace libtorrent {
std::shared_ptr<const torrent_info> get_torrent_copy();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
std::string const& uuid() const { return m_uuid; }
void set_uuid(std::string const& s) { m_uuid = s; }
@ -1058,7 +1055,7 @@ namespace libtorrent {
// a return value of false indicates an error
bool set_metadata(span<char const> metadata);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
void on_torrent_download(error_code const& ec, http_parser const& parser
, span<char const> data);
#endif
@ -1273,7 +1270,7 @@ namespace libtorrent {
std::vector<time_critical_piece> m_time_critical_pieces;
std::string m_trackerid;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.1
std::string m_username;
std::string m_password;
@ -1281,7 +1278,7 @@ namespace libtorrent {
std::string m_save_path;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// if we don't have the metadata, this is a url to
@ -1661,7 +1658,7 @@ namespace libtorrent {
// is optional and may be 0xffffff
std::uint32_t m_downloaded:24;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the timestamp of the last scrape request to one of the trackers in
// this torrent specified in session_time. This is signed because it must
// be able to represent time before the session started

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_TORRENT_FLAGS_HPP
#define TORRENT_TORRENT_FLAGS_HPP
#include "libtorrent/config.hpp"
#include "libtorrent/flags.hpp"
namespace libtorrent {
@ -41,7 +42,7 @@ using torrent_flags_t = flags::bitfield_flag<std::uint64_t, struct torrent_flags
namespace torrent_flags {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/aux_/disable_warnings_push.hpp"
#endif
@ -194,7 +195,7 @@ namespace torrent_flags {
// This flag is cleared by a successful call to save_resume_data()
constexpr torrent_flags_t need_save_resume = 13_bit;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// indicates that this torrent should never be unloaded from RAM, even
// if unloading torrents are allowed in general. Setting this makes
// the torrent exempt from loading/unloading management.
@ -247,14 +248,14 @@ namespace torrent_flags {
| torrent_flags::paused
| torrent_flags::apply_ip_filter
| torrent_flags::need_save_resume
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
| torrent_flags::pinned
| torrent_flags::merge_resume_http_seeds
| torrent_flags::merge_resume_trackers
#endif
;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#endif

View File

@ -41,12 +41,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <memory>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// for deprecated force_reannounce
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#endif
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/socket.hpp" // tcp::endpoint
#include "libtorrent/span.hpp"
@ -62,23 +63,12 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
namespace aux {
struct session_impl;
}
class entry;
struct open_file_state;
struct announce_entry;
class torrent_info;
struct torrent_plugin;
struct peer_info;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
struct peer_list_entry;
#endif
struct torrent_status;
struct torrent_handle;
struct storage_interface;
class torrent;
#ifndef BOOST_NO_EXCEPTIONS
@ -92,6 +82,8 @@ namespace aux {
using resume_data_flags_t = flags::bitfield_flag<std::uint8_t, struct resume_data_flags_tag>;
using queue_position_t = aux::strong_typedef<int, struct queue_position_tag>;
TORRENT_IPV6_NAMESPACE
// holds the state of a block in a piece. Who we requested
// it from and how far along we are at downloading it.
struct TORRENT_EXPORT block_info
@ -168,7 +160,7 @@ namespace aux {
// or outstanding writes
struct TORRENT_EXPORT partial_piece_info
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#include "libtorrent/aux_/disable_warnings_push.hpp"
partial_piece_info() = default;
partial_piece_info(partial_piece_info&&) noexcept = default;
@ -203,7 +195,7 @@ namespace aux {
// get_download_queue() is called, it will be invalidated.
block_info* blocks;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the speed classes. These may be used by the piece picker to
// coalesce requests of similar download rates
enum state_t { none, slow, medium, fast };
@ -221,13 +213,11 @@ namespace aux {
// any of ``fast``, ``medium`` or ``slow`` as soon as a peer want to
// download from it.
state_t TORRENT_DEPRECATED_MEMBER piece_state;
#else
// hidden
enum deprecated_state_t { none, slow, medium, fast };
deprecated_state_t deprecated_piece_state;
#endif
};
TORRENT_IPV6_NAMESPACE_END
// for std::hash (and to support using this type in unordered_map etc.)
TORRENT_EXPORT std::size_t hash_value(torrent_handle const& h);
@ -310,7 +300,7 @@ namespace aux {
// otherwise.
bool have_piece(piece_index_t piece) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// internal
TORRENT_DEPRECATED
void get_full_peer_list(std::vector<peer_list_entry>& v) const;
@ -397,7 +387,7 @@ namespace aux {
void reset_piece_deadline(piece_index_t index) const;
void clear_piece_deadlines() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// This sets the bandwidth priority of this torrent. The priority of a
// torrent determines how much bandwidth its peers are assigned when
// distributing upload and download rate quotas. A high number gives more
@ -539,7 +529,7 @@ namespace aux {
// affect the torrent, and false will be returned.
bool set_metadata(span<char const> metadata) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
bool set_metadata(char const* metadata, int size) const
{ return set_metadata({metadata, size_t(size)}); }
@ -850,7 +840,7 @@ namespace aux {
// info-hash.
std::shared_ptr<const torrent_info> torrent_file() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ================ start deprecation ============
@ -984,7 +974,7 @@ namespace aux {
void prioritize_pieces(std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;
std::vector<download_priority_t> get_piece_priorities() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
void prioritize_pieces(std::vector<int> const& pieces) const;
TORRENT_DEPRECATED
@ -1020,7 +1010,7 @@ namespace aux {
void prioritize_files(std::vector<download_priority_t> const& files) const;
std::vector<download_priority_t> get_file_priorities() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
void prioritize_files(std::vector<int> const& files) const;
TORRENT_DEPRECATED
@ -1044,7 +1034,7 @@ namespace aux {
void force_reannounce(int seconds = 0, int tracker_index = -1) const;
void force_dht_announce() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// forces a reannounce in the specified amount of time.
// This overrides the default announce interval, and no
// announce will take place until the given time has
@ -1135,7 +1125,7 @@ namespace aux {
void set_max_connections(int max_connections) const;
int max_connections() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// sets a username and password that will be sent along in the HTTP-request
// of the tracker announce. Set this if the tracker requires authorization.
TORRENT_DEPRECATED
@ -1190,7 +1180,7 @@ namespace aux {
, move_flags_t flags = move_flags_t::always_replace_files
) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
TORRENT_DEPRECATED
void move_storage(std::string const& save_path, int flags) const;
@ -1201,7 +1191,7 @@ namespace aux {
// file_rename_failed_alert is posted.
void rename_file(file_index_t index, std::string const& new_name) const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
@ -1214,7 +1204,7 @@ namespace aux {
// The torrent needs to be a seed for this to take effect.
TORRENT_DEPRECATED
void super_seeding(bool on) const;
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// ``info_hash()`` returns the info-hash of the torrent. If this handle
// is to a torrent that hasn't loaded yet (for instance by being added)

View File

@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/disable_warnings_pop.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/bdecode.hpp"
#include "libtorrent/time.hpp"
#include "libtorrent/assert.hpp"
@ -58,8 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
class peer_connection;
class entry;
struct announce_entry;
struct lazy_entry;
// internal, exposed for the unit test
@ -171,7 +170,7 @@ namespace libtorrent {
torrent_info(span<char const> buffer, error_code& ec, from_span_t);
torrent_info(std::string const& filename, error_code& ec);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifndef BOOST_NO_EXCEPTIONS
TORRENT_DEPRECATED
torrent_info(char const* buffer, int size, int)
@ -196,7 +195,7 @@ namespace libtorrent {
torrent_info(std::wstring const& filename, error_code& ec);
TORRENT_DEPRECATED
explicit torrent_info(std::wstring const& filename);
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// frees all storage associated with this torrent_info object
~torrent_info();
@ -243,13 +242,13 @@ namespace libtorrent {
copy_on_write();
m_files.rename_file(index, new_filename);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// all wstring APIs are deprecated since 0.16.11
// instead, use the wchar -> utf8 conversion functions
// and pass in utf8 strings
TORRENT_DEPRECATED
void rename_file(file_index_t index, std::wstring const& new_filename);
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// Remaps the file storage to a new file layout. This can be used to, for
// instance, download all data in a torrent to a single file, or to a
@ -281,7 +280,7 @@ namespace libtorrent {
std::vector<sha1_hash> similar_torrents() const;
std::vector<std::string> collections() const;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 0.16. Use web_seeds() instead
TORRENT_DEPRECATED
std::vector<std::string> url_seeds() const;
@ -291,7 +290,7 @@ namespace libtorrent {
// deprecated in 1.1
TORRENT_DEPRECATED
bool parse_info_section(lazy_entry const& e, error_code& ec);
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// ``web_seeds()`` returns all url seeds and http seeds in the torrent.
// Each entry is a ``web_seed_entry`` and may refer to either a url seed
@ -348,7 +347,7 @@ namespace libtorrent {
// returns the info-hash of the torrent
const sha1_hash& info_hash() const { return m_info_hash; }
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.0. Use the variants that take an index instead
// internal_file_entry is no longer exposed in the API
using file_iterator = file_storage::iterator;
@ -377,7 +376,7 @@ namespace libtorrent {
TORRENT_DEPRECATED
file_entry file_at(int index) const { return m_files.at_deprecated(index); }
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
// If you need index-access to files you can use the ``num_files()`` along
// with the ``file_path()``, ``file_size()``-family of functions to access
@ -408,7 +407,7 @@ namespace libtorrent {
return m_files.map_file(file, offset, size);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// ------- start deprecation -------
// deprecated in 1.2
void load(char const*, int, error_code&) {}

View File

@ -48,18 +48,20 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
#endif
TORRENT_VERSION_NAMESPACE_2
// holds a snapshot of the status of a torrent, as queried by
// torrent_handle::status().
struct TORRENT_EXPORT torrent_status
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
@ -83,7 +85,7 @@ namespace libtorrent {
// the different overall states a torrent can be in
enum state_t
{
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// The torrent is in the queue for being checked. But there
// currently is another torrent that are being checked.
// This torrent will wait for its turn.
@ -128,11 +130,8 @@ namespace libtorrent {
checking_resume_data
};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
std::string error;
#else
// internal
std::string _dummy_string_;
#endif
// may be set to an error code describing why the torrent was paused, in
@ -152,7 +151,7 @@ namespace libtorrent {
// the error occurred setting up the SSL context
static constexpr file_index_t error_file_ssl_ctx{-3};
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the error occurred while loading the .torrent file via the user
// supplied load function
static constexpr file_index_t TORRENT_DEPRECATED error_file_metadata{-4};
@ -191,13 +190,10 @@ namespace libtorrent {
// the time until the torrent will announce itself to the tracker.
time_duration next_announce = seconds(0);
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the time the tracker want us to wait until we announce ourself
// again the next time.
time_duration announce_interval;
#else
// hidden
time_duration deprecated_announce_interval_;
#endif
// the URL of the last working tracker. If no tracker request has
@ -411,7 +407,7 @@ namespace libtorrent {
int up_bandwidth_queue = 0;
int down_bandwidth_queue = 0;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// use last_upload, last_download or
// seeding_duration, finished_duration and active_duration
@ -436,12 +432,6 @@ namespace libtorrent {
int TORRENT_DEPRECATED_MEMBER active_time = 0;
int TORRENT_DEPRECATED_MEMBER finished_time = 0;
int TORRENT_DEPRECATED_MEMBER seeding_time = 0;
#else
int deprecated_time_since_upload = 0;
int deprecated_time_since_download = 0;
int deprecated_active_time = 0;
int deprecated_finished_time = 0;
int deprecated_seeding_time = 0;
#endif
// A rank of how important it is to seed the torrent, it is used to
@ -450,22 +440,17 @@ namespace libtorrent {
// see queuing_. Higher value means more important to seed
int seed_rank = 0;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// deprecated in 1.2
// the number of seconds since this torrent acquired scrape data.
// If it has never done that, this value is -1.
int TORRENT_DEPRECATED_MEMBER last_scrape = 0;
#else
int deprecated_last_scrape = 0;
#endif
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// the priority of this torrent
int TORRENT_DEPRECATED_MEMBER priority = 0;
#else
// hidden
int deprecated_priority = 0;
#endif
// the main state the torrent is in. See torrent_status::state_t.
@ -476,7 +461,7 @@ namespace libtorrent {
// was saved.
bool need_save_resume = false;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// true if the session global IP filter applies
// to this torrent. This defaults to true.
bool TORRENT_DEPRECATED_MEMBER ip_filter_applies = false;
@ -512,15 +497,6 @@ namespace libtorrent {
// true when the torrent is in sequential download mode. In this mode
// pieces are downloaded in order rather than rarest first.
bool TORRENT_DEPRECATED_MEMBER sequential_download = false;
#else
// hidden
bool deprecated_ip_filter_applies = false;
bool deprecated_upload_mode = false;
bool deprecated_share_mode = false;
bool deprecated_super_seeding = false;
bool deprecated_paused = false;
bool deprecated_auto_managed = false;
bool deprecated_sequential_download = false;
#endif
// true if all pieces have been downloaded.
@ -542,14 +518,11 @@ namespace libtorrent {
// torrent.
bool has_incoming = false;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// true if the torrent is in seed_mode. If the torrent was started in
// seed mode, it will leave seed mode once all pieces have been checked
// or as soon as one piece fails the hash check.
bool TORRENT_DEPRECATED_MEMBER seed_mode = false;
#else
// hidden
bool deprecated_seed_mode = false;
#endif
// this is true if this torrent's storage is currently being moved from
@ -557,14 +530,11 @@ namespace libtorrent {
// if a large file ends up being copied from one drive to another.
bool moving_storage = false;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// true if this torrent is loaded into RAM. A torrent can be started
// and still not loaded into RAM, in case it has not had any peers interested in it
// yet. Torrents are loaded on demand.
bool TORRENT_DEPRECATED_MEMBER is_loaded = false;
#else
// hidden
bool deprecated_is_loaded;
#endif
// these are set to true if this torrent is allowed to announce to the
@ -575,14 +545,11 @@ namespace libtorrent {
bool announcing_to_lsd = false;
bool announcing_to_dht = false;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
// this reflects whether the ``stop_when_ready`` flag is currently enabled
// on this torrent. For more information, see
// torrent_handle::stop_when_ready().
bool TORRENT_DEPRECATED_MEMBER stop_when_ready = false;
#else
// hidden
bool deprecated_stop_when_ready = false;
#endif
// the info-hash for this torrent
@ -599,6 +566,8 @@ namespace libtorrent {
// information, see ``torrent_handle::flags()``.
torrent_flags_t flags{};
};
TORRENT_VERSION_NAMESPACE_2_END
}
namespace std

View File

@ -57,6 +57,7 @@ namespace ssl {
#endif
#include "libtorrent/socket.hpp"
#include "libtorrent/fwd.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/peer.hpp" // peer_entry
@ -72,14 +73,12 @@ namespace ssl {
namespace libtorrent {
struct request_callback;
class tracker_manager;
struct timeout_handler;
class udp_tracker_connection;
class http_tracker_connection;
struct resolver_interface;
struct counters;
struct ip_filter;
#if TORRENT_USE_I2P
class i2p_connection;
#endif
@ -123,7 +122,7 @@ namespace libtorrent {
std::string url;
std::string trackerid;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
std::string auth;
#endif

View File

@ -38,6 +38,8 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
TORRENT_IPV6_NAMESPACE
struct union_address
{
union_address() { *this = address(); }
@ -124,6 +126,7 @@ namespace libtorrent {
union_address addr;
std::uint16_t port;
};
TORRENT_IPV6_NAMESPACE_END
}
#endif

View File

@ -55,7 +55,7 @@ namespace libtorrent { namespace aux {
constexpr strong_typedef(strong_typedef const& rhs) noexcept = default;
constexpr strong_typedef(strong_typedef&& rhs) noexcept = default;
strong_typedef() noexcept = default;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
constexpr strong_typedef(UnderlyingType val) : m_val(val) {}
constexpr operator UnderlyingType() const { return m_val; }
#else

View File

@ -95,7 +95,7 @@ namespace libtorrent {
// the boost.system error category for UPnP errors
TORRENT_EXPORT boost::system::error_category& upnp_category();
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_DEPRECATED
inline boost::system::error_category& get_upnp_category()
{ return upnp_category(); }

View File

@ -33,15 +33,14 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_WRITE_RESUME_DATA_HPP_INCLUDE
#define TORRENT_WRITE_RESUME_DATA_HPP_INCLUDE
#include "libtorrent/error_code.hpp"
#include <vector>
#include "libtorrent/fwd.hpp"
#include "libtorrent/export.hpp"
#include "libtorrent/bencode.hpp"
namespace libtorrent {
struct add_torrent_params;
class entry;
// this function turns the resume data in an ``add_torrent_params`` object
// into a bencoded structure
TORRENT_EXPORT entry write_resume_data(add_torrent_params const& atp);

View File

@ -37,18 +37,13 @@ POSSIBILITY OF SUCH DAMAGE.
#include <vector>
#include "libtorrent/kademlia/dht_settings.hpp" // for dht_settings
#include "libtorrent/performance_counters.hpp" // for counters
#include "libtorrent/alert_types.hpp" // for dht_routing_bucket
namespace sim
{
struct simulation;
}
namespace libtorrent
{
struct dht_routing_bucket;
}
struct dht_node;
void print_routing_table(std::vector<lt::dht_routing_bucket> const& rt);

View File

@ -32,22 +32,12 @@ POSSIBILITY OF SUCH DAMAGE.
#include "simulator/simulator.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/fwd.hpp"
#include <functional>
#ifndef TORRENT_SETUP_SWARM_HPP_INCLUDED
#define TORRENT_SETUP_SWARM_HPP_INCLUDED
namespace libtorrent
{
class alert;
class session;
struct add_torrent_params;
struct settings_pack;
struct torrent_handle;
struct torrent_status;
}
enum class swarm_test { download, upload };
void setup_swarm(int num_nodes

View File

@ -100,7 +100,7 @@ TORRENT_TEST(dont_count_slow_torrents)
// add torrents
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, false);
lt::add_torrent_params params = ::create_torrent(i, false);
params.flags |= lt::torrent_flags::auto_managed;
params.flags |= lt::torrent_flags::paused;
ses.async_add_torrent(params);
@ -159,7 +159,7 @@ TORRENT_TEST(count_slow_torrents)
// add torrents
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, false);
lt::add_torrent_params params = ::create_torrent(i, false);
params.flags |= torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
ses.async_add_torrent(params);
@ -210,7 +210,7 @@ TORRENT_TEST(force_stopped_download)
// add torrents
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, false);
lt::add_torrent_params params = ::create_torrent(i, false);
// torrents are paused and not auto-managed
params.flags &= ~torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
@ -258,7 +258,7 @@ TORRENT_TEST(force_started)
// add torrents
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, false);
lt::add_torrent_params params = ::create_torrent(i, false);
// torrents are started and not auto-managed
params.flags &= ~torrent_flags::auto_managed;
params.flags &= ~torrent_flags::paused;
@ -308,7 +308,7 @@ TORRENT_TEST(seed_limit)
// add 5 seeds
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, true);
lt::add_torrent_params params = ::create_torrent(i, true);
// torrents are paused and auto-managed
params.flags |= torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
@ -397,7 +397,7 @@ TORRENT_TEST(download_limit)
// add 5 seeds
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, false);
lt::add_torrent_params params = ::create_torrent(i, false);
// torrents are paused and auto-managed
params.flags |= torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
@ -493,7 +493,7 @@ TORRENT_TEST(checking_announce)
// add 5 seeds
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, true);
lt::add_torrent_params params = ::create_torrent(i, true);
// torrents are paused and auto-managed
params.flags |= torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
@ -546,7 +546,7 @@ TORRENT_TEST(paused_checking)
// add 5 seeds
for (int i = 0; i < num_torrents; ++i)
{
lt::add_torrent_params params = create_torrent(i, true);
lt::add_torrent_params params = ::create_torrent(i, true);
// torrents are paused and auto-managed
params.flags &= ~torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
@ -593,7 +593,7 @@ TORRENT_TEST(stop_when_ready)
[](lt::session& ses) {
// add torrents
lt::add_torrent_params params = create_torrent(0, true);
lt::add_torrent_params params = ::create_torrent(0, true);
// torrents are started and auto-managed
params.flags |= torrent_flags::auto_managed;
params.flags |= torrent_flags::stop_when_ready;
@ -661,7 +661,7 @@ TORRENT_TEST(resume_reject_when_paused)
[](lt::session& ses) {
// add torrents
lt::add_torrent_params params = create_torrent(0, true);
lt::add_torrent_params params = ::create_torrent(0, true);
// the torrent is not auto managed and paused. Once the resume data
// check completes, it will stay paused but the state_changed_alert
@ -734,7 +734,7 @@ TORRENT_TEST(no_resume_when_paused)
[](lt::session& ses) {
// add torrents
lt::add_torrent_params params = create_torrent(0, true);
lt::add_torrent_params params = ::create_torrent(0, true);
// the torrent is not auto managed and paused.
params.flags &= ~torrent_flags::auto_managed;
@ -802,7 +802,7 @@ TORRENT_TEST(no_resume_when_started)
[](lt::session& ses) {
// add torrents
lt::add_torrent_params params = create_torrent(0, true);
lt::add_torrent_params params = ::create_torrent(0, true);
ses.async_add_torrent(params);
},
@ -850,7 +850,7 @@ TORRENT_TEST(pause_completed_torrents)
[](lt::session& ses) {
// add torrent
lt::add_torrent_params params = create_torrent(0, true);
lt::add_torrent_params params = ::create_torrent(0, true);
params.flags |= torrent_flags::auto_managed;
params.flags |= torrent_flags::paused;
ses.async_add_torrent(params);

View File

@ -119,7 +119,7 @@ void run_test(HandleAlerts const& on_alert, Test const& test)
print_alerts(*ses[1]);
// the first peer is a downloader, the second peer is a seed
lt::add_torrent_params params = create_torrent(1);
lt::add_torrent_params params = ::create_torrent(1);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;

View File

@ -119,7 +119,7 @@ TORRENT_TEST(apply_ip_filter)
{
add_ip_filter(ses);
lt::add_torrent_params params = create_torrent(0, false);
lt::add_torrent_params params = ::create_torrent(0, false);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;
ses.async_add_torrent(params);
@ -148,7 +148,7 @@ TORRENT_TEST(update_ip_filter)
run_test(
[](lt::session& ses)
{
lt::add_torrent_params params = create_torrent(0, false);
lt::add_torrent_params params = ::create_torrent(0, false);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;
ses.async_add_torrent(params);
@ -181,7 +181,7 @@ TORRENT_TEST(apply_ip_filter_to_torrent)
{
add_ip_filter(ses);
lt::add_torrent_params params = create_torrent(0, false);
lt::add_torrent_params params = ::create_torrent(0, false);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;
@ -216,7 +216,7 @@ TORRENT_TEST(ip_filter_trackers)
{
add_ip_filter(ses);
lt::add_torrent_params params = create_torrent(0, false);
lt::add_torrent_params params = ::create_torrent(0, false);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;
params.trackers = {

View File

@ -71,7 +71,7 @@ TORRENT_TEST(optimistic_unchoke)
io_service ios(sim, addr("50.1.0.0"));
lt::time_point start_time(lt::clock_type::now());
lt::add_torrent_params atp = create_torrent(0);
lt::add_torrent_params atp = ::create_torrent(0);
atp.flags &= ~torrent_flags::auto_managed;
atp.flags &= ~torrent_flags::paused;

View File

@ -46,7 +46,6 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace sim;
using namespace lt;
using sim::asio::ip::address_v4;
// this is the general template for these tests. create the session with custom
@ -76,7 +75,7 @@ void run_test(Setup const& setup, Torrent const& torrent
std::array<fake_peer*, 3> test_peers = {{ &p1, &p2, &p3 }};
// add torrent
lt::add_torrent_params params = create_torrent(0, false);
lt::add_torrent_params params = ::create_torrent(0, false);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;
ses->async_add_torrent(std::move(params));

View File

@ -81,7 +81,7 @@ void run_test(Setup const& setup
on_alert(ses, a);
});
lt::add_torrent_params params = create_torrent(1);
lt::add_torrent_params params = ::create_torrent(1);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;
params.save_path = save_path(0);

View File

@ -657,7 +657,7 @@ TORRENT_TEST(redundant_have)
);
}
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
TORRENT_TEST(lazy_bitfields)
{
test_settings([](lt::settings_pack& pack) {

View File

@ -130,7 +130,7 @@ void run_test(
print_alerts(*ses[1], [](lt::session&, lt::alert const*){}, 1);
// the first peer is a downloader, the second peer is a seed
lt::add_torrent_params params = create_torrent(1);
lt::add_torrent_params params = ::create_torrent(1);
params.flags &= ~lt::torrent_flags::auto_managed;
params.flags &= ~lt::torrent_flags::paused;

View File

@ -40,7 +40,7 @@ namespace libtorrent {
add_torrent_params::add_torrent_params(add_torrent_params const&) = default;
add_torrent_params& add_torrent_params::operator=(add_torrent_params const&) = default;
#ifndef TORRENT_NO_DEPRECATE
#if TORRENT_ABI_VERSION == 1
#define DECL_FLAG(name) \
constexpr torrent_flags_t add_torrent_params::flag_##name
@ -65,7 +65,7 @@ namespace libtorrent {
DECL_FLAG(merge_resume_http_seeds);
DECL_FLAG(default_flags);
#undef DECL_FLAG
#endif // TORRENT_NO_DEPRECATE
#endif // TORRENT_ABI_VERSION
static_assert(std::is_nothrow_move_constructible<add_torrent_params>::value
, "should be nothrow move constructible");

Some files were not shown because too many files have changed in this diff Show More