provide better names for alert_category_t constants

This commit is contained in:
arvidn 2020-03-31 21:48:29 +02:00 committed by Arvid Norberg
parent fae73b5e2b
commit 983b1d6422
27 changed files with 477 additions and 416 deletions

View File

@ -256,6 +256,7 @@ namespace boost
}
struct dummy3 {};
struct dummy12 {};
bytes get_pkt_buf(dht_pkt_alert const& alert)
{
@ -329,6 +330,34 @@ void bind_alert()
s.attr("all_categories") = alert::all_categories;
}
{
scope s = class_<dummy12>("alert_category");
s.attr("error") = alert_category::error;
s.attr("peer") = alert_category::peer;
s.attr("port_mapping") = alert_category::port_mapping;
s.attr("storage") = alert_category::storage;
s.attr("tracker") = alert_category::tracker;
s.attr("connect") = alert_category::connect;
s.attr("status") = alert_category::status;
s.attr("ip_block") = alert_category::ip_block;
s.attr("performance_warning") = alert_category::performance_warning;
s.attr("dht") = alert_category::dht;
s.attr("stats") = alert_category::stats;
s.attr("session_log") = alert_category::session_log;
s.attr("torrent_log") = alert_category::torrent_log;
s.attr("peer_log") = alert_category::peer_log;
s.attr("incoming_request") = alert_category::incoming_request;
s.attr("dht_log") = alert_category::dht_log;
s.attr("dht_operation") = alert_category::dht_operation;
s.attr("port_mapping_log") = alert_category::port_mapping_log;
s.attr("picker_log") = alert_category::picker_log;
s.attr("file_progress") = alert_category::file_progress;
s.attr("piece_progress") = alert_category::piece_progress;
s.attr("upload") = alert_category::upload;
s.attr("block_progress") = alert_category::block_progress;
s.attr("all") = alert_category::all;
}
enum_<operation_t>("operation_t")
.value("unknown", operation_t::unknown)
.value("bittorrent", operation_t::bittorrent)

View File

@ -80,7 +80,8 @@ static_links = \
{
".. _`BEP 3`: https://www.bittorrent.org/beps/bep_0003.html",
".. _`BEP 17`: https://www.bittorrent.org/beps/bep_0017.html",
".. _`BEP 19`: https://www.bittorrent.org/beps/bep_0019.html"
".. _`BEP 19`: https://www.bittorrent.org/beps/bep_0019.html",
".. _`BEP 42`: https://www.bittorrent.org/beps/bep_0042.html"
}
anon_index = 0
@ -1101,6 +1102,7 @@ def linkify_symbols(string):
ret = []
in_literal = False
lno = 0
return_string = ''
for line in lines:
lno += 1
# don't touch headlines, i.e. lines whose
@ -1110,6 +1112,12 @@ def linkify_symbols(string):
else:
next_line = ''
if '.. include:: ' in line:
return_string += '\n'.join(ret)
ret = [line]
return_string += dump_link_targets() + '\n'
continue
if len(next_line) > 0 and lines[lno].replace('=', ''). \
replace('-', '').replace('.', '') == '':
ret.append(line)
@ -1174,7 +1182,8 @@ def linkify_symbols(string):
# print(' found %s -> %s' % (w, link_name))
words[i] = leading + print_link(link_name, symbols[w]) + trailing
ret.append(' '.join(words))
return '\n'.join(ret)
return_string += '\n'.join(ret)
return return_string
link_targets = []

View File

@ -47,8 +47,8 @@ int main(int argc, char const* argv[]) try
return 1;
}
lt::settings_pack p;
p.set_int(lt::settings_pack::alert_mask, lt::alert::status_notification
| lt::alert::error_notification);
p.set_int(lt::settings_pack::alert_mask, lt::alert_category::status
| lt::alert_category::error);
lt::session ses(p);
lt::add_torrent_params atp = lt::parse_magnet_uri(argv[1]);

View File

@ -72,9 +72,9 @@ int main(int argc, char const* argv[]) try
lt::settings_pack pack;
pack.set_int(lt::settings_pack::alert_mask
, lt::alert::error_notification
| lt::alert::storage_notification
| lt::alert::status_notification);
, lt::alert_category::error
| lt::alert_category::storage
| lt::alert_category::status);
lt::session ses(pack);
clk::time_point last_save_resume = clk::now();

View File

@ -582,29 +582,29 @@ void assign_setting(lt::settings_pack& settings, std::string const& key, char co
}
static std::map<lt::string_view, lt::alert_category_t> const alert_categories = {
{"error"_sv, alert::error_notification},
{"peer"_sv, alert::peer_notification},
{"port_mapping"_sv, alert::port_mapping_notification},
{"storage"_sv, alert::storage_notification},
{"tracker"_sv, alert::tracker_notification},
{"connect"_sv, alert::connect_notification},
{"status"_sv, alert::status_notification},
{"ip_block"_sv, alert::ip_block_notification},
{"performance_warning"_sv, alert::performance_warning},
{"dht"_sv, alert::dht_notification},
{"session_log"_sv, alert::session_log_notification},
{"torrent_log"_sv, alert::torrent_log_notification},
{"peer_log"_sv, alert::peer_log_notification},
{"incoming_request"_sv, alert::incoming_request_notification},
{"dht_log"_sv, alert::dht_log_notification},
{"dht_operation"_sv, alert::dht_operation_notification},
{"port_mapping_log"_sv, alert::port_mapping_log_notification},
{"picker_log"_sv, alert::picker_log_notification},
{"file_progress"_sv, alert::file_progress_notification},
{"piece_progress"_sv, alert::piece_progress_notification},
{"upload"_sv, alert::upload_notification},
{"block_progress"_sv, alert::block_progress_notification},
{"all"_sv, alert::all_categories},
{"error"_sv, lt::alert_category::error},
{"peer"_sv, lt::alert_category::peer},
{"port_mapping"_sv, lt::alert_category::port_mapping},
{"storage"_sv, lt::alert_category::storage},
{"tracker"_sv, lt::alert_category::tracker},
{"connect"_sv, lt::alert_category::connect},
{"status"_sv, lt::alert_category::status},
{"ip_block"_sv, lt::alert_category::ip_block},
{"performance_warning"_sv, lt::alert_category::performance_warning},
{"dht"_sv, lt::alert_category::dht},
{"session_log"_sv, lt::alert_category::session_log},
{"torrent_log"_sv, lt::alert_category::torrent_log},
{"peer_log"_sv, lt::alert_category::peer_log},
{"incoming_request"_sv, lt::alert_category::incoming_request},
{"dht_log"_sv, lt::alert_category::dht_log},
{"dht_operation"_sv, lt::alert_category::dht_operation},
{"port_mapping_log"_sv, lt::alert_category::port_mapping_log},
{"picker_log"_sv, lt::alert_category::picker_log},
{"file_progress"_sv, lt::alert_category::file_progress},
{"piece_progress"_sv, lt::alert_category::piece_progress},
{"upload"_sv, lt::alert_category::upload},
{"block_progress"_sv, lt::alert_category::block_progress},
{"all"_sv, lt::alert_category::all},
};
std::stringstream flags(value);
@ -803,11 +803,11 @@ void print_alert(lt::alert const* a, std::string& str)
{
using namespace lt;
if (a->category() & alert::error_notification)
if (a->category() & alert_category::error)
{
str += esc("31");
}
else if (a->category() & (alert::peer_notification | alert::storage_notification))
else if (a->category() & (alert_category::peer | alert_category::storage))
{
str += esc("33");
}
@ -1211,20 +1211,20 @@ examples:
settings.set_str(settings_pack::user_agent, "client_test/" LIBTORRENT_VERSION);
settings.set_int(settings_pack::alert_mask
, alert::error_notification
| alert::peer_notification
| alert::port_mapping_notification
| alert::storage_notification
| alert::tracker_notification
| alert::connect_notification
| alert::status_notification
| alert::ip_block_notification
| alert::performance_warning
| alert::dht_notification
| alert::incoming_request_notification
| alert::dht_operation_notification
| alert::port_mapping_log_notification
| alert::file_progress_notification);
, lt::alert_category::error
| lt::alert_category::peer
| lt::alert_category::port_mapping
| lt::alert_category::storage
| lt::alert_category::tracker
| lt::alert_category::connect
| lt::alert_category::status
| lt::alert_category::ip_block
| lt::alert_category::performance_warning
| lt::alert_category::dht
| lt::alert_category::incoming_request
| lt::alert_category::dht_operation
| lt::alert_category::port_mapping_log
| lt::alert_category::file_progress);
lt::time_duration refresh_delay = lt::milliseconds(500);
bool rate_limit_locals = false;

View File

@ -73,7 +73,7 @@ int main(int argc, char*[])
}
settings_pack p;
p.set_int(settings_pack::alert_mask, alert::port_mapping_notification);
p.set_int(settings_pack::alert_mask, alert_category::port_mapping);
lt::session s(p);
for (;;)

View File

@ -73,10 +73,10 @@ extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)
#ifdef DEBUG_LOGGING
pack.set_int(settings_pack::alert_mask, 0xffffff);
#else
pack.set_int(settings_pack::alert_mask, alert::connect_notification
| alert::error_notification
| alert::status_notification
| alert::peer_notification);
pack.set_int(settings_pack::alert_mask, alert_category::connect
| alert_category::error
| alert_category::status
| alert_category::peer);
#endif
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);

View File

@ -67,8 +67,119 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
// hidden
using alert_category_t = flags::bitfield_flag<std::uint32_t, struct alert_category_tag>;
// bitmask type used to define alert categories. Categories can be enabled
// and disabled by the settings_pack::alert_mask setting. Constants are defined
// in the lt::alert_category namespace
using alert_category_t = flags::bitfield_flag<std::uint32_t, struct alert_category_tag>;
namespace alert_category {
// Enables alerts that report an error. This includes:
//
// * tracker errors
// * tracker warnings
// * file errors
// * resume data failures
// * web seed errors
// * .torrent files errors
// * listen socket errors
// * port mapping errors
constexpr alert_category_t error = 0_bit;
// Enables alerts when peers send invalid requests, get banned or
// snubbed.
constexpr alert_category_t peer = 1_bit;
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
constexpr alert_category_t port_mapping = 2_bit;
// Enables alerts for events related to the storage. File errors and
// synchronization events for moving the storage, renaming files etc.
constexpr alert_category_t storage = 3_bit;
// Enables all tracker events. Includes announcing to trackers,
// receiving responses, warnings and errors.
constexpr alert_category_t tracker = 4_bit;
// Low level alerts for when peers are connected and disconnected.
constexpr alert_category_t connect = 5_bit;
// Enables alerts for when a torrent or the session changes state.
constexpr alert_category_t status = 6_bit;
// Alerts when a peer is blocked by the ip blocker or port blocker.
constexpr alert_category_t ip_block = 8_bit;
// Alerts when some limit is reached that might limit the download
// or upload rate.
constexpr alert_category_t performance_warning = 9_bit;
// Alerts on events in the DHT node. For incoming searches or
// bootstrapping being done etc.
constexpr alert_category_t dht = 10_bit;
// If you enable these alerts, you will receive a stats_alert
// approximately once every second, for every active torrent.
// These alerts contain all statistics counters for the interval since
// the lasts stats alert.
constexpr alert_category_t stats = 11_bit;
// Enables debug logging alerts. These are available unless libtorrent
// was built with logging disabled (``TORRENT_DISABLE_LOGGING``). The
// alerts being posted are log_alert and are session wide.
constexpr alert_category_t session_log = 13_bit;
// Enables debug logging alerts for torrents. These are available
// unless libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// torrent_log_alert and are torrent wide debug events.
constexpr alert_category_t torrent_log = 14_bit;
// Enables debug logging alerts for peers. These are available unless
// libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// peer_log_alert and low-level peer events and messages.
constexpr alert_category_t peer_log = 15_bit;
// enables the incoming_request_alert.
constexpr alert_category_t incoming_request = 16_bit;
// enables dht_log_alert, debug logging for the DHT
constexpr alert_category_t dht_log = 17_bit;
// enable events from pure dht operations not related to torrents
constexpr alert_category_t dht_operation = 18_bit;
// enables port mapping log events. This log is useful
// for debugging the UPnP or NAT-PMP implementation
constexpr alert_category_t port_mapping_log = 19_bit;
// enables verbose logging from the piece picker.
constexpr alert_category_t picker_log = 20_bit;
// alerts when files complete downloading
constexpr alert_category_t file_progress = 21_bit;
// alerts when pieces complete downloading or fail hash check
constexpr alert_category_t piece_progress = 22_bit;
// alerts when we upload blocks to other peers
constexpr alert_category_t upload = 23_bit;
// alerts on individual blocks being requested, downloading, finished,
// rejected, time-out and cancelled. This is likely to post alerts at a
// high rate.
constexpr alert_category_t block_progress = 24_bit;
// The full bitmask, representing all available categories.
//
// since the enum is signed, make sure this isn't
// interpreted as -1. For instance, boost.python
// does that and fails when assigning it to an
// unsigned parameter.
constexpr alert_category_t all = alert_category_t::all();
} // namespace alert_category
#ifdef __GNUC__
#pragma GCC diagnostic push
@ -98,125 +209,38 @@ namespace libtorrent {
using category_t = alert_category_t;
#endif
// Enables alerts that report an error. This includes:
//
// * tracker errors
// * tracker warnings
// * file errors
// * resume data failures
// * web seed errors
// * .torrent files errors
// * listen socket errors
// * port mapping errors
static constexpr alert_category_t error_notification = 0_bit;
// Enables alerts when peers send invalid requests, get banned or
// snubbed.
static constexpr alert_category_t peer_notification = 1_bit;
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
static constexpr alert_category_t port_mapping_notification = 2_bit;
// Enables alerts for events related to the storage. File errors and
// synchronization events for moving the storage, renaming files etc.
static constexpr alert_category_t storage_notification = 3_bit;
// Enables all tracker events. Includes announcing to trackers,
// receiving responses, warnings and errors.
static constexpr alert_category_t tracker_notification = 4_bit;
// Low level alerts for when peers are connected and disconnected.
static constexpr alert_category_t connect_notification = 5_bit;
#if TORRENT_ABI_VERSION == 1
static constexpr alert_category_t TORRENT_DEPRECATED_MEMBER debug_notification = connect_notification;
#endif
// Enables alerts for when a torrent or the session changes state.
static constexpr alert_category_t status_notification = 6_bit;
#if TORRENT_ABI_VERSION == 1
// Alerts for when blocks are requested and completed. Also when
// pieces are completed.
static constexpr alert_category_t TORRENT_DEPRECATED_MEMBER progress_notification = 7_bit;
#endif
// Alerts when a peer is blocked by the ip blocker or port blocker.
static constexpr alert_category_t ip_block_notification = 8_bit;
// Alerts when some limit is reached that might limit the download
// or upload rate.
static constexpr alert_category_t performance_warning = 9_bit;
// Alerts on events in the DHT node. For incoming searches or
// bootstrapping being done etc.
static constexpr alert_category_t dht_notification = 10_bit;
// If you enable these alerts, you will receive a stats_alert
// approximately once every second, for every active torrent.
// These alerts contain all statistics counters for the interval since
// the lasts stats alert.
static constexpr alert_category_t stats_notification = 11_bit;
#if TORRENT_ABI_VERSION == 1
// Alerts on RSS related events, like feeds being updated, feed error
// conditions and successful RSS feed updates. Enabling this category
// will make you receive rss_alert alerts.
static constexpr alert_category_t TORRENT_DEPRECATED_MEMBER rss_notification = 12_bit;
#endif
// Enables debug logging alerts. These are available unless libtorrent
// was built with logging disabled (``TORRENT_DISABLE_LOGGING``). The
// alerts being posted are log_alert and are session wide.
static constexpr alert_category_t session_log_notification = 13_bit;
// Enables debug logging alerts for torrents. These are available
// unless libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// torrent_log_alert and are torrent wide debug events.
static constexpr alert_category_t torrent_log_notification = 14_bit;
// Enables debug logging alerts for peers. These are available unless
// libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// peer_log_alert and low-level peer events and messages.
static constexpr alert_category_t peer_log_notification = 15_bit;
// enables the incoming_request_alert.
static constexpr alert_category_t incoming_request_notification = 16_bit;
// enables dht_log_alert, debug logging for the DHT
static constexpr alert_category_t dht_log_notification = 17_bit;
// enable events from pure dht operations not related to torrents
static constexpr alert_category_t dht_operation_notification = 18_bit;
// enables port mapping log events. This log is useful
// for debugging the UPnP or NAT-PMP implementation
static constexpr alert_category_t port_mapping_log_notification = 19_bit;
// enables verbose logging from the piece picker.
static constexpr alert_category_t picker_log_notification = 20_bit;
// alerts when files complete downloading
static constexpr alert_category_t file_progress_notification = 21_bit;
// alerts when pieces complete downloading or fail hash check
static constexpr alert_category_t piece_progress_notification = 22_bit;
// alerts when we upload blocks to other peers
static constexpr alert_category_t upload_notification = 23_bit;
// alerts on individual blocks being requested, downloading, finished,
// rejected, time-out and cancelled. This is likely to post alerts at a
// high rate.
static constexpr alert_category_t block_progress_notification = 24_bit;
// The full bitmask, representing all available categories.
//
// since the enum is signed, make sure this isn't
// interpreted as -1. For instance, boost.python
// does that and fails when assigning it to an
// unsigned parameter.
static constexpr alert_category_t all_categories = alert_category_t::all();
// hidden

View File

@ -233,7 +233,7 @@ TORRENT_VERSION_NAMESPACE_2
torrent_added_alert(aux::stack_allocator& alloc, torrent_handle const& h);
TORRENT_DEFINE_ALERT(torrent_added_alert, 3)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
};
@ -265,7 +265,7 @@ TORRENT_VERSION_NAMESPACE_2
, torrent_handle const& h, sha1_hash const& ih);
TORRENT_DEFINE_ALERT_PRIO(torrent_removed_alert, 4, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
sha1_hash info_hash;
};
@ -288,7 +288,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(read_piece_alert, 5, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
error_code const error;
@ -316,7 +316,7 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::file_progress_notification
alert_category::file_progress
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -338,7 +338,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(file_renamed_alert, 7, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
char const* new_name() const;
@ -374,7 +374,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(file_rename_failed_alert, 8, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
@ -481,7 +481,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(performance_alert, 9)
static constexpr alert_category_t static_category = alert::performance_warning;
static constexpr alert_category_t static_category = alert_category::performance_warning;
std::string message() const override;
@ -498,7 +498,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(state_changed_alert, 10, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
@ -527,7 +527,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(tracker_error_alert, 11, alert_priority_high)
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert_category::tracker | alert_category::error;
std::string message() const override;
int const times_in_row;
@ -557,7 +557,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(tracker_warning_alert, 12)
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert_category::tracker | alert_category::error;
std::string message() const override;
// the message associated with this warning
@ -582,7 +582,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(scrape_reply_alert, 13, alert_priority_critical)
static constexpr alert_category_t static_category = alert::tracker_notification;
static constexpr alert_category_t static_category = alert_category::tracker;
std::string message() const override;
// the data returned in the scrape response. These numbers
@ -606,7 +606,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(scrape_failed_alert, 14, alert_priority_critical)
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert_category::tracker | alert_category::error;
std::string message() const override;
// the error itself. This may indicate that the tracker sent an error
@ -639,7 +639,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(tracker_reply_alert, 15)
static constexpr alert_category_t static_category = alert::tracker_notification;
static constexpr alert_category_t static_category = alert_category::tracker;
std::string message() const override;
// tells how many peers the tracker returned in this response. This is
@ -661,7 +661,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_reply_alert, 16)
static constexpr alert_category_t static_category = alert::dht_notification | alert::tracker_notification;
static constexpr alert_category_t static_category = alert_category::dht | alert_category::tracker;
std::string message() const override;
int const num_peers;
@ -679,7 +679,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(tracker_announce_alert, 17)
static constexpr alert_category_t static_category = alert::tracker_notification;
static constexpr alert_category_t static_category = alert_category::tracker;
std::string message() const override;
// specifies what event was sent to the tracker. It is defined as:
@ -701,7 +701,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(hash_failed_alert, 18)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
piece_index_t const piece_index;
@ -717,7 +717,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_ban_alert, 19)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
};
@ -731,7 +731,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_unsnubbed_alert, 20)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
};
@ -745,7 +745,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_snubbed_alert, 21)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
};
@ -760,7 +760,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_error_alert, 22)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
// a 0-terminated string of the low-level operation that failed, or nullptr if
@ -785,7 +785,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_connect_alert, 23)
static constexpr alert_category_t static_category = alert::connect_notification;
static constexpr alert_category_t static_category = alert_category::connect;
std::string message() const override;
int const socket_type;
@ -803,7 +803,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_disconnected_alert, 24)
static constexpr alert_category_t static_category = alert::connect_notification;
static constexpr alert_category_t static_category = alert_category::connect;
std::string message() const override;
// the kind of socket this peer was connected over
@ -838,7 +838,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(invalid_request_alert, 25)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
// the request we received from the peer
@ -867,7 +867,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_finished_alert, 26, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
};
@ -890,7 +890,7 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::piece_progress_notification
alert_category::piece_progress
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -917,8 +917,8 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::block_progress_notification
| alert::peer_notification
alert_category::block_progress
| alert_category::peer
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -945,8 +945,8 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::block_progress_notification
| alert::peer_notification
alert_category::block_progress
| alert_category::peer
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -973,7 +973,7 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::block_progress_notification
alert_category::block_progress
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -1000,7 +1000,7 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::block_progress_notification
alert_category::block_progress
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -1026,7 +1026,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(unwanted_block_alert, 32)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
int const block_index;
@ -1046,7 +1046,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(storage_moved_alert, 33, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
// the path the torrent was moved to
@ -1071,7 +1071,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(storage_moved_failed_alert, 34, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
error_code const error;
@ -1108,7 +1108,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_deleted_alert, 35, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
sha1_hash info_hash;
@ -1124,8 +1124,8 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_delete_failed_alert, 36, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification
| alert::error_notification;
static constexpr alert_category_t static_category = alert_category::storage
| alert_category::error;
std::string message() const override;
// tells you why it failed.
@ -1153,7 +1153,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
std::string message() const override;
// the ``params`` structure is populated with the fields to be passed to
@ -1177,8 +1177,8 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_failed_alert, 38, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification
| alert::error_notification;
static constexpr alert_category_t static_category = alert_category::storage
| alert_category::error;
std::string message() const override;
// the error code from the resume_data failure
@ -1199,7 +1199,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_paused_alert, 39, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
};
@ -1212,7 +1212,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_resumed_alert, 40, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
};
@ -1225,7 +1225,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_checked_alert, 41, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
};
@ -1240,7 +1240,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(url_seed_alert, 42)
static constexpr alert_category_t static_category = alert::peer_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert_category::peer | alert_category::error;
std::string message() const override;
// the error the web seed encountered. If this is not set, the server
@ -1278,9 +1278,9 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(file_error_alert, 43, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification
| alert::error_notification
| alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::status
| alert_category::error
| alert_category::storage;
std::string message() const override;
// the error code describing the error.
@ -1315,7 +1315,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(metadata_failed_alert, 44)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// indicates what failed when parsing the metadata. This error is
@ -1357,7 +1357,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(metadata_received_alert, 45)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
};
@ -1375,7 +1375,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(udp_error_alert, 46)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// the source address associated with the error (if any)
@ -1399,7 +1399,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(external_ip_alert, 47)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
// the IP address that is believed to be our external IP
@ -1458,7 +1458,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(listen_failed_alert, 48, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert_category::status | alert_category::error;
std::string message() const override;
// the network device libtorrent attempted to listen on, or the IP address
@ -1542,7 +1542,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(listen_succeeded_alert, 49, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
// the address libtorrent ended up listening on. This address
@ -1580,8 +1580,8 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(portmap_error_alert, 50)
static constexpr alert_category_t static_category = alert::port_mapping_notification
| alert::error_notification;
static constexpr alert_category_t static_category = alert_category::port_mapping
| alert_category::error;
std::string message() const override;
// refers to the mapping index of the port map that failed, i.e.
@ -1613,7 +1613,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(portmap_alert, 51)
static constexpr alert_category_t static_category = alert::port_mapping_notification;
static constexpr alert_category_t static_category = alert_category::port_mapping;
std::string message() const override;
// refers to the mapping index of the port map that failed, i.e.
@ -1646,7 +1646,7 @@ TORRENT_VERSION_NAMESPACE_2
// UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PMP
// and 1 = UPnP). Displaying these messages to an end user is only useful
// for debugging the UPnP or NAT-PMP implementation. This alert is only
// posted if the alert::port_mapping_log_notification flag is enabled in
// posted if the alert_category::port_mapping_log flag is enabled in
// the alert mask.
struct TORRENT_EXPORT portmap_log_alert final : alert
{
@ -1655,7 +1655,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(portmap_log_alert, 52)
static constexpr alert_category_t static_category = alert::port_mapping_log_notification;
static constexpr alert_category_t static_category = alert_category::port_mapping_log;
std::string message() const override;
portmap_transport const map_transport;
@ -1688,8 +1688,8 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(fastresume_rejected_alert, 53, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification
| alert::error_notification;
static constexpr alert_category_t static_category = alert_category::status
| alert_category::error;
std::string message() const override;
error_code error;
@ -1730,7 +1730,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_blocked_alert, 54)
static constexpr alert_category_t static_category = alert::ip_block_notification;
static constexpr alert_category_t static_category = alert_category::ip_block;
std::string message() const override;
enum reason_t
@ -1759,7 +1759,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_announce_alert, 55)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
aux::noexcept_movable<address> ip;
@ -1776,7 +1776,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_get_peers_alert, 56)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
sha1_hash info_hash;
@ -1795,7 +1795,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(stats_alert, 57)
static constexpr alert_category_t static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert_category::stats;
std::string message() const override;
enum stats_channel
@ -1846,7 +1846,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(cache_flushed_alert, 58, alert_priority_high)
static constexpr alert_category_t static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert_category::storage;
};
#if TORRENT_ABI_VERSION == 1
@ -1873,7 +1873,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(anonymous_mode_alert, 59)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
enum kind_t
@ -1908,7 +1908,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(lsd_peer_alert, 60)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
};
@ -1923,7 +1923,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(trackerid_alert, 61)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
// The tracker ID returned by the tracker
@ -1946,7 +1946,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_bootstrap_alert, 62)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
};
@ -1959,7 +1959,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_error_alert, 64, alert_priority_high)
static constexpr alert_category_t static_category = alert::error_notification | alert::status_notification;
static constexpr alert_category_t static_category = alert_category::error | alert_category::status;
std::string message() const override;
// specifies which error the torrent encountered.
@ -1990,7 +1990,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_need_cert_alert, 65, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
#if TORRENT_ABI_VERSION == 1
error_code const TORRENT_DEPRECATED_MEMBER error;
@ -2011,7 +2011,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(incoming_connection_alert, 66)
static constexpr alert_category_t static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert_category::peer;
std::string message() const override;
// tells you what kind of socket the connection was accepted
@ -2051,7 +2051,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(add_torrent_alert, 67, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
// a copy of the parameters used when adding the torrent, it can be used
@ -2074,7 +2074,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(state_update_alert, 68, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
// contains the torrent status of all torrents that changed since last
@ -2101,7 +2101,7 @@ TORRENT_VERSION_NAMESPACE_2
, error_code const& ec);
TORRENT_DEFINE_ALERT(mmap_cache_alert, 69)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
error_code const error;
@ -2149,7 +2149,7 @@ TORRENT_VERSION_NAMESPACE_2
#endif
#endif
static constexpr alert_category_t static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert_category::stats;
std::string message() const override;
// An array are a mix of *counters* and *gauges*, which meanings can be
@ -2198,7 +2198,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(torrent_update_alert, 71, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert_category::status;
std::string message() const override;
// ``old_ih`` and ``new_ih`` are the previous and new info-hash for the torrent, respectively.
@ -2223,7 +2223,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_error_alert, 73)
static constexpr alert_category_t static_category = alert::error_notification | alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::error | alert_category::dht;
std::string message() const override;
// the error code
@ -2254,7 +2254,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(dht_immutable_item_alert, 74, alert_priority_critical)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
@ -2277,7 +2277,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75, alert_priority_critical)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
// the public key that was looked up
@ -2318,7 +2318,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_put_alert, 76)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
// the target hash the item was stored under if this was an *immutable*
@ -2347,7 +2347,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(i2p_alert, 77)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// the error that occurred in the i2p SAM connection
@ -2365,7 +2365,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_outgoing_get_peers_alert, 78)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
// the info_hash of the torrent we're looking for peers for.
@ -2386,7 +2386,7 @@ TORRENT_VERSION_NAMESPACE_2
// This alert is posted by some session wide event. Its main purpose is
// trouble shooting and debugging. It's not enabled by the default alert
// mask and is enabled by the ``alert::session_log_notification`` bit.
// mask and is enabled by the ``alert_category::session_log`` bit.
// Furthermore, it's by default disabled as a build configuration.
struct TORRENT_EXPORT log_alert final : alert
{
@ -2396,7 +2396,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(log_alert, 79)
static constexpr alert_category_t static_category = alert::session_log_notification;
static constexpr alert_category_t static_category = alert_category::session_log;
std::string message() const override;
// returns the log message
@ -2415,7 +2415,7 @@ TORRENT_VERSION_NAMESPACE_2
// This alert is posted by torrent wide events. It's meant to be used for
// trouble shooting and debugging. It's not enabled by the default alert
// mask and is enabled by the ``alert::torrent_log_notification`` bit. By
// mask and is enabled by the ``alert_category::torrent_log`` bit. By
// default it is disabled as a build configuration.
struct TORRENT_EXPORT torrent_log_alert final : torrent_alert
{
@ -2425,7 +2425,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(torrent_log_alert, 80)
static constexpr alert_category_t static_category = alert::torrent_log_notification;
static constexpr alert_category_t static_category = alert_category::torrent_log;
std::string message() const override;
// returns the log message
@ -2443,7 +2443,7 @@ TORRENT_VERSION_NAMESPACE_2
// This alert is posted by events specific to a peer. It's meant to be used
// for trouble shooting and debugging. It's not enabled by the default alert
// mask and is enabled by the ``alert::peer_log_notification`` bit. By
// mask and is enabled by the ``alert_category::peer_log`` bit. By
// default it is disabled as a build configuration.
struct TORRENT_EXPORT peer_log_alert final : peer_alert
{
@ -2466,7 +2466,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(peer_log_alert, 81)
static constexpr alert_category_t static_category = alert::peer_log_notification;
static constexpr alert_category_t static_category = alert_category::peer_log;
std::string message() const override;
// string literal indicating the kind of event. For messages, this is the
@ -2497,7 +2497,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(lsd_error_alert, 82)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// The error code
@ -2562,7 +2562,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_stats_alert, 83)
static constexpr alert_category_t static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert_category::stats;
std::string message() const override;
// a vector of the currently running DHT lookups.
@ -2575,7 +2575,7 @@ TORRENT_VERSION_NAMESPACE_2
// posted every time an incoming request from a peer is accepted and queued
// up for being serviced. This alert is only posted if
// the alert::incoming_request_notification flag is enabled in the alert
// the alert_category::incoming_request flag is enabled in the alert
// mask.
struct TORRENT_EXPORT incoming_request_alert final : peer_alert
{
@ -2584,7 +2584,7 @@ TORRENT_VERSION_NAMESPACE_2
, peer_request r, torrent_handle h
, tcp::endpoint const& ep, peer_id const& peer_id);
static constexpr alert_category_t static_category = alert::incoming_request_notification;
static constexpr alert_category_t static_category = alert_category::incoming_request;
TORRENT_DEFINE_ALERT(incoming_request_alert, 84)
std::string message() const override;
@ -2610,7 +2610,7 @@ TORRENT_VERSION_NAMESPACE_2
dht_log_alert(aux::stack_allocator& alloc
, dht_module_t m, char const* fmt, va_list v);
static constexpr alert_category_t static_category = alert::dht_log_notification;
static constexpr alert_category_t static_category = alert_category::dht_log;
TORRENT_DEFINE_ALERT(dht_log_alert, 85)
std::string message() const override;
@ -2627,7 +2627,7 @@ TORRENT_VERSION_NAMESPACE_2
};
// This alert is posted every time a DHT message is sent or received. It is
// only posted if the ``alert::dht_log_notification`` alert category is
// only posted if the ``alert_category::dht_log`` alert category is
// enabled. It contains a verbatim copy of the message.
struct TORRENT_EXPORT dht_pkt_alert final : alert
{
@ -2638,7 +2638,7 @@ TORRENT_VERSION_NAMESPACE_2
dht_pkt_alert(aux::stack_allocator& alloc, span<char const> buf
, dht_pkt_alert::direction_t d, udp::endpoint const& ep);
static constexpr alert_category_t static_category = alert::dht_log_notification;
static constexpr alert_category_t static_category = alert_category::dht_log;
TORRENT_DEFINE_ALERT(dht_pkt_alert, 86)
std::string message() const override;
@ -2675,7 +2675,7 @@ TORRENT_VERSION_NAMESPACE_2
, sha1_hash const& ih
, std::vector<tcp::endpoint> const& v);
static constexpr alert_category_t static_category = alert::dht_operation_notification;
static constexpr alert_category_t static_category = alert_category::dht_operation;
TORRENT_DEFINE_ALERT(dht_get_peers_reply_alert, 87)
std::string message() const override;
@ -2712,7 +2712,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT_PRIO(dht_direct_response_alert, 88, alert_priority_critical)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
void const* userdata;
@ -2745,7 +2745,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(picker_log_alert, 89)
static constexpr alert_category_t static_category = alert::picker_log_notification;
static constexpr alert_category_t static_category = alert_category::picker_log;
std::string message() const override;
static constexpr picker_flags_t partial_ratio = 0_bit;
@ -2787,7 +2787,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(session_error_alert, 90)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// The error code, if one is associated with this error
@ -2810,7 +2810,7 @@ TORRENT_VERSION_NAMESPACE_2
TORRENT_DEFINE_ALERT(dht_live_nodes_alert, 91)
static constexpr alert_category_t static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert_category::dht;
std::string message() const override;
// the local DHT node's node-ID this routing table belongs to
@ -2843,7 +2843,7 @@ TORRENT_VERSION_NAMESPACE_2
explicit session_stats_header_alert(aux::stack_allocator& alloc);
TORRENT_DEFINE_ALERT(session_stats_header_alert, 92)
static constexpr alert_category_t static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert_category::stats;
std::string message() const override;
};
@ -2859,7 +2859,7 @@ TORRENT_VERSION_NAMESPACE_2
, std::vector<sha1_hash> const& samples
, std::vector<std::pair<sha1_hash, udp::endpoint>> const& nodes);
static constexpr alert_category_t static_category = alert::dht_operation_notification;
static constexpr alert_category_t static_category = alert_category::dht_operation;
TORRENT_DEFINE_ALERT(dht_sample_infohashes_alert, 93)
std::string message() const override;
@ -2919,7 +2919,7 @@ TORRENT_VERSION_NAMESPACE_2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
static constexpr alert_category_t static_category =
alert::upload_notification
alert_category::upload
PROGRESS_NOTIFICATION
;
#ifdef __GNUC__
@ -2942,7 +2942,7 @@ TORRENT_VERSION_NAMESPACE_2
, std::bitset<num_alert_types> const&);
TORRENT_DEFINE_ALERT_PRIO(alerts_dropped_alert, 95, alert_priority_critical + 1)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// a bitmask indicating which alerts were dropped. Each bit represents the
@ -2960,7 +2960,7 @@ TORRENT_VERSION_NAMESPACE_2
, tcp::endpoint const& ep, operation_t operation, error_code const& ec);
TORRENT_DEFINE_ALERT(socks5_alert, 96)
static constexpr alert_category_t static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert_category::error;
std::string message() const override;
// the error

View File

@ -276,7 +276,7 @@ namespace aux {
TORRENT_DEPRECATED
session(fingerprint const& print
, session_flags_t const flags = start_default_features | add_default_plugins
, alert_category_t const alert_mask = alert::error_notification)
, alert_category_t const alert_mask = alert_category::error)
{
settings_pack pack;
pack.set_int(settings_pack::alert_mask, int(alert_mask));
@ -297,7 +297,7 @@ namespace aux {
, std::pair<int, int> listen_port_range
, char const* listen_interface = "0.0.0.0"
, session_flags_t const flags = start_default_features | add_default_plugins
, alert_category_t const alert_mask = alert::error_notification)
, alert_category_t const alert_mask = alert_category::error)
{
TORRENT_ASSERT(listen_port_range.first > 0);
TORRENT_ASSERT(listen_port_range.first <= listen_port_range.second);

View File

@ -39,7 +39,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/add_torrent_params.hpp"
#include "libtorrent/disk_io_thread.hpp" // for cached_piece_info
#include "libtorrent/alert.hpp" // alert::error_notification
#include "libtorrent/alert.hpp" // alert_category::error
#include "libtorrent/peer_class.hpp"
#include "libtorrent/peer_class_type_filter.hpp"
#include "libtorrent/peer_id.hpp"

View File

@ -801,9 +801,8 @@ namespace aux {
// changes are taken in consideration.
enable_ip_notifier,
// when this is true, nodes whose IDs are derived from their source IP
// according to BEP 42 (https://www.bittorrent.org/beps/bep_0042.html) are
// preferred in the routing table.
// when this is true, nodes whose IDs are derived from their source
// IP according to `BEP 42`_ are preferred in the routing table.
dht_prefer_verified_node_ids,
// when this is true, create an affinity for downloading 4 MiB extents
@ -1650,7 +1649,7 @@ namespace aux {
// retry a failed port bind
max_retry_port_bind,
// a bitmask combining flags from alert::category_t defining which
// a bitmask combining flags from alert_category_t defining which
// kinds of alerts to receive
alert_mask,

View File

@ -656,7 +656,7 @@ TORRENT_TEST(resume_reject_when_paused)
{
run_test(
[](settings_pack& sett) {
sett.set_int(settings_pack::alert_mask, alert::all_categories);
sett.set_int(settings_pack::alert_mask, alert_category::all);
},
[](lt::session& ses) {
@ -729,7 +729,7 @@ TORRENT_TEST(no_resume_when_paused)
{
run_test(
[](settings_pack& sett) {
sett.set_int(settings_pack::alert_mask, alert::all_categories);
sett.set_int(settings_pack::alert_mask, alert_category::all);
},
[](lt::session& ses) {
@ -797,7 +797,7 @@ TORRENT_TEST(no_resume_when_started)
{
run_test(
[](settings_pack& sett) {
sett.set_int(settings_pack::alert_mask, alert::all_categories);
sett.set_int(settings_pack::alert_mask, alert_category::all);
},
[](lt::session& ses) {

View File

@ -90,7 +90,7 @@ void bootstrap_session(std::vector<dht_network*> networks, lt::session& ses)
ses.load_state(e);
lt::settings_pack pack;
pack.set_bool(lt::settings_pack::enable_dht, true);
pack.set_int(lt::settings_pack::alert_mask, lt::alert::all_categories);
pack.set_int(lt::settings_pack::alert_mask, lt::alert_category::all);
ses.apply_settings(pack);
}
#endif // TORRENT_DISABLE_DHT

View File

@ -78,7 +78,7 @@ TORRENT_TEST(ip_notifier_setting)
, [](lt::settings_pack& pack)
{
pack.set_int(settings_pack::tick_interval, 1000);
pack.set_int(settings_pack::alert_mask, alert::all_categories);
pack.set_int(settings_pack::alert_mask, alert_category::all);
}
// add torrent
, [](lt::add_torrent_params&) {}
@ -146,7 +146,7 @@ TORRENT_TEST(add_extension_while_transfer)
, [](lt::settings_pack& pack)
{
pack.set_int(settings_pack::tick_interval, 1000);
pack.set_int(settings_pack::alert_mask, alert::all_categories);
pack.set_int(settings_pack::alert_mask, alert_category::all);
}
// add torrent
, [](lt::add_torrent_params&) {}
@ -191,9 +191,9 @@ TORRENT_TEST(tie_listen_ports)
// create session
auto pack = settings();
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:0");
pack.set_int(settings_pack::alert_mask, alert::error_notification
| alert::status_notification
| alert::torrent_log_notification);
pack.set_int(settings_pack::alert_mask, alert_category::error
| alert_category::status
| alert_category::torrent_log);
auto ses = std::make_shared<lt::session>(pack, ios);

View File

@ -587,7 +587,7 @@ TORRENT_TEST(torrent_completed_alert)
// add session
, [](lt::settings_pack& pack)
{
pack.set_int(lt::settings_pack::alert_mask, alert::file_progress_notification);
pack.set_int(lt::settings_pack::alert_mask, alert_category::file_progress);
}
// add torrent
, [](lt::add_torrent_params&) {}
@ -625,7 +625,7 @@ TORRENT_TEST(block_uploaded_alert)
, [](lt::settings_pack& pack)
{
pack.set_int(lt::settings_pack::alert_mask,
alert::upload_notification | alert::status_notification);
alert_category::upload | alert_category::status);
}
// add torrent
, [](lt::add_torrent_params&) {}

View File

@ -388,7 +388,7 @@ TORRENT_TEST(alert_order)
setup_swarm(1, swarm_test::upload
// add session
, [](lt::settings_pack& sett) {
sett.set_int(settings_pack::alert_mask, alert::all_categories);
sett.set_int(settings_pack::alert_mask, alert_category::all);
}
// add torrent
, [](lt::add_torrent_params ) {}

View File

@ -1305,9 +1305,9 @@ void test_tracker_tiers(lt::settings_pack pack
{
using namespace libtorrent;
pack.set_int(settings_pack::alert_mask, alert::error_notification
| alert::status_notification
| alert::torrent_log_notification);
pack.set_int(settings_pack::alert_mask, alert_category::error
| alert_category::status
| alert_category::torrent_log);
// setup the simulation
struct sim_config : sim::default_config

View File

@ -1182,14 +1182,14 @@ namespace {
alert_category_t m = {};
switch (s)
{
case alert::debug: m = alert::all_categories; break;
case alert::info: m = alert::all_categories & ~(alert::debug_notification
| alert::progress_notification | alert::dht_notification); break;
case alert::warning: m = alert::all_categories & ~(alert::debug_notification
| alert::status_notification | alert::progress_notification
| alert::dht_notification); break;
case alert::critical: m = alert::error_notification | alert::storage_notification; break;
case alert::fatal: m = alert::error_notification; break;
case alert::debug: m = alert_category::all; break;
case alert::info: m = alert_category::all & ~(alert::debug_notification
| alert::progress_notification | alert_category::dht); break;
case alert::warning: m = alert_category::all & ~(alert::debug_notification
| alert_category::status | alert::progress_notification
| alert_category::dht); break;
case alert::critical: m = alert_category::error | alert_category::storage; break;
case alert::fatal: m = alert_category::error; break;
case alert::none: m = {}; break;
}

View File

@ -333,7 +333,7 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
SET(connect_seed_every_n_download, 10, nullptr),
SET(max_http_recv_buffer_size, 4*1024*204, nullptr),
SET(max_retry_port_bind, 10, nullptr),
SET(alert_mask, int(static_cast<std::uint32_t>(alert::error_notification)), &session_impl::update_alert_mask),
SET(alert_mask, int(static_cast<std::uint32_t>(alert_category::error)), &session_impl::update_alert_mask),
SET(out_enc_policy, settings_pack::pe_enabled, nullptr),
SET(in_enc_policy, settings_pack::pe_enabled, nullptr),
SET(allowed_enc_level, settings_pack::pe_both, nullptr),

View File

@ -39,24 +39,24 @@ using namespace lt;
lt::settings_pack settings()
{
alert_category_t const mask =
alert::error_notification
| alert::peer_notification
| alert::port_mapping_notification
| alert::storage_notification
| alert::tracker_notification
| alert::connect_notification
| alert::status_notification
| alert::ip_block_notification
| alert::dht_notification
| alert::session_log_notification
| alert::torrent_log_notification
| alert::peer_log_notification
| alert::incoming_request_notification
| alert::dht_log_notification
| alert::dht_operation_notification
| alert::port_mapping_log_notification
| alert::file_progress_notification
| alert::piece_progress_notification;
alert_category::error
| alert_category::peer
| alert_category::port_mapping
| alert_category::storage
| alert_category::tracker
| alert_category::connect
| alert_category::status
| alert_category::ip_block
| alert_category::dht
| alert_category::session_log
| alert_category::torrent_log
| alert_category::peer_log
| alert_category::incoming_request
| alert_category::dht_log
| alert_category::dht_operation
| alert_category::port_mapping_log
| alert_category::file_progress
| alert_category::piece_progress;
settings_pack pack;
pack.set_bool(settings_pack::enable_lsd, false);

View File

@ -44,7 +44,7 @@ using namespace lt;
TORRENT_TEST(limit)
{
alert_manager mgr(500, alert::all_categories);
alert_manager mgr(500, alert_category::all);
TEST_EQUAL(mgr.alert_queue_size_limit(), 500);
TEST_EQUAL(mgr.pending(), false);
@ -83,7 +83,7 @@ TORRENT_TEST(limit)
TORRENT_TEST(limit_int_max)
{
int const inf = std::numeric_limits<int>::max();
alert_manager mgr(inf, alert::all_categories);
alert_manager mgr(inf, alert_category::all);
TEST_EQUAL(mgr.alert_queue_size_limit(), inf);
@ -101,7 +101,7 @@ TORRENT_TEST(limit_int_max)
TORRENT_TEST(priority_limit)
{
alert_manager mgr(100, alert::all_categories);
alert_manager mgr(100, alert_category::all);
TEST_EQUAL(mgr.alert_queue_size_limit(), 100);
@ -132,7 +132,7 @@ void test_notify_fun(int& cnt)
TORRENT_TEST(notify_function)
{
int cnt = 0;
alert_manager mgr(100, alert::all_categories);
alert_manager mgr(100, alert_category::all);
TEST_EQUAL(mgr.alert_queue_size_limit(), 100);
TEST_EQUAL(mgr.pending(), false);
@ -191,7 +191,7 @@ TORRENT_TEST(extensions)
{
#ifndef TORRENT_DISABLE_EXTENSIONS
memset(plugin_alerts, 0, sizeof(plugin_alerts));
alert_manager mgr(100, alert::all_categories);
alert_manager mgr(100, alert_category::all);
mgr.add_extension(std::make_shared<test_plugin>(0));
mgr.add_extension(std::make_shared<test_plugin>(1));
@ -228,7 +228,7 @@ void post_torrent_added(alert_manager* mgr)
TORRENT_TEST(wait_for_alert)
{
alert_manager mgr(100, alert::all_categories);
alert_manager mgr(100, alert_category::all);
time_point start = clock_type::now();
@ -270,7 +270,7 @@ TORRENT_TEST(wait_for_alert)
TORRENT_TEST(alert_mask)
{
alert_manager mgr(100, alert::all_categories);
alert_manager mgr(100, alert_category::all);
TEST_CHECK(mgr.should_post<add_torrent_alert>());
TEST_CHECK(mgr.should_post<torrent_paused_alert>());
@ -283,7 +283,7 @@ TORRENT_TEST(alert_mask)
TORRENT_TEST(dropped_alerts)
{
alert_manager mgr(1, alert::all_categories);
alert_manager mgr(1, alert_category::all);
// nothing has dropped yet
mgr.emplace_alert<torrent_finished_alert>(torrent_handle());
@ -302,7 +302,7 @@ TORRENT_TEST(dropped_alerts)
TORRENT_TEST(alerts_dropped_alert)
{
alert_manager mgr(1, alert::all_categories);
alert_manager mgr(1, alert_category::all);
mgr.emplace_alert<torrent_finished_alert>(torrent_handle());
mgr.emplace_alert<torrent_finished_alert>(torrent_handle());
@ -333,7 +333,7 @@ struct post_plugin : lt::plugin
// plugin handler
TORRENT_TEST(recursive_alerts)
{
alert_manager mgr(100, alert::all_categories);
alert_manager mgr(100, alert_category::all);
auto pl = std::make_shared<post_plugin>(mgr);
mgr.add_extension(pl);

View File

@ -51,7 +51,7 @@ TORRENT_TEST(alerts_types)
TEST_EQUAL(torrent_alert::alert_type, 0);
TEST_EQUAL(peer_alert::alert_type, 1);
TEST_EQUAL(tracker_alert::alert_type, 2);
TEST_EQUAL(alert::debug_notification, alert::connect_notification);
TEST_EQUAL(alert::debug_notification, alert_category::connect);
#endif
#define TEST_ALERT_TYPE(name, seq, prio, cat) \
@ -63,7 +63,7 @@ TORRENT_TEST(alerts_types)
count_alert_types++
#if TORRENT_ABI_VERSION == 1
TEST_ALERT_TYPE(torrent_added_alert, 3, 0, alert::status_notification);
TEST_ALERT_TYPE(torrent_added_alert, 3, 0, alert_category::status);
#else
++count_alert_types;
#endif
@ -74,111 +74,111 @@ TORRENT_TEST(alerts_types)
#define PROGRESS_NOTIFICATION
#endif
TEST_ALERT_TYPE(torrent_removed_alert, 4, 2, alert::status_notification);
TEST_ALERT_TYPE(read_piece_alert, 5, 2, alert::storage_notification);
TEST_ALERT_TYPE(file_completed_alert, 6, 0, PROGRESS_NOTIFICATION alert::file_progress_notification);
TEST_ALERT_TYPE(file_renamed_alert, 7, 2, alert::storage_notification);
TEST_ALERT_TYPE(file_rename_failed_alert, 8, 2, alert::storage_notification);
TEST_ALERT_TYPE(performance_alert, 9, 0, alert::performance_warning);
TEST_ALERT_TYPE(state_changed_alert, 10, 1, alert::status_notification);
TEST_ALERT_TYPE(tracker_error_alert, 11, 1, alert::tracker_notification | alert::error_notification);
TEST_ALERT_TYPE(tracker_warning_alert, 12, 0, alert::tracker_notification | alert::error_notification);
TEST_ALERT_TYPE(scrape_reply_alert, 13, 2, alert::tracker_notification);
TEST_ALERT_TYPE(scrape_failed_alert, 14, 2, alert::tracker_notification | alert::error_notification);
TEST_ALERT_TYPE(tracker_reply_alert, 15, 0, alert::tracker_notification);
TEST_ALERT_TYPE(dht_reply_alert, 16, 0, alert::dht_notification | alert::tracker_notification);
TEST_ALERT_TYPE(tracker_announce_alert, 17, 0, alert::tracker_notification);
TEST_ALERT_TYPE(hash_failed_alert, 18, 0, alert::status_notification);
TEST_ALERT_TYPE(peer_ban_alert, 19, 0, alert::peer_notification);
TEST_ALERT_TYPE(peer_unsnubbed_alert, 20, 0, alert::peer_notification);
TEST_ALERT_TYPE(peer_snubbed_alert, 21, 0, alert::peer_notification);
TEST_ALERT_TYPE(peer_error_alert, 22, 0, alert::peer_notification);
TEST_ALERT_TYPE(peer_connect_alert, 23, 0, alert::connect_notification);
TEST_ALERT_TYPE(peer_disconnected_alert, 24, 0, alert::connect_notification);
TEST_ALERT_TYPE(invalid_request_alert, 25, 0, alert::peer_notification);
TEST_ALERT_TYPE(torrent_finished_alert, 26, 1, alert::status_notification);
TEST_ALERT_TYPE(piece_finished_alert, 27, 0, PROGRESS_NOTIFICATION alert::piece_progress_notification);
TEST_ALERT_TYPE(request_dropped_alert, 28, 0, PROGRESS_NOTIFICATION alert::block_progress_notification | alert::peer_notification);
TEST_ALERT_TYPE(block_timeout_alert, 29, 0, PROGRESS_NOTIFICATION alert::block_progress_notification | alert::peer_notification);
TEST_ALERT_TYPE(block_finished_alert, 30, 0, PROGRESS_NOTIFICATION alert::block_progress_notification);
TEST_ALERT_TYPE(block_downloading_alert, 31, 0, PROGRESS_NOTIFICATION alert::block_progress_notification);
TEST_ALERT_TYPE(unwanted_block_alert, 32, 0, alert::peer_notification);
TEST_ALERT_TYPE(storage_moved_alert, 33, 2, alert::storage_notification);
TEST_ALERT_TYPE(storage_moved_failed_alert, 34, 2, alert::storage_notification);
TEST_ALERT_TYPE(torrent_deleted_alert, 35, 2, alert::storage_notification);
TEST_ALERT_TYPE(torrent_delete_failed_alert, 36, 2, alert::storage_notification | alert::error_notification);
TEST_ALERT_TYPE(save_resume_data_alert, 37, 2, alert::storage_notification);
TEST_ALERT_TYPE(save_resume_data_failed_alert, 38, 2, alert::storage_notification | alert::error_notification);
TEST_ALERT_TYPE(torrent_paused_alert, 39, 1, alert::status_notification);
TEST_ALERT_TYPE(torrent_resumed_alert, 40, 1, alert::status_notification);
TEST_ALERT_TYPE(torrent_checked_alert, 41, 1, alert::status_notification);
TEST_ALERT_TYPE(url_seed_alert, 42, 0, alert::peer_notification | alert::error_notification);
TEST_ALERT_TYPE(file_error_alert, 43, 1, alert::status_notification | alert::error_notification | alert::storage_notification);
TEST_ALERT_TYPE(metadata_failed_alert, 44, 0, alert::error_notification);
TEST_ALERT_TYPE(metadata_received_alert, 45, 0, alert::status_notification);
TEST_ALERT_TYPE(udp_error_alert, 46, 0, alert::error_notification);
TEST_ALERT_TYPE(external_ip_alert, 47, 0, alert::status_notification);
TEST_ALERT_TYPE(listen_failed_alert, 48, 2, alert::status_notification | alert::error_notification);
TEST_ALERT_TYPE(listen_succeeded_alert, 49, 2, alert::status_notification);
TEST_ALERT_TYPE(portmap_error_alert, 50, 0, alert::port_mapping_notification | alert::error_notification);
TEST_ALERT_TYPE(portmap_alert, 51, 0, alert::port_mapping_notification);
TEST_ALERT_TYPE(portmap_log_alert, 52, 0, alert::port_mapping_log_notification);
TEST_ALERT_TYPE(fastresume_rejected_alert, 53, 2, alert::status_notification | alert::error_notification);
TEST_ALERT_TYPE(peer_blocked_alert, 54, 0, alert::ip_block_notification);
TEST_ALERT_TYPE(dht_announce_alert, 55, 0, alert::dht_notification);
TEST_ALERT_TYPE(dht_get_peers_alert, 56, 0, alert::dht_notification);
TEST_ALERT_TYPE(stats_alert, 57, 0, alert::stats_notification);
TEST_ALERT_TYPE(cache_flushed_alert, 58, 1, alert::storage_notification);
TEST_ALERT_TYPE(torrent_removed_alert, 4, 2, alert_category::status);
TEST_ALERT_TYPE(read_piece_alert, 5, 2, alert_category::storage);
TEST_ALERT_TYPE(file_completed_alert, 6, 0, PROGRESS_NOTIFICATION alert_category::file_progress);
TEST_ALERT_TYPE(file_renamed_alert, 7, 2, alert_category::storage);
TEST_ALERT_TYPE(file_rename_failed_alert, 8, 2, alert_category::storage);
TEST_ALERT_TYPE(performance_alert, 9, 0, alert_category::performance_warning);
TEST_ALERT_TYPE(state_changed_alert, 10, 1, alert_category::status);
TEST_ALERT_TYPE(tracker_error_alert, 11, 1, alert_category::tracker | alert_category::error);
TEST_ALERT_TYPE(tracker_warning_alert, 12, 0, alert_category::tracker | alert_category::error);
TEST_ALERT_TYPE(scrape_reply_alert, 13, 2, alert_category::tracker);
TEST_ALERT_TYPE(scrape_failed_alert, 14, 2, alert_category::tracker | alert_category::error);
TEST_ALERT_TYPE(tracker_reply_alert, 15, 0, alert_category::tracker);
TEST_ALERT_TYPE(dht_reply_alert, 16, 0, alert_category::dht | alert_category::tracker);
TEST_ALERT_TYPE(tracker_announce_alert, 17, 0, alert_category::tracker);
TEST_ALERT_TYPE(hash_failed_alert, 18, 0, alert_category::status);
TEST_ALERT_TYPE(peer_ban_alert, 19, 0, alert_category::peer);
TEST_ALERT_TYPE(peer_unsnubbed_alert, 20, 0, alert_category::peer);
TEST_ALERT_TYPE(peer_snubbed_alert, 21, 0, alert_category::peer);
TEST_ALERT_TYPE(peer_error_alert, 22, 0, alert_category::peer);
TEST_ALERT_TYPE(peer_connect_alert, 23, 0, alert_category::connect);
TEST_ALERT_TYPE(peer_disconnected_alert, 24, 0, alert_category::connect);
TEST_ALERT_TYPE(invalid_request_alert, 25, 0, alert_category::peer);
TEST_ALERT_TYPE(torrent_finished_alert, 26, 1, alert_category::status);
TEST_ALERT_TYPE(piece_finished_alert, 27, 0, PROGRESS_NOTIFICATION alert_category::piece_progress);
TEST_ALERT_TYPE(request_dropped_alert, 28, 0, PROGRESS_NOTIFICATION alert_category::block_progress | alert_category::peer);
TEST_ALERT_TYPE(block_timeout_alert, 29, 0, PROGRESS_NOTIFICATION alert_category::block_progress | alert_category::peer);
TEST_ALERT_TYPE(block_finished_alert, 30, 0, PROGRESS_NOTIFICATION alert_category::block_progress);
TEST_ALERT_TYPE(block_downloading_alert, 31, 0, PROGRESS_NOTIFICATION alert_category::block_progress);
TEST_ALERT_TYPE(unwanted_block_alert, 32, 0, alert_category::peer);
TEST_ALERT_TYPE(storage_moved_alert, 33, 2, alert_category::storage);
TEST_ALERT_TYPE(storage_moved_failed_alert, 34, 2, alert_category::storage);
TEST_ALERT_TYPE(torrent_deleted_alert, 35, 2, alert_category::storage);
TEST_ALERT_TYPE(torrent_delete_failed_alert, 36, 2, alert_category::storage | alert_category::error);
TEST_ALERT_TYPE(save_resume_data_alert, 37, 2, alert_category::storage);
TEST_ALERT_TYPE(save_resume_data_failed_alert, 38, 2, alert_category::storage | alert_category::error);
TEST_ALERT_TYPE(torrent_paused_alert, 39, 1, alert_category::status);
TEST_ALERT_TYPE(torrent_resumed_alert, 40, 1, alert_category::status);
TEST_ALERT_TYPE(torrent_checked_alert, 41, 1, alert_category::status);
TEST_ALERT_TYPE(url_seed_alert, 42, 0, alert_category::peer | alert_category::error);
TEST_ALERT_TYPE(file_error_alert, 43, 1, alert_category::status | alert_category::error | alert_category::storage);
TEST_ALERT_TYPE(metadata_failed_alert, 44, 0, alert_category::error);
TEST_ALERT_TYPE(metadata_received_alert, 45, 0, alert_category::status);
TEST_ALERT_TYPE(udp_error_alert, 46, 0, alert_category::error);
TEST_ALERT_TYPE(external_ip_alert, 47, 0, alert_category::status);
TEST_ALERT_TYPE(listen_failed_alert, 48, 2, alert_category::status | alert_category::error);
TEST_ALERT_TYPE(listen_succeeded_alert, 49, 2, alert_category::status);
TEST_ALERT_TYPE(portmap_error_alert, 50, 0, alert_category::port_mapping | alert_category::error);
TEST_ALERT_TYPE(portmap_alert, 51, 0, alert_category::port_mapping);
TEST_ALERT_TYPE(portmap_log_alert, 52, 0, alert_category::port_mapping_log);
TEST_ALERT_TYPE(fastresume_rejected_alert, 53, 2, alert_category::status | alert_category::error);
TEST_ALERT_TYPE(peer_blocked_alert, 54, 0, alert_category::ip_block);
TEST_ALERT_TYPE(dht_announce_alert, 55, 0, alert_category::dht);
TEST_ALERT_TYPE(dht_get_peers_alert, 56, 0, alert_category::dht);
TEST_ALERT_TYPE(stats_alert, 57, 0, alert_category::stats);
TEST_ALERT_TYPE(cache_flushed_alert, 58, 1, alert_category::storage);
#if TORRENT_ABI_VERSION == 1
TEST_ALERT_TYPE(anonymous_mode_alert, 59, 0, alert::error_notification);
TEST_ALERT_TYPE(anonymous_mode_alert, 59, 0, alert_category::error);
#else
count_alert_types++;
#endif
TEST_ALERT_TYPE(lsd_peer_alert, 60, 0, alert::peer_notification);
TEST_ALERT_TYPE(trackerid_alert, 61, 0, alert::status_notification);
TEST_ALERT_TYPE(dht_bootstrap_alert, 62, 0, alert::dht_notification);
TEST_ALERT_TYPE(lsd_peer_alert, 60, 0, alert_category::peer);
TEST_ALERT_TYPE(trackerid_alert, 61, 0, alert_category::status);
TEST_ALERT_TYPE(dht_bootstrap_alert, 62, 0, alert_category::dht);
count_alert_types++; // 63 is gone
TEST_ALERT_TYPE(torrent_error_alert, 64, 1, alert::error_notification | alert::status_notification);
TEST_ALERT_TYPE(torrent_need_cert_alert, 65, 2, alert::status_notification);
TEST_ALERT_TYPE(incoming_connection_alert, 66, 0, alert::peer_notification);
TEST_ALERT_TYPE(add_torrent_alert, 67, 2, alert::status_notification);
TEST_ALERT_TYPE(state_update_alert, 68, 1, alert::status_notification);
TEST_ALERT_TYPE(torrent_error_alert, 64, 1, alert_category::error | alert_category::status);
TEST_ALERT_TYPE(torrent_need_cert_alert, 65, 2, alert_category::status);
TEST_ALERT_TYPE(incoming_connection_alert, 66, 0, alert_category::peer);
TEST_ALERT_TYPE(add_torrent_alert, 67, 2, alert_category::status);
TEST_ALERT_TYPE(state_update_alert, 68, 1, alert_category::status);
#if TORRENT_ABI_VERSION == 1
TEST_ALERT_TYPE(mmap_cache_alert, 69, 0, alert::error_notification);
TEST_ALERT_TYPE(mmap_cache_alert, 69, 0, alert_category::error);
#else
count_alert_types++;
#endif
TEST_ALERT_TYPE(session_stats_alert, 70, 2, alert::stats_notification);
TEST_ALERT_TYPE(session_stats_alert, 70, 2, alert_category::stats);
#if TORRENT_ABI_VERSION == 1
TEST_ALERT_TYPE(torrent_update_alert, 71, 2, alert::status_notification);
TEST_ALERT_TYPE(torrent_update_alert, 71, 2, alert_category::status);
#else
count_alert_types++;
#endif
count_alert_types++; // 72 is gone
TEST_ALERT_TYPE(dht_error_alert, 73, 0, alert::error_notification | alert::dht_notification);
TEST_ALERT_TYPE(dht_immutable_item_alert, 74, 2, alert::dht_notification);
TEST_ALERT_TYPE(dht_mutable_item_alert, 75, 2, alert::dht_notification);
TEST_ALERT_TYPE(dht_put_alert, 76, 0, alert::dht_notification);
TEST_ALERT_TYPE(i2p_alert, 77, 0, alert::error_notification);
TEST_ALERT_TYPE(dht_outgoing_get_peers_alert, 78, 0, alert::dht_notification);
TEST_ALERT_TYPE(log_alert, 79, 0, alert::session_log_notification);
TEST_ALERT_TYPE(torrent_log_alert, 80, 0, alert::torrent_log_notification);
TEST_ALERT_TYPE(peer_log_alert, 81, 0, alert::peer_log_notification);
TEST_ALERT_TYPE(lsd_error_alert, 82, 0, alert::error_notification);
TEST_ALERT_TYPE(dht_stats_alert, 83, 0, alert::stats_notification);
TEST_ALERT_TYPE(incoming_request_alert, 84, 0, alert::incoming_request_notification);
TEST_ALERT_TYPE(dht_log_alert, 85, 0, alert::dht_log_notification);
TEST_ALERT_TYPE(dht_pkt_alert, 86, 0, alert::dht_log_notification);
TEST_ALERT_TYPE(dht_get_peers_reply_alert, 87, 0, alert::dht_operation_notification);
TEST_ALERT_TYPE(dht_direct_response_alert, 88, 2, alert::dht_notification);
TEST_ALERT_TYPE(picker_log_alert, 89, 0, alert::picker_log_notification);
TEST_ALERT_TYPE(session_error_alert, 90, 0, alert::error_notification);
TEST_ALERT_TYPE(dht_live_nodes_alert, 91, 0, alert::dht_notification);
TEST_ALERT_TYPE(session_stats_header_alert, 92, 0, alert::stats_notification);
TEST_ALERT_TYPE(dht_sample_infohashes_alert, 93, 0, alert::dht_operation_notification);
TEST_ALERT_TYPE(block_uploaded_alert, 94, 0, PROGRESS_NOTIFICATION alert::upload_notification);
TEST_ALERT_TYPE(alerts_dropped_alert, 95, 3, alert::error_notification);
TEST_ALERT_TYPE(socks5_alert, 96, 0, alert::error_notification);
TEST_ALERT_TYPE(dht_error_alert, 73, 0, alert_category::error | alert_category::dht);
TEST_ALERT_TYPE(dht_immutable_item_alert, 74, 2, alert_category::dht);
TEST_ALERT_TYPE(dht_mutable_item_alert, 75, 2, alert_category::dht);
TEST_ALERT_TYPE(dht_put_alert, 76, 0, alert_category::dht);
TEST_ALERT_TYPE(i2p_alert, 77, 0, alert_category::error);
TEST_ALERT_TYPE(dht_outgoing_get_peers_alert, 78, 0, alert_category::dht);
TEST_ALERT_TYPE(log_alert, 79, 0, alert_category::session_log);
TEST_ALERT_TYPE(torrent_log_alert, 80, 0, alert_category::torrent_log);
TEST_ALERT_TYPE(peer_log_alert, 81, 0, alert_category::peer_log);
TEST_ALERT_TYPE(lsd_error_alert, 82, 0, alert_category::error);
TEST_ALERT_TYPE(dht_stats_alert, 83, 0, alert_category::stats);
TEST_ALERT_TYPE(incoming_request_alert, 84, 0, alert_category::incoming_request);
TEST_ALERT_TYPE(dht_log_alert, 85, 0, alert_category::dht_log);
TEST_ALERT_TYPE(dht_pkt_alert, 86, 0, alert_category::dht_log);
TEST_ALERT_TYPE(dht_get_peers_reply_alert, 87, 0, alert_category::dht_operation);
TEST_ALERT_TYPE(dht_direct_response_alert, 88, 2, alert_category::dht);
TEST_ALERT_TYPE(picker_log_alert, 89, 0, alert_category::picker_log);
TEST_ALERT_TYPE(session_error_alert, 90, 0, alert_category::error);
TEST_ALERT_TYPE(dht_live_nodes_alert, 91, 0, alert_category::dht);
TEST_ALERT_TYPE(session_stats_header_alert, 92, 0, alert_category::stats);
TEST_ALERT_TYPE(dht_sample_infohashes_alert, 93, 0, alert_category::dht_operation);
TEST_ALERT_TYPE(block_uploaded_alert, 94, 0, PROGRESS_NOTIFICATION alert_category::upload);
TEST_ALERT_TYPE(alerts_dropped_alert, 95, 3, alert_category::error);
TEST_ALERT_TYPE(socks5_alert, 96, 0, alert_category::error);
#undef TEST_ALERT_TYPE
@ -254,7 +254,7 @@ TORRENT_TEST(dht_live_nodes_alert)
TORRENT_TEST(session_stats_alert)
{
alert_manager mgr(1, alert::stats_notification);
alert_manager mgr(1, alert_category::stats);
std::vector<alert*> alerts;
counters cnt;

View File

@ -53,12 +53,12 @@ void test_lsd()
session_proxy p2;
settings_pack pack;
pack.set_int(settings_pack::alert_mask, alert::error_notification
| alert::session_log_notification
| alert::torrent_log_notification
| alert::peer_log_notification
| alert::ip_block_notification
| alert::status_notification);
pack.set_int(settings_pack::alert_mask, alert_category::error
| alert_category::session_log
| alert_category::torrent_log
| alert_category::peer_log
| alert_category::ip_block
| alert_category::status);
pack.set_bool(settings_pack::enable_dht, false);
pack.set_bool(settings_pack::enable_lsd, true);
pack.set_bool(settings_pack::enable_upnp, false);

View File

@ -72,8 +72,8 @@ void test_remap_files(storage_mode_t storage_mode = storage_mode_sparse)
t->remap_files(fs);
auto const alert_mask = alert::all_categories
& ~alert::stats_notification;
auto const alert_mask = alert_category::all
& ~alert_category::stats;
session_proxy p1;

View File

@ -460,7 +460,7 @@ TORRENT_TEST(init_dht_default_bootstrap)
{
settings_pack p = settings();
p.set_bool(settings_pack::enable_dht, true);
p.set_int(settings_pack::alert_mask, alert::all_categories);
p.set_int(settings_pack::alert_mask, alert_category::all);
// default value
p.set_str(settings_pack::dht_bootstrap_nodes, "dht.libtorrent.org:25401");
@ -474,7 +474,7 @@ TORRENT_TEST(init_dht_invalid_bootstrap)
{
settings_pack p = settings();
p.set_bool(settings_pack::enable_dht, true);
p.set_int(settings_pack::alert_mask, alert::all_categories);
p.set_int(settings_pack::alert_mask, alert_category::all);
// no default value
p.set_str(settings_pack::dht_bootstrap_nodes, "test.libtorrent.org:25401:8888");
@ -488,7 +488,7 @@ TORRENT_TEST(init_dht_empty_bootstrap)
{
settings_pack p = settings();
p.set_bool(settings_pack::enable_dht, true);
p.set_int(settings_pack::alert_mask, alert::all_categories);
p.set_int(settings_pack::alert_mask, alert_category::all);
// empty value
p.set_str(settings_pack::dht_bootstrap_nodes, "");
@ -504,7 +504,7 @@ TORRENT_TEST(dht_upload_rate_overflow_pack)
// make sure this doesn't cause an overflow
p.set_int(settings_pack::dht_upload_rate_limit, std::numeric_limits<int>::max());
p.set_int(settings_pack::alert_mask, alert_category_t(std::uint32_t(p.get_int(settings_pack::alert_mask)))
| alert::dht_log_notification);
| alert_category::dht_log);
p.set_bool(settings_pack::enable_dht, true);
lt::session s(p);
@ -520,7 +520,7 @@ TORRENT_TEST(dht_upload_rate_overflow)
settings_pack p = settings();
p.set_bool(settings_pack::enable_dht, true);
p.set_int(settings_pack::alert_mask, alert_category_t(std::uint32_t(p.get_int(settings_pack::alert_mask)))
| alert::dht_log_notification);
| alert_category::dht_log);
lt::session s(p);
// make sure this doesn't cause an overflow
@ -577,7 +577,7 @@ TORRENT_TEST(reopen_network_sockets)
};
settings_pack p = settings();
p.set_int(settings_pack::alert_mask, alert::all_categories);
p.set_int(settings_pack::alert_mask, alert_category::all);
p.set_str(settings_pack::listen_interfaces, "127.0.0.1:6881l");
p.set_bool(settings_pack::enable_upnp, true);

View File

@ -78,7 +78,7 @@ bool prioritize_files(torrent_handle const& h, aux::vector<download_priority_t,
void test_running_torrent(std::shared_ptr<torrent_info> info, std::int64_t file_size)
{
settings_pack pack = settings();
pack.set_int(settings_pack::alert_mask, alert::piece_progress_notification | alert::storage_notification);
pack.set_int(settings_pack::alert_mask, alert_category::piece_progress | alert_category::storage);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48130");
pack.set_int(settings_pack::max_retry_port_bind, 10);
lt::session ses(pack);
@ -231,7 +231,7 @@ TORRENT_TEST(total_wanted)
auto info = std::make_shared<torrent_info>(tmp, from_span);
settings_pack pack = settings();
pack.set_int(settings_pack::alert_mask, alert::storage_notification);
pack.set_int(settings_pack::alert_mask, alert_category::storage);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48130");
pack.set_int(settings_pack::max_retry_port_bind, 10);
lt::session ses(pack);
@ -761,7 +761,7 @@ TORRENT_TEST(symlinks_restore)
p.flags &= ~lt::torrent_flags::paused;
p.save_path = work_dir;
settings_pack pack = settings();
pack.set_int(libtorrent::settings_pack::alert_mask, libtorrent::alert::status_notification | libtorrent::alert::error_notification);
pack.set_int(libtorrent::settings_pack::alert_mask, libtorrent::alert_category::status | libtorrent::alert_category::error);
lt::session ses(std::move(pack));
ses.add_torrent(p);