forked from premiere/premiere-libtorrent
changed the file format for storing the DHT routing table to support IPv6. Changed the address used to be IPv4-IPv6 independent (ip_filter still onlt works with IPv4). Added default boost-build features to the building documentation. Completed the jamfile's support for building without DHT support. Updated documentation with these changes.
This commit is contained in:
parent
9470a6b726
commit
bdf1bbc8f4
139
Jamfile
139
Jamfile
|
@ -16,9 +16,72 @@ if ! $(BOOST_ROOT)
|
|||
"BOOST_ROOT must be set to your boost installation path." ;
|
||||
}
|
||||
|
||||
|
||||
use-project /boost : $(BOOST_ROOT) ;
|
||||
|
||||
|
||||
feature logging : none default verbose : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <logging>none : ;
|
||||
feature.compose <logging>default : <define>TORRENT_LOGGING ;
|
||||
feature.compose <logging>verbose : <define>TORRENT_VERBOSE_LOGGING ;
|
||||
|
||||
feature dht-support : on off logging : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <dht-support>on : ;
|
||||
feature.compose <dht-support>off : <define>TORRENT_DISABLE_DHT ;
|
||||
feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
|
||||
|
||||
SOURCES =
|
||||
allocate_resources.cpp
|
||||
alert.cpp
|
||||
entry.cpp
|
||||
escape_string.cpp
|
||||
file.cpp
|
||||
identify_client.cpp
|
||||
ip_filter.cpp
|
||||
peer_connection.cpp
|
||||
bt_peer_connection.cpp
|
||||
web_peer_connection.cpp
|
||||
piece_picker.cpp
|
||||
policy.cpp
|
||||
session.cpp
|
||||
stat.cpp
|
||||
storage.cpp
|
||||
torrent.cpp
|
||||
torrent_handle.cpp
|
||||
torrent_info.cpp
|
||||
tracker_manager.cpp
|
||||
http_tracker_connection.cpp
|
||||
udp_tracker_connection.cpp
|
||||
sha1.cpp
|
||||
;
|
||||
|
||||
KADEMLIA_SOURCES =
|
||||
kademlia/closest_nodes.cpp
|
||||
kademlia/dht_tracker.cpp
|
||||
kademlia/node.cpp
|
||||
kademlia/refresh.cpp
|
||||
kademlia/rpc_manager.cpp
|
||||
kademlia/find_data.cpp
|
||||
kademlia/node_id.cpp
|
||||
kademlia/routing_table.cpp
|
||||
kademlia/traversal_algorithm.cpp
|
||||
;
|
||||
|
||||
ZLIB_SOURCES =
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
deflate.c
|
||||
gzio.c
|
||||
infback.c
|
||||
inffast.c
|
||||
inflate.c
|
||||
inftrees.c
|
||||
trees.c
|
||||
uncompr.c
|
||||
zutil.c
|
||||
;
|
||||
|
||||
|
||||
project torrent
|
||||
|
||||
: requirements
|
||||
|
@ -50,6 +113,8 @@ project torrent
|
|||
# are exported (GCC 4 and msvc)
|
||||
<link>shared:<define>TORRENT_BUILDING_SHARED
|
||||
|
||||
<link>shared:<define>TORRENT_LINKING_SHARED
|
||||
|
||||
: usage-requirements
|
||||
|
||||
<include>./include
|
||||
|
@ -60,56 +125,6 @@ project torrent
|
|||
|
||||
;
|
||||
|
||||
SOURCES =
|
||||
allocate_resources.cpp
|
||||
alert.cpp
|
||||
entry.cpp
|
||||
escape_string.cpp
|
||||
file.cpp
|
||||
identify_client.cpp
|
||||
ip_filter.cpp
|
||||
peer_connection.cpp
|
||||
bt_peer_connection.cpp
|
||||
web_peer_connection.cpp
|
||||
piece_picker.cpp
|
||||
policy.cpp
|
||||
session.cpp
|
||||
stat.cpp
|
||||
storage.cpp
|
||||
torrent.cpp
|
||||
torrent_handle.cpp
|
||||
torrent_info.cpp
|
||||
tracker_manager.cpp
|
||||
http_tracker_connection.cpp
|
||||
udp_tracker_connection.cpp
|
||||
sha1.cpp
|
||||
|
||||
kademlia/closest_nodes.cpp
|
||||
kademlia/dht_tracker.cpp
|
||||
kademlia/node.cpp
|
||||
kademlia/refresh.cpp
|
||||
kademlia/rpc_manager.cpp
|
||||
kademlia/find_data.cpp
|
||||
kademlia/node_id.cpp
|
||||
kademlia/routing_table.cpp
|
||||
kademlia/traversal_algorithm.cpp
|
||||
;
|
||||
|
||||
ZLIB_SOURCES =
|
||||
adler32.c
|
||||
compress.c
|
||||
crc32.c
|
||||
deflate.c
|
||||
gzio.c
|
||||
infback.c
|
||||
inffast.c
|
||||
inflate.c
|
||||
inftrees.c
|
||||
trees.c
|
||||
uncompr.c
|
||||
zutil.c
|
||||
;
|
||||
|
||||
LIBS = ;
|
||||
|
||||
# some windows specific settings
|
||||
|
@ -120,21 +135,23 @@ LIBS = ;
|
|||
LIBS += wsock32 ;
|
||||
}
|
||||
|
||||
feature logging : none default verbose : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <logging>none : ;
|
||||
feature.compose <logging>default : <define>TORRENT_LOGGING ;
|
||||
feature.compose <logging>verbose : <define>TORRENT_VERBOSE_LOGGING ;
|
||||
|
||||
feature dht-support : on off logging : composite propagated symmetric link-incompatible ;
|
||||
feature.compose <dht-support>on : ;
|
||||
feature.compose <dht-support>off : <define>TORRENT_DISABLE_DHT ;
|
||||
feature.compose <dht-support>logging : <define>TORRENT_DHT_VERBOSE_LOGGING ;
|
||||
|
||||
lib torrent
|
||||
:
|
||||
src/$(SOURCES)
|
||||
src/$(KADEMLIA_SOURCES)
|
||||
zlib/$(ZLIB_SOURCES)
|
||||
$(LIBS)
|
||||
;
|
||||
|
||||
|
||||
# if DHT support is disabled, don't include the kademlia sources
|
||||
lib torrent
|
||||
:
|
||||
src/$(SOURCES)
|
||||
zlib/$(ZLIB_SOURCES)
|
||||
$(LIBS)
|
||||
:
|
||||
<dht-support>off
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -190,8 +190,40 @@ logging of the DHT protocol traffic.</li>
|
|||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">link</span></tt></td>
|
||||
<td><ul class="first last simple">
|
||||
<li><tt class="docutils literal"><span class="pre">static</span></tt> - builds libtorrent as a static
|
||||
library (.a / .lib)</li>
|
||||
<li><tt class="docutils literal"><span class="pre">shared</span></tt> - builds libtorrent as a shared
|
||||
library (.so / .dll).</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">runtime-link</span></tt></td>
|
||||
<td><ul class="first last simple">
|
||||
<li><tt class="docutils literal"><span class="pre">static</span></tt> - links statically against the
|
||||
run-time library (if available on your
|
||||
platform).</li>
|
||||
<li><tt class="docutils literal"><span class="pre">shared</span></tt> - link dynamically against the
|
||||
run-time library (default).</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">variant</span></tt></td>
|
||||
<td><ul class="first last simple">
|
||||
<li><tt class="docutils literal"><span class="pre">debug</span></tt> - builds libtorrent with debug
|
||||
information and invariant checks.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">release</span></tt> - builds libtorrent in release mode
|
||||
without invariant checks and with optimization.</li>
|
||||
<li><tt class="docutils literal"><span class="pre">profile</span></tt> - builds libtorrent with profile
|
||||
information.</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
|
||||
the name of the feature, just the value.</p>
|
||||
<p>The logs created when building vlog or log mode are put in a directory called
|
||||
<tt class="docutils literal"><span class="pre">libtorrent_logs</span></tt> in the current working directory.</p>
|
||||
<p>When building the example client on windows, you need to build with
|
||||
|
@ -217,13 +249,14 @@ needs to be generated first. If you're building from a released tarball,
|
|||
you may skip directly to <a class="reference" href="#step-2-running-configure">Step 2: Running configure</a>.</p>
|
||||
<p>Execute the following commands, in the given order, to generate
|
||||
the build system:</p>
|
||||
<ul class="simple">
|
||||
<li>aclocal -I m4</li>
|
||||
<li>autoheader</li>
|
||||
<li>libtoolize --copy --force</li>
|
||||
<li>automake --add-missing --copy --gnu</li>
|
||||
<li>autoconf</li>
|
||||
</ul>
|
||||
<pre class="literal-block">
|
||||
aclocal -I m4
|
||||
autoheader
|
||||
libtoolize --copy --force
|
||||
automake --add-missing --copy --gnu
|
||||
autoconf
|
||||
</pre>
|
||||
<p>On darwin/OSX you have to run <tt class="docutils literal"><span class="pre">glibtoolize</span></tt> instead of <tt class="docutils literal"><span class="pre">libtoolize</span></tt>.</p>
|
||||
</div>
|
||||
<div class="section" id="step-2-running-configure">
|
||||
<h3><a name="step-2-running-configure">Step 2: Running configure</a></h3>
|
||||
|
|
|
@ -187,6 +187,27 @@ Build features:
|
|||
| | logging of the DHT protocol traffic. |
|
||||
| | * ``off`` - build without DHT support. |
|
||||
+------------------------+----------------------------------------------------+
|
||||
| ``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. |
|
||||
+------------------------+----------------------------------------------------+
|
||||
|
||||
The ``variant`` feature is *implicit*, which means you don't need to specify
|
||||
the name of the feature, just the value.
|
||||
|
||||
The logs created when building vlog or log mode are put in a directory called
|
||||
``libtorrent_logs`` in the current working directory.
|
||||
|
@ -219,14 +240,15 @@ needs to be generated first. If you're building from a released tarball,
|
|||
you may skip directly to `Step 2: Running configure`_.
|
||||
|
||||
Execute the following commands, in the given order, to generate
|
||||
the build system:
|
||||
the build system::
|
||||
|
||||
* aclocal -I m4
|
||||
* autoheader
|
||||
* libtoolize --copy --force
|
||||
* automake --add-missing --copy --gnu
|
||||
* autoconf
|
||||
aclocal -I m4
|
||||
autoheader
|
||||
libtoolize --copy --force
|
||||
automake --add-missing --copy --gnu
|
||||
autoconf
|
||||
|
||||
On darwin/OSX you have to run ``glibtoolize`` instead of ``libtoolize``.
|
||||
|
||||
Step 2: Running configure
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
|
258
docs/manual.html
258
docs/manual.html
|
@ -25,138 +25,139 @@
|
|||
<p class="topic-title first"><a name="table-of-contents">Table of contents</a></p>
|
||||
<ul class="simple">
|
||||
<li><a class="reference" href="#overview" id="id15" name="id15">overview</a></li>
|
||||
<li><a class="reference" href="#session" id="id16" name="id16">session</a><ul>
|
||||
<li><a class="reference" href="#id1" id="id17" name="id17">session()</a></li>
|
||||
<li><a class="reference" href="#id2" id="id18" name="id18">~session()</a></li>
|
||||
<li><a class="reference" href="#add-torrent" id="id19" name="id19">add_torrent()</a></li>
|
||||
<li><a class="reference" href="#remove-torrent" id="id20" name="id20">remove_torrent()</a></li>
|
||||
<li><a class="reference" href="#disable-extensions-enable-extension" id="id21" name="id21">disable_extensions() enable_extension()</a></li>
|
||||
<li><a class="reference" href="#set-upload-rate-limit-set-download-rate-limit" id="id22" name="id22">set_upload_rate_limit() set_download_rate_limit()</a></li>
|
||||
<li><a class="reference" href="#set-max-uploads-set-max-connections" id="id23" name="id23">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#set-max-half-open-connections" id="id24" name="id24">set_max_half_open_connections()</a></li>
|
||||
<li><a class="reference" href="#set-ip-filter" id="id25" name="id25">set_ip_filter()</a></li>
|
||||
<li><a class="reference" href="#status" id="id26" name="id26">status()</a></li>
|
||||
<li><a class="reference" href="#is-listening-listen-port-listen-on" id="id27" name="id27">is_listening() listen_port() listen_on()</a></li>
|
||||
<li><a class="reference" href="#pop-alert-set-severity-level" id="id28" name="id28">pop_alert() set_severity_level()</a></li>
|
||||
<li><a class="reference" href="#start-dht-stop-dht-set-dht-settings-dht-state" id="id29" name="id29">start_dht() stop_dht() set_dht_settings() dht_state()</a></li>
|
||||
<li><a class="reference" href="#primitive-network-types" id="id16" name="id16">primitive network types</a></li>
|
||||
<li><a class="reference" href="#session" id="id17" name="id17">session</a><ul>
|
||||
<li><a class="reference" href="#id1" id="id18" name="id18">session()</a></li>
|
||||
<li><a class="reference" href="#id2" id="id19" name="id19">~session()</a></li>
|
||||
<li><a class="reference" href="#add-torrent" id="id20" name="id20">add_torrent()</a></li>
|
||||
<li><a class="reference" href="#remove-torrent" id="id21" name="id21">remove_torrent()</a></li>
|
||||
<li><a class="reference" href="#disable-extensions-enable-extension" id="id22" name="id22">disable_extensions() enable_extension()</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>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#entry" id="id30" name="id30">entry</a><ul>
|
||||
<li><a class="reference" href="#integer-string-list-dict-type" id="id31" name="id31">integer() string() list() dict() type()</a></li>
|
||||
<li><a class="reference" href="#operator" id="id32" name="id32">operator[]</a></li>
|
||||
<li><a class="reference" href="#find-key" id="id33" name="id33">find_key()</a></li>
|
||||
<li><a class="reference" href="#entry" id="id31" name="id31">entry</a><ul>
|
||||
<li><a class="reference" href="#integer-string-list-dict-type" id="id32" name="id32">integer() string() list() dict() type()</a></li>
|
||||
<li><a class="reference" href="#operator" id="id33" name="id33">operator[]</a></li>
|
||||
<li><a class="reference" href="#find-key" id="id34" name="id34">find_key()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-info" id="id34" name="id34">torrent_info</a><ul>
|
||||
<li><a class="reference" href="#id3" id="id35" name="id35">torrent_info()</a></li>
|
||||
<li><a class="reference" href="#set-comment-set-piece-size-set-creator-set-hash-add-tracker-add-file" id="id36" name="id36">set_comment() set_piece_size() set_creator() set_hash() add_tracker() add_file()</a></li>
|
||||
<li><a class="reference" href="#create-torrent" id="id37" name="id37">create_torrent()</a></li>
|
||||
<li><a class="reference" href="#begin-files-end-files-rbegin-files-rend-files" id="id38" name="id38">begin_files() end_files() rbegin_files() rend_files()</a></li>
|
||||
<li><a class="reference" href="#num-files-file-at" id="id39" name="id39">num_files() file_at()</a></li>
|
||||
<li><a class="reference" href="#map-block" id="id40" name="id40">map_block()</a></li>
|
||||
<li><a class="reference" href="#map-file" id="id41" name="id41">map_file()</a></li>
|
||||
<li><a class="reference" href="#url-seeds" id="id42" name="id42">url_seeds()</a></li>
|
||||
<li><a class="reference" href="#print" id="id43" name="id43">print()</a></li>
|
||||
<li><a class="reference" href="#trackers" id="id44" name="id44">trackers()</a></li>
|
||||
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id45" name="id45">total_size() piece_length() piece_size() num_pieces()</a></li>
|
||||
<li><a class="reference" href="#hash-for-piece-info-hash" id="id46" name="id46">hash_for_piece() info_hash()</a></li>
|
||||
<li><a class="reference" href="#name-comment-creation-date-creator" id="id47" name="id47">name() comment() creation_date() creator()</a></li>
|
||||
<li><a class="reference" href="#priv-set-priv" id="id48" name="id48">priv() set_priv()</a></li>
|
||||
<li><a class="reference" href="#nodes" id="id49" name="id49">nodes()</a></li>
|
||||
<li><a class="reference" href="#add-node" id="id50" name="id50">add_node()</a></li>
|
||||
<li><a class="reference" href="#torrent-info" id="id35" name="id35">torrent_info</a><ul>
|
||||
<li><a class="reference" href="#id3" id="id36" name="id36">torrent_info()</a></li>
|
||||
<li><a class="reference" href="#set-comment-set-piece-size-set-creator-set-hash-add-tracker-add-file" id="id37" name="id37">set_comment() set_piece_size() set_creator() set_hash() add_tracker() add_file()</a></li>
|
||||
<li><a class="reference" href="#create-torrent" id="id38" name="id38">create_torrent()</a></li>
|
||||
<li><a class="reference" href="#begin-files-end-files-rbegin-files-rend-files" id="id39" name="id39">begin_files() end_files() rbegin_files() rend_files()</a></li>
|
||||
<li><a class="reference" href="#num-files-file-at" id="id40" name="id40">num_files() file_at()</a></li>
|
||||
<li><a class="reference" href="#map-block" id="id41" name="id41">map_block()</a></li>
|
||||
<li><a class="reference" href="#map-file" id="id42" name="id42">map_file()</a></li>
|
||||
<li><a class="reference" href="#url-seeds" id="id43" name="id43">url_seeds()</a></li>
|
||||
<li><a class="reference" href="#print" id="id44" name="id44">print()</a></li>
|
||||
<li><a class="reference" href="#trackers" id="id45" name="id45">trackers()</a></li>
|
||||
<li><a class="reference" href="#total-size-piece-length-piece-size-num-pieces" id="id46" name="id46">total_size() piece_length() piece_size() num_pieces()</a></li>
|
||||
<li><a class="reference" href="#hash-for-piece-info-hash" id="id47" name="id47">hash_for_piece() info_hash()</a></li>
|
||||
<li><a class="reference" href="#name-comment-creation-date-creator" id="id48" name="id48">name() comment() creation_date() creator()</a></li>
|
||||
<li><a class="reference" href="#priv-set-priv" id="id49" name="id49">priv() set_priv()</a></li>
|
||||
<li><a class="reference" href="#nodes" id="id50" name="id50">nodes()</a></li>
|
||||
<li><a class="reference" href="#add-node" id="id51" name="id51">add_node()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-handle" id="id51" name="id51">torrent_handle</a><ul>
|
||||
<li><a class="reference" href="#file-progress" id="id52" name="id52">file_progress()</a></li>
|
||||
<li><a class="reference" href="#save-path" id="id53" name="id53">save_path()</a></li>
|
||||
<li><a class="reference" href="#move-storage" id="id54" name="id54">move_storage()</a></li>
|
||||
<li><a class="reference" href="#force-reannounce" id="id55" name="id55">force_reannounce()</a></li>
|
||||
<li><a class="reference" href="#connect-peer" id="id56" name="id56">connect_peer()</a></li>
|
||||
<li><a class="reference" href="#set-ratio" id="id57" name="id57">set_ratio()</a></li>
|
||||
<li><a class="reference" href="#set-upload-limit-set-download-limit" id="id58" name="id58">set_upload_limit() set_download_limit()</a></li>
|
||||
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id59" name="id59">set_peer_upload_limit() set_peer_download_limit()</a></li>
|
||||
<li><a class="reference" href="#pause-resume-is-paused" id="id60" name="id60">pause() resume() is_paused()</a></li>
|
||||
<li><a class="reference" href="#is-seed" id="id61" name="id61">is_seed()</a></li>
|
||||
<li><a class="reference" href="#has-metadata" id="id62" name="id62">has_metadata()</a></li>
|
||||
<li><a class="reference" href="#set-tracker-login" id="id63" name="id63">set_tracker_login()</a></li>
|
||||
<li><a class="reference" href="#trackers-replace-trackers" id="id64" name="id64">trackers() replace_trackers()</a></li>
|
||||
<li><a class="reference" href="#add-url-seed" id="id65" name="id65">add_url_seed()</a></li>
|
||||
<li><a class="reference" href="#use-interface" id="id66" name="id66">use_interface()</a></li>
|
||||
<li><a class="reference" href="#info-hash" id="id67" name="id67">info_hash()</a></li>
|
||||
<li><a class="reference" href="#id5" id="id68" name="id68">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#write-resume-data" id="id69" name="id69">write_resume_data()</a></li>
|
||||
<li><a class="reference" href="#metadata" id="id70" name="id70">metadata()</a></li>
|
||||
<li><a class="reference" href="#id6" id="id71" name="id71">status()</a></li>
|
||||
<li><a class="reference" href="#get-download-queue" id="id72" name="id72">get_download_queue()</a></li>
|
||||
<li><a class="reference" href="#get-peer-info" id="id73" name="id73">get_peer_info()</a></li>
|
||||
<li><a class="reference" href="#get-torrent-info" id="id74" name="id74">get_torrent_info()</a></li>
|
||||
<li><a class="reference" href="#is-valid" id="id75" name="id75">is_valid()</a></li>
|
||||
<li><a class="reference" href="#torrent-handle" id="id52" name="id52">torrent_handle</a><ul>
|
||||
<li><a class="reference" href="#file-progress" id="id53" name="id53">file_progress()</a></li>
|
||||
<li><a class="reference" href="#save-path" id="id54" name="id54">save_path()</a></li>
|
||||
<li><a class="reference" href="#move-storage" id="id55" name="id55">move_storage()</a></li>
|
||||
<li><a class="reference" href="#force-reannounce" id="id56" name="id56">force_reannounce()</a></li>
|
||||
<li><a class="reference" href="#connect-peer" id="id57" name="id57">connect_peer()</a></li>
|
||||
<li><a class="reference" href="#set-ratio" id="id58" name="id58">set_ratio()</a></li>
|
||||
<li><a class="reference" href="#set-upload-limit-set-download-limit" id="id59" name="id59">set_upload_limit() set_download_limit()</a></li>
|
||||
<li><a class="reference" href="#set-peer-upload-limit-set-peer-download-limit" id="id60" name="id60">set_peer_upload_limit() set_peer_download_limit()</a></li>
|
||||
<li><a class="reference" href="#pause-resume-is-paused" id="id61" name="id61">pause() resume() is_paused()</a></li>
|
||||
<li><a class="reference" href="#is-seed" id="id62" name="id62">is_seed()</a></li>
|
||||
<li><a class="reference" href="#has-metadata" id="id63" name="id63">has_metadata()</a></li>
|
||||
<li><a class="reference" href="#set-tracker-login" id="id64" name="id64">set_tracker_login()</a></li>
|
||||
<li><a class="reference" href="#trackers-replace-trackers" id="id65" name="id65">trackers() replace_trackers()</a></li>
|
||||
<li><a class="reference" href="#add-url-seed" id="id66" name="id66">add_url_seed()</a></li>
|
||||
<li><a class="reference" href="#use-interface" id="id67" name="id67">use_interface()</a></li>
|
||||
<li><a class="reference" href="#info-hash" id="id68" name="id68">info_hash()</a></li>
|
||||
<li><a class="reference" href="#id5" id="id69" name="id69">set_max_uploads() set_max_connections()</a></li>
|
||||
<li><a class="reference" href="#write-resume-data" id="id70" name="id70">write_resume_data()</a></li>
|
||||
<li><a class="reference" href="#metadata" id="id71" name="id71">metadata()</a></li>
|
||||
<li><a class="reference" href="#id6" id="id72" name="id72">status()</a></li>
|
||||
<li><a class="reference" href="#get-download-queue" id="id73" name="id73">get_download_queue()</a></li>
|
||||
<li><a class="reference" href="#get-peer-info" id="id74" name="id74">get_peer_info()</a></li>
|
||||
<li><a class="reference" href="#get-torrent-info" id="id75" name="id75">get_torrent_info()</a></li>
|
||||
<li><a class="reference" href="#is-valid" id="id76" name="id76">is_valid()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#torrent-status" id="id76" name="id76">torrent_status</a></li>
|
||||
<li><a class="reference" href="#peer-info" id="id77" name="id77">peer_info</a></li>
|
||||
<li><a class="reference" href="#session-settings" id="id78" name="id78">session_settings</a></li>
|
||||
<li><a class="reference" href="#ip-filter" id="id79" name="id79">ip_filter</a><ul>
|
||||
<li><a class="reference" href="#id8" id="id80" name="id80">ip_filter()</a></li>
|
||||
<li><a class="reference" href="#add-rule" id="id81" name="id81">add_rule()</a></li>
|
||||
<li><a class="reference" href="#access" id="id82" name="id82">access()</a></li>
|
||||
<li><a class="reference" href="#export-filter" id="id83" name="id83">export_filter()</a></li>
|
||||
<li><a class="reference" href="#torrent-status" id="id77" name="id77">torrent_status</a></li>
|
||||
<li><a class="reference" href="#peer-info" id="id78" name="id78">peer_info</a></li>
|
||||
<li><a class="reference" href="#session-settings" id="id79" name="id79">session_settings</a></li>
|
||||
<li><a class="reference" href="#ip-filter" id="id80" name="id80">ip_filter</a><ul>
|
||||
<li><a class="reference" href="#id8" id="id81" name="id81">ip_filter()</a></li>
|
||||
<li><a class="reference" href="#add-rule" id="id82" name="id82">add_rule()</a></li>
|
||||
<li><a class="reference" href="#access" id="id83" name="id83">access()</a></li>
|
||||
<li><a class="reference" href="#export-filter" id="id84" name="id84">export_filter()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#big-number" id="id84" name="id84">big_number</a></li>
|
||||
<li><a class="reference" href="#hasher" id="id85" name="id85">hasher</a></li>
|
||||
<li><a class="reference" href="#fingerprint" id="id86" name="id86">fingerprint</a></li>
|
||||
<li><a class="reference" href="#free-functions" id="id87" name="id87">free functions</a><ul>
|
||||
<li><a class="reference" href="#identify-client" id="id88" name="id88">identify_client()</a></li>
|
||||
<li><a class="reference" href="#client-fingerprint" id="id89" name="id89">client_fingerprint()</a></li>
|
||||
<li><a class="reference" href="#bdecode-bencode" id="id90" name="id90">bdecode() bencode()</a></li>
|
||||
<li><a class="reference" href="#big-number" id="id85" name="id85">big_number</a></li>
|
||||
<li><a class="reference" href="#hasher" id="id86" name="id86">hasher</a></li>
|
||||
<li><a class="reference" href="#fingerprint" id="id87" name="id87">fingerprint</a></li>
|
||||
<li><a class="reference" href="#free-functions" id="id88" name="id88">free functions</a><ul>
|
||||
<li><a class="reference" href="#identify-client" id="id89" name="id89">identify_client()</a></li>
|
||||
<li><a class="reference" href="#client-fingerprint" id="id90" name="id90">client_fingerprint()</a></li>
|
||||
<li><a class="reference" href="#bdecode-bencode" id="id91" name="id91">bdecode() bencode()</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#alerts" id="id91" name="id91">alerts</a><ul>
|
||||
<li><a class="reference" href="#listen-failed-alert" id="id92" name="id92">listen_failed_alert</a></li>
|
||||
<li><a class="reference" href="#file-error-alert" id="id93" name="id93">file_error_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-announce-alert" id="id94" name="id94">tracker_announce_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-alert" id="id95" name="id95">tracker_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-reply-alert" id="id96" name="id96">tracker_reply_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-warning-alert" id="id97" name="id97">tracker_warning_alert</a></li>
|
||||
<li><a class="reference" href="#url-seed-alert" id="id98" name="id98">url_seed_alert</a></li>
|
||||
<li><a class="reference" href="#hash-failed-alert" id="id99" name="id99">hash_failed_alert</a></li>
|
||||
<li><a class="reference" href="#peer-ban-alert" id="id100" name="id100">peer_ban_alert</a></li>
|
||||
<li><a class="reference" href="#peer-error-alert" id="id101" name="id101">peer_error_alert</a></li>
|
||||
<li><a class="reference" href="#invalid-request-alert" id="id102" name="id102">invalid_request_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-finished-alert" id="id103" name="id103">torrent_finished_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-failed-alert" id="id104" name="id104">metadata_failed_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-received-alert" id="id105" name="id105">metadata_received_alert</a></li>
|
||||
<li><a class="reference" href="#fastresume-rejected-alert" id="id106" name="id106">fastresume_rejected_alert</a></li>
|
||||
<li><a class="reference" href="#dispatcher" id="id107" name="id107">dispatcher</a></li>
|
||||
<li><a class="reference" href="#alerts" id="id92" name="id92">alerts</a><ul>
|
||||
<li><a class="reference" href="#listen-failed-alert" id="id93" name="id93">listen_failed_alert</a></li>
|
||||
<li><a class="reference" href="#file-error-alert" id="id94" name="id94">file_error_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-announce-alert" id="id95" name="id95">tracker_announce_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-alert" id="id96" name="id96">tracker_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-reply-alert" id="id97" name="id97">tracker_reply_alert</a></li>
|
||||
<li><a class="reference" href="#tracker-warning-alert" id="id98" name="id98">tracker_warning_alert</a></li>
|
||||
<li><a class="reference" href="#url-seed-alert" id="id99" name="id99">url_seed_alert</a></li>
|
||||
<li><a class="reference" href="#hash-failed-alert" id="id100" name="id100">hash_failed_alert</a></li>
|
||||
<li><a class="reference" href="#peer-ban-alert" id="id101" name="id101">peer_ban_alert</a></li>
|
||||
<li><a class="reference" href="#peer-error-alert" id="id102" name="id102">peer_error_alert</a></li>
|
||||
<li><a class="reference" href="#invalid-request-alert" id="id103" name="id103">invalid_request_alert</a></li>
|
||||
<li><a class="reference" href="#torrent-finished-alert" id="id104" name="id104">torrent_finished_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-failed-alert" id="id105" name="id105">metadata_failed_alert</a></li>
|
||||
<li><a class="reference" href="#metadata-received-alert" id="id106" name="id106">metadata_received_alert</a></li>
|
||||
<li><a class="reference" href="#fastresume-rejected-alert" id="id107" name="id107">fastresume_rejected_alert</a></li>
|
||||
<li><a class="reference" href="#dispatcher" id="id108" name="id108">dispatcher</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#exceptions" id="id108" name="id108">exceptions</a><ul>
|
||||
<li><a class="reference" href="#invalid-handle" id="id109" name="id109">invalid_handle</a></li>
|
||||
<li><a class="reference" href="#duplicate-torrent" id="id110" name="id110">duplicate_torrent</a></li>
|
||||
<li><a class="reference" href="#invalid-encoding" id="id111" name="id111">invalid_encoding</a></li>
|
||||
<li><a class="reference" href="#type-error" id="id112" name="id112">type_error</a></li>
|
||||
<li><a class="reference" href="#invalid-torrent-file" id="id113" name="id113">invalid_torrent_file</a></li>
|
||||
<li><a class="reference" href="#exceptions" id="id109" name="id109">exceptions</a><ul>
|
||||
<li><a class="reference" href="#invalid-handle" id="id110" name="id110">invalid_handle</a></li>
|
||||
<li><a class="reference" href="#duplicate-torrent" id="id111" name="id111">duplicate_torrent</a></li>
|
||||
<li><a class="reference" href="#invalid-encoding" id="id112" name="id112">invalid_encoding</a></li>
|
||||
<li><a class="reference" href="#type-error" id="id113" name="id113">type_error</a></li>
|
||||
<li><a class="reference" href="#invalid-torrent-file" id="id114" name="id114">invalid_torrent_file</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#fast-resume" id="id114" name="id114">fast resume</a><ul>
|
||||
<li><a class="reference" href="#file-format" id="id115" name="id115">file format</a></li>
|
||||
<li><a class="reference" href="#fast-resume" id="id115" name="id115">fast resume</a><ul>
|
||||
<li><a class="reference" href="#file-format" id="id116" name="id116">file format</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#threads" id="id116" name="id116">threads</a></li>
|
||||
<li><a class="reference" href="#storage-allocation" id="id117" name="id117">storage allocation</a><ul>
|
||||
<li><a class="reference" href="#full-allocation" id="id118" name="id118">full allocation</a></li>
|
||||
<li><a class="reference" href="#compact-allocation" id="id119" name="id119">compact allocation</a></li>
|
||||
<li><a class="reference" href="#threads" id="id117" name="id117">threads</a></li>
|
||||
<li><a class="reference" href="#storage-allocation" id="id118" name="id118">storage allocation</a><ul>
|
||||
<li><a class="reference" href="#full-allocation" id="id119" name="id119">full allocation</a></li>
|
||||
<li><a class="reference" href="#compact-allocation" id="id120" name="id120">compact allocation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#extensions" id="id120" name="id120">extensions</a><ul>
|
||||
<li><a class="reference" href="#chat-messages" id="id121" name="id121">chat messages</a></li>
|
||||
<li><a class="reference" href="#metadata-from-peers" id="id122" name="id122">metadata from peers</a></li>
|
||||
<li><a class="reference" href="#http-seeding" id="id123" name="id123">HTTP seeding</a></li>
|
||||
<li><a class="reference" href="#extensions" id="id121" name="id121">extensions</a><ul>
|
||||
<li><a class="reference" href="#chat-messages" id="id122" name="id122">chat messages</a></li>
|
||||
<li><a class="reference" href="#metadata-from-peers" id="id123" name="id123">metadata from peers</a></li>
|
||||
<li><a class="reference" href="#http-seeding" id="id124" name="id124">HTTP seeding</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference" href="#filename-checks" id="id124" name="id124">filename checks</a></li>
|
||||
<li><a class="reference" href="#acknowledgments" id="id125" name="id125">acknowledgments</a></li>
|
||||
<li><a class="reference" href="#filename-checks" id="id125" name="id125">filename checks</a></li>
|
||||
<li><a class="reference" href="#acknowledgments" id="id126" name="id126">acknowledgments</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="overview">
|
||||
|
@ -186,6 +187,26 @@ the <tt class="docutils literal"><span class="pre">session</span></tt>, it conta
|
|||
</ul>
|
||||
<p>Each class and function is described in this manual.</p>
|
||||
</div>
|
||||
<div class="section" id="primitive-network-types">
|
||||
<h1><a name="primitive-network-types">primitive network types</a></h1>
|
||||
<p>There are a few typedefs in the <tt class="docutils literal"><span class="pre">libtorrent</span></tt> namespace which pulls
|
||||
in network types from the <tt class="docutils literal"><span class="pre">asio</span></tt> namespace. These are:</p>
|
||||
<pre class="literal-block">
|
||||
typedef asio::ip::address address;
|
||||
typedef asio::ip::address_v4 address_v4;
|
||||
typedef asio::ip::address_v6 address_v6;
|
||||
using asio::ip::tcp;
|
||||
using asio::ip::udp;
|
||||
</pre>
|
||||
<p>These are declared in the <tt class="docutils literal"><span class="pre"><libtorrent/socket.hpp></span></tt> header.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">using</span></tt> statements will give easy access to:</p>
|
||||
<pre class="literal-block">
|
||||
tcp::endpoint
|
||||
udp::endpoint
|
||||
</pre>
|
||||
<p>Which are the endpoint types used in libtorrent. An endpoint is an address
|
||||
with an associated port.</p>
|
||||
</div>
|
||||
<div class="section" id="session">
|
||||
<h1><a name="session">session</a></h1>
|
||||
<p>The <tt class="docutils literal"><span class="pre">session</span></tt> class has the following synopsis:</p>
|
||||
|
@ -1903,13 +1924,13 @@ public:
|
|||
enum access_flags { blocked = 1 };
|
||||
|
||||
ip_filter();
|
||||
void add_rule(address first, address last, int flags);
|
||||
int access(address const& addr) const;
|
||||
void add_rule(address_v4 first, address_v4 last, int flags);
|
||||
int access(address_v4 const& addr) const;
|
||||
|
||||
struct ip_range
|
||||
{
|
||||
address first;
|
||||
address last;
|
||||
address_v4 first;
|
||||
address_v4 last;
|
||||
int flags;
|
||||
};
|
||||
|
||||
|
@ -1932,7 +1953,7 @@ ip_filter()
|
|||
<h2><a name="add-rule">add_rule()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
void add_rule(address first, address last, int flags);
|
||||
void add_rule(address_v4 first, address_v4 last, int flags);
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>Adds a rule to the filter. <tt class="docutils literal"><span class="pre">first</span></tt> and <tt class="docutils literal"><span class="pre">last</span></tt> defines a range of
|
||||
|
@ -1948,7 +1969,7 @@ precedence.</p>
|
|||
<h2><a name="access">access()</a></h2>
|
||||
<blockquote>
|
||||
<pre class="literal-block">
|
||||
int access(address const& addr) const;
|
||||
int access(address_v4 const& addr) const;
|
||||
</pre>
|
||||
</blockquote>
|
||||
<p>Returns the access permissions for the given address (<tt class="docutils literal"><span class="pre">addr</span></tt>). The permission
|
||||
|
@ -2651,7 +2672,10 @@ layout:</p>
|
|||
</colgroup>
|
||||
<tbody valign="top">
|
||||
<tr><td><tt class="docutils literal"><span class="pre">ip</span></tt></td>
|
||||
<td>string, the ip address of the peer.</td>
|
||||
<td>string, the ip address of the peer. This is
|
||||
not a binary representation of the ip
|
||||
address, but the string representation. It
|
||||
may be an IPv6 string or an IPv4 string.</td>
|
||||
</tr>
|
||||
<tr><td><tt class="docutils literal"><span class="pre">port</span></tt></td>
|
||||
<td>integer, the listen port of the peer</td>
|
||||
|
|
|
@ -31,7 +31,27 @@ The basic usage is as follows:
|
|||
|
||||
Each class and function is described in this manual.
|
||||
|
||||
primitive network types
|
||||
=======================
|
||||
|
||||
There are a few typedefs in the ``libtorrent`` namespace which pulls
|
||||
in network types from the ``asio`` namespace. These are::
|
||||
|
||||
typedef asio::ip::address address;
|
||||
typedef asio::ip::address_v4 address_v4;
|
||||
typedef asio::ip::address_v6 address_v6;
|
||||
using asio::ip::tcp;
|
||||
using asio::ip::udp;
|
||||
|
||||
These are declared in the ``<libtorrent/socket.hpp>`` header.
|
||||
|
||||
The ``using`` statements will give easy access to::
|
||||
|
||||
tcp::endpoint
|
||||
udp::endpoint
|
||||
|
||||
Which are the endpoint types used in libtorrent. An endpoint is an address
|
||||
with an associated port.
|
||||
|
||||
session
|
||||
=======
|
||||
|
@ -1898,13 +1918,13 @@ accessed as ``libtorrent::address``.
|
|||
enum access_flags { blocked = 1 };
|
||||
|
||||
ip_filter();
|
||||
void add_rule(address first, address last, int flags);
|
||||
int access(address const& addr) const;
|
||||
void add_rule(address_v4 first, address_v4 last, int flags);
|
||||
int access(address_v4 const& addr) const;
|
||||
|
||||
struct ip_range
|
||||
{
|
||||
address first;
|
||||
address last;
|
||||
address_v4 first;
|
||||
address_v4 last;
|
||||
int flags;
|
||||
};
|
||||
|
||||
|
@ -1930,7 +1950,7 @@ add_rule()
|
|||
|
||||
::
|
||||
|
||||
void add_rule(address first, address last, int flags);
|
||||
void add_rule(address_v4 first, address_v4 last, int flags);
|
||||
|
||||
Adds a rule to the filter. ``first`` and ``last`` defines a range of
|
||||
ip addresses that will be marked with the given flags. The ``flags``
|
||||
|
@ -1949,7 +1969,7 @@ access()
|
|||
|
||||
::
|
||||
|
||||
int access(address const& addr) const;
|
||||
int access(address_v4 const& addr) const;
|
||||
|
||||
Returns the access permissions for the given address (``addr``). The permission
|
||||
can currently be 0 or ``ip_filter::blocked``. The complexity of this operation
|
||||
|
@ -2737,7 +2757,10 @@ The file format is a bencoded dictionary containing the following fields:
|
|||
| | layout: |
|
||||
| | |
|
||||
| | +----------+-----------------------------------------------+ |
|
||||
| | | ``ip`` | string, the ip address of the peer. | |
|
||||
| | | ``ip`` | string, the ip address of the peer. This is | |
|
||||
| | | | not a binary representation of the ip | |
|
||||
| | | | address, but the string representation. It | |
|
||||
| | | | may be an IPv6 string or an IPv4 string. | |
|
||||
| | +----------+-----------------------------------------------+ |
|
||||
| | | ``port`` | integer, the listen port of the peer | |
|
||||
| | +----------+-----------------------------------------------+ |
|
||||
|
|
|
@ -566,6 +566,7 @@ int main(int ac, char* av[])
|
|||
handles_t handles;
|
||||
session ses;
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
boost::filesystem::ifstream dht_state_file(".dht_state"
|
||||
, std::ios_base::binary);
|
||||
dht_state_file.unsetf(std::ios_base::skipws);
|
||||
|
@ -582,6 +583,7 @@ int main(int ac, char* av[])
|
|||
ses.add_dht_node(std::make_pair(std::string("router.bittorrent.com")
|
||||
, 6881));
|
||||
}
|
||||
#endif
|
||||
|
||||
ses.set_max_half_open_connections(half_open_limit);
|
||||
ses.set_download_rate_limit(download_limit);
|
||||
|
@ -631,9 +633,9 @@ int main(int ac, char* av[])
|
|||
int a, b, c, d;
|
||||
char dummy;
|
||||
in >> a >> dummy >> b >> dummy >> c >> dummy >> d >> dummy;
|
||||
address start((a << 24) + (b << 16) + (c << 8) + d);
|
||||
address_v4 start((a << 24) + (b << 16) + (c << 8) + d);
|
||||
in >> a >> dummy >> b >> dummy >> c >> dummy >> d >> dummy;
|
||||
address last((a << 24) + (b << 16) + (c << 8) + d);
|
||||
address_v4 last((a << 24) + (b << 16) + (c << 8) + d);
|
||||
int flags;
|
||||
in >> flags;
|
||||
if (flags <= 127) flags = ip_filter::blocked;
|
||||
|
@ -932,11 +934,13 @@ int main(int ac, char* av[])
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
entry dht_state = ses.dht_state();
|
||||
boost::filesystem::ofstream out(".dht_state"
|
||||
, std::ios_base::binary);
|
||||
out.unsetf(std::ios_base::skipws);
|
||||
bencode(std::ostream_iterator<char>(out), dht_state);
|
||||
#endif
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
|
|
@ -57,13 +57,13 @@ public:
|
|||
};
|
||||
|
||||
ip_filter();
|
||||
void add_rule(address first, address last, int flags);
|
||||
int access(address const& addr) const;
|
||||
void add_rule(address_v4 first, address_v4 last, int flags);
|
||||
int access(address_v4 const& addr) const;
|
||||
|
||||
struct ip_range
|
||||
{
|
||||
address first;
|
||||
address last;
|
||||
address_v4 first;
|
||||
address_v4 last;
|
||||
int flags;
|
||||
};
|
||||
|
||||
|
@ -74,12 +74,12 @@ public:
|
|||
private:
|
||||
struct range
|
||||
{
|
||||
range(address addr, int access = 0): start(addr), access(access) {}
|
||||
range(address_v4 addr, int access = 0): start(addr), access(access) {}
|
||||
bool operator<(range const& r) const
|
||||
{ return start < r.start; }
|
||||
bool operator<(address const& a) const
|
||||
{ return start < a; }
|
||||
address start;
|
||||
address_v4 start;
|
||||
// the end of the range is implicit
|
||||
// and given by the next entry in the set
|
||||
int access;
|
||||
|
|
|
@ -82,7 +82,9 @@ namespace libtorrent
|
|||
using asio::ip::tcp;
|
||||
using asio::ip::udp;
|
||||
typedef asio::ip::tcp::socket stream_socket;
|
||||
typedef asio::ip::address_v4 address;
|
||||
typedef asio::ip::address address;
|
||||
typedef asio::ip::address_v4 address_v4;
|
||||
typedef asio::ip::address_v6 address_v6;
|
||||
typedef asio::ip::udp::socket datagram_socket;
|
||||
typedef asio::ip::tcp::acceptor socket_acceptor;
|
||||
typedef asio::io_service demuxer;
|
||||
|
@ -92,19 +94,60 @@ namespace libtorrent
|
|||
|
||||
namespace detail
|
||||
{
|
||||
template<class OutIt>
|
||||
void write_address(address const& a, OutIt& out)
|
||||
{
|
||||
if (a.is_v4())
|
||||
{
|
||||
write_uint32(a.to_v4().to_ulong(), out);
|
||||
}
|
||||
else if (a.is_v6())
|
||||
{
|
||||
asio::ip::address_v6::bytes_type bytes
|
||||
= a.to_v6().to_bytes();
|
||||
std::copy(bytes.begin(), bytes.end(), out);
|
||||
}
|
||||
}
|
||||
|
||||
template<class InIt>
|
||||
address read_v4_address(InIt& in)
|
||||
{
|
||||
unsigned long ip = read_uint32(in);
|
||||
return asio::ip::address_v4(ip);
|
||||
}
|
||||
|
||||
template<class InIt>
|
||||
address read_v6_address(InIt& in)
|
||||
{
|
||||
typedef asio::ip::address_v6::bytes_type bytes_t;
|
||||
bytes_t bytes;
|
||||
for (bytes_t::iterator i = bytes.begin()
|
||||
, end(bytes.end()); i != end; ++i)
|
||||
*i = read_uint8(in);
|
||||
return asio::ip::address_v6(bytes);
|
||||
}
|
||||
|
||||
template<class Endpoint, class OutIt>
|
||||
void write_endpoint(Endpoint const& e, OutIt& out)
|
||||
{
|
||||
write_uint32(e.address().to_v4().to_ulong(), out);
|
||||
write_address(e.address(), out);
|
||||
write_uint16(e.port(), out);
|
||||
}
|
||||
|
||||
template<class Endpoint, class InIt>
|
||||
Endpoint read_endpoint(InIt& in)
|
||||
Endpoint read_v4_endpoint(InIt& in)
|
||||
{
|
||||
unsigned int ip = read_uint32(in);
|
||||
address addr = read_v4_address(in);
|
||||
int port = read_uint16(in);
|
||||
return Endpoint(address(ip), port);
|
||||
return Endpoint(addr, port);
|
||||
}
|
||||
|
||||
template<class Endpoint, class InIt>
|
||||
Endpoint read_v6_endpoint(InIt& in)
|
||||
{
|
||||
address addr = read_v6_address(in);
|
||||
int port = read_uint16(in);
|
||||
return Endpoint(addr, port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@ namespace libtorrent
|
|||
ip_filter::ip_filter()
|
||||
{
|
||||
// make the entire ip-range non-blocked
|
||||
m_access_list.insert(range(address(0UL), 0));
|
||||
m_access_list.insert(range(address_v4(0UL), 0));
|
||||
}
|
||||
|
||||
void ip_filter::add_rule(address first, address last, int flags)
|
||||
void ip_filter::add_rule(address_v4 first, address_v4 last, int flags)
|
||||
{
|
||||
using boost::next;
|
||||
using boost::prior;
|
||||
|
@ -80,7 +80,7 @@ namespace libtorrent
|
|||
{
|
||||
// we can do this const-cast because we know that the new
|
||||
// start address will keep the set correctly ordered
|
||||
const_cast<address&>(i->start) = first;
|
||||
const_cast<address_v4&>(i->start) = first;
|
||||
const_cast<int&>(i->access) = flags;
|
||||
}
|
||||
else if (first_access != flags)
|
||||
|
@ -93,14 +93,14 @@ namespace libtorrent
|
|||
{
|
||||
assert(j == m_access_list.end() || last.to_ulong() < j->start.to_ulong() - 1);
|
||||
if (last_access != flags)
|
||||
j = m_access_list.insert(j, range(address(last.to_ulong() + 1), last_access));
|
||||
j = m_access_list.insert(j, range(address_v4(last.to_ulong() + 1), last_access));
|
||||
}
|
||||
|
||||
if (j != m_access_list.end() && j->access == flags) m_access_list.erase(j);
|
||||
assert(!m_access_list.empty());
|
||||
}
|
||||
|
||||
int ip_filter::access(address const& addr) const
|
||||
int ip_filter::access(address_v4 const& addr) const
|
||||
{
|
||||
assert(!m_access_list.empty());
|
||||
range_t::const_iterator i = m_access_list.upper_bound(addr);
|
||||
|
@ -126,9 +126,9 @@ namespace libtorrent
|
|||
|
||||
++i;
|
||||
if (i == end)
|
||||
r.last = address(0xffffffff);
|
||||
r.last = address_v4(0xffffffff);
|
||||
else
|
||||
r.last = address(i->start.to_ulong() - 1);
|
||||
r.last = address_v4(i->start.to_ulong() - 1);
|
||||
|
||||
ret.push_back(r);
|
||||
}
|
||||
|
|
|
@ -105,7 +105,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
namespace libtorrent { namespace dht
|
||||
{
|
||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||
|
@ -164,12 +163,20 @@ namespace libtorrent { namespace dht
|
|||
{
|
||||
if (entry const* nodes = bootstrap.find_key("nodes"))
|
||||
{
|
||||
if (nodes->type() == entry::string_t)
|
||||
if (nodes->type() == entry::list_t)
|
||||
{
|
||||
std::string const& s = nodes->string();
|
||||
std::string::const_iterator in(s.begin());
|
||||
while (std::distance(in, s.end()) >= 6)
|
||||
initial_nodes.push_back(read_endpoint<udp::endpoint>(in));
|
||||
entry::list_type const& node_list = nodes->list();
|
||||
for (entry::list_type::const_iterator i = node_list.begin()
|
||||
, end(node_list.end()); i != end; ++i)
|
||||
{
|
||||
if (i->type() != entry::string_t) continue;
|
||||
std::string const& str = i->string();
|
||||
std::string::const_iterator in(str.begin());
|
||||
if (str.length() == 6)
|
||||
initial_nodes.push_back(read_v4_endpoint<udp::endpoint>(in));
|
||||
else if (str.length() == 18)
|
||||
initial_nodes.push_back(read_v6_endpoint<udp::endpoint>(in));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -430,7 +437,10 @@ namespace libtorrent { namespace dht
|
|||
std::string const& p = i->string();
|
||||
if (p.size() < 6) continue;
|
||||
std::string::const_iterator in = p.begin();
|
||||
m.peers.push_back(read_endpoint<tcp::endpoint>(in));
|
||||
if (p.size() == 6)
|
||||
m.peers.push_back(read_v4_endpoint<tcp::endpoint>(in));
|
||||
else if (p.size() == 18)
|
||||
m.peers.push_back(read_v6_endpoint<tcp::endpoint>(in));
|
||||
}
|
||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||
TORRENT_LOG(dht_tracker) << " peers: " << m.peers.size();
|
||||
|
@ -450,7 +460,7 @@ namespace libtorrent { namespace dht
|
|||
std::copy(i, i + 20, id.begin());
|
||||
i += 20;
|
||||
m.nodes.push_back(libtorrent::dht::node_entry(
|
||||
id, read_endpoint<udp::endpoint>(i)));
|
||||
id, read_v4_endpoint<udp::endpoint>(i)));
|
||||
}
|
||||
#ifdef TORRENT_DHT_VERBOSE_LOGGING
|
||||
TORRENT_LOG(dht_tracker) << " nodes: " << m.nodes.size();
|
||||
|
@ -575,17 +585,26 @@ namespace libtorrent { namespace dht
|
|||
{
|
||||
entry ret(entry::dictionary_t);
|
||||
{
|
||||
std::string nodes;
|
||||
std::back_insert_iterator<std::string> out(nodes);
|
||||
entry nodes(entry::list_t);
|
||||
for (node_impl::iterator i(m_dht.begin())
|
||||
, end(m_dht.end()); i != end; ++i)
|
||||
{
|
||||
std::string node;
|
||||
std::back_insert_iterator<std::string> out(node);
|
||||
write_endpoint(i->addr, out);
|
||||
nodes.list().push_back(entry(node));
|
||||
}
|
||||
bucket_t cache;
|
||||
m_dht.replacement_cache(cache);
|
||||
for (bucket_t::iterator i(cache.begin())
|
||||
, end(cache.end()); i != end; ++i)
|
||||
{
|
||||
std::string node;
|
||||
std::back_insert_iterator<std::string> out(node);
|
||||
write_endpoint(i->addr, out);
|
||||
if (!nodes.empty())
|
||||
nodes.list().push_back(entry(node));
|
||||
}
|
||||
if (!nodes.list().empty())
|
||||
ret["nodes"] = nodes;
|
||||
}
|
||||
|
||||
|
|
|
@ -946,7 +946,7 @@ namespace libtorrent
|
|||
INVARIANT_CHECK;
|
||||
|
||||
// just ignore the obviously invalid entries from the tracker
|
||||
if(remote.address() == address(0) || remote.port() == 0)
|
||||
if(remote.address() == address() || remote.port() == 0)
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
|
@ -651,7 +651,8 @@ namespace libtorrent { namespace detail
|
|||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||
(*m_logger) << endp << " <== INCOMING CONNECTION\n";
|
||||
#endif
|
||||
if (m_ip_filter.access(endp.address().to_v4()) & ip_filter::blocked)
|
||||
if (endp.address().is_v4()
|
||||
&& (m_ip_filter.access(endp.address().to_v4()) & ip_filter::blocked))
|
||||
{
|
||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||
(*m_logger) << "filtered blocked ip\n";
|
||||
|
@ -1153,8 +1154,9 @@ namespace libtorrent
|
|||
= m_impl.m_connections.begin(); i != m_impl.m_connections.end();)
|
||||
{
|
||||
tcp::endpoint sender = i->first->remote_endpoint();
|
||||
if (m_impl.m_ip_filter.access(sender.address().to_v4())
|
||||
& ip_filter::blocked)
|
||||
if (sender.address().is_v4()
|
||||
&& (m_impl.m_ip_filter.access(sender.address().to_v4())
|
||||
& ip_filter::blocked))
|
||||
{
|
||||
#if defined(TORRENT_VERBOSE_LOGGING)
|
||||
(*i->second->m_logger) << "*** CONNECTION FILTERED'\n";
|
||||
|
|
|
@ -549,7 +549,9 @@ namespace libtorrent
|
|||
|
||||
tcp::endpoint a(address::from_string(i->ip), i->port);
|
||||
|
||||
if (m_ses.m_ip_filter.access(a.address().to_v4()) == ip_filter::blocked)
|
||||
if (a.address().is_v4()
|
||||
&& (m_ses.m_ip_filter.access(a.address().to_v4())
|
||||
& ip_filter::blocked))
|
||||
{
|
||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||
debug_log("blocked ip from tracker: " + i->ip);
|
||||
|
|
Loading…
Reference in New Issue