introduced TORRENT_NO_DEPRECATE, to disable deprecated functions. Made example not use deprecated functions. Documented magnet uri related functions.

This commit is contained in:
Arvid Norberg 2008-08-03 15:14:08 +00:00
parent 18b14e56df
commit cbf8e6f3b1
16 changed files with 351 additions and 180 deletions

View File

@ -227,6 +227,9 @@ feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ;
feature zlib : shipped system : composite propagated link-incompatible ;
feature deprecated-functions : on off : composite propagated link-incompatible ;
feature.compose <deprecated-functions>off : <define>TORRENT_NO_DEPRECATE ;
feature statistics : off on : composite propagated link-incompatible ;
feature.compose <statistics>on : <define>TORRENT_STATS ;

View File

@ -198,8 +198,8 @@ For more build configuration flags see <a class="reference" href="#build-configu
<p>Build features:</p>
<table border="1" class="docutils">
<colgroup>
<col width="32%" />
<col width="68%" />
<col width="33%" />
<col width="67%" />
</colgroup>
<thead valign="bottom">
<tr><th class="head">boost build feature</th>
@ -374,6 +374,17 @@ symbols.</li>
</ul>
</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">deprecated-functions</span></tt></td>
<td><ul class="first last simple">
<li><tt class="docutils literal"><span class="pre">on</span></tt> - default. Includes deprecated functions
of the API (might produce warnings during build
when deprecated functions are used).</li>
<li><tt class="docutils literal"><span class="pre">off</span></tt> - excludes deprecated functions from the
API. Generates build errors when deprecated
functions are used.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>The <tt class="docutils literal"><span class="pre">variant</span></tt> feature is <em>implicit</em>, which means you don't need to specify
@ -655,6 +666,10 @@ make the resulting executable faster.</td>
checks. Useful for finding particular bugs
or for running before releases.</td>
</tr>
<tr><td><tt class="docutils literal"><span class="pre">TORRENT_NO_DEPRECATE</span></tt></td>
<td>This will exclude all deprecated functions from
the header files and cpp files.</td>
</tr>
</tbody>
</table>
<p>If you experience that libtorrent uses unreasonable amounts of cpu, it will

View File

@ -215,114 +215,121 @@ For more build configuration flags see `Build configurations`_.
Build features:
+------------------------+----------------------------------------------------+
| boost build feature | values |
+========================+====================================================+
| ``boost`` | * ``system`` - default. Tells the Jamfile that |
| | boost is installed and should be linked against |
| | the system libraries. |
| | * ``source`` - Specifies that boost is to be built |
| | from source. The environment variable |
| | ``BOOST_ROOT`` must be defined to point to the |
| | boost directory. |
+------------------------+----------------------------------------------------+
| ``boost-link`` | * ``static`` - links statically against the boost |
| | libraries. |
| | * ``shared`` - links dynamically against the boost |
| | libraries. |
+------------------------+----------------------------------------------------+
| ``logging`` | * ``none`` - no logging. |
| | * ``default`` - basic session logging. |
| | * ``verbose`` - verbose peer wire logging. |
| | * ``errors`` - like verbose, but limited to errors.|
+------------------------+----------------------------------------------------+
| ``dht-support`` | * ``on`` - build with support for tracker less |
| | torrents and DHT support. |
| | * ``logging`` - build with DHT support and verbose |
| | logging of the DHT protocol traffic. |
| | * ``off`` - build without DHT support. |
+------------------------+----------------------------------------------------+
| ``need-librt`` | * ``no`` - this platform does not need to link |
| | against librt to have POSIX time functions. |
| | * ``yes`` - specify this if your linux system |
| | requires you to link against librt.a. This is |
| | typically the case on x86 64 bit systems. |
+------------------------+----------------------------------------------------+
| ``zlib`` | * ``system`` - links against the zlib supplied |
| | with your operating system. |
| | * ``shipped`` - links against the zlib bundled |
| | with the libtorrent package. |
+------------------------+----------------------------------------------------+
| ``geoip`` | * ``off`` - geo ip lookups disabled |
| | * ``static`` - MaxMind_ geo ip lookup code linked |
| | in statically. Note that this code is under |
| | LGPL license. |
| | * ``shared`` - The MaxMind_ geo ip lookup library |
| | is expected to be installed on the system and |
| | it will be used. |
+------------------------+----------------------------------------------------+
| ``upnp-logging`` | * ``off`` - default. Does not log UPnP traffic. |
| | * ``on`` - creates "upnp.log" with the messages |
| | sent to and received from UPnP devices. |
+------------------------+----------------------------------------------------+
| ``openssl`` | * ``pe`` - turns on support for encrypted |
| | connections. requires openssl (libcrypto) |
| | * ``sha-1`` - openssl will be used instead of the |
| | public domain SHA-1 implementation shipped with |
| | libtorrent. ``libcrypto.a`` will be required for |
| | linking. Encryption support is still turned off. |
| | * ``off`` - turns off support for encrypted |
| | connections. openssl is not linked in. The |
| | shipped public domain SHA-1 implementation is |
| | used. |
+------------------------+----------------------------------------------------+
| ``pool-allocators`` | * ``on`` - default, uses pool allocators for send |
| | buffers. |
| | * ``off`` - uses ``malloc()`` and ``free()`` |
| | instead. Might be useful to debug buffer issues |
| | with tools like electric fence or libgmalloc. |
+------------------------+----------------------------------------------------+
| ``link`` | * ``static`` - builds libtorrent as a static |
| | library (.a / .lib) |
| | * ``shared`` - builds libtorrent as a shared |
| | library (.so / .dll). |
+------------------------+----------------------------------------------------+
| ``runtime-link`` | * ``static`` - links statically against the |
| | run-time library (if available on your |
| | platform). |
| | * ``shared`` - link dynamically against the |
| | run-time library (default). |
+------------------------+----------------------------------------------------+
| ``variant`` | * ``debug`` - builds libtorrent with debug |
| | information and invariant checks. |
| | * ``release`` - builds libtorrent in release mode |
| | without invariant checks and with optimization. |
| | * ``profile`` - builds libtorrent with profile |
| | information. |
+------------------------+----------------------------------------------------+
| ``character-set`` | This setting will only have an affect on windows. |
| | Other platforms are expected to support UTF-8. |
| | |
| | * ``unicode`` - The unicode version of the win32 |
| | API is used. This is default. |
| | * ``ansi`` - The ansi version of the win32 API is |
| | used. |
+------------------------+----------------------------------------------------+
| ``invariant-checks`` | This setting only affects debug builds (where |
| | ``NDEBUG`` is not defined). It defaults to ``on``. |
| | |
| | * ``on`` - internal invariant checks are enabled. |
| | * ``off`` - internal invariant checks are |
| | disabled. The resulting executable will run |
| | faster than a regular debug build. |
| | * ``full`` - turns on extra expensive invariant |
| | checks. |
+------------------------+----------------------------------------------------+
| ``debug-symbols`` | * ``on`` - default for debug builds. This setting |
| | is useful for building release builds with |
| | symbols. |
| | * ``off`` - default for release builds. |
+------------------------+----------------------------------------------------+
+--------------------------+----------------------------------------------------+
| boost build feature | values |
+==========================+====================================================+
| ``boost`` | * ``system`` - default. Tells the Jamfile that |
| | boost is installed and should be linked against |
| | the system libraries. |
| | * ``source`` - Specifies that boost is to be built |
| | from source. The environment variable |
| | ``BOOST_ROOT`` must be defined to point to the |
| | boost directory. |
+--------------------------+----------------------------------------------------+
| ``boost-link`` | * ``static`` - links statically against the boost |
| | libraries. |
| | * ``shared`` - links dynamically against the boost |
| | libraries. |
+--------------------------+----------------------------------------------------+
| ``logging`` | * ``none`` - no logging. |
| | * ``default`` - basic session logging. |
| | * ``verbose`` - verbose peer wire logging. |
| | * ``errors`` - like verbose, but limited to errors.|
+--------------------------+----------------------------------------------------+
| ``dht-support`` | * ``on`` - build with support for tracker less |
| | torrents and DHT support. |
| | * ``logging`` - build with DHT support and verbose |
| | logging of the DHT protocol traffic. |
| | * ``off`` - build without DHT support. |
+--------------------------+----------------------------------------------------+
| ``need-librt`` | * ``no`` - this platform does not need to link |
| | against librt to have POSIX time functions. |
| | * ``yes`` - specify this if your linux system |
| | requires you to link against librt.a. This is |
| | typically the case on x86 64 bit systems. |
+--------------------------+----------------------------------------------------+
| ``zlib`` | * ``system`` - links against the zlib supplied |
| | with your operating system. |
| | * ``shipped`` - links against the zlib bundled |
| | with the libtorrent package. |
+--------------------------+----------------------------------------------------+
| ``geoip`` | * ``off`` - geo ip lookups disabled |
| | * ``static`` - MaxMind_ geo ip lookup code linked |
| | in statically. Note that this code is under |
| | LGPL license. |
| | * ``shared`` - The MaxMind_ geo ip lookup library |
| | is expected to be installed on the system and |
| | it will be used. |
+--------------------------+----------------------------------------------------+
| ``upnp-logging`` | * ``off`` - default. Does not log UPnP traffic. |
| | * ``on`` - creates "upnp.log" with the messages |
| | sent to and received from UPnP devices. |
+--------------------------+----------------------------------------------------+
| ``openssl`` | * ``pe`` - turns on support for encrypted |
| | connections. requires openssl (libcrypto) |
| | * ``sha-1`` - openssl will be used instead of the |
| | public domain SHA-1 implementation shipped with |
| | libtorrent. ``libcrypto.a`` will be required for |
| | linking. Encryption support is still turned off. |
| | * ``off`` - turns off support for encrypted |
| | connections. openssl is not linked in. The |
| | shipped public domain SHA-1 implementation is |
| | used. |
+--------------------------+----------------------------------------------------+
| ``pool-allocators`` | * ``on`` - default, uses pool allocators for send |
| | buffers. |
| | * ``off`` - uses ``malloc()`` and ``free()`` |
| | instead. Might be useful to debug buffer issues |
| | with tools like electric fence or libgmalloc. |
+--------------------------+----------------------------------------------------+
| ``link`` | * ``static`` - builds libtorrent as a static |
| | library (.a / .lib) |
| | * ``shared`` - builds libtorrent as a shared |
| | library (.so / .dll). |
+--------------------------+----------------------------------------------------+
| ``runtime-link`` | * ``static`` - links statically against the |
| | run-time library (if available on your |
| | platform). |
| | * ``shared`` - link dynamically against the |
| | run-time library (default). |
+--------------------------+----------------------------------------------------+
| ``variant`` | * ``debug`` - builds libtorrent with debug |
| | information and invariant checks. |
| | * ``release`` - builds libtorrent in release mode |
| | without invariant checks and with optimization. |
| | * ``profile`` - builds libtorrent with profile |
| | information. |
+--------------------------+----------------------------------------------------+
| ``character-set`` | This setting will only have an affect on windows. |
| | Other platforms are expected to support UTF-8. |
| | |
| | * ``unicode`` - The unicode version of the win32 |
| | API is used. This is default. |
| | * ``ansi`` - The ansi version of the win32 API is |
| | used. |
+--------------------------+----------------------------------------------------+
| ``invariant-checks`` | This setting only affects debug builds (where |
| | ``NDEBUG`` is not defined). It defaults to ``on``. |
| | |
| | * ``on`` - internal invariant checks are enabled. |
| | * ``off`` - internal invariant checks are |
| | disabled. The resulting executable will run |
| | faster than a regular debug build. |
| | * ``full`` - turns on extra expensive invariant |
| | checks. |
+--------------------------+----------------------------------------------------+
| ``debug-symbols`` | * ``on`` - default for debug builds. This setting |
| | is useful for building release builds with |
| | symbols. |
| | * ``off`` - default for release builds. |
+--------------------------+----------------------------------------------------+
| ``deprecated-functions`` | * ``on`` - default. Includes deprecated functions |
| | of the API (might produce warnings during build |
| | when deprecated functions are used). |
| | * ``off`` - excludes deprecated functions from the |
| | API. Generates build errors when deprecated |
| | functions are used. |
+--------------------------+----------------------------------------------------+
.. _MaxMind: http://www.maxmind.com/app/api
@ -602,6 +609,9 @@ defines you can use to control the build.
| | checks. Useful for finding particular bugs |
| | or for running before releases. |
+----------------------------------------+-------------------------------------------------+
| ``TORRENT_NO_DEPRECATE`` | This will exclude all deprecated functions from |
| | the header files and cpp files. |
+----------------------------------------+-------------------------------------------------+
If you experience that libtorrent uses unreasonable amounts of cpu, it will

View File

@ -144,85 +144,88 @@
<li><a class="reference" href="#identify-client" id="id123" name="id123">identify_client()</a></li>
<li><a class="reference" href="#client-fingerprint" id="id124" name="id124">client_fingerprint()</a></li>
<li><a class="reference" href="#bdecode-bencode" id="id125" name="id125">bdecode() bencode()</a></li>
<li><a class="reference" href="#add-magnet-uri" id="id126" name="id126">add_magnet_uri()</a></li>
<li><a class="reference" href="#make-magnet-uri" id="id127" name="id127">make_magnet_uri()</a></li>
</ul>
</li>
<li><a class="reference" href="#alerts" id="id126" name="id126">alerts</a><ul>
<li><a class="reference" href="#external-ip-alert" id="id127" name="id127">external_ip_alert</a></li>
<li><a class="reference" href="#listen-failed-alert" id="id128" name="id128">listen_failed_alert</a></li>
<li><a class="reference" href="#portmap-error-alert" id="id129" name="id129">portmap_error_alert</a></li>
<li><a class="reference" href="#portmap-alert" id="id130" name="id130">portmap_alert</a></li>
<li><a class="reference" href="#file-error-alert" id="id131" name="id131">file_error_alert</a></li>
<li><a class="reference" href="#tracker-announce-alert" id="id132" name="id132">tracker_announce_alert</a></li>
<li><a class="reference" href="#tracker-error-alert" id="id133" name="id133">tracker_error_alert</a></li>
<li><a class="reference" href="#tracker-reply-alert" id="id134" name="id134">tracker_reply_alert</a></li>
<li><a class="reference" href="#dht-reply-alert" id="id135" name="id135">dht_reply_alert</a></li>
<li><a class="reference" href="#tracker-warning-alert" id="id136" name="id136">tracker_warning_alert</a></li>
<li><a class="reference" href="#scrape-reply-alert" id="id137" name="id137">scrape_reply_alert</a></li>
<li><a class="reference" href="#scrape-failed-alert" id="id138" name="id138">scrape_failed_alert</a></li>
<li><a class="reference" href="#url-seed-alert" id="id139" name="id139">url_seed_alert</a></li>
<li><a class="reference" href="#hash-failed-alert" id="id140" name="id140">hash_failed_alert</a></li>
<li><a class="reference" href="#peer-ban-alert" id="id141" name="id141">peer_ban_alert</a></li>
<li><a class="reference" href="#peer-error-alert" id="id142" name="id142">peer_error_alert</a></li>
<li><a class="reference" href="#invalid-request-alert" id="id143" name="id143">invalid_request_alert</a></li>
<li><a class="reference" href="#torrent-finished-alert" id="id144" name="id144">torrent_finished_alert</a></li>
<li><a class="reference" href="#metadata-failed-alert" id="id145" name="id145">metadata_failed_alert</a></li>
<li><a class="reference" href="#metadata-received-alert" id="id146" name="id146">metadata_received_alert</a></li>
<li><a class="reference" href="#fastresume-rejected-alert" id="id147" name="id147">fastresume_rejected_alert</a></li>
<li><a class="reference" href="#peer-blocked-alert" id="id148" name="id148">peer_blocked_alert</a></li>
<li><a class="reference" href="#storage-moved-alert" id="id149" name="id149">storage_moved_alert</a></li>
<li><a class="reference" href="#torrent-paused-alert" id="id150" name="id150">torrent_paused_alert</a></li>
<li><a class="reference" href="#torrent-resumed-alert" id="id151" name="id151">torrent_resumed_alert</a></li>
<li><a class="reference" href="#save-resume-data-alert" id="id152" name="id152">save_resume_data_alert</a></li>
<li><a class="reference" href="#save-resume-data-failed-alert" id="id153" name="id153">save_resume_data_failed_alert</a></li>
<li><a class="reference" href="#dispatcher" id="id154" name="id154">dispatcher</a></li>
<li><a class="reference" href="#alerts" id="id128" name="id128">alerts</a><ul>
<li><a class="reference" href="#external-ip-alert" id="id129" name="id129">external_ip_alert</a></li>
<li><a class="reference" href="#listen-failed-alert" id="id130" name="id130">listen_failed_alert</a></li>
<li><a class="reference" href="#portmap-error-alert" id="id131" name="id131">portmap_error_alert</a></li>
<li><a class="reference" href="#portmap-alert" id="id132" name="id132">portmap_alert</a></li>
<li><a class="reference" href="#file-error-alert" id="id133" name="id133">file_error_alert</a></li>
<li><a class="reference" href="#tracker-announce-alert" id="id134" name="id134">tracker_announce_alert</a></li>
<li><a class="reference" href="#tracker-error-alert" id="id135" name="id135">tracker_error_alert</a></li>
<li><a class="reference" href="#tracker-reply-alert" id="id136" name="id136">tracker_reply_alert</a></li>
<li><a class="reference" href="#dht-reply-alert" id="id137" name="id137">dht_reply_alert</a></li>
<li><a class="reference" href="#tracker-warning-alert" id="id138" name="id138">tracker_warning_alert</a></li>
<li><a class="reference" href="#scrape-reply-alert" id="id139" name="id139">scrape_reply_alert</a></li>
<li><a class="reference" href="#scrape-failed-alert" id="id140" name="id140">scrape_failed_alert</a></li>
<li><a class="reference" href="#url-seed-alert" id="id141" name="id141">url_seed_alert</a></li>
<li><a class="reference" href="#hash-failed-alert" id="id142" name="id142">hash_failed_alert</a></li>
<li><a class="reference" href="#peer-ban-alert" id="id143" name="id143">peer_ban_alert</a></li>
<li><a class="reference" href="#peer-error-alert" id="id144" name="id144">peer_error_alert</a></li>
<li><a class="reference" href="#invalid-request-alert" id="id145" name="id145">invalid_request_alert</a></li>
<li><a class="reference" href="#torrent-finished-alert" id="id146" name="id146">torrent_finished_alert</a></li>
<li><a class="reference" href="#metadata-failed-alert" id="id147" name="id147">metadata_failed_alert</a></li>
<li><a class="reference" href="#metadata-received-alert" id="id148" name="id148">metadata_received_alert</a></li>
<li><a class="reference" href="#fastresume-rejected-alert" id="id149" name="id149">fastresume_rejected_alert</a></li>
<li><a class="reference" href="#peer-blocked-alert" id="id150" name="id150">peer_blocked_alert</a></li>
<li><a class="reference" href="#storage-moved-alert" id="id151" name="id151">storage_moved_alert</a></li>
<li><a class="reference" href="#torrent-paused-alert" id="id152" name="id152">torrent_paused_alert</a></li>
<li><a class="reference" href="#torrent-resumed-alert" id="id153" name="id153">torrent_resumed_alert</a></li>
<li><a class="reference" href="#save-resume-data-alert" id="id154" name="id154">save_resume_data_alert</a></li>
<li><a class="reference" href="#save-resume-data-failed-alert" id="id155" name="id155">save_resume_data_failed_alert</a></li>
<li><a class="reference" href="#dispatcher" id="id156" name="id156">dispatcher</a></li>
</ul>
</li>
<li><a class="reference" href="#exceptions" id="id155" name="id155">exceptions</a><ul>
<li><a class="reference" href="#invalid-handle" id="id156" name="id156">invalid_handle</a></li>
<li><a class="reference" href="#duplicate-torrent" id="id157" name="id157">duplicate_torrent</a></li>
<li><a class="reference" href="#invalid-encoding" id="id158" name="id158">invalid_encoding</a></li>
<li><a class="reference" href="#type-error" id="id159" name="id159">type_error</a></li>
<li><a class="reference" href="#invalid-torrent-file" id="id160" name="id160">invalid_torrent_file</a></li>
<li><a class="reference" href="#exceptions" id="id157" name="id157">exceptions</a><ul>
<li><a class="reference" href="#invalid-handle" id="id158" name="id158">invalid_handle</a></li>
<li><a class="reference" href="#duplicate-torrent" id="id159" name="id159">duplicate_torrent</a></li>
<li><a class="reference" href="#invalid-encoding" id="id160" name="id160">invalid_encoding</a></li>
<li><a class="reference" href="#type-error" id="id161" name="id161">type_error</a></li>
<li><a class="reference" href="#invalid-torrent-file" id="id162" name="id162">invalid_torrent_file</a></li>
</ul>
</li>
<li><a class="reference" href="#storage-interface" id="id161" name="id161">storage_interface</a><ul>
<li><a class="reference" href="#initialize" id="id162" name="id162">initialize()</a></li>
<li><a class="reference" href="#read" id="id163" name="id163">read()</a></li>
<li><a class="reference" href="#write" id="id164" name="id164">write()</a></li>
<li><a class="reference" href="#id12" id="id165" name="id165">move_storage()</a></li>
<li><a class="reference" href="#verify-resume-data" id="id166" name="id166">verify_resume_data()</a></li>
<li><a class="reference" href="#write-resume-data" id="id167" name="id167">write_resume_data()</a></li>
<li><a class="reference" href="#move-slot" id="id168" name="id168">move_slot()</a></li>
<li><a class="reference" href="#swap-slots" id="id169" name="id169">swap_slots()</a></li>
<li><a class="reference" href="#swap-slots3" id="id170" name="id170">swap_slots3()</a></li>
<li><a class="reference" href="#hash-for-slot" id="id171" name="id171">hash_for_slot()</a></li>
<li><a class="reference" href="#release-files" id="id172" name="id172">release_files()</a></li>
<li><a class="reference" href="#delete-files" id="id173" name="id173">delete_files()</a></li>
<li><a class="reference" href="#storage-interface" id="id163" name="id163">storage_interface</a><ul>
<li><a class="reference" href="#initialize" id="id164" name="id164">initialize()</a></li>
<li><a class="reference" href="#read" id="id165" name="id165">read()</a></li>
<li><a class="reference" href="#write" id="id166" name="id166">write()</a></li>
<li><a class="reference" href="#id12" id="id167" name="id167">move_storage()</a></li>
<li><a class="reference" href="#verify-resume-data" id="id168" name="id168">verify_resume_data()</a></li>
<li><a class="reference" href="#write-resume-data" id="id169" name="id169">write_resume_data()</a></li>
<li><a class="reference" href="#move-slot" id="id170" name="id170">move_slot()</a></li>
<li><a class="reference" href="#swap-slots" id="id171" name="id171">swap_slots()</a></li>
<li><a class="reference" href="#swap-slots3" id="id172" name="id172">swap_slots3()</a></li>
<li><a class="reference" href="#hash-for-slot" id="id173" name="id173">hash_for_slot()</a></li>
<li><a class="reference" href="#release-files" id="id174" name="id174">release_files()</a></li>
<li><a class="reference" href="#delete-files" id="id175" name="id175">delete_files()</a></li>
</ul>
</li>
<li><a class="reference" href="#queuing" id="id174" name="id174">queuing</a><ul>
<li><a class="reference" href="#downloading" id="id175" name="id175">downloading</a></li>
<li><a class="reference" href="#seeding" id="id176" name="id176">seeding</a></li>
<li><a class="reference" href="#magnet-links" id="id176" name="id176">magnet links</a></li>
<li><a class="reference" href="#queuing" id="id177" name="id177">queuing</a><ul>
<li><a class="reference" href="#downloading" id="id178" name="id178">downloading</a></li>
<li><a class="reference" href="#seeding" id="id179" name="id179">seeding</a></li>
</ul>
</li>
<li><a class="reference" href="#fast-resume" id="id177" name="id177">fast resume</a><ul>
<li><a class="reference" href="#file-format" id="id178" name="id178">file format</a></li>
<li><a class="reference" href="#fast-resume" id="id180" name="id180">fast resume</a><ul>
<li><a class="reference" href="#file-format" id="id181" name="id181">file format</a></li>
</ul>
</li>
<li><a class="reference" href="#threads" id="id179" name="id179">threads</a></li>
<li><a class="reference" href="#storage-allocation" id="id180" name="id180">storage allocation</a><ul>
<li><a class="reference" href="#sparse-allocation" id="id181" name="id181">sparse allocation</a></li>
<li><a class="reference" href="#full-allocation" id="id182" name="id182">full allocation</a></li>
<li><a class="reference" href="#compact-allocation" id="id183" name="id183">compact allocation</a></li>
<li><a class="reference" href="#threads" id="id182" name="id182">threads</a></li>
<li><a class="reference" href="#storage-allocation" id="id183" name="id183">storage allocation</a><ul>
<li><a class="reference" href="#sparse-allocation" id="id184" name="id184">sparse allocation</a></li>
<li><a class="reference" href="#full-allocation" id="id185" name="id185">full allocation</a></li>
<li><a class="reference" href="#compact-allocation" id="id186" name="id186">compact allocation</a></li>
</ul>
</li>
<li><a class="reference" href="#extensions" id="id184" name="id184">extensions</a><ul>
<li><a class="reference" href="#metadata-from-peers" id="id185" name="id185">metadata from peers</a></li>
<li><a class="reference" href="#http-seeding" id="id186" name="id186">HTTP seeding</a></li>
<li><a class="reference" href="#extensions" id="id187" name="id187">extensions</a><ul>
<li><a class="reference" href="#metadata-from-peers" id="id188" name="id188">metadata from peers</a></li>
<li><a class="reference" href="#http-seeding" id="id189" name="id189">HTTP seeding</a></li>
</ul>
</li>
<li><a class="reference" href="#filename-checks" id="id187" name="id187">filename checks</a></li>
<li><a class="reference" href="#acknowledgments" id="id188" name="id188">acknowledgments</a></li>
<li><a class="reference" href="#filename-checks" id="id190" name="id190">filename checks</a></li>
<li><a class="reference" href="#acknowledgments" id="id191" name="id191">acknowledgments</a></li>
</ul>
</div>
<div class="section">
@ -3633,6 +3636,32 @@ entry e = bdecode(buf, buf + data_size);
<p>If <tt class="docutils literal"><span class="pre">bdecode()</span></tt> encounters invalid encoded data in the range given to it
it will throw <a class="reference" href="#invalid-encoding">invalid_encoding</a>.</p>
</div>
<div class="section">
<h2><a id="add-magnet-uri" name="add-magnet-uri">add_magnet_uri()</a></h2>
<blockquote>
<pre class="literal-block">
torrent_handle add_magnet_uri(session&amp; ses, std::string const&amp; uri
add_torrent_params p);
</pre>
</blockquote>
<p>This function parses the magnet URI (<tt class="docutils literal"><span class="pre">uri</span></tt>) as a bittorrent magnet link,
and adds the torrent to the specified session (<tt class="docutils literal"><span class="pre">ses</span></tt>). It returns the
handle to the newly added torrent, or an invalid handle in case parsing
failed. To control some initial settings of the torrent, sepcify those in
the <tt class="docutils literal"><span class="pre">add_torrent_params</span></tt>, <tt class="docutils literal"><span class="pre">p</span></tt>. See <a class="reference" href="#add-torrent">add_torrent()</a>.</p>
<p>For more information about magnet links, see <a class="reference" href="#magnet-links">magnet links</a>.</p>
</div>
<div class="section">
<h2><a id="make-magnet-uri" name="make-magnet-uri">make_magnet_uri()</a></h2>
<blockquote>
<pre class="literal-block">
std::string make_magnet_uri(torrent_handle const&amp; handle);
</pre>
</blockquote>
<p>Generates a magnet URI from the specified torrent. If the torrent
handle is invalid, an empty string is returned.</p>
<p>For more information about magnet links, see <a class="reference" href="#magnet-links">magnet links</a>.</p>
</div>
</div>
<div class="section">
<h1><a id="alerts" name="alerts">alerts</a></h1>
@ -4406,6 +4435,15 @@ void delete_files() = 0;
</div>
</div>
<div class="section">
<h1><a id="magnet-links" name="magnet-links">magnet links</a></h1>
<p>Magnet links are URIs that includes an info-hash, a display name and optionally
a tracker url. The idea behind magnet links is that an end user can click on a
link in a browser and have it handled by a bittorrent application, to start a
download, without any .torrent file.</p>
<p>The format of the magnet URI is:</p>
<p><strong>magnet:?xt=urn:btih:</strong> <em>Base32 encoded info-hash</em> [ <strong>&amp;dn=</strong> <em>name of download</em> ] [ <strong>&amp;tr=</strong> <em>tracker URL</em> ]*</p>
</div>
<div class="section">
<h1><a id="queuing" name="queuing">queuing</a></h1>
<p>libtorrent supports <em>queuing</em>. Which means it makes sure that a limited number of
torrents are being downloaded at any given time, and once a torrent is completely

View File

@ -3722,6 +3722,34 @@ Now we just need to know how to retrieve information from the entry_.
If ``bdecode()`` encounters invalid encoded data in the range given to it
it will throw invalid_encoding_.
add_magnet_uri()
----------------
::
torrent_handle add_magnet_uri(session& ses, std::string const& uri
add_torrent_params p);
This function parses the magnet URI (``uri``) as a bittorrent magnet link,
and adds the torrent to the specified session (``ses``). It returns the
handle to the newly added torrent, or an invalid handle in case parsing
failed. To control some initial settings of the torrent, sepcify those in
the ``add_torrent_params``, ``p``. See `add_torrent()`_.
For more information about magnet links, see `magnet links`_.
make_magnet_uri()
-----------------
::
std::string make_magnet_uri(torrent_handle const& handle);
Generates a magnet URI from the specified torrent. If the torrent
handle is invalid, an empty string is returned.
For more information about magnet links, see `magnet links`_.
alerts
======
@ -4611,6 +4639,18 @@ delete_files()
This function should delete all files and directories belonging to this storage.
magnet links
============
Magnet links are URIs that includes an info-hash, a display name and optionally
a tracker url. The idea behind magnet links is that an end user can click on a
link in a browser and have it handled by a bittorrent application, to start a
download, without any .torrent file.
The format of the magnet URI is:
**magnet:?xt=urn:btih:** *Base32 encoded info-hash* [ **&dn=** *name of download* ] [ **&tr=** *tracker URL* ]*
queuing
=======

View File

@ -861,6 +861,7 @@ int main(int ac, char* av[])
ses.set_peer_proxy(ps);
ses.set_web_seed_proxy(ps);
#ifndef TORRENT_NO_DEPRECATE
if (log_level == "debug")
ses.set_severity_level(alert::debug);
else if (log_level == "warning")
@ -869,6 +870,7 @@ int main(int ac, char* av[])
ses.set_severity_level(alert::fatal);
else
ses.set_severity_level(alert::info);
#endif
boost::filesystem::ifstream ses_state_file(".ses_state"
, std::ios_base::binary);
@ -956,10 +958,12 @@ int main(int ac, char* av[])
// first see if this is a torrentless download
if (i->substr(0, 7) == "magnet:")
{
add_torrent_params p;
p.save_path = save_path;
p.storage_mode = compact_allocation_mode ? storage_mode_compact
: storage_mode_sparse;
std::cout << "adding MANGET link: " << *i << std::endl;
torrent_handle h = add_magnet_uri(ses, *i, save_path
, compact_allocation_mode ? storage_mode_compact
: storage_mode_sparse);
torrent_handle h = add_magnet_uri(ses, *i, p);
handles.insert(std::make_pair(std::string(), h));

View File

@ -60,7 +60,10 @@ int main(int argc, char* argv[])
{
session s;
s.listen_on(std::make_pair(6881, 6889));
s.add_torrent(torrent_info(argv[1]), "./");
add_torrent_params p;
p.save_path = "./";
p.ti = new torrent_info(argv[1]);
s.add_torrent(p);
// wait for the user to end
char a;

View File

@ -96,7 +96,9 @@ namespace libtorrent {
virtual std::string message() const = 0;
virtual int category() const = 0;
#ifndef TORRENT_NO_DEPRECATE
severity_t severity() const TORRENT_DEPRECATED { return warning; }
#endif
virtual std::auto_ptr<alert> clone() const = 0;

View File

@ -47,12 +47,18 @@ namespace libtorrent
std::string TORRENT_EXPORT make_magnet_uri(torrent_handle const& handle);
#ifndef TORRENT_NO_DEPRECATE
// deprecated in 0.14
torrent_handle TORRENT_EXPORT add_magnet_uri(session& ses, std::string const& uri
, fs::path const& save_path
, storage_mode_t storage_mode = storage_mode_sparse
, bool paused = false
, storage_constructor_type sc = default_storage_constructor
, void* userdata = 0);
, void* userdata = 0) TORRENT_DEPRECATED;
#endif
torrent_handle TORRENT_EXPORT add_magnet_uri(session& ses, std::string const& uri
, add_torrent_params p);
}
#endif

View File

@ -179,6 +179,7 @@ namespace libtorrent
// all torrent_handles must be destructed before the session is destructed!
torrent_handle add_torrent(add_torrent_params const& params);
#ifndef TORRENT_NO_DEPRECATE
// deprecated in 0.14
torrent_handle add_torrent(
torrent_info const& ti
@ -209,6 +210,7 @@ namespace libtorrent
, bool paused = false
, storage_constructor_type sc = default_storage_constructor
, void* userdata = 0) TORRENT_DEPRECATED;
#endif
session_proxy abort() { return session_proxy(m_impl); }
@ -317,7 +319,9 @@ namespace libtorrent
void set_max_half_open_connections(int limit);
std::auto_ptr<alert> pop_alert();
#ifndef TORRENT_NO_DEPRECATE
void set_severity_level(alert::severity_t s) TORRENT_DEPRECATED;
#endif
void set_alert_mask(int m);
alert const* wait_for_alert(time_duration max_wait);

View File

@ -319,10 +319,12 @@ namespace libtorrent
torrent_status status() const;
void get_download_queue(std::vector<partial_piece_info>& queue) const;
#ifndef TORRENT_NO_DEPRECATE
// fills the specified vector with the download progress [0, 1]
// of each file in the torrent. The files are ordered as in
// the torrent_info.
void file_progress(std::vector<float>& progress) const TORRENT_DEPRECATED;
#endif
void file_progress(std::vector<size_type>& progress) const;
void clear_error() const;
@ -370,6 +372,7 @@ namespace libtorrent
// ================ start deprecation ============
#ifndef TORRENT_NO_DEPRECATE
// deprecated in 0.13
// marks the piece with the given index as filtered
// it will not be downloaded
@ -382,6 +385,7 @@ namespace libtorrent
void filter_files(std::vector<bool> const& files) const TORRENT_DEPRECATED;
// ================ end deprecation ============
#endif
void piece_availability(std::vector<int>& avail) const;
@ -403,10 +407,12 @@ namespace libtorrent
// to.
void use_interface(const char* net_interface) const;
#ifndef TORRENT_NO_DEPRECATE
// deprecated in 0.14
// use save_resume_data() instead. It is async. and
// will return the resume data in an alert
entry write_resume_data() const TORRENT_DEPRECATED;
#endif
// forces this torrent to reannounce
// (make a rerequest from the tracker)

View File

@ -125,11 +125,13 @@ namespace libtorrent
peer_request map_file(int file, size_type offset, int size) const
{ return m_files.map_file(file, offset, size); }
#ifndef TORRENT_NO_DEPRECATE
// ------- start deprecation -------
// these functions will be removed in a future version
torrent_info(entry const& torrent_file) TORRENT_DEPRECATED;
void print(std::ostream& os) const TORRENT_DEPRECATED;
// ------- end deprecation -------
#endif
bool is_valid() const { return m_files.is_valid(); }

View File

@ -69,6 +69,7 @@ namespace libtorrent
return ret.str();
}
#ifndef TORRENT_NO_DEPRECATE
torrent_handle add_magnet_uri(session& ses, std::string const& uri
, fs::path const& save_path
, storage_mode_t storage_mode
@ -95,6 +96,31 @@ namespace libtorrent
, name.empty() ? 0 : name.c_str(), save_path, entry()
, storage_mode, paused, sc, userdata);
}
#endif
torrent_handle add_magnet_uri(session& ses, std::string const& uri
, add_torrent_params p)
{
std::string name;
std::string tracker;
boost::optional<std::string> display_name = url_has_argument(uri, "dn");
if (display_name) name = unescape_string(display_name->c_str());
boost::optional<std::string> tracker_string = url_has_argument(uri, "tr");
if (tracker_string) tracker = unescape_string(tracker_string->c_str());
boost::optional<std::string> btih = url_has_argument(uri, "xt");
if (!btih) return torrent_handle();
if (btih->compare(0, 9, "urn:btih:") != 0) return torrent_handle();
sha1_hash info_hash(base32decode(btih->substr(9)));
if (!tracker.empty()) p.tracker_url = tracker.c_str();
p.info_hash = info_hash;
if (!name.empty()) p.name = name.c_str();
return ses.add_torrent(p);
}
}

View File

@ -244,6 +244,7 @@ namespace libtorrent
return m_impl->add_torrent(params);
}
#ifndef TORRENT_NO_DEPRECATE
// if the torrent already exists, this will throw duplicate_torrent
torrent_handle session::add_torrent(
torrent_info const& ti
@ -311,6 +312,7 @@ namespace libtorrent
p.userdata = userdata;
return m_impl->add_torrent(p);
}
#endif
void session::remove_torrent(const torrent_handle& h, int options)
{
@ -518,6 +520,7 @@ namespace libtorrent
m_impl->set_alert_mask(m);
}
#ifndef TORRENT_NO_DEPRECATE
void session::set_severity_level(alert::severity_t s)
{
int m = 0;
@ -535,6 +538,7 @@ namespace libtorrent
m_impl->set_alert_mask(m);
}
#endif
void session::start_lsd()
{

View File

@ -332,11 +332,13 @@ namespace libtorrent
TORRENT_FORWARD(set_tracker_login(name, password));
}
#ifndef TORRENT_NO_DEPRECATE
void torrent_handle::file_progress(std::vector<float>& progress) const
{
INVARIANT_CHECK;
TORRENT_FORWARD(file_progress(progress));
}
#endif
void torrent_handle::file_progress(std::vector<size_type>& progress) const
{
@ -426,6 +428,7 @@ namespace libtorrent
return ret;
}
#ifndef TORRENT_NO_DEPRECATE
// ============ start deprecation ===============
void torrent_handle::filter_piece(int index, bool filter) const
@ -461,7 +464,7 @@ namespace libtorrent
}
// ============ end deprecation ===============
#endif
std::vector<announce_entry> const& torrent_handle::trackers() const
{
@ -525,6 +528,7 @@ namespace libtorrent
return !m_torrent.expired();
}
#ifndef TORRENT_NO_DEPRECATE
entry torrent_handle::write_resume_data() const
{
INVARIANT_CHECK;
@ -535,7 +539,7 @@ namespace libtorrent
return ret;
}
#endif
fs::path torrent_handle::save_path() const
{

View File

@ -227,6 +227,7 @@ namespace libtorrent
return 0;
}
#ifndef TORRENT_NO_DEPRECATE
// standard constructor that parses a torrent file
torrent_info::torrent_info(entry const& torrent_file)
: m_creation_date(pt::ptime(pt::not_a_date_time))
@ -249,6 +250,7 @@ namespace libtorrent
parse_torrent_file(e, error);
#endif
}
#endif
torrent_info::torrent_info(lazy_entry const& torrent_file)
: m_creation_date(pt::ptime(pt::not_a_date_time))
@ -583,6 +585,7 @@ namespace libtorrent
, bind(&announce_entry::tier, _1), bind(&announce_entry::tier, _2)));
}
#ifndef TORRENT_NO_DEPRECATE
// ------- start deprecation -------
void torrent_info::print(std::ostream& os) const
@ -606,6 +609,7 @@ namespace libtorrent
}
// ------- end deprecation -------
#endif
}