diff --git a/docs/client_test.html b/docs/client_test.html index 9e95166b7..061fb0d67 100644 --- a/docs/client_test.html +++ b/docs/client_test.html @@ -3,9 +3,129 @@
- +While running, the client_test sample will look something like this:
- +The commands available in the client are:
@@ -47,7 +167,7 @@ been requested from which peer. The green background means that it has been downloaded. It shows that fast peers will prefer to request whole pieces instead of dowloading parts of pieces. It may make it easier to determine which peer that sent the corrupt data if a piece fails the hash test. - +
There's unicode support on linux, MacOS X and Windows.
To advertise to other clients that you support, one bit from the reserved bytes is used.
-Right now, two bits have known usages.
++-
- [7] & 1 is used by Mainline for DHT support
- [7] & 2 is used by XBT client for peer-exchange support
The bit selected for the extension protocol is bit 20 from the right (counting starts at 0). So (reserved_byte[5] & 0x10) is the expression to use for checking if the client supports extended messaging.
diff --git a/docs/extension_protocol.rst b/docs/extension_protocol.rst index 8eb6ea3a8..02281a0d6 100644 --- a/docs/extension_protocol.rst +++ b/docs/extension_protocol.rst @@ -14,6 +14,7 @@ To advertise to other clients that you support, one bit from the reserved bytes is used. Right now, two bits have known usages. + * [7] & 1 is used by Mainline for DHT support * [7] & 2 is used by XBT client for peer-exchange support diff --git a/docs/index.html b/docs/index.html index bde040035..443462d08 100755 --- a/docs/index.html +++ b/docs/index.html @@ -3,9 +3,129 @@ - +Support the development of libtorrent
There's a mailing list, general libtorrent discussion.
You can usually find me as hydri in #libtorrent on irc.freenode.net.
Written by Arvid Norberg. Copyright (c) 2003
Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson
Thanks to Reimond Retz for bugfixes, suggestions and testing
diff --git a/docs/manual.html b/docs/manual.html index 93d00bc25..ffa51e6e3 100755 --- a/docs/manual.html +++ b/docs/manual.html @@ -352,8 +352,8 @@ boost libraries as well as zlib<@@ -362,7 +362,8 @@ boost libraries as well as zlib<
- Windows 2000 vc7.1
-- Linux x86 GCC 3.0.4, GCC 3.2.3, GCC 3.4.2
-- MacOS X (darwin), (Apple's) GCC 3.3, (Apple's) GCC 4.0
+- Linux x86 GCC 3.3, GCC 3.4.2
+- MacOS X (darwin), (Apple's) GCC 4.0
- SunOS 5.8 GCC 3.1
- Cygwin GCC 3.3.3
- GCC 2.95.4
-- msvc6 sp5
+- msvc6
+- (Apple's) GCC 3.3 (compiler crashes with the latest version of asio)
libtorrent is released under the BSD-license.
@@ -1517,7 +1518,7 @@ struct torrent_handle entry write_resume_data() const; std::vector<char> const& metadata() const; void force_reannounce() const; - void connect_peer(asio::ipv4::tcp::endpoint const& adr) const; + void connect_peer(asio::ip::tcp::endpoint const& adr) const; void set_tracker_login(std::string const& username , std::string const& password) const; @@ -1533,8 +1534,8 @@ struct torrent_handle void set_upload_limit(int limit) const; void set_download_limit(int limit) const; - void set_peer_upload_limit(asio::ipv4::tcp::endpoint ip, int limit) const; - void set_peer_download_limit(asio::ipv4::tcp::endpoint ip, int limit) const; + void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const; + void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; void use_interface(char const* net_interface) const; @@ -1604,7 +1605,7 @@ peers. If the torrent is invalid, queued or in checking mode, this functions wilconnect_peer()
-void connect_peer(asio::ipv4::tcp::endpoint const& adr) const; +void connect_peer(asio::ip::tcp::endpoint const& adr) const;connect_peer() is a way to manually connect to peers that one believe is a part of the @@ -1647,8 +1648,8 @@ limit.
set_peer_upload_limit() set_peer_download_limit()
-void set_peer_upload_limit(asio::ipv4::tcp::endpoint ip, int limit) const; -void set_peer_download_limit(asio::ipv4::tcp::endpoint ip, int limit) const; +void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const; +void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const;Works like set_upload_limit and set_download_limit respectively, but controls individual @@ -2080,7 +2081,7 @@ struct peer_info queued = 0x100 }; unsigned int flags; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; float up_speed; float down_speed; float payload_up_speed; @@ -2259,7 +2260,7 @@ uncompressed (given your limit is lower than 2 megs). Default limit is
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 allowes all addresses (0.0.0.0 - 255.255.255.255). -The address type here is asio::ipv4::address. It can also be +The address type here is asio::ip::address_v4. It can also be accessed as libtorrent::address.
@@ -2736,12 +2737,12 @@ to the torrent that this peer was a member of. struct peer_ban_alert: alert { peer_ban_alert( - asio::ipv4::tcp::endpoint const& pip + asio::ip::tcp::endpoint const& pip , torrent_handle h , const std::string& msg); virtual std::auto_ptr<alert> clone() const; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; torrent_handle handle; };@@ -2755,12 +2756,12 @@ is generated as severity level de struct peer_error_alert: alert { peer_error_alert( - asio::ipv4::tcp::endpoint const& pip + asio::ip::tcp::endpoint const& pip , peer_id const& pid , const std::string& msg); virtual std::auto_ptr<alert> clone() const; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; peer_id id; }; @@ -2777,13 +2778,13 @@ struct invalid_request_alert: alert invalid_request_alert( peer_request const& r , torrent_handle const& h - , asio::ipv4::tcp::endpoint const& send + , asio::ip::tcp::endpoint const& send , peer_id const& pid , std::string const& msg); virtual std::auto_ptr<alert> clone() const; torrent_handle handle; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; peer_request request; peer_id id; }; @@ -3586,6 +3587,7 @@ boost::filesystem::path::default_name_check(boost::filesystem::native);acknowledgements
Written by Arvid Norberg. Copyright © 2003-2005
Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson
+Lots of testing, suggestions and contributions by Massaroddel and Tianhao Qiu.
Big thanks to Michael Wojciechowski and Peter Koeleman for making the autotools scripts.
Thanks to Reimond Retz for bugfixes, suggestions and testing
diff --git a/docs/manual.rst b/docs/manual.rst index ffcef25da..ed660c7b7 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -1347,7 +1347,7 @@ Its declaration looks like this:: entry write_resume_data() const; std::vectorconst& metadata() const; void force_reannounce() const; - void connect_peer(asio::ipv4::tcp::endpoint const& adr) const; + void connect_peer(asio::ip::tcp::endpoint const& adr) const; void set_tracker_login(std::string const& username , std::string const& password) const; @@ -1363,8 +1363,8 @@ Its declaration looks like this:: void set_upload_limit(int limit) const; void set_download_limit(int limit) const; - void set_peer_upload_limit(asio::ipv4::tcp::endpoint ip, int limit) const; - void set_peer_download_limit(asio::ipv4::tcp::endpoint ip, int limit) const; + void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const; + void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; void use_interface(char const* net_interface) const; @@ -1439,7 +1439,7 @@ connect_peer() :: - void connect_peer(asio::ipv4::tcp::endpoint const& adr) const; + void connect_peer(asio::ip::tcp::endpoint const& adr) const; ``connect_peer()`` is a way to manually connect to peers that one believe is a part of the torrent. If the peer does not respond, or is not a member of this torrent, it will simply @@ -1485,8 +1485,8 @@ set_peer_upload_limit() set_peer_download_limit() :: - void set_peer_upload_limit(asio::ipv4::tcp::endpoint ip, int limit) const; - void set_peer_download_limit(asio::ipv4::tcp::endpoint ip, int limit) const; + void set_peer_upload_limit(asio::ip::tcp::endpoint ip, int limit) const; + void set_peer_download_limit(asio::ip::tcp::endpoint ip, int limit) const; Works like ``set_upload_limit`` and ``set_download_limit`` respectively, but controls individual peer instead of the whole torrent. @@ -1943,7 +1943,7 @@ It contains the following fields:: queued = 0x100 }; unsigned int flags; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; float up_speed; float down_speed; float payload_up_speed; @@ -2137,7 +2137,7 @@ ip_filter 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 allowes all addresses (0.0.0.0 - 255.255.255.255). -The ``address`` type here is ``asio::ipv4::address``. It can also be +The ``address`` type here is ``asio::ip::address_v4``. It can also be accessed as ``libtorrent::address``. :: @@ -2671,12 +2671,12 @@ to the torrent that this peer was a member of. struct peer_ban_alert: alert { peer_ban_alert( - asio::ipv4::tcp::endpoint const& pip + asio::ip::tcp::endpoint const& pip , torrent_handle h , const std::string& msg); virtual std::auto_ptr clone() const; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; torrent_handle handle; }; @@ -2693,12 +2693,12 @@ is generated as severity level ``debug``. struct peer_error_alert: alert { peer_error_alert( - asio::ipv4::tcp::endpoint const& pip + asio::ip::tcp::endpoint const& pip , peer_id const& pid , const std::string& msg); virtual std::auto_ptr clone() const; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; peer_id id; }; @@ -2718,13 +2718,13 @@ is a handle to the torrent the peer is a member of. `` invalid_request_alert( peer_request const& r , torrent_handle const& h - , asio::ipv4::tcp::endpoint const& send + , asio::ip::tcp::endpoint const& send , peer_id const& pid , std::string const& msg); virtual std::auto_ptr clone() const; torrent_handle handle; - asio::ipv4::tcp::endpoint ip; + asio::ip::tcp::endpoint ip; peer_request request; peer_id id; }; @@ -3507,6 +3507,8 @@ Written by Arvid Norberg. Copyright |copy| 2003-2005 Contributions by Magnus Jonsson, Daniel Wallin and Cory Nelson +Lots of testing, suggestions and contributions by Massaroddel and Tianhao Qiu. + Big thanks to Michael Wojciechowski and Peter Koeleman for making the autotools scripts. diff --git a/docs/udp_tracker_protocol.html b/docs/udp_tracker_protocol.html index dc3c28829..efb082d23 100644 --- a/docs/udp_tracker_protocol.html +++ b/docs/udp_tracker_protocol.html @@ -3,10 +3,130 @@ - + Bittorrent udp-tracker protocol extension - +@@ -19,8 +139,8 @@Arvid Norberg, arvid@rasterbar.com -- ++-
- introduction
- connecting
@@ -35,8 +155,8 @@- credits
-introduction
++-introduction
A tracker with the protocol "udp://" in its URI is supposed to be contacted using this protocol.
This protocol is supported by @@ -50,8 +170,8 @@ are specified with ANSI-C standard types.
the request. If no reply has been received after 60 seconds, stop retrying.-connecting
++-connecting
Client sends packet:
@@ -60,9 +180,9 @@ retrying. -size -name -description +@@ -90,9 +210,9 @@ identify the protocol. size +name +description - size -name -description +@@ -120,8 +240,8 @@ anymore. size +name +description -announcing
++-announcing
Client sends packet:
@@ -130,9 +250,9 @@ anymore. -size -name -description +@@ -221,9 +341,9 @@ in the reply. Use -1 for default. size +name +description - size -name -description +@@ -265,9 +385,9 @@ seeding. size +name +description - size -name -description +@@ -282,8 +402,8 @@ seeding. size +name +description -scraping
++-scraping
Client sends packet:
@@ -292,9 +412,9 @@ seeding. -size -name -description +@@ -331,9 +451,9 @@ follow. size +name +description - size -name -description +@@ -351,9 +471,9 @@ follow. size +name +description - size -name -description +@@ -378,9 +498,9 @@ you asked in the scrape request. size +name +description - size -name -description +@@ -401,8 +521,8 @@ leechers. size +name +description -errors
++-errors
In case of a tracker error,
server replies packet:
@@ -412,9 +532,9 @@ leechers.
- size -name -description +@@ -436,8 +556,8 @@ describing the error. size +name +description -actions
+ --extensions
++extensions
The extensions field is a bitmask. The following bits are assigned:
@@ -457,8 +577,8 @@ bits are assigned:-1 = authentication. -- diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp index fa52806e9..830a853df 100755 --- a/src/http_tracker_connection.cpp +++ b/src/http_tracker_connection.cpp @@ -375,7 +375,7 @@ namespace libtorrent } #endif - tcp::resolver::query q(*connect_to_host); + tcp::resolver::query q(*connect_to_host, "http"); m_name_lookup.async_resolve(q , boost::bind(&http_tracker_connection::name_lookup, self(), _1, _2)); set_timeout(m_settings.tracker_completion_timeout @@ -415,7 +415,7 @@ namespace libtorrent { assert(false); fail(-1, e.what()); - } + }; void http_tracker_connection::connected(asio::error const& error) try { diff --git a/src/torrent.cpp b/src/torrent.cpp index ae6a32417..6c6fc6647 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -938,7 +938,7 @@ namespace libtorrent = parse_url_components(url); m_resolving_web_seeds.insert(url); - tcp::resolver::query q(hostname); + tcp::resolver::query q(hostname, "http"); m_host_resolver.async_resolve(q, bind(&torrent::on_name_lookup , shared_from_this(), _1, _2, port, url)); diff --git a/src/udp_tracker_connection.cpp b/src/udp_tracker_connection.cpp index cbfbdd8f1..4182e6bc3 100755 --- a/src/udp_tracker_connection.cpp +++ b/src/udp_tracker_connection.cpp @@ -90,7 +90,7 @@ namespace libtorrent , m_attempts(0) { m_socket.reset(new datagram_socket(d)); - tcp::resolver::query q(hostname.c_str()); + tcp::resolver::query q(hostname, "http"); m_name_lookup.async_resolve(q , boost::bind(&udp_tracker_connection::name_lookup, self(), _1, _2)); set_timeout(m_settings.tracker_completion_timeout @@ -121,7 +121,7 @@ namespace libtorrent { fail(-1, e.what()); assert(false); - } + }; void udp_tracker_connection::on_timeout() {authentication
++authentication
The packet will have an authentication part appended to it. It has the following format:
@@ -468,9 +588,9 @@ appended to it. It has the following format:
- size -name -description +@@ -497,8 +617,8 @@ from the 20 bytes hash calculated. size +name +description