diff --git a/Jamfile b/Jamfile index d23fc2ee3..bf7b595d7 100644 --- a/Jamfile +++ b/Jamfile @@ -567,6 +567,7 @@ lib advapi32 : : advapi32 ; lib user32 : : user32 ; lib shell32 : : shell32 ; lib gdi32 : : gdi32 ; +lib z : : shared z ; lib crypto : # sources @@ -616,7 +617,6 @@ lib libiconv : : iconv shared /usr/local/lib ; # openssl on linux/bsd etc. lib gcrypt : : gcrypt shared /opt/local/lib ; -lib z : : shared z ; lib dl : : shared dl ; # time functions used on linux require librt diff --git a/bindings/python/Jamfile b/bindings/python/Jamfile index c650bd15d..e48b7874a 100644 --- a/bindings/python/Jamfile +++ b/bindings/python/Jamfile @@ -151,8 +151,9 @@ my-python-extension libtorrent darwin:-Wno-deprecated-declarations darwin:-Wno-unused-command-line-argument @libtorrent_linking + openssl:/torrent//ssl + openssl:/torrent//crypto : # usage-requirements - @libtorrent_linking false ; diff --git a/bindings/python/src/error_code.cpp b/bindings/python/src/error_code.cpp index 0f772efa3..b2bec8747 100644 --- a/bindings/python/src/error_code.cpp +++ b/bindings/python/src/error_code.cpp @@ -36,7 +36,10 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #if defined TORRENT_USE_OPENSSL -#include +#include +#endif +#if TORRENT_USE_I2P +#include #endif #include "boost_python.hpp" diff --git a/include/libtorrent/aux_/session_interface.hpp b/include/libtorrent/aux_/session_interface.hpp index 13099336e..f2d9ed16a 100644 --- a/include/libtorrent/aux_/session_interface.hpp +++ b/include/libtorrent/aux_/session_interface.hpp @@ -55,7 +55,14 @@ POSSIBILITY OF SUCH DAMAGE. #endif #ifdef TORRENT_USE_OPENSSL -#include +// there is no forward declaration header for asio +namespace boost { +namespace asio { +namespace ssl { + struct context; +} +} +} #endif #include "libtorrent/aux_/disable_warnings_pop.hpp" diff --git a/include/libtorrent/http_connection.hpp b/include/libtorrent/http_connection.hpp index 563f933a3..c2131a147 100644 --- a/include/libtorrent/http_connection.hpp +++ b/include/libtorrent/http_connection.hpp @@ -46,7 +46,14 @@ POSSIBILITY OF SUCH DAMAGE. #include #ifdef TORRENT_USE_OPENSSL -#include +// there is no forward declaration header for asio +namespace boost { +namespace asio { +namespace ssl { + struct context; +} +} +} #endif #include "libtorrent/aux_/disable_warnings_pop.hpp" diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index cb41b586a..62ca79cd1 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -76,6 +76,18 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/debug.hpp" #include "libtorrent/aux_/file_progress.hpp" +#ifdef TORRENT_USE_OPENSSL +// there is no forward declaration header for asio +namespace boost { +namespace asio { +namespace ssl { + struct context; + class verify_context; +} +} +} +#endif + #if TORRENT_COMPLETE_TYPES_REQUIRED #include "libtorrent/peer_connection.hpp" #endif diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp index de4ac6b0a..59e478552 100644 --- a/include/libtorrent/tracker_manager.hpp +++ b/include/libtorrent/tracker_manager.hpp @@ -51,7 +51,14 @@ POSSIBILITY OF SUCH DAMAGE. #include #ifdef TORRENT_USE_OPENSSL -#include +// there is no forward declaration header for asio +namespace boost { +namespace asio { +namespace ssl { + struct context; +} +} +} #endif #include "libtorrent/aux_/disable_warnings_pop.hpp" diff --git a/include/libtorrent/upnp.hpp b/include/libtorrent/upnp.hpp index 0682622b1..516ac1d61 100644 --- a/include/libtorrent/upnp.hpp +++ b/include/libtorrent/upnp.hpp @@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket.hpp" #include "libtorrent/error_code.hpp" #include "libtorrent/broadcast_socket.hpp" -#include "libtorrent/http_connection.hpp" #include "libtorrent/thread.hpp" #include "libtorrent/deadline_timer.hpp" #include "libtorrent/enum_net.hpp" @@ -51,6 +50,8 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { + struct http_connection; + class http_parser; namespace upnp_errors { @@ -300,26 +301,13 @@ private: struct rootdevice { - rootdevice(): port(0) - , lease_duration(default_lease_time) - , supports_specific_external(true) - , disabled(false) - , non_router(false) - { -#if TORRENT_USE_ASSERTS - magic = 1337; -#endif - } + rootdevice(); #if TORRENT_USE_ASSERTS - ~rootdevice() - { - TORRENT_ASSERT(magic == 1337); - magic = 0; - } + ~rootdevice(); #if __cplusplus >= 201103L - rootdevice(rootdevice const&) = default; - rootdevice& operator=(rootdevice const&) = default; + rootdevice(rootdevice const&); + rootdevice& operator=(rootdevice const&); #endif #endif @@ -361,13 +349,7 @@ private: #if TORRENT_USE_ASSERTS int magic; #endif - void close() const - { - TORRENT_ASSERT(magic == 1337); - if (!upnp_connection) return; - upnp_connection->close(); - upnp_connection.reset(); - } + void close() const; bool operator<(rootdevice const& rhs) const { return url < rhs.url; } diff --git a/src/http_connection.cpp b/src/http_connection.cpp index 3e30f1631..a18a12a56 100644 --- a/src/http_connection.cpp +++ b/src/http_connection.cpp @@ -53,6 +53,10 @@ POSSIBILITY OF SUCH DAMAGE. #include #include +#ifdef TORRENT_USE_OPENSSL +#include +#endif + #include "libtorrent/aux_/disable_warnings_pop.hpp" namespace libtorrent { diff --git a/src/tracker_manager.cpp b/src/tracker_manager.cpp index 592eed842..6da3c7a01 100644 --- a/src/tracker_manager.cpp +++ b/src/tracker_manager.cpp @@ -45,6 +45,10 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/udp_tracker_connection.hpp" #include "libtorrent/aux_/session_impl.hpp" +#ifdef TORRENT_USE_OPENSSL +#include +#endif + using boost::tuples::make_tuple; using boost::tuples::tuple; @@ -55,7 +59,6 @@ namespace minimum_tracker_response_length = 3, http_buffer_size = 2048 }; - } namespace libtorrent diff --git a/src/upnp.cpp b/src/upnp.cpp index e4dc73526..bc167780a 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/random.hpp" #include "libtorrent/aux_/time.hpp" // for aux::time_now() #include "libtorrent/aux_/escape_string.hpp" // for convert_from_native +#include "libtorrent/http_connection.hpp" #if defined TORRENT_ASIO_DEBUGGING #include "libtorrent/debug.hpp" @@ -69,6 +70,38 @@ namespace upnp_errors static error_code ignore_error; +upnp::rootdevice::rootdevice() + : port(0) + , lease_duration(default_lease_time) + , supports_specific_external(true) + , disabled(false) + , non_router(false) +{ +#if TORRENT_USE_ASSERTS + magic = 1337; +#endif +} + +void upnp::rootdevice::close() const +{ + TORRENT_ASSERT(magic == 1337); + if (!upnp_connection) return; + upnp_connection->close(); + upnp_connection.reset(); +} + +#if TORRENT_USE_ASSERTS +upnp::rootdevice::~rootdevice() +{ + TORRENT_ASSERT(magic == 1337); + magic = 0; +} +#if __cplusplus >= 201103L +upnp::rootdevice::rootdevice(rootdevice const&) = default; +upnp::rootdevice& upnp::rootdevice::operator=(rootdevice const&) = default; +#endif +#endif + upnp::upnp(io_service& ios , address const& listen_interface, std::string const& user_agent , portmap_callback_t const& cb, log_callback_t const& lcb diff --git a/test/Jamfile b/test/Jamfile index 5a4664f8b..f7983935c 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -138,7 +138,10 @@ test-suite libtorrent : [ run test_privacy.cpp ] [ run test_recheck.cpp ] [ run test_resume.cpp ] - [ run test_ssl.cpp ] + [ run test_ssl.cpp : : + : openssl:/torrent//ssl + openssl:/torrent//crypto + ] [ run test_tracker.cpp ] [ run test_checking.cpp ] [ run test_url_seed.cpp ] @@ -158,7 +161,10 @@ test-suite libtorrent : [ run test_remap_files.cpp ] [ run test_utp.cpp ] [ run test_auto_unchoke.cpp ] - [ run test_http_connection.cpp ] + [ run test_http_connection.cpp : : + : openssl:/torrent//ssl + openssl:/torrent//crypto + ] [ run test_torrent.cpp ] [ run test_transfer.cpp ] [ run test_time_critical.cpp ] diff --git a/test/setup_transfer.cpp b/test/setup_transfer.cpp index 394570a41..85c5894cc 100644 --- a/test/setup_transfer.cpp +++ b/test/setup_transfer.cpp @@ -42,8 +42,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/alert_types.hpp" #include "libtorrent/create_torrent.hpp" #include "libtorrent/socket_io.hpp" // print_endpoint -#include "libtorrent/socket_type.hpp" -#include "libtorrent/instantiate_connection.hpp" #include "libtorrent/ip_filter.hpp" #include "libtorrent/session_stats.hpp" #include "libtorrent/thread.hpp" @@ -59,11 +57,6 @@ POSSIBILITY OF SUCH DAMAGE. #include "test_utils.hpp" #include "setup_transfer.hpp" -#ifdef TORRENT_USE_OPENSSL -#include -#include -#endif - #ifndef _WIN32 #include #include diff --git a/test/test_ip_voter.cpp b/test/test_ip_voter.cpp index 4a0c3f70b..960819454 100644 --- a/test/test_ip_voter.cpp +++ b/test/test_ip_voter.cpp @@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/socket.hpp" #include "libtorrent/random.hpp" #include "libtorrent/socket_io.hpp" -#include "libtorrent/aux_/session_impl.hpp" +#include "libtorrent/aux_/session_interface.hpp" #include "libtorrent/broadcast_socket.hpp" // for supports_ipv6() #include "setup_transfer.hpp" // for rand_v4 @@ -165,8 +165,8 @@ TORRENT_TEST(externa_ip_1) TEST_CHECK(!ec); for (int i = 0; i < 50; ++i) { - ipv1.cast_vote(real_external, aux::session_impl::source_dht, rand_v4()); - ipv1.cast_vote(rand_v4(), aux::session_impl::source_dht, malicious); + ipv1.cast_vote(real_external, aux::session_interface::source_dht, rand_v4()); + ipv1.cast_vote(rand_v4(), aux::session_interface::source_dht, malicious); } TEST_CHECK(ipv1.external_address(rand_v4()) == real_external); } @@ -199,12 +199,12 @@ TORRENT_TEST(externa_ip_2) TEST_CHECK(!ec); for (int i = 0; i < 50; ++i) { - ipv2.cast_vote(real_external1, aux::session_impl::source_dht, rand_v4()); + ipv2.cast_vote(real_external1, aux::session_interface::source_dht, rand_v4()); #if TORRENT_USE_IPV6 if (supports_ipv6()) - ipv2.cast_vote(real_external2, aux::session_impl::source_dht, rand_v6()); + ipv2.cast_vote(real_external2, aux::session_interface::source_dht, rand_v6()); #endif - ipv2.cast_vote(malicious_external, aux::session_impl::source_dht, malicious); + ipv2.cast_vote(malicious_external, aux::session_interface::source_dht, malicious); } TEST_CHECK(ipv2.external_address(rand_v4()) == real_external1); #if TORRENT_USE_IPV6 diff --git a/test/test_storage.cpp b/test/test_storage.cpp index 8e9cac56d..f2eb75dd1 100644 --- a/test/test_storage.cpp +++ b/test/test_storage.cpp @@ -40,13 +40,13 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/hasher.hpp" #include "libtorrent/session.hpp" #include "libtorrent/alert_types.hpp" -#include "libtorrent/aux_/session_impl.hpp" #include "libtorrent/create_torrent.hpp" #include "libtorrent/thread.hpp" #include "libtorrent/torrent_info.hpp" #include #include +#include #include #include diff --git a/test/test_upnp.cpp b/test/test_upnp.cpp index 97f06e2f0..50b473602 100644 --- a/test/test_upnp.cpp +++ b/test/test_upnp.cpp @@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/upnp.hpp" #include "libtorrent/socket.hpp" #include "libtorrent/socket_io.hpp" // print_endpoint +#include "libtorrent/http_parser.hpp" #include "test.hpp" #include "setup_transfer.hpp" #include diff --git a/test/test_xml.cpp b/test/test_xml.cpp index a42c38e64..15f4aaa2e 100644 --- a/test/test_xml.cpp +++ b/test/test_xml.cpp @@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "libtorrent/upnp.hpp" #include "test.hpp" #include +#include char upnp_xml[] = ""