refactored extensions and added a plugin interface. fixed file.cpp for windows

This commit is contained in:
Arvid Norberg
2006-11-14 00:08:16 +00:00
parent b5e6c66e64
commit e35fc5c4be
43 changed files with 2094 additions and 1145 deletions

View File

@@ -32,49 +32,49 @@
<li><a class="reference" href="#abort" id="id20" name="id20">abort()</a></li>
<li><a class="reference" href="#add-torrent" id="id21" name="id21">add_torrent()</a></li>
<li><a class="reference" href="#remove-torrent" id="id22" name="id22">remove_torrent()</a></li>
<li><a class="reference" href="#disable-extensions-enable-extension" id="id23" name="id23">disable_extensions() enable_extension()</a></li>
<li><a class="reference" href="#set-upload-rate-limit-set-download-rate-limit" id="id24" name="id24">set_upload_rate_limit() set_download_rate_limit()</a></li>
<li><a class="reference" href="#set-max-uploads-set-max-connections" id="id25" name="id25">set_max_uploads() set_max_connections()</a></li>
<li><a class="reference" href="#set-max-half-open-connections" id="id26" name="id26">set_max_half_open_connections()</a></li>
<li><a class="reference" href="#set-ip-filter" id="id27" name="id27">set_ip_filter()</a></li>
<li><a class="reference" href="#status" id="id28" name="id28">status()</a></li>
<li><a class="reference" href="#is-listening-listen-port-listen-on" id="id29" name="id29">is_listening() listen_port() listen_on()</a></li>
<li><a class="reference" href="#pop-alert-set-severity-level" id="id30" name="id30">pop_alert() set_severity_level()</a></li>
<li><a class="reference" href="#start-dht-stop-dht-set-dht-settings-dht-state" id="id31" name="id31">start_dht() stop_dht() set_dht_settings() dht_state()</a></li>
<li><a class="reference" href="#add-dht-node-add-dht-router" id="id32" name="id32">add_dht_node() add_dht_router()</a></li>
<li><a class="reference" href="#set-upload-rate-limit-set-download-rate-limit" id="id23" name="id23">set_upload_rate_limit() set_download_rate_limit()</a></li>
<li><a class="reference" href="#set-max-uploads-set-max-connections" id="id24" name="id24">set_max_uploads() set_max_connections()</a></li>
<li><a class="reference" href="#set-max-half-open-connections" id="id25" name="id25">set_max_half_open_connections()</a></li>
<li><a class="reference" href="#set-ip-filter" id="id26" name="id26">set_ip_filter()</a></li>
<li><a class="reference" href="#status" id="id27" name="id27">status()</a></li>
<li><a class="reference" href="#is-listening-listen-port-listen-on" id="id28" name="id28">is_listening() listen_port() listen_on()</a></li>
<li><a class="reference" href="#pop-alert-set-severity-level" id="id29" name="id29">pop_alert() set_severity_level()</a></li>
<li><a class="reference" href="#start-dht-stop-dht-set-dht-settings-dht-state" id="id30" name="id30">start_dht() stop_dht() set_dht_settings() dht_state()</a></li>
<li><a class="reference" href="#add-dht-node-add-dht-router" id="id31" name="id31">add_dht_node() add_dht_router()</a></li>
</ul>
</li>
<li><a class="reference" href="#entry" id="id33" name="id33">entry</a><ul>
<li><a class="reference" href="#integer-string-list-dict-type" id="id34" name="id34">integer() string() list() dict() type()</a></li>
<li><a class="reference" href="#operator" id="id35" name="id35">operator[]</a></li>
<li><a class="reference" href="#find-key" id="id36" name="id36">find_key()</a></li>
<li><a class="reference" href="#entry" id="id32" name="id32">entry</a><ul>
<li><a class="reference" href="#integer-string-list-dict-type" id="id33" name="id33">integer() string() list() dict() type()</a></li>
<li><a class="reference" href="#operator" id="id34" name="id34">operator[]</a></li>
<li><a class="reference" href="#find-key" id="id35" name="id35">find_key()</a></li>
</ul>
</li>
<li><a class="reference" href="#torrent-info" id="id37" name="id37">torrent_info</a><ul>
<li><a class="reference" href="#id3" id="id38" name="id38">torrent_info()</a></li>
<li><a class="reference" href="#set-comment-set-piece-size-set-creator-set-hash-add-tracker-add-file" id="id39" name="id39">set_comment() set_piece_size() set_creator() set_hash() add_tracker() add_file()</a></li>
<li><a class="reference" href="#create-torrent" id="id40" name="id40">create_torrent()</a></li>
<li><a class="reference" href="#begin-files-end-files-rbegin-files-rend-files" id="id41" name="id41">begin_files() end_files() rbegin_files() rend_files()</a></li>
<li><a class="reference" href="#num-files-file-at" id="id42" name="id42">num_files() file_at()</a></li>
<li><a class="reference" href="#map-block" id="id43" name="id43">map_block()</a></li>
<li><a class="reference" href="#map-file" id="id44" name="id44">map_file()</a></li>
<li><a class="reference" href="#url-seeds" id="id45" name="id45">url_seeds()</a></li>
<li><a class="reference" href="#print" id="id46" name="id46">print()</a></li>
<li><a class="reference" href="#trackers" id="id47" name="id47">trackers()</a></li>
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id48" name="id48">total_size() piece_length() piece_size() num_pieces()</a></li>
<li><a class="reference" href="#hash-for-piece-info-hash" id="id49" name="id49">hash_for_piece() info_hash()</a></li>
<li><a class="reference" href="#name-comment-creation-date-creator" id="id50" name="id50">name() comment() creation_date() creator()</a></li>
<li><a class="reference" href="#priv-set-priv" id="id51" name="id51">priv() set_priv()</a></li>
<li><a class="reference" href="#nodes" id="id52" name="id52">nodes()</a></li>
<li><a class="reference" href="#add-node" id="id53" name="id53">add_node()</a></li>
<li><a class="reference" href="#torrent-info" id="id36" name="id36">torrent_info</a><ul>
<li><a class="reference" href="#id3" id="id37" name="id37">torrent_info()</a></li>
<li><a class="reference" href="#set-comment-set-piece-size-set-creator-set-hash-add-tracker-add-file" id="id38" name="id38">set_comment() set_piece_size() set_creator() set_hash() add_tracker() add_file()</a></li>
<li><a class="reference" href="#create-torrent" id="id39" name="id39">create_torrent()</a></li>
<li><a class="reference" href="#begin-files-end-files-rbegin-files-rend-files" id="id40" name="id40">begin_files() end_files() rbegin_files() rend_files()</a></li>
<li><a class="reference" href="#num-files-file-at" id="id41" name="id41">num_files() file_at()</a></li>
<li><a class="reference" href="#map-block" id="id42" name="id42">map_block()</a></li>
<li><a class="reference" href="#map-file" id="id43" name="id43">map_file()</a></li>
<li><a class="reference" href="#url-seeds" id="id44" name="id44">url_seeds()</a></li>
<li><a class="reference" href="#print" id="id45" name="id45">print()</a></li>
<li><a class="reference" href="#trackers" id="id46" name="id46">trackers()</a></li>
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id47" name="id47">total_size() piece_length() piece_size() num_pieces()</a></li>
<li><a class="reference" href="#hash-for-piece-info-hash" id="id48" name="id48">hash_for_piece() info_hash()</a></li>
<li><a class="reference" href="#name-comment-creation-date-creator" id="id49" name="id49">name() comment() creation_date() creator()</a></li>
<li><a class="reference" href="#priv-set-priv" id="id50" name="id50">priv() set_priv()</a></li>
<li><a class="reference" href="#nodes" id="id51" name="id51">nodes()</a></li>
<li><a class="reference" href="#add-node" id="id52" name="id52">add_node()</a></li>
</ul>
</li>
<li><a class="reference" href="#torrent-handle" id="id54" name="id54">torrent_handle</a><ul>
<li><a class="reference" href="#file-progress" id="id55" name="id55">file_progress()</a></li>
<li><a class="reference" href="#save-path" id="id56" name="id56">save_path()</a></li>
<li><a class="reference" href="#move-storage" id="id57" name="id57">move_storage()</a></li>
<li><a class="reference" href="#force-reannounce" id="id58" name="id58">force_reannounce()</a></li>
<li><a class="reference" href="#connect-peer" id="id59" name="id59">connect_peer()</a></li>
<li><a class="reference" href="#torrent-handle" id="id53" name="id53">torrent_handle</a><ul>
<li><a class="reference" href="#file-progress" id="id54" name="id54">file_progress()</a></li>
<li><a class="reference" href="#save-path" id="id55" name="id55">save_path()</a></li>
<li><a class="reference" href="#move-storage" id="id56" name="id56">move_storage()</a></li>
<li><a class="reference" href="#force-reannounce" id="id57" name="id57">force_reannounce()</a></li>
<li><a class="reference" href="#connect-peer" id="id58" name="id58">connect_peer()</a></li>
<li><a class="reference" href="#name" id="id59" name="id59">name()</a></li>
<li><a class="reference" href="#set-ratio" id="id60" name="id60">set_ratio()</a></li>
<li><a class="reference" href="#set-upload-limit-set-download-limit" id="id61" name="id61">set_upload_limit() set_download_limit()</a></li>
<li><a class="reference" href="#set-sequenced-download-threshold" id="id62" name="id62">set_sequenced_download_threshold()</a></li>
@@ -89,78 +89,77 @@
<li><a class="reference" href="#info-hash" id="id71" name="id71">info_hash()</a></li>
<li><a class="reference" href="#id5" id="id72" name="id72">set_max_uploads() set_max_connections()</a></li>
<li><a class="reference" href="#write-resume-data" id="id73" name="id73">write_resume_data()</a></li>
<li><a class="reference" href="#metadata" id="id74" name="id74">metadata()</a></li>
<li><a class="reference" href="#id6" id="id75" name="id75">status()</a></li>
<li><a class="reference" href="#get-download-queue" id="id76" name="id76">get_download_queue()</a></li>
<li><a class="reference" href="#get-peer-info" id="id77" name="id77">get_peer_info()</a></li>
<li><a class="reference" href="#get-torrent-info" id="id78" name="id78">get_torrent_info()</a></li>
<li><a class="reference" href="#is-valid" id="id79" name="id79">is_valid()</a></li>
<li><a class="reference" href="#id6" id="id74" name="id74">status()</a></li>
<li><a class="reference" href="#get-download-queue" id="id75" name="id75">get_download_queue()</a></li>
<li><a class="reference" href="#get-peer-info" id="id76" name="id76">get_peer_info()</a></li>
<li><a class="reference" href="#get-torrent-info" id="id77" name="id77">get_torrent_info()</a></li>
<li><a class="reference" href="#is-valid" id="id78" name="id78">is_valid()</a></li>
</ul>
</li>
<li><a class="reference" href="#torrent-status" id="id80" name="id80">torrent_status</a></li>
<li><a class="reference" href="#peer-info" id="id81" name="id81">peer_info</a></li>
<li><a class="reference" href="#session-settings" id="id82" name="id82">session_settings</a></li>
<li><a class="reference" href="#ip-filter" id="id83" name="id83">ip_filter</a><ul>
<li><a class="reference" href="#id8" id="id84" name="id84">ip_filter()</a></li>
<li><a class="reference" href="#add-rule" id="id85" name="id85">add_rule()</a></li>
<li><a class="reference" href="#access" id="id86" name="id86">access()</a></li>
<li><a class="reference" href="#export-filter" id="id87" name="id87">export_filter()</a></li>
<li><a class="reference" href="#torrent-status" id="id79" name="id79">torrent_status</a></li>
<li><a class="reference" href="#peer-info" id="id80" name="id80">peer_info</a></li>
<li><a class="reference" href="#session-settings" id="id81" name="id81">session_settings</a></li>
<li><a class="reference" href="#ip-filter" id="id82" name="id82">ip_filter</a><ul>
<li><a class="reference" href="#id8" id="id83" name="id83">ip_filter()</a></li>
<li><a class="reference" href="#add-rule" id="id84" name="id84">add_rule()</a></li>
<li><a class="reference" href="#access" id="id85" name="id85">access()</a></li>
<li><a class="reference" href="#export-filter" id="id86" name="id86">export_filter()</a></li>
</ul>
</li>
<li><a class="reference" href="#big-number" id="id88" name="id88">big_number</a></li>
<li><a class="reference" href="#hasher" id="id89" name="id89">hasher</a></li>
<li><a class="reference" href="#fingerprint" id="id90" name="id90">fingerprint</a></li>
<li><a class="reference" href="#free-functions" id="id91" name="id91">free functions</a><ul>
<li><a class="reference" href="#identify-client" id="id92" name="id92">identify_client()</a></li>
<li><a class="reference" href="#client-fingerprint" id="id93" name="id93">client_fingerprint()</a></li>
<li><a class="reference" href="#bdecode-bencode" id="id94" name="id94">bdecode() bencode()</a></li>
<li><a class="reference" href="#big-number" id="id87" name="id87">big_number</a></li>
<li><a class="reference" href="#hasher" id="id88" name="id88">hasher</a></li>
<li><a class="reference" href="#fingerprint" id="id89" name="id89">fingerprint</a></li>
<li><a class="reference" href="#free-functions" id="id90" name="id90">free functions</a><ul>
<li><a class="reference" href="#identify-client" id="id91" name="id91">identify_client()</a></li>
<li><a class="reference" href="#client-fingerprint" id="id92" name="id92">client_fingerprint()</a></li>
<li><a class="reference" href="#bdecode-bencode" id="id93" name="id93">bdecode() bencode()</a></li>
</ul>
</li>
<li><a class="reference" href="#alerts" id="id95" name="id95">alerts</a><ul>
<li><a class="reference" href="#listen-failed-alert" id="id96" name="id96">listen_failed_alert</a></li>
<li><a class="reference" href="#file-error-alert" id="id97" name="id97">file_error_alert</a></li>
<li><a class="reference" href="#tracker-announce-alert" id="id98" name="id98">tracker_announce_alert</a></li>
<li><a class="reference" href="#tracker-alert" id="id99" name="id99">tracker_alert</a></li>
<li><a class="reference" href="#tracker-reply-alert" id="id100" name="id100">tracker_reply_alert</a></li>
<li><a class="reference" href="#tracker-warning-alert" id="id101" name="id101">tracker_warning_alert</a></li>
<li><a class="reference" href="#url-seed-alert" id="id102" name="id102">url_seed_alert</a></li>
<li><a class="reference" href="#hash-failed-alert" id="id103" name="id103">hash_failed_alert</a></li>
<li><a class="reference" href="#peer-ban-alert" id="id104" name="id104">peer_ban_alert</a></li>
<li><a class="reference" href="#peer-error-alert" id="id105" name="id105">peer_error_alert</a></li>
<li><a class="reference" href="#invalid-request-alert" id="id106" name="id106">invalid_request_alert</a></li>
<li><a class="reference" href="#torrent-finished-alert" id="id107" name="id107">torrent_finished_alert</a></li>
<li><a class="reference" href="#metadata-failed-alert" id="id108" name="id108">metadata_failed_alert</a></li>
<li><a class="reference" href="#metadata-received-alert" id="id109" name="id109">metadata_received_alert</a></li>
<li><a class="reference" href="#fastresume-rejected-alert" id="id110" name="id110">fastresume_rejected_alert</a></li>
<li><a class="reference" href="#dispatcher" id="id111" name="id111">dispatcher</a></li>
<li><a class="reference" href="#alerts" id="id94" name="id94">alerts</a><ul>
<li><a class="reference" href="#listen-failed-alert" id="id95" name="id95">listen_failed_alert</a></li>
<li><a class="reference" href="#file-error-alert" id="id96" name="id96">file_error_alert</a></li>
<li><a class="reference" href="#tracker-announce-alert" id="id97" name="id97">tracker_announce_alert</a></li>
<li><a class="reference" href="#tracker-alert" id="id98" name="id98">tracker_alert</a></li>
<li><a class="reference" href="#tracker-reply-alert" id="id99" name="id99">tracker_reply_alert</a></li>
<li><a class="reference" href="#tracker-warning-alert" id="id100" name="id100">tracker_warning_alert</a></li>
<li><a class="reference" href="#url-seed-alert" id="id101" name="id101">url_seed_alert</a></li>
<li><a class="reference" href="#hash-failed-alert" id="id102" name="id102">hash_failed_alert</a></li>
<li><a class="reference" href="#peer-ban-alert" id="id103" name="id103">peer_ban_alert</a></li>
<li><a class="reference" href="#peer-error-alert" id="id104" name="id104">peer_error_alert</a></li>
<li><a class="reference" href="#invalid-request-alert" id="id105" name="id105">invalid_request_alert</a></li>
<li><a class="reference" href="#torrent-finished-alert" id="id106" name="id106">torrent_finished_alert</a></li>
<li><a class="reference" href="#metadata-failed-alert" id="id107" name="id107">metadata_failed_alert</a></li>
<li><a class="reference" href="#metadata-received-alert" id="id108" name="id108">metadata_received_alert</a></li>
<li><a class="reference" href="#fastresume-rejected-alert" id="id109" name="id109">fastresume_rejected_alert</a></li>
<li><a class="reference" href="#dispatcher" id="id110" name="id110">dispatcher</a></li>
</ul>
</li>
<li><a class="reference" href="#exceptions" id="id112" name="id112">exceptions</a><ul>
<li><a class="reference" href="#invalid-handle" id="id113" name="id113">invalid_handle</a></li>
<li><a class="reference" href="#duplicate-torrent" id="id114" name="id114">duplicate_torrent</a></li>
<li><a class="reference" href="#invalid-encoding" id="id115" name="id115">invalid_encoding</a></li>
<li><a class="reference" href="#type-error" id="id116" name="id116">type_error</a></li>
<li><a class="reference" href="#invalid-torrent-file" id="id117" name="id117">invalid_torrent_file</a></li>
<li><a class="reference" href="#exceptions" id="id111" name="id111">exceptions</a><ul>
<li><a class="reference" href="#invalid-handle" id="id112" name="id112">invalid_handle</a></li>
<li><a class="reference" href="#duplicate-torrent" id="id113" name="id113">duplicate_torrent</a></li>
<li><a class="reference" href="#invalid-encoding" id="id114" name="id114">invalid_encoding</a></li>
<li><a class="reference" href="#type-error" id="id115" name="id115">type_error</a></li>
<li><a class="reference" href="#invalid-torrent-file" id="id116" name="id116">invalid_torrent_file</a></li>
</ul>
</li>
<li><a class="reference" href="#fast-resume" id="id118" name="id118">fast resume</a><ul>
<li><a class="reference" href="#file-format" id="id119" name="id119">file format</a></li>
<li><a class="reference" href="#fast-resume" id="id117" name="id117">fast resume</a><ul>
<li><a class="reference" href="#file-format" id="id118" name="id118">file format</a></li>
</ul>
</li>
<li><a class="reference" href="#threads" id="id120" name="id120">threads</a></li>
<li><a class="reference" href="#storage-allocation" id="id121" name="id121">storage allocation</a><ul>
<li><a class="reference" href="#full-allocation" id="id122" name="id122">full allocation</a></li>
<li><a class="reference" href="#compact-allocation" id="id123" name="id123">compact allocation</a></li>
<li><a class="reference" href="#threads" id="id119" name="id119">threads</a></li>
<li><a class="reference" href="#storage-allocation" id="id120" name="id120">storage allocation</a><ul>
<li><a class="reference" href="#full-allocation" id="id121" name="id121">full allocation</a></li>
<li><a class="reference" href="#compact-allocation" id="id122" name="id122">compact allocation</a></li>
</ul>
</li>
<li><a class="reference" href="#extensions" id="id124" name="id124">extensions</a><ul>
<li><a class="reference" href="#chat-messages" id="id125" name="id125">chat messages</a></li>
<li><a class="reference" href="#metadata-from-peers" id="id126" name="id126">metadata from peers</a></li>
<li><a class="reference" href="#http-seeding" id="id127" name="id127">HTTP seeding</a></li>
<li><a class="reference" href="#extensions" id="id123" name="id123">extensions</a><ul>
<li><a class="reference" href="#chat-messages" id="id124" name="id124">chat messages</a></li>
<li><a class="reference" href="#metadata-from-peers" id="id125" name="id125">metadata from peers</a></li>
<li><a class="reference" href="#http-seeding" id="id126" name="id126">HTTP seeding</a></li>
</ul>
</li>
<li><a class="reference" href="#filename-checks" id="id128" name="id128">filename checks</a></li>
<li><a class="reference" href="#acknowledgments" id="id129" name="id129">acknowledgments</a></li>
<li><a class="reference" href="#filename-checks" id="id127" name="id127">filename checks</a></li>
<li><a class="reference" href="#acknowledgments" id="id128" name="id128">acknowledgments</a></li>
</ul>
</div>
<div class="section" id="overview">
@@ -236,6 +235,7 @@ class session: public boost::noncopyable
torrent_handle add_torrent(
char const* tracker_url
, sha1_hash const&amp; info_hash
, char const* name
, boost::filesystem::path const&amp; save_path
, entry const&amp; resume_data = entry()
, bool compact_mode = true
@@ -245,10 +245,6 @@ class session: public boost::noncopyable
void remove_torrent(torrent_handle const&amp; h);
void disable_extensions();
void enable_extension(
peer_connection::extension_index);
void set_settings(
session_settings const&amp; settings);
@@ -349,6 +345,7 @@ torrent_handle add_torrent(
torrent_handle add_torrent(
char const* tracker_url
, sha1_hash const&amp; info_hash
, char const* name
, boost::filesystem::path const&amp; save_path
, entry const&amp; resume_data = entry()
, bool compact_mode = true
@@ -380,7 +377,10 @@ about the torrent's progress, its peers etc. It is also used to abort a torrent.
<p>The second overload that takes a tracker url and an info-hash instead of metadata
(<tt class="docutils literal"><span class="pre">torrent_info</span></tt>) can be used with torrents where (at least some) peers support
the metadata extension. For the overload to be available, libtorrent must be built
with extensions enabled (<tt class="docutils literal"><span class="pre">TORRENT_ENABLE_EXTENSIONS</span></tt> defined).</p>
with extensions enabled (<tt class="docutils literal"><span class="pre">TORRENT_ENABLE_EXTENSIONS</span></tt> defined). It also takes an
optional <tt class="docutils literal"><span class="pre">name</span></tt> argument. This may be 0 in case no name should be assigned to the
torrent. In case it's not 0, the name is used for the torrent as long as it doesn't
have metadata. See <tt class="docutils literal"><span class="pre">torrent_handle::name</span></tt>.</p>
</div>
<div class="section" id="remove-torrent">
<h2><a name="remove-torrent">remove_torrent()</a></h2>
@@ -392,31 +392,6 @@ void remove_torrent(torrent_handle const&amp; h);
<p><tt class="docutils literal"><span class="pre">remove_torrent()</span></tt> will close all peer connections associated with the torrent and tell
the tracker that we've stopped participating in the swarm.</p>
</div>
<div class="section" id="disable-extensions-enable-extension">
<h2><a name="disable-extensions-enable-extension">disable_extensions() enable_extension()</a></h2>
<blockquote>
<pre class="literal-block">
void disable_extensions();
void enable_extension(peer_connection::extension_index);
</pre>
</blockquote>
<p><tt class="docutils literal"><span class="pre">disable_extensions()</span></tt> will disable all extensions available in libtorrent.
<tt class="docutils literal"><span class="pre">enable_extension()</span></tt> will enable a single extension. The available extensions
are enumerated in the <tt class="docutils literal"><span class="pre">peer_connection</span></tt> class. These are the available extensions:</p>
<pre class="literal-block">
enum extension_index
{
extended_chat_message,
extended_metadata_message,
extended_peer_exchange_message,
extended_listen_port_message,
num_supported_extensions
};
</pre>
<p><em>peer_exchange is not implemented yet</em></p>
<p>By default, all extensions are enabled.
For more information about the extensions, see the <a class="reference" href="#extensions">extensions</a> section.</p>
</div>
<div class="section" id="set-upload-rate-limit-set-download-rate-limit">
<h2><a name="set-upload-rate-limit-set-download-rate-limit">set_upload_rate_limit() set_download_rate_limit()</a></h2>
<blockquote>
@@ -596,6 +571,8 @@ address followed by a 2 bytes port number (also network byte order).</dd>
to start up the node again, passing this entry to <tt class="docutils literal"><span class="pre">start_dht</span></tt>. It is a good
idea to save this to disk when the session is closed, and read it up again
when starting.</p>
<p>If the port the DHT is supposed to listen on is already in use, and exception
is thrown, <tt class="docutils literal"><span class="pre">asio::error</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">stop_dht</span></tt> stops the dht node.</p>
<p><tt class="docutils literal"><span class="pre">add_dht_node</span></tt> adds a node to the routing table. This can be used if your
client has its own source of bootstrapping nodes.</p>
@@ -1175,8 +1152,9 @@ struct torrent_handle
torrent_info const&amp; get_torrent_info() const;
bool is_valid() const;
std::string name() const;
entry write_resume_data() const;
std::vector&lt;char&gt; const&amp; metadata() const;
void force_reannounce() const;
void connect_peer(asio::ip::tcp::endpoint const&amp; adr) const;
@@ -1295,6 +1273,17 @@ be disconnected. No harm can be done by using this other than an unnecessary con
attempt is made. If the torrent is uninitialized or in queued or checking mode, this
will throw <a class="reference" href="#invalid-handle">invalid_handle</a>.</p>
</div>
<div class="section" id="name">
<h2><a name="name">name()</a></h2>
<blockquote>
<pre class="literal-block">
std::string name() const;
</pre>
</blockquote>
<p>Returns the name of the torrent. i.e. the name from the metadata associated with it. In
case the torrent was started without metadata, and hasn't completely received it yet,
it returns the name given to it when added to the session. See <tt class="docutils literal"><span class="pre">session::add_torrent</span></tt>.</p>
</div>
<div class="section" id="set-ratio">
<h2><a name="set-ratio">set_ratio()</a></h2>
<blockquote>
@@ -1489,17 +1478,6 @@ not be ready to write resume data.</li>
is still downloading! The recommended practice is to first pause the torrent, then generate the
fast resume data, and then close it down.</p>
</div>
<div class="section" id="metadata">
<h2><a name="metadata">metadata()</a></h2>
<blockquote>
<pre class="literal-block">
std::vector&lt;char&gt; const&amp; metadata() const;
</pre>
</blockquote>
<p><tt class="docutils literal"><span class="pre">metadata()</span></tt> will return a reference to a buffer containing the exact info part of the
.torrent file. This buffer will be valid as long as the torrent is still running. When hashed,
it will produce the same hash as the info-hash.</p>
</div>
<div class="section" id="id6">
<h2><a name="id6">status()</a></h2>
<blockquote>
@@ -2577,9 +2555,9 @@ automatically retry to fetch it in this case. This is only relevant when running
torrent-less download, with the metadata extension provided by libtorrent.
It is generated at severity level <tt class="docutils literal"><span class="pre">info</span></tt>.</p>
<pre class="literal-block">
struct metadata_received_alert: alert
struct metadata_failed_alert: alert
{
metadata_received_alert(
metadata_failed_alert(
const torrent_handle&amp; h
, const std::string&amp; msg);

View File

@@ -80,6 +80,7 @@ The ``session`` class has the following synopsis::
torrent_handle add_torrent(
char const* tracker_url
, sha1_hash const& info_hash
, char const* name
, boost::filesystem::path const& save_path
, entry const& resume_data = entry()
, bool compact_mode = true
@@ -89,10 +90,6 @@ The ``session`` class has the following synopsis::
void remove_torrent(torrent_handle const& h);
void disable_extensions();
void enable_extension(
peer_connection::extension_index);
void set_settings(
session_settings const& settings);
@@ -198,6 +195,7 @@ add_torrent()
torrent_handle add_torrent(
char const* tracker_url
, sha1_hash const& info_hash
, char const* name
, boost::filesystem::path const& save_path
, entry const& resume_data = entry()
, bool compact_mode = true
@@ -234,7 +232,10 @@ about the torrent's progress, its peers etc. It is also used to abort a torrent.
The second overload that takes a tracker url and an info-hash instead of metadata
(``torrent_info``) can be used with torrents where (at least some) peers support
the metadata extension. For the overload to be available, libtorrent must be built
with extensions enabled (``TORRENT_ENABLE_EXTENSIONS`` defined).
with extensions enabled (``TORRENT_ENABLE_EXTENSIONS`` defined). It also takes an
optional ``name`` argument. This may be 0 in case no name should be assigned to the
torrent. In case it's not 0, the name is used for the torrent as long as it doesn't
have metadata. See ``torrent_handle::name``.
remove_torrent()
----------------
@@ -247,32 +248,6 @@ remove_torrent()
the tracker that we've stopped participating in the swarm.
disable_extensions() enable_extension()
---------------------------------------
::
void disable_extensions();
void enable_extension(peer_connection::extension_index);
``disable_extensions()`` will disable all extensions available in libtorrent.
``enable_extension()`` will enable a single extension. The available extensions
are enumerated in the ``peer_connection`` class. These are the available extensions::
enum extension_index
{
extended_chat_message,
extended_metadata_message,
extended_peer_exchange_message,
extended_listen_port_message,
num_supported_extensions
};
*peer_exchange is not implemented yet*
By default, all extensions are enabled.
For more information about the extensions, see the extensions_ section.
set_upload_rate_limit() set_download_rate_limit()
-------------------------------------------------
@@ -469,6 +444,9 @@ to start up the node again, passing this entry to ``start_dht``. It is a good
idea to save this to disk when the session is closed, and read it up again
when starting.
If the port the DHT is supposed to listen on is already in use, and exception
is thrown, ``asio::error``.
``stop_dht`` stops the dht node.
``add_dht_node`` adds a node to the routing table. This can be used if your
@@ -500,6 +478,7 @@ that are ready to replace a failing node, it will be replaced immediately,
this limit is only used to clear out nodes that don't have any node that can
replace them.
add_dht_node() add_dht_router()
-------------------------------
@@ -1112,8 +1091,9 @@ Its declaration looks like this::
torrent_info const& get_torrent_info() const;
bool is_valid() const;
std::string name() const;
entry write_resume_data() const;
std::vector<char> const& metadata() const;
void force_reannounce() const;
void connect_peer(asio::ip::tcp::endpoint const& adr) const;
@@ -1236,6 +1216,18 @@ attempt is made. If the torrent is uninitialized or in queued or checking mode,
will throw invalid_handle_.
name()
------
::
std::string name() const;
Returns the name of the torrent. i.e. the name from the metadata associated with it. In
case the torrent was started without metadata, and hasn't completely received it yet,
it returns the name given to it when added to the session. See ``session::add_torrent``.
set_ratio()
-----------
@@ -1444,18 +1436,6 @@ is still downloading! The recommended practice is to first pause the torrent, th
fast resume data, and then close it down.
metadata()
-------------------
::
std::vector<char> const& metadata() const;
``metadata()`` will return a reference to a buffer containing the exact info part of the
.torrent file. This buffer will be valid as long as the torrent is still running. When hashed,
it will produce the same hash as the info-hash.
status()
--------
@@ -2644,9 +2624,9 @@ It is generated at severity level ``info``.
::
struct metadata_received_alert: alert
struct metadata_failed_alert: alert
{
metadata_received_alert(
metadata_failed_alert(
const torrent_handle& h
, const std::string& msg);