2004-01-18 20:12:18 +01:00
|
|
|
/*
|
|
|
|
|
2014-02-23 20:12:25 +01:00
|
|
|
Copyright (c) 2003-2014, Arvid Norberg
|
2004-01-18 20:12:18 +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_ALERT_TYPES_HPP_INCLUDED
|
|
|
|
#define TORRENT_ALERT_TYPES_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include "libtorrent/alert.hpp"
|
|
|
|
#include "libtorrent/torrent_handle.hpp"
|
2004-03-08 13:36:03 +01:00
|
|
|
#include "libtorrent/socket.hpp"
|
2005-11-01 19:30:39 +01:00
|
|
|
#include "libtorrent/config.hpp"
|
2007-09-10 08:12:41 +02:00
|
|
|
#include "libtorrent/assert.hpp"
|
2008-07-08 11:30:10 +02:00
|
|
|
#include "libtorrent/identify_client.hpp"
|
2009-11-23 09:38:50 +01:00
|
|
|
#include "libtorrent/address.hpp"
|
2010-01-02 15:16:35 +01:00
|
|
|
#include "libtorrent/stat.hpp"
|
2011-01-18 04:41:54 +01:00
|
|
|
#include "libtorrent/rss.hpp" // for feed_handle
|
2015-02-15 06:17:09 +01:00
|
|
|
#include "libtorrent/operations.hpp" // for operation_t enum
|
2010-01-02 15:16:35 +01:00
|
|
|
|
2004-01-18 20:12:18 +01:00
|
|
|
namespace libtorrent
|
|
|
|
{
|
2012-02-12 11:11:14 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// maps an operation id (from peer_error_alert and peer_disconnected_alert)
|
|
|
|
// to its name. See peer_connection for the constants
|
|
|
|
TORRENT_EXPORT char const* operation_name(int op);
|
|
|
|
|
2012-02-12 11:11:14 +01:00
|
|
|
// user defined alerts should use IDs greater than this
|
|
|
|
const static int user_alert_id = 10000;
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// This is a base class for alerts that are associated with a
|
|
|
|
// specific torrent. It contains a handle to the torrent.
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT torrent_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2014-07-06 21:18:00 +02:00
|
|
|
torrent_alert(torrent_handle const& h);
|
2007-01-16 06:05:52 +01:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2014-07-06 21:18:00 +02:00
|
|
|
const static int alert_type = 0;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// The torrent_handle pointing to the torrent this
|
|
|
|
// alert is associated with.
|
2007-01-16 06:05:52 +01:00
|
|
|
torrent_handle handle;
|
2014-07-06 21:18:00 +02:00
|
|
|
std::string name;
|
2007-01-16 06:05:52 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// The peer alert is a base class for alerts that refer to a specific peer. It includes all
|
|
|
|
// the information to identify the peer. i.e. ``ip`` and ``peer-id``.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-08-09 03:44:42 +02:00
|
|
|
peer_alert(torrent_handle const& h, tcp::endpoint const& i
|
|
|
|
, peer_id const& pi)
|
2008-07-08 11:30:10 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, ip(i)
|
|
|
|
, pid(pi)
|
2008-07-08 11:30:10 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
const static int alert_type = 1;
|
2008-07-08 11:30:10 +02:00
|
|
|
const static int static_category = alert::peer_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-07-08 11:30:10 +02:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// The peer's IP address and port.
|
2008-07-08 11:30:10 +02:00
|
|
|
tcp::endpoint ip;
|
2013-09-01 19:34:05 +02:00
|
|
|
|
|
|
|
// the peer ID, if known.
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_id pid;
|
|
|
|
};
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// This is a base class used for alerts that are associated with a
|
|
|
|
// specific tracker. It derives from torrent_alert since a tracker
|
|
|
|
// is also associated with a specific torrent.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT tracker_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-08 11:30:10 +02:00
|
|
|
tracker_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u)
|
2008-07-08 11:30:10 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, url(u)
|
2008-07-12 13:04:23 +02:00
|
|
|
{}
|
2008-07-08 11:30:10 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
const static int alert_type = 2;
|
2008-07-08 11:30:10 +02:00
|
|
|
const static int static_category = alert::tracker_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-07-08 11:30:10 +02:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// The tracker URL
|
2008-07-08 11:30:10 +02:00
|
|
|
std::string url;
|
|
|
|
};
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
#define TORRENT_DEFINE_ALERT(name, seq) \
|
|
|
|
const static int alert_type = seq; \
|
2009-10-30 04:21:25 +01:00
|
|
|
virtual int type() const { return alert_type; } \
|
|
|
|
virtual std::auto_ptr<alert> clone() const \
|
|
|
|
{ return std::auto_ptr<alert>(new name(*this)); } \
|
|
|
|
virtual int category() const { return static_category; } \
|
|
|
|
virtual char const* what() const { return #name; }
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// The ``torrent_added_alert`` is posted once every time a torrent is successfully
|
|
|
|
// added. It doesn't contain any members of its own, but inherits the torrent handle
|
|
|
|
// from its base class.
|
|
|
|
// It's posted when the ``status_notification`` bit is set in the alert_mask.
|
2011-02-01 04:25:40 +01:00
|
|
|
struct TORRENT_EXPORT torrent_added_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2011-02-01 04:25:40 +01:00
|
|
|
torrent_added_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_added_alert, 3);
|
2011-02-01 04:25:40 +01:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// The ``torrent_removed_alert`` is posted whenever a torrent is removed. Since
|
|
|
|
// the torrent handle in its baseclass will always be invalid (since the torrent
|
|
|
|
// is already removed) it has the info hash as a member, to identify it.
|
|
|
|
// It's posted when the ``status_notification`` bit is set in the alert_mask.
|
|
|
|
//
|
|
|
|
// Even though the ``handle`` member doesn't point to an existing torrent anymore,
|
|
|
|
// it is still useful for comparing to other handles, which may also no
|
|
|
|
// longer point to existing torrents, but to the same non-existing torrents.
|
|
|
|
//
|
|
|
|
// The ``torrent_handle`` acts as a ``weak_ptr``, even though its object no
|
|
|
|
// longer exists, it can still compare equal to another weak pointer which
|
|
|
|
// points to the same non-existent object.
|
2011-02-01 04:25:40 +01:00
|
|
|
struct TORRENT_EXPORT torrent_removed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2011-02-01 04:25:40 +01:00
|
|
|
torrent_removed_alert(torrent_handle const& h, sha1_hash const& ih)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, info_hash(ih)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_removed_alert, 4);
|
2011-02-01 04:25:40 +01:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
2014-07-06 21:18:00 +02:00
|
|
|
virtual bool discardable() const { return false; }
|
2011-02-01 04:25:40 +01:00
|
|
|
sha1_hash info_hash;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted when the asynchronous read operation initiated by
|
|
|
|
// a call to torrent_handle::read_piece() is completed. If the read failed, the torrent
|
|
|
|
// is paused and an error state is set and the buffer member of the alert
|
|
|
|
// is 0. If successful, ``buffer`` points to a buffer containing all the data
|
|
|
|
// of the piece. ``piece`` is the piece index that was read. ``size`` is the
|
|
|
|
// number of bytes that was read.
|
|
|
|
//
|
|
|
|
// If the operation fails, ec will indicat what went wrong.
|
|
|
|
struct TORRENT_EXPORT read_piece_alert: torrent_alert
|
2008-12-14 20:47:02 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-12-14 20:47:02 +01:00
|
|
|
read_piece_alert(torrent_handle const& h
|
|
|
|
, int p, boost::shared_array<char> d, int s)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, buffer(d)
|
|
|
|
, piece(p)
|
2009-05-15 17:52:15 +02:00
|
|
|
, size(s)
|
2008-12-14 20:47:02 +01:00
|
|
|
{}
|
2013-01-29 03:18:32 +01:00
|
|
|
read_piece_alert(torrent_handle h, int p, error_code e)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, ec(e)
|
|
|
|
, piece(p)
|
|
|
|
, size(0)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(read_piece_alert, 5);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-12-14 20:47:02 +01:00
|
|
|
const static int static_category = alert::storage_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2008-12-14 20:47:02 +01:00
|
|
|
|
2013-01-29 03:18:32 +01:00
|
|
|
error_code ec;
|
2008-12-14 20:47:02 +01:00
|
|
|
boost::shared_array<char> buffer;
|
|
|
|
int piece;
|
2009-03-27 18:14:15 +01:00
|
|
|
int size;
|
2008-12-14 20:47:02 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is posted whenever an individual file completes its download. i.e.
|
|
|
|
// All pieces overlapping this file have passed their hash check.
|
2009-07-04 06:58:24 +02:00
|
|
|
struct TORRENT_EXPORT file_completed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2009-07-04 06:58:24 +02:00
|
|
|
file_completed_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, int idx)
|
2009-07-04 06:58:24 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, index(idx)
|
2009-07-04 06:58:24 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(file_completed_alert, 6);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-07-04 06:58:24 +02:00
|
|
|
const static int static_category = alert::progress_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-07-04 06:58:24 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// refers to the index of the file that completed.
|
2009-07-04 06:58:24 +02:00
|
|
|
int index;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is posted as a response to a torrent_handle::rename_file() call, if the rename
|
|
|
|
// operation succeeds.
|
2008-05-28 10:44:40 +02:00
|
|
|
struct TORRENT_EXPORT file_renamed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-05-28 10:44:40 +02:00
|
|
|
file_renamed_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& n
|
|
|
|
, int idx)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, name(n)
|
|
|
|
, index(idx)
|
2008-05-28 10:44:40 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(file_renamed_alert, 7);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::storage_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2008-05-28 10:44:40 +02:00
|
|
|
|
|
|
|
std::string name;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// refers to the index of the file that was renamed,
|
|
|
|
// ``name`` is the new name of the file.
|
2008-07-06 14:22:56 +02:00
|
|
|
int index;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is posted as a response to a torrent_handle::rename_file() call, if the rename
|
|
|
|
// operation failed.
|
2008-07-06 14:22:56 +02:00
|
|
|
struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
file_rename_failed_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, int idx
|
|
|
|
, error_code ec)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, index(idx)
|
|
|
|
, error(ec)
|
2008-07-06 14:22:56 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(file_rename_failed_alert, 8);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::storage_notification;
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// refers to the index of the file that was supposed to be renamed,
|
|
|
|
// ``error`` is the error code returned from the filesystem.
|
2008-07-06 14:22:56 +02:00
|
|
|
int index;
|
2009-05-07 08:41:41 +02:00
|
|
|
error_code error;
|
2008-05-28 10:44:40 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a limit is reached that might have a negative impact on
|
|
|
|
// upload or download rate performance.
|
2008-08-19 17:04:14 +02:00
|
|
|
struct TORRENT_EXPORT performance_alert: torrent_alert
|
|
|
|
{
|
|
|
|
enum performance_warning_t
|
|
|
|
{
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// This warning means that the number of bytes queued to be written to disk
|
2014-07-06 21:18:00 +02:00
|
|
|
// exceeds the max disk byte queue setting (``settings_pack::max_queued_disk_bytes``).
|
2013-08-09 03:44:42 +02:00
|
|
|
// This might restrict the download rate, by not queuing up enough write jobs
|
|
|
|
// to the disk I/O thread. When this alert is posted, peer connections are
|
|
|
|
// temporarily stopped from downloading, until the queued disk bytes have fallen
|
|
|
|
// below the limit again. Unless your ``max_queued_disk_bytes`` setting is already
|
|
|
|
// high, you might want to increase it to get better performance.
|
2008-08-19 17:04:14 +02:00
|
|
|
outstanding_disk_buffer_limit_reached,
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// This is posted when libtorrent would like to send more requests to a peer,
|
2014-07-06 21:18:00 +02:00
|
|
|
// but it's limited by ``settings_pack::max_out_request_queue``. The queue length
|
2013-08-09 03:44:42 +02:00
|
|
|
// libtorrent is trying to achieve is determined by the download rate and the
|
2014-07-06 21:18:00 +02:00
|
|
|
// assumed round-trip-time (``settings_pack::request_queue_time``). The assumed
|
2013-08-09 03:44:42 +02:00
|
|
|
// rount-trip-time is not limited to just the network RTT, but also the remote disk
|
|
|
|
// access time and message handling time. It defaults to 3 seconds. The target number
|
|
|
|
// of outstanding requests is set to fill the bandwidth-delay product (assumed RTT
|
|
|
|
// times download rate divided by number of bytes per request). When this alert
|
|
|
|
// is posted, there is a risk that the number of outstanding requests is too low
|
|
|
|
// and limits the download rate. You might want to increase the ``max_out_request_queue``
|
|
|
|
// setting.
|
|
|
|
outstanding_request_limit_reached,
|
|
|
|
|
|
|
|
// This warning is posted when the amount of TCP/IP overhead is greater than the
|
|
|
|
// upload rate limit. When this happens, the TCP/IP overhead is caused by a much
|
|
|
|
// faster download rate, triggering TCP ACK packets. These packets eat into the
|
|
|
|
// rate limit specified to libtorrent. When the overhead traffic is greater than
|
|
|
|
// the rate limit, libtorrent will not be able to send any actual payload, such
|
|
|
|
// as piece requests. This means the download rate will suffer, and new requests
|
|
|
|
// can be sent again. There will be an equilibrium where the download rate, on
|
|
|
|
// average, is about 20 times the upload rate limit. If you want to maximize the
|
|
|
|
// download rate, increase the upload rate limit above 5% of your download capacity.
|
2008-10-28 07:45:42 +01:00
|
|
|
upload_limit_too_low,
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// This is the same warning as ``upload_limit_too_low`` but referring to the download
|
|
|
|
// limit instead of upload. This suggests that your download rate limit is mcuh lower
|
|
|
|
// than your upload capacity. Your upload rate will suffer. To maximize upload rate,
|
|
|
|
// make sure your download rate limit is above 5% of your upload capacity.
|
2009-08-17 22:29:09 +02:00
|
|
|
download_limit_too_low,
|
2012-03-04 12:18:27 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// We're stalled on the disk. We want to write to the socket, and we can write
|
|
|
|
// but our send buffer is empty, waiting to be refilled from the disk.
|
|
|
|
// This either means the disk is slower than the network connection
|
|
|
|
// or that our send buffer watermark is too small, because we can
|
|
|
|
// send it all before the disk gets back to us.
|
|
|
|
// The number of bytes that we keep outstanding, requested from the disk, is calculated
|
|
|
|
// as follows::
|
|
|
|
//
|
|
|
|
// min(512, max(upload_rate * send_buffer_watermark_factor / 100, send_buffer_watermark))
|
|
|
|
//
|
|
|
|
// If you receive this alert, you migth want to either increase your ``send_buffer_watermark``
|
|
|
|
// or ``send_buffer_watermark_factor``.
|
|
|
|
send_buffer_watermark_too_low,
|
2012-03-04 12:18:27 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// If the half (or more) of all upload slots are set as optimistic unchoke slots, this
|
|
|
|
// warning is issued. You probably want more regular (rate based) unchoke slots.
|
|
|
|
too_many_optimistic_unchoke_slots,
|
2012-03-04 12:18:27 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// If the disk write queue ever grows larger than half of the cache size, this warning
|
|
|
|
// is posted. The disk write queue eats into the total disk cache and leaves very little
|
|
|
|
// left for the actual cache. This causes the disk cache to oscillate in evicting large
|
|
|
|
// portions of the cache before allowing peers to download any more, onto the disk write
|
|
|
|
// queue. Either lower ``max_queued_disk_bytes`` or increase ``cache_size``.
|
|
|
|
too_high_disk_queue_limit,
|
2012-03-04 12:18:27 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
aio_limit_reached,
|
2013-08-09 03:44:42 +02:00
|
|
|
bittyrant_with_no_uplimit,
|
2012-03-04 12:18:27 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is generated if outgoing peer connections are failing because of *address in use*
|
2014-07-06 21:18:00 +02:00
|
|
|
// errors, indicating that ``settings_pack::outgoing_ports`` is set and is too small of
|
2013-08-09 03:44:42 +02:00
|
|
|
// a range. Consider not using the ``outgoing_ports`` setting at all, or widen the range to
|
|
|
|
// include more ports.
|
|
|
|
too_few_outgoing_ports,
|
2010-02-06 08:39:45 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
too_few_file_descriptors,
|
2010-02-06 08:39:45 +01:00
|
|
|
|
2010-03-04 04:46:45 +01:00
|
|
|
num_warnings
|
2008-08-19 17:04:14 +02:00
|
|
|
};
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-08-19 17:04:14 +02:00
|
|
|
performance_alert(torrent_handle const& h
|
|
|
|
, performance_warning_t w)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, warning_code(w)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(performance_alert, 9);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::performance_warning;
|
2008-08-19 17:04:14 +02:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-08-19 17:04:14 +02:00
|
|
|
|
|
|
|
performance_warning_t warning_code;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// Generated whenever a torrent changes its state.
|
2008-07-03 12:05:51 +02:00
|
|
|
struct TORRENT_EXPORT state_changed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-03 12:05:51 +02:00
|
|
|
state_changed_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, torrent_status::state_t st
|
|
|
|
, torrent_status::state_t prev_st)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, state(st)
|
|
|
|
, prev_state(prev_st)
|
2008-07-03 12:05:51 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(state_changed_alert, 10);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
2008-07-03 12:05:51 +02:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// the new state of the torrent.
|
2008-07-03 12:05:51 +02:00
|
|
|
torrent_status::state_t state;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// the previous state.
|
2008-12-01 01:19:05 +01:00
|
|
|
torrent_status::state_t prev_state;
|
2008-07-03 12:05:51 +02:00
|
|
|
};
|
|
|
|
|
2015-02-21 23:45:45 +01:00
|
|
|
// This alert is generated on tracker time outs, premature disconnects,
|
|
|
|
// invalid response or a HTTP response other than "200 OK". From the alert
|
|
|
|
// you can get the handle to the torrent the tracker belongs to.
|
2013-08-09 03:44:42 +02:00
|
|
|
//
|
2015-02-21 23:45:45 +01:00
|
|
|
// The ``times_in_row`` member says how many times in a row this tracker has
|
|
|
|
// failed. ``status_code`` is the code returned from the HTTP server. 401
|
|
|
|
// means the tracker needs authentication, 404 means not found etc. If the
|
|
|
|
// tracker timed out, the code will be set to 0.
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_error_alert: tracker_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2009-06-12 18:40:38 +02:00
|
|
|
tracker_error_alert(torrent_handle const& h
|
|
|
|
, int times
|
|
|
|
, int status
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
2010-02-23 22:53:45 +01:00
|
|
|
, error_code const& e
|
|
|
|
, std::string const& m)
|
2013-08-09 03:44:42 +02:00
|
|
|
: tracker_alert(h, u)
|
2009-06-12 18:40:38 +02:00
|
|
|
, times_in_row(times)
|
|
|
|
, status_code(status)
|
2010-02-23 22:53:45 +01:00
|
|
|
, error(e)
|
2010-03-02 04:55:47 +01:00
|
|
|
, msg(m)
|
2009-06-12 18:40:38 +02:00
|
|
|
{
|
|
|
|
TORRENT_ASSERT(!url.empty());
|
|
|
|
}
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(tracker_error_alert, 11);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::tracker_notification | alert::error_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2004-09-12 12:12:16 +02:00
|
|
|
int times_in_row;
|
2005-04-21 01:00:27 +02:00
|
|
|
int status_code;
|
2010-02-23 22:53:45 +01:00
|
|
|
error_code error;
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2004-01-18 20:12:18 +01:00
|
|
|
};
|
|
|
|
|
2015-02-21 23:45:45 +01:00
|
|
|
// This alert is triggered if the tracker reply contains a warning field.
|
|
|
|
// Usually this means that the tracker announce was successful, but the
|
|
|
|
// tracker has a message to the client.
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_warning_alert: tracker_alert
|
2005-08-11 01:32:39 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2005-08-11 01:32:39 +02:00
|
|
|
tracker_warning_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
|
|
|
, std::string const& m)
|
|
|
|
: tracker_alert(h, u)
|
|
|
|
, msg(m)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2005-08-11 01:32:39 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(tracker_warning_alert, 12);
|
2008-07-06 14:22:56 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::tracker_notification | alert::error_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// contains the warning message from the tracker.
|
2009-10-30 04:21:25 +01:00
|
|
|
std::string msg;
|
2005-08-11 01:32:39 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a scrape request succeeds.
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT scrape_reply_alert: tracker_alert
|
2007-11-20 23:46:27 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2007-11-20 23:46:27 +01:00
|
|
|
scrape_reply_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, int incomp
|
|
|
|
, int comp
|
|
|
|
, std::string const& u)
|
|
|
|
: tracker_alert(h, u)
|
|
|
|
, incomplete(incomp)
|
|
|
|
, complete(comp)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2007-11-20 23:46:27 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(scrape_reply_alert, 13);
|
2007-11-20 23:46:27 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// the data returned in the scrape response. These numbers
|
|
|
|
// may be -1 if the reponse was malformed.
|
2009-10-30 04:21:25 +01:00
|
|
|
int incomplete;
|
|
|
|
int complete;
|
2007-11-20 23:46:27 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// If a scrape request fails, this alert is generated. This might be due
|
|
|
|
// to the tracker timing out, refusing connection or returning an http response
|
|
|
|
// code indicating an error.
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT scrape_failed_alert: tracker_alert
|
2007-11-20 23:46:27 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2009-06-12 18:40:38 +02:00
|
|
|
scrape_failed_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
2009-06-12 18:40:38 +02:00
|
|
|
, error_code const& e)
|
2013-08-09 03:44:42 +02:00
|
|
|
: tracker_alert(h, u)
|
2013-08-08 06:32:54 +02:00
|
|
|
, msg(convert_from_native(e.message()))
|
2009-06-12 18:40:38 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
|
|
|
|
2007-11-20 23:46:27 +01:00
|
|
|
scrape_failed_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
|
|
|
, std::string const& m)
|
|
|
|
: tracker_alert(h, u)
|
|
|
|
, msg(m)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2007-11-20 23:46:27 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(scrape_failed_alert, 14);
|
2008-07-06 14:22:56 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::tracker_notification | alert::error_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// contains a message describing the error.
|
2009-10-30 04:21:25 +01:00
|
|
|
std::string msg;
|
2007-11-20 23:46:27 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is only for informational purpose. It is generated when a tracker announce
|
|
|
|
// succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or
|
|
|
|
// the DHT.
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_reply_alert: tracker_alert
|
2005-03-10 10:59:12 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2005-06-06 12:33:44 +02:00
|
|
|
tracker_reply_alert(torrent_handle const& h
|
2007-02-01 08:33:04 +01:00
|
|
|
, int np
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u)
|
|
|
|
: tracker_alert(h, u)
|
2007-02-01 08:33:04 +01:00
|
|
|
, num_peers(np)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2005-03-10 10:59:12 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(tracker_reply_alert, 15);
|
2007-02-01 08:33:04 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// tells how many peers the tracker returned in this response. This is
|
|
|
|
// not expected to be more thant the ``num_want`` settings. These are not necessarily
|
|
|
|
// all new peers, some of them may already be connected.
|
2009-10-30 04:21:25 +01:00
|
|
|
int num_peers;
|
2008-07-06 14:22:56 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated each time the DHT receives peers from a node. ``num_peers``
|
|
|
|
// is the number of peers we received in this packet. Typically these packets are
|
|
|
|
// received from multiple DHT nodes, and so the alerts are typically generated
|
|
|
|
// a few at a time.
|
2008-07-06 14:22:56 +02:00
|
|
|
struct TORRENT_EXPORT dht_reply_alert: tracker_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
dht_reply_alert(torrent_handle const& h
|
|
|
|
, int np)
|
|
|
|
: tracker_alert(h, "")
|
|
|
|
, num_peers(np)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_reply_alert, 16);
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
int num_peers;
|
2005-03-10 10:59:12 +01:00
|
|
|
};
|
2005-06-06 12:33:44 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated each time a tracker announce is sent (or attempted to be sent).
|
|
|
|
// There are no extra data members in this alert. The url can be found in the base class
|
|
|
|
// however.
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_announce_alert: tracker_alert
|
2005-06-06 12:33:44 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-04-23 03:54:21 +02:00
|
|
|
tracker_announce_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u, int e)
|
|
|
|
: tracker_alert(h, u)
|
|
|
|
, event(e)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2008-07-11 14:00:29 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(tracker_announce_alert, 17);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// specifies what event was sent to the tracker. It is defined as:
|
|
|
|
//
|
|
|
|
// 0. None
|
|
|
|
// 1. Completed
|
|
|
|
// 2. Started
|
|
|
|
// 3. Stopped
|
2009-10-30 04:21:25 +01:00
|
|
|
int event;
|
2005-06-06 12:33:44 +02:00
|
|
|
};
|
2005-03-10 10:59:12 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a finished piece fails its hash check. You can get the handle
|
|
|
|
// to the torrent which got the failed piece and the index of the piece itself from the alert.
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT hash_failed_alert: torrent_alert
|
2004-01-18 20:12:18 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2004-01-18 20:12:18 +01:00
|
|
|
hash_failed_alert(
|
2005-06-06 12:33:44 +02:00
|
|
|
torrent_handle const& h
|
2008-07-06 14:22:56 +02:00
|
|
|
, int index)
|
|
|
|
: torrent_alert(h)
|
2004-01-18 20:12:18 +01:00
|
|
|
, piece_index(index)
|
2007-10-05 02:30:00 +02:00
|
|
|
{ TORRENT_ASSERT(index >= 0);}
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(hash_failed_alert, 18);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2004-01-18 20:12:18 +01:00
|
|
|
|
|
|
|
int piece_index;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a peer is banned because it has sent too many corrupt pieces
|
|
|
|
// to us. ``ip`` is the endpoint to the peer that was banned.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_ban_alert: peer_alert
|
2004-03-21 03:03:37 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
peer_ban_alert(torrent_handle h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2004-03-21 03:03:37 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_ban_alert, 19);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2004-03-21 03:03:37 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a peer is unsnubbed. Essentially when it was snubbed for stalling
|
|
|
|
// sending data, and now it started sending data again.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert
|
2008-07-07 14:04:06 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2008-07-07 14:04:06 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_unsnubbed_alert, 20);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-07-07 14:04:06 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a peer is snubbed, when it stops sending data when we request
|
|
|
|
// it.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_snubbed_alert: peer_alert
|
2004-01-18 20:12:18 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2008-07-06 14:22:56 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_snubbed_alert, 21);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2008-07-06 14:22:56 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a peer sends invalid data over the peer-peer protocol. The peer
|
|
|
|
// will be disconnected, but you get its ip address from the alert, to identify it.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_error_alert: peer_alert
|
2008-07-06 14:22:56 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
peer_error_alert(torrent_handle const& h, tcp::endpoint const& ep
|
2014-07-06 21:18:00 +02:00
|
|
|
, peer_id const& peer_id, int op, error_code const& e)
|
2010-03-06 08:16:39 +01:00
|
|
|
: peer_alert(h, ep, peer_id)
|
2014-07-06 21:18:00 +02:00
|
|
|
, operation(op)
|
2009-06-12 18:40:38 +02:00
|
|
|
, error(e)
|
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_error_alert, 22);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::peer_notification;
|
2014-07-06 21:18:00 +02:00
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// a NULL-terminated string of the low-level operation that failed, or NULL if
|
|
|
|
// there was no low level disk operation.
|
|
|
|
int operation;
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// tells you what error caused this alert.
|
2009-06-12 18:40:38 +02:00
|
|
|
error_code error;
|
|
|
|
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
2004-01-18 20:12:18 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted every time an outgoing peer connect attempts succeeds.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_connect_alert: peer_alert
|
2008-05-12 08:05:13 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
peer_connect_alert(torrent_handle h, tcp::endpoint const& ep
|
2013-08-01 02:44:14 +02:00
|
|
|
, peer_id const& peer_id, int type)
|
2010-03-06 08:16:39 +01:00
|
|
|
: peer_alert(h, ep, peer_id)
|
2013-08-01 02:44:14 +02:00
|
|
|
, socket_type(type)
|
2008-07-06 14:22:56 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_connect_alert, 23);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::debug_notification;
|
2014-07-05 01:40:31 +02:00
|
|
|
virtual std::string message() const;
|
2013-08-01 02:44:14 +02:00
|
|
|
|
|
|
|
int socket_type;
|
2008-07-06 14:22:56 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a peer is disconnected for any reason (other than the ones
|
|
|
|
// covered by peer_error_alert ).
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_disconnected_alert: peer_alert
|
2008-07-06 14:22:56 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
peer_disconnected_alert(torrent_handle const& h, tcp::endpoint const& ep
|
2015-02-15 06:17:09 +01:00
|
|
|
, peer_id const& peer_id, operation_t op, int type, error_code const& e)
|
2010-03-06 08:16:39 +01:00
|
|
|
: peer_alert(h, ep, peer_id)
|
2015-02-15 06:17:09 +01:00
|
|
|
, socket_type(type)
|
2014-07-06 21:18:00 +02:00
|
|
|
, operation(op)
|
2009-06-12 18:40:38 +02:00
|
|
|
, error(e)
|
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
2008-05-12 08:05:13 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_disconnected_alert, 24);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::debug_notification;
|
2013-07-28 17:06:28 +02:00
|
|
|
virtual std::string message() const;
|
2008-05-12 08:05:13 +02:00
|
|
|
|
2015-02-15 06:17:09 +01:00
|
|
|
// the kind of socket this peer was connected over
|
|
|
|
int socket_type;
|
|
|
|
|
|
|
|
// the operation or level where the error occurred. Specified as an
|
|
|
|
// value from the operation_t enum. Defined in operations.hpp.
|
|
|
|
operation_t operation;
|
2014-07-06 21:18:00 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// tells you what error caused peer to disconnect.
|
2009-06-12 18:40:38 +02:00
|
|
|
error_code error;
|
|
|
|
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
2008-05-12 08:05:13 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is a debug alert that is generated by an incoming invalid piece request.
|
|
|
|
// ``ip`` is the address of the peer and the ``request`` is the actual incoming
|
|
|
|
// request from the peer. See peer_request for more info.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT invalid_request_alert: peer_alert
|
2004-01-18 20:12:18 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
invalid_request_alert(torrent_handle const& h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id, peer_request const& r)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2004-01-18 20:12:18 +01:00
|
|
|
, request(r)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(invalid_request_alert, 25);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2004-01-18 20:12:18 +01:00
|
|
|
|
|
|
|
peer_request request;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a torrent switches from being a downloader to a seed.
|
|
|
|
// It will only be generated once per torrent. It contains a torrent_handle to the
|
|
|
|
// torrent in question.
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT torrent_finished_alert: torrent_alert
|
2004-01-18 20:12:18 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2004-01-18 20:12:18 +01:00
|
|
|
torrent_finished_alert(
|
2008-07-06 14:22:56 +02:00
|
|
|
const torrent_handle& h)
|
|
|
|
: torrent_alert(h)
|
2004-01-18 20:12:18 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_finished_alert, 26);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " torrent finished downloading"; }
|
2004-01-18 20:12:18 +01:00
|
|
|
};
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// this alert is posted every time a piece completes downloading
|
|
|
|
// and passes the hash check. This alert derives from torrent_alert
|
|
|
|
// which contains the torrent_handle to the torrent the piece belongs to.
|
2007-08-01 08:14:16 +02:00
|
|
|
struct TORRENT_EXPORT piece_finished_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2007-08-01 08:14:16 +02:00
|
|
|
piece_finished_alert(
|
|
|
|
const torrent_handle& h
|
2008-07-06 14:22:56 +02:00
|
|
|
, int piece_num)
|
|
|
|
: torrent_alert(h)
|
2007-08-01 08:14:16 +02:00
|
|
|
, piece_index(piece_num)
|
2007-10-05 02:30:00 +02:00
|
|
|
{ TORRENT_ASSERT(piece_index >= 0);}
|
2007-08-01 08:14:16 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(piece_finished_alert, 27);
|
2007-08-01 08:14:16 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::progress_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// the index of the piece that finished
|
2009-10-30 04:21:25 +01:00
|
|
|
int piece_index;
|
2007-08-01 08:14:16 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a peer rejects or ignores a piece request.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT request_dropped_alert: peer_alert
|
2008-07-07 14:04:06 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
request_dropped_alert(const torrent_handle& h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2008-07-07 14:04:06 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(request_dropped_alert, 28);
|
2008-07-07 14:04:06 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::progress_notification
|
|
|
|
| alert::peer_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
2008-07-07 14:04:06 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a block request times out.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT block_timeout_alert: peer_alert
|
2008-07-07 14:04:06 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
block_timeout_alert(const torrent_handle& h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2008-07-07 14:04:06 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(block_timeout_alert, 29);
|
2008-07-07 14:04:06 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::progress_notification
|
|
|
|
| alert::peer_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
2008-07-07 14:04:06 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a block request receives a response.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT block_finished_alert: peer_alert
|
2007-08-01 08:14:16 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
block_finished_alert(const torrent_handle& h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2007-08-01 08:14:16 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
2007-10-05 02:30:00 +02:00
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
2007-08-01 08:14:16 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(block_finished_alert, 30);
|
2007-08-01 08:14:16 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::progress_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
2007-08-01 08:14:16 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a block request is sent to a peer.
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT block_downloading_alert: peer_alert
|
2007-08-01 08:14:16 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
block_downloading_alert(const torrent_handle& h, tcp::endpoint const& ep
|
2015-02-08 22:17:00 +01:00
|
|
|
, peer_id const& peer_id, int block_num, int piece_num)
|
2010-03-06 08:16:39 +01:00
|
|
|
: peer_alert(h, ep, peer_id)
|
2015-02-08 22:17:00 +01:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
|
|
|
, peer_speedmsg("")
|
|
|
|
#endif
|
2007-08-01 08:14:16 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
2009-10-30 04:21:25 +01:00
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0); }
|
2007-08-01 08:14:16 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(block_downloading_alert, 31);
|
2007-08-01 08:14:16 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::progress_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2015-02-08 22:17:00 +01:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2009-10-30 04:21:25 +01:00
|
|
|
char const* peer_speedmsg;
|
2015-02-08 22:17:00 +01:00
|
|
|
#endif
|
2009-10-30 04:21:25 +01:00
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
2007-08-01 08:14:16 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a block is received that was not requested or
|
|
|
|
// whose request timed out.
|
2008-07-08 20:41:04 +02:00
|
|
|
struct TORRENT_EXPORT unwanted_block_alert: peer_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-03-06 08:16:39 +01:00
|
|
|
unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ep
|
|
|
|
, peer_id const& peer_id, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ep, peer_id)
|
2008-07-08 20:41:04 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(unwanted_block_alert, 32);
|
2008-07-08 20:41:04 +02:00
|
|
|
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
2008-07-08 20:41:04 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// The ``storage_moved_alert`` is generated when all the disk IO has completed and the
|
|
|
|
// files have been moved, as an effect of a call to ``torrent_handle::move_storage``. This
|
|
|
|
// is useful to synchronize with the actual disk. The ``path`` member is the new path of
|
|
|
|
// the storage.
|
2007-06-11 23:24:14 +02:00
|
|
|
struct TORRENT_EXPORT storage_moved_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-08-09 03:44:42 +02:00
|
|
|
storage_moved_alert(torrent_handle const& h, std::string const& p)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, path(p)
|
2007-06-11 23:24:14 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(storage_moved_alert, 33);
|
2008-07-06 14:22:56 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " moved storage to: "
|
|
|
|
+ path;
|
|
|
|
}
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
std::string path;
|
2007-06-11 23:24:14 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// The ``storage_moved_failed_alert`` is generated when an attempt to move the storage,
|
|
|
|
// via torrent_handle::move_storage(), fails.
|
2009-05-11 23:18:09 +02:00
|
|
|
struct TORRENT_EXPORT storage_moved_failed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2014-07-06 21:18:00 +02:00
|
|
|
storage_moved_failed_alert(torrent_handle const& h
|
|
|
|
, error_code const& e
|
|
|
|
, std::string const& file
|
|
|
|
, char const* op)
|
2009-05-11 23:18:09 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, error(e)
|
2014-07-06 21:18:00 +02:00
|
|
|
, file(file)
|
|
|
|
, operation(op)
|
2009-05-11 23:18:09 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(storage_moved_failed_alert, 34);
|
2009-05-11 23:18:09 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2014-07-06 21:18:00 +02:00
|
|
|
return torrent_alert::message() + " storage move failed. "
|
|
|
|
+ (operation?operation:"") + " (" + file + "): "
|
2013-08-08 06:32:54 +02:00
|
|
|
+ convert_from_native(error.message());
|
2009-05-11 23:18:09 +02:00
|
|
|
}
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
error_code error;
|
2014-07-06 21:18:00 +02:00
|
|
|
|
|
|
|
// If the error happened for a speific file, ``file`` is its path. If the error
|
|
|
|
// happened in a specific disk operation.
|
|
|
|
std::string file;
|
|
|
|
|
|
|
|
// a NULL terminated string
|
|
|
|
// naming which one, otherwise it's NULL.
|
|
|
|
char const* operation;
|
2009-05-11 23:18:09 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a request to delete the files of a torrent complete.
|
|
|
|
//
|
|
|
|
// The ``info_hash`` is the info-hash of the torrent that was just deleted. Most of
|
|
|
|
// the time the torrent_handle in the ``torrent_alert`` will be invalid by the time
|
|
|
|
// this alert arrives, since the torrent is being deleted. The ``info_hash`` member
|
|
|
|
// is hence the main way of identifying which torrent just completed the delete.
|
|
|
|
//
|
|
|
|
// This alert is posted in the ``storage_notification`` category, and that bit
|
|
|
|
// needs to be set in the alert_mask.
|
2007-10-13 05:33:33 +02:00
|
|
|
struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-01-23 23:42:48 +01:00
|
|
|
torrent_deleted_alert(torrent_handle const& h, sha1_hash const& ih)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2010-01-23 23:42:48 +01:00
|
|
|
{ info_hash = ih; }
|
2007-10-13 05:33:33 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_deleted_alert, 35);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " deleted"; }
|
2012-12-23 08:01:50 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2010-01-23 17:56:00 +01:00
|
|
|
|
|
|
|
sha1_hash info_hash;
|
2008-07-06 14:22:56 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a request to delete the files of a torrent fails.
|
2013-10-28 00:39:24 +01:00
|
|
|
// Just removing a torrent from the session cannot fail
|
2008-07-06 14:22:56 +02:00
|
|
|
struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-10-28 00:39:24 +01:00
|
|
|
torrent_delete_failed_alert(torrent_handle const& h, error_code const& e, sha1_hash const& ih)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2009-06-12 18:40:38 +02:00
|
|
|
, error(e)
|
2013-10-28 00:39:24 +01:00
|
|
|
, info_hash(ih)
|
2009-06-12 18:40:38 +02:00
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_delete_failed_alert, 36);
|
2008-07-06 14:22:56 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::storage_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " torrent deletion failed: "
|
2013-08-08 06:32:54 +02:00
|
|
|
+convert_from_native(error.message());
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2012-12-23 08:01:50 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// tells you why it failed.
|
2009-10-30 04:21:25 +01:00
|
|
|
error_code error;
|
|
|
|
|
2013-10-28 00:39:24 +01:00
|
|
|
// the info hash of the torrent whose files failed to be deleted
|
|
|
|
sha1_hash info_hash;
|
|
|
|
|
2009-10-30 04:21:25 +01:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
|
|
|
std::string msg;
|
|
|
|
#endif
|
2007-10-13 05:33:33 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated as a response to a ``torrent_handle::save_resume_data`` request.
|
|
|
|
// It is generated once the disk IO thread is done writing the state for this torrent.
|
2008-04-13 20:54:36 +02:00
|
|
|
struct TORRENT_EXPORT save_resume_data_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-04-13 20:54:36 +02:00
|
|
|
save_resume_data_alert(boost::shared_ptr<entry> const& rd
|
2008-07-06 14:22:56 +02:00
|
|
|
, torrent_handle const& h)
|
|
|
|
: torrent_alert(h)
|
2008-04-13 20:54:36 +02:00
|
|
|
, resume_data(rd)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(save_resume_data_alert, 37);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " resume data generated"; }
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// points to the resume data.
|
2009-10-30 04:21:25 +01:00
|
|
|
boost::shared_ptr<entry> resume_data;
|
2008-07-06 14:22:56 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated instead of ``save_resume_data_alert`` if there was an error
|
|
|
|
// generating the resume data. ``error`` describes what went wrong.
|
2008-07-06 14:22:56 +02:00
|
|
|
struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
save_resume_data_failed_alert(torrent_handle const& h
|
2009-06-12 18:40:38 +02:00
|
|
|
, error_code const& e)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2009-06-12 18:40:38 +02:00
|
|
|
, error(e)
|
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(save_resume_data_failed_alert, 38);
|
2009-06-12 18:40:38 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::storage_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " resume data was not generated: "
|
2013-08-08 06:32:54 +02:00
|
|
|
+ convert_from_native(error.message());
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
error_code error;
|
|
|
|
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
|
|
|
std::string msg;
|
|
|
|
#endif
|
2008-04-13 20:54:36 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated as a response to a ``torrent_handle::pause`` request. It is
|
|
|
|
// generated once all disk IO is complete and the files in the torrent have been closed.
|
|
|
|
// This is useful for synchronizing with the disk.
|
2007-06-11 23:24:14 +02:00
|
|
|
struct TORRENT_EXPORT torrent_paused_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
torrent_paused_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h)
|
2007-06-11 23:24:14 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_paused_alert, 39);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " paused"; }
|
2008-07-06 14:22:56 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated as a response to a torrent_handle::resume() request. It is
|
|
|
|
// generated when a torrent goes from a paused state to an active state.
|
2008-07-06 14:22:56 +02:00
|
|
|
struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
torrent_resumed_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h) {}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_resumed_alert, 40);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " resumed"; }
|
2007-06-11 23:24:14 +02:00
|
|
|
};
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// This alert is posted when a torrent completes checking. i.e. when it transitions
|
|
|
|
// out of the ``checking files`` state into a state where it is ready to start downloading
|
2007-08-16 21:41:28 +02:00
|
|
|
struct TORRENT_EXPORT torrent_checked_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
torrent_checked_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h)
|
2007-08-16 21:41:28 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_checked_alert, 41);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " checked"; }
|
|
|
|
};
|
2007-08-16 21:41:28 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a HTTP seed name lookup fails.
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT url_seed_alert: torrent_alert
|
2006-04-25 23:04:48 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2006-04-25 23:04:48 +02:00
|
|
|
url_seed_alert(
|
2007-01-16 06:05:52 +01:00
|
|
|
torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
2009-06-12 18:40:38 +02:00
|
|
|
, error_code const& e)
|
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, url(u)
|
2013-08-08 06:32:54 +02:00
|
|
|
, msg(convert_from_native(e.message()))
|
2009-06-12 18:40:38 +02:00
|
|
|
{}
|
|
|
|
url_seed_alert(
|
|
|
|
torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
|
|
|
, std::string const& m)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, url(u)
|
|
|
|
, msg(m)
|
2006-04-25 23:04:48 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(url_seed_alert, 42);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::peer_notification | alert::error_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " url seed ("
|
|
|
|
+ url + ") failed: " + msg;
|
|
|
|
}
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// the HTTP seed that failed
|
2006-04-25 23:04:48 +02:00
|
|
|
std::string url;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// the error message, potentially from the server
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2006-04-25 23:04:48 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// If the storage fails to read or write files that it needs access to, this alert is
|
|
|
|
// generated and the torrent is paused.
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT file_error_alert: torrent_alert
|
2004-01-26 02:08:59 +01:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2004-01-26 02:08:59 +01:00
|
|
|
file_error_alert(
|
2014-07-06 21:18:00 +02:00
|
|
|
error_code const& ec
|
|
|
|
, std::string const& file
|
|
|
|
, char const* op
|
|
|
|
, torrent_handle const& h)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2014-07-06 21:18:00 +02:00
|
|
|
, file(file)
|
|
|
|
, error(ec)
|
|
|
|
, operation(op)
|
2009-06-10 10:30:55 +02:00
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-10 10:30:55 +02:00
|
|
|
#endif
|
|
|
|
}
|
2004-01-26 02:08:59 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(file_error_alert, 43);
|
2009-06-10 10:30:55 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification
|
|
|
|
| alert::error_notification
|
|
|
|
| alert::storage_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2014-07-06 21:18:00 +02:00
|
|
|
return torrent_alert::message() + " "
|
|
|
|
+ (operation?operation:"") + " (" + file
|
|
|
|
+ ") error: " + convert_from_native(error.message());
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// the path to the file that was accessed when the error occurred.
|
2009-10-30 04:21:25 +01:00
|
|
|
std::string file;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// the error code describing the error.
|
2009-10-30 04:21:25 +01:00
|
|
|
error_code error;
|
2014-07-06 21:18:00 +02:00
|
|
|
char const* operation;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
|
|
|
std::string msg;
|
|
|
|
#endif
|
2004-01-26 02:08:59 +01:00
|
|
|
};
|
2004-01-26 11:29:00 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when the metadata has been completely received and the info-hash
|
|
|
|
// failed to match it. i.e. the metadata that was received was corrupt. libtorrent will
|
|
|
|
// automatically retry to fetch it in this case. This is only relevant when running a
|
|
|
|
// torrent-less download, with the metadata extension provided by libtorrent.
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT metadata_failed_alert: torrent_alert
|
2005-10-17 15:45:53 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2014-07-06 21:18:00 +02:00
|
|
|
metadata_failed_alert(const torrent_handle& h, error_code const& ec)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2014-07-06 21:18:00 +02:00
|
|
|
, error(ec)
|
2005-10-17 15:45:53 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(metadata_failed_alert, 44);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual std::string message() const
|
2014-07-06 21:18:00 +02:00
|
|
|
{ return torrent_alert::message() + " invalid metadata received: " + error.message(); }
|
2013-09-14 12:09:30 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// indicates what failed when parsing the metadata. This error is
|
|
|
|
// what's returned from lazy_bdecode().
|
2013-09-14 12:09:30 +02:00
|
|
|
error_code error;
|
2005-10-17 15:45:53 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when the metadata has been completely received and the torrent
|
|
|
|
// can start downloading. It is not generated on torrents that are started with metadata, but
|
|
|
|
// only those that needs to download it from peers (when utilizing the libtorrent extension).
|
|
|
|
//
|
|
|
|
// There are no additional data members in this alert.
|
|
|
|
//
|
|
|
|
// Typically, when receiving this alert, you would want to save the torrent file in order
|
|
|
|
// to load it back up again when the session is restarted. Here's an example snippet of
|
|
|
|
// code to do that::
|
|
|
|
//
|
|
|
|
// torrent_handle h = alert->handle();
|
|
|
|
// if (h.is_valid()) {
|
2014-07-06 21:18:00 +02:00
|
|
|
// boost::shared_ptr<torrent_info const> ti = h.torrent_file();
|
2013-08-09 03:44:42 +02:00
|
|
|
// create_torrent ct(*ti);
|
|
|
|
// entry te = ct.generate();
|
|
|
|
// std::vector<char> buffer;
|
|
|
|
// bencode(std::back_inserter(buffer), te);
|
|
|
|
// FILE* f = fopen((to_hex(ti->info_hash().to_string()) + ".torrent").c_str(), "wb+");
|
|
|
|
// if (f) {
|
|
|
|
// fwrite(&buffer[0], 1, buffer.size(), f);
|
|
|
|
// fclose(f);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT metadata_received_alert: torrent_alert
|
2004-09-10 02:47:30 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2004-09-10 02:47:30 +02:00
|
|
|
metadata_received_alert(
|
2008-07-06 14:22:56 +02:00
|
|
|
const torrent_handle& h)
|
|
|
|
: torrent_alert(h)
|
2004-09-10 02:47:30 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(metadata_received_alert, 45);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const
|
2009-10-30 04:21:25 +01:00
|
|
|
{ return torrent_alert::message() + " metadata successfully received"; }
|
2004-09-10 02:47:30 +02:00
|
|
|
};
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// This alert is posted when there is an error on the UDP socket. The
|
|
|
|
// UDP socket is used for all uTP, DHT and UDP tracker traffic. It's
|
|
|
|
// global to the session.
|
2008-03-25 05:46:18 +01:00
|
|
|
struct TORRENT_EXPORT udp_error_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-03-25 05:46:18 +01:00
|
|
|
udp_error_alert(
|
|
|
|
udp::endpoint const& ep
|
2008-07-06 14:22:56 +02:00
|
|
|
, error_code const& ec)
|
|
|
|
: endpoint(ep)
|
|
|
|
, error(ec)
|
2008-03-25 05:46:18 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(udp_error_alert, 46);
|
2008-03-25 05:46:18 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2013-08-08 06:32:54 +02:00
|
|
|
return "UDP error: " + convert_from_native(error.message()) + " from: " + endpoint.address().to_string(ec);
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// the source address associated with the error (if any)
|
2009-10-30 04:21:25 +01:00
|
|
|
udp::endpoint endpoint;
|
2013-09-01 19:34:05 +02:00
|
|
|
|
|
|
|
// the error code describing the error
|
2009-10-30 04:21:25 +01:00
|
|
|
error_code error;
|
2008-03-25 05:46:18 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// Whenever libtorrent learns about the machines external IP, this alert is
|
|
|
|
// generated. The external IP address can be acquired from the tracker (if it
|
|
|
|
// supports that) or from peers that supports the extension protocol.
|
|
|
|
// The address can be accessed through the ``external_address`` member.
|
2008-03-29 23:45:55 +01:00
|
|
|
struct TORRENT_EXPORT external_ip_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
external_ip_alert(address const& ip)
|
|
|
|
: external_address(ip)
|
2008-03-29 23:45:55 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(external_ip_alert, 47);
|
2008-03-29 23:45:55 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
|
|
|
return "external IP received: " + external_address.to_string(ec);
|
|
|
|
}
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// the IP address that is believed to be our external IP
|
2009-10-30 04:21:25 +01:00
|
|
|
address external_address;
|
2008-03-29 23:45:55 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when none of the ports, given in the port range, to
|
|
|
|
// session can be opened for listening. The ``endpoint`` member is the
|
|
|
|
// interface and port that failed, ``error`` is the error code describing
|
|
|
|
// the failure.
|
|
|
|
//
|
|
|
|
// libtorrent may sometimes try to listen on port 0, if all other ports failed.
|
|
|
|
// Port 0 asks the operating system to pick a port that's free). If that fails
|
|
|
|
// you may see a listen_failed_alert with port 0 even if you didn't ask to
|
|
|
|
// listen on it.
|
2005-11-01 19:30:39 +01:00
|
|
|
struct TORRENT_EXPORT listen_failed_alert: alert
|
2004-01-26 11:29:00 +01:00
|
|
|
{
|
2014-10-06 05:03:01 +02:00
|
|
|
enum socket_type_t { tcp, tcp_ssl, udp, i2p, socks5, utp_ssl };
|
2013-10-06 08:32:33 +02:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2004-01-26 11:29:00 +01:00
|
|
|
listen_failed_alert(
|
2014-07-06 21:18:00 +02:00
|
|
|
std::string iface
|
2013-06-04 02:35:42 +02:00
|
|
|
, int op
|
2013-10-06 08:32:33 +02:00
|
|
|
, error_code const& ec
|
|
|
|
, socket_type_t t)
|
2014-07-06 21:18:00 +02:00
|
|
|
: interface(iface)
|
2008-07-06 14:22:56 +02:00
|
|
|
, error(ec)
|
2013-06-04 02:35:42 +02:00
|
|
|
, operation(op)
|
2013-10-06 08:32:33 +02:00
|
|
|
, sock_type(t)
|
2004-01-26 11:29:00 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(listen_failed_alert, 48);
|
2007-09-22 18:27:29 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification | alert::error_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// the interface libtorrent attempted to listen on
|
|
|
|
std::string interface;
|
2013-10-06 08:32:33 +02:00
|
|
|
|
|
|
|
// the error the system returned
|
2009-10-30 04:21:25 +01:00
|
|
|
error_code error;
|
2013-10-06 08:32:33 +02:00
|
|
|
|
2013-06-04 02:35:42 +02:00
|
|
|
enum op_t
|
|
|
|
{
|
|
|
|
parse_addr, open, bind, listen, get_peer_name, accept
|
|
|
|
};
|
2013-10-06 08:32:33 +02:00
|
|
|
|
|
|
|
// the specific low level operation that failed. See op_t.
|
2013-06-04 02:35:42 +02:00
|
|
|
int operation;
|
2013-10-06 08:32:33 +02:00
|
|
|
|
|
|
|
// the type of listen socket this alert refers to.
|
|
|
|
socket_type_t sock_type;
|
2004-01-26 11:29:00 +01:00
|
|
|
};
|
2005-06-16 17:41:04 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted when the listen port succeeds to be opened on a
|
|
|
|
// particular interface. ``endpoint`` is the endpoint that successfully
|
|
|
|
// was opened for listening.
|
2007-09-22 18:27:29 +02:00
|
|
|
struct TORRENT_EXPORT listen_succeeded_alert: alert
|
|
|
|
{
|
2014-10-06 05:03:01 +02:00
|
|
|
enum socket_type_t { tcp, tcp_ssl, udp, utp_ssl };
|
2013-10-06 08:32:33 +02:00
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-10-06 08:32:33 +02:00
|
|
|
listen_succeeded_alert(tcp::endpoint const& ep, socket_type_t t)
|
2008-07-06 14:22:56 +02:00
|
|
|
: endpoint(ep)
|
2013-10-06 08:32:33 +02:00
|
|
|
, sock_type(t)
|
2007-09-22 18:27:29 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(listen_succeeded_alert, 49);
|
2007-09-22 18:27:29 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::status_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2011-01-23 19:00:52 +01:00
|
|
|
virtual bool discardable() const { return false; }
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-10-06 08:32:33 +02:00
|
|
|
// the endpoint libtorrent ended up listening on. The address
|
|
|
|
// refers to the local interface and the port is the listen port.
|
2009-10-30 04:21:25 +01:00
|
|
|
tcp::endpoint endpoint;
|
2013-10-06 08:32:33 +02:00
|
|
|
|
|
|
|
// the type of listen socket this alert refers to.
|
|
|
|
socket_type_t sock_type;
|
2007-09-22 18:27:29 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a NAT router was successfully found but some
|
|
|
|
// part of the port mapping request failed. It contains a text message that
|
|
|
|
// may help the user figure out what is wrong. This alert is not generated in
|
|
|
|
// case it appears the client is not running on a NAT:ed network or if it
|
|
|
|
// appears there is no NAT router that can be remote controlled to add port
|
|
|
|
// mappings.
|
2007-03-16 09:25:08 +01:00
|
|
|
struct TORRENT_EXPORT portmap_error_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2009-06-12 18:40:38 +02:00
|
|
|
portmap_error_alert(int i, int t, error_code const& e)
|
2009-10-30 04:21:25 +01:00
|
|
|
: mapping(i), map_type(t), error(e)
|
2009-06-12 18:40:38 +02:00
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
2007-03-16 09:25:08 +01:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(portmap_error_alert, 50);
|
2008-04-06 21:17:58 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::port_mapping_notification
|
|
|
|
| alert::error_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// refers to the mapping index of the port map that failed, i.e.
|
|
|
|
// the index returned from add_mapping().
|
2009-10-30 04:21:25 +01:00
|
|
|
int mapping;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// is 0 for NAT-PMP and 1 for UPnP.
|
2009-10-30 04:21:25 +01:00
|
|
|
int map_type;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// tells you what failed.
|
2009-10-30 04:21:25 +01:00
|
|
|
error_code error;
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
|
|
|
std::string msg;
|
|
|
|
#endif
|
2007-03-16 09:25:08 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a NAT router was successfully found and
|
|
|
|
// a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP
|
|
|
|
// capable router, this is typically generated once when mapping the TCP
|
|
|
|
// port and, if DHT is enabled, when the UDP port is mapped.
|
2007-03-16 09:25:08 +01:00
|
|
|
struct TORRENT_EXPORT portmap_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-07-06 14:22:56 +02:00
|
|
|
portmap_alert(int i, int port, int t)
|
2009-10-30 04:21:25 +01:00
|
|
|
: mapping(i), external_port(port), map_type(t)
|
2007-03-16 09:25:08 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(portmap_alert, 51);
|
2008-04-06 21:17:58 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::port_mapping_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// refers to the mapping index of the port map that failed, i.e.
|
|
|
|
// the index returned from add_mapping().
|
2009-10-30 04:21:25 +01:00
|
|
|
int mapping;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// the external port allocated for the mapping.
|
2009-10-30 04:21:25 +01:00
|
|
|
int external_port;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// 0 for NAT-PMP and 1 for UPnP.
|
2009-10-30 04:21:25 +01:00
|
|
|
int map_type;
|
2007-03-16 09:25:08 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated to log informational events related to either
|
|
|
|
// UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PMP
|
|
|
|
// and 1 = UPnP). Displaying these messages to an end user is only useful
|
|
|
|
// for debugging the UPnP or NAT-PMP implementation.
|
2008-10-22 03:12:14 +02:00
|
|
|
struct TORRENT_EXPORT portmap_log_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2008-10-22 03:12:14 +02:00
|
|
|
portmap_log_alert(int t, std::string const& m)
|
2009-10-30 04:21:25 +01:00
|
|
|
: map_type(t), msg(m)
|
2008-10-22 03:12:14 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(portmap_log_alert, 52);
|
2008-10-22 03:12:14 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::port_mapping_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
int map_type;
|
|
|
|
std::string msg;
|
2008-10-22 03:12:14 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is generated when a fastresume file has been passed to add_torrent() but the
|
|
|
|
// files on disk did not match the fastresume file. The error_code explains the reason why the
|
|
|
|
// resume file was rejected.
|
2007-03-16 08:59:04 +01:00
|
|
|
struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
|
2005-06-16 17:41:04 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2005-06-16 17:41:04 +02:00
|
|
|
fastresume_rejected_alert(torrent_handle const& h
|
2014-07-06 21:18:00 +02:00
|
|
|
, error_code const& ec
|
|
|
|
, std::string const& file
|
|
|
|
, char const* op)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2014-07-06 21:18:00 +02:00
|
|
|
, error(ec)
|
|
|
|
, file(file)
|
|
|
|
, operation(op)
|
2009-06-12 18:40:38 +02:00
|
|
|
{
|
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-08 06:32:54 +02:00
|
|
|
msg = convert_from_native(error.message());
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(fastresume_rejected_alert, 53);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual std::string message() const
|
2014-07-06 21:18:00 +02:00
|
|
|
{
|
|
|
|
return torrent_alert::message() + " fast resume rejected. "
|
|
|
|
+ (operation?operation:"") + "(" + file + "): " + convert_from_native(error.message());
|
|
|
|
}
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2009-06-12 18:40:38 +02:00
|
|
|
error_code error;
|
2005-06-16 17:41:04 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// If the error happend to a specific file, ``file`` is the path to it. If the error happened
|
|
|
|
// in a disk operation.
|
|
|
|
std::string file;
|
|
|
|
|
|
|
|
// a NULL-terminated string of the name of that operation.
|
|
|
|
// ``operation`` is NULL otherwise.
|
|
|
|
char const* operation;
|
|
|
|
|
2009-06-12 18:40:38 +02:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2009-06-12 18:40:38 +02:00
|
|
|
#endif
|
2005-06-16 17:41:04 +02:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted when an incoming peer connection, or a peer that's about to be added
|
|
|
|
// to our peer list, is blocked for some reason. This could be any of:
|
|
|
|
//
|
|
|
|
// * the IP filter
|
|
|
|
// * i2p mixed mode restrictions (a normal peer is not allowed on an i2p swarm)
|
|
|
|
// * the port filter
|
|
|
|
// * the peer has a low port and ``no_connect_privileged_ports`` is enabled
|
|
|
|
// * the protocol of the peer is blocked (uTP/TCP blocking)
|
2009-09-07 03:47:30 +02:00
|
|
|
struct TORRENT_EXPORT peer_blocked_alert: torrent_alert
|
2007-04-17 07:56:43 +02:00
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2014-02-07 18:35:56 +01:00
|
|
|
peer_blocked_alert(torrent_handle const& h, address const& i
|
|
|
|
, int r)
|
2009-09-07 03:47:30 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, ip(i)
|
2014-02-07 18:35:56 +01:00
|
|
|
, reason(r)
|
2007-04-17 07:56:43 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(peer_blocked_alert, 54);
|
2007-04-17 07:56:43 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::ip_block_notification;
|
2014-02-07 18:35:56 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// the address that was blocked.
|
2009-10-30 04:21:25 +01:00
|
|
|
address ip;
|
2014-02-07 18:35:56 +01:00
|
|
|
|
|
|
|
enum reason_t
|
|
|
|
{
|
|
|
|
ip_filter,
|
|
|
|
port_filter,
|
|
|
|
i2p_mixed,
|
|
|
|
privileged_ports,
|
|
|
|
utp_disabled,
|
2014-07-06 21:18:00 +02:00
|
|
|
tcp_disabled,
|
|
|
|
invalid_local_interface
|
2014-02-07 18:35:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
int reason;
|
2008-06-08 07:14:40 +02:00
|
|
|
};
|
2008-09-20 19:42:25 +02:00
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// This alert is generated when a DHT node announces to an info-hash on our
|
|
|
|
// DHT node. It belongs to the ``dht_notification`` category.
|
2008-09-20 19:42:25 +02:00
|
|
|
struct TORRENT_EXPORT dht_announce_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-08-09 03:44:42 +02:00
|
|
|
dht_announce_alert(address const& i, int p
|
|
|
|
, sha1_hash const& ih)
|
|
|
|
: ip(i)
|
|
|
|
, port(p)
|
|
|
|
, info_hash(ih)
|
2008-09-20 19:42:25 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_announce_alert, 55);
|
2008-09-20 19:42:25 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::dht_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
address ip;
|
|
|
|
int port;
|
|
|
|
sha1_hash info_hash;
|
2008-09-20 19:42:25 +02:00
|
|
|
};
|
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// This alert is generated when a DHT node sends a ``get_peers`` message to
|
|
|
|
// our DHT node. It belongs to the ``dht_notification`` category.
|
2008-09-20 19:42:25 +02:00
|
|
|
struct TORRENT_EXPORT dht_get_peers_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-08-09 03:44:42 +02:00
|
|
|
dht_get_peers_alert(sha1_hash const& ih)
|
|
|
|
: info_hash(ih)
|
2008-09-20 19:42:25 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_get_peers_alert, 56);
|
2009-10-30 04:21:25 +01:00
|
|
|
|
2008-09-20 19:42:25 +02:00
|
|
|
const static int static_category = alert::dht_notification;
|
2009-11-26 22:40:10 +01:00
|
|
|
virtual std::string message() const;
|
2009-10-30 04:21:25 +01:00
|
|
|
|
|
|
|
sha1_hash info_hash;
|
2008-09-20 19:42:25 +02:00
|
|
|
};
|
2010-01-02 15:16:35 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted approximately once every second, and it contains
|
|
|
|
// byte counters of most statistics that's tracked for torrents. Each active
|
|
|
|
// torrent posts these alerts regularly.
|
2010-01-02 15:16:35 +01:00
|
|
|
struct TORRENT_EXPORT stats_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-01-02 15:16:35 +01:00
|
|
|
stats_alert(torrent_handle const& h, int interval
|
|
|
|
, stat const& s);
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(stats_alert, 57);
|
2010-01-02 15:16:35 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::stats_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
enum stats_channel
|
|
|
|
{
|
|
|
|
upload_payload,
|
|
|
|
upload_protocol,
|
2010-02-08 06:43:54 +01:00
|
|
|
download_payload,
|
|
|
|
download_protocol,
|
2010-01-02 15:16:35 +01:00
|
|
|
upload_ip_protocol,
|
2014-10-26 01:10:07 +02:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2010-01-02 15:16:35 +01:00
|
|
|
upload_dht_protocol,
|
|
|
|
upload_tracker_protocol,
|
2014-11-26 11:17:44 +01:00
|
|
|
#else
|
|
|
|
deprecated1,
|
|
|
|
deprecated2,
|
2014-10-26 01:10:07 +02:00
|
|
|
#endif
|
2010-01-02 15:16:35 +01:00
|
|
|
download_ip_protocol,
|
2014-10-26 01:10:07 +02:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2010-01-02 15:16:35 +01:00
|
|
|
download_dht_protocol,
|
|
|
|
download_tracker_protocol,
|
2014-11-26 11:17:44 +01:00
|
|
|
#else
|
|
|
|
deprecated3,
|
|
|
|
deprecated4,
|
2014-10-26 01:10:07 +02:00
|
|
|
#endif
|
2010-01-02 15:16:35 +01:00
|
|
|
num_channels
|
|
|
|
};
|
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// an array of samples. The enum describes what each sample is a
|
|
|
|
// measurement of. All of these are raw, and not smoothing is performed.
|
2010-01-02 15:16:35 +01:00
|
|
|
int transferred[num_channels];
|
2013-08-09 03:44:42 +02:00
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// the number of milliseconds during which these stats were collected.
|
|
|
|
// This is typically just above 1000, but if CPU is limited, it may be
|
|
|
|
// higher than that.
|
2010-01-02 15:16:35 +01:00
|
|
|
int interval;
|
|
|
|
};
|
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// This alert is posted when the disk cache has been flushed for a specific
|
|
|
|
// torrent as a result of a call to torrent_handle::flush_cache(). This
|
|
|
|
// alert belongs to the ``storage_notification`` category, which must be
|
|
|
|
// enabled to let this alert through. The alert is also posted when removing
|
|
|
|
// a torrent from the session, once the outstanding cache flush is complete
|
|
|
|
// and the torrent does no longer have any files open.
|
2010-01-09 22:17:52 +01:00
|
|
|
struct TORRENT_EXPORT cache_flushed_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-01-09 22:17:52 +01:00
|
|
|
cache_flushed_alert(torrent_handle const& h);
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(cache_flushed_alert, 58);
|
2010-01-09 22:17:52 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
};
|
2010-04-13 06:30:34 +02:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted when a bittorrent feature is blocked because of the
|
|
|
|
// anonymous mode. For instance, if the tracker proxy is not set up, no
|
|
|
|
// trackers will be used, because trackers can only be used through proxies
|
|
|
|
// when in anonymous mode.
|
2010-04-13 06:30:34 +02:00
|
|
|
struct TORRENT_EXPORT anonymous_mode_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-04-13 06:30:34 +02:00
|
|
|
anonymous_mode_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, int k, std::string const& s)
|
2010-04-13 06:30:34 +02:00
|
|
|
: torrent_alert(h)
|
2013-08-09 03:44:42 +02:00
|
|
|
, kind(k)
|
|
|
|
, str(s)
|
2010-04-13 06:30:34 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(anonymous_mode_alert, 59);
|
2010-04-13 06:30:34 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
enum kind_t
|
|
|
|
{
|
2013-08-09 03:44:42 +02:00
|
|
|
// means that there's no proxy set up for tracker
|
|
|
|
// communication and the tracker will not be contacted.
|
|
|
|
// The tracker which this failed for is specified in the ``str`` member.
|
2010-04-13 06:30:34 +02:00
|
|
|
tracker_not_anonymous = 0
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// specifies what error this is, see kind_t.
|
2010-04-13 06:30:34 +02:00
|
|
|
int kind;
|
|
|
|
std::string str;
|
|
|
|
};
|
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// This alert is generated when we receive a local service discovery message
|
|
|
|
// from a peer for a torrent we're currently participating in.
|
2010-07-15 07:56:29 +02:00
|
|
|
struct TORRENT_EXPORT lsd_peer_alert: peer_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-07-15 07:56:29 +02:00
|
|
|
lsd_peer_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, tcp::endpoint const& i)
|
|
|
|
: peer_alert(h, i, peer_id(0))
|
2010-07-15 07:56:29 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(lsd_peer_alert, 60);
|
2010-07-15 07:56:29 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::peer_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
};
|
|
|
|
|
2014-02-28 05:02:48 +01:00
|
|
|
// This alert is posted whenever a tracker responds with a ``trackerid``.
|
|
|
|
// The tracker ID is like a cookie. The libtorrent will store the tracker ID
|
|
|
|
// for this tracker and repeat it in subsequent announces.
|
2010-11-18 06:51:52 +01:00
|
|
|
struct TORRENT_EXPORT trackerid_alert: tracker_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-11-18 06:51:52 +01:00
|
|
|
trackerid_alert(torrent_handle const& h
|
2013-08-09 03:44:42 +02:00
|
|
|
, std::string const& u
|
2010-11-18 06:51:52 +01:00
|
|
|
, const std::string& id)
|
2013-08-09 03:44:42 +02:00
|
|
|
: tracker_alert(h, u)
|
2010-11-18 06:51:52 +01:00
|
|
|
, trackerid(id)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(trackerid_alert, 61);
|
2010-11-18 06:51:52 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
2013-09-01 19:34:05 +02:00
|
|
|
// The tracker ID returned by the tracker
|
2010-11-18 06:51:52 +01:00
|
|
|
std::string trackerid;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted when the initial DHT bootstrap is done.
|
2010-12-12 04:17:08 +01:00
|
|
|
struct TORRENT_EXPORT dht_bootstrap_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2010-12-12 04:17:08 +01:00
|
|
|
dht_bootstrap_alert() {}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_bootstrap_alert, 62);
|
2010-12-12 04:17:08 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::dht_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted on RSS feed events such as start of RSS feed updates,
|
|
|
|
// successful completed updates and errors during updates.
|
|
|
|
//
|
|
|
|
// This alert is only posted if the ``rss_notifications`` category is enabled
|
|
|
|
// in the alert_mask.
|
2011-01-18 04:41:54 +01:00
|
|
|
struct TORRENT_EXPORT rss_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-08-09 03:44:42 +02:00
|
|
|
rss_alert(feed_handle h, std::string const& u, int s, error_code const& ec)
|
|
|
|
: handle(h), url(u), state(s), error(ec)
|
2011-01-18 04:41:54 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(rss_alert, 63);
|
2011-01-18 04:41:54 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::rss_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
enum state_t
|
|
|
|
{
|
2013-08-09 03:44:42 +02:00
|
|
|
// An update of this feed was just initiated, it will either succeed
|
|
|
|
// or fail soon.
|
|
|
|
state_updating,
|
|
|
|
|
|
|
|
// The feed just completed a successful update, there may be new items
|
|
|
|
// in it. If you're adding torrents manually, you may want to request
|
|
|
|
// the feed status of the feed and look through the ``items`` vector.
|
|
|
|
state_updated,
|
|
|
|
|
|
|
|
// An error just occurred. See the ``error`` field for information on
|
|
|
|
// what went wrong.
|
|
|
|
state_error
|
2011-01-18 04:41:54 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// the handle to the feed which generated this alert.
|
2011-01-18 04:41:54 +01:00
|
|
|
feed_handle handle;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// a short cut to access the url of the feed, without
|
|
|
|
// having to call feed_handle::get_settings().
|
2011-01-18 04:41:54 +01:00
|
|
|
std::string url;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// one of the values from rss_alert::state_t.
|
2011-01-18 04:41:54 +01:00
|
|
|
int state;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// an error code used for when an error occurs on the feed.
|
2011-01-18 04:41:54 +01:00
|
|
|
error_code error;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is posted whenever a torrent is transitioned into the error state.
|
2011-01-22 20:06:43 +01:00
|
|
|
struct TORRENT_EXPORT torrent_error_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2011-01-22 20:06:43 +01:00
|
|
|
torrent_error_alert(torrent_handle const& h
|
2014-07-06 21:18:00 +02:00
|
|
|
, error_code const& e, std::string const& f)
|
2011-01-22 20:06:43 +01:00
|
|
|
: torrent_alert(h)
|
|
|
|
, error(e)
|
2014-07-06 21:18:00 +02:00
|
|
|
, error_file(f)
|
2011-01-22 20:06:43 +01:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_error_alert, 64);
|
2011-01-22 20:06:43 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::error_notification | alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// specifies which error the torrent encountered.
|
2011-01-22 20:06:43 +01:00
|
|
|
error_code error;
|
2014-07-06 21:18:00 +02:00
|
|
|
|
|
|
|
// the filename (or object) the error occurred on.
|
|
|
|
std::string error_file;
|
2011-01-22 20:06:43 +01:00
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This is always posted for SSL torrents. This is a reminder to the client that
|
|
|
|
// the torrent won't work unless torrent_handle::set_ssl_certificate() is called with
|
|
|
|
// a valid certificate. Valid certificates MUST be signed by the SSL certificate
|
|
|
|
// in the .torrent file.
|
2011-09-12 05:51:49 +02:00
|
|
|
struct TORRENT_EXPORT torrent_need_cert_alert: torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2011-09-12 05:51:49 +02:00
|
|
|
torrent_need_cert_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_need_cert_alert, 65);
|
2011-09-12 05:51:49 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
|
|
|
error_code error;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// The incoming connection alert is posted every time we successfully accept
|
|
|
|
// an incoming connection, through any mean. The most straigh-forward ways
|
|
|
|
// of accepting incoming connections are through the TCP listen socket and
|
|
|
|
// the UDP listen socket for uTP sockets. However, connections may also be
|
|
|
|
// accepted ofer a Socks5 or i2p listen socket, or via a torrent specific
|
|
|
|
// listen socket for SSL torrents.
|
2011-09-17 03:44:05 +02:00
|
|
|
struct TORRENT_EXPORT incoming_connection_alert: alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-08-09 03:44:42 +02:00
|
|
|
incoming_connection_alert(int t, tcp::endpoint const& i)
|
|
|
|
: socket_type(t)
|
|
|
|
, ip(i)
|
2011-09-17 03:44:05 +02:00
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(incoming_connection_alert, 66);
|
2011-09-17 03:44:05 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::peer_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// tells you what kind of socket the connection was accepted
|
|
|
|
// as:
|
|
|
|
//
|
|
|
|
// 0. none (no socket instantiated)
|
|
|
|
// 1. TCP
|
|
|
|
// 2. Socks5
|
|
|
|
// 3. HTTP
|
|
|
|
// 4. uTP
|
|
|
|
// 5. i2p
|
|
|
|
// 6. SSL/TCP
|
|
|
|
// 7. SSL/Socks5
|
|
|
|
// 8. HTTPS (SSL/HTTP)
|
|
|
|
// 9. SSL/uTP
|
|
|
|
//
|
2011-09-17 03:44:05 +02:00
|
|
|
int socket_type;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// is the IP address and port the connection came from.
|
2011-09-17 03:44:05 +02:00
|
|
|
tcp::endpoint ip;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is always posted when a torrent was attempted to be added
|
|
|
|
// and contains the return status of the add operation. The torrent handle of the new
|
|
|
|
// torrent can be found in the base class' ``handle`` member. If adding
|
|
|
|
// the torrent failed, ``error`` contains the error code.
|
2011-10-12 12:27:17 +02:00
|
|
|
struct TORRENT_EXPORT add_torrent_alert : torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2011-10-12 12:27:17 +02:00
|
|
|
add_torrent_alert(torrent_handle h, add_torrent_params const& p, error_code ec)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, params(p)
|
|
|
|
, error(ec)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(add_torrent_alert, 67);
|
2011-10-12 12:27:17 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// a copy of the parameters used when adding the torrent, it can be used
|
|
|
|
// to identify which invocation to ``async_add_torrent()`` caused this alert.
|
2011-10-12 12:27:17 +02:00
|
|
|
add_torrent_params params;
|
2013-08-09 03:44:42 +02:00
|
|
|
|
|
|
|
// set to the error, if one occurred while adding the torrent.
|
2011-10-12 12:27:17 +02:00
|
|
|
error_code error;
|
|
|
|
};
|
2011-01-18 04:41:54 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is only posted when requested by the user, by calling session::post_torrent_updates()
|
|
|
|
// on the session. It contains the torrent status of all torrents that changed
|
|
|
|
// since last time this message was posted. Its category is ``status_notification``, but
|
|
|
|
// it's not subject to filtering, since it's only manually posted anyway.
|
2011-11-15 03:34:00 +01:00
|
|
|
struct TORRENT_EXPORT state_update_alert : alert
|
|
|
|
{
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(state_update_alert, 68);
|
2011-11-15 03:34:00 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// contains the torrent status of all torrents that changed since last time
|
|
|
|
// this message was posted. Note that you can map a torrent status to a specific torrent
|
|
|
|
// via its ``handle`` member. The receiving end is suggested to have all torrents sorted
|
|
|
|
// by the torrent_handle or hashed by it, for efficient updates.
|
2011-11-15 03:34:00 +01:00
|
|
|
std::vector<torrent_status> status;
|
|
|
|
};
|
2014-07-06 21:18:00 +02:00
|
|
|
|
|
|
|
struct TORRENT_EXPORT mmap_cache_alert : alert
|
|
|
|
{
|
|
|
|
mmap_cache_alert(error_code const& ec): error(ec) {}
|
|
|
|
TORRENT_DEFINE_ALERT(mmap_cache_alert, 69);
|
|
|
|
|
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
error_code error;
|
|
|
|
};
|
|
|
|
|
|
|
|
// The session_stats_alert is posted when the user requests session statistics by
|
|
|
|
// calling post_session_stats() on the session object. Its category is
|
|
|
|
// ``status_notification``, but it is not subject to filtering, since it's only
|
|
|
|
// manually posted anyway.
|
|
|
|
struct TORRENT_EXPORT session_stats_alert : alert
|
|
|
|
{
|
|
|
|
session_stats_alert() {}
|
|
|
|
TORRENT_DEFINE_ALERT(session_stats_alert, 70);
|
|
|
|
|
|
|
|
const static int static_category = alert::stats_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
|
|
|
// the number of microseconds since the session was
|
|
|
|
// started. It represent the time when the snapshot of values was taken. When
|
|
|
|
// the network thread is under heavy load, the latency between calling
|
|
|
|
// post_session_stats() and receiving this alert may be significant, and
|
|
|
|
// the timestamp may help provide higher accuracy in measurements.
|
|
|
|
boost::uint64_t timestamp;
|
|
|
|
|
|
|
|
// An array are a mix of *counters* and *gauges*, which
|
|
|
|
// meanings can be queries via the session_stats_metrics() function on the session.
|
|
|
|
// The mapping from a specific metric to an index into this array is constant for a
|
|
|
|
// specific version of libtorrent, but may differ for other versions. The intended
|
|
|
|
// usage is to request the mapping, i.e. call session_stats_metrics(), once
|
|
|
|
// on startup, and then use that mapping to interpret these values throughout
|
|
|
|
// the process' runtime.
|
|
|
|
//
|
|
|
|
// For more information, see the session-statistics_ section.
|
|
|
|
std::vector<boost::uint64_t> values;
|
|
|
|
};
|
2012-02-12 11:11:14 +01:00
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// When a torrent changes its info-hash, this alert is posted. This only happens in very
|
|
|
|
// specific cases. For instance, when a torrent is downloaded from a URL, the true info
|
|
|
|
// hash is not known immediately. First the .torrent file must be downloaded and parsed.
|
|
|
|
//
|
|
|
|
// Once this download completes, the ``torrent_update_alert`` is posted to notify the client
|
|
|
|
// of the info-hash changing.
|
2013-05-17 05:19:23 +02:00
|
|
|
struct TORRENT_EXPORT torrent_update_alert : torrent_alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-05-17 05:19:23 +02:00
|
|
|
torrent_update_alert(torrent_handle h, sha1_hash const& old_hash, sha1_hash const& new_hash)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, old_ih(old_hash)
|
|
|
|
, new_ih(new_hash)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(torrent_update_alert, 71);
|
2013-05-17 05:19:23 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// ``old_ih`` and ``new_ih`` are the previous and new info-hash for the torrent, respectively.
|
2013-05-17 05:19:23 +02:00
|
|
|
sha1_hash old_ih;
|
|
|
|
sha1_hash new_ih;
|
|
|
|
};
|
|
|
|
|
2013-08-09 03:44:42 +02:00
|
|
|
// This alert is posted every time a new RSS item (i.e. torrent) is received
|
|
|
|
// from an RSS feed.
|
|
|
|
//
|
|
|
|
// It is only posted if the ``rss_notifications`` category is enabled in the
|
|
|
|
// alert_mask.
|
2013-06-02 04:48:57 +02:00
|
|
|
struct TORRENT_EXPORT rss_item_alert : alert
|
|
|
|
{
|
2013-09-01 19:34:05 +02:00
|
|
|
// internal
|
2013-06-02 04:48:57 +02:00
|
|
|
rss_item_alert(feed_handle h, feed_item const& item)
|
|
|
|
: handle(h)
|
|
|
|
, item(item)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(rss_item_alert, 72);
|
2013-06-02 04:48:57 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::rss_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
feed_handle handle;
|
|
|
|
feed_item item;
|
|
|
|
};
|
|
|
|
|
2014-01-20 10:20:47 +01:00
|
|
|
// posted when something fails in the DHT. This is not necessarily a fatal
|
|
|
|
// error, but it could prevent proper operation
|
|
|
|
struct TORRENT_EXPORT dht_error_alert: alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
dht_error_alert(int op, error_code const& ec)
|
|
|
|
: error(ec), operation(op_t(op)) {}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_error_alert, 73);
|
2014-01-20 10:20:47 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::error_notification
|
|
|
|
| alert::dht_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the error code
|
|
|
|
error_code error;
|
|
|
|
|
|
|
|
enum op_t
|
|
|
|
{
|
|
|
|
unknown,
|
|
|
|
hostname_lookup
|
|
|
|
};
|
|
|
|
|
|
|
|
// the operation that failed
|
|
|
|
op_t operation;
|
|
|
|
};
|
|
|
|
|
2014-02-24 01:31:13 +01:00
|
|
|
// this alert is posted as a response to a call to session::get_item(),
|
|
|
|
// specifically the overload for looking up immutable items in the DHT.
|
|
|
|
struct TORRENT_EXPORT dht_immutable_item_alert: alert
|
|
|
|
{
|
|
|
|
dht_immutable_item_alert(sha1_hash const& t, entry const& i)
|
|
|
|
: target(t), item(i) {}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_immutable_item_alert, 74);
|
2014-02-24 01:31:13 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::error_notification
|
|
|
|
| alert::dht_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
|
|
|
// the target hash of the immutable item. This must
|
|
|
|
// match the sha-1 hash of the bencoded form of ``item``.
|
|
|
|
sha1_hash target;
|
|
|
|
|
|
|
|
// the data for this item
|
|
|
|
entry item;
|
|
|
|
};
|
2013-05-17 05:19:23 +02:00
|
|
|
|
2014-02-24 01:31:13 +01:00
|
|
|
// this alert is posted as a response to a call to session::get_item(),
|
|
|
|
// specifically the overload for looking up mutable items in the DHT.
|
|
|
|
struct TORRENT_EXPORT dht_mutable_item_alert: alert
|
|
|
|
{
|
|
|
|
dht_mutable_item_alert(boost::array<char, 32> k
|
|
|
|
, boost::array<char, 64> sig
|
|
|
|
, boost::uint64_t sequence
|
|
|
|
, std::string const& s
|
|
|
|
, entry const& i)
|
|
|
|
: key(k), signature(sig), seq(sequence), salt(s), item(i) {}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_mutable_item_alert, 75);
|
2014-02-24 01:31:13 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::error_notification
|
|
|
|
| alert::dht_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
virtual bool discardable() const { return false; }
|
|
|
|
|
|
|
|
// the public key that was looked up
|
|
|
|
boost::array<char, 32> key;
|
|
|
|
|
|
|
|
// the signature of the data. This is not the signature of the
|
|
|
|
// plain encoded form of the item, but it includes the sequence number
|
|
|
|
// and possibly the hash as well. See the dht_store document for more
|
|
|
|
// information. This is primarily useful for echoing back in a store
|
|
|
|
// request.
|
|
|
|
boost::array<char, 64> signature;
|
|
|
|
|
|
|
|
// the sequence number of this item
|
|
|
|
boost::uint64_t seq;
|
|
|
|
|
|
|
|
// the salf, if any, used to lookup and store this item. If no
|
|
|
|
// salt was used, this is an empty string
|
|
|
|
std::string salt;
|
|
|
|
|
|
|
|
// the data for this item
|
|
|
|
entry item;
|
|
|
|
};
|
2014-02-28 05:02:48 +01:00
|
|
|
|
|
|
|
// this is posted when a DHT put operation completes. This is useful if the
|
|
|
|
// client is waiting for a put to complete before shutting down for instance.
|
|
|
|
struct TORRENT_EXPORT dht_put_alert: alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
dht_put_alert(sha1_hash const& t)
|
|
|
|
: target(t)
|
|
|
|
, seq(0)
|
|
|
|
{}
|
|
|
|
dht_put_alert(boost::array<char, 32> key
|
|
|
|
, boost::array<char, 64> sig
|
|
|
|
, std::string s
|
2014-03-05 07:32:03 +01:00
|
|
|
, boost::uint64_t sequence_number)
|
2014-02-28 05:02:48 +01:00
|
|
|
: target(0)
|
|
|
|
, public_key(key)
|
|
|
|
, signature(sig)
|
|
|
|
, salt(s)
|
|
|
|
, seq(sequence_number)
|
|
|
|
{}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(dht_put_alert, 76);
|
2014-02-28 05:02:48 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::dht_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the target hash the item was stored under if this was an *immutable*
|
|
|
|
// item.
|
|
|
|
sha1_hash target;
|
|
|
|
|
|
|
|
// if a mutable item was stored, these are the public key, signature,
|
|
|
|
// salt and sequence number the item was stored under.
|
|
|
|
boost::array<char, 32> public_key;
|
|
|
|
boost::array<char, 64> signature;
|
|
|
|
std::string salt;
|
|
|
|
boost::uint64_t seq;
|
|
|
|
};
|
2014-03-15 23:20:19 +01:00
|
|
|
|
|
|
|
// this alert is used to report errors in the i2p SAM connection
|
|
|
|
struct TORRENT_EXPORT i2p_alert : alert
|
|
|
|
{
|
|
|
|
i2p_alert(error_code const& ec) : error(ec) {}
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
TORRENT_DEFINE_ALERT(i2p_alert, 77);
|
2014-03-15 23:20:19 +01:00
|
|
|
|
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the error that occurred in the i2p SAM connection
|
|
|
|
error_code error;
|
|
|
|
};
|
|
|
|
|
2015-01-18 22:36:24 +01:00
|
|
|
// This alert is generated when we send a get_peers request
|
2014-09-22 21:49:32 +02:00
|
|
|
// It belongs to the ``dht_notification`` category.
|
|
|
|
struct TORRENT_EXPORT dht_outgoing_get_peers_alert: alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
dht_outgoing_get_peers_alert(sha1_hash const& ih, sha1_hash const& obfih
|
|
|
|
, udp::endpoint ep)
|
|
|
|
: info_hash(ih)
|
|
|
|
, obfuscated_info_hash(obfih)
|
|
|
|
, ip(ep)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TORRENT_DEFINE_ALERT(dht_outgoing_get_peers_alert, 78);
|
|
|
|
|
|
|
|
const static int static_category = alert::dht_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the info_hash of the torrent we're looking for peers for.
|
|
|
|
sha1_hash info_hash;
|
|
|
|
|
|
|
|
// if this was an obfuscated lookup, this is the info-hash target
|
|
|
|
// actually sent to the node.
|
|
|
|
sha1_hash obfuscated_info_hash;
|
|
|
|
|
|
|
|
// the endpoint we're sending this query to
|
|
|
|
udp::endpoint ip;
|
|
|
|
};
|
|
|
|
|
2014-12-09 10:08:26 +01:00
|
|
|
// This alert is posted by some session wide event. Its main purpose is
|
|
|
|
// trouble shooting and debugging. It's not enabled by the default alert
|
|
|
|
// mask and is enabled by the ``alert::session_log_notification`` bit.
|
|
|
|
// Furhtermore, it's by default disabled as a build configuration. To
|
|
|
|
// enable, build libtorrent with logging support enabled (``logging=on``
|
|
|
|
// with bjam or define ``TORRENT_LOGGING``).
|
|
|
|
struct TORRENT_EXPORT log_alert : alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
log_alert(char const* log)
|
|
|
|
: msg(log)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TORRENT_DEFINE_ALERT(log_alert, 79);
|
|
|
|
|
|
|
|
const static int static_category = alert::session_log_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the log message
|
|
|
|
std::string msg;
|
|
|
|
};
|
|
|
|
|
|
|
|
// This alert is posted by torrent wide events. It's meant to be used for
|
|
|
|
// trouble shooting and debugging. It's not enabled by the default alert
|
|
|
|
// mask and is enabled by the ``alert::torrent_log_notification`` bit. By
|
|
|
|
// default it is disabled as a build configuration. To enable, build
|
|
|
|
// libtorrent with logging support enabled (``logging=on`` with bjam or
|
|
|
|
// define ``TORRENT_LOGGING``).
|
|
|
|
struct TORRENT_EXPORT torrent_log_alert : torrent_alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
torrent_log_alert(torrent_handle h, char const* log)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, msg(log)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TORRENT_DEFINE_ALERT(torrent_log_alert, 80);
|
|
|
|
|
|
|
|
const static int static_category = alert::torrent_log_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the log message
|
|
|
|
std::string msg;
|
|
|
|
};
|
|
|
|
|
|
|
|
// This alert is posted by events specific to a peer. It's meant to be used
|
|
|
|
// for trouble shooting and debugging. It's not enabled by the default alert
|
|
|
|
// mask and is enabled by the ``alert::peer_log_notification`` bit. By
|
|
|
|
// default it is disabled as a build configuration. To enable, build
|
|
|
|
// libtorrent with logging support enabled (``logging=on`` with bjam or
|
|
|
|
// define ``TORRENT_LOGGING``).
|
|
|
|
struct TORRENT_EXPORT peer_log_alert : peer_alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
peer_log_alert(torrent_handle const& h, tcp::endpoint const& i
|
|
|
|
, peer_id const& pi, char const* log)
|
|
|
|
: peer_alert(h, i, pi)
|
|
|
|
, msg(log)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TORRENT_DEFINE_ALERT(peer_log_alert, 81);
|
|
|
|
|
|
|
|
const static int static_category = alert::peer_log_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// the log message
|
|
|
|
std::string msg;
|
|
|
|
};
|
|
|
|
|
2015-01-17 00:01:14 +01:00
|
|
|
// posted if the local service discovery socket fails to start properly.
|
|
|
|
// it's categorized as ``error_notification``.
|
|
|
|
struct TORRENT_EXPORT lsd_error_alert : alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
lsd_error_alert(error_code const& ec)
|
|
|
|
: alert()
|
|
|
|
, error(ec)
|
|
|
|
{}
|
|
|
|
|
|
|
|
TORRENT_DEFINE_ALERT(lsd_error_alert, 82);
|
|
|
|
|
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// The error code
|
|
|
|
error_code error;
|
|
|
|
};
|
|
|
|
|
2015-01-17 18:02:58 +01:00
|
|
|
// holds statistics about a current dht_lookup operation.
|
|
|
|
// a DHT lookup is the travesal of nodes, looking up a
|
|
|
|
// set of target nodes in the DHT for retrieving and possibly
|
|
|
|
// storing information in the DHT
|
|
|
|
struct TORRENT_EXPORT dht_lookup
|
|
|
|
{
|
|
|
|
// string literal indicating which kind of lookup this is
|
|
|
|
char const* type;
|
|
|
|
|
|
|
|
// the number of outstanding request to individual nodes
|
|
|
|
// this lookup has right now
|
|
|
|
int outstanding_requests;
|
|
|
|
|
|
|
|
// the total number of requests that have timed out so far
|
|
|
|
// for this lookup
|
|
|
|
int timeouts;
|
|
|
|
|
|
|
|
// the total number of responses we have received for this
|
|
|
|
// lookup so far for this lookup
|
|
|
|
int responses;
|
|
|
|
|
|
|
|
// the branch factor for this lookup. This is the number of
|
|
|
|
// nodes we keep outstanding requests to in parallel by default.
|
|
|
|
// when nodes time out we may increase this.
|
|
|
|
int branch_factor;
|
|
|
|
|
|
|
|
// the number of nodes left that could be queries for this
|
|
|
|
// lookup. Many of these are likely to be part of the trail
|
|
|
|
// while performing the lookup and would never end up actually
|
|
|
|
// being queried.
|
|
|
|
int nodes_left;
|
|
|
|
|
|
|
|
// the number of seconds ago the
|
|
|
|
// last message was sent that's still
|
|
|
|
// outstanding
|
|
|
|
int last_sent;
|
|
|
|
|
|
|
|
// the number of outstanding requests
|
|
|
|
// that have exceeded the short timeout
|
|
|
|
// and are considered timed out in the
|
|
|
|
// sense that they increased the branch
|
|
|
|
// factor
|
|
|
|
int first_timeout;
|
|
|
|
};
|
|
|
|
|
|
|
|
// struct to hold information about a single DHT routing table bucket
|
|
|
|
struct TORRENT_EXPORT dht_routing_bucket
|
|
|
|
{
|
|
|
|
// the total number of nodes and replacement nodes
|
|
|
|
// in the routing table
|
|
|
|
int num_nodes;
|
|
|
|
int num_replacements;
|
|
|
|
|
|
|
|
// number of seconds since last activity
|
|
|
|
int last_active;
|
|
|
|
};
|
|
|
|
|
|
|
|
// contains current DHT state. Posted in response to session::post_dht_stats().
|
|
|
|
struct TORRENT_EXPORT dht_stats_alert : alert
|
|
|
|
{
|
|
|
|
// internal
|
|
|
|
dht_stats_alert()
|
|
|
|
: alert()
|
|
|
|
{}
|
|
|
|
|
|
|
|
TORRENT_DEFINE_ALERT(dht_stats_alert, 83);
|
|
|
|
|
|
|
|
const static int static_category = alert::stats_notification;
|
|
|
|
virtual std::string message() const;
|
|
|
|
|
|
|
|
// a vector of the currently running DHT lookups.
|
|
|
|
std::vector<dht_lookup> active_requests;
|
|
|
|
|
|
|
|
// contains information about every bucket in the DHT routing
|
|
|
|
// table.
|
2015-01-18 22:36:24 +01:00
|
|
|
std::vector<dht_routing_bucket> routing_table;
|
2015-01-17 18:02:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-02-12 11:11:14 +01:00
|
|
|
#undef TORRENT_DEFINE_ALERT
|
|
|
|
|
2015-01-17 18:02:58 +01:00
|
|
|
enum { num_alert_types = 84 };
|
2004-01-18 20:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2014-07-06 21:18:00 +02:00
|
|
|
|