{"diffoscope-json-version": 1, "source1": "/srv/reproducible-results/rbuild-debian/r-b-build.TfX4sa1x/b1/libtorrent-rasterbar_2.0.8-1_i386.changes", "source2": "/srv/reproducible-results/rbuild-debian/r-b-build.TfX4sa1x/b2/libtorrent-rasterbar_2.0.8-1_i386.changes", "unified_diff": null, "details": [{"source1": "Files", "source2": "Files", "unified_diff": "@@ -1,7 +1,7 @@\n \n ca4eaa506fdaf16efe0f4e25204e2d69 360876 libdevel optional libtorrent-rasterbar-dev_2.0.8-1_i386.deb\n- bbbba924c859bb217b1264d730ec9336 1605400 doc optional libtorrent-rasterbar-doc_2.0.8-1_all.deb\n+ fb09736113d01318ed62b6a64677c47e 1605456 doc optional libtorrent-rasterbar-doc_2.0.8-1_all.deb\n 90f55a27da21b3f872d4e8e7ae3c264b 51219292 debug optional libtorrent-rasterbar2.0-dbgsym_2.0.8-1_i386.deb\n 851b3393141f98e5fe278da79d0627b6 1697800 libs optional libtorrent-rasterbar2.0_2.0.8-1_i386.deb\n 488e2f4cf7820921525252a58b0e5f46 12736700 debug optional python3-libtorrent-dbgsym_2.0.8-1_i386.deb\n- 7b5df70d421f9a723ecbd2f96a36fdf3 702280 python optional python3-libtorrent_2.0.8-1_i386.deb\n+ ade52be24c0beda7158d57166d719879 702276 python optional python3-libtorrent_2.0.8-1_i386.deb\n"}, {"source1": "libtorrent-rasterbar-doc_2.0.8-1_all.deb", "source2": "libtorrent-rasterbar-doc_2.0.8-1_all.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2022-10-23 15:10:21.000000 debian-binary\n -rw-r--r-- 0 0 0 3632 2022-10-23 15:10:21.000000 control.tar.xz\n--rw-r--r-- 0 0 0 1601576 2022-10-23 15:10:21.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 1601632 2022-10-23 15:10:21.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./control", "source2": "./control", "unified_diff": "@@ -1,13 +1,13 @@\n Package: libtorrent-rasterbar-doc\n Source: libtorrent-rasterbar\n Version: 2.0.8-1\n Architecture: all\n Maintainer: Christian Marillat \n-Installed-Size: 5793\n+Installed-Size: 5709\n Section: doc\n Priority: optional\n Multi-Arch: foreign\n Homepage: https://libtorrent.org/\n Description: Documentation for libtorrent-rasterbar\n Bittorrent library by Rasterbar Software (Arvid Norberg).\n libtorrent-rasterbar is a C++ library that aims to be a good alternative to\n"}, {"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -101,15 +101,15 @@\n -rw-r--r-- 0 root (0) root (0) 54531 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Info.html\n -rw-r--r-- 0 root (0) root (0) 48252 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Torrent_Status.html\n -rw-r--r-- 0 root (0) root (0) 16422 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Trackers.html\n -rw-r--r-- 0 root (0) root (0) 24490 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-Utility.html\n -rw-r--r-- 0 root (0) root (0) 9085 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference-ed25519.html\n -rw-r--r-- 0 root (0) root (0) 33602 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/reference.html\n -rw-r--r-- 0 root (0) root (0) 29147 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/security-audit.html\n--rw-r--r-- 0 root (0) root (0) 1334381 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html\n+-rw-r--r-- 0 root (0) root (0) 1248308 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html\n -rw-r--r-- 0 root (0) root (0) 10121 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/streaming.html\n -rw-r--r-- 0 root (0) root (0) 6746 2022-10-23 11:28:40.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/style.css\n -rw-r--r-- 0 root (0) root (0) 520020 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/todo.html\n -rw-r--r-- 0 root (0) root (0) 3021 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/troubleshooting.html\n -rw-r--r-- 0 root (0) root (0) 25025 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/tuning-ref.html\n -rw-r--r-- 0 root (0) root (0) 132588 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/tutorial-ref.html\n -rw-r--r-- 0 root (0) root (0) 16305 2022-10-23 15:10:21.000000 ./usr/share/doc/libtorrent-rasterbar-doc/html/udp_tracker_protocol.html\n"}, {"source1": "./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html", "source2": "./usr/share/doc/libtorrent-rasterbar-doc/html/single-page-ref.html", "unified_diff": "@@ -28,4179 +28,1829 @@\n 2.0.8\n \n \n

home

\n
\n

Table of contents

\n
\n-[report issue]
\n-

bdecode_node

\n-

Declared in "libtorrent/bdecode.hpp"

\n-

Sometimes it's important to get a non-owning reference to the root node (\n-to be able to copy it as a reference for instance). For that, use the\n-non_owning() member function.

\n-

There are 5 different types of nodes, see type_t.

\n-
\n-struct bdecode_node\n-{\n-   bdecode_node () = default;\n-   bdecode_node (bdecode_node const&);\n-   bdecode_node& operator= (bdecode_node&&) & = default;\n-   bdecode_node& operator= (bdecode_node const&) &;\n-   bdecode_node (bdecode_node&&) noexcept;\n-   type_t type () const noexcept;\n-   explicit operator bool () const noexcept;\n-   bdecode_node non_owning () const;\n-   std::ptrdiff_t data_offset () const noexcept;\n-   span<char const> data_section () const noexcept;\n-   string_view list_string_value_at (int i\n-      , string_view default_val = string_view()) const;\n-   std::int64_t list_int_value_at (int i\n-      , std::int64_t default_val = 0) const;\n-   int list_size () const;\n-   bdecode_node list_at (int i) const;\n-   bdecode_node dict_find_dict (string_view key) const;\n-   string_view dict_find_string_value (string_view key\n-      , string_view default_value = string_view()) const;\n-   bdecode_node dict_find (string_view key) const;\n-   std::int64_t dict_find_int_value (string_view key\n-      , std::int64_t default_val = 0) const;\n-   int dict_size () const;\n-   std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;\n-   bdecode_node dict_find_list (string_view key) const;\n-   bdecode_node dict_find_string (string_view key) const;\n-   bdecode_node dict_find_int (string_view key) const;\n-   std::pair<string_view, bdecode_node> dict_at (int i) const;\n-   std::int64_t int_value () const;\n-   string_view string_value () const;\n-   std::ptrdiff_t string_offset () const;\n-   char const* string_ptr () const;\n-   int string_length () const;\n-   void clear ();\n-   void swap (bdecode_node& n);\n-   void reserve (int tokens);\n-   void switch_underlying_buffer (char const* buf) noexcept;\n-   bool has_soft_error (span<char> error) const;\n-\n-   enum type_t\n-   {\n-      none_t,\n-      dict_t,\n-      list_t,\n-      string_t,\n-      int_t,\n-   };\n-};\n-
\n-[report issue]
\n-

bdecode_node()

\n-
\n-bdecode_node () = default;\n-
\n-

creates a default constructed node, it will have the type none_t.

\n-\n-[report issue]
\n-
\n-

bdecode_node() operator=()

\n-
\n-bdecode_node (bdecode_node const&);\n-bdecode_node& operator= (bdecode_node&&) & = default;\n-bdecode_node& operator= (bdecode_node const&) &;\n-bdecode_node (bdecode_node&&) noexcept;\n-
\n-

For owning nodes, the copy will create a copy of the tree, but the\n-underlying buffer remains the same.

\n-[report issue]
\n-
\n-

type()

\n-
\n-type_t type () const noexcept;\n-
\n-

the type of this node. See type_t.

\n-[report issue]
\n-
\n-

bool()

\n-
\n-explicit operator bool () const noexcept;\n-
\n-

returns true if type() != none_t.

\n-[report issue]
\n-
\n-

non_owning()

\n-
\n-bdecode_node non_owning () const;\n-
\n-

return a non-owning reference to this node. This is useful to refer to\n-the root node without copying it in assignments.

\n-\n-[report issue]
\n-
\n-

data_offset() data_section()

\n-
\n-std::ptrdiff_t data_offset () const noexcept;\n-span<char const> data_section () const noexcept;\n-
\n-

returns the buffer and length of the section in the original bencoded\n-buffer where this node is defined. For a dictionary for instance, this\n-starts with d and ends with e, and has all the content of the\n-dictionary in between.\n-the data_offset() function returns the byte-offset to this node in,\n-starting from the beginning of the buffer that was parsed.

\n-\n-\n-\n-[report issue]
\n-
\n-

list_int_value_at() list_size() list_at() list_string_value_at()

\n-
\n-string_view list_string_value_at (int i\n-      , string_view default_val = string_view()) const;\n-std::int64_t list_int_value_at (int i\n-      , std::int64_t default_val = 0) const;\n-int list_size () const;\n-bdecode_node list_at (int i) const;\n-
\n-

functions with the list_ prefix operate on lists. These functions are\n-only valid if type() == list_t. list_at() returns the item\n-in the list at index i. i may not be greater than or equal to the\n-size of the list. size() returns the size of the list.

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-[report issue]
\n-
\n-

dict_at() dict_find_dict() dict_find_int_value() dict_find() dict_find_int() dict_at_node() dict_find_string() dict_find_string_value() dict_find_list() dict_size()

\n-
\n-bdecode_node dict_find_dict (string_view key) const;\n-string_view dict_find_string_value (string_view key\n-      , string_view default_value = string_view()) const;\n-bdecode_node dict_find (string_view key) const;\n-std::int64_t dict_find_int_value (string_view key\n-      , std::int64_t default_val = 0) const;\n-int dict_size () const;\n-std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;\n-bdecode_node dict_find_list (string_view key) const;\n-bdecode_node dict_find_string (string_view key) const;\n-bdecode_node dict_find_int (string_view key) const;\n-std::pair<string_view, bdecode_node> dict_at (int i) const;\n-
\n-

Functions with the dict_ prefix operates on dictionaries. They are\n-only valid if type() == dict_t. In case a key you're looking up\n-contains a 0 byte, you cannot use the 0-terminated string overloads,\n-but have to use string_view instead. dict_find_list will return a\n-valid bdecode_node if the key is found _and_ it is a list. Otherwise\n-it will return a default-constructed bdecode_node.

\n-

Functions with the _value suffix return the value of the node\n-directly, rather than the nodes. In case the node is not found, or it has\n-a different type, a default value is returned (which can be specified).

\n-

dict_at() returns the (key, value)-pair at the specified index in a\n-dictionary. Keys are only allowed to be strings. dict_at_node() also\n-returns the (key, value)-pair, but the key is returned as a\n-bdecode_node (and it will always be a string).

\n-[report issue]
\n-
\n-

int_value()

\n-
\n-std::int64_t int_value () const;\n-
\n-

this function is only valid if type() == int_t. It returns the\n-value of the integer.

\n-\n-\n-\n-[report issue]
\n-
\n-

string_ptr() string_length() string_offset() string_value()

\n-
\n-string_view string_value () const;\n-std::ptrdiff_t string_offset () const;\n-char const* string_ptr () const;\n-int string_length () const;\n-
\n-

these functions are only valid if type() == string_t. They return\n-the string values. Note that string_ptr() is not 0-terminated.\n-string_length() returns the number of bytes in the string.\n-string_offset() returns the byte offset from the start of the parsed\n-bencoded buffer this string can be found.

\n-[report issue]
\n-
\n-

clear()

\n-
\n-void clear ();\n-
\n-

resets the bdecoded_node to a default constructed state. If this is\n-an owning node, the tree is freed and all child nodes are invalidated.

\n-[report issue]
\n-
\n-

swap()

\n-
\n-void swap (bdecode_node& n);\n-
\n-

Swap contents.

\n-[report issue]
\n-
\n-

reserve()

\n-
\n-void reserve (int tokens);\n-
\n-

preallocate memory for the specified numbers of tokens. This is\n-useful if you know approximately how many tokens are in the file\n-you are about to parse. Doing so will save realloc operations\n-while parsing. You should only call this on the root node, before\n-passing it in to bdecode().

\n-[report issue]
\n-
\n-

switch_underlying_buffer()

\n-
\n-void switch_underlying_buffer (char const* buf) noexcept;\n-
\n-

this buffer MUST be identical to the one originally parsed. This\n-operation is only defined on owning root nodes, i.e. the one passed in to\n-decode().

\n-[report issue]
\n-
\n-

has_soft_error()

\n-
\n-bool has_soft_error (span<char> error) const;\n-
\n-

returns true if there is a non-fatal error in the bencoding of this node\n-or its children

\n-[report issue]
\n-
\n-

enum type_t

\n-

Declared in "libtorrent/bdecode.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
none_t0uninitialized or default constructed. This is also used\n-to indicate that a node was not found in some cases.
dict_t1a dictionary node. The dict_find_ functions are valid.
list_t2a list node. The list_ functions are valid.
string_t3a string node, the string_ functions are valid.
int_t4an integer node. The int_ functions are valid.
\n-[report issue]
\n-
\n-
\n-

print_entry()

\n-

Declared in "libtorrent/bdecode.hpp"

\n-
\n-std::string print_entry (bdecode_node const& e\n-   , bool single_line = false, int indent = 0);\n-
\n-

print the bencoded structure in a human-readable format to a string\n-that's returned.

\n-[report issue]
\n-
\n-

bdecode()

\n-

Declared in "libtorrent/bdecode.hpp"

\n-
\n-bdecode_node bdecode (span<char const> buffer\n-   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n-   , int token_limit = 2000000);\n-int bdecode (char const* start, char const* end, bdecode_node& ret\n-   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n-   , int token_limit = 2000000);\n-bdecode_node bdecode (span<char const> buffer\n-   , int depth_limit = 100, int token_limit = 2000000);\n-
\n-

This function decodes/parses bdecoded data (for example a .torrent file).\n-The data structure is returned in the ret argument. the buffer to parse\n-is specified by the start of the buffer as well as the end, i.e. one\n-byte past the end. If the buffer fails to parse, the function returns a\n-non-zero value and fills in ec with the error code. The optional\n-argument error_pos, if set to non-nullptr, will be set to the byte offset\n-into the buffer where the parse failure occurred.

\n-

depth_limit specifies the max number of nested lists or dictionaries are\n-allowed in the data structure. (This affects the stack usage of the\n-function, be careful not to set it too high).

\n-

token_limit is the max number of tokens allowed to be parsed from the\n-buffer. This is simply a sanity check to not have unbounded memory usage.

\n-

The resulting bdecode_node is an owning node. That means it will\n-be holding the whole parsed tree. When iterating lists and dictionaries,\n-those bdecode_node objects will simply have references to the root or\n-owning bdecode_node. If the root node is destructed, all other nodes\n-that refer to anything in that tree become invalid.

\n-

However, the underlying buffer passed in to this function (start, end)\n-must also remain valid while the bdecoded tree is used. The parsed tree\n-produced by this function does not copy any data out of the buffer, but\n-simply produces references back into it.

\n-[report issue]
\n-
\n-

web_seed_entry

\n-

Declared in "libtorrent/torrent_info.hpp"

\n-

the web_seed_entry holds information about a web seed (also known\n-as URL seed or HTTP seed). It is essentially a URL with some state\n-associated with it. For more information, see BEP 17 and BEP 19.

\n+[report issue]
\n+

session_proxy

\n+

Declared in "libtorrent/session.hpp"

\n+

this is a holder for the internal session implementation object. Once the\n+session destruction is explicitly initiated, this holder is used to\n+synchronize the completion of the shutdown. The lifetime of this object\n+may outlive session, causing the session destructor to not block. The\n+session_proxy destructor will block however, until the underlying session\n+is done shutting down.

\n
\n-struct web_seed_entry\n+struct session_proxy\n {\n-   bool operator== (web_seed_entry const& e) const;\n-   bool operator< (web_seed_entry const& e) const;\n-\n-   enum type_t\n-   {\n-      url_seed,\n-      http_seed,\n-   };\n-\n-   std::string url;\n-   std::string auth;\n-   headers_t extra_headers;\n-   std::uint8_t type;\n+   session_proxy ();\n+   session_proxy (session_proxy const&);\n+   session_proxy (session_proxy&&) noexcept;\n+   ~session_proxy ();\n+   session_proxy& operator= (session_proxy&&) & noexcept;\n+   session_proxy& operator= (session_proxy const&) &;\n };\n 
\n-[report issue]
\n-

operator==()

\n-
\n-bool operator== (web_seed_entry const& e) const;\n-
\n-

URL and type comparison

\n-[report issue]
\n-
\n-

operator<()

\n+\n+\n+[report issue]
\n+

session_proxy() ~session_proxy() operator=()

\n
\n-bool operator< (web_seed_entry const& e) const;\n+session_proxy ();\n+session_proxy (session_proxy const&);\n+session_proxy (session_proxy&&) noexcept;\n+~session_proxy ();\n+session_proxy& operator= (session_proxy&&) & noexcept;\n+session_proxy& operator= (session_proxy const&) &;\n 
\n-

URL and type less-than comparison

\n-[report issue]
\n-
\n-

enum type_t

\n-

Declared in "libtorrent/torrent_info.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
url_seed0 
http_seed1 
\n-[report issue]
\n-
url
\n-
The URL of the web seed
\n-
\n-[report issue]
\n-
auth
\n-
Optional authentication. If this is set, it's passed\n-in as HTTP basic auth to the web seed. The format is:\n-username:password.
\n-
\n-[report issue]
\n-
extra_headers
\n-
Any extra HTTP headers that need to be passed to the web seed
\n-
\n-[report issue]
\n-
type
\n-
The type of web seed (see type_t)
\n-
\n-[report issue]
\n+

default constructor, does not refer to any session\n+implementation object.

\n+[report issue]
\n
\n-
\n-

load_torrent_limits

\n-

Declared in "libtorrent/torrent_info.hpp"

\n-

this object holds configuration options for limits to use when loading\n-torrents. They are meant to prevent loading potentially malicious torrents\n-that cause excessive memory allocations.

\n-
\n-struct load_torrent_limits\n-{\n-   int max_buffer_size  = 10000000;\n-   int max_pieces  = 0x200000;\n-   int max_decode_depth  = 100;\n-   int max_decode_tokens  = 3000000;\n-};\n-
\n-[report issue]
\n-
max_buffer_size
\n-
the max size of a .torrent file to load into RAM
\n-
\n-[report issue]
\n-
max_pieces
\n-
the max number of pieces allowed in the torrent
\n-
\n-[report issue]
\n-
max_decode_depth
\n-
the max recursion depth in the bdecoded structure
\n-
\n-[report issue]
\n-
max_decode_tokens
\n-
the max number of bdecode tokens
\n-
\n-[report issue]
\n-
\n-

torrent_info

\n-

Declared in "libtorrent/torrent_info.hpp"

\n-

the torrent_info class holds the information found in a .torrent file.

\n+
\n+

session

\n+

Declared in "libtorrent/session.hpp"

\n+

The session holds all state that spans multiple torrents. Among other\n+things it runs the network loop and manages all torrents. Once it's\n+created, the session object will spawn the main thread that will do all\n+the work. The main thread will be idle as long it doesn't have any\n+torrents to participate in.

\n+

You have some control over session configuration through the\n+session_handle::apply_settings() member function. To change one or more\n+configuration options, create a settings_pack. object and fill it with\n+the settings to be set and pass it in to session::apply_settings().

\n+

see apply_settings().

\n
\n-class torrent_info\n+struct session : session_handle\n {\n-   explicit torrent_info (bdecode_node const& torrent_file);\n-   torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n-   torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);\n-   torrent_info (char const* buffer, int size);\n-   torrent_info (char const* buffer, int size, error_code& ec);\n-   explicit torrent_info (std::string const& filename);\n-   explicit torrent_info (info_hash_t const& info_hash);\n-   torrent_info (std::string const& filename, error_code& ec);\n-   explicit torrent_info (span<char const> buffer, from_span_t);\n-   torrent_info (torrent_info const& t);\n-   torrent_info (span<char const> buffer, error_code& ec, from_span_t);\n-   torrent_info (bdecode_node const& torrent_file, error_code& ec);\n-   torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n-   ~torrent_info ();\n-   file_storage const& orig_files () const;\n-   file_storage const& files () const;\n-   void rename_file (file_index_t index, std::string const& new_filename);\n-   void remap_files (file_storage const& f);\n-   void add_tracker (std::string const& url, int tier = 0);\n-   void clear_trackers ();\n-   std::vector<announce_entry> const& trackers () const;\n-   void add_tracker (std::string const& url, int tier\n-      , announce_entry::tracker_source source);\n-   std::vector<std::string> collections () const;\n-   std::vector<sha1_hash> similar_torrents () const;\n-   void add_url_seed (std::string const& url\n-      , std::string const& ext_auth = std::string()\n-      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::headers_t());\n-   void set_web_seeds (std::vector<web_seed_entry> seeds);\n-   std::vector<web_seed_entry> const& web_seeds () const;\n-   void add_http_seed (std::string const& url\n-      , std::string const& extern_auth = std::string()\n-      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::headers_t());\n-   std::int64_t total_size () const;\n-   int piece_length () const;\n-   int num_pieces () const;\n-   index_range<piece_index_t> piece_range () const;\n-   piece_index_t end_piece () const;\n-   piece_index_t last_piece () const;\n-   info_hash_t const& info_hashes () const;\n-   sha1_hash info_hash () const noexcept;\n-   bool v2 () const;\n-   bool v1 () const;\n-   int num_files () const;\n-   std::vector<file_slice> map_block (piece_index_t const piece\n-      , std::int64_t offset, int size) const;\n-   peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;\n-   string_view ssl_cert () const;\n-   bool is_valid () const;\n-   bool priv () const;\n-   bool is_i2p () const;\n-   int piece_size (piece_index_t index) const;\n-   char const* hash_for_piece_ptr (piece_index_t const index) const;\n-   sha1_hash hash_for_piece (piece_index_t index) const;\n-   bool is_loaded () const;\n-   const std::string& name () const;\n-   std::time_t creation_date () const;\n-   const std::string& creator () const;\n-   const std::string& comment () const;\n-   std::vector<std::pair<std::string, int>> const& nodes () const;\n-   void add_node (std::pair<std::string, int> const& node);\n-   bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);\n-   bdecode_node info (char const* key) const;\n-   span<char const> info_section () const;\n-   span<char const> piece_layer (file_index_t) const;\n-   void free_piece_layers ();\n+   explicit session (session_params&& params);\n+   session ();\n+   explicit session (session_params const& params);\n+   session (session_params&& params, session_flags_t flags);\n+   session (session_params const& params, session_flags_t flags);\n+   session (session_params&& params, io_context& ios);\n+   session (session_params const& params, io_context& ios, session_flags_t);\n+   session (session_params&& params, io_context& ios, session_flags_t);\n+   session (session_params const& params, io_context& ios);\n+   ~session ();\n+   session_proxy abort ();\n };\n 
\n-[report issue]
\n-

torrent_info()

\n-
\n-explicit torrent_info (bdecode_node const& torrent_file);\n-torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n-torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);\n-torrent_info (char const* buffer, int size);\n-torrent_info (char const* buffer, int size, error_code& ec);\n-explicit torrent_info (std::string const& filename);\n-explicit torrent_info (info_hash_t const& info_hash);\n-torrent_info (std::string const& filename, error_code& ec);\n-explicit torrent_info (span<char const> buffer, from_span_t);\n-torrent_info (torrent_info const& t);\n-torrent_info (span<char const> buffer, error_code& ec, from_span_t);\n-torrent_info (bdecode_node const& torrent_file, error_code& ec);\n-torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n-
\n-

The constructor that takes an info-hash will initialize the info-hash\n-to the given value, but leave all other fields empty. This is used\n-internally when downloading torrents without the metadata. The\n-metadata will be created by libtorrent as soon as it has been\n-downloaded from the swarm.

\n-

The constructor that takes a bdecode_node will create a torrent_info\n-object from the information found in the given torrent_file. The\n-bdecode_node represents a tree node in an bencoded file. To load an\n-ordinary .torrent file into a bdecode_node, use bdecode().

\n-

The version that takes a buffer pointer and a size will decode it as a\n-.torrent file and initialize the torrent_info object for you.

\n-

The version that takes a filename will simply load the torrent file\n-and decode it inside the constructor, for convenience. This might not\n-be the most suitable for applications that want to be able to report\n-detailed errors on what might go wrong.

\n-

There is an upper limit on the size of the torrent file that will be\n-loaded by the overload taking a filename. If it's important that even\n-very large torrent files are loaded, use one of the other overloads.

\n-

The overloads that takes an error_code const& never throws if an\n-error occur, they will simply set the error code to describe what went\n-wrong and not fully initialize the torrent_info object. The overloads\n-that do not take the extra error_code parameter will always throw if\n-an error occurs. These overloads are not available when building\n-without exception support.

\n-

The overload that takes a span also needs an extra parameter of\n-type from_span_t to disambiguate the std::string overload for\n-string literals. There is an object in the libtorrent namespace of this\n-type called from_span.

\n-[report issue]
\n-
\n-

~torrent_info()

\n-
\n-~torrent_info ();\n-
\n-

frees all storage associated with this torrent_info object

\n-\n-[report issue]
\n-
\n-

files() orig_files()

\n-
\n-file_storage const& orig_files () const;\n-file_storage const& files () const;\n-
\n-

The file_storage object contains the information on how to map the\n-pieces to files. It is separated from the torrent_info object because\n-when creating torrents a storage object needs to be created without\n-having a torrent file. When renaming files in a storage, the storage\n-needs to make its own copy of the file_storage in order to make its\n-mapping differ from the one in the torrent file.

\n-

orig_files() returns the original (unmodified) file storage for\n-this torrent. This is used by the web server connection, which needs\n-to request files with the original names. Filename may be changed using\n-torrent_info::rename_file().

\n-

For more information on the file_storage object, see the separate\n-document on how to create torrents.

\n-[report issue]
\n-
\n-

rename_file()

\n+[report issue]
\n+

session()

\n
\n-void rename_file (file_index_t index, std::string const& new_filename);\n+explicit session (session_params&& params);\n+session ();\n+explicit session (session_params const& params);\n+session (session_params&& params, session_flags_t flags);\n+session (session_params const& params, session_flags_t flags);\n 
\n-

Renames the file with the specified index to the new name. The new\n-filename is reflected by the file_storage returned by files()\n-but not by the one returned by orig_files().

\n-

If you want to rename the base name of the torrent (for a multi file\n-torrent), you can copy the file_storage (see files() and\n-orig_files() ), change the name, and then use remap_files().

\n-

The new_filename can both be a relative path, in which case the\n-file name is relative to the save_path of the torrent. If the\n-new_filename is an absolute path (i.e. is_complete(new_filename)\n-== true), then the file is detached from the save_path of the\n-torrent. In this case the file is not moved when move_storage() is\n-invoked.

\n-[report issue]
\n-
\n-

remap_files()

\n+

Constructs the session objects which acts as the container of torrents.\n+In order to avoid a race condition between starting the session and\n+configuring it, you can pass in a session_params object. Its settings\n+will take effect before the session starts up.

\n+

The overloads taking flags can be used to start a session in\n+paused mode (by passing in session::paused). Note that\n+add_default_plugins do not have an affect on constructors that\n+take a session_params object. It already contains the plugins to use.

\n+[report issue]
\n+
\n+

session()

\n
\n-void remap_files (file_storage const& f);\n+session (session_params&& params, io_context& ios);\n+session (session_params const& params, io_context& ios, session_flags_t);\n+session (session_params&& params, io_context& ios, session_flags_t);\n+session (session_params const& params, io_context& ios);\n 
\n+

Overload of the constructor that takes an external io_context to run\n+the session object on. This is primarily useful for tests that may want\n+to run multiple sessions on a single io_context, or low resource\n+systems where additional threads are expensive and sharing an\n+io_context with other events is fine.

\n
\n

Warning

\n-

Using remap_files() is discouraged as it's incompatible with v2\n-torrents. This is because the piece boundaries and piece hashes in\n-v2 torrents are intimately tied to the file boundaries. Instead,\n-just rename individual files, or implement a custom disk_interface\n-to customize how to store files.

\n+

The session object does not cleanly terminate with an external\n+io_context. The io_context::run() call must have returned\n+before it's safe to destruct the session. Which means you MUST\n+call session::abort() and save the session_proxy first, then\n+destruct the session object, then sync with the io_context, then\n+destruct the session_proxy object.

\n
\n-

Remaps the file storage to a new file layout. This can be used to, for\n-instance, download all data in a torrent to a single file, or to a\n-number of fixed size sector aligned files, regardless of the number\n-and sizes of the files in the torrent.

\n-

The new specified file_storage must have the exact same size as\n-the current one.

\n-\n-\n-[report issue]
\n-
\n-

trackers() clear_trackers() add_tracker()

\n-
\n-void add_tracker (std::string const& url, int tier = 0);\n-void clear_trackers ();\n-std::vector<announce_entry> const& trackers () const;\n-void add_tracker (std::string const& url, int tier\n-      , announce_entry::tracker_source source);\n-
\n-

add_tracker() adds a tracker to the announce-list. The tier\n-determines the order in which the trackers are to be tried.\n-The trackers() function will return a sorted vector of\n-announce_entry. Each announce entry contains a string, which is\n-the tracker url, and a tier index. The tier index is the high-level\n-priority. No matter which trackers that works or not, the ones with\n-lower tier will always be tried before the one with higher tier\n-number. For more information, see announce_entry.

\n-

trackers() returns all entries from announce-list.

\n-

clear_trackers() removes all trackers from announce-list.

\n-\n-[report issue]
\n-
\n-

collections() similar_torrents()

\n-
\n-std::vector<std::string> collections () const;\n-std::vector<sha1_hash> similar_torrents () const;\n-
\n-

These two functions are related to BEP 38 (mutable torrents). The\n-vectors returned from these correspond to the "similar" and\n-"collections" keys in the .torrent file. Both info-hashes and\n-collections from within the info-dict and from outside of it are\n-included.

\n-\n-\n-\n-[report issue]
\n-
\n-

add_url_seed() set_web_seeds() add_http_seed() web_seeds()

\n-
\n-void add_url_seed (std::string const& url\n-      , std::string const& ext_auth = std::string()\n-      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::headers_t());\n-void set_web_seeds (std::vector<web_seed_entry> seeds);\n-std::vector<web_seed_entry> const& web_seeds () const;\n-void add_http_seed (std::string const& url\n-      , std::string const& extern_auth = std::string()\n-      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::headers_t());\n-
\n-

web_seeds() returns all url seeds and http seeds in the torrent.\n-Each entry is a web_seed_entry and may refer to either a url seed\n-or http seed.

\n-

add_url_seed() and add_http_seed() adds one url to the list of\n-url/http seeds.

\n-

set_web_seeds() replaces all web seeds with the ones specified in\n-the seeds vector.

\n-

The extern_auth argument can be used for other authorization\n-schemes than basic HTTP authorization. If set, it will override any\n-username and password found in the URL itself. The string will be sent\n-as the HTTP authorization header's value (without specifying "Basic").

\n-

The extra_headers argument defaults to an empty list, but can be\n-used to insert custom HTTP headers in the requests to a specific web\n-seed.

\n-

See http seeding for more information.

\n-[report issue]
\n-
\n-

total_size()

\n-
\n-std::int64_t total_size () const;\n-
\n-

total_size() returns the total number of bytes the torrent-file\n-represents. Note that this is the number of pieces times the piece\n-size (modulo the last piece possibly being smaller). With pad files,\n-the total size will be larger than the sum of all (regular) file\n-sizes.

\n-\n-[report issue]
\n-
\n-

num_pieces() piece_length()

\n-
\n-int piece_length () const;\n-int num_pieces () const;\n-
\n-

piece_length() and num_pieces() returns the number of byte\n-for each piece and the total number of pieces, respectively. The\n-difference between piece_size() and piece_length() is that\n-piece_size() takes the piece index as argument and gives you the\n-exact size of that piece. It will always be the same as\n-piece_length() except in the case of the last piece, which may be\n-smaller.

\n-\n-\n-[report issue]
\n-
\n-

last_piece() end_piece() piece_range()

\n-
\n-index_range<piece_index_t> piece_range () const;\n-piece_index_t end_piece () const;\n-piece_index_t last_piece () const;\n-
\n-

last_piece() returns the index to the last piece in the torrent and\n-end_piece() returns the index to the one-past-end piece in the\n-torrent\n-piece_range() returns an implementation-defined type that can be\n-used as the container in a range-for loop. Where the values are the\n-indices of all pieces in the file_storage.

\n-\n-[report issue]
\n-
\n-

info_hash() info_hashes()

\n-
\n-info_hash_t const& info_hashes () const;\n-sha1_hash info_hash () const noexcept;\n-
\n-

returns the info-hash of the torrent. For BitTorrent v2 support, use\n-info_hashes() to get an object that may hold both a v1 and v2\n-info-hash

\n-\n-[report issue]
\n-
\n-

v2() v1()

\n-
\n-bool v2 () const;\n-bool v1 () const;\n-
\n-

returns whether this torrent has v1 and/or v2 metadata, respectively.\n-Hybrid torrents have both. These are shortcuts for\n-info_hashes().has_v1() and info_hashes().has_v2() calls.

\n-[report issue]
\n-
\n-

num_files()

\n-
\n-int num_files () const;\n-
\n-

If you need index-access to files you can use the num_files() along\n-with the file_path(), file_size()-family of functions to access\n-files using indices.

\n-[report issue]
\n-
\n-

map_block()

\n-
\n-std::vector<file_slice> map_block (piece_index_t const piece\n-      , std::int64_t offset, int size) const;\n-
\n-

This function will map a piece index, a byte offset within that piece\n-and a size (in bytes) into the corresponding files with offsets where\n-that data for that piece is supposed to be stored. See file_slice.

\n-[report issue]
\n-
\n-

map_file()

\n-
\n-peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;\n-
\n-

This function will map a range in a specific file into a range in the\n-torrent. The file_offset parameter is the offset in the file,\n-given in bytes, where 0 is the start of the file. See peer_request.

\n-

The input range is assumed to be valid within the torrent.\n-file_offset + size is not allowed to be greater than the file\n-size. file_index must refer to a valid file, i.e. it cannot be >=\n-num_files().

\n-[report issue]
\n-
\n-

ssl_cert()

\n-
\n-string_view ssl_cert () const;\n-
\n-

Returns the SSL root certificate for the torrent, if it is an SSL\n-torrent. Otherwise returns an empty string. The certificate is\n-the public certificate in x509 format.

\n-[report issue]
\n-
\n-

is_valid()

\n-
\n-bool is_valid () const;\n-
\n-

returns true if this torrent_info object has a torrent loaded.\n-This is primarily used to determine if a magnet link has had its\n-metadata resolved yet or not.

\n-[report issue]
\n-
\n-

priv()

\n-
\n-bool priv () const;\n-
\n-

returns true if this torrent is private. i.e., the client should not\n-advertise itself on the trackerless network (the Kademlia DHT) for this torrent.

\n-[report issue]
\n-
\n-

is_i2p()

\n-
\n-bool is_i2p () const;\n-
\n-

returns true if this is an i2p torrent. This is determined by whether\n-or not it has a tracker whose URL domain name ends with ".i2p". i2p\n-torrents disable the DHT and local peer discovery as well as talking\n-to peers over anything other than the i2p network.

\n-[report issue]
\n-
\n-

piece_size()

\n-
\n-int piece_size (piece_index_t index) const;\n-
\n-

returns the piece size of file with index. This will be the same as piece_length(),\n-except for the last piece, which may be shorter.

\n-\n-[report issue]
\n-
\n-

hash_for_piece() hash_for_piece_ptr()

\n-
\n-char const* hash_for_piece_ptr (piece_index_t const index) const;\n-sha1_hash hash_for_piece (piece_index_t index) const;\n-
\n-

hash_for_piece() takes a piece-index and returns the 20-bytes\n-sha1-hash for that piece and info_hash() returns the 20-bytes\n-sha1-hash for the info-section of the torrent file.\n-hash_for_piece_ptr() returns a pointer to the 20 byte sha1 digest\n-for the piece. Note that the string is not 0-terminated.

\n-[report issue]
\n-
\n-

name()

\n-
\n-const std::string& name () const;\n-
\n-

name() returns the name of the torrent.\n-name contains UTF-8 encoded string.

\n-[report issue]
\n-
\n-

creation_date()

\n-
\n-std::time_t creation_date () const;\n-
\n-

creation_date() returns the creation date of the torrent as time_t\n-(posix time). If there's no time stamp in the torrent file, 0 is\n-returned.\n-.. posix time: http://www.opengroup.org/onlinepubs/009695399/functions/time.html

\n-[report issue]
\n-
\n-

creator()

\n-
\n-const std::string& creator () const;\n-
\n-

creator() returns the creator string in the torrent. If there is\n-no creator string it will return an empty string.

\n-[report issue]
\n-
\n-

comment()

\n-
\n-const std::string& comment () const;\n-
\n-

comment() returns the comment associated with the torrent. If\n-there's no comment, it will return an empty string.\n-comment contains UTF-8 encoded string.

\n-[report issue]
\n-
\n-

nodes()

\n-
\n-std::vector<std::pair<std::string, int>> const& nodes () const;\n-
\n-

If this torrent contains any DHT nodes, they are put in this vector in\n-their original form (host name and port number).

\n-[report issue]
\n-
\n-

add_node()

\n-
\n-void add_node (std::pair<std::string, int> const& node);\n-
\n-

This is used when creating torrent. Use this to add a known DHT node.\n-It may be used, by the client, to bootstrap into the DHT network.

\n-[report issue]
\n-
\n-

parse_info_section()

\n-
\n-bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);\n-
\n-

populates the torrent_info by providing just the info-dict buffer.\n-This is used when loading a torrent from a magnet link for instance,\n-where we only have the info-dict. The bdecode_node e points to a\n-parsed info-dictionary. ec returns an error code if something\n-fails (typically if the info dictionary is malformed).\n-The max_pieces parameter allows limiting the amount of memory\n-dedicated to loading the torrent, and fails for torrents that exceed\n-the limit. To load large torrents, this limit may also need to be\n-raised in settings_pack::max_piece_count and in calls to\n-read_resume_data().

\n-[report issue]
\n-
\n-

info()

\n-
\n-bdecode_node info (char const* key) const;\n-
\n-

This function looks up keys from the info-dictionary of the loaded\n-torrent file. It can be used to access extension values put in the\n-.torrent file. If the specified key cannot be found, it returns nullptr.

\n-[report issue]
\n-
\n-

info_section()

\n+[report issue]
\n+
\n+

~session()

\n
\n-span<char const> info_section () const;\n+~session ();\n 
\n-

returns a the raw info section of the torrent file.\n-The underlying buffer is still owned by the torrent_info object

\n-[report issue]
\n-
\n-

piece_layer()

\n+

The destructor of session will notify all trackers that our torrents\n+have been shut down. If some trackers are down, they will time out.\n+All this before the destructor of session returns. So, it's advised\n+that any kind of interface (such as windows) are closed before\n+destructing the session object. Because it can take a few second for\n+it to finish. The timeout can be set with apply_settings().

\n+[report issue]
\n+
\n+

abort()

\n
\n-span<char const> piece_layer (file_index_t) const;\n+session_proxy abort ();\n 
\n-

return the bytes of the piece layer hashes for the specified file. If\n-the file doesn't have a piece layer, an empty span is returned.\n-The span size is divisible by 32, the size of a SHA-256 hash.\n-If the size of the file is smaller than or equal to the piece size,\n-the files "root hash" is the hash of the file and is not saved\n-separately in the "piece layers" field, but this function still\n-returns the root hash of the file in that case.

\n-[report issue]
\n-
\n-

free_piece_layers()

\n+

In case you want to destruct the session asynchronously, you can\n+request a session destruction proxy. If you don't do this, the\n+destructor of the session object will block while the trackers are\n+contacted. If you keep one session_proxy to the session when\n+destructing it, the destructor will not block, but start to close down\n+the session, the destructor of the proxy will then synchronize the\n+threads. So, the destruction of the session is performed from the\n+session destructor call until the session_proxy destructor\n+call. The session_proxy does not have any operations on it (since\n+the session is being closed down, no operations are allowed on it).\n+The only valid operation is calling the destructor:

\n
\n-void free_piece_layers ();\n+struct session_proxy {};\n 
\n-

clears the piece layers from the torrent_info. This is done by the\n-session when a torrent is added, to avoid storing it twice. The piece\n-layer (or other hashes part of the merkle tree) are stored in the\n-internal torrent object.

\n-

Bencoding is a common representation in bittorrent used for dictionary,\n-list, int and string hierarchies. It's used to encode .torrent files and\n-some messages in the network protocol. libtorrent also uses it to store\n-settings, resume data and other session state.

\n-

Strings in bencoded structures do not necessarily represent text.\n-Strings are raw byte buffers of a certain length. If a string is meant to be\n-interpreted as text, it is required to be UTF-8 encoded. See BEP 3.

\n-

The function for decoding bencoded data bdecode(), returning a bdecode_node.\n-This function builds a tree that points back into the original buffer. The\n-returned bdecode_node will not be valid once the buffer it was parsed out of\n-is discarded.

\n-

It's possible to construct an entry from a bdecode_node, if a structure needs\n-to be altered and re-encoded.

\n-[report issue]
\n+[report issue]
\n
\n-
\n-

entry

\n-

Declared in "libtorrent/entry.hpp"

\n-

The entry class represents one node in a bencoded hierarchy. It works as a\n-variant type, it can be either a list, a dictionary (std::map), an integer\n-or a string.

\n+
\n+

session_params

\n+

Declared in "libtorrent/session_params.hpp"

\n+

The session_params is a parameters pack for configuring the session\n+before it's started.

\n
\n-class entry\n+struct session_params\n {\n-   data_type type () const;\n-   entry (dictionary_type);\n-   entry (span<char const>);\n-   entry (integer_type);\n-   entry (preformatted_type);\n-   entry (list_type);\n-   entry (U v);\n-   entry (data_type t);\n-   entry (bdecode_node const& n);\n-   entry& operator= (dictionary_type) &;\n-   entry& operator= (integer_type) &;\n-   entry& operator= (bdecode_node const&) &;\n-   entry& operator= (entry&&) & noexcept;\n-   entry& operator= (span<char const>) &;\n-   entry& operator= (list_type) &;\n-   entry& operator= (entry const&) &;\n-   entry& operator= (preformatted_type) &;\n-   entry& operator= (U v) &;\n-   string_type const& string () const;\n-   preformatted_type const& preformatted () const;\n-   integer_type& integer ();\n-   dictionary_type& dict ();\n-   integer_type const& integer () const;\n-   dictionary_type const& dict () const;\n-   list_type const& list () const;\n-   list_type& list ();\n-   string_type& string ();\n-   preformatted_type& preformatted ();\n-   void swap (entry& e);\n-   entry const& operator[] (string_view key) const;\n-   entry& operator[] (string_view key);\n-   entry const* find_key (string_view key) const;\n-   entry* find_key (string_view key);\n-   std::string to_string (bool single_line = false) const;\n-\n-   enum data_type\n-   {\n-      int_t,\n-      string_t,\n-      list_t,\n-      dictionary_t,\n-      undefined_t,\n-      preformatted_t,\n-   };\n-};\n-
\n-[report issue]
\n-

type()

\n-
\n-data_type type () const;\n-
\n-

returns the concrete type of the entry

\n-[report issue]
\n-
\n-

entry()

\n-
\n-entry (dictionary_type);\n-entry (span<char const>);\n-entry (integer_type);\n-entry (preformatted_type);\n-entry (list_type);\n-
\n-

constructors directly from a specific type.\n-The content of the argument is copied into the\n-newly constructed entry

\n-[report issue]
\n-
\n-

entry()

\n-
\n-entry (data_type t);\n-
\n-

construct an empty entry of the specified type.\n-see data_type enum.

\n-[report issue]
\n-
\n-

entry()

\n-
\n-entry (bdecode_node const& n);\n-
\n-

construct from bdecode_node parsed form (see bdecode())

\n-[report issue]
\n-
\n-

operator=()

\n-
\n-entry& operator= (dictionary_type) &;\n-entry& operator= (integer_type) &;\n-entry& operator= (bdecode_node const&) &;\n-entry& operator= (entry&&) & noexcept;\n-entry& operator= (span<char const>) &;\n-entry& operator= (list_type) &;\n-entry& operator= (entry const&) &;\n-entry& operator= (preformatted_type) &;\n-
\n-

copies the structure of the right hand side into this\n-entry.

\n-\n-\n-\n-\n-[report issue]
\n-
\n-

dict() string() list() integer() preformatted()

\n-
\n-string_type const& string () const;\n-preformatted_type const& preformatted () const;\n-integer_type& integer ();\n-dictionary_type& dict ();\n-integer_type const& integer () const;\n-dictionary_type const& dict () const;\n-list_type const& list () const;\n-list_type& list ();\n-string_type& string ();\n-preformatted_type& preformatted ();\n-
\n-

The integer(), string(), list() and dict() functions\n-are accessors that return the respective type. If the entry object\n-isn't of the type you request, the accessor will throw\n-system_error. You can ask an entry for its type through the\n-type() function.

\n-

If you want to create an entry you give it the type you want it to\n-have in its constructor, and then use one of the non-const accessors\n-to get a reference which you then can assign the value you want it to\n-have.

\n-

The typical code to get info from a torrent file will then look like\n-this:

\n-
\n-entry torrent_file;\n-// ...\n-\n-// throws if this is not a dictionary\n-entry::dictionary_type const& dict = torrent_file.dict();\n-entry::dictionary_type::const_iterator i;\n-i = dict.find("announce");\n-if (i != dict.end())\n-{\n-        std::string tracker_url = i->second.string();\n-        std::cout << tracker_url << "\\n";\n-}\n-
\n-

The following code is equivalent, but a little bit shorter:

\n-
\n-entry torrent_file;\n-// ...\n-\n-// throws if this is not a dictionary\n-if (entry* i = torrent_file.find_key("announce"))\n-{\n-        std::string tracker_url = i->string();\n-        std::cout << tracker_url << "\\n";\n-}\n-
\n-

To make it easier to extract information from a torrent file, the\n-class torrent_info exists.

\n-[report issue]
\n-
\n-

swap()

\n-
\n-void swap (entry& e);\n-
\n-

swaps the content of this with e.

\n-[report issue]
\n-
\n-

operator[]()

\n-
\n-entry const& operator[] (string_view key) const;\n-entry& operator[] (string_view key);\n-
\n-

All of these functions requires the entry to be a dictionary, if it\n-isn't they will throw system_error.

\n-

The non-const versions of the operator[] will return a reference\n-to either the existing element at the given key or, if there is no\n-element with the given key, a reference to a newly inserted element at\n-that key.

\n-

The const version of operator[] will only return a reference to an\n-existing element at the given key. If the key is not found, it will\n-throw system_error.

\n-[report issue]
\n-
\n-

find_key()

\n-
\n-entry const* find_key (string_view key) const;\n-entry* find_key (string_view key);\n-
\n-

These functions requires the entry to be a dictionary, if it isn't\n-they will throw system_error.

\n-

They will look for an element at the given key in the dictionary, if\n-the element cannot be found, they will return nullptr. If an element\n-with the given key is found, the return a pointer to it.

\n-[report issue]
\n-
\n-

to_string()

\n-
\n-std::string to_string (bool single_line = false) const;\n-
\n-

returns a pretty-printed string representation\n-of the bencoded structure, with JSON-style syntax

\n-[report issue]
\n-
\n-

enum data_type

\n-

Declared in "libtorrent/entry.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
int_t0 
string_t1 
list_t2 
dictionary_t3 
undefined_t4 
preformatted_t5 
\n-[report issue]
\n-
\n-
\n-

operator<<()

\n-

Declared in "libtorrent/entry.hpp"

\n-
\n-inline std::ostream& operator<< (std::ostream& os, const entry& e);\n-
\n-

prints the bencoded structure to the ostream as a JSON-style structure.

\n-[report issue]
\n-
\n-

bencode()

\n-

Declared in "libtorrent/bencode.hpp"

\n-
\n-template<class OutIt> int bencode (OutIt out, const entry& e);\n-
\n-

This function will encode data to bencoded form.

\n-

The entry class is the internal representation of the bencoded data\n-and it can be used to retrieve information, an entry can also be build by\n-the program and given to bencode() to encode it into the OutIt\n-iterator.

\n-

OutIt is an OutputIterator. It's a template and usually\n-instantiated as ostream_iterator or back_insert_iterator. This\n-function assumes the value_type of the iterator is a char.\n-In order to encode entry e into a buffer, do:

\n-
\n-std::vector<char> buffer;\n-bencode(std::back_inserter(buf), e);\n-
\n-

The disk I/O can be customized in libtorrent. In previous versions, the\n-customization was at the level of each torrent. Now, the customization point\n-is at the session level. All torrents added to a session will use the same\n-disk I/O subsystem, as determined by the disk_io_constructor (in\n-session_params).

\n-

This allows the disk subsystem to also customize threading and disk job\n-management.

\n-

To customize the disk subsystem, implement disk_interface and provide a\n-factory function to the session constructor (via session_params).

\n-

Example use:

\n-
\n-struct temp_storage\n-{\n-  explicit temp_storage(lt::file_storage const& fs) : m_files(fs) {}\n-\n-  lt::span<char const> readv(lt::peer_request const r, lt::storage_error& ec) const\n-  {\n-    auto const i = m_file_data.find(r.piece);\n-    if (i == m_file_data.end())\n-    {\n-      ec.operation = lt::operation_t::file_read;\n-      ec.ec = boost::asio::error::eof;\n-      return {};\n-    }\n-    if (int(i->second.size()) <= r.start)\n-    {\n-      ec.operation = lt::operation_t::file_read;\n-      ec.ec = boost::asio::error::eof;\n-      return {};\n-    }\n-    return { i->second.data() + r.start, std::min(r.length, int(i->second.size()) - r.start) };\n-  }\n-  void writev(lt::span<char const> const b, lt::piece_index_t const piece, int const offset)\n-  {\n-    auto& data = m_file_data[piece];\n-    if (data.empty())\n-    {\n-      // allocate the whole piece, otherwise we'll invalidate the pointers\n-      // we have returned back to libtorrent\n-      int const size = piece_size(piece);\n-      data.resize(std::size_t(size));\n-    }\n-    TORRENT_ASSERT(offset + b.size() <= int(data.size()));\n-    std::memcpy(data.data() + offset, b.data(), std::size_t(b.size()));\n-  }\n-  lt::sha1_hash hash(lt::piece_index_t const piece\n-    , lt::span<lt::sha256_hash> const block_hashes, lt::storage_error& ec) const\n-  {\n-    auto const i = m_file_data.find(piece);\n-    if (i == m_file_data.end())\n-    {\n-      ec.operation = lt::operation_t::file_read;\n-      ec.ec = boost::asio::error::eof;\n-      return {};\n-    }\n-    if (!block_hashes.empty())\n-    {\n-      int const piece_size2 = m_files.piece_size2(piece);\n-      int const blocks_in_piece2 = m_files.blocks_in_piece2(piece);\n-      char const* buf = i->second.data();\n-      std::int64_t offset = 0;\n-      for (int k = 0; k < blocks_in_piece2; ++k)\n-      {\n-        lt::hasher256 h2;\n-        std::ptrdiff_t const len2 = std::min(lt::default_block_size, int(piece_size2 - offset));\n-        h2.update({ buf, len2 });\n-        buf += len2;\n-        offset += len2;\n-        block_hashes[k] = h2.final();\n-      }\n-    }\n-    return lt::hasher(i->second).final();\n-  }\n-  lt::sha256_hash hash2(lt::piece_index_t const piece, int const offset, lt::storage_error& ec)\n-  {\n-    auto const i = m_file_data.find(piece);\n-    if (i == m_file_data.end())\n-    {\n-      ec.operation = lt::operation_t::file_read;\n-      ec.ec = boost::asio::error::eof;\n-      return {};\n-    }\n-\n-    int const piece_size = m_files.piece_size2(piece);\n-\n-    std::ptrdiff_t const len = std::min(lt::default_block_size, piece_size - offset);\n-\n-    lt::span<char const> b = {i->second.data() + offset, len};\n-    return lt::hasher256(b).final();\n-  }\n-\n-private:\n-  int piece_size(lt::piece_index_t piece) const\n-  {\n-    int const num_pieces = static_cast<int>((m_files.total_size() + m_files.piece_length() - 1) / m_files.piece_length());\n-    return static_cast<int>(piece) < num_pieces - 1\n-      ? m_files.piece_length() : static_cast<int>(m_files.total_size() - std::int64_t(num_pieces - 1) * m_files.piece_length());\n-  }\n-\n-  lt::file_storage const& m_files;\n-  std::map<lt::piece_index_t, std::vector<char>> m_file_data;\n-};\n-\n-lt::storage_index_t pop(std::vector<lt::storage_index_t>& q)\n-{\n-  TORRENT_ASSERT(!q.empty());\n-  lt::storage_index_t const ret = q.back();\n-  q.pop_back();\n-  return ret;\n-}\n-\n-struct temp_disk_io final : lt::disk_interface\n-  , lt::buffer_allocator_interface\n-{\n-  explicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {}\n-\n-  void settings_updated() override {}\n-\n-  lt::storage_holder new_torrent(lt::storage_params const& params\n-    , std::shared_ptr<void> const&) override\n-  {\n-    lt::storage_index_t const idx = m_free_slots.empty()\n-      ? m_torrents.end_index()\n-      : pop(m_free_slots);\n-    auto storage = std::make_unique<temp_storage>(params.files);\n-    if (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move(storage));\n-    else m_torrents[idx] = std::move(storage);\n-    return lt::storage_holder(idx, *this);\n-  }\n-\n-  void remove_torrent(lt::storage_index_t const idx) override\n-  {\n-    m_torrents[idx].reset();\n-    m_free_slots.push_back(idx);\n-  }\n-\n-  void abort(bool) override {}\n-\n-  void async_read(lt::storage_index_t storage, lt::peer_request const& r\n-    , std::function<void(lt::disk_buffer_holder block, lt::storage_error const& se)> handler\n-    , lt::disk_job_flags_t) override\n-  {\n-    // this buffer is owned by the storage. It will remain valid for as\n-    // long as the torrent remains in the session. We don't need any lifetime\n-    // management of it.\n-    lt::storage_error error;\n-    lt::span<char const> b = m_torrents[storage]->readv(r, error);\n-\n-    post(m_ioc, [handler, error, b, this]\n-      { handler(lt::disk_buffer_holder(*this, const_cast<char*>(b.data()), int(b.size())), error); });\n-  }\n-\n-  bool async_write(lt::storage_index_t storage, lt::peer_request const& r\n-    , char const* buf, std::shared_ptr<lt::disk_observer>\n-    , std::function<void(lt::storage_error const&)> handler\n-    , lt::disk_job_flags_t) override\n-  {\n-    lt::span<char const> const b = { buf, r.length };\n-\n-    m_torrents[storage]->writev(b, r.piece, r.start);\n-\n-    post(m_ioc, [=]{ handler(lt::storage_error()); });\n-    return false;\n-  }\n-\n-  void async_hash(lt::storage_index_t storage, lt::piece_index_t const piece\n-    , lt::span<lt::sha256_hash> block_hashes, lt::disk_job_flags_t\n-    , std::function<void(lt::piece_index_t, lt::sha1_hash const&, lt::storage_error const&)> handler) override\n-  {\n-    lt::storage_error error;\n-    lt::sha1_hash const hash = m_torrents[storage]->hash(piece, block_hashes, error);\n-    post(m_ioc, [=]{ handler(piece, hash, error); });\n-  }\n-\n-  void async_hash2(lt::storage_index_t storage, lt::piece_index_t const piece\n-    , int const offset, lt::disk_job_flags_t\n-    , std::function<void(lt::piece_index_t, lt::sha256_hash const&, lt::storage_error const&)> handler) override\n-  {\n-    lt::storage_error error;\n-    lt::sha256_hash const hash = m_torrents[storage]->hash2(piece, offset, error);\n-    post(m_ioc, [=]{ handler(piece, hash, error); });\n-  }\n-\n-  void async_move_storage(lt::storage_index_t, std::string p, lt::move_flags_t\n-    , std::function<void(lt::status_t, std::string const&, lt::storage_error const&)> handler) override\n-  {\n-    post(m_ioc, [=]{\n-      handler(lt::status_t::fatal_disk_error, p\n-        , lt::storage_error(lt::error_code(boost::system::errc::operation_not_supported, lt::system_category())));\n-    });\n-  }\n-\n-  void async_release_files(lt::storage_index_t, std::function<void()>) override {}\n-\n-  void async_delete_files(lt::storage_index_t, lt::remove_flags_t\n-    , std::function<void(lt::storage_error const&)> handler) override\n-  {\n-    post(m_ioc, [=]{ handler(lt::storage_error()); });\n-  }\n-\n-  void async_check_files(lt::storage_index_t\n-    , lt::add_torrent_params const*\n-    , lt::aux::vector<std::string, lt::file_index_t>\n-    , std::function<void(lt::status_t, lt::storage_error const&)> handler) override\n-  {\n-    post(m_ioc, [=]{ handler(lt::status_t::no_error, lt::storage_error()); });\n-  }\n-\n-  void async_rename_file(lt::storage_index_t\n-    , lt::file_index_t const idx\n-    , std::string const name\n-    , std::function<void(std::string const&, lt::file_index_t, lt::storage_error const&)> handler) override\n-  {\n-    post(m_ioc, [=]{ handler(name, idx, lt::storage_error()); });\n-  }\n-\n-  void async_stop_torrent(lt::storage_index_t, std::function<void()> handler) override\n-  {\n-    post(m_ioc, handler);\n-  }\n-\n-  void async_set_file_priority(lt::storage_index_t\n-    , lt::aux::vector<lt::download_priority_t, lt::file_index_t> prio\n-    , std::function<void(lt::storage_error const&\n-      , lt::aux::vector<lt::download_priority_t, lt::file_index_t>)> handler) override\n-  {\n-    post(m_ioc, [=]{\n-      handler(lt::storage_error(lt::error_code(\n-        boost::system::errc::operation_not_supported, lt::system_category())), std::move(prio));\n-    });\n-  }\n-\n-  void async_clear_piece(lt::storage_index_t, lt::piece_index_t index\n-    , std::function<void(lt::piece_index_t)> handler) override\n-  {\n-    post(m_ioc, [=]{ handler(index); });\n-  }\n-\n-  // implements buffer_allocator_interface\n-  void free_disk_buffer(char*) override\n-  {\n-    // never free any buffer. We only return buffers owned by the storage\n-    // object\n-  }\n-\n-  void update_stats_counters(lt::counters&) const override {}\n-\n-  std::vector<lt::open_file_state> get_status(lt::storage_index_t) const override\n-  { return {}; }\n-\n-  void submit_jobs() override {}\n-\n-private:\n-\n-  lt::aux::vector<std::shared_ptr<temp_storage>, lt::storage_index_t> m_torrents;\n-\n-  // slots that are unused in the m_torrents vector\n-  std::vector<lt::storage_index_t> m_free_slots;\n-\n-  // callbacks are posted on this\n-  lt::io_context& m_ioc;\n-};\n+   session_params (settings_pack const& sp);\n+   session_params (settings_pack&& sp);\n+   session_params ();\n+   session_params (settings_pack&& sp\n+      , std::vector<std::shared_ptr<plugin>> exts);\n+   session_params (settings_pack const& sp\n+      , std::vector<std::shared_ptr<plugin>> exts);\n \n-std::unique_ptr<lt::disk_interface> temp_disk_constructor(\n-  lt::io_context& ioc, lt::settings_interface const&, lt::counters&)\n-{\n-  return std::make_unique<temp_disk_io>(ioc);\n-}\n-
\n-[report issue]
\n-
\n-

disk_observer

\n-

Declared in "libtorrent/disk_observer.hpp"

\n-
\n-struct disk_observer\n-{\n-   virtual void on_disk () = 0;\n-};\n-
\n-[report issue]
\n-

on_disk()

\n-
\n-virtual void on_disk () = 0;\n-
\n-

called when the disk cache size has dropped\n-below the low watermark again and we can\n-resume downloading from peers

\n-[report issue]
\n-
\n-
\n-

settings_interface

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-

the common interface to settings_pack and the internal representation of\n-settings.

\n-
\n-struct settings_interface\n-{\n-   virtual void set_str (int name, std::string val) = 0;\n-   virtual void set_int (int name, int val) = 0;\n-   virtual bool has_val (int name) const = 0;\n-   virtual void set_bool (int name, bool val) = 0;\n-   virtual bool get_bool (int name) const = 0;\n-   virtual int get_int (int name) const = 0;\n-   virtual std::string const& get_str (int name) const = 0;\n-};\n-
\n-[report issue]
\n-
\n-

buffer_allocator_interface

\n-

Declared in "libtorrent/disk_buffer_holder.hpp"

\n-

the interface for freeing disk buffers, used by the disk_buffer_holder.\n-when implementing disk_interface, this must also be implemented in order\n-to return disk buffers back to libtorrent

\n-
\n-struct buffer_allocator_interface\n-{\n-   virtual void free_disk_buffer (char* b) = 0;\n-};\n-
\n-[report issue]
\n-
\n-

disk_buffer_holder

\n-

Declared in "libtorrent/disk_buffer_holder.hpp"

\n-

The disk buffer holder acts like a unique_ptr that frees a disk buffer\n-when it's destructed

\n-

If this buffer holder is moved-from, default constructed or reset,\n-data() will return nullptr.

\n-
\n-struct disk_buffer_holder\n-{\n-   disk_buffer_holder (disk_buffer_holder&&) noexcept;\n-   disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;\n-   disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;\n-   disk_buffer_holder (disk_buffer_holder const&) = delete;\n-   disk_buffer_holder (buffer_allocator_interface& alloc\n-      , char* buf, int sz) noexcept;\n-   disk_buffer_holder () noexcept = default;\n-   ~disk_buffer_holder ();\n-   char* data () const noexcept;\n-   void reset ();\n-   void swap (disk_buffer_holder& h) noexcept;\n-   bool is_mutable () const noexcept;\n-   explicit operator bool () const noexcept;\n-   std::ptrdiff_t size () const;\n+   settings_pack settings;\n+   std::vector<std::shared_ptr<plugin>> extensions;\n+   dht::dht_state dht_state;\n+   dht::dht_storage_constructor_type dht_storage_constructor;\n+   disk_io_constructor_type disk_io_constructor;\n+   std::map<std::string, std::string> ext_state;\n+   libtorrent::ip_filter ip_filter;\n };\n 
\n-[report issue]
\n-

disk_buffer_holder()

\n-
\n-disk_buffer_holder (buffer_allocator_interface& alloc\n-      , char* buf, int sz) noexcept;\n-
\n-

construct a buffer holder that will free the held buffer\n-using a disk buffer pool directly (there's only one\n-disk_buffer_pool per session)

\n-[report issue]
\n-
\n-

disk_buffer_holder()

\n-
\n-disk_buffer_holder () noexcept = default;\n-
\n-

default construct a holder that does not own any buffer

\n-[report issue]
\n-
\n-

~disk_buffer_holder()

\n-
\n-~disk_buffer_holder ();\n-
\n-

frees disk buffer held by this object

\n-[report issue]
\n-
\n-

data()

\n-
\n-char* data () const noexcept;\n-
\n-

return a pointer to the held buffer, if any. Otherwise returns nullptr.

\n-[report issue]
\n-
\n-

reset()

\n-
\n-void reset ();\n-
\n-

free the held disk buffer, if any, and clear the holder. This sets the\n-holder object to a default-constructed state

\n-[report issue]
\n-
\n-

swap()

\n-
\n-void swap (disk_buffer_holder& h) noexcept;\n-
\n-

swap pointers of two disk buffer holders.

\n-[report issue]
\n-
\n-

is_mutable()

\n-
\n-bool is_mutable () const noexcept;\n-
\n-

if this returns true, the buffer may not be modified in place

\n-[report issue]
\n-
\n-

bool()

\n+[report issue]
\n+

session_params()

\n
\n-explicit operator bool () const noexcept;\n+session_params (settings_pack const& sp);\n+session_params (settings_pack&& sp);\n+session_params ();\n 
\n-

implicitly convertible to true if the object is currently holding a\n-buffer

\n-[report issue]
\n-
\n-
\n-

open_file_state

\n-

Declared in "libtorrent/disk_interface.hpp"

\n-

this contains information about a file that's currently open by the\n-libtorrent disk I/O subsystem. It's associated with a single torrent.

\n+

This constructor can be used to start with the default plugins\n+(ut_metadata, ut_pex and smart_ban). Pass a settings_pack to set the\n+initial settings when the session starts.

\n+[report issue]
\n+
\n+

session_params()

\n
\n-struct open_file_state\n-{\n-   file_index_t file_index;\n-   file_open_mode_t open_mode;\n-   time_point last_use;\n-};\n+session_params (settings_pack&& sp\n+      , std::vector<std::shared_ptr<plugin>> exts);\n+session_params (settings_pack const& sp\n+      , std::vector<std::shared_ptr<plugin>> exts);\n 
\n-[report issue]
\n-
file_index
\n-
the index of the file this entry refers to into the file_storage\n-file list of this torrent. This starts indexing at 0.
\n-
\n-[report issue]
\n-
open_mode
\n-

open_mode is a bitmask of the file flags this file is currently\n-opened with. For possible flags, see file_open_mode_t.

\n-

Note that the read/write mode is not a bitmask. The two least significant bits are used\n-to represent the read/write mode. Those bits can be masked out using the rw_mask constant.

\n-
\n+

This constructor helps to configure the set of initial plugins\n+to be added to the session before it's started.

\n+[report issue]
\n+
settings
\n+
The settings to configure the session with
\n
\n-[report issue]
\n-
last_use
\n-
a (high precision) timestamp of when the file was last used.
\n+[report issue]
\n+
extensions
\n+
the plugins to add to the session as it is constructed
\n
\n-[report issue]
\n-
\n-

disk_interface

\n-

Declared in "libtorrent/disk_interface.hpp"

\n-

The disk_interface is the customization point for disk I/O in libtorrent.\n-implement this interface and provide a factory function to the session constructor\n-use custom disk I/O. All functions on the disk subsystem (implementing\n-disk_interface) are called from within libtorrent's network thread. For\n-disk I/O to be performed in a separate thread, the disk subsystem has to\n-manage that itself.

\n-

Although the functions are called async_*, they do not technically\n-have to be asynchronous, but they support being asynchronous, by\n-expecting the result passed back into a callback. The callbacks must be\n-posted back onto the network thread via the io_context object passed into\n-the constructor. The callbacks will be run in the network thread.

\n-
\n-struct disk_interface\n-{\n-   virtual storage_holder new_torrent (storage_params const& p\n-      , std::shared_ptr<void> const& torrent) = 0;\n-   virtual void remove_torrent (storage_index_t) = 0;\n-   virtual void async_read (storage_index_t storage, peer_request const& r\n-      , std::function<void(disk_buffer_holder, storage_error const&)> handler\n-      , disk_job_flags_t flags = {}) = 0;\n-   virtual bool async_write (storage_index_t storage, peer_request const& r\n-      , char const* buf, std::shared_ptr<disk_observer> o\n-      , std::function<void(storage_error const&)> handler\n-      , disk_job_flags_t flags = {}) = 0;\n-   virtual void async_hash (storage_index_t storage, piece_index_t piece, span<sha256_hash> v2\n-      , disk_job_flags_t flags\n-      , std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler) = 0;\n-   virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags\n-      , std::function<void(piece_index_t, sha256_hash const&, storage_error const&)> handler) = 0;\n-   virtual void async_move_storage (storage_index_t storage, std::string p, move_flags_t flags\n-      , std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;\n-   virtual void async_release_files (storage_index_t storage\n-      , std::function<void()> handler = std::function<void()>()) = 0;\n-   virtual void async_check_files (storage_index_t storage\n-      , add_torrent_params const* resume_data\n-      , aux::vector<std::string, file_index_t> links\n-      , std::function<void(status_t, storage_error const&)> handler) = 0;\n-   virtual void async_stop_torrent (storage_index_t storage\n-      , std::function<void()> handler = std::function<void()>()) = 0;\n-   virtual void async_rename_file (storage_index_t storage\n-      , file_index_t index, std::string name\n-      , std::function<void(std::string const&, file_index_t, storage_error const&)> handler) = 0;\n-   virtual void async_delete_files (storage_index_t storage, remove_flags_t options\n-      , std::function<void(storage_error const&)> handler) = 0;\n-   virtual void async_set_file_priority (storage_index_t storage\n-      , aux::vector<download_priority_t, file_index_t> prio\n-      , std::function<void(storage_error const&\n-      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;\n-   virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n-      , std::function<void(piece_index_t)> handler) = 0;\n-   virtual void update_stats_counters (counters& c) const = 0;\n-   virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;\n-   virtual void abort (bool wait) = 0;\n-   virtual void submit_jobs () = 0;\n-   virtual void settings_updated () = 0;\n-\n-   static constexpr disk_job_flags_t force_copy  = 0_bit;\n-   static constexpr disk_job_flags_t sequential_access  = 3_bit;\n-   static constexpr disk_job_flags_t volatile_read  = 4_bit;\n-   static constexpr disk_job_flags_t v1_hash  = 5_bit;\n-   static constexpr disk_job_flags_t flush_piece  = 7_bit;\n-};\n-
\n-[report issue]
\n-

new_torrent()

\n-
\n-virtual storage_holder new_torrent (storage_params const& p\n-      , std::shared_ptr<void> const& torrent) = 0;\n-
\n-

this is called when a new torrent is added. The shared_ptr can be\n-used to hold the internal torrent object alive as long as there are\n-outstanding disk operations on the storage.\n-The returned storage_holder is an owning reference to the underlying\n-storage that was just created. It is fundamentally a storage_index_t

\n-[report issue]
\n-
\n-

remove_torrent()

\n-
\n-virtual void remove_torrent (storage_index_t) = 0;\n-
\n-

remove the storage with the specified index. This is not expected to\n-delete any files from disk, just to clean up any resources associated\n-with the specified storage.

\n-\n-[report issue]
\n-
\n-

async_read() async_write()

\n-
\n-virtual void async_read (storage_index_t storage, peer_request const& r\n-      , std::function<void(disk_buffer_holder, storage_error const&)> handler\n-      , disk_job_flags_t flags = {}) = 0;\n-virtual bool async_write (storage_index_t storage, peer_request const& r\n-      , char const* buf, std::shared_ptr<disk_observer> o\n-      , std::function<void(storage_error const&)> handler\n-      , disk_job_flags_t flags = {}) = 0;\n-
\n-

perform a read or write operation from/to the specified storage\n-index and the specified request. When the operation completes, call\n-handler possibly with a disk_buffer_holder, holding the buffer with\n-the result. Flags may be set to affect the read operation. See\n-disk_job_flags_t.

\n-

The disk_observer is a callback to indicate that\n-the store buffer/disk write queue is below the watermark to let peers\n-start writing buffers to disk again. When async_write() returns\n-true, indicating the write queue is full, the peer will stop\n-further writes and wait for the passed-in disk_observer to be\n-notified before resuming.

\n-

Note that for async_read, the peer_request (r) is not\n-necessarily aligned to blocks (but it is most of the time). However,\n-all writes (passed to async_write) are guaranteed to be block\n-aligned.

\n-[report issue]
\n-
\n-

async_hash()

\n-
\n-virtual void async_hash (storage_index_t storage, piece_index_t piece, span<sha256_hash> v2\n-      , disk_job_flags_t flags\n-      , std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler) = 0;\n-
\n-

Compute hash(es) for the specified piece. Unless the v1_hash flag is\n-set (in flags), the SHA-1 hash of the whole piece does not need\n-to be computed.

\n-

The v2 span is optional and can be empty, which means v2 hashes\n-should not be computed. If v2 is non-empty it must be at least large\n-enough to hold all v2 blocks in the piece, and this function will\n-fill in the span with the SHA-256 block hashes of the piece.

\n-[report issue]
\n-
\n-

async_hash2()

\n-
\n-virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags\n-      , std::function<void(piece_index_t, sha256_hash const&, storage_error const&)> handler) = 0;\n-
\n-

computes the v2 hash (SHA-256) of a single block. The block at\n-offset in piece piece.

\n-[report issue]
\n-
\n-

async_move_storage()

\n-
\n-virtual void async_move_storage (storage_index_t storage, std::string p, move_flags_t flags\n-      , std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;\n-
\n-

called to request the files for the specified storage/torrent be\n-moved to a new location. It is the disk I/O object's responsibility\n-to synchronize this with any currently outstanding disk operations to\n-the storage. Whether files are replaced at the destination path or\n-not is controlled by flags (see move_flags_t).

\n-[report issue]
\n-
\n-

async_release_files()

\n-
\n-virtual void async_release_files (storage_index_t storage\n-      , std::function<void()> handler = std::function<void()>()) = 0;\n-
\n-

This is called on disk I/O objects to request they close all open\n-files for the specified storage/torrent. If file handles are not\n-pooled/cached, it can be a no-op. For truly asynchronous disk I/O,\n-this should provide at least one point in time when all files are\n-closed. It is possible that later asynchronous operations will\n-re-open some of the files, by the time this completion handler is\n-called, that's fine.

\n-[report issue]
\n-
\n-

async_check_files()

\n-
\n-virtual void async_check_files (storage_index_t storage\n-      , add_torrent_params const* resume_data\n-      , aux::vector<std::string, file_index_t> links\n-      , std::function<void(status_t, storage_error const&)> handler) = 0;\n-
\n-

this is called when torrents are added to validate their resume data\n-against the files on disk. This function is expected to do a few things:

\n-

if links is non-empty, it contains a string for each file in the\n-torrent. The string being a path to an existing identical file. The\n-default behavior is to create hard links of those files into the\n-storage of the new torrent (specified by storage). An empty\n-string indicates that there is no known identical file. This is part\n-of the "mutable torrent" feature, where files can be reused from\n-other torrents.

\n-

The resume_data points the resume data passed in by the client.

\n-

If the resume_data->flags field has the seed_mode flag set, all\n-files/pieces are expected to be on disk already. This should be\n-verified. Not just the existence of the file, but also that it has\n-the correct size.

\n-

Any file with a piece set in the resume_data->have_pieces bitmask\n-should exist on disk, this should be verified. Pad files and files\n-with zero priority may be skipped.

\n-[report issue]
\n-
\n-

async_stop_torrent()

\n-
\n-virtual void async_stop_torrent (storage_index_t storage\n-      , std::function<void()> handler = std::function<void()>()) = 0;\n-
\n-

This is called when a torrent is stopped. It gives the disk I/O\n-object an opportunity to flush any data to disk that's currently kept\n-cached. This function should at least do the same thing as\n-async_release_files().

\n-[report issue]
\n-
\n-

async_rename_file()

\n-
\n-virtual void async_rename_file (storage_index_t storage\n-      , file_index_t index, std::string name\n-      , std::function<void(std::string const&, file_index_t, storage_error const&)> handler) = 0;\n-
\n-

This function is called when the name of a file in the specified\n-storage has been requested to be renamed. The disk I/O object is\n-responsible for renaming the file without racing with other\n-potentially outstanding operations against the file (such as read,\n-write, move, etc.).

\n-[report issue]
\n-
\n-

async_delete_files()

\n-
\n-virtual void async_delete_files (storage_index_t storage, remove_flags_t options\n-      , std::function<void(storage_error const&)> handler) = 0;\n-
\n-

This function is called when some file(s) on disk have been requested\n-to be removed by the client. storage indicates which torrent is\n-referred to. See session_handle for remove_flags_t flags\n-indicating which files are to be removed.\n-e.g. session_handle::delete_files - delete all files\n-session_handle::delete_partfile - only delete part file.

\n-[report issue]
\n-
\n-

async_set_file_priority()

\n-
\n-virtual void async_set_file_priority (storage_index_t storage\n-      , aux::vector<download_priority_t, file_index_t> prio\n-      , std::function<void(storage_error const&\n-      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;\n-
\n-

This is called to set the priority of some or all files. Changing the\n-priority from or to 0 may involve moving data to and from the\n-partfile. The disk I/O object is responsible for correctly\n-synchronizing this work to not race with any potentially outstanding\n-asynchronous operations affecting these files.

\n-

prio is a vector of the file priority for all files. If it's\n-shorter than the total number of files in the torrent, they are\n-assumed to be set to the default priority.

\n-[report issue]
\n-
\n-

async_clear_piece()

\n-
\n-virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n-      , std::function<void(piece_index_t)> handler) = 0;\n-
\n-

This is called when a piece fails the hash check, to ensure there are\n-no outstanding disk operations to the piece before blocks are\n-re-requested from peers to overwrite the existing blocks. The disk I/O\n-object does not need to perform any action other than synchronize\n-with all outstanding disk operations to the specified piece before\n-posting the result back.

\n-[report issue]
\n-
\n-

update_stats_counters()

\n-
\n-virtual void update_stats_counters (counters& c) const = 0;\n-
\n-

update_stats_counters() is called to give the disk storage an\n-opportunity to update gauges in the c stats counters, that aren't\n-updated continuously as operations are performed. This is called\n-before a snapshot of the counters are passed to the client.

\n-[report issue]
\n-
\n-

get_status()

\n-
\n-virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;\n-
\n-

Return a list of all the files that are currently open for the\n-specified storage/torrent. This is is just used for the client to\n-query the currently open files, and which modes those files are open\n-in.

\n-[report issue]
\n-
\n-

abort()

\n-
\n-virtual void abort (bool wait) = 0;\n-
\n-

this is called when the session is starting to shut down. The disk\n-I/O object is expected to flush any outstanding write jobs, cancel\n-hash jobs and initiate tearing down of any internal threads. If\n-wait is true, this should be asynchronous. i.e. this call should\n-not return until all threads have stopped and all jobs have either\n-been aborted or completed and the disk I/O object is ready to be\n-destructed.

\n-[report issue]
\n-
\n-

submit_jobs()

\n-
\n-virtual void submit_jobs () = 0;\n-
\n-

This will be called after a batch of disk jobs has been issues (via\n-the async_* ). It gives the disk I/O object an opportunity to\n-notify any potential condition variables to wake up the disk\n-thread(s). The async_* calls can of course also notify condition\n-variables, but doing it in this call allows for batching jobs, by\n-issuing the notification once for a collection of jobs.

\n-[report issue]
\n-
\n-

settings_updated()

\n-
\n-virtual void settings_updated () = 0;\n-
\n-

This is called to notify the disk I/O object that the settings have\n-been updated. In the disk io constructor, a settings_interface\n-reference is passed in. Whenever these settings are updated, this\n-function is called to allow the disk I/O object to react to any\n-changed settings relevant to its operations.

\n-[report issue]
\n-
force_copy
\n-
force making a copy of the cached block, rather than getting a\n-reference to a block already in the cache. This is used the block is\n-expected to be overwritten very soon, by async_write()`, and we need\n-access to the previous content.
\n+[report issue]
\n+
dht_state
\n+
DHT node ID and node addresses to bootstrap the DHT with.
\n
\n-[report issue]
\n-
sequential_access
\n-
hint that there may be more disk operations with sequential access to\n-the file
\n+[report issue]
\n+
dht_storage_constructor
\n+
function object to construct the storage object for DHT items.
\n
\n-[report issue]
\n-
volatile_read
\n-
don't keep the read block in cache. This is a hint that this block is\n-unlikely to be read again anytime soon, and caching it would be\n-wasteful.
\n+[report issue]
\n+
disk_io_constructor
\n+
function object to create the disk I/O subsystem. Defaults to\n+default_disk_io_constructor.
\n
\n-[report issue]
\n-
v1_hash
\n-
compute a v1 piece hash. This is only used by the async_hash() call.\n-If this flag is not set in the async_hash() call, the SHA-1 piece\n-hash does not need to be computed.
\n+[report issue]
\n+
ext_state
\n+
this container can be used by extensions/plugins to store settings. It's\n+primarily here to make it convenient to save and restore state across\n+sessions, using read_session_params() and write_session_params().
\n
\n-[report issue]
\n-
flush_piece
\n-
this flag instructs a hash job that we just completed this piece, and\n-it should be flushed to disk
\n+[report issue]
\n+
ip_filter
\n+
the IP filter to use for the session. This restricts which peers are allowed\n+to connect. As if passed to set_ip_filter().
\n
\n-[report issue]
\n+[report issue]
\n
\n-
\n-

storage_holder

\n-

Declared in "libtorrent/disk_interface.hpp"

\n-

a unique, owning, reference to the storage of a torrent in a disk io\n-subsystem (class that implements disk_interface). This is held by the\n-internal libtorrent torrent object to tie the storage object allocated\n-for a torrent to the lifetime of the internal torrent object. When a\n-torrent is removed from the session, this holder is destructed and will\n-inform the disk object.

\n-
\n-struct storage_holder\n-{\n-   storage_holder (storage_index_t idx, disk_interface& disk_io);\n-   ~storage_holder ();\n-   storage_holder () = default;\n-   explicit operator bool () const;\n-   operator storage_index_t () const;\n-   void reset ();\n-   storage_holder& operator= (storage_holder const&) = delete;\n-   storage_holder (storage_holder const&) = delete;\n-   storage_holder (storage_holder&& rhs) noexcept;\n-   storage_holder& operator= (storage_holder&& rhs) noexcept;\n-};\n-
\n-[report issue]
\n-
\n-

file_open_mode_t

\n-

Declared in "libtorrent/disk_interface.hpp"

\n-
\n-
read_only
\n-
open the file for reading only
\n-
\n-
\n-
write_only
\n-
open the file for writing only
\n-
\n-
\n-
read_write
\n-
open the file for reading and writing
\n-
\n-
\n-
rw_mask
\n-
the mask for the bits determining read or write mode
\n-
\n-
\n-
sparse
\n-
open the file in sparse mode (if supported by the\n-filesystem).
\n-
\n-
\n-
no_atime
\n-
don't update the access timestamps on the file (if\n-supported by the operating system and filesystem).\n-this generally improves disk performance.
\n-
\n-
\n-
random_access
\n-
open the file for random access. This disables read-ahead\n-logic
\n-
\n-
\n-
mmapped
\n-
the file is memory mapped
\n-
\n-[report issue]
\n-
\n-

counters

\n-

Declared in "libtorrent/performance_counters.hpp"

\n+
\n+

session_handle

\n+

Declared in "libtorrent/session_handle.hpp"

\n+

this class provides a non-owning handle to a session and a subset of the\n+interface of the session class. If the underlying session is destructed\n+any handle to it will no longer be valid. is_valid() will return false and\n+any operation on it will throw a system_error exception, with error code\n+invalid_session_handle.

\n
\n-struct counters\n+struct session_handle\n {\n-   counters () ;\n-   counters& operator= (counters const&) & ;\n-   counters (counters const&) ;\n-   std::int64_t operator[] (int i) const ;\n-   std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n-   void blend_stats_counter (int c, std::int64_t value, int ratio) ;\n-   void set_value (int c, std::int64_t value) ;\n+   bool is_valid () const;\n+   session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;\n+   void refresh_torrent_status (std::vector<torrent_status>* ret\n+      , status_flags_t flags = {}) const;\n+   std::vector<torrent_status> get_torrent_status (\n+      std::function<bool(torrent_status const&)> const& pred\n+      , status_flags_t flags = {}) const;\n+   void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n+   void post_session_stats ();\n+   void post_dht_stats ();\n+   void set_dht_state (dht::dht_state const& st);\n+   void set_dht_state (dht::dht_state&& st);\n+   torrent_handle find_torrent (sha1_hash const& info_hash) const;\n+   std::vector<torrent_handle> get_torrents () const;\n+   torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);\n+   void async_add_torrent (add_torrent_params&& params);\n+   void async_add_torrent (add_torrent_params const& params);\n+   torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n+   torrent_handle add_torrent (add_torrent_params const& params);\n+   torrent_handle add_torrent (add_torrent_params&& params);\n+   void pause ();\n+   void resume ();\n+   bool is_paused () const;\n+   bool is_dht_running () const;\n+   void set_dht_storage (dht::dht_storage_constructor_type sc);\n+   void add_dht_node (std::pair<std::string, int> const& node);\n+   void dht_get_item (sha1_hash const& target);\n+   void dht_get_item (std::array<char, 32> key\n+      , std::string salt = std::string());\n+   sha1_hash dht_put_item (entry data);\n+   void dht_put_item (std::array<char, 32> key\n+      , std::function<void(entry&, std::array<char, 64>&\n+      , std::int64_t&, std::string const&)> cb\n+      , std::string salt = std::string());\n+   void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});\n+   void dht_get_peers (sha1_hash const& info_hash);\n+   void dht_live_nodes (sha1_hash const& nid);\n+   void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);\n+   void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});\n+   void add_extension (std::shared_ptr<plugin> ext);\n+   void add_extension (std::function<std::shared_ptr<torrent_plugin>(\n+      torrent_handle const&, client_data_t)> ext);\n+   ip_filter get_ip_filter () const;\n+   void set_ip_filter (ip_filter f);\n+   void set_port_filter (port_filter const& f);\n+   unsigned short ssl_listen_port () const;\n+   unsigned short listen_port () const;\n+   bool is_listening () const;\n+   ip_filter get_peer_class_filter () const;\n+   void set_peer_class_filter (ip_filter const& f);\n+   void set_peer_class_type_filter (peer_class_type_filter const& f);\n+   peer_class_type_filter get_peer_class_type_filter () const;\n+   peer_class_t create_peer_class (char const* name);\n+   void delete_peer_class (peer_class_t cid);\n+   void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n+   peer_class_info get_peer_class (peer_class_t cid) const;\n+   void remove_torrent (const torrent_handle&, remove_flags_t = {});\n+   void apply_settings (settings_pack&&);\n+   settings_pack get_settings () const;\n+   void apply_settings (settings_pack const&);\n+   alert* wait_for_alert (time_duration max_wait);\n+   void set_alert_notify (std::function<void()> const& fun);\n+   void pop_alerts (std::vector<alert*>* alerts);\n+   void delete_port_mapping (port_mapping_t handle);\n+   std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);\n+   void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);\n+   std::shared_ptr<aux::session_impl> native_handle () const;\n+\n+   static constexpr save_state_flags_t save_settings  = 0_bit;\n+   static constexpr save_state_flags_t save_dht_state  = 2_bit;\n+   static constexpr save_state_flags_t save_extension_state  = 11_bit;\n+   static constexpr save_state_flags_t save_ip_filter  = 12_bit;\n+   static constexpr peer_class_t global_peer_class_id {0};\n+   static constexpr peer_class_t tcp_peer_class_id {1};\n+   static constexpr peer_class_t local_peer_class_id {2};\n+   static constexpr remove_flags_t delete_files  = 0_bit;\n+   static constexpr remove_flags_t delete_partfile  = 1_bit;\n+   static constexpr session_flags_t paused  = 2_bit;\n+   static constexpr portmap_protocol udp  = portmap_protocol::udp;\n+   static constexpr portmap_protocol tcp  = portmap_protocol::tcp;\n+   static constexpr reopen_network_flags_t reopen_map_ports  = 0_bit;\n };\n 
\n-\n-[report issue]
\n-

inc_stats_counter() operator[]()

\n-
\n-std::int64_t operator[] (int i) const ;\n-std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n-
\n-

returns the new value

\n-[report issue]
\n-
\n-
\n-

stats_metric

\n-

Declared in "libtorrent/session_stats.hpp"

\n-

describes one statistics metric from the session. For more information,\n-see the session statistics section.

\n+[report issue]
\n+

is_valid()

\n
\n-struct stats_metric\n-{\n-   char const* name;\n-   int value_index;\n-   metric_type_t type;\n-};\n+bool is_valid () const;\n 
\n-[report issue]
\n-
name
\n-
the name of the counter or gauge
\n-
\n-\n-[report issue]
\n-
value_index type
\n-
the index into the session stats array, where the underlying value of\n-this counter or gauge is found. The session stats array is part of the\n-session_stats_alert object.
\n-
\n-[report issue]
\n-
\n-

session_stats_metrics()

\n-

Declared in "libtorrent/session_stats.hpp"

\n+

returns true if this handle refers to a valid session object. If the\n+session has been destroyed, all session_handle objects will expire and\n+not be valid.

\n+[report issue]
\n+
\n+

session_state()

\n
\n-std::vector<stats_metric> session_stats_metrics ();\n+session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;\n 
\n-

This free function returns the list of available metrics exposed by\n-libtorrent's statistics API. Each metric has a name and a value index.\n-The value index is the index into the array in session_stats_alert where\n-this metric's value can be found when the session stats is sampled (by\n-calling post_session_stats()).

\n-[report issue]
\n-
\n-

find_metric_idx()

\n-

Declared in "libtorrent/session_stats.hpp"

\n+

returns the current session state. This can be passed to\n+write_session_params() to save the state to disk and restored using\n+read_session_params() when constructing a new session. The kind of\n+state that's included is all settings, the DHT routing table, possibly\n+plugin-specific state.\n+the flags parameter can be used to only save certain parts of the\n+session state

\n+\n+[report issue]
\n+
\n+

refresh_torrent_status() get_torrent_status()

\n
\n-int find_metric_idx (string_view name);\n-
\n-

given a name of a metric, this function returns the counter index of it,\n-or -1 if it could not be found. The counter index is the index into the\n-values array returned by session_stats_alert.

\n-[report issue]
\n-
\n-

enum metric_type_t

\n-

Declared in "libtorrent/session_stats.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
counter0 
gauge1 
\n-

libtorrent has a plugin interface for implementing extensions to the protocol.\n-These can be general extensions for transferring metadata or peer exchange\n-extensions, or it could be used to provide a way to customize the protocol\n-to fit a particular (closed) network.

\n-

In short, the plugin interface makes it possible to:

\n-
    \n-
  • register extension messages (sent in the extension handshake), see\n-extensions.
  • \n-
  • add data and parse data from the extension handshake.
  • \n-
  • send extension messages and standard bittorrent messages.
  • \n-
  • override or block the handling of standard bittorrent messages.
  • \n-
  • save and restore state via the session state
  • \n-
  • see all alerts that are posted
  • \n-
\n-
\n-
\n-

a word of caution

\n-

Writing your own plugin is a very easy way to introduce serious bugs such as\n-dead locks and race conditions. Since a plugin has access to internal\n-structures it is also quite easy to sabotage libtorrent's operation.

\n-

All the callbacks are always called from the libtorrent network thread. In\n-case portions of your plugin are called from other threads, typically the main\n-thread, you cannot use any of the member functions on the internal structures\n-in libtorrent, since those require being called from the libtorrent network\n-thread . Furthermore, you also need to synchronize your own shared data\n-within the plugin, to make sure it is not accessed at the same time from the\n-libtorrent thread (through a callback). If you need to send out a message\n-from another thread, it is advised to use an internal queue, and do the\n-actual sending in tick().

\n-

Since the plugin interface gives you easy access to internal structures, it\n-is not supported as a stable API. Plugins should be considered specific to a\n-specific version of libtorrent. Although, in practice the internals mostly\n-don't change that dramatically.

\n-
\n-
\n-

plugin-interface

\n-

The plugin interface consists of three base classes that the plugin may\n-implement. These are called plugin, torrent_plugin and peer_plugin.\n-They are found in the <libtorrent/extensions.hpp> header.

\n-

These plugins are instantiated for each session, torrent and possibly each peer,\n-respectively.

\n-

For plugins that only need per torrent state, it is enough to only implement\n-torrent_plugin and pass a constructor function or function object to\n-session::add_extension() or torrent_handle::add_extension() (if the\n-torrent has already been started and you want to hook in the extension at\n-run-time).

\n-

The signature of the function is:

\n-
\n-std::shared_ptr<torrent_plugin> (*)(torrent_handle const&, client_data_t);\n+void refresh_torrent_status (std::vector<torrent_status>* ret\n+      , status_flags_t flags = {}) const;\n+std::vector<torrent_status> get_torrent_status (\n+      std::function<bool(torrent_status const&)> const& pred\n+      , status_flags_t flags = {}) const;\n 
\n-

The second argument is the userdata passed to session::add_torrent() or\n-torrent_handle::add_extension().

\n-

The function should return a std::shared_ptr<torrent_plugin> which\n-may or may not be 0. If it is a nullptr, the extension is simply ignored\n-for this torrent. If it is a valid pointer (to a class inheriting\n-torrent_plugin), it will be associated with this torrent and callbacks\n-will be made on torrent events.

\n-

For more elaborate plugins which require session wide state, you would\n-implement plugin, construct an object (in a std::shared_ptr) and pass\n-it in to session::add_extension().

\n+
\n+

Note

\n+

these calls are potentially expensive and won't scale well with\n+lots of torrents. If you're concerned about performance, consider\n+using post_torrent_updates() instead.

\n
\n-
\n-

custom alerts

\n-

Since plugins are running within internal libtorrent threads, one convenient\n-way to communicate with the client is to post custom alerts.

\n-

The expected interface of any alert, apart from deriving from the alert\n-base class, looks like this:

\n+

get_torrent_status returns a vector of the torrent_status for\n+every torrent which satisfies pred, which is a predicate function\n+which determines if a torrent should be included in the returned set\n+or not. Returning true means it should be included and false means\n+excluded. The flags argument is the same as to\n+torrent_handle::status(). Since pred is guaranteed to be\n+called for every torrent, it may be used to count the number of\n+torrents of different categories as well.

\n+

refresh_torrent_status takes a vector of torrent_status structs\n+(for instance the same vector that was returned by\n+get_torrent_status() ) and refreshes the status based on the\n+handle member. It is possible to use this function by first\n+setting up a vector of default constructed torrent_status objects,\n+only initializing the handle member, in order to request the\n+torrent status for multiple torrents in a single call. This can save a\n+significant amount of time if you have a lot of torrents.

\n+

Any torrent_status object whose handle member is not referring to\n+a valid torrent are ignored.

\n+

The intended use of these functions is to start off by calling\n+get_torrent_status() to get a list of all torrents that match your\n+criteria. Then call refresh_torrent_status() on that list. This\n+will only refresh the status for the torrents in your list, and thus\n+ignore all other torrents you might be running. This may save a\n+significant amount of time, especially if the number of torrents you're\n+interested in is small. In order to keep your list of interested\n+torrents up to date, you can either call get_torrent_status() from\n+time to time, to include torrents you might have become interested in\n+since the last time. In order to stop refreshing a certain torrent,\n+simply remove it from the list.

\n+[report issue]
\n+
\n+

post_torrent_updates()

\n
\n-static const int alert_type = <unique alert ID>;\n-virtual int type() const { return alert_type; }\n-\n-virtual std::string message() const;\n-\n-static const alert_category_t static_category = <bitmask of alert::category_t flags>;\n-virtual alert_category_t category() const { return static_category; }\n-\n-virtual char const* what() const { return <string literal of the name of this alert>; }\n+void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n 
\n-

The alert_type is used for the type-checking in alert_cast. It must\n-not collide with any other alert. The built-in alerts in libtorrent will\n-not use alert type IDs greater than user_alert_id. When defining your\n-own alert, make sure it's greater than this constant.

\n-

type() is the run-time equivalence of the alert_type.

\n-

The message() virtual function is expected to construct a useful\n-string representation of the alert and the event or data it represents.\n-Something convenient to put in a log file for instance.

\n-

clone() is used internally to copy alerts. The suggested implementation\n-of simply allocating a new instance as a copy of *this is all that's\n-expected.

\n-

The static category is required for checking whether or not the category\n-for a specific alert is enabled or not, without instantiating the alert.\n-The category virtual function is the run-time equivalence.

\n-

The what() virtual function may simply be a string literal of the class\n-name of your alert.

\n-

For more information, see the alert section.

\n-[report issue]
\n-
\n-

peer_connection_handle

\n-

Declared in "libtorrent/peer_connection_handle.hpp"

\n-

the peer_connection_handle class provides a handle to the internal peer\n-connection object, to be used by plugins. This is a low level interface that\n-may not be stable across libtorrent versions

\n+

This functions instructs the session to post the state_update_alert,\n+containing the status of all torrents whose state changed since the\n+last time this function was called.

\n+

Only torrents who has the state subscription flag set will be\n+included. This flag is on by default. See add_torrent_params.\n+the flags argument is the same as for torrent_handle::status().\n+see status_flags_t in torrent_handle.

\n+[report issue]
\n+
\n+

post_session_stats()

\n
\n-struct peer_connection_handle\n-{\n-   explicit peer_connection_handle (std::weak_ptr<peer_connection> impl);\n-   connection_type type () const;\n-   peer_plugin const* find_plugin (string_view type) const;\n-   void add_extension (std::shared_ptr<peer_plugin>);\n-   bool is_seed () const;\n-   bool upload_only () const;\n-   peer_id const& pid () const;\n-   bool has_piece (piece_index_t i) const;\n-   bool is_interesting () const;\n-   bool is_choked () const;\n-   bool is_peer_interested () const;\n-   bool has_peer_choked () const;\n-   void maybe_unchoke_this_peer ();\n-   void choke_this_peer ();\n-   void get_peer_info (peer_info& p) const;\n-   torrent_handle associated_torrent () const;\n-   tcp::endpoint const& remote () const;\n-   tcp::endpoint local_endpoint () const;\n-   bool is_connecting () const;\n-   void disconnect (error_code const& ec, operation_t op\n-      , disconnect_severity_t = peer_connection_interface::normal);\n-   bool is_disconnecting () const;\n-   bool is_outgoing () const;\n-   bool ignore_unchoke_slots () const;\n-   bool on_local_network () const;\n-   bool failed () const;\n-   bool should_log (peer_log_alert::direction_t direction) const;\n-   void peer_log (peer_log_alert::direction_t direction\n-      , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);\n-   bool can_disconnect (error_code const& ec) const;\n-   bool has_metadata () const;\n-   bool in_handshake () const;\n-   void send_buffer (char const* begin, int size);\n-   time_point time_of_last_unchoke () const;\n-   std::time_t last_seen_complete () const;\n-   bool operator== (peer_connection_handle const& o) const;\n-   bool operator!= (peer_connection_handle const& o) const;\n-   bool operator< (peer_connection_handle const& o) const;\n-   std::shared_ptr<peer_connection> native_handle () const;\n-};\n+void post_session_stats ();\n 
\n-[report issue]
\n-
\n-

bt_peer_connection_handle

\n-

Declared in "libtorrent/peer_connection_handle.hpp"

\n-

The bt_peer_connection_handle provides a handle to the internal bittorrent\n-peer connection object to plugins. It's low level and may not be a stable API\n-across libtorrent versions.

\n+

This function will post a session_stats_alert object, containing a\n+snapshot of the performance counters from the internals of libtorrent.\n+To interpret these counters, query the session via\n+session_stats_metrics().

\n+

For more information, see the session statistics section.

\n+[report issue]
\n+
\n+

post_dht_stats()

\n
\n-struct bt_peer_connection_handle : peer_connection_handle\n-{\n-   explicit bt_peer_connection_handle (peer_connection_handle pc);\n-   bool packet_finished () const;\n-   bool support_extensions () const;\n-   bool supports_encryption () const;\n-   void switch_send_crypto (std::shared_ptr<crypto_plugin> crypto);\n-   void switch_recv_crypto (std::shared_ptr<crypto_plugin> crypto);\n-   std::shared_ptr<bt_peer_connection> native_handle () const;\n-};\n+void post_dht_stats ();\n 
\n-[report issue]
\n-
\n-

plugin

\n-

Declared in "libtorrent/extensions.hpp"

\n-

this is the base class for a session plugin. One primary feature\n-is that it is notified of all torrents that are added to the session,\n-and can add its own torrent_plugins.

\n+

This will cause a dht_stats_alert to be posted.

\n+[report issue]
\n+
\n+

set_dht_state()

\n
\n-struct plugin\n-{\n-   virtual feature_flags_t implemented_features ();\n-   virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);\n-   virtual void added (session_handle const&);\n-   virtual void abort ();\n-   virtual bool on_dht_request (string_view /* query */\n-      , udp::endpoint const& /* source */, bdecode_node const& /* message */\n-      , entry& /* response */);\n-   virtual void on_alert (alert const*);\n-   virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n-      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n-   virtual void on_tick ();\n-   virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);\n-   virtual std::map<std::string, std::string> save_state () const;\n-   virtual void load_state (std::map<std::string, std::string> const&);\n-\n-   static constexpr feature_flags_t optimistic_unchoke_feature  = 1_bit;\n-   static constexpr feature_flags_t tick_feature  = 2_bit;\n-   static constexpr feature_flags_t dht_request_feature  = 3_bit;\n-   static constexpr feature_flags_t alert_feature  = 4_bit;\n-};\n+void set_dht_state (dht::dht_state const& st);\n+void set_dht_state (dht::dht_state&& st);\n 
\n-[report issue]
\n-

implemented_features()

\n+

set the DHT state for the session. This will be taken into account the\n+next time the DHT is started, as if it had been passed in via the\n+session_params on startup.

\n+\n+[report issue]
\n+
\n+

find_torrent() get_torrents()

\n
\n-virtual feature_flags_t implemented_features ();\n+torrent_handle find_torrent (sha1_hash const& info_hash) const;\n+std::vector<torrent_handle> get_torrents () const;\n 
\n-

This function is expected to return a bitmask indicating which features\n-this plugin implements. Some callbacks on this object may not be called\n-unless the corresponding feature flag is returned here. Note that\n-callbacks may still be called even if the corresponding feature is not\n-specified in the return value here. See feature_flags_t for possible\n-flags to return.

\n-[report issue]
\n-
\n-

new_torrent()

\n+

find_torrent() looks for a torrent with the given info-hash. In\n+case there is such a torrent in the session, a torrent_handle to that\n+torrent is returned. In case the torrent cannot be found, an invalid\n+torrent_handle is returned.

\n+

See torrent_handle::is_valid() to know if the torrent was found or\n+not.

\n+

get_torrents() returns a vector of torrent_handles to all the\n+torrents currently in the session.

\n+\n+[report issue]
\n+
\n+

add_torrent() async_add_torrent()

\n
\n-virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);\n+torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);\n+void async_add_torrent (add_torrent_params&& params);\n+void async_add_torrent (add_torrent_params const& params);\n+torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n+torrent_handle add_torrent (add_torrent_params const& params);\n+torrent_handle add_torrent (add_torrent_params&& params);\n 
\n-

this is called by the session every time a new torrent is added.\n-The torrent* points to the internal torrent object created\n-for the new torrent. The client_data_t is the userdata pointer as\n-passed in via add_torrent_params.

\n-

If the plugin returns a torrent_plugin instance, it will be added\n-to the new torrent. Otherwise, return an empty shared_ptr to a\n-torrent_plugin (the default).

\n-[report issue]
\n-
\n-

added()

\n+

You add torrents through the add_torrent() function where you give an\n+object with all the parameters. The add_torrent() overloads will block\n+until the torrent has been added (or failed to be added) and returns\n+an error code and a torrent_handle. In order to add torrents more\n+efficiently, consider using async_add_torrent() which returns\n+immediately, without waiting for the torrent to add. Notification of\n+the torrent being added is sent as add_torrent_alert.

\n+

The overload that does not take an error_code throws an exception on\n+error and is not available when building without exception support.\n+The torrent_handle returned by add_torrent() can be used to retrieve\n+information about the torrent's progress, its peers etc. It is also\n+used to abort a torrent.

\n+

If the torrent you are trying to add already exists in the session (is\n+either queued for checking, being checked or downloading)\n+add_torrent() will throw system_error which derives from\n+std::exception unless duplicate_is_error is set to false. In that\n+case, add_torrent() will return the handle to the existing torrent.

\n+

The add_torrent_params class has a flags field. It can be used to\n+control what state the new torrent will be added in. Common flags to\n+want to control are torrent_flags::paused and\n+torrent_flags::auto_managed. In order to add a magnet link that will\n+just download the metadata, but no payload, set the\n+torrent_flags::upload_mode flag.

\n+

Special consideration has to be taken when adding hybrid torrents\n+(i.e. torrents that are BitTorrent v2 torrents that are backwards\n+compatible with v1). For more details, see BitTorrent v2 torrents.

\n+\n+\n+[report issue]
\n+
\n+

pause() is_paused() resume()

\n
\n-virtual void added (session_handle const&);\n+void pause ();\n+void resume ();\n+bool is_paused () const;\n 
\n-

called when plugin is added to a session

\n-[report issue]
\n-
\n-

abort()

\n+

Pausing the session has the same effect as pausing every torrent in\n+it, except that torrents will not be resumed by the auto-manage\n+mechanism. Resuming will restore the torrents to their previous paused\n+state. i.e. the session pause state is separate from the torrent pause\n+state. A torrent is inactive if it is paused or if the session is\n+paused.

\n+[report issue]
\n+
\n+

is_dht_running()

\n
\n-virtual void abort ();\n+bool is_dht_running () const;\n 
\n-

called when the session is aborted\n-the plugin should perform any cleanup necessary to allow the session's\n-destruction (e.g. cancel outstanding async operations)

\n-[report issue]
\n-
\n-

on_dht_request()

\n+

is_dht_running() returns true if the DHT support has been started\n+and false otherwise.

\n+[report issue]
\n+
\n+

set_dht_storage()

\n
\n-virtual bool on_dht_request (string_view /* query */\n-      , udp::endpoint const& /* source */, bdecode_node const& /* message */\n-      , entry& /* response */);\n+void set_dht_storage (dht::dht_storage_constructor_type sc);\n 
\n-

called when a dht request is received.\n-If your plugin expects this to be called, make sure to include the flag\n-dht_request_feature in the return value from implemented_features().

\n-[report issue]
\n-
\n-

on_alert()

\n+

set_dht_storage set a dht custom storage constructor function\n+to be used internally when the dht is created.

\n+

Since the dht storage is a critical component for the dht behavior,\n+this function will only be effective the next time the dht is started.\n+If you never touch this feature, a default map-memory based storage\n+is used.

\n+

If you want to make sure the dht is initially created with your\n+custom storage, create a session with the setting\n+settings_pack::enable_dht to false, set your constructor function\n+and call apply_settings with settings_pack::enable_dht to true.

\n+[report issue]
\n+
\n+

add_dht_node()

\n
\n-virtual void on_alert (alert const*);\n+void add_dht_node (std::pair<std::string, int> const& node);\n 
\n-

called when an alert is posted alerts that are filtered are not posted.\n-If your plugin expects this to be called, make sure to include the flag\n-alert_feature in the return value from implemented_features().

\n-[report issue]
\n-
\n-

on_unknown_torrent()

\n+

add_dht_node takes a host name and port pair. That endpoint will be\n+pinged, and if a valid DHT reply is received, the node will be added to\n+the routing table.

\n+[report issue]
\n+
\n+

dht_get_item()

\n
\n-virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n-      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n+void dht_get_item (sha1_hash const& target);\n 
\n-

return true if the add_torrent_params should be added

\n-[report issue]
\n-
\n-

on_tick()

\n+

query the DHT for an immutable item at the target hash.\n+the result is posted as a dht_immutable_item_alert.

\n+[report issue]
\n+
\n+

dht_get_item()

\n
\n-virtual void on_tick ();\n+void dht_get_item (std::array<char, 32> key\n+      , std::string salt = std::string());\n 
\n-

called once per second.\n-If your plugin expects this to be called, make sure to include the flag\n-tick_feature in the return value from implemented_features().

\n-[report issue]
\n-
\n-

get_unchoke_priority()

\n+

query the DHT for a mutable item under the public key key.\n+this is an ed25519 key. salt is optional and may be left\n+as an empty string if no salt is to be used.\n+if the item is found in the DHT, a dht_mutable_item_alert is\n+posted.

\n+[report issue]
\n+
\n+

dht_put_item()

\n
\n-virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);\n+sha1_hash dht_put_item (entry data);\n 
\n-

called when choosing peers to optimistically unchoke. The return value\n-indicates the peer's priority for unchoking. Lower return values\n-correspond to higher priority. Priorities above 2^63-1 are reserved.\n-If your plugin has no priority to assign a peer it should return 2^64-1.\n-If your plugin expects this to be called, make sure to include the flag\n-optimistic_unchoke_feature in the return value from implemented_features().\n-If multiple plugins implement this function the lowest return value\n-(i.e. the highest priority) is used.

\n-[report issue]
\n-
\n-

load_state()

\n+

store the given bencoded data as an immutable item in the DHT.\n+the returned hash is the key that is to be used to look the item\n+up again. It's just the SHA-1 hash of the bencoded form of the\n+structure.

\n+[report issue]
\n+
\n+

dht_put_item()

\n
\n-virtual void load_state (std::map<std::string, std::string> const&);\n+void dht_put_item (std::array<char, 32> key\n+      , std::function<void(entry&, std::array<char, 64>&\n+      , std::int64_t&, std::string const&)> cb\n+      , std::string salt = std::string());\n 
\n-

called on startup while loading settings state from the session_params

\n-[report issue]
\n-
optimistic_unchoke_feature
\n-
include this bit if your plugin needs to alter the order of the\n-optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()\n-callback be called.
\n-
\n-[report issue]
\n-
tick_feature
\n-
include this bit if your plugin needs to have on_tick() called
\n-
\n-[report issue]
\n-
dht_request_feature
\n-
include this bit if your plugin needs to have on_dht_request()\n-called
\n-
\n-[report issue]
\n-
alert_feature
\n-
include this bit if your plugin needs to have on_alert()\n-called
\n+

store a mutable item. The key is the public key the blob is\n+to be stored under. The optional salt argument is a string that\n+is to be mixed in with the key when determining where in the DHT\n+the value is to be stored. The callback function is called from within\n+the libtorrent network thread once we've found where to store the blob,\n+possibly with the current value stored under the key.\n+The values passed to the callback functions are:

\n+
\n+
entry& value
\n+
the current value stored under the key (may be empty). Also expected\n+to be set to the value to be stored by the function.
\n+
std::array<char,64>& signature
\n+
the signature authenticating the current value. This may be zeros\n+if there is currently no value stored. The function is expected to\n+fill in this buffer with the signature of the new value to store.\n+To generate the signature, you may want to use the\n+sign_mutable_item function.
\n+
std::int64_t& seq
\n+
current sequence number. May be zero if there is no current value.\n+The function is expected to set this to the new sequence number of\n+the value that is to be stored. Sequence numbers must be monotonically\n+increasing. Attempting to overwrite a value with a lower or equal\n+sequence number will fail, even if the signature is correct.
\n+
std::string const& salt
\n+
this is the salt that was used for this put call.
\n
\n-[report issue]
\n-
\n-
\n-

torrent_plugin

\n-

Declared in "libtorrent/extensions.hpp"

\n-

Torrent plugins are associated with a single torrent and have a number\n-of functions called at certain events. Many of its functions have the\n-ability to change or override the default libtorrent behavior.

\n-
\n-struct torrent_plugin\n-{\n-   virtual std::shared_ptr<peer_plugin> new_connection (peer_connection_handle const&);\n-   virtual void on_piece_failed (piece_index_t);\n-   virtual void on_piece_pass (piece_index_t);\n-   virtual void tick ();\n-   virtual bool on_resume ();\n-   virtual bool on_pause ();\n-   virtual void on_files_checked ();\n-   virtual void on_state (torrent_status::state_t);\n-   virtual void on_add_peer (tcp::endpoint const&,\n-      peer_source_flags_t, add_peer_flags_t);\n-\n-   static constexpr add_peer_flags_t first_time  = 1_bit;\n-   static constexpr add_peer_flags_t filtered  = 2_bit;\n-};\n-
\n-[report issue]
\n-

new_connection()

\n-
\n-virtual std::shared_ptr<peer_plugin> new_connection (peer_connection_handle const&);\n-
\n-

This function is called each time a new peer is connected to the torrent. You\n-may choose to ignore this by just returning a default constructed\n-shared_ptr (in which case you don't need to override this member\n-function).

\n-

If you need an extension to the peer connection (which most plugins do) you\n-are supposed to return an instance of your peer_plugin class. Which in\n-turn will have its hook functions called on event specific to that peer.

\n-

The peer_connection_handle will be valid as long as the shared_ptr\n-is being held by the torrent object. So, it is generally a good idea to not\n-keep a shared_ptr to your own peer_plugin. If you want to keep references\n-to it, use weak_ptr.

\n-

If this function throws an exception, the connection will be closed.

\n-\n-[report issue]
\n-
\n-

on_piece_pass() on_piece_failed()

\n-
\n-virtual void on_piece_failed (piece_index_t);\n-virtual void on_piece_pass (piece_index_t);\n-
\n-

These hooks are called when a piece passes the hash check or fails the hash\n-check, respectively. The index is the piece index that was downloaded.\n-It is possible to access the list of peers that participated in sending the\n-piece through the torrent and the piece_picker.

\n-[report issue]
\n-
\n-

tick()

\n+

Since the callback function cb is called from within libtorrent,\n+it is critical to not perform any blocking operations. Ideally not\n+even locking a mutex. Pass any data required for this function along\n+with the function object's context and make the function entirely\n+self-contained. The only reason data blob's value is computed\n+via a function instead of just passing in the new value is to avoid\n+race conditions. If you want to update the value in the DHT, you\n+must first retrieve it, then modify it, then write it back. The way\n+the DHT works, it is natural to always do a lookup before storing and\n+calling the callback in between is convenient.

\n+\n+[report issue]
\n+
\n+

dht_announce() dht_get_peers()

\n
\n-virtual void tick ();\n+void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});\n+void dht_get_peers (sha1_hash const& info_hash);\n 
\n-

This hook is called approximately once per second. It is a way of making it\n-easy for plugins to do timed events, for sending messages or whatever.

\n-\n-[report issue]
\n-
\n-

on_resume() on_pause()

\n+

dht_get_peers() will issue a DHT get_peer request to the DHT for the\n+specified info-hash. The response (the peers) will be posted back in a\n+dht_get_peers_reply_alert.

\n+

dht_announce() will issue a DHT announce request to the DHT to the\n+specified info-hash, advertising the specified port. If the port is\n+left at its default, 0, the port will be implied by the DHT message's\n+source port (which may improve connectivity through a NAT).

\n+

Both these functions are exposed for advanced custom use of the DHT.\n+All torrents eligible to be announce to the DHT will be automatically,\n+by libtorrent.

\n+

For possible flags, see announce_flags_t.

\n+[report issue]
\n+
\n+

dht_live_nodes()

\n
\n-virtual bool on_resume ();\n-virtual bool on_pause ();\n+void dht_live_nodes (sha1_hash const& nid);\n 
\n-

These hooks are called when the torrent is paused and resumed respectively.\n-The return value indicates if the event was handled. A return value of\n-true indicates that it was handled, and no other plugin after this one\n-will have this hook function called, and the standard handler will also not be\n-invoked. So, returning true effectively overrides the standard behavior of\n-pause or resume.

\n-

Note that if you call pause() or resume() on the torrent from your\n-handler it will recurse back into your handler, so in order to invoke the\n-standard handler, you have to keep your own state on whether you want standard\n-behavior or overridden behavior.

\n-[report issue]
\n-
\n-

on_files_checked()

\n+

Retrieve all the live DHT (identified by nid) nodes. All the\n+nodes id and endpoint will be returned in the list of nodes in the\n+alert dht_live_nodes_alert.\n+Since this alert is a response to an explicit call, it will always be\n+posted, regardless of the alert mask.

\n+[report issue]
\n+
\n+

dht_sample_infohashes()

\n
\n-virtual void on_files_checked ();\n+void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);\n 
\n-

This function is called when the initial files of the torrent have been\n-checked. If there are no files to check, this function is called immediately.

\n-

i.e. This function is always called when the torrent is in a state where it\n-can start downloading.

\n-[report issue]
\n-
\n-

on_state()

\n+

Query the DHT node specified by ep to retrieve a sample of the\n+info-hashes that the node currently have in their storage.\n+The target is included for iterative lookups so that indexing nodes\n+can perform a key space traversal with a single RPC per node by adjusting\n+the target value for each RPC. It has no effect on the returned sample value.\n+The result is posted as a dht_sample_infohashes_alert.

\n+[report issue]
\n+
\n+

dht_direct_request()

\n
\n-virtual void on_state (torrent_status::state_t);\n+void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});\n 
\n-

called when the torrent changes state\n-the state is one of torrent_status::state_t\n-enum members

\n-[report issue]
\n-
\n-

on_add_peer()

\n+

Send an arbitrary DHT request directly to the specified endpoint. This\n+function is intended for use by plugins. When a response is received\n+or the request times out, a dht_direct_response_alert will be posted\n+with the response (if any) and the userdata pointer passed in here.\n+Since this alert is a response to an explicit call, it will always be\n+posted, regardless of the alert mask.

\n+[report issue]
\n+
\n+

add_extension()

\n
\n-virtual void on_add_peer (tcp::endpoint const&,\n-      peer_source_flags_t, add_peer_flags_t);\n+void add_extension (std::shared_ptr<plugin> ext);\n+void add_extension (std::function<std::shared_ptr<torrent_plugin>(\n+      torrent_handle const&, client_data_t)> ext);\n 
\n-

called every time a new peer is added to the peer list.\n-This is before the peer is connected to. For flags, see\n-torrent_plugin::flags_t. The source argument refers to\n-the source where we learned about this peer from. It's a\n-bitmask, because many sources may have told us about the same\n-peer. For peer source flags, see peer_info::peer_source_flags.

\n-[report issue]
\n-
first_time
\n-
this is the first time we see this peer
\n-
\n-[report issue]
\n-
filtered
\n-
this peer was not added because it was\n-filtered by the IP filter
\n+

This function adds an extension to this session. The argument is a\n+function object that is called with a torrent_handle and which should\n+return a std::shared_ptr<torrent_plugin>. To write custom\n+plugins, see libtorrent plugins. For the typical bittorrent client\n+all of these extensions should be added. The main plugins implemented\n+in libtorrent are:

\n+
\n+
uTorrent metadata
\n+
Allows peers to download the metadata (.torrent files) from the swarm\n+directly. Makes it possible to join a swarm with just a tracker and\n+info-hash.
\n
\n-[report issue]
\n-
\n-
\n-

peer_plugin

\n-

Declared in "libtorrent/extensions.hpp"

\n-

peer plugins are associated with a specific peer. A peer could be\n-both a regular bittorrent peer (bt_peer_connection) or one of the\n-web seed connections (web_peer_connection or http_seed_connection).\n-In order to only attach to certain peers, make your\n-torrent_plugin::new_connection only return a plugin for certain peer\n-connection types

\n-
\n-struct peer_plugin\n-{\n-   virtual string_view type () const;\n-   virtual void add_handshake (entry&);\n-   virtual void on_disconnect (error_code const&);\n-   virtual void on_connected ();\n-   virtual bool on_handshake (span<char const>);\n-   virtual bool on_extension_handshake (bdecode_node const&);\n-   virtual bool on_interested ();\n-   virtual bool on_dont_have (piece_index_t);\n-   virtual bool on_bitfield (bitfield const& /*bitfield*/);\n-   virtual bool on_request (peer_request const&);\n-   virtual bool on_have_none ();\n-   virtual bool on_have_all ();\n-   virtual bool on_unchoke ();\n-   virtual bool on_choke ();\n-   virtual bool on_not_interested ();\n-   virtual bool on_have (piece_index_t);\n-   virtual bool on_allowed_fast (piece_index_t);\n-   virtual bool on_piece (peer_request const& /*piece*/\n-      , span<char const> /*buf*/);\n-   virtual bool on_cancel (peer_request const&);\n-   virtual bool on_suggest (piece_index_t);\n-   virtual bool on_reject (peer_request const&);\n-   virtual void sent_reject_request (peer_request const&);\n-   virtual void sent_allow_fast (piece_index_t);\n-   virtual void sent_suggest (piece_index_t);\n-   virtual void sent_choke ();\n-   virtual void sent_have_none ();\n-   virtual void sent_request (peer_request const&);\n-   virtual void sent_have_all ();\n-   virtual void sent_cancel (peer_request const&);\n-   virtual void sent_interested ();\n-   virtual void sent_have (piece_index_t);\n-   virtual void sent_not_interested ();\n-   virtual void sent_unchoke ();\n-   virtual void sent_piece (peer_request const&);\n-   virtual void sent_payload (int /* bytes */);\n-   virtual bool can_disconnect (error_code const& /*ec*/);\n-   virtual bool on_extended (int /*length*/, int /*msg*/,\n-      span<char const> /*body*/);\n-   virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n-      span<char const> /*body*/);\n-   virtual void on_piece_failed (piece_index_t);\n-   virtual void on_piece_pass (piece_index_t);\n-   virtual void tick ();\n-   virtual bool write_request (peer_request const&);\n-};\n-
\n-[report issue]
\n-

type()

\n-
\n-virtual string_view type () const;\n-
\n-

This function is expected to return the name of\n-the plugin.

\n-[report issue]
\n-
\n-

add_handshake()

\n-
\n-virtual void add_handshake (entry&);\n-
\n-

can add entries to the extension handshake\n-this is not called for web seeds

\n-[report issue]
\n-
\n-

on_disconnect()

\n-
\n-virtual void on_disconnect (error_code const&);\n-
\n-

called when the peer is being disconnected.

\n-[report issue]
\n-
\n-

on_connected()

\n-
\n-virtual void on_connected ();\n-
\n-

called when the peer is successfully connected. Note that\n-incoming connections will have been connected by the time\n-the peer plugin is attached to it, and won't have this hook\n-called.

\n-[report issue]
\n-
\n-

on_handshake()

\n-
\n-virtual bool on_handshake (span<char const>);\n-
\n-

this is called when the initial bittorrent handshake is received.\n-Returning false means that the other end doesn't support this extension\n-and will remove it from the list of plugins. this is not called for web\n-seeds

\n-[report issue]
\n-
\n-

on_extension_handshake()

\n-
\n-virtual bool on_extension_handshake (bdecode_node const&);\n-
\n-

called when the extension handshake from the other end is received\n-if this returns false, it means that this extension isn't\n-supported by this peer. It will result in this peer_plugin\n-being removed from the peer_connection and destructed.\n-this is not called for web seeds

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-[report issue]
\n-
\n-

on_dont_have() on_allowed_fast() on_not_interested() on_bitfield() on_have_none() on_have() on_choke() on_interested() on_request() on_unchoke() on_have_all()

\n-
\n-virtual bool on_interested ();\n-virtual bool on_dont_have (piece_index_t);\n-virtual bool on_bitfield (bitfield const& /*bitfield*/);\n-virtual bool on_request (peer_request const&);\n-virtual bool on_have_none ();\n-virtual bool on_have_all ();\n-virtual bool on_unchoke ();\n-virtual bool on_choke ();\n-virtual bool on_not_interested ();\n-virtual bool on_have (piece_index_t);\n-virtual bool on_allowed_fast (piece_index_t);\n-
\n-

returning true from any of the message handlers\n-indicates that the plugin has handled the message.\n-it will break the plugin chain traversing and not let\n-anyone else handle the message, including the default\n-handler.

\n-[report issue]
\n-
\n-

on_piece()

\n-
\n-virtual bool on_piece (peer_request const& /*piece*/\n-      , span<char const> /*buf*/);\n-
\n-

This function is called when the peer connection is receiving\n-a piece. buf points (non-owning pointer) to the data in an\n-internal immutable disk buffer. The length of the data is specified\n-in the length member of the piece parameter.\n-returns true to indicate that the piece is handled and the\n-rest of the logic should be ignored.

\n-\n-\n-\n-\n-[report issue]
\n-
\n-

sent_have() sent_unchoke() sent_piece() sent_interested() sent_not_interested()

\n-
\n-virtual void sent_interested ();\n-virtual void sent_have (piece_index_t);\n-virtual void sent_not_interested ();\n-virtual void sent_unchoke ();\n-virtual void sent_piece (peer_request const&);\n-
\n-

called after a choke message has been sent to the peer

\n-[report issue]
\n-
\n-

sent_payload()

\n-
\n-virtual void sent_payload (int /* bytes */);\n-
\n-

called after piece data has been sent to the peer\n-this can be used for stats book keeping

\n-[report issue]
\n-
\n-

can_disconnect()

\n-
\n-virtual bool can_disconnect (error_code const& /*ec*/);\n-
\n-

called when libtorrent think this peer should be disconnected.\n-if the plugin returns false, the peer will not be disconnected.

\n-[report issue]
\n-
\n-

on_extended()

\n-
\n-virtual bool on_extended (int /*length*/, int /*msg*/,\n-      span<char const> /*body*/);\n-
\n-

called when an extended message is received. If returning true,\n-the message is not processed by any other plugin and if false\n-is returned the next plugin in the chain will receive it to\n-be able to handle it. This is not called for web seeds.\n-thus function may be called more than once per incoming message, but\n-only the last of the calls will the body size equal the length.\n-i.e. Every time another fragment of the message is received, this\n-function will be called, until finally the whole message has been\n-received. The purpose of this is to allow early disconnects for invalid\n-messages and for reporting progress of receiving large messages.

\n-[report issue]
\n-
\n-

on_unknown_message()

\n-
\n-virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n-      span<char const> /*body*/);\n+
\n+#include <libtorrent/extensions/ut_metadata.hpp>\n+ses.add_extension(&lt::create_ut_metadata_plugin);\n 
\n-

this is not called for web seeds

\n-\n-[report issue]
\n-
\n-

on_piece_pass() on_piece_failed()

\n-
\n-virtual void on_piece_failed (piece_index_t);\n-virtual void on_piece_pass (piece_index_t);\n+
\n+
uTorrent peer exchange
\n+
Exchanges peers between clients.
\n+
\n+
\n+#include <libtorrent/extensions/ut_pex.hpp>\n+ses.add_extension(&lt::create_ut_pex_plugin);\n 
\n-

called when a piece that this peer participated in either\n-fails or passes the hash_check

\n-[report issue]
\n-
\n-

tick()

\n-
\n-virtual void tick ();\n+
\n+
smart ban plugin
\n+
A plugin that, with a small overhead, can ban peers\n+that sends bad data with very high accuracy. Should\n+eliminate most problems on poisoned torrents.
\n+
\n+
\n+#include <libtorrent/extensions/smart_ban.hpp>\n+ses.add_extension(&lt::create_smart_ban_plugin);\n 
\n-

called approximately once every second

\n-[report issue]
\n-
\n-

write_request()

\n+\n+[report issue]
\n+
\n+

get_ip_filter() set_ip_filter()

\n
\n-virtual bool write_request (peer_request const&);\n+ip_filter get_ip_filter () const;\n+void set_ip_filter (ip_filter f);\n 
\n-

called each time a request message is to be sent. If true\n-is returned, the original request message won't be sent and\n-no other plugin will have this function called.

\n-[report issue]
\n-
\n-
\n-

crypto_plugin

\n-

Declared in "libtorrent/extensions.hpp"

\n+

Sets a filter that will be used to reject and accept incoming as well\n+as outgoing connections based on their originating ip address. The\n+default filter will allow connections to any ip address. To build a\n+set of rules for which addresses are accepted and not, see ip_filter.

\n+

Each time a peer is blocked because of the IP filter, a\n+peer_blocked_alert is generated. get_ip_filter() Returns the\n+ip_filter currently in the session. See ip_filter.

\n+[report issue]
\n+
\n+

set_port_filter()

\n
\n-struct crypto_plugin\n-{\n-   virtual void set_incoming_key (span<char const> key) = 0;\n-   virtual void set_outgoing_key (span<char const> key) = 0;\n-   encrypt (span<span<char>> /*send_vec*/) = 0;\n-   virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;\n-};\n+void set_port_filter (port_filter const& f);\n 
\n-[report issue]
\n-

decrypt()

\n+

apply port_filter f to incoming and outgoing peers. a port filter\n+will reject making outgoing peer connections to certain remote ports.\n+The main intention is to be able to avoid triggering certain\n+anti-virus software by connecting to SMTP, FTP ports.

\n+\n+\n+[report issue]
\n+
\n+

ssl_listen_port() is_listening() listen_port()

\n
\n-virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;\n+unsigned short ssl_listen_port () const;\n+unsigned short listen_port () const;\n+bool is_listening () const;\n 
\n-

decrypt the provided buffers.\n-returns is a tuple representing the values\n-(consume, produce, packet_size)

\n-

consume is set to the number of bytes which should be trimmed from the\n-head of the buffers, default is 0

\n-

produce is set to the number of bytes of payload which are now ready to\n-be sent to the upper layer. default is the number of bytes passed in receive_vec

\n-

packet_size is set to the minimum number of bytes which must be read to\n-advance the next step of decryption. default is 0

\n-[report issue]
\n-
\n-
\n-

create_ut_pex_plugin()

\n-

Declared in "libtorrent/extensions/ut_pex.hpp"

\n+

is_listening() will tell you whether or not the session has\n+successfully opened a listening port. If it hasn't, this function will\n+return false, and then you can set a new\n+settings_pack::listen_interfaces to try another interface and port to\n+bind to.

\n+

listen_port() returns the port we ended up listening on.

\n+\n+[report issue]
\n+
\n+

get_peer_class_filter() set_peer_class_filter()

\n
\n-std::shared_ptr<torrent_plugin> create_ut_pex_plugin (torrent_handle const&, client_data_t);\n+ip_filter get_peer_class_filter () const;\n+void set_peer_class_filter (ip_filter const& f);\n 
\n-

constructor function for the ut_pex extension. The ut_pex\n-extension allows peers to gossip about their connections, allowing\n-the swarm stay well connected and peers aware of more peers in the\n-swarm. This extension is enabled by default unless explicitly disabled in\n-the session constructor.

\n-

This can either be passed in the add_torrent_params::extensions field, or\n-via torrent_handle::add_extension().

\n-[report issue]
\n-
\n-

create_ut_metadata_plugin()

\n-

Declared in "libtorrent/extensions/ut_metadata.hpp"

\n-
\n-std::shared_ptr<torrent_plugin> create_ut_metadata_plugin (torrent_handle const&, client_data_t);\n+

Sets the peer class filter for this session. All new peer connections\n+will take this into account and be added to the peer classes specified\n+by this filter, based on the peer's IP address.

\n+

The ip-filter essentially maps an IP -> uint32. Each bit in that 32\n+bit integer represents a peer class. The least significant bit\n+represents class 0, the next bit class 1 and so on.

\n+

For more info, see ip_filter.

\n+

For example, to make all peers in the range 200.1.1.0 - 200.1.255.255\n+belong to their own peer class, apply the following filter:

\n+
\n+ip_filter f = ses.get_peer_class_filter();\n+peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range");\n+f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255")\n+        , 1 << static_cast<std::uint32_t>(my_class));\n+ses.set_peer_class_filter(f);\n 
\n-

constructor function for the ut_metadata extension. The ut_metadata\n-extension allows peers to request the .torrent file (or more\n-specifically the info-dictionary of the .torrent file) from each\n-other. This is the main building block in making magnet links work.\n-This extension is enabled by default unless explicitly disabled in\n-the session constructor.

\n-

This can either be passed in the add_torrent_params::extensions field, or\n-via torrent_handle::add_extension().

\n-[report issue]
\n-
\n-

create_smart_ban_plugin()

\n-

Declared in "libtorrent/extensions/smart_ban.hpp"

\n+

This setting only applies to new connections, it won't affect existing\n+peer connections.

\n+

This function is limited to only peer class 0-31, since there are only\n+32 bits in the IP range mapping. Only the set bits matter; no peer\n+class will be removed from a peer as a result of this call, peer\n+classes are only added.

\n+

The peer_class argument cannot be greater than 31. The bitmasks\n+representing peer classes in the peer_class_filter are 32 bits.

\n+

The get_peer_class_filter() function returns the current filter.

\n+

For more information, see peer classes.

\n+\n+[report issue]
\n+
\n+

set_peer_class_type_filter() get_peer_class_type_filter()

\n
\n-std::shared_ptr<torrent_plugin> create_smart_ban_plugin (torrent_handle const&, client_data_t);\n+void set_peer_class_type_filter (peer_class_type_filter const& f);\n+peer_class_type_filter get_peer_class_type_filter () const;\n 
\n-

constructor function for the smart ban extension. The extension keeps\n-track of the data peers have sent us for failing pieces and once the\n-piece completes and passes the hash check bans the peers that turned\n-out to have sent corrupt data.\n-This function can either be passed in the add_torrent_params::extensions\n-field, or via torrent_handle::add_extension().

\n-

This section describes the functions and classes that are used\n-to create torrent files. It is a layered API with low level classes\n-and higher level convenience functions. A torrent is created in 4\n-steps:

\n+

Sets and gets the peer class type filter. This is controls automatic\n+peer class assignments to peers based on what kind of socket it is.

\n+

It does not only support assigning peer classes, it also supports\n+removing peer classes based on socket type.

\n+

The order of these rules being applied are:

\n
    \n-
  1. first the files that will be part of the torrent are determined.
  2. \n-
  3. the torrent properties are set, such as tracker url, web seeds,\n-DHT nodes etc.
  4. \n-
  5. Read through all the files in the torrent, SHA-1 all the data\n-and set the piece hashes.
  6. \n-
  7. The torrent is bencoded into a file or buffer.
  8. \n+
  9. peer-class IP filter
  10. \n+
  11. peer-class type filter, removing classes
  12. \n+
  13. peer-class type filter, adding classes
  14. \n
\n-

If there are a lot of files and or deep directory hierarchies to\n-traverse, step one can be time consuming.

\n-

Typically step 3 is by far the most time consuming step, since it\n-requires to read all the bytes from all the files in the torrent.

\n-

All of these classes and functions are declared by including\n-libtorrent/create_torrent.hpp.

\n-

example:

\n-
\n-file_storage fs;\n-\n-// recursively adds files in directories\n-add_files(fs, "./my_torrent");\n-\n-create_torrent t(fs);\n-t.add_tracker("http://my.tracker.com/announce");\n-t.set_creator("libtorrent example");\n-\n-// reads the files and calculates the hashes\n-set_piece_hashes(t, ".");\n-\n-ofstream out("my_torrent.torrent", std::ios_base::binary);\n-std::vector<char> buf = t.generate_buf();\n-out.write(buf.data(), buf.size());\n-\n-// alternatively, generate an entry and encode it directly to an ostream\n-// iterator\n-bencode(std::ostream_iterator<char>(out), t.generate());\n-
\n-[report issue]
\n-
\n-

create_torrent

\n-

Declared in "libtorrent/create_torrent.hpp"

\n-

This class holds state for creating a torrent. After having added\n-all information to it, call create_torrent::generate() to generate\n-the torrent. The entry that's returned can then be bencoded into a\n-.torrent file using bencode().

\n-
\n-struct create_torrent\n-{\n-   explicit create_torrent (file_storage& fs, int piece_size = 0\n-      , create_flags_t flags = {});\n-   explicit create_torrent (torrent_info const& ti);\n-   entry generate () const;\n-   std::vector<char> generate_buf () const;\n-   file_storage const& files () const;\n-   void set_comment (char const* str);\n-   void set_creator (char const* str);\n-   void set_creation_date (std::time_t timestamp);\n-   void set_hash (piece_index_t index, sha1_hash const& h);\n-   void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);\n-   void add_url_seed (string_view url);\n-   void add_http_seed (string_view url);\n-   void add_node (std::pair<std::string, int> node);\n-   void add_tracker (string_view url, int tier = 0);\n-   void set_root_cert (string_view cert);\n-   void set_priv (bool p);\n-   bool priv () const;\n-   bool is_v1_only () const;\n-   bool is_v2_only () const;\n-   int num_pieces () const;\n-   piece_index_t end_piece () const;\n-   index_range<piece_index_t> piece_range () const noexcept;\n-   file_index_t end_file () const;\n-   index_range<file_index_t> file_range () const noexcept;\n-   index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);\n-   std::int64_t total_size () const;\n-   int piece_length () const;\n-   int piece_size (piece_index_t i) const;\n-   void add_collection (string_view c);\n-   void add_similar_torrent (sha1_hash ih);\n-\n-   static constexpr create_flags_t modification_time  = 2_bit;\n-   static constexpr create_flags_t symlinks  = 3_bit;\n-   static constexpr create_flags_t v2_only  = 5_bit;\n-   static constexpr create_flags_t v1_only  = 6_bit;\n-   static constexpr create_flags_t canonical_files  = 7_bit;\n-   static constexpr create_flags_t no_attributes  = 8_bit;\n-   static constexpr create_flags_t canonical_files_no_tail_padding  = 9_bit;\n-};\n-
\n-[report issue]
\n-

create_torrent()

\n-
\n-explicit create_torrent (file_storage& fs, int piece_size = 0\n-      , create_flags_t flags = {});\n-explicit create_torrent (torrent_info const& ti);\n-
\n-

The piece_size is the size of each piece in bytes. It must be a\n-power of 2 and a minimum of 16 kiB. If a piece size of 0 is\n-specified, a piece_size will be set automatically.

\n-

The flags arguments specifies options for the torrent creation. It can\n-be any combination of the flags defined by create_flags_t.

\n-

The file_storage (fs) parameter defines the files, sizes and\n-their properties for the torrent to be created. Set this up first,\n-before passing it to the create_torrent constructor.

\n-

The overload that takes a torrent_info object will make a verbatim\n-copy of its info dictionary (to preserve the info-hash). The copy of\n-the info dictionary will be used by create_torrent::generate(). This means\n-that none of the member functions of create_torrent that affects\n-the content of the info dictionary (such as set_hash()), will\n-have any affect. Instead of using this overload, consider using\n-write_torrent_file() instead.

\n-
\n-

Warning

\n-

The file_storage and torrent_info objects must stay alive for the\n-entire duration of the create_torrent object.

\n-
\n-\n-[report issue]
\n-
\n-

generate_buf() generate()

\n-
\n-entry generate () const;\n-std::vector<char> generate_buf () const;\n-
\n-

This function will generate the .torrent file as a bencode tree, or a\n-bencoded into a buffer.\n-In order to encode the entry into a flat file, use the bencode() function.

\n-

The function returning an entry may be useful to add custom entries\n-to the torrent file before bencoding it and saving it to disk.

\n-

Whether the resulting torrent object is v1, v2 or hybrid depends on\n-whether any of the v1_only or v2_only flags were set on the\n-constructor. If neither were set, the resulting torrent depends on\n-which hashes were set. If both v1 and v2 hashes were set, a hybrid\n-torrent is created.

\n-

Any failure will cause this function to throw system_error, with an\n-appropriate error message. These are the reasons this call may throw:

\n-
    \n-
  • the file storage has 0 files
  • \n-
  • the total size of the file storage is 0 bytes (i.e. it only has\n-empty files)
  • \n-
  • not all v1 hashes (set_hash()) and not all v2 hashes (set_hash2())\n-were set
  • \n-
  • for v2 torrents, you may not have a directory with the same name as\n-a file. If that's encountered in the file storage, generate()\n-fails.
  • \n-
\n-[report issue]
\n-
\n-

files()

\n-
\n-file_storage const& files () const;\n-
\n-

returns an immutable reference to the file_storage used to create\n-the torrent from.

\n-[report issue]
\n-
\n-

set_comment()

\n-
\n-void set_comment (char const* str);\n-
\n-

Sets the comment for the torrent. The string str should be utf-8 encoded.\n-The comment in a torrent file is optional.

\n-[report issue]
\n-
\n-

set_creator()

\n-
\n-void set_creator (char const* str);\n-
\n-

Sets the creator of the torrent. The string str should be utf-8 encoded.\n-This is optional.

\n-[report issue]
\n-
\n-

set_creation_date()

\n-
\n-void set_creation_date (std::time_t timestamp);\n-
\n-

sets the "creation time" field. Defaults to the system clock at the\n-time of construction of the create_torrent object. The timestamp is\n-specified in seconds, posix time. If the creation date is set to 0,\n-the "creation date" field will be omitted from the generated torrent.

\n-[report issue]
\n-
\n-

set_hash()

\n-
\n-void set_hash (piece_index_t index, sha1_hash const& h);\n-
\n-

This sets the SHA-1 hash for the specified piece (index). You are required\n-to set the hash for every piece in the torrent before generating it. If you have\n-the files on disk, you can use the high level convenience function to do this.\n-See set_piece_hashes().\n-A SHA-1 hash of all zeros is internally used to indicate a hash that\n-has not been set. Setting such hash will not be considered set when\n-calling generate().\n-This function will throw std::system_error if it is called on an\n-object constructed with the v2_only flag.

\n-[report issue]
\n-
\n-

set_hash2()

\n-
\n-void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);\n-
\n-

sets the bittorrent v2 hash for file file of the piece piece.\n-piece is relative to the first piece of the file, starting at 0. The\n-first piece in the file can be computed with\n-file_storage::file_index_at_piece().\n-The hash, h, is the root of the merkle tree formed by the piece's\n-16 kiB blocks. Note that piece sizes must be powers-of-2, so all\n-per-piece merkle trees are complete.\n-A SHA-256 hash of all zeros is internally used to indicate a hash\n-that has not been set. Setting such hash will not be considered set\n-when calling generate().\n-This function will throw std::system_error if it is called on an\n-object constructed with the v1_only flag.

\n-\n-[report issue]
\n-
\n-

add_url_seed() add_http_seed()

\n-
\n-void add_url_seed (string_view url);\n-void add_http_seed (string_view url);\n-
\n-

This adds a url seed to the torrent. You can have any number of url seeds. For a\n-single file torrent, this should be an HTTP url, pointing to a file with identical\n-content as the file of the torrent. For a multi-file torrent, it should point to\n-a directory containing a directory with the same name as this torrent, and all the\n-files of the torrent in it.

\n-

The second function, add_http_seed() adds an HTTP seed instead.

\n-[report issue]
\n-
\n-

add_node()

\n-
\n-void add_node (std::pair<std::string, int> node);\n-
\n-

This adds a DHT node to the torrent. This especially useful if you're creating a\n-tracker less torrent. It can be used by clients to bootstrap their DHT node from.\n-The node is a hostname and a port number where there is a DHT node running.\n-You can have any number of DHT nodes in a torrent.

\n-[report issue]
\n-
\n-

add_tracker()

\n-
\n-void add_tracker (string_view url, int tier = 0);\n-
\n-

Adds a tracker to the torrent. This is not strictly required, but most torrents\n-use a tracker as their main source of peers. The url should be an http:// or udp://\n-url to a machine running a bittorrent tracker that accepts announces for this torrent's\n-info-hash. The tier is the fallback priority of the tracker. All trackers with tier 0 are\n-tried first (in any order). If all fail, trackers with tier 1 are tried. If all of those\n-fail, trackers with tier 2 are tried, and so on.

\n-[report issue]
\n-
\n-

set_root_cert()

\n+

For more information, see peer classes.

\n+[report issue]
\n+
\n+

create_peer_class()

\n
\n-void set_root_cert (string_view cert);\n+peer_class_t create_peer_class (char const* name);\n 
\n-

This function sets an X.509 certificate in PEM format to the torrent. This makes the\n-torrent an SSL torrent. An SSL torrent requires that each peer has a valid certificate\n-signed by this root certificate. For SSL torrents, all peers are connecting over SSL\n-connections. For more information, see the section on ssl torrents.

\n-

The string is not the path to the cert, it's the actual content of the\n-certificate.

\n-\n-[report issue]
\n-
\n-

priv() set_priv()

\n+

Creates a new peer class (see peer classes) with the given name. The\n+returned integer is the new peer class identifier. Peer classes may\n+have the same name, so each invocation of this function creates a new\n+class and returns a unique identifier.

\n+

Identifiers are assigned from low numbers to higher. So if you plan on\n+using certain peer classes in a call to set_peer_class_filter(),\n+make sure to create those early on, to get low identifiers.

\n+

For more information on peer classes, see peer classes.

\n+[report issue]
\n+
\n+

delete_peer_class()

\n
\n-void set_priv (bool p);\n-bool priv () const;\n+void delete_peer_class (peer_class_t cid);\n 
\n-

Sets and queries the private flag of the torrent.\n-Torrents with the private flag set ask the client to not use any other\n-sources than the tracker for peers, and to not use DHT to advertise itself publicly,\n-only the tracker.

\n-[report issue]
\n-
\n-

num_pieces()

\n+

This call dereferences the reference count of the specified peer\n+class. When creating a peer class it's automatically referenced by 1.\n+If you want to recycle a peer class, you may call this function. You\n+may only call this function once per peer class you create.\n+Calling it more than once for the same class will lead to memory\n+corruption.

\n+

Since peer classes are reference counted, this function will not\n+remove the peer class if it's still assigned to torrents or peers. It\n+will however remove it once the last peer and torrent drops their\n+references to it.

\n+

There is no need to call this function for custom peer classes. All\n+peer classes will be properly destructed when the session object\n+destructs.

\n+

For more information on peer classes, see peer classes.

\n+\n+[report issue]
\n+
\n+

set_peer_class() get_peer_class()

\n
\n-int num_pieces () const;\n+void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n+peer_class_info get_peer_class (peer_class_t cid) const;\n 
\n-

returns the number of pieces in the associated file_storage object.

\n-[report issue]
\n-
\n-

piece_range()

\n+

These functions queries information from a peer class and updates the\n+configuration of a peer class, respectively.

\n+

cid must refer to an existing peer class. If it does not, the\n+return value of get_peer_class() is undefined.

\n+

set_peer_class() sets all the information in the\n+peer_class_info object in the specified peer class. There is no\n+option to only update a single property.

\n+

A peer or torrent belonging to more than one class, the highest\n+priority among any of its classes is the one that is taken into\n+account.

\n+

For more information, see peer classes.

\n+[report issue]
\n+
\n+

remove_torrent()

\n
\n-index_range<piece_index_t> piece_range () const noexcept;\n+void remove_torrent (const torrent_handle&, remove_flags_t = {});\n 
\n-

all piece indices in the torrent to be created

\n-[report issue]
\n-
\n-

file_range()

\n+

remove_torrent() will close all peer connections associated with\n+the torrent and tell the tracker that we've stopped participating in\n+the swarm. This operation cannot fail. When it completes, you will\n+receive a torrent_removed_alert.

\n+

remove_torrent() is non-blocking, but will remove the torrent from the\n+session synchronously. Calling session_handle::add_torrent() immediately\n+afterward with the same torrent will succeed. Note that this creates a\n+new handle which is not equal to the removed one.

\n+

The optional second argument options can be used to delete all the\n+files downloaded by this torrent. To do so, pass in the value\n+session_handle::delete_files. Once the torrent is deleted, a\n+torrent_deleted_alert is posted.

\n+

The torrent_handle remains valid for some time after remove_torrent() is\n+called. It will become invalid only after all libtorrent tasks (such as\n+I/O tasks) release their references to the torrent. Until this happens,\n+torrent_handle::is_valid() will return true, and other calls such\n+as torrent_handle::status() will succeed. Because of this, and because\n+remove_torrent() is non-blocking, the following sequence usually\n+succeeds (does not throw system_error):\n+.. code:: c++

\n+
\n+session.remove_handle(handle);\n+handle.save_resume_data();
\n+

Note that when a queued or downloading torrent is removed, its position\n+in the download queue is vacated and every subsequent torrent in the\n+queue has their queue positions updated. This can potentially cause a\n+large state_update to be posted. When removing all torrents, it is\n+advised to remove them from the back of the queue, to minimize the\n+shifting.

\n+\n+[report issue]
\n+
\n+

get_settings() apply_settings()

\n
\n-index_range<file_index_t> file_range () const noexcept;\n+void apply_settings (settings_pack&&);\n+settings_pack get_settings () const;\n+void apply_settings (settings_pack const&);\n 
\n-

all file indices in the torrent to be created

\n-[report issue]
\n-
\n-

file_piece_range()

\n+

Applies the settings specified by the settings_pack s. This is an\n+asynchronous operation that will return immediately and actually apply\n+the settings to the main thread of libtorrent some time later.

\n+\n+\n+[report issue]
\n+
\n+

wait_for_alert() set_alert_notify() pop_alerts()

\n
\n-index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);\n+alert* wait_for_alert (time_duration max_wait);\n+void set_alert_notify (std::function<void()> const& fun);\n+void pop_alerts (std::vector<alert*>* alerts);\n 
\n-

for v2 and hybrid torrents only, the pieces in the\n-specified file, specified as delta from the first piece in the file.\n-i.e. the first index is 0.

\n-[report issue]
\n-
\n-

total_size()

\n+

Alerts is the main mechanism for libtorrent to report errors and\n+events. pop_alerts fills in the vector passed to it with pointers\n+to new alerts. The session still owns these alerts and they will stay\n+valid until the next time pop_alerts is called. You may not delete\n+the alert objects.

\n+

It is safe to call pop_alerts from multiple different threads, as\n+long as the alerts themselves are not accessed once another thread\n+calls pop_alerts. Doing this requires manual synchronization\n+between the popping threads.

\n+

wait_for_alert will block the current thread for max_wait time\n+duration, or until another alert is posted. If an alert is available\n+at the time of the call, it returns immediately. The returned alert\n+pointer is the head of the alert queue. wait_for_alert does not\n+pop alerts from the queue, it merely peeks at it. The returned alert\n+will stay valid until pop_alerts is called twice. The first time\n+will pop it and the second will free it.

\n+

If there is no alert in the queue and no alert arrives within the\n+specified timeout, wait_for_alert returns nullptr.

\n+

In the python binding, wait_for_alert takes the number of\n+milliseconds to wait as an integer.

\n+

The alert queue in the session will not grow indefinitely. Make sure\n+to pop periodically to not miss notifications. To control the max\n+number of alerts that's queued by the session, see\n+settings_pack::alert_queue_size.

\n+

Some alerts are considered so important that they are posted even when\n+the alert queue is full. Some alerts are considered mandatory and cannot\n+be disabled by the alert_mask. For instance,\n+save_resume_data_alert and save_resume_data_failed_alert are always\n+posted, regardless of the alert mask.

\n+

To control which alerts are posted, set the alert_mask\n+(settings_pack::alert_mask).

\n+

If the alert queue fills up to the point where alerts are dropped, this\n+will be indicated by a alerts_dropped_alert, which contains a bitmask\n+of which types of alerts were dropped. Generally it is a good idea to\n+make sure the alert queue is large enough, the alert_mask doesn't have\n+unnecessary categories enabled and to call pop_alert() frequently, to\n+avoid alerts being dropped.

\n+

the set_alert_notify function lets the client set a function object\n+to be invoked every time the alert queue goes from having 0 alerts to\n+1 alert. This function is called from within libtorrent, it may be the\n+main thread, or it may be from within a user call. The intention of\n+of the function is that the client wakes up its main thread, to poll\n+for more alerts using pop_alerts(). If the notify function fails\n+to do so, it won't be called again, until pop_alerts is called for\n+some other reason. For instance, it could signal an eventfd, post a\n+message to an HWND or some other main message pump. The actual\n+retrieval of alerts should not be done in the callback. In fact, the\n+callback should not block. It should not perform any expensive work.\n+It really should just notify the main application thread.

\n+

The type of an alert is returned by the polymorphic function\n+alert::type() but can also be queries from a concrete type via\n+T::alert_type, as a static constant.

\n+\n+[report issue]
\n+
\n+

add_port_mapping() delete_port_mapping()

\n
\n-std::int64_t total_size () const;\n+void delete_port_mapping (port_mapping_t handle);\n+std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);\n 
\n-

the total number of bytes of all files and pad files

\n-\n-[report issue]
\n-
\n-

piece_size() piece_length()

\n+

add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,\n+whichever is enabled. A mapping is created for each listen socket\n+in the session. The return values are all handles referring to the\n+port mappings that were just created. Pass them to delete_port_mapping()\n+to remove them.

\n+[report issue]
\n+
\n+

reopen_network_sockets()

\n
\n-int piece_length () const;\n-int piece_size (piece_index_t i) const;\n+void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);\n 
\n-

piece_length() returns the piece size of all pieces but the\n-last one. piece_size() returns the size of the specified piece.\n-these functions are just forwarding to the associated file_storage.

\n-\n-[report issue]
\n-
\n-

add_similar_torrent() add_collection()

\n+

Instructs the session to reopen all listen and outgoing sockets.

\n+

It's useful in the case your platform doesn't support the built in\n+IP notifier mechanism, or if you have a better more reliable way to\n+detect changes in the IP routing table.

\n+[report issue]
\n+
\n+

native_handle()

\n
\n-void add_collection (string_view c);\n-void add_similar_torrent (sha1_hash ih);\n+std::shared_ptr<aux::session_impl> native_handle () const;\n 
\n-

Add similar torrents (by info-hash) or collections of similar torrents.\n-Similar torrents are expected to share some files with this torrent.\n-Torrents sharing a collection name with this torrent are also expected\n-to share files with this torrent. A torrent may have more than one\n-collection and more than one similar torrents. For more information,\n-see BEP 38.

\n-[report issue]
\n-
modification_time
\n-
This will include the file modification time as part of the torrent.\n-This is not enabled by default, as it might cause problems when you\n-create a torrent from separate files with the same content, hoping to\n-yield the same info-hash. If the files have different modification times,\n-with this option enabled, you would get different info-hashes for the\n-files.
\n+

This function is intended only for use by plugins. This type does\n+not have a stable API and should be relied on as little as possible.

\n+[report issue]
\n+
save_settings
\n+
saves settings (i.e. the settings_pack)
\n
\n-[report issue]
\n-
symlinks
\n-
If this flag is set, files that are symlinks get a symlink attribute\n-set on them and their data will not be included in the torrent. This\n-is useful if you need to reconstruct a file hierarchy which contains\n-symlinks.
\n+[report issue]
\n+
save_dht_state
\n+
saves dht state such as nodes and node-id, possibly accelerating\n+joining the DHT if provided at next session startup.
\n
\n-[report issue]
\n-
v2_only
\n-
Do not generate v1 metadata. The resulting torrent will only be usable by\n-clients which support v2. This requires setting all v2 hashes, with\n-set_hash2() before calling generate(). Setting v1 hashes (with\n-set_hash()) is an error with this flag set.
\n+[report issue]
\n+
save_extension_state
\n+
load or save state from plugins
\n
\n-[report issue]
\n-
v1_only
\n-
do not generate v2 metadata or enforce v2 alignment and padding rules\n-this is mainly for tests, not recommended for production use. This\n-requires setting all v1 hashes, with set_hash(), before calling\n-generate(). Setting v2 hashes (with set_hash2()) is an error with\n-this flag set.
\n+[report issue]
\n+
save_ip_filter
\n+
load or save the IP filter set on the session
\n
\n-[report issue]
\n-
canonical_files
\n-
This flag only affects v1-only torrents, and is only relevant\n-together with the v1_only_flag. This flag will force the\n-same file order and padding as a v2 (or hybrid) torrent would have.\n-It has the effect of ordering files and inserting pad files to align\n-them with piece boundaries.
\n+\n+\n+[report issue]
\n+
global_peer_class_id tcp_peer_class_id local_peer_class_id
\n+
built-in peer classes
\n
\n-[report issue]
\n-
no_attributes
\n-
passing this flag to add_files() will ignore file attributes (such as\n-executable or hidden) when adding the files to the file storage.\n-Since not all filesystems and operating systems support all file\n-attributes the resulting torrent may differ depending on where it's\n-created. If it's important for torrents to be created consistently\n-across systems, this flag should be set.
\n+[report issue]
\n+
delete_files
\n+
delete the files belonging to the torrent from disk.\n+including the part-file, if there is one
\n
\n-[report issue]
\n-
canonical_files_no_tail_padding
\n-
this flag enforces the file layout to be canonical according to the\n-bittorrent v2 specification (just like the canonical_files flag)\n-with the one exception that tail padding is not added to the last\n-file.\n-This behavior deviates from the specification but was the way\n-libtorrent created torrents in version up to and including 2.0.7.\n-This flag is here for backwards compatibility.
\n+[report issue]
\n+
delete_partfile
\n+
delete just the part-file associated with this torrent
\n
\n-[report issue]
\n+[report issue]
\n+
paused
\n+
when set, the session will start paused. Call\n+session_handle::resume() to start
\n+
\n+\n+[report issue]
\n+
udp tcp
\n+
protocols used by add_port_mapping()
\n+
\n+[report issue]
\n+
reopen_map_ports
\n+
This option indicates if the ports are mapped using natpmp\n+and upnp. If mapping was already made, they are deleted and added\n+again. This only works if natpmp and/or upnp are configured to be\n+enable.
\n+
\n+\n+\n+[report issue]
\n
\n-
\n-

add_files()

\n-

Declared in "libtorrent/create_torrent.hpp"

\n-
\n-void add_files (file_storage& fs, std::string const& file\n-   , create_flags_t flags = {});\n-void add_files (file_storage& fs, std::string const& file\n-   , std::function<bool(std::string)> p, create_flags_t flags = {});\n-
\n-

Adds the file specified by path to the file_storage object. In case path\n-refers to a directory, files will be added recursively from the directory.

\n-

If specified, the predicate p is called once for every file and directory that\n-is encountered. Files for which p returns true are added, and directories for\n-which p returns true are traversed. p must have the following signature:

\n-
\n-bool Pred(std::string const& p);\n-
\n-

The path that is passed in to the predicate is the full path of the file or\n-directory. If no predicate is specified, all files are added, and all directories\n-are traversed.

\n-

The ".." directory is never traversed.

\n-

The flags argument should be the same as the flags passed to the create_torrent\n-constructor.

\n-[report issue]
\n-
\n-

set_piece_hashes()

\n-

Declared in "libtorrent/create_torrent.hpp"

\n-
\n-inline void set_piece_hashes (create_torrent& t, std::string const& p);\n-void set_piece_hashes (create_torrent& t, std::string const& p\n-   , settings_interface const& settings\n-   , std::function<void(piece_index_t)> const& f, error_code& ec);\n-inline void set_piece_hashes (create_torrent& t, std::string const& p\n-   , settings_interface const& settings\n-   , std::function<void(piece_index_t)> const& f);\n-void set_piece_hashes (create_torrent& t, std::string const& p\n-   , settings_interface const& settings, disk_io_constructor_type disk_io\n-   , std::function<void(piece_index_t)> const& f, error_code& ec);\n-void set_piece_hashes (create_torrent& t, std::string const& p\n-   , std::function<void(piece_index_t)> const& f, error_code& ec);\n-inline void set_piece_hashes (create_torrent& t, std::string const& p, error_code& ec);\n-inline void set_piece_hashes (create_torrent& t, std::string const& p\n-   , std::function<void(piece_index_t)> const& f);\n-
\n-

This function will assume that the files added to the torrent file exists at path\n-p, read those files and hash the content and set the hashes in the create_torrent\n-object. The optional function f is called in between every hash that is set. f\n-must have the following signature:

\n-
\n-void Fun(piece_index_t);\n-
\n-

The overloads taking a settings_pack may be used to configure the\n-underlying disk access. Such as settings_pack::aio_threads.

\n-

The overloads that don't take an error_code& may throw an exception in case of a\n-file error, the other overloads sets the error code to reflect the error, if any.

\n-[report issue]
\n-
\n-

piece_block

\n-

Declared in "libtorrent/piece_block.hpp"

\n+
\n+

write_session_params() write_session_params_buf() read_session_params()

\n+

Declared in "libtorrent/session_params.hpp"

\n
\n-struct piece_block\n-{\n-   piece_block (piece_index_t p_index, int b_index);\n-   piece_block () = default;\n-   bool operator< (piece_block const& b) const;\n-   bool operator== (piece_block const& b) const;\n-   bool operator!= (piece_block const& b) const;\n-\n-   static const piece_block invalid;\n-   piece_index_t piece_index {0};\n-   int block_index  = 0;\n-};\n+std::vector<char> write_session_params_buf (session_params const& sp\n+   , save_state_flags_t flags = save_state_flags_t::all());\n+entry write_session_params (session_params const& sp\n+   , save_state_flags_t flags = save_state_flags_t::all());\n+session_params read_session_params (span<char const> buf\n+   , save_state_flags_t flags = save_state_flags_t::all());\n+session_params read_session_params (bdecode_node const& e\n+   , save_state_flags_t flags = save_state_flags_t::all());\n 
\n+

These functions serialize and de-serialize a session_params object to and\n+from bencoded form. The session_params object is used to initialize a new\n+session using the state from a previous one (or by programmatically configure\n+the session up-front).\n+The flags parameter can be used to only save and load certain aspects of the\n+session's state.\n+The _buf suffix indicates the function operates on buffer rather than the\n+bencoded structure.\n+The torrents in a session are not part of the session_params state, they have\n+to be restored separately.

\n [report issue]
\n
\n

info_hash_t

\n

Declared in "libtorrent/info_hash.hpp"

\n

class holding the info-hash of a torrent. It can hold a v1 info-hash\n (SHA-1) or a v2 info-hash (SHA-256) or both.

\n
\n

Note

\n

If has_v2() is false then the v1 hash might actually be a truncated\n v2 hash

\n
\n
\n struct info_hash_t\n {\n-   explicit info_hash_t (sha256_hash h2) noexcept;\n+   info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n    explicit info_hash_t (sha1_hash h1) noexcept;\n+   explicit info_hash_t (sha256_hash h2) noexcept;\n    info_hash_t () noexcept = default;\n-   info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n-   bool has_v2 () const;\n-   bool has_v1 () const;\n    bool has (protocol_version v) const;\n+   bool has_v1 () const;\n+   bool has_v2 () const;\n    sha1_hash get (protocol_version v) const;\n    sha1_hash get_best () const;\n    friend bool operator!= (info_hash_t const& lhs, info_hash_t const& rhs);\n    friend bool operator== (info_hash_t const& lhs, info_hash_t const& rhs) noexcept;\n    template <typename F> void for_each (F f) const;\n    bool operator< (info_hash_t const& o) const;\n    friend std::ostream& operator<< (std::ostream& os, info_hash_t const& ih);\n@@ -4208,33 +1858,33 @@\n    sha1_hash v1;\n    sha256_hash v2;\n };\n 
\n [report issue]
\n

info_hash_t()

\n
\n-explicit info_hash_t (sha256_hash h2) noexcept;\n+info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n explicit info_hash_t (sha1_hash h1) noexcept;\n+explicit info_hash_t (sha256_hash h2) noexcept;\n info_hash_t () noexcept = default;\n-info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n 
\n

The default constructor creates an object that has neither a v1 or v2\n hash.

\n

For backwards compatibility, make it possible to construct directly\n from a v1 hash. This constructor allows implicit conversion from a\n v1 hash, but the implicitness is deprecated.

\n \n-\n-[report issue]
\n-
\n-

has() has_v2() has_v1()

\n+\n+[report issue]
\n+
\n+

has() has_v1() has_v2()

\n
\n-bool has_v2 () const;\n-bool has_v1 () const;\n bool has (protocol_version v) const;\n+bool has_v1 () const;\n+bool has_v2 () const;\n 
\n

returns true if the corresponding info hash is present in this\n object.

\n [report issue]
\n
\n

get()

\n
\n@@ -4732,14 +2382,32 @@\n [report issue]
\n
read_state write_state
\n
bitmasks indicating what state this peer\n is in with regards to sending and receiving data. The states are\n defined as independent flags of type bandwidth_state_flags_t, in this\n class.
\n
\n+[report issue]
\n+
\n+

piece_block

\n+

Declared in "libtorrent/piece_block.hpp"

\n+
\n+struct piece_block\n+{\n+   piece_block (piece_index_t p_index, int b_index);\n+   piece_block () = default;\n+   bool operator< (piece_block const& b) const;\n+   bool operator== (piece_block const& b) const;\n+   bool operator!= (piece_block const& b) const;\n+\n+   static const piece_block invalid;\n+   piece_index_t piece_index {0};\n+   int block_index  = 0;\n+};\n+
\n [report issue]
\n
\n

peer_request

\n

Declared in "libtorrent/peer_request.hpp"

\n

represents a byte range within a piece. Internally this is is used for\n incoming piece requests.

\n
\n@@ -4748,15 +2416,15 @@\n    bool operator== (peer_request const& r) const;\n \n    piece_index_t piece;\n    int start;\n    int length;\n };\n 
\n-[report issue]
\n+[report issue]
\n

operator==()

\n
\n bool operator== (peer_request const& r) const;\n 
\n

returns true if the right hand side peer_request refers to the same\n range as this does.

\n [report issue]
\n@@ -4767,23 +2435,65 @@\n
start
\n
The byte offset within that piece where the range starts.
\n
\n [report issue]
\n
length
\n
The size of the range, in bytes.
\n
\n-[report issue]
\n+\n+\n+[report issue]
\n
\n+
\n+

load_torrent_file() load_torrent_parsed() load_torrent_buffer()

\n+

Declared in "libtorrent/load_torrent.hpp"

\n+
\n+add_torrent_params load_torrent_buffer (\n+   span<char const> buffer, load_torrent_limits const& cfg);\n+add_torrent_params load_torrent_file (\n+   std::string const& filename, load_torrent_limits const& cfg);\n+add_torrent_params load_torrent_file (\n+   std::string const& filename);\n+add_torrent_params load_torrent_parsed (\n+   bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n+add_torrent_params load_torrent_buffer (\n+   span<char const> buffer);\n+add_torrent_params load_torrent_parsed (\n+   bdecode_node const& torrent_file);\n+
\n+

These functions load the content of a .torrent file into an\n+add_torrent_params object.\n+The immutable part of a torrent file (the info-dictionary) is stored in\n+the ti field in the add_torrent_params object (as a torrent_info\n+object).\n+The returned object is suitable to be:

\n+
\n+\n+
\n+[report issue]
\n+
\n+

truncate_files()

\n+

Declared in "libtorrent/truncate.hpp"

\n+
\n+void truncate_files (file_storage const& fs, std::string const& save_path, storage_error& ec);\n+
\n+

Truncates files larger than specified in the file_storage, saved under\n+the specified save_path.

\n+[report issue]
\n
\n

make_magnet_uri()

\n

Declared in "libtorrent/magnet_uri.hpp"

\n
\n-std::string make_magnet_uri (torrent_handle const& handle);\n-std::string make_magnet_uri (add_torrent_params const& atp);\n std::string make_magnet_uri (torrent_info const& info);\n+std::string make_magnet_uri (add_torrent_params const& atp);\n+std::string make_magnet_uri (torrent_handle const& handle);\n 
\n

Generates a magnet URI from the specified torrent.

\n

Several fields from the add_torrent_params objects are recorded in the\n magnet link. In order to not include them, they have to be cleared before\n calling make_magnet_uri(). These fields are used:

\n
\n ti, info_hashes, url_seeds, dht_nodes,\n@@ -4803,100 +2513,58 @@\n an empty string is returned.

\n

For more information about magnet links, see magnet links.

\n [report issue]
\n
\n

parse_magnet_uri()

\n

Declared in "libtorrent/magnet_uri.hpp"

\n
\n-add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);\n add_torrent_params parse_magnet_uri (string_view uri);\n void parse_magnet_uri (string_view uri, add_torrent_params& p, error_code& ec);\n+add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);\n 
\n

This function parses out information from the magnet link and populates the\n add_torrent_params object. The overload that does not take an\n error_code reference will throw a system_error on error\n The overload taking an add_torrent_params reference will fill in the\n fields specified in the magnet URI.

\n-\n-\n-[report issue]
\n-
\n-

load_torrent_buffer() load_torrent_parsed() load_torrent_file()

\n-

Declared in "libtorrent/load_torrent.hpp"

\n-
\n-add_torrent_params load_torrent_buffer (\n-   span<char const> buffer);\n-add_torrent_params load_torrent_buffer (\n-   span<char const> buffer, load_torrent_limits const& cfg);\n-add_torrent_params load_torrent_file (\n-   std::string const& filename, load_torrent_limits const& cfg);\n-add_torrent_params load_torrent_parsed (\n-   bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n-add_torrent_params load_torrent_file (\n-   std::string const& filename);\n-add_torrent_params load_torrent_parsed (\n-   bdecode_node const& torrent_file);\n-
\n-

These functions load the content of a .torrent file into an\n-add_torrent_params object.\n-The immutable part of a torrent file (the info-dictionary) is stored in\n-the ti field in the add_torrent_params object (as a torrent_info\n-object).\n-The returned object is suitable to be:

\n-
\n-\n-
\n [report issue]
\n
\n

version()

\n

Declared in "libtorrent/version.hpp"

\n
\n char const* version ();\n 
\n

returns the libtorrent version as string form in this format:\n "<major>.<minor>.<tiny>.<tag>"

\n-[report issue]
\n-
\n-

truncate_files()

\n-

Declared in "libtorrent/truncate.hpp"

\n-
\n-void truncate_files (file_storage const& fs, std::string const& save_path, storage_error& ec);\n-
\n-

Truncates files larger than specified in the file_storage, saved under\n-the specified save_path.

\n-[report issue]
\n-
\n-

enum connection_type

\n-

Declared in "libtorrent/peer_connection.hpp"

\n+[report issue]
\n+
\n+

enum protocol_version

\n+

Declared in "libtorrent/info_hash.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n \n \n \n
namevaluedescription
bittorrent
V10 The original BitTorrent version, using SHA-1 hashes
url_seed
V21 Version 2 of the BitTorrent protocol, using SHA-256 hashes
http_seed
NUM2 
\n [report issue]
\n
\n@@ -4933,14 +2601,45 @@\n \n paused\n 4\n  \n \n \n \n+[report issue]
\n+
\n+

enum connection_type

\n+

Declared in "libtorrent/peer_connection.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
bittorrent0 
url_seed1 
http_seed2 
\n [report issue]
\n
\n

enum socket_type_t

\n

Declared in "libtorrent/socket_type.hpp"

\n \n \n \n@@ -5046,45 +2745,14 @@\n \n \n \n \n \n \n
udp2 
\n-[report issue]
\n-
\n-

enum protocol_version

\n-

Declared in "libtorrent/info_hash.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
V10The original BitTorrent version, using SHA-1 hashes
V21Version 2 of the BitTorrent protocol, using SHA-256 hashes
NUM2 
\n [report issue]
\n
\n

download_priority_t

\n

Declared in "libtorrent/download_priority.hpp"

\n
\n
dont_download
\n
Don't download the file or piece. Partial pieces may still be downloaded when\n@@ -5098,14 +2766,57 @@\n
low_priority
\n
The lowest priority for files and pieces.
\n
\n
\n
top_priority
\n
The highest priority for files and pieces.
\n
\n+[report issue]
\n+
\n+

pex_flags_t

\n+

Declared in "libtorrent/pex_flags.hpp"

\n+
\n+
pex_encryption
\n+
the peer supports protocol encryption
\n+
\n+
\n+
pex_seed
\n+
the peer is a seed
\n+
\n+
\n+
pex_utp
\n+
the peer supports the uTP, transport protocol over UDP.
\n+
\n+
\n+
pex_holepunch
\n+
the peer supports the holepunch extension If this flag is received from a\n+peer, it can be used as a rendezvous point in case direct connections to\n+the peer fail
\n+
\n+
\n+
pex_lt_v2
\n+
protocol v2\n+this is not a standard flag, it is only used internally
\n+
\n+[report issue]
\n+
\n+

int

\n+

Declared in "libtorrent/version.hpp"

\n+
\n+
version_major
\n+
the major, minor and tiny versions of libtorrent
\n+
\n+
\n+
version_minor
\n+
the major, minor and tiny versions of libtorrent
\n+
\n+
\n+
version_tiny
\n+
the major, minor and tiny versions of libtorrent
\n+
\n [report issue]
\n
\n

torrent_flags_t

\n

Declared in "libtorrent/torrent_flags.hpp"

\n
\n
seed_mode
\n

If seed_mode is set, libtorrent will assume that all files\n@@ -5234,15 +2945,15 @@\n stop-when-ready immediately.

\n

When the stop-when-ready logic fires, the flag is cleared. Any\n subsequent transitions between downloading and non-downloading states\n will not be affected, until this flag is set again.

\n

The behavior is more robust when setting this flag as part of adding\n the torrent. See add_torrent_params.

\n

The stop-when-ready flag fixes the inherent race condition of waiting\n-for the state_changed_alert and then call pause(). The download/seeding\n+for the state_changed_alert and then call pause(). The download/seeding\n will most likely start in between posting the alert and receiving the\n call to pause.

\n

A downloading state is one where peers are being connected. Which means\n just downloading the metadata via the ut_metadata extension counts\n as a downloading state. In order to stop a torrent once the metadata\n has been downloaded, instead set all file priorities to dont_download

\n
\n@@ -5317,30 +3028,14 @@\n (dont_download).\n
\n
\n
all
\n
all torrent flags combined. Can conveniently be used when creating masks\n for flags
\n
\n-[report issue]
\n-
\n-

int

\n-

Declared in "libtorrent/version.hpp"

\n-
\n-
version_major
\n-
the major, minor and tiny versions of libtorrent
\n-
\n-
\n-
version_minor
\n-
the major, minor and tiny versions of libtorrent
\n-
\n-
\n-
version_tiny
\n-
the major, minor and tiny versions of libtorrent
\n-
\n [report issue]
\n
\n

char const*

\n

Declared in "libtorrent/version.hpp"

\n
\n
version_str
\n
the libtorrent version in string form
\n@@ -5349,919 +3044,1606 @@\n
\n

std::uint64_t

\n

Declared in "libtorrent/version.hpp"

\n
\n
version_revision
\n
the git commit of this libtorrent version
\n
\n-[report issue]
\n-
\n-

pex_flags_t

\n-

Declared in "libtorrent/pex_flags.hpp"

\n-
\n-
pex_encryption
\n-
the peer supports protocol encryption
\n+[report issue]
\n+
\n+

add_torrent_params

\n+

Declared in "libtorrent/add_torrent_params.hpp"

\n+

The add_torrent_params contains all the information in a .torrent file\n+along with all information necessary to add that torrent to a session.\n+The key fields when adding a torrent are:

\n+
    \n+
  • ti - the immutable info-dict part of the torrent
  • \n+
  • info_hash - when you don't have the metadata (.torrent file). This\n+uniquely identifies the torrent and can validate the info-dict when\n+received from the swarm.
  • \n+
\n+

In order to add a torrent to a session, one of those fields must be set\n+in addition to save_path. The add_torrent_params object can then be\n+passed into one of the session::add_torrent() overloads or\n+session::async_add_torrent().

\n+

If you only specify the info-hash, the torrent file will be downloaded\n+from peers, which requires them to support the metadata extension. For\n+the metadata extension to work, libtorrent must be built with extensions\n+enabled (TORRENT_DISABLE_EXTENSIONS must not be defined). It also\n+takes an optional name argument. This may be left empty in case no\n+name should be assigned to the torrent. In case it's not, the name is\n+used for the torrent as long as it doesn't have metadata. See\n+torrent_handle::name.

\n+

The add_torrent_params is also used when requesting resume data for a\n+torrent. It can be saved to and restored from a file and added back to a\n+new session. For serialization and de-serialization of\n+add_torrent_params objects, see read_resume_data() and\n+write_resume_data().

\n+

The add_torrent_params is also used to represent a parsed .torrent\n+file. It can be loaded via load_torrent_file(), load_torrent_buffer() and\n+load_torrent_parsed(). It can be saved via write_torrent_file().

\n+
\n+struct add_torrent_params\n+{\n+   int version  = LIBTORRENT_VERSION_NUM;\n+   std::shared_ptr<torrent_info> ti;\n+   aux::noexcept_movable<std::vector<std::string>> trackers;\n+   aux::noexcept_movable<std::vector<int>> tracker_tiers;\n+   aux::noexcept_movable<std::vector<std::pair<std::string, int>>> dht_nodes;\n+   std::string name;\n+   std::string save_path;\n+   storage_mode_t storage_mode  = storage_mode_sparse;\n+   client_data_t userdata;\n+   aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;\n+   std::string trackerid;\n+   torrent_flags_t flags  = torrent_flags::default_flags;\n+   info_hash_t info_hashes;\n+   int max_uploads  = -1;\n+   int max_connections  = -1;\n+   int upload_limit  = -1;\n+   int download_limit  = -1;\n+   std::int64_t total_uploaded  = 0;\n+   std::int64_t total_downloaded  = 0;\n+   int active_time  = 0;\n+   int finished_time  = 0;\n+   int seeding_time  = 0;\n+   std::time_t added_time  = 0;\n+   std::time_t completed_time  = 0;\n+   std::time_t last_seen_complete  = 0;\n+   int num_complete  = -1;\n+   int num_incomplete  = -1;\n+   int num_downloaded  = -1;\n+   aux::noexcept_movable<std::vector<std::string>> http_seeds;\n+   aux::noexcept_movable<std::vector<std::string>> url_seeds;\n+   aux::noexcept_movable<std::vector<tcp::endpoint>> peers;\n+   aux::noexcept_movable<std::vector<tcp::endpoint>> banned_peers;\n+   aux::noexcept_movable<std::map<piece_index_t, bitfield>> unfinished_pieces;\n+   typed_bitfield<piece_index_t> have_pieces;\n+   typed_bitfield<piece_index_t> verified_pieces;\n+   aux::noexcept_movable<std::vector<download_priority_t>> piece_priorities;\n+   aux::vector<std::vector<sha256_hash>, file_index_t> merkle_trees;\n+   aux::vector<std::vector<bool>, file_index_t> merkle_tree_mask;\n+   aux::vector<std::vector<bool>, file_index_t> verified_leaf_hashes;\n+   aux::noexcept_movable<std::map<file_index_t, std::string>> renamed_files;\n+   std::time_t last_download  = 0;\n+   std::time_t last_upload  = 0;\n+};\n+
\n+[report issue]
\n+
version
\n+
filled in by the constructor and should be left untouched. It is used\n+for forward binary compatibility.
\n
\n-
\n-
pex_seed
\n-
the peer is a seed
\n+[report issue]
\n+
ti
\n+
torrent_info object with the torrent to add. Unless the\n+info_hash is set, this is required to be initialized.
\n
\n-
\n-
pex_utp
\n-
the peer supports the uTP, transport protocol over UDP.
\n+[report issue]
\n+
trackers
\n+
If the torrent doesn't have a tracker, but relies on the DHT to find\n+peers, the trackers can specify tracker URLs for the torrent.
\n
\n-
\n-
pex_holepunch
\n-
the peer supports the holepunch extension If this flag is received from a\n-peer, it can be used as a rendezvous point in case direct connections to\n-the peer fail
\n+[report issue]
\n+
tracker_tiers
\n+
the tiers the URLs in trackers belong to. Trackers belonging to\n+different tiers may be treated differently, as defined by the multi\n+tracker extension. This is optional, if not specified trackers are\n+assumed to be part of tier 0, or whichever the last tier was as\n+iterating over the trackers.
\n
\n-
\n-
pex_lt_v2
\n-
protocol v2\n-this is not a standard flag, it is only used internally
\n+[report issue]
\n+
dht_nodes
\n+
a list of hostname and port pairs, representing DHT nodes to be added\n+to the session (if DHT is enabled). The hostname may be an IP address.
\n
\n-[report issue]
\n-
\n-

ip_filter

\n-

Declared in "libtorrent/ip_filter.hpp"

\n-

The ip_filter class is a set of rules that uniquely categorizes all\n-ip addresses as allowed or disallowed. The default constructor creates\n-a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for\n-the IPv4 range, and the equivalent range covering all addresses for the\n-IPv6 range).

\n-

A default constructed ip_filter does not filter any address.

\n+[report issue]
\n+
name
\n+
in case there's no other name in this torrent, this name will be used.\n+The name out of the torrent_info object takes precedence if available.
\n+
\n+[report issue]
\n+
save_path
\n+

the path where the torrent is or will be stored.

\n+
\n+

Note

\n+

On windows this path (and other paths) are interpreted as UNC\n+paths. This means they must use backslashes as directory separators\n+and may not contain the special directories "." or "..".

\n+
\n+

Setting this to an absolute path performs slightly better than a\n+relative path.

\n+
\n+
\n+[report issue]
\n+
storage_mode
\n+
One of the values from storage_mode_t. For more information, see\n+storage allocation.
\n+
\n+[report issue]
\n+
userdata
\n+
The userdata parameter is optional and will be passed on to the\n+extension constructor functions, if any\n+(see torrent_handle::add_extension()). It will also be stored in the\n+torrent object and can be retrieved by calling userdata().
\n+
\n+[report issue]
\n+
file_priorities
\n+
can be set to control the initial file priorities when adding a\n+torrent. The semantics are the same as for\n+torrent_handle::prioritize_files(). The file priorities specified\n+in here take precedence over those specified in the resume data, if\n+any.\n+If this vector of file priorities is shorter than the number of files\n+in the torrent, the remaining files (not covered by this) will still\n+have the default download priority. This default can be changed by\n+setting the default_dont_download torrent_flag.
\n+
\n+[report issue]
\n+
trackerid
\n+
the default tracker id to be used when announcing to trackers. By\n+default this is empty, and no tracker ID is used, since this is an\n+optional argument. If a tracker returns a tracker ID, that ID is used\n+instead of this.
\n+
\n+[report issue]
\n+
flags
\n+

flags controlling aspects of this torrent and how it's added. See\n+torrent_flags_t for details.

\n+
\n+

Note

\n+

The flags field is initialized with default flags by the\n+constructor. In order to preserve default behavior when clearing or\n+setting other flags, make sure to bitwise OR or in a flag or bitwise\n+AND the inverse of a flag to clear it.

\n+
\n+
\n+
\n+[report issue]
\n+
info_hashes
\n+
set this to the info hash of the torrent to add in case the info-hash\n+is the only known property of the torrent. i.e. you don't have a\n+.torrent file nor a magnet link.\n+To add a magnet link, use parse_magnet_uri() to populate fields in the\n+add_torrent_params object.
\n+
\n+\n+[report issue]
\n+
max_uploads max_connections
\n+

max_uploads, max_connections, upload_limit,\n+download_limit correspond to the set_max_uploads(),\n+set_max_connections(), set_upload_limit() and\n+set_download_limit() functions on torrent_handle. These values let\n+you initialize these settings when the torrent is added, instead of\n+calling these functions immediately following adding it.

\n+

-1 means unlimited on these settings just like their counterpart\n+functions on torrent_handle

\n+

For fine grained control over rate limits, including making them apply\n+to local peers, see peer classes.

\n+
\n+
\n+\n+[report issue]
\n+
upload_limit download_limit
\n+
the upload and download rate limits for this torrent, specified in\n+bytes per second. -1 means unlimited.
\n+
\n+\n+[report issue]
\n+
total_uploaded total_downloaded
\n+
the total number of bytes uploaded and downloaded by this torrent so\n+far.
\n+
\n+\n+\n+[report issue]
\n+
active_time finished_time seeding_time
\n+
the number of seconds this torrent has spent in started, finished and\n+seeding state so far, respectively.
\n+
\n+\n+[report issue]
\n+
added_time completed_time
\n+
if set to a non-zero value, this is the posix time of when this torrent\n+was first added, including previous runs/sessions. If set to zero, the\n+internal added_time will be set to the time of when add_torrent() is\n+called.
\n+
\n+[report issue]
\n+
last_seen_complete
\n+
if set to non-zero, initializes the time (expressed in posix time) when\n+we last saw a seed or peers that together formed a complete copy of the\n+torrent. If left set to zero, the internal counterpart to this field\n+will be updated when we see a seed or a distributed copies >= 1.0.
\n+
\n+\n+\n+[report issue]
\n+
num_complete num_incomplete num_downloaded
\n+

these field can be used to initialize the torrent's cached scrape data.\n+The scrape data is high level metadata about the current state of the\n+swarm, as returned by the tracker (either when announcing to it or by\n+sending a specific scrape request). num_complete is the number of\n+peers in the swarm that are seeds, or have every piece in the torrent.\n+num_incomplete is the number of peers in the swarm that do not have\n+every piece. num_downloaded is the number of times the torrent has\n+been downloaded (not initiated, but the number of times a download has\n+completed).

\n+

Leaving any of these values set to -1 indicates we don't know, or we\n+have not received any scrape data.

\n+
\n+
\n+\n+[report issue]
\n+
http_seeds url_seeds
\n+

URLs can be added to these two lists to specify additional web\n+seeds to be used by the torrent. If the flag_override_web_seeds\n+is set, these will be the _only_ ones to be used. i.e. any web seeds\n+found in the .torrent file will be overridden.

\n+

http_seeds expects URLs to web servers implementing the original HTTP\n+seed specification BEP 17.

\n+

url_seeds expects URLs to regular web servers, aka "get right" style,\n+specified in BEP 19.

\n+
\n+
\n+[report issue]
\n+
peers
\n+
peers to add to the torrent, to be tried to be connected to as\n+bittorrent peers.
\n+
\n+[report issue]
\n+
banned_peers
\n+
peers banned from this torrent. The will not be connected to
\n+
\n+[report issue]
\n+
unfinished_pieces
\n+
this is a map of partially downloaded piece. The key is the piece index\n+and the value is a bitfield where each bit represents a 16 kiB block.\n+A set bit means we have that block.
\n+
\n+[report issue]
\n+
have_pieces
\n+
this is a bitfield indicating which pieces we already have of this\n+torrent.
\n+
\n+[report issue]
\n+
verified_pieces
\n+
when in seed_mode, pieces with a set bit in this bitfield have been\n+verified to be valid. Other pieces will be verified the first time a\n+peer requests it.
\n+
\n+[report issue]
\n+
piece_priorities
\n+
this sets the priorities for each individual piece in the torrent. Each\n+element in the vector represent the piece with the same index. If you\n+set both file- and piece priorities, file priorities will take\n+precedence.
\n+
\n+[report issue]
\n+
merkle_trees
\n+
v2 hashes, if known
\n+
\n+[report issue]
\n+
merkle_tree_mask
\n+
if set, indicates which hashes are included in the corresponding\n+vector of merkle_trees. These bitmasks always cover the full\n+tree, a cleared bit means the hash is all zeros (i.e. not set) and\n+set bit means the next hash in the corresponding vector in\n+merkle_trees is the hash for that node. This is an optimization\n+to avoid storing a lot of zeros.
\n+
\n+[report issue]
\n+
verified_leaf_hashes
\n+
bit-fields indicating which v2 leaf hashes have been verified\n+against the root hash. If this vector is empty and merkle_trees is\n+non-empty it implies that all hashes in merkle_trees are verified.
\n+
\n+[report issue]
\n+
renamed_files
\n+
this is a map of file indices in the torrent and new filenames to be\n+applied before the torrent is added.
\n+
\n+\n+[report issue]
\n+
last_download last_upload
\n+
the posix time of the last time payload was received or sent for this\n+torrent, respectively.
\n+
\n+[report issue]
\n+
\n+

client_data_t

\n+

Declared in "libtorrent/client_data.hpp"

\n+

A thin wrapper around a void pointer used as "user data". i.e. an opaque\n+cookie passed in to libtorrent and returned on demand. It adds type-safety by\n+requiring the same type be requested out of it as was assigned to it.

\n
\n-struct ip_filter\n+struct client_data_t\n {\n-   ip_filter ();\n-   ip_filter (ip_filter&&);\n-   ip_filter& operator= (ip_filter const&);\n-   ip_filter& operator= (ip_filter&&);\n-   ip_filter (ip_filter const&);\n-   ~ip_filter ();\n-   bool empty () const;\n-   void add_rule (address const& first, address const& last, std::uint32_t flags);\n-   std::uint32_t access (address const& addr) const;\n-   filter_tuple_t export_filter () const;\n+   client_data_t () = default;\n+   explicit client_data_t (T* v);\n+   client_data_t& operator= (T* v);\n+   explicit operator T () const;\n+   T* get () const;\n+   client_data_t& operator= (void*) = delete;\n+   operator void const* () const = delete;\n+   client_data_t& operator= (void const*) = delete;\n+   operator void* () const = delete;\n \n-   enum access_flags\n-   {\n-      blocked,\n-   };\n+   template <typename T, typename U  = typename std::enable_if<std::is_pointer<T>::value>::type>\n };\n 
\n-[report issue]
\n-

empty()

\n+[report issue]
\n+

client_data_t()

\n
\n-bool empty () const;\n+client_data_t () = default;\n 
\n-

returns true if the filter does not contain any rules

\n-[report issue]
\n-
\n-

add_rule()

\n+

construct a nullptr client data

\n+\n+\n+[report issue]
\n+
\n+

const*() void*() operator=()

\n
\n-void add_rule (address const& first, address const& last, std::uint32_t flags);\n+client_data_t& operator= (void*) = delete;\n+operator void const* () const = delete;\n+client_data_t& operator= (void const*) = delete;\n+operator void* () const = delete;\n 
\n-

Adds a rule to the filter. first and last defines a range of\n-ip addresses that will be marked with the given flags. The flags\n-can currently be 0, which means allowed, or ip_filter::blocked, which\n-means disallowed.

\n-

precondition:\n-first.is_v4() == last.is_v4() && first.is_v6() == last.is_v6()

\n-

postcondition:\n-access(x) == flags for every x in the range [first, last]

\n-

This means that in a case of overlapping ranges, the last one applied takes\n-precedence.

\n-[report issue]
\n-
\n-

access()

\n+

we don't allow type-unsafe operations

\n+

You have some control over session configuration through the session::apply_settings()\n+member function. To change one or more configuration options, create a settings_pack\n+object and fill it with the settings to be set and pass it in to session::apply_settings().

\n+

The settings_pack object is a collection of settings updates that are applied\n+to the session when passed to session::apply_settings(). It's empty when\n+constructed.

\n+

You have control over proxy and authorization settings and also the user-agent\n+that will be sent to the tracker. The user-agent will also be used to identify the\n+client with other peers.

\n+

Each configuration option is named with an enum value inside the\n+settings_pack class. These are the available settings:

\n+[report issue]
\n+
\n+
\n+

open_file_state

\n+

Declared in "libtorrent/disk_interface.hpp"

\n+

this contains information about a file that's currently open by the\n+libtorrent disk I/O subsystem. It's associated with a single torrent.

\n
\n-std::uint32_t access (address const& addr) const;\n+struct open_file_state\n+{\n+   file_index_t file_index;\n+   file_open_mode_t open_mode;\n+   time_point last_use;\n+};\n 
\n-

Returns the access permissions for the given address (addr). The permission\n-can currently be 0 or ip_filter::blocked. The complexity of this operation\n-is O(log n), where n is the minimum number of non-overlapping ranges to describe\n-the current filter.

\n-[report issue]
\n-
\n-

export_filter()

\n+[report issue]
\n+
file_index
\n+
the index of the file this entry refers to into the file_storage\n+file list of this torrent. This starts indexing at 0.
\n+
\n+[report issue]
\n+
open_mode
\n+

open_mode is a bitmask of the file flags this file is currently\n+opened with. For possible flags, see file_open_mode_t.

\n+

Note that the read/write mode is not a bitmask. The two least significant bits are used\n+to represent the read/write mode. Those bits can be masked out using the rw_mask constant.

\n+
\n+
\n+[report issue]
\n+
last_use
\n+
a (high precision) timestamp of when the file was last used.
\n+
\n+[report issue]
\n+
\n+

disk_interface

\n+

Declared in "libtorrent/disk_interface.hpp"

\n+

The disk_interface is the customization point for disk I/O in libtorrent.\n+implement this interface and provide a factory function to the session constructor\n+use custom disk I/O. All functions on the disk subsystem (implementing\n+disk_interface) are called from within libtorrent's network thread. For\n+disk I/O to be performed in a separate thread, the disk subsystem has to\n+manage that itself.

\n+

Although the functions are called async_*, they do not technically\n+have to be asynchronous, but they support being asynchronous, by\n+expecting the result passed back into a callback. The callbacks must be\n+posted back onto the network thread via the io_context object passed into\n+the constructor. The callbacks will be run in the network thread.

\n
\n-filter_tuple_t export_filter () const;\n+struct disk_interface\n+{\n+   virtual storage_holder new_torrent (storage_params const& p\n+      , std::shared_ptr<void> const& torrent) = 0;\n+   virtual void remove_torrent (storage_index_t) = 0;\n+   virtual bool async_write (storage_index_t storage, peer_request const& r\n+      , char const* buf, std::shared_ptr<disk_observer> o\n+      , std::function<void(storage_error const&)> handler\n+      , disk_job_flags_t flags = {}) = 0;\n+   virtual void async_read (storage_index_t storage, peer_request const& r\n+      , std::function<void(disk_buffer_holder, storage_error const&)> handler\n+      , disk_job_flags_t flags = {}) = 0;\n+   virtual void async_hash (storage_index_t storage, piece_index_t piece, span<sha256_hash> v2\n+      , disk_job_flags_t flags\n+      , std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler) = 0;\n+   virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags\n+      , std::function<void(piece_index_t, sha256_hash const&, storage_error const&)> handler) = 0;\n+   virtual void async_move_storage (storage_index_t storage, std::string p, move_flags_t flags\n+      , std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;\n+   virtual void async_release_files (storage_index_t storage\n+      , std::function<void()> handler = std::function<void()>()) = 0;\n+   virtual void async_check_files (storage_index_t storage\n+      , add_torrent_params const* resume_data\n+      , aux::vector<std::string, file_index_t> links\n+      , std::function<void(status_t, storage_error const&)> handler) = 0;\n+   virtual void async_stop_torrent (storage_index_t storage\n+      , std::function<void()> handler = std::function<void()>()) = 0;\n+   virtual void async_rename_file (storage_index_t storage\n+      , file_index_t index, std::string name\n+      , std::function<void(std::string const&, file_index_t, storage_error const&)> handler) = 0;\n+   virtual void async_delete_files (storage_index_t storage, remove_flags_t options\n+      , std::function<void(storage_error const&)> handler) = 0;\n+   virtual void async_set_file_priority (storage_index_t storage\n+      , aux::vector<download_priority_t, file_index_t> prio\n+      , std::function<void(storage_error const&\n+      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;\n+   virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n+      , std::function<void(piece_index_t)> handler) = 0;\n+   virtual void update_stats_counters (counters& c) const = 0;\n+   virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;\n+   virtual void abort (bool wait) = 0;\n+   virtual void submit_jobs () = 0;\n+   virtual void settings_updated () = 0;\n+\n+   static constexpr disk_job_flags_t force_copy  = 0_bit;\n+   static constexpr disk_job_flags_t sequential_access  = 3_bit;\n+   static constexpr disk_job_flags_t volatile_read  = 4_bit;\n+   static constexpr disk_job_flags_t v1_hash  = 5_bit;\n+   static constexpr disk_job_flags_t flush_piece  = 7_bit;\n+};\n 
\n-

This function will return the current state of the filter in the minimum number of\n-ranges possible. They are sorted from ranges in low addresses to high addresses. Each\n-entry in the returned vector is a range with the access control specified in its\n-flags field.

\n-

The return value is a tuple containing two range-lists. One for IPv4 addresses\n-and one for IPv6 addresses.

\n-[report issue]
\n-
\n-

enum access_flags

\n-

Declared in "libtorrent/ip_filter.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
blocked1indicates that IPs in this range should not be connected\n-to nor accepted as incoming connections
\n-[report issue]
\n+[report issue]
\n+

new_torrent()

\n+
\n+virtual storage_holder new_torrent (storage_params const& p\n+      , std::shared_ptr<void> const& torrent) = 0;\n+
\n+

this is called when a new torrent is added. The shared_ptr can be\n+used to hold the internal torrent object alive as long as there are\n+outstanding disk operations on the storage.\n+The returned storage_holder is an owning reference to the underlying\n+storage that was just created. It is fundamentally a storage_index_t

\n+[report issue]
\n+
\n+

remove_torrent()

\n+
\n+virtual void remove_torrent (storage_index_t) = 0;\n+
\n+

remove the storage with the specified index. This is not expected to\n+delete any files from disk, just to clean up any resources associated\n+with the specified storage.

\n+\n+[report issue]
\n+
\n+

async_write() async_read()

\n+
\n+virtual bool async_write (storage_index_t storage, peer_request const& r\n+      , char const* buf, std::shared_ptr<disk_observer> o\n+      , std::function<void(storage_error const&)> handler\n+      , disk_job_flags_t flags = {}) = 0;\n+virtual void async_read (storage_index_t storage, peer_request const& r\n+      , std::function<void(disk_buffer_holder, storage_error const&)> handler\n+      , disk_job_flags_t flags = {}) = 0;\n+
\n+

perform a read or write operation from/to the specified storage\n+index and the specified request. When the operation completes, call\n+handler possibly with a disk_buffer_holder, holding the buffer with\n+the result. Flags may be set to affect the read operation. See\n+disk_job_flags_t.

\n+

The disk_observer is a callback to indicate that\n+the store buffer/disk write queue is below the watermark to let peers\n+start writing buffers to disk again. When async_write() returns\n+true, indicating the write queue is full, the peer will stop\n+further writes and wait for the passed-in disk_observer to be\n+notified before resuming.

\n+

Note that for async_read, the peer_request (r) is not\n+necessarily aligned to blocks (but it is most of the time). However,\n+all writes (passed to async_write) are guaranteed to be block\n+aligned.

\n+[report issue]
\n+
\n+

async_hash()

\n+
\n+virtual void async_hash (storage_index_t storage, piece_index_t piece, span<sha256_hash> v2\n+      , disk_job_flags_t flags\n+      , std::function<void(piece_index_t, sha1_hash const&, storage_error const&)> handler) = 0;\n+
\n+

Compute hash(es) for the specified piece. Unless the v1_hash flag is\n+set (in flags), the SHA-1 hash of the whole piece does not need\n+to be computed.

\n+

The v2 span is optional and can be empty, which means v2 hashes\n+should not be computed. If v2 is non-empty it must be at least large\n+enough to hold all v2 blocks in the piece, and this function will\n+fill in the span with the SHA-256 block hashes of the piece.

\n+[report issue]
\n+
\n+

async_hash2()

\n+
\n+virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int offset, disk_job_flags_t flags\n+      , std::function<void(piece_index_t, sha256_hash const&, storage_error const&)> handler) = 0;\n+
\n+

computes the v2 hash (SHA-256) of a single block. The block at\n+offset in piece piece.

\n+[report issue]
\n+
\n+

async_move_storage()

\n+
\n+virtual void async_move_storage (storage_index_t storage, std::string p, move_flags_t flags\n+      , std::function<void(status_t, std::string const&, storage_error const&)> handler) = 0;\n+
\n+

called to request the files for the specified storage/torrent be\n+moved to a new location. It is the disk I/O object's responsibility\n+to synchronize this with any currently outstanding disk operations to\n+the storage. Whether files are replaced at the destination path or\n+not is controlled by flags (see move_flags_t).

\n+[report issue]
\n+
\n+

async_release_files()

\n+
\n+virtual void async_release_files (storage_index_t storage\n+      , std::function<void()> handler = std::function<void()>()) = 0;\n+
\n+

This is called on disk I/O objects to request they close all open\n+files for the specified storage/torrent. If file handles are not\n+pooled/cached, it can be a no-op. For truly asynchronous disk I/O,\n+this should provide at least one point in time when all files are\n+closed. It is possible that later asynchronous operations will\n+re-open some of the files, by the time this completion handler is\n+called, that's fine.

\n+[report issue]
\n+
\n+

async_check_files()

\n+
\n+virtual void async_check_files (storage_index_t storage\n+      , add_torrent_params const* resume_data\n+      , aux::vector<std::string, file_index_t> links\n+      , std::function<void(status_t, storage_error const&)> handler) = 0;\n+
\n+

this is called when torrents are added to validate their resume data\n+against the files on disk. This function is expected to do a few things:

\n+

if links is non-empty, it contains a string for each file in the\n+torrent. The string being a path to an existing identical file. The\n+default behavior is to create hard links of those files into the\n+storage of the new torrent (specified by storage). An empty\n+string indicates that there is no known identical file. This is part\n+of the "mutable torrent" feature, where files can be reused from\n+other torrents.

\n+

The resume_data points the resume data passed in by the client.

\n+

If the resume_data->flags field has the seed_mode flag set, all\n+files/pieces are expected to be on disk already. This should be\n+verified. Not just the existence of the file, but also that it has\n+the correct size.

\n+

Any file with a piece set in the resume_data->have_pieces bitmask\n+should exist on disk, this should be verified. Pad files and files\n+with zero priority may be skipped.

\n+[report issue]
\n+
\n+

async_stop_torrent()

\n+
\n+virtual void async_stop_torrent (storage_index_t storage\n+      , std::function<void()> handler = std::function<void()>()) = 0;\n+
\n+

This is called when a torrent is stopped. It gives the disk I/O\n+object an opportunity to flush any data to disk that's currently kept\n+cached. This function should at least do the same thing as\n+async_release_files().

\n+[report issue]
\n+
\n+

async_rename_file()

\n+
\n+virtual void async_rename_file (storage_index_t storage\n+      , file_index_t index, std::string name\n+      , std::function<void(std::string const&, file_index_t, storage_error const&)> handler) = 0;\n+
\n+

This function is called when the name of a file in the specified\n+storage has been requested to be renamed. The disk I/O object is\n+responsible for renaming the file without racing with other\n+potentially outstanding operations against the file (such as read,\n+write, move, etc.).

\n+[report issue]
\n+
\n+

async_delete_files()

\n+
\n+virtual void async_delete_files (storage_index_t storage, remove_flags_t options\n+      , std::function<void(storage_error const&)> handler) = 0;\n+
\n+

This function is called when some file(s) on disk have been requested\n+to be removed by the client. storage indicates which torrent is\n+referred to. See session_handle for remove_flags_t flags\n+indicating which files are to be removed.\n+e.g. session_handle::delete_files - delete all files\n+session_handle::delete_partfile - only delete part file.

\n+[report issue]
\n+
\n+

async_set_file_priority()

\n+
\n+virtual void async_set_file_priority (storage_index_t storage\n+      , aux::vector<download_priority_t, file_index_t> prio\n+      , std::function<void(storage_error const&\n+      , aux::vector<download_priority_t, file_index_t>)> handler) = 0;\n+
\n+

This is called to set the priority of some or all files. Changing the\n+priority from or to 0 may involve moving data to and from the\n+partfile. The disk I/O object is responsible for correctly\n+synchronizing this work to not race with any potentially outstanding\n+asynchronous operations affecting these files.

\n+

prio is a vector of the file priority for all files. If it's\n+shorter than the total number of files in the torrent, they are\n+assumed to be set to the default priority.

\n+[report issue]
\n+
\n+

async_clear_piece()

\n+
\n+virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n+      , std::function<void(piece_index_t)> handler) = 0;\n+
\n+

This is called when a piece fails the hash check, to ensure there are\n+no outstanding disk operations to the piece before blocks are\n+re-requested from peers to overwrite the existing blocks. The disk I/O\n+object does not need to perform any action other than synchronize\n+with all outstanding disk operations to the specified piece before\n+posting the result back.

\n+[report issue]
\n+
\n+

update_stats_counters()

\n+
\n+virtual void update_stats_counters (counters& c) const = 0;\n+
\n+

update_stats_counters() is called to give the disk storage an\n+opportunity to update gauges in the c stats counters, that aren't\n+updated continuously as operations are performed. This is called\n+before a snapshot of the counters are passed to the client.

\n+[report issue]
\n+
\n+

get_status()

\n+
\n+virtual std::vector<open_file_state> get_status (storage_index_t) const = 0;\n+
\n+

Return a list of all the files that are currently open for the\n+specified storage/torrent. This is is just used for the client to\n+query the currently open files, and which modes those files are open\n+in.

\n+[report issue]
\n+
\n+

abort()

\n+
\n+virtual void abort (bool wait) = 0;\n+
\n+

this is called when the session is starting to shut down. The disk\n+I/O object is expected to flush any outstanding write jobs, cancel\n+hash jobs and initiate tearing down of any internal threads. If\n+wait is true, this should be asynchronous. i.e. this call should\n+not return until all threads have stopped and all jobs have either\n+been aborted or completed and the disk I/O object is ready to be\n+destructed.

\n+[report issue]
\n+
\n+

submit_jobs()

\n+
\n+virtual void submit_jobs () = 0;\n+
\n+

This will be called after a batch of disk jobs has been issues (via\n+the async_* ). It gives the disk I/O object an opportunity to\n+notify any potential condition variables to wake up the disk\n+thread(s). The async_* calls can of course also notify condition\n+variables, but doing it in this call allows for batching jobs, by\n+issuing the notification once for a collection of jobs.

\n+[report issue]
\n+
\n+

settings_updated()

\n+
\n+virtual void settings_updated () = 0;\n+
\n+

This is called to notify the disk I/O object that the settings have\n+been updated. In the disk io constructor, a settings_interface\n+reference is passed in. Whenever these settings are updated, this\n+function is called to allow the disk I/O object to react to any\n+changed settings relevant to its operations.

\n+[report issue]
\n+
force_copy
\n+
force making a copy of the cached block, rather than getting a\n+reference to a block already in the cache. This is used the block is\n+expected to be overwritten very soon, by async_write()`, and we need\n+access to the previous content.
\n+
\n+[report issue]
\n+
sequential_access
\n+
hint that there may be more disk operations with sequential access to\n+the file
\n+
\n+[report issue]
\n+
volatile_read
\n+
don't keep the read block in cache. This is a hint that this block is\n+unlikely to be read again anytime soon, and caching it would be\n+wasteful.
\n+
\n+[report issue]
\n+
v1_hash
\n+
compute a v1 piece hash. This is only used by the async_hash() call.\n+If this flag is not set in the async_hash() call, the SHA-1 piece\n+hash does not need to be computed.
\n+
\n+[report issue]
\n+
flush_piece
\n+
this flag instructs a hash job that we just completed this piece, and\n+it should be flushed to disk
\n+
\n+[report issue]
\n
\n-
\n-

port_filter

\n-

Declared in "libtorrent/ip_filter.hpp"

\n-

the port filter maps non-overlapping port ranges to flags. This\n-is primarily used to indicate whether a range of ports should\n-be connected to or not. The default is to have the full port\n-range (0-65535) set to flag 0.

\n+
\n+

storage_holder

\n+

Declared in "libtorrent/disk_interface.hpp"

\n+

a unique, owning, reference to the storage of a torrent in a disk io\n+subsystem (class that implements disk_interface). This is held by the\n+internal libtorrent torrent object to tie the storage object allocated\n+for a torrent to the lifetime of the internal torrent object. When a\n+torrent is removed from the session, this holder is destructed and will\n+inform the disk object.

\n
\n-class port_filter\n+struct storage_holder\n {\n-   port_filter ();\n-   port_filter (port_filter const&);\n-   port_filter& operator= (port_filter&&);\n-   port_filter (port_filter&&);\n-   ~port_filter ();\n-   port_filter& operator= (port_filter const&);\n-   void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);\n-   std::uint32_t access (std::uint16_t port) const;\n+   storage_holder () = default;\n+   ~storage_holder ();\n+   storage_holder (storage_index_t idx, disk_interface& disk_io);\n+   explicit operator bool () const;\n+   operator storage_index_t () const;\n+   void reset ();\n+   storage_holder& operator= (storage_holder const&) = delete;\n+   storage_holder (storage_holder const&) = delete;\n+   storage_holder (storage_holder&& rhs) noexcept;\n+   storage_holder& operator= (storage_holder&& rhs) noexcept;\n+};\n+
\n+[report issue]
\n+
\n+

settings_interface

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+

the common interface to settings_pack and the internal representation of\n+settings.

\n+
\n+struct settings_interface\n+{\n+   virtual bool has_val (int name) const = 0;\n+   virtual void set_str (int name, std::string val) = 0;\n+   virtual void set_bool (int name, bool val) = 0;\n+   virtual void set_int (int name, int val) = 0;\n+   virtual bool get_bool (int name) const = 0;\n+   virtual int get_int (int name) const = 0;\n+   virtual std::string const& get_str (int name) const = 0;\n+};\n+
\n+[report issue]
\n+
\n+

disk_observer

\n+

Declared in "libtorrent/disk_observer.hpp"

\n+
\n+struct disk_observer\n+{\n+   virtual void on_disk () = 0;\n+};\n+
\n+[report issue]
\n+

on_disk()

\n+
\n+virtual void on_disk () = 0;\n+
\n+

called when the disk cache size has dropped\n+below the low watermark again and we can\n+resume downloading from peers

\n+[report issue]
\n+
\n+
\n+

buffer_allocator_interface

\n+

Declared in "libtorrent/disk_buffer_holder.hpp"

\n+

the interface for freeing disk buffers, used by the disk_buffer_holder.\n+when implementing disk_interface, this must also be implemented in order\n+to return disk buffers back to libtorrent

\n+
\n+struct buffer_allocator_interface\n+{\n+   virtual void free_disk_buffer (char* b) = 0;\n+};\n+
\n+[report issue]
\n+
\n+

disk_buffer_holder

\n+

Declared in "libtorrent/disk_buffer_holder.hpp"

\n+

The disk buffer holder acts like a unique_ptr that frees a disk buffer\n+when it's destructed

\n+

If this buffer holder is moved-from, default constructed or reset,\n+data() will return nullptr.

\n+
\n+struct disk_buffer_holder\n+{\n+   disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;\n+   disk_buffer_holder (disk_buffer_holder&&) noexcept;\n+   disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;\n+   disk_buffer_holder (disk_buffer_holder const&) = delete;\n+   disk_buffer_holder (buffer_allocator_interface& alloc\n+      , char* buf, int sz) noexcept;\n+   disk_buffer_holder () noexcept = default;\n+   ~disk_buffer_holder ();\n+   char* data () const noexcept;\n+   void reset ();\n+   void swap (disk_buffer_holder& h) noexcept;\n+   bool is_mutable () const noexcept;\n+   explicit operator bool () const noexcept;\n+   std::ptrdiff_t size () const;\n+};\n+
\n+[report issue]
\n+

disk_buffer_holder()

\n+
\n+disk_buffer_holder (buffer_allocator_interface& alloc\n+      , char* buf, int sz) noexcept;\n+
\n+

construct a buffer holder that will free the held buffer\n+using a disk buffer pool directly (there's only one\n+disk_buffer_pool per session)

\n+[report issue]
\n+
\n+

disk_buffer_holder()

\n+
\n+disk_buffer_holder () noexcept = default;\n+
\n+

default construct a holder that does not own any buffer

\n+[report issue]
\n+
\n+

~disk_buffer_holder()

\n+
\n+~disk_buffer_holder ();\n+
\n+

frees disk buffer held by this object

\n+[report issue]
\n+
\n+

data()

\n+
\n+char* data () const noexcept;\n+
\n+

return a pointer to the held buffer, if any. Otherwise returns nullptr.

\n+[report issue]
\n+
\n+

reset()

\n+
\n+void reset ();\n+
\n+

free the held disk buffer, if any, and clear the holder. This sets the\n+holder object to a default-constructed state

\n+[report issue]
\n+
\n+

swap()

\n+
\n+void swap (disk_buffer_holder& h) noexcept;\n+
\n+

swap pointers of two disk buffer holders.

\n+[report issue]
\n+
\n+

is_mutable()

\n+
\n+bool is_mutable () const noexcept;\n+
\n+

if this returns true, the buffer may not be modified in place

\n+[report issue]
\n+
\n+

bool()

\n+
\n+explicit operator bool () const noexcept;\n+
\n+

implicitly convertible to true if the object is currently holding a\n+buffer

\n+[report issue]
\n+
\n+
\n+

file_open_mode_t

\n+

Declared in "libtorrent/disk_interface.hpp"

\n+
\n+
read_only
\n+
open the file for reading only
\n+
\n+
\n+
write_only
\n+
open the file for writing only
\n+
\n+
\n+
read_write
\n+
open the file for reading and writing
\n+
\n+
\n+
rw_mask
\n+
the mask for the bits determining read or write mode
\n+
\n+
\n+
sparse
\n+
open the file in sparse mode (if supported by the\n+filesystem).
\n+
\n+
\n+
no_atime
\n+
don't update the access timestamps on the file (if\n+supported by the operating system and filesystem).\n+this generally improves disk performance.
\n+
\n+
\n+
random_access
\n+
open the file for random access. This disables read-ahead\n+logic
\n+
\n+
\n+
mmapped
\n+
the file is memory mapped
\n+
\n+[report issue]
\n+
\n+

web_seed_entry

\n+

Declared in "libtorrent/torrent_info.hpp"

\n+

the web_seed_entry holds information about a web seed (also known\n+as URL seed or HTTP seed). It is essentially a URL with some state\n+associated with it. For more information, see BEP 17 and BEP 19.

\n+
\n+struct web_seed_entry\n+{\n+   bool operator== (web_seed_entry const& e) const;\n+   bool operator< (web_seed_entry const& e) const;\n \n-   enum access_flags\n+   enum type_t\n    {\n-      blocked,\n+      url_seed,\n+      http_seed,\n    };\n+\n+   std::string url;\n+   std::string auth;\n+   headers_t extra_headers;\n+   std::uint8_t type;\n };\n 
\n-[report issue]
\n-

add_rule()

\n+[report issue]
\n+

operator==()

\n
\n-void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);\n+bool operator== (web_seed_entry const& e) const;\n 
\n-

set the flags for the specified port range (first, last) to\n-flags overwriting any existing rule for those ports. The range\n-is inclusive, i.e. the port last also has the flag set on it.

\n-[report issue]
\n-
\n-

access()

\n+

URL and type comparison

\n+[report issue]
\n+
\n+

operator<()

\n
\n-std::uint32_t access (std::uint16_t port) const;\n+bool operator< (web_seed_entry const& e) const;\n 
\n-

test the specified port (port) for whether it is blocked\n-or not. The returned value is the flags set for this port.\n-see access_flags.

\n-[report issue]
\n-
\n-

enum access_flags

\n-

Declared in "libtorrent/ip_filter.hpp"

\n+

URL and type less-than comparison

\n+[report issue]
\n+
\n+

enum type_t

\n+

Declared in "libtorrent/torrent_info.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n+\n+\n+\n+\n \n-\n+\n \n \n
namevaluedescription
blocked
url_seed0 
http_seed1this flag indicates that destination ports in the\n-range should not be connected to 
\n-[report issue]
\n+[report issue]
\n+
url
\n+
The URL of the web seed
\n+
\n+[report issue]
\n+
auth
\n+
Optional authentication. If this is set, it's passed\n+in as HTTP basic auth to the web seed. The format is:\n+username:password.
\n+
\n+[report issue]
\n+
extra_headers
\n+
Any extra HTTP headers that need to be passed to the web seed
\n+
\n+[report issue]
\n+
type
\n+
The type of web seed (see type_t)
\n+
\n+[report issue]
\n
\n-
\n-

storage_params

\n-

Declared in "libtorrent/storage_defs.hpp"

\n-

a parameter pack used to construct the storage for a torrent, used in\n-disk_interface

\n-
\n-struct storage_params\n-{\n-   storage_params (file_storage const& f, file_storage const* mf\n-      , std::string const& sp, storage_mode_t const sm\n-      , aux::vector<download_priority_t, file_index_t> const& prio\n-      , sha1_hash const& ih);\n-\n-   file_storage const& files;\n-   file_storage const* mapped_files  = nullptr;\n-   std::string const& path;\n-   storage_mode_t mode {storage_mode_sparse};\n-   aux::vector<download_priority_t, file_index_t> const& priorities;\n-   sha1_hash info_hash;\n-};\n-
\n-[report issue]
\n-
\n-

file_slice

\n-

Declared in "libtorrent/file_storage.hpp"

\n-

represents a window of a file in a torrent.

\n-

The file_index refers to the index of the file (in the torrent_info).\n-To get the path and filename, use file_path() and give the file_index\n-as argument. The offset is the byte offset in the file where the range\n-starts, and size is the number of bytes this range is. The size + offset\n-will never be greater than the file size.

\n+
\n+

load_torrent_limits

\n+

Declared in "libtorrent/torrent_info.hpp"

\n+

this object holds configuration options for limits to use when loading\n+torrents. They are meant to prevent loading potentially malicious torrents\n+that cause excessive memory allocations.

\n
\n-struct file_slice\n+struct load_torrent_limits\n {\n-   file_index_t file_index;\n-   std::int64_t offset;\n-   std::int64_t size;\n+   int max_buffer_size  = 10000000;\n+   int max_pieces  = 0x200000;\n+   int max_decode_depth  = 100;\n+   int max_decode_tokens  = 3000000;\n };\n 
\n-[report issue]
\n-
file_index
\n-
the index of the file
\n+[report issue]
\n+
max_buffer_size
\n+
the max size of a .torrent file to load into RAM
\n
\n-[report issue]
\n-
offset
\n-
the offset from the start of the file, in bytes
\n+[report issue]
\n+
max_pieces
\n+
the max number of pieces allowed in the torrent
\n
\n-[report issue]
\n-
size
\n-
the size of the window, in bytes
\n+[report issue]
\n+
max_decode_depth
\n+
the max recursion depth in the bdecoded structure
\n
\n-[report issue]
\n-
\n-

file_storage

\n-

Declared in "libtorrent/file_storage.hpp"

\n-

The file_storage class represents a file list and the piece\n-size. Everything necessary to interpret a regular bittorrent storage\n-file structure.

\n+[report issue]
\n+
max_decode_tokens
\n+
the max number of bdecode tokens
\n+
\n+[report issue]
\n+
\n+

torrent_info

\n+

Declared in "libtorrent/torrent_info.hpp"

\n+

the torrent_info class holds the information found in a .torrent file.

\n
\n-class file_storage\n+class torrent_info\n {\n-   bool is_valid () const;\n-   void reserve (int num_files);\n-   void add_file_borrow (error_code& ec, string_view filename\n-      , std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}, char const* filehash = nullptr\n-      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n-   void add_file (std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}\n-      , std::time_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n-   void add_file (error_code& ec, std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}\n-      , std::time_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n-   void add_file_borrow (string_view filename\n-      , std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}, char const* filehash = nullptr\n-      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n+   torrent_info (char const* buffer, int size, error_code& ec);\n+   explicit torrent_info (std::string const& filename);\n+   torrent_info (bdecode_node const& torrent_file, error_code& ec);\n+   explicit torrent_info (span<char const> buffer, from_span_t);\n+   torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n+   torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);\n+   torrent_info (span<char const> buffer, error_code& ec, from_span_t);\n+   torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n+   torrent_info (char const* buffer, int size);\n+   torrent_info (std::string const& filename, error_code& ec);\n+   explicit torrent_info (bdecode_node const& torrent_file);\n+   explicit torrent_info (info_hash_t const& info_hash);\n+   torrent_info (torrent_info const& t);\n+   ~torrent_info ();\n+   file_storage const& files () const;\n+   file_storage const& orig_files () const;\n    void rename_file (file_index_t index, std::string const& new_filename);\n-   std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset\n-      , std::int64_t size) const;\n-   peer_request map_file (file_index_t file, std::int64_t offset, int size) const;\n-   int num_files () const noexcept;\n-   file_index_t end_file () const noexcept;\n-   index_range<file_index_t> file_range () const noexcept;\n+   void remap_files (file_storage const& f);\n+   void add_tracker (std::string const& url, int tier = 0);\n+   void clear_trackers ();\n+   std::vector<announce_entry> const& trackers () const;\n+   void add_tracker (std::string const& url, int tier\n+      , announce_entry::tracker_source source);\n+   std::vector<std::string> collections () const;\n+   std::vector<sha1_hash> similar_torrents () const;\n+   std::vector<web_seed_entry> const& web_seeds () const;\n+   void set_web_seeds (std::vector<web_seed_entry> seeds);\n+   void add_url_seed (std::string const& url\n+      , std::string const& ext_auth = std::string()\n+      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::headers_t());\n+   void add_http_seed (std::string const& url\n+      , std::string const& extern_auth = std::string()\n+      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::headers_t());\n    std::int64_t total_size () const;\n-   void set_num_pieces (int n);\n+   int piece_length () const;\n    int num_pieces () const;\n+   index_range<piece_index_t> piece_range () const;\n    piece_index_t end_piece () const;\n    piece_index_t last_piece () const;\n-   index_range<piece_index_t> piece_range () const noexcept;\n-   int piece_length () const;\n-   void set_piece_length (int l);\n-   int piece_size (piece_index_t index) const;\n-   int piece_size2 (piece_index_t index) const;\n-   int blocks_in_piece2 (piece_index_t index) const;\n-   void set_name (std::string const& n);\n-   std::string const& name () const;\n-   void swap (file_storage& ti) noexcept;\n-   void canonicalize ();\n-   std::int64_t file_size (file_index_t index) const;\n-   sha1_hash hash (file_index_t index) const;\n-   std::string symlink (file_index_t index) const;\n-   bool pad_file_at (file_index_t index) const;\n-   std::time_t mtime (file_index_t index) const;\n-   std::int64_t file_offset (file_index_t index) const;\n-   sha256_hash root (file_index_t index) const;\n-   string_view file_name (file_index_t index) const;\n-   std::string file_path (file_index_t index, std::string const& save_path = "") const;\n-   char const* root_ptr (file_index_t const index) const;\n-   int file_num_blocks (file_index_t index) const;\n-   int file_num_pieces (file_index_t index) const;\n-   index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;\n-   int file_first_piece_node (file_index_t index) const;\n-   int file_first_block_node (file_index_t index) const;\n-   std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;\n-   void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;\n-   file_flags_t file_flags (file_index_t index) const;\n-   bool file_absolute_path (file_index_t index) const;\n-   file_index_t file_index_at_offset (std::int64_t offset) const;\n-   file_index_t file_index_at_piece (piece_index_t piece) const;\n-   file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n-   piece_index_t piece_index_at_file (file_index_t f) const;\n-   void sanitize_symlinks ();\n+   info_hash_t const& info_hashes () const;\n+   sha1_hash info_hash () const noexcept;\n+   bool v1 () const;\n    bool v2 () const;\n-\n-   static constexpr file_flags_t flag_pad_file  = 0_bit;\n-   static constexpr file_flags_t flag_hidden  = 1_bit;\n-   static constexpr file_flags_t flag_executable  = 2_bit;\n-   static constexpr file_flags_t flag_symlink  = 3_bit;\n+   int num_files () const;\n+   std::vector<file_slice> map_block (piece_index_t const piece\n+      , std::int64_t offset, int size) const;\n+   peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;\n+   string_view ssl_cert () const;\n+   bool is_valid () const;\n+   bool priv () const;\n+   bool is_i2p () const;\n+   int piece_size (piece_index_t index) const;\n+   char const* hash_for_piece_ptr (piece_index_t const index) const;\n+   sha1_hash hash_for_piece (piece_index_t index) const;\n+   bool is_loaded () const;\n+   const std::string& name () const;\n+   std::time_t creation_date () const;\n+   const std::string& creator () const;\n+   const std::string& comment () const;\n+   std::vector<std::pair<std::string, int>> const& nodes () const;\n+   void add_node (std::pair<std::string, int> const& node);\n+   bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);\n+   bdecode_node info (char const* key) const;\n+   span<char const> info_section () const;\n+   span<char const> piece_layer (file_index_t) const;\n+   void free_piece_layers ();\n };\n 
\n-[report issue]
\n-

is_valid()

\n+[report issue]
\n+

torrent_info()

\n
\n-bool is_valid () const;\n+torrent_info (char const* buffer, int size, error_code& ec);\n+explicit torrent_info (std::string const& filename);\n+torrent_info (bdecode_node const& torrent_file, error_code& ec);\n+explicit torrent_info (span<char const> buffer, from_span_t);\n+torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n+torrent_info (span<char const> buffer, load_torrent_limits const& cfg, from_span_t);\n+torrent_info (span<char const> buffer, error_code& ec, from_span_t);\n+torrent_info (bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n+torrent_info (char const* buffer, int size);\n+torrent_info (std::string const& filename, error_code& ec);\n+explicit torrent_info (bdecode_node const& torrent_file);\n+explicit torrent_info (info_hash_t const& info_hash);\n+torrent_info (torrent_info const& t);\n 
\n-

returns true if the piece length has been initialized\n-on the file_storage. This is typically taken as a proxy\n-of whether the file_storage as a whole is initialized or\n-not.

\n-[report issue]
\n-
\n-

reserve()

\n+

The constructor that takes an info-hash will initialize the info-hash\n+to the given value, but leave all other fields empty. This is used\n+internally when downloading torrents without the metadata. The\n+metadata will be created by libtorrent as soon as it has been\n+downloaded from the swarm.

\n+

The constructor that takes a bdecode_node will create a torrent_info\n+object from the information found in the given torrent_file. The\n+bdecode_node represents a tree node in an bencoded file. To load an\n+ordinary .torrent file into a bdecode_node, use bdecode().

\n+

The version that takes a buffer pointer and a size will decode it as a\n+.torrent file and initialize the torrent_info object for you.

\n+

The version that takes a filename will simply load the torrent file\n+and decode it inside the constructor, for convenience. This might not\n+be the most suitable for applications that want to be able to report\n+detailed errors on what might go wrong.

\n+

There is an upper limit on the size of the torrent file that will be\n+loaded by the overload taking a filename. If it's important that even\n+very large torrent files are loaded, use one of the other overloads.

\n+

The overloads that takes an error_code const& never throws if an\n+error occur, they will simply set the error code to describe what went\n+wrong and not fully initialize the torrent_info object. The overloads\n+that do not take the extra error_code parameter will always throw if\n+an error occurs. These overloads are not available when building\n+without exception support.

\n+

The overload that takes a span also needs an extra parameter of\n+type from_span_t to disambiguate the std::string overload for\n+string literals. There is an object in the libtorrent namespace of this\n+type called from_span.

\n+[report issue]
\n+
\n+

~torrent_info()

\n
\n-void reserve (int num_files);\n+~torrent_info ();\n 
\n-

allocates space for num_files in the internal file list. This can\n-be used to avoid reallocating the internal file list when the number\n-of files to be added is known up-front.

\n-\n-[report issue]
\n-
\n-

add_file() add_file_borrow()

\n+

frees all storage associated with this torrent_info object

\n+\n+[report issue]
\n+
\n+

files() orig_files()

\n
\n-void add_file_borrow (error_code& ec, string_view filename\n-      , std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}, char const* filehash = nullptr\n-      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n-void add_file (std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}\n-      , std::time_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n-void add_file (error_code& ec, std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}\n-      , std::time_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n-void add_file_borrow (string_view filename\n-      , std::string const& path, std::int64_t file_size\n-      , file_flags_t file_flags = {}, char const* filehash = nullptr\n-      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n-      , char const* root_hash = nullptr);\n+file_storage const& files () const;\n+file_storage const& orig_files () const;\n 
\n-

Adds a file to the file storage. The add_file_borrow version\n-expects that filename is the file name (without a path) of\n-the file that's being added.\n-This memory is borrowed, i.e. it is the caller's\n-responsibility to make sure it stays valid throughout the lifetime\n-of this file_storage object or any copy of it. The same thing applies\n-to filehash, which is an optional pointer to a 20 byte binary\n-SHA-1 hash of the file.

\n-

if filename is empty, the filename from path is used and not\n-borrowed.

\n-

The path argument is the full path (in the torrent file) to\n-the file to add. Note that this is not supposed to be an absolute\n-path, but it is expected to include the name of the torrent as the\n-first path element.

\n-

file_size is the size of the file in bytes.

\n-

The file_flags argument sets attributes on the file. The file\n-attributes is an extension and may not work in all bittorrent clients.

\n-

For possible file attributes, see file_storage::flags_t.

\n-

The mtime argument is optional and can be set to 0. If non-zero,\n-it is the posix time of the last modification time of this file.

\n-

symlink_path is the path the file is a symlink to. To make this a\n-symlink you also need to set the file_storage::flag_symlink file flag.

\n-

root_hash is an optional pointer to a 32 byte SHA-256 hash, being\n-the merkle tree root hash for this file. This is only used for v2\n-torrents. If the root hash is specified for one file, it has to\n-be specified for all, otherwise this function will fail.\n-Note that the buffer root_hash points to must out-live the\n-file_storage object, it will not be copied. This parameter is only\n-used when loading torrents, that already have their file hashes\n-computed. When creating torrents, the file hashes will be computed by\n-the piece hashes.

\n-

If more files than one are added, certain restrictions to their paths\n-apply. In a multi-file file storage (torrent), all files must share\n-the same root directory.

\n-

That is, the first path element of all files must be the same.\n-This shared path element is also set to the name of the torrent. It\n-can be changed by calling set_name.

\n-

The overloads that take an error_code reference will report failures\n-via that variable, otherwise system_error is thrown.

\n-[report issue]
\n-
\n+

The file_storage object contains the information on how to map the\n+pieces to files. It is separated from the torrent_info object because\n+when creating torrents a storage object needs to be created without\n+having a torrent file. When renaming files in a storage, the storage\n+needs to make its own copy of the file_storage in order to make its\n+mapping differ from the one in the torrent file.

\n+

orig_files() returns the original (unmodified) file storage for\n+this torrent. This is used by the web server connection, which needs\n+to request files with the original names. Filename may be changed using\n+torrent_info::rename_file().

\n+

For more information on the file_storage object, see the separate\n+document on how to create torrents.

\n+[report issue]
\n+
\n

rename_file()

\n
\n void rename_file (file_index_t index, std::string const& new_filename);\n 
\n-

renames the file at index to new_filename. Keep in mind\n-that filenames are expected to be UTF-8 encoded.

\n-[report issue]
\n-
\n-

map_block()

\n-
\n-std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset\n-      , std::int64_t size) const;\n-
\n-

returns a list of file_slice objects representing the portions of\n-files the specified piece index, byte offset and size range overlaps.\n-this is the inverse mapping of map_file().

\n-

Preconditions of this function is that the input range is within the\n-torrents address space. piece may not be negative and

\n-
\n-piece * piece_size + offset + size
\n-

may not exceed the total size of the torrent.

\n-[report issue]
\n-
\n-

map_file()

\n+

Renames the file with the specified index to the new name. The new\n+filename is reflected by the file_storage returned by files()\n+but not by the one returned by orig_files().

\n+

If you want to rename the base name of the torrent (for a multi file\n+torrent), you can copy the file_storage (see files() and\n+orig_files() ), change the name, and then use remap_files().

\n+

The new_filename can both be a relative path, in which case the\n+file name is relative to the save_path of the torrent. If the\n+new_filename is an absolute path (i.e. is_complete(new_filename)\n+== true), then the file is detached from the save_path of the\n+torrent. In this case the file is not moved when move_storage() is\n+invoked.

\n+[report issue]
\n+
\n+

remap_files()

\n
\n-peer_request map_file (file_index_t file, std::int64_t offset, int size) const;\n+void remap_files (file_storage const& f);\n 
\n-

returns a peer_request representing the piece index, byte offset\n-and size the specified file range overlaps. This is the inverse\n-mapping over map_block(). Note that the peer_request return type\n-is meant to hold bittorrent block requests, which may not be larger\n-than 16 kiB. Mapping a range larger than that may return an overflown\n-integer.

\n-[report issue]
\n-
\n-

num_files()

\n+
\n+

Warning

\n+

Using remap_files() is discouraged as it's incompatible with v2\n+torrents. This is because the piece boundaries and piece hashes in\n+v2 torrents are intimately tied to the file boundaries. Instead,\n+just rename individual files, or implement a custom disk_interface\n+to customize how to store files.

\n+
\n+

Remaps the file storage to a new file layout. This can be used to, for\n+instance, download all data in a torrent to a single file, or to a\n+number of fixed size sector aligned files, regardless of the number\n+and sizes of the files in the torrent.

\n+

The new specified file_storage must have the exact same size as\n+the current one.

\n+\n+\n+[report issue]
\n+
\n+

clear_trackers() trackers() add_tracker()

\n
\n-int num_files () const noexcept;\n+void add_tracker (std::string const& url, int tier = 0);\n+void clear_trackers ();\n+std::vector<announce_entry> const& trackers () const;\n+void add_tracker (std::string const& url, int tier\n+      , announce_entry::tracker_source source);\n 
\n-

returns the number of files in the file_storage

\n-[report issue]
\n-
\n-

end_file()

\n+

add_tracker() adds a tracker to the announce-list. The tier\n+determines the order in which the trackers are to be tried.\n+The trackers() function will return a sorted vector of\n+announce_entry. Each announce entry contains a string, which is\n+the tracker url, and a tier index. The tier index is the high-level\n+priority. No matter which trackers that works or not, the ones with\n+lower tier will always be tried before the one with higher tier\n+number. For more information, see announce_entry.

\n+

trackers() returns all entries from announce-list.

\n+

clear_trackers() removes all trackers from announce-list.

\n+\n+[report issue]
\n+
\n+

collections() similar_torrents()

\n
\n-file_index_t end_file () const noexcept;\n+std::vector<std::string> collections () const;\n+std::vector<sha1_hash> similar_torrents () const;\n 
\n-

returns the index of the one-past-end file in the file storage

\n-[report issue]
\n-
\n-

file_range()

\n+

These two functions are related to BEP 38 (mutable torrents). The\n+vectors returned from these correspond to the "similar" and\n+"collections" keys in the .torrent file. Both info-hashes and\n+collections from within the info-dict and from outside of it are\n+included.

\n+\n+\n+\n+[report issue]
\n+
\n+

set_web_seeds() web_seeds() add_http_seed() add_url_seed()

\n
\n-index_range<file_index_t> file_range () const noexcept;\n+std::vector<web_seed_entry> const& web_seeds () const;\n+void set_web_seeds (std::vector<web_seed_entry> seeds);\n+void add_url_seed (std::string const& url\n+      , std::string const& ext_auth = std::string()\n+      , web_seed_entry::headers_t const& ext_headers = web_seed_entry::headers_t());\n+void add_http_seed (std::string const& url\n+      , std::string const& extern_auth = std::string()\n+      , web_seed_entry::headers_t const& extra_headers = web_seed_entry::headers_t());\n 
\n-

returns an implementation-defined type that can be used as the\n-container in a range-for loop. Where the values are the indices of all\n-files in the file_storage.

\n-[report issue]
\n-
\n+

web_seeds() returns all url seeds and http seeds in the torrent.\n+Each entry is a web_seed_entry and may refer to either a url seed\n+or http seed.

\n+

add_url_seed() and add_http_seed() adds one url to the list of\n+url/http seeds.

\n+

set_web_seeds() replaces all web seeds with the ones specified in\n+the seeds vector.

\n+

The extern_auth argument can be used for other authorization\n+schemes than basic HTTP authorization. If set, it will override any\n+username and password found in the URL itself. The string will be sent\n+as the HTTP authorization header's value (without specifying "Basic").

\n+

The extra_headers argument defaults to an empty list, but can be\n+used to insert custom HTTP headers in the requests to a specific web\n+seed.

\n+

See http seeding for more information.

\n+[report issue]
\n+
\n

total_size()

\n
\n std::int64_t total_size () const;\n 
\n-

returns the total number of bytes all the files in this torrent spans

\n+

total_size() returns the total number of bytes the torrent-file\n+represents. Note that this is the number of pieces times the piece\n+size (modulo the last piece possibly being smaller). With pad files,\n+the total size will be larger than the sum of all (regular) file\n+sizes.

\n \n-[report issue]
\n-
\n-

num_pieces() set_num_pieces()

\n+[report issue]
\n+
\n+

num_pieces() piece_length()

\n
\n-void set_num_pieces (int n);\n+int piece_length () const;\n int num_pieces () const;\n 
\n-

set and get the number of pieces in the torrent

\n-[report issue]
\n-
\n-

end_piece()

\n+

piece_length() and num_pieces() returns the number of byte\n+for each piece and the total number of pieces, respectively. The\n+difference between piece_size() and piece_length() is that\n+piece_size() takes the piece index as argument and gives you the\n+exact size of that piece. It will always be the same as\n+piece_length() except in the case of the last piece, which may be\n+smaller.

\n+\n+\n+[report issue]
\n+
\n+

last_piece() end_piece() piece_range()

\n
\n+index_range<piece_index_t> piece_range () const;\n piece_index_t end_piece () const;\n-
\n-

returns the index of the one-past-end piece in the file storage

\n-[report issue]
\n-
\n-

last_piece()

\n-
\n piece_index_t last_piece () const;\n 
\n-

returns the index of the last piece in the torrent. The last piece is\n-special in that it may be smaller than the other pieces (and the other\n-pieces are all the same size).

\n-[report issue]
\n-
\n-

piece_range()

\n-
\n-index_range<piece_index_t> piece_range () const noexcept;\n-
\n-

returns an implementation-defined type that can be used as the\n-container in a range-for loop. Where the values are the indices of all\n-pieces in the file_storage.

\n-\n-[report issue]
\n-
\n-

set_piece_length() piece_length()

\n-
\n-int piece_length () const;\n-void set_piece_length (int l);\n-
\n-

set and get the size of each piece in this torrent. It must be a power of two\n-and at least 16 kiB.

\n-[report issue]
\n-
\n-

piece_size()

\n+

last_piece() returns the index to the last piece in the torrent and\n+end_piece() returns the index to the one-past-end piece in the\n+torrent\n+piece_range() returns an implementation-defined type that can be\n+used as the container in a range-for loop. Where the values are the\n+indices of all pieces in the file_storage.

\n+\n+[report issue]
\n+
\n+

info_hashes() info_hash()

\n
\n-int piece_size (piece_index_t index) const;\n+info_hash_t const& info_hashes () const;\n+sha1_hash info_hash () const noexcept;\n 
\n-

returns the piece size of index. This will be the same as piece_length(), except\n-for the last piece, which may be shorter.

\n-[report issue]
\n-
\n-

piece_size2()

\n+

returns the info-hash of the torrent. For BitTorrent v2 support, use\n+info_hashes() to get an object that may hold both a v1 and v2\n+info-hash

\n+\n+[report issue]
\n+
\n+

v2() v1()

\n
\n-int piece_size2 (piece_index_t index) const;\n+bool v1 () const;\n+bool v2 () const;\n 
\n-

Returns the size of the given piece. If the piece spans multiple files,\n-only the first file is considered part of the piece. This is used for\n-v2 torrents, where all files are piece aligned and padded. i.e. The pad\n-files are not considered part of the piece for this purpose.

\n-[report issue]
\n-
\n-

blocks_in_piece2()

\n+

returns whether this torrent has v1 and/or v2 metadata, respectively.\n+Hybrid torrents have both. These are shortcuts for\n+info_hashes().has_v1() and info_hashes().has_v2() calls.

\n+[report issue]
\n+
\n+

num_files()

\n
\n-int blocks_in_piece2 (piece_index_t index) const;\n+int num_files () const;\n 
\n-

returns the number of blocks in the specified piece, for v2 torrents.

\n-\n-[report issue]
\n-
\n-

set_name() name()

\n+

If you need index-access to files you can use the num_files() along\n+with the file_path(), file_size()-family of functions to access\n+files using indices.

\n+[report issue]
\n+
\n+

map_block()

\n
\n-void set_name (std::string const& n);\n-std::string const& name () const;\n+std::vector<file_slice> map_block (piece_index_t const piece\n+      , std::int64_t offset, int size) const;\n 
\n-

set and get the name of this torrent. For multi-file torrents, this is also\n-the name of the root directory all the files are stored in.

\n-[report issue]
\n-
\n-

swap()

\n+

This function will map a piece index, a byte offset within that piece\n+and a size (in bytes) into the corresponding files with offsets where\n+that data for that piece is supposed to be stored. See file_slice.

\n+[report issue]
\n+
\n+

map_file()

\n
\n-void swap (file_storage& ti) noexcept;\n+peer_request map_file (file_index_t const file, std::int64_t offset, int size) const;\n 
\n-

swap all content of this with ti.

\n-[report issue]
\n-
\n-

canonicalize()

\n+

This function will map a range in a specific file into a range in the\n+torrent. The file_offset parameter is the offset in the file,\n+given in bytes, where 0 is the start of the file. See peer_request.

\n+

The input range is assumed to be valid within the torrent.\n+file_offset + size is not allowed to be greater than the file\n+size. file_index must refer to a valid file, i.e. it cannot be >=\n+num_files().

\n+[report issue]
\n+
\n+

ssl_cert()

\n
\n-void canonicalize ();\n+string_view ssl_cert () const;\n 
\n-

arrange files and padding to match the canonical form required\n-by BEP 52

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-[report issue]
\n-
\n-

file_size() hash() pad_file_at() root() file_offset() root_ptr() file_path() file_name() mtime() symlink()

\n+

Returns the SSL root certificate for the torrent, if it is an SSL\n+torrent. Otherwise returns an empty string. The certificate is\n+the public certificate in x509 format.

\n+[report issue]
\n+
\n+

is_valid()

\n
\n-std::int64_t file_size (file_index_t index) const;\n-sha1_hash hash (file_index_t index) const;\n-std::string symlink (file_index_t index) const;\n-bool pad_file_at (file_index_t index) const;\n-std::time_t mtime (file_index_t index) const;\n-std::int64_t file_offset (file_index_t index) const;\n-sha256_hash root (file_index_t index) const;\n-string_view file_name (file_index_t index) const;\n-std::string file_path (file_index_t index, std::string const& save_path = "") const;\n-char const* root_ptr (file_index_t const index) const;\n+bool is_valid () const;\n 
\n-

These functions are used to query attributes of files at\n-a given index.

\n-

The hash() is a SHA-1 hash of the file, or 0 if none was\n-provided in the torrent file. This can potentially be used to\n-join a bittorrent network with other file sharing networks.

\n-

root() returns the SHA-256 merkle tree root of the specified file,\n-in case this is a v2 torrent. Otherwise returns zeros.\n-root_ptr() returns a pointer to the SHA-256 merkle tree root hash\n-for the specified file. The pointer points into storage referred to\n-when the file was added, it is not owned by this object. Torrents\n-that are not v2 torrents return nullptr.

\n-

The mtime() is the modification time is the posix\n-time when a file was last modified when the torrent\n-was created, or 0 if it was not included in the torrent file.

\n-

file_path() returns the full path to a file.

\n-

file_size() returns the size of a file.

\n-

pad_file_at() returns true if the file at the given\n-index is a pad-file.

\n-

file_name() returns just the name of the file, whereas\n-file_path() returns the path (inside the torrent file) with\n-the filename appended.

\n-

file_offset() returns the byte offset within the torrent file\n-where this file starts. It can be used to map the file to a piece\n-index (given the piece size).

\n-\n-\n-[report issue]
\n-
\n-

file_num_pieces() file_num_blocks() file_piece_range()

\n+

returns true if this torrent_info object has a torrent loaded.\n+This is primarily used to determine if a magnet link has had its\n+metadata resolved yet or not.

\n+[report issue]
\n+
\n+

priv()

\n
\n-int file_num_blocks (file_index_t index) const;\n-int file_num_pieces (file_index_t index) const;\n-index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;\n+bool priv () const;\n 
\n-

Returns the number of pieces or blocks the file at index spans,\n-under the assumption that the file is aligned to the start of a piece.\n-This is only meaningful for v2 torrents, where files are guaranteed\n-such alignment.\n-These numbers are used to size and navigate the merkle hash tree for\n-each file.

\n-\n-[report issue]
\n-
\n-

file_first_block_node() file_first_piece_node()

\n+

returns true if this torrent is private. i.e., the client should not\n+advertise itself on the trackerless network (the Kademlia DHT) for this torrent.

\n+[report issue]
\n+
\n+

is_i2p()

\n
\n-int file_first_piece_node (file_index_t index) const;\n-int file_first_block_node (file_index_t index) const;\n+bool is_i2p () const;\n 
\n-

index of first piece node in the merkle tree

\n-[report issue]
\n-
\n-

file_path_hash()

\n+

returns true if this is an i2p torrent. This is determined by whether\n+or not it has a tracker whose URL domain name ends with ".i2p". i2p\n+torrents disable the DHT and local peer discovery as well as talking\n+to peers over anything other than the i2p network.

\n+[report issue]
\n+
\n+

piece_size()

\n
\n-std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;\n+int piece_size (piece_index_t index) const;\n 
\n-

returns the crc32 hash of file_path(index)

\n-[report issue]
\n-
\n-

all_path_hashes()

\n+

returns the piece size of file with index. This will be the same as piece_length(),\n+except for the last piece, which may be shorter.

\n+\n+[report issue]
\n+
\n+

hash_for_piece_ptr() hash_for_piece()

\n
\n-void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;\n+char const* hash_for_piece_ptr (piece_index_t const index) const;\n+sha1_hash hash_for_piece (piece_index_t index) const;\n 
\n-

this will add the CRC32 hash of all directory entries to the table. No\n-filename will be included, just directories. Every depth of directories\n-are added separately to allow test for collisions with files at all\n-levels. i.e. if one path in the torrent is foo/bar/baz, the CRC32\n-hashes for foo, foo/bar and foo/bar/baz will be added to\n-the set.

\n-[report issue]
\n-
\n-

file_flags()

\n+

hash_for_piece() takes a piece-index and returns the 20-bytes\n+sha1-hash for that piece and info_hash() returns the 20-bytes\n+sha1-hash for the info-section of the torrent file.\n+hash_for_piece_ptr() returns a pointer to the 20 byte sha1 digest\n+for the piece. Note that the string is not 0-terminated.

\n+[report issue]
\n+
\n+

name()

\n
\n-file_flags_t file_flags (file_index_t index) const;\n+const std::string& name () const;\n 
\n-

returns a bitmask of flags from file_flags_t that apply\n-to file at index.

\n-[report issue]
\n-
\n-

file_absolute_path()

\n+

name() returns the name of the torrent.\n+name contains UTF-8 encoded string.

\n+[report issue]
\n+
\n+

creation_date()

\n
\n-bool file_absolute_path (file_index_t index) const;\n+std::time_t creation_date () const;\n 
\n-

returns true if the file at the specified index has been renamed to\n-have an absolute path, i.e. is not anchored in the save path of the\n-torrent.

\n-\n-[report issue]
\n-
\n-

file_index_at_offset() file_index_at_piece()

\n+

creation_date() returns the creation date of the torrent as time_t\n+(posix time). If there's no time stamp in the torrent file, 0 is\n+returned.\n+.. posix time: http://www.opengroup.org/onlinepubs/009695399/functions/time.html

\n+[report issue]
\n+
\n+

creator()

\n
\n-file_index_t file_index_at_offset (std::int64_t offset) const;\n-file_index_t file_index_at_piece (piece_index_t piece) const;\n+const std::string& creator () const;\n 
\n-

returns the index of the file at the given offset in the torrent

\n-[report issue]
\n-
\n-

file_index_for_root()

\n+

creator() returns the creator string in the torrent. If there is\n+no creator string it will return an empty string.

\n+[report issue]
\n+
\n+

comment()

\n
\n-file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n+const std::string& comment () const;\n 
\n-

finds the file with the given root hash and returns its index\n-if there is no file with the root hash, file_index_t{-1} is returned

\n-[report issue]
\n-
\n-

piece_index_at_file()

\n+

comment() returns the comment associated with the torrent. If\n+there's no comment, it will return an empty string.\n+comment contains UTF-8 encoded string.

\n+[report issue]
\n+
\n+

nodes()

\n
\n-piece_index_t piece_index_at_file (file_index_t f) const;\n+std::vector<std::pair<std::string, int>> const& nodes () const;\n 
\n-

returns the piece index the given file starts at

\n-[report issue]
\n-
\n-

sanitize_symlinks()

\n+

If this torrent contains any DHT nodes, they are put in this vector in\n+their original form (host name and port number).

\n+[report issue]
\n+
\n+

add_node()

\n
\n-void sanitize_symlinks ();\n+void add_node (std::pair<std::string, int> const& node);\n 
\n-

validate any symlinks, to ensure they all point to\n-other files or directories inside this storage. Any invalid symlinks\n-are updated to point to themselves.

\n-[report issue]
\n-
\n-

v2()

\n+

This is used when creating torrent. Use this to add a known DHT node.\n+It may be used, by the client, to bootstrap into the DHT network.

\n+[report issue]
\n+
\n+

parse_info_section()

\n
\n-bool v2 () const;\n+bool parse_info_section (bdecode_node const& info, error_code& ec, int max_pieces);\n 
\n-

returns true if this torrent contains v2 metadata.

\n-[report issue]
\n-
flag_pad_file
\n-
the file is a pad file. It's required to contain zeros\n-at it will not be saved to disk. Its purpose is to make\n-the following file start on a piece boundary.
\n-
\n-[report issue]
\n-
flag_hidden
\n-
this file has the hidden attribute set. This is primarily\n-a windows attribute
\n-
\n-[report issue]
\n-
flag_executable
\n-
this file has the executable attribute set.
\n-
\n-[report issue]
\n-
flag_symlink
\n-
this file is a symbolic link. It should have a link\n-target string associated with it.
\n-
\n-[report issue]
\n-
\n-
\n-

posix_disk_io_constructor()

\n-

Declared in "libtorrent/posix_disk_io.hpp"

\n+

populates the torrent_info by providing just the info-dict buffer.\n+This is used when loading a torrent from a magnet link for instance,\n+where we only have the info-dict. The bdecode_node e points to a\n+parsed info-dictionary. ec returns an error code if something\n+fails (typically if the info dictionary is malformed).\n+The max_pieces parameter allows limiting the amount of memory\n+dedicated to loading the torrent, and fails for torrents that exceed\n+the limit. To load large torrents, this limit may also need to be\n+raised in settings_pack::max_piece_count and in calls to\n+read_resume_data().

\n+[report issue]
\n+
\n+

info()

\n
\n-std::unique_ptr<disk_interface> posix_disk_io_constructor (\n-   io_context& ios, settings_interface const&, counters& cnt);\n+bdecode_node info (char const* key) const;\n 
\n-

this is a simple posix disk I/O back-end, used for systems that don't\n-have a 64 bit virtual address space or don't support memory mapped files.\n-It's implemented using portable C file functions and is single-threaded.

\n-[report issue]
\n-
\n-

mmap_disk_io_constructor()

\n-

Declared in "libtorrent/mmap_disk_io.hpp"

\n+

This function looks up keys from the info-dictionary of the loaded\n+torrent file. It can be used to access extension values put in the\n+.torrent file. If the specified key cannot be found, it returns nullptr.

\n+[report issue]
\n+
\n+

info_section()

\n
\n-std::unique_ptr<disk_interface> mmap_disk_io_constructor (\n-   io_context& ios, settings_interface const&, counters& cnt);\n+span<char const> info_section () const;\n 
\n-

constructs a memory mapped file disk I/O object.

\n-[report issue]
\n-
\n-

disabled_disk_io_constructor()

\n-

Declared in "libtorrent/disabled_disk_io.hpp"

\n+

returns a the raw info section of the torrent file.\n+The underlying buffer is still owned by the torrent_info object

\n+[report issue]
\n+
\n+

piece_layer()

\n
\n-std::unique_ptr<disk_interface> disabled_disk_io_constructor (\n-   io_context& ios, settings_interface const&, counters& cnt);\n+span<char const> piece_layer (file_index_t) const;\n 
\n-

creates a disk io object that discards all data written to it, and only\n-returns zero-buffers when read from. May be useful for testing and\n-benchmarking.

\n-[report issue]
\n-
\n-

default_disk_io_constructor()

\n-

Declared in "libtorrent/session.hpp"

\n+

return the bytes of the piece layer hashes for the specified file. If\n+the file doesn't have a piece layer, an empty span is returned.\n+The span size is divisible by 32, the size of a SHA-256 hash.\n+If the size of the file is smaller than or equal to the piece size,\n+the files "root hash" is the hash of the file and is not saved\n+separately in the "piece layers" field, but this function still\n+returns the root hash of the file in that case.

\n+[report issue]
\n+
\n+

free_piece_layers()

\n
\n-std::unique_ptr<disk_interface> default_disk_io_constructor (\n-   io_context& ios, settings_interface const&, counters& cnt);\n+void free_piece_layers ();\n 
\n-

the constructor function for the default storage. On systems that support\n-memory mapped files (and a 64 bit address space) the memory mapped storage\n-will be constructed, otherwise the portable posix storage.

\n-[report issue]
\n-
\n-

enum storage_mode_t

\n-

Declared in "libtorrent/storage_defs.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
storage_mode_allocate0All pieces will be written to their final position, all files will be\n-allocated in full when the torrent is first started. This mode minimizes\n-fragmentation but could be a costly operation.
storage_mode_sparse1All pieces will be written to the place where they belong and sparse files\n-will be used. This is the recommended, and default mode.
\n-[report issue]
\n-
\n-

enum status_t

\n-

Declared in "libtorrent/storage_defs.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
no_error0 
fatal_disk_error1 
need_full_check2 
file_exist3 
oversized_file16this is not an enum value, but a flag that can be set in the return\n-from async_check_files, in case an existing file was found larger than\n-specified in the torrent. i.e. it has garbage at the end\n-the status_t field is used for this to preserve ABI.
\n-[report issue]
\n-
\n-

enum move_flags_t

\n-

Declared in "libtorrent/storage_defs.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
namevaluedescription
always_replace_files0replace any files in the destination when copying\n-or moving the storage
fail_if_exist1if any files that we want to copy exist in the destination\n-exist, fail the whole operation and don't perform\n-any copy or move. There is an inherent race condition\n-in this mode. The files are checked for existence before\n-the operation starts. In between the check and performing\n-the copy, the destination files may be created, in which\n-case they are replaced.
dont_replace2if any file exist in the target, take those files instead\n-of the ones we may have in the source.
\n+

clears the piece layers from the torrent_info. This is done by the\n+session when a torrent is added, to avoid storing it twice. The piece\n+layer (or other hashes part of the merkle tree) are stored in the\n+internal torrent object.

\n

You have some control over session configuration through the session::apply_settings()\n member function. To change one or more configuration options, create a settings_pack\n object and fill it with the settings to be set and pass it in to session::apply_settings().

\n

The settings_pack object is a collection of settings updates that are applied\n to the session when passed to session::apply_settings(). It's empty when\n constructed.

\n

You have control over proxy and authorization settings and also the user-agent\n that will be sent to the tracker. The user-agent will also be used to identify the\n client with other peers.

\n

Each configuration option is named with an enum value inside the\n settings_pack class. These are the available settings:

\n [report issue]
\n+
\n
\n

settings_pack

\n

Declared in "libtorrent/settings_pack.hpp"

\n

The settings_pack struct, contains the names of all settings as\n enum values. These values are passed in to the set_str(),\n set_int(), set_bool() functions, to specify the setting to\n change.

\n@@ -10706,17 +9088,17 @@\n
\n struct settings_pack final : settings_interface\n {\n    friend  void apply_pack_impl (settings_pack const*\n       , aux::session_settings_single_thread&\n       , std::vector<void(aux::session_impl::*)()>*);\n    void set_str (int name, std::string val) override;\n-   void set_int (int name, int val) override;\n    void set_int (int name, flags::bitfield_flag<Type, Tag> const val);\n    void set_bool (int name, bool val) override;\n+   void set_int (int name, int val) override;\n    bool has_val (int name) const override;\n    void clear ();\n    void clear (int name);\n    int get_int (int name) const override;\n    bool get_bool (int name) const override;\n    std::string const& get_str (int name) const override;\n    void for_each (Fun&& f) const;\n@@ -10793,55 +9175,55 @@\n       socks5_pw,\n       http,\n       http_pw,\n       i2p_proxy,\n    };\n };\n 
\n-\n \n-[report issue]
\n-

set_str() set_bool() set_int()

\n+\n+[report issue]
\n+

set_bool() set_int() set_str()

\n
\n void set_str (int name, std::string val) override;\n-void set_int (int name, int val) override;\n void set_int (int name, flags::bitfield_flag<Type, Tag> const val);\n void set_bool (int name, bool val) override;\n+void set_int (int name, int val) override;\n 
\n

set a configuration option in the settings_pack. name is one of\n the enum values from string_types, int_types or bool_types. They must\n match the respective type of the set_* function.

\n [report issue]
\n
\n

has_val()

\n
\n bool has_val (int name) const override;\n 
\n

queries whether the specified configuration option has a value set in\n this pack. name can be any enumeration value from string_types,\n int_types or bool_types.

\n [report issue]
\n-
\n+
\n

clear()

\n
\n void clear ();\n 
\n

clear the settings pack from all settings

\n [report issue]
\n-
\n+
\n

clear()

\n
\n void clear (int name);\n 
\n

clear a specific setting from the pack

\n-\n \n-[report issue]
\n-
\n-

get_bool() get_int() get_str()

\n+\n+[report issue]
\n+
\n+

get_int() get_str() get_bool()

\n
\n int get_int (int name) const override;\n bool get_bool (int name) const override;\n std::string const& get_str (int name) const override;\n 
\n

queries the current configuration option from the settings_pack.\n name is one of the enumeration values from string_types, int_types\n@@ -10850,1537 +9232,2356 @@\n value is returned.

\n [report issue]
\n
\n

enum type_bases

\n

Declared in "libtorrent/settings_pack.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
string_type_base0 
int_type_base16384 
bool_type_base32768 
type_mask49152 
index_mask16383 
\n+[report issue]
\n+
\n+

enum mmap_write_mode_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
always_pwrite0disable writing to disk via mmap, always use normal write calls
always_mmap_write1prefer using memory mapped files for disk writes (at least for\n+large files where it might make sense)
auto_mmap_write2determine whether to use pwrite or memory mapped files for disk\n+writes depending on the kind of storage behind the save path
\n+[report issue]
\n+
\n+

enum suggest_mode_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
no_piece_suggestions0 
suggest_read_cache1 
\n+[report issue]
\n+
\n+

enum choking_algorithm_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
fixed_slots_choker0This is the traditional choker with a fixed number of unchoke\n+slots (as specified by settings_pack::unchoke_slots_limit).
rate_based_choker2

This opens up unchoke slots based on the upload rate achieved to\n+peers. The more slots that are opened, the marginal upload rate\n+required to open up another slot increases. Configure the initial\n+threshold with settings_pack::rate_choker_initial_threshold.

\n+

For more information, see rate based choking.

\n+
deprecated_bittyrant_choker3 
\n+[report issue]
\n+
\n+

enum seed_choking_algorithm_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
round_robin0which round-robins the peers that are unchoked\n+when seeding. This distributes the upload bandwidth uniformly and\n+fairly. It minimizes the ability for a peer to download everything\n+without redistributing it.
fastest_upload1unchokes the peers we can send to the fastest. This might be a\n+bit more reliable in utilizing all available capacity.
anti_leech2prioritizes peers who have just started or are\n+just about to finish the download. The intention is to force\n+peers in the middle of the download to trade with each other.\n+This does not just take into account the pieces a peer is\n+reporting having downloaded, but also the pieces we have sent\n+to it.
\n+[report issue]
\n+
\n+

enum io_buffer_mode_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
enable_os_cache0 
deprecated_disable_os_cache_for_aligned_files1 
disable_os_cache2 
write_through3 
\n+[report issue]
\n+
\n+

enum bandwidth_mixed_algo_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
prefer_tcp0disables the mixed mode bandwidth balancing
peer_proportional1does not throttle uTP, throttles TCP to the same proportion\n+of throughput as there are TCP connections
\n+[report issue]
\n+
\n+

enum enc_policy

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
pe_forced0Only encrypted connections are allowed. Incoming connections that\n+are not encrypted are closed and if the encrypted outgoing\n+connection fails, a non-encrypted retry will not be made.
pe_enabled1encrypted connections are enabled, but non-encrypted connections\n+are allowed. An incoming non-encrypted connection will be accepted,\n+and if an outgoing encrypted connection fails, a non- encrypted\n+connection will be tried.
pe_disabled2only non-encrypted connections are allowed.
\n+[report issue]
\n+
\n+

enum enc_level

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
pe_plaintext1use only plain text encryption
pe_rc42use only RC4 encryption
pe_both3allow both
\n+[report issue]
\n+
\n+

enum proxy_type_t

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
none0No proxy server is used and all other fields are ignored.
socks41The server is assumed to be a SOCKS4 server that requires a\n+username.
socks52The server is assumed to be a SOCKS5 server (RFC 1928) that does\n+not require any authentication. The username and password are\n+ignored.
socks5_pw3The server is assumed to be a SOCKS5 server that supports plain\n+text username and password authentication (RFC 1929). The\n+username and password specified may be sent to the proxy if it\n+requires.
http4The server is assumed to be an HTTP proxy. If the transport used\n+for the connection is non-HTTP, the server is assumed to support\n+the CONNECT method. i.e. for web seeds and HTTP trackers, a plain\n+proxy will suffice. The proxy is assumed to not require\n+authorization. The username and password will not be used.
http_pw5The server is assumed to be an HTTP proxy that requires user\n+authorization. The username and password will be sent to the proxy.
i2p_proxy6route through a i2p SAM proxy
\n+\n+[report issue]
\n+
\n+
\n+

min_memory_usage() high_performance_seed()

\n+

Declared in "libtorrent/session.hpp"

\n+
\n+settings_pack min_memory_usage ();\n+settings_pack high_performance_seed ();\n+
\n+

The default values of the session settings are set for a regular\n+bittorrent client running on a desktop system. There are functions that\n+can set the session settings to pre set settings for other environments.\n+These can be used for the basis, and should be tweaked to fit your needs\n+better.

\n+

min_memory_usage returns settings that will use the minimal amount of\n+RAM, at the potential expense of upload and download performance. It\n+adjusts the socket buffer sizes, disables the disk cache, lowers the send\n+buffer watermarks so that each connection only has at most one block in\n+use at any one time. It lowers the outstanding blocks send to the disk\n+I/O thread so that connections only have one block waiting to be flushed\n+to disk at any given time. It lowers the max number of peers in the peer\n+list for torrents. It performs multiple smaller reads when it hashes\n+pieces, instead of reading it all into memory before hashing.

\n+

This configuration is intended to be the starting point for embedded\n+devices. It will significantly reduce memory usage.

\n+

high_performance_seed returns settings optimized for a seed box,\n+serving many peers and that doesn't do any downloading. It has a 128 MB\n+disk cache and has a limit of 400 files in its file pool. It support fast\n+upload rates by allowing large send buffers.

\n+\n+[report issue]
\n+
\n+

name_for_setting() setting_by_name()

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+
\n+char const* name_for_setting (int s);\n+int setting_by_name (string_view name);\n+
\n+

converts a setting integer (from the enums string_types, int_types or\n+bool_types) to a string, and vice versa.

\n+[report issue]
\n+
\n+

default_settings()

\n+

Declared in "libtorrent/settings_pack.hpp"

\n+
\n+settings_pack default_settings ();\n+
\n+

returns a settings_pack with every setting set to its default value

\n+[report issue]
\n+
\n+

generate_fingerprint()

\n+

Declared in "libtorrent/fingerprint.hpp"

\n+
\n+std::string generate_fingerprint (std::string name\n+   , int major, int minor = 0, int revision = 0, int tag = 0);\n+
\n+

This is a utility function to produce a client ID fingerprint formatted to\n+the most common convention. The fingerprint can be set via the\n+peer_fingerprint setting, in settings_pack.

\n+

The name string should contain exactly two characters. These are the\n+characters unique to your client, used to identify it. Make sure not to\n+clash with anybody else. Here are some taken id's:

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
id charsclient
LTlibtorrent (default)
UTuTorrent
UMuTorrent Mac
qBqBittorrent
BPBitTorrent Pro
BTBitTorrent
DEDeluge
AZAzureus
TLTribler
\n+

There's an informal directory of client id's here.

\n+

The major, minor, revision and tag parameters are used to\n+identify the version of your client.

\n+[report issue]
\n+
\n+

bitfield

\n+

Declared in "libtorrent/bitfield.hpp"

\n+

The bitfield type stores any number of bits as a bitfield\n+in a heap allocated array.

\n+
\n+struct bitfield\n+{\n+   explicit bitfield (int bits);\n+   bitfield (char const* b, int bits);\n+   bitfield (bitfield const& rhs);\n+   bitfield (bitfield&& rhs) noexcept = default;\n+   bitfield (int bits, bool val);\n+   bitfield () noexcept = default;\n+   void assign (char const* b, int const bits);\n+   bool operator[] (int index) const noexcept;\n+   bool get_bit (int index) const noexcept;\n+   void clear_bit (int index) noexcept;\n+   void set_bit (int index) noexcept;\n+   bool all_set () const noexcept;\n+   bool none_set () const noexcept;\n+   int size () const noexcept;\n+   int num_words () const noexcept;\n+   bool empty () const noexcept;\n+   char const* data () const noexcept;\n+   char* data () noexcept;\n+   void swap (bitfield& rhs) noexcept;\n+   int count () const noexcept;\n+   int find_first_set () const noexcept;\n+   int find_last_clear () const noexcept;\n+};\n+
\n+[report issue]
\n+

bitfield()

\n+
\n+explicit bitfield (int bits);\n+bitfield (char const* b, int bits);\n+bitfield (bitfield const& rhs);\n+bitfield (bitfield&& rhs) noexcept = default;\n+bitfield (int bits, bool val);\n+bitfield () noexcept = default;\n+
\n+

constructs a new bitfield. The default constructor creates an empty\n+bitfield. bits is the size of the bitfield (specified in bits).\n+val is the value to initialize the bits to. If not specified\n+all bits are initialized to 0.

\n+

The constructor taking a pointer b and bits copies a bitfield\n+from the specified buffer, and bits number of bits (rounded up to\n+the nearest byte boundary).

\n+[report issue]
\n+
\n+

assign()

\n+
\n+void assign (char const* b, int const bits);\n+
\n+

copy bitfield from buffer b of bits number of bits, rounded up to\n+the nearest byte boundary.

\n+\n+[report issue]
\n+
\n+

operator[]() get_bit()

\n+
\n+bool operator[] (int index) const noexcept;\n+bool get_bit (int index) const noexcept;\n+
\n+

query bit at index. Returns true if bit is 1, otherwise false.

\n+\n+[report issue]
\n+
\n+

clear_bit() set_bit()

\n+
\n+void clear_bit (int index) noexcept;\n+void set_bit (int index) noexcept;\n+
\n+

set bit at index to 0 (clear_bit) or 1 (set_bit).

\n+[report issue]
\n+
\n+

all_set()

\n+
\n+bool all_set () const noexcept;\n+
\n+

returns true if all bits in the bitfield are set

\n+[report issue]
\n+
\n+

none_set()

\n+
\n+bool none_set () const noexcept;\n+
\n+

returns true if no bit in the bitfield is set

\n+[report issue]
\n+
\n+

size()

\n+
\n+int size () const noexcept;\n+
\n+

returns the size of the bitfield in bits.

\n+[report issue]
\n+
\n+

num_words()

\n+
\n+int num_words () const noexcept;\n+
\n+

returns the number of 32 bit words are needed to represent all bits in\n+this bitfield.

\n+[report issue]
\n+
\n+

empty()

\n+
\n+bool empty () const noexcept;\n+
\n+

returns true if the bitfield has zero size.

\n+[report issue]
\n+
\n+

data()

\n+
\n+char const* data () const noexcept;\n+char* data () noexcept;\n+
\n+

returns a pointer to the internal buffer of the bitfield, or\n+nullptr if it's empty.

\n+[report issue]
\n+
\n+

swap()

\n+
\n+void swap (bitfield& rhs) noexcept;\n+
\n+

swaps the bit-fields two variables refer to

\n+[report issue]
\n+
\n+

count()

\n+
\n+int count () const noexcept;\n+
\n+

count the number of bits in the bitfield that are set to 1.

\n+[report issue]
\n+
\n+

find_first_set()

\n+
\n+int find_first_set () const noexcept;\n+
\n+

returns the index of the first set bit in the bitfield, i.e. 1 bit.

\n+[report issue]
\n+
\n+

find_last_clear()

\n+
\n+int find_last_clear () const noexcept;\n+
\n+

returns the index to the last cleared bit in the bitfield, i.e. 0 bit.

\n+[report issue]
\n+
\n+
\n+

hasher

\n+

Declared in "libtorrent/hasher.hpp"

\n+

this is a SHA-1 hash class.

\n+

You use it by first instantiating it, then call update() to feed it\n+with data. i.e. you don't have to keep the entire buffer of which you want to\n+create the hash in memory. You can feed the hasher parts of it at a time. When\n+You have fed the hasher with all the data, you call final() and it\n+will return the sha1-hash of the data.

\n+

The constructor that takes a char const* and an integer will construct the\n+sha1 context and feed it the data passed in.

\n+

If you want to reuse the hasher object once you have created a hash, you have to\n+call reset() to reinitialize it.

\n+

The built-in software version of sha1-algorithm was implemented\n+by Steve Reid and released as public domain.\n+For more info, see src/sha1.cpp.

\n+
\n+class hasher\n+{\n+   hasher ();\n+   hasher& operator= (hasher const&) &;\n+   explicit hasher (span<char const> data);\n+   hasher (char const* data, int len);\n+   hasher (hasher const&);\n+   hasher& update (char const* data, int len);\n+   hasher& update (span<char const> data);\n+   sha1_hash final ();\n+   void reset ();\n+};\n+
\n+\n+[report issue]
\n+

operator=() hasher()

\n+
\n+hasher& operator= (hasher const&) &;\n+explicit hasher (span<char const> data);\n+hasher (char const* data, int len);\n+hasher (hasher const&);\n+
\n+

this is the same as default constructing followed by a call to\n+update(data, len).

\n+[report issue]
\n+
\n+

update()

\n+
\n+hasher& update (char const* data, int len);\n+hasher& update (span<char const> data);\n+
\n+

append the following bytes to what is being hashed

\n+[report issue]
\n+
\n+

final()

\n+
\n+sha1_hash final ();\n+
\n+

returns the SHA-1 digest of the buffers previously passed to\n+update() and the hasher constructor.

\n+[report issue]
\n+
\n+

reset()

\n+
\n+void reset ();\n+
\n+

restore the hasher state to be as if the hasher has just been\n+default constructed.

\n+[report issue]
\n+
\n+
\n+

hasher256

\n+

Declared in "libtorrent/hasher.hpp"

\n+
\n+class hasher256\n+{\n+   hasher256 ();\n+   hasher256 (char const* data, int len);\n+   explicit hasher256 (span<char const> data);\n+   hasher256 (hasher256 const&);\n+   hasher256& operator= (hasher256 const&) &;\n+   hasher256& update (char const* data, int len);\n+   hasher256& update (span<char const> data);\n+   sha256_hash final ();\n+   void reset ();\n+   ~hasher256 ();\n+};\n+
\n+\n+[report issue]
\n+

hasher256() operator=()

\n+
\n+hasher256 (char const* data, int len);\n+explicit hasher256 (span<char const> data);\n+hasher256 (hasher256 const&);\n+hasher256& operator= (hasher256 const&) &;\n+
\n+

this is the same as default constructing followed by a call to\n+update(data, len).

\n+[report issue]
\n+
\n+

update()

\n+
\n+hasher256& update (char const* data, int len);\n+hasher256& update (span<char const> data);\n+
\n+

append the following bytes to what is being hashed

\n+[report issue]
\n+
\n+

final()

\n+
\n+sha256_hash final ();\n+
\n+

returns the SHA-1 digest of the buffers previously passed to\n+update() and the hasher constructor.

\n+[report issue]
\n+
\n+

reset()

\n+
\n+void reset ();\n+
\n+

restore the hasher state to be as if the hasher has just been\n+default constructed.

\n+[report issue]
\n+
\n+
\n+

peer_class_type_filter

\n+

Declared in "libtorrent/peer_class_type_filter.hpp"

\n+

peer_class_type_filter is a simple container for rules for adding and subtracting\n+peer-classes from peers. It is applied after the peer class filter is applied (which\n+is based on the peer's IP address).

\n+
\n+struct peer_class_type_filter\n+{\n+   void remove (socket_type_t const st, peer_class_t const peer_class);\n+   void add (socket_type_t const st, peer_class_t const peer_class);\n+   void allow (socket_type_t const st, peer_class_t const peer_class);\n+   void disallow (socket_type_t const st, peer_class_t const peer_class);\n+   std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n+   friend bool operator== (peer_class_type_filter const& lhs\n+      , peer_class_type_filter const& rhs);\n+\n+   enum socket_type_t\n+   {\n+      tcp_socket,\n+      utp_socket,\n+      ssl_tcp_socket,\n+      ssl_utp_socket,\n+      i2p_socket,\n+      num_socket_types,\n+   };\n+};\n+
\n+\n+[report issue]
\n+

add() remove()

\n+
\n+void remove (socket_type_t const st, peer_class_t const peer_class);\n+void add (socket_type_t const st, peer_class_t const peer_class);\n+
\n+

add() and remove() adds and removes a peer class to be added\n+to new peers based on socket type.

\n+\n+[report issue]
\n+
\n+

disallow() allow()

\n+
\n+void allow (socket_type_t const st, peer_class_t const peer_class);\n+void disallow (socket_type_t const st, peer_class_t const peer_class);\n+
\n+

disallow() and allow() adds and removes a peer class to be\n+removed from new peers based on socket type.

\n+

The peer_class argument cannot be greater than 31. The bitmasks representing\n+peer classes in the peer_class_type_filter are 32 bits.

\n+[report issue]
\n+
\n+

apply()

\n+
\n+std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n+
\n+

takes a bitmask of peer classes and returns a new bitmask of\n+peer classes after the rules have been applied, based on the socket type argument\n+(st).

\n+[report issue]
\n+
\n+

enum socket_type_t

\n+

Declared in "libtorrent/peer_class_type_filter.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
tcp_socket0these match the socket types from socket_type.hpp\n+shifted one down
utp_socket1 
ssl_tcp_socket2 
ssl_utp_socket3 
i2p_socket4 
num_socket_types5 
\n+[report issue]
\n+
\n+
\n+

peer_class_info

\n+

Declared in "libtorrent/peer_class.hpp"

\n+

holds settings for a peer class. Used in set_peer_class() and\n+get_peer_class() calls.

\n+
\n+struct peer_class_info\n+{\n+   bool ignore_unchoke_slots;\n+   int connection_limit_factor;\n+   std::string label;\n+   int upload_limit;\n+   int download_limit;\n+   int upload_priority;\n+   int download_priority;\n+};\n+
\n+[report issue]
\n+
ignore_unchoke_slots
\n+
ignore_unchoke_slots determines whether peers should always\n+unchoke a peer, regardless of the choking algorithm, or if it should\n+honor the unchoke slot limits. It's used for local peers by default.\n+If any of the peer classes a peer belongs to has this set to true,\n+that peer will be unchoked at all times.
\n+
\n+[report issue]
\n+
connection_limit_factor
\n+
adjusts the connection limit (global and per torrent) that applies to\n+this peer class. By default, local peers are allowed to exceed the\n+normal connection limit for instance. This is specified as a percent\n+factor. 100 makes the peer class apply normally to the limit. 200\n+means as long as there are fewer connections than twice the limit, we\n+accept this peer. This factor applies both to the global connection\n+limit and the per-torrent limit. Note that if not used carefully one\n+peer class can potentially completely starve out all other over time.
\n+
\n+[report issue]
\n+
label
\n+
not used by libtorrent. It's intended as a potentially user-facing\n+identifier of this peer class.
\n+
\n+\n+[report issue]
\n+
upload_limit download_limit
\n+
transfer rates limits for the whole peer class. They are specified in\n+bytes per second and apply to the sum of all peers that are members of\n+this class.
\n+
\n+\n+[report issue]
\n+
upload_priority download_priority
\n+
relative priorities used by the bandwidth allocator in the rate\n+limiter. If no rate limits are in use, the priority is not used\n+either. Priorities start at 1 (0 is not a valid priority) and may not\n+exceed 255.
\n+
\n+[report issue]
\n+
\n+

storage_error

\n+

Declared in "libtorrent/error_code.hpp"

\n+

used by storage to return errors\n+also includes which underlying file the\n+error happened on

\n+
\n+struct storage_error\n+{\n+   explicit operator bool () const;\n+   file_index_t file () const;\n+   void file (file_index_t f);\n+\n+   error_code ec;\n+   operation_t operation;\n+};\n+
\n+[report issue]
\n+

bool()

\n+
\n+explicit operator bool () const;\n+
\n+

explicitly converts to true if this object represents an error, and\n+false if it does not.

\n+[report issue]
\n+
\n+

file()

\n+
\n+file_index_t file () const;\n+void file (file_index_t f);\n+
\n+

set and query the index (in the torrent) of the file this error\n+occurred on. This may also have special values defined in\n+torrent_status.

\n+[report issue]
\n+
ec
\n+
the error that occurred
\n+
\n+[report issue]
\n+
operation
\n+
A code from operation_t enum, indicating what\n+kind of operation failed.
\n+
\n+[report issue]
\n+
\n+
\n+

libtorrent_category()

\n+

Declared in "libtorrent/error_code.hpp"

\n+
\n+boost::system::error_category& libtorrent_category ();\n+
\n+

return the instance of the libtorrent_error_category which\n+maps libtorrent error codes to human readable error messages.

\n+[report issue]
\n+
\n+

http_category()

\n+

Declared in "libtorrent/error_code.hpp"

\n+
\n+boost::system::error_category& http_category ();\n+
\n+

returns the error_category for HTTP errors

\n+[report issue]
\n+
\n+

pcp_category()

\n+

Declared in "libtorrent/natpmp.hpp"

\n+
\n+boost::system::error_category& pcp_category ();\n+
\n+[report issue]
\n+
\n+

upnp_category()

\n+

Declared in "libtorrent/upnp.hpp"

\n+
\n+boost::system::error_category& upnp_category ();\n+
\n+

the boost.system error category for UPnP errors

\n+[report issue]
\n+
\n+

gzip_category()

\n+

Declared in "libtorrent/gzip.hpp"

\n+
\n+boost::system::error_category& gzip_category ();\n+
\n+

get the error_category for zip errors

\n+[report issue]
\n+
\n+

socks_category()

\n+

Declared in "libtorrent/socks5_stream.hpp"

\n+
\n+boost::system::error_category& socks_category ();\n+
\n+

returns the error_category for SOCKS5 errors

\n+[report issue]
\n+
\n+

i2p_category()

\n+

Declared in "libtorrent/i2p_stream.hpp"

\n+
\n+boost::system::error_category& i2p_category ();\n+
\n+

returns the error category for I2P errors

\n+[report issue]
\n+
\n+

bdecode_category()

\n+

Declared in "libtorrent/bdecode.hpp"

\n+
\n+boost::system::error_category& bdecode_category ();\n+
\n+[report issue]
\n+
\n+

enum error_code_enum

\n+

Declared in "libtorrent/error_code.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
no_error0Not an error
file_collision1Two torrents has files which end up overwriting each other
failed_hash_check2A piece did not match its piece hash
torrent_is_no_dict3The .torrent file does not contain a bencoded dictionary at\n+its top level
torrent_missing_info4The .torrent file does not have an info dictionary
torrent_info_no_dict5The .torrent file's info entry is not a dictionary
torrent_missing_piece_length6The .torrent file does not have a piece length entry
torrent_missing_name7The .torrent file does not have a name entry
torrent_invalid_name8The .torrent file's name entry is invalid
torrent_invalid_length9The length of a file, or of the whole .torrent file is invalid.\n+Either negative or not an integer
torrent_file_parse_failed10Failed to parse a file entry in the .torrent
torrent_missing_pieces11The pieces field is missing or invalid in the .torrent file
torrent_invalid_hashes12The pieces string has incorrect length
too_many_pieces_in_torrent13The .torrent file has more pieces than is supported by libtorrent
invalid_swarm_metadata14The metadata (.torrent file) that was received from the swarm\n+matched the info-hash, but failed to be parsed
invalid_bencoding15The file or buffer is not correctly bencoded
no_files_in_torrent16The .torrent file does not contain any files
invalid_escaped_string17The string was not properly url-encoded as expected
session_is_closing18Operation is not permitted since the session is shutting down
duplicate_torrent19There's already a torrent with that info-hash added to the\n+session
invalid_torrent_handle20The supplied torrent_handle is not referring to a valid torrent
invalid_entry_type21The type requested from the entry did not match its type
missing_info_hash_in_uri22The specified URI does not contain a valid info-hash
file_too_short23One of the files in the torrent was unexpectedly small. This\n+might be caused by files being changed by an external process
unsupported_url_protocol24The URL used an unknown protocol. Currently http and\n+https (if built with openssl support) are recognized. For\n+trackers udp is recognized as well.
url_parse_error25The URL did not conform to URL syntax and failed to be parsed
peer_sent_empty_piece26The peer sent a piece message of length 0
parse_failed27A bencoded structure was corrupt and failed to be parsed
invalid_file_tag28The fast resume file was missing or had an invalid file version\n+tag
missing_info_hash29The fast resume file was missing or had an invalid info-hash
mismatching_info_hash30The info-hash did not match the torrent
invalid_hostname31The URL contained an invalid hostname
invalid_port32The URL had an invalid port
port_blocked33The port is blocked by the port-filter, and prevented the\n+connection
expected_close_bracket_in_address34The IPv6 address was expected to end with "]"
destructing_torrent35The torrent is being destructed, preventing the operation to\n+succeed
timed_out36The connection timed out
upload_upload_connection37The peer is upload only, and we are upload only. There's no point\n+in keeping the connection
uninteresting_upload_peer38The peer is upload only, and we're not interested in it. There's\n+no point in keeping the connection
invalid_info_hash39The peer sent an unknown info-hash
torrent_paused40The torrent is paused, preventing the operation from succeeding
invalid_have41The peer sent an invalid have message, either wrong size or\n+referring to a piece that doesn't exist in the torrent
invalid_bitfield_size42The bitfield message had the incorrect size
too_many_requests_when_choked43The peer kept requesting pieces after it was choked, possible\n+abuse attempt.
invalid_piece44The peer sent a piece message that does not correspond to a\n+piece request sent by the client
no_memory45memory allocation failed
torrent_aborted46The torrent is aborted, preventing the operation to succeed
self_connection47The peer is a connection to ourself, no point in keeping it
invalid_piece_size48The peer sent a piece message with invalid size, either negative\n+or greater than one block
timed_out_no_interest49The peer has not been interesting or interested in us for too\n+long, no point in keeping it around
timed_out_inactivity50The peer has not said anything in a long time, possibly dead
timed_out_no_handshake51The peer did not send a handshake within a reasonable amount of\n+time, it might not be a bittorrent peer
timed_out_no_request52The peer has been unchoked for too long without requesting any\n+data. It might be lying about its interest in us
invalid_choke53The peer sent an invalid choke message
invalid_unchoke54The peer send an invalid unchoke message
invalid_interested55The peer sent an invalid interested message
invalid_not_interested56The peer sent an invalid not-interested message
invalid_request57The peer sent an invalid piece request message
invalid_hash_list58The peer sent an invalid hash-list message (this is part of the\n+merkle-torrent extension)
invalid_hash_piece59The peer sent an invalid hash-piece message (this is part of the\n+merkle-torrent extension)
invalid_cancel60The peer sent an invalid cancel message
invalid_dht_port61The peer sent an invalid DHT port-message
invalid_suggest62The peer sent an invalid suggest piece-message
invalid_have_all63The peer sent an invalid have all-message
invalid_have_none64The peer sent an invalid have none-message
invalid_reject65The peer sent an invalid reject message
invalid_allow_fast66The peer sent an invalid allow fast-message
invalid_extended67The peer sent an invalid extension message ID
invalid_message68The peer sent an invalid message ID
sync_hash_not_found69The synchronization hash was not found in the encrypted handshake
invalid_encryption_constant70The encryption constant in the handshake is invalid
no_plaintext_mode71The peer does not support plain text, which is the selected mode
no_rc4_mode72The peer does not support RC4, which is the selected mode
unsupported_encryption_mode73The peer does not support any of the encryption modes that the\n+client supports
unsupported_encryption_mode_selected74The peer selected an encryption mode that the client did not\n+advertise and does not support
invalid_pad_size75The pad size used in the encryption handshake is of invalid size
invalid_encrypt_handshake76The encryption handshake is invalid
no_incoming_encrypted77The client is set to not support incoming encrypted connections\n+and this is an encrypted connection
no_incoming_regular78The client is set to not support incoming regular bittorrent\n+connections, and this is a regular connection
duplicate_peer_id79The client is already connected to this peer-ID
torrent_removed80Torrent was removed
packet_too_large81The packet size exceeded the upper sanity check-limit
reserved82 
http_error83The web server responded with an error
missing_location84The web server response is missing a location header
invalid_redirection85The web seed redirected to a path that no longer matches the\n+.torrent directory structure
redirecting86The connection was closed because it redirected to a different\n+URL
invalid_range87The HTTP range header is invalid
no_content_length88The HTTP response did not have a content length
banned_by_ip_filter89The IP is blocked by the IP filter
too_many_connections90At the connection limit
peer_banned91The peer is marked as banned
stopping_torrent92The torrent is stopping, causing the operation to fail
too_many_corrupt_pieces93The peer has sent too many corrupt pieces and is banned
torrent_not_ready94The torrent is not ready to receive peers
peer_not_constructed95The peer is not completely constructed yet
session_closing96The session is closing, causing the operation to fail
optimistic_disconnect97The peer was disconnected in order to leave room for a\n+potentially better peer
torrent_finished98The torrent is finished
no_router99No UPnP router found
metadata_too_large100The metadata message says the metadata exceeds the limit
invalid_metadata_request101The peer sent an invalid metadata request message
invalid_metadata_size102The peer advertised an invalid metadata size
invalid_metadata_offset103The peer sent a message with an invalid metadata offset
invalid_metadata_message104The peer sent an invalid metadata message
pex_message_too_large105The peer sent a peer exchange message that was too large
invalid_pex_message106The peer sent an invalid peer exchange message
invalid_lt_tracker_message107The peer sent an invalid tracker exchange message
too_frequent_pex108The peer sent an pex messages too often. This is a possible\n+attempt of and attack
no_metadata109The operation failed because it requires the torrent to have\n+the metadata (.torrent file) and it doesn't have it yet.\n+This happens for magnet links before they have downloaded the\n+metadata, and also torrents added by URL.
invalid_dont_have110The peer sent an invalid dont_have message. The don't have\n+message is an extension to allow peers to advertise that the\n+no longer has a piece they previously had.
requires_ssl_connection111The peer tried to connect to an SSL torrent without connecting\n+over SSL.
invalid_ssl_cert112The peer tried to connect to a torrent with a certificate\n+for a different torrent.
not_an_ssl_torrent113the torrent is not an SSL torrent, and the operation requires\n+an SSL torrent
banned_by_port_filter114peer was banned because its listen port is within a banned port\n+range, as specified by the port_filter.
invalid_session_handle115The session_handle is not referring to a valid session_impl
invalid_listen_socket116the listen socket associated with this request was closed
invalid_hash_request117 
invalid_hashes118 
invalid_hash_reject119 
deprecated_120120 
deprecated_121121 
deprecated_122122 
deprecated_123123 
deprecated_124124 
missing_file_sizes130The resume data file is missing the file sizes entry
no_files_in_resume_data131The resume data file file sizes entry is empty
missing_pieces132The resume data file is missing the pieces and slots entry
mismatching_number_of_files133The number of files in the resume data does not match the number\n+of files in the torrent
mismatching_file_size134One of the files on disk has a different size than in the fast\n+resume file
mismatching_file_timestamp135One of the files on disk has a different timestamp than in the\n+fast resume file
not_a_dictionary136The resume data file is not a dictionary
invalid_blocks_per_piece137The blocks per piece entry is invalid in the resume data file
missing_slots138The resume file is missing the slots entry, which is required\n+for torrents with compact allocation. DEPRECATED
too_many_slots139The resume file contains more slots than the torrent
invalid_slot_list140The slot entry is invalid in the resume data
invalid_piece_index141One index in the slot list is invalid
pieces_need_reorder142The pieces on disk needs to be re-ordered for the specified\n+allocation mode. This happens if you specify sparse allocation\n+and the files on disk are using compact storage. The pieces needs\n+to be moved to their right position. DEPRECATED
resume_data_not_modified143this error is returned when asking to save resume data and\n+specifying the flag to only save when there's anything new to save\n+(torrent_handle::only_if_modified) and there wasn't anything changed.
http_parse_error150The HTTP header was not correctly formatted
http_missing_location151The HTTP response was in the 300-399 range but lacked a location\n+header
http_failed_decompress152The HTTP response was encoded with gzip or deflate but\n+decompressing it failed
no_i2p_router160The URL specified an i2p address, but no i2p router is configured
no_i2p_endpoint161i2p acceptor is not available yet, can't announce without endpoint
scrape_not_available170The tracker URL doesn't support transforming it into a scrape\n+URL. i.e. it doesn't contain "announce.
invalid_tracker_response171invalid tracker response
invalid_peer_dict172invalid peer dictionary entry. Not a dictionary
tracker_failure173tracker sent a failure message
invalid_files_entry174missing or invalid files entry
invalid_hash_entry175missing or invalid hash entry
invalid_peers_entry176missing or invalid peers and peers6 entry
invalid_tracker_response_length177UDP tracker response packet has invalid size
invalid_tracker_transaction_id178invalid transaction id in UDP tracker response
invalid_tracker_action179invalid action field in UDP tracker response
announce_skipped180skipped announce (because it's assumed to be unreachable over the\n+given source network interface)
no_entropy200random number generation failed
ssrf_mitigation201blocked by SSRF mitigation
blocked_by_idna202blocked because IDNA host names are banned
torrent_unknown_version210the torrent file has an unknown meta version
torrent_missing_file_tree211the v2 torrent file has no file tree
torrent_missing_meta_version212the torrent contains v2 keys but does not specify meta version 2
torrent_inconsistent_files213the v1 and v2 file metadata does not match
torrent_missing_piece_layer214one or more files are missing piece layer hashes
torrent_invalid_piece_layer215a piece layer has the wrong size or failed hash check
torrent_missing_pieces_root216a v2 file entry has no root hash
torrent_inconsistent_hashes217the v1 and v2 hashes do not describe the same data
torrent_invalid_pad_file218a file in the v2 metadata has the pad attribute set
error_code_max219the number of error codes
\n+[report issue]
\n+
\n+

enum http_errors

\n+

Declared in "libtorrent/error_code.hpp"

\n+\n+\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-
namevaluedescription
string_type_base0
cont100 
int_type_base16384
ok200 
bool_type_base32768
created201 
type_mask49152
accepted202 
index_mask16383
no_content204 
\n-[report issue]
\n-
\n-

enum mmap_write_mode_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n+\n+\n+\n \n-\n-
namevaluedescription
multiple_choices300 
always_pwrite0disable writing to disk via mmap, always use normal write calls
moved_permanently301 
always_mmap_write1prefer using memory mapped files for disk writes (at least for\n-large files where it might make sense)
moved_temporarily302 
auto_mmap_write2determine whether to use pwrite or memory mapped files for disk\n-writes depending on the kind of storage behind the save path
not_modified304 
\n-[report issue]
\n-
\n-

enum suggest_mode_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-
namevaluedescription
bad_request400 
no_piece_suggestions0
unauthorized401 
suggest_read_cache1
forbidden403 
\n-[report issue]
\n-
\n-

enum choking_algorithm_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n+\n+\n+\n \n \n \n
namevaluedescription
not_found404 
fixed_slots_choker0This is the traditional choker with a fixed number of unchoke\n-slots (as specified by settings_pack::unchoke_slots_limit).
internal_server_error500 
rate_based_choker2

This opens up unchoke slots based on the upload rate achieved to\n-peers. The more slots that are opened, the marginal upload rate\n-required to open up another slot increases. Configure the initial\n-threshold with settings_pack::rate_choker_initial_threshold.

\n-

For more information, see rate based choking.

\n-
not_implemented501 
deprecated_bittyrant_choker3
bad_gateway502 
service_unavailable503 
\n-[report issue]
\n-
\n-

enum seed_choking_algorithm_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n+[report issue]
\n+
\n+

enum pcp_errors

\n+

Declared in "libtorrent/natpmp.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n-
namevaluedescription
round_robin
pcp_success0which round-robins the peers that are unchoked\n-when seeding. This distributes the upload bandwidth uniformly and\n-fairly. It minimizes the ability for a peer to download everything\n-without redistributing it. 
fastest_upload
pcp_unsupp_version1unchokes the peers we can send to the fastest. This might be a\n-bit more reliable in utilizing all available capacity. 
anti_leech
pcp_not_authorized2prioritizes peers who have just started or are\n-just about to finish the download. The intention is to force\n-peers in the middle of the download to trade with each other.\n-This does not just take into account the pieces a peer is\n-reporting having downloaded, but also the pieces we have sent\n-to it. 
\n-[report issue]
\n-
\n-

enum io_buffer_mode_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-\n+\n+\n \n \n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n \n \n
namevaluedescription
pcp_malformed_request3 
enable_os_cache0
pcp_unsupp_opcode4 
deprecated_disable_os_cache_for_aligned_files1
pcp_unsupp_option5 
disable_os_cache2
pcp_malformed_option6 
write_through3
pcp_network_failure7 
pcp_no_resources8 
pcp_unsupp_protocol9 
pcp_user_ex_quota10 
pcp_cannot_provide_external11 
pcp_address_mismatch12 
pcp_excessive_remote_peers13 
\n-[report issue]
\n-
\n-

enum bandwidth_mixed_algo_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n+[report issue]
\n+
\n+

enum error_code_enum

\n+

Declared in "libtorrent/upnp.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n \n-\n+\n \n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n \n
namevaluedescription
prefer_tcp
no_error0disables the mixed mode bandwidth balancingNo error
peer_proportional1does not throttle uTP, throttles TCP to the same proportion\n-of throughput as there are TCP connections
invalid_argument402One of the arguments in the request is invalid
action_failed501The request failed
value_not_in_array714The specified value does not exist in the array
source_ip_cannot_be_wildcarded715The source IP address cannot be wild-carded, but\n+must be fully specified
external_port_cannot_be_wildcarded716The external port cannot be a wildcard, but must\n+be specified
port_mapping_conflict718The port mapping entry specified conflicts with a\n+mapping assigned previously to another client
internal_port_must_match_external724Internal and external port value must be the same
only_permanent_leases_supported725The NAT implementation only supports permanent\n+lease times on port mappings
remote_host_must_be_wildcard726RemoteHost must be a wildcard and cannot be a\n+specific IP address or DNS name
external_port_must_be_wildcard727ExternalPort must be a wildcard and cannot be a\n+specific port
\n-[report issue]
\n-
\n-

enum enc_policy

\n-

Declared in "libtorrent/settings_pack.hpp"

\n+[report issue]
\n+
\n+

enum error_code_enum

\n+

Declared in "libtorrent/gzip.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n \n
namevaluedescription
pe_forced
no_error0Only encrypted connections are allowed. Incoming connections that\n-are not encrypted are closed and if the encrypted outgoing\n-connection fails, a non-encrypted retry will not be made.Not an error
pe_enabled
invalid_gzip_header1encrypted connections are enabled, but non-encrypted connections\n-are allowed. An incoming non-encrypted connection will be accepted,\n-and if an outgoing encrypted connection fails, a non- encrypted\n-connection will be tried.the supplied gzip buffer has invalid header
pe_disabled
inflated_data_too_large2only non-encrypted connections are allowed.the gzip buffer would inflate to more bytes than the specified\n+maximum size, and was rejected.
data_did_not_terminate3available inflate data did not terminate
space_exhausted4output space exhausted before completing inflate
invalid_block_type5invalid block type (type == 3)
invalid_stored_block_length6stored block length did not match one's complement
too_many_length_or_distance_codes7dynamic block code description: too many length or distance codes
code_lengths_codes_incomplete8dynamic block code description: code lengths codes incomplete
repeat_lengths_with_no_first_length9dynamic block code description: repeat lengths with no first length
repeat_more_than_specified_lengths10dynamic block code description: repeat more than specified lengths
invalid_literal_length_code_lengths11dynamic block code description: invalid literal/length code lengths
invalid_distance_code_lengths12dynamic block code description: invalid distance code lengths
invalid_literal_code_in_block13invalid literal/length or distance code in fixed or dynamic block
distance_too_far_back_in_block14distance is too far back in fixed or dynamic block
unknown_gzip_error15an unknown error occurred during gzip inflation
error_code_max16the number of error codes
\n-[report issue]
\n-
\n-

enum enc_level

\n-

Declared in "libtorrent/settings_pack.hpp"

\n+[report issue]
\n+
\n+

enum socks_error_code

\n+

Declared in "libtorrent/socks5_stream.hpp"

\n \n \n-\n+\n \n-\n+\n \n \n \n \n \n \n \n \n-\n+\n+\n+\n+\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n \n
namevaluedescription
pe_plaintext
no_error0 
unsupported_version1use only plain text encryption 
pe_rc4
unsupported_authentication_method2use only RC4 encryption 
pe_both
unsupported_authentication_version3allow both 
authentication_error4 
username_required5 
general_failure6 
command_not_supported7 
no_identd8 
identd_error9 
num_errors10 
\n-[report issue]
\n-
\n-

enum proxy_type_t

\n-

Declared in "libtorrent/settings_pack.hpp"

\n+[report issue]
\n+
\n+

enum i2p_error_code

\n+

Declared in "libtorrent/i2p_stream.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n \n
namevaluedescription
none
no_error0No proxy server is used and all other fields are ignored. 
socks4
parse_failed1The server is assumed to be a SOCKS4 server that requires a\n-username. 
socks5
cant_reach_peer2The server is assumed to be a SOCKS5 server (RFC 1928) that does\n-not require any authentication. The username and password are\n-ignored. 
socks5_pw
i2p_error3The server is assumed to be a SOCKS5 server that supports plain\n-text username and password authentication (RFC 1929). The\n-username and password specified may be sent to the proxy if it\n-requires. 
http
invalid_key4The server is assumed to be an HTTP proxy. If the transport used\n-for the connection is non-HTTP, the server is assumed to support\n-the CONNECT method. i.e. for web seeds and HTTP trackers, a plain\n-proxy will suffice. The proxy is assumed to not require\n-authorization. The username and password will not be used. 
http_pw
invalid_id5The server is assumed to be an HTTP proxy that requires user\n-authorization. The username and password will be sent to the proxy. 
i2p_proxy
timeout6route through a i2p SAM proxy 
key_not_found7 
duplicated_id8 
num_errors9 
\n-[report issue]
\n-
\n-
\n-

generate_fingerprint()

\n-

Declared in "libtorrent/fingerprint.hpp"

\n-
\n-std::string generate_fingerprint (std::string name\n-   , int major, int minor = 0, int revision = 0, int tag = 0);\n-
\n-

This is a utility function to produce a client ID fingerprint formatted to\n-the most common convention. The fingerprint can be set via the\n-peer_fingerprint setting, in settings_pack.

\n-

The name string should contain exactly two characters. These are the\n-characters unique to your client, used to identify it. Make sure not to\n-clash with anybody else. Here are some taken id's:

\n+[report issue]
\n+
\n+

enum error_code_enum

\n+

Declared in "libtorrent/bdecode.hpp"

\n \n \n-\n-\n+\n+\n+\n \n \n-\n-\n+\n+\n+\n \n \n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n-\n-\n+\n+\n+\n \n \n
id charsclient
namevaluedescription
LTlibtorrent (default)
no_error0Not an error
UTuTorrent
expected_digit1expected digit in bencoded string
UMuTorrent Mac
expected_colon2expected colon in bencoded string
qBqBittorrent
unexpected_eof3unexpected end of file in bencoded string
BPBitTorrent Pro
expected_value4expected value (list, dict, int or string) in bencoded string
BTBitTorrent
depth_exceeded5bencoded recursion depth limit exceeded
DEDeluge
limit_exceeded6bencoded item count limit exceeded
AZAzureus
overflow7integer overflow
TLTribler
error_code_max8the number of error codes
\n-

There's an informal directory of client id's here.

\n-

The major, minor, revision and tag parameters are used to\n-identify the version of your client.

\n-\n-[report issue]
\n-
\n-

name_for_setting() setting_by_name()

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-
\n-int setting_by_name (string_view name);\n-char const* name_for_setting (int s);\n-
\n-

converts a setting integer (from the enums string_types, int_types or\n-bool_types) to a string, and vice versa.

\n-[report issue]
\n-
\n-

default_settings()

\n-

Declared in "libtorrent/settings_pack.hpp"

\n-
\n-settings_pack default_settings ();\n-
\n-

returns a settings_pack with every setting set to its default value

\n-\n-[report issue]
\n-
\n-

high_performance_seed() min_memory_usage()

\n-

Declared in "libtorrent/session.hpp"

\n-
\n-settings_pack min_memory_usage ();\n-settings_pack high_performance_seed ();\n-
\n-

The default values of the session settings are set for a regular\n-bittorrent client running on a desktop system. There are functions that\n-can set the session settings to pre set settings for other environments.\n-These can be used for the basis, and should be tweaked to fit your needs\n-better.

\n-

min_memory_usage returns settings that will use the minimal amount of\n-RAM, at the potential expense of upload and download performance. It\n-adjusts the socket buffer sizes, disables the disk cache, lowers the send\n-buffer watermarks so that each connection only has at most one block in\n-use at any one time. It lowers the outstanding blocks send to the disk\n-I/O thread so that connections only have one block waiting to be flushed\n-to disk at any given time. It lowers the max number of peers in the peer\n-list for torrents. It performs multiple smaller reads when it hashes\n-pieces, instead of reading it all into memory before hashing.

\n-

This configuration is intended to be the starting point for embedded\n-devices. It will significantly reduce memory usage.

\n-

high_performance_seed returns settings optimized for a seed box,\n-serving many peers and that doesn't do any downloading. It has a 128 MB\n-disk cache and has a limit of 400 files in its file pool. It support fast\n-upload rates by allowing large send buffers.

\n-[report issue]
\n-
\n-

session_params

\n-

Declared in "libtorrent/session_params.hpp"

\n-

The session_params is a parameters pack for configuring the session\n-before it's started.

\n-
\n-struct session_params\n-{\n-   session_params (settings_pack const& sp);\n-   session_params ();\n-   session_params (settings_pack&& sp);\n-   session_params (settings_pack const& sp\n-      , std::vector<std::shared_ptr<plugin>> exts);\n-   session_params (settings_pack&& sp\n-      , std::vector<std::shared_ptr<plugin>> exts);\n-\n-   settings_pack settings;\n-   std::vector<std::shared_ptr<plugin>> extensions;\n-   dht::dht_state dht_state;\n-   dht::dht_storage_constructor_type dht_storage_constructor;\n-   disk_io_constructor_type disk_io_constructor;\n-   std::map<std::string, std::string> ext_state;\n-   libtorrent::ip_filter ip_filter;\n-};\n-
\n-[report issue]
\n-

session_params()

\n-
\n-session_params (settings_pack const& sp);\n-session_params ();\n-session_params (settings_pack&& sp);\n-
\n-

This constructor can be used to start with the default plugins\n-(ut_metadata, ut_pex and smart_ban). Pass a settings_pack to set the\n-initial settings when the session starts.

\n-[report issue]
\n-
\n-

session_params()

\n-
\n-session_params (settings_pack const& sp\n-      , std::vector<std::shared_ptr<plugin>> exts);\n-session_params (settings_pack&& sp\n-      , std::vector<std::shared_ptr<plugin>> exts);\n-
\n-

This constructor helps to configure the set of initial plugins\n-to be added to the session before it's started.

\n-[report issue]
\n-
settings
\n-
The settings to configure the session with
\n-
\n-[report issue]
\n-
extensions
\n-
the plugins to add to the session as it is constructed
\n-
\n-[report issue]
\n-
dht_state
\n-
DHT node ID and node addresses to bootstrap the DHT with.
\n-
\n-[report issue]
\n-
dht_storage_constructor
\n-
function object to construct the storage object for DHT items.
\n-
\n-[report issue]
\n-
disk_io_constructor
\n-
function object to create the disk I/O subsystem. Defaults to\n-default_disk_io_constructor.
\n-
\n-[report issue]
\n-
ext_state
\n-
this container can be used by extensions/plugins to store settings. It's\n-primarily here to make it convenient to save and restore state across\n-sessions, using read_session_params() and write_session_params().
\n-
\n-[report issue]
\n-
ip_filter
\n-
the IP filter to use for the session. This restricts which peers are allowed\n-to connect. As if passed to set_ip_filter().
\n-
\n-[report issue]
\n-
\n-
\n-

session_proxy

\n-

Declared in "libtorrent/session.hpp"

\n-

this is a holder for the internal session implementation object. Once the\n-session destruction is explicitly initiated, this holder is used to\n-synchronize the completion of the shutdown. The lifetime of this object\n-may outlive session, causing the session destructor to not block. The\n-session_proxy destructor will block however, until the underlying session\n-is done shutting down.

\n-
\n-struct session_proxy\n-{\n-   session_proxy ();\n-   session_proxy (session_proxy&&) noexcept;\n-   session_proxy (session_proxy const&);\n-   session_proxy& operator= (session_proxy const&) &;\n-   ~session_proxy ();\n-   session_proxy& operator= (session_proxy&&) & noexcept;\n-};\n-
\n-\n-\n-[report issue]
\n-

~session_proxy() operator=() session_proxy()

\n-
\n-session_proxy ();\n-session_proxy (session_proxy&&) noexcept;\n-session_proxy (session_proxy const&);\n-session_proxy& operator= (session_proxy const&) &;\n-~session_proxy ();\n-session_proxy& operator= (session_proxy&&) & noexcept;\n-
\n-

default constructor, does not refer to any session\n-implementation object.

\n-[report issue]
\n-
\n-
\n-

session

\n-

Declared in "libtorrent/session.hpp"

\n-

The session holds all state that spans multiple torrents. Among other\n-things it runs the network loop and manages all torrents. Once it's\n-created, the session object will spawn the main thread that will do all\n-the work. The main thread will be idle as long it doesn't have any\n-torrents to participate in.

\n-

You have some control over session configuration through the\n-session_handle::apply_settings() member function. To change one or more\n-configuration options, create a settings_pack. object and fill it with\n-the settings to be set and pass it in to session::apply_settings().

\n-

see apply_settings().

\n+[report issue]
\n+
\n+

counters

\n+

Declared in "libtorrent/performance_counters.hpp"

\n
\n-struct session : session_handle\n+struct counters\n {\n-   explicit session (session_params&& params);\n-   explicit session (session_params const& params);\n-   session (session_params const& params, session_flags_t flags);\n-   session (session_params&& params, session_flags_t flags);\n-   session ();\n-   session (session_params&& params, io_context& ios, session_flags_t);\n-   session (session_params&& params, io_context& ios);\n-   session (session_params const& params, io_context& ios, session_flags_t);\n-   session (session_params const& params, io_context& ios);\n-   ~session ();\n-   session_proxy abort ();\n+   counters () ;\n+   counters (counters const&) ;\n+   counters& operator= (counters const&) & ;\n+   std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n+   std::int64_t operator[] (int i) const ;\n+   void set_value (int c, std::int64_t value) ;\n+   void blend_stats_counter (int c, std::int64_t value, int ratio) ;\n };\n 
\n-[report issue]
\n-

session()

\n-
\n-explicit session (session_params&& params);\n-explicit session (session_params const& params);\n-session (session_params const& params, session_flags_t flags);\n-session (session_params&& params, session_flags_t flags);\n-session ();\n-
\n-

Constructs the session objects which acts as the container of torrents.\n-In order to avoid a race condition between starting the session and\n-configuring it, you can pass in a session_params object. Its settings\n-will take effect before the session starts up.

\n-

The overloads taking flags can be used to start a session in\n-paused mode (by passing in session::paused). Note that\n-add_default_plugins do not have an affect on constructors that\n-take a session_params object. It already contains the plugins to use.

\n-[report issue]
\n-
\n-

session()

\n-
\n-session (session_params&& params, io_context& ios, session_flags_t);\n-session (session_params&& params, io_context& ios);\n-session (session_params const& params, io_context& ios, session_flags_t);\n-session (session_params const& params, io_context& ios);\n-
\n-

Overload of the constructor that takes an external io_context to run\n-the session object on. This is primarily useful for tests that may want\n-to run multiple sessions on a single io_context, or low resource\n-systems where additional threads are expensive and sharing an\n-io_context with other events is fine.

\n-
\n-

Warning

\n-

The session object does not cleanly terminate with an external\n-io_context. The io_context::run() call must have returned\n-before it's safe to destruct the session. Which means you MUST\n-call session::abort() and save the session_proxy first, then\n-destruct the session object, then sync with the io_context, then\n-destruct the session_proxy object.

\n-
\n-[report issue]
\n-
\n-

~session()

\n-
\n-~session ();\n-
\n-

The destructor of session will notify all trackers that our torrents\n-have been shut down. If some trackers are down, they will time out.\n-All this before the destructor of session returns. So, it's advised\n-that any kind of interface (such as windows) are closed before\n-destructing the session object. Because it can take a few second for\n-it to finish. The timeout can be set with apply_settings().

\n-[report issue]
\n-
\n-

abort()

\n-
\n-session_proxy abort ();\n-
\n-

In case you want to destruct the session asynchronously, you can\n-request a session destruction proxy. If you don't do this, the\n-destructor of the session object will block while the trackers are\n-contacted. If you keep one session_proxy to the session when\n-destructing it, the destructor will not block, but start to close down\n-the session, the destructor of the proxy will then synchronize the\n-threads. So, the destruction of the session is performed from the\n-session destructor call until the session_proxy destructor\n-call. The session_proxy does not have any operations on it (since\n-the session is being closed down, no operations are allowed on it).\n-The only valid operation is calling the destructor:

\n+\n+[report issue]
\n+

operator[]() inc_stats_counter()

\n
\n-struct session_proxy {};\n+std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n+std::int64_t operator[] (int i) const ;\n 
\n-[report issue]
\n+

returns the new value

\n+[report issue]
\n
\n-
\n-

session_handle

\n-

Declared in "libtorrent/session_handle.hpp"

\n-

this class provides a non-owning handle to a session and a subset of the\n-interface of the session class. If the underlying session is destructed\n-any handle to it will no longer be valid. is_valid() will return false and\n-any operation on it will throw a system_error exception, with error code\n-invalid_session_handle.

\n+
\n+

stats_metric

\n+

Declared in "libtorrent/session_stats.hpp"

\n+

describes one statistics metric from the session. For more information,\n+see the session statistics section.

\n
\n-struct session_handle\n+struct stats_metric\n {\n-   bool is_valid () const;\n-   session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;\n-   void refresh_torrent_status (std::vector<torrent_status>* ret\n-      , status_flags_t flags = {}) const;\n-   std::vector<torrent_status> get_torrent_status (\n-      std::function<bool(torrent_status const&)> const& pred\n-      , status_flags_t flags = {}) const;\n-   void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n-   void post_session_stats ();\n-   void post_dht_stats ();\n-   void set_dht_state (dht::dht_state const& st);\n-   void set_dht_state (dht::dht_state&& st);\n-   std::vector<torrent_handle> get_torrents () const;\n-   torrent_handle find_torrent (sha1_hash const& info_hash) const;\n-   torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n-   torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);\n-   torrent_handle add_torrent (add_torrent_params&& params);\n-   void async_add_torrent (add_torrent_params const& params);\n-   void async_add_torrent (add_torrent_params&& params);\n-   torrent_handle add_torrent (add_torrent_params const& params);\n-   void pause ();\n-   void resume ();\n-   bool is_paused () const;\n-   bool is_dht_running () const;\n-   void set_dht_storage (dht::dht_storage_constructor_type sc);\n-   void add_dht_node (std::pair<std::string, int> const& node);\n-   void dht_get_item (sha1_hash const& target);\n-   void dht_get_item (std::array<char, 32> key\n-      , std::string salt = std::string());\n-   sha1_hash dht_put_item (entry data);\n-   void dht_put_item (std::array<char, 32> key\n-      , std::function<void(entry&, std::array<char, 64>&\n-      , std::int64_t&, std::string const&)> cb\n-      , std::string salt = std::string());\n-   void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});\n-   void dht_get_peers (sha1_hash const& info_hash);\n-   void dht_live_nodes (sha1_hash const& nid);\n-   void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);\n-   void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});\n-   void add_extension (std::function<std::shared_ptr<torrent_plugin>(\n-      torrent_handle const&, client_data_t)> ext);\n-   void add_extension (std::shared_ptr<plugin> ext);\n-   void set_ip_filter (ip_filter f);\n-   ip_filter get_ip_filter () const;\n-   void set_port_filter (port_filter const& f);\n-   unsigned short ssl_listen_port () const;\n-   unsigned short listen_port () const;\n-   bool is_listening () const;\n-   ip_filter get_peer_class_filter () const;\n-   void set_peer_class_filter (ip_filter const& f);\n-   void set_peer_class_type_filter (peer_class_type_filter const& f);\n-   peer_class_type_filter get_peer_class_type_filter () const;\n-   peer_class_t create_peer_class (char const* name);\n-   void delete_peer_class (peer_class_t cid);\n-   peer_class_info get_peer_class (peer_class_t cid) const;\n-   void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n-   void remove_torrent (const torrent_handle&, remove_flags_t = {});\n-   void apply_settings (settings_pack&&);\n-   void apply_settings (settings_pack const&);\n-   settings_pack get_settings () const;\n-   void set_alert_notify (std::function<void()> const& fun);\n-   void pop_alerts (std::vector<alert*>* alerts);\n-   alert* wait_for_alert (time_duration max_wait);\n-   std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);\n-   void delete_port_mapping (port_mapping_t handle);\n-   void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);\n-   std::shared_ptr<aux::session_impl> native_handle () const;\n-\n-   static constexpr save_state_flags_t save_settings  = 0_bit;\n-   static constexpr save_state_flags_t save_dht_state  = 2_bit;\n-   static constexpr save_state_flags_t save_extension_state  = 11_bit;\n-   static constexpr save_state_flags_t save_ip_filter  = 12_bit;\n-   static constexpr peer_class_t global_peer_class_id {0};\n-   static constexpr peer_class_t tcp_peer_class_id {1};\n-   static constexpr peer_class_t local_peer_class_id {2};\n-   static constexpr remove_flags_t delete_files  = 0_bit;\n-   static constexpr remove_flags_t delete_partfile  = 1_bit;\n-   static constexpr session_flags_t paused  = 2_bit;\n-   static constexpr portmap_protocol udp  = portmap_protocol::udp;\n-   static constexpr portmap_protocol tcp  = portmap_protocol::tcp;\n-   static constexpr reopen_network_flags_t reopen_map_ports  = 0_bit;\n+   char const* name;\n+   int value_index;\n+   metric_type_t type;\n };\n 
\n-[report issue]
\n-

is_valid()

\n-
\n-bool is_valid () const;\n-
\n-

returns true if this handle refers to a valid session object. If the\n-session has been destroyed, all session_handle objects will expire and\n-not be valid.

\n-[report issue]
\n-
\n-

session_state()

\n-
\n-session_params session_state (save_state_flags_t flags = save_state_flags_t::all()) const;\n-
\n-

returns the current session state. This can be passed to\n-write_session_params() to save the state to disk and restored using\n-read_session_params() when constructing a new session. The kind of\n-state that's included is all settings, the DHT routing table, possibly\n-plugin-specific state.\n-the flags parameter can be used to only save certain parts of the\n-session state

\n-\n-[report issue]
\n-
\n-

get_torrent_status() refresh_torrent_status()

\n-
\n-void refresh_torrent_status (std::vector<torrent_status>* ret\n-      , status_flags_t flags = {}) const;\n-std::vector<torrent_status> get_torrent_status (\n-      std::function<bool(torrent_status const&)> const& pred\n-      , status_flags_t flags = {}) const;\n-
\n-
\n-

Note

\n-

these calls are potentially expensive and won't scale well with\n-lots of torrents. If you're concerned about performance, consider\n-using post_torrent_updates() instead.

\n-
\n-

get_torrent_status returns a vector of the torrent_status for\n-every torrent which satisfies pred, which is a predicate function\n-which determines if a torrent should be included in the returned set\n-or not. Returning true means it should be included and false means\n-excluded. The flags argument is the same as to\n-torrent_handle::status(). Since pred is guaranteed to be\n-called for every torrent, it may be used to count the number of\n-torrents of different categories as well.

\n-

refresh_torrent_status takes a vector of torrent_status structs\n-(for instance the same vector that was returned by\n-get_torrent_status() ) and refreshes the status based on the\n-handle member. It is possible to use this function by first\n-setting up a vector of default constructed torrent_status objects,\n-only initializing the handle member, in order to request the\n-torrent status for multiple torrents in a single call. This can save a\n-significant amount of time if you have a lot of torrents.

\n-

Any torrent_status object whose handle member is not referring to\n-a valid torrent are ignored.

\n-

The intended use of these functions is to start off by calling\n-get_torrent_status() to get a list of all torrents that match your\n-criteria. Then call refresh_torrent_status() on that list. This\n-will only refresh the status for the torrents in your list, and thus\n-ignore all other torrents you might be running. This may save a\n-significant amount of time, especially if the number of torrents you're\n-interested in is small. In order to keep your list of interested\n-torrents up to date, you can either call get_torrent_status() from\n-time to time, to include torrents you might have become interested in\n-since the last time. In order to stop refreshing a certain torrent,\n-simply remove it from the list.

\n-[report issue]
\n-
\n-

post_torrent_updates()

\n-
\n-void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n-
\n-

This functions instructs the session to post the state_update_alert,\n-containing the status of all torrents whose state changed since the\n-last time this function was called.

\n-

Only torrents who has the state subscription flag set will be\n-included. This flag is on by default. See add_torrent_params.\n-the flags argument is the same as for torrent_handle::status().\n-see status_flags_t in torrent_handle.

\n-[report issue]
\n-
\n-

post_session_stats()

\n-
\n-void post_session_stats ();\n-
\n-

This function will post a session_stats_alert object, containing a\n-snapshot of the performance counters from the internals of libtorrent.\n-To interpret these counters, query the session via\n-session_stats_metrics().

\n-

For more information, see the session statistics section.

\n-[report issue]
\n-
\n-

post_dht_stats()

\n-
\n-void post_dht_stats ();\n-
\n-

This will cause a dht_stats_alert to be posted.

\n-[report issue]
\n-
\n-

set_dht_state()

\n-
\n-void set_dht_state (dht::dht_state const& st);\n-void set_dht_state (dht::dht_state&& st);\n-
\n-

set the DHT state for the session. This will be taken into account the\n-next time the DHT is started, as if it had been passed in via the\n-session_params on startup.

\n-\n-[report issue]
\n-
\n-

find_torrent() get_torrents()

\n-
\n-std::vector<torrent_handle> get_torrents () const;\n-torrent_handle find_torrent (sha1_hash const& info_hash) const;\n-
\n-

find_torrent() looks for a torrent with the given info-hash. In\n-case there is such a torrent in the session, a torrent_handle to that\n-torrent is returned. In case the torrent cannot be found, an invalid\n-torrent_handle is returned.

\n-

See torrent_handle::is_valid() to know if the torrent was found or\n-not.

\n-

get_torrents() returns a vector of torrent_handles to all the\n-torrents currently in the session.

\n-\n-[report issue]
\n-
\n-

add_torrent() async_add_torrent()

\n-
\n-torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n-torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);\n-torrent_handle add_torrent (add_torrent_params&& params);\n-void async_add_torrent (add_torrent_params const& params);\n-void async_add_torrent (add_torrent_params&& params);\n-torrent_handle add_torrent (add_torrent_params const& params);\n-
\n-

You add torrents through the add_torrent() function where you give an\n-object with all the parameters. The add_torrent() overloads will block\n-until the torrent has been added (or failed to be added) and returns\n-an error code and a torrent_handle. In order to add torrents more\n-efficiently, consider using async_add_torrent() which returns\n-immediately, without waiting for the torrent to add. Notification of\n-the torrent being added is sent as add_torrent_alert.

\n-

The overload that does not take an error_code throws an exception on\n-error and is not available when building without exception support.\n-The torrent_handle returned by add_torrent() can be used to retrieve\n-information about the torrent's progress, its peers etc. It is also\n-used to abort a torrent.

\n-

If the torrent you are trying to add already exists in the session (is\n-either queued for checking, being checked or downloading)\n-add_torrent() will throw system_error which derives from\n-std::exception unless duplicate_is_error is set to false. In that\n-case, add_torrent() will return the handle to the existing torrent.

\n-

The add_torrent_params class has a flags field. It can be used to\n-control what state the new torrent will be added in. Common flags to\n-want to control are torrent_flags::paused and\n-torrent_flags::auto_managed. In order to add a magnet link that will\n-just download the metadata, but no payload, set the\n-torrent_flags::upload_mode flag.

\n-

Special consideration has to be taken when adding hybrid torrents\n-(i.e. torrents that are BitTorrent v2 torrents that are backwards\n-compatible with v1). For more details, see BitTorrent v2 torrents.

\n-\n-\n-[report issue]
\n-
\n-

resume() pause() is_paused()

\n-
\n-void pause ();\n-void resume ();\n-bool is_paused () const;\n-
\n-

Pausing the session has the same effect as pausing every torrent in\n-it, except that torrents will not be resumed by the auto-manage\n-mechanism. Resuming will restore the torrents to their previous paused\n-state. i.e. the session pause state is separate from the torrent pause\n-state. A torrent is inactive if it is paused or if the session is\n-paused.

\n-[report issue]
\n-
\n-

is_dht_running()

\n-
\n-bool is_dht_running () const;\n-
\n-

is_dht_running() returns true if the DHT support has been started\n-and false otherwise.

\n-[report issue]
\n-
\n-

set_dht_storage()

\n-
\n-void set_dht_storage (dht::dht_storage_constructor_type sc);\n-
\n-

set_dht_storage set a dht custom storage constructor function\n-to be used internally when the dht is created.

\n-

Since the dht storage is a critical component for the dht behavior,\n-this function will only be effective the next time the dht is started.\n-If you never touch this feature, a default map-memory based storage\n-is used.

\n-

If you want to make sure the dht is initially created with your\n-custom storage, create a session with the setting\n-settings_pack::enable_dht to false, set your constructor function\n-and call apply_settings with settings_pack::enable_dht to true.

\n-[report issue]
\n-
\n-

add_dht_node()

\n-
\n-void add_dht_node (std::pair<std::string, int> const& node);\n-
\n-

add_dht_node takes a host name and port pair. That endpoint will be\n-pinged, and if a valid DHT reply is received, the node will be added to\n-the routing table.

\n-[report issue]
\n-
\n-

dht_get_item()

\n-
\n-void dht_get_item (sha1_hash const& target);\n-
\n-

query the DHT for an immutable item at the target hash.\n-the result is posted as a dht_immutable_item_alert.

\n-[report issue]
\n-
\n-

dht_get_item()

\n-
\n-void dht_get_item (std::array<char, 32> key\n-      , std::string salt = std::string());\n-
\n-

query the DHT for a mutable item under the public key key.\n-this is an ed25519 key. salt is optional and may be left\n-as an empty string if no salt is to be used.\n-if the item is found in the DHT, a dht_mutable_item_alert is\n-posted.

\n-[report issue]
\n-
\n-

dht_put_item()

\n-
\n-sha1_hash dht_put_item (entry data);\n-
\n-

store the given bencoded data as an immutable item in the DHT.\n-the returned hash is the key that is to be used to look the item\n-up again. It's just the SHA-1 hash of the bencoded form of the\n-structure.

\n-[report issue]
\n-
\n-

dht_put_item()

\n-
\n-void dht_put_item (std::array<char, 32> key\n-      , std::function<void(entry&, std::array<char, 64>&\n-      , std::int64_t&, std::string const&)> cb\n-      , std::string salt = std::string());\n-
\n-

store a mutable item. The key is the public key the blob is\n-to be stored under. The optional salt argument is a string that\n-is to be mixed in with the key when determining where in the DHT\n-the value is to be stored. The callback function is called from within\n-the libtorrent network thread once we've found where to store the blob,\n-possibly with the current value stored under the key.\n-The values passed to the callback functions are:

\n-
\n-
entry& value
\n-
the current value stored under the key (may be empty). Also expected\n-to be set to the value to be stored by the function.
\n-
std::array<char,64>& signature
\n-
the signature authenticating the current value. This may be zeros\n-if there is currently no value stored. The function is expected to\n-fill in this buffer with the signature of the new value to store.\n-To generate the signature, you may want to use the\n-sign_mutable_item function.
\n-
std::int64_t& seq
\n-
current sequence number. May be zero if there is no current value.\n-The function is expected to set this to the new sequence number of\n-the value that is to be stored. Sequence numbers must be monotonically\n-increasing. Attempting to overwrite a value with a lower or equal\n-sequence number will fail, even if the signature is correct.
\n-
std::string const& salt
\n-
this is the salt that was used for this put call.
\n-
\n-

Since the callback function cb is called from within libtorrent,\n-it is critical to not perform any blocking operations. Ideally not\n-even locking a mutex. Pass any data required for this function along\n-with the function object's context and make the function entirely\n-self-contained. The only reason data blob's value is computed\n-via a function instead of just passing in the new value is to avoid\n-race conditions. If you want to update the value in the DHT, you\n-must first retrieve it, then modify it, then write it back. The way\n-the DHT works, it is natural to always do a lookup before storing and\n-calling the callback in between is convenient.

\n-\n-[report issue]
\n-
\n-

dht_get_peers() dht_announce()

\n-
\n-void dht_announce (sha1_hash const& info_hash, int port = 0, dht::announce_flags_t flags = {});\n-void dht_get_peers (sha1_hash const& info_hash);\n-
\n-

dht_get_peers() will issue a DHT get_peer request to the DHT for the\n-specified info-hash. The response (the peers) will be posted back in a\n-dht_get_peers_reply_alert.

\n-

dht_announce() will issue a DHT announce request to the DHT to the\n-specified info-hash, advertising the specified port. If the port is\n-left at its default, 0, the port will be implied by the DHT message's\n-source port (which may improve connectivity through a NAT).

\n-

Both these functions are exposed for advanced custom use of the DHT.\n-All torrents eligible to be announce to the DHT will be automatically,\n-by libtorrent.

\n-

For possible flags, see announce_flags_t.

\n-[report issue]
\n-
\n-

dht_live_nodes()

\n-
\n-void dht_live_nodes (sha1_hash const& nid);\n-
\n-

Retrieve all the live DHT (identified by nid) nodes. All the\n-nodes id and endpoint will be returned in the list of nodes in the\n-alert dht_live_nodes_alert.\n-Since this alert is a response to an explicit call, it will always be\n-posted, regardless of the alert mask.

\n-[report issue]
\n-
\n-

dht_sample_infohashes()

\n-
\n-void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);\n-
\n-

Query the DHT node specified by ep to retrieve a sample of the\n-info-hashes that the node currently have in their storage.\n-The target is included for iterative lookups so that indexing nodes\n-can perform a key space traversal with a single RPC per node by adjusting\n-the target value for each RPC. It has no effect on the returned sample value.\n-The result is posted as a dht_sample_infohashes_alert.

\n-[report issue]
\n-
\n-

dht_direct_request()

\n-
\n-void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t userdata = {});\n-
\n-

Send an arbitrary DHT request directly to the specified endpoint. This\n-function is intended for use by plugins. When a response is received\n-or the request times out, a dht_direct_response_alert will be posted\n-with the response (if any) and the userdata pointer passed in here.\n-Since this alert is a response to an explicit call, it will always be\n-posted, regardless of the alert mask.

\n-[report issue]
\n-
\n-

add_extension()

\n-
\n-void add_extension (std::function<std::shared_ptr<torrent_plugin>(\n-      torrent_handle const&, client_data_t)> ext);\n-void add_extension (std::shared_ptr<plugin> ext);\n-
\n-

This function adds an extension to this session. The argument is a\n-function object that is called with a torrent_handle and which should\n-return a std::shared_ptr<torrent_plugin>. To write custom\n-plugins, see libtorrent plugins. For the typical bittorrent client\n-all of these extensions should be added. The main plugins implemented\n-in libtorrent are:

\n-
\n-
uTorrent metadata
\n-
Allows peers to download the metadata (.torrent files) from the swarm\n-directly. Makes it possible to join a swarm with just a tracker and\n-info-hash.
\n-
\n-
\n-#include <libtorrent/extensions/ut_metadata.hpp>\n-ses.add_extension(&lt::create_ut_metadata_plugin);\n-
\n-
\n-
uTorrent peer exchange
\n-
Exchanges peers between clients.
\n+[report issue]
\n+
name
\n+
the name of the counter or gauge
\n
\n-
\n-#include <libtorrent/extensions/ut_pex.hpp>\n-ses.add_extension(&lt::create_ut_pex_plugin);\n-
\n-
\n-
smart ban plugin
\n-
A plugin that, with a small overhead, can ban peers\n-that sends bad data with very high accuracy. Should\n-eliminate most problems on poisoned torrents.
\n+\n+[report issue]
\n+
value_index type
\n+
the index into the session stats array, where the underlying value of\n+this counter or gauge is found. The session stats array is part of the\n+session_stats_alert object.
\n
\n-
\n-#include <libtorrent/extensions/smart_ban.hpp>\n-ses.add_extension(&lt::create_smart_ban_plugin);\n-
\n-\n-[report issue]
\n-
\n-

get_ip_filter() set_ip_filter()

\n-
\n-void set_ip_filter (ip_filter f);\n-ip_filter get_ip_filter () const;\n-
\n-

Sets a filter that will be used to reject and accept incoming as well\n-as outgoing connections based on their originating ip address. The\n-default filter will allow connections to any ip address. To build a\n-set of rules for which addresses are accepted and not, see ip_filter.

\n-

Each time a peer is blocked because of the IP filter, a\n-peer_blocked_alert is generated. get_ip_filter() Returns the\n-ip_filter currently in the session. See ip_filter.

\n-[report issue]
\n-
\n-

set_port_filter()

\n-
\n-void set_port_filter (port_filter const& f);\n-
\n-

apply port_filter f to incoming and outgoing peers. a port filter\n-will reject making outgoing peer connections to certain remote ports.\n-The main intention is to be able to avoid triggering certain\n-anti-virus software by connecting to SMTP, FTP ports.

\n-\n-\n-[report issue]
\n-
\n-

ssl_listen_port() listen_port() is_listening()

\n-
\n-unsigned short ssl_listen_port () const;\n-unsigned short listen_port () const;\n-bool is_listening () const;\n-
\n-

is_listening() will tell you whether or not the session has\n-successfully opened a listening port. If it hasn't, this function will\n-return false, and then you can set a new\n-settings_pack::listen_interfaces to try another interface and port to\n-bind to.

\n-

listen_port() returns the port we ended up listening on.

\n-\n-[report issue]
\n-
\n-

set_peer_class_filter() get_peer_class_filter()

\n-
\n-ip_filter get_peer_class_filter () const;\n-void set_peer_class_filter (ip_filter const& f);\n-
\n-

Sets the peer class filter for this session. All new peer connections\n-will take this into account and be added to the peer classes specified\n-by this filter, based on the peer's IP address.

\n-

The ip-filter essentially maps an IP -> uint32. Each bit in that 32\n-bit integer represents a peer class. The least significant bit\n-represents class 0, the next bit class 1 and so on.

\n-

For more info, see ip_filter.

\n-

For example, to make all peers in the range 200.1.1.0 - 200.1.255.255\n-belong to their own peer class, apply the following filter:

\n-
\n-ip_filter f = ses.get_peer_class_filter();\n-peer_class_t my_class = ses.create_peer_class("200.1.x.x IP range");\n-f.add_rule(make_address("200.1.1.0"), make_address("200.1.255.255")\n-        , 1 << static_cast<std::uint32_t>(my_class));\n-ses.set_peer_class_filter(f);\n-
\n-

This setting only applies to new connections, it won't affect existing\n-peer connections.

\n-

This function is limited to only peer class 0-31, since there are only\n-32 bits in the IP range mapping. Only the set bits matter; no peer\n-class will be removed from a peer as a result of this call, peer\n-classes are only added.

\n-

The peer_class argument cannot be greater than 31. The bitmasks\n-representing peer classes in the peer_class_filter are 32 bits.

\n-

The get_peer_class_filter() function returns the current filter.

\n-

For more information, see peer classes.

\n-\n-[report issue]
\n-
\n-

get_peer_class_type_filter() set_peer_class_type_filter()

\n-
\n-void set_peer_class_type_filter (peer_class_type_filter const& f);\n-peer_class_type_filter get_peer_class_type_filter () const;\n-
\n-

Sets and gets the peer class type filter. This is controls automatic\n-peer class assignments to peers based on what kind of socket it is.

\n-

It does not only support assigning peer classes, it also supports\n-removing peer classes based on socket type.

\n-

The order of these rules being applied are:

\n-
    \n-
  1. peer-class IP filter
  2. \n-
  3. peer-class type filter, removing classes
  4. \n-
  5. peer-class type filter, adding classes
  6. \n-
\n-

For more information, see peer classes.

\n-[report issue]
\n-
\n-

create_peer_class()

\n-
\n-peer_class_t create_peer_class (char const* name);\n-
\n-

Creates a new peer class (see peer classes) with the given name. The\n-returned integer is the new peer class identifier. Peer classes may\n-have the same name, so each invocation of this function creates a new\n-class and returns a unique identifier.

\n-

Identifiers are assigned from low numbers to higher. So if you plan on\n-using certain peer classes in a call to set_peer_class_filter(),\n-make sure to create those early on, to get low identifiers.

\n-

For more information on peer classes, see peer classes.

\n-[report issue]
\n-
\n-

delete_peer_class()

\n-
\n-void delete_peer_class (peer_class_t cid);\n-
\n-

This call dereferences the reference count of the specified peer\n-class. When creating a peer class it's automatically referenced by 1.\n-If you want to recycle a peer class, you may call this function. You\n-may only call this function once per peer class you create.\n-Calling it more than once for the same class will lead to memory\n-corruption.

\n-

Since peer classes are reference counted, this function will not\n-remove the peer class if it's still assigned to torrents or peers. It\n-will however remove it once the last peer and torrent drops their\n-references to it.

\n-

There is no need to call this function for custom peer classes. All\n-peer classes will be properly destructed when the session object\n-destructs.

\n-

For more information on peer classes, see peer classes.

\n-\n-[report issue]
\n-
\n-

set_peer_class() get_peer_class()

\n-
\n-peer_class_info get_peer_class (peer_class_t cid) const;\n-void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n-
\n-

These functions queries information from a peer class and updates the\n-configuration of a peer class, respectively.

\n-

cid must refer to an existing peer class. If it does not, the\n-return value of get_peer_class() is undefined.

\n-

set_peer_class() sets all the information in the\n-peer_class_info object in the specified peer class. There is no\n-option to only update a single property.

\n-

A peer or torrent belonging to more than one class, the highest\n-priority among any of its classes is the one that is taken into\n-account.

\n-

For more information, see peer classes.

\n-[report issue]
\n-
\n-

remove_torrent()

\n-
\n-void remove_torrent (const torrent_handle&, remove_flags_t = {});\n-
\n-

remove_torrent() will close all peer connections associated with\n-the torrent and tell the tracker that we've stopped participating in\n-the swarm. This operation cannot fail. When it completes, you will\n-receive a torrent_removed_alert.

\n-

remove_torrent() is non-blocking, but will remove the torrent from the\n-session synchronously. Calling session_handle::add_torrent() immediately\n-afterward with the same torrent will succeed. Note that this creates a\n-new handle which is not equal to the removed one.

\n-

The optional second argument options can be used to delete all the\n-files downloaded by this torrent. To do so, pass in the value\n-session_handle::delete_files. Once the torrent is deleted, a\n-torrent_deleted_alert is posted.

\n-

The torrent_handle remains valid for some time after remove_torrent() is\n-called. It will become invalid only after all libtorrent tasks (such as\n-I/O tasks) release their references to the torrent. Until this happens,\n-torrent_handle::is_valid() will return true, and other calls such\n-as torrent_handle::status() will succeed. Because of this, and because\n-remove_torrent() is non-blocking, the following sequence usually\n-succeeds (does not throw system_error):\n-.. code:: c++

\n-
\n-session.remove_handle(handle);\n-handle.save_resume_data();
\n-

Note that when a queued or downloading torrent is removed, its position\n-in the download queue is vacated and every subsequent torrent in the\n-queue has their queue positions updated. This can potentially cause a\n-large state_update to be posted. When removing all torrents, it is\n-advised to remove them from the back of the queue, to minimize the\n-shifting.

\n-\n-[report issue]
\n-
\n-

apply_settings() get_settings()

\n-
\n-void apply_settings (settings_pack&&);\n-void apply_settings (settings_pack const&);\n-settings_pack get_settings () const;\n-
\n-

Applies the settings specified by the settings_pack s. This is an\n-asynchronous operation that will return immediately and actually apply\n-the settings to the main thread of libtorrent some time later.

\n-\n-\n-[report issue]
\n-
\n-

set_alert_notify() pop_alerts() wait_for_alert()

\n-
\n-void set_alert_notify (std::function<void()> const& fun);\n-void pop_alerts (std::vector<alert*>* alerts);\n-alert* wait_for_alert (time_duration max_wait);\n-
\n-

Alerts is the main mechanism for libtorrent to report errors and\n-events. pop_alerts fills in the vector passed to it with pointers\n-to new alerts. The session still owns these alerts and they will stay\n-valid until the next time pop_alerts is called. You may not delete\n-the alert objects.

\n-

It is safe to call pop_alerts from multiple different threads, as\n-long as the alerts themselves are not accessed once another thread\n-calls pop_alerts. Doing this requires manual synchronization\n-between the popping threads.

\n-

wait_for_alert will block the current thread for max_wait time\n-duration, or until another alert is posted. If an alert is available\n-at the time of the call, it returns immediately. The returned alert\n-pointer is the head of the alert queue. wait_for_alert does not\n-pop alerts from the queue, it merely peeks at it. The returned alert\n-will stay valid until pop_alerts is called twice. The first time\n-will pop it and the second will free it.

\n-

If there is no alert in the queue and no alert arrives within the\n-specified timeout, wait_for_alert returns nullptr.

\n-

In the python binding, wait_for_alert takes the number of\n-milliseconds to wait as an integer.

\n-

The alert queue in the session will not grow indefinitely. Make sure\n-to pop periodically to not miss notifications. To control the max\n-number of alerts that's queued by the session, see\n-settings_pack::alert_queue_size.

\n-

Some alerts are considered so important that they are posted even when\n-the alert queue is full. Some alerts are considered mandatory and cannot\n-be disabled by the alert_mask. For instance,\n-save_resume_data_alert and save_resume_data_failed_alert are always\n-posted, regardless of the alert mask.

\n-

To control which alerts are posted, set the alert_mask\n-(settings_pack::alert_mask).

\n-

If the alert queue fills up to the point where alerts are dropped, this\n-will be indicated by a alerts_dropped_alert, which contains a bitmask\n-of which types of alerts were dropped. Generally it is a good idea to\n-make sure the alert queue is large enough, the alert_mask doesn't have\n-unnecessary categories enabled and to call pop_alert() frequently, to\n-avoid alerts being dropped.

\n-

the set_alert_notify function lets the client set a function object\n-to be invoked every time the alert queue goes from having 0 alerts to\n-1 alert. This function is called from within libtorrent, it may be the\n-main thread, or it may be from within a user call. The intention of\n-of the function is that the client wakes up its main thread, to poll\n-for more alerts using pop_alerts(). If the notify function fails\n-to do so, it won't be called again, until pop_alerts is called for\n-some other reason. For instance, it could signal an eventfd, post a\n-message to an HWND or some other main message pump. The actual\n-retrieval of alerts should not be done in the callback. In fact, the\n-callback should not block. It should not perform any expensive work.\n-It really should just notify the main application thread.

\n-

The type of an alert is returned by the polymorphic function\n-alert::type() but can also be queries from a concrete type via\n-T::alert_type, as a static constant.

\n-\n-[report issue]
\n-
\n-

delete_port_mapping() add_port_mapping()

\n-
\n-std::vector<port_mapping_t> add_port_mapping (portmap_protocol t, int external_port, int local_port);\n-void delete_port_mapping (port_mapping_t handle);\n-
\n-

add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,\n-whichever is enabled. A mapping is created for each listen socket\n-in the session. The return values are all handles referring to the\n-port mappings that were just created. Pass them to delete_port_mapping()\n-to remove them.

\n-[report issue]
\n-
\n-

reopen_network_sockets()

\n-
\n-void reopen_network_sockets (reopen_network_flags_t options = reopen_map_ports);\n-
\n-

Instructs the session to reopen all listen and outgoing sockets.

\n-

It's useful in the case your platform doesn't support the built in\n-IP notifier mechanism, or if you have a better more reliable way to\n-detect changes in the IP routing table.

\n-[report issue]
\n-
\n-

native_handle()

\n+[report issue]
\n+
\n+

session_stats_metrics()

\n+

Declared in "libtorrent/session_stats.hpp"

\n
\n-std::shared_ptr<aux::session_impl> native_handle () const;\n+std::vector<stats_metric> session_stats_metrics ();\n 
\n-

This function is intended only for use by plugins. This type does\n-not have a stable API and should be relied on as little as possible.

\n-[report issue]
\n-
save_settings
\n-
saves settings (i.e. the settings_pack)
\n-
\n-[report issue]
\n-
save_dht_state
\n-
saves dht state such as nodes and node-id, possibly accelerating\n-joining the DHT if provided at next session startup.
\n-
\n-[report issue]
\n-
save_extension_state
\n-
load or save state from plugins
\n-
\n-[report issue]
\n-
save_ip_filter
\n-
load or save the IP filter set on the session
\n-
\n-\n-\n-[report issue]
\n-
global_peer_class_id tcp_peer_class_id local_peer_class_id
\n-
built-in peer classes
\n-
\n-[report issue]
\n-
delete_files
\n-
delete the files belonging to the torrent from disk.\n-including the part-file, if there is one
\n-
\n-[report issue]
\n-
delete_partfile
\n-
delete just the part-file associated with this torrent
\n-
\n-[report issue]
\n-
paused
\n-
when set, the session will start paused. Call\n-session_handle::resume() to start
\n-
\n-\n-[report issue]
\n-
udp tcp
\n-
protocols used by add_port_mapping()
\n-
\n-[report issue]
\n-
reopen_map_ports
\n-
This option indicates if the ports are mapped using natpmp\n-and upnp. If mapping was already made, they are deleted and added\n-again. This only works if natpmp and/or upnp are configured to be\n-enable.
\n-
\n-\n-\n-[report issue]
\n-
\n-
\n-

write_session_params_buf() write_session_params() read_session_params()

\n-

Declared in "libtorrent/session_params.hpp"

\n+

This free function returns the list of available metrics exposed by\n+libtorrent's statistics API. Each metric has a name and a value index.\n+The value index is the index into the array in session_stats_alert where\n+this metric's value can be found when the session stats is sampled (by\n+calling post_session_stats()).

\n+[report issue]
\n+
\n+

find_metric_idx()

\n+

Declared in "libtorrent/session_stats.hpp"

\n
\n-session_params read_session_params (bdecode_node const& e\n-   , save_state_flags_t flags = save_state_flags_t::all());\n-session_params read_session_params (span<char const> buf\n-   , save_state_flags_t flags = save_state_flags_t::all());\n-entry write_session_params (session_params const& sp\n-   , save_state_flags_t flags = save_state_flags_t::all());\n-std::vector<char> write_session_params_buf (session_params const& sp\n-   , save_state_flags_t flags = save_state_flags_t::all());\n+int find_metric_idx (string_view name);\n 
\n-

These functions serialize and de-serialize a session_params object to and\n-from bencoded form. The session_params object is used to initialize a new\n-session using the state from a previous one (or by programmatically configure\n-the session up-front).\n-The flags parameter can be used to only save and load certain aspects of the\n-session's state.\n-The _buf suffix indicates the function operates on buffer rather than the\n-bencoded structure.\n-The torrents in a session are not part of the session_params state, they have\n-to be restored separately.

\n+

given a name of a metric, this function returns the counter index of it,\n+or -1 if it could not be found. The counter index is the index into the\n+values array returned by session_stats_alert.

\n+[report issue]
\n+
\n+

enum metric_type_t

\n+

Declared in "libtorrent/session_stats.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
counter0 
gauge1 
\n

The pop_alerts() function on session is the main interface for retrieving\n alerts (warnings, messages and errors from libtorrent). If no alerts have\n been posted by libtorrent pop_alerts() will return an empty list.

\n

By default, only errors are reported. settings_pack::alert_mask can be\n used to specify which kinds of events should be reported. The alert mask is\n a combination of the alert_category_t flags in the alert class.

\n

Every alert belongs to one or more category. There is a cost associated with\n@@ -12392,124 +11593,15 @@\n

There are other alert base classes that some alerts derive from, all the\n alerts that are generated for a specific torrent are derived from\n torrent_alert, and tracker events derive from tracker_alert.

\n

Alerts returned by pop_alerts() are only valid until the next call to\n pop_alerts(). You may not copy an alert object to access it after the next\n call to pop_alerts(). Internal members of alerts also become invalid once\n pop_alerts() is called again.

\n-[report issue]
\n-
\n-

alert

\n-

Declared in "libtorrent/alert.hpp"

\n-

The alert class is the base class that specific messages are derived from.\n-alert types are not copyable, and cannot be constructed by the client. The\n-pointers returned by libtorrent are short lived (the details are described\n-under session_handle::pop_alerts())

\n-
\n-struct alert\n-{\n-   time_point timestamp () const;\n-   virtual int type () const noexcept = 0;\n-   virtual char const* what () const noexcept = 0;\n-   virtual std::string message () const = 0;\n-   virtual alert_category_t category () const noexcept = 0;\n-\n-   static constexpr alert_category_t error_notification  = 0_bit;\n-   static constexpr alert_category_t peer_notification  = 1_bit;\n-   static constexpr alert_category_t port_mapping_notification  = 2_bit;\n-   static constexpr alert_category_t storage_notification  = 3_bit;\n-   static constexpr alert_category_t tracker_notification  = 4_bit;\n-   static constexpr alert_category_t connect_notification  = 5_bit;\n-   static constexpr alert_category_t status_notification  = 6_bit;\n-   static constexpr alert_category_t ip_block_notification  = 8_bit;\n-   static constexpr alert_category_t performance_warning  = 9_bit;\n-   static constexpr alert_category_t dht_notification  = 10_bit;\n-   static constexpr alert_category_t session_log_notification  = 13_bit;\n-   static constexpr alert_category_t torrent_log_notification  = 14_bit;\n-   static constexpr alert_category_t peer_log_notification  = 15_bit;\n-   static constexpr alert_category_t incoming_request_notification  = 16_bit;\n-   static constexpr alert_category_t dht_log_notification  = 17_bit;\n-   static constexpr alert_category_t dht_operation_notification  = 18_bit;\n-   static constexpr alert_category_t port_mapping_log_notification  = 19_bit;\n-   static constexpr alert_category_t picker_log_notification  = 20_bit;\n-   static constexpr alert_category_t file_progress_notification  = 21_bit;\n-   static constexpr alert_category_t piece_progress_notification  = 22_bit;\n-   static constexpr alert_category_t upload_notification  = 23_bit;\n-   static constexpr alert_category_t block_progress_notification  = 24_bit;\n-   static constexpr alert_category_t all_categories  = alert_category_t::all();\n-};\n-
\n-[report issue]
\n-

timestamp()

\n-
\n-time_point timestamp () const;\n-
\n-

a timestamp is automatically created in the constructor

\n-[report issue]
\n-
\n-

type()

\n-
\n-virtual int type () const noexcept = 0;\n-
\n-

returns an integer that is unique to this alert type. It can be\n-compared against a specific alert by querying a static constant called alert_type\n-in the alert. It can be used to determine the run-time type of an alert* in\n-order to cast to that alert type and access specific members.

\n-

e.g:

\n-
\n-std::vector<alert*> alerts;\n-ses.pop_alerts(&alerts);\n-for (alert* a : alerts) {\n-        switch (a->type()) {\n-\n-                case read_piece_alert::alert_type:\n-                {\n-                        auto* p = static_cast<read_piece_alert*>(a);\n-                        if (p->ec) {\n-                                // read_piece failed\n-                                break;\n-                        }\n-                        // use p\n-                        break;\n-                }\n-                case file_renamed_alert::alert_type:\n-                {\n-                        // etc...\n-                }\n-        }\n-}\n-
\n-[report issue]
\n-
\n-

what()

\n-
\n-virtual char const* what () const noexcept = 0;\n-
\n-

returns a string literal describing the type of the alert. It does\n-not include any information that might be bundled with the alert.

\n-[report issue]
\n-
\n-

message()

\n-
\n-virtual std::string message () const = 0;\n-
\n-

generate a string describing the alert and the information bundled\n-with it. This is mainly intended for debug and development use. It is not suitable\n-to use this for applications that may be localized. Instead, handle each alert\n-type individually and extract and render the information from the alert depending\n-on the locale.

\n-[report issue]
\n-
\n-

category()

\n-
\n-virtual alert_category_t category () const noexcept = 0;\n-
\n-

returns a bitmask specifying which categories this alert belong to.

\n [report issue]
\n-
\n
\n

dht_routing_bucket

\n

Declared in "libtorrent/alert_types.hpp"

\n

struct to hold information about a single DHT routing table bucket

\n
\n struct dht_routing_bucket\n {\n@@ -12541,15 +11633,15 @@\n {\n    std::string message () const override;\n    char const* torrent_name () const;\n \n    torrent_handle handle;\n };\n 
\n-[report issue]
\n+[report issue]
\n

message()

\n
\n std::string message () const override;\n 
\n

returns the message associated with this alert

\n [report issue]
\n
handle
\n@@ -12691,27 +11783,27 @@\n

Declared in "libtorrent/alert_types.hpp"

\n

This is posted as a response to a torrent_handle::rename_file() call, if the rename\n operation succeeds.

\n
\n struct file_renamed_alert final : torrent_alert\n {\n    std::string message () const override;\n-   char const* old_name () const;\n    char const* new_name () const;\n+   char const* old_name () const;\n \n    static constexpr alert_category_t static_category  = alert_category::storage;\n    file_index_t const index;\n };\n 
\n-\n-[report issue]
\n-

new_name() old_name()

\n+\n+[report issue]
\n+

old_name() new_name()

\n
\n-char const* old_name () const;\n char const* new_name () const;\n+char const* old_name () const;\n 
\n

returns the new and previous file name, respectively.

\n [report issue]
\n
index
\n
refers to the index of the file that was renamed,
\n
\n [report issue]
\n@@ -15091,27 +14183,27 @@\n

posted in response to a call to session::dht_live_nodes(). It contains the\n live nodes from the DHT routing table of one of the DHT nodes running\n locally.

\n
\n struct dht_live_nodes_alert final : alert\n {\n    std::string message () const override;\n-   std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;\n    int num_nodes () const;\n+   std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;\n \n    static constexpr alert_category_t static_category  = alert_category::dht;\n    sha1_hash node_id;\n };\n 
\n \n [report issue]
\n

num_nodes() nodes()

\n
\n-std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;\n int num_nodes () const;\n+std::vector<std::pair<sha1_hash, udp::endpoint>> nodes () const;\n 
\n

the number of nodes in the routing table and the actual nodes.

\n [report issue]
\n
node_id
\n
the local DHT node's node-ID this routing table belongs to
\n
\n [report issue]
\n@@ -15152,17 +14244,17 @@\n static constexpr alert_category_t static_category = alert_category::dht_operation;\n sha1_hash node_id;\n aux::noexcept_movable<udp::endpoint> endpoint;\n time_duration const interval;\n int const num_infohashes;\n };\n \n-\n-[report issue]
\n-

num_samples() samples()

\n+\n+[report issue]
\n+

samples() num_samples()

\n
\n int num_samples () const;\n std::vector<sha1_hash> samples () const;\n 
\n

returns the number of info-hashes returned by the node, as well as the\n actual info-hashes. num_samples() is more efficient than\n samples().size().

\n@@ -15226,16 +14318,16 @@\n

this alert is posted to indicate to the client that some alerts were\n dropped. Dropped meaning that the alert failed to be delivered to the\n client. The most common cause of such failure is that the internal alert\n queue grew too big (controlled by alert_queue_size).

\n
\n struct alerts_dropped_alert final : alert\n {\n-   static_assert (num_alert_types <= abi_alert_count, "need to increase bitset. This is an ABI break");\n    std::string message () const override;\n+   static_assert (num_alert_types <= abi_alert_count, "need to increase bitset. This is an ABI break");\n \n    static constexpr alert_category_t static_category  = alert_category::error;\n    std::bitset<abi_alert_count> dropped_alerts;\n };\n 
\n [report issue]
\n
dropped_alerts
\n@@ -15346,30 +14438,139 @@\n
\n [report issue]
\n
metadata
\n
the metadata that was received by one of the torrents in conflict.\n One way to resolve the conflict is to remove both failing torrents\n and re-add it using this metadata
\n
\n+[report issue]
\n+
\n+

alert

\n+

Declared in "libtorrent/alert.hpp"

\n+

The alert class is the base class that specific messages are derived from.\n+alert types are not copyable, and cannot be constructed by the client. The\n+pointers returned by libtorrent are short lived (the details are described\n+under session_handle::pop_alerts())

\n+
\n+struct alert\n+{\n+   time_point timestamp () const;\n+   virtual int type () const noexcept = 0;\n+   virtual char const* what () const noexcept = 0;\n+   virtual std::string message () const = 0;\n+   virtual alert_category_t category () const noexcept = 0;\n+\n+   static constexpr alert_category_t error_notification  = 0_bit;\n+   static constexpr alert_category_t peer_notification  = 1_bit;\n+   static constexpr alert_category_t port_mapping_notification  = 2_bit;\n+   static constexpr alert_category_t storage_notification  = 3_bit;\n+   static constexpr alert_category_t tracker_notification  = 4_bit;\n+   static constexpr alert_category_t connect_notification  = 5_bit;\n+   static constexpr alert_category_t status_notification  = 6_bit;\n+   static constexpr alert_category_t ip_block_notification  = 8_bit;\n+   static constexpr alert_category_t performance_warning  = 9_bit;\n+   static constexpr alert_category_t dht_notification  = 10_bit;\n+   static constexpr alert_category_t session_log_notification  = 13_bit;\n+   static constexpr alert_category_t torrent_log_notification  = 14_bit;\n+   static constexpr alert_category_t peer_log_notification  = 15_bit;\n+   static constexpr alert_category_t incoming_request_notification  = 16_bit;\n+   static constexpr alert_category_t dht_log_notification  = 17_bit;\n+   static constexpr alert_category_t dht_operation_notification  = 18_bit;\n+   static constexpr alert_category_t port_mapping_log_notification  = 19_bit;\n+   static constexpr alert_category_t picker_log_notification  = 20_bit;\n+   static constexpr alert_category_t file_progress_notification  = 21_bit;\n+   static constexpr alert_category_t piece_progress_notification  = 22_bit;\n+   static constexpr alert_category_t upload_notification  = 23_bit;\n+   static constexpr alert_category_t block_progress_notification  = 24_bit;\n+   static constexpr alert_category_t all_categories  = alert_category_t::all();\n+};\n+
\n+[report issue]
\n+

timestamp()

\n+
\n+time_point timestamp () const;\n+
\n+

a timestamp is automatically created in the constructor

\n+[report issue]
\n+
\n+

type()

\n+
\n+virtual int type () const noexcept = 0;\n+
\n+

returns an integer that is unique to this alert type. It can be\n+compared against a specific alert by querying a static constant called alert_type\n+in the alert. It can be used to determine the run-time type of an alert* in\n+order to cast to that alert type and access specific members.

\n+

e.g:

\n+
\n+std::vector<alert*> alerts;\n+ses.pop_alerts(&alerts);\n+for (alert* a : alerts) {\n+        switch (a->type()) {\n+\n+                case read_piece_alert::alert_type:\n+                {\n+                        auto* p = static_cast<read_piece_alert*>(a);\n+                        if (p->ec) {\n+                                // read_piece failed\n+                                break;\n+                        }\n+                        // use p\n+                        break;\n+                }\n+                case file_renamed_alert::alert_type:\n+                {\n+                        // etc...\n+                }\n+        }\n+}\n+
\n+[report issue]
\n+
\n+

what()

\n+
\n+virtual char const* what () const noexcept = 0;\n+
\n+

returns a string literal describing the type of the alert. It does\n+not include any information that might be bundled with the alert.

\n+[report issue]
\n+
\n+

message()

\n+
\n+virtual std::string message () const = 0;\n+
\n+

generate a string describing the alert and the information bundled\n+with it. This is mainly intended for debug and development use. It is not suitable\n+to use this for applications that may be localized. Instead, handle each alert\n+type individually and extract and render the information from the alert depending\n+on the locale.

\n+[report issue]
\n+
\n+

category()

\n+
\n+virtual alert_category_t category () const noexcept = 0;\n+
\n+

returns a bitmask specifying which categories this alert belong to.

\n [report issue]
\n+
\n
\n

operation_name()

\n

Declared in "libtorrent/operations.hpp"

\n
\n char const* operation_name (operation_t op);\n 
\n

maps an operation id (from peer_error_alert and peer_disconnected_alert)\n to its name. See operation_t for the constants

\n [report issue]
\n
\n

alert_cast()

\n

Declared in "libtorrent/alert.hpp"

\n
\n-template <typename T> T const* alert_cast (alert const* a);\n template <typename T> T* alert_cast (alert* a);\n+template <typename T> T const* alert_cast (alert const* a);\n 
\n

When you get an alert, you can use alert_cast<> to attempt to cast the\n pointer to a specific alert type, in order to query it for more\n information.

\n
\n

Note

\n

alert_cast<> can only cast to an exact alert type, not a base class

\n@@ -15582,14 +14783,26 @@\n \n file_truncate\n 46\n call to ftruncate() (or SetEndOfFile() on windows)\n \n \n \n+[report issue]
\n+
\n+

int

\n+

Declared in "libtorrent/alert_types.hpp"

\n+
\n+
user_alert_id
\n+
user defined alerts should use IDs greater than this
\n+
\n+
\n+
num_alert_types
\n+
this constant represents "max_alert_index" + 1
\n+
\n [report issue]
\n
\n

alert_category_t

\n

Declared in "libtorrent/alert.hpp"

\n
\n
error
\n

Enables alerts that report an error. This includes:

\n@@ -15717,1409 +14930,3483 @@\n

The full bitmask, representing all available categories.

\n

since the enum is signed, make sure this isn't\n interpreted as -1. For instance, boost.python\n does that and fails when assigning it to an\n unsigned parameter.

\n
\n
\n-[report issue]
\n-
\n-

int

\n-

Declared in "libtorrent/alert_types.hpp"

\n-
\n-
user_alert_id
\n-
user defined alerts should use IDs greater than this
\n+[report issue]
\n+
\n+

torrent_status

\n+

Declared in "libtorrent/torrent_status.hpp"

\n+

holds a snapshot of the status of a torrent, as queried by\n+torrent_handle::status().

\n+
\n+struct torrent_status\n+{\n+   bool operator== (torrent_status const& st) const;\n+\n+   enum state_t\n+   {\n+      checking_files,\n+      downloading_metadata,\n+      downloading,\n+      finished,\n+      seeding,\n+      unused_enum_for_backwards_compatibility_allocating,\n+      checking_resume_data,\n+   };\n+\n+   torrent_handle handle;\n+   error_code errc;\n+   file_index_t error_file  = torrent_status::error_file_none;\n+   static constexpr file_index_t error_file_none {-1};\n+   static constexpr file_index_t error_file_ssl_ctx {-3};\n+   static constexpr file_index_t error_file_metadata {-4};\n+   static constexpr file_index_t error_file_exception {-5};\n+   static constexpr file_index_t error_file_partfile {-6};\n+   std::string save_path;\n+   std::string name;\n+   std::weak_ptr<const torrent_info> torrent_file;\n+   time_duration next_announce  = seconds{0};\n+   std::string current_tracker;\n+   std::int64_t total_download  = 0;\n+   std::int64_t total_upload  = 0;\n+   std::int64_t total_payload_download  = 0;\n+   std::int64_t total_payload_upload  = 0;\n+   std::int64_t total_failed_bytes  = 0;\n+   std::int64_t total_redundant_bytes  = 0;\n+   typed_bitfield<piece_index_t> pieces;\n+   typed_bitfield<piece_index_t> verified_pieces;\n+   std::int64_t total_done  = 0;\n+   std::int64_t total  = 0;\n+   std::int64_t total_wanted_done  = 0;\n+   std::int64_t total_wanted  = 0;\n+   std::int64_t all_time_upload  = 0;\n+   std::int64_t all_time_download  = 0;\n+   std::time_t added_time  = 0;\n+   std::time_t completed_time  = 0;\n+   std::time_t last_seen_complete  = 0;\n+   storage_mode_t storage_mode  = storage_mode_sparse;\n+   float progress  = 0.f;\n+   int progress_ppm  = 0;\n+   queue_position_t queue_position {};\n+   int download_rate  = 0;\n+   int upload_rate  = 0;\n+   int download_payload_rate  = 0;\n+   int upload_payload_rate  = 0;\n+   int num_seeds  = 0;\n+   int num_peers  = 0;\n+   int num_complete  = -1;\n+   int num_incomplete  = -1;\n+   int list_seeds  = 0;\n+   int list_peers  = 0;\n+   int connect_candidates  = 0;\n+   int num_pieces  = 0;\n+   int distributed_full_copies  = 0;\n+   int distributed_fraction  = 0;\n+   float distributed_copies  = 0.f;\n+   int block_size  = 0;\n+   int num_uploads  = 0;\n+   int num_connections  = 0;\n+   int uploads_limit  = 0;\n+   int connections_limit  = 0;\n+   int up_bandwidth_queue  = 0;\n+   int down_bandwidth_queue  = 0;\n+   int seed_rank  = 0;\n+   state_t state  = checking_resume_data;\n+   bool need_save_resume  = false;\n+   bool is_seeding  = false;\n+   bool is_finished  = false;\n+   bool has_metadata  = false;\n+   bool has_incoming  = false;\n+   bool moving_storage  = false;\n+   bool announcing_to_trackers  = false;\n+   bool announcing_to_lsd  = false;\n+   bool announcing_to_dht  = false;\n+   info_hash_t info_hashes;\n+   time_point last_upload;\n+   time_point last_download;\n+   seconds active_duration;\n+   seconds finished_duration;\n+   seconds seeding_duration;\n+   torrent_flags_t flags {};\n+};\n+
\n+[report issue]
\n+

operator==()

\n+
\n+bool operator== (torrent_status const& st) const;\n+
\n+

compares if the torrent status objects come from the same torrent. i.e.\n+only the torrent_handle field is compared.

\n+[report issue]
\n+
\n+

enum state_t

\n+

Declared in "libtorrent/torrent_status.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
checking_files1The torrent has not started its download yet, and is\n+currently checking existing files.
downloading_metadata2The torrent is trying to download metadata from peers.\n+This implies the ut_metadata extension is in use.
downloading3The torrent is being downloaded. This is the state\n+most torrents will be in most of the time. The progress\n+meter will tell how much of the files that has been\n+downloaded.
finished4In this state the torrent has finished downloading but\n+still doesn't have the entire torrent. i.e. some pieces\n+are filtered and won't get downloaded.
seeding5In this state the torrent has finished downloading and\n+is a pure seeder.
unused_enum_for_backwards_compatibility_allocating6If the torrent was started in full allocation mode, this\n+indicates that the (disk) storage for the torrent is\n+allocated.
checking_resume_data7The torrent is currently checking the fast resume data and\n+comparing it to the files on disk. This is typically\n+completed in a fraction of a second, but if you add a\n+large number of torrents at once, they will queue up.
\n+[report issue]
\n+
handle
\n+
a handle to the torrent whose status the object represents.
\n
\n-
\n-
num_alert_types
\n-
this constant represents "max_alert_index" + 1
\n+[report issue]
\n+
errc
\n+
may be set to an error code describing why the torrent was paused, in\n+case it was paused by an error. If the torrent is not paused or if it's\n+paused but not because of an error, this error_code is not set.\n+if the error is attributed specifically to a file, error_file is set to\n+the index of that file in the .torrent file.
\n
\n-[report issue]
\n-
\n-

client_data_t

\n-

Declared in "libtorrent/client_data.hpp"

\n-

A thin wrapper around a void pointer used as "user data". i.e. an opaque\n-cookie passed in to libtorrent and returned on demand. It adds type-safety by\n-requiring the same type be requested out of it as was assigned to it.

\n+[report issue]
\n+
error_file
\n+
if the torrent is stopped because of an disk I/O error, this field\n+contains the index of the file in the torrent that encountered the\n+error. If the error did not originate in a file in the torrent, there\n+are a few special values this can be set to: error_file_none,\n+error_file_ssl_ctx, error_file_exception, error_file_partfile or\n+error_file_metadata;
\n+
\n+[report issue]
\n+
error_file_none
\n+
special values for error_file to describe which file or component\n+encountered the error (errc).\n+the error did not occur on a file
\n+
\n+[report issue]
\n+
error_file_ssl_ctx
\n+
the error occurred setting up the SSL context
\n+
\n+[report issue]
\n+
error_file_metadata
\n+
the error occurred while loading the metadata for the torrent
\n+
\n+[report issue]
\n+
error_file_exception
\n+
there was a serious error reported in this torrent. The error code\n+or a torrent log alert may provide more information.
\n+
\n+[report issue]
\n+
error_file_partfile
\n+
the error occurred with the partfile
\n+
\n+[report issue]
\n+
save_path
\n+
the path to the directory where this torrent's files are stored.\n+It's typically the path as was given to async_add_torrent() or\n+add_torrent() when this torrent was started. This field is only\n+included if the torrent status is queried with\n+torrent_handle::query_save_path.
\n+
\n+[report issue]
\n+
name
\n+
the name of the torrent. Typically this is derived from the\n+.torrent file. In case the torrent was started without metadata,\n+and hasn't completely received it yet, it returns the name given\n+to it when added to the session. See session::add_torrent.\n+This field is only included if the torrent status is queried\n+with torrent_handle::query_name.
\n+
\n+[report issue]
\n+
torrent_file
\n+
set to point to the torrent_info object for this torrent. It's\n+only included if the torrent status is queried with\n+torrent_handle::query_torrent_file.
\n+
\n+[report issue]
\n+
next_announce
\n+
the time until the torrent will announce itself to the tracker.
\n+
\n+[report issue]
\n+
current_tracker
\n+
the URL of the last working tracker. If no tracker request has\n+been successful yet, it's set to an empty string.
\n+
\n+\n+[report issue]
\n+
total_download total_upload
\n+
the number of bytes downloaded and uploaded to all peers, accumulated,\n+this session only. The session is considered to restart when a\n+torrent is paused and restarted again. When a torrent is paused, these\n+counters are reset to 0. If you want complete, persistent, stats, see\n+all_time_upload and all_time_download.
\n+
\n+\n+[report issue]
\n+
total_payload_download total_payload_upload
\n+
counts the amount of bytes send and received this session, but only\n+the actual payload data (i.e the interesting data), these counters\n+ignore any protocol overhead. The session is considered to restart\n+when a torrent is paused and restarted again. When a torrent is\n+paused, these counters are reset to 0.
\n+
\n+[report issue]
\n+
total_failed_bytes
\n+
the number of bytes that has been downloaded and that has failed the\n+piece hash test. In other words, this is just how much crap that has\n+been downloaded since the torrent was last started. If a torrent is\n+paused and then restarted again, this counter will be reset.
\n+
\n+[report issue]
\n+
total_redundant_bytes
\n+
the number of bytes that has been downloaded even though that data\n+already was downloaded. The reason for this is that in some situations\n+the same data can be downloaded by mistake. When libtorrent sends\n+requests to a peer, and the peer doesn't send a response within a\n+certain timeout, libtorrent will re-request that block. Another\n+situation when libtorrent may re-request blocks is when the requests\n+it sends out are not replied in FIFO-order (it will re-request blocks\n+that are skipped by an out of order block). This is supposed to be as\n+low as possible. This only counts bytes since the torrent was last\n+started. If a torrent is paused and then restarted again, this counter\n+will be reset.
\n+
\n+[report issue]
\n+
pieces
\n+
a bitmask that represents which pieces we have (set to true) and the\n+pieces we don't have. It's a pointer and may be set to 0 if the\n+torrent isn't downloading or seeding.
\n+
\n+[report issue]
\n+
verified_pieces
\n+
a bitmask representing which pieces has had their hash checked. This\n+only applies to torrents in seed mode. If the torrent is not in seed\n+mode, this bitmask may be empty.
\n+
\n+[report issue]
\n+
total_done
\n+
the total number of bytes of the file(s) that we have. All this does\n+not necessarily has to be downloaded during this session (that's\n+total_payload_download).
\n+
\n+[report issue]
\n+
total
\n+
the total number of bytes to download for this torrent. This\n+may be less than the size of the torrent in case there are\n+pad files. This number only counts bytes that will actually\n+be requested from peers.
\n+
\n+[report issue]
\n+
total_wanted_done
\n+
the number of bytes we have downloaded, only counting the pieces that\n+we actually want to download. i.e. excluding any pieces that we have\n+but have priority 0 (i.e. not wanted).\n+Once a torrent becomes seed, any piece- and file priorities are\n+forgotten and all bytes are considered "wanted".
\n+
\n+[report issue]
\n+
total_wanted
\n+
The total number of bytes we want to download. This may be smaller\n+than the total torrent size in case any pieces are prioritized to 0,\n+i.e. not wanted.\n+Once a torrent becomes seed, any piece- and file priorities are\n+forgotten and all bytes are considered "wanted".
\n+
\n+\n+[report issue]
\n+
all_time_upload all_time_download
\n+
are accumulated upload and download payload byte counters. They are\n+saved in and restored from resume data to keep totals across sessions.
\n+
\n+[report issue]
\n+
added_time
\n+
the posix-time when this torrent was added. i.e. what time(nullptr)\n+returned at the time.
\n+
\n+[report issue]
\n+
completed_time
\n+
the posix-time when this torrent was finished. If the torrent is not\n+yet finished, this is 0.
\n+
\n+[report issue]
\n+
last_seen_complete
\n+
the time when we, or one of our peers, last saw a complete copy of\n+this torrent.
\n+
\n+[report issue]
\n+
storage_mode
\n+
The allocation mode for the torrent. See storage_mode_t for the\n+options. For more information, see storage allocation.
\n+
\n+[report issue]
\n+
progress
\n+
a value in the range [0, 1], that represents the progress of the\n+torrent's current task. It may be checking files or downloading.
\n+
\n+[report issue]
\n+
progress_ppm
\n+

progress parts per million (progress * 1000000) when disabling\n+floating point operations, this is the only option to query progress

\n+

reflects the same value as progress, but instead in a range [0,\n+1000000] (ppm = parts per million). When floating point operations are\n+disabled, this is the only alternative to the floating point value in\n+progress.

\n+
\n+
\n+[report issue]
\n+
queue_position
\n+
the position this torrent has in the download\n+queue. If the torrent is a seed or finished, this is -1.
\n+
\n+\n+[report issue]
\n+
download_rate upload_rate
\n+
the total rates for all peers for this torrent. These will usually\n+have better precision than summing the rates from all peers. The rates\n+are given as the number of bytes per second.
\n+
\n+\n+[report issue]
\n+
download_payload_rate upload_payload_rate
\n+
the total transfer rate of payload only, not counting protocol\n+chatter. This might be slightly smaller than the other rates, but if\n+projected over a long time (e.g. when calculating ETA:s) the\n+difference may be noticeable.
\n+
\n+[report issue]
\n+
num_seeds
\n+
the number of peers that are seeding that this client is\n+currently connected to.
\n+
\n+[report issue]
\n+
num_peers
\n+
the number of peers this torrent currently is connected to. Peer\n+connections that are in the half-open state (is attempting to connect)\n+or are queued for later connection attempt do not count. Although they\n+are visible in the peer list when you call get_peer_info().
\n+
\n+\n+[report issue]
\n+
num_complete num_incomplete
\n+
if the tracker sends scrape info in its announce reply, these fields\n+will be set to the total number of peers that have the whole file and\n+the total number of peers that are still downloading. set to -1 if the\n+tracker did not send any scrape data in its announce reply.
\n+
\n+\n+[report issue]
\n+
list_seeds list_peers
\n+
the number of seeds in our peer list and the total number of peers\n+(including seeds). We are not necessarily connected to all the peers\n+in our peer list. This is the number of peers we know of in total,\n+including banned peers and peers that we have failed to connect to.
\n+
\n+[report issue]
\n+
connect_candidates
\n+
the number of peers in this torrent's peer list that is a candidate to\n+be connected to. i.e. It has fewer connect attempts than the max fail\n+count, it is not a seed if we are a seed, it is not banned etc. If\n+this is 0, it means we don't know of any more peers that we can try.
\n+
\n+[report issue]
\n+
num_pieces
\n+
the number of pieces that has been downloaded. It is equivalent to:\n+std::accumulate(pieces->begin(), pieces->end()). So you don't have\n+to count yourself. This can be used to see if anything has updated\n+since last time if you want to keep a graph of the pieces up to date.
\n+
\n+[report issue]
\n+
distributed_full_copies
\n+
the number of distributed copies of the torrent. Note that one copy\n+may be spread out among many peers. It tells how many copies there are\n+currently of the rarest piece(s) among the peers this client is\n+connected to.
\n+
\n+[report issue]
\n+
distributed_fraction
\n+

tells the share of pieces that have more copies than the rarest\n+piece(s). Divide this number by 1000 to get the fraction.

\n+

For example, if distributed_full_copies is 2 and\n+distributed_fraction is 500, it means that the rarest pieces have\n+only 2 copies among the peers this torrent is connected to, and that\n+50% of all the pieces have more than two copies.

\n+

If we are a seed, the piece picker is deallocated as an optimization,\n+and piece availability is no longer tracked. In this case the\n+distributed copies members are set to -1.

\n+
\n+
\n+[report issue]
\n+
distributed_copies
\n+

the number of distributed copies of the file. note that one copy may\n+be spread out among many peers. This is a floating point\n+representation of the distributed copies.

\n+
\n+
the integer part tells how many copies
\n+
there are of the rarest piece(s)
\n+
the fractional part tells the fraction of pieces that
\n+
have more copies than the rarest piece(s).
\n+
\n+
\n+
\n+[report issue]
\n+
block_size
\n+
the size of a block, in bytes. A block is a sub piece, it is the\n+number of bytes that each piece request asks for and the number of\n+bytes that each bit in the partial_piece_info's bitset represents,\n+see get_download_queue(). This is typically 16 kB, but it may be\n+smaller, if the pieces are smaller.
\n+
\n+[report issue]
\n+
num_uploads
\n+
the number of unchoked peers in this torrent.
\n+
\n+[report issue]
\n+
num_connections
\n+
the number of peer connections this torrent has, including half-open\n+connections that hasn't completed the bittorrent handshake yet. This\n+is always >= num_peers.
\n+
\n+[report issue]
\n+
uploads_limit
\n+
the set limit of upload slots (unchoked peers) for this torrent.
\n+
\n+[report issue]
\n+
connections_limit
\n+
the set limit of number of connections for this torrent.
\n+
\n+\n+[report issue]
\n+
up_bandwidth_queue down_bandwidth_queue
\n+
the number of peers in this torrent that are waiting for more\n+bandwidth quota from the torrent rate limiter. This can determine if\n+the rate you get from this torrent is bound by the torrents limit or\n+not. If there is no limit set on this torrent, the peers might still\n+be waiting for bandwidth quota from the global limiter, but then they\n+are counted in the session_status object.
\n+
\n+[report issue]
\n+
seed_rank
\n+
A rank of how important it is to seed the torrent, it is used to\n+determine which torrents to seed and which to queue. It is based on\n+the peer to seed ratio from the tracker scrape. For more information,\n+see queuing. Higher value means more important to seed
\n+
\n+[report issue]
\n+
state
\n+
the main state the torrent is in. See torrent_status::state_t.
\n+
\n+[report issue]
\n+
need_save_resume
\n+
true if this torrent has unsaved changes\n+to its download state and statistics since the last resume data\n+was saved.
\n+
\n+[report issue]
\n+
is_seeding
\n+
true if all pieces have been downloaded.
\n+
\n+[report issue]
\n+
is_finished
\n+
true if all pieces that have a priority > 0 are downloaded. There is\n+only a distinction between finished and seeding if some pieces or\n+files have been set to priority 0, i.e. are not downloaded.
\n+
\n+[report issue]
\n+
has_metadata
\n+
true if this torrent has metadata (either it was started from a\n+.torrent file or the metadata has been downloaded). The only scenario\n+where this can be false is when the torrent was started torrent-less\n+(i.e. with just an info-hash and tracker ip, a magnet link for\n+instance).
\n+
\n+[report issue]
\n+
has_incoming
\n+
true if there has ever been an incoming connection attempt to this\n+torrent.
\n+
\n+[report issue]
\n+
moving_storage
\n+
this is true if this torrent's storage is currently being moved from\n+one location to another. This may potentially be a long operation\n+if a large file ends up being copied from one drive to another.
\n+
\n+\n+\n+[report issue]
\n+
announcing_to_trackers announcing_to_lsd announcing_to_dht
\n+
these are set to true if this torrent is allowed to announce to the\n+respective peer source. Whether they are true or false is determined by\n+the queue logic/auto manager. Torrents that are not auto managed will\n+always be allowed to announce to all peer sources.
\n+
\n+[report issue]
\n+
info_hashes
\n+
the info-hash for this torrent
\n+
\n+\n+[report issue]
\n+
last_upload last_download
\n+
the timestamps of the last time this torrent uploaded or downloaded\n+payload to any peer.
\n+
\n+\n+\n+[report issue]
\n+
active_duration finished_duration seeding_duration
\n+
these are cumulative counters of for how long the torrent has been in\n+different states. active means not paused and added to session. Whether\n+it has found any peers or not is not relevant.\n+finished means all selected files/pieces were downloaded and available\n+to other peers (this is always a subset of active time).\n+seeding means all files/pieces were downloaded and available to\n+peers. Being available to peers does not imply there are other peers\n+asking for the payload.
\n+
\n+[report issue]
\n+
flags
\n+
reflects several of the torrent's flags. For more\n+information, see torrent_handle::flags().
\n+
\n+

Bencoding is a common representation in bittorrent used for dictionary,\n+list, int and string hierarchies. It's used to encode .torrent files and\n+some messages in the network protocol. libtorrent also uses it to store\n+settings, resume data and other session state.

\n+

Strings in bencoded structures do not necessarily represent text.\n+Strings are raw byte buffers of a certain length. If a string is meant to be\n+interpreted as text, it is required to be UTF-8 encoded. See BEP 3.

\n+

The function for decoding bencoded data bdecode(), returning a bdecode_node.\n+This function builds a tree that points back into the original buffer. The\n+returned bdecode_node will not be valid once the buffer it was parsed out of\n+is discarded.

\n+

It's possible to construct an entry from a bdecode_node, if a structure needs\n+to be altered and re-encoded.

\n+[report issue]
\n+
\n+
\n+

entry

\n+

Declared in "libtorrent/entry.hpp"

\n+

The entry class represents one node in a bencoded hierarchy. It works as a\n+variant type, it can be either a list, a dictionary (std::map), an integer\n+or a string.

\n
\n-struct client_data_t\n+class entry\n {\n-   client_data_t () = default;\n-   explicit client_data_t (T* v);\n-   client_data_t& operator= (T* v);\n-   explicit operator T () const;\n-   T* get () const;\n-   client_data_t& operator= (void*) = delete;\n-   operator void* () const = delete;\n-   operator void const* () const = delete;\n-   client_data_t& operator= (void const*) = delete;\n+   data_type type () const;\n+   entry (span<char const>);\n+   entry (preformatted_type);\n+   entry (list_type);\n+   entry (dictionary_type);\n+   entry (integer_type);\n+   entry (U v);\n+   entry (data_type t);\n+   entry (bdecode_node const& n);\n+   entry& operator= (span<char const>) &;\n+   entry& operator= (entry&&) & noexcept;\n+   entry& operator= (preformatted_type) &;\n+   entry& operator= (entry const&) &;\n+   entry& operator= (list_type) &;\n+   entry& operator= (integer_type) &;\n+   entry& operator= (dictionary_type) &;\n+   entry& operator= (bdecode_node const&) &;\n+   entry& operator= (U v) &;\n+   preformatted_type& preformatted ();\n+   dictionary_type& dict ();\n+   string_type const& string () const;\n+   list_type& list ();\n+   integer_type const& integer () const;\n+   list_type const& list () const;\n+   string_type& string ();\n+   preformatted_type const& preformatted () const;\n+   integer_type& integer ();\n+   dictionary_type const& dict () const;\n+   void swap (entry& e);\n+   entry const& operator[] (string_view key) const;\n+   entry& operator[] (string_view key);\n+   entry* find_key (string_view key);\n+   entry const* find_key (string_view key) const;\n+   std::string to_string (bool single_line = false) const;\n \n-   template <typename T, typename U  = typename std::enable_if<std::is_pointer<T>::value>::type>\n+   enum data_type\n+   {\n+      int_t,\n+      string_t,\n+      list_t,\n+      dictionary_t,\n+      undefined_t,\n+      preformatted_t,\n+   };\n };\n 
\n-[report issue]
\n-

client_data_t()

\n+[report issue]
\n+

type()

\n
\n-client_data_t () = default;\n+data_type type () const;\n 
\n-

construct a nullptr client data

\n-\n-\n-[report issue]
\n-
\n-

const*() operator=() void*()

\n+

returns the concrete type of the entry

\n+[report issue]
\n+
\n+

entry()

\n
\n-client_data_t& operator= (void*) = delete;\n-operator void* () const = delete;\n-operator void const* () const = delete;\n-client_data_t& operator= (void const*) = delete;\n+entry (span<char const>);\n+entry (preformatted_type);\n+entry (list_type);\n+entry (dictionary_type);\n+entry (integer_type);\n 
\n-

we don't allow type-unsafe operations

\n-[report issue]
\n+

constructors directly from a specific type.\n+The content of the argument is copied into the\n+newly constructed entry

\n+[report issue]
\n+
\n+

entry()

\n+
\n+entry (data_type t);\n+
\n+

construct an empty entry of the specified type.\n+see data_type enum.

\n+[report issue]
\n+
\n+

entry()

\n+
\n+entry (bdecode_node const& n);\n+
\n+

construct from bdecode_node parsed form (see bdecode())

\n+[report issue]
\n+
\n+

operator=()

\n+
\n+entry& operator= (span<char const>) &;\n+entry& operator= (entry&&) & noexcept;\n+entry& operator= (preformatted_type) &;\n+entry& operator= (entry const&) &;\n+entry& operator= (list_type) &;\n+entry& operator= (integer_type) &;\n+entry& operator= (dictionary_type) &;\n+entry& operator= (bdecode_node const&) &;\n+
\n+

copies the structure of the right hand side into this\n+entry.

\n+\n+\n+\n+\n+[report issue]
\n+
\n+

preformatted() integer() list() dict() string()

\n+
\n+preformatted_type& preformatted ();\n+dictionary_type& dict ();\n+string_type const& string () const;\n+list_type& list ();\n+integer_type const& integer () const;\n+list_type const& list () const;\n+string_type& string ();\n+preformatted_type const& preformatted () const;\n+integer_type& integer ();\n+dictionary_type const& dict () const;\n+
\n+

The integer(), string(), list() and dict() functions\n+are accessors that return the respective type. If the entry object\n+isn't of the type you request, the accessor will throw\n+system_error. You can ask an entry for its type through the\n+type() function.

\n+

If you want to create an entry you give it the type you want it to\n+have in its constructor, and then use one of the non-const accessors\n+to get a reference which you then can assign the value you want it to\n+have.

\n+

The typical code to get info from a torrent file will then look like\n+this:

\n+
\n+entry torrent_file;\n+// ...\n+\n+// throws if this is not a dictionary\n+entry::dictionary_type const& dict = torrent_file.dict();\n+entry::dictionary_type::const_iterator i;\n+i = dict.find("announce");\n+if (i != dict.end())\n+{\n+        std::string tracker_url = i->second.string();\n+        std::cout << tracker_url << "\\n";\n+}\n+
\n+

The following code is equivalent, but a little bit shorter:

\n+
\n+entry torrent_file;\n+// ...\n+\n+// throws if this is not a dictionary\n+if (entry* i = torrent_file.find_key("announce"))\n+{\n+        std::string tracker_url = i->string();\n+        std::cout << tracker_url << "\\n";\n+}\n+
\n+

To make it easier to extract information from a torrent file, the\n+class torrent_info exists.

\n+[report issue]
\n+
\n+

swap()

\n+
\n+void swap (entry& e);\n+
\n+

swaps the content of this with e.

\n+[report issue]
\n+
\n+

operator[]()

\n+
\n+entry const& operator[] (string_view key) const;\n+entry& operator[] (string_view key);\n+
\n+

All of these functions requires the entry to be a dictionary, if it\n+isn't they will throw system_error.

\n+

The non-const versions of the operator[] will return a reference\n+to either the existing element at the given key or, if there is no\n+element with the given key, a reference to a newly inserted element at\n+that key.

\n+

The const version of operator[] will only return a reference to an\n+existing element at the given key. If the key is not found, it will\n+throw system_error.

\n+[report issue]
\n+
\n+

find_key()

\n+
\n+entry* find_key (string_view key);\n+entry const* find_key (string_view key) const;\n+
\n+

These functions requires the entry to be a dictionary, if it isn't\n+they will throw system_error.

\n+

They will look for an element at the given key in the dictionary, if\n+the element cannot be found, they will return nullptr. If an element\n+with the given key is found, the return a pointer to it.

\n+[report issue]
\n+
\n+

to_string()

\n+
\n+std::string to_string (bool single_line = false) const;\n+
\n+

returns a pretty-printed string representation\n+of the bencoded structure, with JSON-style syntax

\n+[report issue]
\n+
\n+

enum data_type

\n+

Declared in "libtorrent/entry.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
int_t0 
string_t1 
list_t2 
dictionary_t3 
undefined_t4 
preformatted_t5 
\n+[report issue]
\n
\n-
\n-

add_torrent_params

\n-

Declared in "libtorrent/add_torrent_params.hpp"

\n-

The add_torrent_params contains all the information in a .torrent file\n-along with all information necessary to add that torrent to a session.\n-The key fields when adding a torrent are:

\n+
\n+

operator<<()

\n+

Declared in "libtorrent/entry.hpp"

\n+
\n+inline std::ostream& operator<< (std::ostream& os, const entry& e);\n+
\n+

prints the bencoded structure to the ostream as a JSON-style structure.

\n+[report issue]
\n+
\n+

bencode()

\n+

Declared in "libtorrent/bencode.hpp"

\n+
\n+template<class OutIt> int bencode (OutIt out, const entry& e);\n+
\n+

This function will encode data to bencoded form.

\n+

The entry class is the internal representation of the bencoded data\n+and it can be used to retrieve information, an entry can also be build by\n+the program and given to bencode() to encode it into the OutIt\n+iterator.

\n+

OutIt is an OutputIterator. It's a template and usually\n+instantiated as ostream_iterator or back_insert_iterator. This\n+function assumes the value_type of the iterator is a char.\n+In order to encode entry e into a buffer, do:

\n+
\n+std::vector<char> buffer;\n+bencode(std::back_inserter(buf), e);\n+
\n+

libtorrent has a plugin interface for implementing extensions to the protocol.\n+These can be general extensions for transferring metadata or peer exchange\n+extensions, or it could be used to provide a way to customize the protocol\n+to fit a particular (closed) network.

\n+

In short, the plugin interface makes it possible to:

\n
    \n-
  • ti - the immutable info-dict part of the torrent
  • \n-
  • info_hash - when you don't have the metadata (.torrent file). This\n-uniquely identifies the torrent and can validate the info-dict when\n-received from the swarm.
  • \n+
  • register extension messages (sent in the extension handshake), see\n+extensions.
  • \n+
  • add data and parse data from the extension handshake.
  • \n+
  • send extension messages and standard bittorrent messages.
  • \n+
  • override or block the handling of standard bittorrent messages.
  • \n+
  • save and restore state via the session state
  • \n+
  • see all alerts that are posted
  • \n
\n-

In order to add a torrent to a session, one of those fields must be set\n-in addition to save_path. The add_torrent_params object can then be\n-passed into one of the session::add_torrent() overloads or\n-session::async_add_torrent().

\n-

If you only specify the info-hash, the torrent file will be downloaded\n-from peers, which requires them to support the metadata extension. For\n-the metadata extension to work, libtorrent must be built with extensions\n-enabled (TORRENT_DISABLE_EXTENSIONS must not be defined). It also\n-takes an optional name argument. This may be left empty in case no\n-name should be assigned to the torrent. In case it's not, the name is\n-used for the torrent as long as it doesn't have metadata. See\n-torrent_handle::name.

\n-

The add_torrent_params is also used when requesting resume data for a\n-torrent. It can be saved to and restored from a file and added back to a\n-new session. For serialization and de-serialization of\n-add_torrent_params objects, see read_resume_data() and\n-write_resume_data().

\n-

The add_torrent_params is also used to represent a parsed .torrent\n-file. It can be loaded via load_torrent_file(), load_torrent_buffer() and\n-load_torrent_parsed(). It can be saved via write_torrent_file().

\n+
\n+
\n+

a word of caution

\n+

Writing your own plugin is a very easy way to introduce serious bugs such as\n+dead locks and race conditions. Since a plugin has access to internal\n+structures it is also quite easy to sabotage libtorrent's operation.

\n+

All the callbacks are always called from the libtorrent network thread. In\n+case portions of your plugin are called from other threads, typically the main\n+thread, you cannot use any of the member functions on the internal structures\n+in libtorrent, since those require being called from the libtorrent network\n+thread . Furthermore, you also need to synchronize your own shared data\n+within the plugin, to make sure it is not accessed at the same time from the\n+libtorrent thread (through a callback). If you need to send out a message\n+from another thread, it is advised to use an internal queue, and do the\n+actual sending in tick().

\n+

Since the plugin interface gives you easy access to internal structures, it\n+is not supported as a stable API. Plugins should be considered specific to a\n+specific version of libtorrent. Although, in practice the internals mostly\n+don't change that dramatically.

\n+
\n+
\n+

plugin-interface

\n+

The plugin interface consists of three base classes that the plugin may\n+implement. These are called plugin, torrent_plugin and peer_plugin.\n+They are found in the <libtorrent/extensions.hpp> header.

\n+

These plugins are instantiated for each session, torrent and possibly each peer,\n+respectively.

\n+

For plugins that only need per torrent state, it is enough to only implement\n+torrent_plugin and pass a constructor function or function object to\n+session::add_extension() or torrent_handle::add_extension() (if the\n+torrent has already been started and you want to hook in the extension at\n+run-time).

\n+

The signature of the function is:

\n+
\n+std::shared_ptr<torrent_plugin> (*)(torrent_handle const&, client_data_t);\n+
\n+

The second argument is the userdata passed to session::add_torrent() or\n+torrent_handle::add_extension().

\n+

The function should return a std::shared_ptr<torrent_plugin> which\n+may or may not be 0. If it is a nullptr, the extension is simply ignored\n+for this torrent. If it is a valid pointer (to a class inheriting\n+torrent_plugin), it will be associated with this torrent and callbacks\n+will be made on torrent events.

\n+

For more elaborate plugins which require session wide state, you would\n+implement plugin, construct an object (in a std::shared_ptr) and pass\n+it in to session::add_extension().

\n+
\n+
\n+

custom alerts

\n+

Since plugins are running within internal libtorrent threads, one convenient\n+way to communicate with the client is to post custom alerts.

\n+

The expected interface of any alert, apart from deriving from the alert\n+base class, looks like this:

\n+
\n+static const int alert_type = <unique alert ID>;\n+virtual int type() const { return alert_type; }\n+\n+virtual std::string message() const;\n+\n+static const alert_category_t static_category = <bitmask of alert::category_t flags>;\n+virtual alert_category_t category() const { return static_category; }\n+\n+virtual char const* what() const { return <string literal of the name of this alert>; }\n+
\n+

The alert_type is used for the type-checking in alert_cast. It must\n+not collide with any other alert. The built-in alerts in libtorrent will\n+not use alert type IDs greater than user_alert_id. When defining your\n+own alert, make sure it's greater than this constant.

\n+

type() is the run-time equivalence of the alert_type.

\n+

The message() virtual function is expected to construct a useful\n+string representation of the alert and the event or data it represents.\n+Something convenient to put in a log file for instance.

\n+

clone() is used internally to copy alerts. The suggested implementation\n+of simply allocating a new instance as a copy of *this is all that's\n+expected.

\n+

The static category is required for checking whether or not the category\n+for a specific alert is enabled or not, without instantiating the alert.\n+The category virtual function is the run-time equivalence.

\n+

The what() virtual function may simply be a string literal of the class\n+name of your alert.

\n+

For more information, see the alert section.

\n+[report issue]
\n+
\n+

plugin

\n+

Declared in "libtorrent/extensions.hpp"

\n+

this is the base class for a session plugin. One primary feature\n+is that it is notified of all torrents that are added to the session,\n+and can add its own torrent_plugins.

\n+
\n+struct plugin\n+{\n+   virtual feature_flags_t implemented_features ();\n+   virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);\n+   virtual void added (session_handle const&);\n+   virtual void abort ();\n+   virtual bool on_dht_request (string_view /* query */\n+      , udp::endpoint const& /* source */, bdecode_node const& /* message */\n+      , entry& /* response */);\n+   virtual void on_alert (alert const*);\n+   virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n+      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n+   virtual void on_tick ();\n+   virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);\n+   virtual std::map<std::string, std::string> save_state () const;\n+   virtual void load_state (std::map<std::string, std::string> const&);\n+\n+   static constexpr feature_flags_t optimistic_unchoke_feature  = 1_bit;\n+   static constexpr feature_flags_t tick_feature  = 2_bit;\n+   static constexpr feature_flags_t dht_request_feature  = 3_bit;\n+   static constexpr feature_flags_t alert_feature  = 4_bit;\n+};\n+
\n+[report issue]
\n+

implemented_features()

\n+
\n+virtual feature_flags_t implemented_features ();\n+
\n+

This function is expected to return a bitmask indicating which features\n+this plugin implements. Some callbacks on this object may not be called\n+unless the corresponding feature flag is returned here. Note that\n+callbacks may still be called even if the corresponding feature is not\n+specified in the return value here. See feature_flags_t for possible\n+flags to return.

\n+[report issue]
\n+
\n+

new_torrent()

\n+
\n+virtual std::shared_ptr<torrent_plugin> new_torrent (torrent_handle const&, client_data_t);\n+
\n+

this is called by the session every time a new torrent is added.\n+The torrent* points to the internal torrent object created\n+for the new torrent. The client_data_t is the userdata pointer as\n+passed in via add_torrent_params.

\n+

If the plugin returns a torrent_plugin instance, it will be added\n+to the new torrent. Otherwise, return an empty shared_ptr to a\n+torrent_plugin (the default).

\n+[report issue]
\n+
\n+

added()

\n+
\n+virtual void added (session_handle const&);\n+
\n+

called when plugin is added to a session

\n+[report issue]
\n+
\n+

abort()

\n+
\n+virtual void abort ();\n+
\n+

called when the session is aborted\n+the plugin should perform any cleanup necessary to allow the session's\n+destruction (e.g. cancel outstanding async operations)

\n+[report issue]
\n+
\n+

on_dht_request()

\n+
\n+virtual bool on_dht_request (string_view /* query */\n+      , udp::endpoint const& /* source */, bdecode_node const& /* message */\n+      , entry& /* response */);\n+
\n+

called when a dht request is received.\n+If your plugin expects this to be called, make sure to include the flag\n+dht_request_feature in the return value from implemented_features().

\n+[report issue]
\n+
\n+

on_alert()

\n+
\n+virtual void on_alert (alert const*);\n+
\n+

called when an alert is posted alerts that are filtered are not posted.\n+If your plugin expects this to be called, make sure to include the flag\n+alert_feature in the return value from implemented_features().

\n+[report issue]
\n+
\n+

on_unknown_torrent()

\n+
\n+virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n+      , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n+
\n+

return true if the add_torrent_params should be added

\n+[report issue]
\n+
\n+

on_tick()

\n+
\n+virtual void on_tick ();\n+
\n+

called once per second.\n+If your plugin expects this to be called, make sure to include the flag\n+tick_feature in the return value from implemented_features().

\n+[report issue]
\n+
\n+

get_unchoke_priority()

\n+
\n+virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */);\n+
\n+

called when choosing peers to optimistically unchoke. The return value\n+indicates the peer's priority for unchoking. Lower return values\n+correspond to higher priority. Priorities above 2^63-1 are reserved.\n+If your plugin has no priority to assign a peer it should return 2^64-1.\n+If your plugin expects this to be called, make sure to include the flag\n+optimistic_unchoke_feature in the return value from implemented_features().\n+If multiple plugins implement this function the lowest return value\n+(i.e. the highest priority) is used.

\n+[report issue]
\n+
\n+

load_state()

\n+
\n+virtual void load_state (std::map<std::string, std::string> const&);\n+
\n+

called on startup while loading settings state from the session_params

\n+[report issue]
\n+
optimistic_unchoke_feature
\n+
include this bit if your plugin needs to alter the order of the\n+optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()\n+callback be called.
\n+
\n+[report issue]
\n+
tick_feature
\n+
include this bit if your plugin needs to have on_tick() called
\n+
\n+[report issue]
\n+
dht_request_feature
\n+
include this bit if your plugin needs to have on_dht_request()\n+called
\n+
\n+[report issue]
\n+
alert_feature
\n+
include this bit if your plugin needs to have on_alert()\n+called
\n+
\n+[report issue]
\n+
\n+
\n+

torrent_plugin

\n+

Declared in "libtorrent/extensions.hpp"

\n+

Torrent plugins are associated with a single torrent and have a number\n+of functions called at certain events. Many of its functions have the\n+ability to change or override the default libtorrent behavior.

\n+
\n+struct torrent_plugin\n+{\n+   virtual std::shared_ptr<peer_plugin> new_connection (peer_connection_handle const&);\n+   virtual void on_piece_failed (piece_index_t);\n+   virtual void on_piece_pass (piece_index_t);\n+   virtual void tick ();\n+   virtual bool on_pause ();\n+   virtual bool on_resume ();\n+   virtual void on_files_checked ();\n+   virtual void on_state (torrent_status::state_t);\n+   virtual void on_add_peer (tcp::endpoint const&,\n+      peer_source_flags_t, add_peer_flags_t);\n+\n+   static constexpr add_peer_flags_t first_time  = 1_bit;\n+   static constexpr add_peer_flags_t filtered  = 2_bit;\n+};\n+
\n+[report issue]
\n+

new_connection()

\n+
\n+virtual std::shared_ptr<peer_plugin> new_connection (peer_connection_handle const&);\n+
\n+

This function is called each time a new peer is connected to the torrent. You\n+may choose to ignore this by just returning a default constructed\n+shared_ptr (in which case you don't need to override this member\n+function).

\n+

If you need an extension to the peer connection (which most plugins do) you\n+are supposed to return an instance of your peer_plugin class. Which in\n+turn will have its hook functions called on event specific to that peer.

\n+

The peer_connection_handle will be valid as long as the shared_ptr\n+is being held by the torrent object. So, it is generally a good idea to not\n+keep a shared_ptr to your own peer_plugin. If you want to keep references\n+to it, use weak_ptr.

\n+

If this function throws an exception, the connection will be closed.

\n+\n+[report issue]
\n+
\n+

on_piece_failed() on_piece_pass()

\n+
\n+virtual void on_piece_failed (piece_index_t);\n+virtual void on_piece_pass (piece_index_t);\n+
\n+

These hooks are called when a piece passes the hash check or fails the hash\n+check, respectively. The index is the piece index that was downloaded.\n+It is possible to access the list of peers that participated in sending the\n+piece through the torrent and the piece_picker.

\n+[report issue]
\n+
\n+

tick()

\n+
\n+virtual void tick ();\n+
\n+

This hook is called approximately once per second. It is a way of making it\n+easy for plugins to do timed events, for sending messages or whatever.

\n+\n+[report issue]
\n+
\n+

on_pause() on_resume()

\n+
\n+virtual bool on_pause ();\n+virtual bool on_resume ();\n+
\n+

These hooks are called when the torrent is paused and resumed respectively.\n+The return value indicates if the event was handled. A return value of\n+true indicates that it was handled, and no other plugin after this one\n+will have this hook function called, and the standard handler will also not be\n+invoked. So, returning true effectively overrides the standard behavior of\n+pause or resume.

\n+

Note that if you call pause() or resume() on the torrent from your\n+handler it will recurse back into your handler, so in order to invoke the\n+standard handler, you have to keep your own state on whether you want standard\n+behavior or overridden behavior.

\n+[report issue]
\n+
\n+

on_files_checked()

\n+
\n+virtual void on_files_checked ();\n+
\n+

This function is called when the initial files of the torrent have been\n+checked. If there are no files to check, this function is called immediately.

\n+

i.e. This function is always called when the torrent is in a state where it\n+can start downloading.

\n+[report issue]
\n+
\n+

on_state()

\n+
\n+virtual void on_state (torrent_status::state_t);\n+
\n+

called when the torrent changes state\n+the state is one of torrent_status::state_t\n+enum members

\n+[report issue]
\n+
\n+

on_add_peer()

\n+
\n+virtual void on_add_peer (tcp::endpoint const&,\n+      peer_source_flags_t, add_peer_flags_t);\n+
\n+

called every time a new peer is added to the peer list.\n+This is before the peer is connected to. For flags, see\n+torrent_plugin::flags_t. The source argument refers to\n+the source where we learned about this peer from. It's a\n+bitmask, because many sources may have told us about the same\n+peer. For peer source flags, see peer_info::peer_source_flags.

\n+[report issue]
\n+
first_time
\n+
this is the first time we see this peer
\n+
\n+[report issue]
\n+
filtered
\n+
this peer was not added because it was\n+filtered by the IP filter
\n+
\n+[report issue]
\n+
\n+
\n+

peer_plugin

\n+

Declared in "libtorrent/extensions.hpp"

\n+

peer plugins are associated with a specific peer. A peer could be\n+both a regular bittorrent peer (bt_peer_connection) or one of the\n+web seed connections (web_peer_connection or http_seed_connection).\n+In order to only attach to certain peers, make your\n+torrent_plugin::new_connection only return a plugin for certain peer\n+connection types

\n+
\n+struct peer_plugin\n+{\n+   virtual string_view type () const;\n+   virtual void add_handshake (entry&);\n+   virtual void on_disconnect (error_code const&);\n+   virtual void on_connected ();\n+   virtual bool on_handshake (span<char const>);\n+   virtual bool on_extension_handshake (bdecode_node const&);\n+   virtual bool on_bitfield (bitfield const& /*bitfield*/);\n+   virtual bool on_request (peer_request const&);\n+   virtual bool on_not_interested ();\n+   virtual bool on_interested ();\n+   virtual bool on_have_all ();\n+   virtual bool on_unchoke ();\n+   virtual bool on_dont_have (piece_index_t);\n+   virtual bool on_have (piece_index_t);\n+   virtual bool on_have_none ();\n+   virtual bool on_choke ();\n+   virtual bool on_allowed_fast (piece_index_t);\n+   virtual bool on_piece (peer_request const& /*piece*/\n+      , span<char const> /*buf*/);\n+   virtual bool on_cancel (peer_request const&);\n+   virtual bool on_reject (peer_request const&);\n+   virtual bool on_suggest (piece_index_t);\n+   virtual void sent_have_none ();\n+   virtual void sent_have_all ();\n+   virtual void sent_suggest (piece_index_t);\n+   virtual void sent_reject_request (peer_request const&);\n+   virtual void sent_request (peer_request const&);\n+   virtual void sent_cancel (peer_request const&);\n+   virtual void sent_allow_fast (piece_index_t);\n+   virtual void sent_choke ();\n+   virtual void sent_piece (peer_request const&);\n+   virtual void sent_not_interested ();\n+   virtual void sent_unchoke ();\n+   virtual void sent_interested ();\n+   virtual void sent_have (piece_index_t);\n+   virtual void sent_payload (int /* bytes */);\n+   virtual bool can_disconnect (error_code const& /*ec*/);\n+   virtual bool on_extended (int /*length*/, int /*msg*/,\n+      span<char const> /*body*/);\n+   virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n+      span<char const> /*body*/);\n+   virtual void on_piece_failed (piece_index_t);\n+   virtual void on_piece_pass (piece_index_t);\n+   virtual void tick ();\n+   virtual bool write_request (peer_request const&);\n+};\n+
\n+[report issue]
\n+

type()

\n+
\n+virtual string_view type () const;\n+
\n+

This function is expected to return the name of\n+the plugin.

\n+[report issue]
\n+
\n+

add_handshake()

\n+
\n+virtual void add_handshake (entry&);\n+
\n+

can add entries to the extension handshake\n+this is not called for web seeds

\n+[report issue]
\n+
\n+

on_disconnect()

\n+
\n+virtual void on_disconnect (error_code const&);\n+
\n+

called when the peer is being disconnected.

\n+[report issue]
\n+
\n+

on_connected()

\n+
\n+virtual void on_connected ();\n+
\n+

called when the peer is successfully connected. Note that\n+incoming connections will have been connected by the time\n+the peer plugin is attached to it, and won't have this hook\n+called.

\n+[report issue]
\n+
\n+

on_handshake()

\n+
\n+virtual bool on_handshake (span<char const>);\n+
\n+

this is called when the initial bittorrent handshake is received.\n+Returning false means that the other end doesn't support this extension\n+and will remove it from the list of plugins. this is not called for web\n+seeds

\n+[report issue]
\n+
\n+

on_extension_handshake()

\n+
\n+virtual bool on_extension_handshake (bdecode_node const&);\n+
\n+

called when the extension handshake from the other end is received\n+if this returns false, it means that this extension isn't\n+supported by this peer. It will result in this peer_plugin\n+being removed from the peer_connection and destructed.\n+this is not called for web seeds

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+[report issue]
\n+
\n+

on_have() on_have_all() on_interested() on_request() on_bitfield() on_dont_have() on_allowed_fast() on_unchoke() on_have_none() on_not_interested() on_choke()

\n+
\n+virtual bool on_bitfield (bitfield const& /*bitfield*/);\n+virtual bool on_request (peer_request const&);\n+virtual bool on_not_interested ();\n+virtual bool on_interested ();\n+virtual bool on_have_all ();\n+virtual bool on_unchoke ();\n+virtual bool on_dont_have (piece_index_t);\n+virtual bool on_have (piece_index_t);\n+virtual bool on_have_none ();\n+virtual bool on_choke ();\n+virtual bool on_allowed_fast (piece_index_t);\n+
\n+

returning true from any of the message handlers\n+indicates that the plugin has handled the message.\n+it will break the plugin chain traversing and not let\n+anyone else handle the message, including the default\n+handler.

\n+[report issue]
\n+
\n+

on_piece()

\n+
\n+virtual bool on_piece (peer_request const& /*piece*/\n+      , span<char const> /*buf*/);\n+
\n+

This function is called when the peer connection is receiving\n+a piece. buf points (non-owning pointer) to the data in an\n+internal immutable disk buffer. The length of the data is specified\n+in the length member of the piece parameter.\n+returns true to indicate that the piece is handled and the\n+rest of the logic should be ignored.

\n+\n+\n+\n+\n+[report issue]
\n+
\n+

sent_piece() sent_unchoke() sent_interested() sent_not_interested() sent_have()

\n+
\n+virtual void sent_piece (peer_request const&);\n+virtual void sent_not_interested ();\n+virtual void sent_unchoke ();\n+virtual void sent_interested ();\n+virtual void sent_have (piece_index_t);\n+
\n+

called after a choke message has been sent to the peer

\n+[report issue]
\n+
\n+

sent_payload()

\n+
\n+virtual void sent_payload (int /* bytes */);\n+
\n+

called after piece data has been sent to the peer\n+this can be used for stats book keeping

\n+[report issue]
\n+
\n+

can_disconnect()

\n+
\n+virtual bool can_disconnect (error_code const& /*ec*/);\n+
\n+

called when libtorrent think this peer should be disconnected.\n+if the plugin returns false, the peer will not be disconnected.

\n+[report issue]
\n+
\n+

on_extended()

\n+
\n+virtual bool on_extended (int /*length*/, int /*msg*/,\n+      span<char const> /*body*/);\n+
\n+

called when an extended message is received. If returning true,\n+the message is not processed by any other plugin and if false\n+is returned the next plugin in the chain will receive it to\n+be able to handle it. This is not called for web seeds.\n+thus function may be called more than once per incoming message, but\n+only the last of the calls will the body size equal the length.\n+i.e. Every time another fragment of the message is received, this\n+function will be called, until finally the whole message has been\n+received. The purpose of this is to allow early disconnects for invalid\n+messages and for reporting progress of receiving large messages.

\n+[report issue]
\n+
\n+

on_unknown_message()

\n+
\n+virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n+      span<char const> /*body*/);\n+
\n+

this is not called for web seeds

\n+\n+[report issue]
\n+
\n+

on_piece_failed() on_piece_pass()

\n+
\n+virtual void on_piece_failed (piece_index_t);\n+virtual void on_piece_pass (piece_index_t);\n+
\n+

called when a piece that this peer participated in either\n+fails or passes the hash_check

\n+[report issue]
\n+
\n+

tick()

\n+
\n+virtual void tick ();\n+
\n+

called approximately once every second

\n+[report issue]
\n+
\n+

write_request()

\n+
\n+virtual bool write_request (peer_request const&);\n+
\n+

called each time a request message is to be sent. If true\n+is returned, the original request message won't be sent and\n+no other plugin will have this function called.

\n+[report issue]
\n+
\n+
\n+

crypto_plugin

\n+

Declared in "libtorrent/extensions.hpp"

\n+
\n+struct crypto_plugin\n+{\n+   virtual void set_outgoing_key (span<char const> key) = 0;\n+   virtual void set_incoming_key (span<char const> key) = 0;\n+   encrypt (span<span<char>> /*send_vec*/) = 0;\n+   virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;\n+};\n+
\n+[report issue]
\n+

decrypt()

\n+
\n+virtual std::tuple<int, int, int> decrypt (span<span<char>> /*receive_vec*/) = 0;\n+
\n+

decrypt the provided buffers.\n+returns is a tuple representing the values\n+(consume, produce, packet_size)

\n+

consume is set to the number of bytes which should be trimmed from the\n+head of the buffers, default is 0

\n+

produce is set to the number of bytes of payload which are now ready to\n+be sent to the upper layer. default is the number of bytes passed in receive_vec

\n+

packet_size is set to the minimum number of bytes which must be read to\n+advance the next step of decryption. default is 0

\n+[report issue]
\n+
\n+
\n+

peer_connection_handle

\n+

Declared in "libtorrent/peer_connection_handle.hpp"

\n+

the peer_connection_handle class provides a handle to the internal peer\n+connection object, to be used by plugins. This is a low level interface that\n+may not be stable across libtorrent versions

\n+
\n+struct peer_connection_handle\n+{\n+   explicit peer_connection_handle (std::weak_ptr<peer_connection> impl);\n+   connection_type type () const;\n+   void add_extension (std::shared_ptr<peer_plugin>);\n+   peer_plugin const* find_plugin (string_view type) const;\n+   bool is_seed () const;\n+   bool upload_only () const;\n+   peer_id const& pid () const;\n+   bool has_piece (piece_index_t i) const;\n+   bool is_interesting () const;\n+   bool is_choked () const;\n+   bool is_peer_interested () const;\n+   bool has_peer_choked () const;\n+   void maybe_unchoke_this_peer ();\n+   void choke_this_peer ();\n+   void get_peer_info (peer_info& p) const;\n+   torrent_handle associated_torrent () const;\n+   tcp::endpoint local_endpoint () const;\n+   tcp::endpoint const& remote () const;\n+   bool is_outgoing () const;\n+   bool is_disconnecting () const;\n+   bool is_connecting () const;\n+   void disconnect (error_code const& ec, operation_t op\n+      , disconnect_severity_t = peer_connection_interface::normal);\n+   bool on_local_network () const;\n+   bool ignore_unchoke_slots () const;\n+   bool failed () const;\n+   void peer_log (peer_log_alert::direction_t direction\n+      , char const* event, char const* fmt = "", ...) const TORRENT_FORMAT(4,5);\n+   bool should_log (peer_log_alert::direction_t direction) const;\n+   bool can_disconnect (error_code const& ec) const;\n+   bool has_metadata () const;\n+   bool in_handshake () const;\n+   void send_buffer (char const* begin, int size);\n+   time_point time_of_last_unchoke () const;\n+   std::time_t last_seen_complete () const;\n+   bool operator< (peer_connection_handle const& o) const;\n+   bool operator== (peer_connection_handle const& o) const;\n+   bool operator!= (peer_connection_handle const& o) const;\n+   std::shared_ptr<peer_connection> native_handle () const;\n+};\n+
\n+[report issue]
\n+
\n+

bt_peer_connection_handle

\n+

Declared in "libtorrent/peer_connection_handle.hpp"

\n+

The bt_peer_connection_handle provides a handle to the internal bittorrent\n+peer connection object to plugins. It's low level and may not be a stable API\n+across libtorrent versions.

\n+
\n+struct bt_peer_connection_handle : peer_connection_handle\n+{\n+   explicit bt_peer_connection_handle (peer_connection_handle pc);\n+   bool packet_finished () const;\n+   bool support_extensions () const;\n+   bool supports_encryption () const;\n+   void switch_send_crypto (std::shared_ptr<crypto_plugin> crypto);\n+   void switch_recv_crypto (std::shared_ptr<crypto_plugin> crypto);\n+   std::shared_ptr<bt_peer_connection> native_handle () const;\n+};\n+
\n+[report issue]
\n+
\n+

create_ut_metadata_plugin()

\n+

Declared in "libtorrent/extensions/ut_metadata.hpp"

\n+
\n+std::shared_ptr<torrent_plugin> create_ut_metadata_plugin (torrent_handle const&, client_data_t);\n+
\n+

constructor function for the ut_metadata extension. The ut_metadata\n+extension allows peers to request the .torrent file (or more\n+specifically the info-dictionary of the .torrent file) from each\n+other. This is the main building block in making magnet links work.\n+This extension is enabled by default unless explicitly disabled in\n+the session constructor.

\n+

This can either be passed in the add_torrent_params::extensions field, or\n+via torrent_handle::add_extension().

\n+[report issue]
\n+
\n+

create_smart_ban_plugin()

\n+

Declared in "libtorrent/extensions/smart_ban.hpp"

\n+
\n+std::shared_ptr<torrent_plugin> create_smart_ban_plugin (torrent_handle const&, client_data_t);\n+
\n+

constructor function for the smart ban extension. The extension keeps\n+track of the data peers have sent us for failing pieces and once the\n+piece completes and passes the hash check bans the peers that turned\n+out to have sent corrupt data.\n+This function can either be passed in the add_torrent_params::extensions\n+field, or via torrent_handle::add_extension().

\n+[report issue]
\n+
\n+

create_ut_pex_plugin()

\n+

Declared in "libtorrent/extensions/ut_pex.hpp"

\n+
\n+std::shared_ptr<torrent_plugin> create_ut_pex_plugin (torrent_handle const&, client_data_t);\n+
\n+

constructor function for the ut_pex extension. The ut_pex\n+extension allows peers to gossip about their connections, allowing\n+the swarm stay well connected and peers aware of more peers in the\n+swarm. This extension is enabled by default unless explicitly disabled in\n+the session constructor.

\n+

This can either be passed in the add_torrent_params::extensions field, or\n+via torrent_handle::add_extension().

\n+[report issue]
\n+
\n+

ip_filter

\n+

Declared in "libtorrent/ip_filter.hpp"

\n+

The ip_filter class is a set of rules that uniquely categorizes all\n+ip addresses as allowed or disallowed. The default constructor creates\n+a single rule that allows all addresses (0.0.0.0 - 255.255.255.255 for\n+the IPv4 range, and the equivalent range covering all addresses for the\n+IPv6 range).

\n+

A default constructed ip_filter does not filter any address.

\n+
\n+struct ip_filter\n+{\n+   ip_filter ();\n+   ip_filter& operator= (ip_filter&&);\n+   ~ip_filter ();\n+   ip_filter (ip_filter&&);\n+   ip_filter& operator= (ip_filter const&);\n+   ip_filter (ip_filter const&);\n+   bool empty () const;\n+   void add_rule (address const& first, address const& last, std::uint32_t flags);\n+   std::uint32_t access (address const& addr) const;\n+   filter_tuple_t export_filter () const;\n+\n+   enum access_flags\n+   {\n+      blocked,\n+   };\n+};\n+
\n+[report issue]
\n+

empty()

\n+
\n+bool empty () const;\n+
\n+

returns true if the filter does not contain any rules

\n+[report issue]
\n+
\n+

add_rule()

\n+
\n+void add_rule (address const& first, address const& last, std::uint32_t flags);\n+
\n+

Adds a rule to the filter. first and last defines a range of\n+ip addresses that will be marked with the given flags. The flags\n+can currently be 0, which means allowed, or ip_filter::blocked, which\n+means disallowed.

\n+

precondition:\n+first.is_v4() == last.is_v4() && first.is_v6() == last.is_v6()

\n+

postcondition:\n+access(x) == flags for every x in the range [first, last]

\n+

This means that in a case of overlapping ranges, the last one applied takes\n+precedence.

\n+[report issue]
\n+
\n+

access()

\n+
\n+std::uint32_t access (address const& addr) const;\n+
\n+

Returns the access permissions for the given address (addr). The permission\n+can currently be 0 or ip_filter::blocked. The complexity of this operation\n+is O(log n), where n is the minimum number of non-overlapping ranges to describe\n+the current filter.

\n+[report issue]
\n+
\n+

export_filter()

\n+
\n+filter_tuple_t export_filter () const;\n+
\n+

This function will return the current state of the filter in the minimum number of\n+ranges possible. They are sorted from ranges in low addresses to high addresses. Each\n+entry in the returned vector is a range with the access control specified in its\n+flags field.

\n+

The return value is a tuple containing two range-lists. One for IPv4 addresses\n+and one for IPv6 addresses.

\n+[report issue]
\n+
\n+

enum access_flags

\n+

Declared in "libtorrent/ip_filter.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
blocked1indicates that IPs in this range should not be connected\n+to nor accepted as incoming connections
\n+[report issue]
\n+
\n+
\n+

port_filter

\n+

Declared in "libtorrent/ip_filter.hpp"

\n+

the port filter maps non-overlapping port ranges to flags. This\n+is primarily used to indicate whether a range of ports should\n+be connected to or not. The default is to have the full port\n+range (0-65535) set to flag 0.

\n+
\n+class port_filter\n+{\n+   ~port_filter ();\n+   port_filter (port_filter const&);\n+   port_filter& operator= (port_filter const&);\n+   port_filter& operator= (port_filter&&);\n+   port_filter ();\n+   port_filter (port_filter&&);\n+   void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);\n+   std::uint32_t access (std::uint16_t port) const;\n+\n+   enum access_flags\n+   {\n+      blocked,\n+   };\n+};\n+
\n+[report issue]
\n+

add_rule()

\n+
\n+void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);\n+
\n+

set the flags for the specified port range (first, last) to\n+flags overwriting any existing rule for those ports. The range\n+is inclusive, i.e. the port last also has the flag set on it.

\n+[report issue]
\n+
\n+

access()

\n+
\n+std::uint32_t access (std::uint16_t port) const;\n+
\n+

test the specified port (port) for whether it is blocked\n+or not. The returned value is the flags set for this port.\n+see access_flags.

\n+[report issue]
\n+
\n+

enum access_flags

\n+

Declared in "libtorrent/ip_filter.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
blocked1this flag indicates that destination ports in the\n+range should not be connected to
\n+[report issue]
\n+
\n+
\n+

bdecode_node

\n+

Declared in "libtorrent/bdecode.hpp"

\n+

Sometimes it's important to get a non-owning reference to the root node (\n+to be able to copy it as a reference for instance). For that, use the\n+non_owning() member function.

\n+

There are 5 different types of nodes, see type_t.

\n+
\n+struct bdecode_node\n+{\n+   bdecode_node () = default;\n+   bdecode_node (bdecode_node const&);\n+   bdecode_node (bdecode_node&&) noexcept;\n+   bdecode_node& operator= (bdecode_node&&) & = default;\n+   bdecode_node& operator= (bdecode_node const&) &;\n+   type_t type () const noexcept;\n+   explicit operator bool () const noexcept;\n+   bdecode_node non_owning () const;\n+   span<char const> data_section () const noexcept;\n+   std::ptrdiff_t data_offset () const noexcept;\n+   std::int64_t list_int_value_at (int i\n+      , std::int64_t default_val = 0) const;\n+   bdecode_node list_at (int i) const;\n+   string_view list_string_value_at (int i\n+      , string_view default_val = string_view()) const;\n+   int list_size () const;\n+   std::pair<string_view, bdecode_node> dict_at (int i) const;\n+   bdecode_node dict_find_dict (string_view key) const;\n+   std::int64_t dict_find_int_value (string_view key\n+      , std::int64_t default_val = 0) const;\n+   string_view dict_find_string_value (string_view key\n+      , string_view default_value = string_view()) const;\n+   int dict_size () const;\n+   bdecode_node dict_find_list (string_view key) const;\n+   bdecode_node dict_find_string (string_view key) const;\n+   bdecode_node dict_find_int (string_view key) const;\n+   std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;\n+   bdecode_node dict_find (string_view key) const;\n+   std::int64_t int_value () const;\n+   string_view string_value () const;\n+   std::ptrdiff_t string_offset () const;\n+   int string_length () const;\n+   char const* string_ptr () const;\n+   void clear ();\n+   void swap (bdecode_node& n);\n+   void reserve (int tokens);\n+   void switch_underlying_buffer (char const* buf) noexcept;\n+   bool has_soft_error (span<char> error) const;\n+\n+   enum type_t\n+   {\n+      none_t,\n+      dict_t,\n+      list_t,\n+      string_t,\n+      int_t,\n+   };\n+};\n+
\n+[report issue]
\n+

bdecode_node()

\n+
\n+bdecode_node () = default;\n+
\n+

creates a default constructed node, it will have the type none_t.

\n+\n+[report issue]
\n+
\n+

bdecode_node() operator=()

\n+
\n+bdecode_node (bdecode_node const&);\n+bdecode_node (bdecode_node&&) noexcept;\n+bdecode_node& operator= (bdecode_node&&) & = default;\n+bdecode_node& operator= (bdecode_node const&) &;\n+
\n+

For owning nodes, the copy will create a copy of the tree, but the\n+underlying buffer remains the same.

\n+[report issue]
\n+
\n+

type()

\n+
\n+type_t type () const noexcept;\n+
\n+

the type of this node. See type_t.

\n+[report issue]
\n+
\n+

bool()

\n+
\n+explicit operator bool () const noexcept;\n+
\n+

returns true if type() != none_t.

\n+[report issue]
\n+
\n+

non_owning()

\n+
\n+bdecode_node non_owning () const;\n+
\n+

return a non-owning reference to this node. This is useful to refer to\n+the root node without copying it in assignments.

\n+\n+[report issue]
\n+
\n+

data_offset() data_section()

\n+
\n+span<char const> data_section () const noexcept;\n+std::ptrdiff_t data_offset () const noexcept;\n+
\n+

returns the buffer and length of the section in the original bencoded\n+buffer where this node is defined. For a dictionary for instance, this\n+starts with d and ends with e, and has all the content of the\n+dictionary in between.\n+the data_offset() function returns the byte-offset to this node in,\n+starting from the beginning of the buffer that was parsed.

\n+\n+\n+\n+[report issue]
\n+
\n+

list_string_value_at() list_at() list_int_value_at() list_size()

\n+
\n+std::int64_t list_int_value_at (int i\n+      , std::int64_t default_val = 0) const;\n+bdecode_node list_at (int i) const;\n+string_view list_string_value_at (int i\n+      , string_view default_val = string_view()) const;\n+int list_size () const;\n+
\n+

functions with the list_ prefix operate on lists. These functions are\n+only valid if type() == list_t. list_at() returns the item\n+in the list at index i. i may not be greater than or equal to the\n+size of the list. size() returns the size of the list.

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+[report issue]
\n+
\n+

dict_find_string_value() dict_find_int_value() dict_find() dict_at() dict_find_dict() dict_find_string() dict_find_int() dict_at_node() dict_size() dict_find_list()

\n+
\n+std::pair<string_view, bdecode_node> dict_at (int i) const;\n+bdecode_node dict_find_dict (string_view key) const;\n+std::int64_t dict_find_int_value (string_view key\n+      , std::int64_t default_val = 0) const;\n+string_view dict_find_string_value (string_view key\n+      , string_view default_value = string_view()) const;\n+int dict_size () const;\n+bdecode_node dict_find_list (string_view key) const;\n+bdecode_node dict_find_string (string_view key) const;\n+bdecode_node dict_find_int (string_view key) const;\n+std::pair<bdecode_node, bdecode_node> dict_at_node (int i) const;\n+bdecode_node dict_find (string_view key) const;\n+
\n+

Functions with the dict_ prefix operates on dictionaries. They are\n+only valid if type() == dict_t. In case a key you're looking up\n+contains a 0 byte, you cannot use the 0-terminated string overloads,\n+but have to use string_view instead. dict_find_list will return a\n+valid bdecode_node if the key is found _and_ it is a list. Otherwise\n+it will return a default-constructed bdecode_node.

\n+

Functions with the _value suffix return the value of the node\n+directly, rather than the nodes. In case the node is not found, or it has\n+a different type, a default value is returned (which can be specified).

\n+

dict_at() returns the (key, value)-pair at the specified index in a\n+dictionary. Keys are only allowed to be strings. dict_at_node() also\n+returns the (key, value)-pair, but the key is returned as a\n+bdecode_node (and it will always be a string).

\n+[report issue]
\n+
\n+

int_value()

\n+
\n+std::int64_t int_value () const;\n+
\n+

this function is only valid if type() == int_t. It returns the\n+value of the integer.

\n+\n+\n+\n+[report issue]
\n+
\n+

string_ptr() string_offset() string_value() string_length()

\n+
\n+string_view string_value () const;\n+std::ptrdiff_t string_offset () const;\n+int string_length () const;\n+char const* string_ptr () const;\n+
\n+

these functions are only valid if type() == string_t. They return\n+the string values. Note that string_ptr() is not 0-terminated.\n+string_length() returns the number of bytes in the string.\n+string_offset() returns the byte offset from the start of the parsed\n+bencoded buffer this string can be found.

\n+[report issue]
\n+
\n+

clear()

\n+
\n+void clear ();\n+
\n+

resets the bdecoded_node to a default constructed state. If this is\n+an owning node, the tree is freed and all child nodes are invalidated.

\n+[report issue]
\n+
\n+

swap()

\n+
\n+void swap (bdecode_node& n);\n+
\n+

Swap contents.

\n+[report issue]
\n+
\n+

reserve()

\n+
\n+void reserve (int tokens);\n+
\n+

preallocate memory for the specified numbers of tokens. This is\n+useful if you know approximately how many tokens are in the file\n+you are about to parse. Doing so will save realloc operations\n+while parsing. You should only call this on the root node, before\n+passing it in to bdecode().

\n+[report issue]
\n+
\n+

switch_underlying_buffer()

\n+
\n+void switch_underlying_buffer (char const* buf) noexcept;\n+
\n+

this buffer MUST be identical to the one originally parsed. This\n+operation is only defined on owning root nodes, i.e. the one passed in to\n+decode().

\n+[report issue]
\n+
\n+

has_soft_error()

\n+
\n+bool has_soft_error (span<char> error) const;\n+
\n+

returns true if there is a non-fatal error in the bencoding of this node\n+or its children

\n+[report issue]
\n+
\n+

enum type_t

\n+

Declared in "libtorrent/bdecode.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+
namevaluedescription
none_t0uninitialized or default constructed. This is also used\n+to indicate that a node was not found in some cases.
dict_t1a dictionary node. The dict_find_ functions are valid.
list_t2a list node. The list_ functions are valid.
string_t3a string node, the string_ functions are valid.
int_t4an integer node. The int_ functions are valid.
\n+[report issue]
\n+
\n+
\n+

print_entry()

\n+

Declared in "libtorrent/bdecode.hpp"

\n+
\n+std::string print_entry (bdecode_node const& e\n+   , bool single_line = false, int indent = 0);\n+
\n+

print the bencoded structure in a human-readable format to a string\n+that's returned.

\n+[report issue]
\n+
\n+

bdecode()

\n+

Declared in "libtorrent/bdecode.hpp"

\n+
\n+bdecode_node bdecode (span<char const> buffer\n+   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n+   , int token_limit = 2000000);\n+int bdecode (char const* start, char const* end, bdecode_node& ret\n+   , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n+   , int token_limit = 2000000);\n+bdecode_node bdecode (span<char const> buffer\n+   , int depth_limit = 100, int token_limit = 2000000);\n+
\n+

This function decodes/parses bdecoded data (for example a .torrent file).\n+The data structure is returned in the ret argument. the buffer to parse\n+is specified by the start of the buffer as well as the end, i.e. one\n+byte past the end. If the buffer fails to parse, the function returns a\n+non-zero value and fills in ec with the error code. The optional\n+argument error_pos, if set to non-nullptr, will be set to the byte offset\n+into the buffer where the parse failure occurred.

\n+

depth_limit specifies the max number of nested lists or dictionaries are\n+allowed in the data structure. (This affects the stack usage of the\n+function, be careful not to set it too high).

\n+

token_limit is the max number of tokens allowed to be parsed from the\n+buffer. This is simply a sanity check to not have unbounded memory usage.

\n+

The resulting bdecode_node is an owning node. That means it will\n+be holding the whole parsed tree. When iterating lists and dictionaries,\n+those bdecode_node objects will simply have references to the root or\n+owning bdecode_node. If the root node is destructed, all other nodes\n+that refer to anything in that tree become invalid.

\n+

However, the underlying buffer passed in to this function (start, end)\n+must also remain valid while the bdecoded tree is used. The parsed tree\n+produced by this function does not copy any data out of the buffer, but\n+simply produces references back into it.

\n+[report issue]
\n+
\n+

storage_params

\n+

Declared in "libtorrent/storage_defs.hpp"

\n+

a parameter pack used to construct the storage for a torrent, used in\n+disk_interface

\n+
\n+struct storage_params\n+{\n+   storage_params (file_storage const& f, file_storage const* mf\n+      , std::string const& sp, storage_mode_t const sm\n+      , aux::vector<download_priority_t, file_index_t> const& prio\n+      , sha1_hash const& ih);\n+\n+   file_storage const& files;\n+   file_storage const* mapped_files  = nullptr;\n+   std::string const& path;\n+   storage_mode_t mode {storage_mode_sparse};\n+   aux::vector<download_priority_t, file_index_t> const& priorities;\n+   sha1_hash info_hash;\n+};\n+
\n+[report issue]
\n+
\n+

file_slice

\n+

Declared in "libtorrent/file_storage.hpp"

\n+

represents a window of a file in a torrent.

\n+

The file_index refers to the index of the file (in the torrent_info).\n+To get the path and filename, use file_path() and give the file_index\n+as argument. The offset is the byte offset in the file where the range\n+starts, and size is the number of bytes this range is. The size + offset\n+will never be greater than the file size.

\n
\n-struct add_torrent_params\n+struct file_slice\n {\n-   int version  = LIBTORRENT_VERSION_NUM;\n-   std::shared_ptr<torrent_info> ti;\n-   aux::noexcept_movable<std::vector<std::string>> trackers;\n-   aux::noexcept_movable<std::vector<int>> tracker_tiers;\n-   aux::noexcept_movable<std::vector<std::pair<std::string, int>>> dht_nodes;\n-   std::string name;\n-   std::string save_path;\n-   storage_mode_t storage_mode  = storage_mode_sparse;\n-   client_data_t userdata;\n-   aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;\n-   std::string trackerid;\n-   torrent_flags_t flags  = torrent_flags::default_flags;\n-   info_hash_t info_hashes;\n-   int max_uploads  = -1;\n-   int max_connections  = -1;\n-   int upload_limit  = -1;\n-   int download_limit  = -1;\n-   std::int64_t total_uploaded  = 0;\n-   std::int64_t total_downloaded  = 0;\n-   int active_time  = 0;\n-   int finished_time  = 0;\n-   int seeding_time  = 0;\n-   std::time_t added_time  = 0;\n-   std::time_t completed_time  = 0;\n-   std::time_t last_seen_complete  = 0;\n-   int num_complete  = -1;\n-   int num_incomplete  = -1;\n-   int num_downloaded  = -1;\n-   aux::noexcept_movable<std::vector<std::string>> http_seeds;\n-   aux::noexcept_movable<std::vector<std::string>> url_seeds;\n-   aux::noexcept_movable<std::vector<tcp::endpoint>> peers;\n-   aux::noexcept_movable<std::vector<tcp::endpoint>> banned_peers;\n-   aux::noexcept_movable<std::map<piece_index_t, bitfield>> unfinished_pieces;\n-   typed_bitfield<piece_index_t> have_pieces;\n-   typed_bitfield<piece_index_t> verified_pieces;\n-   aux::noexcept_movable<std::vector<download_priority_t>> piece_priorities;\n-   aux::vector<std::vector<sha256_hash>, file_index_t> merkle_trees;\n-   aux::vector<std::vector<bool>, file_index_t> merkle_tree_mask;\n-   aux::vector<std::vector<bool>, file_index_t> verified_leaf_hashes;\n-   aux::noexcept_movable<std::map<file_index_t, std::string>> renamed_files;\n-   std::time_t last_download  = 0;\n-   std::time_t last_upload  = 0;\n+   file_index_t file_index;\n+   std::int64_t offset;\n+   std::int64_t size;\n };\n 
\n-[report issue]
\n-
version
\n-
filled in by the constructor and should be left untouched. It is used\n-for forward binary compatibility.
\n-
\n-[report issue]
\n-
ti
\n-
torrent_info object with the torrent to add. Unless the\n-info_hash is set, this is required to be initialized.
\n-
\n-[report issue]
\n-
trackers
\n-
If the torrent doesn't have a tracker, but relies on the DHT to find\n-peers, the trackers can specify tracker URLs for the torrent.
\n-
\n-[report issue]
\n-
tracker_tiers
\n-
the tiers the URLs in trackers belong to. Trackers belonging to\n-different tiers may be treated differently, as defined by the multi\n-tracker extension. This is optional, if not specified trackers are\n-assumed to be part of tier 0, or whichever the last tier was as\n-iterating over the trackers.
\n-
\n-[report issue]
\n-
dht_nodes
\n-
a list of hostname and port pairs, representing DHT nodes to be added\n-to the session (if DHT is enabled). The hostname may be an IP address.
\n-
\n-[report issue]
\n-
name
\n-
in case there's no other name in this torrent, this name will be used.\n-The name out of the torrent_info object takes precedence if available.
\n-
\n-[report issue]
\n-
save_path
\n-

the path where the torrent is or will be stored.

\n-
\n-

Note

\n-

On windows this path (and other paths) are interpreted as UNC\n-paths. This means they must use backslashes as directory separators\n-and may not contain the special directories "." or "..".

\n-
\n-

Setting this to an absolute path performs slightly better than a\n-relative path.

\n-
\n-
\n-[report issue]
\n-
storage_mode
\n-
One of the values from storage_mode_t. For more information, see\n-storage allocation.
\n-
\n-[report issue]
\n-
userdata
\n-
The userdata parameter is optional and will be passed on to the\n-extension constructor functions, if any\n-(see torrent_handle::add_extension()). It will also be stored in the\n-torrent object and can be retrieved by calling userdata().
\n-
\n-[report issue]
\n-
file_priorities
\n-
can be set to control the initial file priorities when adding a\n-torrent. The semantics are the same as for\n-torrent_handle::prioritize_files(). The file priorities specified\n-in here take precedence over those specified in the resume data, if\n-any.\n-If this vector of file priorities is shorter than the number of files\n-in the torrent, the remaining files (not covered by this) will still\n-have the default download priority. This default can be changed by\n-setting the default_dont_download torrent_flag.
\n-
\n-[report issue]
\n-
trackerid
\n-
the default tracker id to be used when announcing to trackers. By\n-default this is empty, and no tracker ID is used, since this is an\n-optional argument. If a tracker returns a tracker ID, that ID is used\n-instead of this.
\n-
\n-[report issue]
\n-
flags
\n-

flags controlling aspects of this torrent and how it's added. See\n-torrent_flags_t for details.

\n-
\n-

Note

\n-

The flags field is initialized with default flags by the\n-constructor. In order to preserve default behavior when clearing or\n-setting other flags, make sure to bitwise OR or in a flag or bitwise\n-AND the inverse of a flag to clear it.

\n-
\n-
\n-
\n-[report issue]
\n-
info_hashes
\n-
set this to the info hash of the torrent to add in case the info-hash\n-is the only known property of the torrent. i.e. you don't have a\n-.torrent file nor a magnet link.\n-To add a magnet link, use parse_magnet_uri() to populate fields in the\n-add_torrent_params object.
\n-
\n-\n-[report issue]
\n-
max_uploads max_connections
\n-

max_uploads, max_connections, upload_limit,\n-download_limit correspond to the set_max_uploads(),\n-set_max_connections(), set_upload_limit() and\n-set_download_limit() functions on torrent_handle. These values let\n-you initialize these settings when the torrent is added, instead of\n-calling these functions immediately following adding it.

\n-

-1 means unlimited on these settings just like their counterpart\n-functions on torrent_handle

\n-

For fine grained control over rate limits, including making them apply\n-to local peers, see peer classes.

\n-
\n-
\n-\n-[report issue]
\n-
upload_limit download_limit
\n-
the upload and download rate limits for this torrent, specified in\n-bytes per second. -1 means unlimited.
\n-
\n-\n-[report issue]
\n-
total_uploaded total_downloaded
\n-
the total number of bytes uploaded and downloaded by this torrent so\n-far.
\n-
\n-\n-\n-[report issue]
\n-
active_time finished_time seeding_time
\n-
the number of seconds this torrent has spent in started, finished and\n-seeding state so far, respectively.
\n-
\n-\n-[report issue]
\n-
added_time completed_time
\n-
if set to a non-zero value, this is the posix time of when this torrent\n-was first added, including previous runs/sessions. If set to zero, the\n-internal added_time will be set to the time of when add_torrent() is\n-called.
\n-
\n-[report issue]
\n-
last_seen_complete
\n-
if set to non-zero, initializes the time (expressed in posix time) when\n-we last saw a seed or peers that together formed a complete copy of the\n-torrent. If left set to zero, the internal counterpart to this field\n-will be updated when we see a seed or a distributed copies >= 1.0.
\n-
\n-\n-\n-[report issue]
\n-
num_complete num_incomplete num_downloaded
\n-

these field can be used to initialize the torrent's cached scrape data.\n-The scrape data is high level metadata about the current state of the\n-swarm, as returned by the tracker (either when announcing to it or by\n-sending a specific scrape request). num_complete is the number of\n-peers in the swarm that are seeds, or have every piece in the torrent.\n-num_incomplete is the number of peers in the swarm that do not have\n-every piece. num_downloaded is the number of times the torrent has\n-been downloaded (not initiated, but the number of times a download has\n-completed).

\n-

Leaving any of these values set to -1 indicates we don't know, or we\n-have not received any scrape data.

\n-
\n-
\n-\n-[report issue]
\n-
http_seeds url_seeds
\n-

URLs can be added to these two lists to specify additional web\n-seeds to be used by the torrent. If the flag_override_web_seeds\n-is set, these will be the _only_ ones to be used. i.e. any web seeds\n-found in the .torrent file will be overridden.

\n-

http_seeds expects URLs to web servers implementing the original HTTP\n-seed specification BEP 17.

\n-

url_seeds expects URLs to regular web servers, aka "get right" style,\n-specified in BEP 19.

\n-
\n-
\n-[report issue]
\n-
peers
\n-
peers to add to the torrent, to be tried to be connected to as\n-bittorrent peers.
\n-
\n-[report issue]
\n-
banned_peers
\n-
peers banned from this torrent. The will not be connected to
\n-
\n-[report issue]
\n-
unfinished_pieces
\n-
this is a map of partially downloaded piece. The key is the piece index\n-and the value is a bitfield where each bit represents a 16 kiB block.\n-A set bit means we have that block.
\n-
\n-[report issue]
\n-
have_pieces
\n-
this is a bitfield indicating which pieces we already have of this\n-torrent.
\n-
\n-[report issue]
\n-
verified_pieces
\n-
when in seed_mode, pieces with a set bit in this bitfield have been\n-verified to be valid. Other pieces will be verified the first time a\n-peer requests it.
\n-
\n-[report issue]
\n-
piece_priorities
\n-
this sets the priorities for each individual piece in the torrent. Each\n-element in the vector represent the piece with the same index. If you\n-set both file- and piece priorities, file priorities will take\n-precedence.
\n-
\n-[report issue]
\n-
merkle_trees
\n-
v2 hashes, if known
\n-
\n-[report issue]
\n-
merkle_tree_mask
\n-
if set, indicates which hashes are included in the corresponding\n-vector of merkle_trees. These bitmasks always cover the full\n-tree, a cleared bit means the hash is all zeros (i.e. not set) and\n-set bit means the next hash in the corresponding vector in\n-merkle_trees is the hash for that node. This is an optimization\n-to avoid storing a lot of zeros.
\n-
\n-[report issue]
\n-
verified_leaf_hashes
\n-
bit-fields indicating which v2 leaf hashes have been verified\n-against the root hash. If this vector is empty and merkle_trees is\n-non-empty it implies that all hashes in merkle_trees are verified.
\n+[report issue]
\n+
file_index
\n+
the index of the file
\n
\n-[report issue]
\n-
renamed_files
\n-
this is a map of file indices in the torrent and new filenames to be\n-applied before the torrent is added.
\n+[report issue]
\n+
offset
\n+
the offset from the start of the file, in bytes
\n
\n-\n-[report issue]
\n-
last_download last_upload
\n-
the posix time of the last time payload was received or sent for this\n-torrent, respectively.
\n+[report issue]
\n+
size
\n+
the size of the window, in bytes
\n
\n-[report issue]
\n-
\n-

hasher

\n-

Declared in "libtorrent/hasher.hpp"

\n-

this is a SHA-1 hash class.

\n-

You use it by first instantiating it, then call update() to feed it\n-with data. i.e. you don't have to keep the entire buffer of which you want to\n-create the hash in memory. You can feed the hasher parts of it at a time. When\n-You have fed the hasher with all the data, you call final() and it\n-will return the sha1-hash of the data.

\n-

The constructor that takes a char const* and an integer will construct the\n-sha1 context and feed it the data passed in.

\n-

If you want to reuse the hasher object once you have created a hash, you have to\n-call reset() to reinitialize it.

\n-

The built-in software version of sha1-algorithm was implemented\n-by Steve Reid and released as public domain.\n-For more info, see src/sha1.cpp.

\n+[report issue]
\n+
\n+

file_storage

\n+

Declared in "libtorrent/file_storage.hpp"

\n+

The file_storage class represents a file list and the piece\n+size. Everything necessary to interpret a regular bittorrent storage\n+file structure.

\n
\n-class hasher\n+class file_storage\n {\n-   hasher ();\n-   hasher& operator= (hasher const&) &;\n-   hasher (hasher const&);\n-   explicit hasher (span<char const> data);\n-   hasher (char const* data, int len);\n-   hasher& update (span<char const> data);\n-   hasher& update (char const* data, int len);\n-   sha1_hash final ();\n-   void reset ();\n+   bool is_valid () const;\n+   void reserve (int num_files);\n+   void add_file_borrow (string_view filename\n+      , std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}, char const* filehash = nullptr\n+      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+   void add_file (std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}\n+      , std::time_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+   void add_file (error_code& ec, std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}\n+      , std::time_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+   void add_file_borrow (error_code& ec, string_view filename\n+      , std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}, char const* filehash = nullptr\n+      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+   void rename_file (file_index_t index, std::string const& new_filename);\n+   std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset\n+      , std::int64_t size) const;\n+   peer_request map_file (file_index_t file, std::int64_t offset, int size) const;\n+   int num_files () const noexcept;\n+   file_index_t end_file () const noexcept;\n+   index_range<file_index_t> file_range () const noexcept;\n+   std::int64_t total_size () const;\n+   int num_pieces () const;\n+   void set_num_pieces (int n);\n+   piece_index_t end_piece () const;\n+   piece_index_t last_piece () const;\n+   index_range<piece_index_t> piece_range () const noexcept;\n+   int piece_length () const;\n+   void set_piece_length (int l);\n+   int piece_size (piece_index_t index) const;\n+   int piece_size2 (piece_index_t index) const;\n+   int blocks_in_piece2 (piece_index_t index) const;\n+   void set_name (std::string const& n);\n+   std::string const& name () const;\n+   void swap (file_storage& ti) noexcept;\n+   void canonicalize ();\n+   std::string symlink (file_index_t index) const;\n+   std::int64_t file_size (file_index_t index) const;\n+   sha256_hash root (file_index_t index) const;\n+   std::int64_t file_offset (file_index_t index) const;\n+   sha1_hash hash (file_index_t index) const;\n+   char const* root_ptr (file_index_t const index) const;\n+   std::time_t mtime (file_index_t index) const;\n+   std::string file_path (file_index_t index, std::string const& save_path = "") const;\n+   bool pad_file_at (file_index_t index) const;\n+   string_view file_name (file_index_t index) const;\n+   index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;\n+   int file_num_pieces (file_index_t index) const;\n+   int file_num_blocks (file_index_t index) const;\n+   int file_first_block_node (file_index_t index) const;\n+   int file_first_piece_node (file_index_t index) const;\n+   std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;\n+   void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;\n+   file_flags_t file_flags (file_index_t index) const;\n+   bool file_absolute_path (file_index_t index) const;\n+   file_index_t file_index_at_offset (std::int64_t offset) const;\n+   file_index_t file_index_at_piece (piece_index_t piece) const;\n+   file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n+   piece_index_t piece_index_at_file (file_index_t f) const;\n+   void sanitize_symlinks ();\n+   bool v2 () const;\n+\n+   static constexpr file_flags_t flag_pad_file  = 0_bit;\n+   static constexpr file_flags_t flag_hidden  = 1_bit;\n+   static constexpr file_flags_t flag_executable  = 2_bit;\n+   static constexpr file_flags_t flag_symlink  = 3_bit;\n };\n 
\n-\n-[report issue]
\n-

hasher() operator=()

\n-
\n-hasher& operator= (hasher const&) &;\n-hasher (hasher const&);\n-explicit hasher (span<char const> data);\n-hasher (char const* data, int len);\n-
\n-

this is the same as default constructing followed by a call to\n-update(data, len).

\n-[report issue]
\n-
\n-

update()

\n+[report issue]
\n+

is_valid()

\n
\n-hasher& update (span<char const> data);\n-hasher& update (char const* data, int len);\n+bool is_valid () const;\n 
\n-

append the following bytes to what is being hashed

\n-[report issue]
\n-
\n-

final()

\n+

returns true if the piece length has been initialized\n+on the file_storage. This is typically taken as a proxy\n+of whether the file_storage as a whole is initialized or\n+not.

\n+[report issue]
\n+
\n+

reserve()

\n
\n-sha1_hash final ();\n+void reserve (int num_files);\n 
\n-

returns the SHA-1 digest of the buffers previously passed to\n-update() and the hasher constructor.

\n-[report issue]
\n-
\n-

reset()

\n+

allocates space for num_files in the internal file list. This can\n+be used to avoid reallocating the internal file list when the number\n+of files to be added is known up-front.

\n+\n+[report issue]
\n+
\n+

add_file() add_file_borrow()

\n
\n-void reset ();\n+void add_file_borrow (string_view filename\n+      , std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}, char const* filehash = nullptr\n+      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+void add_file (std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}\n+      , std::time_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+void add_file (error_code& ec, std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}\n+      , std::time_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n+void add_file_borrow (error_code& ec, string_view filename\n+      , std::string const& path, std::int64_t file_size\n+      , file_flags_t file_flags = {}, char const* filehash = nullptr\n+      , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+      , char const* root_hash = nullptr);\n 
\n-

restore the hasher state to be as if the hasher has just been\n-default constructed.

\n-[report issue]
\n-
\n-
\n-

hasher256

\n-

Declared in "libtorrent/hasher.hpp"

\n+

Adds a file to the file storage. The add_file_borrow version\n+expects that filename is the file name (without a path) of\n+the file that's being added.\n+This memory is borrowed, i.e. it is the caller's\n+responsibility to make sure it stays valid throughout the lifetime\n+of this file_storage object or any copy of it. The same thing applies\n+to filehash, which is an optional pointer to a 20 byte binary\n+SHA-1 hash of the file.

\n+

if filename is empty, the filename from path is used and not\n+borrowed.

\n+

The path argument is the full path (in the torrent file) to\n+the file to add. Note that this is not supposed to be an absolute\n+path, but it is expected to include the name of the torrent as the\n+first path element.

\n+

file_size is the size of the file in bytes.

\n+

The file_flags argument sets attributes on the file. The file\n+attributes is an extension and may not work in all bittorrent clients.

\n+

For possible file attributes, see file_storage::flags_t.

\n+

The mtime argument is optional and can be set to 0. If non-zero,\n+it is the posix time of the last modification time of this file.

\n+

symlink_path is the path the file is a symlink to. To make this a\n+symlink you also need to set the file_storage::flag_symlink file flag.

\n+

root_hash is an optional pointer to a 32 byte SHA-256 hash, being\n+the merkle tree root hash for this file. This is only used for v2\n+torrents. If the root hash is specified for one file, it has to\n+be specified for all, otherwise this function will fail.\n+Note that the buffer root_hash points to must out-live the\n+file_storage object, it will not be copied. This parameter is only\n+used when loading torrents, that already have their file hashes\n+computed. When creating torrents, the file hashes will be computed by\n+the piece hashes.

\n+

If more files than one are added, certain restrictions to their paths\n+apply. In a multi-file file storage (torrent), all files must share\n+the same root directory.

\n+

That is, the first path element of all files must be the same.\n+This shared path element is also set to the name of the torrent. It\n+can be changed by calling set_name.

\n+

The overloads that take an error_code reference will report failures\n+via that variable, otherwise system_error is thrown.

\n+[report issue]
\n+
\n+

rename_file()

\n
\n-class hasher256\n-{\n-   hasher256 ();\n-   hasher256 (hasher256 const&);\n-   hasher256& operator= (hasher256 const&) &;\n-   explicit hasher256 (span<char const> data);\n-   hasher256 (char const* data, int len);\n-   hasher256& update (span<char const> data);\n-   hasher256& update (char const* data, int len);\n-   sha256_hash final ();\n-   void reset ();\n-   ~hasher256 ();\n-};\n+void rename_file (file_index_t index, std::string const& new_filename);\n 
\n-\n-[report issue]
\n-

hasher256() operator=()

\n+

renames the file at index to new_filename. Keep in mind\n+that filenames are expected to be UTF-8 encoded.

\n+[report issue]
\n+
\n+

map_block()

\n
\n-hasher256 (hasher256 const&);\n-hasher256& operator= (hasher256 const&) &;\n-explicit hasher256 (span<char const> data);\n-hasher256 (char const* data, int len);\n+std::vector<file_slice> map_block (piece_index_t piece, std::int64_t offset\n+      , std::int64_t size) const;\n 
\n-

this is the same as default constructing followed by a call to\n-update(data, len).

\n-[report issue]
\n-
\n-

update()

\n+

returns a list of file_slice objects representing the portions of\n+files the specified piece index, byte offset and size range overlaps.\n+this is the inverse mapping of map_file().

\n+

Preconditions of this function is that the input range is within the\n+torrents address space. piece may not be negative and

\n+
\n+piece * piece_size + offset + size
\n+

may not exceed the total size of the torrent.

\n+[report issue]
\n+
\n+

map_file()

\n
\n-hasher256& update (span<char const> data);\n-hasher256& update (char const* data, int len);\n+peer_request map_file (file_index_t file, std::int64_t offset, int size) const;\n 
\n-

append the following bytes to what is being hashed

\n-[report issue]
\n-
\n-

final()

\n+

returns a peer_request representing the piece index, byte offset\n+and size the specified file range overlaps. This is the inverse\n+mapping over map_block(). Note that the peer_request return type\n+is meant to hold bittorrent block requests, which may not be larger\n+than 16 kiB. Mapping a range larger than that may return an overflown\n+integer.

\n+[report issue]
\n+
\n+

num_files()

\n
\n-sha256_hash final ();\n+int num_files () const noexcept;\n 
\n-

returns the SHA-1 digest of the buffers previously passed to\n-update() and the hasher constructor.

\n-[report issue]
\n-
\n-

reset()

\n+

returns the number of files in the file_storage

\n+[report issue]
\n+
\n+

end_file()

\n
\n-void reset ();\n+file_index_t end_file () const noexcept;\n 
\n-

restore the hasher state to be as if the hasher has just been\n-default constructed.

\n-[report issue]
\n-
\n-
\n-

bitfield

\n-

Declared in "libtorrent/bitfield.hpp"

\n-

The bitfield type stores any number of bits as a bitfield\n-in a heap allocated array.

\n+

returns the index of the one-past-end file in the file storage

\n+[report issue]
\n+
\n+

file_range()

\n
\n-struct bitfield\n-{\n-   bitfield (int bits, bool val);\n-   bitfield (bitfield const& rhs);\n-   bitfield (bitfield&& rhs) noexcept = default;\n-   bitfield (char const* b, int bits);\n-   bitfield () noexcept = default;\n-   explicit bitfield (int bits);\n-   void assign (char const* b, int const bits);\n-   bool operator[] (int index) const noexcept;\n-   bool get_bit (int index) const noexcept;\n-   void clear_bit (int index) noexcept;\n-   void set_bit (int index) noexcept;\n-   bool all_set () const noexcept;\n-   bool none_set () const noexcept;\n-   int size () const noexcept;\n-   int num_words () const noexcept;\n-   bool empty () const noexcept;\n-   char* data () noexcept;\n-   char const* data () const noexcept;\n-   void swap (bitfield& rhs) noexcept;\n-   int count () const noexcept;\n-   int find_first_set () const noexcept;\n-   int find_last_clear () const noexcept;\n-};\n+index_range<file_index_t> file_range () const noexcept;\n 
\n-[report issue]
\n-

bitfield()

\n+

returns an implementation-defined type that can be used as the\n+container in a range-for loop. Where the values are the indices of all\n+files in the file_storage.

\n+[report issue]
\n+
\n+

total_size()

\n
\n-bitfield (int bits, bool val);\n-bitfield (bitfield const& rhs);\n-bitfield (bitfield&& rhs) noexcept = default;\n-bitfield (char const* b, int bits);\n-bitfield () noexcept = default;\n-explicit bitfield (int bits);\n+std::int64_t total_size () const;\n 
\n-

constructs a new bitfield. The default constructor creates an empty\n-bitfield. bits is the size of the bitfield (specified in bits).\n-val is the value to initialize the bits to. If not specified\n-all bits are initialized to 0.

\n-

The constructor taking a pointer b and bits copies a bitfield\n-from the specified buffer, and bits number of bits (rounded up to\n-the nearest byte boundary).

\n-[report issue]
\n-
\n-

assign()

\n+

returns the total number of bytes all the files in this torrent spans

\n+\n+[report issue]
\n+
\n+

num_pieces() set_num_pieces()

\n
\n-void assign (char const* b, int const bits);\n+int num_pieces () const;\n+void set_num_pieces (int n);\n 
\n-

copy bitfield from buffer b of bits number of bits, rounded up to\n-the nearest byte boundary.

\n-\n-[report issue]
\n-
\n-

operator[]() get_bit()

\n+

set and get the number of pieces in the torrent

\n+[report issue]
\n+
\n+

end_piece()

\n
\n-bool operator[] (int index) const noexcept;\n-bool get_bit (int index) const noexcept;\n+piece_index_t end_piece () const;\n 
\n-

query bit at index. Returns true if bit is 1, otherwise false.

\n-\n-[report issue]
\n-
\n-

clear_bit() set_bit()

\n+

returns the index of the one-past-end piece in the file storage

\n+[report issue]
\n+
\n+

last_piece()

\n
\n-void clear_bit (int index) noexcept;\n-void set_bit (int index) noexcept;\n+piece_index_t last_piece () const;\n 
\n-

set bit at index to 0 (clear_bit) or 1 (set_bit).

\n-[report issue]
\n-
\n-

all_set()

\n+

returns the index of the last piece in the torrent. The last piece is\n+special in that it may be smaller than the other pieces (and the other\n+pieces are all the same size).

\n+[report issue]
\n+
\n+

piece_range()

\n
\n-bool all_set () const noexcept;\n+index_range<piece_index_t> piece_range () const noexcept;\n 
\n-

returns true if all bits in the bitfield are set

\n-[report issue]
\n-
\n-

none_set()

\n+

returns an implementation-defined type that can be used as the\n+container in a range-for loop. Where the values are the indices of all\n+pieces in the file_storage.

\n+\n+[report issue]
\n+
\n+

set_piece_length() piece_length()

\n
\n-bool none_set () const noexcept;\n+int piece_length () const;\n+void set_piece_length (int l);\n 
\n-

returns true if no bit in the bitfield is set

\n-[report issue]
\n-
\n-

size()

\n+

set and get the size of each piece in this torrent. It must be a power of two\n+and at least 16 kiB.

\n+[report issue]
\n+
\n+

piece_size()

\n
\n-int size () const noexcept;\n+int piece_size (piece_index_t index) const;\n 
\n-

returns the size of the bitfield in bits.

\n-[report issue]
\n-
\n-

num_words()

\n+

returns the piece size of index. This will be the same as piece_length(), except\n+for the last piece, which may be shorter.

\n+[report issue]
\n+
\n+

piece_size2()

\n
\n-int num_words () const noexcept;\n+int piece_size2 (piece_index_t index) const;\n 
\n-

returns the number of 32 bit words are needed to represent all bits in\n-this bitfield.

\n-[report issue]
\n-
\n-

empty()

\n+

Returns the size of the given piece. If the piece spans multiple files,\n+only the first file is considered part of the piece. This is used for\n+v2 torrents, where all files are piece aligned and padded. i.e. The pad\n+files are not considered part of the piece for this purpose.

\n+[report issue]
\n+
\n+

blocks_in_piece2()

\n
\n-bool empty () const noexcept;\n+int blocks_in_piece2 (piece_index_t index) const;\n 
\n-

returns true if the bitfield has zero size.

\n-[report issue]
\n-
\n-

data()

\n+

returns the number of blocks in the specified piece, for v2 torrents.

\n+\n+[report issue]
\n+
\n+

set_name() name()

\n
\n-char* data () noexcept;\n-char const* data () const noexcept;\n+void set_name (std::string const& n);\n+std::string const& name () const;\n 
\n-

returns a pointer to the internal buffer of the bitfield, or\n-nullptr if it's empty.

\n-[report issue]
\n+

set and get the name of this torrent. For multi-file torrents, this is also\n+the name of the root directory all the files are stored in.

\n+[report issue]
\n
\n

swap()

\n
\n-void swap (bitfield& rhs) noexcept;\n+void swap (file_storage& ti) noexcept;\n 
\n-

swaps the bit-fields two variables refer to

\n-[report issue]
\n-
\n-

count()

\n+

swap all content of this with ti.

\n+[report issue]
\n+
\n+

canonicalize()

\n
\n-int count () const noexcept;\n+void canonicalize ();\n 
\n-

count the number of bits in the bitfield that are set to 1.

\n-[report issue]
\n-
\n-

find_first_set()

\n+

arrange files and padding to match the canonical form required\n+by BEP 52

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+[report issue]
\n+\n-
\n-

find_last_clear()

\n+

These functions are used to query attributes of files at\n+a given index.

\n+

The hash() is a SHA-1 hash of the file, or 0 if none was\n+provided in the torrent file. This can potentially be used to\n+join a bittorrent network with other file sharing networks.

\n+

root() returns the SHA-256 merkle tree root of the specified file,\n+in case this is a v2 torrent. Otherwise returns zeros.\n+root_ptr() returns a pointer to the SHA-256 merkle tree root hash\n+for the specified file. The pointer points into storage referred to\n+when the file was added, it is not owned by this object. Torrents\n+that are not v2 torrents return nullptr.

\n+

The mtime() is the modification time is the posix\n+time when a file was last modified when the torrent\n+was created, or 0 if it was not included in the torrent file.

\n+

file_path() returns the full path to a file.

\n+

file_size() returns the size of a file.

\n+

pad_file_at() returns true if the file at the given\n+index is a pad-file.

\n+

file_name() returns just the name of the file, whereas\n+file_path() returns the path (inside the torrent file) with\n+the filename appended.

\n+

file_offset() returns the byte offset within the torrent file\n+where this file starts. It can be used to map the file to a piece\n+index (given the piece size).

\n+\n+\n+[report issue]
\n+
\n+

file_num_pieces() file_piece_range() file_num_blocks()

\n
\n-int find_last_clear () const noexcept;\n+index_range<piece_index_t::diff_type> file_piece_range (file_index_t) const;\n+int file_num_pieces (file_index_t index) const;\n+int file_num_blocks (file_index_t index) const;\n 
\n-

returns the index to the last cleared bit in the bitfield, i.e. 0 bit.

\n-[report issue]
\n+

Returns the number of pieces or blocks the file at index spans,\n+under the assumption that the file is aligned to the start of a piece.\n+This is only meaningful for v2 torrents, where files are guaranteed\n+such alignment.\n+These numbers are used to size and navigate the merkle hash tree for\n+each file.

\n+\n+[report issue]
\n+
\n+

file_first_piece_node() file_first_block_node()

\n+
\n+int file_first_block_node (file_index_t index) const;\n+int file_first_piece_node (file_index_t index) const;\n+
\n+

index of first piece node in the merkle tree

\n+[report issue]
\n+
\n+

file_path_hash()

\n+
\n+std::uint32_t file_path_hash (file_index_t index, std::string const& save_path) const;\n+
\n+

returns the crc32 hash of file_path(index)

\n+[report issue]
\n+
\n+

all_path_hashes()

\n+
\n+void all_path_hashes (std::unordered_set<std::uint32_t>& table) const;\n+
\n+

this will add the CRC32 hash of all directory entries to the table. No\n+filename will be included, just directories. Every depth of directories\n+are added separately to allow test for collisions with files at all\n+levels. i.e. if one path in the torrent is foo/bar/baz, the CRC32\n+hashes for foo, foo/bar and foo/bar/baz will be added to\n+the set.

\n+[report issue]
\n+
\n+

file_flags()

\n+
\n+file_flags_t file_flags (file_index_t index) const;\n+
\n+

returns a bitmask of flags from file_flags_t that apply\n+to file at index.

\n+[report issue]
\n+
\n+

file_absolute_path()

\n+
\n+bool file_absolute_path (file_index_t index) const;\n+
\n+

returns true if the file at the specified index has been renamed to\n+have an absolute path, i.e. is not anchored in the save path of the\n+torrent.

\n+\n+[report issue]
\n+
\n+

file_index_at_offset() file_index_at_piece()

\n+
\n+file_index_t file_index_at_offset (std::int64_t offset) const;\n+file_index_t file_index_at_piece (piece_index_t piece) const;\n+
\n+

returns the index of the file at the given offset in the torrent

\n+[report issue]
\n+
\n+

file_index_for_root()

\n+
\n+file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n+
\n+

finds the file with the given root hash and returns its index\n+if there is no file with the root hash, file_index_t{-1} is returned

\n+[report issue]
\n+
\n+

piece_index_at_file()

\n+
\n+piece_index_t piece_index_at_file (file_index_t f) const;\n+
\n+

returns the piece index the given file starts at

\n+[report issue]
\n+
\n+

sanitize_symlinks()

\n+
\n+void sanitize_symlinks ();\n+
\n+

validate any symlinks, to ensure they all point to\n+other files or directories inside this storage. Any invalid symlinks\n+are updated to point to themselves.

\n+[report issue]
\n+
\n+

v2()

\n+
\n+bool v2 () const;\n+
\n+

returns true if this torrent contains v2 metadata.

\n+[report issue]
\n+
flag_pad_file
\n+
the file is a pad file. It's required to contain zeros\n+at it will not be saved to disk. Its purpose is to make\n+the following file start on a piece boundary.
\n+
\n+[report issue]
\n+
flag_hidden
\n+
this file has the hidden attribute set. This is primarily\n+a windows attribute
\n+
\n+[report issue]
\n+
flag_executable
\n+
this file has the executable attribute set.
\n+
\n+[report issue]
\n+
flag_symlink
\n+
this file is a symbolic link. It should have a link\n+target string associated with it.
\n+
\n+[report issue]
\n
\n-
\n-

torrent_status

\n-

Declared in "libtorrent/torrent_status.hpp"

\n-

holds a snapshot of the status of a torrent, as queried by\n-torrent_handle::status().

\n+
\n+

default_disk_io_constructor()

\n+

Declared in "libtorrent/session.hpp"

\n
\n-struct torrent_status\n-{\n-   bool operator== (torrent_status const& st) const;\n-\n-   enum state_t\n-   {\n-      checking_files,\n-      downloading_metadata,\n-      downloading,\n-      finished,\n-      seeding,\n-      unused_enum_for_backwards_compatibility_allocating,\n-      checking_resume_data,\n-   };\n-\n-   torrent_handle handle;\n-   error_code errc;\n-   file_index_t error_file  = torrent_status::error_file_none;\n-   static constexpr file_index_t error_file_none {-1};\n-   static constexpr file_index_t error_file_ssl_ctx {-3};\n-   static constexpr file_index_t error_file_metadata {-4};\n-   static constexpr file_index_t error_file_exception {-5};\n-   static constexpr file_index_t error_file_partfile {-6};\n-   std::string save_path;\n-   std::string name;\n-   std::weak_ptr<const torrent_info> torrent_file;\n-   time_duration next_announce  = seconds{0};\n-   std::string current_tracker;\n-   std::int64_t total_download  = 0;\n-   std::int64_t total_upload  = 0;\n-   std::int64_t total_payload_download  = 0;\n-   std::int64_t total_payload_upload  = 0;\n-   std::int64_t total_failed_bytes  = 0;\n-   std::int64_t total_redundant_bytes  = 0;\n-   typed_bitfield<piece_index_t> pieces;\n-   typed_bitfield<piece_index_t> verified_pieces;\n-   std::int64_t total_done  = 0;\n-   std::int64_t total  = 0;\n-   std::int64_t total_wanted_done  = 0;\n-   std::int64_t total_wanted  = 0;\n-   std::int64_t all_time_upload  = 0;\n-   std::int64_t all_time_download  = 0;\n-   std::time_t added_time  = 0;\n-   std::time_t completed_time  = 0;\n-   std::time_t last_seen_complete  = 0;\n-   storage_mode_t storage_mode  = storage_mode_sparse;\n-   float progress  = 0.f;\n-   int progress_ppm  = 0;\n-   queue_position_t queue_position {};\n-   int download_rate  = 0;\n-   int upload_rate  = 0;\n-   int download_payload_rate  = 0;\n-   int upload_payload_rate  = 0;\n-   int num_seeds  = 0;\n-   int num_peers  = 0;\n-   int num_complete  = -1;\n-   int num_incomplete  = -1;\n-   int list_seeds  = 0;\n-   int list_peers  = 0;\n-   int connect_candidates  = 0;\n-   int num_pieces  = 0;\n-   int distributed_full_copies  = 0;\n-   int distributed_fraction  = 0;\n-   float distributed_copies  = 0.f;\n-   int block_size  = 0;\n-   int num_uploads  = 0;\n-   int num_connections  = 0;\n-   int uploads_limit  = 0;\n-   int connections_limit  = 0;\n-   int up_bandwidth_queue  = 0;\n-   int down_bandwidth_queue  = 0;\n-   int seed_rank  = 0;\n-   state_t state  = checking_resume_data;\n-   bool need_save_resume  = false;\n-   bool is_seeding  = false;\n-   bool is_finished  = false;\n-   bool has_metadata  = false;\n-   bool has_incoming  = false;\n-   bool moving_storage  = false;\n-   bool announcing_to_trackers  = false;\n-   bool announcing_to_lsd  = false;\n-   bool announcing_to_dht  = false;\n-   info_hash_t info_hashes;\n-   time_point last_upload;\n-   time_point last_download;\n-   seconds active_duration;\n-   seconds finished_duration;\n-   seconds seeding_duration;\n-   torrent_flags_t flags {};\n-};\n+std::unique_ptr<disk_interface> default_disk_io_constructor (\n+   io_context& ios, settings_interface const&, counters& cnt);\n 
\n-[report issue]
\n-

operator==()

\n+

the constructor function for the default storage. On systems that support\n+memory mapped files (and a 64 bit address space) the memory mapped storage\n+will be constructed, otherwise the portable posix storage.

\n+[report issue]
\n+
\n+

posix_disk_io_constructor()

\n+

Declared in "libtorrent/posix_disk_io.hpp"

\n
\n-bool operator== (torrent_status const& st) const;\n+std::unique_ptr<disk_interface> posix_disk_io_constructor (\n+   io_context& ios, settings_interface const&, counters& cnt);\n 
\n-

compares if the torrent status objects come from the same torrent. i.e.\n-only the torrent_handle field is compared.

\n-[report issue]
\n-
\n-

enum state_t

\n-

Declared in "libtorrent/torrent_status.hpp"

\n+

this is a simple posix disk I/O back-end, used for systems that don't\n+have a 64 bit virtual address space or don't support memory mapped files.\n+It's implemented using portable C file functions and is single-threaded.

\n+[report issue]
\n+
\n+

mmap_disk_io_constructor()

\n+

Declared in "libtorrent/mmap_disk_io.hpp"

\n+
\n+std::unique_ptr<disk_interface> mmap_disk_io_constructor (\n+   io_context& ios, settings_interface const&, counters& cnt);\n+
\n+

constructs a memory mapped file disk I/O object.

\n+[report issue]
\n+
\n+

disabled_disk_io_constructor()

\n+

Declared in "libtorrent/disabled_disk_io.hpp"

\n+
\n+std::unique_ptr<disk_interface> disabled_disk_io_constructor (\n+   io_context& ios, settings_interface const&, counters& cnt);\n+
\n+

creates a disk io object that discards all data written to it, and only\n+returns zero-buffers when read from. May be useful for testing and\n+benchmarking.

\n+[report issue]
\n+
\n+

enum storage_mode_t

\n+

Declared in "libtorrent/storage_defs.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n+\n+\n+\n+\n+\n \n-\n+\n \n-\n+\n+
namevaluedescription
checking_files
storage_mode_allocate0All pieces will be written to their final position, all files will be\n+allocated in full when the torrent is first started. This mode minimizes\n+fragmentation but could be a costly operation.
storage_mode_sparse1The torrent has not started its download yet, and is\n-currently checking existing files.All pieces will be written to the place where they belong and sparse files\n+will be used. This is the recommended, and default mode.
downloading_metadata
\n+[report issue]
\n+
\n+

enum status_t

\n+

Declared in "libtorrent/storage_defs.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n-\n+\n \n-\n+\n \n-\n+\n \n-\n-\n-\n+\n+\n+\n \n-\n-\n-\n+\n+
namevaluedescription
no_error0 
fatal_disk_error1 
need_full_check2The torrent is trying to download metadata from peers.\n-This implies the ut_metadata extension is in use. 
downloading
file_exist3The torrent is being downloaded. This is the state\n-most torrents will be in most of the time. The progress\n-meter will tell how much of the files that has been\n-downloaded. 
finished4In this state the torrent has finished downloading but\n-still doesn't have the entire torrent. i.e. some pieces\n-are filtered and won't get downloaded.
oversized_file16this is not an enum value, but a flag that can be set in the return\n+from async_check_files, in case an existing file was found larger than\n+specified in the torrent. i.e. it has garbage at the end\n+the status_t field is used for this to preserve ABI.
seeding5In this state the torrent has finished downloading and\n-is a pure seeder.
\n+[report issue]
\n+
\n+

enum move_flags_t

\n+

Declared in "libtorrent/storage_defs.hpp"

\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n \n-\n-\n-\n+\n+\n+\n+\n+\n \n-\n-\n-\n+\n+\n+\n+\n+\n+\n+\n \n \n
namevaluedescription
unused_enum_for_backwards_compatibility_allocating6If the torrent was started in full allocation mode, this\n-indicates that the (disk) storage for the torrent is\n-allocated.
always_replace_files0replace any files in the destination when copying\n+or moving the storage
checking_resume_data7The torrent is currently checking the fast resume data and\n-comparing it to the files on disk. This is typically\n-completed in a fraction of a second, but if you add a\n-large number of torrents at once, they will queue up.
fail_if_exist1if any files that we want to copy exist in the destination\n+exist, fail the whole operation and don't perform\n+any copy or move. There is an inherent race condition\n+in this mode. The files are checked for existence before\n+the operation starts. In between the check and performing\n+the copy, the destination files may be created, in which\n+case they are replaced.
dont_replace2if any file exist in the target, take those files instead\n+of the ones we may have in the source.
\n-[report issue]
\n-
handle
\n-
a handle to the torrent whose status the object represents.
\n-
\n-[report issue]
\n-
errc
\n-
may be set to an error code describing why the torrent was paused, in\n-case it was paused by an error. If the torrent is not paused or if it's\n-paused but not because of an error, this error_code is not set.\n-if the error is attributed specifically to a file, error_file is set to\n-the index of that file in the .torrent file.
\n-
\n-[report issue]
\n-
error_file
\n-
if the torrent is stopped because of an disk I/O error, this field\n-contains the index of the file in the torrent that encountered the\n-error. If the error did not originate in a file in the torrent, there\n-are a few special values this can be set to: error_file_none,\n-error_file_ssl_ctx, error_file_exception, error_file_partfile or\n-error_file_metadata;
\n-
\n-[report issue]
\n-
error_file_none
\n-
special values for error_file to describe which file or component\n-encountered the error (errc).\n-the error did not occur on a file
\n-
\n-[report issue]
\n-
error_file_ssl_ctx
\n-
the error occurred setting up the SSL context
\n-
\n-[report issue]
\n-
error_file_metadata
\n-
the error occurred while loading the metadata for the torrent
\n-
\n-[report issue]
\n-
error_file_exception
\n-
there was a serious error reported in this torrent. The error code\n-or a torrent log alert may provide more information.
\n-
\n-[report issue]
\n-
error_file_partfile
\n-
the error occurred with the partfile
\n-
\n-[report issue]
\n-
save_path
\n-
the path to the directory where this torrent's files are stored.\n-It's typically the path as was given to async_add_torrent() or\n-add_torrent() when this torrent was started. This field is only\n-included if the torrent status is queried with\n-torrent_handle::query_save_path.
\n-
\n-[report issue]
\n-
name
\n-
the name of the torrent. Typically this is derived from the\n-.torrent file. In case the torrent was started without metadata,\n-and hasn't completely received it yet, it returns the name given\n-to it when added to the session. See session::add_torrent.\n-This field is only included if the torrent status is queried\n-with torrent_handle::query_name.
\n-
\n-[report issue]
\n-
torrent_file
\n-
set to point to the torrent_info object for this torrent. It's\n-only included if the torrent status is queried with\n-torrent_handle::query_torrent_file.
\n-
\n-[report issue]
\n-
next_announce
\n-
the time until the torrent will announce itself to the tracker.
\n-
\n-[report issue]
\n-
current_tracker
\n-
the URL of the last working tracker. If no tracker request has\n-been successful yet, it's set to an empty string.
\n-
\n-\n-[report issue]
\n-
total_download total_upload
\n-
the number of bytes downloaded and uploaded to all peers, accumulated,\n-this session only. The session is considered to restart when a\n-torrent is paused and restarted again. When a torrent is paused, these\n-counters are reset to 0. If you want complete, persistent, stats, see\n-all_time_upload and all_time_download.
\n-
\n-\n-[report issue]
\n-
total_payload_download total_payload_upload
\n-
counts the amount of bytes send and received this session, but only\n-the actual payload data (i.e the interesting data), these counters\n-ignore any protocol overhead. The session is considered to restart\n-when a torrent is paused and restarted again. When a torrent is\n-paused, these counters are reset to 0.
\n-
\n-[report issue]
\n-
total_failed_bytes
\n-
the number of bytes that has been downloaded and that has failed the\n-piece hash test. In other words, this is just how much crap that has\n-been downloaded since the torrent was last started. If a torrent is\n-paused and then restarted again, this counter will be reset.
\n-
\n-[report issue]
\n-
total_redundant_bytes
\n-
the number of bytes that has been downloaded even though that data\n-already was downloaded. The reason for this is that in some situations\n-the same data can be downloaded by mistake. When libtorrent sends\n-requests to a peer, and the peer doesn't send a response within a\n-certain timeout, libtorrent will re-request that block. Another\n-situation when libtorrent may re-request blocks is when the requests\n-it sends out are not replied in FIFO-order (it will re-request blocks\n-that are skipped by an out of order block). This is supposed to be as\n-low as possible. This only counts bytes since the torrent was last\n-started. If a torrent is paused and then restarted again, this counter\n-will be reset.
\n-
\n-[report issue]
\n-
pieces
\n-
a bitmask that represents which pieces we have (set to true) and the\n-pieces we don't have. It's a pointer and may be set to 0 if the\n-torrent isn't downloading or seeding.
\n-
\n-[report issue]
\n-
verified_pieces
\n-
a bitmask representing which pieces has had their hash checked. This\n-only applies to torrents in seed mode. If the torrent is not in seed\n-mode, this bitmask may be empty.
\n-
\n-[report issue]
\n-
total_done
\n-
the total number of bytes of the file(s) that we have. All this does\n-not necessarily has to be downloaded during this session (that's\n-total_payload_download).
\n-
\n-[report issue]
\n-
total
\n-
the total number of bytes to download for this torrent. This\n-may be less than the size of the torrent in case there are\n-pad files. This number only counts bytes that will actually\n-be requested from peers.
\n-
\n-[report issue]
\n-
total_wanted_done
\n-
the number of bytes we have downloaded, only counting the pieces that\n-we actually want to download. i.e. excluding any pieces that we have\n-but have priority 0 (i.e. not wanted).\n-Once a torrent becomes seed, any piece- and file priorities are\n-forgotten and all bytes are considered "wanted".
\n-
\n-[report issue]
\n-
total_wanted
\n-
The total number of bytes we want to download. This may be smaller\n-than the total torrent size in case any pieces are prioritized to 0,\n-i.e. not wanted.\n-Once a torrent becomes seed, any piece- and file priorities are\n-forgotten and all bytes are considered "wanted".
\n-
\n-\n-[report issue]
\n-
all_time_upload all_time_download
\n-
are accumulated upload and download payload byte counters. They are\n-saved in and restored from resume data to keep totals across sessions.
\n-
\n-[report issue]
\n-
added_time
\n-
the posix-time when this torrent was added. i.e. what time(nullptr)\n-returned at the time.
\n-
\n-[report issue]
\n-
completed_time
\n-
the posix-time when this torrent was finished. If the torrent is not\n-yet finished, this is 0.
\n-
\n-[report issue]
\n-
last_seen_complete
\n-
the time when we, or one of our peers, last saw a complete copy of\n-this torrent.
\n-
\n-[report issue]
\n-
storage_mode
\n-
The allocation mode for the torrent. See storage_mode_t for the\n-options. For more information, see storage allocation.
\n-
\n-[report issue]
\n-
progress
\n-
a value in the range [0, 1], that represents the progress of the\n-torrent's current task. It may be checking files or downloading.
\n-
\n-[report issue]
\n-
progress_ppm
\n-

progress parts per million (progress * 1000000) when disabling\n-floating point operations, this is the only option to query progress

\n-

reflects the same value as progress, but instead in a range [0,\n-1000000] (ppm = parts per million). When floating point operations are\n-disabled, this is the only alternative to the floating point value in\n-progress.

\n-
\n-
\n-[report issue]
\n-
queue_position
\n-
the position this torrent has in the download\n-queue. If the torrent is a seed or finished, this is -1.
\n-
\n-\n-[report issue]
\n-
download_rate upload_rate
\n-
the total rates for all peers for this torrent. These will usually\n-have better precision than summing the rates from all peers. The rates\n-are given as the number of bytes per second.
\n-
\n-\n-[report issue]
\n-
download_payload_rate upload_payload_rate
\n-
the total transfer rate of payload only, not counting protocol\n-chatter. This might be slightly smaller than the other rates, but if\n-projected over a long time (e.g. when calculating ETA:s) the\n-difference may be noticeable.
\n-
\n-[report issue]
\n-
num_seeds
\n-
the number of peers that are seeding that this client is\n-currently connected to.
\n-
\n-[report issue]
\n-
num_peers
\n-
the number of peers this torrent currently is connected to. Peer\n-connections that are in the half-open state (is attempting to connect)\n-or are queued for later connection attempt do not count. Although they\n-are visible in the peer list when you call get_peer_info().
\n-
\n-\n-[report issue]
\n-
num_complete num_incomplete
\n-
if the tracker sends scrape info in its announce reply, these fields\n-will be set to the total number of peers that have the whole file and\n-the total number of peers that are still downloading. set to -1 if the\n-tracker did not send any scrape data in its announce reply.
\n-
\n-\n-[report issue]
\n-
list_seeds list_peers
\n-
the number of seeds in our peer list and the total number of peers\n-(including seeds). We are not necessarily connected to all the peers\n-in our peer list. This is the number of peers we know of in total,\n-including banned peers and peers that we have failed to connect to.
\n-
\n-[report issue]
\n-
connect_candidates
\n-
the number of peers in this torrent's peer list that is a candidate to\n-be connected to. i.e. It has fewer connect attempts than the max fail\n-count, it is not a seed if we are a seed, it is not banned etc. If\n-this is 0, it means we don't know of any more peers that we can try.
\n-
\n-[report issue]
\n-
num_pieces
\n-
the number of pieces that has been downloaded. It is equivalent to:\n-std::accumulate(pieces->begin(), pieces->end()). So you don't have\n-to count yourself. This can be used to see if anything has updated\n-since last time if you want to keep a graph of the pieces up to date.
\n-
\n-[report issue]
\n-
distributed_full_copies
\n-
the number of distributed copies of the torrent. Note that one copy\n-may be spread out among many peers. It tells how many copies there are\n-currently of the rarest piece(s) among the peers this client is\n-connected to.
\n-
\n-[report issue]
\n-
distributed_fraction
\n-

tells the share of pieces that have more copies than the rarest\n-piece(s). Divide this number by 1000 to get the fraction.

\n-

For example, if distributed_full_copies is 2 and\n-distributed_fraction is 500, it means that the rarest pieces have\n-only 2 copies among the peers this torrent is connected to, and that\n-50% of all the pieces have more than two copies.

\n-

If we are a seed, the piece picker is deallocated as an optimization,\n-and piece availability is no longer tracked. In this case the\n-distributed copies members are set to -1.

\n-
\n-
\n-[report issue]
\n-
distributed_copies
\n-

the number of distributed copies of the file. note that one copy may\n-be spread out among many peers. This is a floating point\n-representation of the distributed copies.

\n-
\n-
the integer part tells how many copies
\n-
there are of the rarest piece(s)
\n-
the fractional part tells the fraction of pieces that
\n-
have more copies than the rarest piece(s).
\n-
\n-
\n-
\n-[report issue]
\n-
block_size
\n-
the size of a block, in bytes. A block is a sub piece, it is the\n-number of bytes that each piece request asks for and the number of\n-bytes that each bit in the partial_piece_info's bitset represents,\n-see get_download_queue(). This is typically 16 kB, but it may be\n-smaller, if the pieces are smaller.
\n-
\n-[report issue]
\n-
num_uploads
\n-
the number of unchoked peers in this torrent.
\n-
\n-[report issue]
\n-
num_connections
\n-
the number of peer connections this torrent has, including half-open\n-connections that hasn't completed the bittorrent handshake yet. This\n-is always >= num_peers.
\n-
\n-[report issue]
\n-
uploads_limit
\n-
the set limit of upload slots (unchoked peers) for this torrent.
\n-
\n-[report issue]
\n-
connections_limit
\n-
the set limit of number of connections for this torrent.
\n-
\n-\n-[report issue]
\n-
up_bandwidth_queue down_bandwidth_queue
\n-
the number of peers in this torrent that are waiting for more\n-bandwidth quota from the torrent rate limiter. This can determine if\n-the rate you get from this torrent is bound by the torrents limit or\n-not. If there is no limit set on this torrent, the peers might still\n-be waiting for bandwidth quota from the global limiter, but then they\n-are counted in the session_status object.
\n-
\n-[report issue]
\n-
seed_rank
\n-
A rank of how important it is to seed the torrent, it is used to\n-determine which torrents to seed and which to queue. It is based on\n-the peer to seed ratio from the tracker scrape. For more information,\n-see queuing. Higher value means more important to seed
\n-
\n-[report issue]
\n-
state
\n-
the main state the torrent is in. See torrent_status::state_t.
\n+[report issue]
\n+
\n+

announce_infohash

\n+

Declared in "libtorrent/announce_entry.hpp"

\n+
\n+struct announce_infohash\n+{\n+   std::string message;\n+   error_code last_error;\n+   int scrape_incomplete  = -1;\n+   int scrape_complete  = -1;\n+   int scrape_downloaded  = -1;\n+   std::uint8_t fails : 7;\n+   bool updating : 1;\n+   bool start_sent : 1;\n+   bool complete_sent : 1;\n+};\n+
\n+[report issue]
\n+
message
\n+
if this tracker has returned an error or warning message\n+that message is stored here
\n
\n-[report issue]
\n-
need_save_resume
\n-
true if this torrent has unsaved changes\n-to its download state and statistics since the last resume data\n-was saved.
\n+[report issue]
\n+
last_error
\n+
if this tracker failed the last time it was contacted\n+this error code specifies what error occurred
\n
\n-[report issue]
\n-
is_seeding
\n-
true if all pieces have been downloaded.
\n+\n+\n+[report issue]
\n+
scrape_incomplete scrape_complete scrape_downloaded
\n+
if this tracker has returned scrape data, these fields are filled in\n+with valid numbers. Otherwise they are set to -1. incomplete counts\n+the number of current downloaders. complete counts the number of\n+current peers completed the download, or "seeds". downloaded is the\n+cumulative number of completed downloads.
\n
\n-[report issue]
\n-
is_finished
\n-
true if all pieces that have a priority > 0 are downloaded. There is\n-only a distinction between finished and seeding if some pieces or\n-files have been set to priority 0, i.e. are not downloaded.
\n+[report issue]
\n+
fails
\n+
the number of times in a row we have failed to announce to this\n+tracker.
\n
\n-[report issue]
\n-
has_metadata
\n-
true if this torrent has metadata (either it was started from a\n-.torrent file or the metadata has been downloaded). The only scenario\n-where this can be false is when the torrent was started torrent-less\n-(i.e. with just an info-hash and tracker ip, a magnet link for\n-instance).
\n+[report issue]
\n+
updating
\n+
true while we're waiting for a response from the tracker.
\n
\n-[report issue]
\n-
has_incoming
\n-
true if there has ever been an incoming connection attempt to this\n-torrent.
\n+[report issue]
\n+
start_sent
\n+
set to true when we get a valid response from an announce\n+with event=started. If it is set, we won't send start in the subsequent\n+announces.
\n
\n-[report issue]
\n-
moving_storage
\n-
this is true if this torrent's storage is currently being moved from\n-one location to another. This may potentially be a long operation\n-if a large file ends up being copied from one drive to another.
\n+[report issue]
\n+
complete_sent
\n+
set to true when we send a event=completed.
\n
\n-\n-\n-[report issue]
\n-
announcing_to_trackers announcing_to_lsd announcing_to_dht
\n-
these are set to true if this torrent is allowed to announce to the\n-respective peer source. Whether they are true or false is determined by\n-the queue logic/auto manager. Torrents that are not auto managed will\n-always be allowed to announce to all peer sources.
\n+[report issue]
\n+
\n+

announce_endpoint

\n+

Declared in "libtorrent/announce_entry.hpp"

\n+

announces are sent to each tracker using every listen socket\n+this class holds information about one listen socket for one tracker

\n+
\n+struct announce_endpoint\n+{\n+   announce_endpoint ();\n+\n+   tcp::endpoint local_endpoint;\n+   aux::array<announce_infohash, num_protocols, protocol_version> info_hashes;\n+   bool enabled  = true;\n+};\n+
\n+[report issue]
\n+
local_endpoint
\n+
the local endpoint of the listen interface associated with this endpoint
\n
\n-[report issue]
\n+[report issue]
\n
info_hashes
\n-
the info-hash for this torrent
\n-
\n-\n-[report issue]
\n-
last_upload last_download
\n-
the timestamps of the last time this torrent uploaded or downloaded\n-payload to any peer.
\n-
\n-\n-\n-[report issue]
\n-
active_duration finished_duration seeding_duration
\n-
these are cumulative counters of for how long the torrent has been in\n-different states. active means not paused and added to session. Whether\n-it has found any peers or not is not relevant.\n-finished means all selected files/pieces were downloaded and available\n-to other peers (this is always a subset of active time).\n-seeding means all files/pieces were downloaded and available to\n-peers. Being available to peers does not imply there are other peers\n-asking for the payload.
\n+
info_hashes[0] is the v1 info hash (SHA1)\n+info_hashes[1] is the v2 info hash (truncated SHA-256)
\n
\n-[report issue]
\n-
flags
\n-
reflects several of the torrent's flags. For more\n-information, see torrent_handle::flags().
\n+[report issue]
\n+
enabled
\n+
set to false to not announce from this endpoint
\n
\n-[report issue]
\n-
\n-
\n-

peer_class_type_filter

\n-

Declared in "libtorrent/peer_class_type_filter.hpp"

\n-

peer_class_type_filter is a simple container for rules for adding and subtracting\n-peer-classes from peers. It is applied after the peer class filter is applied (which\n-is based on the peer's IP address).

\n+[report issue]
\n+
\n+

announce_entry

\n+

Declared in "libtorrent/announce_entry.hpp"

\n+

this class holds information about one bittorrent tracker, as it\n+relates to a specific torrent.

\n
\n-struct peer_class_type_filter\n+struct announce_entry\n {\n-   void add (socket_type_t const st, peer_class_t const peer_class);\n-   void remove (socket_type_t const st, peer_class_t const peer_class);\n-   void allow (socket_type_t const st, peer_class_t const peer_class);\n-   void disallow (socket_type_t const st, peer_class_t const peer_class);\n-   std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n-   friend bool operator== (peer_class_type_filter const& lhs\n-      , peer_class_type_filter const& rhs);\n+   explicit announce_entry (string_view u);\n+   announce_entry (announce_entry const&);\n+   announce_entry& operator= (announce_entry const&) &;\n+   announce_entry ();\n+   ~announce_entry ();\n \n-   enum socket_type_t\n+   enum tracker_source\n    {\n-      tcp_socket,\n-      utp_socket,\n-      ssl_tcp_socket,\n-      ssl_utp_socket,\n-      i2p_socket,\n-      num_socket_types,\n+      source_torrent,\n+      source_client,\n+      source_magnet_link,\n+      source_tex,\n    };\n+\n+   std::string url;\n+   std::string trackerid;\n+   std::vector<announce_endpoint> endpoints;\n+   std::uint8_t tier  = 0;\n+   std::uint8_t fail_limit  = 0;\n+   std::uint8_t source:4;\n+   bool verified:1;\n };\n 
\n-\n-[report issue]
\n-

add() remove()

\n-
\n-void add (socket_type_t const st, peer_class_t const peer_class);\n-void remove (socket_type_t const st, peer_class_t const peer_class);\n-
\n-

add() and remove() adds and removes a peer class to be added\n-to new peers based on socket type.

\n-\n-[report issue]
\n-
\n-

disallow() allow()

\n-
\n-void allow (socket_type_t const st, peer_class_t const peer_class);\n-void disallow (socket_type_t const st, peer_class_t const peer_class);\n-
\n-

disallow() and allow() adds and removes a peer class to be\n-removed from new peers based on socket type.

\n-

The peer_class argument cannot be greater than 31. The bitmasks representing\n-peer classes in the peer_class_type_filter are 32 bits.

\n-[report issue]
\n-
\n-

apply()

\n+\n+\n+[report issue]
\n+

~announce_entry() announce_entry() operator=()

\n
\n-std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n+explicit announce_entry (string_view u);\n+announce_entry (announce_entry const&);\n+announce_entry& operator= (announce_entry const&) &;\n+announce_entry ();\n+~announce_entry ();\n 
\n-

takes a bitmask of peer classes and returns a new bitmask of\n-peer classes after the rules have been applied, based on the socket type argument\n-(st).

\n-[report issue]
\n-
\n-

enum socket_type_t

\n-

Declared in "libtorrent/peer_class_type_filter.hpp"

\n+

constructs a tracker announce entry with u as the URL.

\n+[report issue]
\n+
\n+

enum tracker_source

\n+

Declared in "libtorrent/announce_entry.hpp"

\n \n \n-\n-\n-\n+\n+\n+\n \n \n \n \n \n \n \n \n-\n-\n-\n-\n-\n+\n \n-\n+\n \n-\n+\n \n-\n-\n-\n-\n-\n+\n \n-\n+\n \n-\n+\n \n-\n-\n-\n+\n+\n+\n \n \n
namevaluedescription
tcp_socket0these match the socket types from socket_type.hpp\n-shifted one down
utp_socket
source_torrent1 the tracker was part of the .torrent file
ssl_tcp_socket
source_client2 
ssl_utp_socket3 the tracker was added programmatically via the add_tracker() function
i2p_socket
source_magnet_link4 the tracker was part of a magnet link
num_socket_types5 
source_tex8the tracker was received from the swarm via tracker exchange
\n-[report issue]
\n+[report issue]
\n+
url
\n+
tracker URL as it appeared in the torrent file
\n+
\n+[report issue]
\n+
trackerid
\n+
the current &trackerid= argument passed to the tracker.\n+this is optional and is normally empty (in which case no\n+trackerid is sent).
\n+
\n+[report issue]
\n+
endpoints
\n+
each local listen socket (endpoint) will announce to the tracker. This\n+list contains state per endpoint.
\n+
\n+[report issue]
\n+
tier
\n+
the tier this tracker belongs to
\n+
\n+[report issue]
\n+
fail_limit
\n+
the max number of failures to announce to this tracker in\n+a row, before this tracker is not used anymore. 0 means unlimited
\n+
\n+[report issue]
\n+
source
\n+
a bitmask specifying which sources we got this tracker from.
\n+
\n+[report issue]
\n+
verified
\n+
set to true the first time we receive a valid response\n+from this tracker.
\n+
\n+

This section describes the functions and classes that are used\n+to create torrent files. It is a layered API with low level classes\n+and higher level convenience functions. A torrent is created in 4\n+steps:

\n+
    \n+
  1. first the files that will be part of the torrent are determined.
  2. \n+
  3. the torrent properties are set, such as tracker url, web seeds,\n+DHT nodes etc.
  4. \n+
  5. Read through all the files in the torrent, SHA-1 all the data\n+and set the piece hashes.
  6. \n+
  7. The torrent is bencoded into a file or buffer.
  8. \n+
\n+

If there are a lot of files and or deep directory hierarchies to\n+traverse, step one can be time consuming.

\n+

Typically step 3 is by far the most time consuming step, since it\n+requires to read all the bytes from all the files in the torrent.

\n+

All of these classes and functions are declared by including\n+libtorrent/create_torrent.hpp.

\n+

example:

\n+
\n+file_storage fs;\n+\n+// recursively adds files in directories\n+add_files(fs, "./my_torrent");\n+\n+create_torrent t(fs);\n+t.add_tracker("http://my.tracker.com/announce");\n+t.set_creator("libtorrent example");\n+\n+// reads the files and calculates the hashes\n+set_piece_hashes(t, ".");\n+\n+ofstream out("my_torrent.torrent", std::ios_base::binary);\n+std::vector<char> buf = t.generate_buf();\n+out.write(buf.data(), buf.size());\n+\n+// alternatively, generate an entry and encode it directly to an ostream\n+// iterator\n+bencode(std::ostream_iterator<char>(out), t.generate());\n+
\n+[report issue]
\n
\n-
\n-

peer_class_info

\n-

Declared in "libtorrent/peer_class.hpp"

\n-

holds settings for a peer class. Used in set_peer_class() and\n-get_peer_class() calls.

\n+
\n+

create_torrent

\n+

Declared in "libtorrent/create_torrent.hpp"

\n+

This class holds state for creating a torrent. After having added\n+all information to it, call create_torrent::generate() to generate\n+the torrent. The entry that's returned can then be bencoded into a\n+.torrent file using bencode().

\n
\n-struct peer_class_info\n+struct create_torrent\n {\n-   bool ignore_unchoke_slots;\n-   int connection_limit_factor;\n-   std::string label;\n-   int upload_limit;\n-   int download_limit;\n-   int upload_priority;\n-   int download_priority;\n+   explicit create_torrent (file_storage& fs, int piece_size = 0\n+      , create_flags_t flags = {});\n+   explicit create_torrent (torrent_info const& ti);\n+   entry generate () const;\n+   std::vector<char> generate_buf () const;\n+   file_storage const& files () const;\n+   void set_comment (char const* str);\n+   void set_creator (char const* str);\n+   void set_creation_date (std::time_t timestamp);\n+   void set_hash (piece_index_t index, sha1_hash const& h);\n+   void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);\n+   void add_http_seed (string_view url);\n+   void add_url_seed (string_view url);\n+   void add_node (std::pair<std::string, int> node);\n+   void add_tracker (string_view url, int tier = 0);\n+   void set_root_cert (string_view cert);\n+   bool priv () const;\n+   void set_priv (bool p);\n+   bool is_v1_only () const;\n+   bool is_v2_only () const;\n+   int num_pieces () const;\n+   piece_index_t end_piece () const;\n+   index_range<piece_index_t> piece_range () const noexcept;\n+   file_index_t end_file () const;\n+   index_range<file_index_t> file_range () const noexcept;\n+   index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);\n+   std::int64_t total_size () const;\n+   int piece_length () const;\n+   int piece_size (piece_index_t i) const;\n+   void add_collection (string_view c);\n+   void add_similar_torrent (sha1_hash ih);\n+\n+   static constexpr create_flags_t modification_time  = 2_bit;\n+   static constexpr create_flags_t symlinks  = 3_bit;\n+   static constexpr create_flags_t v2_only  = 5_bit;\n+   static constexpr create_flags_t v1_only  = 6_bit;\n+   static constexpr create_flags_t canonical_files  = 7_bit;\n+   static constexpr create_flags_t no_attributes  = 8_bit;\n+   static constexpr create_flags_t canonical_files_no_tail_padding  = 9_bit;\n };\n 
\n-[report issue]
\n-
ignore_unchoke_slots
\n-
ignore_unchoke_slots determines whether peers should always\n-unchoke a peer, regardless of the choking algorithm, or if it should\n-honor the unchoke slot limits. It's used for local peers by default.\n-If any of the peer classes a peer belongs to has this set to true,\n-that peer will be unchoked at all times.
\n+[report issue]
\n+

create_torrent()

\n+
\n+explicit create_torrent (file_storage& fs, int piece_size = 0\n+      , create_flags_t flags = {});\n+explicit create_torrent (torrent_info const& ti);\n+
\n+

The piece_size is the size of each piece in bytes. It must be a\n+power of 2 and a minimum of 16 kiB. If a piece size of 0 is\n+specified, a piece_size will be set automatically.

\n+

The flags arguments specifies options for the torrent creation. It can\n+be any combination of the flags defined by create_flags_t.

\n+

The file_storage (fs) parameter defines the files, sizes and\n+their properties for the torrent to be created. Set this up first,\n+before passing it to the create_torrent constructor.

\n+

The overload that takes a torrent_info object will make a verbatim\n+copy of its info dictionary (to preserve the info-hash). The copy of\n+the info dictionary will be used by create_torrent::generate(). This means\n+that none of the member functions of create_torrent that affects\n+the content of the info dictionary (such as set_hash()), will\n+have any affect. Instead of using this overload, consider using\n+write_torrent_file() instead.

\n+
\n+

Warning

\n+

The file_storage and torrent_info objects must stay alive for the\n+entire duration of the create_torrent object.

\n+
\n+\n+[report issue]
\n+
\n+

generate() generate_buf()

\n+
\n+entry generate () const;\n+std::vector<char> generate_buf () const;\n+
\n+

This function will generate the .torrent file as a bencode tree, or a\n+bencoded into a buffer.\n+In order to encode the entry into a flat file, use the bencode() function.

\n+

The function returning an entry may be useful to add custom entries\n+to the torrent file before bencoding it and saving it to disk.

\n+

Whether the resulting torrent object is v1, v2 or hybrid depends on\n+whether any of the v1_only or v2_only flags were set on the\n+constructor. If neither were set, the resulting torrent depends on\n+which hashes were set. If both v1 and v2 hashes were set, a hybrid\n+torrent is created.

\n+

Any failure will cause this function to throw system_error, with an\n+appropriate error message. These are the reasons this call may throw:

\n+
    \n+
  • the file storage has 0 files
  • \n+
  • the total size of the file storage is 0 bytes (i.e. it only has\n+empty files)
  • \n+
  • not all v1 hashes (set_hash()) and not all v2 hashes (set_hash2())\n+were set
  • \n+
  • for v2 torrents, you may not have a directory with the same name as\n+a file. If that's encountered in the file storage, generate()\n+fails.
  • \n+
\n+[report issue]
\n+
\n+

files()

\n+
\n+file_storage const& files () const;\n+
\n+

returns an immutable reference to the file_storage used to create\n+the torrent from.

\n+[report issue]
\n+
\n+

set_comment()

\n+
\n+void set_comment (char const* str);\n+
\n+

Sets the comment for the torrent. The string str should be utf-8 encoded.\n+The comment in a torrent file is optional.

\n+[report issue]
\n+
\n+

set_creator()

\n+
\n+void set_creator (char const* str);\n+
\n+

Sets the creator of the torrent. The string str should be utf-8 encoded.\n+This is optional.

\n+[report issue]
\n+
\n+

set_creation_date()

\n+
\n+void set_creation_date (std::time_t timestamp);\n+
\n+

sets the "creation time" field. Defaults to the system clock at the\n+time of construction of the create_torrent object. The timestamp is\n+specified in seconds, posix time. If the creation date is set to 0,\n+the "creation date" field will be omitted from the generated torrent.

\n+[report issue]
\n+
\n+

set_hash()

\n+
\n+void set_hash (piece_index_t index, sha1_hash const& h);\n+
\n+

This sets the SHA-1 hash for the specified piece (index). You are required\n+to set the hash for every piece in the torrent before generating it. If you have\n+the files on disk, you can use the high level convenience function to do this.\n+See set_piece_hashes().\n+A SHA-1 hash of all zeros is internally used to indicate a hash that\n+has not been set. Setting such hash will not be considered set when\n+calling generate().\n+This function will throw std::system_error if it is called on an\n+object constructed with the v2_only flag.

\n+[report issue]
\n+
\n+

set_hash2()

\n+
\n+void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash const& h);\n+
\n+

sets the bittorrent v2 hash for file file of the piece piece.\n+piece is relative to the first piece of the file, starting at 0. The\n+first piece in the file can be computed with\n+file_storage::file_index_at_piece().\n+The hash, h, is the root of the merkle tree formed by the piece's\n+16 kiB blocks. Note that piece sizes must be powers-of-2, so all\n+per-piece merkle trees are complete.\n+A SHA-256 hash of all zeros is internally used to indicate a hash\n+that has not been set. Setting such hash will not be considered set\n+when calling generate().\n+This function will throw std::system_error if it is called on an\n+object constructed with the v1_only flag.

\n+\n+[report issue]
\n+
\n+

add_http_seed() add_url_seed()

\n+
\n+void add_http_seed (string_view url);\n+void add_url_seed (string_view url);\n+
\n+

This adds a url seed to the torrent. You can have any number of url seeds. For a\n+single file torrent, this should be an HTTP url, pointing to a file with identical\n+content as the file of the torrent. For a multi-file torrent, it should point to\n+a directory containing a directory with the same name as this torrent, and all the\n+files of the torrent in it.

\n+

The second function, add_http_seed() adds an HTTP seed instead.

\n+[report issue]
\n+
\n+

add_node()

\n+
\n+void add_node (std::pair<std::string, int> node);\n+
\n+

This adds a DHT node to the torrent. This especially useful if you're creating a\n+tracker less torrent. It can be used by clients to bootstrap their DHT node from.\n+The node is a hostname and a port number where there is a DHT node running.\n+You can have any number of DHT nodes in a torrent.

\n+[report issue]
\n+
\n+

add_tracker()

\n+
\n+void add_tracker (string_view url, int tier = 0);\n+
\n+

Adds a tracker to the torrent. This is not strictly required, but most torrents\n+use a tracker as their main source of peers. The url should be an http:// or udp://\n+url to a machine running a bittorrent tracker that accepts announces for this torrent's\n+info-hash. The tier is the fallback priority of the tracker. All trackers with tier 0 are\n+tried first (in any order). If all fail, trackers with tier 1 are tried. If all of those\n+fail, trackers with tier 2 are tried, and so on.

\n+[report issue]
\n+
\n+

set_root_cert()

\n+
\n+void set_root_cert (string_view cert);\n+
\n+

This function sets an X.509 certificate in PEM format to the torrent. This makes the\n+torrent an SSL torrent. An SSL torrent requires that each peer has a valid certificate\n+signed by this root certificate. For SSL torrents, all peers are connecting over SSL\n+connections. For more information, see the section on ssl torrents.

\n+

The string is not the path to the cert, it's the actual content of the\n+certificate.

\n+\n+[report issue]
\n+
\n+

priv() set_priv()

\n+
\n+bool priv () const;\n+void set_priv (bool p);\n+
\n+

Sets and queries the private flag of the torrent.\n+Torrents with the private flag set ask the client to not use any other\n+sources than the tracker for peers, and to not use DHT to advertise itself publicly,\n+only the tracker.

\n+[report issue]
\n+
\n+

num_pieces()

\n+
\n+int num_pieces () const;\n+
\n+

returns the number of pieces in the associated file_storage object.

\n+[report issue]
\n+
\n+

piece_range()

\n+
\n+index_range<piece_index_t> piece_range () const noexcept;\n+
\n+

all piece indices in the torrent to be created

\n+[report issue]
\n+
\n+

file_range()

\n+
\n+index_range<file_index_t> file_range () const noexcept;\n+
\n+

all file indices in the torrent to be created

\n+[report issue]
\n+
\n+

file_piece_range()

\n+
\n+index_range<piece_index_t::diff_type> file_piece_range (file_index_t f);\n+
\n+

for v2 and hybrid torrents only, the pieces in the\n+specified file, specified as delta from the first piece in the file.\n+i.e. the first index is 0.

\n+[report issue]
\n+
\n+

total_size()

\n+
\n+std::int64_t total_size () const;\n+
\n+

the total number of bytes of all files and pad files

\n+\n+[report issue]
\n+
\n+

piece_size() piece_length()

\n+
\n+int piece_length () const;\n+int piece_size (piece_index_t i) const;\n+
\n+

piece_length() returns the piece size of all pieces but the\n+last one. piece_size() returns the size of the specified piece.\n+these functions are just forwarding to the associated file_storage.

\n+\n+[report issue]
\n+
\n+

add_similar_torrent() add_collection()

\n+
\n+void add_collection (string_view c);\n+void add_similar_torrent (sha1_hash ih);\n+
\n+

Add similar torrents (by info-hash) or collections of similar torrents.\n+Similar torrents are expected to share some files with this torrent.\n+Torrents sharing a collection name with this torrent are also expected\n+to share files with this torrent. A torrent may have more than one\n+collection and more than one similar torrents. For more information,\n+see BEP 38.

\n+[report issue]
\n+
modification_time
\n+
This will include the file modification time as part of the torrent.\n+This is not enabled by default, as it might cause problems when you\n+create a torrent from separate files with the same content, hoping to\n+yield the same info-hash. If the files have different modification times,\n+with this option enabled, you would get different info-hashes for the\n+files.
\n
\n-[report issue]
\n-
connection_limit_factor
\n-
adjusts the connection limit (global and per torrent) that applies to\n-this peer class. By default, local peers are allowed to exceed the\n-normal connection limit for instance. This is specified as a percent\n-factor. 100 makes the peer class apply normally to the limit. 200\n-means as long as there are fewer connections than twice the limit, we\n-accept this peer. This factor applies both to the global connection\n-limit and the per-torrent limit. Note that if not used carefully one\n-peer class can potentially completely starve out all other over time.
\n+[report issue]
\n+
symlinks
\n+
If this flag is set, files that are symlinks get a symlink attribute\n+set on them and their data will not be included in the torrent. This\n+is useful if you need to reconstruct a file hierarchy which contains\n+symlinks.
\n
\n-[report issue]
\n-
label
\n-
not used by libtorrent. It's intended as a potentially user-facing\n-identifier of this peer class.
\n+[report issue]
\n+
v2_only
\n+
Do not generate v1 metadata. The resulting torrent will only be usable by\n+clients which support v2. This requires setting all v2 hashes, with\n+set_hash2() before calling generate(). Setting v1 hashes (with\n+set_hash()) is an error with this flag set.
\n
\n-\n-[report issue]
\n-
upload_limit download_limit
\n-
transfer rates limits for the whole peer class. They are specified in\n-bytes per second and apply to the sum of all peers that are members of\n-this class.
\n+[report issue]
\n+
v1_only
\n+
do not generate v2 metadata or enforce v2 alignment and padding rules\n+this is mainly for tests, not recommended for production use. This\n+requires setting all v1 hashes, with set_hash(), before calling\n+generate(). Setting v2 hashes (with set_hash2()) is an error with\n+this flag set.
\n
\n-\n-[report issue]
\n-
upload_priority download_priority
\n-
relative priorities used by the bandwidth allocator in the rate\n-limiter. If no rate limits are in use, the priority is not used\n-either. Priorities start at 1 (0 is not a valid priority) and may not\n-exceed 255.
\n+[report issue]
\n+
canonical_files
\n+
This flag only affects v1-only torrents, and is only relevant\n+together with the v1_only_flag. This flag will force the\n+same file order and padding as a v2 (or hybrid) torrent would have.\n+It has the effect of ordering files and inserting pad files to align\n+them with piece boundaries.
\n+
\n+[report issue]
\n+
no_attributes
\n+
passing this flag to add_files() will ignore file attributes (such as\n+executable or hidden) when adding the files to the file storage.\n+Since not all filesystems and operating systems support all file\n+attributes the resulting torrent may differ depending on where it's\n+created. If it's important for torrents to be created consistently\n+across systems, this flag should be set.
\n
\n+[report issue]
\n+
canonical_files_no_tail_padding
\n+
this flag enforces the file layout to be canonical according to the\n+bittorrent v2 specification (just like the canonical_files flag)\n+with the one exception that tail padding is not added to the last\n+file.\n+This behavior deviates from the specification but was the way\n+libtorrent created torrents in version up to and including 2.0.7.\n+This flag is here for backwards compatibility.
\n+
\n+[report issue]
\n+
\n+
\n+

add_files()

\n+

Declared in "libtorrent/create_torrent.hpp"

\n+
\n+void add_files (file_storage& fs, std::string const& file\n+   , create_flags_t flags = {});\n+void add_files (file_storage& fs, std::string const& file\n+   , std::function<bool(std::string)> p, create_flags_t flags = {});\n+
\n+

Adds the file specified by path to the file_storage object. In case path\n+refers to a directory, files will be added recursively from the directory.

\n+

If specified, the predicate p is called once for every file and directory that\n+is encountered. Files for which p returns true are added, and directories for\n+which p returns true are traversed. p must have the following signature:

\n+
\n+bool Pred(std::string const& p);\n+
\n+

The path that is passed in to the predicate is the full path of the file or\n+directory. If no predicate is specified, all files are added, and all directories\n+are traversed.

\n+

The ".." directory is never traversed.

\n+

The flags argument should be the same as the flags passed to the create_torrent\n+constructor.

\n+[report issue]
\n+
\n+

set_piece_hashes()

\n+

Declared in "libtorrent/create_torrent.hpp"

\n+
\n+void set_piece_hashes (create_torrent& t, std::string const& p\n+   , settings_interface const& settings, disk_io_constructor_type disk_io\n+   , std::function<void(piece_index_t)> const& f, error_code& ec);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p\n+   , settings_interface const& settings\n+   , std::function<void(piece_index_t)> const& f);\n+void set_piece_hashes (create_torrent& t, std::string const& p\n+   , settings_interface const& settings\n+   , std::function<void(piece_index_t)> const& f, error_code& ec);\n+void set_piece_hashes (create_torrent& t, std::string const& p\n+   , std::function<void(piece_index_t)> const& f, error_code& ec);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p\n+   , std::function<void(piece_index_t)> const& f);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p, error_code& ec);\n+
\n+

This function will assume that the files added to the torrent file exists at path\n+p, read those files and hash the content and set the hashes in the create_torrent\n+object. The optional function f is called in between every hash that is set. f\n+must have the following signature:

\n+
\n+void Fun(piece_index_t);\n+
\n+

The overloads taking a settings_pack may be used to configure the\n+underlying disk access. Such as settings_pack::aio_threads.

\n+

The overloads that don't take an error_code& may throw an exception in case of a\n+file error, the other overloads sets the error code to reflect the error, if any.

\n [report issue]
\n
\n

block_info

\n

Declared in "libtorrent/torrent_handle.hpp"

\n

holds the state of a block in a piece. Who we requested\n it from and how far along we are at downloading it.

\n
\n struct block_info\n {\n-   void set_peer (tcp::endpoint const& ep);\n    tcp::endpoint peer () const;\n+   void set_peer (tcp::endpoint const& ep);\n \n    enum block_state_t\n    {\n       none,\n       requested,\n       writing,\n       finished,\n@@ -17127,20 +18414,20 @@\n \n    unsigned bytes_progress:15;\n    unsigned block_size:15;\n    unsigned state:2;\n    unsigned num_peers:14;\n };\n 
\n-\n-[report issue]
\n-

peer() set_peer()

\n+\n+[report issue]
\n+

set_peer() peer()

\n
\n-void set_peer (tcp::endpoint const& ep);\n tcp::endpoint peer () const;\n+void set_peer (tcp::endpoint const& ep);\n 
\n

The peer is the ip address of the peer this block was downloaded from.

\n [report issue]
\n
\n

enum block_state_t

\n

Declared in "libtorrent/torrent_handle.hpp"

\n \n@@ -17268,109 +18555,109 @@\n Which means you cannot perform any operation on it, unless you first\n assign it a valid handle. If you try to perform any operation on an\n uninitialized handle, it will throw invalid_handle.

\n
\n

Warning

\n

All operations on a torrent_handle may throw system_error\n exception, in case the handle is no longer referring to a torrent.\n-There is one exception is_valid() will never throw. Since the torrents\n+There is one exception is_valid() will never throw. Since the torrents\n are processed by a background thread, there is no guarantee that a\n handle will remain valid between two calls.

\n
\n
\n struct torrent_handle\n {\n    friend std::size_t hash_value (torrent_handle const& th);\n    torrent_handle () noexcept = default;\n-   void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;\n    void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;\n+   void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;\n    void read_piece (piece_index_t piece) const;\n    bool have_piece (piece_index_t piece) const;\n    void get_peer_info (std::vector<peer_info>& v) const;\n    torrent_status status (status_flags_t flags = status_flags_t::all()) const;\n-   std::vector<partial_piece_info> get_download_queue () const;\n    void get_download_queue (std::vector<partial_piece_info>& queue) const;\n-   void reset_piece_deadline (piece_index_t index) const;\n-   void clear_piece_deadlines () const;\n+   std::vector<partial_piece_info> get_download_queue () const;\n    void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;\n-   std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;\n+   void clear_piece_deadlines () const;\n+   void reset_piece_deadline (piece_index_t index) const;\n    void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;\n+   std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;\n    std::vector<open_file_state> file_status () const;\n    void clear_error () const;\n    void add_tracker (announce_entry const&) const;\n-   void replace_trackers (std::vector<announce_entry> const&) const;\n    std::vector<announce_entry> trackers () const;\n+   void replace_trackers (std::vector<announce_entry> const&) const;\n    void remove_url_seed (std::string const& url) const;\n    std::set<std::string> url_seeds () const;\n    void add_url_seed (std::string const& url) const;\n-   void add_http_seed (std::string const& url) const;\n-   std::set<std::string> http_seeds () const;\n    void remove_http_seed (std::string const& url) const;\n+   std::set<std::string> http_seeds () const;\n+   void add_http_seed (std::string const& url) const;\n    void add_extension (\n       std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, client_data_t)> const& ext\n       , client_data_t userdata = client_data_t{});\n    bool set_metadata (span<char const> metadata) const;\n    bool is_valid () const;\n    void resume () const;\n    void pause (pause_flags_t flags = {}) const;\n-   void set_flags (torrent_flags_t flags) const;\n    void unset_flags (torrent_flags_t flags) const;\n    void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;\n    torrent_flags_t flags () const;\n+   void set_flags (torrent_flags_t flags) const;\n    void flush_cache () const;\n    void force_recheck () const;\n    void save_resume_data (resume_data_flags_t flags = {}) const;\n    bool need_save_resume_data () const;\n-   void queue_position_down () const;\n-   queue_position_t queue_position () const;\n    void queue_position_bottom () const;\n-   void queue_position_top () const;\n    void queue_position_up () const;\n+   void queue_position_top () const;\n+   queue_position_t queue_position () const;\n+   void queue_position_down () const;\n    void queue_position_set (queue_position_t p) const;\n+   void set_ssl_certificate_buffer (std::string const& certificate\n+      , std::string const& private_key\n+      , std::string const& dh_params);\n    void set_ssl_certificate (std::string const& certificate\n       , std::string const& private_key\n       , std::string const& dh_params\n       , std::string const& passphrase = "");\n-   void set_ssl_certificate_buffer (std::string const& certificate\n-      , std::string const& private_key\n-      , std::string const& dh_params);\n    std::shared_ptr<const torrent_info> torrent_file () const;\n    std::shared_ptr<torrent_info> torrent_file_with_hashes () const;\n    std::vector<std::vector<sha256_hash>> piece_layers () const;\n    void piece_availability (std::vector<int>& avail) const;\n    std::vector<download_priority_t> get_piece_priorities () const;\n    void piece_priority (piece_index_t index, download_priority_t priority) const;\n-   void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;\n    download_priority_t piece_priority (piece_index_t index) const;\n    void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;\n-   void file_priority (file_index_t index, download_priority_t priority) const;\n+   void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;\n    std::vector<download_priority_t> get_file_priorities () const;\n+   void file_priority (file_index_t index, download_priority_t priority) const;\n    void prioritize_files (std::vector<download_priority_t> const& files) const;\n    download_priority_t file_priority (file_index_t index) const;\n-   void force_lsd_announce () const;\n    void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;\n    void force_dht_announce () const;\n+   void force_lsd_announce () const;\n    void scrape_tracker (int idx = -1) const;\n-   int download_limit () const;\n-   void set_upload_limit (int limit) const;\n    void set_download_limit (int limit) const;\n+   void set_upload_limit (int limit) const;\n+   int download_limit () const;\n    int upload_limit () const;\n    void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}\n       , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;\n    void clear_peers ();\n    int max_uploads () const;\n    void set_max_uploads (int max_uploads) const;\n    int max_connections () const;\n    void set_max_connections (int max_connections) const;\n    void move_storage (std::string const& save_path\n       , move_flags_t flags = move_flags_t::always_replace_files\n       ) const;\n    void rename_file (file_index_t index, std::string const& new_name) const;\n-   sha1_hash info_hash () const;\n    info_hash_t info_hashes () const;\n+   sha1_hash info_hash () const;\n    bool operator< (const torrent_handle& h) const;\n    bool operator== (const torrent_handle& h) const;\n    bool operator!= (const torrent_handle& h) const;\n    std::uint32_t id () const;\n    std::shared_ptr<torrent> native_handle () const;\n    client_data_t userdata () const;\n    bool in_session () const;\n@@ -17395,21 +18682,21 @@\n 
\n [report issue]
\n

torrent_handle()

\n
\n torrent_handle () noexcept = default;\n 
\n

constructs a torrent handle that does not refer to a torrent.\n-i.e. is_valid() will return false.

\n+i.e. is_valid() will return false.

\n [report issue]
\n
\n

add_piece()

\n
\n-void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;\n void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags = {}) const;\n+void add_piece (piece_index_t piece, std::vector<char> data, add_piece_flags_t flags = {}) const;\n 
\n

This function will write data to the storage as piece piece,\n as if it had been downloaded from a peer.

\n

By default, data that's already been downloaded is not overwritten by\n this buffer. If you trust this data to be correct (and pass the piece\n hash check) you may pass the overwrite_existing flag. This will\n instruct libtorrent to overwrite any data that may already have been\n@@ -17476,30 +18763,30 @@\n filter them out.

\n

By default everything is included. The flags you can use to decide\n what to include are defined in this class.

\n [report issue]
\n
\n

get_download_queue()

\n
\n-std::vector<partial_piece_info> get_download_queue () const;\n void get_download_queue (std::vector<partial_piece_info>& queue) const;\n+std::vector<partial_piece_info> get_download_queue () const;\n 
\n

get_download_queue() returns a vector with information about pieces\n that are partially downloaded or not downloaded but partially\n requested. See partial_piece_info for the fields in the returned\n vector.

\n-\n+\n \n-[report issue]
\n-
\n-

clear_piece_deadlines() set_piece_deadline() reset_piece_deadline()

\n+[report issue]
\n+
\n+

reset_piece_deadline() set_piece_deadline() clear_piece_deadlines()

\n
\n-void reset_piece_deadline (piece_index_t index) const;\n-void clear_piece_deadlines () const;\n void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t flags = {}) const;\n+void clear_piece_deadlines () const;\n+void reset_piece_deadline (piece_index_t index) const;\n 
\n

This function sets or resets the deadline associated with a specific\n piece index (index). libtorrent will attempt to download this\n entire piece before the deadline expires. This is not necessarily\n possible, but pieces with a more recent deadline will always be\n prioritized over pieces with a deadline further ahead in time. The\n deadline (and flags) of a piece can be changed by calling this\n@@ -17514,16 +18801,16 @@\n priority.

\n

clear_piece_deadlines() removes deadlines on all pieces in\n the torrent. As if reset_piece_deadline() was called on all pieces.

\n [report issue]
\n
\n

file_progress()

\n
\n-std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;\n void file_progress (std::vector<std::int64_t>& progress, file_progress_flags_t flags = {}) const;\n+std::vector<std::int64_t> file_progress (file_progress_flags_t flags = {}) const;\n 
\n

This function fills in the supplied vector, or returns a vector, with\n the number of bytes downloaded of each file in this torrent. The\n progress values are ordered the same as the files in the\n torrent_info.

\n

This operation is not very cheap. Its complexity is O(n + mj).\n Where n is the number of files, m is the number of currently\n@@ -17559,16 +18846,16 @@\n \n \n [report issue]

\n
\n

trackers() replace_trackers() add_tracker()

\n
\n void add_tracker (announce_entry const&) const;\n-void replace_trackers (std::vector<announce_entry> const&) const;\n std::vector<announce_entry> trackers () const;\n+void replace_trackers (std::vector<announce_entry> const&) const;\n 
\n

trackers() will return the list of trackers for this torrent. The\n announce entry contains both a string url which specify the\n announce url for the tracker as well as an int tier, which is\n specifies the order in which this tracker is tried. If you want\n libtorrent to use another list of trackers for this torrent, you can\n use replace_trackers() which takes a list of the same form as the\n@@ -17578,19 +18865,19 @@\n

add_tracker() will look if the specified tracker is already in the\n set. If it is, it doesn't do anything. If it's not in the current set\n of trackers, it will insert it in the tier specified in the\n announce_entry.

\n

The updated set of trackers will be saved in the resume data, and when\n a torrent is started with resume data, the trackers from the resume\n data will replace the original ones.

\n-\n+\n \n-[report issue]
\n-
\n-

add_url_seed() url_seeds() remove_url_seed()

\n+[report issue]
\n+
\n+

remove_url_seed() url_seeds() add_url_seed()

\n
\n void remove_url_seed (std::string const& url) const;\n std::set<std::string> url_seeds () const;\n void add_url_seed (std::string const& url) const;\n 
\n

add_url_seed() adds another url to the torrent's list of url\n seeds. If the given url already exists in that list, the call has no\n@@ -17603,17 +18890,17 @@\n

See http seeding for more information.

\n \n \n [report issue]
\n
\n

http_seeds() add_http_seed() remove_http_seed()

\n
\n-void add_http_seed (std::string const& url) const;\n-std::set<std::string> http_seeds () const;\n void remove_http_seed (std::string const& url) const;\n+std::set<std::string> http_seeds () const;\n+void add_http_seed (std::string const& url) const;\n 
\n

These functions are identical as the *_url_seed() variants, but\n they operate on BEP 17 web seeds instead of BEP 19.

\n

See http seeding for more information.

\n [report issue]
\n
\n

add_extension()

\n@@ -17649,24 +18936,24 @@\n

Returns true if this handle refers to a valid torrent and false if it\n hasn't been initialized or if the torrent it refers to has been\n removed from the session AND destructed.

\n

To tell if the torrent_handle is in the session, use\n torrent_handle::in_session(). This will return true before\n session_handle::remove_torrent() is called, and false\n afterward.

\n-

Clients should only use is_valid() to determine if the result of\n+

Clients should only use is_valid() to determine if the result of\n session::find_torrent() was successful.

\n-

Unlike other member functions which return a value, is_valid()\n+

Unlike other member functions which return a value, is_valid()\n completes immediately, without blocking on a result from the\n network thread. Also unlike other functions, it never throws\n the system_error exception.

\n-\n-[report issue]
\n-
\n-

resume() pause()

\n+\n+[report issue]
\n+
\n+

pause() resume()

\n
\n void resume () const;\n void pause (pause_flags_t flags = {}) const;\n 
\n

pause(), and resume() will disconnect all peers and reconnect\n all peers respectively. When a torrent is paused, it will however\n remember all share ratios to all peers and remember all potential (not\n@@ -17680,24 +18967,24 @@\n

\n

Note

\n

Torrents that are auto-managed may be automatically resumed again. It\n does not make sense to pause an auto-managed torrent without making it\n not auto-managed first. Torrents are auto-managed by default when added\n to the session. For more information, see queuing.

\n
\n-\n \n-[report issue]
\n-
\n-

set_flags() unset_flags() flags()

\n+\n+[report issue]
\n+
\n+

unset_flags() set_flags() flags()

\n
\n-void set_flags (torrent_flags_t flags) const;\n void unset_flags (torrent_flags_t flags) const;\n void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;\n torrent_flags_t flags () const;\n+void set_flags (torrent_flags_t flags) const;\n 
\n

sets and gets the torrent state flags. See torrent_flags_t.\n The set_flags overload that take a mask will affect all\n flags part of the mask, and set their values to what the\n flags argument is set to. This allows clearing and\n setting flags in a single function call.\n The set_flags overload that just takes flags, sets all\n@@ -17756,15 +19043,15 @@\n

  • No torrent state has changed since the last saving of resume\n data, and the only_if_modified flag is set.\n metadata (see libtorrent's metadata from peers extension)
  • \n \n \n

    Note that some counters may be outdated by the time you receive the fast resume data

    \n

    When saving resume data because of shutting down, make sure not to\n-remove_torrent() before you receive the save_resume_data_alert.\n+remove_torrent() before you receive the save_resume_data_alert.\n There's no need to pause the session or torrent when saving resume\n data.

    \n

    The paused state of a torrent is saved in the resume data, so pausing\n all torrents before saving resume data will all torrents be restored\n in a paused state.

    \n
    \n

    Note

    \n@@ -17848,27 +19135,27 @@\n
    \n

    Note

    \n

    A torrent's resume data is considered saved as soon as the\n save_resume_data_alert is posted. It is important to make sure this\n alert is received and handled in order for this function to be\n meaningful.

    \n
    \n+\n \n-\n \n-\n-[report issue]
    \n-
    \n-

    queue_position() queue_position_bottom() queue_position_up() queue_position_top() queue_position_down()

    \n+\n+[report issue]
    \n+
    \n+

    queue_position_down() queue_position() queue_position_up() queue_position_bottom() queue_position_top()

    \n
    \n-void queue_position_down () const;\n-queue_position_t queue_position () const;\n void queue_position_bottom () const;\n-void queue_position_top () const;\n void queue_position_up () const;\n+void queue_position_top () const;\n+queue_position_t queue_position () const;\n+void queue_position_down () const;\n 
    \n

    Every torrent that is added is assigned a queue position exactly one\n greater than the greatest queue position of all existing torrents.\n Torrents that are being seeded have -1 as their queue position, since\n they're no longer in line to be downloaded.

    \n

    When a torrent is removed or turns into a seed, all torrents with\n greater queue positions have their positions decreased to fill in the\n@@ -17887,26 +19174,26 @@\n

    queue_position_set()

    \n
    \n void queue_position_set (queue_position_t p) const;\n 
    \n

    updates the position in the queue for this torrent. The relative order\n of all other torrents remain intact but their numerical queue position\n shifts to make space for this torrent's new position

    \n-\n-[report issue]
    \n-
    \n-

    set_ssl_certificate_buffer() set_ssl_certificate()

    \n+\n+[report issue]
    \n+
    \n+

    set_ssl_certificate() set_ssl_certificate_buffer()

    \n
    \n+void set_ssl_certificate_buffer (std::string const& certificate\n+      , std::string const& private_key\n+      , std::string const& dh_params);\n void set_ssl_certificate (std::string const& certificate\n       , std::string const& private_key\n       , std::string const& dh_params\n       , std::string const& passphrase = "");\n-void set_ssl_certificate_buffer (std::string const& certificate\n-      , std::string const& private_key\n-      , std::string const& dh_params);\n 
    \n

    For SSL torrents, use this to specify a path to a .pem file to use as\n this client's certificate. The certificate must be signed by the\n certificate in the .torrent file to be valid.

    \n

    The set_ssl_certificate_buffer() overload takes the actual certificate,\n private key and DH params as strings, rather than paths to files.

    \n

    cert is a path to the (signed) certificate in .pem format\n@@ -17922,18 +19209,18 @@\n

    Note that when a torrent first starts up, and it needs a certificate,\n it will suspend connecting to any peers until it has one. It's\n typically desirable to resume the torrent after setting the SSL\n certificate.

    \n

    If you receive a torrent_need_cert_alert, you need to call this to\n provide a valid cert. If you don't have a cert you won't be allowed to\n connect to any peers.

    \n-\n-[report issue]
    \n-
    \n-

    torrent_file_with_hashes() torrent_file()

    \n+\n+[report issue]
    \n+
    \n+

    torrent_file() torrent_file_with_hashes()

    \n
    \n std::shared_ptr<const torrent_info> torrent_file () const;\n std::shared_ptr<torrent_info> torrent_file_with_hashes () const;\n 
    \n

    torrent_file() returns a pointer to the torrent_info object\n associated with this torrent. The torrent_info object may be a copy\n of the internal object. If the torrent doesn't have metadata, the\n@@ -17989,17 +19276,17 @@\n \n [report issue]

    \n
    \n

    piece_priority() get_piece_priorities() prioritize_pieces()

    \n
    \n std::vector<download_priority_t> get_piece_priorities () const;\n void piece_priority (piece_index_t index, download_priority_t priority) const;\n-void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;\n download_priority_t piece_priority (piece_index_t index) const;\n void prioritize_pieces (std::vector<download_priority_t> const& pieces) const;\n+void prioritize_pieces (std::vector<std::pair<piece_index_t, download_priority_t>> const& pieces) const;\n 
    \n

    These functions are used to set and get the priority of individual\n pieces. By default all pieces have priority 4. That means that the\n random rarest first algorithm is effectively active for all pieces.\n You may however change the priority of individual pieces. There are 8\n priority levels. 0 means not to download the piece at all. Otherwise,\n lower priority values means less likely to be picked. Piece priority\n@@ -18021,22 +19308,22 @@\n Invalid entries, where the piece index or priority is out of range, are\n not allowed.

    \n

    get_piece_priorities returns a vector with one element for each piece\n in the torrent. Each element is the current priority of that piece.

    \n

    It's possible to cancel the effect of file priorities by setting the\n priorities for the affected pieces. Care has to be taken when mixing\n usage of file- and piece priorities.

    \n-\n \n-[report issue]
    \n-
    \n-

    prioritize_files() file_priority() get_file_priorities()

    \n+\n+[report issue]
    \n+
    \n+

    file_priority() get_file_priorities() prioritize_files()

    \n
    \n-void file_priority (file_index_t index, download_priority_t priority) const;\n std::vector<download_priority_t> get_file_priorities () const;\n+void file_priority (file_index_t index, download_priority_t priority) const;\n void prioritize_files (std::vector<download_priority_t> const& files) const;\n download_priority_t file_priority (file_index_t index) const;\n 
    \n

    index must be in the range [0, number_of_files).

    \n

    file_priority() queries or sets the priority of file index.

    \n

    prioritize_files() takes a vector that has at as many elements as\n there are files in the torrent. Each entry is the priority of that\n@@ -18061,23 +19348,23 @@\n file_prio_alert.

    \n

    When combining file- and piece priorities, the resume file will record\n both. When loading the resume data, the file priorities will be applied\n first, then the piece priorities.

    \n

    Moving data from a file into the part file is currently not\n supported. If a file has its priority set to 0 after it has already\n been created, it will not be moved into the partfile.

    \n-\n \n-[report issue]
    \n-
    \n-

    force_dht_announce() force_reannounce() force_lsd_announce()

    \n+\n+[report issue]
    \n+
    \n+

    force_reannounce() force_lsd_announce() force_dht_announce()

    \n
    \n-void force_lsd_announce () const;\n void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {}) const;\n void force_dht_announce () const;\n+void force_lsd_announce () const;\n 
    \n

    force_reannounce() will force this torrent to do another tracker\n request, to receive new peers. The seconds argument specifies how\n many seconds from now to issue the tracker announces.

    \n

    If the tracker's min_interval has not passed since the last\n announce, the forced announce will be scheduled to happen immediately\n as the min_interval expires. This is to honor trackers minimum\n@@ -18102,23 +19389,23 @@\n

    A scrape request queries the tracker for statistics such as total\n number of incomplete peers, complete peers, number of downloads etc.

    \n

    This request will specifically update the num_complete and\n num_incomplete fields in the torrent_status struct once it\n completes. When it completes, it will generate a scrape_reply_alert.\n If it fails, it will generate a scrape_failed_alert.

    \n \n-\n \n-[report issue]
    \n-
    \n-

    download_limit() set_download_limit() set_upload_limit() upload_limit()

    \n+\n+[report issue]
    \n+
    \n+

    download_limit() set_upload_limit() set_download_limit() upload_limit()

    \n
    \n-int download_limit () const;\n-void set_upload_limit (int limit) const;\n void set_download_limit (int limit) const;\n+void set_upload_limit (int limit) const;\n+int download_limit () const;\n int upload_limit () const;\n 
    \n

    set_upload_limit will limit the upload bandwidth used by this\n particular torrent to the limit you set. It is given as the number of\n bytes per second the torrent is allowed to upload.\n set_download_limit works the same way but for download bandwidth\n instead of upload bandwidth. Note that setting a higher limit on a\n@@ -18165,18 +19452,18 @@\n \n

    set_max_uploads() sets the maximum number of peers that's unchoked\n at the same time on this torrent. If you set this to -1, there will be\n no limit. This defaults to infinite. The primary setting controlling\n this is the global unchoke slots limit, set by unchoke_slots_limit in\n settings_pack.

    \n

    max_uploads() returns the current settings.

    \n-\n-[report issue]
    \n-
    \n-

    max_connections() set_max_connections()

    \n+\n+[report issue]
    \n+
    \n+

    set_max_connections() max_connections()

    \n
    \n int max_connections () const;\n void set_max_connections (int max_connections) const;\n 
    \n

    set_max_connections() sets the maximum number of connection this\n torrent will open. If all connections are used up, incoming\n connections may be refused or poor connections may be closed. This\n@@ -18242,21 +19529,21 @@\n

    rename_file()

    \n
    \n void rename_file (file_index_t index, std::string const& new_name) const;\n 
    \n

    Renames the file with the given index asynchronously. The rename\n operation is complete when either a file_renamed_alert or\n file_rename_failed_alert is posted.

    \n-\n-[report issue]
    \n-
    \n-

    info_hash() info_hashes()

    \n+\n+[report issue]
    \n+
    \n+

    info_hashes() info_hash()

    \n
    \n-sha1_hash info_hash () const;\n info_hash_t info_hashes () const;\n+sha1_hash info_hash () const;\n 
    \n

    returns the info-hash(es) of the torrent. If this handle is to a\n torrent that hasn't loaded yet (for instance by being added) by a\n URL, the returned value is undefined.\n The info_hash() returns the SHA-1 info-hash for v1 torrents and a\n truncated hash for v2 torrents. For the full v2 info-hash, use\n info_hashes() instead.

    \n@@ -18417,1585 +19704,14 @@\n
    \n

    hash_value()

    \n

    Declared in "libtorrent/torrent_handle.hpp"

    \n
    \n std::size_t hash_value (torrent_handle const& h);\n 
    \n

    for std::hash (and to support using this type in unordered_map etc.)

    \n-[report issue]
    \n-
    \n-

    storage_error

    \n-

    Declared in "libtorrent/error_code.hpp"

    \n-

    used by storage to return errors\n-also includes which underlying file the\n-error happened on

    \n-
    \n-struct storage_error\n-{\n-   explicit operator bool () const;\n-   void file (file_index_t f);\n-   file_index_t file () const;\n-\n-   error_code ec;\n-   operation_t operation;\n-};\n-
    \n-[report issue]
    \n-

    bool()

    \n-
    \n-explicit operator bool () const;\n-
    \n-

    explicitly converts to true if this object represents an error, and\n-false if it does not.

    \n-[report issue]
    \n-
    \n-

    file()

    \n-
    \n-void file (file_index_t f);\n-file_index_t file () const;\n-
    \n-

    set and query the index (in the torrent) of the file this error\n-occurred on. This may also have special values defined in\n-torrent_status.

    \n-[report issue]
    \n-
    ec
    \n-
    the error that occurred
    \n-
    \n-[report issue]
    \n-
    operation
    \n-
    A code from operation_t enum, indicating what\n-kind of operation failed.
    \n-
    \n-[report issue]
    \n-
    \n-
    \n-

    bdecode_category()

    \n-

    Declared in "libtorrent/bdecode.hpp"

    \n-
    \n-boost::system::error_category& bdecode_category ();\n-
    \n-[report issue]
    \n-
    \n-

    i2p_category()

    \n-

    Declared in "libtorrent/i2p_stream.hpp"

    \n-
    \n-boost::system::error_category& i2p_category ();\n-
    \n-

    returns the error category for I2P errors

    \n-[report issue]
    \n-
    \n-

    socks_category()

    \n-

    Declared in "libtorrent/socks5_stream.hpp"

    \n-
    \n-boost::system::error_category& socks_category ();\n-
    \n-

    returns the error_category for SOCKS5 errors

    \n-[report issue]
    \n-
    \n-

    pcp_category()

    \n-

    Declared in "libtorrent/natpmp.hpp"

    \n-
    \n-boost::system::error_category& pcp_category ();\n-
    \n-[report issue]
    \n-
    \n-

    upnp_category()

    \n-

    Declared in "libtorrent/upnp.hpp"

    \n-
    \n-boost::system::error_category& upnp_category ();\n-
    \n-

    the boost.system error category for UPnP errors

    \n-[report issue]
    \n-
    \n-

    libtorrent_category()

    \n-

    Declared in "libtorrent/error_code.hpp"

    \n-
    \n-boost::system::error_category& libtorrent_category ();\n-
    \n-

    return the instance of the libtorrent_error_category which\n-maps libtorrent error codes to human readable error messages.

    \n-[report issue]
    \n-
    \n-

    http_category()

    \n-

    Declared in "libtorrent/error_code.hpp"

    \n-
    \n-boost::system::error_category& http_category ();\n-
    \n-

    returns the error_category for HTTP errors

    \n-[report issue]
    \n-
    \n-

    gzip_category()

    \n-

    Declared in "libtorrent/gzip.hpp"

    \n-
    \n-boost::system::error_category& gzip_category ();\n-
    \n-

    get the error_category for zip errors

    \n-[report issue]
    \n-
    \n-

    enum error_code_enum

    \n-

    Declared in "libtorrent/bdecode.hpp"

    \n-
    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    no_error0Not an error
    expected_digit1expected digit in bencoded string
    expected_colon2expected colon in bencoded string
    unexpected_eof3unexpected end of file in bencoded string
    expected_value4expected value (list, dict, int or string) in bencoded string
    depth_exceeded5bencoded recursion depth limit exceeded
    limit_exceeded6bencoded item count limit exceeded
    overflow7integer overflow
    error_code_max8the number of error codes
    \n-[report issue]
    \n-
    \n-

    enum i2p_error_code

    \n-

    Declared in "libtorrent/i2p_stream.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    no_error0 
    parse_failed1 
    cant_reach_peer2 
    i2p_error3 
    invalid_key4 
    invalid_id5 
    timeout6 
    key_not_found7 
    duplicated_id8 
    num_errors9 
    \n-[report issue]
    \n-
    \n-

    enum socks_error_code

    \n-

    Declared in "libtorrent/socks5_stream.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    no_error0 
    unsupported_version1 
    unsupported_authentication_method2 
    unsupported_authentication_version3 
    authentication_error4 
    username_required5 
    general_failure6 
    command_not_supported7 
    no_identd8 
    identd_error9 
    num_errors10 
    \n-[report issue]
    \n-
    \n-

    enum pcp_errors

    \n-

    Declared in "libtorrent/natpmp.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    pcp_success0 
    pcp_unsupp_version1 
    pcp_not_authorized2 
    pcp_malformed_request3 
    pcp_unsupp_opcode4 
    pcp_unsupp_option5 
    pcp_malformed_option6 
    pcp_network_failure7 
    pcp_no_resources8 
    pcp_unsupp_protocol9 
    pcp_user_ex_quota10 
    pcp_cannot_provide_external11 
    pcp_address_mismatch12 
    pcp_excessive_remote_peers13 
    \n-[report issue]
    \n-
    \n-

    enum error_code_enum

    \n-

    Declared in "libtorrent/upnp.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    no_error0No error
    invalid_argument402One of the arguments in the request is invalid
    action_failed501The request failed
    value_not_in_array714The specified value does not exist in the array
    source_ip_cannot_be_wildcarded715The source IP address cannot be wild-carded, but\n-must be fully specified
    external_port_cannot_be_wildcarded716The external port cannot be a wildcard, but must\n-be specified
    port_mapping_conflict718The port mapping entry specified conflicts with a\n-mapping assigned previously to another client
    internal_port_must_match_external724Internal and external port value must be the same
    only_permanent_leases_supported725The NAT implementation only supports permanent\n-lease times on port mappings
    remote_host_must_be_wildcard726RemoteHost must be a wildcard and cannot be a\n-specific IP address or DNS name
    external_port_must_be_wildcard727ExternalPort must be a wildcard and cannot be a\n-specific port
    \n-[report issue]
    \n-
    \n-

    enum error_code_enum

    \n-

    Declared in "libtorrent/error_code.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    no_error0Not an error
    file_collision1Two torrents has files which end up overwriting each other
    failed_hash_check2A piece did not match its piece hash
    torrent_is_no_dict3The .torrent file does not contain a bencoded dictionary at\n-its top level
    torrent_missing_info4The .torrent file does not have an info dictionary
    torrent_info_no_dict5The .torrent file's info entry is not a dictionary
    torrent_missing_piece_length6The .torrent file does not have a piece length entry
    torrent_missing_name7The .torrent file does not have a name entry
    torrent_invalid_name8The .torrent file's name entry is invalid
    torrent_invalid_length9The length of a file, or of the whole .torrent file is invalid.\n-Either negative or not an integer
    torrent_file_parse_failed10Failed to parse a file entry in the .torrent
    torrent_missing_pieces11The pieces field is missing or invalid in the .torrent file
    torrent_invalid_hashes12The pieces string has incorrect length
    too_many_pieces_in_torrent13The .torrent file has more pieces than is supported by libtorrent
    invalid_swarm_metadata14The metadata (.torrent file) that was received from the swarm\n-matched the info-hash, but failed to be parsed
    invalid_bencoding15The file or buffer is not correctly bencoded
    no_files_in_torrent16The .torrent file does not contain any files
    invalid_escaped_string17The string was not properly url-encoded as expected
    session_is_closing18Operation is not permitted since the session is shutting down
    duplicate_torrent19There's already a torrent with that info-hash added to the\n-session
    invalid_torrent_handle20The supplied torrent_handle is not referring to a valid torrent
    invalid_entry_type21The type requested from the entry did not match its type
    missing_info_hash_in_uri22The specified URI does not contain a valid info-hash
    file_too_short23One of the files in the torrent was unexpectedly small. This\n-might be caused by files being changed by an external process
    unsupported_url_protocol24The URL used an unknown protocol. Currently http and\n-https (if built with openssl support) are recognized. For\n-trackers udp is recognized as well.
    url_parse_error25The URL did not conform to URL syntax and failed to be parsed
    peer_sent_empty_piece26The peer sent a piece message of length 0
    parse_failed27A bencoded structure was corrupt and failed to be parsed
    invalid_file_tag28The fast resume file was missing or had an invalid file version\n-tag
    missing_info_hash29The fast resume file was missing or had an invalid info-hash
    mismatching_info_hash30The info-hash did not match the torrent
    invalid_hostname31The URL contained an invalid hostname
    invalid_port32The URL had an invalid port
    port_blocked33The port is blocked by the port-filter, and prevented the\n-connection
    expected_close_bracket_in_address34The IPv6 address was expected to end with "]"
    destructing_torrent35The torrent is being destructed, preventing the operation to\n-succeed
    timed_out36The connection timed out
    upload_upload_connection37The peer is upload only, and we are upload only. There's no point\n-in keeping the connection
    uninteresting_upload_peer38The peer is upload only, and we're not interested in it. There's\n-no point in keeping the connection
    invalid_info_hash39The peer sent an unknown info-hash
    torrent_paused40The torrent is paused, preventing the operation from succeeding
    invalid_have41The peer sent an invalid have message, either wrong size or\n-referring to a piece that doesn't exist in the torrent
    invalid_bitfield_size42The bitfield message had the incorrect size
    too_many_requests_when_choked43The peer kept requesting pieces after it was choked, possible\n-abuse attempt.
    invalid_piece44The peer sent a piece message that does not correspond to a\n-piece request sent by the client
    no_memory45memory allocation failed
    torrent_aborted46The torrent is aborted, preventing the operation to succeed
    self_connection47The peer is a connection to ourself, no point in keeping it
    invalid_piece_size48The peer sent a piece message with invalid size, either negative\n-or greater than one block
    timed_out_no_interest49The peer has not been interesting or interested in us for too\n-long, no point in keeping it around
    timed_out_inactivity50The peer has not said anything in a long time, possibly dead
    timed_out_no_handshake51The peer did not send a handshake within a reasonable amount of\n-time, it might not be a bittorrent peer
    timed_out_no_request52The peer has been unchoked for too long without requesting any\n-data. It might be lying about its interest in us
    invalid_choke53The peer sent an invalid choke message
    invalid_unchoke54The peer send an invalid unchoke message
    invalid_interested55The peer sent an invalid interested message
    invalid_not_interested56The peer sent an invalid not-interested message
    invalid_request57The peer sent an invalid piece request message
    invalid_hash_list58The peer sent an invalid hash-list message (this is part of the\n-merkle-torrent extension)
    invalid_hash_piece59The peer sent an invalid hash-piece message (this is part of the\n-merkle-torrent extension)
    invalid_cancel60The peer sent an invalid cancel message
    invalid_dht_port61The peer sent an invalid DHT port-message
    invalid_suggest62The peer sent an invalid suggest piece-message
    invalid_have_all63The peer sent an invalid have all-message
    invalid_have_none64The peer sent an invalid have none-message
    invalid_reject65The peer sent an invalid reject message
    invalid_allow_fast66The peer sent an invalid allow fast-message
    invalid_extended67The peer sent an invalid extension message ID
    invalid_message68The peer sent an invalid message ID
    sync_hash_not_found69The synchronization hash was not found in the encrypted handshake
    invalid_encryption_constant70The encryption constant in the handshake is invalid
    no_plaintext_mode71The peer does not support plain text, which is the selected mode
    no_rc4_mode72The peer does not support RC4, which is the selected mode
    unsupported_encryption_mode73The peer does not support any of the encryption modes that the\n-client supports
    unsupported_encryption_mode_selected74The peer selected an encryption mode that the client did not\n-advertise and does not support
    invalid_pad_size75The pad size used in the encryption handshake is of invalid size
    invalid_encrypt_handshake76The encryption handshake is invalid
    no_incoming_encrypted77The client is set to not support incoming encrypted connections\n-and this is an encrypted connection
    no_incoming_regular78The client is set to not support incoming regular bittorrent\n-connections, and this is a regular connection
    duplicate_peer_id79The client is already connected to this peer-ID
    torrent_removed80Torrent was removed
    packet_too_large81The packet size exceeded the upper sanity check-limit
    reserved82 
    http_error83The web server responded with an error
    missing_location84The web server response is missing a location header
    invalid_redirection85The web seed redirected to a path that no longer matches the\n-.torrent directory structure
    redirecting86The connection was closed because it redirected to a different\n-URL
    invalid_range87The HTTP range header is invalid
    no_content_length88The HTTP response did not have a content length
    banned_by_ip_filter89The IP is blocked by the IP filter
    too_many_connections90At the connection limit
    peer_banned91The peer is marked as banned
    stopping_torrent92The torrent is stopping, causing the operation to fail
    too_many_corrupt_pieces93The peer has sent too many corrupt pieces and is banned
    torrent_not_ready94The torrent is not ready to receive peers
    peer_not_constructed95The peer is not completely constructed yet
    session_closing96The session is closing, causing the operation to fail
    optimistic_disconnect97The peer was disconnected in order to leave room for a\n-potentially better peer
    torrent_finished98The torrent is finished
    no_router99No UPnP router found
    metadata_too_large100The metadata message says the metadata exceeds the limit
    invalid_metadata_request101The peer sent an invalid metadata request message
    invalid_metadata_size102The peer advertised an invalid metadata size
    invalid_metadata_offset103The peer sent a message with an invalid metadata offset
    invalid_metadata_message104The peer sent an invalid metadata message
    pex_message_too_large105The peer sent a peer exchange message that was too large
    invalid_pex_message106The peer sent an invalid peer exchange message
    invalid_lt_tracker_message107The peer sent an invalid tracker exchange message
    too_frequent_pex108The peer sent an pex messages too often. This is a possible\n-attempt of and attack
    no_metadata109The operation failed because it requires the torrent to have\n-the metadata (.torrent file) and it doesn't have it yet.\n-This happens for magnet links before they have downloaded the\n-metadata, and also torrents added by URL.
    invalid_dont_have110The peer sent an invalid dont_have message. The don't have\n-message is an extension to allow peers to advertise that the\n-no longer has a piece they previously had.
    requires_ssl_connection111The peer tried to connect to an SSL torrent without connecting\n-over SSL.
    invalid_ssl_cert112The peer tried to connect to a torrent with a certificate\n-for a different torrent.
    not_an_ssl_torrent113the torrent is not an SSL torrent, and the operation requires\n-an SSL torrent
    banned_by_port_filter114peer was banned because its listen port is within a banned port\n-range, as specified by the port_filter.
    invalid_session_handle115The session_handle is not referring to a valid session_impl
    invalid_listen_socket116the listen socket associated with this request was closed
    invalid_hash_request117 
    invalid_hashes118 
    invalid_hash_reject119 
    deprecated_120120 
    deprecated_121121 
    deprecated_122122 
    deprecated_123123 
    deprecated_124124 
    missing_file_sizes130The resume data file is missing the file sizes entry
    no_files_in_resume_data131The resume data file file sizes entry is empty
    missing_pieces132The resume data file is missing the pieces and slots entry
    mismatching_number_of_files133The number of files in the resume data does not match the number\n-of files in the torrent
    mismatching_file_size134One of the files on disk has a different size than in the fast\n-resume file
    mismatching_file_timestamp135One of the files on disk has a different timestamp than in the\n-fast resume file
    not_a_dictionary136The resume data file is not a dictionary
    invalid_blocks_per_piece137The blocks per piece entry is invalid in the resume data file
    missing_slots138The resume file is missing the slots entry, which is required\n-for torrents with compact allocation. DEPRECATED
    too_many_slots139The resume file contains more slots than the torrent
    invalid_slot_list140The slot entry is invalid in the resume data
    invalid_piece_index141One index in the slot list is invalid
    pieces_need_reorder142The pieces on disk needs to be re-ordered for the specified\n-allocation mode. This happens if you specify sparse allocation\n-and the files on disk are using compact storage. The pieces needs\n-to be moved to their right position. DEPRECATED
    resume_data_not_modified143this error is returned when asking to save resume data and\n-specifying the flag to only save when there's anything new to save\n-(torrent_handle::only_if_modified) and there wasn't anything changed.
    http_parse_error150The HTTP header was not correctly formatted
    http_missing_location151The HTTP response was in the 300-399 range but lacked a location\n-header
    http_failed_decompress152The HTTP response was encoded with gzip or deflate but\n-decompressing it failed
    no_i2p_router160The URL specified an i2p address, but no i2p router is configured
    no_i2p_endpoint161i2p acceptor is not available yet, can't announce without endpoint
    scrape_not_available170The tracker URL doesn't support transforming it into a scrape\n-URL. i.e. it doesn't contain "announce.
    invalid_tracker_response171invalid tracker response
    invalid_peer_dict172invalid peer dictionary entry. Not a dictionary
    tracker_failure173tracker sent a failure message
    invalid_files_entry174missing or invalid files entry
    invalid_hash_entry175missing or invalid hash entry
    invalid_peers_entry176missing or invalid peers and peers6 entry
    invalid_tracker_response_length177UDP tracker response packet has invalid size
    invalid_tracker_transaction_id178invalid transaction id in UDP tracker response
    invalid_tracker_action179invalid action field in UDP tracker response
    announce_skipped180skipped announce (because it's assumed to be unreachable over the\n-given source network interface)
    no_entropy200random number generation failed
    ssrf_mitigation201blocked by SSRF mitigation
    blocked_by_idna202blocked because IDNA host names are banned
    torrent_unknown_version210the torrent file has an unknown meta version
    torrent_missing_file_tree211the v2 torrent file has no file tree
    torrent_missing_meta_version212the torrent contains v2 keys but does not specify meta version 2
    torrent_inconsistent_files213the v1 and v2 file metadata does not match
    torrent_missing_piece_layer214one or more files are missing piece layer hashes
    torrent_invalid_piece_layer215a piece layer has the wrong size or failed hash check
    torrent_missing_pieces_root216a v2 file entry has no root hash
    torrent_inconsistent_hashes217the v1 and v2 hashes do not describe the same data
    torrent_invalid_pad_file218a file in the v2 metadata has the pad attribute set
    error_code_max219the number of error codes
    \n-[report issue]
    \n-
    \n-

    enum http_errors

    \n-

    Declared in "libtorrent/error_code.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    cont100 
    ok200 
    created201 
    accepted202 
    no_content204 
    multiple_choices300 
    moved_permanently301 
    moved_temporarily302 
    not_modified304 
    bad_request400 
    unauthorized401 
    forbidden403 
    not_found404 
    internal_server_error500 
    not_implemented501 
    bad_gateway502 
    service_unavailable503 
    \n-[report issue]
    \n-
    \n-

    enum error_code_enum

    \n-

    Declared in "libtorrent/gzip.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    no_error0Not an error
    invalid_gzip_header1the supplied gzip buffer has invalid header
    inflated_data_too_large2the gzip buffer would inflate to more bytes than the specified\n-maximum size, and was rejected.
    data_did_not_terminate3available inflate data did not terminate
    space_exhausted4output space exhausted before completing inflate
    invalid_block_type5invalid block type (type == 3)
    invalid_stored_block_length6stored block length did not match one's complement
    too_many_length_or_distance_codes7dynamic block code description: too many length or distance codes
    code_lengths_codes_incomplete8dynamic block code description: code lengths codes incomplete
    repeat_lengths_with_no_first_length9dynamic block code description: repeat lengths with no first length
    repeat_more_than_specified_lengths10dynamic block code description: repeat more than specified lengths
    invalid_literal_length_code_lengths11dynamic block code description: invalid literal/length code lengths
    invalid_distance_code_lengths12dynamic block code description: invalid distance code lengths
    invalid_literal_code_in_block13invalid literal/length or distance code in fixed or dynamic block
    distance_too_far_back_in_block14distance is too far back in fixed or dynamic block
    unknown_gzip_error15an unknown error occurred during gzip inflation
    error_code_max16the number of error codes
    \n-[report issue]
    \n-
    \n-

    announce_infohash

    \n-

    Declared in "libtorrent/announce_entry.hpp"

    \n-
    \n-struct announce_infohash\n-{\n-   std::string message;\n-   error_code last_error;\n-   int scrape_incomplete  = -1;\n-   int scrape_complete  = -1;\n-   int scrape_downloaded  = -1;\n-   std::uint8_t fails : 7;\n-   bool updating : 1;\n-   bool start_sent : 1;\n-   bool complete_sent : 1;\n-};\n-
    \n-[report issue]
    \n-
    message
    \n-
    if this tracker has returned an error or warning message\n-that message is stored here
    \n-
    \n-[report issue]
    \n-
    last_error
    \n-
    if this tracker failed the last time it was contacted\n-this error code specifies what error occurred
    \n-
    \n-\n-\n-[report issue]
    \n-
    scrape_incomplete scrape_complete scrape_downloaded
    \n-
    if this tracker has returned scrape data, these fields are filled in\n-with valid numbers. Otherwise they are set to -1. incomplete counts\n-the number of current downloaders. complete counts the number of\n-current peers completed the download, or "seeds". downloaded is the\n-cumulative number of completed downloads.
    \n-
    \n-[report issue]
    \n-
    fails
    \n-
    the number of times in a row we have failed to announce to this\n-tracker.
    \n-
    \n-[report issue]
    \n-
    updating
    \n-
    true while we're waiting for a response from the tracker.
    \n-
    \n-[report issue]
    \n-
    start_sent
    \n-
    set to true when we get a valid response from an announce\n-with event=started. If it is set, we won't send start in the subsequent\n-announces.
    \n-
    \n-[report issue]
    \n-
    complete_sent
    \n-
    set to true when we send a event=completed.
    \n-
    \n-[report issue]
    \n-
    \n-

    announce_endpoint

    \n-

    Declared in "libtorrent/announce_entry.hpp"

    \n-

    announces are sent to each tracker using every listen socket\n-this class holds information about one listen socket for one tracker

    \n-
    \n-struct announce_endpoint\n-{\n-   announce_endpoint ();\n-\n-   tcp::endpoint local_endpoint;\n-   aux::array<announce_infohash, num_protocols, protocol_version> info_hashes;\n-   bool enabled  = true;\n-};\n-
    \n-[report issue]
    \n-
    local_endpoint
    \n-
    the local endpoint of the listen interface associated with this endpoint
    \n-
    \n-[report issue]
    \n-
    info_hashes
    \n-
    info_hashes[0] is the v1 info hash (SHA1)\n-info_hashes[1] is the v2 info hash (truncated SHA-256)
    \n-
    \n-[report issue]
    \n-
    enabled
    \n-
    set to false to not announce from this endpoint
    \n-
    \n-[report issue]
    \n-
    \n-

    announce_entry

    \n-

    Declared in "libtorrent/announce_entry.hpp"

    \n-

    this class holds information about one bittorrent tracker, as it\n-relates to a specific torrent.

    \n-
    \n-struct announce_entry\n-{\n-   explicit announce_entry (string_view u);\n-   announce_entry (announce_entry const&);\n-   announce_entry ();\n-   announce_entry& operator= (announce_entry const&) &;\n-   ~announce_entry ();\n-\n-   enum tracker_source\n-   {\n-      source_torrent,\n-      source_client,\n-      source_magnet_link,\n-      source_tex,\n-   };\n-\n-   std::string url;\n-   std::string trackerid;\n-   std::vector<announce_endpoint> endpoints;\n-   std::uint8_t tier  = 0;\n-   std::uint8_t fail_limit  = 0;\n-   std::uint8_t source:4;\n-   bool verified:1;\n-};\n-
    \n-\n-\n-[report issue]
    \n-

    ~announce_entry() operator=() announce_entry()

    \n-
    \n-explicit announce_entry (string_view u);\n-announce_entry (announce_entry const&);\n-announce_entry ();\n-announce_entry& operator= (announce_entry const&) &;\n-~announce_entry ();\n-
    \n-

    constructs a tracker announce entry with u as the URL.

    \n-[report issue]
    \n-
    \n-

    enum tracker_source

    \n-

    Declared in "libtorrent/announce_entry.hpp"

    \n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-
    namevaluedescription
    source_torrent1the tracker was part of the .torrent file
    source_client2the tracker was added programmatically via the add_tracker() function
    source_magnet_link4the tracker was part of a magnet link
    source_tex8the tracker was received from the swarm via tracker exchange
    \n-[report issue]
    \n-
    url
    \n-
    tracker URL as it appeared in the torrent file
    \n-
    \n-[report issue]
    \n-
    trackerid
    \n-
    the current &trackerid= argument passed to the tracker.\n-this is optional and is normally empty (in which case no\n-trackerid is sent).
    \n-
    \n-[report issue]
    \n-
    endpoints
    \n-
    each local listen socket (endpoint) will announce to the tracker. This\n-list contains state per endpoint.
    \n-
    \n-[report issue]
    \n-
    tier
    \n-
    the tier this tracker belongs to
    \n-
    \n-[report issue]
    \n-
    fail_limit
    \n-
    the max number of failures to announce to this tracker in\n-a row, before this tracker is not used anymore. 0 means unlimited
    \n-
    \n-[report issue]
    \n-
    source
    \n-
    a bitmask specifying which sources we got this tracker from.
    \n-
    \n-[report issue]
    \n-
    verified
    \n-
    set to true the first time we receive a valid response\n-from this tracker.
    \n-
    \n-[report issue]
    \n-
    \n-
    \n-

    dht_state

    \n-

    Declared in "libtorrent/kademlia/dht_state.hpp"

    \n-

    This structure helps to store and load the state\n-of the dht_tracker.\n-At this moment the library is only a dual stack\n-implementation of the DHT. See BEP 32

    \n-
    \n-struct dht_state\n-{\n-   void clear ();\n-\n-   node_ids_t nids;\n-   std::vector<udp::endpoint> nodes;\n-   std::vector<udp::endpoint> nodes6;\n-};\n-
    \n-[report issue]
    \n-
    nodes
    \n-
    the bootstrap nodes saved from the buckets node
    \n-
    \n-[report issue]
    \n-
    nodes6
    \n-
    the bootstrap nodes saved from the IPv6 buckets node
    \n-
    \n [report issue]
    \n
    \n

    dht_storage_counters

    \n

    Declared in "libtorrent/kademlia/dht_storage.hpp"

    \n

    This structure hold the relevant counters for the storage

    \n
    \n struct dht_storage_counters\n@@ -20219,16 +19935,42 @@\n [report issue]
    \n
    \n

    counters()

    \n
    \n virtual dht_storage_counters counters () const = 0;\n 
    \n

    return stats counters for the store

    \n-[report issue]
    \n+[report issue]
    \n
    \n+
    \n+

    dht_state

    \n+

    Declared in "libtorrent/kademlia/dht_state.hpp"

    \n+

    This structure helps to store and load the state\n+of the dht_tracker.\n+At this moment the library is only a dual stack\n+implementation of the DHT. See BEP 32

    \n+
    \n+struct dht_state\n+{\n+   void clear ();\n+\n+   node_ids_t nids;\n+   std::vector<udp::endpoint> nodes;\n+   std::vector<udp::endpoint> nodes6;\n+};\n+
    \n+[report issue]
    \n+
    nodes
    \n+
    the bootstrap nodes saved from the buckets node
    \n+
    \n+[report issue]
    \n+
    nodes6
    \n+
    the bootstrap nodes saved from the IPv6 buckets node
    \n+
    \n+[report issue]
    \n
    \n

    sign_mutable_item()

    \n

    Declared in "libtorrent/kademlia/item.hpp"

    \n
    \n signature sign_mutable_item (\n    span<char const> v\n    , span<char const> salt\n@@ -20267,74 +20009,74 @@\n your source UDP port as your listen port, rather than the one specified in\n the message. This may improve the chances of traversing NATs when using uTP.\n 
    \n
    \n
    ssl_torrent
    \n
    Specify the port number for the SSL listen socket in the DHT announce.
    \n
    \n-[report issue]
    \n-
    \n-

    read_resume_data()

    \n-

    Declared in "libtorrent/read_resume_data.hpp"

    \n-
    \n-add_torrent_params read_resume_data (bdecode_node const& rd\n-   , int piece_limit = 0x200000);\n-add_torrent_params read_resume_data (span<char const> buffer\n-   , load_torrent_limits const& cfg = {});\n-add_torrent_params read_resume_data (bdecode_node const& rd\n-   , error_code& ec, int piece_limit = 0x200000);\n-add_torrent_params read_resume_data (span<char const> buffer\n-   , error_code& ec, load_torrent_limits const& cfg = {});\n-
    \n-

    these functions are used to parse resume data and populate the appropriate\n-fields in an add_torrent_params object. This object can then be used to add\n-the actual torrent_info object to and pass to session::add_torrent() or\n-session::async_add_torrent().

    \n-

    If the client wants to override any field that was loaded from the resume\n-data, e.g. save_path, those fields must be changed after loading resume\n-data but before adding the torrent.

    \n-

    The piece_limit parameter determines the largest number of pieces\n-allowed in the torrent that may be loaded as part of the resume data, if\n-it contains an info field. The overloads that take a flat buffer are\n-instead configured with limits on torrent sizes via load_torrent limits.

    \n-

    In order to support large torrents, it may also be necessary to raise the\n-settings_pack::max_piece_count setting and pass a higher limit to calls\n-to torrent_info::parse_info_section().

    \n-\n-[report issue]
    \n-
    \n-

    write_resume_data() write_resume_data_buf()

    \n+\n+[report issue]
    \n+
    \n+

    write_resume_data_buf() write_resume_data()

    \n

    Declared in "libtorrent/write_resume_data.hpp"

    \n
    \n-std::vector<char> write_resume_data_buf (add_torrent_params const& atp);\n entry write_resume_data (add_torrent_params const& atp);\n+std::vector<char> write_resume_data_buf (add_torrent_params const& atp);\n 
    \n

    this function turns the resume data in an add_torrent_params object\n into a bencoded structure

    \n \n [report issue]
    \n
    \n

    write_torrent_file_buf() write_torrent_file()

    \n

    Declared in "libtorrent/write_resume_data.hpp"

    \n
    \n-entry write_torrent_file (add_torrent_params const& atp);\n-entry write_torrent_file (add_torrent_params const& atp, write_torrent_flags_t flags);\n std::vector<char> write_torrent_file_buf (add_torrent_params const& atp\n    , write_torrent_flags_t flags);\n+entry write_torrent_file (add_torrent_params const& atp);\n+entry write_torrent_file (add_torrent_params const& atp, write_torrent_flags_t flags);\n 
    \n

    writes only the fields to create a .torrent file. This function may fail\n with a std::system_error exception if:

    \n
      \n
    • The add_torrent_params object passed to this function does not contain the\n info dictionary (the ti field)
    • \n
    • The piece layers are not complete for all files that need them
    • \n
    \n

    The write_torrent_file_buf() overload returns the torrent file in\n bencoded buffer form. This overload may be faster at the expense of lost\n flexibility to add custom fields.

    \n+[report issue]
    \n+
    \n+

    read_resume_data()

    \n+

    Declared in "libtorrent/read_resume_data.hpp"

    \n+
    \n+add_torrent_params read_resume_data (bdecode_node const& rd\n+   , error_code& ec, int piece_limit = 0x200000);\n+add_torrent_params read_resume_data (span<char const> buffer\n+   , error_code& ec, load_torrent_limits const& cfg = {});\n+add_torrent_params read_resume_data (span<char const> buffer\n+   , load_torrent_limits const& cfg = {});\n+add_torrent_params read_resume_data (bdecode_node const& rd\n+   , int piece_limit = 0x200000);\n+
    \n+

    these functions are used to parse resume data and populate the appropriate\n+fields in an add_torrent_params object. This object can then be used to add\n+the actual torrent_info object to and pass to session::add_torrent() or\n+session::async_add_torrent().

    \n+

    If the client wants to override any field that was loaded from the resume\n+data, e.g. save_path, those fields must be changed after loading resume\n+data but before adding the torrent.

    \n+

    The piece_limit parameter determines the largest number of pieces\n+allowed in the torrent that may be loaded as part of the resume data, if\n+it contains an info field. The overloads that take a flat buffer are\n+instead configured with limits on torrent sizes via load_torrent limits.

    \n+

    In order to support large torrents, it may also be necessary to raise the\n+settings_pack::max_piece_count setting and pass a higher limit to calls\n+to torrent_info::parse_info_section().

    \n [report issue]
    \n
    \n

    write_torrent_flags_t

    \n

    Declared in "libtorrent/write_resume_data.hpp"

    \n
    \n
    allow_missing_piece_layer
    \n
    this makes write_torrent_file() not fail when attempting to write a\n@@ -20395,18 +20137,18 @@\n \n

    Verifies the signature on the given message using pk

    \n [report issue]
    \n
    \n

    ed25519_add_scalar()

    \n

    Declared in "libtorrent/kademlia/ed25519.hpp"

    \n
    \n-secret_key ed25519_add_scalar (secret_key const& sk\n-   , std::array<char, 32> const& scalar);\n public_key ed25519_add_scalar (public_key const& pk\n    , std::array<char, 32> const& scalar);\n+secret_key ed25519_add_scalar (secret_key const& sk\n+   , std::array<char, 32> const& scalar);\n 
    \n

    Adds a scalar to the given key pair where scalar is a 32 byte buffer\n (possibly generated with ed25519_create_seed), generating a new key pair.

    \n

    You can calculate the public key sum without knowing the private key and\n vice versa by passing in null for the key you don't know. This is useful\n when a third party (an authoritative server for example) needs to enforce\n randomness on a key pair while only knowing the public key of the other\n", "details": [{"source1": "html2text {}", "source2": "html2text {}", "unified_diff": "@@ -4,367 +4,254 @@\n \n \n \n [libtorrent_logo]\n Version: 2.0.8\n home\n Table of contents\n- * bdecode_node\n- o bdecode_node()\n- o bdecode_node()_operator=()\n- o type()\n- o bool()\n- o non_owning()\n- o data_offset()_data_section()\n- o list_int_value_at()_list_size()_list_at()_list_string_value_at()\n- o dict_at()_dict_find_dict()_dict_find_int_value()_dict_find()\n- dict_find_int()_dict_at_node()_dict_find_string()\n- dict_find_string_value()_dict_find_list()_dict_size()\n- o int_value()\n- o string_ptr()_string_length()_string_offset()_string_value()\n- o clear()\n+ * session_proxy\n+ o session_proxy()_~session_proxy()_operator=()\n+ * session\n+ o session()\n+ o session()\n+ o ~session()\n+ o abort()\n+ * session_params\n+ o session_params()\n+ o session_params()\n+ * session_handle\n+ o is_valid()\n+ o session_state()\n+ o refresh_torrent_status()_get_torrent_status()\n+ o post_torrent_updates()\n+ o post_session_stats()\n+ o post_dht_stats()\n+ o set_dht_state()\n+ o find_torrent()_get_torrents()\n+ o add_torrent()_async_add_torrent()\n+ o pause()_is_paused()_resume()\n+ o is_dht_running()\n+ o set_dht_storage()\n+ o add_dht_node()\n+ o dht_get_item()\n+ o dht_get_item()\n+ o dht_put_item()\n+ o dht_put_item()\n+ o dht_announce()_dht_get_peers()\n+ o dht_live_nodes()\n+ o dht_sample_infohashes()\n+ o dht_direct_request()\n+ o add_extension()\n+ o get_ip_filter()_set_ip_filter()\n+ o set_port_filter()\n+ o ssl_listen_port()_is_listening()_listen_port()\n+ o get_peer_class_filter()_set_peer_class_filter()\n+ o set_peer_class_type_filter()_get_peer_class_type_filter()\n+ o create_peer_class()\n+ o delete_peer_class()\n+ o set_peer_class()_get_peer_class()\n+ o remove_torrent()\n+ o get_settings()_apply_settings()\n+ o wait_for_alert()_set_alert_notify()_pop_alerts()\n+ o add_port_mapping()_delete_port_mapping()\n+ o reopen_network_sockets()\n+ o native_handle()\n+ * write_session_params()_write_session_params_buf()_read_session_params()\n+ * info_hash_t\n+ o info_hash_t()\n+ o has()_has_v1()_has_v2()\n+ o get()\n+ o get_best()\n+ o for_each()\n+ * peer_info\n+ * piece_block\n+ * peer_request\n+ o operator==()\n+ * load_torrent_file()_load_torrent_parsed()_load_torrent_buffer()\n+ * truncate_files()\n+ * make_magnet_uri()\n+ * parse_magnet_uri()\n+ * version()\n+ * enum_protocol_version\n+ * enum_event_t\n+ * enum_connection_type\n+ * enum_socket_type_t\n+ * enum_portmap_transport\n+ * enum_portmap_protocol\n+ * download_priority_t\n+ * pex_flags_t\n+ * int\n+ * torrent_flags_t\n+ * char_const*\n+ * std::uint64_t\n+ * add_torrent_params\n+ * client_data_t\n+ o client_data_t()\n+ o const*()_void*()_operator=()\n+ * open_file_state\n+ * disk_interface\n+ o new_torrent()\n+ o remove_torrent()\n+ o async_write()_async_read()\n+ o async_hash()\n+ o async_hash2()\n+ o async_move_storage()\n+ o async_release_files()\n+ o async_check_files()\n+ o async_stop_torrent()\n+ o async_rename_file()\n+ o async_delete_files()\n+ o async_set_file_priority()\n+ o async_clear_piece()\n+ o update_stats_counters()\n+ o get_status()\n+ o abort()\n+ o submit_jobs()\n+ o settings_updated()\n+ * storage_holder\n+ * settings_interface\n+ * disk_observer\n+ o on_disk()\n+ * buffer_allocator_interface\n+ * disk_buffer_holder\n+ o disk_buffer_holder()\n+ o disk_buffer_holder()\n+ o ~disk_buffer_holder()\n+ o data()\n+ o reset()\n o swap()\n- o reserve()\n- o switch_underlying_buffer()\n- o has_soft_error()\n- o enum_type_t\n- * print_entry()\n- * bdecode()\n+ o is_mutable()\n+ o bool()\n+ * file_open_mode_t\n * web_seed_entry\n o operator==()\n o operator<()\n o enum_type_t\n * load_torrent_limits\n * torrent_info\n o torrent_info()\n o ~torrent_info()\n o files()_orig_files()\n o rename_file()\n o remap_files()\n- o trackers()_clear_trackers()_add_tracker()\n+ o clear_trackers()_trackers()_add_tracker()\n o collections()_similar_torrents()\n- o add_url_seed()_set_web_seeds()_add_http_seed()_web_seeds()\n+ o set_web_seeds()_web_seeds()_add_http_seed()_add_url_seed()\n o total_size()\n o num_pieces()_piece_length()\n o last_piece()_end_piece()_piece_range()\n- o info_hash()_info_hashes()\n+ o info_hashes()_info_hash()\n o v2()_v1()\n o num_files()\n o map_block()\n o map_file()\n o ssl_cert()\n o is_valid()\n o priv()\n o is_i2p()\n o piece_size()\n- o hash_for_piece()_hash_for_piece_ptr()\n+ o hash_for_piece_ptr()_hash_for_piece()\n o name()\n o creation_date()\n o creator()\n o comment()\n o nodes()\n o add_node()\n o parse_info_section()\n o info()\n o info_section()\n o piece_layer()\n o free_piece_layers()\n- * entry\n- o type()\n- o entry()\n- o entry()\n- o entry()\n- o operator=()\n- o dict()_string()_list()_integer()_preformatted()\n- o swap()\n- o operator[]()\n- o find_key()\n- o to_string()\n- o enum_data_type\n- * operator<<()\n- * bencode()\n- * disk_observer\n- o on_disk()\n- * settings_interface\n- * buffer_allocator_interface\n- * disk_buffer_holder\n- o disk_buffer_holder()\n- o disk_buffer_holder()\n- o ~disk_buffer_holder()\n- o data()\n- o reset()\n- o swap()\n- o is_mutable()\n- o bool()\n- * open_file_state\n- * disk_interface\n- o new_torrent()\n- o remove_torrent()\n- o async_read()_async_write()\n- o async_hash()\n- o async_hash2()\n- o async_move_storage()\n- o async_release_files()\n- o async_check_files()\n- o async_stop_torrent()\n- o async_rename_file()\n- o async_delete_files()\n- o async_set_file_priority()\n- o async_clear_piece()\n- o update_stats_counters()\n- o get_status()\n- o abort()\n- o submit_jobs()\n- o settings_updated()\n- * storage_holder\n- * file_open_mode_t\n- * counters\n- o inc_stats_counter()_operator[]()\n- * stats_metric\n- * session_stats_metrics()\n- * find_metric_idx()\n- * enum_metric_type_t\n- * a_word_of_caution\n- * plugin-interface\n- * custom_alerts\n- * peer_connection_handle\n- * bt_peer_connection_handle\n- * plugin\n- o implemented_features()\n- o new_torrent()\n- o added()\n- o abort()\n- o on_dht_request()\n- o on_alert()\n- o on_unknown_torrent()\n- o on_tick()\n- o get_unchoke_priority()\n- o load_state()\n- * torrent_plugin\n- o new_connection()\n- o on_piece_pass()_on_piece_failed()\n- o tick()\n- o on_resume()_on_pause()\n- o on_files_checked()\n- o on_state()\n- o on_add_peer()\n- * peer_plugin\n- o type()\n- o add_handshake()\n- o on_disconnect()\n- o on_connected()\n- o on_handshake()\n- o on_extension_handshake()\n- o on_dont_have()_on_allowed_fast()_on_not_interested()_on_bitfield()\n- on_have_none()_on_have()_on_choke()_on_interested()_on_request()\n- on_unchoke()_on_have_all()\n- o on_piece()\n- o sent_have()_sent_unchoke()_sent_piece()_sent_interested()\n- sent_not_interested()\n- o sent_payload()\n- o can_disconnect()\n- o on_extended()\n- o on_unknown_message()\n- o on_piece_pass()_on_piece_failed()\n- o tick()\n- o write_request()\n- * crypto_plugin\n- o decrypt()\n- * create_ut_pex_plugin()\n- * create_ut_metadata_plugin()\n- * create_smart_ban_plugin()\n- * create_torrent\n- o create_torrent()\n- o generate_buf()_generate()\n- o files()\n- o set_comment()\n- o set_creator()\n- o set_creation_date()\n- o set_hash()\n- o set_hash2()\n- o add_url_seed()_add_http_seed()\n- o add_node()\n- o add_tracker()\n- o set_root_cert()\n- o priv()_set_priv()\n- o num_pieces()\n- o piece_range()\n- o file_range()\n- o file_piece_range()\n- o total_size()\n- o piece_size()_piece_length()\n- o add_similar_torrent()_add_collection()\n- * add_files()\n- * set_piece_hashes()\n- * piece_block\n- * info_hash_t\n- o info_hash_t()\n- o has()_has_v2()_has_v1()\n- o get()\n- o get_best()\n- o for_each()\n- * peer_info\n- * peer_request\n- o operator==()\n- * make_magnet_uri()\n- * parse_magnet_uri()\n- * load_torrent_buffer()_load_torrent_parsed()_load_torrent_file()\n- * version()\n- * truncate_files()\n- * enum_connection_type\n- * enum_event_t\n- * enum_socket_type_t\n- * enum_portmap_transport\n- * enum_portmap_protocol\n- * enum_protocol_version\n- * download_priority_t\n- * torrent_flags_t\n- * int\n- * char_const*\n- * std::uint64_t\n- * pex_flags_t\n- * ip_filter\n- o empty()\n- o add_rule()\n- o access()\n- o export_filter()\n- o enum_access_flags\n- * port_filter\n- o add_rule()\n- o access()\n- o enum_access_flags\n- * storage_params\n- * file_slice\n- * file_storage\n- o is_valid()\n- o reserve()\n- o add_file()_add_file_borrow()\n- o rename_file()\n- o map_block()\n- o map_file()\n- o num_files()\n- o end_file()\n- o file_range()\n- o total_size()\n- o num_pieces()_set_num_pieces()\n- o end_piece()\n- o last_piece()\n- o piece_range()\n- o set_piece_length()_piece_length()\n- o piece_size()\n- o piece_size2()\n- o blocks_in_piece2()\n- o set_name()_name()\n- o swap()\n- o canonicalize()\n- o file_size()_hash()_pad_file_at()_root()_file_offset()_root_ptr()\n- file_path()_file_name()_mtime()_symlink()\n- o file_num_pieces()_file_num_blocks()_file_piece_range()\n- o file_first_block_node()_file_first_piece_node()\n- o file_path_hash()\n- o all_path_hashes()\n- o file_flags()\n- o file_absolute_path()\n- o file_index_at_offset()_file_index_at_piece()\n- o file_index_for_root()\n- o piece_index_at_file()\n- o sanitize_symlinks()\n- o v2()\n- * posix_disk_io_constructor()\n- * mmap_disk_io_constructor()\n- * disabled_disk_io_constructor()\n- * default_disk_io_constructor()\n- * enum_storage_mode_t\n- * enum_status_t\n- * enum_move_flags_t\n * settings_pack\n- o set_str()_set_bool()_set_int()\n+ o set_bool()_set_int()_set_str()\n o has_val()\n o clear()\n o clear()\n- o get_bool()_get_int()_get_str()\n+ o get_int()_get_str()_get_bool()\n o enum_type_bases\n o enum_mmap_write_mode_t\n o enum_suggest_mode_t\n o enum_choking_algorithm_t\n o enum_seed_choking_algorithm_t\n o enum_io_buffer_mode_t\n o enum_bandwidth_mixed_algo_t\n o enum_enc_policy\n o enum_enc_level\n o enum_proxy_type_t\n- * generate_fingerprint()\n+ * min_memory_usage()_high_performance_seed()\n * name_for_setting()_setting_by_name()\n * default_settings()\n- * high_performance_seed()_min_memory_usage()\n- * session_params\n- o session_params()\n- o session_params()\n- * session_proxy\n- o ~session_proxy()_operator=()_session_proxy()\n- * session\n- o session()\n- o session()\n- o ~session()\n- o abort()\n- * session_handle\n- o is_valid()\n- o session_state()\n- o get_torrent_status()_refresh_torrent_status()\n- o post_torrent_updates()\n- o post_session_stats()\n- o post_dht_stats()\n- o set_dht_state()\n- o find_torrent()_get_torrents()\n- o add_torrent()_async_add_torrent()\n- o resume()_pause()_is_paused()\n- o is_dht_running()\n- o set_dht_storage()\n- o add_dht_node()\n- o dht_get_item()\n- o dht_get_item()\n- o dht_put_item()\n- o dht_put_item()\n- o dht_get_peers()_dht_announce()\n- o dht_live_nodes()\n- o dht_sample_infohashes()\n- o dht_direct_request()\n- o add_extension()\n- o get_ip_filter()_set_ip_filter()\n- o set_port_filter()\n- o ssl_listen_port()_listen_port()_is_listening()\n- o set_peer_class_filter()_get_peer_class_filter()\n- o get_peer_class_type_filter()_set_peer_class_type_filter()\n- o create_peer_class()\n- o delete_peer_class()\n- o set_peer_class()_get_peer_class()\n- o remove_torrent()\n- o apply_settings()_get_settings()\n- o set_alert_notify()_pop_alerts()_wait_for_alert()\n- o delete_port_mapping()_add_port_mapping()\n- o reopen_network_sockets()\n- o native_handle()\n- * write_session_params_buf()_write_session_params()_read_session_params()\n- * alert\n- o timestamp()\n- o type()\n- o what()\n- o message()\n- o category()\n+ * generate_fingerprint()\n+ * bitfield\n+ o bitfield()\n+ o assign()\n+ o operator[]()_get_bit()\n+ o clear_bit()_set_bit()\n+ o all_set()\n+ o none_set()\n+ o size()\n+ o num_words()\n+ o empty()\n+ o data()\n+ o swap()\n+ o count()\n+ o find_first_set()\n+ o find_last_clear()\n+ * hasher\n+ o operator=()_hasher()\n+ o update()\n+ o final()\n+ o reset()\n+ * hasher256\n+ o hasher256()_operator=()\n+ o update()\n+ o final()\n+ o reset()\n+ * peer_class_type_filter\n+ o add()_remove()\n+ o disallow()_allow()\n+ o apply()\n+ o enum_socket_type_t\n+ * peer_class_info\n+ * storage_error\n+ o bool()\n+ o file()\n+ * libtorrent_category()\n+ * http_category()\n+ * pcp_category()\n+ * upnp_category()\n+ * gzip_category()\n+ * socks_category()\n+ * i2p_category()\n+ * bdecode_category()\n+ * enum_error_code_enum\n+ * enum_http_errors\n+ * enum_pcp_errors\n+ * enum_error_code_enum\n+ * enum_error_code_enum\n+ * enum_socks_error_code\n+ * enum_i2p_error_code\n+ * enum_error_code_enum\n+ * counters\n+ o operator[]()_inc_stats_counter()\n+ * stats_metric\n+ * session_stats_metrics()\n+ * find_metric_idx()\n+ * enum_metric_type_t\n * dht_routing_bucket\n * torrent_alert\n o message()\n * peer_alert\n * tracker_alert\n o tracker_url()\n * torrent_removed_alert\n * read_piece_alert\n * file_completed_alert\n * file_renamed_alert\n- o new_name()_old_name()\n+ o old_name()_new_name()\n * file_rename_failed_alert\n * performance_alert\n o enum_performance_warning_t\n * state_changed_alert\n * tracker_error_alert\n o failure_reason()\n * tracker_warning_alert\n@@ -464,2829 +351,1140 @@\n * dht_direct_response_alert\n * picker_log_alert\n * session_error_alert\n * dht_live_nodes_alert\n o num_nodes()_nodes()\n * session_stats_header_alert\n * dht_sample_infohashes_alert\n- o num_samples()_samples()\n+ o samples()_num_samples()\n o num_nodes()\n o nodes()\n * block_uploaded_alert\n * alerts_dropped_alert\n * socks5_alert\n * file_prio_alert\n * oversized_file_alert\n * torrent_conflict_alert\n+ * alert\n+ o timestamp()\n+ o type()\n+ o what()\n+ o message()\n+ o category()\n * operation_name()\n * alert_cast()\n * enum_operation_t\n- * alert_category_t\n * int\n- * client_data_t\n- o client_data_t()\n- o const*()_operator=()_void*()\n- * add_torrent_params\n- * hasher\n- o hasher()_operator=()\n- o update()\n- o final()\n- o reset()\n- * hasher256\n- o hasher256()_operator=()\n- o update()\n- o final()\n- o reset()\n- * bitfield\n- o bitfield()\n- o assign()\n- o operator[]()_get_bit()\n- o clear_bit()_set_bit()\n- o all_set()\n- o none_set()\n- o size()\n- o num_words()\n- o empty()\n- o data()\n- o swap()\n- o count()\n- o find_first_set()\n- o find_last_clear()\n+ * alert_category_t\n * torrent_status\n o operator==()\n o enum_state_t\n- * peer_class_type_filter\n- o add()_remove()\n- o disallow()_allow()\n- o apply()\n- o enum_socket_type_t\n- * peer_class_info\n+ * entry\n+ o type()\n+ o entry()\n+ o entry()\n+ o entry()\n+ o operator=()\n+ o preformatted()_integer()_list()_dict()_string()\n+ o swap()\n+ o operator[]()\n+ o find_key()\n+ o to_string()\n+ o enum_data_type\n+ * operator<<()\n+ * bencode()\n+ * a_word_of_caution\n+ * plugin-interface\n+ * custom_alerts\n+ * plugin\n+ o implemented_features()\n+ o new_torrent()\n+ o added()\n+ o abort()\n+ o on_dht_request()\n+ o on_alert()\n+ o on_unknown_torrent()\n+ o on_tick()\n+ o get_unchoke_priority()\n+ o load_state()\n+ * torrent_plugin\n+ o new_connection()\n+ o on_piece_failed()_on_piece_pass()\n+ o tick()\n+ o on_pause()_on_resume()\n+ o on_files_checked()\n+ o on_state()\n+ o on_add_peer()\n+ * peer_plugin\n+ o type()\n+ o add_handshake()\n+ o on_disconnect()\n+ o on_connected()\n+ o on_handshake()\n+ o on_extension_handshake()\n+ o on_have()_on_have_all()_on_interested()_on_request()_on_bitfield()\n+ on_dont_have()_on_allowed_fast()_on_unchoke()_on_have_none()\n+ on_not_interested()_on_choke()\n+ o on_piece()\n+ o sent_piece()_sent_unchoke()_sent_interested()_sent_not_interested()\n+ sent_have()\n+ o sent_payload()\n+ o can_disconnect()\n+ o on_extended()\n+ o on_unknown_message()\n+ o on_piece_failed()_on_piece_pass()\n+ o tick()\n+ o write_request()\n+ * crypto_plugin\n+ o decrypt()\n+ * peer_connection_handle\n+ * bt_peer_connection_handle\n+ * create_ut_metadata_plugin()\n+ * create_smart_ban_plugin()\n+ * create_ut_pex_plugin()\n+ * ip_filter\n+ o empty()\n+ o add_rule()\n+ o access()\n+ o export_filter()\n+ o enum_access_flags\n+ * port_filter\n+ o add_rule()\n+ o access()\n+ o enum_access_flags\n+ * bdecode_node\n+ o bdecode_node()\n+ o bdecode_node()_operator=()\n+ o type()\n+ o bool()\n+ o non_owning()\n+ o data_offset()_data_section()\n+ o list_string_value_at()_list_at()_list_int_value_at()_list_size()\n+ o dict_find_string_value()_dict_find_int_value()_dict_find()_dict_at\n+ ()_dict_find_dict()_dict_find_string()_dict_find_int()_dict_at_node\n+ ()_dict_size()_dict_find_list()\n+ o int_value()\n+ o string_ptr()_string_offset()_string_value()_string_length()\n+ o clear()\n+ o swap()\n+ o reserve()\n+ o switch_underlying_buffer()\n+ o has_soft_error()\n+ o enum_type_t\n+ * print_entry()\n+ * bdecode()\n+ * storage_params\n+ * file_slice\n+ * file_storage\n+ o is_valid()\n+ o reserve()\n+ o add_file()_add_file_borrow()\n+ o rename_file()\n+ o map_block()\n+ o map_file()\n+ o num_files()\n+ o end_file()\n+ o file_range()\n+ o total_size()\n+ o num_pieces()_set_num_pieces()\n+ o end_piece()\n+ o last_piece()\n+ o piece_range()\n+ o set_piece_length()_piece_length()\n+ o piece_size()\n+ o piece_size2()\n+ o blocks_in_piece2()\n+ o set_name()_name()\n+ o swap()\n+ o canonicalize()\n+ o file_name()_file_size()_file_offset()_mtime()_root()_file_path()\n+ root_ptr()_symlink()_pad_file_at()_hash()\n+ o file_num_pieces()_file_piece_range()_file_num_blocks()\n+ o file_first_piece_node()_file_first_block_node()\n+ o file_path_hash()\n+ o all_path_hashes()\n+ o file_flags()\n+ o file_absolute_path()\n+ o file_index_at_offset()_file_index_at_piece()\n+ o file_index_for_root()\n+ o piece_index_at_file()\n+ o sanitize_symlinks()\n+ o v2()\n+ * default_disk_io_constructor()\n+ * posix_disk_io_constructor()\n+ * mmap_disk_io_constructor()\n+ * disabled_disk_io_constructor()\n+ * enum_storage_mode_t\n+ * enum_status_t\n+ * enum_move_flags_t\n+ * announce_infohash\n+ * announce_endpoint\n+ * announce_entry\n+ o ~announce_entry()_announce_entry()_operator=()\n+ o enum_tracker_source\n+ * create_torrent\n+ o create_torrent()\n+ o generate()_generate_buf()\n+ o files()\n+ o set_comment()\n+ o set_creator()\n+ o set_creation_date()\n+ o set_hash()\n+ o set_hash2()\n+ o add_http_seed()_add_url_seed()\n+ o add_node()\n+ o add_tracker()\n+ o set_root_cert()\n+ o priv()_set_priv()\n+ o num_pieces()\n+ o piece_range()\n+ o file_range()\n+ o file_piece_range()\n+ o total_size()\n+ o piece_size()_piece_length()\n+ o add_similar_torrent()_add_collection()\n+ * add_files()\n+ * set_piece_hashes()\n * block_info\n- o peer()_set_peer()\n+ o set_peer()_peer()\n o enum_block_state_t\n * partial_piece_info\n * torrent_handle\n o torrent_handle()\n o add_piece()\n o read_piece()\n o have_piece()\n o get_peer_info()\n o status()\n o get_download_queue()\n- o clear_piece_deadlines()_set_piece_deadline()_reset_piece_deadline()\n+ o reset_piece_deadline()_set_piece_deadline()_clear_piece_deadlines()\n o file_progress()\n o file_status()\n o clear_error()\n o trackers()_replace_trackers()_add_tracker()\n- o add_url_seed()_url_seeds()_remove_url_seed()\n+ o remove_url_seed()_url_seeds()_add_url_seed()\n o http_seeds()_add_http_seed()_remove_http_seed()\n o add_extension()\n o set_metadata()\n o is_valid()\n- o resume()_pause()\n- o set_flags()_unset_flags()_flags()\n+ o pause()_resume()\n+ o unset_flags()_set_flags()_flags()\n o flush_cache()\n o force_recheck()\n o save_resume_data()\n o need_save_resume_data()\n- o queue_position()_queue_position_bottom()_queue_position_up()\n- queue_position_top()_queue_position_down()\n+ o queue_position_down()_queue_position()_queue_position_up()\n+ queue_position_bottom()_queue_position_top()\n o queue_position_set()\n- o set_ssl_certificate_buffer()_set_ssl_certificate()\n- o torrent_file_with_hashes()_torrent_file()\n+ o set_ssl_certificate()_set_ssl_certificate_buffer()\n+ o torrent_file()_torrent_file_with_hashes()\n o piece_layers()\n o piece_availability()\n o piece_priority()_get_piece_priorities()_prioritize_pieces()\n- o prioritize_files()_file_priority()_get_file_priorities()\n- o force_dht_announce()_force_reannounce()_force_lsd_announce()\n+ o file_priority()_get_file_priorities()_prioritize_files()\n+ o force_reannounce()_force_lsd_announce()_force_dht_announce()\n o scrape_tracker()\n- o download_limit()_set_download_limit()_set_upload_limit()\n+ o download_limit()_set_upload_limit()_set_download_limit()\n upload_limit()\n o connect_peer()\n o clear_peers()\n o set_max_uploads()_max_uploads()\n- o max_connections()_set_max_connections()\n+ o set_max_connections()_max_connections()\n o move_storage()\n o rename_file()\n- o info_hash()_info_hashes()\n+ o info_hashes()_info_hash()\n o operator!=()_operator<()_operator==()\n o id()\n o native_handle()\n o userdata()\n o in_session()\n * hash_value()\n- * storage_error\n- o bool()\n- o file()\n- * bdecode_category()\n- * i2p_category()\n- * socks_category()\n- * pcp_category()\n- * upnp_category()\n- * libtorrent_category()\n- * http_category()\n- * gzip_category()\n- * enum_error_code_enum\n- * enum_i2p_error_code\n- * enum_socks_error_code\n- * enum_pcp_errors\n- * enum_error_code_enum\n- * enum_error_code_enum\n- * enum_http_errors\n- * enum_error_code_enum\n- * announce_infohash\n- * announce_endpoint\n- * announce_entry\n- o ~announce_entry()_operator=()_announce_entry()\n- o enum_tracker_source\n- * dht_state\n * dht_storage_counters\n o reset()\n * dht_storage_interface\n o update_node_ids()\n o get_peers()\n o announce_peer()\n o get_immutable_item()\n o put_immutable_item()\n o get_mutable_item_seq()\n o get_mutable_item()\n o put_mutable_item()\n o get_infohashes_sample()\n o tick()\n o counters()\n+ * dht_state\n * sign_mutable_item()\n * dht_default_storage_constructor()\n * announce_flags_t\n- * read_resume_data()\n- * write_resume_data()_write_resume_data_buf()\n+ * write_resume_data_buf()_write_resume_data()\n * write_torrent_file_buf()_write_torrent_file()\n+ * read_resume_data()\n * write_torrent_flags_t\n * ed25519_create_seed()\n * ed25519_create_keypair()\n * ed25519_sign()\n * ed25519_verify()\n * ed25519_add_scalar()\n * ed25519_key_exchange()\n [report_issue]\n-****** bdecode_node ******\n-Declared in \"libtorrent/bdecode.hpp\"\n-Sometimes it's important to get a non-owning reference to the root node ( to be\n-able to copy it as a reference for instance). For that, use the non_owning()\n-member function.\n-There are 5 different types of nodes, see type_t.\n-struct bdecode_node\n-{\n- bdecode_node () = default;\n- bdecode_node (bdecode_node const&);\n- bdecode_node& operator= (bdecode_node&&) & = default;\n- bdecode_node& operator= (bdecode_node const&) &;\n- bdecode_node (bdecode_node&&) noexcept;\n- type_t type () const noexcept;\n- explicit operator bool () const noexcept;\n- bdecode_node non_owning () const;\n- std::ptrdiff_t data_offset () const noexcept;\n- span data_section () const noexcept;\n- string_view list_string_value_at (int i\n- , string_view default_val = string_view()) const;\n- std::int64_t list_int_value_at (int i\n- , std::int64_t default_val = 0) const;\n- int list_size () const;\n- bdecode_node list_at (int i) const;\n- bdecode_node dict_find_dict (string_view key) const;\n- string_view dict_find_string_value (string_view key\n- , string_view default_value = string_view()) const;\n- bdecode_node dict_find (string_view key) const;\n- std::int64_t dict_find_int_value (string_view key\n- , std::int64_t default_val = 0) const;\n- int dict_size () const;\n- std::pair dict_at_node (int i) const;\n- bdecode_node dict_find_list (string_view key) const;\n- bdecode_node dict_find_string (string_view key) const;\n- bdecode_node dict_find_int (string_view key) const;\n- std::pair dict_at (int i) const;\n- std::int64_t int_value () const;\n- string_view string_value () const;\n- std::ptrdiff_t string_offset () const;\n- char const* string_ptr () const;\n- int string_length () const;\n- void clear ();\n- void swap (bdecode_node& n);\n- void reserve (int tokens);\n- void switch_underlying_buffer (char const* buf) noexcept;\n- bool has_soft_error (span error) const;\n-\n- enum type_t\n- {\n- none_t,\n- dict_t,\n- list_t,\n- string_t,\n- int_t,\n- };\n-};\n-[report_issue]\n-***** bdecode_node() *****\n-bdecode_node () = default;\n-creates a default constructed node, it will have the type none_t.\n- [report_issue]\n-***** bdecode_node() operator=() *****\n-bdecode_node (bdecode_node const&);\n-bdecode_node& operator= (bdecode_node&&) & = default;\n-bdecode_node& operator= (bdecode_node const&) &;\n-bdecode_node (bdecode_node&&) noexcept;\n-For owning nodes, the copy will create a copy of the tree, but the underlying\n-buffer remains the same.\n-[report_issue]\n-***** type() *****\n-type_t type () const noexcept;\n-the type of this node. See type_t.\n-[report_issue]\n-***** bool() *****\n-explicit operator bool () const noexcept;\n-returns true if type() != none_t.\n-[report_issue]\n-***** non_owning() *****\n-bdecode_node non_owning () const;\n-return a non-owning reference to this node. This is useful to refer to the root\n-node without copying it in assignments.\n- [report_issue]\n-***** data_offset() data_section() *****\n-std::ptrdiff_t data_offset () const noexcept;\n-span data_section () const noexcept;\n-returns the buffer and length of the section in the original bencoded buffer\n-where this node is defined. For a dictionary for instance, this starts with d\n-and ends with e, and has all the content of the dictionary in between. the\n-data_offset() function returns the byte-offset to this node in, starting from\n-the beginning of the buffer that was parsed.\n- [report_issue]\n-***** list_int_value_at() list_size() list_at() list_string_value_at() *****\n-string_view list_string_value_at (int i\n- , string_view default_val = string_view()) const;\n-std::int64_t list_int_value_at (int i\n- , std::int64_t default_val = 0) const;\n-int list_size () const;\n-bdecode_node list_at (int i) const;\n-functions with the list_ prefix operate on lists. These functions are only\n-valid if type() == list_t. list_at() returns the item in the list at index i. i\n-may not be greater than or equal to the size of the list. size() returns the\n-size of the list.\n- [report_issue]\n-***** dict_at() dict_find_dict() dict_find_int_value() dict_find()\n-dict_find_int() dict_at_node() dict_find_string() dict_find_string_value()\n-dict_find_list() dict_size() *****\n-bdecode_node dict_find_dict (string_view key) const;\n-string_view dict_find_string_value (string_view key\n- , string_view default_value = string_view()) const;\n-bdecode_node dict_find (string_view key) const;\n-std::int64_t dict_find_int_value (string_view key\n- , std::int64_t default_val = 0) const;\n-int dict_size () const;\n-std::pair dict_at_node (int i) const;\n-bdecode_node dict_find_list (string_view key) const;\n-bdecode_node dict_find_string (string_view key) const;\n-bdecode_node dict_find_int (string_view key) const;\n-std::pair dict_at (int i) const;\n-Functions with the dict_ prefix operates on dictionaries. They are only valid\n-if type() == dict_t. In case a key you're looking up contains a 0 byte, you\n-cannot use the 0-terminated string overloads, but have to use string_view\n-instead. dict_find_list will return a valid bdecode_node if the key is found\n-_and_ it is a list. Otherwise it will return a default-constructed\n-bdecode_node.\n-Functions with the _value suffix return the value of the node directly, rather\n-than the nodes. In case the node is not found, or it has a different type, a\n-default value is returned (which can be specified).\n-dict_at() returns the (key, value)-pair at the specified index in a dictionary.\n-Keys are only allowed to be strings. dict_at_node() also returns the (key,\n-value)-pair, but the key is returned as a bdecode_node (and it will always be a\n-string).\n-[report_issue]\n-***** int_value() *****\n-std::int64_t int_value () const;\n-this function is only valid if type() == int_t. It returns the value of the\n-integer.\n- [report_issue]\n-***** string_ptr() string_length() string_offset() string_value() *****\n-string_view string_value () const;\n-std::ptrdiff_t string_offset () const;\n-char const* string_ptr () const;\n-int string_length () const;\n-these functions are only valid if type() == string_t. They return the string\n-values. Note that string_ptr() is not 0-terminated. string_length() returns the\n-number of bytes in the string. string_offset() returns the byte offset from the\n-start of the parsed bencoded buffer this string can be found.\n-[report_issue]\n-***** clear() *****\n-void clear ();\n-resets the bdecoded_node to a default constructed state. If this is an owning\n-node, the tree is freed and all child nodes are invalidated.\n-[report_issue]\n-***** swap() *****\n-void swap (bdecode_node& n);\n-Swap contents.\n-[report_issue]\n-***** reserve() *****\n-void reserve (int tokens);\n-preallocate memory for the specified numbers of tokens. This is useful if you\n-know approximately how many tokens are in the file you are about to parse.\n-Doing so will save realloc operations while parsing. You should only call this\n-on the root node, before passing it in to bdecode().\n-[report_issue]\n-***** switch_underlying_buffer() *****\n-void switch_underlying_buffer (char const* buf) noexcept;\n-this buffer MUST be identical to the one originally parsed. This operation is\n-only defined on owning root nodes, i.e. the one passed in to decode().\n-[report_issue]\n-***** has_soft_error() *****\n-bool has_soft_error (span error) const;\n-returns true if there is a non-fatal error in the bencoding of this node or its\n-children\n-[report_issue]\n-***** enum type_t *****\n-Declared in \"libtorrent/bdecode.hpp\"\n- _________________________________________________________________________\n-|name____|value|description_______________________________________________|\n-|none_t |0 |uninitialized or default constructed. This is also used to|\n-|________|_____|indicate_that_a_node_was_not_found_in_some_cases._________|\n-|dict_t__|1____|a_dictionary_node._The_dict_find__functions_are_valid.____|\n-|list_t__|2____|a_list_node._The_list__functions_are_valid._______________|\n-|string_t|3____|a_string_node,_the_string__functions_are_valid.___________|\n-|int_t___|4____|an_integer_node._The_int__functions_are_valid.____________|\n-[report_issue]\n-****** print_entry() ******\n-Declared in \"libtorrent/bdecode.hpp\"\n-std::string print_entry (bdecode_node const& e\n- , bool single_line = false, int indent = 0);\n-print the bencoded structure in a human-readable format to a string that's\n-returned.\n-[report_issue]\n-****** bdecode() ******\n-Declared in \"libtorrent/bdecode.hpp\"\n-bdecode_node bdecode (span buffer\n- , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n- , int token_limit = 2000000);\n-int bdecode (char const* start, char const* end, bdecode_node& ret\n- , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n- , int token_limit = 2000000);\n-bdecode_node bdecode (span buffer\n- , int depth_limit = 100, int token_limit = 2000000);\n-This function decodes/parses bdecoded data (for example a .torrent file). The\n-data structure is returned in the ret argument. the buffer to parse is\n-specified by the start of the buffer as well as the end, i.e. one byte past the\n-end. If the buffer fails to parse, the function returns a non-zero value and\n-fills in ec with the error code. The optional argument error_pos, if set to\n-non-nullptr, will be set to the byte offset into the buffer where the parse\n-failure occurred.\n-depth_limit specifies the max number of nested lists or dictionaries are\n-allowed in the data structure. (This affects the stack usage of the function,\n-be careful not to set it too high).\n-token_limit is the max number of tokens allowed to be parsed from the buffer.\n-This is simply a sanity check to not have unbounded memory usage.\n-The resulting bdecode_node is an owning node. That means it will be holding the\n-whole parsed tree. When iterating lists and dictionaries, those bdecode_node\n-objects will simply have references to the root or owning bdecode_node. If the\n-root node is destructed, all other nodes that refer to anything in that tree\n-become invalid.\n-However, the underlying buffer passed in to this function (start, end) must\n-also remain valid while the bdecoded tree is used. The parsed tree produced by\n-this function does not copy any data out of the buffer, but simply produces\n-references back into it.\n-[report_issue]\n-****** web_seed_entry ******\n-Declared in \"libtorrent/torrent_info.hpp\"\n-the web_seed_entry holds information about a web seed (also known as URL seed\n-or HTTP seed). It is essentially a URL with some state associated with it. For\n-more information, see BEP_17 and BEP_19.\n-struct web_seed_entry\n-{\n- bool operator== (web_seed_entry const& e) const;\n- bool operator< (web_seed_entry const& e) const;\n-\n- enum type_t\n- {\n- url_seed,\n- http_seed,\n- };\n-\n- std::string url;\n- std::string auth;\n- headers_t extra_headers;\n- std::uint8_t type;\n-};\n-[report_issue]\n-***** operator==() *****\n-bool operator== (web_seed_entry const& e) const;\n-URL and type comparison\n-[report_issue]\n-***** operator<() *****\n-bool operator< (web_seed_entry const& e) const;\n-URL and type less-than comparison\n-[report_issue]\n-***** enum type_t *****\n-Declared in \"libtorrent/torrent_info.hpp\"\n- ___________________________\n-|name_____|value|description|\n-|url_seed_|0____|\u00a0_________|\n-|http_seed|1____|\u00a0_________|\n-[report_issue]\n- url\n- The URL of the web seed\n-[report_issue]\n- auth\n- Optional authentication. If this is set, it's passed in as HTTP basic\n- auth to the web seed. The format is: username:password.\n-[report_issue]\n- extra_headers\n- Any extra HTTP headers that need to be passed to the web seed\n-[report_issue]\n- type\n- The type of web seed (see type_t)\n-[report_issue]\n-****** load_torrent_limits ******\n-Declared in \"libtorrent/torrent_info.hpp\"\n-this object holds configuration options for limits to use when loading\n-torrents. They are meant to prevent loading potentially malicious torrents that\n-cause excessive memory allocations.\n-struct load_torrent_limits\n-{\n- int max_buffer_size = 10000000;\n- int max_pieces = 0x200000;\n- int max_decode_depth = 100;\n- int max_decode_tokens = 3000000;\n-};\n-[report_issue]\n- max_buffer_size\n- the max size of a .torrent file to load into RAM\n-[report_issue]\n- max_pieces\n- the max number of pieces allowed in the torrent\n-[report_issue]\n- max_decode_depth\n- the max recursion depth in the bdecoded structure\n-[report_issue]\n- max_decode_tokens\n- the max number of bdecode tokens\n-[report_issue]\n-****** torrent_info ******\n-Declared in \"libtorrent/torrent_info.hpp\"\n-the torrent_info class holds the information found in a .torrent file.\n-class torrent_info\n+****** session_proxy ******\n+Declared in \"libtorrent/session.hpp\"\n+this is a holder for the internal session implementation object. Once the\n+session destruction is explicitly initiated, this holder is used to synchronize\n+the completion of the shutdown. The lifetime of this object may outlive\n+session, causing the session destructor to not block. The session_proxy\n+destructor will block however, until the underlying session is done shutting\n+down.\n+struct session_proxy\n {\n- explicit torrent_info (bdecode_node const& torrent_file);\n- torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n- torrent_info (span buffer, load_torrent_limits const& cfg,\n-from_span_t);\n- torrent_info (char const* buffer, int size);\n- torrent_info (char const* buffer, int size, error_code& ec);\n- explicit torrent_info (std::string const& filename);\n- explicit torrent_info (info_hash_t const& info_hash);\n- torrent_info (std::string const& filename, error_code& ec);\n- explicit torrent_info (span buffer, from_span_t);\n- torrent_info (torrent_info const& t);\n- torrent_info (span buffer, error_code& ec, from_span_t);\n- torrent_info (bdecode_node const& torrent_file, error_code& ec);\n- torrent_info (bdecode_node const& torrent_file, load_torrent_limits const&\n-cfg);\n- ~torrent_info ();\n- file_storage const& orig_files () const;\n- file_storage const& files () const;\n- void rename_file (file_index_t index, std::string const& new_filename);\n- void remap_files (file_storage const& f);\n- void add_tracker (std::string const& url, int tier = 0);\n- void clear_trackers ();\n- std::vector const& trackers () const;\n- void add_tracker (std::string const& url, int tier\n- , announce_entry::tracker_source source);\n- std::vector collections () const;\n- std::vector similar_torrents () const;\n- void add_url_seed (std::string const& url\n- , std::string const& ext_auth = std::string()\n- , web_seed_entry::headers_t const& ext_headers = web_seed_entry::\n-headers_t());\n- void set_web_seeds (std::vector seeds);\n- std::vector const& web_seeds () const;\n- void add_http_seed (std::string const& url\n- , std::string const& extern_auth = std::string()\n- , web_seed_entry::headers_t const& extra_headers = web_seed_entry::\n-headers_t());\n- std::int64_t total_size () const;\n- int piece_length () const;\n- int num_pieces () const;\n- index_range piece_range () const;\n- piece_index_t end_piece () const;\n- piece_index_t last_piece () const;\n- info_hash_t const& info_hashes () const;\n- sha1_hash info_hash () const noexcept;\n- bool v2 () const;\n- bool v1 () const;\n- int num_files () const;\n- std::vector map_block (piece_index_t const piece\n- , std::int64_t offset, int size) const;\n- peer_request map_file (file_index_t const file, std::int64_t offset, int\n-size) const;\n- string_view ssl_cert () const;\n- bool is_valid () const;\n- bool priv () const;\n- bool is_i2p () const;\n- int piece_size (piece_index_t index) const;\n- char const* hash_for_piece_ptr (piece_index_t const index) const;\n- sha1_hash hash_for_piece (piece_index_t index) const;\n- bool is_loaded () const;\n- const std::string& name () const;\n- std::time_t creation_date () const;\n- const std::string& creator () const;\n- const std::string& comment () const;\n- std::vector> const& nodes () const;\n- void add_node (std::pair const& node);\n- bool parse_info_section (bdecode_node const& info, error_code& ec, int\n-max_pieces);\n- bdecode_node info (char const* key) const;\n- span info_section () const;\n- span piece_layer (file_index_t) const;\n- void free_piece_layers ();\n+ session_proxy ();\n+ session_proxy (session_proxy const&);\n+ session_proxy (session_proxy&&) noexcept;\n+ ~session_proxy ();\n+ session_proxy& operator= (session_proxy&&) & noexcept;\n+ session_proxy& operator= (session_proxy const&) &;\n };\n-[report_issue]\n-***** torrent_info() *****\n-explicit torrent_info (bdecode_node const& torrent_file);\n-torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n-torrent_info (span buffer, load_torrent_limits const& cfg,\n-from_span_t);\n-torrent_info (char const* buffer, int size);\n-torrent_info (char const* buffer, int size, error_code& ec);\n-explicit torrent_info (std::string const& filename);\n-explicit torrent_info (info_hash_t const& info_hash);\n-torrent_info (std::string const& filename, error_code& ec);\n-explicit torrent_info (span buffer, from_span_t);\n-torrent_info (torrent_info const& t);\n-torrent_info (span buffer, error_code& ec, from_span_t);\n-torrent_info (bdecode_node const& torrent_file, error_code& ec);\n-torrent_info (bdecode_node const& torrent_file, load_torrent_limits const&\n-cfg);\n-The constructor that takes an info-hash will initialize the info-hash to the\n-given value, but leave all other fields empty. This is used internally when\n-downloading torrents without the metadata. The metadata will be created by\n-libtorrent as soon as it has been downloaded from the swarm.\n-The constructor that takes a bdecode_node will create a torrent_info object\n-from the information found in the given torrent_file. The bdecode_node\n-represents a tree node in an bencoded file. To load an ordinary .torrent file\n-into a bdecode_node, use bdecode().\n-The version that takes a buffer pointer and a size will decode it as a .torrent\n-file and initialize the torrent_info object for you.\n-The version that takes a filename will simply load the torrent file and decode\n-it inside the constructor, for convenience. This might not be the most suitable\n-for applications that want to be able to report detailed errors on what might\n-go wrong.\n-There is an upper limit on the size of the torrent file that will be loaded by\n-the overload taking a filename. If it's important that even very large torrent\n-files are loaded, use one of the other overloads.\n-The overloads that takes an error_code const& never throws if an error occur,\n-they will simply set the error code to describe what went wrong and not fully\n-initialize the torrent_info object. The overloads that do not take the extra\n-error_code parameter will always throw if an error occurs. These overloads are\n-not available when building without exception support.\n-The overload that takes a span also needs an extra parameter of type\n-from_span_t to disambiguate the std::string overload for string literals. There\n-is an object in the libtorrent namespace of this type called from_span.\n-[report_issue]\n-***** ~torrent_info() *****\n-~torrent_info ();\n-frees all storage associated with this torrent_info object\n- [report_issue]\n-***** files() orig_files() *****\n-file_storage const& orig_files () const;\n-file_storage const& files () const;\n-The file_storage object contains the information on how to map the pieces to\n-files. It is separated from the torrent_info object because when creating\n-torrents a storage object needs to be created without having a torrent file.\n-When renaming files in a storage, the storage needs to make its own copy of the\n-file_storage in order to make its mapping differ from the one in the torrent\n-file.\n-orig_files() returns the original (unmodified) file storage for this torrent.\n-This is used by the web server connection, which needs to request files with\n-the original names. Filename may be changed using torrent_info::rename_file().\n-For more information on the file_storage object, see the separate document on\n-how to create torrents.\n-[report_issue]\n-***** rename_file() *****\n-void rename_file (file_index_t index, std::string const& new_filename);\n-Renames the file with the specified index to the new name. The new filename is\n-reflected by the file_storage returned by files() but not by the one returned\n-by orig_files().\n-If you want to rename the base name of the torrent (for a multi file torrent),\n-you can copy the file_storage (see files() and orig_files() ), change the name,\n-and then use remap_files().\n-The new_filename can both be a relative path, in which case the file name is\n-relative to the save_path of the torrent. If the new_filename is an absolute\n-path (i.e. is_complete(new_filename) == true), then the file is detached from\n-the save_path of the torrent. In this case the file is not moved when\n-move_storage() is invoked.\n-[report_issue]\n-***** remap_files() *****\n-void remap_files (file_storage const& f);\n-Warning\n-Usingremap_files()is discouraged as it's incompatible with v2 torrents. This is\n-because the piece boundaries and piece hashes in v2 torrents are intimately\n-tied to the file boundaries. Instead, just rename individual files, or\n-implement a custom disk_interface to customize how to store files.\n-Remaps the file storage to a new file layout. This can be used to, for\n-instance, download all data in a torrent to a single file, or to a number of\n-fixed size sector aligned files, regardless of the number and sizes of the\n-files in the torrent.\n-The new specified file_storage must have the exact same size as the current\n-one.\n [report_issue]\n-***** trackers() clear_trackers() add_tracker() *****\n-void add_tracker (std::string const& url, int tier = 0);\n-void clear_trackers ();\n-std::vector const& trackers () const;\n-void add_tracker (std::string const& url, int tier\n- , announce_entry::tracker_source source);\n-add_tracker() adds a tracker to the announce-list. The tier determines the\n-order in which the trackers are to be tried. The trackers() function will\n-return a sorted vector of announce_entry. Each announce entry contains a\n-string, which is the tracker url, and a tier index. The tier index is the high-\n-level priority. No matter which trackers that works or not, the ones with lower\n-tier will always be tried before the one with higher tier number. For more\n-information, see announce_entry.\n-trackers() returns all entries from announce-list.\n-clear_trackers() removes all trackers from announce-list.\n- [report_issue]\n-***** collections() similar_torrents() *****\n-std::vector collections () const;\n-std::vector similar_torrents () const;\n-These two functions are related to BEP_38 (mutable torrents). The vectors\n-returned from these correspond to the \"similar\" and \"collections\" keys in the\n-.torrent file. Both info-hashes and collections from within the info-dict and\n-from outside of it are included.\n- [report_issue]\n-***** add_url_seed() set_web_seeds() add_http_seed() web_seeds() *****\n-void add_url_seed (std::string const& url\n- , std::string const& ext_auth = std::string()\n- , web_seed_entry::headers_t const& ext_headers = web_seed_entry::\n-headers_t());\n-void set_web_seeds (std::vector seeds);\n-std::vector const& web_seeds () const;\n-void add_http_seed (std::string const& url\n- , std::string const& extern_auth = std::string()\n- , web_seed_entry::headers_t const& extra_headers = web_seed_entry::\n-headers_t());\n-web_seeds() returns all url seeds and http seeds in the torrent. Each entry is\n-a web_seed_entry and may refer to either a url seed or http seed.\n-add_url_seed() and add_http_seed() adds one url to the list of url/http seeds.\n-set_web_seeds() replaces all web seeds with the ones specified in the seeds\n-vector.\n-The extern_auth argument can be used for other authorization schemes than basic\n-HTTP authorization. If set, it will override any username and password found in\n-the URL itself. The string will be sent as the HTTP authorization header's\n-value (without specifying \"Basic\").\n-The extra_headers argument defaults to an empty list, but can be used to insert\n-custom HTTP headers in the requests to a specific web seed.\n-See http_seeding for more information.\n-[report_issue]\n-***** total_size() *****\n-std::int64_t total_size () const;\n-total_size() returns the total number of bytes the torrent-file represents.\n-Note that this is the number of pieces times the piece size (modulo the last\n-piece possibly being smaller). With pad files, the total size will be larger\n-than the sum of all (regular) file sizes.\n- [report_issue]\n-***** num_pieces() piece_length() *****\n-int piece_length () const;\n-int num_pieces () const;\n-piece_length() and num_pieces() returns the number of byte for each piece and\n-the total number of pieces, respectively. The difference between piece_size()\n-and piece_length() is that piece_size() takes the piece index as argument and\n-gives you the exact size of that piece. It will always be the same as\n-piece_length() except in the case of the last piece, which may be smaller.\n- [report_issue]\n-***** last_piece() end_piece() piece_range() *****\n-index_range piece_range () const;\n-piece_index_t end_piece () const;\n-piece_index_t last_piece () const;\n-last_piece() returns the index to the last piece in the torrent and end_piece()\n-returns the index to the one-past-end piece in the torrent piece_range()\n-returns an implementation-defined type that can be used as the container in a\n-range-for loop. Where the values are the indices of all pieces in the\n-file_storage.\n- [report_issue]\n-***** info_hash() info_hashes() *****\n-info_hash_t const& info_hashes () const;\n-sha1_hash info_hash () const noexcept;\n-returns the info-hash of the torrent. For BitTorrent v2 support, use\n-info_hashes() to get an object that may hold both a v1 and v2 info-hash\n- [report_issue]\n-***** v2() v1() *****\n-bool v2 () const;\n-bool v1 () const;\n-returns whether this torrent has v1 and/or v2 metadata, respectively. Hybrid\n-torrents have both. These are shortcuts for info_hashes().has_v1() and\n-info_hashes().has_v2() calls.\n-[report_issue]\n-***** num_files() *****\n-int num_files () const;\n-If you need index-access to files you can use the num_files() along with the\n-file_path(), file_size()-family of functions to access files using indices.\n-[report_issue]\n-***** map_block() *****\n-std::vector map_block (piece_index_t const piece\n- , std::int64_t offset, int size) const;\n-This function will map a piece index, a byte offset within that piece and a\n-size (in bytes) into the corresponding files with offsets where that data for\n-that piece is supposed to be stored. See file_slice.\n-[report_issue]\n-***** map_file() *****\n-peer_request map_file (file_index_t const file, std::int64_t offset, int size)\n-const;\n-This function will map a range in a specific file into a range in the torrent.\n-The file_offset parameter is the offset in the file, given in bytes, where 0 is\n-the start of the file. See peer_request.\n-The input range is assumed to be valid within the torrent. file_offset + size\n-is not allowed to be greater than the file size. file_index must refer to a\n-valid file, i.e. it cannot be >= num_files().\n-[report_issue]\n-***** ssl_cert() *****\n-string_view ssl_cert () const;\n-Returns the SSL root certificate for the torrent, if it is an SSL torrent.\n-Otherwise returns an empty string. The certificate is the public certificate in\n-x509 format.\n-[report_issue]\n-***** is_valid() *****\n-bool is_valid () const;\n-returns true if this torrent_info object has a torrent loaded. This is\n-primarily used to determine if a magnet link has had its metadata resolved yet\n-or not.\n-[report_issue]\n-***** priv() *****\n-bool priv () const;\n-returns true if this torrent is private. i.e., the client should not advertise\n-itself on the trackerless network (the Kademlia DHT) for this torrent.\n-[report_issue]\n-***** is_i2p() *****\n-bool is_i2p () const;\n-returns true if this is an i2p torrent. This is determined by whether or not it\n-has a tracker whose URL domain name ends with \".i2p\". i2p torrents disable the\n-DHT and local peer discovery as well as talking to peers over anything other\n-than the i2p network.\n-[report_issue]\n-***** piece_size() *****\n-int piece_size (piece_index_t index) const;\n-returns the piece size of file with index. This will be the same as\n-piece_length(), except for the last piece, which may be shorter.\n- [report_issue]\n-***** hash_for_piece() hash_for_piece_ptr() *****\n-char const* hash_for_piece_ptr (piece_index_t const index) const;\n-sha1_hash hash_for_piece (piece_index_t index) const;\n-hash_for_piece() takes a piece-index and returns the 20-bytes sha1-hash for\n-that piece and info_hash() returns the 20-bytes sha1-hash for the info-section\n-of the torrent file. hash_for_piece_ptr() returns a pointer to the 20 byte sha1\n-digest for the piece. Note that the string is not 0-terminated.\n-[report_issue]\n-***** name() *****\n-const std::string& name () const;\n-name() returns the name of the torrent. name contains UTF-8 encoded string.\n-[report_issue]\n-***** creation_date() *****\n-std::time_t creation_date () const;\n-creation_date() returns the creation date of the torrent as time_t (posix\n-time). If there's no time stamp in the torrent file, 0 is returned. .. posix\n-time: http://www.opengroup.org/onlinepubs/009695399/functions/time.html\n-[report_issue]\n-***** creator() *****\n-const std::string& creator () const;\n-creator() returns the creator string in the torrent. If there is no creator\n-string it will return an empty string.\n-[report_issue]\n-***** comment() *****\n-const std::string& comment () const;\n-comment() returns the comment associated with the torrent. If there's no\n-comment, it will return an empty string. comment contains UTF-8 encoded string.\n-[report_issue]\n-***** nodes() *****\n-std::vector> const& nodes () const;\n-If this torrent contains any DHT nodes, they are put in this vector in their\n-original form (host name and port number).\n-[report_issue]\n-***** add_node() *****\n-void add_node (std::pair const& node);\n-This is used when creating torrent. Use this to add a known DHT node. It may be\n-used, by the client, to bootstrap into the DHT network.\n-[report_issue]\n-***** parse_info_section() *****\n-bool parse_info_section (bdecode_node const& info, error_code& ec, int\n-max_pieces);\n-populates the torrent_info by providing just the info-dict buffer. This is used\n-when loading a torrent from a magnet link for instance, where we only have the\n-info-dict. The bdecode_node e points to a parsed info-dictionary. ec returns an\n-error code if something fails (typically if the info dictionary is malformed).\n-Themax_piecesparameter allows limiting the amount of memory dedicated to\n-loading the torrent, and fails for torrents that exceed the limit. To load\n-large torrents, this limit may also need to be raised in settings_pack::\n-max_piece_count and in calls to read_resume_data().\n-[report_issue]\n-***** info() *****\n-bdecode_node info (char const* key) const;\n-This function looks up keys from the info-dictionary of the loaded torrent\n-file. It can be used to access extension values put in the .torrent file. If\n-the specified key cannot be found, it returns nullptr.\n-[report_issue]\n-***** info_section() *****\n-span info_section () const;\n-returns a the raw info section of the torrent file. The underlying buffer is\n-still owned by the torrent_info object\n-[report_issue]\n-***** piece_layer() *****\n-span piece_layer (file_index_t) const;\n-return the bytes of the piece layer hashes for the specified file. If the file\n-doesn't have a piece layer, an empty span is returned. The span size is\n-divisible by 32, the size of a SHA-256 hash. If the size of the file is smaller\n-than or equal to the piece size, the files \"root hash\" is the hash of the file\n-and is not saved separately in the \"piece layers\" field, but this function\n-still returns the root hash of the file in that case.\n-[report_issue]\n-***** free_piece_layers() *****\n-void free_piece_layers ();\n-clears the piece layers from the torrent_info. This is done by the session when\n-a torrent is added, to avoid storing it twice. The piece layer (or other hashes\n-part of the merkle tree) are stored in the internal torrent object.\n-Bencoding is a common representation in bittorrent used for dictionary, list,\n-int and string hierarchies. It's used to encode .torrent files and some\n-messages in the network protocol. libtorrent also uses it to store settings,\n-resume data and other session state.\n-Strings in bencoded structures do not necessarily represent text. Strings are\n-raw byte buffers of a certain length. If a string is meant to be interpreted as\n-text, it is required to be UTF-8 encoded. See BEP_3.\n-The function for decoding bencoded data bdecode(), returning a bdecode_node.\n-This function builds a tree that points back into the original buffer. The\n-returned bdecode_node will not be valid once the buffer it was parsed out of is\n-discarded.\n-It's possible to construct an entry from a bdecode_node, if a structure needs\n-to be altered and re-encoded.\n+***** session_proxy() ~session_proxy() operator=() *****\n+session_proxy ();\n+session_proxy (session_proxy const&);\n+session_proxy (session_proxy&&) noexcept;\n+~session_proxy ();\n+session_proxy& operator= (session_proxy&&) & noexcept;\n+session_proxy& operator= (session_proxy const&) &;\n+default constructor, does not refer to any session implementation object.\n [report_issue]\n-****** entry ******\n-Declared in \"libtorrent/entry.hpp\"\n-The entry class represents one node in a bencoded hierarchy. It works as a\n-variant type, it can be either a list, a dictionary (std::map), an integer or a\n-string.\n-class entry\n+****** session ******\n+Declared in \"libtorrent/session.hpp\"\n+The session holds all state that spans multiple torrents. Among other things it\n+runs the network loop and manages all torrents. Once it's created, the session\n+object will spawn the main thread that will do all the work. The main thread\n+will be idle as long it doesn't have any torrents to participate in.\n+You have some control over session configuration through the session_handle::\n+apply_settings() member function. To change one or more configuration options,\n+create a settings_pack. object and fill it with the settings to be set and pass\n+it in to session::apply_settings().\n+see apply_settings().\n+struct session : session_handle\n {\n- data_type type () const;\n- entry (dictionary_type);\n- entry (span);\n- entry (integer_type);\n- entry (preformatted_type);\n- entry (list_type);\n- entry (U v);\n- entry (data_type t);\n- entry (bdecode_node const& n);\n- entry& operator= (dictionary_type) &;\n- entry& operator= (integer_type) &;\n- entry& operator= (bdecode_node const&) &;\n- entry& operator= (entry&&) & noexcept;\n- entry& operator= (span) &;\n- entry& operator= (list_type) &;\n- entry& operator= (entry const&) &;\n- entry& operator= (preformatted_type) &;\n- entry& operator= (U v) &;\n- string_type const& string () const;\n- preformatted_type const& preformatted () const;\n- integer_type& integer ();\n- dictionary_type& dict ();\n- integer_type const& integer () const;\n- dictionary_type const& dict () const;\n- list_type const& list () const;\n- list_type& list ();\n- string_type& string ();\n- preformatted_type& preformatted ();\n- void swap (entry& e);\n- entry const& operator[] (string_view key) const;\n- entry& operator[] (string_view key);\n- entry const* find_key (string_view key) const;\n- entry* find_key (string_view key);\n- std::string to_string (bool single_line = false) const;\n-\n- enum data_type\n- {\n- int_t,\n- string_t,\n- list_t,\n- dictionary_t,\n- undefined_t,\n- preformatted_t,\n- };\n+ explicit session (session_params&& params);\n+ session ();\n+ explicit session (session_params const& params);\n+ session (session_params&& params, session_flags_t flags);\n+ session (session_params const& params, session_flags_t flags);\n+ session (session_params&& params, io_context& ios);\n+ session (session_params const& params, io_context& ios, session_flags_t);\n+ session (session_params&& params, io_context& ios, session_flags_t);\n+ session (session_params const& params, io_context& ios);\n+ ~session ();\n+ session_proxy abort ();\n };\n [report_issue]\n-***** type() *****\n-data_type type () const;\n-returns the concrete type of the entry\n-[report_issue]\n-***** entry() *****\n-entry (dictionary_type);\n-entry (span);\n-entry (integer_type);\n-entry (preformatted_type);\n-entry (list_type);\n-constructors directly from a specific type. The content of the argument is\n-copied into the newly constructed entry\n-[report_issue]\n-***** entry() *****\n-entry (data_type t);\n-construct an empty entry of the specified type. see data_type enum.\n-[report_issue]\n-***** entry() *****\n-entry (bdecode_node const& n);\n-construct from bdecode_node parsed form (see bdecode())\n-[report_issue]\n-***** operator=() *****\n-entry& operator= (dictionary_type) &;\n-entry& operator= (integer_type) &;\n-entry& operator= (bdecode_node const&) &;\n-entry& operator= (entry&&) & noexcept;\n-entry& operator= (span) &;\n-entry& operator= (list_type) &;\n-entry& operator= (entry const&) &;\n-entry& operator= (preformatted_type) &;\n-copies the structure of the right hand side into this entry.\n- [report_issue]\n-***** dict() string() list() integer() preformatted() *****\n-string_type const& string () const;\n-preformatted_type const& preformatted () const;\n-integer_type& integer ();\n-dictionary_type& dict ();\n-integer_type const& integer () const;\n-dictionary_type const& dict () const;\n-list_type const& list () const;\n-list_type& list ();\n-string_type& string ();\n-preformatted_type& preformatted ();\n-The integer(), string(), list() and dict() functions are accessors that return\n-the respective type. If the entry object isn't of the type you request, the\n-accessor will throw system_error. You can ask an entry for its type through the\n-type() function.\n-If you want to create an entry you give it the type you want it to have in its\n-constructor, and then use one of the non-const accessors to get a reference\n-which you then can assign the value you want it to have.\n-The typical code to get info from a torrent file will then look like this:\n-entry torrent_file;\n-// ...\n-\n-// throws if this is not a dictionary\n-entry::dictionary_type const& dict = torrent_file.dict();\n-entry::dictionary_type::const_iterator i;\n-i = dict.find(\"announce\");\n-if (i != dict.end())\n-{\n- std::string tracker_url = i->second.string();\n- std::cout << tracker_url << \"\\n\";\n-}\n-The following code is equivalent, but a little bit shorter:\n-entry torrent_file;\n-// ...\n-\n-// throws if this is not a dictionary\n-if (entry* i = torrent_file.find_key(\"announce\"))\n-{\n- std::string tracker_url = i->string();\n- std::cout << tracker_url << \"\\n\";\n-}\n-To make it easier to extract information from a torrent file, the class\n-torrent_info exists.\n-[report_issue]\n-***** swap() *****\n-void swap (entry& e);\n-swaps the content of this with e.\n-[report_issue]\n-***** operator[]() *****\n-entry const& operator[] (string_view key) const;\n-entry& operator[] (string_view key);\n-All of these functions requires the entry to be a dictionary, if it isn't they\n-will throw system_error.\n-The non-const versions of the operator[] will return a reference to either the\n-existing element at the given key or, if there is no element with the given\n-key, a reference to a newly inserted element at that key.\n-The const version of operator[] will only return a reference to an existing\n-element at the given key. If the key is not found, it will throw system_error.\n-[report_issue]\n-***** find_key() *****\n-entry const* find_key (string_view key) const;\n-entry* find_key (string_view key);\n-These functions requires the entry to be a dictionary, if it isn't they will\n-throw system_error.\n-They will look for an element at the given key in the dictionary, if the\n-element cannot be found, they will return nullptr. If an element with the given\n-key is found, the return a pointer to it.\n+***** session() *****\n+explicit session (session_params&& params);\n+session ();\n+explicit session (session_params const& params);\n+session (session_params&& params, session_flags_t flags);\n+session (session_params const& params, session_flags_t flags);\n+Constructs the session objects which acts as the container of torrents. In\n+order to avoid a race condition between starting the session and configuring\n+it, you can pass in a session_params object. Its settings will take effect\n+before the session starts up.\n+The overloads taking flags can be used to start a session in paused mode (by\n+passing in session::paused). Note that add_default_plugins do not have an\n+affect on constructors that take a session_params object. It already contains\n+the plugins to use.\n [report_issue]\n-***** to_string() *****\n-std::string to_string (bool single_line = false) const;\n-returns a pretty-printed string representation of the bencoded structure, with\n-JSON-style syntax\n+***** session() *****\n+session (session_params&& params, io_context& ios);\n+session (session_params const& params, io_context& ios, session_flags_t);\n+session (session_params&& params, io_context& ios, session_flags_t);\n+session (session_params const& params, io_context& ios);\n+Overload of the constructor that takes an external io_context to run the\n+session object on. This is primarily useful for tests that may want to run\n+multiple sessions on a single io_context, or low resource systems where\n+additional threads are expensive and sharing an io_context with other events is\n+fine.\n+Warning\n+The session object does not cleanly terminate with an external io_context. The\n+io_context::run() call must have returned before it's safe to destruct the\n+session. Which means you MUST call session::abort() and save the session_proxy\n+first, then destruct the session object, then sync with the io_context, then\n+destruct the session_proxy object.\n [report_issue]\n-***** enum data_type *****\n-Declared in \"libtorrent/entry.hpp\"\n- ________________________________\n-|name__________|value|description|\n-|int_t_________|0____|\u00a0_________|\n-|string_t______|1____|\u00a0_________|\n-|list_t________|2____|\u00a0_________|\n-|dictionary_t__|3____|\u00a0_________|\n-|undefined_t___|4____|\u00a0_________|\n-|preformatted_t|5____|\u00a0_________|\n+***** ~session() *****\n+~session ();\n+The destructor of session will notify all trackers that our torrents have been\n+shut down. If some trackers are down, they will time out. All this before the\n+destructor of session returns. So, it's advised that any kind of interface\n+(such as windows) are closed before destructing the session object. Because it\n+can take a few second for it to finish. The timeout can be set with\n+apply_settings().\n [report_issue]\n-****** operator<<() ******\n-Declared in \"libtorrent/entry.hpp\"\n-inline std::ostream& operator<< (std::ostream& os, const entry& e);\n-prints the bencoded structure to the ostream as a JSON-style structure.\n+***** abort() *****\n+session_proxy abort ();\n+In case you want to destruct the session asynchronously, you can request a\n+session destruction proxy. If you don't do this, the destructor of the session\n+object will block while the trackers are contacted. If you keep one\n+session_proxy to the session when destructing it, the destructor will not\n+block, but start to close down the session, the destructor of the proxy will\n+then synchronize the threads. So, the destruction of the session is performed\n+from the session destructor call until the session_proxy destructor call. The\n+session_proxy does not have any operations on it (since the session is being\n+closed down, no operations are allowed on it). The only valid operation is\n+calling the destructor:\n+struct session_proxy {};\n [report_issue]\n-****** bencode() ******\n-Declared in \"libtorrent/bencode.hpp\"\n-template int bencode (OutIt out, const entry& e);\n-This function will encode data to bencoded form.\n-The entry class is the internal representation of the bencoded data and it can\n-be used to retrieve information, an entry can also be build by the program and\n-given to bencode() to encode it into the OutIt iterator.\n-OutIt is an OutputIterator. It's a template and usually instantiated as\n-ostream_iterator or back_insert_iterator. This function assumes the value_type\n-of the iterator is a char. In order to encode entry e into a buffer, do:\n-std::vector buffer;\n-bencode(std::back_inserter(buf), e);\n-The disk I/O can be customized in libtorrent. In previous versions, the\n-customization was at the level of each torrent. Now, the customization point is\n-at the session level. All torrents added to a session will use the same disk I/\n-O subsystem, as determined by the disk_io_constructor (in session_params).\n-This allows the disk subsystem to also customize threading and disk job\n-management.\n-To customize the disk subsystem, implement disk_interface and provide a factory\n-function to the session constructor (via session_params).\n-Example use:\n-struct temp_storage\n-{\n- explicit temp_storage(lt::file_storage const& fs) : m_files(fs) {}\n-\n- lt::span readv(lt::peer_request const r, lt::storage_error& ec)\n-const\n- {\n- auto const i = m_file_data.find(r.piece);\n- if (i == m_file_data.end())\n- {\n- ec.operation = lt::operation_t::file_read;\n- ec.ec = boost::asio::error::eof;\n- return {};\n- }\n- if (int(i->second.size()) <= r.start)\n- {\n- ec.operation = lt::operation_t::file_read;\n- ec.ec = boost::asio::error::eof;\n- return {};\n- }\n- return { i->second.data() + r.start, std::min(r.length, int(i->second.size\n-()) - r.start) };\n- }\n- void writev(lt::span const b, lt::piece_index_t const piece, int\n-const offset)\n- {\n- auto& data = m_file_data[piece];\n- if (data.empty())\n- {\n- // allocate the whole piece, otherwise we'll invalidate the pointers\n- // we have returned back to libtorrent\n- int const size = piece_size(piece);\n- data.resize(std::size_t(size));\n- }\n- TORRENT_ASSERT(offset + b.size() <= int(data.size()));\n- std::memcpy(data.data() + offset, b.data(), std::size_t(b.size()));\n- }\n- lt::sha1_hash hash(lt::piece_index_t const piece\n- , lt::span const block_hashes, lt::storage_error& ec)\n-const\n- {\n- auto const i = m_file_data.find(piece);\n- if (i == m_file_data.end())\n- {\n- ec.operation = lt::operation_t::file_read;\n- ec.ec = boost::asio::error::eof;\n- return {};\n- }\n- if (!block_hashes.empty())\n- {\n- int const piece_size2 = m_files.piece_size2(piece);\n- int const blocks_in_piece2 = m_files.blocks_in_piece2(piece);\n- char const* buf = i->second.data();\n- std::int64_t offset = 0;\n- for (int k = 0; k < blocks_in_piece2; ++k)\n- {\n- lt::hasher256 h2;\n- std::ptrdiff_t const len2 = std::min(lt::default_block_size, int\n-(piece_size2 - offset));\n- h2.update({ buf, len2 });\n- buf += len2;\n- offset += len2;\n- block_hashes[k] = h2.final();\n- }\n- }\n- return lt::hasher(i->second).final();\n- }\n- lt::sha256_hash hash2(lt::piece_index_t const piece, int const offset, lt::\n-storage_error& ec)\n- {\n- auto const i = m_file_data.find(piece);\n- if (i == m_file_data.end())\n- {\n- ec.operation = lt::operation_t::file_read;\n- ec.ec = boost::asio::error::eof;\n- return {};\n- }\n-\n- int const piece_size = m_files.piece_size2(piece);\n-\n- std::ptrdiff_t const len = std::min(lt::default_block_size, piece_size -\n-offset);\n-\n- lt::span b = {i->second.data() + offset, len};\n- return lt::hasher256(b).final();\n- }\n-\n-private:\n- int piece_size(lt::piece_index_t piece) const\n- {\n- int const num_pieces = static_cast((m_files.total_size() +\n-m_files.piece_length() - 1) / m_files.piece_length());\n- return static_cast(piece) < num_pieces - 1\n- ? m_files.piece_length() : static_cast(m_files.total_size() - std::\n-int64_t(num_pieces - 1) * m_files.piece_length());\n- }\n-\n- lt::file_storage const& m_files;\n- std::map> m_file_data;\n-};\n-\n-lt::storage_index_t pop(std::vector& q)\n-{\n- TORRENT_ASSERT(!q.empty());\n- lt::storage_index_t const ret = q.back();\n- q.pop_back();\n- return ret;\n-}\n-\n-struct temp_disk_io final : lt::disk_interface\n- , lt::buffer_allocator_interface\n+****** session_params ******\n+Declared in \"libtorrent/session_params.hpp\"\n+The session_params is a parameters pack for configuring the session before it's\n+started.\n+struct session_params\n {\n- explicit temp_disk_io(lt::io_context& ioc): m_ioc(ioc) {}\n-\n- void settings_updated() override {}\n-\n- lt::storage_holder new_torrent(lt::storage_params const& params\n- , std::shared_ptr const&) override\n- {\n- lt::storage_index_t const idx = m_free_slots.empty()\n- ? m_torrents.end_index()\n- : pop(m_free_slots);\n- auto storage = std::make_unique(params.files);\n- if (idx == m_torrents.end_index()) m_torrents.emplace_back(std::move\n-(storage));\n- else m_torrents[idx] = std::move(storage);\n- return lt::storage_holder(idx, *this);\n- }\n-\n- void remove_torrent(lt::storage_index_t const idx) override\n- {\n- m_torrents[idx].reset();\n- m_free_slots.push_back(idx);\n- }\n-\n- void abort(bool) override {}\n-\n- void async_read(lt::storage_index_t storage, lt::peer_request const& r\n- , std::function handler\n- , lt::disk_job_flags_t) override\n- {\n- // this buffer is owned by the storage. It will remain valid for as\n- // long as the torrent remains in the session. We don't need any lifetime\n- // management of it.\n- lt::storage_error error;\n- lt::span b = m_torrents[storage]->readv(r, error);\n-\n- post(m_ioc, [handler, error, b, this]\n- { handler(lt::disk_buffer_holder(*this, const_cast(b.data()), int\n-(b.size())), error); });\n- }\n-\n- bool async_write(lt::storage_index_t storage, lt::peer_request const& r\n- , char const* buf, std::shared_ptr\n- , std::function handler\n- , lt::disk_job_flags_t) override\n- {\n- lt::span const b = { buf, r.length };\n-\n- m_torrents[storage]->writev(b, r.piece, r.start);\n-\n- post(m_ioc, [=]{ handler(lt::storage_error()); });\n- return false;\n- }\n-\n- void async_hash(lt::storage_index_t storage, lt::piece_index_t const piece\n- , lt::span block_hashes, lt::disk_job_flags_t\n- , std::function handler) override\n- {\n- lt::storage_error error;\n- lt::sha1_hash const hash = m_torrents[storage]->hash(piece, block_hashes,\n-error);\n- post(m_ioc, [=]{ handler(piece, hash, error); });\n- }\n-\n- void async_hash2(lt::storage_index_t storage, lt::piece_index_t const piece\n- , int const offset, lt::disk_job_flags_t\n- , std::function handler) override\n- {\n- lt::storage_error error;\n- lt::sha256_hash const hash = m_torrents[storage]->hash2(piece, offset,\n-error);\n- post(m_ioc, [=]{ handler(piece, hash, error); });\n- }\n-\n- void async_move_storage(lt::storage_index_t, std::string p, lt::move_flags_t\n- , std::function handler) override\n- {\n- post(m_ioc, [=]{\n- handler(lt::status_t::fatal_disk_error, p\n- , lt::storage_error(lt::error_code(boost::system::errc::\n-operation_not_supported, lt::system_category())));\n- });\n- }\n-\n- void async_release_files(lt::storage_index_t, std::function) override\n-{}\n-\n- void async_delete_files(lt::storage_index_t, lt::remove_flags_t\n- , std::function handler) override\n- {\n- post(m_ioc, [=]{ handler(lt::storage_error()); });\n- }\n-\n- void async_check_files(lt::storage_index_t\n- , lt::add_torrent_params const*\n- , lt::aux::vector\n- , std::function handler)\n-override\n- {\n- post(m_ioc, [=]{ handler(lt::status_t::no_error, lt::storage_error()); });\n- }\n-\n- void async_rename_file(lt::storage_index_t\n- , lt::file_index_t const idx\n- , std::string const name\n- , std::function handler) override\n- {\n- post(m_ioc, [=]{ handler(name, idx, lt::storage_error()); });\n- }\n-\n- void async_stop_torrent(lt::storage_index_t, std::function handler)\n-override\n- {\n- post(m_ioc, handler);\n- }\n-\n- void async_set_file_priority(lt::storage_index_t\n- , lt::aux::vector prio\n- , std::function)> handler)\n-override\n- {\n- post(m_ioc, [=]{\n- handler(lt::storage_error(lt::error_code(\n- boost::system::errc::operation_not_supported, lt::system_category())),\n-std::move(prio));\n- });\n- }\n-\n- void async_clear_piece(lt::storage_index_t, lt::piece_index_t index\n- , std::function handler) override\n- {\n- post(m_ioc, [=]{ handler(index); });\n- }\n-\n- // implements buffer_allocator_interface\n- void free_disk_buffer(char*) override\n- {\n- // never free any buffer. We only return buffers owned by the storage\n- // object\n- }\n-\n- void update_stats_counters(lt::counters&) const override {}\n-\n- std::vector get_status(lt::storage_index_t) const\n-override\n- { return {}; }\n-\n- void submit_jobs() override {}\n-\n-private:\n-\n- lt::aux::vector, lt::storage_index_t>\n-m_torrents;\n-\n- // slots that are unused in the m_torrents vector\n- std::vector m_free_slots;\n-\n- // callbacks are posted on this\n- lt::io_context& m_ioc;\n-};\n+ session_params (settings_pack const& sp);\n+ session_params (settings_pack&& sp);\n+ session_params ();\n+ session_params (settings_pack&& sp\n+ , std::vector> exts);\n+ session_params (settings_pack const& sp\n+ , std::vector> exts);\n \n-std::unique_ptr temp_disk_constructor(\n- lt::io_context& ioc, lt::settings_interface const&, lt::counters&)\n-{\n- return std::make_unique(ioc);\n-}\n-[report_issue]\n-****** disk_observer ******\n-Declared in \"libtorrent/disk_observer.hpp\"\n-struct disk_observer\n-{\n- virtual void on_disk () = 0;\n-};\n-[report_issue]\n-***** on_disk() *****\n-virtual void on_disk () = 0;\n-called when the disk cache size has dropped below the low watermark again and\n-we can resume downloading from peers\n-[report_issue]\n-****** settings_interface ******\n-Declared in \"libtorrent/settings_pack.hpp\"\n-the common interface to settings_pack and the internal representation of\n-settings.\n-struct settings_interface\n-{\n- virtual void set_str (int name, std::string val) = 0;\n- virtual void set_int (int name, int val) = 0;\n- virtual bool has_val (int name) const = 0;\n- virtual void set_bool (int name, bool val) = 0;\n- virtual bool get_bool (int name) const = 0;\n- virtual int get_int (int name) const = 0;\n- virtual std::string const& get_str (int name) const = 0;\n-};\n-[report_issue]\n-****** buffer_allocator_interface ******\n-Declared in \"libtorrent/disk_buffer_holder.hpp\"\n-the interface for freeing disk buffers, used by the disk_buffer_holder. when\n-implementing disk_interface, this must also be implemented in order to return\n-disk buffers back to libtorrent\n-struct buffer_allocator_interface\n-{\n- virtual void free_disk_buffer (char* b) = 0;\n-};\n-[report_issue]\n-****** disk_buffer_holder ******\n-Declared in \"libtorrent/disk_buffer_holder.hpp\"\n-The disk buffer holder acts like a unique_ptr that frees a disk buffer when\n-it's destructed\n-If this buffer holder is moved-from, default constructed or reset, data() will\n-return nullptr.\n-struct disk_buffer_holder\n-{\n- disk_buffer_holder (disk_buffer_holder&&) noexcept;\n- disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;\n- disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;\n- disk_buffer_holder (disk_buffer_holder const&) = delete;\n- disk_buffer_holder (buffer_allocator_interface& alloc\n- , char* buf, int sz) noexcept;\n- disk_buffer_holder () noexcept = default;\n- ~disk_buffer_holder ();\n- char* data () const noexcept;\n- void reset ();\n- void swap (disk_buffer_holder& h) noexcept;\n- bool is_mutable () const noexcept;\n- explicit operator bool () const noexcept;\n- std::ptrdiff_t size () const;\n+ settings_pack settings;\n+ std::vector> extensions;\n+ dht::dht_state dht_state;\n+ dht::dht_storage_constructor_type dht_storage_constructor;\n+ disk_io_constructor_type disk_io_constructor;\n+ std::map ext_state;\n+ libtorrent::ip_filter ip_filter;\n };\n [report_issue]\n-***** disk_buffer_holder() *****\n-disk_buffer_holder (buffer_allocator_interface& alloc\n- , char* buf, int sz) noexcept;\n-construct a buffer holder that will free the held buffer using a disk buffer\n-pool directly (there's only one disk_buffer_pool per session)\n-[report_issue]\n-***** disk_buffer_holder() *****\n-disk_buffer_holder () noexcept = default;\n-default construct a holder that does not own any buffer\n-[report_issue]\n-***** ~disk_buffer_holder() *****\n-~disk_buffer_holder ();\n-frees disk buffer held by this object\n-[report_issue]\n-***** data() *****\n-char* data () const noexcept;\n-return a pointer to the held buffer, if any. Otherwise returns nullptr.\n+***** session_params() *****\n+session_params (settings_pack const& sp);\n+session_params (settings_pack&& sp);\n+session_params ();\n+This constructor can be used to start with the default plugins (ut_metadata,\n+ut_pex and smart_ban). Pass a settings_pack to set the initial settings when\n+the session starts.\n [report_issue]\n-***** reset() *****\n-void reset ();\n-free the held disk buffer, if any, and clear the holder. This sets the holder\n-object to a default-constructed state\n+***** session_params() *****\n+session_params (settings_pack&& sp\n+ , std::vector> exts);\n+session_params (settings_pack const& sp\n+ , std::vector> exts);\n+This constructor helps to configure the set of initial plugins to be added to\n+the session before it's started.\n [report_issue]\n-***** swap() *****\n-void swap (disk_buffer_holder& h) noexcept;\n-swap pointers of two disk buffer holders.\n+ settings\n+ The settings to configure the session with\n [report_issue]\n-***** is_mutable() *****\n-bool is_mutable () const noexcept;\n-if this returns true, the buffer may not be modified in place\n+ extensions\n+ the plugins to add to the session as it is constructed\n [report_issue]\n-***** bool() *****\n-explicit operator bool () const noexcept;\n-implicitly convertible to true if the object is currently holding a buffer\n+ dht_state\n+ DHT node ID and node addresses to bootstrap the DHT with.\n [report_issue]\n-****** open_file_state ******\n-Declared in \"libtorrent/disk_interface.hpp\"\n-this contains information about a file that's currently open by the libtorrent\n-disk I/O subsystem. It's associated with a single torrent.\n-struct open_file_state\n-{\n- file_index_t file_index;\n- file_open_mode_t open_mode;\n- time_point last_use;\n-};\n+ dht_storage_constructor\n+ function object to construct the storage object for DHT items.\n [report_issue]\n- file_index\n- the index of the file this entry refers to into the file_storage file\n- list of this torrent. This starts indexing at 0.\n+ disk_io_constructor\n+ function object to create the disk I/O subsystem. Defaults to\n+ default_disk_io_constructor.\n [report_issue]\n- open_mode\n- open_mode is a bitmask of the file flags this file is currently opened\n- with. For possible flags, see file_open_mode_t.\n- Note that the read/write mode is not a bitmask. The two least significant\n- bits are used to represent the read/write mode. Those bits can be masked\n- out using the rw_mask constant.\n+ ext_state\n+ this container can be used by extensions/plugins to store settings. It's\n+ primarily here to make it convenient to save and restore state across\n+ sessions, using read_session_params() and write_session_params().\n [report_issue]\n- last_use\n- a (high precision) timestamp of when the file was last used.\n+ ip_filter\n+ the IP filter to use for the session. This restricts which peers are\n+ allowed to connect. As if passed to set_ip_filter().\n [report_issue]\n-****** disk_interface ******\n-Declared in \"libtorrent/disk_interface.hpp\"\n-The disk_interface is the customization point for disk I/O in libtorrent.\n-implement this interface and provide a factory function to the session\n-constructor use custom disk I/O. All functions on the disk subsystem\n-(implementing disk_interface) are called from within libtorrent's network\n-thread. For disk I/O to be performed in a separate thread, the disk subsystem\n-has to manage that itself.\n-Although the functions are called async_*, they do not technically have to be\n-asynchronous, but they support being asynchronous, by expecting the result\n-passed back into a callback. The callbacks must be posted back onto the network\n-thread via the io_context object passed into the constructor. The callbacks\n-will be run in the network thread.\n-struct disk_interface\n+****** session_handle ******\n+Declared in \"libtorrent/session_handle.hpp\"\n+this class provides a non-owning handle to a session and a subset of the\n+interface of the session class. If the underlying session is destructed any\n+handle to it will no longer be valid. is_valid() will return false and any\n+operation on it will throw a system_error exception, with error code\n+invalid_session_handle.\n+struct session_handle\n {\n- virtual storage_holder new_torrent (storage_params const& p\n- , std::shared_ptr const& torrent) = 0;\n- virtual void remove_torrent (storage_index_t) = 0;\n- virtual void async_read (storage_index_t storage, peer_request const& r\n- , std::function handler\n- , disk_job_flags_t flags = {}) = 0;\n- virtual bool async_write (storage_index_t storage, peer_request const& r\n- , char const* buf, std::shared_ptr o\n- , std::function handler\n- , disk_job_flags_t flags = {}) = 0;\n- virtual void async_hash (storage_index_t storage, piece_index_t piece,\n-span v2\n- , disk_job_flags_t flags\n- , std::function handler) = 0;\n- virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int\n-offset, disk_job_flags_t flags\n- , std::function handler) = 0;\n- virtual void async_move_storage (storage_index_t storage, std::string p,\n-move_flags_t flags\n- , std::function\n-handler) = 0;\n- virtual void async_release_files (storage_index_t storage\n- , std::function handler = std::function()) = 0;\n- virtual void async_check_files (storage_index_t storage\n- , add_torrent_params const* resume_data\n- , aux::vector links\n- , std::function handler) = 0;\n- virtual void async_stop_torrent (storage_index_t storage\n- , std::function handler = std::function()) = 0;\n- virtual void async_rename_file (storage_index_t storage\n- , file_index_t index, std::string name\n- , std::function handler) = 0;\n- virtual void async_delete_files (storage_index_t storage, remove_flags_t\n-options\n- , std::function handler) = 0;\n- virtual void async_set_file_priority (storage_index_t storage\n- , aux::vector prio\n- , std::function)> handler) = 0;\n- virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n- , std::function handler) = 0;\n- virtual void update_stats_counters (counters& c) const = 0;\n- virtual std::vector get_status (storage_index_t) const = 0;\n- virtual void abort (bool wait) = 0;\n- virtual void submit_jobs () = 0;\n- virtual void settings_updated () = 0;\n+ bool is_valid () const;\n+ session_params session_state (save_state_flags_t flags =\n+save_state_flags_t::all()) const;\n+ void refresh_torrent_status (std::vector* ret\n+ , status_flags_t flags = {}) const;\n+ std::vector get_torrent_status (\n+ std::function const& pred\n+ , status_flags_t flags = {}) const;\n+ void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n+ void post_session_stats ();\n+ void post_dht_stats ();\n+ void set_dht_state (dht::dht_state const& st);\n+ void set_dht_state (dht::dht_state&& st);\n+ torrent_handle find_torrent (sha1_hash const& info_hash) const;\n+ std::vector get_torrents () const;\n+ torrent_handle add_torrent (add_torrent_params const& params, error_code&\n+ec);\n+ void async_add_torrent (add_torrent_params&& params);\n+ void async_add_torrent (add_torrent_params const& params);\n+ torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n+ torrent_handle add_torrent (add_torrent_params const& params);\n+ torrent_handle add_torrent (add_torrent_params&& params);\n+ void pause ();\n+ void resume ();\n+ bool is_paused () const;\n+ bool is_dht_running () const;\n+ void set_dht_storage (dht::dht_storage_constructor_type sc);\n+ void add_dht_node (std::pair const& node);\n+ void dht_get_item (sha1_hash const& target);\n+ void dht_get_item (std::array key\n+ , std::string salt = std::string());\n+ sha1_hash dht_put_item (entry data);\n+ void dht_put_item (std::array key\n+ , std::function&\n+ , std::int64_t&, std::string const&)> cb\n+ , std::string salt = std::string());\n+ void dht_announce (sha1_hash const& info_hash, int port = 0, dht::\n+announce_flags_t flags = {});\n+ void dht_get_peers (sha1_hash const& info_hash);\n+ void dht_live_nodes (sha1_hash const& nid);\n+ void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const&\n+target);\n+ void dht_direct_request (udp::endpoint const& ep, entry const& e,\n+client_data_t userdata = {});\n+ void add_extension (std::shared_ptr ext);\n+ void add_extension (std::function(\n+ torrent_handle const&, client_data_t)> ext);\n+ ip_filter get_ip_filter () const;\n+ void set_ip_filter (ip_filter f);\n+ void set_port_filter (port_filter const& f);\n+ unsigned short ssl_listen_port () const;\n+ unsigned short listen_port () const;\n+ bool is_listening () const;\n+ ip_filter get_peer_class_filter () const;\n+ void set_peer_class_filter (ip_filter const& f);\n+ void set_peer_class_type_filter (peer_class_type_filter const& f);\n+ peer_class_type_filter get_peer_class_type_filter () const;\n+ peer_class_t create_peer_class (char const* name);\n+ void delete_peer_class (peer_class_t cid);\n+ void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n+ peer_class_info get_peer_class (peer_class_t cid) const;\n+ void remove_torrent (const torrent_handle&, remove_flags_t = {});\n+ void apply_settings (settings_pack&&);\n+ settings_pack get_settings () const;\n+ void apply_settings (settings_pack const&);\n+ alert* wait_for_alert (time_duration max_wait);\n+ void set_alert_notify (std::function const& fun);\n+ void pop_alerts (std::vector* alerts);\n+ void delete_port_mapping (port_mapping_t handle);\n+ std::vector add_port_mapping (portmap_protocol t, int\n+external_port, int local_port);\n+ void reopen_network_sockets (reopen_network_flags_t options =\n+reopen_map_ports);\n+ std::shared_ptr native_handle () const;\n \n- static constexpr disk_job_flags_t force_copy = 0_bit;\n- static constexpr disk_job_flags_t sequential_access = 3_bit;\n- static constexpr disk_job_flags_t volatile_read = 4_bit;\n- static constexpr disk_job_flags_t v1_hash = 5_bit;\n- static constexpr disk_job_flags_t flush_piece = 7_bit;\n+ static constexpr save_state_flags_t save_settings = 0_bit;\n+ static constexpr save_state_flags_t save_dht_state = 2_bit;\n+ static constexpr save_state_flags_t save_extension_state = 11_bit;\n+ static constexpr save_state_flags_t save_ip_filter = 12_bit;\n+ static constexpr peer_class_t global_peer_class_id {0};\n+ static constexpr peer_class_t tcp_peer_class_id {1};\n+ static constexpr peer_class_t local_peer_class_id {2};\n+ static constexpr remove_flags_t delete_files = 0_bit;\n+ static constexpr remove_flags_t delete_partfile = 1_bit;\n+ static constexpr session_flags_t paused = 2_bit;\n+ static constexpr portmap_protocol udp = portmap_protocol::udp;\n+ static constexpr portmap_protocol tcp = portmap_protocol::tcp;\n+ static constexpr reopen_network_flags_t reopen_map_ports = 0_bit;\n };\n [report_issue]\n-***** new_torrent() *****\n-virtual storage_holder new_torrent (storage_params const& p\n- , std::shared_ptr const& torrent) = 0;\n-this is called when a new torrent is added. The shared_ptr can be used to hold\n-the internal torrent object alive as long as there are outstanding disk\n-operations on the storage. The returned storage_holder is an owning reference\n-to the underlying storage that was just created. It is fundamentally a\n-storage_index_t\n+***** is_valid() *****\n+bool is_valid () const;\n+returns true if this handle refers to a valid session object. If the session\n+has been destroyed, all session_handle objects will expire and not be valid.\n [report_issue]\n-***** remove_torrent() *****\n-virtual void remove_torrent (storage_index_t) = 0;\n-remove the storage with the specified index. This is not expected to delete any\n-files from disk, just to clean up any resources associated with the specified\n-storage.\n+***** session_state() *****\n+session_params session_state (save_state_flags_t flags = save_state_flags_t::\n+all()) const;\n+returns the current session state. This can be passed to write_session_params()\n+to save the state to disk and restored using read_session_params() when\n+constructing a new session. The kind of state that's included is all settings,\n+the DHT routing table, possibly plugin-specific state. the flags parameter can\n+be used to only save certain parts of the session state\n [report_issue]\n-***** async_read() async_write() *****\n-virtual void async_read (storage_index_t storage, peer_request const& r\n- , std::function handler\n- , disk_job_flags_t flags = {}) = 0;\n-virtual bool async_write (storage_index_t storage, peer_request const& r\n- , char const* buf, std::shared_ptr o\n- , std::function handler\n- , disk_job_flags_t flags = {}) = 0;\n-perform a read or write operation from/to the specified storage index and the\n-specified request. When the operation completes, call handler possibly with a\n-disk_buffer_holder, holding the buffer with the result. Flags may be set to\n-affect the read operation. See disk_job_flags_t.\n-The disk_observer is a callback to indicate that the store buffer/disk write\n-queue is below the watermark to let peers start writing buffers to disk again.\n-When async_write() returns true, indicating the write queue is full, the peer\n-will stop further writes and wait for the passed-in disk_observer to be\n-notified before resuming.\n-Note that for async_read, the peer_request (r) is not necessarily aligned to\n-blocks (but it is most of the time). However, all writes (passed to\n-async_write) are guaranteed to be block aligned.\n-[report_issue]\n-***** async_hash() *****\n-virtual void async_hash (storage_index_t storage, piece_index_t piece,\n-span v2\n- , disk_job_flags_t flags\n- , std::function handler) = 0;\n-Compute hash(es) for the specified piece. Unless the v1_hash flag is set (in\n-flags), the SHA-1 hash of the whole piece does not need to be computed.\n-Thev2span is optional and can be empty, which means v2 hashes should not be\n-computed. If v2 is non-empty it must be at least large enough to hold all v2\n-blocks in the piece, and this function will fill in the span with the SHA-256\n-block hashes of the piece.\n-[report_issue]\n-***** async_hash2() *****\n-virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int\n-offset, disk_job_flags_t flags\n- , std::function handler) = 0;\n-computes the v2 hash (SHA-256) of a single block. The block at offset in piece\n-piece.\n-[report_issue]\n-***** async_move_storage() *****\n-virtual void async_move_storage (storage_index_t storage, std::string p,\n-move_flags_t flags\n- , std::function\n-handler) = 0;\n-called to request the files for the specified storage/torrent be moved to a new\n-location. It is the disk I/O object's responsibility to synchronize this with\n-any currently outstanding disk operations to the storage. Whether files are\n-replaced at the destination path or not is controlled by flags (see\n-move_flags_t).\n-[report_issue]\n-***** async_release_files() *****\n-virtual void async_release_files (storage_index_t storage\n- , std::function handler = std::function()) = 0;\n-This is called on disk I/O objects to request they close all open files for the\n-specified storage/torrent. If file handles are not pooled/cached, it can be a\n-no-op. For truly asynchronous disk I/O, this should provide at least one point\n-in time when all files are closed. It is possible that later asynchronous\n-operations will re-open some of the files, by the time this completion handler\n-is called, that's fine.\n-[report_issue]\n-***** async_check_files() *****\n-virtual void async_check_files (storage_index_t storage\n- , add_torrent_params const* resume_data\n- , aux::vector links\n- , std::function handler) = 0;\n-this is called when torrents are added to validate their resume data against\n-the files on disk. This function is expected to do a few things:\n-if links is non-empty, it contains a string for each file in the torrent. The\n-string being a path to an existing identical file. The default behavior is to\n-create hard links of those files into the storage of the new torrent (specified\n-by storage). An empty string indicates that there is no known identical file.\n-This is part of the \"mutable torrent\" feature, where files can be reused from\n-other torrents.\n-The resume_data points the resume data passed in by the client.\n-If the resume_data->flags field has the seed_mode flag set, all files/pieces\n-are expected to be on disk already. This should be verified. Not just the\n-existence of the file, but also that it has the correct size.\n-Any file with a piece set in the resume_data->have_pieces bitmask should exist\n-on disk, this should be verified. Pad files and files with zero priority may be\n-skipped.\n-[report_issue]\n-***** async_stop_torrent() *****\n-virtual void async_stop_torrent (storage_index_t storage\n- , std::function handler = std::function()) = 0;\n-This is called when a torrent is stopped. It gives the disk I/O object an\n-opportunity to flush any data to disk that's currently kept cached. This\n-function should at least do the same thing as async_release_files().\n-[report_issue]\n-***** async_rename_file() *****\n-virtual void async_rename_file (storage_index_t storage\n- , file_index_t index, std::string name\n- , std::function handler) = 0;\n-This function is called when the name of a file in the specified storage has\n-been requested to be renamed. The disk I/O object is responsible for renaming\n-the file without racing with other potentially outstanding operations against\n-the file (such as read, write, move, etc.).\n-[report_issue]\n-***** async_delete_files() *****\n-virtual void async_delete_files (storage_index_t storage, remove_flags_t\n-options\n- , std::function handler) = 0;\n-This function is called when some file(s) on disk have been requested to be\n-removed by the client. storage indicates which torrent is referred to. See\n-session_handle for remove_flags_t flags indicating which files are to be\n-removed. e.g. session_handle::delete_files - delete all files session_handle::\n-delete_partfile - only delete part file.\n-[report_issue]\n-***** async_set_file_priority() *****\n-virtual void async_set_file_priority (storage_index_t storage\n- , aux::vector prio\n- , std::function)> handler) = 0;\n-This is called to set the priority of some or all files. Changing the priority\n-from or to 0 may involve moving data to and from the partfile. The disk I/\n-O object is responsible for correctly synchronizing this work to not race with\n-any potentially outstanding asynchronous operations affecting these files.\n-prio is a vector of the file priority for all files. If it's shorter than the\n-total number of files in the torrent, they are assumed to be set to the default\n-priority.\n-[report_issue]\n-***** async_clear_piece() *****\n-virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n- , std::function handler) = 0;\n-This is called when a piece fails the hash check, to ensure there are no\n-outstanding disk operations to the piece before blocks are re-requested from\n-peers to overwrite the existing blocks. The disk I/O object does not need to\n-perform any action other than synchronize with all outstanding disk operations\n-to the specified piece before posting the result back.\n-[report_issue]\n-***** update_stats_counters() *****\n-virtual void update_stats_counters (counters& c) const = 0;\n-update_stats_counters() is called to give the disk storage an opportunity to\n-update gauges in the c stats counters, that aren't updated continuously as\n-operations are performed. This is called before a snapshot of the counters are\n-passed to the client.\n-[report_issue]\n-***** get_status() *****\n-virtual std::vector get_status (storage_index_t) const = 0;\n-Return a list of all the files that are currently open for the specified\n-storage/torrent. This is is just used for the client to query the currently\n-open files, and which modes those files are open in.\n-[report_issue]\n-***** abort() *****\n-virtual void abort (bool wait) = 0;\n-this is called when the session is starting to shut down. The disk I/O object\n-is expected to flush any outstanding write jobs, cancel hash jobs and initiate\n-tearing down of any internal threads. If wait is true, this should be\n-asynchronous. i.e. this call should not return until all threads have stopped\n-and all jobs have either been aborted or completed and the disk I/O object is\n-ready to be destructed.\n-[report_issue]\n-***** submit_jobs() *****\n-virtual void submit_jobs () = 0;\n-This will be called after a batch of disk jobs has been issues (via the async_*\n-). It gives the disk I/O object an opportunity to notify any potential\n-condition variables to wake up the disk thread(s). The async_* calls can of\n-course also notify condition variables, but doing it in this call allows for\n-batching jobs, by issuing the notification once for a collection of jobs.\n-[report_issue]\n-***** settings_updated() *****\n-virtual void settings_updated () = 0;\n-This is called to notify the disk I/O object that the settings have been\n-updated. In the disk io constructor, a settings_interface reference is passed\n-in. Whenever these settings are updated, this function is called to allow the\n-disk I/O object to react to any changed settings relevant to its operations.\n-[report_issue]\n- force_copy\n- force making a copy of the cached block, rather than getting a reference\n- to a block already in the cache. This is used the block is expected to be\n- overwritten very soon, by async_write()`, and we need access to the\n- previous content.\n-[report_issue]\n- sequential_access\n- hint that there may be more disk operations with sequential access to the\n- file\n-[report_issue]\n- volatile_read\n- don't keep the read block in cache. This is a hint that this block is\n- unlikely to be read again anytime soon, and caching it would be wasteful.\n-[report_issue]\n- v1_hash\n- compute a v1 piece hash. This is only used by the async_hash() call. If\n- this flag is not set in the async_hash() call, the SHA-1 piece hash does\n- not need to be computed.\n+***** refresh_torrent_status() get_torrent_status() *****\n+void refresh_torrent_status (std::vector* ret\n+ , status_flags_t flags = {}) const;\n+std::vector get_torrent_status (\n+ std::function const& pred\n+ , status_flags_t flags = {}) const;\n+Note\n+these calls are potentially expensive and won't scale well with lots of\n+torrents. If you're concerned about performance, consider using\n+post_torrent_updates() instead.\n+get_torrent_status returns a vector of the torrent_status for every torrent\n+which satisfies pred, which is a predicate function which determines if a\n+torrent should be included in the returned set or not. Returning true means it\n+should be included and false means excluded. The flags argument is the same as\n+to torrent_handle::status(). Since pred is guaranteed to be called for every\n+torrent, it may be used to count the number of torrents of different categories\n+as well.\n+refresh_torrent_status takes a vector of torrent_status structs (for instance\n+the same vector that was returned by get_torrent_status() ) and refreshes the\n+status based on the handle member. It is possible to use this function by first\n+setting up a vector of default constructed torrent_status objects, only\n+initializing the handle member, in order to request the torrent status for\n+multiple torrents in a single call. This can save a significant amount of time\n+if you have a lot of torrents.\n+Any torrent_status object whose handle member is not referring to a valid\n+torrent are ignored.\n+The intended use of these functions is to start off by calling\n+get_torrent_status() to get a list of all torrents that match your criteria.\n+Then call refresh_torrent_status() on that list. This will only refresh the\n+status for the torrents in your list, and thus ignore all other torrents you\n+might be running. This may save a significant amount of time, especially if the\n+number of torrents you're interested in is small. In order to keep your list of\n+interested torrents up to date, you can either call get_torrent_status() from\n+time to time, to include torrents you might have become interested in since the\n+last time. In order to stop refreshing a certain torrent, simply remove it from\n+the list.\n [report_issue]\n- flush_piece\n- this flag instructs a hash job that we just completed this piece, and it\n- should be flushed to disk\n+***** post_torrent_updates() *****\n+void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n+This functions instructs the session to post the state_update_alert, containing\n+the status of all torrents whose state changed since the last time this\n+function was called.\n+Only torrents who has the state subscription flag set will be included. This\n+flag is on by default. See add_torrent_params. the flags argument is the same\n+as for torrent_handle::status(). see status_flags_t in torrent_handle.\n [report_issue]\n-****** storage_holder ******\n-Declared in \"libtorrent/disk_interface.hpp\"\n-a unique, owning, reference to the storage of a torrent in a disk io subsystem\n-(class that implements disk_interface). This is held by the internal libtorrent\n-torrent object to tie the storage object allocated for a torrent to the\n-lifetime of the internal torrent object. When a torrent is removed from the\n-session, this holder is destructed and will inform the disk object.\n-struct storage_holder\n-{\n- storage_holder (storage_index_t idx, disk_interface& disk_io);\n- ~storage_holder ();\n- storage_holder () = default;\n- explicit operator bool () const;\n- operator storage_index_t () const;\n- void reset ();\n- storage_holder& operator= (storage_holder const&) = delete;\n- storage_holder (storage_holder const&) = delete;\n- storage_holder (storage_holder&& rhs) noexcept;\n- storage_holder& operator= (storage_holder&& rhs) noexcept;\n-};\n+***** post_session_stats() *****\n+void post_session_stats ();\n+This function will post a session_stats_alert object, containing a snapshot of\n+the performance counters from the internals of libtorrent. To interpret these\n+counters, query the session via session_stats_metrics().\n+For more information, see the session_statistics section.\n [report_issue]\n-****** file_open_mode_t ******\n-Declared in \"libtorrent/disk_interface.hpp\"\n- read_only\n- open the file for reading only\n- write_only\n- open the file for writing only\n- read_write\n- open the file for reading and writing\n- rw_mask\n- the mask for the bits determining read or write mode\n- sparse\n- open the file in sparse mode (if supported by the filesystem).\n- no_atime\n- don't update the access timestamps on the file (if supported by the\n- operating system and filesystem). this generally improves disk\n- performance.\n- random_access\n- open the file for random access. This disables read-ahead logic\n- mmapped\n- the file is memory mapped\n+***** post_dht_stats() *****\n+void post_dht_stats ();\n+This will cause a dht_stats_alert to be posted.\n [report_issue]\n-****** counters ******\n-Declared in \"libtorrent/performance_counters.hpp\"\n-struct counters\n-{\n- counters () ;\n- counters& operator= (counters const&) & ;\n- counters (counters const&) ;\n- std::int64_t operator[] (int i) const ;\n- std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n- void blend_stats_counter (int c, std::int64_t value, int ratio) ;\n- void set_value (int c, std::int64_t value) ;\n-};\n+***** set_dht_state() *****\n+void set_dht_state (dht::dht_state const& st);\n+void set_dht_state (dht::dht_state&& st);\n+set the DHT state for the session. This will be taken into account the next\n+time the DHT is started, as if it had been passed in via the session_params on\n+startup.\n [report_issue]\n-***** inc_stats_counter() operator[]() *****\n-std::int64_t operator[] (int i) const ;\n-std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n-returns the new value\n-[report_issue]\n-****** stats_metric ******\n-Declared in \"libtorrent/session_stats.hpp\"\n-describes one statistics metric from the session. For more information, see the\n-session_statistics section.\n-struct stats_metric\n-{\n- char const* name;\n- int value_index;\n- metric_type_t type;\n-};\n-[report_issue]\n- name\n- the name of the counter or gauge\n+***** find_torrent() get_torrents() *****\n+torrent_handle find_torrent (sha1_hash const& info_hash) const;\n+std::vector get_torrents () const;\n+find_torrent() looks for a torrent with the given info-hash. In case there is\n+such a torrent in the session, a torrent_handle to that torrent is returned. In\n+case the torrent cannot be found, an invalid torrent_handle is returned.\n+See torrent_handle::is_valid() to know if the torrent was found or not.\n+get_torrents() returns a vector of torrent_handles to all the torrents\n+currently in the session.\n [report_issue]\n- value_index type\n- the index into the session stats array, where the underlying value of\n- this counter or gauge is found. The session stats array is part of the\n- session_stats_alert object.\n-[report_issue]\n-****** session_stats_metrics() ******\n-Declared in \"libtorrent/session_stats.hpp\"\n-std::vector session_stats_metrics ();\n-This free function returns the list of available metrics exposed by\n-libtorrent's statistics API. Each metric has a name and a value index. The\n-value index is the index into the array in session_stats_alert where this\n-metric's value can be found when the session stats is sampled (by calling\n-post_session_stats()).\n-[report_issue]\n-****** find_metric_idx() ******\n-Declared in \"libtorrent/session_stats.hpp\"\n-int find_metric_idx (string_view name);\n-given a name of a metric, this function returns the counter index of it, or -\n-1 if it could not be found. The counter index is the index into the values\n-array returned by session_stats_alert.\n-[report_issue]\n-****** enum metric_type_t ******\n-Declared in \"libtorrent/session_stats.hpp\"\n- _________________________\n-|name___|value|description|\n-|counter|0____|\u00a0_________|\n-|gauge__|1____|\u00a0_________|\n-libtorrent has a plugin interface for implementing extensions to the protocol.\n-These can be general extensions for transferring metadata or peer exchange\n-extensions, or it could be used to provide a way to customize the protocol to\n-fit a particular (closed) network.\n-In short, the plugin interface makes it possible to:\n- * register extension messages (sent in the extension handshake), see\n- extensions.\n- * add data and parse data from the extension handshake.\n- * send extension messages and standard bittorrent messages.\n- * override or block the handling of standard bittorrent messages.\n- * save and restore state via the session state\n- * see all alerts that are posted\n-****** a word of caution ******\n-Writing your own plugin is a very easy way to introduce serious bugs such as\n-dead locks and race conditions. Since a plugin has access to internal\n-structures it is also quite easy to sabotage libtorrent's operation.\n-All the callbacks are always called from the libtorrent network thread. In case\n-portions of your plugin are called from other threads, typically the main\n-thread, you cannot use any of the member functions on the internal structures\n-in libtorrent, since those require being called from the libtorrent network\n-thread . Furthermore, you also need to synchronize your own shared data within\n-the plugin, to make sure it is not accessed at the same time from the\n-libtorrent thread (through a callback). If you need to send out a message from\n-another thread, it is advised to use an internal queue, and do the actual\n-sending in tick().\n-Since the plugin interface gives you easy access to internal structures, it is\n-not supported as a stable API. Plugins should be considered specific to a\n-specific version of libtorrent. Although, in practice the internals mostly\n-don't change that dramatically.\n-****** plugin-interface ******\n-The plugin interface consists of three base classes that the plugin may\n-implement. These are called plugin, torrent_plugin and peer_plugin. They are\n-found in the header.\n-These plugins are instantiated for each session, torrent and possibly each\n-peer, respectively.\n-For plugins that only need per torrent state, it is enough to only implement\n-torrent_plugin and pass a constructor function or function object to session::\n-add_extension() or torrent_handle::add_extension() (if the torrent has already\n-been started and you want to hook in the extension at run-time).\n-The signature of the function is:\n-std::shared_ptr (*)(torrent_handle const&, client_data_t);\n-The second argument is the userdata passed to session::add_torrent() or\n-torrent_handle::add_extension().\n-The function should return a std::shared_ptr which may or may\n-not be 0. If it is a nullptr, the extension is simply ignored for this torrent.\n-If it is a valid pointer (to a class inheriting torrent_plugin), it will be\n-associated with this torrent and callbacks will be made on torrent events.\n-For more elaborate plugins which require session wide state, you would\n-implement plugin, construct an object (in a std::shared_ptr) and pass it in to\n-session::add_extension().\n-****** custom alerts ******\n-Since plugins are running within internal libtorrent threads, one convenient\n-way to communicate with the client is to post custom alerts.\n-The expected interface of any alert, apart from deriving from the alert base\n-class, looks like this:\n-static const int alert_type = ;\n-virtual int type() const { return alert_type; }\n-\n-virtual std::string message() const;\n-\n-static const alert_category_t static_category = ;\n-virtual alert_category_t category() const { return static_category; }\n-\n-virtual char const* what() const { return ; }\n-The alert_type is used for the type-checking in alert_cast. It must not collide\n-with any other alert. The built-in alerts in libtorrent will not use alert type\n-IDs greater than user_alert_id. When defining your own alert, make sure it's\n-greater than this constant.\n-type() is the run-time equivalence of the alert_type.\n-The message() virtual function is expected to construct a useful string\n-representation of the alert and the event or data it represents. Something\n-convenient to put in a log file for instance.\n-clone() is used internally to copy alerts. The suggested implementation of\n-simply allocating a new instance as a copy of *this is all that's expected.\n-The static category is required for checking whether or not the category for a\n-specific alert is enabled or not, without instantiating the alert. The category\n-virtual function is the run-time equivalence.\n-The what() virtual function may simply be a string literal of the class name of\n-your alert.\n-For more information, see the alert_section.\n-[report_issue]\n-****** peer_connection_handle ******\n-Declared in \"libtorrent/peer_connection_handle.hpp\"\n-the peer_connection_handle class provides a handle to the internal peer\n-connection object, to be used by plugins. This is a low level interface that\n-may not be stable across libtorrent versions\n-struct peer_connection_handle\n-{\n- explicit peer_connection_handle (std::weak_ptr impl);\n- connection_type type () const;\n- peer_plugin const* find_plugin (string_view type) const;\n- void add_extension (std::shared_ptr);\n- bool is_seed () const;\n- bool upload_only () const;\n- peer_id const& pid () const;\n- bool has_piece (piece_index_t i) const;\n- bool is_interesting () const;\n- bool is_choked () const;\n- bool is_peer_interested () const;\n- bool has_peer_choked () const;\n- void maybe_unchoke_this_peer ();\n- void choke_this_peer ();\n- void get_peer_info (peer_info& p) const;\n- torrent_handle associated_torrent () const;\n- tcp::endpoint const& remote () const;\n- tcp::endpoint local_endpoint () const;\n- bool is_connecting () const;\n- void disconnect (error_code const& ec, operation_t op\n- , disconnect_severity_t = peer_connection_interface::normal);\n- bool is_disconnecting () const;\n- bool is_outgoing () const;\n- bool ignore_unchoke_slots () const;\n- bool on_local_network () const;\n- bool failed () const;\n- bool should_log (peer_log_alert::direction_t direction) const;\n- void peer_log (peer_log_alert::direction_t direction\n- , char const* event, char const* fmt = \"\", ...) const TORRENT_FORMAT\n-(4,5);\n- bool can_disconnect (error_code const& ec) const;\n- bool has_metadata () const;\n- bool in_handshake () const;\n- void send_buffer (char const* begin, int size);\n- time_point time_of_last_unchoke () const;\n- std::time_t last_seen_complete () const;\n- bool operator== (peer_connection_handle const& o) const;\n- bool operator!= (peer_connection_handle const& o) const;\n- bool operator< (peer_connection_handle const& o) const;\n- std::shared_ptr native_handle () const;\n-};\n-[report_issue]\n-****** bt_peer_connection_handle ******\n-Declared in \"libtorrent/peer_connection_handle.hpp\"\n-The bt_peer_connection_handle provides a handle to the internal bittorrent peer\n-connection object to plugins. It's low level and may not be a stable API across\n-libtorrent versions.\n-struct bt_peer_connection_handle : peer_connection_handle\n-{\n- explicit bt_peer_connection_handle (peer_connection_handle pc);\n- bool packet_finished () const;\n- bool support_extensions () const;\n- bool supports_encryption () const;\n- void switch_send_crypto (std::shared_ptr crypto);\n- void switch_recv_crypto (std::shared_ptr crypto);\n- std::shared_ptr native_handle () const;\n-};\n-[report_issue]\n-****** plugin ******\n-Declared in \"libtorrent/extensions.hpp\"\n-this is the base class for a session plugin. One primary feature is that it is\n-notified of all torrents that are added to the session, and can add its own\n-torrent_plugins.\n-struct plugin\n-{\n- virtual feature_flags_t implemented_features ();\n- virtual std::shared_ptr new_torrent (torrent_handle const&,\n-client_data_t);\n- virtual void added (session_handle const&);\n- virtual void abort ();\n- virtual bool on_dht_request (string_view /* query */\n- , udp::endpoint const& /* source */, bdecode_node const& /* message */\n- , entry& /* response */);\n- virtual void on_alert (alert const*);\n- virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n- , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n- virtual void on_tick ();\n- virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer\n-*/);\n- virtual std::map save_state () const;\n- virtual void load_state (std::map const&);\n-\n- static constexpr feature_flags_t optimistic_unchoke_feature = 1_bit;\n- static constexpr feature_flags_t tick_feature = 2_bit;\n- static constexpr feature_flags_t dht_request_feature = 3_bit;\n- static constexpr feature_flags_t alert_feature = 4_bit;\n-};\n-[report_issue]\n-***** implemented_features() *****\n-virtual feature_flags_t implemented_features ();\n-This function is expected to return a bitmask indicating which features this\n-plugin implements. Some callbacks on this object may not be called unless the\n-corresponding feature flag is returned here. Note that callbacks may still be\n-called even if the corresponding feature is not specified in the return value\n-here. See feature_flags_t for possible flags to return.\n-[report_issue]\n-***** new_torrent() *****\n-virtual std::shared_ptr new_torrent (torrent_handle const&,\n-client_data_t);\n-this is called by the session every time a new torrent is added. The torrent*\n-points to the internal torrent object created for the new torrent. The\n-client_data_t is the userdata pointer as passed in via add_torrent_params.\n-If the plugin returns a torrent_plugin instance, it will be added to the new\n-torrent. Otherwise, return an empty shared_ptr to a torrent_plugin (the\n-default).\n-[report_issue]\n-***** added() *****\n-virtual void added (session_handle const&);\n-called when plugin is added to a session\n-[report_issue]\n-***** abort() *****\n-virtual void abort ();\n-called when the session is aborted the plugin should perform any cleanup\n-necessary to allow the session's destruction (e.g. cancel outstanding async\n-operations)\n-[report_issue]\n-***** on_dht_request() *****\n-virtual bool on_dht_request (string_view /* query */\n- , udp::endpoint const& /* source */, bdecode_node const& /* message */\n- , entry& /* response */);\n-called when a dht request is received. If your plugin expects this to be\n-called, make sure to include the flag dht_request_feature in the return value\n-from implemented_features().\n-[report_issue]\n-***** on_alert() *****\n-virtual void on_alert (alert const*);\n-called when an alert is posted alerts that are filtered are not posted. If your\n-plugin expects this to be called, make sure to include the flag alert_feature\n-in the return value from implemented_features().\n-[report_issue]\n-***** on_unknown_torrent() *****\n-virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n- , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n-return true if the add_torrent_params should be added\n-[report_issue]\n-***** on_tick() *****\n-virtual void on_tick ();\n-called once per second. If your plugin expects this to be called, make sure to\n-include the flag tick_feature in the return value from implemented_features().\n-[report_issue]\n-***** get_unchoke_priority() *****\n-virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */\n-);\n-called when choosing peers to optimistically unchoke. The return value\n-indicates the peer's priority for unchoking. Lower return values correspond to\n-higher priority. Priorities above 2^63-1 are reserved. If your plugin has no\n-priority to assign a peer it should return 2^64-1. If your plugin expects this\n-to be called, make sure to include the flag optimistic_unchoke_feature in the\n-return value from implemented_features(). If multiple plugins implement this\n-function the lowest return value (i.e. the highest priority) is used.\n-[report_issue]\n-***** load_state() *****\n-virtual void load_state (std::map const&);\n-called on startup while loading settings state from the session_params\n+***** add_torrent() async_add_torrent() *****\n+torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);\n+void async_add_torrent (add_torrent_params&& params);\n+void async_add_torrent (add_torrent_params const& params);\n+torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n+torrent_handle add_torrent (add_torrent_params const& params);\n+torrent_handle add_torrent (add_torrent_params&& params);\n+You add torrents through the add_torrent() function where you give an object\n+with all the parameters. The add_torrent() overloads will block until the\n+torrent has been added (or failed to be added) and returns an error code and a\n+torrent_handle. In order to add torrents more efficiently, consider using\n+async_add_torrent() which returns immediately, without waiting for the torrent\n+to add. Notification of the torrent being added is sent as add_torrent_alert.\n+The overload that does not take an error_code throws an exception on error and\n+is not available when building without exception support. The torrent_handle\n+returned by add_torrent() can be used to retrieve information about the\n+torrent's progress, its peers etc. It is also used to abort a torrent.\n+If the torrent you are trying to add already exists in the session (is either\n+queued for checking, being checked or downloading) add_torrent() will throw\n+system_error which derives from std::exception unless duplicate_is_error is set\n+to false. In that case, add_torrent() will return the handle to the existing\n+torrent.\n+The add_torrent_params class has a flags field. It can be used to control what\n+state the new torrent will be added in. Common flags to want to control are\n+torrent_flags::paused and torrent_flags::auto_managed. In order to add a magnet\n+link that will just download the metadata, but no payload, set the\n+torrent_flags::upload_mode flag.\n+Special consideration has to be taken when adding hybrid torrents (i.e.\n+torrents that are BitTorrent v2 torrents that are backwards compatible with\n+v1). For more details, see BitTorrent_v2_torrents.\n+ [report_issue]\n+***** pause() is_paused() resume() *****\n+void pause ();\n+void resume ();\n+bool is_paused () const;\n+Pausing the session has the same effect as pausing every torrent in it, except\n+that torrents will not be resumed by the auto-manage mechanism. Resuming will\n+restore the torrents to their previous paused state. i.e. the session pause\n+state is separate from the torrent pause state. A torrent is inactive if it is\n+paused or if the session is paused.\n [report_issue]\n- optimistic_unchoke_feature\n- include this bit if your plugin needs to alter the order of the\n- optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()\n- callback be called.\n+***** is_dht_running() *****\n+bool is_dht_running () const;\n+is_dht_running() returns true if the DHT support has been started and false\n+otherwise.\n [report_issue]\n- tick_feature\n- include this bit if your plugin needs to have on_tick() called\n+***** set_dht_storage() *****\n+void set_dht_storage (dht::dht_storage_constructor_type sc);\n+set_dht_storage set a dht custom storage constructor function to be used\n+internally when the dht is created.\n+Since the dht storage is a critical component for the dht behavior, this\n+function will only be effective the next time the dht is started. If you never\n+touch this feature, a default map-memory based storage is used.\n+If you want to make sure the dht is initially created with your custom storage,\n+create a session with the setting settings_pack::enable_dht to false, set your\n+constructor function and call apply_settings with settings_pack::enable_dht to\n+true.\n [report_issue]\n- dht_request_feature\n- include this bit if your plugin needs to have on_dht_request() called\n+***** add_dht_node() *****\n+void add_dht_node (std::pair const& node);\n+add_dht_node takes a host name and port pair. That endpoint will be pinged, and\n+if a valid DHT reply is received, the node will be added to the routing table.\n [report_issue]\n- alert_feature\n- include this bit if your plugin needs to have on_alert() called\n+***** dht_get_item() *****\n+void dht_get_item (sha1_hash const& target);\n+query the DHT for an immutable item at the target hash. the result is posted as\n+a dht_immutable_item_alert.\n [report_issue]\n-****** torrent_plugin ******\n-Declared in \"libtorrent/extensions.hpp\"\n-Torrent plugins are associated with a single torrent and have a number of\n-functions called at certain events. Many of its functions have the ability to\n-change or override the default libtorrent behavior.\n-struct torrent_plugin\n-{\n- virtual std::shared_ptr new_connection (peer_connection_handle\n-const&);\n- virtual void on_piece_failed (piece_index_t);\n- virtual void on_piece_pass (piece_index_t);\n- virtual void tick ();\n- virtual bool on_resume ();\n- virtual bool on_pause ();\n- virtual void on_files_checked ();\n- virtual void on_state (torrent_status::state_t);\n- virtual void on_add_peer (tcp::endpoint const&,\n- peer_source_flags_t, add_peer_flags_t);\n-\n- static constexpr add_peer_flags_t first_time = 1_bit;\n- static constexpr add_peer_flags_t filtered = 2_bit;\n-};\n+***** dht_get_item() *****\n+void dht_get_item (std::array key\n+ , std::string salt = std::string());\n+query the DHT for a mutable item under the public key key. this is an ed25519\n+key. salt is optional and may be left as an empty string if no salt is to be\n+used. if the item is found in the DHT, a dht_mutable_item_alert is posted.\n [report_issue]\n-***** new_connection() *****\n-virtual std::shared_ptr new_connection (peer_connection_handle\n-const&);\n-This function is called each time a new peer is connected to the torrent. You\n-may choose to ignore this by just returning a default constructed shared_ptr\n-(in which case you don't need to override this member function).\n-If you need an extension to the peer connection (which most plugins do) you are\n-supposed to return an instance of your peer_plugin class. Which in turn will\n-have its hook functions called on event specific to that peer.\n-The peer_connection_handle will be valid as long as the shared_ptr is being\n-held by the torrent object. So, it is generally a good idea to not keep a\n-shared_ptr to your own peer_plugin. If you want to keep references to it, use\n-weak_ptr.\n-If this function throws an exception, the connection will be closed.\n- [report_issue]\n-***** on_piece_pass() on_piece_failed() *****\n-virtual void on_piece_failed (piece_index_t);\n-virtual void on_piece_pass (piece_index_t);\n-These hooks are called when a piece passes the hash check or fails the hash\n-check, respectively. The index is the piece index that was downloaded. It is\n-possible to access the list of peers that participated in sending the piece\n-through the torrent and the piece_picker.\n+***** dht_put_item() *****\n+sha1_hash dht_put_item (entry data);\n+store the given bencoded data as an immutable item in the DHT. the returned\n+hash is the key that is to be used to look the item up again. It's just the\n+SHA-1 hash of the bencoded form of the structure.\n [report_issue]\n-***** tick() *****\n-virtual void tick ();\n-This hook is called approximately once per second. It is a way of making it\n-easy for plugins to do timed events, for sending messages or whatever.\n+***** dht_put_item() *****\n+void dht_put_item (std::array key\n+ , std::function&\n+ , std::int64_t&, std::string const&)> cb\n+ , std::string salt = std::string());\n+store a mutable item. The key is the public key the blob is to be stored under.\n+The optional salt argument is a string that is to be mixed in with the key when\n+determining where in the DHT the value is to be stored. The callback function\n+is called from within the libtorrent network thread once we've found where to\n+store the blob, possibly with the current value stored under the key. The\n+values passed to the callback functions are:\n+ entry& value\n+ the current value stored under the key (may be empty). Also expected to\n+ be set to the value to be stored by the function.\n+ std::array& signature\n+ the signature authenticating the current value. This may be zeros if\n+ there is currently no value stored. The function is expected to fill in\n+ this buffer with the signature of the new value to store. To generate the\n+ signature, you may want to use the sign_mutable_item function.\n+ std::int64_t& seq\n+ current sequence number. May be zero if there is no current value. The\n+ function is expected to set this to the new sequence number of the value\n+ that is to be stored. Sequence numbers must be monotonically increasing.\n+ Attempting to overwrite a value with a lower or equal sequence number\n+ will fail, even if the signature is correct.\n+ std::string const& salt\n+ this is the salt that was used for this put call.\n+Since the callback function cb is called from within libtorrent, it is critical\n+to not perform any blocking operations. Ideally not even locking a mutex. Pass\n+any data required for this function along with the function object's context\n+and make the function entirely self-contained. The only reason data blob's\n+value is computed via a function instead of just passing in the new value is to\n+avoid race conditions. If you want to update the value in the DHT, you must\n+first retrieve it, then modify it, then write it back. The way the DHT works,\n+it is natural to always do a lookup before storing and calling the callback in\n+between is convenient.\n [report_issue]\n-***** on_resume() on_pause() *****\n-virtual bool on_resume ();\n-virtual bool on_pause ();\n-These hooks are called when the torrent is paused and resumed respectively. The\n-return value indicates if the event was handled. A return value of true\n-indicates that it was handled, and no other plugin after this one will have\n-this hook function called, and the standard handler will also not be invoked.\n-So, returning true effectively overrides the standard behavior of pause or\n-resume.\n-Note that if you call pause() or resume() on the torrent from your handler it\n-will recurse back into your handler, so in order to invoke the standard\n-handler, you have to keep your own state on whether you want standard behavior\n-or overridden behavior.\n-[report_issue]\n-***** on_files_checked() *****\n-virtual void on_files_checked ();\n-This function is called when the initial files of the torrent have been\n-checked. If there are no files to check, this function is called immediately.\n-i.e. This function is always called when the torrent is in a state where it can\n-start downloading.\n-[report_issue]\n-***** on_state() *****\n-virtual void on_state (torrent_status::state_t);\n-called when the torrent changes state the state is one of torrent_status::\n-state_t enum members\n-[report_issue]\n-***** on_add_peer() *****\n-virtual void on_add_peer (tcp::endpoint const&,\n- peer_source_flags_t, add_peer_flags_t);\n-called every time a new peer is added to the peer list. This is before the peer\n-is connected to. For flags, see torrent_plugin::flags_t. The source argument\n-refers to the source where we learned about this peer from. It's a bitmask,\n-because many sources may have told us about the same peer. For peer source\n-flags, see peer_info::peer_source_flags.\n-[report_issue]\n- first_time\n- this is the first time we see this peer\n-[report_issue]\n- filtered\n- this peer was not added because it was filtered by the IP filter\n-[report_issue]\n-****** peer_plugin ******\n-Declared in \"libtorrent/extensions.hpp\"\n-peer plugins are associated with a specific peer. A peer could be both a\n-regular bittorrent peer (bt_peer_connection) or one of the web seed connections\n-(web_peer_connection or http_seed_connection). In order to only attach to\n-certain peers, make your torrent_plugin::new_connection only return a plugin\n-for certain peer connection types\n-struct peer_plugin\n-{\n- virtual string_view type () const;\n- virtual void add_handshake (entry&);\n- virtual void on_disconnect (error_code const&);\n- virtual void on_connected ();\n- virtual bool on_handshake (span);\n- virtual bool on_extension_handshake (bdecode_node const&);\n- virtual bool on_interested ();\n- virtual bool on_dont_have (piece_index_t);\n- virtual bool on_bitfield (bitfield const& /*bitfield*/);\n- virtual bool on_request (peer_request const&);\n- virtual bool on_have_none ();\n- virtual bool on_have_all ();\n- virtual bool on_unchoke ();\n- virtual bool on_choke ();\n- virtual bool on_not_interested ();\n- virtual bool on_have (piece_index_t);\n- virtual bool on_allowed_fast (piece_index_t);\n- virtual bool on_piece (peer_request const& /*piece*/\n- , span /*buf*/);\n- virtual bool on_cancel (peer_request const&);\n- virtual bool on_suggest (piece_index_t);\n- virtual bool on_reject (peer_request const&);\n- virtual void sent_reject_request (peer_request const&);\n- virtual void sent_allow_fast (piece_index_t);\n- virtual void sent_suggest (piece_index_t);\n- virtual void sent_choke ();\n- virtual void sent_have_none ();\n- virtual void sent_request (peer_request const&);\n- virtual void sent_have_all ();\n- virtual void sent_cancel (peer_request const&);\n- virtual void sent_interested ();\n- virtual void sent_have (piece_index_t);\n- virtual void sent_not_interested ();\n- virtual void sent_unchoke ();\n- virtual void sent_piece (peer_request const&);\n- virtual void sent_payload (int /* bytes */);\n- virtual bool can_disconnect (error_code const& /*ec*/);\n- virtual bool on_extended (int /*length*/, int /*msg*/,\n- span /*body*/);\n- virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n- span /*body*/);\n- virtual void on_piece_failed (piece_index_t);\n- virtual void on_piece_pass (piece_index_t);\n- virtual void tick ();\n- virtual bool write_request (peer_request const&);\n-};\n-[report_issue]\n-***** type() *****\n-virtual string_view type () const;\n-This function is expected to return the name of the plugin.\n-[report_issue]\n-***** add_handshake() *****\n-virtual void add_handshake (entry&);\n-can add entries to the extension handshake this is not called for web seeds\n-[report_issue]\n-***** on_disconnect() *****\n-virtual void on_disconnect (error_code const&);\n-called when the peer is being disconnected.\n-[report_issue]\n-***** on_connected() *****\n-virtual void on_connected ();\n-called when the peer is successfully connected. Note that incoming connections\n-will have been connected by the time the peer plugin is attached to it, and\n-won't have this hook called.\n-[report_issue]\n-***** on_handshake() *****\n-virtual bool on_handshake (span);\n-this is called when the initial bittorrent handshake is received. Returning\n-false means that the other end doesn't support this extension and will remove\n-it from the list of plugins. this is not called for web seeds\n-[report_issue]\n-***** on_extension_handshake() *****\n-virtual bool on_extension_handshake (bdecode_node const&);\n-called when the extension handshake from the other end is received if this\n-returns false, it means that this extension isn't supported by this peer. It\n-will result in this peer_plugin being removed from the peer_connection and\n-destructed. this is not called for web seeds\n- [report_issue]\n-***** on_dont_have() on_allowed_fast() on_not_interested() on_bitfield()\n-on_have_none() on_have() on_choke() on_interested() on_request() on_unchoke()\n-on_have_all() *****\n-virtual bool on_interested ();\n-virtual bool on_dont_have (piece_index_t);\n-virtual bool on_bitfield (bitfield const& /*bitfield*/);\n-virtual bool on_request (peer_request const&);\n-virtual bool on_have_none ();\n-virtual bool on_have_all ();\n-virtual bool on_unchoke ();\n-virtual bool on_choke ();\n-virtual bool on_not_interested ();\n-virtual bool on_have (piece_index_t);\n-virtual bool on_allowed_fast (piece_index_t);\n-returning true from any of the message handlers indicates that the plugin has\n-handled the message. it will break the plugin chain traversing and not let\n-anyone else handle the message, including the default handler.\n-[report_issue]\n-***** on_piece() *****\n-virtual bool on_piece (peer_request const& /*piece*/\n- , span /*buf*/);\n-This function is called when the peer connection is receiving a piece. buf\n-points (non-owning pointer) to the data in an internal immutable disk buffer.\n-The length of the data is specified in the length member of the piece\n-parameter. returns true to indicate that the piece is handled and the rest of\n-the logic should be ignored.\n- [report_issue]\n-***** sent_have() sent_unchoke() sent_piece() sent_interested()\n-sent_not_interested() *****\n-virtual void sent_interested ();\n-virtual void sent_have (piece_index_t);\n-virtual void sent_not_interested ();\n-virtual void sent_unchoke ();\n-virtual void sent_piece (peer_request const&);\n-called after a choke message has been sent to the peer\n+***** dht_announce() dht_get_peers() *****\n+void dht_announce (sha1_hash const& info_hash, int port = 0, dht::\n+announce_flags_t flags = {});\n+void dht_get_peers (sha1_hash const& info_hash);\n+dht_get_peers() will issue a DHT get_peer request to the DHT for the specified\n+info-hash. The response (the peers) will be posted back in a\n+dht_get_peers_reply_alert.\n+dht_announce() will issue a DHT announce request to the DHT to the specified\n+info-hash, advertising the specified port. If the port is left at its default,\n+0, the port will be implied by the DHT message's source port (which may improve\n+connectivity through a NAT).\n+Both these functions are exposed for advanced custom use of the DHT. All\n+torrents eligible to be announce to the DHT will be automatically, by\n+libtorrent.\n+For possible flags, see announce_flags_t.\n [report_issue]\n-***** sent_payload() *****\n-virtual void sent_payload (int /* bytes */);\n-called after piece data has been sent to the peer this can be used for stats\n-book keeping\n+***** dht_live_nodes() *****\n+void dht_live_nodes (sha1_hash const& nid);\n+Retrieve all the live DHT (identified by nid) nodes. All the nodes id and\n+endpoint will be returned in the list of nodes in the alert\n+dht_live_nodes_alert. Since this alert is a response to an explicit call, it\n+will always be posted, regardless of the alert mask.\n [report_issue]\n-***** can_disconnect() *****\n-virtual bool can_disconnect (error_code const& /*ec*/);\n-called when libtorrent think this peer should be disconnected. if the plugin\n-returns false, the peer will not be disconnected.\n+***** dht_sample_infohashes() *****\n+void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);\n+Query the DHT node specified by ep to retrieve a sample of the info-hashes that\n+the node currently have in their storage. The target is included for iterative\n+lookups so that indexing nodes can perform a key space traversal with a single\n+RPC per node by adjusting the target value for each RPC. It has no effect on\n+the returned sample value. The result is posted as a\n+dht_sample_infohashes_alert.\n [report_issue]\n-***** on_extended() *****\n-virtual bool on_extended (int /*length*/, int /*msg*/,\n- span /*body*/);\n-called when an extended message is received. If returning true, the message is\n-not processed by any other plugin and if false is returned the next plugin in\n-the chain will receive it to be able to handle it. This is not called for web\n-seeds. thus function may be called more than once per incoming message, but\n-only the last of the calls will the body size equal the length. i.e. Every time\n-another fragment of the message is received, this function will be called,\n-until finally the whole message has been received. The purpose of this is to\n-allow early disconnects for invalid messages and for reporting progress of\n-receiving large messages.\n+***** dht_direct_request() *****\n+void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t\n+userdata = {});\n+Send an arbitrary DHT request directly to the specified endpoint. This function\n+is intended for use by plugins. When a response is received or the request\n+times out, a dht_direct_response_alert will be posted with the response (if\n+any) and the userdata pointer passed in here. Since this alert is a response to\n+an explicit call, it will always be posted, regardless of the alert mask.\n [report_issue]\n-***** on_unknown_message() *****\n-virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n- span /*body*/);\n-this is not called for web seeds\n+***** add_extension() *****\n+void add_extension (std::shared_ptr ext);\n+void add_extension (std::function(\n+ torrent_handle const&, client_data_t)> ext);\n+This function adds an extension to this session. The argument is a function\n+object that is called with a torrent_handle and which should return a std::\n+shared_ptr. To write custom plugins, see libtorrent_plugins.\n+For the typical bittorrent client all of these extensions should be added. The\n+main plugins implemented in libtorrent are:\n+ uTorrent metadata\n+ Allows peers to download the metadata (.torrent files) from the swarm\n+ directly. Makes it possible to join a swarm with just a tracker and info-\n+ hash.\n+#include \n+ses.add_extension(<::create_ut_metadata_plugin);\n+ uTorrent peer exchange\n+ Exchanges peers between clients.\n+#include \n+ses.add_extension(<::create_ut_pex_plugin);\n+ smart ban plugin\n+ A plugin that, with a small overhead, can ban peers that sends bad data\n+ with very high accuracy. Should eliminate most problems on poisoned\n+ torrents.\n+#include \n+ses.add_extension(<::create_smart_ban_plugin);\n [report_issue]\n-***** on_piece_pass() on_piece_failed() *****\n-virtual void on_piece_failed (piece_index_t);\n-virtual void on_piece_pass (piece_index_t);\n-called when a piece that this peer participated in either fails or passes the\n-hash_check\n-[report_issue]\n-***** tick() *****\n-virtual void tick ();\n-called approximately once every second\n-[report_issue]\n-***** write_request() *****\n-virtual bool write_request (peer_request const&);\n-called each time a request message is to be sent. If true is returned, the\n-original request message won't be sent and no other plugin will have this\n-function called.\n-[report_issue]\n-****** crypto_plugin ******\n-Declared in \"libtorrent/extensions.hpp\"\n-struct crypto_plugin\n-{\n- virtual void set_incoming_key (span key) = 0;\n- virtual void set_outgoing_key (span key) = 0;\n- encrypt (span> /*send_vec*/) = 0;\n- virtual std::tuple decrypt (span> /*receive_vec*/\n-) = 0;\n-};\n-[report_issue]\n-***** decrypt() *****\n-virtual std::tuple decrypt (span> /*receive_vec*/) =\n-0;\n-decrypt the provided buffers. returns is a tuple representing the values\n-(consume, produce, packet_size)\n-consume is set to the number of bytes which should be trimmed from the head of\n-the buffers, default is 0\n-produce is set to the number of bytes of payload which are now ready to be sent\n-to the upper layer. default is the number of bytes passed in receive_vec\n-packet_size is set to the minimum number of bytes which must be read to advance\n-the next step of decryption. default is 0\n-[report_issue]\n-****** create_ut_pex_plugin() ******\n-Declared in \"libtorrent/extensions/ut_pex.hpp\"\n-std::shared_ptr create_ut_pex_plugin (torrent_handle const&,\n-client_data_t);\n-constructor function for the ut_pex extension. The ut_pex extension allows\n-peers to gossip about their connections, allowing the swarm stay well connected\n-and peers aware of more peers in the swarm. This extension is enabled by\n-default unless explicitly disabled in the session constructor.\n-This can either be passed in the add_torrent_params::extensions field, or via\n-torrent_handle::add_extension().\n-[report_issue]\n-****** create_ut_metadata_plugin() ******\n-Declared in \"libtorrent/extensions/ut_metadata.hpp\"\n-std::shared_ptr create_ut_metadata_plugin (torrent_handle\n-const&, client_data_t);\n-constructor function for the ut_metadata extension. The ut_metadata extension\n-allows peers to request the .torrent file (or more specifically the info-\n-dictionary of the .torrent file) from each other. This is the main building\n-block in making magnet links work. This extension is enabled by default unless\n-explicitly disabled in the session constructor.\n-This can either be passed in the add_torrent_params::extensions field, or via\n-torrent_handle::add_extension().\n-[report_issue]\n-****** create_smart_ban_plugin() ******\n-Declared in \"libtorrent/extensions/smart_ban.hpp\"\n-std::shared_ptr create_smart_ban_plugin (torrent_handle const&,\n-client_data_t);\n-constructor function for the smart ban extension. The extension keeps track of\n-the data peers have sent us for failing pieces and once the piece completes and\n-passes the hash check bans the peers that turned out to have sent corrupt data.\n-This function can either be passed in the add_torrent_params::extensions field,\n-or via torrent_handle::add_extension().\n-This section describes the functions and classes that are used to create\n-torrent files. It is a layered API with low level classes and higher level\n-convenience functions. A torrent is created in 4 steps:\n- 1. first the files that will be part of the torrent are determined.\n- 2. the torrent properties are set, such as tracker url, web seeds, DHT nodes\n- etc.\n- 3. Read through all the files in the torrent, SHA-1 all the data and set the\n- piece hashes.\n- 4. The torrent is bencoded into a file or buffer.\n-If there are a lot of files and or deep directory hierarchies to traverse, step\n-one can be time consuming.\n-Typically step 3 is by far the most time consuming step, since it requires to\n-read all the bytes from all the files in the torrent.\n-All of these classes and functions are declared by including libtorrent/\n-create_torrent.hpp.\n-example:\n-file_storage fs;\n-\n-// recursively adds files in directories\n-add_files(fs, \"./my_torrent\");\n-\n-create_torrent t(fs);\n-t.add_tracker(\"http://my.tracker.com/announce\");\n-t.set_creator(\"libtorrent example\");\n-\n-// reads the files and calculates the hashes\n-set_piece_hashes(t, \".\");\n-\n-ofstream out(\"my_torrent.torrent\", std::ios_base::binary);\n-std::vector buf = t.generate_buf();\n-out.write(buf.data(), buf.size());\n-\n-// alternatively, generate an entry and encode it directly to an ostream\n-// iterator\n-bencode(std::ostream_iterator(out), t.generate());\n-[report_issue]\n-****** create_torrent ******\n-Declared in \"libtorrent/create_torrent.hpp\"\n-This class holds state for creating a torrent. After having added all\n-information to it, call create_torrent::generate() to generate the torrent. The\n-entry that's returned can then be bencoded into a .torrent file using bencode\n-().\n-struct create_torrent\n-{\n- explicit create_torrent (file_storage& fs, int piece_size = 0\n- , create_flags_t flags = {});\n- explicit create_torrent (torrent_info const& ti);\n- entry generate () const;\n- std::vector generate_buf () const;\n- file_storage const& files () const;\n- void set_comment (char const* str);\n- void set_creator (char const* str);\n- void set_creation_date (std::time_t timestamp);\n- void set_hash (piece_index_t index, sha1_hash const& h);\n- void set_hash2 (file_index_t file, piece_index_t::diff_type piece,\n-sha256_hash const& h);\n- void add_url_seed (string_view url);\n- void add_http_seed (string_view url);\n- void add_node (std::pair node);\n- void add_tracker (string_view url, int tier = 0);\n- void set_root_cert (string_view cert);\n- void set_priv (bool p);\n- bool priv () const;\n- bool is_v1_only () const;\n- bool is_v2_only () const;\n- int num_pieces () const;\n- piece_index_t end_piece () const;\n- index_range piece_range () const noexcept;\n- file_index_t end_file () const;\n- index_range file_range () const noexcept;\n- index_range file_piece_range (file_index_t f);\n- std::int64_t total_size () const;\n- int piece_length () const;\n- int piece_size (piece_index_t i) const;\n- void add_collection (string_view c);\n- void add_similar_torrent (sha1_hash ih);\n-\n- static constexpr create_flags_t modification_time = 2_bit;\n- static constexpr create_flags_t symlinks = 3_bit;\n- static constexpr create_flags_t v2_only = 5_bit;\n- static constexpr create_flags_t v1_only = 6_bit;\n- static constexpr create_flags_t canonical_files = 7_bit;\n- static constexpr create_flags_t no_attributes = 8_bit;\n- static constexpr create_flags_t canonical_files_no_tail_padding = 9_bit;\n-};\n+***** get_ip_filter() set_ip_filter() *****\n+ip_filter get_ip_filter () const;\n+void set_ip_filter (ip_filter f);\n+Sets a filter that will be used to reject and accept incoming as well as\n+outgoing connections based on their originating ip address. The default filter\n+will allow connections to any ip address. To build a set of rules for which\n+addresses are accepted and not, see ip_filter.\n+Each time a peer is blocked because of the IP filter, a peer_blocked_alert is\n+generated. get_ip_filter() Returns the ip_filter currently in the session. See\n+ip_filter.\n [report_issue]\n-***** create_torrent() *****\n-explicit create_torrent (file_storage& fs, int piece_size = 0\n- , create_flags_t flags = {});\n-explicit create_torrent (torrent_info const& ti);\n-The piece_size is the size of each piece in bytes. It must be a power of 2 and\n-a minimum of 16 kiB. If a piece size of 0 is specified, a piece_size will be\n-set automatically.\n-The flags arguments specifies options for the torrent creation. It can be any\n-combination of the flags defined by create_flags_t.\n-The file_storage (fs) parameter defines the files, sizes and their properties\n-for the torrent to be created. Set this up first, before passing it to the\n-create_torrent constructor.\n-The overload that takes a torrent_info object will make a verbatim copy of its\n-info dictionary (to preserve the info-hash). The copy of the info dictionary\n-will be used by create_torrent::generate(). This means that none of the member\n-functions of create_torrent that affects the content of the info dictionary\n-(such as set_hash()), will have any affect. Instead of using this overload,\n-consider using write_torrent_file() instead.\n-Warning\n-The file_storage and torrent_info objects must stay alive for the entire\n-duration of the create_torrent object.\n+***** set_port_filter() *****\n+void set_port_filter (port_filter const& f);\n+apply port_filter f to incoming and outgoing peers. a port filter will reject\n+making outgoing peer connections to certain remote ports. The main intention is\n+to be able to avoid triggering certain anti-virus software by connecting to\n+SMTP, FTP ports.\n+ [report_issue]\n+***** ssl_listen_port() is_listening() listen_port() *****\n+unsigned short ssl_listen_port () const;\n+unsigned short listen_port () const;\n+bool is_listening () const;\n+is_listening() will tell you whether or not the session has successfully opened\n+a listening port. If it hasn't, this function will return false, and then you\n+can set a new settings_pack::listen_interfaces to try another interface and\n+port to bind to.\n+listen_port() returns the port we ended up listening on.\n [report_issue]\n-***** generate_buf() generate() *****\n-entry generate () const;\n-std::vector generate_buf () const;\n-This function will generate the .torrent file as a bencode tree, or a bencoded\n-into a buffer. In order to encode the entry into a flat file, use the bencode()\n-function.\n-The function returning an entry may be useful to add custom entries to the\n-torrent file before bencoding it and saving it to disk.\n-Whether the resulting torrent object is v1, v2 or hybrid depends on whether any\n-of the v1_only or v2_only flags were set on the constructor. If neither were\n-set, the resulting torrent depends on which hashes were set. If both v1 and v2\n-hashes were set, a hybrid torrent is created.\n-Any failure will cause this function to throw system_error, with an appropriate\n-error message. These are the reasons this call may throw:\n- * the file storage has 0 files\n- * the total size of the file storage is 0 bytes (i.e. it only has empty\n- files)\n- * not all v1 hashes (set_hash()) and not all v2 hashes (set_hash2()) were\n- set\n- * for v2 torrents, you may not have a directory with the same name as a\n- file. If that's encountered in the file storage, generate() fails.\n-[report_issue]\n-***** files() *****\n-file_storage const& files () const;\n-returns an immutable reference to the file_storage used to create the torrent\n-from.\n-[report_issue]\n-***** set_comment() *****\n-void set_comment (char const* str);\n-Sets the comment for the torrent. The string str should be utf-8 encoded. The\n-comment in a torrent file is optional.\n-[report_issue]\n-***** set_creator() *****\n-void set_creator (char const* str);\n-Sets the creator of the torrent. The string str should be utf-8 encoded. This\n-is optional.\n-[report_issue]\n-***** set_creation_date() *****\n-void set_creation_date (std::time_t timestamp);\n-sets the \"creation time\" field. Defaults to the system clock at the time of\n-construction of the create_torrent object. The timestamp is specified in\n-seconds, posix time. If the creation date is set to 0, the \"creation date\"\n-field will be omitted from the generated torrent.\n-[report_issue]\n-***** set_hash() *****\n-void set_hash (piece_index_t index, sha1_hash const& h);\n-This sets the SHA-1 hash for the specified piece (index). You are required to\n-set the hash for every piece in the torrent before generating it. If you have\n-the files on disk, you can use the high level convenience function to do this.\n-See set_piece_hashes(). A SHA-1 hash of all zeros is internally used to\n-indicate a hash that has not been set. Setting such hash will not be considered\n-set when calling generate(). This function will throw std::system_error if it\n-is called on an object constructed with the v2_only flag.\n-[report_issue]\n-***** set_hash2() *****\n-void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash\n-const& h);\n-sets the bittorrent v2 hash for filefileof the piecepiece.pieceis relative to\n-the first piece of the file, starting at 0. The first piece in the file can be\n-computed with file_storage::file_index_at_piece(). The hash,h, is the root of\n-the merkle tree formed by the piece's 16 kiB blocks. Note that piece sizes must\n-be powers-of-2, so all per-piece merkle trees are complete. A SHA-256 hash of\n-all zeros is internally used to indicate a hash that has not been set. Setting\n-such hash will not be considered set when calling generate(). This function\n-will throw std::system_error if it is called on an object constructed with the\n-v1_only flag.\n+***** get_peer_class_filter() set_peer_class_filter() *****\n+ip_filter get_peer_class_filter () const;\n+void set_peer_class_filter (ip_filter const& f);\n+Sets the peer class filter for this session. All new peer connections will take\n+this into account and be added to the peer classes specified by this filter,\n+based on the peer's IP address.\n+The ip-filter essentially maps an IP -> uint32. Each bit in that 32 bit integer\n+represents a peer class. The least significant bit represents class 0, the next\n+bit class 1 and so on.\n+For more info, see ip_filter.\n+For example, to make all peers in the range 200.1.1.0 - 200.1.255.255 belong to\n+their own peer class, apply the following filter:\n+ip_filter f = ses.get_peer_class_filter();\n+peer_class_t my_class = ses.create_peer_class(\"200.1.x.x IP range\");\n+f.add_rule(make_address(\"200.1.1.0\"), make_address(\"200.1.255.255\")\n+ , 1 << static_cast(my_class));\n+ses.set_peer_class_filter(f);\n+This setting only applies to new connections, it won't affect existing peer\n+connections.\n+This function is limited to only peer class 0-31, since there are only 32 bits\n+in the IP range mapping. Only the set bits matter; no peer class will be\n+removed from a peer as a result of this call, peer classes are only added.\n+The peer_class argument cannot be greater than 31. The bitmasks representing\n+peer classes in the peer_class_filter are 32 bits.\n+The get_peer_class_filter() function returns the current filter.\n+For more information, see peer_classes.\n [report_issue]\n-***** add_url_seed() add_http_seed() *****\n-void add_url_seed (string_view url);\n-void add_http_seed (string_view url);\n-This adds a url seed to the torrent. You can have any number of url seeds. For\n-a single file torrent, this should be an HTTP url, pointing to a file with\n-identical content as the file of the torrent. For a multi-file torrent, it\n-should point to a directory containing a directory with the same name as this\n-torrent, and all the files of the torrent in it.\n-The second function, add_http_seed() adds an HTTP seed instead.\n-[report_issue]\n-***** add_node() *****\n-void add_node (std::pair node);\n-This adds a DHT node to the torrent. This especially useful if you're creating\n-a tracker less torrent. It can be used by clients to bootstrap their DHT node\n-from. The node is a hostname and a port number where there is a DHT node\n-running. You can have any number of DHT nodes in a torrent.\n+***** set_peer_class_type_filter() get_peer_class_type_filter() *****\n+void set_peer_class_type_filter (peer_class_type_filter const& f);\n+peer_class_type_filter get_peer_class_type_filter () const;\n+Sets and gets the peer class type filter. This is controls automatic peer class\n+assignments to peers based on what kind of socket it is.\n+It does not only support assigning peer classes, it also supports removing peer\n+classes based on socket type.\n+The order of these rules being applied are:\n+ 1. peer-class IP filter\n+ 2. peer-class type filter, removing classes\n+ 3. peer-class type filter, adding classes\n+For more information, see peer_classes.\n [report_issue]\n-***** add_tracker() *****\n-void add_tracker (string_view url, int tier = 0);\n-Adds a tracker to the torrent. This is not strictly required, but most torrents\n-use a tracker as their main source of peers. The url should be an http:// or\n-udp:// url to a machine running a bittorrent tracker that accepts announces for\n-this torrent's info-hash. The tier is the fallback priority of the tracker. All\n-trackers with tier 0 are tried first (in any order). If all fail, trackers with\n-tier 1 are tried. If all of those fail, trackers with tier 2 are tried, and so\n-on.\n+***** create_peer_class() *****\n+peer_class_t create_peer_class (char const* name);\n+Creates a new peer class (see peer_classes) with the given name. The returned\n+integer is the new peer class identifier. Peer classes may have the same name,\n+so each invocation of this function creates a new class and returns a unique\n+identifier.\n+Identifiers are assigned from low numbers to higher. So if you plan on using\n+certain peer classes in a call to set_peer_class_filter(), make sure to create\n+those early on, to get low identifiers.\n+For more information on peer classes, see peer_classes.\n [report_issue]\n-***** set_root_cert() *****\n-void set_root_cert (string_view cert);\n-This function sets an X.509 certificate in PEM format to the torrent. This\n-makes the torrent an SSL torrent. An SSL torrent requires that each peer has a\n-valid certificate signed by this root certificate. For SSL torrents, all peers\n-are connecting over SSL connections. For more information, see the section on\n-ssl_torrents.\n-The string is not the path to the cert, it's the actual content of the\n-certificate.\n+***** delete_peer_class() *****\n+void delete_peer_class (peer_class_t cid);\n+This call dereferences the reference count of the specified peer class. When\n+creating a peer class it's automatically referenced by 1. If you want to\n+recycle a peer class, you may call this function. You may only call this\n+function once per peer class you create. Calling it more than once for the same\n+class will lead to memory corruption.\n+Since peer classes are reference counted, this function will not remove the\n+peer class if it's still assigned to torrents or peers. It will however remove\n+it once the last peer and torrent drops their references to it.\n+There is no need to call this function for custom peer classes. All peer\n+classes will be properly destructed when the session object destructs.\n+For more information on peer classes, see peer_classes.\n [report_issue]\n-***** priv() set_priv() *****\n-void set_priv (bool p);\n-bool priv () const;\n-Sets and queries the private flag of the torrent. Torrents with the private\n-flag set ask the client to not use any other sources than the tracker for\n-peers, and to not use DHT to advertise itself publicly, only the tracker.\n-[report_issue]\n-***** num_pieces() *****\n-int num_pieces () const;\n-returns the number of pieces in the associated file_storage object.\n-[report_issue]\n-***** piece_range() *****\n-index_range piece_range () const noexcept;\n-all piece indices in the torrent to be created\n-[report_issue]\n-***** file_range() *****\n-index_range file_range () const noexcept;\n-all file indices in the torrent to be created\n-[report_issue]\n-***** file_piece_range() *****\n-index_range file_piece_range (file_index_t f);\n-for v2 and hybrid torrents only, the pieces in the specified file, specified as\n-delta from the first piece in the file. i.e. the first index is 0.\n+***** set_peer_class() get_peer_class() *****\n+void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n+peer_class_info get_peer_class (peer_class_t cid) const;\n+These functions queries information from a peer class and updates the\n+configuration of a peer class, respectively.\n+cid must refer to an existing peer class. If it does not, the return value of\n+get_peer_class() is undefined.\n+set_peer_class() sets all the information in the peer_class_info object in the\n+specified peer class. There is no option to only update a single property.\n+A peer or torrent belonging to more than one class, the highest priority among\n+any of its classes is the one that is taken into account.\n+For more information, see peer_classes.\n [report_issue]\n-***** total_size() *****\n-std::int64_t total_size () const;\n-the total number of bytes of all files and pad files\n+***** remove_torrent() *****\n+void remove_torrent (const torrent_handle&, remove_flags_t = {});\n+remove_torrent() will close all peer connections associated with the torrent\n+and tell the tracker that we've stopped participating in the swarm. This\n+operation cannot fail. When it completes, you will receive a\n+torrent_removed_alert.\n+remove_torrent() is non-blocking, but will remove the torrent from the session\n+synchronously. Calling session_handle::add_torrent() immediately afterward with\n+the same torrent will succeed. Note that this creates a new handle which is not\n+equal to the removed one.\n+The optional second argument options can be used to delete all the files\n+downloaded by this torrent. To do so, pass in the value session_handle::\n+delete_files. Once the torrent is deleted, a torrent_deleted_alert is posted.\n+The torrent_handle remains valid for some time after remove_torrent() is\n+called. It will become invalid only after all libtorrent tasks (such as I/\n+O tasks) release their references to the torrent. Until this happens,\n+torrent_handle::is_valid() will return true, and other calls such as\n+torrent_handle::status() will succeed. Because of this, and because\n+remove_torrent() is non-blocking, the following sequence usually succeeds (does\n+not throw system_error): .. code:: c++\n+ session.remove_handle(handle); handle.save_resume_data();\n+Note that when a queued or downloading torrent is removed, its position in the\n+download queue is vacated and every subsequent torrent in the queue has their\n+queue positions updated. This can potentially cause a large state_update to be\n+posted. When removing all torrents, it is advised to remove them from the back\n+of the queue, to minimize the shifting.\n [report_issue]\n-***** piece_size() piece_length() *****\n-int piece_length () const;\n-int piece_size (piece_index_t i) const;\n-piece_length() returns the piece size of all pieces but the last one.\n-piece_size() returns the size of the specified piece. these functions are just\n-forwarding to the associated file_storage.\n+***** get_settings() apply_settings() *****\n+void apply_settings (settings_pack&&);\n+settings_pack get_settings () const;\n+void apply_settings (settings_pack const&);\n+Applies the settings specified by the settings_pack s. This is an asynchronous\n+operation that will return immediately and actually apply the settings to the\n+main thread of libtorrent some time later.\n+ [report_issue]\n+***** wait_for_alert() set_alert_notify() pop_alerts() *****\n+alert* wait_for_alert (time_duration max_wait);\n+void set_alert_notify (std::function const& fun);\n+void pop_alerts (std::vector* alerts);\n+Alerts is the main mechanism for libtorrent to report errors and events.\n+pop_alerts fills in the vector passed to it with pointers to new alerts. The\n+session still owns these alerts and they will stay valid until the next time\n+pop_alerts is called. You may not delete the alert objects.\n+It is safe to call pop_alerts from multiple different threads, as long as the\n+alerts themselves are not accessed once another thread calls pop_alerts. Doing\n+this requires manual synchronization between the popping threads.\n+wait_for_alert will block the current thread for max_wait time duration, or\n+until another alert is posted. If an alert is available at the time of the\n+call, it returns immediately. The returned alert pointer is the head of the\n+alert queue. wait_for_alert does not pop alerts from the queue, it merely peeks\n+at it. The returned alert will stay valid until pop_alerts is called twice. The\n+first time will pop it and the second will free it.\n+If there is no alert in the queue and no alert arrives within the specified\n+timeout, wait_for_alert returns nullptr.\n+In the python binding, wait_for_alert takes the number of milliseconds to wait\n+as an integer.\n+The alert queue in the session will not grow indefinitely. Make sure to pop\n+periodically to not miss notifications. To control the max number of alerts\n+that's queued by the session, see settings_pack::alert_queue_size.\n+Some alerts are considered so important that they are posted even when the\n+alert queue is full. Some alerts are considered mandatory and cannot be\n+disabled by the alert_mask. For instance, save_resume_data_alert and\n+save_resume_data_failed_alert are always posted, regardless of the alert mask.\n+To control which alerts are posted, set the alert_mask (settings_pack::\n+alert_mask).\n+If the alert queue fills up to the point where alerts are dropped, this will be\n+indicated by a alerts_dropped_alert, which contains a bitmask of which types of\n+alerts were dropped. Generally it is a good idea to make sure the alert queue\n+is large enough, the alert_mask doesn't have unnecessary categories enabled and\n+to call pop_alert() frequently, to avoid alerts being dropped.\n+the set_alert_notify function lets the client set a function object to be\n+invoked every time the alert queue goes from having 0 alerts to 1 alert. This\n+function is called from within libtorrent, it may be the main thread, or it may\n+be from within a user call. The intention of of the function is that the client\n+wakes up its main thread, to poll for more alerts using pop_alerts(). If the\n+notify function fails to do so, it won't be called again, until pop_alerts is\n+called for some other reason. For instance, it could signal an eventfd, post a\n+message to an HWND or some other main message pump. The actual retrieval of\n+alerts should not be done in the callback. In fact, the callback should not\n+block. It should not perform any expensive work. It really should just notify\n+the main application thread.\n+The type of an alert is returned by the polymorphic function alert::type() but\n+can also be queries from a concrete type via T::alert_type, as a static\n+constant.\n [report_issue]\n-***** add_similar_torrent() add_collection() *****\n-void add_collection (string_view c);\n-void add_similar_torrent (sha1_hash ih);\n-Add similar torrents (by info-hash) or collections of similar torrents. Similar\n-torrents are expected to share some files with this torrent. Torrents sharing a\n-collection name with this torrent are also expected to share files with this\n-torrent. A torrent may have more than one collection and more than one similar\n-torrents. For more information, see BEP_38.\n+***** add_port_mapping() delete_port_mapping() *****\n+void delete_port_mapping (port_mapping_t handle);\n+std::vector add_port_mapping (portmap_protocol t, int\n+external_port, int local_port);\n+add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,\n+whichever is enabled. A mapping is created for each listen socket in the\n+session. The return values are all handles referring to the port mappings that\n+were just created. Pass them to delete_port_mapping() to remove them.\n [report_issue]\n- modification_time\n- This will include the file modification time as part of the torrent. This\n- is not enabled by default, as it might cause problems when you create a\n- torrent from separate files with the same content, hoping to yield the\n- same info-hash. If the files have different modification times, with this\n- option enabled, you would get different info-hashes for the files.\n+***** reopen_network_sockets() *****\n+void reopen_network_sockets (reopen_network_flags_t options =\n+reopen_map_ports);\n+Instructs the session to reopen all listen and outgoing sockets.\n+It's useful in the case your platform doesn't support the built in IP notifier\n+mechanism, or if you have a better more reliable way to detect changes in the\n+IP routing table.\n [report_issue]\n- symlinks\n- If this flag is set, files that are symlinks get a symlink attribute set\n- on them and their data will not be included in the torrent. This is\n- useful if you need to reconstruct a file hierarchy which contains\n- symlinks.\n+***** native_handle() *****\n+std::shared_ptr native_handle () const;\n+This function is intended only for use by plugins. This type does not have a\n+stable API and should be relied on as little as possible.\n [report_issue]\n- v2_only\n- Do not generate v1 metadata. The resulting torrent will only be usable by\n- clients which support v2. This requires setting all v2 hashes, with\n- set_hash2() before calling generate(). Setting v1 hashes (with set_hash\n- ()) is an error with this flag set.\n+ save_settings\n+ saves settings (i.e. the settings_pack)\n [report_issue]\n- v1_only\n- do not generate v2 metadata or enforce v2 alignment and padding rules\n- this is mainly for tests, not recommended for production use. This\n- requires setting all v1 hashes, with set_hash(), before calling generate\n- (). Setting v2 hashes (with set_hash2()) is an error with this flag set.\n+ save_dht_state\n+ saves dht state such as nodes and node-id, possibly accelerating joining\n+ the DHT if provided at next session startup.\n [report_issue]\n- canonical_files\n- This flag only affects v1-only torrents, and is only relevant together\n- with the v1_only_flag. This flag will force the same file order and\n- padding as a v2 (or hybrid) torrent would have. It has the effect of\n- ordering files and inserting pad files to align them with piece\n- boundaries.\n+ save_extension_state\n+ load or save state from plugins\n [report_issue]\n- no_attributes\n- passing this flag to add_files() will ignore file attributes (such as\n- executable or hidden) when adding the files to the file storage. Since\n- not all filesystems and operating systems support all file attributes the\n- resulting torrent may differ depending on where it's created. If it's\n- important for torrents to be created consistently across systems, this\n- flag should be set.\n+ save_ip_filter\n+ load or save the IP filter set on the session\n+ [report_issue]\n+ global_peer_class_id tcp_peer_class_id local_peer_class_id\n+ built-in peer classes\n [report_issue]\n- canonical_files_no_tail_padding\n- this flag enforces the file layout to be canonical according to the\n- bittorrent v2 specification (just like the canonical_files flag) with the\n- one exception that tail padding is not added to the last file. This\n- behavior deviates from the specification but was the way libtorrent\n- created torrents in version up to and including 2.0.7. This flag is here\n- for backwards compatibility.\n+ delete_files\n+ delete the files belonging to the torrent from disk. including the part-\n+ file, if there is one\n [report_issue]\n-****** add_files() ******\n-Declared in \"libtorrent/create_torrent.hpp\"\n-void add_files (file_storage& fs, std::string const& file\n- , create_flags_t flags = {});\n-void add_files (file_storage& fs, std::string const& file\n- , std::function p, create_flags_t flags = {});\n-Adds the file specified by path to the file_storage object. In case path refers\n-to a directory, files will be added recursively from the directory.\n-If specified, the predicate p is called once for every file and directory that\n-is encountered. Files for which p returns true are added, and directories for\n-which p returns true are traversed. p must have the following signature:\n-bool Pred(std::string const& p);\n-The path that is passed in to the predicate is the full path of the file or\n-directory. If no predicate is specified, all files are added, and all\n-directories are traversed.\n-The \"..\" directory is never traversed.\n-The flags argument should be the same as the flags passed to the create_torrent\n-constructor.\n+ delete_partfile\n+ delete just the part-file associated with this torrent\n [report_issue]\n-****** set_piece_hashes() ******\n-Declared in \"libtorrent/create_torrent.hpp\"\n-inline void set_piece_hashes (create_torrent& t, std::string const& p);\n-void set_piece_hashes (create_torrent& t, std::string const& p\n- , settings_interface const& settings\n- , std::function const& f, error_code& ec);\n-inline void set_piece_hashes (create_torrent& t, std::string const& p\n- , settings_interface const& settings\n- , std::function const& f);\n-void set_piece_hashes (create_torrent& t, std::string const& p\n- , settings_interface const& settings, disk_io_constructor_type disk_io\n- , std::function const& f, error_code& ec);\n-void set_piece_hashes (create_torrent& t, std::string const& p\n- , std::function const& f, error_code& ec);\n-inline void set_piece_hashes (create_torrent& t, std::string const& p,\n-error_code& ec);\n-inline void set_piece_hashes (create_torrent& t, std::string const& p\n- , std::function const& f);\n-This function will assume that the files added to the torrent file exists at\n-path p, read those files and hash the content and set the hashes in the\n-create_torrent object. The optional function f is called in between every hash\n-that is set. f must have the following signature:\n-void Fun(piece_index_t);\n-The overloads taking a settings_pack may be used to configure the underlying\n-disk access. Such as settings_pack::aio_threads.\n-The overloads that don't take an error_code& may throw an exception in case of\n-a file error, the other overloads sets the error code to reflect the error, if\n-any.\n+ paused\n+ when set, the session will start paused. Call session_handle::resume() to\n+ start\n+ [report_issue]\n+ udp tcp\n+ protocols used by add_port_mapping()\n [report_issue]\n-****** piece_block ******\n-Declared in \"libtorrent/piece_block.hpp\"\n-struct piece_block\n-{\n- piece_block (piece_index_t p_index, int b_index);\n- piece_block () = default;\n- bool operator< (piece_block const& b) const;\n- bool operator== (piece_block const& b) const;\n- bool operator!= (piece_block const& b) const;\n-\n- static const piece_block invalid;\n- piece_index_t piece_index {0};\n- int block_index = 0;\n-};\n+ reopen_map_ports\n+ This option indicates if the ports are mapped using natpmp and upnp. If\n+ mapping was already made, they are deleted and added again. This only\n+ works if natpmp and/or upnp are configured to be enable.\n+ [report_issue]\n+****** write_session_params() write_session_params_buf() read_session_params()\n+******\n+Declared in \"libtorrent/session_params.hpp\"\n+std::vector write_session_params_buf (session_params const& sp\n+ , save_state_flags_t flags = save_state_flags_t::all());\n+entry write_session_params (session_params const& sp\n+ , save_state_flags_t flags = save_state_flags_t::all());\n+session_params read_session_params (span buf\n+ , save_state_flags_t flags = save_state_flags_t::all());\n+session_params read_session_params (bdecode_node const& e\n+ , save_state_flags_t flags = save_state_flags_t::all());\n+These functions serialize and de-serialize a session_params object to and from\n+bencoded form. The session_params object is used to initialize a new session\n+using the state from a previous one (or by programmatically configure the\n+session up-front). The flags parameter can be used to only save and load\n+certain aspects of the session's state. The _buf suffix indicates the function\n+operates on buffer rather than the bencoded structure. The torrents in a\n+session are not part of the session_params state, they have to be restored\n+separately.\n [report_issue]\n ****** info_hash_t ******\n Declared in \"libtorrent/info_hash.hpp\"\n class holding the info-hash of a torrent. It can hold a v1 info-hash (SHA-1) or\n a v2 info-hash (SHA-256) or both.\n Note\n If has_v2() is false then the v1 hash might actually be a truncated v2 hash\n struct info_hash_t\n {\n- explicit info_hash_t (sha256_hash h2) noexcept;\n+ info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n explicit info_hash_t (sha1_hash h1) noexcept;\n+ explicit info_hash_t (sha256_hash h2) noexcept;\n info_hash_t () noexcept = default;\n- info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n- bool has_v2 () const;\n- bool has_v1 () const;\n bool has (protocol_version v) const;\n+ bool has_v1 () const;\n+ bool has_v2 () const;\n sha1_hash get (protocol_version v) const;\n sha1_hash get_best () const;\n friend bool operator!= (info_hash_t const& lhs, info_hash_t const& rhs);\n friend bool operator== (info_hash_t const& lhs, info_hash_t const& rhs)\n noexcept;\n template void for_each (F f) const;\n bool operator< (info_hash_t const& o) const;\n friend std::ostream& operator<< (std::ostream& os, info_hash_t const& ih);\n \n sha1_hash v1;\n sha256_hash v2;\n };\n [report_issue]\n ***** info_hash_t() *****\n-explicit info_hash_t (sha256_hash h2) noexcept;\n+info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n explicit info_hash_t (sha1_hash h1) noexcept;\n+explicit info_hash_t (sha256_hash h2) noexcept;\n info_hash_t () noexcept = default;\n-info_hash_t (sha1_hash h1, sha256_hash h2) noexcept;\n The default constructor creates an object that has neither a v1 or v2 hash.\n For backwards compatibility, make it possible to construct directly from a v1\n hash. This constructor allows implicit conversion from a v1 hash, but the\n implicitness is deprecated.\n [report_issue]\n-***** has() has_v2() has_v1() *****\n-bool has_v2 () const;\n-bool has_v1 () const;\n+***** has() has_v1() has_v2() *****\n bool has (protocol_version v) const;\n+bool has_v1 () const;\n+bool has_v2 () const;\n returns true if the corresponding info hash is present in this object.\n [report_issue]\n ***** get() *****\n sha1_hash get (protocol_version v) const;\n returns the has for the specified protocol version\n [report_issue]\n ***** get_best() *****\n@@ -3663,14 +1861,29 @@\n to disk before downloading more.\n [report_issue]\n read_state write_state\n bitmasks indicating what state this peer is in with regards to sending\n and receiving data. The states are defined as independent flags of type\n bandwidth_state_flags_t, in this class.\n [report_issue]\n+****** piece_block ******\n+Declared in \"libtorrent/piece_block.hpp\"\n+struct piece_block\n+{\n+ piece_block (piece_index_t p_index, int b_index);\n+ piece_block () = default;\n+ bool operator< (piece_block const& b) const;\n+ bool operator== (piece_block const& b) const;\n+ bool operator!= (piece_block const& b) const;\n+\n+ static const piece_block invalid;\n+ piece_index_t piece_index {0};\n+ int block_index = 0;\n+};\n+[report_issue]\n ****** peer_request ******\n Declared in \"libtorrent/peer_request.hpp\"\n represents a byte range within a piece. Internally this is is used for incoming\n piece requests.\n struct peer_request\n {\n bool operator== (peer_request const& r) const;\n@@ -3689,20 +1902,49 @@\n The index of the piece in which the range starts.\n [report_issue]\n start\n The byte offset within that piece where the range starts.\n [report_issue]\n length\n The size of the range, in bytes.\n+ [report_issue]\n+****** load_torrent_file() load_torrent_parsed() load_torrent_buffer() ******\n+Declared in \"libtorrent/load_torrent.hpp\"\n+add_torrent_params load_torrent_buffer (\n+ span buffer, load_torrent_limits const& cfg);\n+add_torrent_params load_torrent_file (\n+ std::string const& filename, load_torrent_limits const& cfg);\n+add_torrent_params load_torrent_file (\n+ std::string const& filename);\n+add_torrent_params load_torrent_parsed (\n+ bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n+add_torrent_params load_torrent_buffer (\n+ span buffer);\n+add_torrent_params load_torrent_parsed (\n+ bdecode_node const& torrent_file);\n+These functions load the content of a .torrent file into an add_torrent_params\n+object. The immutable part of a torrent file (the info-dictionary) is stored in\n+the ti field in the add_torrent_params object (as a torrent_info object). The\n+returned object is suitable to be:\n+ * added to a session via add_torrent() or async_add_torrent()\n+ * saved as a .torrent_file via write_torrent_file()\n+ * turned into a magnet link via make_magnet_uri()\n+[report_issue]\n+****** truncate_files() ******\n+Declared in \"libtorrent/truncate.hpp\"\n+void truncate_files (file_storage const& fs, std::string const& save_path,\n+storage_error& ec);\n+Truncates files larger than specified in the file_storage, saved under the\n+specified save_path.\n [report_issue]\n ****** make_magnet_uri() ******\n Declared in \"libtorrent/magnet_uri.hpp\"\n-std::string make_magnet_uri (torrent_handle const& handle);\n-std::string make_magnet_uri (add_torrent_params const& atp);\n std::string make_magnet_uri (torrent_info const& info);\n+std::string make_magnet_uri (add_torrent_params const& atp);\n+std::string make_magnet_uri (torrent_handle const& handle);\n Generates a magnet URI from the specified torrent.\n Several fields from the add_torrent_params objects are recorded in the magnet\n link. In order to not include them, they have to be cleared before calling\n make_magnet_uri(). These fields are used:\n ti, info_hashes, url_seeds, dht_nodes, file_priorities, trackers,\n name, peers.\n Depending on what the use case for the resulting magnet link is, clearing peers\n@@ -3717,76 +1959,55 @@\n The overload that takes a torrent_handle will make blocking calls to query\n information about the torrent. If the torrent handle is invalid, an empty\n string is returned.\n For more information about magnet links, see magnet_links.\n [report_issue]\n ****** parse_magnet_uri() ******\n Declared in \"libtorrent/magnet_uri.hpp\"\n-add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);\n add_torrent_params parse_magnet_uri (string_view uri);\n void parse_magnet_uri (string_view uri, add_torrent_params& p, error_code& ec);\n+add_torrent_params parse_magnet_uri (string_view uri, error_code& ec);\n This function parses out information from the magnet link and populates the\n add_torrent_params object. The overload that does not take an error_code\n reference will throw a system_error on error The overload taking an\n add_torrent_params reference will fill in the fields specified in the magnet\n URI.\n- [report_issue]\n-****** load_torrent_buffer() load_torrent_parsed() load_torrent_file() ******\n-Declared in \"libtorrent/load_torrent.hpp\"\n-add_torrent_params load_torrent_buffer (\n- span buffer);\n-add_torrent_params load_torrent_buffer (\n- span buffer, load_torrent_limits const& cfg);\n-add_torrent_params load_torrent_file (\n- std::string const& filename, load_torrent_limits const& cfg);\n-add_torrent_params load_torrent_parsed (\n- bdecode_node const& torrent_file, load_torrent_limits const& cfg);\n-add_torrent_params load_torrent_file (\n- std::string const& filename);\n-add_torrent_params load_torrent_parsed (\n- bdecode_node const& torrent_file);\n-These functions load the content of a .torrent file into an add_torrent_params\n-object. The immutable part of a torrent file (the info-dictionary) is stored in\n-the ti field in the add_torrent_params object (as a torrent_info object). The\n-returned object is suitable to be:\n- * added to a session via add_torrent() or async_add_torrent()\n- * saved as a .torrent_file via write_torrent_file()\n- * turned into a magnet link via make_magnet_uri()\n [report_issue]\n ****** version() ******\n Declared in \"libtorrent/version.hpp\"\n char const* version ();\n returns the libtorrent version as string form in this format:\n \"...\"\n [report_issue]\n-****** truncate_files() ******\n-Declared in \"libtorrent/truncate.hpp\"\n-void truncate_files (file_storage const& fs, std::string const& save_path,\n-storage_error& ec);\n-Truncates files larger than specified in the file_storage, saved under the\n-specified save_path.\n-[report_issue]\n-****** enum connection_type ******\n-Declared in \"libtorrent/peer_connection.hpp\"\n- ____________________________\n-|name______|value|description|\n-|bittorrent|0____|\u00a0_________|\n-|url_seed__|1____|\u00a0_________|\n-|http_seed_|2____|\u00a0_________|\n+****** enum protocol_version ******\n+Declared in \"libtorrent/info_hash.hpp\"\n+ _____________________________________________________________________\n+|name|value|description_______________________________________________|\n+|V1__|0____|The_original_BitTorrent_version,_using_SHA-1_hashes_______|\n+|V2__|1____|Version_2_of_the_BitTorrent_protocol,_using_SHA-256_hashes|\n+|NUM_|2____|\u00a0________________________________________________________|\n [report_issue]\n ****** enum event_t ******\n Declared in \"libtorrent/tracker_manager.hpp\"\n ___________________________\n |name_____|value|description|\n |none_____|0____|\u00a0_________|\n |completed|1____|\u00a0_________|\n |started__|2____|\u00a0_________|\n |stopped__|3____|\u00a0_________|\n |paused___|4____|\u00a0_________|\n [report_issue]\n+****** enum connection_type ******\n+Declared in \"libtorrent/peer_connection.hpp\"\n+ ____________________________\n+|name______|value|description|\n+|bittorrent|0____|\u00a0_________|\n+|url_seed__|1____|\u00a0_________|\n+|http_seed_|2____|\u00a0_________|\n+[report_issue]\n ****** enum socket_type_t ******\n Declared in \"libtorrent/socket_type.hpp\"\n ____________________________\n |name______|value|description|\n |tcp_______|0____|\u00a0_________|\n |socks5____|1____|\u00a0_________|\n |http______|2____|\u00a0_________|\n@@ -3808,34 +2029,50 @@\n Declared in \"libtorrent/portmap.hpp\"\n ______________________\n |name|value|description|\n |none|0____|\u00a0_________|\n |tcp_|1____|\u00a0_________|\n |udp_|2____|\u00a0_________|\n [report_issue]\n-****** enum protocol_version ******\n-Declared in \"libtorrent/info_hash.hpp\"\n- _____________________________________________________________________\n-|name|value|description_______________________________________________|\n-|V1__|0____|The_original_BitTorrent_version,_using_SHA-1_hashes_______|\n-|V2__|1____|Version_2_of_the_BitTorrent_protocol,_using_SHA-256_hashes|\n-|NUM_|2____|\u00a0________________________________________________________|\n-[report_issue]\n ****** download_priority_t ******\n Declared in \"libtorrent/download_priority.hpp\"\n dont_download\n Don't download the file or piece. Partial pieces may still be downloaded\n when setting file priorities.\n default_priority\n The default priority for files and pieces.\n low_priority\n The lowest priority for files and pieces.\n top_priority\n The highest priority for files and pieces.\n [report_issue]\n+****** pex_flags_t ******\n+Declared in \"libtorrent/pex_flags.hpp\"\n+ pex_encryption\n+ the peer supports protocol encryption\n+ pex_seed\n+ the peer is a seed\n+ pex_utp\n+ the peer supports the uTP, transport protocol over UDP.\n+ pex_holepunch\n+ the peer supports the holepunch extension If this flag is received from a\n+ peer, it can be used as a rendezvous point in case direct connections to\n+ the peer fail\n+ pex_lt_v2\n+ protocol v2 this is not a standard flag, it is only used internally\n+[report_issue]\n+****** int ******\n+Declared in \"libtorrent/version.hpp\"\n+ version_major\n+ the major, minor and tiny versions of libtorrent\n+ version_minor\n+ the major, minor and tiny versions of libtorrent\n+ version_tiny\n+ the major, minor and tiny versions of libtorrent\n+[report_issue]\n ****** torrent_flags_t ******\n Declared in \"libtorrent/torrent_flags.hpp\"\n seed_mode\n If seed_mode is set, libtorrent will assume that all files are present\n for this torrent and that they all match the hashes in the torrent file.\n Each time a peer requests to download a block, the piece is verified\n against the hash, unless it has been verified already. If a hash fails,\n@@ -3994,624 +2231,1221 @@\n file_priorities is still set for some files. Any file not covered by the\n file_priorities list will be set to normal download priority, unless this\n flag is set, in which case they will be set to 0 (dont_download).\n all\n all torrent flags combined. Can conveniently be used when creating masks\n for flags\n [report_issue]\n-****** int ******\n-Declared in \"libtorrent/version.hpp\"\n- version_major\n- the major, minor and tiny versions of libtorrent\n- version_minor\n- the major, minor and tiny versions of libtorrent\n- version_tiny\n- the major, minor and tiny versions of libtorrent\n-[report_issue]\n ****** char const* ******\n Declared in \"libtorrent/version.hpp\"\n version_str\n the libtorrent version in string form\n [report_issue]\n ****** std::uint64_t ******\n Declared in \"libtorrent/version.hpp\"\n version_revision\n the git commit of this libtorrent version\n [report_issue]\n-****** pex_flags_t ******\n-Declared in \"libtorrent/pex_flags.hpp\"\n- pex_encryption\n- the peer supports protocol encryption\n- pex_seed\n- the peer is a seed\n- pex_utp\n- the peer supports the uTP, transport protocol over UDP.\n- pex_holepunch\n- the peer supports the holepunch extension If this flag is received from a\n- peer, it can be used as a rendezvous point in case direct connections to\n- the peer fail\n- pex_lt_v2\n- protocol v2 this is not a standard flag, it is only used internally\n+****** add_torrent_params ******\n+Declared in \"libtorrent/add_torrent_params.hpp\"\n+The add_torrent_params contains all the information in a .torrent file along\n+with all information necessary to add that torrent to a session. The key fields\n+when adding a torrent are:\n+ * ti - the immutable info-dict part of the torrent\n+ * info_hash - when you don't have the metadata (.torrent file). This\n+ uniquely identifies the torrent and can validate the info-dict when\n+ received from the swarm.\n+In order to add a torrent to a session, one of those fields must be set in\n+addition to save_path. The add_torrent_params object can then be passed into\n+one of the session::add_torrent() overloads or session::async_add_torrent().\n+If you only specify the info-hash, the torrent file will be downloaded from\n+peers, which requires them to support the metadata extension. For the metadata\n+extension to work, libtorrent must be built with extensions enabled\n+(TORRENT_DISABLE_EXTENSIONS must not be defined). It also takes an optional\n+name argument. This may be left empty in case no name should be assigned to the\n+torrent. In case it's not, the name is used for the torrent as long as it\n+doesn't have metadata. See torrent_handle::name.\n+The add_torrent_params is also used when requesting resume data for a torrent.\n+It can be saved to and restored from a file and added back to a new session.\n+For serialization and de-serialization of add_torrent_params objects, see\n+read_resume_data() and write_resume_data().\n+The add_torrent_params is also used to represent a parsed .torrent file. It can\n+be loaded via load_torrent_file(), load_torrent_buffer() and\n+load_torrent_parsed(). It can be saved via write_torrent_file().\n+struct add_torrent_params\n+{\n+ int version = LIBTORRENT_VERSION_NUM;\n+ std::shared_ptr ti;\n+ aux::noexcept_movable> trackers;\n+ aux::noexcept_movable> tracker_tiers;\n+ aux::noexcept_movable>> dht_nodes;\n+ std::string name;\n+ std::string save_path;\n+ storage_mode_t storage_mode = storage_mode_sparse;\n+ client_data_t userdata;\n+ aux::noexcept_movable> file_priorities;\n+ std::string trackerid;\n+ torrent_flags_t flags = torrent_flags::default_flags;\n+ info_hash_t info_hashes;\n+ int max_uploads = -1;\n+ int max_connections = -1;\n+ int upload_limit = -1;\n+ int download_limit = -1;\n+ std::int64_t total_uploaded = 0;\n+ std::int64_t total_downloaded = 0;\n+ int active_time = 0;\n+ int finished_time = 0;\n+ int seeding_time = 0;\n+ std::time_t added_time = 0;\n+ std::time_t completed_time = 0;\n+ std::time_t last_seen_complete = 0;\n+ int num_complete = -1;\n+ int num_incomplete = -1;\n+ int num_downloaded = -1;\n+ aux::noexcept_movable> http_seeds;\n+ aux::noexcept_movable> url_seeds;\n+ aux::noexcept_movable> peers;\n+ aux::noexcept_movable> banned_peers;\n+ aux::noexcept_movable> unfinished_pieces;\n+ typed_bitfield have_pieces;\n+ typed_bitfield verified_pieces;\n+ aux::noexcept_movable> piece_priorities;\n+ aux::vector, file_index_t> merkle_trees;\n+ aux::vector, file_index_t> merkle_tree_mask;\n+ aux::vector, file_index_t> verified_leaf_hashes;\n+ aux::noexcept_movable> renamed_files;\n+ std::time_t last_download = 0;\n+ std::time_t last_upload = 0;\n+};\n [report_issue]\n-****** ip_filter ******\n-Declared in \"libtorrent/ip_filter.hpp\"\n-The ip_filter class is a set of rules that uniquely categorizes all ip\n-addresses as allowed or disallowed. The default constructor creates a single\n-rule that allows all addresses (0.0.0.0 - 255.255.255.255 for the IPv4 range,\n-and the equivalent range covering all addresses for the IPv6 range).\n-A default constructed ip_filter does not filter any address.\n-struct ip_filter\n+ version\n+ filled in by the constructor and should be left untouched. It is used for\n+ forward binary compatibility.\n+[report_issue]\n+ ti\n+ torrent_info object with the torrent to add. Unless the info_hash is set,\n+ this is required to be initialized.\n+[report_issue]\n+ trackers\n+ If the torrent doesn't have a tracker, but relies on the DHT to find\n+ peers, the trackers can specify tracker URLs for the torrent.\n+[report_issue]\n+ tracker_tiers\n+ the tiers the URLs in trackers belong to. Trackers belonging to different\n+ tiers may be treated differently, as defined by the multi tracker\n+ extension. This is optional, if not specified trackers are assumed to be\n+ part of tier 0, or whichever the last tier was as iterating over the\n+ trackers.\n+[report_issue]\n+ dht_nodes\n+ a list of hostname and port pairs, representing DHT nodes to be added to\n+ the session (if DHT is enabled). The hostname may be an IP address.\n+[report_issue]\n+ name\n+ in case there's no other name in this torrent, this name will be used.\n+ The name out of the torrent_info object takes precedence if available.\n+[report_issue]\n+ save_path\n+ the path where the torrent is or will be stored.\n+ Note\n+ On windows this path (and other paths) are interpreted as UNC paths. This\n+ means they must use backslashes as directory separators and may not\n+ contain the special directories \".\" or \"..\".\n+ Setting this to an absolute path performs slightly better than a relative\n+ path.\n+[report_issue]\n+ storage_mode\n+ One of the values from storage_mode_t. For more information, see storage\n+ allocation.\n+[report_issue]\n+ userdata\n+ The userdata parameter is optional and will be passed on to the extension\n+ constructor functions, if any (see torrent_handle::add_extension()). It\n+ will also be stored in the torrent object and can be retrieved by calling\n+ userdata().\n+[report_issue]\n+ file_priorities\n+ can be set to control the initial file priorities when adding a torrent.\n+ The semantics are the same as for torrent_handle::prioritize_files(). The\n+ file priorities specified in here take precedence over those specified in\n+ the resume data, if any. If this vector of file priorities is shorter\n+ than the number of files in the torrent, the remaining files (not covered\n+ by this) will still have the default download priority. This default can\n+ be changed by setting the default_dont_download torrent_flag.\n+[report_issue]\n+ trackerid\n+ the default tracker id to be used when announcing to trackers. By default\n+ this is empty, and no tracker ID is used, since this is an optional\n+ argument. If a tracker returns a tracker ID, that ID is used instead of\n+ this.\n+[report_issue]\n+ flags\n+ flags controlling aspects of this torrent and how it's added. See\n+ torrent_flags_t for details.\n+ Note\n+ The flags field is initialized with default flags by the constructor. In\n+ order to preserve default behavior when clearing or setting other flags,\n+ make sure to bitwise OR or in a flag or bitwise AND the inverse of a flag\n+ to clear it.\n+[report_issue]\n+ info_hashes\n+ set this to the info hash of the torrent to add in case the info-hash is\n+ the only known property of the torrent. i.e. you don't have a .torrent\n+ file nor a magnet link. To add a magnet link, use parse_magnet_uri() to\n+ populate fields in the add_torrent_params object.\n+ [report_issue]\n+ max_uploads max_connections\n+ max_uploads, max_connections, upload_limit, download_limit correspond to\n+ the set_max_uploads(), set_max_connections(), set_upload_limit() and\n+ set_download_limit() functions on torrent_handle. These values let you\n+ initialize these settings when the torrent is added, instead of calling\n+ these functions immediately following adding it.\n+ -1 means unlimited on these settings just like their counterpart\n+ functions on torrent_handle\n+ For fine grained control over rate limits, including making them apply to\n+ local peers, see peer_classes.\n+ [report_issue]\n+ upload_limit download_limit\n+ the upload and download rate limits for this torrent, specified in bytes\n+ per second. -1 means unlimited.\n+ [report_issue]\n+ total_uploaded total_downloaded\n+ the total number of bytes uploaded and downloaded by this torrent so far.\n+ [report_issue]\n+ active_time finished_time seeding_time\n+ the number of seconds this torrent has spent in started, finished and\n+ seeding state so far, respectively.\n+ [report_issue]\n+ added_time completed_time\n+ if set to a non-zero value, this is the posix time of when this torrent\n+ was first added, including previous runs/sessions. If set to zero, the\n+ internal added_time will be set to the time of when add_torrent() is\n+ called.\n+[report_issue]\n+ last_seen_complete\n+ if set to non-zero, initializes the time (expressed in posix time) when\n+ we last saw a seed or peers that together formed a complete copy of the\n+ torrent. If left set to zero, the internal counterpart to this field will\n+ be updated when we see a seed or a distributed copies >= 1.0.\n+ [report_issue]\n+ num_complete num_incomplete num_downloaded\n+ these field can be used to initialize the torrent's cached scrape data.\n+ The scrape data is high level metadata about the current state of the\n+ swarm, as returned by the tracker (either when announcing to it or by\n+ sending a specific scrape request). num_complete is the number of peers\n+ in the swarm that are seeds, or have every piece in the torrent.\n+ num_incomplete is the number of peers in the swarm that do not have every\n+ piece. num_downloaded is the number of times the torrent has been\n+ downloaded (not initiated, but the number of times a download has\n+ completed).\n+ Leaving any of these values set to -1 indicates we don't know, or we have\n+ not received any scrape data.\n+ [report_issue]\n+ http_seeds url_seeds\n+ URLs can be added to these two lists to specify additional web seeds to\n+ be used by the torrent. If the flag_override_web_seeds is set, these will\n+ be the _only_ ones to be used. i.e. any web seeds found in the .torrent\n+ file will be overridden.\n+ http_seeds expects URLs to web servers implementing the original HTTP\n+ seed specification BEP_17.\n+ url_seeds expects URLs to regular web servers, aka \"get right\" style,\n+ specified in BEP_19.\n+[report_issue]\n+ peers\n+ peers to add to the torrent, to be tried to be connected to as bittorrent\n+ peers.\n+[report_issue]\n+ banned_peers\n+ peers banned from this torrent. The will not be connected to\n+[report_issue]\n+ unfinished_pieces\n+ this is a map of partially downloaded piece. The key is the piece index\n+ and the value is a bitfield where each bit represents a 16 kiB block. A\n+ set bit means we have that block.\n+[report_issue]\n+ have_pieces\n+ this is a bitfield indicating which pieces we already have of this\n+ torrent.\n+[report_issue]\n+ verified_pieces\n+ when in seed_mode, pieces with a set bit in this bitfield have been\n+ verified to be valid. Other pieces will be verified the first time a peer\n+ requests it.\n+[report_issue]\n+ piece_priorities\n+ this sets the priorities for each individual piece in the torrent. Each\n+ element in the vector represent the piece with the same index. If you set\n+ both file- and piece priorities, file priorities will take precedence.\n+[report_issue]\n+ merkle_trees\n+ v2 hashes, if known\n+[report_issue]\n+ merkle_tree_mask\n+ if set, indicates which hashes are included in the corresponding vector\n+ of merkle_trees. These bitmasks always cover the full tree, a cleared bit\n+ means the hash is all zeros (i.e. not set) and set bit means the next\n+ hash in the corresponding vector in merkle_trees is the hash for that\n+ node. This is an optimization to avoid storing a lot of zeros.\n+[report_issue]\n+ verified_leaf_hashes\n+ bit-fields indicating which v2 leaf hashes have been verified against the\n+ root hash. If this vector is empty and merkle_trees is non-empty it\n+ implies that all hashes in merkle_trees are verified.\n+[report_issue]\n+ renamed_files\n+ this is a map of file indices in the torrent and new filenames to be\n+ applied before the torrent is added.\n+ [report_issue]\n+ last_download last_upload\n+ the posix time of the last time payload was received or sent for this\n+ torrent, respectively.\n+[report_issue]\n+****** client_data_t ******\n+Declared in \"libtorrent/client_data.hpp\"\n+A thin wrapper around a void pointer used as \"user data\". i.e. an opaque cookie\n+passed in to libtorrent and returned on demand. It adds type-safety by\n+requiring the same type be requested out of it as was assigned to it.\n+struct client_data_t\n {\n- ip_filter ();\n- ip_filter (ip_filter&&);\n- ip_filter& operator= (ip_filter const&);\n- ip_filter& operator= (ip_filter&&);\n- ip_filter (ip_filter const&);\n- ~ip_filter ();\n- bool empty () const;\n- void add_rule (address const& first, address const& last, std::uint32_t\n-flags);\n- std::uint32_t access (address const& addr) const;\n- filter_tuple_t export_filter () const;\n+ client_data_t () = default;\n+ explicit client_data_t (T* v);\n+ client_data_t& operator= (T* v);\n+ explicit operator T () const;\n+ T* get () const;\n+ client_data_t& operator= (void*) = delete;\n+ operator void const* () const = delete;\n+ client_data_t& operator= (void const*) = delete;\n+ operator void* () const = delete;\n \n- enum access_flags\n- {\n- blocked,\n- };\n+ template ::value>::type>\n };\n [report_issue]\n-***** empty() *****\n-bool empty () const;\n-returns true if the filter does not contain any rules\n+***** client_data_t() *****\n+client_data_t () = default;\n+construct a nullptr client data\n+ [report_issue]\n+***** const*() void*() operator=() *****\n+client_data_t& operator= (void*) = delete;\n+operator void const* () const = delete;\n+client_data_t& operator= (void const*) = delete;\n+operator void* () const = delete;\n+we don't allow type-unsafe operations\n+You have some control over session configuration through the session::\n+apply_settings() member function. To change one or more configuration options,\n+create a settings_pack object and fill it with the settings to be set and pass\n+it in to session::apply_settings().\n+The settings_pack object is a collection of settings updates that are applied\n+to the session when passed to session::apply_settings(). It's empty when\n+constructed.\n+You have control over proxy and authorization settings and also the user-agent\n+that will be sent to the tracker. The user-agent will also be used to identify\n+the client with other peers.\n+Each configuration option is named with an enum value inside the settings_pack\n+class. These are the available settings:\n [report_issue]\n-***** add_rule() *****\n-void add_rule (address const& first, address const& last, std::uint32_t flags);\n-Adds a rule to the filter. first and last defines a range of ip addresses that\n-will be marked with the given flags. The flags can currently be 0, which means\n-allowed, or ip_filter::blocked, which means disallowed.\n-precondition: first.is_v4() == last.is_v4() && first.is_v6() == last.is_v6()\n-postcondition: access(x) == flags for every x in the range [first, last]\n-This means that in a case of overlapping ranges, the last one applied takes\n-precedence.\n+****** open_file_state ******\n+Declared in \"libtorrent/disk_interface.hpp\"\n+this contains information about a file that's currently open by the libtorrent\n+disk I/O subsystem. It's associated with a single torrent.\n+struct open_file_state\n+{\n+ file_index_t file_index;\n+ file_open_mode_t open_mode;\n+ time_point last_use;\n+};\n [report_issue]\n-***** access() *****\n-std::uint32_t access (address const& addr) const;\n-Returns the access permissions for the given address (addr). The permission can\n-currently be 0 or ip_filter::blocked. The complexity of this operation is O(log\n-n), where n is the minimum number of non-overlapping ranges to describe the\n-current filter.\n+ file_index\n+ the index of the file this entry refers to into the file_storage file\n+ list of this torrent. This starts indexing at 0.\n [report_issue]\n-***** export_filter() *****\n-filter_tuple_t export_filter () const;\n-This function will return the current state of the filter in the minimum number\n-of ranges possible. They are sorted from ranges in low addresses to high\n-addresses. Each entry in the returned vector is a range with the access control\n-specified in its flags field.\n-The return value is a tuple containing two range-lists. One for IPv4 addresses\n-and one for IPv6 addresses.\n+ open_mode\n+ open_mode is a bitmask of the file flags this file is currently opened\n+ with. For possible flags, see file_open_mode_t.\n+ Note that the read/write mode is not a bitmask. The two least significant\n+ bits are used to represent the read/write mode. Those bits can be masked\n+ out using the rw_mask constant.\n [report_issue]\n-***** enum access_flags *****\n-Declared in \"libtorrent/ip_filter.hpp\"\n- _____________________________________________________________________________\n-|name___|value|description____________________________________________________|\n-|blocked|1 |indicates that IPs in this range should not be connected to nor|\n-|_______|_____|accepted_as_incoming_connections_______________________________|\n+ last_use\n+ a (high precision) timestamp of when the file was last used.\n [report_issue]\n-****** port_filter ******\n-Declared in \"libtorrent/ip_filter.hpp\"\n-the port filter maps non-overlapping port ranges to flags. This is primarily\n-used to indicate whether a range of ports should be connected to or not. The\n-default is to have the full port range (0-65535) set to flag 0.\n-class port_filter\n+****** disk_interface ******\n+Declared in \"libtorrent/disk_interface.hpp\"\n+The disk_interface is the customization point for disk I/O in libtorrent.\n+implement this interface and provide a factory function to the session\n+constructor use custom disk I/O. All functions on the disk subsystem\n+(implementing disk_interface) are called from within libtorrent's network\n+thread. For disk I/O to be performed in a separate thread, the disk subsystem\n+has to manage that itself.\n+Although the functions are called async_*, they do not technically have to be\n+asynchronous, but they support being asynchronous, by expecting the result\n+passed back into a callback. The callbacks must be posted back onto the network\n+thread via the io_context object passed into the constructor. The callbacks\n+will be run in the network thread.\n+struct disk_interface\n {\n- port_filter ();\n- port_filter (port_filter const&);\n- port_filter& operator= (port_filter&&);\n- port_filter (port_filter&&);\n- ~port_filter ();\n- port_filter& operator= (port_filter const&);\n- void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t\n-flags);\n- std::uint32_t access (std::uint16_t port) const;\n+ virtual storage_holder new_torrent (storage_params const& p\n+ , std::shared_ptr const& torrent) = 0;\n+ virtual void remove_torrent (storage_index_t) = 0;\n+ virtual bool async_write (storage_index_t storage, peer_request const& r\n+ , char const* buf, std::shared_ptr o\n+ , std::function handler\n+ , disk_job_flags_t flags = {}) = 0;\n+ virtual void async_read (storage_index_t storage, peer_request const& r\n+ , std::function handler\n+ , disk_job_flags_t flags = {}) = 0;\n+ virtual void async_hash (storage_index_t storage, piece_index_t piece,\n+span v2\n+ , disk_job_flags_t flags\n+ , std::function handler) = 0;\n+ virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int\n+offset, disk_job_flags_t flags\n+ , std::function handler) = 0;\n+ virtual void async_move_storage (storage_index_t storage, std::string p,\n+move_flags_t flags\n+ , std::function\n+handler) = 0;\n+ virtual void async_release_files (storage_index_t storage\n+ , std::function handler = std::function()) = 0;\n+ virtual void async_check_files (storage_index_t storage\n+ , add_torrent_params const* resume_data\n+ , aux::vector links\n+ , std::function handler) = 0;\n+ virtual void async_stop_torrent (storage_index_t storage\n+ , std::function handler = std::function()) = 0;\n+ virtual void async_rename_file (storage_index_t storage\n+ , file_index_t index, std::string name\n+ , std::function handler) = 0;\n+ virtual void async_delete_files (storage_index_t storage, remove_flags_t\n+options\n+ , std::function handler) = 0;\n+ virtual void async_set_file_priority (storage_index_t storage\n+ , aux::vector prio\n+ , std::function)> handler) = 0;\n+ virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n+ , std::function handler) = 0;\n+ virtual void update_stats_counters (counters& c) const = 0;\n+ virtual std::vector get_status (storage_index_t) const = 0;\n+ virtual void abort (bool wait) = 0;\n+ virtual void submit_jobs () = 0;\n+ virtual void settings_updated () = 0;\n \n- enum access_flags\n- {\n- blocked,\n- };\n+ static constexpr disk_job_flags_t force_copy = 0_bit;\n+ static constexpr disk_job_flags_t sequential_access = 3_bit;\n+ static constexpr disk_job_flags_t volatile_read = 4_bit;\n+ static constexpr disk_job_flags_t v1_hash = 5_bit;\n+ static constexpr disk_job_flags_t flush_piece = 7_bit;\n };\n [report_issue]\n-***** add_rule() *****\n-void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);\n-set the flags for the specified port range (first, last) to flags overwriting\n-any existing rule for those ports. The range is inclusive, i.e. the port last\n-also has the flag set on it.\n+***** new_torrent() *****\n+virtual storage_holder new_torrent (storage_params const& p\n+ , std::shared_ptr const& torrent) = 0;\n+this is called when a new torrent is added. The shared_ptr can be used to hold\n+the internal torrent object alive as long as there are outstanding disk\n+operations on the storage. The returned storage_holder is an owning reference\n+to the underlying storage that was just created. It is fundamentally a\n+storage_index_t\n [report_issue]\n-***** access() *****\n-std::uint32_t access (std::uint16_t port) const;\n-test the specified port (port) for whether it is blocked or not. The returned\n-value is the flags set for this port. see access_flags.\n+***** remove_torrent() *****\n+virtual void remove_torrent (storage_index_t) = 0;\n+remove the storage with the specified index. This is not expected to delete any\n+files from disk, just to clean up any resources associated with the specified\n+storage.\n+ [report_issue]\n+***** async_write() async_read() *****\n+virtual bool async_write (storage_index_t storage, peer_request const& r\n+ , char const* buf, std::shared_ptr o\n+ , std::function handler\n+ , disk_job_flags_t flags = {}) = 0;\n+virtual void async_read (storage_index_t storage, peer_request const& r\n+ , std::function handler\n+ , disk_job_flags_t flags = {}) = 0;\n+perform a read or write operation from/to the specified storage index and the\n+specified request. When the operation completes, call handler possibly with a\n+disk_buffer_holder, holding the buffer with the result. Flags may be set to\n+affect the read operation. See disk_job_flags_t.\n+The disk_observer is a callback to indicate that the store buffer/disk write\n+queue is below the watermark to let peers start writing buffers to disk again.\n+When async_write() returns true, indicating the write queue is full, the peer\n+will stop further writes and wait for the passed-in disk_observer to be\n+notified before resuming.\n+Note that for async_read, the peer_request (r) is not necessarily aligned to\n+blocks (but it is most of the time). However, all writes (passed to\n+async_write) are guaranteed to be block aligned.\n [report_issue]\n-***** enum access_flags *****\n-Declared in \"libtorrent/ip_filter.hpp\"\n- ____________________________________________________________________________\n-|name___|value|description___________________________________________________|\n-|blocked|1 |this flag indicates that destination ports in the range should|\n-|_______|_____|not_be_connected_to___________________________________________|\n+***** async_hash() *****\n+virtual void async_hash (storage_index_t storage, piece_index_t piece,\n+span v2\n+ , disk_job_flags_t flags\n+ , std::function handler) = 0;\n+Compute hash(es) for the specified piece. Unless the v1_hash flag is set (in\n+flags), the SHA-1 hash of the whole piece does not need to be computed.\n+Thev2span is optional and can be empty, which means v2 hashes should not be\n+computed. If v2 is non-empty it must be at least large enough to hold all v2\n+blocks in the piece, and this function will fill in the span with the SHA-256\n+block hashes of the piece.\n [report_issue]\n-****** storage_params ******\n-Declared in \"libtorrent/storage_defs.hpp\"\n-a parameter pack used to construct the storage for a torrent, used in\n-disk_interface\n-struct storage_params\n+***** async_hash2() *****\n+virtual void async_hash2 (storage_index_t storage, piece_index_t piece, int\n+offset, disk_job_flags_t flags\n+ , std::function handler) = 0;\n+computes the v2 hash (SHA-256) of a single block. The block at offset in piece\n+piece.\n+[report_issue]\n+***** async_move_storage() *****\n+virtual void async_move_storage (storage_index_t storage, std::string p,\n+move_flags_t flags\n+ , std::function\n+handler) = 0;\n+called to request the files for the specified storage/torrent be moved to a new\n+location. It is the disk I/O object's responsibility to synchronize this with\n+any currently outstanding disk operations to the storage. Whether files are\n+replaced at the destination path or not is controlled by flags (see\n+move_flags_t).\n+[report_issue]\n+***** async_release_files() *****\n+virtual void async_release_files (storage_index_t storage\n+ , std::function handler = std::function()) = 0;\n+This is called on disk I/O objects to request they close all open files for the\n+specified storage/torrent. If file handles are not pooled/cached, it can be a\n+no-op. For truly asynchronous disk I/O, this should provide at least one point\n+in time when all files are closed. It is possible that later asynchronous\n+operations will re-open some of the files, by the time this completion handler\n+is called, that's fine.\n+[report_issue]\n+***** async_check_files() *****\n+virtual void async_check_files (storage_index_t storage\n+ , add_torrent_params const* resume_data\n+ , aux::vector links\n+ , std::function handler) = 0;\n+this is called when torrents are added to validate their resume data against\n+the files on disk. This function is expected to do a few things:\n+if links is non-empty, it contains a string for each file in the torrent. The\n+string being a path to an existing identical file. The default behavior is to\n+create hard links of those files into the storage of the new torrent (specified\n+by storage). An empty string indicates that there is no known identical file.\n+This is part of the \"mutable torrent\" feature, where files can be reused from\n+other torrents.\n+The resume_data points the resume data passed in by the client.\n+If the resume_data->flags field has the seed_mode flag set, all files/pieces\n+are expected to be on disk already. This should be verified. Not just the\n+existence of the file, but also that it has the correct size.\n+Any file with a piece set in the resume_data->have_pieces bitmask should exist\n+on disk, this should be verified. Pad files and files with zero priority may be\n+skipped.\n+[report_issue]\n+***** async_stop_torrent() *****\n+virtual void async_stop_torrent (storage_index_t storage\n+ , std::function handler = std::function()) = 0;\n+This is called when a torrent is stopped. It gives the disk I/O object an\n+opportunity to flush any data to disk that's currently kept cached. This\n+function should at least do the same thing as async_release_files().\n+[report_issue]\n+***** async_rename_file() *****\n+virtual void async_rename_file (storage_index_t storage\n+ , file_index_t index, std::string name\n+ , std::function handler) = 0;\n+This function is called when the name of a file in the specified storage has\n+been requested to be renamed. The disk I/O object is responsible for renaming\n+the file without racing with other potentially outstanding operations against\n+the file (such as read, write, move, etc.).\n+[report_issue]\n+***** async_delete_files() *****\n+virtual void async_delete_files (storage_index_t storage, remove_flags_t\n+options\n+ , std::function handler) = 0;\n+This function is called when some file(s) on disk have been requested to be\n+removed by the client. storage indicates which torrent is referred to. See\n+session_handle for remove_flags_t flags indicating which files are to be\n+removed. e.g. session_handle::delete_files - delete all files session_handle::\n+delete_partfile - only delete part file.\n+[report_issue]\n+***** async_set_file_priority() *****\n+virtual void async_set_file_priority (storage_index_t storage\n+ , aux::vector prio\n+ , std::function)> handler) = 0;\n+This is called to set the priority of some or all files. Changing the priority\n+from or to 0 may involve moving data to and from the partfile. The disk I/\n+O object is responsible for correctly synchronizing this work to not race with\n+any potentially outstanding asynchronous operations affecting these files.\n+prio is a vector of the file priority for all files. If it's shorter than the\n+total number of files in the torrent, they are assumed to be set to the default\n+priority.\n+[report_issue]\n+***** async_clear_piece() *****\n+virtual void async_clear_piece (storage_index_t storage, piece_index_t index\n+ , std::function handler) = 0;\n+This is called when a piece fails the hash check, to ensure there are no\n+outstanding disk operations to the piece before blocks are re-requested from\n+peers to overwrite the existing blocks. The disk I/O object does not need to\n+perform any action other than synchronize with all outstanding disk operations\n+to the specified piece before posting the result back.\n+[report_issue]\n+***** update_stats_counters() *****\n+virtual void update_stats_counters (counters& c) const = 0;\n+update_stats_counters() is called to give the disk storage an opportunity to\n+update gauges in the c stats counters, that aren't updated continuously as\n+operations are performed. This is called before a snapshot of the counters are\n+passed to the client.\n+[report_issue]\n+***** get_status() *****\n+virtual std::vector get_status (storage_index_t) const = 0;\n+Return a list of all the files that are currently open for the specified\n+storage/torrent. This is is just used for the client to query the currently\n+open files, and which modes those files are open in.\n+[report_issue]\n+***** abort() *****\n+virtual void abort (bool wait) = 0;\n+this is called when the session is starting to shut down. The disk I/O object\n+is expected to flush any outstanding write jobs, cancel hash jobs and initiate\n+tearing down of any internal threads. If wait is true, this should be\n+asynchronous. i.e. this call should not return until all threads have stopped\n+and all jobs have either been aborted or completed and the disk I/O object is\n+ready to be destructed.\n+[report_issue]\n+***** submit_jobs() *****\n+virtual void submit_jobs () = 0;\n+This will be called after a batch of disk jobs has been issues (via the async_*\n+). It gives the disk I/O object an opportunity to notify any potential\n+condition variables to wake up the disk thread(s). The async_* calls can of\n+course also notify condition variables, but doing it in this call allows for\n+batching jobs, by issuing the notification once for a collection of jobs.\n+[report_issue]\n+***** settings_updated() *****\n+virtual void settings_updated () = 0;\n+This is called to notify the disk I/O object that the settings have been\n+updated. In the disk io constructor, a settings_interface reference is passed\n+in. Whenever these settings are updated, this function is called to allow the\n+disk I/O object to react to any changed settings relevant to its operations.\n+[report_issue]\n+ force_copy\n+ force making a copy of the cached block, rather than getting a reference\n+ to a block already in the cache. This is used the block is expected to be\n+ overwritten very soon, by async_write()`, and we need access to the\n+ previous content.\n+[report_issue]\n+ sequential_access\n+ hint that there may be more disk operations with sequential access to the\n+ file\n+[report_issue]\n+ volatile_read\n+ don't keep the read block in cache. This is a hint that this block is\n+ unlikely to be read again anytime soon, and caching it would be wasteful.\n+[report_issue]\n+ v1_hash\n+ compute a v1 piece hash. This is only used by the async_hash() call. If\n+ this flag is not set in the async_hash() call, the SHA-1 piece hash does\n+ not need to be computed.\n+[report_issue]\n+ flush_piece\n+ this flag instructs a hash job that we just completed this piece, and it\n+ should be flushed to disk\n+[report_issue]\n+****** storage_holder ******\n+Declared in \"libtorrent/disk_interface.hpp\"\n+a unique, owning, reference to the storage of a torrent in a disk io subsystem\n+(class that implements disk_interface). This is held by the internal libtorrent\n+torrent object to tie the storage object allocated for a torrent to the\n+lifetime of the internal torrent object. When a torrent is removed from the\n+session, this holder is destructed and will inform the disk object.\n+struct storage_holder\n {\n- storage_params (file_storage const& f, file_storage const* mf\n- , std::string const& sp, storage_mode_t const sm\n- , aux::vector const& prio\n- , sha1_hash const& ih);\n+ storage_holder () = default;\n+ ~storage_holder ();\n+ storage_holder (storage_index_t idx, disk_interface& disk_io);\n+ explicit operator bool () const;\n+ operator storage_index_t () const;\n+ void reset ();\n+ storage_holder& operator= (storage_holder const&) = delete;\n+ storage_holder (storage_holder const&) = delete;\n+ storage_holder (storage_holder&& rhs) noexcept;\n+ storage_holder& operator= (storage_holder&& rhs) noexcept;\n+};\n+[report_issue]\n+****** settings_interface ******\n+Declared in \"libtorrent/settings_pack.hpp\"\n+the common interface to settings_pack and the internal representation of\n+settings.\n+struct settings_interface\n+{\n+ virtual bool has_val (int name) const = 0;\n+ virtual void set_str (int name, std::string val) = 0;\n+ virtual void set_bool (int name, bool val) = 0;\n+ virtual void set_int (int name, int val) = 0;\n+ virtual bool get_bool (int name) const = 0;\n+ virtual int get_int (int name) const = 0;\n+ virtual std::string const& get_str (int name) const = 0;\n+};\n+[report_issue]\n+****** disk_observer ******\n+Declared in \"libtorrent/disk_observer.hpp\"\n+struct disk_observer\n+{\n+ virtual void on_disk () = 0;\n+};\n+[report_issue]\n+***** on_disk() *****\n+virtual void on_disk () = 0;\n+called when the disk cache size has dropped below the low watermark again and\n+we can resume downloading from peers\n+[report_issue]\n+****** buffer_allocator_interface ******\n+Declared in \"libtorrent/disk_buffer_holder.hpp\"\n+the interface for freeing disk buffers, used by the disk_buffer_holder. when\n+implementing disk_interface, this must also be implemented in order to return\n+disk buffers back to libtorrent\n+struct buffer_allocator_interface\n+{\n+ virtual void free_disk_buffer (char* b) = 0;\n+};\n+[report_issue]\n+****** disk_buffer_holder ******\n+Declared in \"libtorrent/disk_buffer_holder.hpp\"\n+The disk buffer holder acts like a unique_ptr that frees a disk buffer when\n+it's destructed\n+If this buffer holder is moved-from, default constructed or reset, data() will\n+return nullptr.\n+struct disk_buffer_holder\n+{\n+ disk_buffer_holder& operator= (disk_buffer_holder&&) & noexcept;\n+ disk_buffer_holder (disk_buffer_holder&&) noexcept;\n+ disk_buffer_holder& operator= (disk_buffer_holder const&) = delete;\n+ disk_buffer_holder (disk_buffer_holder const&) = delete;\n+ disk_buffer_holder (buffer_allocator_interface& alloc\n+ , char* buf, int sz) noexcept;\n+ disk_buffer_holder () noexcept = default;\n+ ~disk_buffer_holder ();\n+ char* data () const noexcept;\n+ void reset ();\n+ void swap (disk_buffer_holder& h) noexcept;\n+ bool is_mutable () const noexcept;\n+ explicit operator bool () const noexcept;\n+ std::ptrdiff_t size () const;\n+};\n+[report_issue]\n+***** disk_buffer_holder() *****\n+disk_buffer_holder (buffer_allocator_interface& alloc\n+ , char* buf, int sz) noexcept;\n+construct a buffer holder that will free the held buffer using a disk buffer\n+pool directly (there's only one disk_buffer_pool per session)\n+[report_issue]\n+***** disk_buffer_holder() *****\n+disk_buffer_holder () noexcept = default;\n+default construct a holder that does not own any buffer\n+[report_issue]\n+***** ~disk_buffer_holder() *****\n+~disk_buffer_holder ();\n+frees disk buffer held by this object\n+[report_issue]\n+***** data() *****\n+char* data () const noexcept;\n+return a pointer to the held buffer, if any. Otherwise returns nullptr.\n+[report_issue]\n+***** reset() *****\n+void reset ();\n+free the held disk buffer, if any, and clear the holder. This sets the holder\n+object to a default-constructed state\n+[report_issue]\n+***** swap() *****\n+void swap (disk_buffer_holder& h) noexcept;\n+swap pointers of two disk buffer holders.\n+[report_issue]\n+***** is_mutable() *****\n+bool is_mutable () const noexcept;\n+if this returns true, the buffer may not be modified in place\n+[report_issue]\n+***** bool() *****\n+explicit operator bool () const noexcept;\n+implicitly convertible to true if the object is currently holding a buffer\n+[report_issue]\n+****** file_open_mode_t ******\n+Declared in \"libtorrent/disk_interface.hpp\"\n+ read_only\n+ open the file for reading only\n+ write_only\n+ open the file for writing only\n+ read_write\n+ open the file for reading and writing\n+ rw_mask\n+ the mask for the bits determining read or write mode\n+ sparse\n+ open the file in sparse mode (if supported by the filesystem).\n+ no_atime\n+ don't update the access timestamps on the file (if supported by the\n+ operating system and filesystem). this generally improves disk\n+ performance.\n+ random_access\n+ open the file for random access. This disables read-ahead logic\n+ mmapped\n+ the file is memory mapped\n+[report_issue]\n+****** web_seed_entry ******\n+Declared in \"libtorrent/torrent_info.hpp\"\n+the web_seed_entry holds information about a web seed (also known as URL seed\n+or HTTP seed). It is essentially a URL with some state associated with it. For\n+more information, see BEP_17 and BEP_19.\n+struct web_seed_entry\n+{\n+ bool operator== (web_seed_entry const& e) const;\n+ bool operator< (web_seed_entry const& e) const;\n \n- file_storage const& files;\n- file_storage const* mapped_files = nullptr;\n- std::string const& path;\n- storage_mode_t mode {storage_mode_sparse};\n- aux::vector const& priorities;\n- sha1_hash info_hash;\n+ enum type_t\n+ {\n+ url_seed,\n+ http_seed,\n+ };\n+\n+ std::string url;\n+ std::string auth;\n+ headers_t extra_headers;\n+ std::uint8_t type;\n };\n [report_issue]\n-****** file_slice ******\n-Declared in \"libtorrent/file_storage.hpp\"\n-represents a window of a file in a torrent.\n-The file_index refers to the index of the file (in the torrent_info). To get\n-the path and filename, use file_path() and give the file_index as argument. The\n-offset is the byte offset in the file where the range starts, and size is the\n-number of bytes this range is. The size + offset will never be greater than the\n-file size.\n-struct file_slice\n+***** operator==() *****\n+bool operator== (web_seed_entry const& e) const;\n+URL and type comparison\n+[report_issue]\n+***** operator<() *****\n+bool operator< (web_seed_entry const& e) const;\n+URL and type less-than comparison\n+[report_issue]\n+***** enum type_t *****\n+Declared in \"libtorrent/torrent_info.hpp\"\n+ ___________________________\n+|name_____|value|description|\n+|url_seed_|0____|\u00a0_________|\n+|http_seed|1____|\u00a0_________|\n+[report_issue]\n+ url\n+ The URL of the web seed\n+[report_issue]\n+ auth\n+ Optional authentication. If this is set, it's passed in as HTTP basic\n+ auth to the web seed. The format is: username:password.\n+[report_issue]\n+ extra_headers\n+ Any extra HTTP headers that need to be passed to the web seed\n+[report_issue]\n+ type\n+ The type of web seed (see type_t)\n+[report_issue]\n+****** load_torrent_limits ******\n+Declared in \"libtorrent/torrent_info.hpp\"\n+this object holds configuration options for limits to use when loading\n+torrents. They are meant to prevent loading potentially malicious torrents that\n+cause excessive memory allocations.\n+struct load_torrent_limits\n {\n- file_index_t file_index;\n- std::int64_t offset;\n- std::int64_t size;\n+ int max_buffer_size = 10000000;\n+ int max_pieces = 0x200000;\n+ int max_decode_depth = 100;\n+ int max_decode_tokens = 3000000;\n };\n [report_issue]\n- file_index\n- the index of the file\n+ max_buffer_size\n+ the max size of a .torrent file to load into RAM\n [report_issue]\n- offset\n- the offset from the start of the file, in bytes\n+ max_pieces\n+ the max number of pieces allowed in the torrent\n [report_issue]\n- size\n- the size of the window, in bytes\n+ max_decode_depth\n+ the max recursion depth in the bdecoded structure\n [report_issue]\n-****** file_storage ******\n-Declared in \"libtorrent/file_storage.hpp\"\n-The file_storage class represents a file list and the piece size. Everything\n-necessary to interpret a regular bittorrent storage file structure.\n-class file_storage\n+ max_decode_tokens\n+ the max number of bdecode tokens\n+[report_issue]\n+****** torrent_info ******\n+Declared in \"libtorrent/torrent_info.hpp\"\n+the torrent_info class holds the information found in a .torrent file.\n+class torrent_info\n {\n- bool is_valid () const;\n- void reserve (int num_files);\n- void add_file_borrow (error_code& ec, string_view filename\n- , std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}, char const* filehash = nullptr\n- , std::int64_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n- void add_file (std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}\n- , std::time_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n- void add_file (error_code& ec, std::string const& path, std::int64_t\n-file_size\n- , file_flags_t file_flags = {}\n- , std::time_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n- void add_file_borrow (string_view filename\n- , std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}, char const* filehash = nullptr\n- , std::int64_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n+ torrent_info (char const* buffer, int size, error_code& ec);\n+ explicit torrent_info (std::string const& filename);\n+ torrent_info (bdecode_node const& torrent_file, error_code& ec);\n+ explicit torrent_info (span buffer, from_span_t);\n+ torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n+ torrent_info (span buffer, load_torrent_limits const& cfg,\n+from_span_t);\n+ torrent_info (span buffer, error_code& ec, from_span_t);\n+ torrent_info (bdecode_node const& torrent_file, load_torrent_limits const&\n+cfg);\n+ torrent_info (char const* buffer, int size);\n+ torrent_info (std::string const& filename, error_code& ec);\n+ explicit torrent_info (bdecode_node const& torrent_file);\n+ explicit torrent_info (info_hash_t const& info_hash);\n+ torrent_info (torrent_info const& t);\n+ ~torrent_info ();\n+ file_storage const& files () const;\n+ file_storage const& orig_files () const;\n void rename_file (file_index_t index, std::string const& new_filename);\n- std::vector map_block (piece_index_t piece, std::int64_t offset\n- , std::int64_t size) const;\n- peer_request map_file (file_index_t file, std::int64_t offset, int size)\n-const;\n- int num_files () const noexcept;\n- file_index_t end_file () const noexcept;\n- index_range file_range () const noexcept;\n+ void remap_files (file_storage const& f);\n+ void add_tracker (std::string const& url, int tier = 0);\n+ void clear_trackers ();\n+ std::vector const& trackers () const;\n+ void add_tracker (std::string const& url, int tier\n+ , announce_entry::tracker_source source);\n+ std::vector collections () const;\n+ std::vector similar_torrents () const;\n+ std::vector const& web_seeds () const;\n+ void set_web_seeds (std::vector seeds);\n+ void add_url_seed (std::string const& url\n+ , std::string const& ext_auth = std::string()\n+ , web_seed_entry::headers_t const& ext_headers = web_seed_entry::\n+headers_t());\n+ void add_http_seed (std::string const& url\n+ , std::string const& extern_auth = std::string()\n+ , web_seed_entry::headers_t const& extra_headers = web_seed_entry::\n+headers_t());\n std::int64_t total_size () const;\n- void set_num_pieces (int n);\n+ int piece_length () const;\n int num_pieces () const;\n+ index_range piece_range () const;\n piece_index_t end_piece () const;\n piece_index_t last_piece () const;\n- index_range piece_range () const noexcept;\n- int piece_length () const;\n- void set_piece_length (int l);\n- int piece_size (piece_index_t index) const;\n- int piece_size2 (piece_index_t index) const;\n- int blocks_in_piece2 (piece_index_t index) const;\n- void set_name (std::string const& n);\n- std::string const& name () const;\n- void swap (file_storage& ti) noexcept;\n- void canonicalize ();\n- std::int64_t file_size (file_index_t index) const;\n- sha1_hash hash (file_index_t index) const;\n- std::string symlink (file_index_t index) const;\n- bool pad_file_at (file_index_t index) const;\n- std::time_t mtime (file_index_t index) const;\n- std::int64_t file_offset (file_index_t index) const;\n- sha256_hash root (file_index_t index) const;\n- string_view file_name (file_index_t index) const;\n- std::string file_path (file_index_t index, std::string const& save_path =\n-\"\") const;\n- char const* root_ptr (file_index_t const index) const;\n- int file_num_blocks (file_index_t index) const;\n- int file_num_pieces (file_index_t index) const;\n- index_range file_piece_range (file_index_t) const;\n- int file_first_piece_node (file_index_t index) const;\n- int file_first_block_node (file_index_t index) const;\n- std::uint32_t file_path_hash (file_index_t index, std::string const&\n-save_path) const;\n- void all_path_hashes (std::unordered_set& table) const;\n- file_flags_t file_flags (file_index_t index) const;\n- bool file_absolute_path (file_index_t index) const;\n- file_index_t file_index_at_offset (std::int64_t offset) const;\n- file_index_t file_index_at_piece (piece_index_t piece) const;\n- file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n- piece_index_t piece_index_at_file (file_index_t f) const;\n- void sanitize_symlinks ();\n+ info_hash_t const& info_hashes () const;\n+ sha1_hash info_hash () const noexcept;\n+ bool v1 () const;\n bool v2 () const;\n-\n- static constexpr file_flags_t flag_pad_file = 0_bit;\n- static constexpr file_flags_t flag_hidden = 1_bit;\n- static constexpr file_flags_t flag_executable = 2_bit;\n- static constexpr file_flags_t flag_symlink = 3_bit;\n+ int num_files () const;\n+ std::vector map_block (piece_index_t const piece\n+ , std::int64_t offset, int size) const;\n+ peer_request map_file (file_index_t const file, std::int64_t offset, int\n+size) const;\n+ string_view ssl_cert () const;\n+ bool is_valid () const;\n+ bool priv () const;\n+ bool is_i2p () const;\n+ int piece_size (piece_index_t index) const;\n+ char const* hash_for_piece_ptr (piece_index_t const index) const;\n+ sha1_hash hash_for_piece (piece_index_t index) const;\n+ bool is_loaded () const;\n+ const std::string& name () const;\n+ std::time_t creation_date () const;\n+ const std::string& creator () const;\n+ const std::string& comment () const;\n+ std::vector> const& nodes () const;\n+ void add_node (std::pair const& node);\n+ bool parse_info_section (bdecode_node const& info, error_code& ec, int\n+max_pieces);\n+ bdecode_node info (char const* key) const;\n+ span info_section () const;\n+ span piece_layer (file_index_t) const;\n+ void free_piece_layers ();\n };\n [report_issue]\n-***** is_valid() *****\n-bool is_valid () const;\n-returns true if the piece length has been initialized on the file_storage. This\n-is typically taken as a proxy of whether the file_storage as a whole is\n-initialized or not.\n+***** torrent_info() *****\n+torrent_info (char const* buffer, int size, error_code& ec);\n+explicit torrent_info (std::string const& filename);\n+torrent_info (bdecode_node const& torrent_file, error_code& ec);\n+explicit torrent_info (span buffer, from_span_t);\n+torrent_info (std::string const& filename, load_torrent_limits const& cfg);\n+torrent_info (span buffer, load_torrent_limits const& cfg,\n+from_span_t);\n+torrent_info (span buffer, error_code& ec, from_span_t);\n+torrent_info (bdecode_node const& torrent_file, load_torrent_limits const&\n+cfg);\n+torrent_info (char const* buffer, int size);\n+torrent_info (std::string const& filename, error_code& ec);\n+explicit torrent_info (bdecode_node const& torrent_file);\n+explicit torrent_info (info_hash_t const& info_hash);\n+torrent_info (torrent_info const& t);\n+The constructor that takes an info-hash will initialize the info-hash to the\n+given value, but leave all other fields empty. This is used internally when\n+downloading torrents without the metadata. The metadata will be created by\n+libtorrent as soon as it has been downloaded from the swarm.\n+The constructor that takes a bdecode_node will create a torrent_info object\n+from the information found in the given torrent_file. The bdecode_node\n+represents a tree node in an bencoded file. To load an ordinary .torrent file\n+into a bdecode_node, use bdecode().\n+The version that takes a buffer pointer and a size will decode it as a .torrent\n+file and initialize the torrent_info object for you.\n+The version that takes a filename will simply load the torrent file and decode\n+it inside the constructor, for convenience. This might not be the most suitable\n+for applications that want to be able to report detailed errors on what might\n+go wrong.\n+There is an upper limit on the size of the torrent file that will be loaded by\n+the overload taking a filename. If it's important that even very large torrent\n+files are loaded, use one of the other overloads.\n+The overloads that takes an error_code const& never throws if an error occur,\n+they will simply set the error code to describe what went wrong and not fully\n+initialize the torrent_info object. The overloads that do not take the extra\n+error_code parameter will always throw if an error occurs. These overloads are\n+not available when building without exception support.\n+The overload that takes a span also needs an extra parameter of type\n+from_span_t to disambiguate the std::string overload for string literals. There\n+is an object in the libtorrent namespace of this type called from_span.\n [report_issue]\n-***** reserve() *****\n-void reserve (int num_files);\n-allocates space for num_files in the internal file list. This can be used to\n-avoid reallocating the internal file list when the number of files to be added\n-is known up-front.\n+***** ~torrent_info() *****\n+~torrent_info ();\n+frees all storage associated with this torrent_info object\n [report_issue]\n-***** add_file() add_file_borrow() *****\n-void add_file_borrow (error_code& ec, string_view filename\n- , std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}, char const* filehash = nullptr\n- , std::int64_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n-void add_file (std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}\n- , std::time_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n-void add_file (error_code& ec, std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}\n- , std::time_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n-void add_file_borrow (string_view filename\n- , std::string const& path, std::int64_t file_size\n- , file_flags_t file_flags = {}, char const* filehash = nullptr\n- , std::int64_t mtime = 0, string_view symlink_path = string_view()\n- , char const* root_hash = nullptr);\n-Adds a file to the file storage. The add_file_borrow version expects that\n-filename is the file name (without a path) of the file that's being added. This\n-memory is borrowed, i.e. it is the caller's responsibility to make sure it\n-stays valid throughout the lifetime of this file_storage object or any copy of\n-it. The same thing applies to filehash, which is an optional pointer to a 20\n-byte binary SHA-1 hash of the file.\n-if filename is empty, the filename from path is used and not borrowed.\n-The path argument is the full path (in the torrent file) to the file to add.\n-Note that this is not supposed to be an absolute path, but it is expected to\n-include the name of the torrent as the first path element.\n-file_size is the size of the file in bytes.\n-The file_flags argument sets attributes on the file. The file attributes is an\n-extension and may not work in all bittorrent clients.\n-For possible file attributes, see file_storage::flags_t.\n-The mtime argument is optional and can be set to 0. If non-zero, it is the\n-posix time of the last modification time of this file.\n-symlink_path is the path the file is a symlink to. To make this a symlink you\n-also need to set the file_storage::flag_symlink file flag.\n-root_hash is an optional pointer to a 32 byte SHA-256 hash, being the merkle\n-tree root hash for this file. This is only used for v2 torrents. If the root\n-hash is specified for one file, it has to be specified for all, otherwise this\n-function will fail. Note that the buffer root_hash points to must out-live the\n-file_storage object, it will not be copied. This parameter is only used when\n-loading torrents, that already have their file hashes computed. When creating\n-torrents, the file hashes will be computed by the piece hashes.\n-If more files than one are added, certain restrictions to their paths apply. In\n-a multi-file file storage (torrent), all files must share the same root\n-directory.\n-That is, the first path element of all files must be the same. This shared path\n-element is also set to the name of the torrent. It can be changed by calling\n-set_name.\n-The overloads that take anerror_codereference will report failures via that\n-variable, otherwisesystem_erroris thrown.\n+***** files() orig_files() *****\n+file_storage const& files () const;\n+file_storage const& orig_files () const;\n+The file_storage object contains the information on how to map the pieces to\n+files. It is separated from the torrent_info object because when creating\n+torrents a storage object needs to be created without having a torrent file.\n+When renaming files in a storage, the storage needs to make its own copy of the\n+file_storage in order to make its mapping differ from the one in the torrent\n+file.\n+orig_files() returns the original (unmodified) file storage for this torrent.\n+This is used by the web server connection, which needs to request files with\n+the original names. Filename may be changed using torrent_info::rename_file().\n+For more information on the file_storage object, see the separate document on\n+how to create torrents.\n [report_issue]\n ***** rename_file() *****\n void rename_file (file_index_t index, std::string const& new_filename);\n-renames the file at index to new_filename. Keep in mind that filenames are\n-expected to be UTF-8 encoded.\n-[report_issue]\n-***** map_block() *****\n-std::vector map_block (piece_index_t piece, std::int64_t offset\n- , std::int64_t size) const;\n-returns a list of file_slice objects representing the portions of files the\n-specified piece index, byte offset and size range overlaps. this is the inverse\n-mapping of map_file().\n-Preconditions of this function is that the input range is within the torrents\n-address space. piece may not be negative and\n- piece * piece_size + offset + size\n-may not exceed the total size of the torrent.\n-[report_issue]\n-***** map_file() *****\n-peer_request map_file (file_index_t file, std::int64_t offset, int size) const;\n-returns a peer_request representing the piece index, byte offset and size the\n-specified file range overlaps. This is the inverse mapping over map_block().\n-Note that the peer_request return type is meant to hold bittorrent block\n-requests, which may not be larger than 16 kiB. Mapping a range larger than that\n-may return an overflown integer.\n-[report_issue]\n-***** num_files() *****\n-int num_files () const noexcept;\n-returns the number of files in the file_storage\n-[report_issue]\n-***** end_file() *****\n-file_index_t end_file () const noexcept;\n-returns the index of the one-past-end file in the file storage\n+Renames the file with the specified index to the new name. The new filename is\n+reflected by the file_storage returned by files() but not by the one returned\n+by orig_files().\n+If you want to rename the base name of the torrent (for a multi file torrent),\n+you can copy the file_storage (see files() and orig_files() ), change the name,\n+and then use remap_files().\n+The new_filename can both be a relative path, in which case the file name is\n+relative to the save_path of the torrent. If the new_filename is an absolute\n+path (i.e. is_complete(new_filename) == true), then the file is detached from\n+the save_path of the torrent. In this case the file is not moved when\n+move_storage() is invoked.\n [report_issue]\n-***** file_range() *****\n-index_range file_range () const noexcept;\n-returns an implementation-defined type that can be used as the container in a\n-range-for loop. Where the values are the indices of all files in the\n-file_storage.\n+***** remap_files() *****\n+void remap_files (file_storage const& f);\n+Warning\n+Usingremap_files()is discouraged as it's incompatible with v2 torrents. This is\n+because the piece boundaries and piece hashes in v2 torrents are intimately\n+tied to the file boundaries. Instead, just rename individual files, or\n+implement a custom disk_interface to customize how to store files.\n+Remaps the file storage to a new file layout. This can be used to, for\n+instance, download all data in a torrent to a single file, or to a number of\n+fixed size sector aligned files, regardless of the number and sizes of the\n+files in the torrent.\n+The new specified file_storage must have the exact same size as the current\n+one.\n+ [report_issue]\n+***** clear_trackers() trackers() add_tracker() *****\n+void add_tracker (std::string const& url, int tier = 0);\n+void clear_trackers ();\n+std::vector const& trackers () const;\n+void add_tracker (std::string const& url, int tier\n+ , announce_entry::tracker_source source);\n+add_tracker() adds a tracker to the announce-list. The tier determines the\n+order in which the trackers are to be tried. The trackers() function will\n+return a sorted vector of announce_entry. Each announce entry contains a\n+string, which is the tracker url, and a tier index. The tier index is the high-\n+level priority. No matter which trackers that works or not, the ones with lower\n+tier will always be tried before the one with higher tier number. For more\n+information, see announce_entry.\n+trackers() returns all entries from announce-list.\n+clear_trackers() removes all trackers from announce-list.\n+ [report_issue]\n+***** collections() similar_torrents() *****\n+std::vector collections () const;\n+std::vector similar_torrents () const;\n+These two functions are related to BEP_38 (mutable torrents). The vectors\n+returned from these correspond to the \"similar\" and \"collections\" keys in the\n+.torrent file. Both info-hashes and collections from within the info-dict and\n+from outside of it are included.\n+ [report_issue]\n+***** set_web_seeds() web_seeds() add_http_seed() add_url_seed() *****\n+std::vector const& web_seeds () const;\n+void set_web_seeds (std::vector seeds);\n+void add_url_seed (std::string const& url\n+ , std::string const& ext_auth = std::string()\n+ , web_seed_entry::headers_t const& ext_headers = web_seed_entry::\n+headers_t());\n+void add_http_seed (std::string const& url\n+ , std::string const& extern_auth = std::string()\n+ , web_seed_entry::headers_t const& extra_headers = web_seed_entry::\n+headers_t());\n+web_seeds() returns all url seeds and http seeds in the torrent. Each entry is\n+a web_seed_entry and may refer to either a url seed or http seed.\n+add_url_seed() and add_http_seed() adds one url to the list of url/http seeds.\n+set_web_seeds() replaces all web seeds with the ones specified in the seeds\n+vector.\n+The extern_auth argument can be used for other authorization schemes than basic\n+HTTP authorization. If set, it will override any username and password found in\n+the URL itself. The string will be sent as the HTTP authorization header's\n+value (without specifying \"Basic\").\n+The extra_headers argument defaults to an empty list, but can be used to insert\n+custom HTTP headers in the requests to a specific web seed.\n+See http_seeding for more information.\n [report_issue]\n ***** total_size() *****\n std::int64_t total_size () const;\n-returns the total number of bytes all the files in this torrent spans\n+total_size() returns the total number of bytes the torrent-file represents.\n+Note that this is the number of pieces times the piece size (modulo the last\n+piece possibly being smaller). With pad files, the total size will be larger\n+than the sum of all (regular) file sizes.\n [report_issue]\n-***** num_pieces() set_num_pieces() *****\n-void set_num_pieces (int n);\n+***** num_pieces() piece_length() *****\n+int piece_length () const;\n int num_pieces () const;\n-set and get the number of pieces in the torrent\n-[report_issue]\n-***** end_piece() *****\n+piece_length() and num_pieces() returns the number of byte for each piece and\n+the total number of pieces, respectively. The difference between piece_size()\n+and piece_length() is that piece_size() takes the piece index as argument and\n+gives you the exact size of that piece. It will always be the same as\n+piece_length() except in the case of the last piece, which may be smaller.\n+ [report_issue]\n+***** last_piece() end_piece() piece_range() *****\n+index_range piece_range () const;\n piece_index_t end_piece () const;\n-returns the index of the one-past-end piece in the file storage\n-[report_issue]\n-***** last_piece() *****\n piece_index_t last_piece () const;\n-returns the index of the last piece in the torrent. The last piece is special\n-in that it may be smaller than the other pieces (and the other pieces are all\n-the same size).\n-[report_issue]\n-***** piece_range() *****\n-index_range piece_range () const noexcept;\n+last_piece() returns the index to the last piece in the torrent and end_piece()\n+returns the index to the one-past-end piece in the torrent piece_range()\n returns an implementation-defined type that can be used as the container in a\n range-for loop. Where the values are the indices of all pieces in the\n file_storage.\n [report_issue]\n-***** set_piece_length() piece_length() *****\n-int piece_length () const;\n-void set_piece_length (int l);\n-set and get the size of each piece in this torrent. It must be a power of two\n-and at least 16 kiB.\n-[report_issue]\n-***** piece_size() *****\n-int piece_size (piece_index_t index) const;\n-returns the piece size of index. This will be the same as piece_length(),\n-except for the last piece, which may be shorter.\n-[report_issue]\n-***** piece_size2() *****\n-int piece_size2 (piece_index_t index) const;\n-Returns the size of the given piece. If the piece spans multiple files, only\n-the first file is considered part of the piece. This is used for v2 torrents,\n-where all files are piece aligned and padded. i.e. The pad files are not\n-considered part of the piece for this purpose.\n-[report_issue]\n-***** blocks_in_piece2() *****\n-int blocks_in_piece2 (piece_index_t index) const;\n-returns the number of blocks in the specified piece, for v2 torrents.\n+***** info_hashes() info_hash() *****\n+info_hash_t const& info_hashes () const;\n+sha1_hash info_hash () const noexcept;\n+returns the info-hash of the torrent. For BitTorrent v2 support, use\n+info_hashes() to get an object that may hold both a v1 and v2 info-hash\n [report_issue]\n-***** set_name() name() *****\n-void set_name (std::string const& n);\n-std::string const& name () const;\n-set and get the name of this torrent. For multi-file torrents, this is also the\n-name of the root directory all the files are stored in.\n+***** v2() v1() *****\n+bool v1 () const;\n+bool v2 () const;\n+returns whether this torrent has v1 and/or v2 metadata, respectively. Hybrid\n+torrents have both. These are shortcuts for info_hashes().has_v1() and\n+info_hashes().has_v2() calls.\n [report_issue]\n-***** swap() *****\n-void swap (file_storage& ti) noexcept;\n-swap all content of this with ti.\n+***** num_files() *****\n+int num_files () const;\n+If you need index-access to files you can use the num_files() along with the\n+file_path(), file_size()-family of functions to access files using indices.\n [report_issue]\n-***** canonicalize() *****\n-void canonicalize ();\n-arrange files and padding to match the canonical form required by BEP 52\n- [report_issue]\n-***** file_size() hash() pad_file_at() root() file_offset() root_ptr()\n-file_path() file_name() mtime() symlink() *****\n-std::int64_t file_size (file_index_t index) const;\n-sha1_hash hash (file_index_t index) const;\n-std::string symlink (file_index_t index) const;\n-bool pad_file_at (file_index_t index) const;\n-std::time_t mtime (file_index_t index) const;\n-std::int64_t file_offset (file_index_t index) const;\n-sha256_hash root (file_index_t index) const;\n-string_view file_name (file_index_t index) const;\n-std::string file_path (file_index_t index, std::string const& save_path = \"\")\n-const;\n-char const* root_ptr (file_index_t const index) const;\n-These functions are used to query attributes of files at a given index.\n-The hash() is a SHA-1 hash of the file, or 0 if none was provided in the\n-torrent file. This can potentially be used to join a bittorrent network with\n-other file sharing networks.\n-root() returns the SHA-256 merkle tree root of the specified file, in case this\n-is a v2 torrent. Otherwise returns zeros. root_ptr() returns a pointer to the\n-SHA-256 merkle tree root hash for the specified file. The pointer points into\n-storage referred to when the file was added, it is not owned by this object.\n-Torrents that are not v2 torrents return nullptr.\n-The mtime() is the modification time is the posix time when a file was last\n-modified when the torrent was created, or 0 if it was not included in the\n-torrent file.\n-file_path() returns the full path to a file.\n-file_size() returns the size of a file.\n-pad_file_at() returns true if the file at the given index is a pad-file.\n-file_name() returns just the name of the file, whereas file_path() returns the\n-path (inside the torrent file) with the filename appended.\n-file_offset() returns the byte offset within the torrent file where this file\n-starts. It can be used to map the file to a piece index (given the piece size).\n- [report_issue]\n-***** file_num_pieces() file_num_blocks() file_piece_range() *****\n-int file_num_blocks (file_index_t index) const;\n-int file_num_pieces (file_index_t index) const;\n-index_range file_piece_range (file_index_t) const;\n-Returns the number of pieces or blocks the file atindexspans, under the\n-assumption that the file is aligned to the start of a piece. This is only\n-meaningful for v2 torrents, where files are guaranteed such alignment. These\n-numbers are used to size and navigate the merkle hash tree for each file.\n- [report_issue]\n-***** file_first_block_node() file_first_piece_node() *****\n-int file_first_piece_node (file_index_t index) const;\n-int file_first_block_node (file_index_t index) const;\n-index of first piece node in the merkle tree\n+***** map_block() *****\n+std::vector map_block (piece_index_t const piece\n+ , std::int64_t offset, int size) const;\n+This function will map a piece index, a byte offset within that piece and a\n+size (in bytes) into the corresponding files with offsets where that data for\n+that piece is supposed to be stored. See file_slice.\n [report_issue]\n-***** file_path_hash() *****\n-std::uint32_t file_path_hash (file_index_t index, std::string const& save_path)\n+***** map_file() *****\n+peer_request map_file (file_index_t const file, std::int64_t offset, int size)\n const;\n-returns the crc32 hash of file_path(index)\n-[report_issue]\n-***** all_path_hashes() *****\n-void all_path_hashes (std::unordered_set& table) const;\n-this will add the CRC32 hash of all directory entries to the table. No filename\n-will be included, just directories. Every depth of directories are added\n-separately to allow test for collisions with files at all levels. i.e. if one\n-path in the torrent is foo/bar/baz, the CRC32 hashes for foo, foo/bar and foo/\n-bar/baz will be added to the set.\n-[report_issue]\n-***** file_flags() *****\n-file_flags_t file_flags (file_index_t index) const;\n-returns a bitmask of flags from file_flags_t that apply to file at index.\n+This function will map a range in a specific file into a range in the torrent.\n+The file_offset parameter is the offset in the file, given in bytes, where 0 is\n+the start of the file. See peer_request.\n+The input range is assumed to be valid within the torrent. file_offset + size\n+is not allowed to be greater than the file size. file_index must refer to a\n+valid file, i.e. it cannot be >= num_files().\n [report_issue]\n-***** file_absolute_path() *****\n-bool file_absolute_path (file_index_t index) const;\n-returns true if the file at the specified index has been renamed to have an\n-absolute path, i.e. is not anchored in the save path of the torrent.\n- [report_issue]\n-***** file_index_at_offset() file_index_at_piece() *****\n-file_index_t file_index_at_offset (std::int64_t offset) const;\n-file_index_t file_index_at_piece (piece_index_t piece) const;\n-returns the index of the file at the given offset in the torrent\n+***** ssl_cert() *****\n+string_view ssl_cert () const;\n+Returns the SSL root certificate for the torrent, if it is an SSL torrent.\n+Otherwise returns an empty string. The certificate is the public certificate in\n+x509 format.\n [report_issue]\n-***** file_index_for_root() *****\n-file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n-finds the file with the given root hash and returns its index if there is no\n-file with the root hash, file_index_t{-1} is returned\n+***** is_valid() *****\n+bool is_valid () const;\n+returns true if this torrent_info object has a torrent loaded. This is\n+primarily used to determine if a magnet link has had its metadata resolved yet\n+or not.\n [report_issue]\n-***** piece_index_at_file() *****\n-piece_index_t piece_index_at_file (file_index_t f) const;\n-returns the piece index the given file starts at\n+***** priv() *****\n+bool priv () const;\n+returns true if this torrent is private. i.e., the client should not advertise\n+itself on the trackerless network (the Kademlia DHT) for this torrent.\n [report_issue]\n-***** sanitize_symlinks() *****\n-void sanitize_symlinks ();\n-validate any symlinks, to ensure they all point to other files or directories\n-inside this storage. Any invalid symlinks are updated to point to themselves.\n+***** is_i2p() *****\n+bool is_i2p () const;\n+returns true if this is an i2p torrent. This is determined by whether or not it\n+has a tracker whose URL domain name ends with \".i2p\". i2p torrents disable the\n+DHT and local peer discovery as well as talking to peers over anything other\n+than the i2p network.\n [report_issue]\n-***** v2() *****\n-bool v2 () const;\n-returns true if this torrent contains v2 metadata.\n+***** piece_size() *****\n+int piece_size (piece_index_t index) const;\n+returns the piece size of file with index. This will be the same as\n+piece_length(), except for the last piece, which may be shorter.\n+ [report_issue]\n+***** hash_for_piece_ptr() hash_for_piece() *****\n+char const* hash_for_piece_ptr (piece_index_t const index) const;\n+sha1_hash hash_for_piece (piece_index_t index) const;\n+hash_for_piece() takes a piece-index and returns the 20-bytes sha1-hash for\n+that piece and info_hash() returns the 20-bytes sha1-hash for the info-section\n+of the torrent file. hash_for_piece_ptr() returns a pointer to the 20 byte sha1\n+digest for the piece. Note that the string is not 0-terminated.\n [report_issue]\n- flag_pad_file\n- the file is a pad file. It's required to contain zeros at it will not be\n- saved to disk. Its purpose is to make the following file start on a piece\n- boundary.\n+***** name() *****\n+const std::string& name () const;\n+name() returns the name of the torrent. name contains UTF-8 encoded string.\n [report_issue]\n- flag_hidden\n- this file has the hidden attribute set. This is primarily a windows\n- attribute\n+***** creation_date() *****\n+std::time_t creation_date () const;\n+creation_date() returns the creation date of the torrent as time_t (posix\n+time). If there's no time stamp in the torrent file, 0 is returned. .. posix\n+time: http://www.opengroup.org/onlinepubs/009695399/functions/time.html\n [report_issue]\n- flag_executable\n- this file has the executable attribute set.\n+***** creator() *****\n+const std::string& creator () const;\n+creator() returns the creator string in the torrent. If there is no creator\n+string it will return an empty string.\n [report_issue]\n- flag_symlink\n- this file is a symbolic link. It should have a link target string\n- associated with it.\n+***** comment() *****\n+const std::string& comment () const;\n+comment() returns the comment associated with the torrent. If there's no\n+comment, it will return an empty string. comment contains UTF-8 encoded string.\n [report_issue]\n-****** posix_disk_io_constructor() ******\n-Declared in \"libtorrent/posix_disk_io.hpp\"\n-std::unique_ptr posix_disk_io_constructor (\n- io_context& ios, settings_interface const&, counters& cnt);\n-this is a simple posix disk I/O back-end, used for systems that don't have a 64\n-bit virtual address space or don't support memory mapped files. It's\n-implemented using portable C file functions and is single-threaded.\n+***** nodes() *****\n+std::vector> const& nodes () const;\n+If this torrent contains any DHT nodes, they are put in this vector in their\n+original form (host name and port number).\n [report_issue]\n-****** mmap_disk_io_constructor() ******\n-Declared in \"libtorrent/mmap_disk_io.hpp\"\n-std::unique_ptr mmap_disk_io_constructor (\n- io_context& ios, settings_interface const&, counters& cnt);\n-constructs a memory mapped file disk I/O object.\n+***** add_node() *****\n+void add_node (std::pair const& node);\n+This is used when creating torrent. Use this to add a known DHT node. It may be\n+used, by the client, to bootstrap into the DHT network.\n [report_issue]\n-****** disabled_disk_io_constructor() ******\n-Declared in \"libtorrent/disabled_disk_io.hpp\"\n-std::unique_ptr disabled_disk_io_constructor (\n- io_context& ios, settings_interface const&, counters& cnt);\n-creates a disk io object that discards all data written to it, and only returns\n-zero-buffers when read from. May be useful for testing and benchmarking.\n+***** parse_info_section() *****\n+bool parse_info_section (bdecode_node const& info, error_code& ec, int\n+max_pieces);\n+populates the torrent_info by providing just the info-dict buffer. This is used\n+when loading a torrent from a magnet link for instance, where we only have the\n+info-dict. The bdecode_node e points to a parsed info-dictionary. ec returns an\n+error code if something fails (typically if the info dictionary is malformed).\n+Themax_piecesparameter allows limiting the amount of memory dedicated to\n+loading the torrent, and fails for torrents that exceed the limit. To load\n+large torrents, this limit may also need to be raised in settings_pack::\n+max_piece_count and in calls to read_resume_data().\n [report_issue]\n-****** default_disk_io_constructor() ******\n-Declared in \"libtorrent/session.hpp\"\n-std::unique_ptr default_disk_io_constructor (\n- io_context& ios, settings_interface const&, counters& cnt);\n-the constructor function for the default storage. On systems that support\n-memory mapped files (and a 64 bit address space) the memory mapped storage will\n-be constructed, otherwise the portable posix storage.\n+***** info() *****\n+bdecode_node info (char const* key) const;\n+This function looks up keys from the info-dictionary of the loaded torrent\n+file. It can be used to access extension values put in the .torrent file. If\n+the specified key cannot be found, it returns nullptr.\n [report_issue]\n-****** enum storage_mode_t ******\n-Declared in \"libtorrent/storage_defs.hpp\"\n- ___________________________________________________________________________\n-|name_________________|value|description____________________________________|\n-| | |All pieces will be written to their final |\n-| | |position, all files will be allocated in full |\n-|storage_mode_allocate|0 |when the torrent is first started. This mode |\n-| | |minimizes fragmentation but could be a costly |\n-|_____________________|_____|operation._____________________________________|\n-| | |All pieces will be written to the place where |\n-|storage_mode_sparse |1 |they belong and sparse files will be used. This|\n-|_____________________|_____|is_the_recommended,_and_default_mode.__________|\n+***** info_section() *****\n+span info_section () const;\n+returns a the raw info section of the torrent file. The underlying buffer is\n+still owned by the torrent_info object\n [report_issue]\n-****** enum status_t ******\n-Declared in \"libtorrent/storage_defs.hpp\"\n- ____________________________________________________________________________\n-|name____________|value|description__________________________________________|\n-|no_error________|0____|\u00a0___________________________________________________|\n-|fatal_disk_error|1____|\u00a0___________________________________________________|\n-|need_full_check_|2____|\u00a0___________________________________________________|\n-|file_exist______|3____|\u00a0___________________________________________________|\n-| | |this is not an enum value, but a flag that can be set|\n-| | |in the return from async_check_files, in case an |\n-|oversized_file |16 |existing file was found larger than specified in the |\n-| | |torrent. i.e. it has garbage at the end the status_t |\n-|________________|_____|field_is_used_for_this_to_preserve_ABI.______________|\n+***** piece_layer() *****\n+span piece_layer (file_index_t) const;\n+return the bytes of the piece layer hashes for the specified file. If the file\n+doesn't have a piece layer, an empty span is returned. The span size is\n+divisible by 32, the size of a SHA-256 hash. If the size of the file is smaller\n+than or equal to the piece size, the files \"root hash\" is the hash of the file\n+and is not saved separately in the \"piece layers\" field, but this function\n+still returns the root hash of the file in that case.\n [report_issue]\n-****** enum move_flags_t ******\n-Declared in \"libtorrent/storage_defs.hpp\"\n- ____________________________________________________________________________\n-|name________________|value|description______________________________________|\n-|always_replace_files|0 |replace any files in the destination when copying|\n-|____________________|_____|or_moving_the_storage____________________________|\n-| | |if any files that we want to copy exist in the |\n-| | |destination exist, fail the whole operation and |\n-| | |don't perform any copy or move. There is an |\n-|fail_if_exist |1 |inherent race condition in this mode. The files |\n-| | |are checked for existence before the operation |\n-| | |starts. In between the check and performing the |\n-| | |copy, the destination files may be created, in |\n-|____________________|_____|which_case_they_are_replaced.____________________|\n-|dont_replace |2 |if any file exist in the target, take those files|\n-|____________________|_____|instead_of_the_ones_we_may_have_in_the_source.___|\n+***** free_piece_layers() *****\n+void free_piece_layers ();\n+clears the piece layers from the torrent_info. This is done by the session when\n+a torrent is added, to avoid storing it twice. The piece layer (or other hashes\n+part of the merkle tree) are stored in the internal torrent object.\n You have some control over session configuration through the session::\n apply_settings() member function. To change one or more configuration options,\n create a settings_pack object and fill it with the settings to be set and pass\n it in to session::apply_settings().\n The settings_pack object is a collection of settings updates that are applied\n to the session when passed to session::apply_settings(). It's empty when\n constructed.\n@@ -6005,17 +4839,17 @@\n limit is specified in 16 kiB blocks.\n struct settings_pack final : settings_interface\n {\n friend void apply_pack_impl (settings_pack const*\n , aux::session_settings_single_thread&\n , std::vector*);\n void set_str (int name, std::string val) override;\n- void set_int (int name, int val) override;\n void set_int (int name, flags::bitfield_flag const val);\n void set_bool (int name, bool val) override;\n+ void set_int (int name, int val) override;\n bool has_val (int name) const override;\n void clear ();\n void clear (int name);\n int get_int (int name) const override;\n bool get_bool (int name) const override;\n std::string const& get_str (int name) const override;\n void for_each (Fun&& f) const;\n@@ -6092,19 +4926,19 @@\n socks5_pw,\n http,\n http_pw,\n i2p_proxy,\n };\n };\n [report_issue]\n-***** set_str() set_bool() set_int() *****\n+***** set_bool() set_int() set_str() *****\n void set_str (int name, std::string val) override;\n-void set_int (int name, int val) override;\n void set_int (int name, flags::bitfield_flag const val);\n void set_bool (int name, bool val) override;\n+void set_int (int name, int val) override;\n set a configuration option in the settings_pack. name is one of the enum values\n from string_types, int_types or bool_types. They must match the respective type\n of the set_* function.\n [report_issue]\n ***** has_val() *****\n bool has_val (int name) const override;\n queries whether the specified configuration option has a value set in this\n@@ -6115,15 +4949,15 @@\n void clear ();\n clear the settings pack from all settings\n [report_issue]\n ***** clear() *****\n void clear (int name);\n clear a specific setting from the pack\n [report_issue]\n-***** get_bool() get_int() get_str() *****\n+***** get_int() get_str() get_bool() *****\n int get_int (int name) const override;\n bool get_bool (int name) const override;\n std::string const& get_str (int name) const override;\n queries the current configuration option from the settings_pack. name is one of\n the enumeration values from string_types, int_types or bool_types. The enum\n value must match the type of the get_* function. If the specified setting field\n has not been set, the default value is returned.\n@@ -6253,14 +5087,50 @@\n | | |trackers, a plain proxy will suffice. The proxy is assumed to|\n | | |not require authorization. The username and password will not|\n |_________|_____|be_used._____________________________________________________|\n | | |The server is assumed to be an HTTP proxy that requires user |\n |http_pw |5 |authorization. The username and password will be sent to the |\n |_________|_____|proxy._______________________________________________________|\n |i2p_proxy|6____|route_through_a_i2p_SAM_proxy________________________________|\n+ [report_issue]\n+****** min_memory_usage() high_performance_seed() ******\n+Declared in \"libtorrent/session.hpp\"\n+settings_pack min_memory_usage ();\n+settings_pack high_performance_seed ();\n+The default values of the session settings are set for a regular bittorrent\n+client running on a desktop system. There are functions that can set the\n+session settings to pre set settings for other environments. These can be used\n+for the basis, and should be tweaked to fit your needs better.\n+min_memory_usage returns settings that will use the minimal amount of RAM, at\n+the potential expense of upload and download performance. It adjusts the socket\n+buffer sizes, disables the disk cache, lowers the send buffer watermarks so\n+that each connection only has at most one block in use at any one time. It\n+lowers the outstanding blocks send to the disk I/O thread so that connections\n+only have one block waiting to be flushed to disk at any given time. It lowers\n+the max number of peers in the peer list for torrents. It performs multiple\n+smaller reads when it hashes pieces, instead of reading it all into memory\n+before hashing.\n+This configuration is intended to be the starting point for embedded devices.\n+It will significantly reduce memory usage.\n+high_performance_seed returns settings optimized for a seed box, serving many\n+peers and that doesn't do any downloading. It has a 128 MB disk cache and has a\n+limit of 400 files in its file pool. It support fast upload rates by allowing\n+large send buffers.\n+ [report_issue]\n+****** name_for_setting() setting_by_name() ******\n+Declared in \"libtorrent/settings_pack.hpp\"\n+char const* name_for_setting (int s);\n+int setting_by_name (string_view name);\n+converts a setting integer (from the enums string_types, int_types or\n+bool_types) to a string, and vice versa.\n+[report_issue]\n+****** default_settings() ******\n+Declared in \"libtorrent/settings_pack.hpp\"\n+settings_pack default_settings ();\n+returns a settings_pack with every setting set to its default value\n [report_issue]\n ****** generate_fingerprint() ******\n Declared in \"libtorrent/fingerprint.hpp\"\n std::string generate_fingerprint (std::string name\n , int major, int minor = 0, int revision = 0, int tag = 0);\n This is a utility function to produce a client ID fingerprint formatted to the\n most common convention. The fingerprint can be set via the peer_fingerprint\n@@ -6278,862 +5148,970 @@\n |BT______|BitTorrent__________|\n |DE______|Deluge______________|\n |AZ______|Azureus_____________|\n |TL______|Tribler_____________|\n There's an informal directory of client id's here.\n The major, minor, revision and tag parameters are used to identify the version\n of your client.\n- [report_issue]\n-****** name_for_setting() setting_by_name() ******\n-Declared in \"libtorrent/settings_pack.hpp\"\n-int setting_by_name (string_view name);\n-char const* name_for_setting (int s);\n-converts a setting integer (from the enums string_types, int_types or\n-bool_types) to a string, and vice versa.\n-[report_issue]\n-****** default_settings() ******\n-Declared in \"libtorrent/settings_pack.hpp\"\n-settings_pack default_settings ();\n-returns a settings_pack with every setting set to its default value\n- [report_issue]\n-****** high_performance_seed() min_memory_usage() ******\n-Declared in \"libtorrent/session.hpp\"\n-settings_pack min_memory_usage ();\n-settings_pack high_performance_seed ();\n-The default values of the session settings are set for a regular bittorrent\n-client running on a desktop system. There are functions that can set the\n-session settings to pre set settings for other environments. These can be used\n-for the basis, and should be tweaked to fit your needs better.\n-min_memory_usage returns settings that will use the minimal amount of RAM, at\n-the potential expense of upload and download performance. It adjusts the socket\n-buffer sizes, disables the disk cache, lowers the send buffer watermarks so\n-that each connection only has at most one block in use at any one time. It\n-lowers the outstanding blocks send to the disk I/O thread so that connections\n-only have one block waiting to be flushed to disk at any given time. It lowers\n-the max number of peers in the peer list for torrents. It performs multiple\n-smaller reads when it hashes pieces, instead of reading it all into memory\n-before hashing.\n-This configuration is intended to be the starting point for embedded devices.\n-It will significantly reduce memory usage.\n-high_performance_seed returns settings optimized for a seed box, serving many\n-peers and that doesn't do any downloading. It has a 128 MB disk cache and has a\n-limit of 400 files in its file pool. It support fast upload rates by allowing\n-large send buffers.\n [report_issue]\n-****** session_params ******\n-Declared in \"libtorrent/session_params.hpp\"\n-The session_params is a parameters pack for configuring the session before it's\n-started.\n-struct session_params\n+****** bitfield ******\n+Declared in \"libtorrent/bitfield.hpp\"\n+The bitfield type stores any number of bits as a bitfield in a heap allocated\n+array.\n+struct bitfield\n {\n- session_params (settings_pack const& sp);\n- session_params ();\n- session_params (settings_pack&& sp);\n- session_params (settings_pack const& sp\n- , std::vector> exts);\n- session_params (settings_pack&& sp\n- , std::vector> exts);\n-\n- settings_pack settings;\n- std::vector> extensions;\n- dht::dht_state dht_state;\n- dht::dht_storage_constructor_type dht_storage_constructor;\n- disk_io_constructor_type disk_io_constructor;\n- std::map ext_state;\n- libtorrent::ip_filter ip_filter;\n+ explicit bitfield (int bits);\n+ bitfield (char const* b, int bits);\n+ bitfield (bitfield const& rhs);\n+ bitfield (bitfield&& rhs) noexcept = default;\n+ bitfield (int bits, bool val);\n+ bitfield () noexcept = default;\n+ void assign (char const* b, int const bits);\n+ bool operator[] (int index) const noexcept;\n+ bool get_bit (int index) const noexcept;\n+ void clear_bit (int index) noexcept;\n+ void set_bit (int index) noexcept;\n+ bool all_set () const noexcept;\n+ bool none_set () const noexcept;\n+ int size () const noexcept;\n+ int num_words () const noexcept;\n+ bool empty () const noexcept;\n+ char const* data () const noexcept;\n+ char* data () noexcept;\n+ void swap (bitfield& rhs) noexcept;\n+ int count () const noexcept;\n+ int find_first_set () const noexcept;\n+ int find_last_clear () const noexcept;\n };\n [report_issue]\n-***** session_params() *****\n-session_params (settings_pack const& sp);\n-session_params ();\n-session_params (settings_pack&& sp);\n-This constructor can be used to start with the default plugins (ut_metadata,\n-ut_pex and smart_ban). Pass a settings_pack to set the initial settings when\n-the session starts.\n+***** bitfield() *****\n+explicit bitfield (int bits);\n+bitfield (char const* b, int bits);\n+bitfield (bitfield const& rhs);\n+bitfield (bitfield&& rhs) noexcept = default;\n+bitfield (int bits, bool val);\n+bitfield () noexcept = default;\n+constructs a new bitfield. The default constructor creates an empty bitfield.\n+bits is the size of the bitfield (specified in bits). val is the value to\n+initialize the bits to. If not specified all bits are initialized to 0.\n+The constructor taking a pointer b and bits copies a bitfield from the\n+specified buffer, and bits number of bits (rounded up to the nearest byte\n+boundary).\n [report_issue]\n-***** session_params() *****\n-session_params (settings_pack const& sp\n- , std::vector> exts);\n-session_params (settings_pack&& sp\n- , std::vector> exts);\n-This constructor helps to configure the set of initial plugins to be added to\n-the session before it's started.\n+***** assign() *****\n+void assign (char const* b, int const bits);\n+copy bitfield from buffer b of bits number of bits, rounded up to the nearest\n+byte boundary.\n+ [report_issue]\n+***** operator[]() get_bit() *****\n+bool operator[] (int index) const noexcept;\n+bool get_bit (int index) const noexcept;\n+query bit at index. Returns true if bit is 1, otherwise false.\n+ [report_issue]\n+***** clear_bit() set_bit() *****\n+void clear_bit (int index) noexcept;\n+void set_bit (int index) noexcept;\n+set bit at index to 0 (clear_bit) or 1 (set_bit).\n [report_issue]\n- settings\n- The settings to configure the session with\n+***** all_set() *****\n+bool all_set () const noexcept;\n+returns true if all bits in the bitfield are set\n [report_issue]\n- extensions\n- the plugins to add to the session as it is constructed\n+***** none_set() *****\n+bool none_set () const noexcept;\n+returns true if no bit in the bitfield is set\n [report_issue]\n- dht_state\n- DHT node ID and node addresses to bootstrap the DHT with.\n+***** size() *****\n+int size () const noexcept;\n+returns the size of the bitfield in bits.\n [report_issue]\n- dht_storage_constructor\n- function object to construct the storage object for DHT items.\n+***** num_words() *****\n+int num_words () const noexcept;\n+returns the number of 32 bit words are needed to represent all bits in this\n+bitfield.\n [report_issue]\n- disk_io_constructor\n- function object to create the disk I/O subsystem. Defaults to\n- default_disk_io_constructor.\n+***** empty() *****\n+bool empty () const noexcept;\n+returns true if the bitfield has zero size.\n [report_issue]\n- ext_state\n- this container can be used by extensions/plugins to store settings. It's\n- primarily here to make it convenient to save and restore state across\n- sessions, using read_session_params() and write_session_params().\n+***** data() *****\n+char const* data () const noexcept;\n+char* data () noexcept;\n+returns a pointer to the internal buffer of the bitfield, or nullptr if it's\n+empty.\n [report_issue]\n- ip_filter\n- the IP filter to use for the session. This restricts which peers are\n- allowed to connect. As if passed to set_ip_filter().\n+***** swap() *****\n+void swap (bitfield& rhs) noexcept;\n+swaps the bit-fields two variables refer to\n [report_issue]\n-****** session_proxy ******\n-Declared in \"libtorrent/session.hpp\"\n-this is a holder for the internal session implementation object. Once the\n-session destruction is explicitly initiated, this holder is used to synchronize\n-the completion of the shutdown. The lifetime of this object may outlive\n-session, causing the session destructor to not block. The session_proxy\n-destructor will block however, until the underlying session is done shutting\n-down.\n-struct session_proxy\n+***** count() *****\n+int count () const noexcept;\n+count the number of bits in the bitfield that are set to 1.\n+[report_issue]\n+***** find_first_set() *****\n+int find_first_set () const noexcept;\n+returns the index of the first set bit in the bitfield, i.e. 1 bit.\n+[report_issue]\n+***** find_last_clear() *****\n+int find_last_clear () const noexcept;\n+returns the index to the last cleared bit in the bitfield, i.e. 0 bit.\n+[report_issue]\n+****** hasher ******\n+Declared in \"libtorrent/hasher.hpp\"\n+this is a SHA-1 hash class.\n+You use it by first instantiating it, then call update() to feed it with data.\n+i.e. you don't have to keep the entire buffer of which you want to create the\n+hash in memory. You can feed the hasher parts of it at a time. When You have\n+fed the hasher with all the data, you call final() and it will return the sha1-\n+hash of the data.\n+The constructor that takes a char const* and an integer will construct the sha1\n+context and feed it the data passed in.\n+If you want to reuse the hasher object once you have created a hash, you have\n+to call reset() to reinitialize it.\n+The built-in software version of sha1-algorithm was implemented by Steve Reid\n+and released as public domain. For more info, see src/sha1.cpp.\n+class hasher\n {\n- session_proxy ();\n- session_proxy (session_proxy&&) noexcept;\n- session_proxy (session_proxy const&);\n- session_proxy& operator= (session_proxy const&) &;\n- ~session_proxy ();\n- session_proxy& operator= (session_proxy&&) & noexcept;\n+ hasher ();\n+ hasher& operator= (hasher const&) &;\n+ explicit hasher (span data);\n+ hasher (char const* data, int len);\n+ hasher (hasher const&);\n+ hasher& update (char const* data, int len);\n+ hasher& update (span data);\n+ sha1_hash final ();\n+ void reset ();\n };\n- [report_issue]\n-***** ~session_proxy() operator=() session_proxy() *****\n-session_proxy ();\n-session_proxy (session_proxy&&) noexcept;\n-session_proxy (session_proxy const&);\n-session_proxy& operator= (session_proxy const&) &;\n-~session_proxy ();\n-session_proxy& operator= (session_proxy&&) & noexcept;\n-default constructor, does not refer to any session implementation object.\n+ [report_issue]\n+***** operator=() hasher() *****\n+hasher& operator= (hasher const&) &;\n+explicit hasher (span data);\n+hasher (char const* data, int len);\n+hasher (hasher const&);\n+this is the same as default constructing followed by a call to update(data,\n+len).\n [report_issue]\n-****** session ******\n-Declared in \"libtorrent/session.hpp\"\n-The session holds all state that spans multiple torrents. Among other things it\n-runs the network loop and manages all torrents. Once it's created, the session\n-object will spawn the main thread that will do all the work. The main thread\n-will be idle as long it doesn't have any torrents to participate in.\n-You have some control over session configuration through the session_handle::\n-apply_settings() member function. To change one or more configuration options,\n-create a settings_pack. object and fill it with the settings to be set and pass\n-it in to session::apply_settings().\n-see apply_settings().\n-struct session : session_handle\n+***** update() *****\n+hasher& update (char const* data, int len);\n+hasher& update (span data);\n+append the following bytes to what is being hashed\n+[report_issue]\n+***** final() *****\n+sha1_hash final ();\n+returns the SHA-1 digest of the buffers previously passed to update() and the\n+hasher constructor.\n+[report_issue]\n+***** reset() *****\n+void reset ();\n+restore the hasher state to be as if the hasher has just been default\n+constructed.\n+[report_issue]\n+****** hasher256 ******\n+Declared in \"libtorrent/hasher.hpp\"\n+class hasher256\n {\n- explicit session (session_params&& params);\n- explicit session (session_params const& params);\n- session (session_params const& params, session_flags_t flags);\n- session (session_params&& params, session_flags_t flags);\n- session ();\n- session (session_params&& params, io_context& ios, session_flags_t);\n- session (session_params&& params, io_context& ios);\n- session (session_params const& params, io_context& ios, session_flags_t);\n- session (session_params const& params, io_context& ios);\n- ~session ();\n- session_proxy abort ();\n+ hasher256 ();\n+ hasher256 (char const* data, int len);\n+ explicit hasher256 (span data);\n+ hasher256 (hasher256 const&);\n+ hasher256& operator= (hasher256 const&) &;\n+ hasher256& update (char const* data, int len);\n+ hasher256& update (span data);\n+ sha256_hash final ();\n+ void reset ();\n+ ~hasher256 ();\n };\n+ [report_issue]\n+***** hasher256() operator=() *****\n+hasher256 (char const* data, int len);\n+explicit hasher256 (span data);\n+hasher256 (hasher256 const&);\n+hasher256& operator= (hasher256 const&) &;\n+this is the same as default constructing followed by a call to update(data,\n+len).\n [report_issue]\n-***** session() *****\n-explicit session (session_params&& params);\n-explicit session (session_params const& params);\n-session (session_params const& params, session_flags_t flags);\n-session (session_params&& params, session_flags_t flags);\n-session ();\n-Constructs the session objects which acts as the container of torrents. In\n-order to avoid a race condition between starting the session and configuring\n-it, you can pass in a session_params object. Its settings will take effect\n-before the session starts up.\n-The overloads taking flags can be used to start a session in paused mode (by\n-passing in session::paused). Note that add_default_plugins do not have an\n-affect on constructors that take a session_params object. It already contains\n-the plugins to use.\n-[report_issue]\n-***** session() *****\n-session (session_params&& params, io_context& ios, session_flags_t);\n-session (session_params&& params, io_context& ios);\n-session (session_params const& params, io_context& ios, session_flags_t);\n-session (session_params const& params, io_context& ios);\n-Overload of the constructor that takes an external io_context to run the\n-session object on. This is primarily useful for tests that may want to run\n-multiple sessions on a single io_context, or low resource systems where\n-additional threads are expensive and sharing an io_context with other events is\n-fine.\n-Warning\n-The session object does not cleanly terminate with an external io_context. The\n-io_context::run() call must have returned before it's safe to destruct the\n-session. Which means you MUST call session::abort() and save the session_proxy\n-first, then destruct the session object, then sync with the io_context, then\n-destruct the session_proxy object.\n+***** update() *****\n+hasher256& update (char const* data, int len);\n+hasher256& update (span data);\n+append the following bytes to what is being hashed\n [report_issue]\n-***** ~session() *****\n-~session ();\n-The destructor of session will notify all trackers that our torrents have been\n-shut down. If some trackers are down, they will time out. All this before the\n-destructor of session returns. So, it's advised that any kind of interface\n-(such as windows) are closed before destructing the session object. Because it\n-can take a few second for it to finish. The timeout can be set with\n-apply_settings().\n+***** final() *****\n+sha256_hash final ();\n+returns the SHA-1 digest of the buffers previously passed to update() and the\n+hasher constructor.\n [report_issue]\n-***** abort() *****\n-session_proxy abort ();\n-In case you want to destruct the session asynchronously, you can request a\n-session destruction proxy. If you don't do this, the destructor of the session\n-object will block while the trackers are contacted. If you keep one\n-session_proxy to the session when destructing it, the destructor will not\n-block, but start to close down the session, the destructor of the proxy will\n-then synchronize the threads. So, the destruction of the session is performed\n-from the session destructor call until the session_proxy destructor call. The\n-session_proxy does not have any operations on it (since the session is being\n-closed down, no operations are allowed on it). The only valid operation is\n-calling the destructor:\n-struct session_proxy {};\n+***** reset() *****\n+void reset ();\n+restore the hasher state to be as if the hasher has just been default\n+constructed.\n [report_issue]\n-****** session_handle ******\n-Declared in \"libtorrent/session_handle.hpp\"\n-this class provides a non-owning handle to a session and a subset of the\n-interface of the session class. If the underlying session is destructed any\n-handle to it will no longer be valid. is_valid() will return false and any\n-operation on it will throw a system_error exception, with error code\n-invalid_session_handle.\n-struct session_handle\n+****** peer_class_type_filter ******\n+Declared in \"libtorrent/peer_class_type_filter.hpp\"\n+peer_class_type_filter is a simple container for rules for adding and\n+subtracting peer-classes from peers. It is applied after the peer class filter\n+is applied (which is based on the peer's IP address).\n+struct peer_class_type_filter\n {\n- bool is_valid () const;\n- session_params session_state (save_state_flags_t flags =\n-save_state_flags_t::all()) const;\n- void refresh_torrent_status (std::vector* ret\n- , status_flags_t flags = {}) const;\n- std::vector get_torrent_status (\n- std::function const& pred\n- , status_flags_t flags = {}) const;\n- void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n- void post_session_stats ();\n- void post_dht_stats ();\n- void set_dht_state (dht::dht_state const& st);\n- void set_dht_state (dht::dht_state&& st);\n- std::vector get_torrents () const;\n- torrent_handle find_torrent (sha1_hash const& info_hash) const;\n- torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n- torrent_handle add_torrent (add_torrent_params const& params, error_code&\n-ec);\n- torrent_handle add_torrent (add_torrent_params&& params);\n- void async_add_torrent (add_torrent_params const& params);\n- void async_add_torrent (add_torrent_params&& params);\n- torrent_handle add_torrent (add_torrent_params const& params);\n- void pause ();\n- void resume ();\n- bool is_paused () const;\n- bool is_dht_running () const;\n- void set_dht_storage (dht::dht_storage_constructor_type sc);\n- void add_dht_node (std::pair const& node);\n- void dht_get_item (sha1_hash const& target);\n- void dht_get_item (std::array key\n- , std::string salt = std::string());\n- sha1_hash dht_put_item (entry data);\n- void dht_put_item (std::array key\n- , std::function&\n- , std::int64_t&, std::string const&)> cb\n- , std::string salt = std::string());\n- void dht_announce (sha1_hash const& info_hash, int port = 0, dht::\n-announce_flags_t flags = {});\n- void dht_get_peers (sha1_hash const& info_hash);\n- void dht_live_nodes (sha1_hash const& nid);\n- void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const&\n-target);\n- void dht_direct_request (udp::endpoint const& ep, entry const& e,\n-client_data_t userdata = {});\n- void add_extension (std::function(\n- torrent_handle const&, client_data_t)> ext);\n- void add_extension (std::shared_ptr ext);\n- void set_ip_filter (ip_filter f);\n- ip_filter get_ip_filter () const;\n- void set_port_filter (port_filter const& f);\n- unsigned short ssl_listen_port () const;\n- unsigned short listen_port () const;\n- bool is_listening () const;\n- ip_filter get_peer_class_filter () const;\n- void set_peer_class_filter (ip_filter const& f);\n- void set_peer_class_type_filter (peer_class_type_filter const& f);\n- peer_class_type_filter get_peer_class_type_filter () const;\n- peer_class_t create_peer_class (char const* name);\n- void delete_peer_class (peer_class_t cid);\n- peer_class_info get_peer_class (peer_class_t cid) const;\n- void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n- void remove_torrent (const torrent_handle&, remove_flags_t = {});\n- void apply_settings (settings_pack&&);\n- void apply_settings (settings_pack const&);\n- settings_pack get_settings () const;\n- void set_alert_notify (std::function const& fun);\n- void pop_alerts (std::vector* alerts);\n- alert* wait_for_alert (time_duration max_wait);\n- std::vector add_port_mapping (portmap_protocol t, int\n-external_port, int local_port);\n- void delete_port_mapping (port_mapping_t handle);\n- void reopen_network_sockets (reopen_network_flags_t options =\n-reopen_map_ports);\n- std::shared_ptr native_handle () const;\n+ void remove (socket_type_t const st, peer_class_t const peer_class);\n+ void add (socket_type_t const st, peer_class_t const peer_class);\n+ void allow (socket_type_t const st, peer_class_t const peer_class);\n+ void disallow (socket_type_t const st, peer_class_t const peer_class);\n+ std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n+ friend bool operator== (peer_class_type_filter const& lhs\n+ , peer_class_type_filter const& rhs);\n \n- static constexpr save_state_flags_t save_settings = 0_bit;\n- static constexpr save_state_flags_t save_dht_state = 2_bit;\n- static constexpr save_state_flags_t save_extension_state = 11_bit;\n- static constexpr save_state_flags_t save_ip_filter = 12_bit;\n- static constexpr peer_class_t global_peer_class_id {0};\n- static constexpr peer_class_t tcp_peer_class_id {1};\n- static constexpr peer_class_t local_peer_class_id {2};\n- static constexpr remove_flags_t delete_files = 0_bit;\n- static constexpr remove_flags_t delete_partfile = 1_bit;\n- static constexpr session_flags_t paused = 2_bit;\n- static constexpr portmap_protocol udp = portmap_protocol::udp;\n- static constexpr portmap_protocol tcp = portmap_protocol::tcp;\n- static constexpr reopen_network_flags_t reopen_map_ports = 0_bit;\n+ enum socket_type_t\n+ {\n+ tcp_socket,\n+ utp_socket,\n+ ssl_tcp_socket,\n+ ssl_utp_socket,\n+ i2p_socket,\n+ num_socket_types,\n+ };\n };\n+ [report_issue]\n+***** add() remove() *****\n+void remove (socket_type_t const st, peer_class_t const peer_class);\n+void add (socket_type_t const st, peer_class_t const peer_class);\n+add() and remove() adds and removes a peer class to be added to new peers based\n+on socket type.\n+ [report_issue]\n+***** disallow() allow() *****\n+void allow (socket_type_t const st, peer_class_t const peer_class);\n+void disallow (socket_type_t const st, peer_class_t const peer_class);\n+disallow() and allow() adds and removes a peer class to be removed from new\n+peers based on socket type.\n+The peer_class argument cannot be greater than 31. The bitmasks representing\n+peer classes in the peer_class_type_filter are 32 bits.\n [report_issue]\n-***** is_valid() *****\n-bool is_valid () const;\n-returns true if this handle refers to a valid session object. If the session\n-has been destroyed, all session_handle objects will expire and not be valid.\n+***** apply() *****\n+std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n+takes a bitmask of peer classes and returns a new bitmask of peer classes after\n+the rules have been applied, based on the socket type argument (st).\n [report_issue]\n-***** session_state() *****\n-session_params session_state (save_state_flags_t flags = save_state_flags_t::\n-all()) const;\n-returns the current session state. This can be passed to write_session_params()\n-to save the state to disk and restored using read_session_params() when\n-constructing a new session. The kind of state that's included is all settings,\n-the DHT routing table, possibly plugin-specific state. the flags parameter can\n-be used to only save certain parts of the session state\n- [report_issue]\n-***** get_torrent_status() refresh_torrent_status() *****\n-void refresh_torrent_status (std::vector* ret\n- , status_flags_t flags = {}) const;\n-std::vector get_torrent_status (\n- std::function const& pred\n- , status_flags_t flags = {}) const;\n-Note\n-these calls are potentially expensive and won't scale well with lots of\n-torrents. If you're concerned about performance, consider using\n-post_torrent_updates() instead.\n-get_torrent_status returns a vector of the torrent_status for every torrent\n-which satisfies pred, which is a predicate function which determines if a\n-torrent should be included in the returned set or not. Returning true means it\n-should be included and false means excluded. The flags argument is the same as\n-to torrent_handle::status(). Since pred is guaranteed to be called for every\n-torrent, it may be used to count the number of torrents of different categories\n-as well.\n-refresh_torrent_status takes a vector of torrent_status structs (for instance\n-the same vector that was returned by get_torrent_status() ) and refreshes the\n-status based on the handle member. It is possible to use this function by first\n-setting up a vector of default constructed torrent_status objects, only\n-initializing the handle member, in order to request the torrent status for\n-multiple torrents in a single call. This can save a significant amount of time\n-if you have a lot of torrents.\n-Any torrent_status object whose handle member is not referring to a valid\n-torrent are ignored.\n-The intended use of these functions is to start off by calling\n-get_torrent_status() to get a list of all torrents that match your criteria.\n-Then call refresh_torrent_status() on that list. This will only refresh the\n-status for the torrents in your list, and thus ignore all other torrents you\n-might be running. This may save a significant amount of time, especially if the\n-number of torrents you're interested in is small. In order to keep your list of\n-interested torrents up to date, you can either call get_torrent_status() from\n-time to time, to include torrents you might have become interested in since the\n-last time. In order to stop refreshing a certain torrent, simply remove it from\n-the list.\n+***** enum socket_type_t *****\n+Declared in \"libtorrent/peer_class_type_filter.hpp\"\n+ ________________________________________________________________________\n+|name____________|value|description______________________________________|\n+|tcp_socket |0 |these match the socket types from socket_type.hpp|\n+|________________|_____|shifted_one_down_________________________________|\n+|utp_socket______|1____|\u00a0_______________________________________________|\n+|ssl_tcp_socket__|2____|\u00a0_______________________________________________|\n+|ssl_utp_socket__|3____|\u00a0_______________________________________________|\n+|i2p_socket______|4____|\u00a0_______________________________________________|\n+|num_socket_types|5____|\u00a0_______________________________________________|\n [report_issue]\n-***** post_torrent_updates() *****\n-void post_torrent_updates (status_flags_t flags = status_flags_t::all());\n-This functions instructs the session to post the state_update_alert, containing\n-the status of all torrents whose state changed since the last time this\n-function was called.\n-Only torrents who has the state subscription flag set will be included. This\n-flag is on by default. See add_torrent_params. the flags argument is the same\n-as for torrent_handle::status(). see status_flags_t in torrent_handle.\n+****** peer_class_info ******\n+Declared in \"libtorrent/peer_class.hpp\"\n+holds settings for a peer class. Used in set_peer_class() and get_peer_class()\n+calls.\n+struct peer_class_info\n+{\n+ bool ignore_unchoke_slots;\n+ int connection_limit_factor;\n+ std::string label;\n+ int upload_limit;\n+ int download_limit;\n+ int upload_priority;\n+ int download_priority;\n+};\n [report_issue]\n-***** post_session_stats() *****\n-void post_session_stats ();\n-This function will post a session_stats_alert object, containing a snapshot of\n-the performance counters from the internals of libtorrent. To interpret these\n-counters, query the session via session_stats_metrics().\n-For more information, see the session_statistics section.\n+ ignore_unchoke_slots\n+ ignore_unchoke_slots determines whether peers should always unchoke a\n+ peer, regardless of the choking algorithm, or if it should honor the\n+ unchoke slot limits. It's used for local peers by default. If any of the\n+ peer classes a peer belongs to has this set to true, that peer will be\n+ unchoked at all times.\n [report_issue]\n-***** post_dht_stats() *****\n-void post_dht_stats ();\n-This will cause a dht_stats_alert to be posted.\n+ connection_limit_factor\n+ adjusts the connection limit (global and per torrent) that applies to\n+ this peer class. By default, local peers are allowed to exceed the normal\n+ connection limit for instance. This is specified as a percent factor. 100\n+ makes the peer class apply normally to the limit. 200 means as long as\n+ there are fewer connections than twice the limit, we accept this peer.\n+ This factor applies both to the global connection limit and the per-\n+ torrent limit. Note that if not used carefully one peer class can\n+ potentially completely starve out all other over time.\n [report_issue]\n-***** set_dht_state() *****\n-void set_dht_state (dht::dht_state const& st);\n-void set_dht_state (dht::dht_state&& st);\n-set the DHT state for the session. This will be taken into account the next\n-time the DHT is started, as if it had been passed in via the session_params on\n-startup.\n+ label\n+ not used by libtorrent. It's intended as a potentially user-facing\n+ identifier of this peer class.\n [report_issue]\n-***** find_torrent() get_torrents() *****\n-std::vector get_torrents () const;\n-torrent_handle find_torrent (sha1_hash const& info_hash) const;\n-find_torrent() looks for a torrent with the given info-hash. In case there is\n-such a torrent in the session, a torrent_handle to that torrent is returned. In\n-case the torrent cannot be found, an invalid torrent_handle is returned.\n-See torrent_handle::is_valid() to know if the torrent was found or not.\n-get_torrents() returns a vector of torrent_handles to all the torrents\n-currently in the session.\n+ upload_limit download_limit\n+ transfer rates limits for the whole peer class. They are specified in\n+ bytes per second and apply to the sum of all peers that are members of\n+ this class.\n [report_issue]\n-***** add_torrent() async_add_torrent() *****\n-torrent_handle add_torrent (add_torrent_params&& params, error_code& ec);\n-torrent_handle add_torrent (add_torrent_params const& params, error_code& ec);\n-torrent_handle add_torrent (add_torrent_params&& params);\n-void async_add_torrent (add_torrent_params const& params);\n-void async_add_torrent (add_torrent_params&& params);\n-torrent_handle add_torrent (add_torrent_params const& params);\n-You add torrents through the add_torrent() function where you give an object\n-with all the parameters. The add_torrent() overloads will block until the\n-torrent has been added (or failed to be added) and returns an error code and a\n-torrent_handle. In order to add torrents more efficiently, consider using\n-async_add_torrent() which returns immediately, without waiting for the torrent\n-to add. Notification of the torrent being added is sent as add_torrent_alert.\n-The overload that does not take an error_code throws an exception on error and\n-is not available when building without exception support. The torrent_handle\n-returned by add_torrent() can be used to retrieve information about the\n-torrent's progress, its peers etc. It is also used to abort a torrent.\n-If the torrent you are trying to add already exists in the session (is either\n-queued for checking, being checked or downloading) add_torrent() will throw\n-system_error which derives from std::exception unless duplicate_is_error is set\n-to false. In that case, add_torrent() will return the handle to the existing\n-torrent.\n-The add_torrent_params class has a flags field. It can be used to control what\n-state the new torrent will be added in. Common flags to want to control are\n-torrent_flags::paused and torrent_flags::auto_managed. In order to add a magnet\n-link that will just download the metadata, but no payload, set the\n-torrent_flags::upload_mode flag.\n-Special consideration has to be taken when adding hybrid torrents (i.e.\n-torrents that are BitTorrent v2 torrents that are backwards compatible with\n-v1). For more details, see BitTorrent_v2_torrents.\n- [report_issue]\n-***** resume() pause() is_paused() *****\n-void pause ();\n-void resume ();\n-bool is_paused () const;\n-Pausing the session has the same effect as pausing every torrent in it, except\n-that torrents will not be resumed by the auto-manage mechanism. Resuming will\n-restore the torrents to their previous paused state. i.e. the session pause\n-state is separate from the torrent pause state. A torrent is inactive if it is\n-paused or if the session is paused.\n+ upload_priority download_priority\n+ relative priorities used by the bandwidth allocator in the rate limiter.\n+ If no rate limits are in use, the priority is not used either. Priorities\n+ start at 1 (0 is not a valid priority) and may not exceed 255.\n [report_issue]\n-***** is_dht_running() *****\n-bool is_dht_running () const;\n-is_dht_running() returns true if the DHT support has been started and false\n-otherwise.\n+****** storage_error ******\n+Declared in \"libtorrent/error_code.hpp\"\n+used by storage to return errors also includes which underlying file the error\n+happened on\n+struct storage_error\n+{\n+ explicit operator bool () const;\n+ file_index_t file () const;\n+ void file (file_index_t f);\n+\n+ error_code ec;\n+ operation_t operation;\n+};\n [report_issue]\n-***** set_dht_storage() *****\n-void set_dht_storage (dht::dht_storage_constructor_type sc);\n-set_dht_storage set a dht custom storage constructor function to be used\n-internally when the dht is created.\n-Since the dht storage is a critical component for the dht behavior, this\n-function will only be effective the next time the dht is started. If you never\n-touch this feature, a default map-memory based storage is used.\n-If you want to make sure the dht is initially created with your custom storage,\n-create a session with the setting settings_pack::enable_dht to false, set your\n-constructor function and call apply_settings with settings_pack::enable_dht to\n-true.\n+***** bool() *****\n+explicit operator bool () const;\n+explicitly converts to true if this object represents an error, and false if it\n+does not.\n [report_issue]\n-***** add_dht_node() *****\n-void add_dht_node (std::pair const& node);\n-add_dht_node takes a host name and port pair. That endpoint will be pinged, and\n-if a valid DHT reply is received, the node will be added to the routing table.\n+***** file() *****\n+file_index_t file () const;\n+void file (file_index_t f);\n+set and query the index (in the torrent) of the file this error occurred on.\n+This may also have special values defined in torrent_status.\n [report_issue]\n-***** dht_get_item() *****\n-void dht_get_item (sha1_hash const& target);\n-query the DHT for an immutable item at the target hash. the result is posted as\n-a dht_immutable_item_alert.\n+ ec\n+ the error that occurred\n [report_issue]\n-***** dht_get_item() *****\n-void dht_get_item (std::array key\n- , std::string salt = std::string());\n-query the DHT for a mutable item under the public key key. this is an ed25519\n-key. salt is optional and may be left as an empty string if no salt is to be\n-used. if the item is found in the DHT, a dht_mutable_item_alert is posted.\n+ operation\n+ A code from operation_t enum, indicating what kind of operation failed.\n [report_issue]\n-***** dht_put_item() *****\n-sha1_hash dht_put_item (entry data);\n-store the given bencoded data as an immutable item in the DHT. the returned\n-hash is the key that is to be used to look the item up again. It's just the\n-SHA-1 hash of the bencoded form of the structure.\n+****** libtorrent_category() ******\n+Declared in \"libtorrent/error_code.hpp\"\n+boost::system::error_category& libtorrent_category ();\n+return the instance of the libtorrent_error_category which maps libtorrent\n+error codes to human readable error messages.\n [report_issue]\n-***** dht_put_item() *****\n-void dht_put_item (std::array key\n- , std::function&\n- , std::int64_t&, std::string const&)> cb\n- , std::string salt = std::string());\n-store a mutable item. The key is the public key the blob is to be stored under.\n-The optional salt argument is a string that is to be mixed in with the key when\n-determining where in the DHT the value is to be stored. The callback function\n-is called from within the libtorrent network thread once we've found where to\n-store the blob, possibly with the current value stored under the key. The\n-values passed to the callback functions are:\n- entry& value\n- the current value stored under the key (may be empty). Also expected to\n- be set to the value to be stored by the function.\n- std::array& signature\n- the signature authenticating the current value. This may be zeros if\n- there is currently no value stored. The function is expected to fill in\n- this buffer with the signature of the new value to store. To generate the\n- signature, you may want to use the sign_mutable_item function.\n- std::int64_t& seq\n- current sequence number. May be zero if there is no current value. The\n- function is expected to set this to the new sequence number of the value\n- that is to be stored. Sequence numbers must be monotonically increasing.\n- Attempting to overwrite a value with a lower or equal sequence number\n- will fail, even if the signature is correct.\n- std::string const& salt\n- this is the salt that was used for this put call.\n-Since the callback function cb is called from within libtorrent, it is critical\n-to not perform any blocking operations. Ideally not even locking a mutex. Pass\n-any data required for this function along with the function object's context\n-and make the function entirely self-contained. The only reason data blob's\n-value is computed via a function instead of just passing in the new value is to\n-avoid race conditions. If you want to update the value in the DHT, you must\n-first retrieve it, then modify it, then write it back. The way the DHT works,\n-it is natural to always do a lookup before storing and calling the callback in\n-between is convenient.\n- [report_issue]\n-***** dht_get_peers() dht_announce() *****\n-void dht_announce (sha1_hash const& info_hash, int port = 0, dht::\n-announce_flags_t flags = {});\n-void dht_get_peers (sha1_hash const& info_hash);\n-dht_get_peers() will issue a DHT get_peer request to the DHT for the specified\n-info-hash. The response (the peers) will be posted back in a\n-dht_get_peers_reply_alert.\n-dht_announce() will issue a DHT announce request to the DHT to the specified\n-info-hash, advertising the specified port. If the port is left at its default,\n-0, the port will be implied by the DHT message's source port (which may improve\n-connectivity through a NAT).\n-Both these functions are exposed for advanced custom use of the DHT. All\n-torrents eligible to be announce to the DHT will be automatically, by\n-libtorrent.\n-For possible flags, see announce_flags_t.\n+****** http_category() ******\n+Declared in \"libtorrent/error_code.hpp\"\n+boost::system::error_category& http_category ();\n+returns the error_category for HTTP errors\n [report_issue]\n-***** dht_live_nodes() *****\n-void dht_live_nodes (sha1_hash const& nid);\n-Retrieve all the live DHT (identified by nid) nodes. All the nodes id and\n-endpoint will be returned in the list of nodes in the alert\n-dht_live_nodes_alert. Since this alert is a response to an explicit call, it\n-will always be posted, regardless of the alert mask.\n+****** pcp_category() ******\n+Declared in \"libtorrent/natpmp.hpp\"\n+boost::system::error_category& pcp_category ();\n [report_issue]\n-***** dht_sample_infohashes() *****\n-void dht_sample_infohashes (udp::endpoint const& ep, sha1_hash const& target);\n-Query the DHT node specified by ep to retrieve a sample of the info-hashes that\n-the node currently have in their storage. The target is included for iterative\n-lookups so that indexing nodes can perform a key space traversal with a single\n-RPC per node by adjusting the target value for each RPC. It has no effect on\n-the returned sample value. The result is posted as a\n-dht_sample_infohashes_alert.\n+****** upnp_category() ******\n+Declared in \"libtorrent/upnp.hpp\"\n+boost::system::error_category& upnp_category ();\n+the boost.system error category for UPnP errors\n [report_issue]\n-***** dht_direct_request() *****\n-void dht_direct_request (udp::endpoint const& ep, entry const& e, client_data_t\n-userdata = {});\n-Send an arbitrary DHT request directly to the specified endpoint. This function\n-is intended for use by plugins. When a response is received or the request\n-times out, a dht_direct_response_alert will be posted with the response (if\n-any) and the userdata pointer passed in here. Since this alert is a response to\n-an explicit call, it will always be posted, regardless of the alert mask.\n+****** gzip_category() ******\n+Declared in \"libtorrent/gzip.hpp\"\n+boost::system::error_category& gzip_category ();\n+get the error_category for zip errors\n [report_issue]\n-***** add_extension() *****\n-void add_extension (std::function(\n- torrent_handle const&, client_data_t)> ext);\n-void add_extension (std::shared_ptr ext);\n-This function adds an extension to this session. The argument is a function\n-object that is called with a torrent_handle and which should return a std::\n-shared_ptr. To write custom plugins, see libtorrent_plugins.\n-For the typical bittorrent client all of these extensions should be added. The\n-main plugins implemented in libtorrent are:\n- uTorrent metadata\n- Allows peers to download the metadata (.torrent files) from the swarm\n- directly. Makes it possible to join a swarm with just a tracker and info-\n- hash.\n-#include \n-ses.add_extension(<::create_ut_metadata_plugin);\n- uTorrent peer exchange\n- Exchanges peers between clients.\n-#include \n-ses.add_extension(<::create_ut_pex_plugin);\n- smart ban plugin\n- A plugin that, with a small overhead, can ban peers that sends bad data\n- with very high accuracy. Should eliminate most problems on poisoned\n- torrents.\n-#include \n-ses.add_extension(<::create_smart_ban_plugin);\n- [report_issue]\n-***** get_ip_filter() set_ip_filter() *****\n-void set_ip_filter (ip_filter f);\n-ip_filter get_ip_filter () const;\n-Sets a filter that will be used to reject and accept incoming as well as\n-outgoing connections based on their originating ip address. The default filter\n-will allow connections to any ip address. To build a set of rules for which\n-addresses are accepted and not, see ip_filter.\n-Each time a peer is blocked because of the IP filter, a peer_blocked_alert is\n-generated. get_ip_filter() Returns the ip_filter currently in the session. See\n-ip_filter.\n+****** socks_category() ******\n+Declared in \"libtorrent/socks5_stream.hpp\"\n+boost::system::error_category& socks_category ();\n+returns the error_category for SOCKS5 errors\n [report_issue]\n-***** set_port_filter() *****\n-void set_port_filter (port_filter const& f);\n-apply port_filter f to incoming and outgoing peers. a port filter will reject\n-making outgoing peer connections to certain remote ports. The main intention is\n-to be able to avoid triggering certain anti-virus software by connecting to\n-SMTP, FTP ports.\n- [report_issue]\n-***** ssl_listen_port() listen_port() is_listening() *****\n-unsigned short ssl_listen_port () const;\n-unsigned short listen_port () const;\n-bool is_listening () const;\n-is_listening() will tell you whether or not the session has successfully opened\n-a listening port. If it hasn't, this function will return false, and then you\n-can set a new settings_pack::listen_interfaces to try another interface and\n-port to bind to.\n-listen_port() returns the port we ended up listening on.\n- [report_issue]\n-***** set_peer_class_filter() get_peer_class_filter() *****\n-ip_filter get_peer_class_filter () const;\n-void set_peer_class_filter (ip_filter const& f);\n-Sets the peer class filter for this session. All new peer connections will take\n-this into account and be added to the peer classes specified by this filter,\n-based on the peer's IP address.\n-The ip-filter essentially maps an IP -> uint32. Each bit in that 32 bit integer\n-represents a peer class. The least significant bit represents class 0, the next\n-bit class 1 and so on.\n-For more info, see ip_filter.\n-For example, to make all peers in the range 200.1.1.0 - 200.1.255.255 belong to\n-their own peer class, apply the following filter:\n-ip_filter f = ses.get_peer_class_filter();\n-peer_class_t my_class = ses.create_peer_class(\"200.1.x.x IP range\");\n-f.add_rule(make_address(\"200.1.1.0\"), make_address(\"200.1.255.255\")\n- , 1 << static_cast(my_class));\n-ses.set_peer_class_filter(f);\n-This setting only applies to new connections, it won't affect existing peer\n-connections.\n-This function is limited to only peer class 0-31, since there are only 32 bits\n-in the IP range mapping. Only the set bits matter; no peer class will be\n-removed from a peer as a result of this call, peer classes are only added.\n-The peer_class argument cannot be greater than 31. The bitmasks representing\n-peer classes in the peer_class_filter are 32 bits.\n-The get_peer_class_filter() function returns the current filter.\n-For more information, see peer_classes.\n- [report_issue]\n-***** get_peer_class_type_filter() set_peer_class_type_filter() *****\n-void set_peer_class_type_filter (peer_class_type_filter const& f);\n-peer_class_type_filter get_peer_class_type_filter () const;\n-Sets and gets the peer class type filter. This is controls automatic peer class\n-assignments to peers based on what kind of socket it is.\n-It does not only support assigning peer classes, it also supports removing peer\n-classes based on socket type.\n-The order of these rules being applied are:\n- 1. peer-class IP filter\n- 2. peer-class type filter, removing classes\n- 3. peer-class type filter, adding classes\n-For more information, see peer_classes.\n+****** i2p_category() ******\n+Declared in \"libtorrent/i2p_stream.hpp\"\n+boost::system::error_category& i2p_category ();\n+returns the error category for I2P errors\n [report_issue]\n-***** create_peer_class() *****\n-peer_class_t create_peer_class (char const* name);\n-Creates a new peer class (see peer_classes) with the given name. The returned\n-integer is the new peer class identifier. Peer classes may have the same name,\n-so each invocation of this function creates a new class and returns a unique\n-identifier.\n-Identifiers are assigned from low numbers to higher. So if you plan on using\n-certain peer classes in a call to set_peer_class_filter(), make sure to create\n-those early on, to get low identifiers.\n-For more information on peer classes, see peer_classes.\n+****** bdecode_category() ******\n+Declared in \"libtorrent/bdecode.hpp\"\n+boost::system::error_category& bdecode_category ();\n [report_issue]\n-***** delete_peer_class() *****\n-void delete_peer_class (peer_class_t cid);\n-This call dereferences the reference count of the specified peer class. When\n-creating a peer class it's automatically referenced by 1. If you want to\n-recycle a peer class, you may call this function. You may only call this\n-function once per peer class you create. Calling it more than once for the same\n-class will lead to memory corruption.\n-Since peer classes are reference counted, this function will not remove the\n-peer class if it's still assigned to torrents or peers. It will however remove\n-it once the last peer and torrent drops their references to it.\n-There is no need to call this function for custom peer classes. All peer\n-classes will be properly destructed when the session object destructs.\n-For more information on peer classes, see peer_classes.\n- [report_issue]\n-***** set_peer_class() get_peer_class() *****\n-peer_class_info get_peer_class (peer_class_t cid) const;\n-void set_peer_class (peer_class_t cid, peer_class_info const& pci);\n-These functions queries information from a peer class and updates the\n-configuration of a peer class, respectively.\n-cid must refer to an existing peer class. If it does not, the return value of\n-get_peer_class() is undefined.\n-set_peer_class() sets all the information in the peer_class_info object in the\n-specified peer class. There is no option to only update a single property.\n-A peer or torrent belonging to more than one class, the highest priority among\n-any of its classes is the one that is taken into account.\n-For more information, see peer_classes.\n+****** enum error_code_enum ******\n+Declared in \"libtorrent/error_code.hpp\"\n+ _____________________________________________________________________________\n+|name________________________________|value|description_______________________|\n+|no_error____________________________|0____|Not_an_error______________________|\n+|file_collision |1 |Two torrents has files which end |\n+|____________________________________|_____|up_overwriting_each_other_________|\n+|failed_hash_check |2 |A piece did not match its piece |\n+|____________________________________|_____|hash______________________________|\n+| | |The .torrent file does not contain|\n+|torrent_is_no_dict |3 |a bencoded dictionary at its top |\n+|____________________________________|_____|level_____________________________|\n+|torrent_missing_info |4 |The .torrent file does not have an|\n+|____________________________________|_____|info_dictionary___________________|\n+|torrent_info_no_dict |5 |The .torrent file's info entry is |\n+|____________________________________|_____|not_a_dictionary__________________|\n+|torrent_missing_piece_length |6 |The .torrent file does not have a |\n+|____________________________________|_____|piece_length_entry________________|\n+|torrent_missing_name |7 |The .torrent file does not have a |\n+|____________________________________|_____|name_entry________________________|\n+|torrent_invalid_name |8 |The .torrent file's name entry is |\n+|____________________________________|_____|invalid___________________________|\n+| | |The length of a file, or of the |\n+|torrent_invalid_length |9 |whole .torrent file is invalid. |\n+|____________________________________|_____|Either_negative_or_not_an_integer_|\n+|torrent_file_parse_failed |10 |Failed to parse a file entry in |\n+|____________________________________|_____|the_.torrent______________________|\n+|torrent_missing_pieces |11 |The pieces field is missing or |\n+|____________________________________|_____|invalid_in_the_.torrent_file______|\n+|torrent_invalid_hashes |12 |The pieces string has incorrect |\n+|____________________________________|_____|length____________________________|\n+|too_many_pieces_in_torrent |13 |The .torrent file has more pieces |\n+|____________________________________|_____|than_is_supported_by_libtorrent___|\n+| | |The metadata (.torrent file) that |\n+|invalid_swarm_metadata |14 |was received from the swarm |\n+| | |matched the info-hash, but failed |\n+|____________________________________|_____|to_be_parsed______________________|\n+|invalid_bencoding |15 |The file or buffer is not |\n+|____________________________________|_____|correctly_bencoded________________|\n+|no_files_in_torrent |16 |The .torrent file does not contain|\n+|____________________________________|_____|any_files_________________________|\n+|invalid_escaped_string |17 |The string was not properly url- |\n+|____________________________________|_____|encoded_as_expected_______________|\n+|session_is_closing |18 |Operation is not permitted since |\n+|____________________________________|_____|the_session_is_shutting_down______|\n+| | |There's already a torrent with |\n+|duplicate_torrent |19 |that info-hash added to the |\n+|____________________________________|_____|session___________________________|\n+|invalid_torrent_handle |20 |The supplied torrent_handle is not|\n+|____________________________________|_____|referring_to_a_valid_torrent______|\n+|invalid_entry_type |21 |The type requested from the entry |\n+|____________________________________|_____|did_not_match_its_type____________|\n+|missing_info_hash_in_uri |22 |The specified URI does not contain|\n+|____________________________________|_____|a_valid_info-hash_________________|\n+| | |One of the files in the torrent |\n+|file_too_short |23 |was unexpectedly small. This might|\n+| | |be caused by files being changed |\n+|____________________________________|_____|by_an_external_process____________|\n+| | |The URL used an unknown protocol. |\n+| | |Currently http and https (if built|\n+|unsupported_url_protocol |24 |with openssl support) are |\n+| | |recognized. For trackers udp is |\n+|____________________________________|_____|recognized_as_well._______________|\n+|url_parse_error |25 |The URL did not conform to URL |\n+|____________________________________|_____|syntax_and_failed_to_be_parsed____|\n+|peer_sent_empty_piece |26 |The peer sent a piece message of |\n+|____________________________________|_____|length_0__________________________|\n+|parse_failed |27 |A bencoded structure was corrupt |\n+|____________________________________|_____|and_failed_to_be_parsed___________|\n+|invalid_file_tag |28 |The fast resume file was missing |\n+|____________________________________|_____|or_had_an_invalid_file_version_tag|\n+|missing_info_hash |29 |The fast resume file was missing |\n+|____________________________________|_____|or_had_an_invalid_info-hash_______|\n+|mismatching_info_hash |30 |The info-hash did not match the |\n+|____________________________________|_____|torrent___________________________|\n+|invalid_hostname |31 |The URL contained an invalid |\n+|____________________________________|_____|hostname__________________________|\n+|invalid_port________________________|32___|The_URL_had_an_invalid_port_______|\n+| | |The port is blocked by the port- |\n+|port_blocked |33 |filter, and prevented the |\n+|____________________________________|_____|connection________________________|\n+|expected_close_bracket_in_address |34 |The IPv6 address was expected to |\n+|____________________________________|_____|end_with_\"]\"______________________|\n+| | |The torrent is being destructed, |\n+|destructing_torrent |35 |preventing the operation to |\n+|____________________________________|_____|succeed___________________________|\n+|timed_out___________________________|36___|The_connection_timed_out__________|\n+| | |The peer is upload only, and we |\n+|upload_upload_connection |37 |are upload only. There's no point |\n+|____________________________________|_____|in_keeping_the_connection_________|\n+| | |The peer is upload only, and we're|\n+|uninteresting_upload_peer |38 |not interested in it. There's no |\n+|____________________________________|_____|point_in_keeping_the_connection___|\n+|invalid_info_hash___________________|39___|The_peer_sent_an_unknown_info-hash|\n+|torrent_paused |40 |The torrent is paused, preventing |\n+|____________________________________|_____|the_operation_from_succeeding_____|\n+| | |The peer sent an invalid have |\n+|invalid_have |41 |message, either wrong size or |\n+| | |referring to a piece that doesn't |\n+|____________________________________|_____|exist_in_the_torrent______________|\n+|invalid_bitfield_size |42 |The bitfield message had the |\n+|____________________________________|_____|incorrect_size____________________|\n+| | |The peer kept requesting pieces |\n+|too_many_requests_when_choked |43 |after it was choked, possible |\n+|____________________________________|_____|abuse_attempt.____________________|\n+| | |The peer sent a piece message that|\n+|invalid_piece |44 |does not correspond to a piece |\n+|____________________________________|_____|request_sent_by_the_client________|\n+|no_memory___________________________|45___|memory_allocation_failed__________|\n+|torrent_aborted |46 |The torrent is aborted, preventing|\n+|____________________________________|_____|the_operation_to_succeed__________|\n+|self_connection |47 |The peer is a connection to |\n+|____________________________________|_____|ourself,_no_point_in_keeping_it___|\n+| | |The peer sent a piece message with|\n+|invalid_piece_size |48 |invalid size, either negative or |\n+|____________________________________|_____|greater_than_one_block____________|\n+| | |The peer has not been interesting |\n+|timed_out_no_interest |49 |or interested in us for too long, |\n+|____________________________________|_____|no_point_in_keeping_it_around_____|\n+|timed_out_inactivity |50 |The peer has not said anything in |\n+|____________________________________|_____|a_long_time,_possibly_dead________|\n+| | |The peer did not send a handshake |\n+|timed_out_no_handshake |51 |within a reasonable amount of |\n+| | |time, it might not be a bittorrent|\n+|____________________________________|_____|peer______________________________|\n+| | |The peer has been unchoked for too|\n+|timed_out_no_request |52 |long without requesting any data. |\n+| | |It might be lying about its |\n+|____________________________________|_____|interest_in_us____________________|\n+|invalid_choke |53 |The peer sent an invalid choke |\n+|____________________________________|_____|message___________________________|\n+|invalid_unchoke |54 |The peer send an invalid unchoke |\n+|____________________________________|_____|message___________________________|\n+|invalid_interested |55 |The peer sent an invalid |\n+|____________________________________|_____|interested_message________________|\n+|invalid_not_interested |56 |The peer sent an invalid not- |\n+|____________________________________|_____|interested_message________________|\n+|invalid_request |57 |The peer sent an invalid piece |\n+|____________________________________|_____|request_message___________________|\n+| | |The peer sent an invalid hash-list|\n+|invalid_hash_list |58 |message (this is part of the |\n+|____________________________________|_____|merkle-torrent_extension)_________|\n+| | |The peer sent an invalid hash- |\n+|invalid_hash_piece |59 |piece message (this is part of the|\n+|____________________________________|_____|merkle-torrent_extension)_________|\n+|invalid_cancel |60 |The peer sent an invalid cancel |\n+|____________________________________|_____|message___________________________|\n+|invalid_dht_port |61 |The peer sent an invalid DHT port-|\n+|____________________________________|_____|message___________________________|\n+|invalid_suggest |62 |The peer sent an invalid suggest |\n+|____________________________________|_____|piece-message_____________________|\n+|invalid_have_all |63 |The peer sent an invalid have all-|\n+|____________________________________|_____|message___________________________|\n+|invalid_have_none |64 |The peer sent an invalid have |\n+|____________________________________|_____|none-message______________________|\n+|invalid_reject |65 |The peer sent an invalid reject |\n+|____________________________________|_____|message___________________________|\n+|invalid_allow_fast |66 |The peer sent an invalid allow |\n+|____________________________________|_____|fast-message______________________|\n+|invalid_extended |67 |The peer sent an invalid extension|\n+|____________________________________|_____|message_ID________________________|\n+|invalid_message |68 |The peer sent an invalid message |\n+|____________________________________|_____|ID________________________________|\n+|sync_hash_not_found |69 |The synchronization hash was not |\n+|____________________________________|_____|found_in_the_encrypted_handshake__|\n+|invalid_encryption_constant |70 |The encryption constant in the |\n+|____________________________________|_____|handshake_is_invalid______________|\n+|no_plaintext_mode |71 |The peer does not support plain |\n+|____________________________________|_____|text,_which_is_the_selected_mode__|\n+|no_rc4_mode |72 |The peer does not support RC4, |\n+|____________________________________|_____|which_is_the_selected_mode________|\n+| | |The peer does not support any of |\n+|unsupported_encryption_mode |73 |the encryption modes that the |\n+|____________________________________|_____|client_supports___________________|\n+| | |The peer selected an encryption |\n+|unsupported_encryption_mode_selected|74 |mode that the client did not |\n+|____________________________________|_____|advertise_and_does_not_support____|\n+| | |The pad size used in the |\n+|invalid_pad_size |75 |encryption handshake is of invalid|\n+|____________________________________|_____|size______________________________|\n+|invalid_encrypt_handshake |76 |The encryption handshake is |\n+|____________________________________|_____|invalid___________________________|\n+| | |The client is set to not support |\n+|no_incoming_encrypted |77 |incoming encrypted connections and|\n+|____________________________________|_____|this_is_an_encrypted_connection___|\n+| | |The client is set to not support |\n+|no_incoming_regular |78 |incoming regular bittorrent |\n+| | |connections, and this is a regular|\n+|____________________________________|_____|connection________________________|\n+|duplicate_peer_id |79 |The client is already connected to|\n+|____________________________________|_____|this_peer-ID______________________|\n+|torrent_removed_____________________|80___|Torrent_was_removed_______________|\n+|packet_too_large |81 |The packet size exceeded the upper|\n+|____________________________________|_____|sanity_check-limit________________|\n+|reserved____________________________|82___|\u00a0________________________________|\n+|http_error |83 |The web server responded with an |\n+|____________________________________|_____|error_____________________________|\n+|missing_location |84 |The web server response is missing|\n+|____________________________________|_____|a_location_header_________________|\n+| | |The web seed redirected to a path |\n+|invalid_redirection |85 |that no longer matches the |\n+|____________________________________|_____|.torrent_directory_structure______|\n+|redirecting |86 |The connection was closed because |\n+|____________________________________|_____|it_redirected_to_a_different_URL__|\n+|invalid_range_______________________|87___|The_HTTP_range_header_is_invalid__|\n+|no_content_length |88 |The HTTP response did not have a |\n+|____________________________________|_____|content_length____________________|\n+|banned_by_ip_filter_________________|89___|The_IP_is_blocked_by_the_IP_filter|\n+|too_many_connections________________|90___|At_the_connection_limit___________|\n+|peer_banned_________________________|91___|The_peer_is_marked_as_banned______|\n+|stopping_torrent |92 |The torrent is stopping, causing |\n+|____________________________________|_____|the_operation_to_fail_____________|\n+|too_many_corrupt_pieces |93 |The peer has sent too many corrupt|\n+|____________________________________|_____|pieces_and_is_banned______________|\n+|torrent_not_ready |94 |The torrent is not ready to |\n+|____________________________________|_____|receive_peers_____________________|\n+|peer_not_constructed |95 |The peer is not completely |\n+|____________________________________|_____|constructed_yet___________________|\n+|session_closing |96 |The session is closing, causing |\n+|____________________________________|_____|the_operation_to_fail_____________|\n+| | |The peer was disconnected in order|\n+|optimistic_disconnect |97 |to leave room for a potentially |\n+|____________________________________|_____|better_peer_______________________|\n+|torrent_finished____________________|98___|The_torrent_is_finished___________|\n+|no_router___________________________|99___|No_UPnP_router_found______________|\n+|metadata_too_large |100 |The metadata message says the |\n+|____________________________________|_____|metadata_exceeds_the_limit________|\n+|invalid_metadata_request |101 |The peer sent an invalid metadata |\n+|____________________________________|_____|request_message___________________|\n+|invalid_metadata_size |102 |The peer advertised an invalid |\n+|____________________________________|_____|metadata_size_____________________|\n+|invalid_metadata_offset |103 |The peer sent a message with an |\n+|____________________________________|_____|invalid_metadata_offset___________|\n+|invalid_metadata_message |104 |The peer sent an invalid metadata |\n+|____________________________________|_____|message___________________________|\n+|pex_message_too_large |105 |The peer sent a peer exchange |\n+|____________________________________|_____|message_that_was_too_large________|\n+|invalid_pex_message |106 |The peer sent an invalid peer |\n+|____________________________________|_____|exchange_message__________________|\n+|invalid_lt_tracker_message |107 |The peer sent an invalid tracker |\n+|____________________________________|_____|exchange_message__________________|\n+| | |The peer sent an pex messages too |\n+|too_frequent_pex |108 |often. This is a possible attempt |\n+|____________________________________|_____|of_and_attack_____________________|\n+| | |The operation failed because it |\n+| | |requires the torrent to have the |\n+| | |metadata (.torrent file) and it |\n+|no_metadata |109 |doesn't have it yet. This happens |\n+| | |for magnet links before they have |\n+| | |downloaded the metadata, and also |\n+|____________________________________|_____|torrents_added_by_URL.____________|\n+| | |The peer sent an invalid dont_have|\n+| | |message. The don't have message is|\n+|invalid_dont_have |110 |an extension to allow peers to |\n+| | |advertise that the no longer has a|\n+|____________________________________|_____|piece_they_previously_had.________|\n+| | |The peer tried to connect to an |\n+|requires_ssl_connection |111 |SSL torrent without connecting |\n+|____________________________________|_____|over_SSL._________________________|\n+| | |The peer tried to connect to a |\n+|invalid_ssl_cert |112 |torrent with a certificate for a |\n+|____________________________________|_____|different_torrent.________________|\n+| | |the torrent is not an SSL torrent,|\n+|not_an_ssl_torrent |113 |and the operation requires an SSL |\n+|____________________________________|_____|torrent___________________________|\n+| | |peer was banned because its listen|\n+|banned_by_port_filter |114 |port is within a banned port |\n+| | |range, as specified by the |\n+|____________________________________|_____|port_filter.______________________|\n+|invalid_session_handle |115 |The session_handle is not |\n+|____________________________________|_____|referring_to_a_valid_session_impl_|\n+|invalid_listen_socket |116 |the listen socket associated with |\n+|____________________________________|_____|this_request_was_closed___________|\n+|invalid_hash_request________________|117__|\u00a0________________________________|\n+|invalid_hashes______________________|118__|\u00a0________________________________|\n+|invalid_hash_reject_________________|119__|\u00a0________________________________|\n+|deprecated_120______________________|120__|\u00a0________________________________|\n+|deprecated_121______________________|121__|\u00a0________________________________|\n+|deprecated_122______________________|122__|\u00a0________________________________|\n+|deprecated_123______________________|123__|\u00a0________________________________|\n+|deprecated_124______________________|124__|\u00a0________________________________|\n+|missing_file_sizes |130 |The resume data file is missing |\n+|____________________________________|_____|the_file_sizes_entry______________|\n+|no_files_in_resume_data |131 |The resume data file file sizes |\n+|____________________________________|_____|entry_is_empty____________________|\n+|missing_pieces |132 |The resume data file is missing |\n+|____________________________________|_____|the_pieces_and_slots_entry________|\n+| | |The number of files in the resume |\n+|mismatching_number_of_files |133 |data does not match the number of |\n+|____________________________________|_____|files_in_the_torrent______________|\n+| | |One of the files on disk has a |\n+|mismatching_file_size |134 |different size than in the fast |\n+|____________________________________|_____|resume_file_______________________|\n+| | |One of the files on disk has a |\n+|mismatching_file_timestamp |135 |different timestamp than in the |\n+|____________________________________|_____|fast_resume_file__________________|\n+|not_a_dictionary |136 |The resume data file is not a |\n+|____________________________________|_____|dictionary________________________|\n+|invalid_blocks_per_piece |137 |The blocks per piece entry is |\n+|____________________________________|_____|invalid_in_the_resume_data_file___|\n+| | |The resume file is missing the |\n+|missing_slots |138 |slots entry, which is required for|\n+| | |torrents with compact allocation. |\n+|____________________________________|_____|DEPRECATED________________________|\n+|too_many_slots |139 |The resume file contains more |\n+|____________________________________|_____|slots_than_the_torrent____________|\n+|invalid_slot_list |140 |The slot entry is invalid in the |\n+|____________________________________|_____|resume_data_______________________|\n+|invalid_piece_index |141 |One index in the slot list is |\n+|____________________________________|_____|invalid___________________________|\n+| | |The pieces on disk needs to be re-|\n+| | |ordered for the specified |\n+| | |allocation mode. This happens if |\n+|pieces_need_reorder |142 |you specify sparse allocation and |\n+| | |the files on disk are using |\n+| | |compact storage. The pieces needs |\n+| | |to be moved to their right |\n+|____________________________________|_____|position._DEPRECATED______________|\n+| | |this error is returned when asking|\n+| | |to save resume data and specifying|\n+|resume_data_not_modified |143 |the flag to only save when there's|\n+| | |anything new to save |\n+| | |(torrent_handle::only_if_modified)|\n+|____________________________________|_____|and_there_wasn't_anything_changed.|\n+|http_parse_error |150 |The HTTP header was not correctly |\n+|____________________________________|_____|formatted_________________________|\n+| | |The HTTP response was in the 300- |\n+|http_missing_location |151 |399 range but lacked a location |\n+|____________________________________|_____|header____________________________|\n+| | |The HTTP response was encoded with|\n+|http_failed_decompress |152 |gzip or deflate but decompressing |\n+|____________________________________|_____|it_failed_________________________|\n+|no_i2p_router |160 |The URL specified an i2p address, |\n+|____________________________________|_____|but_no_i2p_router_is_configured___|\n+|no_i2p_endpoint |161 |i2p acceptor is not available yet,|\n+|____________________________________|_____|can't_announce_without_endpoint___|\n+| | |The tracker URL doesn't support |\n+|scrape_not_available |170 |transforming it into a scrape URL.|\n+|____________________________________|_____|i.e._it_doesn't_contain_\"announce.|\n+|invalid_tracker_response____________|171__|invalid_tracker_response__________|\n+|invalid_peer_dict |172 |invalid peer dictionary entry. Not|\n+|____________________________________|_____|a_dictionary______________________|\n+|tracker_failure_____________________|173__|tracker_sent_a_failure_message____|\n+|invalid_files_entry_________________|174__|missing_or_invalid_files_entry____|\n+|invalid_hash_entry__________________|175__|missing_or_invalid_hash_entry_____|\n+|invalid_peers_entry |176 |missing or invalid peers and |\n+|____________________________________|_____|peers6_entry______________________|\n+|invalid_tracker_response_length |177 |UDP tracker response packet has |\n+|____________________________________|_____|invalid_size______________________|\n+|invalid_tracker_transaction_id |178 |invalid transaction id in UDP |\n+|____________________________________|_____|tracker_response__________________|\n+|invalid_tracker_action |179 |invalid action field in UDP |\n+|____________________________________|_____|tracker_response__________________|\n+| | |skipped announce (because it's |\n+|announce_skipped |180 |assumed to be unreachable over the|\n+|____________________________________|_____|given_source_network_interface)___|\n+|no_entropy__________________________|200__|random_number_generation_failed___|\n+|ssrf_mitigation_____________________|201__|blocked_by_SSRF_mitigation________|\n+|blocked_by_idna |202 |blocked because IDNA host names |\n+|____________________________________|_____|are_banned________________________|\n+|torrent_unknown_version |210 |the torrent file has an unknown |\n+|____________________________________|_____|meta_version______________________|\n+|torrent_missing_file_tree |211 |the v2 torrent file has no file |\n+|____________________________________|_____|tree______________________________|\n+|torrent_missing_meta_version |212 |the torrent contains v2 keys but |\n+|____________________________________|_____|does_not_specify_meta_version_2___|\n+|torrent_inconsistent_files |213 |the v1 and v2 file metadata does |\n+|____________________________________|_____|not_match_________________________|\n+|torrent_missing_piece_layer |214 |one or more files are missing |\n+|____________________________________|_____|piece_layer_hashes________________|\n+|torrent_invalid_piece_layer |215 |a piece layer has the wrong size |\n+|____________________________________|_____|or_failed_hash_check______________|\n+|torrent_missing_pieces_root_________|216__|a_v2_file_entry_has_no_root_hash__|\n+|torrent_inconsistent_hashes |217 |the v1 and v2 hashes do not |\n+|____________________________________|_____|describe_the_same_data____________|\n+|torrent_invalid_pad_file |218 |a file in the v2 metadata has the |\n+|____________________________________|_____|pad_attribute_set_________________|\n+|error_code_max______________________|219__|the_number_of_error_codes_________|\n [report_issue]\n-***** remove_torrent() *****\n-void remove_torrent (const torrent_handle&, remove_flags_t = {});\n-remove_torrent() will close all peer connections associated with the torrent\n-and tell the tracker that we've stopped participating in the swarm. This\n-operation cannot fail. When it completes, you will receive a\n-torrent_removed_alert.\n-remove_torrent() is non-blocking, but will remove the torrent from the session\n-synchronously. Calling session_handle::add_torrent() immediately afterward with\n-the same torrent will succeed. Note that this creates a new handle which is not\n-equal to the removed one.\n-The optional second argument options can be used to delete all the files\n-downloaded by this torrent. To do so, pass in the value session_handle::\n-delete_files. Once the torrent is deleted, a torrent_deleted_alert is posted.\n-The torrent_handle remains valid for some time after remove_torrent() is\n-called. It will become invalid only after all libtorrent tasks (such as I/\n-O tasks) release their references to the torrent. Until this happens,\n-torrent_handle::is_valid() will return true, and other calls such as\n-torrent_handle::status() will succeed. Because of this, and because\n-remove_torrent() is non-blocking, the following sequence usually succeeds (does\n-not throw system_error): .. code:: c++\n- session.remove_handle(handle); handle.save_resume_data();\n-Note that when a queued or downloading torrent is removed, its position in the\n-download queue is vacated and every subsequent torrent in the queue has their\n-queue positions updated. This can potentially cause a large state_update to be\n-posted. When removing all torrents, it is advised to remove them from the back\n-of the queue, to minimize the shifting.\n- [report_issue]\n-***** apply_settings() get_settings() *****\n-void apply_settings (settings_pack&&);\n-void apply_settings (settings_pack const&);\n-settings_pack get_settings () const;\n-Applies the settings specified by the settings_pack s. This is an asynchronous\n-operation that will return immediately and actually apply the settings to the\n-main thread of libtorrent some time later.\n- [report_issue]\n-***** set_alert_notify() pop_alerts() wait_for_alert() *****\n-void set_alert_notify (std::function const& fun);\n-void pop_alerts (std::vector* alerts);\n-alert* wait_for_alert (time_duration max_wait);\n-Alerts is the main mechanism for libtorrent to report errors and events.\n-pop_alerts fills in the vector passed to it with pointers to new alerts. The\n-session still owns these alerts and they will stay valid until the next time\n-pop_alerts is called. You may not delete the alert objects.\n-It is safe to call pop_alerts from multiple different threads, as long as the\n-alerts themselves are not accessed once another thread calls pop_alerts. Doing\n-this requires manual synchronization between the popping threads.\n-wait_for_alert will block the current thread for max_wait time duration, or\n-until another alert is posted. If an alert is available at the time of the\n-call, it returns immediately. The returned alert pointer is the head of the\n-alert queue. wait_for_alert does not pop alerts from the queue, it merely peeks\n-at it. The returned alert will stay valid until pop_alerts is called twice. The\n-first time will pop it and the second will free it.\n-If there is no alert in the queue and no alert arrives within the specified\n-timeout, wait_for_alert returns nullptr.\n-In the python binding, wait_for_alert takes the number of milliseconds to wait\n-as an integer.\n-The alert queue in the session will not grow indefinitely. Make sure to pop\n-periodically to not miss notifications. To control the max number of alerts\n-that's queued by the session, see settings_pack::alert_queue_size.\n-Some alerts are considered so important that they are posted even when the\n-alert queue is full. Some alerts are considered mandatory and cannot be\n-disabled by the alert_mask. For instance, save_resume_data_alert and\n-save_resume_data_failed_alert are always posted, regardless of the alert mask.\n-To control which alerts are posted, set the alert_mask (settings_pack::\n-alert_mask).\n-If the alert queue fills up to the point where alerts are dropped, this will be\n-indicated by a alerts_dropped_alert, which contains a bitmask of which types of\n-alerts were dropped. Generally it is a good idea to make sure the alert queue\n-is large enough, the alert_mask doesn't have unnecessary categories enabled and\n-to call pop_alert() frequently, to avoid alerts being dropped.\n-the set_alert_notify function lets the client set a function object to be\n-invoked every time the alert queue goes from having 0 alerts to 1 alert. This\n-function is called from within libtorrent, it may be the main thread, or it may\n-be from within a user call. The intention of of the function is that the client\n-wakes up its main thread, to poll for more alerts using pop_alerts(). If the\n-notify function fails to do so, it won't be called again, until pop_alerts is\n-called for some other reason. For instance, it could signal an eventfd, post a\n-message to an HWND or some other main message pump. The actual retrieval of\n-alerts should not be done in the callback. In fact, the callback should not\n-block. It should not perform any expensive work. It really should just notify\n-the main application thread.\n-The type of an alert is returned by the polymorphic function alert::type() but\n-can also be queries from a concrete type via T::alert_type, as a static\n-constant.\n- [report_issue]\n-***** delete_port_mapping() add_port_mapping() *****\n-std::vector add_port_mapping (portmap_protocol t, int\n-external_port, int local_port);\n-void delete_port_mapping (port_mapping_t handle);\n-add_port_mapping adds one or more port forwards on UPnP and/or NAT-PMP,\n-whichever is enabled. A mapping is created for each listen socket in the\n-session. The return values are all handles referring to the port mappings that\n-were just created. Pass them to delete_port_mapping() to remove them.\n+****** enum http_errors ******\n+Declared in \"libtorrent/error_code.hpp\"\n+ _______________________________________\n+|name_________________|value|description|\n+|cont_________________|100__|\u00a0_________|\n+|ok___________________|200__|\u00a0_________|\n+|created______________|201__|\u00a0_________|\n+|accepted_____________|202__|\u00a0_________|\n+|no_content___________|204__|\u00a0_________|\n+|multiple_choices_____|300__|\u00a0_________|\n+|moved_permanently____|301__|\u00a0_________|\n+|moved_temporarily____|302__|\u00a0_________|\n+|not_modified_________|304__|\u00a0_________|\n+|bad_request__________|400__|\u00a0_________|\n+|unauthorized_________|401__|\u00a0_________|\n+|forbidden____________|403__|\u00a0_________|\n+|not_found____________|404__|\u00a0_________|\n+|internal_server_error|500__|\u00a0_________|\n+|not_implemented______|501__|\u00a0_________|\n+|bad_gateway__________|502__|\u00a0_________|\n+|service_unavailable__|503__|\u00a0_________|\n [report_issue]\n-***** reopen_network_sockets() *****\n-void reopen_network_sockets (reopen_network_flags_t options =\n-reopen_map_ports);\n-Instructs the session to reopen all listen and outgoing sockets.\n-It's useful in the case your platform doesn't support the built in IP notifier\n-mechanism, or if you have a better more reliable way to detect changes in the\n-IP routing table.\n+****** enum pcp_errors ******\n+Declared in \"libtorrent/natpmp.hpp\"\n+ _____________________________________________\n+|name_______________________|value|description|\n+|pcp_success________________|0____|\u00a0_________|\n+|pcp_unsupp_version_________|1____|\u00a0_________|\n+|pcp_not_authorized_________|2____|\u00a0_________|\n+|pcp_malformed_request______|3____|\u00a0_________|\n+|pcp_unsupp_opcode__________|4____|\u00a0_________|\n+|pcp_unsupp_option__________|5____|\u00a0_________|\n+|pcp_malformed_option_______|6____|\u00a0_________|\n+|pcp_network_failure________|7____|\u00a0_________|\n+|pcp_no_resources___________|8____|\u00a0_________|\n+|pcp_unsupp_protocol________|9____|\u00a0_________|\n+|pcp_user_ex_quota__________|10___|\u00a0_________|\n+|pcp_cannot_provide_external|11___|\u00a0_________|\n+|pcp_address_mismatch_______|12___|\u00a0_________|\n+|pcp_excessive_remote_peers_|13___|\u00a0_________|\n [report_issue]\n-***** native_handle() *****\n-std::shared_ptr native_handle () const;\n-This function is intended only for use by plugins. This type does not have a\n-stable API and should be relied on as little as possible.\n+****** enum error_code_enum ******\n+Declared in \"libtorrent/upnp.hpp\"\n+ _____________________________________________________________________________\n+|name______________________________|value|description_________________________|\n+|no_error__________________________|0____|No_error____________________________|\n+|invalid_argument |402 |One of the arguments in the request |\n+|__________________________________|_____|is_invalid__________________________|\n+|action_failed_____________________|501__|The_request_failed__________________|\n+|value_not_in_array |714 |The specified value does not exist |\n+|__________________________________|_____|in_the_array________________________|\n+| | |The source IP address cannot be |\n+|source_ip_cannot_be_wildcarded |715 |wild-carded, but must be fully |\n+|__________________________________|_____|specified___________________________|\n+|external_port_cannot_be_wildcarded|716 |The external port cannot be a |\n+|__________________________________|_____|wildcard,_but_must_be_specified_____|\n+| | |The port mapping entry specified |\n+|port_mapping_conflict |718 |conflicts with a mapping assigned |\n+|__________________________________|_____|previously_to_another_client________|\n+|internal_port_must_match_external |724 |Internal and external port value |\n+|__________________________________|_____|must_be_the_same____________________|\n+| | |The NAT implementation only supports|\n+|only_permanent_leases_supported |725 |permanent lease times on port |\n+|__________________________________|_____|mappings____________________________|\n+| | |RemoteHost must be a wildcard and |\n+|remote_host_must_be_wildcard |726 |cannot be a specific IP address or |\n+|__________________________________|_____|DNS_name____________________________|\n+|external_port_must_be_wildcard |727 |ExternalPort must be a wildcard and |\n+|__________________________________|_____|cannot_be_a_specific_port___________|\n [report_issue]\n- save_settings\n- saves settings (i.e. the settings_pack)\n+****** enum error_code_enum ******\n+Declared in \"libtorrent/gzip.hpp\"\n+ _____________________________________________________________________________\n+|name_______________________________|value|description________________________|\n+|no_error___________________________|0____|Not_an_error_______________________|\n+|invalid_gzip_header |1 |the supplied gzip buffer has |\n+|___________________________________|_____|invalid_header_____________________|\n+| | |the gzip buffer would inflate to |\n+|inflated_data_too_large |2 |more bytes than the specified |\n+|___________________________________|_____|maximum_size,_and_was_rejected.____|\n+|data_did_not_terminate |3 |available inflate data did not |\n+|___________________________________|_____|terminate__________________________|\n+|space_exhausted |4 |output space exhausted before |\n+|___________________________________|_____|completing_inflate_________________|\n+|invalid_block_type_________________|5____|invalid_block_type_(type_==_3)_____|\n+|invalid_stored_block_length |6 |stored block length did not match |\n+|___________________________________|_____|one's_complement___________________|\n+|too_many_length_or_distance_codes |7 |dynamic block code description: too|\n+|___________________________________|_____|many_length_or_distance_codes______|\n+|code_lengths_codes_incomplete |8 |dynamic block code description: |\n+|___________________________________|_____|code_lengths_codes_incomplete______|\n+|repeat_lengths_with_no_first_length|9 |dynamic block code description: |\n+|___________________________________|_____|repeat_lengths_with_no_first_length|\n+|repeat_more_than_specified_lengths |10 |dynamic block code description: |\n+|___________________________________|_____|repeat_more_than_specified_lengths_|\n+|invalid_literal_length_code_lengths|11 |dynamic block code description: |\n+|___________________________________|_____|invalid_literal/length_code_lengths|\n+|invalid_distance_code_lengths |12 |dynamic block code description: |\n+|___________________________________|_____|invalid_distance_code_lengths______|\n+|invalid_literal_code_in_block |13 |invalid literal/length or distance |\n+|___________________________________|_____|code_in_fixed_or_dynamic_block_____|\n+|distance_too_far_back_in_block |14 |distance is too far back in fixed |\n+|___________________________________|_____|or_dynamic_block___________________|\n+|unknown_gzip_error |15 |an unknown error occurred during |\n+|___________________________________|_____|gzip_inflation_____________________|\n+|error_code_max_____________________|16___|the_number_of_error_codes__________|\n [report_issue]\n- save_dht_state\n- saves dht state such as nodes and node-id, possibly accelerating joining\n- the DHT if provided at next session startup.\n+****** enum socks_error_code ******\n+Declared in \"libtorrent/socks5_stream.hpp\"\n+ ____________________________________________________\n+|name______________________________|value|description|\n+|no_error__________________________|0____|\u00a0_________|\n+|unsupported_version_______________|1____|\u00a0_________|\n+|unsupported_authentication_method_|2____|\u00a0_________|\n+|unsupported_authentication_version|3____|\u00a0_________|\n+|authentication_error______________|4____|\u00a0_________|\n+|username_required_________________|5____|\u00a0_________|\n+|general_failure___________________|6____|\u00a0_________|\n+|command_not_supported_____________|7____|\u00a0_________|\n+|no_identd_________________________|8____|\u00a0_________|\n+|identd_error______________________|9____|\u00a0_________|\n+|num_errors________________________|10___|\u00a0_________|\n [report_issue]\n- save_extension_state\n- load or save state from plugins\n+****** enum i2p_error_code ******\n+Declared in \"libtorrent/i2p_stream.hpp\"\n+ _________________________________\n+|name___________|value|description|\n+|no_error_______|0____|\u00a0_________|\n+|parse_failed___|1____|\u00a0_________|\n+|cant_reach_peer|2____|\u00a0_________|\n+|i2p_error______|3____|\u00a0_________|\n+|invalid_key____|4____|\u00a0_________|\n+|invalid_id_____|5____|\u00a0_________|\n+|timeout________|6____|\u00a0_________|\n+|key_not_found__|7____|\u00a0_________|\n+|duplicated_id__|8____|\u00a0_________|\n+|num_errors_____|9____|\u00a0_________|\n [report_issue]\n- save_ip_filter\n- load or save the IP filter set on the session\n- [report_issue]\n- global_peer_class_id tcp_peer_class_id local_peer_class_id\n- built-in peer classes\n+****** enum error_code_enum ******\n+Declared in \"libtorrent/bdecode.hpp\"\n+ ___________________________________________________________________________\n+|name__________|value|description___________________________________________|\n+|no_error______|0____|Not_an_error__________________________________________|\n+|expected_digit|1____|expected_digit_in_bencoded_string_____________________|\n+|expected_colon|2____|expected_colon_in_bencoded_string_____________________|\n+|unexpected_eof|3____|unexpected_end_of_file_in_bencoded_string_____________|\n+|expected_value|4 |expected value (list, dict, int or string) in bencoded|\n+|______________|_____|string________________________________________________|\n+|depth_exceeded|5____|bencoded_recursion_depth_limit_exceeded_______________|\n+|limit_exceeded|6____|bencoded_item_count_limit_exceeded____________________|\n+|overflow______|7____|integer_overflow______________________________________|\n+|error_code_max|8____|the_number_of_error_codes_____________________________|\n [report_issue]\n- delete_files\n- delete the files belonging to the torrent from disk. including the part-\n- file, if there is one\n+****** counters ******\n+Declared in \"libtorrent/performance_counters.hpp\"\n+struct counters\n+{\n+ counters () ;\n+ counters (counters const&) ;\n+ counters& operator= (counters const&) & ;\n+ std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n+ std::int64_t operator[] (int i) const ;\n+ void set_value (int c, std::int64_t value) ;\n+ void blend_stats_counter (int c, std::int64_t value, int ratio) ;\n+};\n+ [report_issue]\n+***** operator[]() inc_stats_counter() *****\n+std::int64_t inc_stats_counter (int c, std::int64_t value = 1) ;\n+std::int64_t operator[] (int i) const ;\n+returns the new value\n [report_issue]\n- delete_partfile\n- delete just the part-file associated with this torrent\n+****** stats_metric ******\n+Declared in \"libtorrent/session_stats.hpp\"\n+describes one statistics metric from the session. For more information, see the\n+session_statistics section.\n+struct stats_metric\n+{\n+ char const* name;\n+ int value_index;\n+ metric_type_t type;\n+};\n [report_issue]\n- paused\n- when set, the session will start paused. Call session_handle::resume() to\n- start\n+ name\n+ the name of the counter or gauge\n [report_issue]\n- udp tcp\n- protocols used by add_port_mapping()\n+ value_index type\n+ the index into the session stats array, where the underlying value of\n+ this counter or gauge is found. The session stats array is part of the\n+ session_stats_alert object.\n [report_issue]\n- reopen_map_ports\n- This option indicates if the ports are mapped using natpmp and upnp. If\n- mapping was already made, they are deleted and added again. This only\n- works if natpmp and/or upnp are configured to be enable.\n- [report_issue]\n-****** write_session_params_buf() write_session_params() read_session_params()\n-******\n-Declared in \"libtorrent/session_params.hpp\"\n-session_params read_session_params (bdecode_node const& e\n- , save_state_flags_t flags = save_state_flags_t::all());\n-session_params read_session_params (span buf\n- , save_state_flags_t flags = save_state_flags_t::all());\n-entry write_session_params (session_params const& sp\n- , save_state_flags_t flags = save_state_flags_t::all());\n-std::vector write_session_params_buf (session_params const& sp\n- , save_state_flags_t flags = save_state_flags_t::all());\n-These functions serialize and de-serialize a session_params object to and from\n-bencoded form. The session_params object is used to initialize a new session\n-using the state from a previous one (or by programmatically configure the\n-session up-front). The flags parameter can be used to only save and load\n-certain aspects of the session's state. The _buf suffix indicates the function\n-operates on buffer rather than the bencoded structure. The torrents in a\n-session are not part of the session_params state, they have to be restored\n-separately.\n+****** session_stats_metrics() ******\n+Declared in \"libtorrent/session_stats.hpp\"\n+std::vector session_stats_metrics ();\n+This free function returns the list of available metrics exposed by\n+libtorrent's statistics API. Each metric has a name and a value index. The\n+value index is the index into the array in session_stats_alert where this\n+metric's value can be found when the session stats is sampled (by calling\n+post_session_stats()).\n+[report_issue]\n+****** find_metric_idx() ******\n+Declared in \"libtorrent/session_stats.hpp\"\n+int find_metric_idx (string_view name);\n+given a name of a metric, this function returns the counter index of it, or -\n+1 if it could not be found. The counter index is the index into the values\n+array returned by session_stats_alert.\n+[report_issue]\n+****** enum metric_type_t ******\n+Declared in \"libtorrent/session_stats.hpp\"\n+ _________________________\n+|name___|value|description|\n+|counter|0____|\u00a0_________|\n+|gauge__|1____|\u00a0_________|\n The pop_alerts() function on session is the main interface for retrieving\n alerts (warnings, messages and errors from libtorrent). If no alerts have been\n posted by libtorrent pop_alerts() will return an empty list.\n By default, only errors are reported. settings_pack::alert_mask can be used to\n specify which kinds of events should be reported. The alert mask is a\n combination of the alert_category_t flags in the alert class.\n Every alert belongs to one or more category. There is a cost associated with\n@@ -7146,103 +6124,14 @@\n that are generated for a specific torrent are derived from torrent_alert, and\n tracker events derive from tracker_alert.\n Alerts returned by pop_alerts() are only valid until the next call to\n pop_alerts(). You may not copy an alert object to access it after the next call\n to pop_alerts(). Internal members of alerts also become invalid once pop_alerts\n () is called again.\n [report_issue]\n-****** alert ******\n-Declared in \"libtorrent/alert.hpp\"\n-The alert class is the base class that specific messages are derived from.\n-alert types are not copyable, and cannot be constructed by the client. The\n-pointers returned by libtorrent are short lived (the details are described\n-under session_handle::pop_alerts())\n-struct alert\n-{\n- time_point timestamp () const;\n- virtual int type () const noexcept = 0;\n- virtual char const* what () const noexcept = 0;\n- virtual std::string message () const = 0;\n- virtual alert_category_t category () const noexcept = 0;\n-\n- static constexpr alert_category_t error_notification = 0_bit;\n- static constexpr alert_category_t peer_notification = 1_bit;\n- static constexpr alert_category_t port_mapping_notification = 2_bit;\n- static constexpr alert_category_t storage_notification = 3_bit;\n- static constexpr alert_category_t tracker_notification = 4_bit;\n- static constexpr alert_category_t connect_notification = 5_bit;\n- static constexpr alert_category_t status_notification = 6_bit;\n- static constexpr alert_category_t ip_block_notification = 8_bit;\n- static constexpr alert_category_t performance_warning = 9_bit;\n- static constexpr alert_category_t dht_notification = 10_bit;\n- static constexpr alert_category_t session_log_notification = 13_bit;\n- static constexpr alert_category_t torrent_log_notification = 14_bit;\n- static constexpr alert_category_t peer_log_notification = 15_bit;\n- static constexpr alert_category_t incoming_request_notification = 16_bit;\n- static constexpr alert_category_t dht_log_notification = 17_bit;\n- static constexpr alert_category_t dht_operation_notification = 18_bit;\n- static constexpr alert_category_t port_mapping_log_notification = 19_bit;\n- static constexpr alert_category_t picker_log_notification = 20_bit;\n- static constexpr alert_category_t file_progress_notification = 21_bit;\n- static constexpr alert_category_t piece_progress_notification = 22_bit;\n- static constexpr alert_category_t upload_notification = 23_bit;\n- static constexpr alert_category_t block_progress_notification = 24_bit;\n- static constexpr alert_category_t all_categories = alert_category_t::all();\n-};\n-[report_issue]\n-***** timestamp() *****\n-time_point timestamp () const;\n-a timestamp is automatically created in the constructor\n-[report_issue]\n-***** type() *****\n-virtual int type () const noexcept = 0;\n-returns an integer that is unique to this alert type. It can be compared\n-against a specific alert by querying a static constant called alert_type in the\n-alert. It can be used to determine the run-time type of an alert* in order to\n-cast to that alert type and access specific members.\n-e.g:\n-std::vector alerts;\n-ses.pop_alerts(&alerts);\n-for (alert* a : alerts) {\n- switch (a->type()) {\n-\n- case read_piece_alert::alert_type:\n- {\n- auto* p = static_cast(a);\n- if (p->ec) {\n- // read_piece failed\n- break;\n- }\n- // use p\n- break;\n- }\n- case file_renamed_alert::alert_type:\n- {\n- // etc...\n- }\n- }\n-}\n-[report_issue]\n-***** what() *****\n-virtual char const* what () const noexcept = 0;\n-returns a string literal describing the type of the alert. It does not include\n-any information that might be bundled with the alert.\n-[report_issue]\n-***** message() *****\n-virtual std::string message () const = 0;\n-generate a string describing the alert and the information bundled with it.\n-This is mainly intended for debug and development use. It is not suitable to\n-use this for applications that may be localized. Instead, handle each alert\n-type individually and extract and render the information from the alert\n-depending on the locale.\n-[report_issue]\n-***** category() *****\n-virtual alert_category_t category () const noexcept = 0;\n-returns a bitmask specifying which categories this alert belong to.\n-[report_issue]\n ****** dht_routing_bucket ******\n Declared in \"libtorrent/alert_types.hpp\"\n struct to hold information about a single DHT routing table bucket\n struct dht_routing_bucket\n {\n int num_nodes;\n int num_replacements;\n@@ -7384,25 +6273,25 @@\n ****** file_renamed_alert ******\n Declared in \"libtorrent/alert_types.hpp\"\n This is posted as a response to a torrent_handle::rename_file() call, if the\n rename operation succeeds.\n struct file_renamed_alert final : torrent_alert\n {\n std::string message () const override;\n- char const* old_name () const;\n char const* new_name () const;\n+ char const* old_name () const;\n \n static constexpr alert_category_t static_category = alert_category::\n storage;\n file_index_t const index;\n };\n [report_issue]\n-***** new_name() old_name() *****\n-char const* old_name () const;\n+***** old_name() new_name() *****\n char const* new_name () const;\n+char const* old_name () const;\n returns the new and previous file name, respectively.\n [report_issue]\n index\n refers to the index of the file that was renamed,\n [report_issue]\n ****** file_rename_failed_alert ******\n Declared in \"libtorrent/alert_types.hpp\"\n@@ -9272,24 +8161,24 @@\n ****** dht_live_nodes_alert ******\n Declared in \"libtorrent/alert_types.hpp\"\n posted in response to a call to session::dht_live_nodes(). It contains the live\n nodes from the DHT routing table of one of the DHT nodes running locally.\n struct dht_live_nodes_alert final : alert\n {\n std::string message () const override;\n- std::vector> nodes () const;\n int num_nodes () const;\n+ std::vector> nodes () const;\n \n static constexpr alert_category_t static_category = alert_category::dht;\n sha1_hash node_id;\n };\n [report_issue]\n ***** num_nodes() nodes() *****\n-std::vector> nodes () const;\n int num_nodes () const;\n+std::vector> nodes () const;\n the number of nodes in the routing table and the actual nodes.\n [report_issue]\n node_id\n the local DHT node's node-ID this routing table belongs to\n [report_issue]\n ****** session_stats_header_alert ******\n Declared in \"libtorrent/alert_types.hpp\"\n@@ -9323,15 +8212,15 @@\n dht_operation;\n sha1_hash node_id;\n aux::noexcept_movable endpoint;\n time_duration const interval;\n int const num_infohashes;\n };\n [report_issue]\n-***** num_samples() samples() *****\n+***** samples() num_samples() *****\n int num_samples () const;\n std::vector samples () const;\n returns the number of info-hashes returned by the node, as well as the actual\n info-hashes. num_samples() is more efficient than samples().size().\n [report_issue]\n ***** num_nodes() *****\n int num_nodes () const;\n@@ -9378,17 +8267,17 @@\n Declared in \"libtorrent/alert_types.hpp\"\n this alert is posted to indicate to the client that some alerts were dropped.\n Dropped meaning that the alert failed to be delivered to the client. The most\n common cause of such failure is that the internal alert queue grew too big\n (controlled by alert_queue_size).\n struct alerts_dropped_alert final : alert\n {\n+ std::string message () const override;\n static_assert (num_alert_types <= abi_alert_count, \"need to increase bitset.\n This is an ABI break\");\n- std::string message () const override;\n \n static constexpr alert_category_t static_category = alert_category::error;\n std::bitset dropped_alerts;\n };\n [report_issue]\n dropped_alerts\n a bitmask indicating which alerts were dropped. Each bit represents the\n@@ -9480,24 +8369,113 @@\n collided with this swarm's info-hash.\n [report_issue]\n metadata\n the metadata that was received by one of the torrents in conflict. One\n way to resolve the conflict is to remove both failing torrents and re-add\n it using this metadata\n [report_issue]\n+****** alert ******\n+Declared in \"libtorrent/alert.hpp\"\n+The alert class is the base class that specific messages are derived from.\n+alert types are not copyable, and cannot be constructed by the client. The\n+pointers returned by libtorrent are short lived (the details are described\n+under session_handle::pop_alerts())\n+struct alert\n+{\n+ time_point timestamp () const;\n+ virtual int type () const noexcept = 0;\n+ virtual char const* what () const noexcept = 0;\n+ virtual std::string message () const = 0;\n+ virtual alert_category_t category () const noexcept = 0;\n+\n+ static constexpr alert_category_t error_notification = 0_bit;\n+ static constexpr alert_category_t peer_notification = 1_bit;\n+ static constexpr alert_category_t port_mapping_notification = 2_bit;\n+ static constexpr alert_category_t storage_notification = 3_bit;\n+ static constexpr alert_category_t tracker_notification = 4_bit;\n+ static constexpr alert_category_t connect_notification = 5_bit;\n+ static constexpr alert_category_t status_notification = 6_bit;\n+ static constexpr alert_category_t ip_block_notification = 8_bit;\n+ static constexpr alert_category_t performance_warning = 9_bit;\n+ static constexpr alert_category_t dht_notification = 10_bit;\n+ static constexpr alert_category_t session_log_notification = 13_bit;\n+ static constexpr alert_category_t torrent_log_notification = 14_bit;\n+ static constexpr alert_category_t peer_log_notification = 15_bit;\n+ static constexpr alert_category_t incoming_request_notification = 16_bit;\n+ static constexpr alert_category_t dht_log_notification = 17_bit;\n+ static constexpr alert_category_t dht_operation_notification = 18_bit;\n+ static constexpr alert_category_t port_mapping_log_notification = 19_bit;\n+ static constexpr alert_category_t picker_log_notification = 20_bit;\n+ static constexpr alert_category_t file_progress_notification = 21_bit;\n+ static constexpr alert_category_t piece_progress_notification = 22_bit;\n+ static constexpr alert_category_t upload_notification = 23_bit;\n+ static constexpr alert_category_t block_progress_notification = 24_bit;\n+ static constexpr alert_category_t all_categories = alert_category_t::all();\n+};\n+[report_issue]\n+***** timestamp() *****\n+time_point timestamp () const;\n+a timestamp is automatically created in the constructor\n+[report_issue]\n+***** type() *****\n+virtual int type () const noexcept = 0;\n+returns an integer that is unique to this alert type. It can be compared\n+against a specific alert by querying a static constant called alert_type in the\n+alert. It can be used to determine the run-time type of an alert* in order to\n+cast to that alert type and access specific members.\n+e.g:\n+std::vector alerts;\n+ses.pop_alerts(&alerts);\n+for (alert* a : alerts) {\n+ switch (a->type()) {\n+\n+ case read_piece_alert::alert_type:\n+ {\n+ auto* p = static_cast(a);\n+ if (p->ec) {\n+ // read_piece failed\n+ break;\n+ }\n+ // use p\n+ break;\n+ }\n+ case file_renamed_alert::alert_type:\n+ {\n+ // etc...\n+ }\n+ }\n+}\n+[report_issue]\n+***** what() *****\n+virtual char const* what () const noexcept = 0;\n+returns a string literal describing the type of the alert. It does not include\n+any information that might be bundled with the alert.\n+[report_issue]\n+***** message() *****\n+virtual std::string message () const = 0;\n+generate a string describing the alert and the information bundled with it.\n+This is mainly intended for debug and development use. It is not suitable to\n+use this for applications that may be localized. Instead, handle each alert\n+type individually and extract and render the information from the alert\n+depending on the locale.\n+[report_issue]\n+***** category() *****\n+virtual alert_category_t category () const noexcept = 0;\n+returns a bitmask specifying which categories this alert belong to.\n+[report_issue]\n ****** operation_name() ******\n Declared in \"libtorrent/operations.hpp\"\n char const* operation_name (operation_t op);\n maps an operation id (from peer_error_alert and peer_disconnected_alert) to its\n name. See operation_t for the constants\n [report_issue]\n ****** alert_cast() ******\n Declared in \"libtorrent/alert.hpp\"\n-template T const* alert_cast (alert const* a);\n template T* alert_cast (alert* a);\n+template T const* alert_cast (alert const* a);\n When you get an alert, you can use alert_cast<> to attempt to cast the pointer\n to a specific alert type, in order to query it for more information.\n Note\n alert_cast<> can only cast to an exact alert type, not a base class\n [report_issue]\n ****** enum operation_t ******\n Declared in \"libtorrent/operations.hpp\"\n@@ -9556,14 +8534,21 @@\n |enum_route_________|42___|enumeration_of_network_routes______________________|\n |file_seek |43 |moving read/write position in a file, operation_t::|\n |___________________|_____|hostname_lookup____________________________________|\n |timer______________|44___|an_async_wait_operation_on_a_timer_________________|\n |file_mmap__________|45___|call_to_mmap()_(or_windows_counterpart)____________|\n |file_truncate______|46___|call_to_ftruncate()_(or_SetEndOfFile()_on_windows)_|\n [report_issue]\n+****** int ******\n+Declared in \"libtorrent/alert_types.hpp\"\n+ user_alert_id\n+ user defined alerts should use IDs greater than this\n+ num_alert_types\n+ this constant represents \"max_alert_index\" + 1\n+[report_issue]\n ****** alert_category_t ******\n Declared in \"libtorrent/alert.hpp\"\n error\n Enables alerts that report an error. This includes:\n * tracker errors\n * tracker warnings\n * file errors\n@@ -9635,498 +8620,14 @@\n rate.\n all\n The full bitmask, representing all available categories.\n since the enum is signed, make sure this isn't interpreted as -1. For\n instance, boost.python does that and fails when assigning it to an\n unsigned parameter.\n [report_issue]\n-****** int ******\n-Declared in \"libtorrent/alert_types.hpp\"\n- user_alert_id\n- user defined alerts should use IDs greater than this\n- num_alert_types\n- this constant represents \"max_alert_index\" + 1\n-[report_issue]\n-****** client_data_t ******\n-Declared in \"libtorrent/client_data.hpp\"\n-A thin wrapper around a void pointer used as \"user data\". i.e. an opaque cookie\n-passed in to libtorrent and returned on demand. It adds type-safety by\n-requiring the same type be requested out of it as was assigned to it.\n-struct client_data_t\n-{\n- client_data_t () = default;\n- explicit client_data_t (T* v);\n- client_data_t& operator= (T* v);\n- explicit operator T () const;\n- T* get () const;\n- client_data_t& operator= (void*) = delete;\n- operator void* () const = delete;\n- operator void const* () const = delete;\n- client_data_t& operator= (void const*) = delete;\n-\n- template ::value>::type>\n-};\n-[report_issue]\n-***** client_data_t() *****\n-client_data_t () = default;\n-construct a nullptr client data\n- [report_issue]\n-***** const*() operator=() void*() *****\n-client_data_t& operator= (void*) = delete;\n-operator void* () const = delete;\n-operator void const* () const = delete;\n-client_data_t& operator= (void const*) = delete;\n-we don't allow type-unsafe operations\n-[report_issue]\n-****** add_torrent_params ******\n-Declared in \"libtorrent/add_torrent_params.hpp\"\n-The add_torrent_params contains all the information in a .torrent file along\n-with all information necessary to add that torrent to a session. The key fields\n-when adding a torrent are:\n- * ti - the immutable info-dict part of the torrent\n- * info_hash - when you don't have the metadata (.torrent file). This\n- uniquely identifies the torrent and can validate the info-dict when\n- received from the swarm.\n-In order to add a torrent to a session, one of those fields must be set in\n-addition to save_path. The add_torrent_params object can then be passed into\n-one of the session::add_torrent() overloads or session::async_add_torrent().\n-If you only specify the info-hash, the torrent file will be downloaded from\n-peers, which requires them to support the metadata extension. For the metadata\n-extension to work, libtorrent must be built with extensions enabled\n-(TORRENT_DISABLE_EXTENSIONS must not be defined). It also takes an optional\n-name argument. This may be left empty in case no name should be assigned to the\n-torrent. In case it's not, the name is used for the torrent as long as it\n-doesn't have metadata. See torrent_handle::name.\n-The add_torrent_params is also used when requesting resume data for a torrent.\n-It can be saved to and restored from a file and added back to a new session.\n-For serialization and de-serialization of add_torrent_params objects, see\n-read_resume_data() and write_resume_data().\n-The add_torrent_params is also used to represent a parsed .torrent file. It can\n-be loaded via load_torrent_file(), load_torrent_buffer() and\n-load_torrent_parsed(). It can be saved via write_torrent_file().\n-struct add_torrent_params\n-{\n- int version = LIBTORRENT_VERSION_NUM;\n- std::shared_ptr ti;\n- aux::noexcept_movable> trackers;\n- aux::noexcept_movable> tracker_tiers;\n- aux::noexcept_movable>> dht_nodes;\n- std::string name;\n- std::string save_path;\n- storage_mode_t storage_mode = storage_mode_sparse;\n- client_data_t userdata;\n- aux::noexcept_movable> file_priorities;\n- std::string trackerid;\n- torrent_flags_t flags = torrent_flags::default_flags;\n- info_hash_t info_hashes;\n- int max_uploads = -1;\n- int max_connections = -1;\n- int upload_limit = -1;\n- int download_limit = -1;\n- std::int64_t total_uploaded = 0;\n- std::int64_t total_downloaded = 0;\n- int active_time = 0;\n- int finished_time = 0;\n- int seeding_time = 0;\n- std::time_t added_time = 0;\n- std::time_t completed_time = 0;\n- std::time_t last_seen_complete = 0;\n- int num_complete = -1;\n- int num_incomplete = -1;\n- int num_downloaded = -1;\n- aux::noexcept_movable> http_seeds;\n- aux::noexcept_movable> url_seeds;\n- aux::noexcept_movable> peers;\n- aux::noexcept_movable> banned_peers;\n- aux::noexcept_movable> unfinished_pieces;\n- typed_bitfield have_pieces;\n- typed_bitfield verified_pieces;\n- aux::noexcept_movable> piece_priorities;\n- aux::vector, file_index_t> merkle_trees;\n- aux::vector, file_index_t> merkle_tree_mask;\n- aux::vector, file_index_t> verified_leaf_hashes;\n- aux::noexcept_movable> renamed_files;\n- std::time_t last_download = 0;\n- std::time_t last_upload = 0;\n-};\n-[report_issue]\n- version\n- filled in by the constructor and should be left untouched. It is used for\n- forward binary compatibility.\n-[report_issue]\n- ti\n- torrent_info object with the torrent to add. Unless the info_hash is set,\n- this is required to be initialized.\n-[report_issue]\n- trackers\n- If the torrent doesn't have a tracker, but relies on the DHT to find\n- peers, the trackers can specify tracker URLs for the torrent.\n-[report_issue]\n- tracker_tiers\n- the tiers the URLs in trackers belong to. Trackers belonging to different\n- tiers may be treated differently, as defined by the multi tracker\n- extension. This is optional, if not specified trackers are assumed to be\n- part of tier 0, or whichever the last tier was as iterating over the\n- trackers.\n-[report_issue]\n- dht_nodes\n- a list of hostname and port pairs, representing DHT nodes to be added to\n- the session (if DHT is enabled). The hostname may be an IP address.\n-[report_issue]\n- name\n- in case there's no other name in this torrent, this name will be used.\n- The name out of the torrent_info object takes precedence if available.\n-[report_issue]\n- save_path\n- the path where the torrent is or will be stored.\n- Note\n- On windows this path (and other paths) are interpreted as UNC paths. This\n- means they must use backslashes as directory separators and may not\n- contain the special directories \".\" or \"..\".\n- Setting this to an absolute path performs slightly better than a relative\n- path.\n-[report_issue]\n- storage_mode\n- One of the values from storage_mode_t. For more information, see storage\n- allocation.\n-[report_issue]\n- userdata\n- The userdata parameter is optional and will be passed on to the extension\n- constructor functions, if any (see torrent_handle::add_extension()). It\n- will also be stored in the torrent object and can be retrieved by calling\n- userdata().\n-[report_issue]\n- file_priorities\n- can be set to control the initial file priorities when adding a torrent.\n- The semantics are the same as for torrent_handle::prioritize_files(). The\n- file priorities specified in here take precedence over those specified in\n- the resume data, if any. If this vector of file priorities is shorter\n- than the number of files in the torrent, the remaining files (not covered\n- by this) will still have the default download priority. This default can\n- be changed by setting the default_dont_download torrent_flag.\n-[report_issue]\n- trackerid\n- the default tracker id to be used when announcing to trackers. By default\n- this is empty, and no tracker ID is used, since this is an optional\n- argument. If a tracker returns a tracker ID, that ID is used instead of\n- this.\n-[report_issue]\n- flags\n- flags controlling aspects of this torrent and how it's added. See\n- torrent_flags_t for details.\n- Note\n- The flags field is initialized with default flags by the constructor. In\n- order to preserve default behavior when clearing or setting other flags,\n- make sure to bitwise OR or in a flag or bitwise AND the inverse of a flag\n- to clear it.\n-[report_issue]\n- info_hashes\n- set this to the info hash of the torrent to add in case the info-hash is\n- the only known property of the torrent. i.e. you don't have a .torrent\n- file nor a magnet link. To add a magnet link, use parse_magnet_uri() to\n- populate fields in the add_torrent_params object.\n- [report_issue]\n- max_uploads max_connections\n- max_uploads, max_connections, upload_limit, download_limit correspond to\n- the set_max_uploads(), set_max_connections(), set_upload_limit() and\n- set_download_limit() functions on torrent_handle. These values let you\n- initialize these settings when the torrent is added, instead of calling\n- these functions immediately following adding it.\n- -1 means unlimited on these settings just like their counterpart\n- functions on torrent_handle\n- For fine grained control over rate limits, including making them apply to\n- local peers, see peer_classes.\n- [report_issue]\n- upload_limit download_limit\n- the upload and download rate limits for this torrent, specified in bytes\n- per second. -1 means unlimited.\n- [report_issue]\n- total_uploaded total_downloaded\n- the total number of bytes uploaded and downloaded by this torrent so far.\n- [report_issue]\n- active_time finished_time seeding_time\n- the number of seconds this torrent has spent in started, finished and\n- seeding state so far, respectively.\n- [report_issue]\n- added_time completed_time\n- if set to a non-zero value, this is the posix time of when this torrent\n- was first added, including previous runs/sessions. If set to zero, the\n- internal added_time will be set to the time of when add_torrent() is\n- called.\n-[report_issue]\n- last_seen_complete\n- if set to non-zero, initializes the time (expressed in posix time) when\n- we last saw a seed or peers that together formed a complete copy of the\n- torrent. If left set to zero, the internal counterpart to this field will\n- be updated when we see a seed or a distributed copies >= 1.0.\n- [report_issue]\n- num_complete num_incomplete num_downloaded\n- these field can be used to initialize the torrent's cached scrape data.\n- The scrape data is high level metadata about the current state of the\n- swarm, as returned by the tracker (either when announcing to it or by\n- sending a specific scrape request). num_complete is the number of peers\n- in the swarm that are seeds, or have every piece in the torrent.\n- num_incomplete is the number of peers in the swarm that do not have every\n- piece. num_downloaded is the number of times the torrent has been\n- downloaded (not initiated, but the number of times a download has\n- completed).\n- Leaving any of these values set to -1 indicates we don't know, or we have\n- not received any scrape data.\n- [report_issue]\n- http_seeds url_seeds\n- URLs can be added to these two lists to specify additional web seeds to\n- be used by the torrent. If the flag_override_web_seeds is set, these will\n- be the _only_ ones to be used. i.e. any web seeds found in the .torrent\n- file will be overridden.\n- http_seeds expects URLs to web servers implementing the original HTTP\n- seed specification BEP_17.\n- url_seeds expects URLs to regular web servers, aka \"get right\" style,\n- specified in BEP_19.\n-[report_issue]\n- peers\n- peers to add to the torrent, to be tried to be connected to as bittorrent\n- peers.\n-[report_issue]\n- banned_peers\n- peers banned from this torrent. The will not be connected to\n-[report_issue]\n- unfinished_pieces\n- this is a map of partially downloaded piece. The key is the piece index\n- and the value is a bitfield where each bit represents a 16 kiB block. A\n- set bit means we have that block.\n-[report_issue]\n- have_pieces\n- this is a bitfield indicating which pieces we already have of this\n- torrent.\n-[report_issue]\n- verified_pieces\n- when in seed_mode, pieces with a set bit in this bitfield have been\n- verified to be valid. Other pieces will be verified the first time a peer\n- requests it.\n-[report_issue]\n- piece_priorities\n- this sets the priorities for each individual piece in the torrent. Each\n- element in the vector represent the piece with the same index. If you set\n- both file- and piece priorities, file priorities will take precedence.\n-[report_issue]\n- merkle_trees\n- v2 hashes, if known\n-[report_issue]\n- merkle_tree_mask\n- if set, indicates which hashes are included in the corresponding vector\n- of merkle_trees. These bitmasks always cover the full tree, a cleared bit\n- means the hash is all zeros (i.e. not set) and set bit means the next\n- hash in the corresponding vector in merkle_trees is the hash for that\n- node. This is an optimization to avoid storing a lot of zeros.\n-[report_issue]\n- verified_leaf_hashes\n- bit-fields indicating which v2 leaf hashes have been verified against the\n- root hash. If this vector is empty and merkle_trees is non-empty it\n- implies that all hashes in merkle_trees are verified.\n-[report_issue]\n- renamed_files\n- this is a map of file indices in the torrent and new filenames to be\n- applied before the torrent is added.\n- [report_issue]\n- last_download last_upload\n- the posix time of the last time payload was received or sent for this\n- torrent, respectively.\n-[report_issue]\n-****** hasher ******\n-Declared in \"libtorrent/hasher.hpp\"\n-this is a SHA-1 hash class.\n-You use it by first instantiating it, then call update() to feed it with data.\n-i.e. you don't have to keep the entire buffer of which you want to create the\n-hash in memory. You can feed the hasher parts of it at a time. When You have\n-fed the hasher with all the data, you call final() and it will return the sha1-\n-hash of the data.\n-The constructor that takes a char const* and an integer will construct the sha1\n-context and feed it the data passed in.\n-If you want to reuse the hasher object once you have created a hash, you have\n-to call reset() to reinitialize it.\n-The built-in software version of sha1-algorithm was implemented by Steve Reid\n-and released as public domain. For more info, see src/sha1.cpp.\n-class hasher\n-{\n- hasher ();\n- hasher& operator= (hasher const&) &;\n- hasher (hasher const&);\n- explicit hasher (span data);\n- hasher (char const* data, int len);\n- hasher& update (span data);\n- hasher& update (char const* data, int len);\n- sha1_hash final ();\n- void reset ();\n-};\n- [report_issue]\n-***** hasher() operator=() *****\n-hasher& operator= (hasher const&) &;\n-hasher (hasher const&);\n-explicit hasher (span data);\n-hasher (char const* data, int len);\n-this is the same as default constructing followed by a call to update(data,\n-len).\n-[report_issue]\n-***** update() *****\n-hasher& update (span data);\n-hasher& update (char const* data, int len);\n-append the following bytes to what is being hashed\n-[report_issue]\n-***** final() *****\n-sha1_hash final ();\n-returns the SHA-1 digest of the buffers previously passed to update() and the\n-hasher constructor.\n-[report_issue]\n-***** reset() *****\n-void reset ();\n-restore the hasher state to be as if the hasher has just been default\n-constructed.\n-[report_issue]\n-****** hasher256 ******\n-Declared in \"libtorrent/hasher.hpp\"\n-class hasher256\n-{\n- hasher256 ();\n- hasher256 (hasher256 const&);\n- hasher256& operator= (hasher256 const&) &;\n- explicit hasher256 (span data);\n- hasher256 (char const* data, int len);\n- hasher256& update (span data);\n- hasher256& update (char const* data, int len);\n- sha256_hash final ();\n- void reset ();\n- ~hasher256 ();\n-};\n- [report_issue]\n-***** hasher256() operator=() *****\n-hasher256 (hasher256 const&);\n-hasher256& operator= (hasher256 const&) &;\n-explicit hasher256 (span data);\n-hasher256 (char const* data, int len);\n-this is the same as default constructing followed by a call to update(data,\n-len).\n-[report_issue]\n-***** update() *****\n-hasher256& update (span data);\n-hasher256& update (char const* data, int len);\n-append the following bytes to what is being hashed\n-[report_issue]\n-***** final() *****\n-sha256_hash final ();\n-returns the SHA-1 digest of the buffers previously passed to update() and the\n-hasher constructor.\n-[report_issue]\n-***** reset() *****\n-void reset ();\n-restore the hasher state to be as if the hasher has just been default\n-constructed.\n-[report_issue]\n-****** bitfield ******\n-Declared in \"libtorrent/bitfield.hpp\"\n-The bitfield type stores any number of bits as a bitfield in a heap allocated\n-array.\n-struct bitfield\n-{\n- bitfield (int bits, bool val);\n- bitfield (bitfield const& rhs);\n- bitfield (bitfield&& rhs) noexcept = default;\n- bitfield (char const* b, int bits);\n- bitfield () noexcept = default;\n- explicit bitfield (int bits);\n- void assign (char const* b, int const bits);\n- bool operator[] (int index) const noexcept;\n- bool get_bit (int index) const noexcept;\n- void clear_bit (int index) noexcept;\n- void set_bit (int index) noexcept;\n- bool all_set () const noexcept;\n- bool none_set () const noexcept;\n- int size () const noexcept;\n- int num_words () const noexcept;\n- bool empty () const noexcept;\n- char* data () noexcept;\n- char const* data () const noexcept;\n- void swap (bitfield& rhs) noexcept;\n- int count () const noexcept;\n- int find_first_set () const noexcept;\n- int find_last_clear () const noexcept;\n-};\n-[report_issue]\n-***** bitfield() *****\n-bitfield (int bits, bool val);\n-bitfield (bitfield const& rhs);\n-bitfield (bitfield&& rhs) noexcept = default;\n-bitfield (char const* b, int bits);\n-bitfield () noexcept = default;\n-explicit bitfield (int bits);\n-constructs a new bitfield. The default constructor creates an empty bitfield.\n-bits is the size of the bitfield (specified in bits). val is the value to\n-initialize the bits to. If not specified all bits are initialized to 0.\n-The constructor taking a pointer b and bits copies a bitfield from the\n-specified buffer, and bits number of bits (rounded up to the nearest byte\n-boundary).\n-[report_issue]\n-***** assign() *****\n-void assign (char const* b, int const bits);\n-copy bitfield from buffer b of bits number of bits, rounded up to the nearest\n-byte boundary.\n- [report_issue]\n-***** operator[]() get_bit() *****\n-bool operator[] (int index) const noexcept;\n-bool get_bit (int index) const noexcept;\n-query bit at index. Returns true if bit is 1, otherwise false.\n- [report_issue]\n-***** clear_bit() set_bit() *****\n-void clear_bit (int index) noexcept;\n-void set_bit (int index) noexcept;\n-set bit at index to 0 (clear_bit) or 1 (set_bit).\n-[report_issue]\n-***** all_set() *****\n-bool all_set () const noexcept;\n-returns true if all bits in the bitfield are set\n-[report_issue]\n-***** none_set() *****\n-bool none_set () const noexcept;\n-returns true if no bit in the bitfield is set\n-[report_issue]\n-***** size() *****\n-int size () const noexcept;\n-returns the size of the bitfield in bits.\n-[report_issue]\n-***** num_words() *****\n-int num_words () const noexcept;\n-returns the number of 32 bit words are needed to represent all bits in this\n-bitfield.\n-[report_issue]\n-***** empty() *****\n-bool empty () const noexcept;\n-returns true if the bitfield has zero size.\n-[report_issue]\n-***** data() *****\n-char* data () noexcept;\n-char const* data () const noexcept;\n-returns a pointer to the internal buffer of the bitfield, or nullptr if it's\n-empty.\n-[report_issue]\n-***** swap() *****\n-void swap (bitfield& rhs) noexcept;\n-swaps the bit-fields two variables refer to\n-[report_issue]\n-***** count() *****\n-int count () const noexcept;\n-count the number of bits in the bitfield that are set to 1.\n-[report_issue]\n-***** find_first_set() *****\n-int find_first_set () const noexcept;\n-returns the index of the first set bit in the bitfield, i.e. 1 bit.\n-[report_issue]\n-***** find_last_clear() *****\n-int find_last_clear () const noexcept;\n-returns the index to the last cleared bit in the bitfield, i.e. 0 bit.\n-[report_issue]\n ****** torrent_status ******\n Declared in \"libtorrent/torrent_status.hpp\"\n holds a snapshot of the status of a torrent, as queried by torrent_handle::\n status().\n struct torrent_status\n {\n bool operator== (torrent_status const& st) const;\n@@ -10595,126 +9096,2086 @@\n is always a subset of active time). seeding means all files/pieces were\n downloaded and available to peers. Being available to peers does not\n imply there are other peers asking for the payload.\n [report_issue]\n flags\n reflects several of the torrent's flags. For more information, see\n torrent_handle::flags().\n+Bencoding is a common representation in bittorrent used for dictionary, list,\n+int and string hierarchies. It's used to encode .torrent files and some\n+messages in the network protocol. libtorrent also uses it to store settings,\n+resume data and other session state.\n+Strings in bencoded structures do not necessarily represent text. Strings are\n+raw byte buffers of a certain length. If a string is meant to be interpreted as\n+text, it is required to be UTF-8 encoded. See BEP_3.\n+The function for decoding bencoded data bdecode(), returning a bdecode_node.\n+This function builds a tree that points back into the original buffer. The\n+returned bdecode_node will not be valid once the buffer it was parsed out of is\n+discarded.\n+It's possible to construct an entry from a bdecode_node, if a structure needs\n+to be altered and re-encoded.\n [report_issue]\n-****** peer_class_type_filter ******\n-Declared in \"libtorrent/peer_class_type_filter.hpp\"\n-peer_class_type_filter is a simple container for rules for adding and\n-subtracting peer-classes from peers. It is applied after the peer class filter\n-is applied (which is based on the peer's IP address).\n-struct peer_class_type_filter\n+****** entry ******\n+Declared in \"libtorrent/entry.hpp\"\n+The entry class represents one node in a bencoded hierarchy. It works as a\n+variant type, it can be either a list, a dictionary (std::map), an integer or a\n+string.\n+class entry\n {\n- void add (socket_type_t const st, peer_class_t const peer_class);\n- void remove (socket_type_t const st, peer_class_t const peer_class);\n- void allow (socket_type_t const st, peer_class_t const peer_class);\n- void disallow (socket_type_t const st, peer_class_t const peer_class);\n- std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n- friend bool operator== (peer_class_type_filter const& lhs\n- , peer_class_type_filter const& rhs);\n+ data_type type () const;\n+ entry (span);\n+ entry (preformatted_type);\n+ entry (list_type);\n+ entry (dictionary_type);\n+ entry (integer_type);\n+ entry (U v);\n+ entry (data_type t);\n+ entry (bdecode_node const& n);\n+ entry& operator= (span) &;\n+ entry& operator= (entry&&) & noexcept;\n+ entry& operator= (preformatted_type) &;\n+ entry& operator= (entry const&) &;\n+ entry& operator= (list_type) &;\n+ entry& operator= (integer_type) &;\n+ entry& operator= (dictionary_type) &;\n+ entry& operator= (bdecode_node const&) &;\n+ entry& operator= (U v) &;\n+ preformatted_type& preformatted ();\n+ dictionary_type& dict ();\n+ string_type const& string () const;\n+ list_type& list ();\n+ integer_type const& integer () const;\n+ list_type const& list () const;\n+ string_type& string ();\n+ preformatted_type const& preformatted () const;\n+ integer_type& integer ();\n+ dictionary_type const& dict () const;\n+ void swap (entry& e);\n+ entry const& operator[] (string_view key) const;\n+ entry& operator[] (string_view key);\n+ entry* find_key (string_view key);\n+ entry const* find_key (string_view key) const;\n+ std::string to_string (bool single_line = false) const;\n \n- enum socket_type_t\n+ enum data_type\n {\n- tcp_socket,\n- utp_socket,\n- ssl_tcp_socket,\n- ssl_utp_socket,\n- i2p_socket,\n- num_socket_types,\n+ int_t,\n+ string_t,\n+ list_t,\n+ dictionary_t,\n+ undefined_t,\n+ preformatted_t,\n };\n };\n+[report_issue]\n+***** type() *****\n+data_type type () const;\n+returns the concrete type of the entry\n+[report_issue]\n+***** entry() *****\n+entry (span);\n+entry (preformatted_type);\n+entry (list_type);\n+entry (dictionary_type);\n+entry (integer_type);\n+constructors directly from a specific type. The content of the argument is\n+copied into the newly constructed entry\n+[report_issue]\n+***** entry() *****\n+entry (data_type t);\n+construct an empty entry of the specified type. see data_type enum.\n+[report_issue]\n+***** entry() *****\n+entry (bdecode_node const& n);\n+construct from bdecode_node parsed form (see bdecode())\n+[report_issue]\n+***** operator=() *****\n+entry& operator= (span) &;\n+entry& operator= (entry&&) & noexcept;\n+entry& operator= (preformatted_type) &;\n+entry& operator= (entry const&) &;\n+entry& operator= (list_type) &;\n+entry& operator= (integer_type) &;\n+entry& operator= (dictionary_type) &;\n+entry& operator= (bdecode_node const&) &;\n+copies the structure of the right hand side into this entry.\n+ [report_issue]\n+***** preformatted() integer() list() dict() string() *****\n+preformatted_type& preformatted ();\n+dictionary_type& dict ();\n+string_type const& string () const;\n+list_type& list ();\n+integer_type const& integer () const;\n+list_type const& list () const;\n+string_type& string ();\n+preformatted_type const& preformatted () const;\n+integer_type& integer ();\n+dictionary_type const& dict () const;\n+The integer(), string(), list() and dict() functions are accessors that return\n+the respective type. If the entry object isn't of the type you request, the\n+accessor will throw system_error. You can ask an entry for its type through the\n+type() function.\n+If you want to create an entry you give it the type you want it to have in its\n+constructor, and then use one of the non-const accessors to get a reference\n+which you then can assign the value you want it to have.\n+The typical code to get info from a torrent file will then look like this:\n+entry torrent_file;\n+// ...\n+\n+// throws if this is not a dictionary\n+entry::dictionary_type const& dict = torrent_file.dict();\n+entry::dictionary_type::const_iterator i;\n+i = dict.find(\"announce\");\n+if (i != dict.end())\n+{\n+ std::string tracker_url = i->second.string();\n+ std::cout << tracker_url << \"\\n\";\n+}\n+The following code is equivalent, but a little bit shorter:\n+entry torrent_file;\n+// ...\n+\n+// throws if this is not a dictionary\n+if (entry* i = torrent_file.find_key(\"announce\"))\n+{\n+ std::string tracker_url = i->string();\n+ std::cout << tracker_url << \"\\n\";\n+}\n+To make it easier to extract information from a torrent file, the class\n+torrent_info exists.\n+[report_issue]\n+***** swap() *****\n+void swap (entry& e);\n+swaps the content of this with e.\n+[report_issue]\n+***** operator[]() *****\n+entry const& operator[] (string_view key) const;\n+entry& operator[] (string_view key);\n+All of these functions requires the entry to be a dictionary, if it isn't they\n+will throw system_error.\n+The non-const versions of the operator[] will return a reference to either the\n+existing element at the given key or, if there is no element with the given\n+key, a reference to a newly inserted element at that key.\n+The const version of operator[] will only return a reference to an existing\n+element at the given key. If the key is not found, it will throw system_error.\n+[report_issue]\n+***** find_key() *****\n+entry* find_key (string_view key);\n+entry const* find_key (string_view key) const;\n+These functions requires the entry to be a dictionary, if it isn't they will\n+throw system_error.\n+They will look for an element at the given key in the dictionary, if the\n+element cannot be found, they will return nullptr. If an element with the given\n+key is found, the return a pointer to it.\n+[report_issue]\n+***** to_string() *****\n+std::string to_string (bool single_line = false) const;\n+returns a pretty-printed string representation of the bencoded structure, with\n+JSON-style syntax\n+[report_issue]\n+***** enum data_type *****\n+Declared in \"libtorrent/entry.hpp\"\n+ ________________________________\n+|name__________|value|description|\n+|int_t_________|0____|\u00a0_________|\n+|string_t______|1____|\u00a0_________|\n+|list_t________|2____|\u00a0_________|\n+|dictionary_t__|3____|\u00a0_________|\n+|undefined_t___|4____|\u00a0_________|\n+|preformatted_t|5____|\u00a0_________|\n+[report_issue]\n+****** operator<<() ******\n+Declared in \"libtorrent/entry.hpp\"\n+inline std::ostream& operator<< (std::ostream& os, const entry& e);\n+prints the bencoded structure to the ostream as a JSON-style structure.\n+[report_issue]\n+****** bencode() ******\n+Declared in \"libtorrent/bencode.hpp\"\n+template int bencode (OutIt out, const entry& e);\n+This function will encode data to bencoded form.\n+The entry class is the internal representation of the bencoded data and it can\n+be used to retrieve information, an entry can also be build by the program and\n+given to bencode() to encode it into the OutIt iterator.\n+OutIt is an OutputIterator. It's a template and usually instantiated as\n+ostream_iterator or back_insert_iterator. This function assumes the value_type\n+of the iterator is a char. In order to encode entry e into a buffer, do:\n+std::vector buffer;\n+bencode(std::back_inserter(buf), e);\n+libtorrent has a plugin interface for implementing extensions to the protocol.\n+These can be general extensions for transferring metadata or peer exchange\n+extensions, or it could be used to provide a way to customize the protocol to\n+fit a particular (closed) network.\n+In short, the plugin interface makes it possible to:\n+ * register extension messages (sent in the extension handshake), see\n+ extensions.\n+ * add data and parse data from the extension handshake.\n+ * send extension messages and standard bittorrent messages.\n+ * override or block the handling of standard bittorrent messages.\n+ * save and restore state via the session state\n+ * see all alerts that are posted\n+****** a word of caution ******\n+Writing your own plugin is a very easy way to introduce serious bugs such as\n+dead locks and race conditions. Since a plugin has access to internal\n+structures it is also quite easy to sabotage libtorrent's operation.\n+All the callbacks are always called from the libtorrent network thread. In case\n+portions of your plugin are called from other threads, typically the main\n+thread, you cannot use any of the member functions on the internal structures\n+in libtorrent, since those require being called from the libtorrent network\n+thread . Furthermore, you also need to synchronize your own shared data within\n+the plugin, to make sure it is not accessed at the same time from the\n+libtorrent thread (through a callback). If you need to send out a message from\n+another thread, it is advised to use an internal queue, and do the actual\n+sending in tick().\n+Since the plugin interface gives you easy access to internal structures, it is\n+not supported as a stable API. Plugins should be considered specific to a\n+specific version of libtorrent. Although, in practice the internals mostly\n+don't change that dramatically.\n+****** plugin-interface ******\n+The plugin interface consists of three base classes that the plugin may\n+implement. These are called plugin, torrent_plugin and peer_plugin. They are\n+found in the header.\n+These plugins are instantiated for each session, torrent and possibly each\n+peer, respectively.\n+For plugins that only need per torrent state, it is enough to only implement\n+torrent_plugin and pass a constructor function or function object to session::\n+add_extension() or torrent_handle::add_extension() (if the torrent has already\n+been started and you want to hook in the extension at run-time).\n+The signature of the function is:\n+std::shared_ptr (*)(torrent_handle const&, client_data_t);\n+The second argument is the userdata passed to session::add_torrent() or\n+torrent_handle::add_extension().\n+The function should return a std::shared_ptr which may or may\n+not be 0. If it is a nullptr, the extension is simply ignored for this torrent.\n+If it is a valid pointer (to a class inheriting torrent_plugin), it will be\n+associated with this torrent and callbacks will be made on torrent events.\n+For more elaborate plugins which require session wide state, you would\n+implement plugin, construct an object (in a std::shared_ptr) and pass it in to\n+session::add_extension().\n+****** custom alerts ******\n+Since plugins are running within internal libtorrent threads, one convenient\n+way to communicate with the client is to post custom alerts.\n+The expected interface of any alert, apart from deriving from the alert base\n+class, looks like this:\n+static const int alert_type = ;\n+virtual int type() const { return alert_type; }\n+\n+virtual std::string message() const;\n+\n+static const alert_category_t static_category = ;\n+virtual alert_category_t category() const { return static_category; }\n+\n+virtual char const* what() const { return ; }\n+The alert_type is used for the type-checking in alert_cast. It must not collide\n+with any other alert. The built-in alerts in libtorrent will not use alert type\n+IDs greater than user_alert_id. When defining your own alert, make sure it's\n+greater than this constant.\n+type() is the run-time equivalence of the alert_type.\n+The message() virtual function is expected to construct a useful string\n+representation of the alert and the event or data it represents. Something\n+convenient to put in a log file for instance.\n+clone() is used internally to copy alerts. The suggested implementation of\n+simply allocating a new instance as a copy of *this is all that's expected.\n+The static category is required for checking whether or not the category for a\n+specific alert is enabled or not, without instantiating the alert. The category\n+virtual function is the run-time equivalence.\n+The what() virtual function may simply be a string literal of the class name of\n+your alert.\n+For more information, see the alert_section.\n+[report_issue]\n+****** plugin ******\n+Declared in \"libtorrent/extensions.hpp\"\n+this is the base class for a session plugin. One primary feature is that it is\n+notified of all torrents that are added to the session, and can add its own\n+torrent_plugins.\n+struct plugin\n+{\n+ virtual feature_flags_t implemented_features ();\n+ virtual std::shared_ptr new_torrent (torrent_handle const&,\n+client_data_t);\n+ virtual void added (session_handle const&);\n+ virtual void abort ();\n+ virtual bool on_dht_request (string_view /* query */\n+ , udp::endpoint const& /* source */, bdecode_node const& /* message */\n+ , entry& /* response */);\n+ virtual void on_alert (alert const*);\n+ virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n+ , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n+ virtual void on_tick ();\n+ virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer\n+*/);\n+ virtual std::map save_state () const;\n+ virtual void load_state (std::map const&);\n+\n+ static constexpr feature_flags_t optimistic_unchoke_feature = 1_bit;\n+ static constexpr feature_flags_t tick_feature = 2_bit;\n+ static constexpr feature_flags_t dht_request_feature = 3_bit;\n+ static constexpr feature_flags_t alert_feature = 4_bit;\n+};\n+[report_issue]\n+***** implemented_features() *****\n+virtual feature_flags_t implemented_features ();\n+This function is expected to return a bitmask indicating which features this\n+plugin implements. Some callbacks on this object may not be called unless the\n+corresponding feature flag is returned here. Note that callbacks may still be\n+called even if the corresponding feature is not specified in the return value\n+here. See feature_flags_t for possible flags to return.\n+[report_issue]\n+***** new_torrent() *****\n+virtual std::shared_ptr new_torrent (torrent_handle const&,\n+client_data_t);\n+this is called by the session every time a new torrent is added. The torrent*\n+points to the internal torrent object created for the new torrent. The\n+client_data_t is the userdata pointer as passed in via add_torrent_params.\n+If the plugin returns a torrent_plugin instance, it will be added to the new\n+torrent. Otherwise, return an empty shared_ptr to a torrent_plugin (the\n+default).\n+[report_issue]\n+***** added() *****\n+virtual void added (session_handle const&);\n+called when plugin is added to a session\n+[report_issue]\n+***** abort() *****\n+virtual void abort ();\n+called when the session is aborted the plugin should perform any cleanup\n+necessary to allow the session's destruction (e.g. cancel outstanding async\n+operations)\n+[report_issue]\n+***** on_dht_request() *****\n+virtual bool on_dht_request (string_view /* query */\n+ , udp::endpoint const& /* source */, bdecode_node const& /* message */\n+ , entry& /* response */);\n+called when a dht request is received. If your plugin expects this to be\n+called, make sure to include the flag dht_request_feature in the return value\n+from implemented_features().\n+[report_issue]\n+***** on_alert() *****\n+virtual void on_alert (alert const*);\n+called when an alert is posted alerts that are filtered are not posted. If your\n+plugin expects this to be called, make sure to include the flag alert_feature\n+in the return value from implemented_features().\n+[report_issue]\n+***** on_unknown_torrent() *****\n+virtual bool on_unknown_torrent (info_hash_t const& /* info_hash */\n+ , peer_connection_handle const& /* pc */, add_torrent_params& /* p */);\n+return true if the add_torrent_params should be added\n+[report_issue]\n+***** on_tick() *****\n+virtual void on_tick ();\n+called once per second. If your plugin expects this to be called, make sure to\n+include the flag tick_feature in the return value from implemented_features().\n+[report_issue]\n+***** get_unchoke_priority() *****\n+virtual uint64_t get_unchoke_priority (peer_connection_handle const& /* peer */\n+);\n+called when choosing peers to optimistically unchoke. The return value\n+indicates the peer's priority for unchoking. Lower return values correspond to\n+higher priority. Priorities above 2^63-1 are reserved. If your plugin has no\n+priority to assign a peer it should return 2^64-1. If your plugin expects this\n+to be called, make sure to include the flag optimistic_unchoke_feature in the\n+return value from implemented_features(). If multiple plugins implement this\n+function the lowest return value (i.e. the highest priority) is used.\n+[report_issue]\n+***** load_state() *****\n+virtual void load_state (std::map const&);\n+called on startup while loading settings state from the session_params\n+[report_issue]\n+ optimistic_unchoke_feature\n+ include this bit if your plugin needs to alter the order of the\n+ optimistic unchoke of peers. i.e. have the on_optimistic_unchoke()\n+ callback be called.\n+[report_issue]\n+ tick_feature\n+ include this bit if your plugin needs to have on_tick() called\n+[report_issue]\n+ dht_request_feature\n+ include this bit if your plugin needs to have on_dht_request() called\n+[report_issue]\n+ alert_feature\n+ include this bit if your plugin needs to have on_alert() called\n+[report_issue]\n+****** torrent_plugin ******\n+Declared in \"libtorrent/extensions.hpp\"\n+Torrent plugins are associated with a single torrent and have a number of\n+functions called at certain events. Many of its functions have the ability to\n+change or override the default libtorrent behavior.\n+struct torrent_plugin\n+{\n+ virtual std::shared_ptr new_connection (peer_connection_handle\n+const&);\n+ virtual void on_piece_failed (piece_index_t);\n+ virtual void on_piece_pass (piece_index_t);\n+ virtual void tick ();\n+ virtual bool on_pause ();\n+ virtual bool on_resume ();\n+ virtual void on_files_checked ();\n+ virtual void on_state (torrent_status::state_t);\n+ virtual void on_add_peer (tcp::endpoint const&,\n+ peer_source_flags_t, add_peer_flags_t);\n+\n+ static constexpr add_peer_flags_t first_time = 1_bit;\n+ static constexpr add_peer_flags_t filtered = 2_bit;\n+};\n+[report_issue]\n+***** new_connection() *****\n+virtual std::shared_ptr new_connection (peer_connection_handle\n+const&);\n+This function is called each time a new peer is connected to the torrent. You\n+may choose to ignore this by just returning a default constructed shared_ptr\n+(in which case you don't need to override this member function).\n+If you need an extension to the peer connection (which most plugins do) you are\n+supposed to return an instance of your peer_plugin class. Which in turn will\n+have its hook functions called on event specific to that peer.\n+The peer_connection_handle will be valid as long as the shared_ptr is being\n+held by the torrent object. So, it is generally a good idea to not keep a\n+shared_ptr to your own peer_plugin. If you want to keep references to it, use\n+weak_ptr.\n+If this function throws an exception, the connection will be closed.\n [report_issue]\n-***** add() remove() *****\n-void add (socket_type_t const st, peer_class_t const peer_class);\n-void remove (socket_type_t const st, peer_class_t const peer_class);\n-add() and remove() adds and removes a peer class to be added to new peers based\n-on socket type.\n+***** on_piece_failed() on_piece_pass() *****\n+virtual void on_piece_failed (piece_index_t);\n+virtual void on_piece_pass (piece_index_t);\n+These hooks are called when a piece passes the hash check or fails the hash\n+check, respectively. The index is the piece index that was downloaded. It is\n+possible to access the list of peers that participated in sending the piece\n+through the torrent and the piece_picker.\n+[report_issue]\n+***** tick() *****\n+virtual void tick ();\n+This hook is called approximately once per second. It is a way of making it\n+easy for plugins to do timed events, for sending messages or whatever.\n [report_issue]\n-***** disallow() allow() *****\n-void allow (socket_type_t const st, peer_class_t const peer_class);\n-void disallow (socket_type_t const st, peer_class_t const peer_class);\n-disallow() and allow() adds and removes a peer class to be removed from new\n-peers based on socket type.\n-The peer_class argument cannot be greater than 31. The bitmasks representing\n-peer classes in the peer_class_type_filter are 32 bits.\n+***** on_pause() on_resume() *****\n+virtual bool on_pause ();\n+virtual bool on_resume ();\n+These hooks are called when the torrent is paused and resumed respectively. The\n+return value indicates if the event was handled. A return value of true\n+indicates that it was handled, and no other plugin after this one will have\n+this hook function called, and the standard handler will also not be invoked.\n+So, returning true effectively overrides the standard behavior of pause or\n+resume.\n+Note that if you call pause() or resume() on the torrent from your handler it\n+will recurse back into your handler, so in order to invoke the standard\n+handler, you have to keep your own state on whether you want standard behavior\n+or overridden behavior.\n [report_issue]\n-***** apply() *****\n-std::uint32_t apply (socket_type_t const st, std::uint32_t peer_class_mask);\n-takes a bitmask of peer classes and returns a new bitmask of peer classes after\n-the rules have been applied, based on the socket type argument (st).\n+***** on_files_checked() *****\n+virtual void on_files_checked ();\n+This function is called when the initial files of the torrent have been\n+checked. If there are no files to check, this function is called immediately.\n+i.e. This function is always called when the torrent is in a state where it can\n+start downloading.\n [report_issue]\n-***** enum socket_type_t *****\n-Declared in \"libtorrent/peer_class_type_filter.hpp\"\n- ________________________________________________________________________\n-|name____________|value|description______________________________________|\n-|tcp_socket |0 |these match the socket types from socket_type.hpp|\n-|________________|_____|shifted_one_down_________________________________|\n-|utp_socket______|1____|\u00a0_______________________________________________|\n-|ssl_tcp_socket__|2____|\u00a0_______________________________________________|\n-|ssl_utp_socket__|3____|\u00a0_______________________________________________|\n-|i2p_socket______|4____|\u00a0_______________________________________________|\n-|num_socket_types|5____|\u00a0_______________________________________________|\n+***** on_state() *****\n+virtual void on_state (torrent_status::state_t);\n+called when the torrent changes state the state is one of torrent_status::\n+state_t enum members\n [report_issue]\n-****** peer_class_info ******\n-Declared in \"libtorrent/peer_class.hpp\"\n-holds settings for a peer class. Used in set_peer_class() and get_peer_class()\n-calls.\n-struct peer_class_info\n+***** on_add_peer() *****\n+virtual void on_add_peer (tcp::endpoint const&,\n+ peer_source_flags_t, add_peer_flags_t);\n+called every time a new peer is added to the peer list. This is before the peer\n+is connected to. For flags, see torrent_plugin::flags_t. The source argument\n+refers to the source where we learned about this peer from. It's a bitmask,\n+because many sources may have told us about the same peer. For peer source\n+flags, see peer_info::peer_source_flags.\n+[report_issue]\n+ first_time\n+ this is the first time we see this peer\n+[report_issue]\n+ filtered\n+ this peer was not added because it was filtered by the IP filter\n+[report_issue]\n+****** peer_plugin ******\n+Declared in \"libtorrent/extensions.hpp\"\n+peer plugins are associated with a specific peer. A peer could be both a\n+regular bittorrent peer (bt_peer_connection) or one of the web seed connections\n+(web_peer_connection or http_seed_connection). In order to only attach to\n+certain peers, make your torrent_plugin::new_connection only return a plugin\n+for certain peer connection types\n+struct peer_plugin\n {\n- bool ignore_unchoke_slots;\n- int connection_limit_factor;\n- std::string label;\n- int upload_limit;\n- int download_limit;\n- int upload_priority;\n- int download_priority;\n+ virtual string_view type () const;\n+ virtual void add_handshake (entry&);\n+ virtual void on_disconnect (error_code const&);\n+ virtual void on_connected ();\n+ virtual bool on_handshake (span);\n+ virtual bool on_extension_handshake (bdecode_node const&);\n+ virtual bool on_bitfield (bitfield const& /*bitfield*/);\n+ virtual bool on_request (peer_request const&);\n+ virtual bool on_not_interested ();\n+ virtual bool on_interested ();\n+ virtual bool on_have_all ();\n+ virtual bool on_unchoke ();\n+ virtual bool on_dont_have (piece_index_t);\n+ virtual bool on_have (piece_index_t);\n+ virtual bool on_have_none ();\n+ virtual bool on_choke ();\n+ virtual bool on_allowed_fast (piece_index_t);\n+ virtual bool on_piece (peer_request const& /*piece*/\n+ , span /*buf*/);\n+ virtual bool on_cancel (peer_request const&);\n+ virtual bool on_reject (peer_request const&);\n+ virtual bool on_suggest (piece_index_t);\n+ virtual void sent_have_none ();\n+ virtual void sent_have_all ();\n+ virtual void sent_suggest (piece_index_t);\n+ virtual void sent_reject_request (peer_request const&);\n+ virtual void sent_request (peer_request const&);\n+ virtual void sent_cancel (peer_request const&);\n+ virtual void sent_allow_fast (piece_index_t);\n+ virtual void sent_choke ();\n+ virtual void sent_piece (peer_request const&);\n+ virtual void sent_not_interested ();\n+ virtual void sent_unchoke ();\n+ virtual void sent_interested ();\n+ virtual void sent_have (piece_index_t);\n+ virtual void sent_payload (int /* bytes */);\n+ virtual bool can_disconnect (error_code const& /*ec*/);\n+ virtual bool on_extended (int /*length*/, int /*msg*/,\n+ span /*body*/);\n+ virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n+ span /*body*/);\n+ virtual void on_piece_failed (piece_index_t);\n+ virtual void on_piece_pass (piece_index_t);\n+ virtual void tick ();\n+ virtual bool write_request (peer_request const&);\n };\n [report_issue]\n- ignore_unchoke_slots\n- ignore_unchoke_slots determines whether peers should always unchoke a\n- peer, regardless of the choking algorithm, or if it should honor the\n- unchoke slot limits. It's used for local peers by default. If any of the\n- peer classes a peer belongs to has this set to true, that peer will be\n- unchoked at all times.\n+***** type() *****\n+virtual string_view type () const;\n+This function is expected to return the name of the plugin.\n [report_issue]\n- connection_limit_factor\n- adjusts the connection limit (global and per torrent) that applies to\n- this peer class. By default, local peers are allowed to exceed the normal\n- connection limit for instance. This is specified as a percent factor. 100\n- makes the peer class apply normally to the limit. 200 means as long as\n- there are fewer connections than twice the limit, we accept this peer.\n- This factor applies both to the global connection limit and the per-\n- torrent limit. Note that if not used carefully one peer class can\n- potentially completely starve out all other over time.\n+***** add_handshake() *****\n+virtual void add_handshake (entry&);\n+can add entries to the extension handshake this is not called for web seeds\n [report_issue]\n- label\n- not used by libtorrent. It's intended as a potentially user-facing\n- identifier of this peer class.\n+***** on_disconnect() *****\n+virtual void on_disconnect (error_code const&);\n+called when the peer is being disconnected.\n+[report_issue]\n+***** on_connected() *****\n+virtual void on_connected ();\n+called when the peer is successfully connected. Note that incoming connections\n+will have been connected by the time the peer plugin is attached to it, and\n+won't have this hook called.\n+[report_issue]\n+***** on_handshake() *****\n+virtual bool on_handshake (span);\n+this is called when the initial bittorrent handshake is received. Returning\n+false means that the other end doesn't support this extension and will remove\n+it from the list of plugins. this is not called for web seeds\n+[report_issue]\n+***** on_extension_handshake() *****\n+virtual bool on_extension_handshake (bdecode_node const&);\n+called when the extension handshake from the other end is received if this\n+returns false, it means that this extension isn't supported by this peer. It\n+will result in this peer_plugin being removed from the peer_connection and\n+destructed. this is not called for web seeds\n+ [report_issue]\n+***** on_have() on_have_all() on_interested() on_request() on_bitfield()\n+on_dont_have() on_allowed_fast() on_unchoke() on_have_none() on_not_interested\n+() on_choke() *****\n+virtual bool on_bitfield (bitfield const& /*bitfield*/);\n+virtual bool on_request (peer_request const&);\n+virtual bool on_not_interested ();\n+virtual bool on_interested ();\n+virtual bool on_have_all ();\n+virtual bool on_unchoke ();\n+virtual bool on_dont_have (piece_index_t);\n+virtual bool on_have (piece_index_t);\n+virtual bool on_have_none ();\n+virtual bool on_choke ();\n+virtual bool on_allowed_fast (piece_index_t);\n+returning true from any of the message handlers indicates that the plugin has\n+handled the message. it will break the plugin chain traversing and not let\n+anyone else handle the message, including the default handler.\n+[report_issue]\n+***** on_piece() *****\n+virtual bool on_piece (peer_request const& /*piece*/\n+ , span /*buf*/);\n+This function is called when the peer connection is receiving a piece. buf\n+points (non-owning pointer) to the data in an internal immutable disk buffer.\n+The length of the data is specified in the length member of the piece\n+parameter. returns true to indicate that the piece is handled and the rest of\n+the logic should be ignored.\n+ [report_issue]\n+***** sent_piece() sent_unchoke() sent_interested() sent_not_interested()\n+sent_have() *****\n+virtual void sent_piece (peer_request const&);\n+virtual void sent_not_interested ();\n+virtual void sent_unchoke ();\n+virtual void sent_interested ();\n+virtual void sent_have (piece_index_t);\n+called after a choke message has been sent to the peer\n+[report_issue]\n+***** sent_payload() *****\n+virtual void sent_payload (int /* bytes */);\n+called after piece data has been sent to the peer this can be used for stats\n+book keeping\n+[report_issue]\n+***** can_disconnect() *****\n+virtual bool can_disconnect (error_code const& /*ec*/);\n+called when libtorrent think this peer should be disconnected. if the plugin\n+returns false, the peer will not be disconnected.\n+[report_issue]\n+***** on_extended() *****\n+virtual bool on_extended (int /*length*/, int /*msg*/,\n+ span /*body*/);\n+called when an extended message is received. If returning true, the message is\n+not processed by any other plugin and if false is returned the next plugin in\n+the chain will receive it to be able to handle it. This is not called for web\n+seeds. thus function may be called more than once per incoming message, but\n+only the last of the calls will the body size equal the length. i.e. Every time\n+another fragment of the message is received, this function will be called,\n+until finally the whole message has been received. The purpose of this is to\n+allow early disconnects for invalid messages and for reporting progress of\n+receiving large messages.\n+[report_issue]\n+***** on_unknown_message() *****\n+virtual bool on_unknown_message (int /*length*/, int /*msg*/,\n+ span /*body*/);\n+this is not called for web seeds\n [report_issue]\n- upload_limit download_limit\n- transfer rates limits for the whole peer class. They are specified in\n- bytes per second and apply to the sum of all peers that are members of\n- this class.\n+***** on_piece_failed() on_piece_pass() *****\n+virtual void on_piece_failed (piece_index_t);\n+virtual void on_piece_pass (piece_index_t);\n+called when a piece that this peer participated in either fails or passes the\n+hash_check\n+[report_issue]\n+***** tick() *****\n+virtual void tick ();\n+called approximately once every second\n+[report_issue]\n+***** write_request() *****\n+virtual bool write_request (peer_request const&);\n+called each time a request message is to be sent. If true is returned, the\n+original request message won't be sent and no other plugin will have this\n+function called.\n+[report_issue]\n+****** crypto_plugin ******\n+Declared in \"libtorrent/extensions.hpp\"\n+struct crypto_plugin\n+{\n+ virtual void set_outgoing_key (span key) = 0;\n+ virtual void set_incoming_key (span key) = 0;\n+ encrypt (span> /*send_vec*/) = 0;\n+ virtual std::tuple decrypt (span> /*receive_vec*/\n+) = 0;\n+};\n+[report_issue]\n+***** decrypt() *****\n+virtual std::tuple decrypt (span> /*receive_vec*/) =\n+0;\n+decrypt the provided buffers. returns is a tuple representing the values\n+(consume, produce, packet_size)\n+consume is set to the number of bytes which should be trimmed from the head of\n+the buffers, default is 0\n+produce is set to the number of bytes of payload which are now ready to be sent\n+to the upper layer. default is the number of bytes passed in receive_vec\n+packet_size is set to the minimum number of bytes which must be read to advance\n+the next step of decryption. default is 0\n+[report_issue]\n+****** peer_connection_handle ******\n+Declared in \"libtorrent/peer_connection_handle.hpp\"\n+the peer_connection_handle class provides a handle to the internal peer\n+connection object, to be used by plugins. This is a low level interface that\n+may not be stable across libtorrent versions\n+struct peer_connection_handle\n+{\n+ explicit peer_connection_handle (std::weak_ptr impl);\n+ connection_type type () const;\n+ void add_extension (std::shared_ptr);\n+ peer_plugin const* find_plugin (string_view type) const;\n+ bool is_seed () const;\n+ bool upload_only () const;\n+ peer_id const& pid () const;\n+ bool has_piece (piece_index_t i) const;\n+ bool is_interesting () const;\n+ bool is_choked () const;\n+ bool is_peer_interested () const;\n+ bool has_peer_choked () const;\n+ void maybe_unchoke_this_peer ();\n+ void choke_this_peer ();\n+ void get_peer_info (peer_info& p) const;\n+ torrent_handle associated_torrent () const;\n+ tcp::endpoint local_endpoint () const;\n+ tcp::endpoint const& remote () const;\n+ bool is_outgoing () const;\n+ bool is_disconnecting () const;\n+ bool is_connecting () const;\n+ void disconnect (error_code const& ec, operation_t op\n+ , disconnect_severity_t = peer_connection_interface::normal);\n+ bool on_local_network () const;\n+ bool ignore_unchoke_slots () const;\n+ bool failed () const;\n+ void peer_log (peer_log_alert::direction_t direction\n+ , char const* event, char const* fmt = \"\", ...) const TORRENT_FORMAT\n+(4,5);\n+ bool should_log (peer_log_alert::direction_t direction) const;\n+ bool can_disconnect (error_code const& ec) const;\n+ bool has_metadata () const;\n+ bool in_handshake () const;\n+ void send_buffer (char const* begin, int size);\n+ time_point time_of_last_unchoke () const;\n+ std::time_t last_seen_complete () const;\n+ bool operator< (peer_connection_handle const& o) const;\n+ bool operator== (peer_connection_handle const& o) const;\n+ bool operator!= (peer_connection_handle const& o) const;\n+ std::shared_ptr native_handle () const;\n+};\n+[report_issue]\n+****** bt_peer_connection_handle ******\n+Declared in \"libtorrent/peer_connection_handle.hpp\"\n+The bt_peer_connection_handle provides a handle to the internal bittorrent peer\n+connection object to plugins. It's low level and may not be a stable API across\n+libtorrent versions.\n+struct bt_peer_connection_handle : peer_connection_handle\n+{\n+ explicit bt_peer_connection_handle (peer_connection_handle pc);\n+ bool packet_finished () const;\n+ bool support_extensions () const;\n+ bool supports_encryption () const;\n+ void switch_send_crypto (std::shared_ptr crypto);\n+ void switch_recv_crypto (std::shared_ptr crypto);\n+ std::shared_ptr native_handle () const;\n+};\n+[report_issue]\n+****** create_ut_metadata_plugin() ******\n+Declared in \"libtorrent/extensions/ut_metadata.hpp\"\n+std::shared_ptr create_ut_metadata_plugin (torrent_handle\n+const&, client_data_t);\n+constructor function for the ut_metadata extension. The ut_metadata extension\n+allows peers to request the .torrent file (or more specifically the info-\n+dictionary of the .torrent file) from each other. This is the main building\n+block in making magnet links work. This extension is enabled by default unless\n+explicitly disabled in the session constructor.\n+This can either be passed in the add_torrent_params::extensions field, or via\n+torrent_handle::add_extension().\n+[report_issue]\n+****** create_smart_ban_plugin() ******\n+Declared in \"libtorrent/extensions/smart_ban.hpp\"\n+std::shared_ptr create_smart_ban_plugin (torrent_handle const&,\n+client_data_t);\n+constructor function for the smart ban extension. The extension keeps track of\n+the data peers have sent us for failing pieces and once the piece completes and\n+passes the hash check bans the peers that turned out to have sent corrupt data.\n+This function can either be passed in the add_torrent_params::extensions field,\n+or via torrent_handle::add_extension().\n+[report_issue]\n+****** create_ut_pex_plugin() ******\n+Declared in \"libtorrent/extensions/ut_pex.hpp\"\n+std::shared_ptr create_ut_pex_plugin (torrent_handle const&,\n+client_data_t);\n+constructor function for the ut_pex extension. The ut_pex extension allows\n+peers to gossip about their connections, allowing the swarm stay well connected\n+and peers aware of more peers in the swarm. This extension is enabled by\n+default unless explicitly disabled in the session constructor.\n+This can either be passed in the add_torrent_params::extensions field, or via\n+torrent_handle::add_extension().\n+[report_issue]\n+****** ip_filter ******\n+Declared in \"libtorrent/ip_filter.hpp\"\n+The ip_filter class is a set of rules that uniquely categorizes all ip\n+addresses as allowed or disallowed. The default constructor creates a single\n+rule that allows all addresses (0.0.0.0 - 255.255.255.255 for the IPv4 range,\n+and the equivalent range covering all addresses for the IPv6 range).\n+A default constructed ip_filter does not filter any address.\n+struct ip_filter\n+{\n+ ip_filter ();\n+ ip_filter& operator= (ip_filter&&);\n+ ~ip_filter ();\n+ ip_filter (ip_filter&&);\n+ ip_filter& operator= (ip_filter const&);\n+ ip_filter (ip_filter const&);\n+ bool empty () const;\n+ void add_rule (address const& first, address const& last, std::uint32_t\n+flags);\n+ std::uint32_t access (address const& addr) const;\n+ filter_tuple_t export_filter () const;\n+\n+ enum access_flags\n+ {\n+ blocked,\n+ };\n+};\n+[report_issue]\n+***** empty() *****\n+bool empty () const;\n+returns true if the filter does not contain any rules\n+[report_issue]\n+***** add_rule() *****\n+void add_rule (address const& first, address const& last, std::uint32_t flags);\n+Adds a rule to the filter. first and last defines a range of ip addresses that\n+will be marked with the given flags. The flags can currently be 0, which means\n+allowed, or ip_filter::blocked, which means disallowed.\n+precondition: first.is_v4() == last.is_v4() && first.is_v6() == last.is_v6()\n+postcondition: access(x) == flags for every x in the range [first, last]\n+This means that in a case of overlapping ranges, the last one applied takes\n+precedence.\n+[report_issue]\n+***** access() *****\n+std::uint32_t access (address const& addr) const;\n+Returns the access permissions for the given address (addr). The permission can\n+currently be 0 or ip_filter::blocked. The complexity of this operation is O(log\n+n), where n is the minimum number of non-overlapping ranges to describe the\n+current filter.\n+[report_issue]\n+***** export_filter() *****\n+filter_tuple_t export_filter () const;\n+This function will return the current state of the filter in the minimum number\n+of ranges possible. They are sorted from ranges in low addresses to high\n+addresses. Each entry in the returned vector is a range with the access control\n+specified in its flags field.\n+The return value is a tuple containing two range-lists. One for IPv4 addresses\n+and one for IPv6 addresses.\n+[report_issue]\n+***** enum access_flags *****\n+Declared in \"libtorrent/ip_filter.hpp\"\n+ _____________________________________________________________________________\n+|name___|value|description____________________________________________________|\n+|blocked|1 |indicates that IPs in this range should not be connected to nor|\n+|_______|_____|accepted_as_incoming_connections_______________________________|\n+[report_issue]\n+****** port_filter ******\n+Declared in \"libtorrent/ip_filter.hpp\"\n+the port filter maps non-overlapping port ranges to flags. This is primarily\n+used to indicate whether a range of ports should be connected to or not. The\n+default is to have the full port range (0-65535) set to flag 0.\n+class port_filter\n+{\n+ ~port_filter ();\n+ port_filter (port_filter const&);\n+ port_filter& operator= (port_filter const&);\n+ port_filter& operator= (port_filter&&);\n+ port_filter ();\n+ port_filter (port_filter&&);\n+ void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t\n+flags);\n+ std::uint32_t access (std::uint16_t port) const;\n+\n+ enum access_flags\n+ {\n+ blocked,\n+ };\n+};\n+[report_issue]\n+***** add_rule() *****\n+void add_rule (std::uint16_t first, std::uint16_t last, std::uint32_t flags);\n+set the flags for the specified port range (first, last) to flags overwriting\n+any existing rule for those ports. The range is inclusive, i.e. the port last\n+also has the flag set on it.\n+[report_issue]\n+***** access() *****\n+std::uint32_t access (std::uint16_t port) const;\n+test the specified port (port) for whether it is blocked or not. The returned\n+value is the flags set for this port. see access_flags.\n+[report_issue]\n+***** enum access_flags *****\n+Declared in \"libtorrent/ip_filter.hpp\"\n+ ____________________________________________________________________________\n+|name___|value|description___________________________________________________|\n+|blocked|1 |this flag indicates that destination ports in the range should|\n+|_______|_____|not_be_connected_to___________________________________________|\n+[report_issue]\n+****** bdecode_node ******\n+Declared in \"libtorrent/bdecode.hpp\"\n+Sometimes it's important to get a non-owning reference to the root node ( to be\n+able to copy it as a reference for instance). For that, use the non_owning()\n+member function.\n+There are 5 different types of nodes, see type_t.\n+struct bdecode_node\n+{\n+ bdecode_node () = default;\n+ bdecode_node (bdecode_node const&);\n+ bdecode_node (bdecode_node&&) noexcept;\n+ bdecode_node& operator= (bdecode_node&&) & = default;\n+ bdecode_node& operator= (bdecode_node const&) &;\n+ type_t type () const noexcept;\n+ explicit operator bool () const noexcept;\n+ bdecode_node non_owning () const;\n+ span data_section () const noexcept;\n+ std::ptrdiff_t data_offset () const noexcept;\n+ std::int64_t list_int_value_at (int i\n+ , std::int64_t default_val = 0) const;\n+ bdecode_node list_at (int i) const;\n+ string_view list_string_value_at (int i\n+ , string_view default_val = string_view()) const;\n+ int list_size () const;\n+ std::pair dict_at (int i) const;\n+ bdecode_node dict_find_dict (string_view key) const;\n+ std::int64_t dict_find_int_value (string_view key\n+ , std::int64_t default_val = 0) const;\n+ string_view dict_find_string_value (string_view key\n+ , string_view default_value = string_view()) const;\n+ int dict_size () const;\n+ bdecode_node dict_find_list (string_view key) const;\n+ bdecode_node dict_find_string (string_view key) const;\n+ bdecode_node dict_find_int (string_view key) const;\n+ std::pair dict_at_node (int i) const;\n+ bdecode_node dict_find (string_view key) const;\n+ std::int64_t int_value () const;\n+ string_view string_value () const;\n+ std::ptrdiff_t string_offset () const;\n+ int string_length () const;\n+ char const* string_ptr () const;\n+ void clear ();\n+ void swap (bdecode_node& n);\n+ void reserve (int tokens);\n+ void switch_underlying_buffer (char const* buf) noexcept;\n+ bool has_soft_error (span error) const;\n+\n+ enum type_t\n+ {\n+ none_t,\n+ dict_t,\n+ list_t,\n+ string_t,\n+ int_t,\n+ };\n+};\n+[report_issue]\n+***** bdecode_node() *****\n+bdecode_node () = default;\n+creates a default constructed node, it will have the type none_t.\n [report_issue]\n- upload_priority download_priority\n- relative priorities used by the bandwidth allocator in the rate limiter.\n- If no rate limits are in use, the priority is not used either. Priorities\n- start at 1 (0 is not a valid priority) and may not exceed 255.\n+***** bdecode_node() operator=() *****\n+bdecode_node (bdecode_node const&);\n+bdecode_node (bdecode_node&&) noexcept;\n+bdecode_node& operator= (bdecode_node&&) & = default;\n+bdecode_node& operator= (bdecode_node const&) &;\n+For owning nodes, the copy will create a copy of the tree, but the underlying\n+buffer remains the same.\n+[report_issue]\n+***** type() *****\n+type_t type () const noexcept;\n+the type of this node. See type_t.\n+[report_issue]\n+***** bool() *****\n+explicit operator bool () const noexcept;\n+returns true if type() != none_t.\n+[report_issue]\n+***** non_owning() *****\n+bdecode_node non_owning () const;\n+return a non-owning reference to this node. This is useful to refer to the root\n+node without copying it in assignments.\n+ [report_issue]\n+***** data_offset() data_section() *****\n+span data_section () const noexcept;\n+std::ptrdiff_t data_offset () const noexcept;\n+returns the buffer and length of the section in the original bencoded buffer\n+where this node is defined. For a dictionary for instance, this starts with d\n+and ends with e, and has all the content of the dictionary in between. the\n+data_offset() function returns the byte-offset to this node in, starting from\n+the beginning of the buffer that was parsed.\n+ [report_issue]\n+***** list_string_value_at() list_at() list_int_value_at() list_size() *****\n+std::int64_t list_int_value_at (int i\n+ , std::int64_t default_val = 0) const;\n+bdecode_node list_at (int i) const;\n+string_view list_string_value_at (int i\n+ , string_view default_val = string_view()) const;\n+int list_size () const;\n+functions with the list_ prefix operate on lists. These functions are only\n+valid if type() == list_t. list_at() returns the item in the list at index i. i\n+may not be greater than or equal to the size of the list. size() returns the\n+size of the list.\n+ [report_issue]\n+***** dict_find_string_value() dict_find_int_value() dict_find() dict_at()\n+dict_find_dict() dict_find_string() dict_find_int() dict_at_node() dict_size()\n+dict_find_list() *****\n+std::pair dict_at (int i) const;\n+bdecode_node dict_find_dict (string_view key) const;\n+std::int64_t dict_find_int_value (string_view key\n+ , std::int64_t default_val = 0) const;\n+string_view dict_find_string_value (string_view key\n+ , string_view default_value = string_view()) const;\n+int dict_size () const;\n+bdecode_node dict_find_list (string_view key) const;\n+bdecode_node dict_find_string (string_view key) const;\n+bdecode_node dict_find_int (string_view key) const;\n+std::pair dict_at_node (int i) const;\n+bdecode_node dict_find (string_view key) const;\n+Functions with the dict_ prefix operates on dictionaries. They are only valid\n+if type() == dict_t. In case a key you're looking up contains a 0 byte, you\n+cannot use the 0-terminated string overloads, but have to use string_view\n+instead. dict_find_list will return a valid bdecode_node if the key is found\n+_and_ it is a list. Otherwise it will return a default-constructed\n+bdecode_node.\n+Functions with the _value suffix return the value of the node directly, rather\n+than the nodes. In case the node is not found, or it has a different type, a\n+default value is returned (which can be specified).\n+dict_at() returns the (key, value)-pair at the specified index in a dictionary.\n+Keys are only allowed to be strings. dict_at_node() also returns the (key,\n+value)-pair, but the key is returned as a bdecode_node (and it will always be a\n+string).\n+[report_issue]\n+***** int_value() *****\n+std::int64_t int_value () const;\n+this function is only valid if type() == int_t. It returns the value of the\n+integer.\n+ [report_issue]\n+***** string_ptr() string_offset() string_value() string_length() *****\n+string_view string_value () const;\n+std::ptrdiff_t string_offset () const;\n+int string_length () const;\n+char const* string_ptr () const;\n+these functions are only valid if type() == string_t. They return the string\n+values. Note that string_ptr() is not 0-terminated. string_length() returns the\n+number of bytes in the string. string_offset() returns the byte offset from the\n+start of the parsed bencoded buffer this string can be found.\n+[report_issue]\n+***** clear() *****\n+void clear ();\n+resets the bdecoded_node to a default constructed state. If this is an owning\n+node, the tree is freed and all child nodes are invalidated.\n+[report_issue]\n+***** swap() *****\n+void swap (bdecode_node& n);\n+Swap contents.\n+[report_issue]\n+***** reserve() *****\n+void reserve (int tokens);\n+preallocate memory for the specified numbers of tokens. This is useful if you\n+know approximately how many tokens are in the file you are about to parse.\n+Doing so will save realloc operations while parsing. You should only call this\n+on the root node, before passing it in to bdecode().\n+[report_issue]\n+***** switch_underlying_buffer() *****\n+void switch_underlying_buffer (char const* buf) noexcept;\n+this buffer MUST be identical to the one originally parsed. This operation is\n+only defined on owning root nodes, i.e. the one passed in to decode().\n+[report_issue]\n+***** has_soft_error() *****\n+bool has_soft_error (span error) const;\n+returns true if there is a non-fatal error in the bencoding of this node or its\n+children\n+[report_issue]\n+***** enum type_t *****\n+Declared in \"libtorrent/bdecode.hpp\"\n+ _________________________________________________________________________\n+|name____|value|description_______________________________________________|\n+|none_t |0 |uninitialized or default constructed. This is also used to|\n+|________|_____|indicate_that_a_node_was_not_found_in_some_cases._________|\n+|dict_t__|1____|a_dictionary_node._The_dict_find__functions_are_valid.____|\n+|list_t__|2____|a_list_node._The_list__functions_are_valid._______________|\n+|string_t|3____|a_string_node,_the_string__functions_are_valid.___________|\n+|int_t___|4____|an_integer_node._The_int__functions_are_valid.____________|\n+[report_issue]\n+****** print_entry() ******\n+Declared in \"libtorrent/bdecode.hpp\"\n+std::string print_entry (bdecode_node const& e\n+ , bool single_line = false, int indent = 0);\n+print the bencoded structure in a human-readable format to a string that's\n+returned.\n+[report_issue]\n+****** bdecode() ******\n+Declared in \"libtorrent/bdecode.hpp\"\n+bdecode_node bdecode (span buffer\n+ , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n+ , int token_limit = 2000000);\n+int bdecode (char const* start, char const* end, bdecode_node& ret\n+ , error_code& ec, int* error_pos = nullptr, int depth_limit = 100\n+ , int token_limit = 2000000);\n+bdecode_node bdecode (span buffer\n+ , int depth_limit = 100, int token_limit = 2000000);\n+This function decodes/parses bdecoded data (for example a .torrent file). The\n+data structure is returned in the ret argument. the buffer to parse is\n+specified by the start of the buffer as well as the end, i.e. one byte past the\n+end. If the buffer fails to parse, the function returns a non-zero value and\n+fills in ec with the error code. The optional argument error_pos, if set to\n+non-nullptr, will be set to the byte offset into the buffer where the parse\n+failure occurred.\n+depth_limit specifies the max number of nested lists or dictionaries are\n+allowed in the data structure. (This affects the stack usage of the function,\n+be careful not to set it too high).\n+token_limit is the max number of tokens allowed to be parsed from the buffer.\n+This is simply a sanity check to not have unbounded memory usage.\n+The resulting bdecode_node is an owning node. That means it will be holding the\n+whole parsed tree. When iterating lists and dictionaries, those bdecode_node\n+objects will simply have references to the root or owning bdecode_node. If the\n+root node is destructed, all other nodes that refer to anything in that tree\n+become invalid.\n+However, the underlying buffer passed in to this function (start, end) must\n+also remain valid while the bdecoded tree is used. The parsed tree produced by\n+this function does not copy any data out of the buffer, but simply produces\n+references back into it.\n+[report_issue]\n+****** storage_params ******\n+Declared in \"libtorrent/storage_defs.hpp\"\n+a parameter pack used to construct the storage for a torrent, used in\n+disk_interface\n+struct storage_params\n+{\n+ storage_params (file_storage const& f, file_storage const* mf\n+ , std::string const& sp, storage_mode_t const sm\n+ , aux::vector const& prio\n+ , sha1_hash const& ih);\n+\n+ file_storage const& files;\n+ file_storage const* mapped_files = nullptr;\n+ std::string const& path;\n+ storage_mode_t mode {storage_mode_sparse};\n+ aux::vector const& priorities;\n+ sha1_hash info_hash;\n+};\n+[report_issue]\n+****** file_slice ******\n+Declared in \"libtorrent/file_storage.hpp\"\n+represents a window of a file in a torrent.\n+The file_index refers to the index of the file (in the torrent_info). To get\n+the path and filename, use file_path() and give the file_index as argument. The\n+offset is the byte offset in the file where the range starts, and size is the\n+number of bytes this range is. The size + offset will never be greater than the\n+file size.\n+struct file_slice\n+{\n+ file_index_t file_index;\n+ std::int64_t offset;\n+ std::int64_t size;\n+};\n+[report_issue]\n+ file_index\n+ the index of the file\n+[report_issue]\n+ offset\n+ the offset from the start of the file, in bytes\n+[report_issue]\n+ size\n+ the size of the window, in bytes\n+[report_issue]\n+****** file_storage ******\n+Declared in \"libtorrent/file_storage.hpp\"\n+The file_storage class represents a file list and the piece size. Everything\n+necessary to interpret a regular bittorrent storage file structure.\n+class file_storage\n+{\n+ bool is_valid () const;\n+ void reserve (int num_files);\n+ void add_file_borrow (string_view filename\n+ , std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}, char const* filehash = nullptr\n+ , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+ void add_file (std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}\n+ , std::time_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+ void add_file (error_code& ec, std::string const& path, std::int64_t\n+file_size\n+ , file_flags_t file_flags = {}\n+ , std::time_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+ void add_file_borrow (error_code& ec, string_view filename\n+ , std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}, char const* filehash = nullptr\n+ , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+ void rename_file (file_index_t index, std::string const& new_filename);\n+ std::vector map_block (piece_index_t piece, std::int64_t offset\n+ , std::int64_t size) const;\n+ peer_request map_file (file_index_t file, std::int64_t offset, int size)\n+const;\n+ int num_files () const noexcept;\n+ file_index_t end_file () const noexcept;\n+ index_range file_range () const noexcept;\n+ std::int64_t total_size () const;\n+ int num_pieces () const;\n+ void set_num_pieces (int n);\n+ piece_index_t end_piece () const;\n+ piece_index_t last_piece () const;\n+ index_range piece_range () const noexcept;\n+ int piece_length () const;\n+ void set_piece_length (int l);\n+ int piece_size (piece_index_t index) const;\n+ int piece_size2 (piece_index_t index) const;\n+ int blocks_in_piece2 (piece_index_t index) const;\n+ void set_name (std::string const& n);\n+ std::string const& name () const;\n+ void swap (file_storage& ti) noexcept;\n+ void canonicalize ();\n+ std::string symlink (file_index_t index) const;\n+ std::int64_t file_size (file_index_t index) const;\n+ sha256_hash root (file_index_t index) const;\n+ std::int64_t file_offset (file_index_t index) const;\n+ sha1_hash hash (file_index_t index) const;\n+ char const* root_ptr (file_index_t const index) const;\n+ std::time_t mtime (file_index_t index) const;\n+ std::string file_path (file_index_t index, std::string const& save_path =\n+\"\") const;\n+ bool pad_file_at (file_index_t index) const;\n+ string_view file_name (file_index_t index) const;\n+ index_range file_piece_range (file_index_t) const;\n+ int file_num_pieces (file_index_t index) const;\n+ int file_num_blocks (file_index_t index) const;\n+ int file_first_block_node (file_index_t index) const;\n+ int file_first_piece_node (file_index_t index) const;\n+ std::uint32_t file_path_hash (file_index_t index, std::string const&\n+save_path) const;\n+ void all_path_hashes (std::unordered_set& table) const;\n+ file_flags_t file_flags (file_index_t index) const;\n+ bool file_absolute_path (file_index_t index) const;\n+ file_index_t file_index_at_offset (std::int64_t offset) const;\n+ file_index_t file_index_at_piece (piece_index_t piece) const;\n+ file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n+ piece_index_t piece_index_at_file (file_index_t f) const;\n+ void sanitize_symlinks ();\n+ bool v2 () const;\n+\n+ static constexpr file_flags_t flag_pad_file = 0_bit;\n+ static constexpr file_flags_t flag_hidden = 1_bit;\n+ static constexpr file_flags_t flag_executable = 2_bit;\n+ static constexpr file_flags_t flag_symlink = 3_bit;\n+};\n+[report_issue]\n+***** is_valid() *****\n+bool is_valid () const;\n+returns true if the piece length has been initialized on the file_storage. This\n+is typically taken as a proxy of whether the file_storage as a whole is\n+initialized or not.\n+[report_issue]\n+***** reserve() *****\n+void reserve (int num_files);\n+allocates space for num_files in the internal file list. This can be used to\n+avoid reallocating the internal file list when the number of files to be added\n+is known up-front.\n+ [report_issue]\n+***** add_file() add_file_borrow() *****\n+void add_file_borrow (string_view filename\n+ , std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}, char const* filehash = nullptr\n+ , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+void add_file (std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}\n+ , std::time_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+void add_file (error_code& ec, std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}\n+ , std::time_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+void add_file_borrow (error_code& ec, string_view filename\n+ , std::string const& path, std::int64_t file_size\n+ , file_flags_t file_flags = {}, char const* filehash = nullptr\n+ , std::int64_t mtime = 0, string_view symlink_path = string_view()\n+ , char const* root_hash = nullptr);\n+Adds a file to the file storage. The add_file_borrow version expects that\n+filename is the file name (without a path) of the file that's being added. This\n+memory is borrowed, i.e. it is the caller's responsibility to make sure it\n+stays valid throughout the lifetime of this file_storage object or any copy of\n+it. The same thing applies to filehash, which is an optional pointer to a 20\n+byte binary SHA-1 hash of the file.\n+if filename is empty, the filename from path is used and not borrowed.\n+The path argument is the full path (in the torrent file) to the file to add.\n+Note that this is not supposed to be an absolute path, but it is expected to\n+include the name of the torrent as the first path element.\n+file_size is the size of the file in bytes.\n+The file_flags argument sets attributes on the file. The file attributes is an\n+extension and may not work in all bittorrent clients.\n+For possible file attributes, see file_storage::flags_t.\n+The mtime argument is optional and can be set to 0. If non-zero, it is the\n+posix time of the last modification time of this file.\n+symlink_path is the path the file is a symlink to. To make this a symlink you\n+also need to set the file_storage::flag_symlink file flag.\n+root_hash is an optional pointer to a 32 byte SHA-256 hash, being the merkle\n+tree root hash for this file. This is only used for v2 torrents. If the root\n+hash is specified for one file, it has to be specified for all, otherwise this\n+function will fail. Note that the buffer root_hash points to must out-live the\n+file_storage object, it will not be copied. This parameter is only used when\n+loading torrents, that already have their file hashes computed. When creating\n+torrents, the file hashes will be computed by the piece hashes.\n+If more files than one are added, certain restrictions to their paths apply. In\n+a multi-file file storage (torrent), all files must share the same root\n+directory.\n+That is, the first path element of all files must be the same. This shared path\n+element is also set to the name of the torrent. It can be changed by calling\n+set_name.\n+The overloads that take anerror_codereference will report failures via that\n+variable, otherwisesystem_erroris thrown.\n+[report_issue]\n+***** rename_file() *****\n+void rename_file (file_index_t index, std::string const& new_filename);\n+renames the file at index to new_filename. Keep in mind that filenames are\n+expected to be UTF-8 encoded.\n+[report_issue]\n+***** map_block() *****\n+std::vector map_block (piece_index_t piece, std::int64_t offset\n+ , std::int64_t size) const;\n+returns a list of file_slice objects representing the portions of files the\n+specified piece index, byte offset and size range overlaps. this is the inverse\n+mapping of map_file().\n+Preconditions of this function is that the input range is within the torrents\n+address space. piece may not be negative and\n+ piece * piece_size + offset + size\n+may not exceed the total size of the torrent.\n+[report_issue]\n+***** map_file() *****\n+peer_request map_file (file_index_t file, std::int64_t offset, int size) const;\n+returns a peer_request representing the piece index, byte offset and size the\n+specified file range overlaps. This is the inverse mapping over map_block().\n+Note that the peer_request return type is meant to hold bittorrent block\n+requests, which may not be larger than 16 kiB. Mapping a range larger than that\n+may return an overflown integer.\n+[report_issue]\n+***** num_files() *****\n+int num_files () const noexcept;\n+returns the number of files in the file_storage\n+[report_issue]\n+***** end_file() *****\n+file_index_t end_file () const noexcept;\n+returns the index of the one-past-end file in the file storage\n+[report_issue]\n+***** file_range() *****\n+index_range file_range () const noexcept;\n+returns an implementation-defined type that can be used as the container in a\n+range-for loop. Where the values are the indices of all files in the\n+file_storage.\n+[report_issue]\n+***** total_size() *****\n+std::int64_t total_size () const;\n+returns the total number of bytes all the files in this torrent spans\n+ [report_issue]\n+***** num_pieces() set_num_pieces() *****\n+int num_pieces () const;\n+void set_num_pieces (int n);\n+set and get the number of pieces in the torrent\n+[report_issue]\n+***** end_piece() *****\n+piece_index_t end_piece () const;\n+returns the index of the one-past-end piece in the file storage\n+[report_issue]\n+***** last_piece() *****\n+piece_index_t last_piece () const;\n+returns the index of the last piece in the torrent. The last piece is special\n+in that it may be smaller than the other pieces (and the other pieces are all\n+the same size).\n+[report_issue]\n+***** piece_range() *****\n+index_range piece_range () const noexcept;\n+returns an implementation-defined type that can be used as the container in a\n+range-for loop. Where the values are the indices of all pieces in the\n+file_storage.\n+ [report_issue]\n+***** set_piece_length() piece_length() *****\n+int piece_length () const;\n+void set_piece_length (int l);\n+set and get the size of each piece in this torrent. It must be a power of two\n+and at least 16 kiB.\n+[report_issue]\n+***** piece_size() *****\n+int piece_size (piece_index_t index) const;\n+returns the piece size of index. This will be the same as piece_length(),\n+except for the last piece, which may be shorter.\n+[report_issue]\n+***** piece_size2() *****\n+int piece_size2 (piece_index_t index) const;\n+Returns the size of the given piece. If the piece spans multiple files, only\n+the first file is considered part of the piece. This is used for v2 torrents,\n+where all files are piece aligned and padded. i.e. The pad files are not\n+considered part of the piece for this purpose.\n+[report_issue]\n+***** blocks_in_piece2() *****\n+int blocks_in_piece2 (piece_index_t index) const;\n+returns the number of blocks in the specified piece, for v2 torrents.\n+ [report_issue]\n+***** set_name() name() *****\n+void set_name (std::string const& n);\n+std::string const& name () const;\n+set and get the name of this torrent. For multi-file torrents, this is also the\n+name of the root directory all the files are stored in.\n+[report_issue]\n+***** swap() *****\n+void swap (file_storage& ti) noexcept;\n+swap all content of this with ti.\n+[report_issue]\n+***** canonicalize() *****\n+void canonicalize ();\n+arrange files and padding to match the canonical form required by BEP 52\n+ [report_issue]\n+***** file_name() file_size() file_offset() mtime() root() file_path() root_ptr\n+() symlink() pad_file_at() hash() *****\n+std::string symlink (file_index_t index) const;\n+std::int64_t file_size (file_index_t index) const;\n+sha256_hash root (file_index_t index) const;\n+std::int64_t file_offset (file_index_t index) const;\n+sha1_hash hash (file_index_t index) const;\n+char const* root_ptr (file_index_t const index) const;\n+std::time_t mtime (file_index_t index) const;\n+std::string file_path (file_index_t index, std::string const& save_path = \"\")\n+const;\n+bool pad_file_at (file_index_t index) const;\n+string_view file_name (file_index_t index) const;\n+These functions are used to query attributes of files at a given index.\n+The hash() is a SHA-1 hash of the file, or 0 if none was provided in the\n+torrent file. This can potentially be used to join a bittorrent network with\n+other file sharing networks.\n+root() returns the SHA-256 merkle tree root of the specified file, in case this\n+is a v2 torrent. Otherwise returns zeros. root_ptr() returns a pointer to the\n+SHA-256 merkle tree root hash for the specified file. The pointer points into\n+storage referred to when the file was added, it is not owned by this object.\n+Torrents that are not v2 torrents return nullptr.\n+The mtime() is the modification time is the posix time when a file was last\n+modified when the torrent was created, or 0 if it was not included in the\n+torrent file.\n+file_path() returns the full path to a file.\n+file_size() returns the size of a file.\n+pad_file_at() returns true if the file at the given index is a pad-file.\n+file_name() returns just the name of the file, whereas file_path() returns the\n+path (inside the torrent file) with the filename appended.\n+file_offset() returns the byte offset within the torrent file where this file\n+starts. It can be used to map the file to a piece index (given the piece size).\n+ [report_issue]\n+***** file_num_pieces() file_piece_range() file_num_blocks() *****\n+index_range file_piece_range (file_index_t) const;\n+int file_num_pieces (file_index_t index) const;\n+int file_num_blocks (file_index_t index) const;\n+Returns the number of pieces or blocks the file atindexspans, under the\n+assumption that the file is aligned to the start of a piece. This is only\n+meaningful for v2 torrents, where files are guaranteed such alignment. These\n+numbers are used to size and navigate the merkle hash tree for each file.\n+ [report_issue]\n+***** file_first_piece_node() file_first_block_node() *****\n+int file_first_block_node (file_index_t index) const;\n+int file_first_piece_node (file_index_t index) const;\n+index of first piece node in the merkle tree\n+[report_issue]\n+***** file_path_hash() *****\n+std::uint32_t file_path_hash (file_index_t index, std::string const& save_path)\n+const;\n+returns the crc32 hash of file_path(index)\n+[report_issue]\n+***** all_path_hashes() *****\n+void all_path_hashes (std::unordered_set& table) const;\n+this will add the CRC32 hash of all directory entries to the table. No filename\n+will be included, just directories. Every depth of directories are added\n+separately to allow test for collisions with files at all levels. i.e. if one\n+path in the torrent is foo/bar/baz, the CRC32 hashes for foo, foo/bar and foo/\n+bar/baz will be added to the set.\n+[report_issue]\n+***** file_flags() *****\n+file_flags_t file_flags (file_index_t index) const;\n+returns a bitmask of flags from file_flags_t that apply to file at index.\n+[report_issue]\n+***** file_absolute_path() *****\n+bool file_absolute_path (file_index_t index) const;\n+returns true if the file at the specified index has been renamed to have an\n+absolute path, i.e. is not anchored in the save path of the torrent.\n+ [report_issue]\n+***** file_index_at_offset() file_index_at_piece() *****\n+file_index_t file_index_at_offset (std::int64_t offset) const;\n+file_index_t file_index_at_piece (piece_index_t piece) const;\n+returns the index of the file at the given offset in the torrent\n+[report_issue]\n+***** file_index_for_root() *****\n+file_index_t file_index_for_root (sha256_hash const& root_hash) const;\n+finds the file with the given root hash and returns its index if there is no\n+file with the root hash, file_index_t{-1} is returned\n+[report_issue]\n+***** piece_index_at_file() *****\n+piece_index_t piece_index_at_file (file_index_t f) const;\n+returns the piece index the given file starts at\n+[report_issue]\n+***** sanitize_symlinks() *****\n+void sanitize_symlinks ();\n+validate any symlinks, to ensure they all point to other files or directories\n+inside this storage. Any invalid symlinks are updated to point to themselves.\n+[report_issue]\n+***** v2() *****\n+bool v2 () const;\n+returns true if this torrent contains v2 metadata.\n+[report_issue]\n+ flag_pad_file\n+ the file is a pad file. It's required to contain zeros at it will not be\n+ saved to disk. Its purpose is to make the following file start on a piece\n+ boundary.\n+[report_issue]\n+ flag_hidden\n+ this file has the hidden attribute set. This is primarily a windows\n+ attribute\n+[report_issue]\n+ flag_executable\n+ this file has the executable attribute set.\n+[report_issue]\n+ flag_symlink\n+ this file is a symbolic link. It should have a link target string\n+ associated with it.\n+[report_issue]\n+****** default_disk_io_constructor() ******\n+Declared in \"libtorrent/session.hpp\"\n+std::unique_ptr default_disk_io_constructor (\n+ io_context& ios, settings_interface const&, counters& cnt);\n+the constructor function for the default storage. On systems that support\n+memory mapped files (and a 64 bit address space) the memory mapped storage will\n+be constructed, otherwise the portable posix storage.\n+[report_issue]\n+****** posix_disk_io_constructor() ******\n+Declared in \"libtorrent/posix_disk_io.hpp\"\n+std::unique_ptr posix_disk_io_constructor (\n+ io_context& ios, settings_interface const&, counters& cnt);\n+this is a simple posix disk I/O back-end, used for systems that don't have a 64\n+bit virtual address space or don't support memory mapped files. It's\n+implemented using portable C file functions and is single-threaded.\n+[report_issue]\n+****** mmap_disk_io_constructor() ******\n+Declared in \"libtorrent/mmap_disk_io.hpp\"\n+std::unique_ptr mmap_disk_io_constructor (\n+ io_context& ios, settings_interface const&, counters& cnt);\n+constructs a memory mapped file disk I/O object.\n+[report_issue]\n+****** disabled_disk_io_constructor() ******\n+Declared in \"libtorrent/disabled_disk_io.hpp\"\n+std::unique_ptr disabled_disk_io_constructor (\n+ io_context& ios, settings_interface const&, counters& cnt);\n+creates a disk io object that discards all data written to it, and only returns\n+zero-buffers when read from. May be useful for testing and benchmarking.\n+[report_issue]\n+****** enum storage_mode_t ******\n+Declared in \"libtorrent/storage_defs.hpp\"\n+ ___________________________________________________________________________\n+|name_________________|value|description____________________________________|\n+| | |All pieces will be written to their final |\n+| | |position, all files will be allocated in full |\n+|storage_mode_allocate|0 |when the torrent is first started. This mode |\n+| | |minimizes fragmentation but could be a costly |\n+|_____________________|_____|operation._____________________________________|\n+| | |All pieces will be written to the place where |\n+|storage_mode_sparse |1 |they belong and sparse files will be used. This|\n+|_____________________|_____|is_the_recommended,_and_default_mode.__________|\n+[report_issue]\n+****** enum status_t ******\n+Declared in \"libtorrent/storage_defs.hpp\"\n+ ____________________________________________________________________________\n+|name____________|value|description__________________________________________|\n+|no_error________|0____|\u00a0___________________________________________________|\n+|fatal_disk_error|1____|\u00a0___________________________________________________|\n+|need_full_check_|2____|\u00a0___________________________________________________|\n+|file_exist______|3____|\u00a0___________________________________________________|\n+| | |this is not an enum value, but a flag that can be set|\n+| | |in the return from async_check_files, in case an |\n+|oversized_file |16 |existing file was found larger than specified in the |\n+| | |torrent. i.e. it has garbage at the end the status_t |\n+|________________|_____|field_is_used_for_this_to_preserve_ABI.______________|\n+[report_issue]\n+****** enum move_flags_t ******\n+Declared in \"libtorrent/storage_defs.hpp\"\n+ ____________________________________________________________________________\n+|name________________|value|description______________________________________|\n+|always_replace_files|0 |replace any files in the destination when copying|\n+|____________________|_____|or_moving_the_storage____________________________|\n+| | |if any files that we want to copy exist in the |\n+| | |destination exist, fail the whole operation and |\n+| | |don't perform any copy or move. There is an |\n+|fail_if_exist |1 |inherent race condition in this mode. The files |\n+| | |are checked for existence before the operation |\n+| | |starts. In between the check and performing the |\n+| | |copy, the destination files may be created, in |\n+|____________________|_____|which_case_they_are_replaced.____________________|\n+|dont_replace |2 |if any file exist in the target, take those files|\n+|____________________|_____|instead_of_the_ones_we_may_have_in_the_source.___|\n+[report_issue]\n+****** announce_infohash ******\n+Declared in \"libtorrent/announce_entry.hpp\"\n+struct announce_infohash\n+{\n+ std::string message;\n+ error_code last_error;\n+ int scrape_incomplete = -1;\n+ int scrape_complete = -1;\n+ int scrape_downloaded = -1;\n+ std::uint8_t fails : 7;\n+ bool updating : 1;\n+ bool start_sent : 1;\n+ bool complete_sent : 1;\n+};\n+[report_issue]\n+ message\n+ if this tracker has returned an error or warning message that message is\n+ stored here\n+[report_issue]\n+ last_error\n+ if this tracker failed the last time it was contacted this error code\n+ specifies what error occurred\n+ [report_issue]\n+ scrape_incomplete scrape_complete scrape_downloaded\n+ if this tracker has returned scrape data, these fields are filled in with\n+ valid numbers. Otherwise they are set to -1. incomplete counts the number\n+ of current downloaders. complete counts the number of current peers\n+ completed the download, or \"seeds\". downloaded is the cumulative number\n+ of completed downloads.\n+[report_issue]\n+ fails\n+ the number of times in a row we have failed to announce to this tracker.\n+[report_issue]\n+ updating\n+ true while we're waiting for a response from the tracker.\n+[report_issue]\n+ start_sent\n+ set to true when we get a valid response from an announce with\n+ event=started. If it is set, we won't send start in the subsequent\n+ announces.\n+[report_issue]\n+ complete_sent\n+ set to true when we send a event=completed.\n+[report_issue]\n+****** announce_endpoint ******\n+Declared in \"libtorrent/announce_entry.hpp\"\n+announces are sent to each tracker using every listen socket this class holds\n+information about one listen socket for one tracker\n+struct announce_endpoint\n+{\n+ announce_endpoint ();\n+\n+ tcp::endpoint local_endpoint;\n+ aux::array info_hashes;\n+ bool enabled = true;\n+};\n+[report_issue]\n+ local_endpoint\n+ the local endpoint of the listen interface associated with this endpoint\n+[report_issue]\n+ info_hashes\n+ info_hashes[0] is the v1 info hash (SHA1) info_hashes[1] is the v2 info\n+ hash (truncated SHA-256)\n+[report_issue]\n+ enabled\n+ set to false to not announce from this endpoint\n+[report_issue]\n+****** announce_entry ******\n+Declared in \"libtorrent/announce_entry.hpp\"\n+this class holds information about one bittorrent tracker, as it relates to a\n+specific torrent.\n+struct announce_entry\n+{\n+ explicit announce_entry (string_view u);\n+ announce_entry (announce_entry const&);\n+ announce_entry& operator= (announce_entry const&) &;\n+ announce_entry ();\n+ ~announce_entry ();\n+\n+ enum tracker_source\n+ {\n+ source_torrent,\n+ source_client,\n+ source_magnet_link,\n+ source_tex,\n+ };\n+\n+ std::string url;\n+ std::string trackerid;\n+ std::vector endpoints;\n+ std::uint8_t tier = 0;\n+ std::uint8_t fail_limit = 0;\n+ std::uint8_t source:4;\n+ bool verified:1;\n+};\n+ [report_issue]\n+***** ~announce_entry() announce_entry() operator=() *****\n+explicit announce_entry (string_view u);\n+announce_entry (announce_entry const&);\n+announce_entry& operator= (announce_entry const&) &;\n+announce_entry ();\n+~announce_entry ();\n+constructs a tracker announce entry with u as the URL.\n+[report_issue]\n+***** enum tracker_source *****\n+Declared in \"libtorrent/announce_entry.hpp\"\n+ ____________________________________________________________________________\n+|name______________|value|description________________________________________|\n+|source_torrent____|1____|the_tracker_was_part_of_the_.torrent_file__________|\n+|source_client |2 |the tracker was added programmatically via the |\n+|__________________|_____|add_tracker()_function_____________________________|\n+|source_magnet_link|4____|the_tracker_was_part_of_a_magnet_link______________|\n+|source_tex |8 |the tracker was received from the swarm via tracker|\n+|__________________|_____|exchange___________________________________________|\n+[report_issue]\n+ url\n+ tracker URL as it appeared in the torrent file\n+[report_issue]\n+ trackerid\n+ the current &trackerid= argument passed to the tracker. this is optional\n+ and is normally empty (in which case no trackerid is sent).\n+[report_issue]\n+ endpoints\n+ each local listen socket (endpoint) will announce to the tracker. This\n+ list contains state per endpoint.\n+[report_issue]\n+ tier\n+ the tier this tracker belongs to\n+[report_issue]\n+ fail_limit\n+ the max number of failures to announce to this tracker in a row, before\n+ this tracker is not used anymore. 0 means unlimited\n+[report_issue]\n+ source\n+ a bitmask specifying which sources we got this tracker from.\n+[report_issue]\n+ verified\n+ set to true the first time we receive a valid response from this tracker.\n+This section describes the functions and classes that are used to create\n+torrent files. It is a layered API with low level classes and higher level\n+convenience functions. A torrent is created in 4 steps:\n+ 1. first the files that will be part of the torrent are determined.\n+ 2. the torrent properties are set, such as tracker url, web seeds, DHT nodes\n+ etc.\n+ 3. Read through all the files in the torrent, SHA-1 all the data and set the\n+ piece hashes.\n+ 4. The torrent is bencoded into a file or buffer.\n+If there are a lot of files and or deep directory hierarchies to traverse, step\n+one can be time consuming.\n+Typically step 3 is by far the most time consuming step, since it requires to\n+read all the bytes from all the files in the torrent.\n+All of these classes and functions are declared by including libtorrent/\n+create_torrent.hpp.\n+example:\n+file_storage fs;\n+\n+// recursively adds files in directories\n+add_files(fs, \"./my_torrent\");\n+\n+create_torrent t(fs);\n+t.add_tracker(\"http://my.tracker.com/announce\");\n+t.set_creator(\"libtorrent example\");\n+\n+// reads the files and calculates the hashes\n+set_piece_hashes(t, \".\");\n+\n+ofstream out(\"my_torrent.torrent\", std::ios_base::binary);\n+std::vector buf = t.generate_buf();\n+out.write(buf.data(), buf.size());\n+\n+// alternatively, generate an entry and encode it directly to an ostream\n+// iterator\n+bencode(std::ostream_iterator(out), t.generate());\n+[report_issue]\n+****** create_torrent ******\n+Declared in \"libtorrent/create_torrent.hpp\"\n+This class holds state for creating a torrent. After having added all\n+information to it, call create_torrent::generate() to generate the torrent. The\n+entry that's returned can then be bencoded into a .torrent file using bencode\n+().\n+struct create_torrent\n+{\n+ explicit create_torrent (file_storage& fs, int piece_size = 0\n+ , create_flags_t flags = {});\n+ explicit create_torrent (torrent_info const& ti);\n+ entry generate () const;\n+ std::vector generate_buf () const;\n+ file_storage const& files () const;\n+ void set_comment (char const* str);\n+ void set_creator (char const* str);\n+ void set_creation_date (std::time_t timestamp);\n+ void set_hash (piece_index_t index, sha1_hash const& h);\n+ void set_hash2 (file_index_t file, piece_index_t::diff_type piece,\n+sha256_hash const& h);\n+ void add_http_seed (string_view url);\n+ void add_url_seed (string_view url);\n+ void add_node (std::pair node);\n+ void add_tracker (string_view url, int tier = 0);\n+ void set_root_cert (string_view cert);\n+ bool priv () const;\n+ void set_priv (bool p);\n+ bool is_v1_only () const;\n+ bool is_v2_only () const;\n+ int num_pieces () const;\n+ piece_index_t end_piece () const;\n+ index_range piece_range () const noexcept;\n+ file_index_t end_file () const;\n+ index_range file_range () const noexcept;\n+ index_range file_piece_range (file_index_t f);\n+ std::int64_t total_size () const;\n+ int piece_length () const;\n+ int piece_size (piece_index_t i) const;\n+ void add_collection (string_view c);\n+ void add_similar_torrent (sha1_hash ih);\n+\n+ static constexpr create_flags_t modification_time = 2_bit;\n+ static constexpr create_flags_t symlinks = 3_bit;\n+ static constexpr create_flags_t v2_only = 5_bit;\n+ static constexpr create_flags_t v1_only = 6_bit;\n+ static constexpr create_flags_t canonical_files = 7_bit;\n+ static constexpr create_flags_t no_attributes = 8_bit;\n+ static constexpr create_flags_t canonical_files_no_tail_padding = 9_bit;\n+};\n+[report_issue]\n+***** create_torrent() *****\n+explicit create_torrent (file_storage& fs, int piece_size = 0\n+ , create_flags_t flags = {});\n+explicit create_torrent (torrent_info const& ti);\n+The piece_size is the size of each piece in bytes. It must be a power of 2 and\n+a minimum of 16 kiB. If a piece size of 0 is specified, a piece_size will be\n+set automatically.\n+The flags arguments specifies options for the torrent creation. It can be any\n+combination of the flags defined by create_flags_t.\n+The file_storage (fs) parameter defines the files, sizes and their properties\n+for the torrent to be created. Set this up first, before passing it to the\n+create_torrent constructor.\n+The overload that takes a torrent_info object will make a verbatim copy of its\n+info dictionary (to preserve the info-hash). The copy of the info dictionary\n+will be used by create_torrent::generate(). This means that none of the member\n+functions of create_torrent that affects the content of the info dictionary\n+(such as set_hash()), will have any affect. Instead of using this overload,\n+consider using write_torrent_file() instead.\n+Warning\n+The file_storage and torrent_info objects must stay alive for the entire\n+duration of the create_torrent object.\n+ [report_issue]\n+***** generate() generate_buf() *****\n+entry generate () const;\n+std::vector generate_buf () const;\n+This function will generate the .torrent file as a bencode tree, or a bencoded\n+into a buffer. In order to encode the entry into a flat file, use the bencode()\n+function.\n+The function returning an entry may be useful to add custom entries to the\n+torrent file before bencoding it and saving it to disk.\n+Whether the resulting torrent object is v1, v2 or hybrid depends on whether any\n+of the v1_only or v2_only flags were set on the constructor. If neither were\n+set, the resulting torrent depends on which hashes were set. If both v1 and v2\n+hashes were set, a hybrid torrent is created.\n+Any failure will cause this function to throw system_error, with an appropriate\n+error message. These are the reasons this call may throw:\n+ * the file storage has 0 files\n+ * the total size of the file storage is 0 bytes (i.e. it only has empty\n+ files)\n+ * not all v1 hashes (set_hash()) and not all v2 hashes (set_hash2()) were\n+ set\n+ * for v2 torrents, you may not have a directory with the same name as a\n+ file. If that's encountered in the file storage, generate() fails.\n+[report_issue]\n+***** files() *****\n+file_storage const& files () const;\n+returns an immutable reference to the file_storage used to create the torrent\n+from.\n+[report_issue]\n+***** set_comment() *****\n+void set_comment (char const* str);\n+Sets the comment for the torrent. The string str should be utf-8 encoded. The\n+comment in a torrent file is optional.\n+[report_issue]\n+***** set_creator() *****\n+void set_creator (char const* str);\n+Sets the creator of the torrent. The string str should be utf-8 encoded. This\n+is optional.\n+[report_issue]\n+***** set_creation_date() *****\n+void set_creation_date (std::time_t timestamp);\n+sets the \"creation time\" field. Defaults to the system clock at the time of\n+construction of the create_torrent object. The timestamp is specified in\n+seconds, posix time. If the creation date is set to 0, the \"creation date\"\n+field will be omitted from the generated torrent.\n+[report_issue]\n+***** set_hash() *****\n+void set_hash (piece_index_t index, sha1_hash const& h);\n+This sets the SHA-1 hash for the specified piece (index). You are required to\n+set the hash for every piece in the torrent before generating it. If you have\n+the files on disk, you can use the high level convenience function to do this.\n+See set_piece_hashes(). A SHA-1 hash of all zeros is internally used to\n+indicate a hash that has not been set. Setting such hash will not be considered\n+set when calling generate(). This function will throw std::system_error if it\n+is called on an object constructed with the v2_only flag.\n+[report_issue]\n+***** set_hash2() *****\n+void set_hash2 (file_index_t file, piece_index_t::diff_type piece, sha256_hash\n+const& h);\n+sets the bittorrent v2 hash for filefileof the piecepiece.pieceis relative to\n+the first piece of the file, starting at 0. The first piece in the file can be\n+computed with file_storage::file_index_at_piece(). The hash,h, is the root of\n+the merkle tree formed by the piece's 16 kiB blocks. Note that piece sizes must\n+be powers-of-2, so all per-piece merkle trees are complete. A SHA-256 hash of\n+all zeros is internally used to indicate a hash that has not been set. Setting\n+such hash will not be considered set when calling generate(). This function\n+will throw std::system_error if it is called on an object constructed with the\n+v1_only flag.\n+ [report_issue]\n+***** add_http_seed() add_url_seed() *****\n+void add_http_seed (string_view url);\n+void add_url_seed (string_view url);\n+This adds a url seed to the torrent. You can have any number of url seeds. For\n+a single file torrent, this should be an HTTP url, pointing to a file with\n+identical content as the file of the torrent. For a multi-file torrent, it\n+should point to a directory containing a directory with the same name as this\n+torrent, and all the files of the torrent in it.\n+The second function, add_http_seed() adds an HTTP seed instead.\n+[report_issue]\n+***** add_node() *****\n+void add_node (std::pair node);\n+This adds a DHT node to the torrent. This especially useful if you're creating\n+a tracker less torrent. It can be used by clients to bootstrap their DHT node\n+from. The node is a hostname and a port number where there is a DHT node\n+running. You can have any number of DHT nodes in a torrent.\n+[report_issue]\n+***** add_tracker() *****\n+void add_tracker (string_view url, int tier = 0);\n+Adds a tracker to the torrent. This is not strictly required, but most torrents\n+use a tracker as their main source of peers. The url should be an http:// or\n+udp:// url to a machine running a bittorrent tracker that accepts announces for\n+this torrent's info-hash. The tier is the fallback priority of the tracker. All\n+trackers with tier 0 are tried first (in any order). If all fail, trackers with\n+tier 1 are tried. If all of those fail, trackers with tier 2 are tried, and so\n+on.\n+[report_issue]\n+***** set_root_cert() *****\n+void set_root_cert (string_view cert);\n+This function sets an X.509 certificate in PEM format to the torrent. This\n+makes the torrent an SSL torrent. An SSL torrent requires that each peer has a\n+valid certificate signed by this root certificate. For SSL torrents, all peers\n+are connecting over SSL connections. For more information, see the section on\n+ssl_torrents.\n+The string is not the path to the cert, it's the actual content of the\n+certificate.\n+ [report_issue]\n+***** priv() set_priv() *****\n+bool priv () const;\n+void set_priv (bool p);\n+Sets and queries the private flag of the torrent. Torrents with the private\n+flag set ask the client to not use any other sources than the tracker for\n+peers, and to not use DHT to advertise itself publicly, only the tracker.\n+[report_issue]\n+***** num_pieces() *****\n+int num_pieces () const;\n+returns the number of pieces in the associated file_storage object.\n+[report_issue]\n+***** piece_range() *****\n+index_range piece_range () const noexcept;\n+all piece indices in the torrent to be created\n+[report_issue]\n+***** file_range() *****\n+index_range file_range () const noexcept;\n+all file indices in the torrent to be created\n+[report_issue]\n+***** file_piece_range() *****\n+index_range file_piece_range (file_index_t f);\n+for v2 and hybrid torrents only, the pieces in the specified file, specified as\n+delta from the first piece in the file. i.e. the first index is 0.\n+[report_issue]\n+***** total_size() *****\n+std::int64_t total_size () const;\n+the total number of bytes of all files and pad files\n+ [report_issue]\n+***** piece_size() piece_length() *****\n+int piece_length () const;\n+int piece_size (piece_index_t i) const;\n+piece_length() returns the piece size of all pieces but the last one.\n+piece_size() returns the size of the specified piece. these functions are just\n+forwarding to the associated file_storage.\n+ [report_issue]\n+***** add_similar_torrent() add_collection() *****\n+void add_collection (string_view c);\n+void add_similar_torrent (sha1_hash ih);\n+Add similar torrents (by info-hash) or collections of similar torrents. Similar\n+torrents are expected to share some files with this torrent. Torrents sharing a\n+collection name with this torrent are also expected to share files with this\n+torrent. A torrent may have more than one collection and more than one similar\n+torrents. For more information, see BEP_38.\n+[report_issue]\n+ modification_time\n+ This will include the file modification time as part of the torrent. This\n+ is not enabled by default, as it might cause problems when you create a\n+ torrent from separate files with the same content, hoping to yield the\n+ same info-hash. If the files have different modification times, with this\n+ option enabled, you would get different info-hashes for the files.\n+[report_issue]\n+ symlinks\n+ If this flag is set, files that are symlinks get a symlink attribute set\n+ on them and their data will not be included in the torrent. This is\n+ useful if you need to reconstruct a file hierarchy which contains\n+ symlinks.\n+[report_issue]\n+ v2_only\n+ Do not generate v1 metadata. The resulting torrent will only be usable by\n+ clients which support v2. This requires setting all v2 hashes, with\n+ set_hash2() before calling generate(). Setting v1 hashes (with set_hash\n+ ()) is an error with this flag set.\n+[report_issue]\n+ v1_only\n+ do not generate v2 metadata or enforce v2 alignment and padding rules\n+ this is mainly for tests, not recommended for production use. This\n+ requires setting all v1 hashes, with set_hash(), before calling generate\n+ (). Setting v2 hashes (with set_hash2()) is an error with this flag set.\n+[report_issue]\n+ canonical_files\n+ This flag only affects v1-only torrents, and is only relevant together\n+ with the v1_only_flag. This flag will force the same file order and\n+ padding as a v2 (or hybrid) torrent would have. It has the effect of\n+ ordering files and inserting pad files to align them with piece\n+ boundaries.\n+[report_issue]\n+ no_attributes\n+ passing this flag to add_files() will ignore file attributes (such as\n+ executable or hidden) when adding the files to the file storage. Since\n+ not all filesystems and operating systems support all file attributes the\n+ resulting torrent may differ depending on where it's created. If it's\n+ important for torrents to be created consistently across systems, this\n+ flag should be set.\n+[report_issue]\n+ canonical_files_no_tail_padding\n+ this flag enforces the file layout to be canonical according to the\n+ bittorrent v2 specification (just like the canonical_files flag) with the\n+ one exception that tail padding is not added to the last file. This\n+ behavior deviates from the specification but was the way libtorrent\n+ created torrents in version up to and including 2.0.7. This flag is here\n+ for backwards compatibility.\n+[report_issue]\n+****** add_files() ******\n+Declared in \"libtorrent/create_torrent.hpp\"\n+void add_files (file_storage& fs, std::string const& file\n+ , create_flags_t flags = {});\n+void add_files (file_storage& fs, std::string const& file\n+ , std::function p, create_flags_t flags = {});\n+Adds the file specified by path to the file_storage object. In case path refers\n+to a directory, files will be added recursively from the directory.\n+If specified, the predicate p is called once for every file and directory that\n+is encountered. Files for which p returns true are added, and directories for\n+which p returns true are traversed. p must have the following signature:\n+bool Pred(std::string const& p);\n+The path that is passed in to the predicate is the full path of the file or\n+directory. If no predicate is specified, all files are added, and all\n+directories are traversed.\n+The \"..\" directory is never traversed.\n+The flags argument should be the same as the flags passed to the create_torrent\n+constructor.\n+[report_issue]\n+****** set_piece_hashes() ******\n+Declared in \"libtorrent/create_torrent.hpp\"\n+void set_piece_hashes (create_torrent& t, std::string const& p\n+ , settings_interface const& settings, disk_io_constructor_type disk_io\n+ , std::function const& f, error_code& ec);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p\n+ , settings_interface const& settings\n+ , std::function const& f);\n+void set_piece_hashes (create_torrent& t, std::string const& p\n+ , settings_interface const& settings\n+ , std::function const& f, error_code& ec);\n+void set_piece_hashes (create_torrent& t, std::string const& p\n+ , std::function const& f, error_code& ec);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p\n+ , std::function const& f);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p);\n+inline void set_piece_hashes (create_torrent& t, std::string const& p,\n+error_code& ec);\n+This function will assume that the files added to the torrent file exists at\n+path p, read those files and hash the content and set the hashes in the\n+create_torrent object. The optional function f is called in between every hash\n+that is set. f must have the following signature:\n+void Fun(piece_index_t);\n+The overloads taking a settings_pack may be used to configure the underlying\n+disk access. Such as settings_pack::aio_threads.\n+The overloads that don't take an error_code& may throw an exception in case of\n+a file error, the other overloads sets the error code to reflect the error, if\n+any.\n [report_issue]\n ****** block_info ******\n Declared in \"libtorrent/torrent_handle.hpp\"\n holds the state of a block in a piece. Who we requested it from and how far\n along we are at downloading it.\n struct block_info\n {\n- void set_peer (tcp::endpoint const& ep);\n tcp::endpoint peer () const;\n+ void set_peer (tcp::endpoint const& ep);\n \n enum block_state_t\n {\n none,\n requested,\n writing,\n finished,\n@@ -10722,17 +11183,17 @@\n \n unsigned bytes_progress:15;\n unsigned block_size:15;\n unsigned state:2;\n unsigned num_peers:14;\n };\n [report_issue]\n-***** peer() set_peer() *****\n-void set_peer (tcp::endpoint const& ep);\n+***** set_peer() peer() *****\n tcp::endpoint peer () const;\n+void set_peer (tcp::endpoint const& ep);\n The peer is the ip address of the peer this block was downloaded from.\n [report_issue]\n ***** enum block_state_t *****\n Declared in \"libtorrent/torrent_handle.hpp\"\n ___________________________________________________________________________\n |name_____|value|description________________________________________________|\n |none |0 |This block has not been downloaded or requested form any |\n@@ -10819,110 +11280,110 @@\n the handle is no longer referring to a torrent. There is one exception is_valid\n () will never throw. Since the torrents are processed by a background thread,\n there is no guarantee that a handle will remain valid between two calls.\n struct torrent_handle\n {\n friend std::size_t hash_value (torrent_handle const& th);\n torrent_handle () noexcept = default;\n- void add_piece (piece_index_t piece, std::vector data,\n-add_piece_flags_t flags = {}) const;\n void add_piece (piece_index_t piece, char const* data, add_piece_flags_t\n flags = {}) const;\n+ void add_piece (piece_index_t piece, std::vector data,\n+add_piece_flags_t flags = {}) const;\n void read_piece (piece_index_t piece) const;\n bool have_piece (piece_index_t piece) const;\n void get_peer_info (std::vector& v) const;\n torrent_status status (status_flags_t flags = status_flags_t::all()) const;\n- std::vector get_download_queue () const;\n void get_download_queue (std::vector& queue) const;\n- void reset_piece_deadline (piece_index_t index) const;\n- void clear_piece_deadlines () const;\n+ std::vector get_download_queue () const;\n void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t\n flags = {}) const;\n- std::vector file_progress (file_progress_flags_t flags = {})\n-const;\n+ void clear_piece_deadlines () const;\n+ void reset_piece_deadline (piece_index_t index) const;\n void file_progress (std::vector& progress,\n file_progress_flags_t flags = {}) const;\n+ std::vector file_progress (file_progress_flags_t flags = {})\n+const;\n std::vector file_status () const;\n void clear_error () const;\n void add_tracker (announce_entry const&) const;\n- void replace_trackers (std::vector const&) const;\n std::vector trackers () const;\n+ void replace_trackers (std::vector const&) const;\n void remove_url_seed (std::string const& url) const;\n std::set url_seeds () const;\n void add_url_seed (std::string const& url) const;\n- void add_http_seed (std::string const& url) const;\n- std::set http_seeds () const;\n void remove_http_seed (std::string const& url) const;\n+ std::set http_seeds () const;\n+ void add_http_seed (std::string const& url) const;\n void add_extension (\n std::function(torrent_handle const&,\n client_data_t)> const& ext\n , client_data_t userdata = client_data_t{});\n bool set_metadata (span metadata) const;\n bool is_valid () const;\n void resume () const;\n void pause (pause_flags_t flags = {}) const;\n- void set_flags (torrent_flags_t flags) const;\n void unset_flags (torrent_flags_t flags) const;\n void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;\n torrent_flags_t flags () const;\n+ void set_flags (torrent_flags_t flags) const;\n void flush_cache () const;\n void force_recheck () const;\n void save_resume_data (resume_data_flags_t flags = {}) const;\n bool need_save_resume_data () const;\n- void queue_position_down () const;\n- queue_position_t queue_position () const;\n void queue_position_bottom () const;\n- void queue_position_top () const;\n void queue_position_up () const;\n+ void queue_position_top () const;\n+ queue_position_t queue_position () const;\n+ void queue_position_down () const;\n void queue_position_set (queue_position_t p) const;\n+ void set_ssl_certificate_buffer (std::string const& certificate\n+ , std::string const& private_key\n+ , std::string const& dh_params);\n void set_ssl_certificate (std::string const& certificate\n , std::string const& private_key\n , std::string const& dh_params\n , std::string const& passphrase = \"\");\n- void set_ssl_certificate_buffer (std::string const& certificate\n- , std::string const& private_key\n- , std::string const& dh_params);\n std::shared_ptr torrent_file () const;\n std::shared_ptr torrent_file_with_hashes () const;\n std::vector> piece_layers () const;\n void piece_availability (std::vector& avail) const;\n std::vector get_piece_priorities () const;\n void piece_priority (piece_index_t index, download_priority_t priority)\n const;\n- void prioritize_pieces (std::vector> const& pieces) const;\n download_priority_t piece_priority (piece_index_t index) const;\n void prioritize_pieces (std::vector const& pieces)\n const;\n- void file_priority (file_index_t index, download_priority_t priority) const;\n+ void prioritize_pieces (std::vector> const& pieces) const;\n std::vector get_file_priorities () const;\n+ void file_priority (file_index_t index, download_priority_t priority) const;\n void prioritize_files (std::vector const& files) const;\n download_priority_t file_priority (file_index_t index) const;\n- void force_lsd_announce () const;\n void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t =\n {}) const;\n void force_dht_announce () const;\n+ void force_lsd_announce () const;\n void scrape_tracker (int idx = -1) const;\n- int download_limit () const;\n- void set_upload_limit (int limit) const;\n void set_download_limit (int limit) const;\n+ void set_upload_limit (int limit) const;\n+ int download_limit () const;\n int upload_limit () const;\n void connect_peer (tcp::endpoint const& adr, peer_source_flags_t source = {}\n , pex_flags_t flags = pex_encryption | pex_utp | pex_holepunch) const;\n void clear_peers ();\n int max_uploads () const;\n void set_max_uploads (int max_uploads) const;\n int max_connections () const;\n void set_max_connections (int max_connections) const;\n void move_storage (std::string const& save_path\n , move_flags_t flags = move_flags_t::always_replace_files\n ) const;\n void rename_file (file_index_t index, std::string const& new_name) const;\n- sha1_hash info_hash () const;\n info_hash_t info_hashes () const;\n+ sha1_hash info_hash () const;\n bool operator< (const torrent_handle& h) const;\n bool operator== (const torrent_handle& h) const;\n bool operator!= (const torrent_handle& h) const;\n std::uint32_t id () const;\n std::shared_ptr native_handle () const;\n client_data_t userdata () const;\n bool in_session () const;\n@@ -10947,18 +11408,18 @@\n [report_issue]\n ***** torrent_handle() *****\n torrent_handle () noexcept = default;\n constructs a torrent handle that does not refer to a torrent. i.e. is_valid()\n will return false.\n [report_issue]\n ***** add_piece() *****\n-void add_piece (piece_index_t piece, std::vector data, add_piece_flags_t\n-flags = {}) const;\n void add_piece (piece_index_t piece, char const* data, add_piece_flags_t flags\n = {}) const;\n+void add_piece (piece_index_t piece, std::vector data, add_piece_flags_t\n+flags = {}) const;\n This function will write data to the storage as piece piece, as if it had been\n downloaded from a peer.\n By default, data that's already been downloaded is not overwritten by this\n buffer. If you trust this data to be correct (and pass the piece hash check)\n you may pass the overwrite_existing flag. This will instruct libtorrent to\n overwrite any data that may already have been downloaded with this data.\n Since the data is written asynchronously, you may know that is passed or failed\n@@ -11005,25 +11466,25 @@\n returned in the torrent_status. Some information in there is relatively\n expensive to calculate, and if you're not interested in it (and see performance\n issues), you can filter them out.\n By default everything is included. The flags you can use to decide what to\n include are defined in this class.\n [report_issue]\n ***** get_download_queue() *****\n-std::vector get_download_queue () const;\n void get_download_queue (std::vector& queue) const;\n+std::vector get_download_queue () const;\n get_download_queue() returns a vector with information about pieces that are\n partially downloaded or not downloaded but partially requested. See\n partial_piece_info for the fields in the returned vector.\n [report_issue]\n-***** clear_piece_deadlines() set_piece_deadline() reset_piece_deadline() *****\n-void reset_piece_deadline (piece_index_t index) const;\n-void clear_piece_deadlines () const;\n+***** reset_piece_deadline() set_piece_deadline() clear_piece_deadlines() *****\n void set_piece_deadline (piece_index_t index, int deadline, deadline_flags_t\n flags = {}) const;\n+void clear_piece_deadlines () const;\n+void reset_piece_deadline (piece_index_t index) const;\n This function sets or resets the deadline associated with a specific piece\n index (index). libtorrent will attempt to download this entire piece before the\n deadline expires. This is not necessarily possible, but pieces with a more\n recent deadline will always be prioritized over pieces with a deadline further\n ahead in time. The deadline (and flags) of a piece can be changed by calling\n this function again.\n If the piece is already downloaded when this call is made, nothing happens,\n@@ -11032,18 +11493,18 @@\n deadline is the number of milliseconds until this piece should be completed.\n reset_piece_deadline removes the deadline from the piece. If it hasn't already\n been downloaded, it will no longer be considered a priority.\n clear_piece_deadlines() removes deadlines on all pieces in the torrent. As if\n reset_piece_deadline() was called on all pieces.\n [report_issue]\n ***** file_progress() *****\n-std::vector file_progress (file_progress_flags_t flags = {})\n-const;\n void file_progress (std::vector& progress, file_progress_flags_t\n flags = {}) const;\n+std::vector file_progress (file_progress_flags_t flags = {})\n+const;\n This function fills in the supplied vector, or returns a vector, with the\n number of bytes downloaded of each file in this torrent. The progress values\n are ordered the same as the files in the torrent_info.\n This operation is not very cheap. Its complexity is O(n + mj). Where n is the\n number of files, m is the number of currently downloading pieces and j is the\n number of blocks in a piece.\n The flags parameter can be used to specify the granularity of the file\n@@ -11066,46 +11527,46 @@\n ***** clear_error() *****\n void clear_error () const;\n If the torrent is in an error state (i.e. torrent_status::error is non-empty),\n this will clear the error and start the torrent again.\n [report_issue]\n ***** trackers() replace_trackers() add_tracker() *****\n void add_tracker (announce_entry const&) const;\n-void replace_trackers (std::vector const&) const;\n std::vector trackers () const;\n+void replace_trackers (std::vector const&) const;\n trackers() will return the list of trackers for this torrent. The announce\n entry contains both a string url which specify the announce url for the tracker\n as well as an int tier, which is specifies the order in which this tracker is\n tried. If you want libtorrent to use another list of trackers for this torrent,\n you can use replace_trackers() which takes a list of the same form as the one\n returned from trackers() and will replace it. If you want an immediate effect,\n you have to call force_reannounce(). See announce_entry.\n add_tracker() will look if the specified tracker is already in the set. If it\n is, it doesn't do anything. If it's not in the current set of trackers, it will\n insert it in the tier specified in the announce_entry.\n The updated set of trackers will be saved in the resume data, and when a\n torrent is started with resume data, the trackers from the resume data will\n replace the original ones.\n [report_issue]\n-***** add_url_seed() url_seeds() remove_url_seed() *****\n+***** remove_url_seed() url_seeds() add_url_seed() *****\n void remove_url_seed (std::string const& url) const;\n std::set url_seeds () const;\n void add_url_seed (std::string const& url) const;\n add_url_seed() adds another url to the torrent's list of url seeds. If the\n given url already exists in that list, the call has no effect. The torrent will\n connect to the server and try to download pieces from it, unless it's paused,\n queued, checking or seeding. remove_url_seed() removes the given url if it\n exists already. url_seeds() return a set of the url seeds currently in this\n torrent. Note that URLs that fails may be removed automatically from the list.\n See http_seeding for more information.\n [report_issue]\n ***** http_seeds() add_http_seed() remove_http_seed() *****\n-void add_http_seed (std::string const& url) const;\n-std::set http_seeds () const;\n void remove_http_seed (std::string const& url) const;\n+std::set http_seeds () const;\n+void add_http_seed (std::string const& url) const;\n These functions are identical as the *_url_seed() variants, but they operate on\n BEP_17 web seeds instead of BEP_19.\n See http_seeding for more information.\n [report_issue]\n ***** add_extension() *****\n void add_extension (\n std::function(torrent_handle const&,\n@@ -11136,15 +11597,15 @@\n and false afterward.\n Clients should only use is_valid() to determine if the result of session::\n find_torrent() was successful.\n Unlike other member functions which return a value, is_valid() completes\n immediately, without blocking on a result from the network thread. Also unlike\n other functions, it never throws the system_error exception.\n [report_issue]\n-***** resume() pause() *****\n+***** pause() resume() *****\n void resume () const;\n void pause (pause_flags_t flags = {}) const;\n pause(), and resume() will disconnect all peers and reconnect all peers\n respectively. When a torrent is paused, it will however remember all share\n ratios to all peers and remember all potential (not connected) peers. Torrents\n may be paused automatically if there is a file error (e.g. disk full) or\n something similar. See file_error_alert.\n@@ -11153,19 +11614,19 @@\n for the torrent_status::paused flag.\n Note\n Torrents that are auto-managed may be automatically resumed again. It does not\n make sense to pause an auto-managed torrent without making it not auto-managed\n first. Torrents are auto-managed by default when added to the session. For more\n information, see queuing.\n [report_issue]\n-***** set_flags() unset_flags() flags() *****\n-void set_flags (torrent_flags_t flags) const;\n+***** unset_flags() set_flags() flags() *****\n void unset_flags (torrent_flags_t flags) const;\n void set_flags (torrent_flags_t flags, torrent_flags_t mask) const;\n torrent_flags_t flags () const;\n+void set_flags (torrent_flags_t flags) const;\n sets and gets the torrent state flags. See torrent_flags_t. The set_flags\n overload that take a mask will affect all flags part of the mask, and set their\n values to what the flags argument is set to. This allows clearing and setting\n flags in a single function call. The set_flags overload that just takes flags,\n sets all the specified flags and leave any other flags unchanged. unset_flags\n clears the specified flags, while leaving any other flags unchanged.\n Theseed_modeflag is special, it can only be cleared once the torrent has been\n@@ -11285,21 +11746,21 @@\n saving resume data periodically, it makes sense to skip any torrent which\n hasn't downloaded anything since the last time.\n Note\n A torrent's resume data is considered saved as soon as the\n save_resume_data_alert is posted. It is important to make sure this alert is\n received and handled in order for this function to be meaningful.\n [report_issue]\n-***** queue_position() queue_position_bottom() queue_position_up()\n-queue_position_top() queue_position_down() *****\n-void queue_position_down () const;\n-queue_position_t queue_position () const;\n+***** queue_position_down() queue_position() queue_position_up()\n+queue_position_bottom() queue_position_top() *****\n void queue_position_bottom () const;\n-void queue_position_top () const;\n void queue_position_up () const;\n+void queue_position_top () const;\n+queue_position_t queue_position () const;\n+void queue_position_down () const;\n Every torrent that is added is assigned a queue position exactly one greater\n than the greatest queue position of all existing torrents. Torrents that are\n being seeded have -1 as their queue position, since they're no longer in line\n to be downloaded.\n When a torrent is removed or turns into a seed, all torrents with greater queue\n positions have their positions decreased to fill in the space in the sequence.\n queue_position() returns the torrent's position in the download queue. The\n@@ -11313,22 +11774,22 @@\n [report_issue]\n ***** queue_position_set() *****\n void queue_position_set (queue_position_t p) const;\n updates the position in the queue for this torrent. The relative order of all\n other torrents remain intact but their numerical queue position shifts to make\n space for this torrent's new position\n [report_issue]\n-***** set_ssl_certificate_buffer() set_ssl_certificate() *****\n+***** set_ssl_certificate() set_ssl_certificate_buffer() *****\n+void set_ssl_certificate_buffer (std::string const& certificate\n+ , std::string const& private_key\n+ , std::string const& dh_params);\n void set_ssl_certificate (std::string const& certificate\n , std::string const& private_key\n , std::string const& dh_params\n , std::string const& passphrase = \"\");\n-void set_ssl_certificate_buffer (std::string const& certificate\n- , std::string const& private_key\n- , std::string const& dh_params);\n For SSL torrents, use this to specify a path to a .pem file to use as this\n client's certificate. The certificate must be signed by the certificate in the\n .torrent file to be valid.\n The set_ssl_certificate_buffer() overload takes the actual certificate, private\n key and DH params as strings, rather than paths to files.\n cert is a path to the (signed) certificate in .pem format corresponding to this\n torrent.\n@@ -11342,15 +11803,15 @@\n Note that when a torrent first starts up, and it needs a certificate, it will\n suspend connecting to any peers until it has one. It's typically desirable to\n resume the torrent after setting the SSL certificate.\n If you receive a torrent_need_cert_alert, you need to call this to provide a\n valid cert. If you don't have a cert you won't be allowed to connect to any\n peers.\n [report_issue]\n-***** torrent_file_with_hashes() torrent_file() *****\n+***** torrent_file() torrent_file_with_hashes() *****\n std::shared_ptr torrent_file () const;\n std::shared_ptr torrent_file_with_hashes () const;\n torrent_file() returns a pointer to the torrent_info object associated with\n this torrent. The torrent_info object may be a copy of the internal object. If\n the torrent doesn't have metadata, the pointer will not be initialized (i.e. a\n nullptr). The torrent may be in a state without metadata only if it was started\n without a .torrent file, e.g. by being added by magnet link.\n@@ -11390,18 +11851,18 @@\n The piece availability is the number of peers that we are connected that has\n advertised having a particular piece. This is the information that libtorrent\n uses in order to prefer picking rare pieces.\n [report_issue]\n ***** piece_priority() get_piece_priorities() prioritize_pieces() *****\n std::vector get_piece_priorities () const;\n void piece_priority (piece_index_t index, download_priority_t priority) const;\n-void prioritize_pieces (std::vector> const& pieces) const;\n download_priority_t piece_priority (piece_index_t index) const;\n void prioritize_pieces (std::vector const& pieces) const;\n+void prioritize_pieces (std::vector> const& pieces) const;\n These functions are used to set and get the priority of individual pieces. By\n default all pieces have priority 4. That means that the random rarest first\n algorithm is effectively active for all pieces. You may however change the\n priority of individual pieces. There are 8 priority levels. 0 means not to\n download the piece at all. Otherwise, lower priority values means less likely\n to be picked. Piece priority takes precedence over piece availability. Every\n piece with priority 7 will be attempted to be picked before a priority 6 piece\n@@ -11421,17 +11882,17 @@\n where the piece index or priority is out of range, are not allowed.\n get_piece_priorities returns a vector with one element for each piece in the\n torrent. Each element is the current priority of that piece.\n It's possible to cancel the effect of file priorities by setting the priorities\n for the affected pieces. Care has to be taken when mixing usage of file- and\n piece priorities.\n [report_issue]\n-***** prioritize_files() file_priority() get_file_priorities() *****\n-void file_priority (file_index_t index, download_priority_t priority) const;\n+***** file_priority() get_file_priorities() prioritize_files() *****\n std::vector get_file_priorities () const;\n+void file_priority (file_index_t index, download_priority_t priority) const;\n void prioritize_files (std::vector const& files) const;\n download_priority_t file_priority (file_index_t index) const;\n index must be in the range [0, number_of_files).\n file_priority() queries or sets the priority of file index.\n prioritize_files() takes a vector that has at as many elements as there are\n files in the torrent. Each entry is the priority of that file. The function\n sets the priorities of all the pieces in the torrent based on the vector.\n@@ -11452,19 +11913,19 @@\n When combining file- and piece priorities, the resume file will record both.\n When loading the resume data, the file priorities will be applied first, then\n the piece priorities.\n Moving data from a file into the part file is currently not supported. If a\n file has its priority set to 0 after it has already been created, it will not\n be moved into the partfile.\n [report_issue]\n-***** force_dht_announce() force_reannounce() force_lsd_announce() *****\n-void force_lsd_announce () const;\n+***** force_reannounce() force_lsd_announce() force_dht_announce() *****\n void force_reannounce (int seconds = 0, int idx = -1, reannounce_flags_t = {})\n const;\n void force_dht_announce () const;\n+void force_lsd_announce () const;\n force_reannounce() will force this torrent to do another tracker request, to\n receive new peers. The seconds argument specifies how many seconds from now to\n issue the tracker announces.\n If the tracker's min_interval has not passed since the last announce, the\n forced announce will be scheduled to happen immediately as the min_interval\n expires. This is to honor trackers minimum re-announce interval settings.\n The tracker_index argument specifies which tracker to re-announce. If set to -\n@@ -11482,19 +11943,19 @@\n A scrape request queries the tracker for statistics such as total number of\n incomplete peers, complete peers, number of downloads etc.\n This request will specifically update the num_complete and num_incomplete\n fields in the torrent_status struct once it completes. When it completes, it\n will generate a scrape_reply_alert. If it fails, it will generate a\n scrape_failed_alert.\n [report_issue]\n-***** download_limit() set_download_limit() set_upload_limit() upload_limit()\n+***** download_limit() set_upload_limit() set_download_limit() upload_limit()\n *****\n-int download_limit () const;\n-void set_upload_limit (int limit) const;\n void set_download_limit (int limit) const;\n+void set_upload_limit (int limit) const;\n+int download_limit () const;\n int upload_limit () const;\n set_upload_limit will limit the upload bandwidth used by this particular\n torrent to the limit you set. It is given as the number of bytes per second the\n torrent is allowed to upload. set_download_limit works the same way but for\n download bandwidth instead of upload bandwidth. Note that setting a higher\n limit on a torrent then the global limit (settings_pack::upload_rate_limit)\n will not override the global rate limit. The torrent can never upload more than\n@@ -11527,15 +11988,15 @@\n void set_max_uploads (int max_uploads) const;\n set_max_uploads() sets the maximum number of peers that's unchoked at the same\n time on this torrent. If you set this to -1, there will be no limit. This\n defaults to infinite. The primary setting controlling this is the global\n unchoke slots limit, set by unchoke_slots_limit in settings_pack.\n max_uploads() returns the current settings.\n [report_issue]\n-***** max_connections() set_max_connections() *****\n+***** set_max_connections() max_connections() *****\n int max_connections () const;\n void set_max_connections (int max_connections) const;\n set_max_connections() sets the maximum number of connection this torrent will\n open. If all connections are used up, incoming connections may be refused or\n poor connections may be closed. This must be at least 2. The default is\n unlimited number of connections. If -1 is given to the function, it means\n unlimited. There is also a global limit of the number of connections, set by\n@@ -11587,17 +12048,17 @@\n [report_issue]\n ***** rename_file() *****\n void rename_file (file_index_t index, std::string const& new_name) const;\n Renames the file with the given index asynchronously. The rename operation is\n complete when either a file_renamed_alert or file_rename_failed_alert is\n posted.\n [report_issue]\n-***** info_hash() info_hashes() *****\n-sha1_hash info_hash () const;\n+***** info_hashes() info_hash() *****\n info_hash_t info_hashes () const;\n+sha1_hash info_hash () const;\n returns the info-hash(es) of the torrent. If this handle is to a torrent that\n hasn't loaded yet (for instance by being added) by a URL, the returned value is\n undefined. The info_hash() returns the SHA-1 info-hash for v1 torrents and a\n truncated hash for v2 torrents. For the full v2 info-hash, use info_hashes()\n instead.\n [report_issue]\n ***** operator!=() operator<() operator==() *****\n@@ -11714,774 +12175,14 @@\n is announced immediately.\n [report_issue]\n ****** hash_value() ******\n Declared in \"libtorrent/torrent_handle.hpp\"\n std::size_t hash_value (torrent_handle const& h);\n for std::hash (and to support using this type in unordered_map etc.)\n [report_issue]\n-****** storage_error ******\n-Declared in \"libtorrent/error_code.hpp\"\n-used by storage to return errors also includes which underlying file the error\n-happened on\n-struct storage_error\n-{\n- explicit operator bool () const;\n- void file (file_index_t f);\n- file_index_t file () const;\n-\n- error_code ec;\n- operation_t operation;\n-};\n-[report_issue]\n-***** bool() *****\n-explicit operator bool () const;\n-explicitly converts to true if this object represents an error, and false if it\n-does not.\n-[report_issue]\n-***** file() *****\n-void file (file_index_t f);\n-file_index_t file () const;\n-set and query the index (in the torrent) of the file this error occurred on.\n-This may also have special values defined in torrent_status.\n-[report_issue]\n- ec\n- the error that occurred\n-[report_issue]\n- operation\n- A code from operation_t enum, indicating what kind of operation failed.\n-[report_issue]\n-****** bdecode_category() ******\n-Declared in \"libtorrent/bdecode.hpp\"\n-boost::system::error_category& bdecode_category ();\n-[report_issue]\n-****** i2p_category() ******\n-Declared in \"libtorrent/i2p_stream.hpp\"\n-boost::system::error_category& i2p_category ();\n-returns the error category for I2P errors\n-[report_issue]\n-****** socks_category() ******\n-Declared in \"libtorrent/socks5_stream.hpp\"\n-boost::system::error_category& socks_category ();\n-returns the error_category for SOCKS5 errors\n-[report_issue]\n-****** pcp_category() ******\n-Declared in \"libtorrent/natpmp.hpp\"\n-boost::system::error_category& pcp_category ();\n-[report_issue]\n-****** upnp_category() ******\n-Declared in \"libtorrent/upnp.hpp\"\n-boost::system::error_category& upnp_category ();\n-the boost.system error category for UPnP errors\n-[report_issue]\n-****** libtorrent_category() ******\n-Declared in \"libtorrent/error_code.hpp\"\n-boost::system::error_category& libtorrent_category ();\n-return the instance of the libtorrent_error_category which maps libtorrent\n-error codes to human readable error messages.\n-[report_issue]\n-****** http_category() ******\n-Declared in \"libtorrent/error_code.hpp\"\n-boost::system::error_category& http_category ();\n-returns the error_category for HTTP errors\n-[report_issue]\n-****** gzip_category() ******\n-Declared in \"libtorrent/gzip.hpp\"\n-boost::system::error_category& gzip_category ();\n-get the error_category for zip errors\n-[report_issue]\n-****** enum error_code_enum ******\n-Declared in \"libtorrent/bdecode.hpp\"\n- ___________________________________________________________________________\n-|name__________|value|description___________________________________________|\n-|no_error______|0____|Not_an_error__________________________________________|\n-|expected_digit|1____|expected_digit_in_bencoded_string_____________________|\n-|expected_colon|2____|expected_colon_in_bencoded_string_____________________|\n-|unexpected_eof|3____|unexpected_end_of_file_in_bencoded_string_____________|\n-|expected_value|4 |expected value (list, dict, int or string) in bencoded|\n-|______________|_____|string________________________________________________|\n-|depth_exceeded|5____|bencoded_recursion_depth_limit_exceeded_______________|\n-|limit_exceeded|6____|bencoded_item_count_limit_exceeded____________________|\n-|overflow______|7____|integer_overflow______________________________________|\n-|error_code_max|8____|the_number_of_error_codes_____________________________|\n-[report_issue]\n-****** enum i2p_error_code ******\n-Declared in \"libtorrent/i2p_stream.hpp\"\n- _________________________________\n-|name___________|value|description|\n-|no_error_______|0____|\u00a0_________|\n-|parse_failed___|1____|\u00a0_________|\n-|cant_reach_peer|2____|\u00a0_________|\n-|i2p_error______|3____|\u00a0_________|\n-|invalid_key____|4____|\u00a0_________|\n-|invalid_id_____|5____|\u00a0_________|\n-|timeout________|6____|\u00a0_________|\n-|key_not_found__|7____|\u00a0_________|\n-|duplicated_id__|8____|\u00a0_________|\n-|num_errors_____|9____|\u00a0_________|\n-[report_issue]\n-****** enum socks_error_code ******\n-Declared in \"libtorrent/socks5_stream.hpp\"\n- ____________________________________________________\n-|name______________________________|value|description|\n-|no_error__________________________|0____|\u00a0_________|\n-|unsupported_version_______________|1____|\u00a0_________|\n-|unsupported_authentication_method_|2____|\u00a0_________|\n-|unsupported_authentication_version|3____|\u00a0_________|\n-|authentication_error______________|4____|\u00a0_________|\n-|username_required_________________|5____|\u00a0_________|\n-|general_failure___________________|6____|\u00a0_________|\n-|command_not_supported_____________|7____|\u00a0_________|\n-|no_identd_________________________|8____|\u00a0_________|\n-|identd_error______________________|9____|\u00a0_________|\n-|num_errors________________________|10___|\u00a0_________|\n-[report_issue]\n-****** enum pcp_errors ******\n-Declared in \"libtorrent/natpmp.hpp\"\n- _____________________________________________\n-|name_______________________|value|description|\n-|pcp_success________________|0____|\u00a0_________|\n-|pcp_unsupp_version_________|1____|\u00a0_________|\n-|pcp_not_authorized_________|2____|\u00a0_________|\n-|pcp_malformed_request______|3____|\u00a0_________|\n-|pcp_unsupp_opcode__________|4____|\u00a0_________|\n-|pcp_unsupp_option__________|5____|\u00a0_________|\n-|pcp_malformed_option_______|6____|\u00a0_________|\n-|pcp_network_failure________|7____|\u00a0_________|\n-|pcp_no_resources___________|8____|\u00a0_________|\n-|pcp_unsupp_protocol________|9____|\u00a0_________|\n-|pcp_user_ex_quota__________|10___|\u00a0_________|\n-|pcp_cannot_provide_external|11___|\u00a0_________|\n-|pcp_address_mismatch_______|12___|\u00a0_________|\n-|pcp_excessive_remote_peers_|13___|\u00a0_________|\n-[report_issue]\n-****** enum error_code_enum ******\n-Declared in \"libtorrent/upnp.hpp\"\n- _____________________________________________________________________________\n-|name______________________________|value|description_________________________|\n-|no_error__________________________|0____|No_error____________________________|\n-|invalid_argument |402 |One of the arguments in the request |\n-|__________________________________|_____|is_invalid__________________________|\n-|action_failed_____________________|501__|The_request_failed__________________|\n-|value_not_in_array |714 |The specified value does not exist |\n-|__________________________________|_____|in_the_array________________________|\n-| | |The source IP address cannot be |\n-|source_ip_cannot_be_wildcarded |715 |wild-carded, but must be fully |\n-|__________________________________|_____|specified___________________________|\n-|external_port_cannot_be_wildcarded|716 |The external port cannot be a |\n-|__________________________________|_____|wildcard,_but_must_be_specified_____|\n-| | |The port mapping entry specified |\n-|port_mapping_conflict |718 |conflicts with a mapping assigned |\n-|__________________________________|_____|previously_to_another_client________|\n-|internal_port_must_match_external |724 |Internal and external port value |\n-|__________________________________|_____|must_be_the_same____________________|\n-| | |The NAT implementation only supports|\n-|only_permanent_leases_supported |725 |permanent lease times on port |\n-|__________________________________|_____|mappings____________________________|\n-| | |RemoteHost must be a wildcard and |\n-|remote_host_must_be_wildcard |726 |cannot be a specific IP address or |\n-|__________________________________|_____|DNS_name____________________________|\n-|external_port_must_be_wildcard |727 |ExternalPort must be a wildcard and |\n-|__________________________________|_____|cannot_be_a_specific_port___________|\n-[report_issue]\n-****** enum error_code_enum ******\n-Declared in \"libtorrent/error_code.hpp\"\n- _____________________________________________________________________________\n-|name________________________________|value|description_______________________|\n-|no_error____________________________|0____|Not_an_error______________________|\n-|file_collision |1 |Two torrents has files which end |\n-|____________________________________|_____|up_overwriting_each_other_________|\n-|failed_hash_check |2 |A piece did not match its piece |\n-|____________________________________|_____|hash______________________________|\n-| | |The .torrent file does not contain|\n-|torrent_is_no_dict |3 |a bencoded dictionary at its top |\n-|____________________________________|_____|level_____________________________|\n-|torrent_missing_info |4 |The .torrent file does not have an|\n-|____________________________________|_____|info_dictionary___________________|\n-|torrent_info_no_dict |5 |The .torrent file's info entry is |\n-|____________________________________|_____|not_a_dictionary__________________|\n-|torrent_missing_piece_length |6 |The .torrent file does not have a |\n-|____________________________________|_____|piece_length_entry________________|\n-|torrent_missing_name |7 |The .torrent file does not have a |\n-|____________________________________|_____|name_entry________________________|\n-|torrent_invalid_name |8 |The .torrent file's name entry is |\n-|____________________________________|_____|invalid___________________________|\n-| | |The length of a file, or of the |\n-|torrent_invalid_length |9 |whole .torrent file is invalid. |\n-|____________________________________|_____|Either_negative_or_not_an_integer_|\n-|torrent_file_parse_failed |10 |Failed to parse a file entry in |\n-|____________________________________|_____|the_.torrent______________________|\n-|torrent_missing_pieces |11 |The pieces field is missing or |\n-|____________________________________|_____|invalid_in_the_.torrent_file______|\n-|torrent_invalid_hashes |12 |The pieces string has incorrect |\n-|____________________________________|_____|length____________________________|\n-|too_many_pieces_in_torrent |13 |The .torrent file has more pieces |\n-|____________________________________|_____|than_is_supported_by_libtorrent___|\n-| | |The metadata (.torrent file) that |\n-|invalid_swarm_metadata |14 |was received from the swarm |\n-| | |matched the info-hash, but failed |\n-|____________________________________|_____|to_be_parsed______________________|\n-|invalid_bencoding |15 |The file or buffer is not |\n-|____________________________________|_____|correctly_bencoded________________|\n-|no_files_in_torrent |16 |The .torrent file does not contain|\n-|____________________________________|_____|any_files_________________________|\n-|invalid_escaped_string |17 |The string was not properly url- |\n-|____________________________________|_____|encoded_as_expected_______________|\n-|session_is_closing |18 |Operation is not permitted since |\n-|____________________________________|_____|the_session_is_shutting_down______|\n-| | |There's already a torrent with |\n-|duplicate_torrent |19 |that info-hash added to the |\n-|____________________________________|_____|session___________________________|\n-|invalid_torrent_handle |20 |The supplied torrent_handle is not|\n-|____________________________________|_____|referring_to_a_valid_torrent______|\n-|invalid_entry_type |21 |The type requested from the entry |\n-|____________________________________|_____|did_not_match_its_type____________|\n-|missing_info_hash_in_uri |22 |The specified URI does not contain|\n-|____________________________________|_____|a_valid_info-hash_________________|\n-| | |One of the files in the torrent |\n-|file_too_short |23 |was unexpectedly small. This might|\n-| | |be caused by files being changed |\n-|____________________________________|_____|by_an_external_process____________|\n-| | |The URL used an unknown protocol. |\n-| | |Currently http and https (if built|\n-|unsupported_url_protocol |24 |with openssl support) are |\n-| | |recognized. For trackers udp is |\n-|____________________________________|_____|recognized_as_well._______________|\n-|url_parse_error |25 |The URL did not conform to URL |\n-|____________________________________|_____|syntax_and_failed_to_be_parsed____|\n-|peer_sent_empty_piece |26 |The peer sent a piece message of |\n-|____________________________________|_____|length_0__________________________|\n-|parse_failed |27 |A bencoded structure was corrupt |\n-|____________________________________|_____|and_failed_to_be_parsed___________|\n-|invalid_file_tag |28 |The fast resume file was missing |\n-|____________________________________|_____|or_had_an_invalid_file_version_tag|\n-|missing_info_hash |29 |The fast resume file was missing |\n-|____________________________________|_____|or_had_an_invalid_info-hash_______|\n-|mismatching_info_hash |30 |The info-hash did not match the |\n-|____________________________________|_____|torrent___________________________|\n-|invalid_hostname |31 |The URL contained an invalid |\n-|____________________________________|_____|hostname__________________________|\n-|invalid_port________________________|32___|The_URL_had_an_invalid_port_______|\n-| | |The port is blocked by the port- |\n-|port_blocked |33 |filter, and prevented the |\n-|____________________________________|_____|connection________________________|\n-|expected_close_bracket_in_address |34 |The IPv6 address was expected to |\n-|____________________________________|_____|end_with_\"]\"______________________|\n-| | |The torrent is being destructed, |\n-|destructing_torrent |35 |preventing the operation to |\n-|____________________________________|_____|succeed___________________________|\n-|timed_out___________________________|36___|The_connection_timed_out__________|\n-| | |The peer is upload only, and we |\n-|upload_upload_connection |37 |are upload only. There's no point |\n-|____________________________________|_____|in_keeping_the_connection_________|\n-| | |The peer is upload only, and we're|\n-|uninteresting_upload_peer |38 |not interested in it. There's no |\n-|____________________________________|_____|point_in_keeping_the_connection___|\n-|invalid_info_hash___________________|39___|The_peer_sent_an_unknown_info-hash|\n-|torrent_paused |40 |The torrent is paused, preventing |\n-|____________________________________|_____|the_operation_from_succeeding_____|\n-| | |The peer sent an invalid have |\n-|invalid_have |41 |message, either wrong size or |\n-| | |referring to a piece that doesn't |\n-|____________________________________|_____|exist_in_the_torrent______________|\n-|invalid_bitfield_size |42 |The bitfield message had the |\n-|____________________________________|_____|incorrect_size____________________|\n-| | |The peer kept requesting pieces |\n-|too_many_requests_when_choked |43 |after it was choked, possible |\n-|____________________________________|_____|abuse_attempt.____________________|\n-| | |The peer sent a piece message that|\n-|invalid_piece |44 |does not correspond to a piece |\n-|____________________________________|_____|request_sent_by_the_client________|\n-|no_memory___________________________|45___|memory_allocation_failed__________|\n-|torrent_aborted |46 |The torrent is aborted, preventing|\n-|____________________________________|_____|the_operation_to_succeed__________|\n-|self_connection |47 |The peer is a connection to |\n-|____________________________________|_____|ourself,_no_point_in_keeping_it___|\n-| | |The peer sent a piece message with|\n-|invalid_piece_size |48 |invalid size, either negative or |\n-|____________________________________|_____|greater_than_one_block____________|\n-| | |The peer has not been interesting |\n-|timed_out_no_interest |49 |or interested in us for too long, |\n-|____________________________________|_____|no_point_in_keeping_it_around_____|\n-|timed_out_inactivity |50 |The peer has not said anything in |\n-|____________________________________|_____|a_long_time,_possibly_dead________|\n-| | |The peer did not send a handshake |\n-|timed_out_no_handshake |51 |within a reasonable amount of |\n-| | |time, it might not be a bittorrent|\n-|____________________________________|_____|peer______________________________|\n-| | |The peer has been unchoked for too|\n-|timed_out_no_request |52 |long without requesting any data. |\n-| | |It might be lying about its |\n-|____________________________________|_____|interest_in_us____________________|\n-|invalid_choke |53 |The peer sent an invalid choke |\n-|____________________________________|_____|message___________________________|\n-|invalid_unchoke |54 |The peer send an invalid unchoke |\n-|____________________________________|_____|message___________________________|\n-|invalid_interested |55 |The peer sent an invalid |\n-|____________________________________|_____|interested_message________________|\n-|invalid_not_interested |56 |The peer sent an invalid not- |\n-|____________________________________|_____|interested_message________________|\n-|invalid_request |57 |The peer sent an invalid piece |\n-|____________________________________|_____|request_message___________________|\n-| | |The peer sent an invalid hash-list|\n-|invalid_hash_list |58 |message (this is part of the |\n-|____________________________________|_____|merkle-torrent_extension)_________|\n-| | |The peer sent an invalid hash- |\n-|invalid_hash_piece |59 |piece message (this is part of the|\n-|____________________________________|_____|merkle-torrent_extension)_________|\n-|invalid_cancel |60 |The peer sent an invalid cancel |\n-|____________________________________|_____|message___________________________|\n-|invalid_dht_port |61 |The peer sent an invalid DHT port-|\n-|____________________________________|_____|message___________________________|\n-|invalid_suggest |62 |The peer sent an invalid suggest |\n-|____________________________________|_____|piece-message_____________________|\n-|invalid_have_all |63 |The peer sent an invalid have all-|\n-|____________________________________|_____|message___________________________|\n-|invalid_have_none |64 |The peer sent an invalid have |\n-|____________________________________|_____|none-message______________________|\n-|invalid_reject |65 |The peer sent an invalid reject |\n-|____________________________________|_____|message___________________________|\n-|invalid_allow_fast |66 |The peer sent an invalid allow |\n-|____________________________________|_____|fast-message______________________|\n-|invalid_extended |67 |The peer sent an invalid extension|\n-|____________________________________|_____|message_ID________________________|\n-|invalid_message |68 |The peer sent an invalid message |\n-|____________________________________|_____|ID________________________________|\n-|sync_hash_not_found |69 |The synchronization hash was not |\n-|____________________________________|_____|found_in_the_encrypted_handshake__|\n-|invalid_encryption_constant |70 |The encryption constant in the |\n-|____________________________________|_____|handshake_is_invalid______________|\n-|no_plaintext_mode |71 |The peer does not support plain |\n-|____________________________________|_____|text,_which_is_the_selected_mode__|\n-|no_rc4_mode |72 |The peer does not support RC4, |\n-|____________________________________|_____|which_is_the_selected_mode________|\n-| | |The peer does not support any of |\n-|unsupported_encryption_mode |73 |the encryption modes that the |\n-|____________________________________|_____|client_supports___________________|\n-| | |The peer selected an encryption |\n-|unsupported_encryption_mode_selected|74 |mode that the client did not |\n-|____________________________________|_____|advertise_and_does_not_support____|\n-| | |The pad size used in the |\n-|invalid_pad_size |75 |encryption handshake is of invalid|\n-|____________________________________|_____|size______________________________|\n-|invalid_encrypt_handshake |76 |The encryption handshake is |\n-|____________________________________|_____|invalid___________________________|\n-| | |The client is set to not support |\n-|no_incoming_encrypted |77 |incoming encrypted connections and|\n-|____________________________________|_____|this_is_an_encrypted_connection___|\n-| | |The client is set to not support |\n-|no_incoming_regular |78 |incoming regular bittorrent |\n-| | |connections, and this is a regular|\n-|____________________________________|_____|connection________________________|\n-|duplicate_peer_id |79 |The client is already connected to|\n-|____________________________________|_____|this_peer-ID______________________|\n-|torrent_removed_____________________|80___|Torrent_was_removed_______________|\n-|packet_too_large |81 |The packet size exceeded the upper|\n-|____________________________________|_____|sanity_check-limit________________|\n-|reserved____________________________|82___|\u00a0________________________________|\n-|http_error |83 |The web server responded with an |\n-|____________________________________|_____|error_____________________________|\n-|missing_location |84 |The web server response is missing|\n-|____________________________________|_____|a_location_header_________________|\n-| | |The web seed redirected to a path |\n-|invalid_redirection |85 |that no longer matches the |\n-|____________________________________|_____|.torrent_directory_structure______|\n-|redirecting |86 |The connection was closed because |\n-|____________________________________|_____|it_redirected_to_a_different_URL__|\n-|invalid_range_______________________|87___|The_HTTP_range_header_is_invalid__|\n-|no_content_length |88 |The HTTP response did not have a |\n-|____________________________________|_____|content_length____________________|\n-|banned_by_ip_filter_________________|89___|The_IP_is_blocked_by_the_IP_filter|\n-|too_many_connections________________|90___|At_the_connection_limit___________|\n-|peer_banned_________________________|91___|The_peer_is_marked_as_banned______|\n-|stopping_torrent |92 |The torrent is stopping, causing |\n-|____________________________________|_____|the_operation_to_fail_____________|\n-|too_many_corrupt_pieces |93 |The peer has sent too many corrupt|\n-|____________________________________|_____|pieces_and_is_banned______________|\n-|torrent_not_ready |94 |The torrent is not ready to |\n-|____________________________________|_____|receive_peers_____________________|\n-|peer_not_constructed |95 |The peer is not completely |\n-|____________________________________|_____|constructed_yet___________________|\n-|session_closing |96 |The session is closing, causing |\n-|____________________________________|_____|the_operation_to_fail_____________|\n-| | |The peer was disconnected in order|\n-|optimistic_disconnect |97 |to leave room for a potentially |\n-|____________________________________|_____|better_peer_______________________|\n-|torrent_finished____________________|98___|The_torrent_is_finished___________|\n-|no_router___________________________|99___|No_UPnP_router_found______________|\n-|metadata_too_large |100 |The metadata message says the |\n-|____________________________________|_____|metadata_exceeds_the_limit________|\n-|invalid_metadata_request |101 |The peer sent an invalid metadata |\n-|____________________________________|_____|request_message___________________|\n-|invalid_metadata_size |102 |The peer advertised an invalid |\n-|____________________________________|_____|metadata_size_____________________|\n-|invalid_metadata_offset |103 |The peer sent a message with an |\n-|____________________________________|_____|invalid_metadata_offset___________|\n-|invalid_metadata_message |104 |The peer sent an invalid metadata |\n-|____________________________________|_____|message___________________________|\n-|pex_message_too_large |105 |The peer sent a peer exchange |\n-|____________________________________|_____|message_that_was_too_large________|\n-|invalid_pex_message |106 |The peer sent an invalid peer |\n-|____________________________________|_____|exchange_message__________________|\n-|invalid_lt_tracker_message |107 |The peer sent an invalid tracker |\n-|____________________________________|_____|exchange_message__________________|\n-| | |The peer sent an pex messages too |\n-|too_frequent_pex |108 |often. This is a possible attempt |\n-|____________________________________|_____|of_and_attack_____________________|\n-| | |The operation failed because it |\n-| | |requires the torrent to have the |\n-| | |metadata (.torrent file) and it |\n-|no_metadata |109 |doesn't have it yet. This happens |\n-| | |for magnet links before they have |\n-| | |downloaded the metadata, and also |\n-|____________________________________|_____|torrents_added_by_URL.____________|\n-| | |The peer sent an invalid dont_have|\n-| | |message. The don't have message is|\n-|invalid_dont_have |110 |an extension to allow peers to |\n-| | |advertise that the no longer has a|\n-|____________________________________|_____|piece_they_previously_had.________|\n-| | |The peer tried to connect to an |\n-|requires_ssl_connection |111 |SSL torrent without connecting |\n-|____________________________________|_____|over_SSL._________________________|\n-| | |The peer tried to connect to a |\n-|invalid_ssl_cert |112 |torrent with a certificate for a |\n-|____________________________________|_____|different_torrent.________________|\n-| | |the torrent is not an SSL torrent,|\n-|not_an_ssl_torrent |113 |and the operation requires an SSL |\n-|____________________________________|_____|torrent___________________________|\n-| | |peer was banned because its listen|\n-|banned_by_port_filter |114 |port is within a banned port |\n-| | |range, as specified by the |\n-|____________________________________|_____|port_filter.______________________|\n-|invalid_session_handle |115 |The session_handle is not |\n-|____________________________________|_____|referring_to_a_valid_session_impl_|\n-|invalid_listen_socket |116 |the listen socket associated with |\n-|____________________________________|_____|this_request_was_closed___________|\n-|invalid_hash_request________________|117__|\u00a0________________________________|\n-|invalid_hashes______________________|118__|\u00a0________________________________|\n-|invalid_hash_reject_________________|119__|\u00a0________________________________|\n-|deprecated_120______________________|120__|\u00a0________________________________|\n-|deprecated_121______________________|121__|\u00a0________________________________|\n-|deprecated_122______________________|122__|\u00a0________________________________|\n-|deprecated_123______________________|123__|\u00a0________________________________|\n-|deprecated_124______________________|124__|\u00a0________________________________|\n-|missing_file_sizes |130 |The resume data file is missing |\n-|____________________________________|_____|the_file_sizes_entry______________|\n-|no_files_in_resume_data |131 |The resume data file file sizes |\n-|____________________________________|_____|entry_is_empty____________________|\n-|missing_pieces |132 |The resume data file is missing |\n-|____________________________________|_____|the_pieces_and_slots_entry________|\n-| | |The number of files in the resume |\n-|mismatching_number_of_files |133 |data does not match the number of |\n-|____________________________________|_____|files_in_the_torrent______________|\n-| | |One of the files on disk has a |\n-|mismatching_file_size |134 |different size than in the fast |\n-|____________________________________|_____|resume_file_______________________|\n-| | |One of the files on disk has a |\n-|mismatching_file_timestamp |135 |different timestamp than in the |\n-|____________________________________|_____|fast_resume_file__________________|\n-|not_a_dictionary |136 |The resume data file is not a |\n-|____________________________________|_____|dictionary________________________|\n-|invalid_blocks_per_piece |137 |The blocks per piece entry is |\n-|____________________________________|_____|invalid_in_the_resume_data_file___|\n-| | |The resume file is missing the |\n-|missing_slots |138 |slots entry, which is required for|\n-| | |torrents with compact allocation. |\n-|____________________________________|_____|DEPRECATED________________________|\n-|too_many_slots |139 |The resume file contains more |\n-|____________________________________|_____|slots_than_the_torrent____________|\n-|invalid_slot_list |140 |The slot entry is invalid in the |\n-|____________________________________|_____|resume_data_______________________|\n-|invalid_piece_index |141 |One index in the slot list is |\n-|____________________________________|_____|invalid___________________________|\n-| | |The pieces on disk needs to be re-|\n-| | |ordered for the specified |\n-| | |allocation mode. This happens if |\n-|pieces_need_reorder |142 |you specify sparse allocation and |\n-| | |the files on disk are using |\n-| | |compact storage. The pieces needs |\n-| | |to be moved to their right |\n-|____________________________________|_____|position._DEPRECATED______________|\n-| | |this error is returned when asking|\n-| | |to save resume data and specifying|\n-|resume_data_not_modified |143 |the flag to only save when there's|\n-| | |anything new to save |\n-| | |(torrent_handle::only_if_modified)|\n-|____________________________________|_____|and_there_wasn't_anything_changed.|\n-|http_parse_error |150 |The HTTP header was not correctly |\n-|____________________________________|_____|formatted_________________________|\n-| | |The HTTP response was in the 300- |\n-|http_missing_location |151 |399 range but lacked a location |\n-|____________________________________|_____|header____________________________|\n-| | |The HTTP response was encoded with|\n-|http_failed_decompress |152 |gzip or deflate but decompressing |\n-|____________________________________|_____|it_failed_________________________|\n-|no_i2p_router |160 |The URL specified an i2p address, |\n-|____________________________________|_____|but_no_i2p_router_is_configured___|\n-|no_i2p_endpoint |161 |i2p acceptor is not available yet,|\n-|____________________________________|_____|can't_announce_without_endpoint___|\n-| | |The tracker URL doesn't support |\n-|scrape_not_available |170 |transforming it into a scrape URL.|\n-|____________________________________|_____|i.e._it_doesn't_contain_\"announce.|\n-|invalid_tracker_response____________|171__|invalid_tracker_response__________|\n-|invalid_peer_dict |172 |invalid peer dictionary entry. Not|\n-|____________________________________|_____|a_dictionary______________________|\n-|tracker_failure_____________________|173__|tracker_sent_a_failure_message____|\n-|invalid_files_entry_________________|174__|missing_or_invalid_files_entry____|\n-|invalid_hash_entry__________________|175__|missing_or_invalid_hash_entry_____|\n-|invalid_peers_entry |176 |missing or invalid peers and |\n-|____________________________________|_____|peers6_entry______________________|\n-|invalid_tracker_response_length |177 |UDP tracker response packet has |\n-|____________________________________|_____|invalid_size______________________|\n-|invalid_tracker_transaction_id |178 |invalid transaction id in UDP |\n-|____________________________________|_____|tracker_response__________________|\n-|invalid_tracker_action |179 |invalid action field in UDP |\n-|____________________________________|_____|tracker_response__________________|\n-| | |skipped announce (because it's |\n-|announce_skipped |180 |assumed to be unreachable over the|\n-|____________________________________|_____|given_source_network_interface)___|\n-|no_entropy__________________________|200__|random_number_generation_failed___|\n-|ssrf_mitigation_____________________|201__|blocked_by_SSRF_mitigation________|\n-|blocked_by_idna |202 |blocked because IDNA host names |\n-|____________________________________|_____|are_banned________________________|\n-|torrent_unknown_version |210 |the torrent file has an unknown |\n-|____________________________________|_____|meta_version______________________|\n-|torrent_missing_file_tree |211 |the v2 torrent file has no file |\n-|____________________________________|_____|tree______________________________|\n-|torrent_missing_meta_version |212 |the torrent contains v2 keys but |\n-|____________________________________|_____|does_not_specify_meta_version_2___|\n-|torrent_inconsistent_files |213 |the v1 and v2 file metadata does |\n-|____________________________________|_____|not_match_________________________|\n-|torrent_missing_piece_layer |214 |one or more files are missing |\n-|____________________________________|_____|piece_layer_hashes________________|\n-|torrent_invalid_piece_layer |215 |a piece layer has the wrong size |\n-|____________________________________|_____|or_failed_hash_check______________|\n-|torrent_missing_pieces_root_________|216__|a_v2_file_entry_has_no_root_hash__|\n-|torrent_inconsistent_hashes |217 |the v1 and v2 hashes do not |\n-|____________________________________|_____|describe_the_same_data____________|\n-|torrent_invalid_pad_file |218 |a file in the v2 metadata has the |\n-|____________________________________|_____|pad_attribute_set_________________|\n-|error_code_max______________________|219__|the_number_of_error_codes_________|\n-[report_issue]\n-****** enum http_errors ******\n-Declared in \"libtorrent/error_code.hpp\"\n- _______________________________________\n-|name_________________|value|description|\n-|cont_________________|100__|\u00a0_________|\n-|ok___________________|200__|\u00a0_________|\n-|created______________|201__|\u00a0_________|\n-|accepted_____________|202__|\u00a0_________|\n-|no_content___________|204__|\u00a0_________|\n-|multiple_choices_____|300__|\u00a0_________|\n-|moved_permanently____|301__|\u00a0_________|\n-|moved_temporarily____|302__|\u00a0_________|\n-|not_modified_________|304__|\u00a0_________|\n-|bad_request__________|400__|\u00a0_________|\n-|unauthorized_________|401__|\u00a0_________|\n-|forbidden____________|403__|\u00a0_________|\n-|not_found____________|404__|\u00a0_________|\n-|internal_server_error|500__|\u00a0_________|\n-|not_implemented______|501__|\u00a0_________|\n-|bad_gateway__________|502__|\u00a0_________|\n-|service_unavailable__|503__|\u00a0_________|\n-[report_issue]\n-****** enum error_code_enum ******\n-Declared in \"libtorrent/gzip.hpp\"\n- _____________________________________________________________________________\n-|name_______________________________|value|description________________________|\n-|no_error___________________________|0____|Not_an_error_______________________|\n-|invalid_gzip_header |1 |the supplied gzip buffer has |\n-|___________________________________|_____|invalid_header_____________________|\n-| | |the gzip buffer would inflate to |\n-|inflated_data_too_large |2 |more bytes than the specified |\n-|___________________________________|_____|maximum_size,_and_was_rejected.____|\n-|data_did_not_terminate |3 |available inflate data did not |\n-|___________________________________|_____|terminate__________________________|\n-|space_exhausted |4 |output space exhausted before |\n-|___________________________________|_____|completing_inflate_________________|\n-|invalid_block_type_________________|5____|invalid_block_type_(type_==_3)_____|\n-|invalid_stored_block_length |6 |stored block length did not match |\n-|___________________________________|_____|one's_complement___________________|\n-|too_many_length_or_distance_codes |7 |dynamic block code description: too|\n-|___________________________________|_____|many_length_or_distance_codes______|\n-|code_lengths_codes_incomplete |8 |dynamic block code description: |\n-|___________________________________|_____|code_lengths_codes_incomplete______|\n-|repeat_lengths_with_no_first_length|9 |dynamic block code description: |\n-|___________________________________|_____|repeat_lengths_with_no_first_length|\n-|repeat_more_than_specified_lengths |10 |dynamic block code description: |\n-|___________________________________|_____|repeat_more_than_specified_lengths_|\n-|invalid_literal_length_code_lengths|11 |dynamic block code description: |\n-|___________________________________|_____|invalid_literal/length_code_lengths|\n-|invalid_distance_code_lengths |12 |dynamic block code description: |\n-|___________________________________|_____|invalid_distance_code_lengths______|\n-|invalid_literal_code_in_block |13 |invalid literal/length or distance |\n-|___________________________________|_____|code_in_fixed_or_dynamic_block_____|\n-|distance_too_far_back_in_block |14 |distance is too far back in fixed |\n-|___________________________________|_____|or_dynamic_block___________________|\n-|unknown_gzip_error |15 |an unknown error occurred during |\n-|___________________________________|_____|gzip_inflation_____________________|\n-|error_code_max_____________________|16___|the_number_of_error_codes__________|\n-[report_issue]\n-****** announce_infohash ******\n-Declared in \"libtorrent/announce_entry.hpp\"\n-struct announce_infohash\n-{\n- std::string message;\n- error_code last_error;\n- int scrape_incomplete = -1;\n- int scrape_complete = -1;\n- int scrape_downloaded = -1;\n- std::uint8_t fails : 7;\n- bool updating : 1;\n- bool start_sent : 1;\n- bool complete_sent : 1;\n-};\n-[report_issue]\n- message\n- if this tracker has returned an error or warning message that message is\n- stored here\n-[report_issue]\n- last_error\n- if this tracker failed the last time it was contacted this error code\n- specifies what error occurred\n- [report_issue]\n- scrape_incomplete scrape_complete scrape_downloaded\n- if this tracker has returned scrape data, these fields are filled in with\n- valid numbers. Otherwise they are set to -1. incomplete counts the number\n- of current downloaders. complete counts the number of current peers\n- completed the download, or \"seeds\". downloaded is the cumulative number\n- of completed downloads.\n-[report_issue]\n- fails\n- the number of times in a row we have failed to announce to this tracker.\n-[report_issue]\n- updating\n- true while we're waiting for a response from the tracker.\n-[report_issue]\n- start_sent\n- set to true when we get a valid response from an announce with\n- event=started. If it is set, we won't send start in the subsequent\n- announces.\n-[report_issue]\n- complete_sent\n- set to true when we send a event=completed.\n-[report_issue]\n-****** announce_endpoint ******\n-Declared in \"libtorrent/announce_entry.hpp\"\n-announces are sent to each tracker using every listen socket this class holds\n-information about one listen socket for one tracker\n-struct announce_endpoint\n-{\n- announce_endpoint ();\n-\n- tcp::endpoint local_endpoint;\n- aux::array info_hashes;\n- bool enabled = true;\n-};\n-[report_issue]\n- local_endpoint\n- the local endpoint of the listen interface associated with this endpoint\n-[report_issue]\n- info_hashes\n- info_hashes[0] is the v1 info hash (SHA1) info_hashes[1] is the v2 info\n- hash (truncated SHA-256)\n-[report_issue]\n- enabled\n- set to false to not announce from this endpoint\n-[report_issue]\n-****** announce_entry ******\n-Declared in \"libtorrent/announce_entry.hpp\"\n-this class holds information about one bittorrent tracker, as it relates to a\n-specific torrent.\n-struct announce_entry\n-{\n- explicit announce_entry (string_view u);\n- announce_entry (announce_entry const&);\n- announce_entry ();\n- announce_entry& operator= (announce_entry const&) &;\n- ~announce_entry ();\n-\n- enum tracker_source\n- {\n- source_torrent,\n- source_client,\n- source_magnet_link,\n- source_tex,\n- };\n-\n- std::string url;\n- std::string trackerid;\n- std::vector endpoints;\n- std::uint8_t tier = 0;\n- std::uint8_t fail_limit = 0;\n- std::uint8_t source:4;\n- bool verified:1;\n-};\n- [report_issue]\n-***** ~announce_entry() operator=() announce_entry() *****\n-explicit announce_entry (string_view u);\n-announce_entry (announce_entry const&);\n-announce_entry ();\n-announce_entry& operator= (announce_entry const&) &;\n-~announce_entry ();\n-constructs a tracker announce entry with u as the URL.\n-[report_issue]\n-***** enum tracker_source *****\n-Declared in \"libtorrent/announce_entry.hpp\"\n- ____________________________________________________________________________\n-|name______________|value|description________________________________________|\n-|source_torrent____|1____|the_tracker_was_part_of_the_.torrent_file__________|\n-|source_client |2 |the tracker was added programmatically via the |\n-|__________________|_____|add_tracker()_function_____________________________|\n-|source_magnet_link|4____|the_tracker_was_part_of_a_magnet_link______________|\n-|source_tex |8 |the tracker was received from the swarm via tracker|\n-|__________________|_____|exchange___________________________________________|\n-[report_issue]\n- url\n- tracker URL as it appeared in the torrent file\n-[report_issue]\n- trackerid\n- the current &trackerid= argument passed to the tracker. this is optional\n- and is normally empty (in which case no trackerid is sent).\n-[report_issue]\n- endpoints\n- each local listen socket (endpoint) will announce to the tracker. This\n- list contains state per endpoint.\n-[report_issue]\n- tier\n- the tier this tracker belongs to\n-[report_issue]\n- fail_limit\n- the max number of failures to announce to this tracker in a row, before\n- this tracker is not used anymore. 0 means unlimited\n-[report_issue]\n- source\n- a bitmask specifying which sources we got this tracker from.\n-[report_issue]\n- verified\n- set to true the first time we receive a valid response from this tracker.\n-[report_issue]\n-****** dht_state ******\n-Declared in \"libtorrent/kademlia/dht_state.hpp\"\n-This structure helps to store and load the state of the dht_tracker. At this\n-moment the library is only a dual stack implementation of the DHT. See BEP_32\n-struct dht_state\n-{\n- void clear ();\n-\n- node_ids_t nids;\n- std::vector nodes;\n- std::vector nodes6;\n-};\n-[report_issue]\n- nodes\n- the bootstrap nodes saved from the buckets node\n-[report_issue]\n- nodes6\n- the bootstrap nodes saved from the IPv6 buckets node\n-[report_issue]\n ****** dht_storage_counters ******\n Declared in \"libtorrent/kademlia/dht_storage.hpp\"\n This structure hold the relevant counters for the storage\n struct dht_storage_counters\n {\n void reset ();\n \n@@ -12647,14 +12348,33 @@\n For implementers: Use this functions for expire peers or items or any other\n storage cleanup.\n [report_issue]\n ***** counters() *****\n virtual dht_storage_counters counters () const = 0;\n return stats counters for the store\n [report_issue]\n+****** dht_state ******\n+Declared in \"libtorrent/kademlia/dht_state.hpp\"\n+This structure helps to store and load the state of the dht_tracker. At this\n+moment the library is only a dual stack implementation of the DHT. See BEP_32\n+struct dht_state\n+{\n+ void clear ();\n+\n+ node_ids_t nids;\n+ std::vector nodes;\n+ std::vector nodes6;\n+};\n+[report_issue]\n+ nodes\n+ the bootstrap nodes saved from the buckets node\n+[report_issue]\n+ nodes6\n+ the bootstrap nodes saved from the IPv6 buckets node\n+[report_issue]\n ****** sign_mutable_item() ******\n Declared in \"libtorrent/kademlia/item.hpp\"\n signature sign_mutable_item (\n span v\n , span salt\n , sequence_number seq\n , public_key const& pk\n@@ -12680,62 +12400,62 @@\n implied_port\n announce to DHT with the implied-port flag set. This tells the network to\n use your source UDP port as your listen port, rather than the one\n specified in the message. This may improve the chances of traversing NATs\n when using uTP.\n ssl_torrent\n Specify the port number for the SSL listen socket in the DHT announce.\n+ [report_issue]\n+****** write_resume_data_buf() write_resume_data() ******\n+Declared in \"libtorrent/write_resume_data.hpp\"\n+entry write_resume_data (add_torrent_params const& atp);\n+std::vector write_resume_data_buf (add_torrent_params const& atp);\n+this function turns the resume data in an add_torrent_params object into a\n+bencoded structure\n+ [report_issue]\n+****** write_torrent_file_buf() write_torrent_file() ******\n+Declared in \"libtorrent/write_resume_data.hpp\"\n+std::vector write_torrent_file_buf (add_torrent_params const& atp\n+ , write_torrent_flags_t flags);\n+entry write_torrent_file (add_torrent_params const& atp);\n+entry write_torrent_file (add_torrent_params const& atp, write_torrent_flags_t\n+flags);\n+writes only the fields to create a .torrent file. This function may fail with a\n+std::system_error exception if:\n+ * The add_torrent_params object passed to this function does not contain\n+ the info dictionary (the ti field)\n+ * The piece layers are not complete for all files that need them\n+The write_torrent_file_buf() overload returns the torrent file in bencoded\n+buffer form. This overload may be faster at the expense of lost flexibility to\n+add custom fields.\n [report_issue]\n ****** read_resume_data() ******\n Declared in \"libtorrent/read_resume_data.hpp\"\n add_torrent_params read_resume_data (bdecode_node const& rd\n- , int piece_limit = 0x200000);\n-add_torrent_params read_resume_data (span buffer\n- , load_torrent_limits const& cfg = {});\n-add_torrent_params read_resume_data (bdecode_node const& rd\n , error_code& ec, int piece_limit = 0x200000);\n add_torrent_params read_resume_data (span buffer\n , error_code& ec, load_torrent_limits const& cfg = {});\n+add_torrent_params read_resume_data (span buffer\n+ , load_torrent_limits const& cfg = {});\n+add_torrent_params read_resume_data (bdecode_node const& rd\n+ , int piece_limit = 0x200000);\n these functions are used to parse resume data and populate the appropriate\n fields in an add_torrent_params object. This object can then be used to add the\n actual torrent_info object to and pass to session::add_torrent() or session::\n async_add_torrent().\n If the client wants to override any field that was loaded from the resume data,\n e.g. save_path, those fields must be changed after loading resume data but\n before adding the torrent.\n The piece_limit parameter determines the largest number of pieces allowed in\n the torrent that may be loaded as part of the resume data, if it contains an\n info field. The overloads that take a flat buffer are instead configured with\n limits on torrent sizes via load_torrent limits.\n In order to support large torrents, it may also be necessary to raise the\n settings_pack::max_piece_count setting and pass a higher limit to calls to\n torrent_info::parse_info_section().\n- [report_issue]\n-****** write_resume_data() write_resume_data_buf() ******\n-Declared in \"libtorrent/write_resume_data.hpp\"\n-std::vector write_resume_data_buf (add_torrent_params const& atp);\n-entry write_resume_data (add_torrent_params const& atp);\n-this function turns the resume data in an add_torrent_params object into a\n-bencoded structure\n- [report_issue]\n-****** write_torrent_file_buf() write_torrent_file() ******\n-Declared in \"libtorrent/write_resume_data.hpp\"\n-entry write_torrent_file (add_torrent_params const& atp);\n-entry write_torrent_file (add_torrent_params const& atp, write_torrent_flags_t\n-flags);\n-std::vector write_torrent_file_buf (add_torrent_params const& atp\n- , write_torrent_flags_t flags);\n-writes only the fields to create a .torrent file. This function may fail with a\n-std::system_error exception if:\n- * The add_torrent_params object passed to this function does not contain\n- the info dictionary (the ti field)\n- * The piece layers are not complete for all files that need them\n-The write_torrent_file_buf() overload returns the torrent file in bencoded\n-buffer form. This overload may be faster at the expense of lost flexibility to\n-add custom fields.\n [report_issue]\n ****** write_torrent_flags_t ******\n Declared in \"libtorrent/write_resume_data.hpp\"\n allow_missing_piece_layer\n this makes write_torrent_file() not fail when attempting to write a v2\n torrent file that does not have all the piece layers\n no_http_seeds\n@@ -12774,18 +12494,18 @@\n Declared in \"libtorrent/kademlia/ed25519.hpp\"\n bool ed25519_verify (signature const& sig\n , span msg, public_key const& pk);\n Verifies the signature on the given message using pk\n [report_issue]\n ****** ed25519_add_scalar() ******\n Declared in \"libtorrent/kademlia/ed25519.hpp\"\n-secret_key ed25519_add_scalar (secret_key const& sk\n- , std::array const& scalar);\n public_key ed25519_add_scalar (public_key const& pk\n , std::array const& scalar);\n+secret_key ed25519_add_scalar (secret_key const& sk\n+ , std::array const& scalar);\n Adds a scalar to the given key pair where scalar is a 32 byte buffer (possibly\n generated withed25519_create_seed), generating a new key pair.\n You can calculate the public key sum without knowing the private key and vice\n versa by passing in null for the key you don't know. This is useful when a\n third party (an authoritative server for example) needs to enforce randomness\n on a key pair while only knowing the public key of the other side.\n Warning: the last bit of the scalar is ignored - if comparing scalars make sure\n"}]}]}]}]}, {"source1": "python3-libtorrent_2.0.8-1_i386.deb", "source2": "python3-libtorrent_2.0.8-1_i386.deb", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,3 +1,3 @@\n -rw-r--r-- 0 0 0 4 2022-10-23 15:10:21.000000 debian-binary\n -rw-r--r-- 0 0 0 1012 2022-10-23 15:10:21.000000 control.tar.xz\n--rw-r--r-- 0 0 0 701076 2022-10-23 15:10:21.000000 data.tar.xz\n+-rw-r--r-- 0 0 0 701072 2022-10-23 15:10:21.000000 data.tar.xz\n"}, {"source1": "control.tar.xz", "source2": "control.tar.xz", "unified_diff": null, "details": [{"source1": "control.tar", "source2": "control.tar", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "unified_diff": null, "details": [{"source1": "./md5sums", "source2": "./md5sums", "comments": ["Files differ"], "unified_diff": null}]}]}]}, {"source1": "data.tar.xz", "source2": "data.tar.xz", "unified_diff": null, "details": [{"source1": "data.tar", "source2": "data.tar", "unified_diff": null, "details": [{"source1": "file list", "source2": "file list", "unified_diff": "@@ -1,15 +1,15 @@\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/lib/\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/lib/python3/\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/\n -rw-r--r-- 0 root (0) root (0) 4790780 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/libtorrent.cpython-311-i386-linux-gnu.so\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/libtorrent.egg-info/\n--rw-r--r-- 0 root (0) root (0) 272 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/libtorrent.egg-info/PKG-INFO\n+-rw-r--r-- 0 root (0) root (0) 270 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/libtorrent.egg-info/PKG-INFO\n -rw-r--r-- 0 root (0) root (0) 1 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/libtorrent.egg-info/dependency_links.txt\n -rw-r--r-- 0 root (0) root (0) 17 2022-10-23 15:10:21.000000 ./usr/lib/python3/dist-packages/libtorrent.egg-info/top_level.txt\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/share/\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/share/doc/\n drwxr-xr-x 0 root (0) root (0) 0 2022-10-23 15:10:21.000000 ./usr/share/doc/python3-libtorrent/\n -rw-r--r-- 0 root (0) root (0) 2045 2022-10-23 15:10:21.000000 ./usr/share/doc/python3-libtorrent/changelog.Debian.gz\n -rw-r--r-- 0 root (0) root (0) 32554 2022-10-23 11:28:40.000000 ./usr/share/doc/python3-libtorrent/changelog.gz\n"}, {"source1": "./usr/lib/python3/dist-packages/libtorrent.egg-info/PKG-INFO", "source2": "./usr/lib/python3/dist-packages/libtorrent.egg-info/PKG-INFO", "unified_diff": "@@ -2,10 +2,10 @@\n Name: libtorrent\n Version: 2.0.8\n Summary: Python bindings for libtorrent-rasterbar\n Home-page: http://libtorrent.org\n Author: Arvid Norberg\n Author-email: arvid@libtorrent.org\n License: BSD\n-Platform: Linux-x86_64\n+Platform: Linux-i686\n \n Python bindings for libtorrent-rasterbar\n"}]}]}]}]}