2009-11-26 06:45:43 +01:00
|
|
|
/*
|
|
|
|
|
2018-04-09 09:04:33 +02:00
|
|
|
Copyright (c) 2009-2018, Arvid Norberg
|
2009-11-26 06:45:43 +01:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in
|
|
|
|
the documentation and/or other materials provided with the distribution.
|
|
|
|
* Neither the name of the author nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived
|
|
|
|
from this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TORRENT_ADD_TORRENT_PARAMS_HPP_INCLUDED
|
|
|
|
#define TORRENT_ADD_TORRENT_PARAMS_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2016-04-27 18:27:52 +02:00
|
|
|
#include <map>
|
2016-08-13 03:31:55 +02:00
|
|
|
#include <functional>
|
2016-12-11 02:51:55 +01:00
|
|
|
#include <ctime>
|
2015-12-15 06:03:43 +01:00
|
|
|
|
2009-11-26 06:45:43 +01:00
|
|
|
#include "libtorrent/storage_defs.hpp"
|
2016-11-02 06:03:12 +01:00
|
|
|
#include "libtorrent/sha1_hash.hpp"
|
2010-07-15 03:14:36 +02:00
|
|
|
#include "libtorrent/version.hpp"
|
2016-02-12 21:42:39 +01:00
|
|
|
#include "libtorrent/socket.hpp" // for tcp::endpoint
|
2016-02-12 23:50:29 +01:00
|
|
|
#include "libtorrent/bitfield.hpp"
|
2016-05-23 14:15:39 +02:00
|
|
|
#include "libtorrent/error_code.hpp"
|
2016-12-22 16:42:33 +01:00
|
|
|
#include "libtorrent/units.hpp"
|
2017-07-09 16:32:01 +02:00
|
|
|
#include "libtorrent/torrent_flags.hpp"
|
2017-10-29 00:44:40 +02:00
|
|
|
#include "libtorrent/download_priority.hpp"
|
2017-05-28 13:14:58 +02:00
|
|
|
#include "libtorrent/aux_/noexcept_movable.hpp"
|
2009-11-26 06:45:43 +01:00
|
|
|
|
2017-04-12 19:00:57 +02:00
|
|
|
namespace libtorrent {
|
|
|
|
|
2009-11-26 17:25:39 +01:00
|
|
|
class torrent_info;
|
2013-11-17 23:38:37 +01:00
|
|
|
struct torrent_plugin;
|
2015-07-25 18:39:25 +02:00
|
|
|
struct torrent_handle;
|
2009-11-26 06:45:43 +01:00
|
|
|
|
2018-04-26 09:01:14 +02:00
|
|
|
TORRENT_VERSION_NAMESPACE_2
|
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// The add_torrent_params is a parameter pack for adding torrents to a
|
|
|
|
// session. The key fields when adding a torrent are:
|
2013-07-20 22:11:01 +02:00
|
|
|
//
|
2017-03-23 23:19:40 +01:00
|
|
|
// * ti - when you have loaded a .torrent file into a torrent_info object
|
2017-03-29 08:16:07 +02:00
|
|
|
// * info_hash - when you don't have the metadata (.torrent file) but. This
|
|
|
|
// is set when adding a magnet link.
|
2013-07-20 22:11:01 +02:00
|
|
|
//
|
2017-03-05 15:31:28 +01:00
|
|
|
// one of those fields must be set. Another mandatory field is
|
2014-04-28 06:46:33 +02:00
|
|
|
// ``save_path``. The add_torrent_params object is passed into one of the
|
|
|
|
// ``session::add_torrent()`` overloads or ``session::async_add_torrent()``.
|
2013-07-20 22:11:01 +02:00
|
|
|
//
|
2014-04-28 06:46:33 +02:00
|
|
|
// If you only specify the info-hash, the torrent file will be downloaded
|
|
|
|
// from peers, which requires them to support the metadata extension. For
|
|
|
|
// the metadata extension to work, libtorrent must be built with extensions
|
|
|
|
// enabled (``TORRENT_DISABLE_EXTENSIONS`` must not be defined). It also
|
|
|
|
// takes an optional ``name`` argument. This may be left empty in case no
|
|
|
|
// name should be assigned to the torrent. In case it's not, the name is
|
|
|
|
// used for the torrent as long as it doesn't have metadata. See
|
|
|
|
// ``torrent_handle::name``.
|
2013-07-20 22:11:01 +02:00
|
|
|
//
|
2017-03-05 15:31:28 +01:00
|
|
|
// The ``add_torrent_params`` is also used when requesting resume data for a
|
|
|
|
// torrent. It can be saved to and restored from a file and added back to a
|
|
|
|
// new session. For serialization and deserialization of
|
|
|
|
// ``add_torrent_params`` objects, see read_resume_data() and
|
|
|
|
// write_resume_data().
|
2017-03-18 01:41:47 +01:00
|
|
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
2013-07-19 18:30:26 +02:00
|
|
|
struct TORRENT_EXPORT add_torrent_params
|
2009-11-26 06:45:43 +01:00
|
|
|
{
|
2014-04-28 06:46:33 +02:00
|
|
|
// The constructor can be used to initialize the storage constructor,
|
|
|
|
// which determines the storage mechanism for the downloaded or seeding
|
|
|
|
// data for the torrent. For more information, see the ``storage`` field.
|
2017-06-07 16:41:28 +02:00
|
|
|
explicit add_torrent_params(storage_constructor_type sc = default_storage_constructor);
|
|
|
|
add_torrent_params(add_torrent_params&&) noexcept;
|
2018-02-01 01:06:15 +01:00
|
|
|
add_torrent_params& operator=(add_torrent_params&&) = default;
|
2017-06-07 16:41:28 +02:00
|
|
|
add_torrent_params(add_torrent_params const&);
|
|
|
|
add_torrent_params& operator=(add_torrent_params const&);
|
2011-11-08 06:36:22 +01:00
|
|
|
|
2017-07-09 16:32:01 +02:00
|
|
|
// These are all deprecated. use torrent_flags_t instead (in
|
|
|
|
// libtorrent/torrent_flags.hpp)
|
2018-04-26 09:01:14 +02:00
|
|
|
#if TORRENT_ABI_VERSION == 1
|
2016-06-13 03:12:48 +02:00
|
|
|
|
2017-07-09 16:32:01 +02:00
|
|
|
using flags_t = torrent_flags_t;
|
|
|
|
|
|
|
|
#define DECL_FLAG(name) \
|
|
|
|
static constexpr torrent_flags_t TORRENT_DEPRECATED_MEMBER flag_##name = torrent_flags::name
|
|
|
|
|
|
|
|
DECL_FLAG(seed_mode);
|
|
|
|
DECL_FLAG(upload_mode);
|
|
|
|
DECL_FLAG(share_mode);
|
|
|
|
DECL_FLAG(apply_ip_filter);
|
|
|
|
DECL_FLAG(paused);
|
|
|
|
DECL_FLAG(auto_managed);
|
|
|
|
DECL_FLAG(duplicate_is_error);
|
|
|
|
DECL_FLAG(update_subscribe);
|
|
|
|
DECL_FLAG(super_seeding);
|
|
|
|
DECL_FLAG(sequential_download);
|
|
|
|
DECL_FLAG(pinned);
|
|
|
|
DECL_FLAG(stop_when_ready);
|
|
|
|
DECL_FLAG(override_trackers);
|
|
|
|
DECL_FLAG(override_web_seeds);
|
|
|
|
DECL_FLAG(need_save_resume);
|
|
|
|
DECL_FLAG(override_resume_data);
|
|
|
|
DECL_FLAG(merge_resume_trackers);
|
|
|
|
DECL_FLAG(use_resume_save_path);
|
|
|
|
DECL_FLAG(merge_resume_http_seeds);
|
|
|
|
DECL_FLAG(default_flags);
|
|
|
|
#undef DECL_FLAG
|
2018-04-26 09:01:14 +02:00
|
|
|
#endif // TORRENT_ABI_VERSION
|
2017-03-19 17:58:55 +01:00
|
|
|
|
|
|
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
2015-11-20 07:00:39 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// filled in by the constructor and should be left untouched. It is used
|
|
|
|
// for forward binary compatibility.
|
2016-10-27 02:41:57 +02:00
|
|
|
int version = LIBTORRENT_VERSION_NUM;
|
2016-06-13 03:12:48 +02:00
|
|
|
|
2017-03-29 08:16:07 +02:00
|
|
|
// torrent_info object with the torrent to add. Unless the
|
2016-01-04 03:20:47 +01:00
|
|
|
// info_hash is set, this is required to be initialized.
|
2016-08-17 23:26:35 +02:00
|
|
|
std::shared_ptr<torrent_info> ti;
|
2013-08-17 09:01:03 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// If the torrent doesn't have a tracker, but relies on the DHT to find
|
|
|
|
// peers, the ``trackers`` can specify tracker URLs for the torrent.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<std::string>> trackers;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2015-12-15 06:03:43 +01:00
|
|
|
// the tiers the URLs in ``trackers`` belong to. Trackers belonging to
|
|
|
|
// different tiers may be treated differently, as defined by the multi
|
|
|
|
// tracker extension. This is optional, if not specified trackers are
|
|
|
|
// assumed to be part of tier 0, or whichever the last tier was as
|
|
|
|
// iterating over the trackers.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<int>> tracker_tiers;
|
2015-12-15 06:03:43 +01:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// a list of hostname and port pairs, representing DHT nodes to be added
|
|
|
|
// to the session (if DHT is enabled). The hostname may be an IP address.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<std::pair<std::string, int>>> dht_nodes;
|
2016-08-26 06:14:11 +02:00
|
|
|
|
2012-03-08 10:54:44 +01:00
|
|
|
std::string name;
|
2014-06-13 00:39:41 +02:00
|
|
|
|
2015-12-15 06:03:43 +01:00
|
|
|
// the path where the torrent is or will be stored.
|
2016-10-22 17:47:24 +02:00
|
|
|
//
|
2014-12-07 08:22:39 +01:00
|
|
|
// .. note::
|
|
|
|
// On windows this path (and other paths) are interpreted as UNC
|
|
|
|
// paths. This means they must use backslashes as directory separators
|
|
|
|
// and may not contain the special directories "." or "..".
|
2017-01-29 02:21:39 +01:00
|
|
|
//
|
2017-06-17 17:35:53 +02:00
|
|
|
// Setting this to an absolute path performs slightly better than a
|
2017-01-26 05:42:59 +01:00
|
|
|
// relative path.
|
2009-11-26 06:45:43 +01:00
|
|
|
std::string save_path;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// One of the values from storage_mode_t. For more information, see
|
|
|
|
// storage-allocation_.
|
2016-10-27 02:41:57 +02:00
|
|
|
storage_mode_t storage_mode = storage_mode_sparse;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// can be used to customize how the data is stored. The default storage
|
|
|
|
// will simply write the data to the files it belongs to, but it could be
|
|
|
|
// overridden to save everything to a single file at a specific location
|
|
|
|
// or encrypt the content on disk for instance. For more information
|
|
|
|
// about the storage_interface that needs to be implemented for a custom
|
|
|
|
// storage, see storage_interface.
|
2017-05-28 13:14:58 +02:00
|
|
|
#ifdef __clang__
|
2009-11-26 06:45:43 +01:00
|
|
|
storage_constructor_type storage;
|
2017-05-28 13:14:58 +02:00
|
|
|
#else
|
|
|
|
aux::noexcept_movable<storage_constructor_type> storage;
|
|
|
|
#endif
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// The ``userdata`` parameter is optional and will be passed on to the
|
2015-03-14 22:55:26 +01:00
|
|
|
// extension constructor functions, if any
|
|
|
|
// (see torrent_handle::add_extension()).
|
2016-10-27 02:41:57 +02:00
|
|
|
void* userdata = nullptr;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// can be set to control the initial file priorities when adding a
|
|
|
|
// torrent. The semantics are the same as for
|
2017-07-09 18:07:28 +02:00
|
|
|
// ``torrent_handle::prioritize_files()``. The file priorities specified
|
|
|
|
// in here take precedence over those specified in the resume data, if
|
|
|
|
// any.
|
2017-10-29 00:44:40 +02:00
|
|
|
aux::noexcept_movable<std::vector<download_priority_t>> file_priorities;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// torrent extension construction functions can be added to this vector
|
|
|
|
// to have them be added immediately when the torrent is constructed.
|
|
|
|
// This may be desired over the torrent_handle::add_extension() in order
|
|
|
|
// to avoid race conditions. For instance it may be important to have the
|
|
|
|
// plugin catch events that happen very early on after the torrent is
|
|
|
|
// created.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<std::function<std::shared_ptr<torrent_plugin>(torrent_handle const&, void*)>>>
|
2013-11-26 05:14:29 +01:00
|
|
|
extensions;
|
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// the default tracker id to be used when announcing to trackers. By
|
|
|
|
// default this is empty, and no tracker ID is used, since this is an
|
|
|
|
// optional argument. If a tracker returns a tracker ID, that ID is used
|
|
|
|
// instead of this.
|
2010-11-18 06:51:52 +01:00
|
|
|
std::string trackerid;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// flags controlling aspects of this torrent and how it's added. See
|
2017-07-09 16:32:01 +02:00
|
|
|
// torrent_flags_t for details.
|
2016-10-22 17:47:24 +02:00
|
|
|
//
|
2016-05-31 01:36:44 +02:00
|
|
|
// .. note::
|
|
|
|
// The ``flags`` field is initialized with default flags by the
|
|
|
|
// constructor. In order to preserve default behavior when clearing or
|
|
|
|
// setting other flags, make sure to bitwise OR or in a flag or bitwise
|
|
|
|
// AND the inverse of a flag to clear it.
|
2017-07-09 16:32:01 +02:00
|
|
|
torrent_flags_t flags = torrent_flags::default_flags;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2013-11-29 06:29:39 +01:00
|
|
|
// set this to the info hash of the torrent to add in case the info-hash
|
|
|
|
// is the only known property of the torrent. i.e. you don't have a
|
|
|
|
// .torrent file nor a magnet link.
|
2017-06-21 06:50:14 +02:00
|
|
|
// To add a magnet link, use parse_magnet_uri() to populate fields in the
|
2017-03-29 08:16:07 +02:00
|
|
|
// add_torrent_params object.
|
2013-11-26 05:14:29 +01:00
|
|
|
sha1_hash info_hash;
|
2013-07-20 22:11:01 +02:00
|
|
|
|
2014-04-28 06:46:33 +02:00
|
|
|
// ``max_uploads``, ``max_connections``, ``upload_limit``,
|
|
|
|
// ``download_limit`` correspond to the ``set_max_uploads()``,
|
|
|
|
// ``set_max_connections()``, ``set_upload_limit()`` and
|
|
|
|
// ``set_download_limit()`` functions on torrent_handle. These values let
|
|
|
|
// you initialize these settings when the torrent is added, instead of
|
|
|
|
// calling these functions immediately following adding it.
|
2016-10-22 17:47:24 +02:00
|
|
|
//
|
2014-04-28 06:46:33 +02:00
|
|
|
// -1 means unlimited on these settings just like their counterpart
|
|
|
|
// functions on torrent_handle
|
2017-03-31 00:07:24 +02:00
|
|
|
//
|
2017-03-28 02:47:12 +02:00
|
|
|
// For fine grained control over rate limits, including making them apply
|
|
|
|
// to local peers, see peer-classes_.
|
2016-10-27 02:41:57 +02:00
|
|
|
int max_uploads = -1;
|
|
|
|
int max_connections = -1;
|
2016-10-28 00:09:15 +02:00
|
|
|
|
2016-10-27 02:41:57 +02:00
|
|
|
int upload_limit = -1;
|
|
|
|
int download_limit = -1;
|
2013-08-02 11:42:51 +02:00
|
|
|
|
2015-12-15 06:03:43 +01:00
|
|
|
// the total number of bytes uploaded and downloaded by this torrent so
|
|
|
|
// far.
|
2016-10-27 02:41:57 +02:00
|
|
|
std::int64_t total_uploaded = 0;
|
|
|
|
std::int64_t total_downloaded = 0;
|
2015-12-15 06:03:43 +01:00
|
|
|
|
2016-05-02 00:15:25 +02:00
|
|
|
// the number of seconds this torrent has spent in started, finished and
|
2015-12-15 06:03:43 +01:00
|
|
|
// seeding state so far, respectively.
|
2016-10-27 02:41:57 +02:00
|
|
|
int active_time = 0;
|
|
|
|
int finished_time = 0;
|
|
|
|
int seeding_time = 0;
|
2015-12-15 06:03:43 +01:00
|
|
|
|
|
|
|
// if set to a non-zero value, this is the posix time of when this torrent
|
|
|
|
// was first added, including previous runs/sessions. If set to zero, the
|
|
|
|
// internal added_time will be set to the time of when add_torrent() is
|
|
|
|
// called.
|
2016-12-11 02:51:55 +01:00
|
|
|
std::time_t added_time = 0;
|
|
|
|
std::time_t completed_time = 0;
|
2015-12-15 06:03:43 +01:00
|
|
|
|
|
|
|
// if set to non-zero, initializes the time (expressed in posix time) when
|
|
|
|
// we last saw a seed or peers that together formed a complete copy of the
|
|
|
|
// torrent. If left set to zero, the internal counterpart to this field
|
|
|
|
// will be updated when we see a seed or a distributed copies >= 1.0.
|
2016-12-11 02:51:55 +01:00
|
|
|
std::time_t last_seen_complete = 0;
|
2015-12-15 06:03:43 +01:00
|
|
|
|
|
|
|
// these field can be used to initialize the torrent's cached scrape data.
|
|
|
|
// The scrape data is high level metadata about the current state of the
|
|
|
|
// swarm, as returned by the tracker (either when announcing to it or by
|
|
|
|
// sending a specific scrape request). ``num_complete`` is the number of
|
|
|
|
// peers in the swarm that are seeds, or have every piece in the torrent.
|
2016-05-02 00:15:25 +02:00
|
|
|
// ``num_incomplete`` is the number of peers in the swarm that do not have
|
2015-12-15 06:03:43 +01:00
|
|
|
// every piece. ``num_downloaded`` is the number of times the torrent has
|
|
|
|
// been downloaded (not initiated, but the number of times a download has
|
|
|
|
// completed).
|
2016-10-22 17:47:24 +02:00
|
|
|
//
|
2015-12-15 06:03:43 +01:00
|
|
|
// Leaving any of these values set to -1 indicates we don't know, or we
|
|
|
|
// have not received any scrape data.
|
2016-10-27 02:41:57 +02:00
|
|
|
int num_complete = -1;
|
|
|
|
int num_incomplete = -1;
|
2016-10-28 00:09:15 +02:00
|
|
|
|
2016-10-27 02:41:57 +02:00
|
|
|
int num_downloaded = -1;
|
2016-02-11 19:58:18 +01:00
|
|
|
|
|
|
|
// URLs can be added to these two lists to specify additional web
|
|
|
|
// seeds to be used by the torrent. If the ``flag_override_web_seeds``
|
|
|
|
// is set, these will be the _only_ ones to be used. i.e. any web seeds
|
|
|
|
// found in the .torrent file will be overridden.
|
2016-10-22 17:47:24 +02:00
|
|
|
//
|
2016-02-11 19:58:18 +01:00
|
|
|
// http_seeds expects URLs to web servers implementing the original HTTP
|
|
|
|
// seed specification `BEP 17`_.
|
2016-10-22 17:47:24 +02:00
|
|
|
//
|
2016-02-11 19:58:18 +01:00
|
|
|
// url_seeds expects URLs to regular web servers, aka "get right" style,
|
|
|
|
// specified in `BEP 19`_.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<std::string>> http_seeds;
|
|
|
|
aux::noexcept_movable<std::vector<std::string>> url_seeds;
|
2016-02-11 19:58:18 +01:00
|
|
|
|
2016-02-12 23:50:29 +01:00
|
|
|
// peers to add to the torrent, to be tried to be connected to as
|
|
|
|
// bittorrent peers.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<tcp::endpoint>> peers;
|
2016-02-12 23:50:29 +01:00
|
|
|
|
|
|
|
// peers banned from this torrent. The will not be connected to
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<tcp::endpoint>> banned_peers;
|
2016-02-12 21:42:39 +01:00
|
|
|
|
2016-02-12 23:50:29 +01:00
|
|
|
// this is a map of partially downloaded piece. The key is the piece index
|
|
|
|
// and the value is a bitfield where each bit represents a 16 kiB block.
|
|
|
|
// A set bit means we have that block.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::map<piece_index_t, bitfield>> unfinished_pieces;
|
2016-02-12 23:50:29 +01:00
|
|
|
|
|
|
|
// this is a bitfield indicating which pieces we already have of this
|
|
|
|
// torrent.
|
2016-12-22 16:42:33 +01:00
|
|
|
typed_bitfield<piece_index_t> have_pieces;
|
2016-02-12 23:50:29 +01:00
|
|
|
|
|
|
|
// when in seed_mode, pieces with a set bit in this bitfield have been
|
|
|
|
// verified to be valid. Other pieces will be verified the first time a
|
|
|
|
// peer requests it.
|
2016-12-22 16:42:33 +01:00
|
|
|
typed_bitfield<piece_index_t> verified_pieces;
|
2016-02-12 23:50:29 +01:00
|
|
|
|
|
|
|
// this sets the priorities for each individual piece in the torrent. Each
|
|
|
|
// element in the vector represent the piece with the same index. If you
|
|
|
|
// set both file- and piece priorities, file priorities will take
|
|
|
|
// precedence.
|
2017-10-29 00:44:40 +02:00
|
|
|
aux::noexcept_movable<std::vector<download_priority_t>> piece_priorities;
|
2016-02-12 23:50:29 +01:00
|
|
|
|
2016-02-13 22:41:38 +01:00
|
|
|
// if this is a merkle tree torrent, and you're seeding, this field must
|
|
|
|
// be set. It is all the hashes in the binary tree, with the root as the
|
|
|
|
// first entry. See torrent_info::set_merkle_tree() for more info.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<sha1_hash>> merkle_tree;
|
2016-02-13 22:41:38 +01:00
|
|
|
|
2016-02-14 00:07:02 +01:00
|
|
|
// this is a map of file indices in the torrent and new filenames to be
|
|
|
|
// applied before the torrent is added.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::map<file_index_t, std::string>> renamed_files;
|
2016-02-14 00:07:02 +01:00
|
|
|
|
2018-04-28 03:25:36 +02:00
|
|
|
std::time_t last_download = 0;
|
|
|
|
std::time_t last_upload = 0;
|
2013-08-02 11:42:51 +02:00
|
|
|
|
2018-04-26 09:01:14 +02:00
|
|
|
#if TORRENT_ABI_VERSION == 1
|
2016-11-02 06:03:12 +01:00
|
|
|
// deprecated in 1.2
|
2017-03-29 08:16:07 +02:00
|
|
|
|
|
|
|
// ``url`` can be set to a magnet link, in order to download the .torrent
|
|
|
|
// file (also known as the metadata), specifically the info-dictionary,
|
|
|
|
// from the bittorrent swarm. This may require access to the DHT, in case
|
|
|
|
// the magnet link does not come with trackers.
|
|
|
|
//
|
|
|
|
// In earlier versions of libtorrent, the URL could be an HTTP or file://
|
|
|
|
// url. These uses are deprecated and discouraged. When adding a torrent
|
|
|
|
// by magnet link, it will be set to the ``downloading_metadata`` state
|
|
|
|
// until the .torrent file has been downloaded. If there is any error
|
|
|
|
// while downloading, the torrent will be stopped and the torrent error
|
|
|
|
// state (``torrent_status::error``) will indicate what went wrong.
|
|
|
|
std::string TORRENT_DEPRECATED_MEMBER url;
|
|
|
|
|
2016-02-20 21:49:49 +01:00
|
|
|
// if ``uuid`` is specified, it is used to find duplicates. If another
|
|
|
|
// torrent is already running with the same UUID as the one being added,
|
|
|
|
// it will be considered a duplicate. This is mainly useful for RSS feed
|
|
|
|
// items which has UUIDs specified.
|
2017-03-19 17:58:55 +01:00
|
|
|
std::string TORRENT_DEPRECATED_MEMBER uuid;
|
2016-02-20 21:49:49 +01:00
|
|
|
|
2016-02-11 19:58:18 +01:00
|
|
|
// The optional parameter, ``resume_data`` can be given if up to date
|
|
|
|
// fast-resume data is available. The fast-resume data can be acquired
|
|
|
|
// from a running torrent by calling save_resume_data() on
|
|
|
|
// torrent_handle. See fast-resume_. The ``vector`` that is passed in
|
|
|
|
// will be swapped into the running torrent instance with
|
|
|
|
// ``std::vector::swap()``.
|
2017-05-28 13:14:58 +02:00
|
|
|
aux::noexcept_movable<std::vector<char>> TORRENT_DEPRECATED_MEMBER resume_data;
|
2016-02-20 00:56:26 +01:00
|
|
|
|
|
|
|
// to support the deprecated use case of reading the resume data into
|
|
|
|
// resume_data field and getting a reject alert, any parse failure is
|
|
|
|
// communicated forward into libtorrent via this field. If this is set, a
|
|
|
|
// fastresume_rejected_alert will be posted.
|
|
|
|
error_code internal_resume_data_error;
|
2018-04-26 09:01:14 +02:00
|
|
|
#endif // TORRENT_ABI_VERSION
|
2016-02-11 19:58:18 +01:00
|
|
|
|
2009-11-26 06:45:43 +01:00
|
|
|
};
|
2018-04-26 09:01:14 +02:00
|
|
|
|
|
|
|
TORRENT_VERSION_NAMESPACE_2_END
|
2009-11-26 06:45:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|