This file is indexed.

/usr/include/libtorrent/alert_types.hpp is in libtorrent-rasterbar-dev 0.16.13-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
/*

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"
#include "libtorrent/socket.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/identify_client.hpp"
#include "libtorrent/address.hpp"
#include "libtorrent/stat.hpp"
#include "libtorrent/rss.hpp" // for feed_handle

// lines reserved for future includes
// the type-ids of the alert types
// are derived from the line on which
// they are declared




namespace libtorrent
{

	// user defined alerts should use IDs greater than this
	const static int user_alert_id = 10000;

	struct TORRENT_EXPORT torrent_alert: alert
	{
		torrent_alert(torrent_handle const& h)
			: handle(h)
		{}
		
		const static int alert_type = 1;
		virtual std::string message() const;

		torrent_handle handle;
	};

	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 alert_type = 2;
		const static int static_category = alert::peer_notification;
		virtual int category() const { return static_category; }
		virtual std::string message() const;

		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_)
		{}

		const static int alert_type = 3;
		const static int static_category = alert::tracker_notification;
		virtual int category() const { return static_category; }
		virtual std::string message() const;

		std::string url;
	};

#define TORRENT_DEFINE_ALERT(name) \
	const static int alert_type = __LINE__; \
	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; }

	struct TORRENT_EXPORT torrent_added_alert: torrent_alert
	{
		torrent_added_alert(torrent_handle const& h)
			: torrent_alert(h)
		{}

		TORRENT_DEFINE_ALERT(torrent_added_alert);
		const static int static_category = alert::status_notification;
		virtual std::string message() const;
	};

	struct TORRENT_EXPORT torrent_removed_alert: torrent_alert
	{
		torrent_removed_alert(torrent_handle const& h, sha1_hash const& ih)
			: torrent_alert(h)
			, info_hash(ih)
		{}

		TORRENT_DEFINE_ALERT(torrent_removed_alert);
		const static int static_category = alert::status_notification;
		virtual std::string message() const;
		sha1_hash info_hash;
	};

	struct TORRENT_EXPORT read_piece_alert: torrent_alert
	{
		read_piece_alert(torrent_handle const& h
			, int p, boost::shared_array<char> d, int s)
			: torrent_alert(h)
			, buffer(d)
			, piece(p)
			, size(s)
		{}

		TORRENT_DEFINE_ALERT(read_piece_alert);

		const static int static_category = alert::storage_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		boost::shared_array<char> buffer;
		int piece;
		int size;
	};

	struct TORRENT_EXPORT file_completed_alert: torrent_alert
	{
		file_completed_alert(torrent_handle const& h
			, int index_)
			: torrent_alert(h)
			, index(index_)
		{}

		TORRENT_DEFINE_ALERT(file_completed_alert);

		const static int static_category = alert::progress_notification;
		virtual std::string message() const;

		int index;
	};

	struct TORRENT_EXPORT file_renamed_alert: torrent_alert
	{
		file_renamed_alert(torrent_handle const& h
			, std::string const& name_
			, int index_)
			: torrent_alert(h)
			, name(name_)
			, index(index_)
		{}

		TORRENT_DEFINE_ALERT(file_renamed_alert);

		const static int static_category = alert::storage_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		std::string name;
		int index;
	};

	struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert
	{
		file_rename_failed_alert(torrent_handle const& h
			, int index_
			, error_code ec_)
			: torrent_alert(h)
			, index(index_)
			, error(ec_)
		{}

		TORRENT_DEFINE_ALERT(file_rename_failed_alert);

		const static int static_category = alert::storage_notification;

		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		int index;
		error_code error;
	};

	struct TORRENT_EXPORT performance_alert: torrent_alert
	{
		enum performance_warning_t
		{
			outstanding_disk_buffer_limit_reached,
			outstanding_request_limit_reached,
			upload_limit_too_low,
			download_limit_too_low,
			send_buffer_watermark_too_low,
			too_many_optimistic_unchoke_slots,
			bittyrant_with_no_uplimit,
			too_high_disk_queue_limit,
			too_few_outgoing_ports,
			too_few_file_descriptors,







			num_warnings
		};

		performance_alert(torrent_handle const& h
			, performance_warning_t w)
			: torrent_alert(h)
			, warning_code(w)
		{}

		TORRENT_DEFINE_ALERT(performance_alert);

		const static int static_category = alert::performance_warning;

		virtual std::string message() const;

		performance_warning_t warning_code;
	};

	struct TORRENT_EXPORT state_changed_alert: torrent_alert
	{
		state_changed_alert(torrent_handle const& h
			, torrent_status::state_t state_
			, torrent_status::state_t prev_state_)
			: torrent_alert(h)
			, state(state_)
			, prev_state(prev_state_)
		{}

		TORRENT_DEFINE_ALERT(state_changed_alert);

		const static int static_category = alert::status_notification;

		virtual std::string message() const;

		torrent_status::state_t state;
		torrent_status::state_t prev_state;
	};

	struct TORRENT_EXPORT tracker_error_alert: tracker_alert
	{
		tracker_error_alert(torrent_handle const& h
			, int times
			, int status
			, std::string const& url_
			, error_code const& e
			, std::string const& m)
			: tracker_alert(h, url_)
			, times_in_row(times)
			, status_code(status)
			, error(e)
			, msg(m)
		{
			TORRENT_ASSERT(!url.empty());
		}

		TORRENT_DEFINE_ALERT(tracker_error_alert);

		const static int static_category = alert::tracker_notification | alert::error_notification;
		virtual std::string message() const;

		int times_in_row;
		int status_code;
		error_code error;
		std::string msg;
	};

	struct TORRENT_EXPORT tracker_warning_alert: tracker_alert
	{
		tracker_warning_alert(torrent_handle const& h
			, std::string const& url_
			, std::string const& msg_)
			: tracker_alert(h, url_)
			, msg(msg_)
		{ TORRENT_ASSERT(!url.empty()); }

		TORRENT_DEFINE_ALERT(tracker_warning_alert);

		const static int static_category = alert::tracker_notification | alert::error_notification;
		virtual std::string message() const;

		std::string msg;
	};

	struct TORRENT_EXPORT scrape_reply_alert: tracker_alert
	{
		scrape_reply_alert(torrent_handle const& h
			, int incomplete_
			, int complete_
			, std::string const& url_)
			: tracker_alert(h, url_)
			, incomplete(incomplete_)
			, complete(complete_)
		{ TORRENT_ASSERT(!url.empty()); }

		TORRENT_DEFINE_ALERT(scrape_reply_alert);

		virtual std::string message() const;

		int incomplete;
		int complete;
	};

	struct TORRENT_EXPORT scrape_failed_alert: tracker_alert
	{
		scrape_failed_alert(torrent_handle const& h
			, std::string const& url_
			, error_code const& e)
			: tracker_alert(h, url_)
			, msg(convert_from_native(e.message()))
		{ TORRENT_ASSERT(!url.empty()); }

		scrape_failed_alert(torrent_handle const& h
			, std::string const& url_
			, std::string const& msg_)
			: tracker_alert(h, url_)
			, msg(msg_)
		{ TORRENT_ASSERT(!url.empty()); }

		TORRENT_DEFINE_ALERT(scrape_failed_alert);

		const static int static_category = alert::tracker_notification | alert::error_notification;
		virtual std::string message() const;

		std::string msg;
	};

	struct TORRENT_EXPORT tracker_reply_alert: tracker_alert
	{
		tracker_reply_alert(torrent_handle const& h
			, int np
			, std::string const& url_)
			: tracker_alert(h, url_)
			, num_peers(np)
		{ TORRENT_ASSERT(!url.empty()); }

		TORRENT_DEFINE_ALERT(tracker_reply_alert);

		virtual std::string message() const;

		int num_peers;
	};

	struct TORRENT_EXPORT dht_reply_alert: tracker_alert
	{
		dht_reply_alert(torrent_handle const& h
			, int np)
			: tracker_alert(h, "")
			, num_peers(np)
		{}

		TORRENT_DEFINE_ALERT(dht_reply_alert);

		virtual std::string message() const;

		int num_peers;
	};

	struct TORRENT_EXPORT tracker_announce_alert: tracker_alert
	{
		tracker_announce_alert(torrent_handle const& h
			, std::string const& url_, int event_)
			: tracker_alert(h, url_)
			, event(event_)
		{ TORRENT_ASSERT(!url.empty()); }

		TORRENT_DEFINE_ALERT(tracker_announce_alert);

		virtual std::string message() const;

		int event;
	};
	
	struct TORRENT_EXPORT hash_failed_alert: torrent_alert
	{
		hash_failed_alert(
			torrent_handle const& h
			, int index)
			: torrent_alert(h)
			, piece_index(index)
		{ TORRENT_ASSERT(index >= 0);}

		TORRENT_DEFINE_ALERT(hash_failed_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const;

		int piece_index;
	};

	struct TORRENT_EXPORT peer_ban_alert: peer_alert
	{
		peer_ban_alert(torrent_handle h, tcp::endpoint const& ep
			, peer_id const& peer_id)
			: peer_alert(h, ep, peer_id)
		{}

		TORRENT_DEFINE_ALERT(peer_ban_alert);

		virtual std::string message() const;
	};

	struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert
	{
		peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const& ep
			, peer_id const& peer_id)
			: peer_alert(h, ep, peer_id)
		{}

		TORRENT_DEFINE_ALERT(peer_unsnubbed_alert);

		virtual std::string message() const;
	};

	struct TORRENT_EXPORT peer_snubbed_alert: peer_alert
	{
		peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep
			, peer_id const& peer_id)
			: peer_alert(h, ep, peer_id)
		{}

		TORRENT_DEFINE_ALERT(peer_snubbed_alert);

		virtual std::string message() const;
	};

	struct TORRENT_EXPORT peer_error_alert: peer_alert
	{
		peer_error_alert(torrent_handle const& h, tcp::endpoint const& ep
			, peer_id const& peer_id, error_code const& e)
			: peer_alert(h, ep, peer_id)
			, error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}

		TORRENT_DEFINE_ALERT(peer_error_alert);

		const static int static_category = alert::peer_notification;
		virtual std::string message() const
		{
			return peer_alert::message() + " peer error: " + convert_from_native(error.message());
		}

		error_code error;

#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT peer_connect_alert: peer_alert
	{
		peer_connect_alert(torrent_handle h, tcp::endpoint const& ep
			, peer_id const& peer_id)
			: peer_alert(h, ep, peer_id)
		{}

		TORRENT_DEFINE_ALERT(peer_connect_alert);

		const static int static_category = alert::debug_notification;
		virtual std::string message() const
		{ return peer_alert::message() + " connecting to peer"; }
	};

	struct TORRENT_EXPORT peer_disconnected_alert: peer_alert
	{
		peer_disconnected_alert(torrent_handle const& h, tcp::endpoint const& ep
			, peer_id const& peer_id, error_code const& e)
			: peer_alert(h, ep, peer_id)
			, error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}

		TORRENT_DEFINE_ALERT(peer_disconnected_alert);

		const static int static_category = alert::debug_notification;
		virtual std::string message() const;

		error_code error;

#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT invalid_request_alert: peer_alert
	{
		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)
			, request(r)
		{}

		TORRENT_DEFINE_ALERT(invalid_request_alert);

		virtual std::string message() const;

		peer_request request;
	};

	struct TORRENT_EXPORT torrent_finished_alert: torrent_alert
	{
		torrent_finished_alert(
			const torrent_handle& h)
			: torrent_alert(h)
		{}

		TORRENT_DEFINE_ALERT(torrent_finished_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " torrent finished downloading"; }
	};

	struct TORRENT_EXPORT piece_finished_alert: torrent_alert
	{
		piece_finished_alert(
			const torrent_handle& h
			, int piece_num)
			: torrent_alert(h)
			, piece_index(piece_num)
		{ TORRENT_ASSERT(piece_index >= 0);}

		TORRENT_DEFINE_ALERT(piece_finished_alert);

		const static int static_category = alert::progress_notification;
		virtual std::string message() const;

		int piece_index;
	};

	struct TORRENT_EXPORT request_dropped_alert: peer_alert
	{
		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)
			, block_index(block_num)
			, piece_index(piece_num)
		{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}

		TORRENT_DEFINE_ALERT(request_dropped_alert);

		const static int static_category = alert::progress_notification
			| alert::peer_notification;
		virtual std::string message() const;

		int block_index;
		int piece_index;
	};

	struct TORRENT_EXPORT block_timeout_alert: peer_alert
	{
		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)
			, block_index(block_num)
			, piece_index(piece_num)
		{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}

		TORRENT_DEFINE_ALERT(block_timeout_alert);

		const static int static_category = alert::progress_notification
			| alert::peer_notification;
		virtual std::string message() const;

		int block_index;
		int piece_index;
	};

	struct TORRENT_EXPORT block_finished_alert: peer_alert
	{
		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)
			, block_index(block_num)
			, piece_index(piece_num)
		{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}

		TORRENT_DEFINE_ALERT(block_finished_alert);

		const static int static_category = alert::progress_notification;
		virtual std::string message() const;

		int block_index;
		int piece_index;
	};

	struct TORRENT_EXPORT block_downloading_alert: peer_alert
	{
		block_downloading_alert(const torrent_handle& h, tcp::endpoint const& ep
			, peer_id const& peer_id, char const* speedmsg, int block_num, int piece_num)
			: peer_alert(h, ep, peer_id)
			, peer_speedmsg(speedmsg)
			, block_index(block_num)
			, piece_index(piece_num)
		{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0); }

		TORRENT_DEFINE_ALERT(block_downloading_alert);

		const static int static_category = alert::progress_notification;
		virtual std::string message() const;

		char const* peer_speedmsg;
		int block_index;
		int piece_index;
	};

	struct TORRENT_EXPORT unwanted_block_alert: peer_alert
	{
		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)
			, block_index(block_num)
			, piece_index(piece_num)
		{ TORRENT_ASSERT(block_index >= 0 && piece_index >= 0);}

		TORRENT_DEFINE_ALERT(unwanted_block_alert);

		virtual std::string message() const;

		int block_index;
		int piece_index;
	};

	struct TORRENT_EXPORT storage_moved_alert: torrent_alert
	{
		storage_moved_alert(torrent_handle const& h, std::string const& path_)
			: torrent_alert(h)
			, path(path_)
		{}
	
		TORRENT_DEFINE_ALERT(storage_moved_alert);

		const static int static_category = alert::storage_notification;
		virtual std::string message() const
		{
			return torrent_alert::message() + " moved storage to: "
				+ path;
		}

		std::string path;
	};

	struct TORRENT_EXPORT storage_moved_failed_alert: torrent_alert
	{
		storage_moved_failed_alert(torrent_handle const& h, error_code const& ec_)
			: torrent_alert(h)
			, error(ec_)
		{}
	
		TORRENT_DEFINE_ALERT(storage_moved_failed_alert);

		const static int static_category = alert::storage_notification;
		virtual std::string message() const
		{
			return torrent_alert::message() + " storage move failed: "
				+ convert_from_native(error.message());
		}

		error_code error;
	};

	struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert
	{
		torrent_deleted_alert(torrent_handle const& h, sha1_hash const& ih)
			: torrent_alert(h)
		{ info_hash = ih; }
	
		TORRENT_DEFINE_ALERT(torrent_deleted_alert);

		const static int static_category = alert::storage_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " deleted"; }

		sha1_hash info_hash;
	};

	struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert
	{
		torrent_delete_failed_alert(torrent_handle const& h, error_code const& e)
			: torrent_alert(h)
			, error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}
	
		TORRENT_DEFINE_ALERT(torrent_delete_failed_alert);

		const static int static_category = alert::storage_notification
			| alert::error_notification;
		virtual std::string message() const
		{
			return torrent_alert::message() + " torrent deletion failed: "
				+convert_from_native(error.message());
		}

		error_code error;

#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT save_resume_data_alert: torrent_alert
	{
		save_resume_data_alert(boost::shared_ptr<entry> const& rd
			, torrent_handle const& h)
			: torrent_alert(h)
			, resume_data(rd)
		{}
	
		TORRENT_DEFINE_ALERT(save_resume_data_alert);

		const static int static_category = alert::storage_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " resume data generated"; }
		virtual bool discardable() const { return false; }

		boost::shared_ptr<entry> resume_data;
	};

	struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert
	{
		save_resume_data_failed_alert(torrent_handle const& h
			, error_code const& e)
			: torrent_alert(h)
			, error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}
	
		TORRENT_DEFINE_ALERT(save_resume_data_failed_alert);

		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: "
				+ convert_from_native(error.message());
		}
		virtual bool discardable() const { return false; }

		error_code error;

#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT torrent_paused_alert: torrent_alert
	{
		torrent_paused_alert(torrent_handle const& h)
			: torrent_alert(h)
		{}
	
		TORRENT_DEFINE_ALERT(torrent_paused_alert);

		const static int static_category = alert::status_notification;
		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) {}

		TORRENT_DEFINE_ALERT(torrent_resumed_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " resumed"; }
	};

	struct TORRENT_EXPORT torrent_checked_alert: torrent_alert
	{
		torrent_checked_alert(torrent_handle const& h)
			: torrent_alert(h)
		{}

		TORRENT_DEFINE_ALERT(torrent_checked_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " checked"; }
	};

	struct TORRENT_EXPORT url_seed_alert: torrent_alert
	{
		url_seed_alert(
			torrent_handle const& h
			, std::string const& url_
			, error_code const& e)
			: torrent_alert(h)
			, url(url_)
			, msg(convert_from_native(e.message()))
		{}

		url_seed_alert(
			torrent_handle const& h
			, std::string const& url_
			, std::string const& msg_)
			: torrent_alert(h)
			, url(url_)
			, msg(msg_)
		{}

		TORRENT_DEFINE_ALERT(url_seed_alert);

		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;
		}

		std::string url;
		std::string msg;
	};

	struct TORRENT_EXPORT file_error_alert: torrent_alert
	{
		file_error_alert(
			std::string const& f
			, torrent_handle const& h
			, error_code const& e)
			: torrent_alert(h)
			, file(f)
			, error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}

		TORRENT_DEFINE_ALERT(file_error_alert);

		const static int static_category = alert::status_notification
			| alert::error_notification
			| alert::storage_notification;
		virtual std::string message() const
		{
			return torrent_alert::message() + " file (" + file + ") error: "
				+ convert_from_native(error.message());
		}

		std::string file;
		error_code error;

#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT metadata_failed_alert: torrent_alert
	{
		metadata_failed_alert(const torrent_handle& h)
			: torrent_alert(h)
		{}

		TORRENT_DEFINE_ALERT(metadata_failed_alert);

		const static int static_category = alert::error_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " invalid metadata received"; }
	};
	
	struct TORRENT_EXPORT metadata_received_alert: torrent_alert
	{
		metadata_received_alert(
			const torrent_handle& h)
			: torrent_alert(h)
		{}

		TORRENT_DEFINE_ALERT(metadata_received_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " metadata successfully received"; }
	};

	struct TORRENT_EXPORT udp_error_alert: alert
	{
		udp_error_alert(
			udp::endpoint const& ep
			, error_code const& ec)
			: endpoint(ep)
			, error(ec)
		{}

		TORRENT_DEFINE_ALERT(udp_error_alert);

		const static int static_category = alert::error_notification;
		virtual std::string message() const
		{
			error_code ec;
			return "UDP error: " + convert_from_native(error.message()) + " from: " + endpoint.address().to_string(ec);
		}

		udp::endpoint endpoint;
		error_code error;
	};

	struct TORRENT_EXPORT external_ip_alert: alert
	{
		external_ip_alert(address const& ip)
			: external_address(ip)
		{}

		TORRENT_DEFINE_ALERT(external_ip_alert);

		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);
		}

		address external_address;
	};

	struct TORRENT_EXPORT listen_failed_alert: alert
	{
		listen_failed_alert(
			tcp::endpoint const& ep
			, error_code const& ec)
			: endpoint(ep)
			, error(ec)
		{}

		TORRENT_DEFINE_ALERT(listen_failed_alert);

		const static int static_category = alert::status_notification | alert::error_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		tcp::endpoint endpoint;
		error_code error;
	};

	struct TORRENT_EXPORT listen_succeeded_alert: alert
	{
		listen_succeeded_alert(tcp::endpoint const& ep)
			: endpoint(ep)
		{}

		TORRENT_DEFINE_ALERT(listen_succeeded_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		tcp::endpoint endpoint;
	};

	struct TORRENT_EXPORT portmap_error_alert: alert
	{
		portmap_error_alert(int i, int t, error_code const& e)
			:  mapping(i), map_type(t), error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}

		TORRENT_DEFINE_ALERT(portmap_error_alert);

		const static int static_category = alert::port_mapping_notification
			| alert::error_notification;
		virtual std::string message() const;

		int mapping;
		int map_type;
		error_code error;
#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT portmap_alert: alert
	{
		portmap_alert(int i, int port, int t)
			: mapping(i), external_port(port), map_type(t)
		{}

		TORRENT_DEFINE_ALERT(portmap_alert);

		const static int static_category = alert::port_mapping_notification;
		virtual std::string message() const;

		int mapping;
		int external_port;
		int map_type;
	};

	struct TORRENT_EXPORT portmap_log_alert: alert
	{
		portmap_log_alert(int t, std::string const& m)
			: map_type(t), msg(m)
		{}

		TORRENT_DEFINE_ALERT(portmap_log_alert);

		const static int static_category = alert::port_mapping_notification;
		virtual std::string message() const;

		int map_type;
		std::string msg;
	};

	struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert
	{
		fastresume_rejected_alert(torrent_handle const& h
			, error_code const& e)
			: torrent_alert(h)
			, error(e)
		{
#ifndef TORRENT_NO_DEPRECATE
			msg = convert_from_native(error.message());
#endif
		}

		TORRENT_DEFINE_ALERT(fastresume_rejected_alert);

		const static int static_category = alert::status_notification
			| alert::error_notification;
		virtual std::string message() const
		{ return torrent_alert::message() + " fast resume rejected: " + convert_from_native(error.message()); }

		error_code error;

#ifndef TORRENT_NO_DEPRECATE
		std::string msg;
#endif
	};

	struct TORRENT_EXPORT peer_blocked_alert: torrent_alert
	{
		peer_blocked_alert(torrent_handle const& h, address const& ip_)
			: torrent_alert(h)
			, ip(ip_)
		{}
		
		TORRENT_DEFINE_ALERT(peer_blocked_alert);

		const static int static_category = alert::ip_block_notification;
		virtual std::string message() const
		{
			error_code ec;
			return torrent_alert::message() + ": blocked peer: " + ip.to_string(ec);
		}

		address ip;
	};

	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_)
		{}
		
		TORRENT_DEFINE_ALERT(dht_announce_alert);

		const static int static_category = alert::dht_notification;
		virtual std::string message() const;

		address ip;
		int port;
		sha1_hash info_hash;
	};

	struct TORRENT_EXPORT dht_get_peers_alert: alert
	{
		dht_get_peers_alert(sha1_hash const& info_hash_)
			: info_hash(info_hash_)
		{}

		TORRENT_DEFINE_ALERT(dht_get_peers_alert);

		const static int static_category = alert::dht_notification;
		virtual std::string message() const;

		sha1_hash info_hash;
	};

	struct TORRENT_EXPORT stats_alert: torrent_alert
	{
		stats_alert(torrent_handle const& h, int interval
			, stat const& s);

		TORRENT_DEFINE_ALERT(stats_alert);

		const static int static_category = alert::stats_notification;
		virtual std::string message() const;

		enum stats_channel
		{
			upload_payload,
			upload_protocol,
			download_payload,
			download_protocol,
#ifndef TORRENT_DISABLE_FULL_STATS
			upload_ip_protocol,
			upload_dht_protocol,
			upload_tracker_protocol,
			download_ip_protocol,
			download_dht_protocol,
			download_tracker_protocol,
#endif
			num_channels
		};

		int transferred[num_channels];
		int interval;
	};

	struct TORRENT_EXPORT cache_flushed_alert: torrent_alert
	{
		cache_flushed_alert(torrent_handle const& h);

		TORRENT_DEFINE_ALERT(cache_flushed_alert);

		const static int static_category = alert::storage_notification;
	};

	struct TORRENT_EXPORT anonymous_mode_alert: torrent_alert
	{
		anonymous_mode_alert(torrent_handle const& h
			, int kind_, std::string const& str_)
			: torrent_alert(h)
			, kind(kind_)
			, str(str_)
		{}

		TORRENT_DEFINE_ALERT(anonymous_mode_alert);

		const static int static_category = alert::error_notification;
		virtual std::string message() const;

		enum kind_t
		{
			tracker_not_anonymous = 0
		};

		int kind;
		std::string str;
	};

	struct TORRENT_EXPORT lsd_peer_alert: peer_alert
	{
		lsd_peer_alert(torrent_handle const& h
			, tcp::endpoint const& ip_)
			: peer_alert(h, ip_, peer_id(0))
		{}

		TORRENT_DEFINE_ALERT(lsd_peer_alert);

		const static int static_category = alert::peer_notification;
		virtual std::string message() const;
	};

	struct TORRENT_EXPORT trackerid_alert: tracker_alert
	{
		trackerid_alert(torrent_handle const& h
			, std::string const& url_
                        , const std::string& id)
			: tracker_alert(h, url_)
			, trackerid(id)
		{}

		TORRENT_DEFINE_ALERT(trackerid_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const;

		std::string trackerid;
	};

	struct TORRENT_EXPORT dht_bootstrap_alert: alert
	{
		dht_bootstrap_alert() {}
		
		TORRENT_DEFINE_ALERT(dht_bootstrap_alert);

		const static int static_category = alert::dht_notification;
		virtual std::string message() const;
	};

	struct TORRENT_EXPORT rss_alert: alert
	{
		rss_alert(feed_handle h, std::string const& url_, int state_, error_code const& ec)
			: handle(h), url(url_), state(state_), error(ec)
		{}

		TORRENT_DEFINE_ALERT(rss_alert);

		const static int static_category = alert::rss_notification;
		virtual std::string message() const;

		enum state_t
		{
			state_updating, state_updated, state_error
		};

		feed_handle handle;
		std::string url;
		int state;
		error_code error;
	};

	struct TORRENT_EXPORT torrent_error_alert: torrent_alert
	{
		torrent_error_alert(torrent_handle const& h
			, error_code const& e)
			: torrent_alert(h)
			, error(e)
		{}

		TORRENT_DEFINE_ALERT(torrent_error_alert);

		const static int static_category = alert::error_notification | alert::status_notification;
		virtual std::string message() const;

		error_code error;
	};

	struct TORRENT_EXPORT torrent_need_cert_alert: torrent_alert
	{
		torrent_need_cert_alert(torrent_handle const& h)
			: torrent_alert(h)
		{}

		TORRENT_DEFINE_ALERT(torrent_need_cert_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		error_code error;
	};

	struct TORRENT_EXPORT incoming_connection_alert: alert
	{
		incoming_connection_alert(int type_, tcp::endpoint const& ip_)
			: socket_type(type_)
			, ip(ip_)
		{}

		TORRENT_DEFINE_ALERT(incoming_connection_alert);

		const static int static_category = alert::peer_notification;
		virtual std::string message() const;

		int socket_type;
		tcp::endpoint ip;
	};

	struct TORRENT_EXPORT add_torrent_alert : torrent_alert
	{
		add_torrent_alert(torrent_handle h, add_torrent_params const& p, error_code ec)
			: torrent_alert(h)
			, params(p)
			, error(ec)
		{}

		TORRENT_DEFINE_ALERT(add_torrent_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		add_torrent_params params;
		error_code error;
	};

	struct TORRENT_EXPORT state_update_alert : alert
	{
		TORRENT_DEFINE_ALERT(state_update_alert);

		const static int static_category = alert::status_notification;
		virtual std::string message() const;
		virtual bool discardable() const { return false; }

		std::vector<torrent_status> status;
	};

#undef TORRENT_DEFINE_ALERT

}


#endif