2004-01-18 20:12:18 +01:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (c) 2003, Arvid Norberg
|
|
|
|
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"
|
|
|
|
#include "libtorrent/peer_connection.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"
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
|
2004-01-18 20:12:18 +01:00
|
|
|
namespace libtorrent
|
|
|
|
{
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT torrent_alert: alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
torrent_alert(torrent_handle const& h)
|
|
|
|
: handle(h)
|
2007-01-16 06:05:52 +01:00
|
|
|
{}
|
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual std::string message() const
|
2008-07-08 11:30:10 +02:00
|
|
|
{ return handle.is_valid()?handle.name():" - "; }
|
2008-07-06 14:22:56 +02:00
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
torrent_handle handle;
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_alert: torrent_alert
|
|
|
|
{
|
|
|
|
peer_alert(torrent_handle const& h, tcp::endpoint const& ip_
|
|
|
|
, peer_id const& pid_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, ip(ip_)
|
|
|
|
, pid(pid_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
const static int static_category = alert::peer_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
|
|
|
return torrent_alert::message() + " peer (" + ip.address().to_string(ec)
|
|
|
|
+ ", " + identify_client(pid) + ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
tcp::endpoint ip;
|
|
|
|
peer_id pid;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT tracker_alert: torrent_alert
|
|
|
|
{
|
|
|
|
tracker_alert(torrent_handle const& h
|
|
|
|
, std::string const& url_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, url(url_)
|
2008-07-12 13:04:23 +02:00
|
|
|
{}
|
2008-07-08 11:30:10 +02:00
|
|
|
|
|
|
|
const static int static_category = alert::tracker_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " (" + url + ")";
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string url;
|
|
|
|
};
|
|
|
|
|
2008-05-28 10:44:40 +02:00
|
|
|
struct TORRENT_EXPORT file_renamed_alert: torrent_alert
|
|
|
|
{
|
|
|
|
file_renamed_alert(torrent_handle const& h
|
|
|
|
, std::string const& name_
|
2008-07-06 14:22:56 +02:00
|
|
|
, int index_)
|
|
|
|
: torrent_alert(h)
|
2008-05-28 10:44:40 +02:00
|
|
|
, name(name_)
|
2008-07-06 14:22:56 +02:00
|
|
|
, index(index_)
|
2008-05-28 10:44:40 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new file_renamed_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual char const* what() const { return "file renamed"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << torrent_alert::message() << ": file "
|
|
|
|
<< index << " renamed to " << name;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2008-05-28 10:44:40 +02:00
|
|
|
|
|
|
|
std::string name;
|
2008-07-06 14:22:56 +02:00
|
|
|
int index;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert
|
|
|
|
{
|
|
|
|
file_rename_failed_alert(torrent_handle const& h
|
|
|
|
, std::string const& msg_
|
|
|
|
, int index_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, msg(msg_)
|
|
|
|
, index(index_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new file_rename_failed_alert(*this)); }
|
|
|
|
|
|
|
|
virtual char const* what() const { return "file rename failed"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << torrent_alert::message() << ": failed to rename file "
|
|
|
|
<< index << ": " << msg;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
|
|
|
|
std::string msg;
|
|
|
|
int index;
|
2008-05-28 10:44:40 +02:00
|
|
|
};
|
|
|
|
|
2008-08-19 17:04:14 +02:00
|
|
|
struct TORRENT_EXPORT performance_alert: torrent_alert
|
|
|
|
{
|
|
|
|
enum performance_warning_t
|
|
|
|
{
|
|
|
|
outstanding_disk_buffer_limit_reached,
|
2008-10-28 07:45:42 +01:00
|
|
|
outstanding_request_limit_reached,
|
|
|
|
upload_limit_too_low,
|
|
|
|
download_limit_too_low
|
2008-08-19 17:04:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
performance_alert(torrent_handle const& h
|
|
|
|
, performance_warning_t w)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, warning_code(w)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new performance_alert(*this)); }
|
|
|
|
|
|
|
|
virtual char const* what() const { return "performance warning"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
static char const* warning_str[] =
|
|
|
|
{
|
|
|
|
"max outstanding disk writes reached",
|
|
|
|
"max outstanding piece requests reached",
|
2008-10-28 07:45:42 +01:00
|
|
|
"upload limit too low (download rate will suffer)",
|
|
|
|
"download limit too low (upload rate will suffer)"
|
2008-08-19 17:04:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
return torrent_alert::message() + ": performance warning: "
|
|
|
|
+ warning_str[warning_code];
|
|
|
|
}
|
|
|
|
|
|
|
|
const static int static_category = alert::performance_warning;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
|
|
|
|
performance_warning_t warning_code;
|
|
|
|
};
|
|
|
|
|
2008-07-03 12:05:51 +02:00
|
|
|
struct TORRENT_EXPORT state_changed_alert: torrent_alert
|
|
|
|
{
|
|
|
|
state_changed_alert(torrent_handle const& h
|
2008-12-01 01:19:05 +01:00
|
|
|
, torrent_status::state_t state_
|
|
|
|
, torrent_status::state_t prev_state_)
|
2008-07-06 14:22:56 +02:00
|
|
|
: torrent_alert(h)
|
2008-07-03 12:05:51 +02:00
|
|
|
, state(state_)
|
2008-12-01 01:19:05 +01:00
|
|
|
, prev_state(prev_state_)
|
2008-07-03 12:05:51 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new state_changed_alert(*this)); }
|
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "torrent state changed"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
static char const* state_str[] =
|
2008-08-18 20:04:04 +02:00
|
|
|
{"checking (q)", "checking", "dl metadata"
|
2008-12-01 08:01:53 +01:00
|
|
|
, "downloading", "finished", "seeding", "allocating"
|
|
|
|
, "checking (r)"};
|
2008-07-06 14:22:56 +02:00
|
|
|
|
|
|
|
return torrent_alert::message() + ": state changed to: "
|
|
|
|
+ state_str[state];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
|
2008-07-03 12:05:51 +02:00
|
|
|
torrent_status::state_t state;
|
2008-12-01 01:19:05 +01:00
|
|
|
torrent_status::state_t prev_state;
|
2008-07-03 12:05:51 +02:00
|
|
|
};
|
|
|
|
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_error_alert: tracker_alert
|
|
|
|
{
|
|
|
|
tracker_error_alert(torrent_handle const& h
|
2004-09-12 12:12:16 +02:00
|
|
|
, int times
|
2005-04-21 01:00:27 +02:00
|
|
|
, int status
|
2008-04-23 03:54:21 +02:00
|
|
|
, std::string const& url
|
2008-07-06 14:22:56 +02:00
|
|
|
, std::string const& msg_)
|
|
|
|
: tracker_alert(h, url)
|
2004-09-12 12:12:16 +02:00
|
|
|
, times_in_row(times)
|
2005-04-21 01:00:27 +02:00
|
|
|
, status_code(status)
|
2008-07-06 14:22:56 +02:00
|
|
|
, msg(msg_)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2004-01-18 20:12:18 +01:00
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
2008-04-23 03:54:21 +02:00
|
|
|
{ return std::auto_ptr<alert>(new tracker_error_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::tracker_notification | alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual char const* what() const { return "tracker error"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << tracker_alert::message() << " (" << status_code << ") "
|
|
|
|
<< msg << " (" << times_in_row << ")";
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
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;
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2004-01-18 20:12:18 +01:00
|
|
|
};
|
|
|
|
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_warning_alert: tracker_alert
|
2005-08-11 01:32:39 +02:00
|
|
|
{
|
|
|
|
tracker_warning_alert(torrent_handle const& h
|
2008-04-23 03:54:21 +02:00
|
|
|
, std::string const& url
|
2008-07-06 14:22:56 +02:00
|
|
|
, std::string const& msg_)
|
|
|
|
: tracker_alert(h, url)
|
|
|
|
, msg(msg_)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2005-08-11 01:32:39 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
|
|
|
|
2005-08-11 01:32:39 +02:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new tracker_warning_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::tracker_notification | alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual char const* what() const { return "tracker warning"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return tracker_alert::message() + " warning: " + msg;
|
|
|
|
}
|
2005-08-11 01:32:39 +02:00
|
|
|
};
|
|
|
|
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT scrape_reply_alert: tracker_alert
|
2007-11-20 23:46:27 +01:00
|
|
|
{
|
|
|
|
scrape_reply_alert(torrent_handle const& h
|
|
|
|
, int incomplete_
|
|
|
|
, int complete_
|
2008-07-06 14:22:56 +02:00
|
|
|
, std::string const& url)
|
|
|
|
: tracker_alert(h, url)
|
2007-11-20 23:46:27 +01:00
|
|
|
, incomplete(incomplete_)
|
|
|
|
, complete(complete_)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2007-11-20 23:46:27 +01:00
|
|
|
|
|
|
|
int incomplete;
|
|
|
|
int complete;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new scrape_reply_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "tracker scrape reply"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << tracker_alert::message() << " scrape reply: " << incomplete
|
|
|
|
<< " " << complete;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2007-11-20 23:46:27 +01:00
|
|
|
};
|
|
|
|
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT scrape_failed_alert: tracker_alert
|
2007-11-20 23:46:27 +01:00
|
|
|
{
|
|
|
|
scrape_failed_alert(torrent_handle const& h
|
2008-04-23 03:54:21 +02:00
|
|
|
, std::string const& url
|
2008-07-06 14:22:56 +02:00
|
|
|
, std::string const& msg_)
|
|
|
|
: tracker_alert(h, url)
|
|
|
|
, msg(msg_)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2007-11-20 23:46:27 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
|
|
|
|
2007-11-20 23:46:27 +01:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new scrape_failed_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
const static int static_category = alert::tracker_notification | alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual char const* what() const { return "tracker scrape failed"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return tracker_alert::message() + " scrape failed: " + msg;
|
|
|
|
}
|
2007-11-20 23:46:27 +01:00
|
|
|
};
|
|
|
|
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_reply_alert: tracker_alert
|
2005-03-10 10:59:12 +01:00
|
|
|
{
|
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
|
2008-07-06 14:22:56 +02:00
|
|
|
, std::string const& url)
|
|
|
|
: tracker_alert(h, url)
|
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
|
|
|
|
2007-02-01 08:33:04 +01:00
|
|
|
int num_peers;
|
|
|
|
|
2005-03-10 10:59:12 +01:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new tracker_reply_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "tracker reply"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << tracker_alert::message() << " received peers: "
|
|
|
|
<< num_peers;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT dht_reply_alert: tracker_alert
|
|
|
|
{
|
|
|
|
dht_reply_alert(torrent_handle const& h
|
|
|
|
, int np)
|
|
|
|
: tracker_alert(h, "")
|
|
|
|
, num_peers(np)
|
|
|
|
{}
|
|
|
|
|
|
|
|
int num_peers;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new dht_reply_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "DHT reply"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << torrent_alert::message() << " received DHT peers: "
|
|
|
|
<< num_peers;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2005-03-10 10:59:12 +01:00
|
|
|
};
|
2005-06-06 12:33:44 +02:00
|
|
|
|
2008-04-23 03:54:21 +02:00
|
|
|
struct TORRENT_EXPORT tracker_announce_alert: tracker_alert
|
2005-06-06 12:33:44 +02:00
|
|
|
{
|
2008-04-23 03:54:21 +02:00
|
|
|
tracker_announce_alert(torrent_handle const& h
|
2008-07-11 14:00:29 +02:00
|
|
|
, std::string const& url, int event_)
|
2008-07-06 14:22:56 +02:00
|
|
|
: tracker_alert(h, url)
|
2008-07-11 14:00:29 +02:00
|
|
|
, event(event_)
|
2008-07-12 13:04:23 +02:00
|
|
|
{ TORRENT_ASSERT(!url.empty()); }
|
2008-07-11 14:00:29 +02:00
|
|
|
|
|
|
|
int event;
|
2005-06-06 12:33:44 +02:00
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new tracker_announce_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "tracker announce sent"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-07-11 14:00:29 +02:00
|
|
|
const static char* event_str[] = {"none", "completed", "started", "stopped"};
|
|
|
|
return tracker_alert::message() + " sending announce (" + event_str[event] + ")";
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2005-06-06 12:33:44 +02:00
|
|
|
};
|
2005-03-10 10:59:12 +01:00
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT hash_failed_alert: torrent_alert
|
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
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new hash_failed_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "piece hash failed"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << torrent_alert::message() << " hash for piece "
|
|
|
|
<< piece_index << " failed";
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2004-01-18 20:12:18 +01:00
|
|
|
|
|
|
|
int piece_index;
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_ban_alert: peer_alert
|
2004-03-21 03:03:37 +01:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_ban_alert(torrent_handle h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid)
|
|
|
|
: peer_alert(h, ip, pid)
|
2004-03-21 03:03:37 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_ban_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "peer banned"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2008-07-08 11:30:10 +02:00
|
|
|
return peer_alert::message() + " banned peer";
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2004-03-21 03:03:37 +01:00
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert
|
2008-07-07 14:04:06 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-07 14:04:06 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_unsnubbed_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "peer unsnubbed"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
return peer_alert::message() + " peer unsnubbed";
|
2008-07-07 14:04:06 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_snubbed_alert: peer_alert
|
2004-01-18 20:12:18 +01:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-06 14:22:56 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_snubbed_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "peer snubbed"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
return peer_alert::message() + " peer snubbed";
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_error_alert: peer_alert
|
2008-07-06 14:22:56 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_error_alert(torrent_handle const& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, std::string const& msg_)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-06 14:22:56 +02:00
|
|
|
, msg(msg_)
|
2004-01-18 20:12:18 +01:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_error_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "peer error"; }
|
|
|
|
const static int static_category = alert::peer_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2008-07-08 11:30:10 +02:00
|
|
|
return peer_alert::message() + " peer error: " + msg;
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2004-01-18 20:12:18 +01:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2004-01-18 20:12:18 +01:00
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_connect_alert: peer_alert
|
2008-05-12 08:05:13 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_connect_alert(torrent_handle h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-06 14:22:56 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_connect_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "connecting to peer"; }
|
|
|
|
const static int static_category = alert::debug_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
return peer_alert::message() + " connecting to peer";
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT peer_disconnected_alert: peer_alert
|
2008-07-06 14:22:56 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
peer_disconnected_alert(torrent_handle const& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, std::string const& msg_)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-06 14:22:56 +02:00
|
|
|
, msg(msg_)
|
2008-05-12 08:05:13 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_disconnected_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "peer disconnected"; }
|
|
|
|
const static int static_category = alert::debug_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
return peer_alert::message() + " disconnecting: " + msg;
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2008-05-12 08:05:13 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2008-05-12 08:05:13 +02:00
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT invalid_request_alert: peer_alert
|
2004-01-18 20:12:18 +01:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
invalid_request_alert(torrent_handle const& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, peer_request const& r)
|
|
|
|
: peer_alert(h, ip, pid)
|
2004-01-18 20:12:18 +01:00
|
|
|
, request(r)
|
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new invalid_request_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "invalid piece request"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << peer_alert::message() << " peer sent an invalid piece request "
|
|
|
|
"( piece: " << request.piece << " start: " << request.start
|
|
|
|
<< " len: " << request.length << ")";
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2004-01-18 20:12:18 +01:00
|
|
|
|
|
|
|
peer_request request;
|
|
|
|
};
|
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT torrent_finished_alert: torrent_alert
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new torrent_finished_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "torrent finished"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " torrent finished downloading";
|
|
|
|
}
|
2004-01-18 20:12:18 +01:00
|
|
|
};
|
|
|
|
|
2007-08-01 08:14:16 +02:00
|
|
|
struct TORRENT_EXPORT piece_finished_alert: torrent_alert
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
int piece_index;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new piece_finished_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "piece finished downloading"; }
|
|
|
|
const static int static_category = alert::progress_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << torrent_alert::message() << " piece " << piece_index
|
|
|
|
<< " finished downloading";
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2007-08-01 08:14:16 +02:00
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT request_dropped_alert: peer_alert
|
2008-07-07 14:04:06 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
request_dropped_alert(const torrent_handle& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-07 14:04:06 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new request_dropped_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "block request dropped"; }
|
|
|
|
const static int static_category = alert::progress_notification
|
|
|
|
| alert::peer_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << peer_alert::message() << " peer dropped block ( piece: "
|
|
|
|
<< piece_index << " block: " << block_index << ")";
|
|
|
|
return ret.str();
|
2008-07-07 14:04:06 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT block_timeout_alert: peer_alert
|
2008-07-07 14:04:06 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
block_timeout_alert(const torrent_handle& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ip, pid)
|
2008-07-07 14:04:06 +02:00
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new block_timeout_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "block timed out"; }
|
|
|
|
const static int static_category = alert::progress_notification
|
|
|
|
| alert::peer_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << peer_alert::message() << " peer timed out request ( piece: "
|
|
|
|
<< piece_index << " block: " << block_index << ")";
|
|
|
|
return ret.str();
|
2008-07-07 14:04:06 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT block_finished_alert: peer_alert
|
2007-08-01 08:14:16 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
block_finished_alert(const torrent_handle& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ip, pid)
|
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
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new block_finished_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "block finished downloading"; }
|
|
|
|
const static int static_category = alert::progress_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << peer_alert::message() << " block finished downloading ( piece: "
|
|
|
|
<< piece_index << " block: " << block_index << ")";
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2007-08-01 08:14:16 +02:00
|
|
|
};
|
|
|
|
|
2008-07-08 11:30:10 +02:00
|
|
|
struct TORRENT_EXPORT block_downloading_alert: peer_alert
|
2007-08-01 08:14:16 +02:00
|
|
|
{
|
2008-07-08 11:30:10 +02:00
|
|
|
block_downloading_alert(const torrent_handle& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, char const* speedmsg, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ip, pid)
|
2007-08-01 08:14:16 +02:00
|
|
|
, peer_speedmsg(speedmsg)
|
|
|
|
, 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
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
char const* peer_speedmsg;
|
2007-08-01 08:14:16 +02:00
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new block_downloading_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "block requested"; }
|
|
|
|
const static int static_category = alert::progress_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << peer_alert::message() << " requested block ( piece: "
|
|
|
|
<< piece_index << " block: " << block_index << ") " << peer_speedmsg;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2007-08-01 08:14:16 +02:00
|
|
|
};
|
|
|
|
|
2008-07-08 20:41:04 +02:00
|
|
|
struct TORRENT_EXPORT unwanted_block_alert: peer_alert
|
|
|
|
{
|
|
|
|
unwanted_block_alert(const torrent_handle& h, tcp::endpoint const& ip
|
|
|
|
, peer_id const& pid, int block_num, int piece_num)
|
|
|
|
: peer_alert(h, ip, pid)
|
|
|
|
, block_index(block_num)
|
|
|
|
, piece_index(piece_num)
|
|
|
|
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
|
|
|
|
|
|
|
|
int block_index;
|
|
|
|
int piece_index;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new unwanted_block_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "unwanted block received"; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << peer_alert::message() << " received block not in download queue ( piece: "
|
|
|
|
<< piece_index << " block: " << block_index << ")";
|
|
|
|
return ret.str();
|
2008-07-08 20:41:04 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-06-11 23:24:14 +02:00
|
|
|
struct TORRENT_EXPORT storage_moved_alert: torrent_alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
storage_moved_alert(torrent_handle const& h, std::string const& path_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, path(path_)
|
2007-06-11 23:24:14 +02:00
|
|
|
{}
|
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string path;
|
|
|
|
|
2007-06-11 23:24:14 +02:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new storage_moved_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "storage moved"; }
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " moved storage to: "
|
|
|
|
+ path;
|
|
|
|
}
|
2007-06-11 23:24:14 +02:00
|
|
|
};
|
|
|
|
|
2007-10-13 05:33:33 +02:00
|
|
|
struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
torrent_deleted_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h)
|
2007-10-13 05:33:33 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new torrent_deleted_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "torrent deleted"; }
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " deleted";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert
|
|
|
|
{
|
|
|
|
torrent_delete_failed_alert(torrent_handle const& h, std::string msg_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, msg(msg_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
std::string msg;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new torrent_delete_failed_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "torrent delete failed"; }
|
|
|
|
const static int static_category = alert::storage_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " torrent deletion failed: "
|
|
|
|
+ msg;
|
|
|
|
}
|
2007-10-13 05:33:33 +02:00
|
|
|
};
|
|
|
|
|
2008-04-13 20:54:36 +02:00
|
|
|
struct TORRENT_EXPORT save_resume_data_alert: torrent_alert
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
{}
|
|
|
|
|
|
|
|
boost::shared_ptr<entry> resume_data;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new save_resume_data_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "save resume data complete"; }
|
|
|
|
const static int static_category = alert::storage_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " resume data generated";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert
|
|
|
|
{
|
|
|
|
save_resume_data_failed_alert(torrent_handle const& h
|
|
|
|
, std::string const& msg_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, msg(msg_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
std::string msg;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new save_resume_data_failed_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "save resume data failed"; }
|
|
|
|
const static int static_category = alert::storage_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " resume data was not generated: "
|
|
|
|
+ msg;
|
|
|
|
}
|
2008-04-13 20:54:36 +02:00
|
|
|
};
|
|
|
|
|
2007-06-11 23:24:14 +02:00
|
|
|
struct TORRENT_EXPORT torrent_paused_alert: torrent_alert
|
|
|
|
{
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new torrent_paused_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "torrent paused"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " paused";
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert
|
|
|
|
{
|
|
|
|
torrent_resumed_alert(torrent_handle const& h)
|
|
|
|
: torrent_alert(h) {}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new torrent_resumed_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "torrent resumed"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " resumed";
|
|
|
|
}
|
2007-06-11 23:24:14 +02:00
|
|
|
};
|
|
|
|
|
2007-08-16 21:41:28 +02:00
|
|
|
struct TORRENT_EXPORT torrent_checked_alert: torrent_alert
|
|
|
|
{
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new torrent_checked_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "torrent checked"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " checked";
|
|
|
|
}
|
2007-08-16 21:41:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT url_seed_alert: torrent_alert
|
2006-04-25 23:04:48 +02:00
|
|
|
{
|
|
|
|
url_seed_alert(
|
2007-01-16 06:05:52 +01:00
|
|
|
torrent_handle const& h
|
|
|
|
, const std::string& url_
|
2008-07-06 14:22:56 +02:00
|
|
|
, const std::string& msg_)
|
|
|
|
: torrent_alert(h)
|
2006-04-25 23:04:48 +02:00
|
|
|
, url(url_)
|
2008-07-06 14:22:56 +02:00
|
|
|
, msg(msg_)
|
2006-04-25 23:04:48 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new url_seed_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "web seed error"; }
|
|
|
|
const static int static_category = alert::peer_notification | alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " url seed ("
|
|
|
|
+ url + ") failed: " + msg;
|
|
|
|
}
|
2006-04-25 23:04:48 +02:00
|
|
|
|
|
|
|
std::string url;
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2006-04-25 23:04:48 +02:00
|
|
|
};
|
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT file_error_alert: torrent_alert
|
2004-01-26 02:08:59 +01:00
|
|
|
{
|
|
|
|
file_error_alert(
|
2008-04-13 00:08:07 +02:00
|
|
|
std::string const& f
|
|
|
|
, const torrent_handle& h
|
2008-07-06 14:22:56 +02:00
|
|
|
, const std::string& msg_)
|
|
|
|
: torrent_alert(h)
|
2008-04-13 00:08:07 +02:00
|
|
|
, file(f)
|
2008-07-06 14:22:56 +02:00
|
|
|
, msg(msg_)
|
2004-01-26 02:08:59 +01:00
|
|
|
{}
|
|
|
|
|
2008-04-13 00:08:07 +02:00
|
|
|
std::string file;
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2008-04-13 00:08:07 +02:00
|
|
|
|
2004-01-26 02:08:59 +01:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new file_error_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "file error"; }
|
|
|
|
const static int static_category = alert::status_notification
|
|
|
|
| alert::error_notification
|
|
|
|
| alert::storage_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " file (" + file + ") error: "
|
|
|
|
+ msg;
|
|
|
|
}
|
2004-01-26 02:08:59 +01:00
|
|
|
};
|
2004-01-26 11:29:00 +01:00
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT metadata_failed_alert: torrent_alert
|
2005-10-17 15:45:53 +02:00
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
metadata_failed_alert(const torrent_handle& h)
|
|
|
|
: torrent_alert(h)
|
2005-10-17 15:45:53 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new metadata_failed_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "metadata failed"; }
|
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " invalid metadata received";
|
|
|
|
}
|
2005-10-17 15:45:53 +02:00
|
|
|
};
|
|
|
|
|
2007-01-16 06:05:52 +01:00
|
|
|
struct TORRENT_EXPORT metadata_received_alert: torrent_alert
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new metadata_received_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "metadata received"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " metadata successfully received";
|
|
|
|
}
|
2004-09-10 02:47:30 +02:00
|
|
|
};
|
|
|
|
|
2008-03-25 05:46:18 +01:00
|
|
|
struct TORRENT_EXPORT udp_error_alert: alert
|
|
|
|
{
|
|
|
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
udp::endpoint endpoint;
|
2008-07-06 14:22:56 +02:00
|
|
|
error_code error;
|
2008-03-25 05:46:18 +01:00
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new udp_error_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "udp error"; }
|
|
|
|
const static int static_category = alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
|
|
|
return "UDP error: " + error.message() + " from: " + endpoint.address().to_string(ec);
|
|
|
|
}
|
2008-03-25 05:46:18 +01:00
|
|
|
};
|
|
|
|
|
2008-03-29 23:45:55 +01:00
|
|
|
struct TORRENT_EXPORT external_ip_alert: alert
|
|
|
|
{
|
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
|
|
|
{}
|
|
|
|
|
|
|
|
address external_address;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new external_ip_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "external IP received"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
|
|
|
return "external IP received: " + external_address.to_string(ec);
|
|
|
|
}
|
2008-03-29 23:45:55 +01:00
|
|
|
};
|
|
|
|
|
2005-11-01 19:30:39 +01:00
|
|
|
struct TORRENT_EXPORT listen_failed_alert: alert
|
2004-01-26 11:29:00 +01:00
|
|
|
{
|
|
|
|
listen_failed_alert(
|
2007-09-22 18:27:29 +02:00
|
|
|
tcp::endpoint const& ep
|
2008-07-06 14:22:56 +02:00
|
|
|
, error_code const& ec)
|
|
|
|
: endpoint(ep)
|
|
|
|
, error(ec)
|
2004-01-26 11:29:00 +01:00
|
|
|
{}
|
|
|
|
|
2007-09-22 18:27:29 +02:00
|
|
|
tcp::endpoint endpoint;
|
2008-07-06 14:22:56 +02:00
|
|
|
error_code error;
|
2007-09-22 18:27:29 +02:00
|
|
|
|
2004-01-26 11:29:00 +01:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new listen_failed_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "listen failed"; }
|
|
|
|
const static int static_category = alert::status_notification | alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << "listening on " << endpoint
|
|
|
|
<< " failed: " << error.message();
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2004-01-26 11:29:00 +01:00
|
|
|
};
|
2005-06-16 17:41:04 +02:00
|
|
|
|
2007-09-22 18:27:29 +02:00
|
|
|
struct TORRENT_EXPORT listen_succeeded_alert: alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
listen_succeeded_alert(tcp::endpoint const& ep)
|
|
|
|
: endpoint(ep)
|
2007-09-22 18:27:29 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
tcp::endpoint endpoint;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new listen_succeeded_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "listen succeeded"; }
|
|
|
|
const static int static_category = alert::status_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << "successfully listening on " << endpoint;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2007-09-22 18:27:29 +02:00
|
|
|
};
|
|
|
|
|
2007-03-16 09:25:08 +01:00
|
|
|
struct TORRENT_EXPORT portmap_error_alert: alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
portmap_error_alert(int i, int t, const std::string& msg_)
|
|
|
|
: mapping(i), type(t), msg(msg_)
|
2007-03-16 09:25:08 +01:00
|
|
|
{}
|
|
|
|
|
2008-04-06 21:17:58 +02:00
|
|
|
int mapping;
|
2008-04-07 01:18:35 +02:00
|
|
|
int type;
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
2008-04-06 21:17:58 +02:00
|
|
|
|
2007-03-16 09:25:08 +01:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new portmap_error_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "port map error"; }
|
|
|
|
const static int static_category = alert::port_mapping_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
static char const* type_str[] = {"NAT-PMP", "UPnP"};
|
|
|
|
return std::string("could not map port using ") + type_str[type]
|
|
|
|
+ ": " + msg;
|
|
|
|
}
|
2007-03-16 09:25:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT portmap_alert: alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
portmap_alert(int i, int port, int t)
|
|
|
|
: mapping(i), external_port(port), type(t)
|
2007-03-16 09:25:08 +01:00
|
|
|
{}
|
|
|
|
|
2008-04-06 21:17:58 +02:00
|
|
|
int mapping;
|
|
|
|
int external_port;
|
2008-04-07 01:18:35 +02:00
|
|
|
int type;
|
2008-04-06 21:17:58 +02:00
|
|
|
|
2007-03-16 09:25:08 +01:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new portmap_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "port map succeeded"; }
|
|
|
|
const static int static_category = alert::port_mapping_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
static char const* type_str[] = {"NAT-PMP", "UPnP"};
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << "successfully mapped port using " << type_str[type]
|
|
|
|
<< ". external port: " << external_port;
|
|
|
|
return ret.str();
|
2008-07-06 14:22:56 +02:00
|
|
|
}
|
2007-03-16 09:25:08 +01:00
|
|
|
};
|
|
|
|
|
2008-10-22 03:12:14 +02:00
|
|
|
struct TORRENT_EXPORT portmap_log_alert: alert
|
|
|
|
{
|
|
|
|
portmap_log_alert(int t, std::string const& m)
|
|
|
|
: type(t), msg(m)
|
|
|
|
{}
|
|
|
|
|
|
|
|
int type;
|
|
|
|
std::string msg;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new portmap_log_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "port map log"; }
|
|
|
|
const static int static_category = alert::port_mapping_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
static char const* type_str[] = {"NAT-PMP", "UPnP"};
|
|
|
|
std::stringstream ret;
|
|
|
|
ret << type_str[type] << ": " << msg;
|
|
|
|
return ret.str();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-03-16 08:59:04 +01:00
|
|
|
struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
|
2005-06-16 17:41:04 +02:00
|
|
|
{
|
|
|
|
fastresume_rejected_alert(torrent_handle const& h
|
2008-07-06 14:22:56 +02:00
|
|
|
, std::string const& msg_)
|
|
|
|
: torrent_alert(h)
|
|
|
|
, msg(msg_)
|
2005-08-11 01:32:39 +02:00
|
|
|
{}
|
2005-06-16 17:41:04 +02:00
|
|
|
|
2008-07-06 14:22:56 +02:00
|
|
|
std::string msg;
|
|
|
|
|
2005-06-16 17:41:04 +02:00
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new fastresume_rejected_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "resume data rejected"; }
|
|
|
|
const static int static_category = alert::status_notification
|
|
|
|
| alert::error_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
return torrent_alert::message() + " fast resume rejected: " + msg;
|
|
|
|
}
|
2005-06-16 17:41:04 +02:00
|
|
|
};
|
|
|
|
|
2007-04-17 07:56:43 +02:00
|
|
|
struct TORRENT_EXPORT peer_blocked_alert: alert
|
|
|
|
{
|
2008-07-06 14:22:56 +02:00
|
|
|
peer_blocked_alert(address const& ip_)
|
|
|
|
: ip(ip_)
|
2007-04-17 07:56:43 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
address ip;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new peer_blocked_alert(*this)); }
|
2008-07-06 14:22:56 +02:00
|
|
|
virtual char const* what() const { return "peer blocked"; }
|
|
|
|
const static int static_category = alert::ip_block_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
|
|
|
return "blocked peer: " + ip.to_string(ec);
|
|
|
|
}
|
2008-06-08 07:14:40 +02:00
|
|
|
};
|
2008-09-20 19:42:25 +02:00
|
|
|
|
|
|
|
struct TORRENT_EXPORT dht_announce_alert: alert
|
|
|
|
{
|
|
|
|
dht_announce_alert(address const& ip_, int port_
|
|
|
|
, sha1_hash const& info_hash_)
|
|
|
|
: ip(ip_)
|
|
|
|
, port(port_)
|
|
|
|
, info_hash(info_hash_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
address ip;
|
|
|
|
int port;
|
|
|
|
sha1_hash info_hash;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new dht_announce_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "incoming dht announce"; }
|
|
|
|
const static int static_category = alert::dht_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << "incoming dht annonce: " << ip.to_string(ec) << ":"
|
|
|
|
<< port << " (" << info_hash << ")";
|
|
|
|
return ret.str();
|
2008-09-20 19:42:25 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct TORRENT_EXPORT dht_get_peers_alert: alert
|
|
|
|
{
|
|
|
|
dht_get_peers_alert(sha1_hash const& info_hash_)
|
|
|
|
: info_hash(info_hash_)
|
|
|
|
{}
|
|
|
|
|
|
|
|
sha1_hash info_hash;
|
|
|
|
|
|
|
|
virtual std::auto_ptr<alert> clone() const
|
|
|
|
{ return std::auto_ptr<alert>(new dht_get_peers_alert(*this)); }
|
|
|
|
virtual char const* what() const { return "incoming dht get_peers request"; }
|
|
|
|
const static int static_category = alert::dht_notification;
|
|
|
|
virtual int category() const { return static_category; }
|
|
|
|
virtual std::string message() const
|
|
|
|
{
|
|
|
|
error_code ec;
|
2008-10-18 19:22:31 +02:00
|
|
|
std::stringstream ret;
|
|
|
|
ret << "incoming dht get_peers: " << info_hash;
|
|
|
|
return ret.str();
|
2008-09-20 19:42:25 +02:00
|
|
|
}
|
|
|
|
};
|
2004-01-18 20:12:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|