3
Copyright (c) 2003, Arvid Norberg
6
Redistribution and use in source and binary forms, with or without
7
modification, are permitted provided that the following conditions
10
* Redistributions of source code must retain the above copyright
11
notice, this list of conditions and the following disclaimer.
12
* Redistributions in binary form must reproduce the above copyright
13
notice, this list of conditions and the following disclaimer in
14
the documentation and/or other materials provided with the distribution.
15
* Neither the name of the author nor the names of its
16
contributors may be used to endorse or promote products derived
17
from this software without specific prior written permission.
19
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
POSSIBILITY OF SUCH DAMAGE.
33
#ifndef TORRENT_ALERT_TYPES_HPP_INCLUDED
34
#define TORRENT_ALERT_TYPES_HPP_INCLUDED
36
#include "libtorrent/alert.hpp"
37
#include "libtorrent/torrent_handle.hpp"
38
#include "libtorrent/socket.hpp"
39
#include "libtorrent/peer_connection.hpp"
40
#include "libtorrent/config.hpp"
41
#include "libtorrent/assert.hpp"
45
struct TORRENT_EXPORT torrent_alert: alert
47
torrent_alert(torrent_handle const& h, alert::severity_t s
48
, std::string const& msg)
53
torrent_handle handle;
56
struct TORRENT_EXPORT tracker_alert: torrent_alert
58
tracker_alert(torrent_handle const& h
61
, std::string const& url_
62
, std::string const& msg)
63
: torrent_alert(h, alert::warning, msg)
69
virtual std::auto_ptr<alert> clone() const
70
{ return std::auto_ptr<alert>(new tracker_alert(*this)); }
77
struct TORRENT_EXPORT tracker_warning_alert: torrent_alert
79
tracker_warning_alert(torrent_handle const& h
80
, std::string const& msg)
81
: torrent_alert(h, alert::warning, msg)
84
virtual std::auto_ptr<alert> clone() const
85
{ return std::auto_ptr<alert>(new tracker_warning_alert(*this)); }
88
struct TORRENT_EXPORT scrape_reply_alert: torrent_alert
90
scrape_reply_alert(torrent_handle const& h
93
, std::string const& msg)
94
: torrent_alert(h, alert::info, msg)
95
, incomplete(incomplete_)
102
virtual std::auto_ptr<alert> clone() const
103
{ return std::auto_ptr<alert>(new scrape_reply_alert(*this)); }
106
struct TORRENT_EXPORT scrape_failed_alert: torrent_alert
108
scrape_failed_alert(torrent_handle const& h
109
, std::string const& msg)
110
: torrent_alert(h, alert::warning, msg)
113
virtual std::auto_ptr<alert> clone() const
114
{ return std::auto_ptr<alert>(new scrape_failed_alert(*this)); }
117
struct TORRENT_EXPORT tracker_reply_alert: torrent_alert
119
tracker_reply_alert(torrent_handle const& h
121
, std::string const& msg)
122
: torrent_alert(h, alert::info, msg)
128
virtual std::auto_ptr<alert> clone() const
129
{ return std::auto_ptr<alert>(new tracker_reply_alert(*this)); }
132
struct TORRENT_EXPORT tracker_announce_alert: torrent_alert
134
tracker_announce_alert(torrent_handle const& h, std::string const& msg)
135
: torrent_alert(h, alert::info, msg)
138
virtual std::auto_ptr<alert> clone() const
139
{ return std::auto_ptr<alert>(new tracker_announce_alert(*this)); }
142
struct TORRENT_EXPORT hash_failed_alert: torrent_alert
145
torrent_handle const& h
147
, std::string const& msg)
148
: torrent_alert(h, alert::info, msg)
150
{ TORRENT_ASSERT(index >= 0);}
152
virtual std::auto_ptr<alert> clone() const
153
{ return std::auto_ptr<alert>(new hash_failed_alert(*this)); }
158
struct TORRENT_EXPORT peer_ban_alert: torrent_alert
160
peer_ban_alert(tcp::endpoint const& pip, torrent_handle h, std::string const& msg)
161
: torrent_alert(h, alert::info, msg)
165
virtual std::auto_ptr<alert> clone() const
166
{ return std::auto_ptr<alert>(new peer_ban_alert(*this)); }
171
struct TORRENT_EXPORT peer_error_alert: alert
173
peer_error_alert(tcp::endpoint const& pip, peer_id const& pid_, std::string const& msg)
174
: alert(alert::debug, msg)
179
virtual std::auto_ptr<alert> clone() const
180
{ return std::auto_ptr<alert>(new peer_error_alert(*this)); }
186
struct TORRENT_EXPORT invalid_request_alert: torrent_alert
188
invalid_request_alert(
189
peer_request const& r
190
, torrent_handle const& h
191
, tcp::endpoint const& sender
192
, peer_id const& pid_
193
, std::string const& msg)
194
: torrent_alert(h, alert::debug, msg)
200
virtual std::auto_ptr<alert> clone() const
201
{ return std::auto_ptr<alert>(new invalid_request_alert(*this)); }
204
peer_request request;
208
struct TORRENT_EXPORT torrent_finished_alert: torrent_alert
210
torrent_finished_alert(
211
const torrent_handle& h
212
, const std::string& msg)
213
: torrent_alert(h, alert::warning, msg)
216
virtual std::auto_ptr<alert> clone() const
217
{ return std::auto_ptr<alert>(new torrent_finished_alert(*this)); }
220
struct TORRENT_EXPORT piece_finished_alert: torrent_alert
222
piece_finished_alert(
223
const torrent_handle& h
225
, const std::string& msg)
226
: torrent_alert(h, alert::debug, msg)
227
, piece_index(piece_num)
228
{ TORRENT_ASSERT(piece_index >= 0);}
232
virtual std::auto_ptr<alert> clone() const
233
{ return std::auto_ptr<alert>(new piece_finished_alert(*this)); }
236
struct TORRENT_EXPORT block_finished_alert: torrent_alert
238
block_finished_alert(
239
const torrent_handle& h
242
, const std::string& msg)
243
: torrent_alert(h, alert::debug, msg)
244
, block_index(block_num)
245
, piece_index(piece_num)
246
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
251
virtual std::auto_ptr<alert> clone() const
252
{ return std::auto_ptr<alert>(new block_finished_alert(*this)); }
255
struct TORRENT_EXPORT block_downloading_alert: torrent_alert
257
block_downloading_alert(
258
const torrent_handle& h
259
, char const* speedmsg
262
, const std::string& msg)
263
: torrent_alert(h, alert::debug, msg)
264
, peer_speedmsg(speedmsg)
265
, block_index(block_num)
266
, piece_index(piece_num)
267
{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}
269
std::string peer_speedmsg;
273
virtual std::auto_ptr<alert> clone() const
274
{ return std::auto_ptr<alert>(new block_downloading_alert(*this)); }
277
struct TORRENT_EXPORT storage_moved_alert: torrent_alert
279
storage_moved_alert(torrent_handle const& h, std::string const& path)
280
: torrent_alert(h, alert::warning, path)
283
virtual std::auto_ptr<alert> clone() const
284
{ return std::auto_ptr<alert>(new storage_moved_alert(*this)); }
287
struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert
289
torrent_deleted_alert(torrent_handle const& h, std::string const& msg)
290
: torrent_alert(h, alert::warning, msg)
293
virtual std::auto_ptr<alert> clone() const
294
{ return std::auto_ptr<alert>(new torrent_deleted_alert(*this)); }
297
struct TORRENT_EXPORT torrent_paused_alert: torrent_alert
299
torrent_paused_alert(torrent_handle const& h, std::string const& msg)
300
: torrent_alert(h, alert::warning, msg)
303
virtual std::auto_ptr<alert> clone() const
304
{ return std::auto_ptr<alert>(new torrent_paused_alert(*this)); }
307
struct TORRENT_EXPORT torrent_checked_alert: torrent_alert
309
torrent_checked_alert(torrent_handle const& h, std::string const& msg)
310
: torrent_alert(h, alert::info, msg)
313
virtual std::auto_ptr<alert> clone() const
314
{ return std::auto_ptr<alert>(new torrent_checked_alert(*this)); }
318
struct TORRENT_EXPORT url_seed_alert: torrent_alert
321
torrent_handle const& h
322
, const std::string& url_
323
, const std::string& msg)
324
: torrent_alert(h, alert::warning, msg)
328
virtual std::auto_ptr<alert> clone() const
329
{ return std::auto_ptr<alert>(new url_seed_alert(*this)); }
334
struct TORRENT_EXPORT file_error_alert: torrent_alert
337
const torrent_handle& h
338
, const std::string& msg)
339
: torrent_alert(h, alert::fatal, msg)
342
virtual std::auto_ptr<alert> clone() const
343
{ return std::auto_ptr<alert>(new file_error_alert(*this)); }
346
struct TORRENT_EXPORT metadata_failed_alert: torrent_alert
348
metadata_failed_alert(
349
const torrent_handle& h
350
, const std::string& msg)
351
: torrent_alert(h, alert::info, msg)
354
virtual std::auto_ptr<alert> clone() const
355
{ return std::auto_ptr<alert>(new metadata_failed_alert(*this)); }
358
struct TORRENT_EXPORT metadata_received_alert: torrent_alert
360
metadata_received_alert(
361
const torrent_handle& h
362
, const std::string& msg)
363
: torrent_alert(h, alert::info, msg)
366
virtual std::auto_ptr<alert> clone() const
367
{ return std::auto_ptr<alert>(new metadata_received_alert(*this)); }
370
struct TORRENT_EXPORT listen_failed_alert: alert
373
tcp::endpoint const& ep
374
, std::string const& msg)
375
: alert(alert::fatal, msg)
379
tcp::endpoint endpoint;
381
virtual std::auto_ptr<alert> clone() const
382
{ return std::auto_ptr<alert>(new listen_failed_alert(*this)); }
385
struct TORRENT_EXPORT listen_succeeded_alert: alert
387
listen_succeeded_alert(
388
tcp::endpoint const& ep
389
, std::string const& msg)
390
: alert(alert::fatal, msg)
394
tcp::endpoint endpoint;
396
virtual std::auto_ptr<alert> clone() const
397
{ return std::auto_ptr<alert>(new listen_succeeded_alert(*this)); }
400
struct TORRENT_EXPORT portmap_error_alert: alert
402
portmap_error_alert(const std::string& msg)
403
: alert(alert::warning, msg)
406
virtual std::auto_ptr<alert> clone() const
407
{ return std::auto_ptr<alert>(new portmap_error_alert(*this)); }
410
struct TORRENT_EXPORT portmap_alert: alert
412
portmap_alert(const std::string& msg)
413
: alert(alert::info, msg)
416
virtual std::auto_ptr<alert> clone() const
417
{ return std::auto_ptr<alert>(new portmap_alert(*this)); }
420
struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
422
fastresume_rejected_alert(torrent_handle const& h
423
, std::string const& msg)
424
: torrent_alert(h, alert::warning, msg)
427
virtual std::auto_ptr<alert> clone() const
428
{ return std::auto_ptr<alert>(new fastresume_rejected_alert(*this)); }
431
struct TORRENT_EXPORT peer_blocked_alert: alert
433
peer_blocked_alert(address const& ip_
434
, std::string const& msg)
435
: alert(alert::info, msg)
441
virtual std::auto_ptr<alert> clone() const
442
{ return std::auto_ptr<alert>(new peer_blocked_alert(*this)); }