| alert_types.hpp | | alert_types.hpp | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| { | | { | |
| | | | |
| // user defined alerts should use IDs greater than this | | // user defined alerts should use IDs greater than this | |
| const static int user_alert_id = 10000; | | const static int user_alert_id = 10000; | |
| | | | |
| // This is a base class for alerts that are associated with a | | // This is a base class for alerts that are associated with a | |
| // specific torrent. It contains a handle to the torrent. | | // specific torrent. It contains a handle to the torrent. | |
| struct TORRENT_EXPORT torrent_alert: alert | | struct TORRENT_EXPORT torrent_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_alert(torrent_handle const& h) | | torrent_alert(torrent_handle const& h); | |
| : handle(h) | | | |
| {} | | | |
| | | | |
| // internal | | // internal | |
| const static int alert_type = 1; | | const static int alert_type = 1; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // The torrent_handle pointing to the torrent this | | // The torrent_handle pointing to the torrent this | |
| // alert is associated with. | | // alert is associated with. | |
| torrent_handle handle; | | torrent_handle handle; | |
| }; | | }; | |
| | | | |
| // The peer alert is a base class for alerts that refer to a specifi
c peer. It includes all | | // The peer alert is a base class for alerts that refer to a specifi
c peer. It includes all | |
| // the information to identify the peer. i.e. ``ip`` and ``peer-id``
. | | // the information to identify the peer. i.e. ``ip`` and ``peer-id``
. | |
| struct TORRENT_EXPORT peer_alert: torrent_alert | | struct TORRENT_EXPORT peer_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_alert(torrent_handle const& h, tcp::endpoint const& i | | peer_alert(torrent_handle const& h, tcp::endpoint const& i | |
|
| , peer_id const& pi) | | , peer_id const& pi); | |
| : torrent_alert(h) | | | |
| , ip(i) | | | |
| , pid(pi) | | | |
| {} | | | |
| | | | |
| const static int alert_type = 2; | | const static int alert_type = 2; | |
| const static int static_category = alert::peer_notification; | | const static int static_category = alert::peer_notification; | |
| virtual int category() const { return static_category; } | | virtual int category() const { return static_category; } | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // The peer's IP address and port. | | // The peer's IP address and port. | |
| tcp::endpoint ip; | | tcp::endpoint ip; | |
| | | | |
| // the peer ID, if known. | | // the peer ID, if known. | |
| peer_id pid; | | peer_id pid; | |
| }; | | }; | |
| | | | |
| // This is a base class used for alerts that are associated with a | | // This is a base class used for alerts that are associated with a | |
| // specific tracker. It derives from torrent_alert since a tracker | | // specific tracker. It derives from torrent_alert since a tracker | |
| // is also associated with a specific torrent. | | // is also associated with a specific torrent. | |
| struct TORRENT_EXPORT tracker_alert: torrent_alert | | struct TORRENT_EXPORT tracker_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| tracker_alert(torrent_handle const& h | | tracker_alert(torrent_handle const& h | |
|
| , std::string const& u) | | , std::string const& u); | |
| : torrent_alert(h) | | | |
| , url(u) | | | |
| {} | | | |
| | | | |
| const static int alert_type = 3; | | const static int alert_type = 3; | |
| const static int static_category = alert::tracker_notificati
on; | | const static int static_category = alert::tracker_notificati
on; | |
| virtual int category() const { return static_category; } | | virtual int category() const { return static_category; } | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // The tracker URL | | // The tracker URL | |
| std::string url; | | std::string url; | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 126 | |
| virtual int category() const { return static_category; } \ | | virtual int category() const { return static_category; } \ | |
| virtual char const* what() const { return #name; } | | virtual char const* what() const { return #name; } | |
| | | | |
| // The ``torrent_added_alert`` is posted once every time a torrent i
s successfully | | // The ``torrent_added_alert`` is posted once every time a torrent i
s successfully | |
| // added. It doesn't contain any members of its own, but inherits th
e torrent handle | | // added. It doesn't contain any members of its own, but inherits th
e torrent handle | |
| // from its base class. | | // from its base class. | |
| // It's posted when the ``status_notification`` bit is set in the al
ert_mask. | | // It's posted when the ``status_notification`` bit is set in the al
ert_mask. | |
| struct TORRENT_EXPORT torrent_added_alert: torrent_alert | | struct TORRENT_EXPORT torrent_added_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_added_alert(torrent_handle const& h) | | torrent_added_alert(torrent_handle const& h); | |
| : torrent_alert(h) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_added_alert); | | TORRENT_DEFINE_ALERT(torrent_added_alert); | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| }; | | }; | |
| | | | |
| // The ``torrent_removed_alert`` is posted whenever a torrent is rem
oved. Since | | // The ``torrent_removed_alert`` is posted whenever a torrent is rem
oved. Since | |
| // the torrent handle in its baseclass will always be invalid (since
the torrent | | // the torrent handle in its baseclass will always be invalid (since
the torrent | |
| // is already removed) it has the info hash as a member, to identify
it. | | // is already removed) it has the info hash as a member, to identify
it. | |
| // It's posted when the ``status_notification`` bit is set in the al
ert_mask. | | // It's posted when the ``status_notification`` bit is set in the al
ert_mask. | |
| | | | |
| skipping to change at line 159 | | skipping to change at line 148 | |
| // Even though the ``handle`` member doesn't point to an existing to
rrent anymore, | | // Even though the ``handle`` member doesn't point to an existing to
rrent anymore, | |
| // it is still useful for comparing to other handles, which may also
no | | // it is still useful for comparing to other handles, which may also
no | |
| // longer point to existing torrents, but to the same non-existing t
orrents. | | // longer point to existing torrents, but to the same non-existing t
orrents. | |
| // | | // | |
| // The ``torrent_handle`` acts as a ``weak_ptr``, even though its ob
ject no | | // The ``torrent_handle`` acts as a ``weak_ptr``, even though its ob
ject no | |
| // longer exists, it can still compare equal to another weak pointer
which | | // longer exists, it can still compare equal to another weak pointer
which | |
| // points to the same non-existent object. | | // points to the same non-existent object. | |
| struct TORRENT_EXPORT torrent_removed_alert: torrent_alert | | struct TORRENT_EXPORT torrent_removed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_removed_alert(torrent_handle const& h, sha1_hash con | | torrent_removed_alert(torrent_handle const& h, sha1_hash con | |
| st& ih) | | st& ih); | |
| : torrent_alert(h) | | | |
| , info_hash(ih) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_removed_alert); | | TORRENT_DEFINE_ALERT(torrent_removed_alert); | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| sha1_hash info_hash; | | sha1_hash info_hash; | |
| }; | | }; | |
| | | | |
| // This alert is posted when the asynchronous read operation initiat
ed by | | // This alert is posted when the asynchronous read operation initiat
ed by | |
| // a call to torrent_handle::read_piece() is completed. If the read
failed, the torrent | | // a call to torrent_handle::read_piece() is completed. If the read
failed, the torrent | |
| // is paused and an error state is set and the buffer member of the
alert | | // is paused and an error state is set and the buffer member of the
alert | |
| // is 0. If successful, ``buffer`` points to a buffer containing all
the data | | // is 0. If successful, ``buffer`` points to a buffer containing all
the data | |
| // of the piece. ``piece`` is the piece index that was read. ``size`
` is the | | // of the piece. ``piece`` is the piece index that was read. ``size`
` is the | |
| // number of bytes that was read. | | // number of bytes that was read. | |
| // | | // | |
| // If the operation fails, ec will indicat what went wrong. | | // If the operation fails, ec will indicat what went wrong. | |
| struct TORRENT_EXPORT read_piece_alert: torrent_alert | | struct TORRENT_EXPORT read_piece_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| read_piece_alert(torrent_handle const& h | | read_piece_alert(torrent_handle const& h | |
|
| , int p, boost::shared_array<char> d, int s) | | , int p, boost::shared_array<char> d, int s); | |
| : torrent_alert(h) | | read_piece_alert(torrent_handle h, int p, error_code e); | |
| , buffer(d) | | | |
| , piece(p) | | | |
| , size(s) | | | |
| {} | | | |
| read_piece_alert(torrent_handle h, int p, error_code e) | | | |
| : torrent_alert(h) | | | |
| , ec(e) | | | |
| , piece(p) | | | |
| , size(0) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(read_piece_alert); | | TORRENT_DEFINE_ALERT(read_piece_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| error_code ec; | | error_code ec; | |
| boost::shared_array<char> buffer; | | boost::shared_array<char> buffer; | |
| int piece; | | int piece; | |
| int size; | | int size; | |
| }; | | }; | |
| | | | |
| // This is posted whenever an individual file completes its download
. i.e. | | // This is posted whenever an individual file completes its download
. i.e. | |
| // All pieces overlapping this file have passed their hash check. | | // All pieces overlapping this file have passed their hash check. | |
| struct TORRENT_EXPORT file_completed_alert: torrent_alert | | struct TORRENT_EXPORT file_completed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| file_completed_alert(torrent_handle const& h | | file_completed_alert(torrent_handle const& h | |
|
| , int idx) | | , int idx); | |
| : torrent_alert(h) | | | |
| , index(idx) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(file_completed_alert); | | TORRENT_DEFINE_ALERT(file_completed_alert); | |
| | | | |
| const static int static_category = alert::progress_notificat
ion; | | const static int static_category = alert::progress_notificat
ion; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // refers to the index of the file that completed. | | // refers to the index of the file that completed. | |
| int index; | | int index; | |
| }; | | }; | |
| | | | |
| // This is posted as a response to a torrent_handle::rename_file() c
all, if the rename | | // This is posted as a response to a torrent_handle::rename_file() c
all, if the rename | |
| // operation succeeds. | | // operation succeeds. | |
| struct TORRENT_EXPORT file_renamed_alert: torrent_alert | | struct TORRENT_EXPORT file_renamed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| file_renamed_alert(torrent_handle const& h | | file_renamed_alert(torrent_handle const& h | |
| , std::string const& n | | , std::string const& n | |
|
| , int idx) | | , int idx); | |
| : torrent_alert(h) | | | |
| , name(n) | | | |
| , index(idx) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(file_renamed_alert); | | TORRENT_DEFINE_ALERT(file_renamed_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| std::string name; | | std::string name; | |
| | | | |
| // refers to the index of the file that was renamed, | | // refers to the index of the file that was renamed, | |
| | | | |
| skipping to change at line 260 | | skipping to change at line 229 | |
| int index; | | int index; | |
| }; | | }; | |
| | | | |
| // This is posted as a response to a torrent_handle::rename_file() c
all, if the rename | | // This is posted as a response to a torrent_handle::rename_file() c
all, if the rename | |
| // operation failed. | | // operation failed. | |
| struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert | | struct TORRENT_EXPORT file_rename_failed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| file_rename_failed_alert(torrent_handle const& h | | file_rename_failed_alert(torrent_handle const& h | |
| , int idx | | , int idx | |
|
| , error_code ec) | | , error_code ec); | |
| : torrent_alert(h) | | | |
| , index(idx) | | | |
| , error(ec) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(file_rename_failed_alert); | | TORRENT_DEFINE_ALERT(file_rename_failed_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // refers to the index of the file that was supposed to be r
enamed, | | // refers to the index of the file that was supposed to be r
enamed, | |
| // ``error`` is the error code returned from the filesystem. | | // ``error`` is the error code returned from the filesystem. | |
| | | | |
| skipping to change at line 365 | | skipping to change at line 330 | |
| // include more ports. | | // include more ports. | |
| too_few_outgoing_ports, | | too_few_outgoing_ports, | |
| | | | |
| too_few_file_descriptors, | | too_few_file_descriptors, | |
| | | | |
| num_warnings | | num_warnings | |
| }; | | }; | |
| | | | |
| // internal | | // internal | |
| performance_alert(torrent_handle const& h | | performance_alert(torrent_handle const& h | |
|
| , performance_warning_t w) | | , performance_warning_t w); | |
| : torrent_alert(h) | | | |
| , warning_code(w) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(performance_alert); | | TORRENT_DEFINE_ALERT(performance_alert); | |
| | | | |
| const static int static_category = alert::performance_warnin
g; | | const static int static_category = alert::performance_warnin
g; | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| performance_warning_t warning_code; | | performance_warning_t warning_code; | |
| }; | | }; | |
| | | | |
| // Generated whenever a torrent changes its state. | | // Generated whenever a torrent changes its state. | |
| struct TORRENT_EXPORT state_changed_alert: torrent_alert | | struct TORRENT_EXPORT state_changed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| state_changed_alert(torrent_handle const& h | | state_changed_alert(torrent_handle const& h | |
| , torrent_status::state_t st | | , torrent_status::state_t st | |
|
| , torrent_status::state_t prev_st) | | , torrent_status::state_t prev_st); | |
| : torrent_alert(h) | | | |
| , state(st) | | | |
| , prev_state(prev_st) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(state_changed_alert); | | TORRENT_DEFINE_ALERT(state_changed_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the new state of the torrent. | | // the new state of the torrent. | |
| torrent_status::state_t state; | | torrent_status::state_t state; | |
| | | | |
| | | | |
| skipping to change at line 420 | | skipping to change at line 378 | |
| // means the tracker needs authentication, 404 means not found etc.
If the | | // means the tracker needs authentication, 404 means not found etc.
If the | |
| // tracker timed out, the code will be set to 0. | | // tracker timed out, the code will be set to 0. | |
| struct TORRENT_EXPORT tracker_error_alert: tracker_alert | | struct TORRENT_EXPORT tracker_error_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| tracker_error_alert(torrent_handle const& h | | tracker_error_alert(torrent_handle const& h | |
| , int times | | , int times | |
| , int status | | , int status | |
| , std::string const& u | | , std::string const& u | |
| , error_code const& e | | , error_code const& e | |
|
| , std::string const& m) | | , std::string const& m); | |
| : tracker_alert(h, u) | | | |
| , times_in_row(times) | | | |
| , status_code(status) | | | |
| , error(e) | | | |
| , msg(m) | | | |
| { | | | |
| TORRENT_ASSERT(!url.empty()); | | | |
| } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(tracker_error_alert); | | TORRENT_DEFINE_ALERT(tracker_error_alert); | |
| | | | |
| const static int static_category = alert::tracker_notificati
on | alert::error_notification; | | const static int static_category = alert::tracker_notificati
on | alert::error_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int times_in_row; | | int times_in_row; | |
| int status_code; | | int status_code; | |
| error_code error; | | error_code error; | |
| std::string msg; | | std::string msg; | |
| }; | | }; | |
| | | | |
| // This alert is triggered if the tracker reply contains a warning f
ield. | | // This alert is triggered if the tracker reply contains a warning f
ield. | |
| // Usually this means that the tracker announce was successful, but
the | | // Usually this means that the tracker announce was successful, but
the | |
| // tracker has a message to the client. | | // tracker has a message to the client. | |
| struct TORRENT_EXPORT tracker_warning_alert: tracker_alert | | struct TORRENT_EXPORT tracker_warning_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| tracker_warning_alert(torrent_handle const& h | | tracker_warning_alert(torrent_handle const& h | |
| , std::string const& u | | , std::string const& u | |
|
| , std::string const& m) | | , std::string const& m); | |
| : tracker_alert(h, u) | | | |
| , msg(m) | | | |
| { TORRENT_ASSERT(!url.empty()); } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(tracker_warning_alert); | | TORRENT_DEFINE_ALERT(tracker_warning_alert); | |
| | | | |
| const static int static_category = alert::tracker_notificati
on | alert::error_notification; | | const static int static_category = alert::tracker_notificati
on | alert::error_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // contains the warning message from the tracker. | | // contains the warning message from the tracker. | |
| std::string msg; | | std::string msg; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a scrape request succeeds. | | // This alert is generated when a scrape request succeeds. | |
| struct TORRENT_EXPORT scrape_reply_alert: tracker_alert | | struct TORRENT_EXPORT scrape_reply_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| scrape_reply_alert(torrent_handle const& h | | scrape_reply_alert(torrent_handle const& h | |
| , int incomp | | , int incomp | |
| , int comp | | , int comp | |
|
| , std::string const& u) | | , std::string const& u); | |
| : tracker_alert(h, u) | | | |
| , incomplete(incomp) | | | |
| , complete(comp) | | | |
| { TORRENT_ASSERT(!url.empty()); } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(scrape_reply_alert); | | TORRENT_DEFINE_ALERT(scrape_reply_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the data returned in the scrape response. These numbers | | // the data returned in the scrape response. These numbers | |
| // may be -1 if the reponse was malformed. | | // may be -1 if the reponse was malformed. | |
| int incomplete; | | int incomplete; | |
| int complete; | | int complete; | |
| }; | | }; | |
| | | | |
| // If a scrape request fails, this alert is generated. This might be
due | | // If a scrape request fails, this alert is generated. This might be
due | |
| // to the tracker timing out, refusing connection or returning an ht
tp response | | // to the tracker timing out, refusing connection or returning an ht
tp response | |
| // code indicating an error. | | // code indicating an error. | |
| struct TORRENT_EXPORT scrape_failed_alert: tracker_alert | | struct TORRENT_EXPORT scrape_failed_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| scrape_failed_alert(torrent_handle const& h | | scrape_failed_alert(torrent_handle const& h | |
| , std::string const& u | | , std::string const& u | |
|
| , error_code const& e) | | , error_code const& e); | |
| : tracker_alert(h, u) | | | |
| , msg(convert_from_native(e.message())) | | | |
| { TORRENT_ASSERT(!url.empty()); } | | | |
| | | | |
| scrape_failed_alert(torrent_handle const& h | | scrape_failed_alert(torrent_handle const& h | |
| , std::string const& u | | , std::string const& u | |
|
| , std::string const& m) | | , std::string const& m); | |
| : tracker_alert(h, u) | | | |
| , msg(m) | | | |
| { TORRENT_ASSERT(!url.empty()); } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(scrape_failed_alert); | | TORRENT_DEFINE_ALERT(scrape_failed_alert); | |
| | | | |
| const static int static_category = alert::tracker_notificati
on | alert::error_notification; | | const static int static_category = alert::tracker_notificati
on | alert::error_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // contains a message describing the error. | | // contains a message describing the error. | |
| std::string msg; | | std::string msg; | |
| }; | | }; | |
| | | | |
| // This alert is only for informational purpose. It is generated whe
n a tracker announce | | // This alert is only for informational purpose. It is generated whe
n a tracker announce | |
| // succeeds. It is generated regardless what kind of tracker was use
d, be it UDP, HTTP or | | // succeeds. It is generated regardless what kind of tracker was use
d, be it UDP, HTTP or | |
| // the DHT. | | // the DHT. | |
| struct TORRENT_EXPORT tracker_reply_alert: tracker_alert | | struct TORRENT_EXPORT tracker_reply_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| tracker_reply_alert(torrent_handle const& h | | tracker_reply_alert(torrent_handle const& h | |
| , int np | | , int np | |
|
| , std::string const& u) | | , std::string const& u); | |
| : tracker_alert(h, u) | | | |
| , num_peers(np) | | | |
| { TORRENT_ASSERT(!url.empty()); } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(tracker_reply_alert); | | TORRENT_DEFINE_ALERT(tracker_reply_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // tells how many peers the tracker returned in this respons
e. This is | | // tells how many peers the tracker returned in this respons
e. This is | |
| // not expected to be more thant the ``num_want`` settings.
These are not necessarily | | // not expected to be more thant the ``num_want`` settings.
These are not necessarily | |
| // all new peers, some of them may already be connected. | | // all new peers, some of them may already be connected. | |
| int num_peers; | | int num_peers; | |
| }; | | }; | |
| | | | |
| // This alert is generated each time the DHT receives peers from a n
ode. ``num_peers`` | | // This alert is generated each time the DHT receives peers from a n
ode. ``num_peers`` | |
| // is the number of peers we received in this packet. Typically thes
e packets are | | // is the number of peers we received in this packet. Typically thes
e packets are | |
| // received from multiple DHT nodes, and so the alerts are typically
generated | | // received from multiple DHT nodes, and so the alerts are typically
generated | |
| // a few at a time. | | // a few at a time. | |
| struct TORRENT_EXPORT dht_reply_alert: tracker_alert | | struct TORRENT_EXPORT dht_reply_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| dht_reply_alert(torrent_handle const& h | | dht_reply_alert(torrent_handle const& h | |
|
| , int np) | | , int np); | |
| : tracker_alert(h, "") | | | |
| , num_peers(np) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_reply_alert); | | TORRENT_DEFINE_ALERT(dht_reply_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int num_peers; | | int num_peers; | |
| }; | | }; | |
| | | | |
| // This alert is generated each time a tracker announce is sent (or
attempted to be sent). | | // This alert is generated each time a tracker announce is sent (or
attempted to be sent). | |
| // There are no extra data members in this alert. The url can be fou
nd in the base class | | // There are no extra data members in this alert. The url can be fou
nd in the base class | |
| // however. | | // however. | |
| struct TORRENT_EXPORT tracker_announce_alert: tracker_alert | | struct TORRENT_EXPORT tracker_announce_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| tracker_announce_alert(torrent_handle const& h | | tracker_announce_alert(torrent_handle const& h | |
|
| , std::string const& u, int e) | | , std::string const& u, int e); | |
| : tracker_alert(h, u) | | | |
| , event(e) | | | |
| { TORRENT_ASSERT(!url.empty()); } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(tracker_announce_alert); | | TORRENT_DEFINE_ALERT(tracker_announce_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // specifies what event was sent to the tracker. It is defin
ed as: | | // specifies what event was sent to the tracker. It is defin
ed as: | |
| // | | // | |
| // 0. None | | // 0. None | |
| // 1. Completed | | // 1. Completed | |
| // 2. Started | | // 2. Started | |
| | | | |
| skipping to change at line 590 | | skipping to change at line 518 | |
| int event; | | int event; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a finished piece fails its hash chec
k. You can get the handle | | // This alert is generated when a finished piece fails its hash chec
k. You can get the handle | |
| // to the torrent which got the failed piece and the index of the pi
ece itself from the alert. | | // to the torrent which got the failed piece and the index of the pi
ece itself from the alert. | |
| struct TORRENT_EXPORT hash_failed_alert: torrent_alert | | struct TORRENT_EXPORT hash_failed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| hash_failed_alert( | | hash_failed_alert( | |
| torrent_handle const& h | | torrent_handle const& h | |
|
| , int index) | | , int index); | |
| : torrent_alert(h) | | | |
| , piece_index(index) | | | |
| { TORRENT_ASSERT(index >= 0);} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(hash_failed_alert); | | TORRENT_DEFINE_ALERT(hash_failed_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a peer is banned because it has sent
too many corrupt pieces | | // This alert is generated when a peer is banned because it has sent
too many corrupt pieces | |
| // to us. ``ip`` is the endpoint to the peer that was banned. | | // to us. ``ip`` is the endpoint to the peer that was banned. | |
| struct TORRENT_EXPORT peer_ban_alert: peer_alert | | struct TORRENT_EXPORT peer_ban_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_ban_alert(torrent_handle h, tcp::endpoint const& ep | | peer_ban_alert(torrent_handle h, tcp::endpoint const& ep | |
|
| , peer_id const& peer_id) | | , peer_id const& peer_id); | |
| : peer_alert(h, ep, peer_id) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(peer_ban_alert); | | TORRENT_DEFINE_ALERT(peer_ban_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a peer is unsnubbed. Essentially whe
n it was snubbed for stalling | | // This alert is generated when a peer is unsnubbed. Essentially whe
n it was snubbed for stalling | |
| // sending data, and now it started sending data again. | | // sending data, and now it started sending data again. | |
| struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert | | struct TORRENT_EXPORT peer_unsnubbed_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const&
ep | | peer_unsnubbed_alert(torrent_handle h, tcp::endpoint const&
ep | |
|
| , peer_id const& peer_id) | | , peer_id const& peer_id); | |
| : peer_alert(h, ep, peer_id) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(peer_unsnubbed_alert); | | TORRENT_DEFINE_ALERT(peer_unsnubbed_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a peer is snubbed, when it stops sen
ding data when we request | | // This alert is generated when a peer is snubbed, when it stops sen
ding data when we request | |
| // it. | | // it. | |
| struct TORRENT_EXPORT peer_snubbed_alert: peer_alert | | struct TORRENT_EXPORT peer_snubbed_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep | | peer_snubbed_alert(torrent_handle h, tcp::endpoint const& ep | |
|
| , peer_id const& peer_id) | | , peer_id const& peer_id); | |
| : peer_alert(h, ep, peer_id) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(peer_snubbed_alert); | | TORRENT_DEFINE_ALERT(peer_snubbed_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a peer sends invalid data over the p
eer-peer protocol. The peer | | // This alert is generated when a peer sends invalid data over the p
eer-peer protocol. The peer | |
| // will be disconnected, but you get its ip address from the alert,
to identify it. | | // will be disconnected, but you get its ip address from the alert,
to identify it. | |
| struct TORRENT_EXPORT peer_error_alert: peer_alert | | struct TORRENT_EXPORT peer_error_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_error_alert(torrent_handle const& h, tcp::endpoint cons
t& ep | | peer_error_alert(torrent_handle const& h, tcp::endpoint cons
t& ep | |
|
| , peer_id const& peer_id, error_code const& e) | | , 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); | | TORRENT_DEFINE_ALERT(peer_error_alert); | |
| | | | |
| const static int static_category = alert::peer_notification; | | const static int static_category = alert::peer_notification; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| return peer_alert::message() + " peer error: " + con | | | |
| vert_from_native(error.message()); | | | |
| } | | | |
| | | | |
| // tells you what error caused this alert. | | // tells you what error caused this alert. | |
| error_code error; | | error_code error; | |
| | | | |
| #ifndef TORRENT_NO_DEPRECATE | | #ifndef TORRENT_NO_DEPRECATE | |
| std::string msg; | | std::string msg; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This alert is posted every time an outgoing peer connect attempts
succeeds. | | // This alert is posted every time an outgoing peer connect attempts
succeeds. | |
| struct TORRENT_EXPORT peer_connect_alert: peer_alert | | struct TORRENT_EXPORT peer_connect_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_connect_alert(torrent_handle h, tcp::endpoint const& ep | | peer_connect_alert(torrent_handle h, tcp::endpoint const& ep | |
|
| , peer_id const& peer_id, int type) | | , peer_id const& peer_id, int type); | |
| : peer_alert(h, ep, peer_id) | | | |
| , socket_type(type) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(peer_connect_alert); | | TORRENT_DEFINE_ALERT(peer_connect_alert); | |
| | | | |
| const static int static_category = alert::debug_notification
; | | const static int static_category = alert::debug_notification
; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int socket_type; | | int socket_type; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a peer is disconnected for any reaso
n (other than the ones | | // This alert is generated when a peer is disconnected for any reaso
n (other than the ones | |
| // covered by peer_error_alert ). | | // covered by peer_error_alert ). | |
| struct TORRENT_EXPORT peer_disconnected_alert: peer_alert | | struct TORRENT_EXPORT peer_disconnected_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_disconnected_alert(torrent_handle const& h, tcp::endpoi
nt const& ep | | peer_disconnected_alert(torrent_handle const& h, tcp::endpoi
nt const& ep | |
|
| , peer_id const& peer_id, error_code const& e) | | , 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); | | TORRENT_DEFINE_ALERT(peer_disconnected_alert); | |
| | | | |
| const static int static_category = alert::debug_notification
; | | const static int static_category = alert::debug_notification
; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // tells you what error caused peer to disconnect. | | // tells you what error caused peer to disconnect. | |
| error_code error; | | error_code error; | |
| | | | |
| #ifndef TORRENT_NO_DEPRECATE | | #ifndef TORRENT_NO_DEPRECATE | |
| | | | |
| skipping to change at line 732 | | skipping to change at line 631 | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This is a debug alert that is generated by an incoming invalid pi
ece request. | | // This is a debug alert that is generated by an incoming invalid pi
ece request. | |
| // ``ip`` is the address of the peer and the ``request`` is the actu
al incoming | | // ``ip`` is the address of the peer and the ``request`` is the actu
al incoming | |
| // request from the peer. See peer_request for more info. | | // request from the peer. See peer_request for more info. | |
| struct TORRENT_EXPORT invalid_request_alert: peer_alert | | struct TORRENT_EXPORT invalid_request_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| invalid_request_alert(torrent_handle const& h, tcp::endpoint
const& ep | | invalid_request_alert(torrent_handle const& h, tcp::endpoint
const& ep | |
|
| , peer_id const& peer_id, peer_request const& r) | | , peer_id const& peer_id, peer_request const& r); | |
| : peer_alert(h, ep, peer_id) | | | |
| , request(r) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(invalid_request_alert); | | TORRENT_DEFINE_ALERT(invalid_request_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| peer_request request; | | peer_request request; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a torrent switches from being a down
loader to a seed. | | // This alert is generated when a torrent switches from being a down
loader to a seed. | |
| // It will only be generated once per torrent. It contains a torrent
_handle to the | | // It will only be generated once per torrent. It contains a torrent
_handle to the | |
| // torrent in question. | | // torrent in question. | |
| struct TORRENT_EXPORT torrent_finished_alert: torrent_alert | | struct TORRENT_EXPORT torrent_finished_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_finished_alert( | | torrent_finished_alert(const torrent_handle& h); | |
| const torrent_handle& h) | | | |
| : torrent_alert(h) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_finished_alert); | | TORRENT_DEFINE_ALERT(torrent_finished_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " torrent finished downl | | | |
| oading"; } | | | |
| }; | | }; | |
| | | | |
| // this alert is posted every time a piece completes downloading | | // this alert is posted every time a piece completes downloading | |
| // and passes the hash check. This alert derives from torrent_alert | | // and passes the hash check. This alert derives from torrent_alert | |
| // which contains the torrent_handle to the torrent the piece belong
s to. | | // which contains the torrent_handle to the torrent the piece belong
s to. | |
| struct TORRENT_EXPORT piece_finished_alert: torrent_alert | | struct TORRENT_EXPORT piece_finished_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| piece_finished_alert( | | piece_finished_alert( | |
| const torrent_handle& h | | const torrent_handle& h | |
|
| , int piece_num) | | , int piece_num); | |
| : torrent_alert(h) | | | |
| , piece_index(piece_num) | | | |
| { TORRENT_ASSERT(piece_index >= 0);} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(piece_finished_alert); | | TORRENT_DEFINE_ALERT(piece_finished_alert); | |
| | | | |
| const static int static_category = alert::progress_notificat
ion; | | const static int static_category = alert::progress_notificat
ion; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the index of the piece that finished | | // the index of the piece that finished | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a peer rejects or ignores a piece re
quest. | | // This alert is generated when a peer rejects or ignores a piece re
quest. | |
| struct TORRENT_EXPORT request_dropped_alert: peer_alert | | struct TORRENT_EXPORT request_dropped_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| request_dropped_alert(const torrent_handle& h, tcp::endpoint
const& ep | | request_dropped_alert(const torrent_handle& h, tcp::endpoint
const& ep | |
|
| , peer_id const& peer_id, int block_num, int piece_n | | , peer_id const& peer_id, int block_num, int piece_n | |
| um) | | um); | |
| : 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); | | TORRENT_DEFINE_ALERT(request_dropped_alert); | |
| | | | |
| const static int static_category = alert::progress_notificat
ion | | const static int static_category = alert::progress_notificat
ion | |
| | alert::peer_notification; | | | alert::peer_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int block_index; | | int block_index; | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a block request times out. | | // This alert is generated when a block request times out. | |
| struct TORRENT_EXPORT block_timeout_alert: peer_alert | | struct TORRENT_EXPORT block_timeout_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| block_timeout_alert(const torrent_handle& h, tcp::endpoint c
onst& ep | | block_timeout_alert(const torrent_handle& h, tcp::endpoint c
onst& ep | |
|
| , peer_id const& peer_id, int block_num, int piece_n | | , peer_id const& peer_id, int block_num, int piece_n | |
| um) | | um); | |
| : 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); | | TORRENT_DEFINE_ALERT(block_timeout_alert); | |
| | | | |
| const static int static_category = alert::progress_notificat
ion | | const static int static_category = alert::progress_notificat
ion | |
| | alert::peer_notification; | | | alert::peer_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int block_index; | | int block_index; | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a block request receives a response. | | // This alert is generated when a block request receives a response. | |
| struct TORRENT_EXPORT block_finished_alert: peer_alert | | struct TORRENT_EXPORT block_finished_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| block_finished_alert(const torrent_handle& h, tcp::endpoint
const& ep | | block_finished_alert(const torrent_handle& h, tcp::endpoint
const& ep | |
|
| , peer_id const& peer_id, int block_num, int piece_n | | , peer_id const& peer_id, int block_num, int piece_n | |
| um) | | um); | |
| : 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); | | TORRENT_DEFINE_ALERT(block_finished_alert); | |
| | | | |
| const static int static_category = alert::progress_notificat
ion; | | const static int static_category = alert::progress_notificat
ion; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int block_index; | | int block_index; | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a block request is sent to a peer. | | // This alert is generated when a block request is sent to a peer. | |
| struct TORRENT_EXPORT block_downloading_alert: peer_alert | | struct TORRENT_EXPORT block_downloading_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| block_downloading_alert(const torrent_handle& h, tcp::endpoi
nt const& ep | | block_downloading_alert(const torrent_handle& h, tcp::endpoi
nt const& ep | |
|
| , peer_id const& peer_id, char const* speedmsg, int | | , peer_id const& peer_id, char const* speedmsg, int | |
| block_num, int piece_num) | | 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); | | TORRENT_DEFINE_ALERT(block_downloading_alert); | |
| | | | |
| const static int static_category = alert::progress_notificat
ion; | | const static int static_category = alert::progress_notificat
ion; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| char const* peer_speedmsg; | | char const* peer_speedmsg; | |
| int block_index; | | int block_index; | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a block is received that was not req
uested or | | // This alert is generated when a block is received that was not req
uested or | |
| // whose request timed out. | | // whose request timed out. | |
| struct TORRENT_EXPORT unwanted_block_alert: peer_alert | | struct TORRENT_EXPORT unwanted_block_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| unwanted_block_alert(const torrent_handle& h, tcp::endpoint
const& ep | | unwanted_block_alert(const torrent_handle& h, tcp::endpoint
const& ep | |
|
| , peer_id const& peer_id, int block_num, int piece_n | | , peer_id const& peer_id, int block_num, int piece_n | |
| um) | | um); | |
| : 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); | | TORRENT_DEFINE_ALERT(unwanted_block_alert); | |
| | | | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int block_index; | | int block_index; | |
| int piece_index; | | int piece_index; | |
| }; | | }; | |
| | | | |
| // The ``storage_moved_alert`` is generated when all the disk IO has
completed and the | | // The ``storage_moved_alert`` is generated when all the disk IO has
completed and the | |
| // files have been moved, as an effect of a call to ``torrent_handle
::move_storage``. This | | // files have been moved, as an effect of a call to ``torrent_handle
::move_storage``. This | |
| // is useful to synchronize with the actual disk. The ``path`` membe
r is the new path of | | // is useful to synchronize with the actual disk. The ``path`` membe
r is the new path of | |
| // the storage. | | // the storage. | |
| struct TORRENT_EXPORT storage_moved_alert: torrent_alert | | struct TORRENT_EXPORT storage_moved_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| storage_moved_alert(torrent_handle const& h, std::string con | | storage_moved_alert(torrent_handle const& h, std::string con | |
| st& p) | | st& p); | |
| : torrent_alert(h) | | | |
| , path(p) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(storage_moved_alert); | | TORRENT_DEFINE_ALERT(storage_moved_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| return torrent_alert::message() + " moved storage to | | | |
| : " | | | |
| + path; | | | |
| } | | | |
| | | | |
| std::string path; | | std::string path; | |
| }; | | }; | |
| | | | |
| // The ``storage_moved_failed_alert`` is generated when an attempt t
o move the storage, | | // The ``storage_moved_failed_alert`` is generated when an attempt t
o move the storage, | |
| // via torrent_handle::move_storage(), fails. | | // via torrent_handle::move_storage(), fails. | |
| struct TORRENT_EXPORT storage_moved_failed_alert: torrent_alert | | struct TORRENT_EXPORT storage_moved_failed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| storage_moved_failed_alert(torrent_handle const& h, error_co | | storage_moved_failed_alert(torrent_handle const& h, error_co | |
| de const& e) | | de const& e); | |
| : torrent_alert(h) | | | |
| , error(e) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(storage_moved_failed_alert); | | TORRENT_DEFINE_ALERT(storage_moved_failed_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| return torrent_alert::message() + " storage move fai | | | |
| led: " | | | |
| + convert_from_native(error.message()); | | | |
| } | | | |
| | | | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a request to delete the files of a t
orrent complete. | | // This alert is generated when a request to delete the files of a t
orrent complete. | |
| // | | // | |
| // The ``info_hash`` is the info-hash of the torrent that was just d
eleted. Most of | | // The ``info_hash`` is the info-hash of the torrent that was just d
eleted. Most of | |
| // the time the torrent_handle in the ``torrent_alert`` will be inva
lid by the time | | // the time the torrent_handle in the ``torrent_alert`` will be inva
lid by the time | |
| // this alert arrives, since the torrent is being deleted. The ``inf
o_hash`` member | | // this alert arrives, since the torrent is being deleted. The ``inf
o_hash`` member | |
| // is hence the main way of identifying which torrent just completed
the delete. | | // is hence the main way of identifying which torrent just completed
the delete. | |
| // | | // | |
| // This alert is posted in the ``storage_notification`` category, an
d that bit | | // This alert is posted in the ``storage_notification`` category, an
d that bit | |
| // needs to be set in the alert_mask. | | // needs to be set in the alert_mask. | |
| struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert | | struct TORRENT_EXPORT torrent_deleted_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_deleted_alert(torrent_handle const& h, sha1_hash con | | torrent_deleted_alert(torrent_handle const& h, sha1_hash con | |
| st& ih) | | st& ih); | |
| : torrent_alert(h) | | | |
| { info_hash = ih; } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_deleted_alert); | | TORRENT_DEFINE_ALERT(torrent_deleted_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " deleted"; } | | | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| sha1_hash info_hash; | | sha1_hash info_hash; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a request to delete the files of a t
orrent fails. | | // This alert is generated when a request to delete the files of a t
orrent fails. | |
| // Just removing a torrent from the session cannot fail | | // Just removing a torrent from the session cannot fail | |
| struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert | | struct TORRENT_EXPORT torrent_delete_failed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_delete_failed_alert(torrent_handle const& h, error_c | | torrent_delete_failed_alert(torrent_handle const& h, error_c | |
| ode const& e, sha1_hash const& ih) | | ode const& e | |
| : torrent_alert(h) | | , sha1_hash const& ih); | |
| , error(e) | | | |
| , info_hash(ih) | | | |
| { | | | |
| #ifndef TORRENT_NO_DEPRECATE | | | |
| msg = convert_from_native(error.message()); | | | |
| #endif | | | |
| } | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_delete_failed_alert); | | TORRENT_DEFINE_ALERT(torrent_delete_failed_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on | | const static int static_category = alert::storage_notificati
on | |
| | alert::error_notification; | | | alert::error_notification; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| return torrent_alert::message() + " torrent deletion | | | |
| failed: " | | | |
| +convert_from_native(error.message()); | | | |
| } | | | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // tells you why it failed. | | // tells you why it failed. | |
| error_code error; | | error_code error; | |
| | | | |
| // the info hash of the torrent whose files failed to be del
eted | | // the info hash of the torrent whose files failed to be del
eted | |
| sha1_hash info_hash; | | sha1_hash info_hash; | |
| | | | |
| #ifndef TORRENT_NO_DEPRECATE | | #ifndef TORRENT_NO_DEPRECATE | |
| std::string msg; | | std::string msg; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This alert is generated as a response to a ``torrent_handle::save
_resume_data`` request. | | // This alert is generated as a response to a ``torrent_handle::save
_resume_data`` request. | |
| // It is generated once the disk IO thread is done writing the state
for this torrent. | | // It is generated once the disk IO thread is done writing the state
for this torrent. | |
| struct TORRENT_EXPORT save_resume_data_alert: torrent_alert | | struct TORRENT_EXPORT save_resume_data_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| save_resume_data_alert(boost::shared_ptr<entry> const& rd | | save_resume_data_alert(boost::shared_ptr<entry> const& rd | |
|
| , torrent_handle const& h) | | , torrent_handle const& h); | |
| : torrent_alert(h) | | | |
| , resume_data(rd) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(save_resume_data_alert); | | TORRENT_DEFINE_ALERT(save_resume_data_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on; | | const static int static_category = alert::storage_notificati
on; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " resume data generated" | | | |
| ; } | | | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // points to the resume data. | | // points to the resume data. | |
| boost::shared_ptr<entry> resume_data; | | boost::shared_ptr<entry> resume_data; | |
| }; | | }; | |
| | | | |
| // This alert is generated instead of ``save_resume_data_alert`` if
there was an error | | // This alert is generated instead of ``save_resume_data_alert`` if
there was an error | |
| // generating the resume data. ``error`` describes what went wrong. | | // generating the resume data. ``error`` describes what went wrong. | |
| struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert | | struct TORRENT_EXPORT save_resume_data_failed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| save_resume_data_failed_alert(torrent_handle const& h | | save_resume_data_failed_alert(torrent_handle const& h | |
|
| , error_code const& e) | | , 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); | | TORRENT_DEFINE_ALERT(save_resume_data_failed_alert); | |
| | | | |
| const static int static_category = alert::storage_notificati
on | | const static int static_category = alert::storage_notificati
on | |
| | alert::error_notification; | | | alert::error_notification; | |
|
| virtual std::string message() const | | 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; } | | virtual bool discardable() const { return false; } | |
| | | | |
| error_code error; | | error_code error; | |
| | | | |
| #ifndef TORRENT_NO_DEPRECATE | | #ifndef TORRENT_NO_DEPRECATE | |
| std::string msg; | | std::string msg; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This alert is generated as a response to a ``torrent_handle::paus
e`` request. It is | | // This alert is generated as a response to a ``torrent_handle::paus
e`` request. It is | |
| // generated once all disk IO is complete and the files in the torre
nt have been closed. | | // generated once all disk IO is complete and the files in the torre
nt have been closed. | |
| // This is useful for synchronizing with the disk. | | // This is useful for synchronizing with the disk. | |
| struct TORRENT_EXPORT torrent_paused_alert: torrent_alert | | struct TORRENT_EXPORT torrent_paused_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_paused_alert(torrent_handle const& h) | | torrent_paused_alert(torrent_handle const& h); | |
| : torrent_alert(h) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_paused_alert); | | TORRENT_DEFINE_ALERT(torrent_paused_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " paused"; } | | | |
| }; | | }; | |
| | | | |
| // This alert is generated as a response to a torrent_handle::resume
() request. It is | | // This alert is generated as a response to a torrent_handle::resume
() request. It is | |
| // generated when a torrent goes from a paused state to an active st
ate. | | // generated when a torrent goes from a paused state to an active st
ate. | |
| struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert | | struct TORRENT_EXPORT torrent_resumed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_resumed_alert(torrent_handle const& h) | | torrent_resumed_alert(torrent_handle const& h); | |
| : torrent_alert(h) {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_resumed_alert); | | TORRENT_DEFINE_ALERT(torrent_resumed_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " resumed"; } | | | |
| }; | | }; | |
| | | | |
| // This alert is posted when a torrent completes checking. i.e. when
it transitions | | // This alert is posted when a torrent completes checking. i.e. when
it transitions | |
| // out of the ``checking files`` state into a state where it is read
y to start downloading | | // out of the ``checking files`` state into a state where it is read
y to start downloading | |
| struct TORRENT_EXPORT torrent_checked_alert: torrent_alert | | struct TORRENT_EXPORT torrent_checked_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_checked_alert(torrent_handle const& h) | | torrent_checked_alert(torrent_handle const& h); | |
| : torrent_alert(h) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_checked_alert); | | TORRENT_DEFINE_ALERT(torrent_checked_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " checked"; } | | | |
| }; | | }; | |
| | | | |
| // This alert is generated when a HTTP seed name lookup fails. | | // This alert is generated when a HTTP seed name lookup fails. | |
| struct TORRENT_EXPORT url_seed_alert: torrent_alert | | struct TORRENT_EXPORT url_seed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| url_seed_alert( | | url_seed_alert( | |
| torrent_handle const& h | | torrent_handle const& h | |
| , std::string const& u | | , std::string const& u | |
|
| , error_code const& e) | | , error_code const& e); | |
| : torrent_alert(h) | | | |
| , url(u) | | | |
| , msg(convert_from_native(e.message())) | | | |
| {} | | | |
| url_seed_alert( | | url_seed_alert( | |
| torrent_handle const& h | | torrent_handle const& h | |
| , std::string const& u | | , std::string const& u | |
|
| , std::string const& m) | | , std::string const& m); | |
| : torrent_alert(h) | | | |
| , url(u) | | | |
| , msg(m) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(url_seed_alert); | | TORRENT_DEFINE_ALERT(url_seed_alert); | |
| | | | |
| const static int static_category = alert::peer_notification
| alert::error_notification; | | const static int static_category = alert::peer_notification
| alert::error_notification; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| return torrent_alert::message() + " url seed (" | | | |
| + url + ") failed: " + msg; | | | |
| } | | | |
| | | | |
| // the HTTP seed that failed | | // the HTTP seed that failed | |
| std::string url; | | std::string url; | |
| | | | |
| // the error message, potentially from the server | | // the error message, potentially from the server | |
| std::string msg; | | std::string msg; | |
| }; | | }; | |
| | | | |
| // If the storage fails to read or write files that it needs access
to, this alert is | | // If the storage fails to read or write files that it needs access
to, this alert is | |
| // generated and the torrent is paused. | | // generated and the torrent is paused. | |
| struct TORRENT_EXPORT file_error_alert: torrent_alert | | struct TORRENT_EXPORT file_error_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| file_error_alert( | | file_error_alert( | |
| std::string const& f | | std::string const& f | |
| , torrent_handle const& h | | , torrent_handle const& h | |
|
| , error_code const& e) | | , 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); | | TORRENT_DEFINE_ALERT(file_error_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n | | const static int static_category = alert::status_notificatio
n | |
| | alert::error_notification | | | alert::error_notification | |
| | alert::storage_notification; | | | alert::storage_notification; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| return torrent_alert::message() + " file (" + file + | | | |
| ") error: " | | | |
| + convert_from_native(error.message()); | | | |
| } | | | |
| | | | |
| // the path to the file that was accessed when the error occ
urred. | | // the path to the file that was accessed when the error occ
urred. | |
| std::string file; | | std::string file; | |
| | | | |
| // the error code describing the error. | | // the error code describing the error. | |
| error_code error; | | error_code error; | |
| | | | |
| #ifndef TORRENT_NO_DEPRECATE | | #ifndef TORRENT_NO_DEPRECATE | |
| std::string msg; | | std::string msg; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This alert is generated when the metadata has been completely rec
eived and the info-hash | | // This alert is generated when the metadata has been completely rec
eived and the info-hash | |
| // failed to match it. i.e. the metadata that was received was corru
pt. libtorrent will | | // failed to match it. i.e. the metadata that was received was corru
pt. libtorrent will | |
| // automatically retry to fetch it in this case. This is only releva
nt when running a | | // automatically retry to fetch it in this case. This is only releva
nt when running a | |
| // torrent-less download, with the metadata extension provided by li
btorrent. | | // torrent-less download, with the metadata extension provided by li
btorrent. | |
| struct TORRENT_EXPORT metadata_failed_alert: torrent_alert | | struct TORRENT_EXPORT metadata_failed_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| metadata_failed_alert(const torrent_handle& h, error_code e) | | metadata_failed_alert(const torrent_handle& h, error_code e) | |
| : torrent_alert(h) | | ; | |
| , error(e) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(metadata_failed_alert); | | TORRENT_DEFINE_ALERT(metadata_failed_alert); | |
| | | | |
| const static int static_category = alert::error_notification
; | | const static int static_category = alert::error_notification
; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " invalid metadata recei | | | |
| ved"; } | | | |
| | | | |
| // the error that occurred | | // the error that occurred | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| // This alert is generated when the metadata has been completely rec
eived and the torrent | | // This alert is generated when the metadata has been completely rec
eived and the torrent | |
| // can start downloading. It is not generated on torrents that are s
tarted with metadata, but | | // can start downloading. It is not generated on torrents that are s
tarted with metadata, but | |
| // only those that needs to download it from peers (when utilizing t
he libtorrent extension). | | // only those that needs to download it from peers (when utilizing t
he libtorrent extension). | |
| // | | // | |
| // There are no additional data members in this alert. | | // There are no additional data members in this alert. | |
| | | | |
| skipping to change at line 1227 | | skipping to change at line 1016 | |
| // if (f) { | | // if (f) { | |
| // fwrite(&buffer[0], 1, buffer.size(), f); | | // fwrite(&buffer[0], 1, buffer.size(), f); | |
| // fclose(f); | | // fclose(f); | |
| // } | | // } | |
| // } | | // } | |
| // | | // | |
| struct TORRENT_EXPORT metadata_received_alert: torrent_alert | | struct TORRENT_EXPORT metadata_received_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| metadata_received_alert( | | metadata_received_alert( | |
|
| const torrent_handle& h) | | const torrent_handle& h); | |
| : torrent_alert(h) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(metadata_received_alert); | | TORRENT_DEFINE_ALERT(metadata_received_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " metadata successfully | | | |
| received"; } | | | |
| }; | | }; | |
| | | | |
| // This alert is posted when there is an error on the UDP socket. Th
e | | // This alert is posted when there is an error on the UDP socket. Th
e | |
| // UDP socket is used for all uTP, DHT and UDP tracker traffic. It's | | // UDP socket is used for all uTP, DHT and UDP tracker traffic. It's | |
| // global to the session. | | // global to the session. | |
| struct TORRENT_EXPORT udp_error_alert: alert | | struct TORRENT_EXPORT udp_error_alert: alert | |
| { | | { | |
| // internal | | // internal | |
| udp_error_alert( | | udp_error_alert( | |
| udp::endpoint const& ep | | udp::endpoint const& ep | |
|
| , error_code const& ec) | | , error_code const& ec); | |
| : endpoint(ep) | | | |
| , error(ec) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(udp_error_alert); | | TORRENT_DEFINE_ALERT(udp_error_alert); | |
| | | | |
| const static int static_category = alert::error_notification
; | | const static int static_category = alert::error_notification
; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| error_code ec; | | | |
| return "UDP error: " + convert_from_native(error.mes | | | |
| sage()) + " from: " + endpoint.address().to_string(ec); | | | |
| } | | | |
| | | | |
| // the source address associated with the error (if any) | | // the source address associated with the error (if any) | |
| udp::endpoint endpoint; | | udp::endpoint endpoint; | |
| | | | |
| // the error code describing the error | | // the error code describing the error | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| // Whenever libtorrent learns about the machines external IP, this a
lert is | | // Whenever libtorrent learns about the machines external IP, this a
lert is | |
| // generated. The external IP address can be acquired from the track
er (if it | | // generated. The external IP address can be acquired from the track
er (if it | |
| // supports that) or from peers that supports the extension protocol
. | | // supports that) or from peers that supports the extension protocol
. | |
| // The address can be accessed through the ``external_address`` memb
er. | | // The address can be accessed through the ``external_address`` memb
er. | |
| struct TORRENT_EXPORT external_ip_alert: alert | | struct TORRENT_EXPORT external_ip_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| external_ip_alert(address const& ip) | | external_ip_alert(address const& ip); | |
| : external_address(ip) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(external_ip_alert); | | TORRENT_DEFINE_ALERT(external_ip_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { | | | |
| error_code ec; | | | |
| return "external IP received: " + external_address.t | | | |
| o_string(ec); | | | |
| } | | | |
| | | | |
| // the IP address that is believed to be our external IP | | // the IP address that is believed to be our external IP | |
| address external_address; | | address external_address; | |
| }; | | }; | |
| | | | |
| // This alert is generated when none of the ports, given in the port
range, to | | // This alert is generated when none of the ports, given in the port
range, to | |
| // session can be opened for listening. The ``endpoint`` member is t
he | | // session can be opened for listening. The ``endpoint`` member is t
he | |
| // interface and port that failed, ``error`` is the error code descr
ibing | | // interface and port that failed, ``error`` is the error code descr
ibing | |
| // the failure. | | // the failure. | |
| // | | // | |
| | | | |
| skipping to change at line 1309 | | skipping to change at line 1082 | |
| // listen on it. | | // listen on it. | |
| struct TORRENT_EXPORT listen_failed_alert: alert | | struct TORRENT_EXPORT listen_failed_alert: alert | |
| { | | { | |
| enum socket_type_t { tcp, tcp_ssl, udp, i2p, socks5 }; | | enum socket_type_t { tcp, tcp_ssl, udp, i2p, socks5 }; | |
| | | | |
| // internal | | // internal | |
| listen_failed_alert( | | listen_failed_alert( | |
| tcp::endpoint const& ep | | tcp::endpoint const& ep | |
| , int op | | , int op | |
| , error_code const& ec | | , error_code const& ec | |
|
| , socket_type_t t) | | , socket_type_t t); | |
| : endpoint(ep) | | | |
| , error(ec) | | | |
| , operation(op) | | | |
| , sock_type(t) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(listen_failed_alert); | | TORRENT_DEFINE_ALERT(listen_failed_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n | alert::error_notification; | | const static int static_category = alert::status_notificatio
n | alert::error_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // the endpoint libtorrent attempted to listen on | | // the endpoint libtorrent attempted to listen on | |
| tcp::endpoint endpoint; | | tcp::endpoint endpoint; | |
| | | | |
| | | | |
| skipping to change at line 1348 | | skipping to change at line 1116 | |
| }; | | }; | |
| | | | |
| // This alert is posted when the listen port succeeds to be opened o
n a | | // This alert is posted when the listen port succeeds to be opened o
n a | |
| // particular interface. ``endpoint`` is the endpoint that successfu
lly | | // particular interface. ``endpoint`` is the endpoint that successfu
lly | |
| // was opened for listening. | | // was opened for listening. | |
| struct TORRENT_EXPORT listen_succeeded_alert: alert | | struct TORRENT_EXPORT listen_succeeded_alert: alert | |
| { | | { | |
| enum socket_type_t { tcp, tcp_ssl, udp }; | | enum socket_type_t { tcp, tcp_ssl, udp }; | |
| | | | |
| // internal | | // internal | |
|
| listen_succeeded_alert(tcp::endpoint const& ep, socket_type_ | | listen_succeeded_alert(tcp::endpoint const& ep, socket_type_ | |
| t t) | | t t); | |
| : endpoint(ep) | | | |
| , sock_type(t) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(listen_succeeded_alert); | | TORRENT_DEFINE_ALERT(listen_succeeded_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // the endpoint libtorrent ended up listening on. The addres
s | | // the endpoint libtorrent ended up listening on. The addres
s | |
| // refers to the local interface and the port is the listen
port. | | // refers to the local interface and the port is the listen
port. | |
| tcp::endpoint endpoint; | | tcp::endpoint endpoint; | |
| | | | |
| skipping to change at line 1376 | | skipping to change at line 1141 | |
| | | | |
| // This alert is generated when a NAT router was successfully found
but some | | // This alert is generated when a NAT router was successfully found
but some | |
| // part of the port mapping request failed. It contains a text messa
ge that | | // part of the port mapping request failed. It contains a text messa
ge that | |
| // may help the user figure out what is wrong. This alert is not gen
erated in | | // may help the user figure out what is wrong. This alert is not gen
erated in | |
| // case it appears the client is not running on a NAT:ed network or
if it | | // case it appears the client is not running on a NAT:ed network or
if it | |
| // appears there is no NAT router that can be remote controlled to a
dd port | | // appears there is no NAT router that can be remote controlled to a
dd port | |
| // mappings. | | // mappings. | |
| struct TORRENT_EXPORT portmap_error_alert: alert | | struct TORRENT_EXPORT portmap_error_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| portmap_error_alert(int i, int t, error_code const& e) | | 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); | | TORRENT_DEFINE_ALERT(portmap_error_alert); | |
| | | | |
| const static int static_category = alert::port_mapping_notif
ication | | const static int static_category = alert::port_mapping_notif
ication | |
| | alert::error_notification; | | | alert::error_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // refers to the mapping index of the port map that failed,
i.e. | | // refers to the mapping index of the port map that failed,
i.e. | |
| // the index returned from add_mapping(). | | // the index returned from add_mapping(). | |
| int mapping; | | int mapping; | |
| | | | |
| skipping to change at line 1411 | | skipping to change at line 1170 | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This alert is generated when a NAT router was successfully found
and | | // This alert is generated when a NAT router was successfully found
and | |
| // a port was successfully mapped on it. On a NAT:ed network with a
NAT-PMP | | // a port was successfully mapped on it. On a NAT:ed network with a
NAT-PMP | |
| // capable router, this is typically generated once when mapping the
TCP | | // capable router, this is typically generated once when mapping the
TCP | |
| // port and, if DHT is enabled, when the UDP port is mapped. | | // port and, if DHT is enabled, when the UDP port is mapped. | |
| struct TORRENT_EXPORT portmap_alert: alert | | struct TORRENT_EXPORT portmap_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| portmap_alert(int i, int port, int t) | | portmap_alert(int i, int port, int t); | |
| : mapping(i), external_port(port), map_type(t) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(portmap_alert); | | TORRENT_DEFINE_ALERT(portmap_alert); | |
| | | | |
| const static int static_category = alert::port_mapping_notif
ication; | | const static int static_category = alert::port_mapping_notif
ication; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // refers to the mapping index of the port map that failed,
i.e. | | // refers to the mapping index of the port map that failed,
i.e. | |
| // the index returned from add_mapping(). | | // the index returned from add_mapping(). | |
| int mapping; | | int mapping; | |
| | | | |
| | | | |
| skipping to change at line 1438 | | skipping to change at line 1195 | |
| int map_type; | | int map_type; | |
| }; | | }; | |
| | | | |
| // This alert is generated to log informational events related to ei
ther | | // This alert is generated to log informational events related to ei
ther | |
| // UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PM
P | | // UPnP or NAT-PMP. They contain a log line and the type (0 = NAT-PM
P | |
| // and 1 = UPnP). Displaying these messages to an end user is only u
seful | | // and 1 = UPnP). Displaying these messages to an end user is only u
seful | |
| // for debugging the UPnP or NAT-PMP implementation. | | // for debugging the UPnP or NAT-PMP implementation. | |
| struct TORRENT_EXPORT portmap_log_alert: alert | | struct TORRENT_EXPORT portmap_log_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| portmap_log_alert(int t, std::string const& m) | | portmap_log_alert(int t, std::string const& m); | |
| : map_type(t), msg(m) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(portmap_log_alert); | | TORRENT_DEFINE_ALERT(portmap_log_alert); | |
| | | | |
| const static int static_category = alert::port_mapping_notif
ication; | | const static int static_category = alert::port_mapping_notif
ication; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| int map_type; | | int map_type; | |
| std::string msg; | | std::string msg; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a fastresume file has been passed to
add_torrent() but the | | // This alert is generated when a fastresume file has been passed to
add_torrent() but the | |
| // files on disk did not match the fastresume file. The error_code e
xplains the reason why the | | // files on disk did not match the fastresume file. The error_code e
xplains the reason why the | |
| // resume file was rejected. | | // resume file was rejected. | |
| struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert | | struct TORRENT_EXPORT fastresume_rejected_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| fastresume_rejected_alert(torrent_handle const& h | | fastresume_rejected_alert(torrent_handle const& h | |
|
| , error_code const& e) | | , 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); | | TORRENT_DEFINE_ALERT(fastresume_rejected_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n | | const static int static_category = alert::status_notificatio
n | |
| | alert::error_notification; | | | alert::error_notification; | |
|
| virtual std::string message() const | | virtual std::string message() const; | |
| { return torrent_alert::message() + " fast resume rejected: | | | |
| " + convert_from_native(error.message()); } | | | |
| | | | |
| error_code error; | | error_code error; | |
| | | | |
| #ifndef TORRENT_NO_DEPRECATE | | #ifndef TORRENT_NO_DEPRECATE | |
| std::string msg; | | std::string msg; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| // This alert is posted when an incoming peer connection, or a peer
that's about to be added | | // This alert is posted when an incoming peer connection, or a peer
that's about to be added | |
| // to our peer list, is blocked for some reason. This could be any o
f: | | // to our peer list, is blocked for some reason. This could be any o
f: | |
| // | | // | |
| // * the IP filter | | // * the IP filter | |
| // * i2p mixed mode restrictions (a normal peer is not allowed on an
i2p swarm) | | // * i2p mixed mode restrictions (a normal peer is not allowed on an
i2p swarm) | |
| // * the port filter | | // * the port filter | |
| // * the peer has a low port and ``no_connect_privileged_ports`` is
enabled | | // * the peer has a low port and ``no_connect_privileged_ports`` is
enabled | |
| // * the protocol of the peer is blocked (uTP/TCP blocking) | | // * the protocol of the peer is blocked (uTP/TCP blocking) | |
| struct TORRENT_EXPORT peer_blocked_alert: torrent_alert | | struct TORRENT_EXPORT peer_blocked_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| peer_blocked_alert(torrent_handle const& h, address const& i | | peer_blocked_alert(torrent_handle const& h, address const& i | |
|
| , int r) | | , int r); | |
| : torrent_alert(h) | | | |
| , ip(i) | | | |
| , reason(r) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(peer_blocked_alert); | | TORRENT_DEFINE_ALERT(peer_blocked_alert); | |
| | | | |
| const static int static_category = alert::ip_block_notificat
ion; | | const static int static_category = alert::ip_block_notificat
ion; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the address that was blocked. | | // the address that was blocked. | |
| address ip; | | address ip; | |
| | | | |
| enum reason_t | | enum reason_t | |
| | | | |
| skipping to change at line 1526 | | skipping to change at line 1269 | |
| | | | |
| int reason; | | int reason; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a DHT node announces to an info-hash
on our | | // This alert is generated when a DHT node announces to an info-hash
on our | |
| // DHT node. It belongs to the ``dht_notification`` category. | | // DHT node. It belongs to the ``dht_notification`` category. | |
| struct TORRENT_EXPORT dht_announce_alert: alert | | struct TORRENT_EXPORT dht_announce_alert: alert | |
| { | | { | |
| // internal | | // internal | |
| dht_announce_alert(address const& i, int p | | dht_announce_alert(address const& i, int p | |
|
| , sha1_hash const& ih) | | , sha1_hash const& ih); | |
| : ip(i) | | | |
| , port(p) | | | |
| , info_hash(ih) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_announce_alert); | | TORRENT_DEFINE_ALERT(dht_announce_alert); | |
| | | | |
| const static int static_category = alert::dht_notification; | | const static int static_category = alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| address ip; | | address ip; | |
| int port; | | int port; | |
| sha1_hash info_hash; | | sha1_hash info_hash; | |
| }; | | }; | |
| | | | |
| // This alert is generated when a DHT node sends a ``get_peers`` mes
sage to | | // This alert is generated when a DHT node sends a ``get_peers`` mes
sage to | |
| // our DHT node. It belongs to the ``dht_notification`` category. | | // our DHT node. It belongs to the ``dht_notification`` category. | |
| struct TORRENT_EXPORT dht_get_peers_alert: alert | | struct TORRENT_EXPORT dht_get_peers_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| dht_get_peers_alert(sha1_hash const& ih) | | dht_get_peers_alert(sha1_hash const& ih); | |
| : info_hash(ih) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_get_peers_alert); | | TORRENT_DEFINE_ALERT(dht_get_peers_alert); | |
| | | | |
| const static int static_category = alert::dht_notification; | | const static int static_category = alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| sha1_hash info_hash; | | sha1_hash info_hash; | |
| }; | | }; | |
| | | | |
| // This alert is posted approximately once every second, and it cont
ains | | // This alert is posted approximately once every second, and it cont
ains | |
| | | | |
| skipping to change at line 1624 | | skipping to change at line 1361 | |
| }; | | }; | |
| | | | |
| // This alert is posted when a bittorrent feature is blocked because
of the | | // This alert is posted when a bittorrent feature is blocked because
of the | |
| // anonymous mode. For instance, if the tracker proxy is not set up,
no | | // anonymous mode. For instance, if the tracker proxy is not set up,
no | |
| // trackers will be used, because trackers can only be used through
proxies | | // trackers will be used, because trackers can only be used through
proxies | |
| // when in anonymous mode. | | // when in anonymous mode. | |
| struct TORRENT_EXPORT anonymous_mode_alert: torrent_alert | | struct TORRENT_EXPORT anonymous_mode_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| anonymous_mode_alert(torrent_handle const& h | | anonymous_mode_alert(torrent_handle const& h | |
|
| , int k, std::string const& s) | | , int k, std::string const& s); | |
| : torrent_alert(h) | | | |
| , kind(k) | | | |
| , str(s) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(anonymous_mode_alert); | | TORRENT_DEFINE_ALERT(anonymous_mode_alert); | |
| | | | |
| const static int static_category = alert::error_notification
; | | const static int static_category = alert::error_notification
; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| enum kind_t | | enum kind_t | |
| { | | { | |
| // means that there's no proxy set up for tracker | | // means that there's no proxy set up for tracker | |
| // communication and the tracker will not be contact
ed. | | // communication and the tracker will not be contact
ed. | |
| | | | |
| skipping to change at line 1654 | | skipping to change at line 1387 | |
| int kind; | | int kind; | |
| std::string str; | | std::string str; | |
| }; | | }; | |
| | | | |
| // This alert is generated when we receive a local service discovery
message | | // This alert is generated when we receive a local service discovery
message | |
| // from a peer for a torrent we're currently participating in. | | // from a peer for a torrent we're currently participating in. | |
| struct TORRENT_EXPORT lsd_peer_alert: peer_alert | | struct TORRENT_EXPORT lsd_peer_alert: peer_alert | |
| { | | { | |
| // internal | | // internal | |
| lsd_peer_alert(torrent_handle const& h | | lsd_peer_alert(torrent_handle const& h | |
|
| , tcp::endpoint const& i) | | , tcp::endpoint const& i); | |
| : peer_alert(h, i, peer_id(0)) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(lsd_peer_alert); | | TORRENT_DEFINE_ALERT(lsd_peer_alert); | |
| | | | |
| const static int static_category = alert::peer_notification; | | const static int static_category = alert::peer_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| }; | | }; | |
| | | | |
| // This alert is posted whenever a tracker responds with a ``tracker
id``. | | // This alert is posted whenever a tracker responds with a ``tracker
id``. | |
| // The tracker ID is like a cookie. The libtorrent will store the tr
acker ID | | // The tracker ID is like a cookie. The libtorrent will store the tr
acker ID | |
| // for this tracker and repeat it in subsequent announces. | | // for this tracker and repeat it in subsequent announces. | |
| struct TORRENT_EXPORT trackerid_alert: tracker_alert | | struct TORRENT_EXPORT trackerid_alert: tracker_alert | |
| { | | { | |
| // internal | | // internal | |
| trackerid_alert(torrent_handle const& h | | trackerid_alert(torrent_handle const& h | |
| , std::string const& u | | , std::string const& u | |
|
| , const std::string& id) | | , const std::string& id); | |
| : tracker_alert(h, u) | | | |
| , trackerid(id) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(trackerid_alert); | | TORRENT_DEFINE_ALERT(trackerid_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // The tracker ID returned by the tracker | | // The tracker ID returned by the tracker | |
| std::string trackerid; | | std::string trackerid; | |
| }; | | }; | |
| | | | |
| // This alert is posted when the initial DHT bootstrap is done. | | // This alert is posted when the initial DHT bootstrap is done. | |
| struct TORRENT_EXPORT dht_bootstrap_alert: alert | | struct TORRENT_EXPORT dht_bootstrap_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| dht_bootstrap_alert() {} | | dht_bootstrap_alert(); | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_bootstrap_alert); | | TORRENT_DEFINE_ALERT(dht_bootstrap_alert); | |
| | | | |
| const static int static_category = alert::dht_notification; | | const static int static_category = alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| }; | | }; | |
| | | | |
| // This alert is posted on RSS feed events such as start of RSS feed
updates, | | // This alert is posted on RSS feed events such as start of RSS feed
updates, | |
| // successful completed updates and errors during updates. | | // successful completed updates and errors during updates. | |
| // | | // | |
| // This alert is only posted if the ``rss_notifications`` category i
s enabled | | // This alert is only posted if the ``rss_notifications`` category i
s enabled | |
| // in the alert_mask. | | // in the alert_mask. | |
| struct TORRENT_EXPORT rss_alert: alert | | struct TORRENT_EXPORT rss_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| rss_alert(feed_handle h, std::string const& u, int s, error_ | | rss_alert(feed_handle h, std::string const& u, int s, error_ | |
| code const& ec) | | code const& ec); | |
| : handle(h), url(u), state(s), error(ec) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(rss_alert); | | TORRENT_DEFINE_ALERT(rss_alert); | |
| | | | |
| const static int static_category = alert::rss_notification; | | const static int static_category = alert::rss_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| enum state_t | | enum state_t | |
| { | | { | |
| // An update of this feed was just initiated, it wil
l either succeed | | // An update of this feed was just initiated, it wil
l either succeed | |
| // or fail soon. | | // or fail soon. | |
| | | | |
| skipping to change at line 1750 | | skipping to change at line 1476 | |
| | | | |
| // an error code used for when an error occurs on the feed. | | // an error code used for when an error occurs on the feed. | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| // This is posted whenever a torrent is transitioned into the error
state. | | // This is posted whenever a torrent is transitioned into the error
state. | |
| struct TORRENT_EXPORT torrent_error_alert: torrent_alert | | struct TORRENT_EXPORT torrent_error_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
| torrent_error_alert(torrent_handle const& h | | torrent_error_alert(torrent_handle const& h | |
|
| , error_code const& e) | | , error_code const& e); | |
| : torrent_alert(h) | | | |
| , error(e) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_error_alert); | | TORRENT_DEFINE_ALERT(torrent_error_alert); | |
| | | | |
| const static int static_category = alert::error_notification
| alert::status_notification; | | const static int static_category = alert::error_notification
| alert::status_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // specifies which error the torrent encountered. | | // specifies which error the torrent encountered. | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| // This is always posted for SSL torrents. This is a reminder to the
client that | | // This is always posted for SSL torrents. This is a reminder to the
client that | |
| // the torrent won't work unless torrent_handle::set_ssl_certificate
() is called with | | // the torrent won't work unless torrent_handle::set_ssl_certificate
() is called with | |
| // a valid certificate. Valid certificates MUST be signed by the SSL
certificate | | // a valid certificate. Valid certificates MUST be signed by the SSL
certificate | |
| // in the .torrent file. | | // in the .torrent file. | |
| struct TORRENT_EXPORT torrent_need_cert_alert: torrent_alert | | struct TORRENT_EXPORT torrent_need_cert_alert: torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_need_cert_alert(torrent_handle const& h) | | torrent_need_cert_alert(torrent_handle const& h); | |
| : torrent_alert(h) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_need_cert_alert); | | TORRENT_DEFINE_ALERT(torrent_need_cert_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| // The incoming connection alert is posted every time we successfull
y accept | | // The incoming connection alert is posted every time we successfull
y accept | |
| // an incoming connection, through any mean. The most straigh-forwar
d ways | | // an incoming connection, through any mean. The most straigh-forwar
d ways | |
| // of accepting incoming connections are through the TCP listen sock
et and | | // of accepting incoming connections are through the TCP listen sock
et and | |
| // the UDP listen socket for uTP sockets. However, connections may a
lso be | | // the UDP listen socket for uTP sockets. However, connections may a
lso be | |
| // accepted ofer a Socks5 or i2p listen socket, or via a torrent spe
cific | | // accepted ofer a Socks5 or i2p listen socket, or via a torrent spe
cific | |
| // listen socket for SSL torrents. | | // listen socket for SSL torrents. | |
| struct TORRENT_EXPORT incoming_connection_alert: alert | | struct TORRENT_EXPORT incoming_connection_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| incoming_connection_alert(int t, tcp::endpoint const& i) | | incoming_connection_alert(int t, tcp::endpoint const& i); | |
| : socket_type(t) | | | |
| , ip(i) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(incoming_connection_alert); | | TORRENT_DEFINE_ALERT(incoming_connection_alert); | |
| | | | |
| const static int static_category = alert::peer_notification; | | const static int static_category = alert::peer_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // tells you what kind of socket the connection was accepted | | // tells you what kind of socket the connection was accepted | |
| // as: | | // as: | |
| // | | // | |
| // 0. none (no socket instantiated) | | // 0. none (no socket instantiated) | |
| | | | |
| skipping to change at line 1830 | | skipping to change at line 1548 | |
| tcp::endpoint ip; | | tcp::endpoint ip; | |
| }; | | }; | |
| | | | |
| // This alert is always posted when a torrent was attempted to be ad
ded | | // This alert is always posted when a torrent was attempted to be ad
ded | |
| // and contains the return status of the add operation. The torrent
handle of the new | | // and contains the return status of the add operation. The torrent
handle of the new | |
| // torrent can be found in the base class' ``handle`` member. If add
ing | | // torrent can be found in the base class' ``handle`` member. If add
ing | |
| // the torrent failed, ``error`` contains the error code. | | // the torrent failed, ``error`` contains the error code. | |
| struct TORRENT_EXPORT add_torrent_alert : torrent_alert | | struct TORRENT_EXPORT add_torrent_alert : torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| add_torrent_alert(torrent_handle h, add_torrent_params const | | add_torrent_alert(torrent_handle h, add_torrent_params const | |
| & p, error_code ec) | | & p, error_code ec); | |
| : torrent_alert(h) | | | |
| , params(p) | | | |
| , error(ec) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(add_torrent_alert); | | TORRENT_DEFINE_ALERT(add_torrent_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // a copy of the parameters used when adding the torrent, it
can be used | | // a copy of the parameters used when adding the torrent, it
can be used | |
| // to identify which invocation to ``async_add_torrent()`` c
aused this alert. | | // to identify which invocation to ``async_add_torrent()`` c
aused this alert. | |
| add_torrent_params params; | | add_torrent_params params; | |
| | | | |
| skipping to change at line 1878 | | skipping to change at line 1592 | |
| | | | |
| // When a torrent changes its info-hash, this alert is posted. This
only happens in very | | // When a torrent changes its info-hash, this alert is posted. This
only happens in very | |
| // specific cases. For instance, when a torrent is downloaded from a
URL, the true info | | // specific cases. For instance, when a torrent is downloaded from a
URL, the true info | |
| // hash is not known immediately. First the .torrent file must be do
wnloaded and parsed. | | // hash is not known immediately. First the .torrent file must be do
wnloaded and parsed. | |
| // | | // | |
| // Once this download completes, the ``torrent_update_alert`` is pos
ted to notify the client | | // Once this download completes, the ``torrent_update_alert`` is pos
ted to notify the client | |
| // of the info-hash changing. | | // of the info-hash changing. | |
| struct TORRENT_EXPORT torrent_update_alert : torrent_alert | | struct TORRENT_EXPORT torrent_update_alert : torrent_alert | |
| { | | { | |
| // internal | | // internal | |
|
| torrent_update_alert(torrent_handle h, sha1_hash const& old_ | | torrent_update_alert(torrent_handle h, sha1_hash const& old_ | |
| hash, sha1_hash const& new_hash) | | hash, sha1_hash const& new_hash); | |
| : torrent_alert(h) | | | |
| , old_ih(old_hash) | | | |
| , new_ih(new_hash) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(torrent_update_alert); | | TORRENT_DEFINE_ALERT(torrent_update_alert); | |
| | | | |
| const static int static_category = alert::status_notificatio
n; | | const static int static_category = alert::status_notificatio
n; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // ``old_ih`` and ``new_ih`` are the previous and new info-h
ash for the torrent, respectively. | | // ``old_ih`` and ``new_ih`` are the previous and new info-h
ash for the torrent, respectively. | |
| sha1_hash old_ih; | | sha1_hash old_ih; | |
| sha1_hash new_ih; | | sha1_hash new_ih; | |
| }; | | }; | |
| | | | |
| // This alert is posted every time a new RSS item (i.e. torrent) is
received | | // This alert is posted every time a new RSS item (i.e. torrent) is
received | |
| // from an RSS feed. | | // from an RSS feed. | |
| // | | // | |
| // It is only posted if the ``rss_notifications`` category is enable
d in the | | // It is only posted if the ``rss_notifications`` category is enable
d in the | |
| // alert_mask. | | // alert_mask. | |
| struct TORRENT_EXPORT rss_item_alert : alert | | struct TORRENT_EXPORT rss_item_alert : alert | |
| { | | { | |
| // internal | | // internal | |
|
| rss_item_alert(feed_handle h, feed_item const& item) | | rss_item_alert(feed_handle h, feed_item const& item); | |
| : handle(h) | | | |
| , item(item) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(rss_item_alert); | | TORRENT_DEFINE_ALERT(rss_item_alert); | |
| | | | |
| const static int static_category = alert::rss_notification; | | const static int static_category = alert::rss_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| feed_handle handle; | | feed_handle handle; | |
| feed_item item; | | feed_item item; | |
| }; | | }; | |
| | | | |
| // posted when something fails in the DHT. This is not necessarily a
fatal | | // posted when something fails in the DHT. This is not necessarily a
fatal | |
| // error, but it could prevent proper operation | | // error, but it could prevent proper operation | |
| struct TORRENT_EXPORT dht_error_alert: alert | | struct TORRENT_EXPORT dht_error_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| dht_error_alert(int op, error_code const& ec) | | dht_error_alert(int op, error_code const& ec); | |
| : error(ec), operation(op_t(op)) {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_error_alert); | | TORRENT_DEFINE_ALERT(dht_error_alert); | |
| | | | |
| const static int static_category = alert::error_notification | | const static int static_category = alert::error_notification | |
| | alert::dht_notification; | | | alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the error code | | // the error code | |
| error_code error; | | error_code error; | |
| | | | |
| | | | |
| skipping to change at line 1948 | | skipping to change at line 1654 | |
| }; | | }; | |
| | | | |
| // the operation that failed | | // the operation that failed | |
| op_t operation; | | op_t operation; | |
| }; | | }; | |
| | | | |
| // this alert is posted as a response to a call to session::get_item
(), | | // this alert is posted as a response to a call to session::get_item
(), | |
| // specifically the overload for looking up immutable items in the D
HT. | | // specifically the overload for looking up immutable items in the D
HT. | |
| struct TORRENT_EXPORT dht_immutable_item_alert: alert | | struct TORRENT_EXPORT dht_immutable_item_alert: alert | |
| { | | { | |
|
| dht_immutable_item_alert(sha1_hash const& t, entry const& i) | | dht_immutable_item_alert(sha1_hash const& t, entry const& i) | |
| : target(t), item(i) {} | | ; | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_immutable_item_alert); | | TORRENT_DEFINE_ALERT(dht_immutable_item_alert); | |
| | | | |
| const static int static_category = alert::error_notification | | const static int static_category = alert::error_notification | |
| | alert::dht_notification; | | | alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // the target hash of the immutable item. This must | | // the target hash of the immutable item. This must | |
| // match the sha-1 hash of the bencoded form of ``item``. | | // match the sha-1 hash of the bencoded form of ``item``. | |
| | | | |
| skipping to change at line 1974 | | skipping to change at line 1679 | |
| }; | | }; | |
| | | | |
| // this alert is posted as a response to a call to session::get_item
(), | | // this alert is posted as a response to a call to session::get_item
(), | |
| // specifically the overload for looking up mutable items in the DHT
. | | // specifically the overload for looking up mutable items in the DHT
. | |
| struct TORRENT_EXPORT dht_mutable_item_alert: alert | | struct TORRENT_EXPORT dht_mutable_item_alert: alert | |
| { | | { | |
| dht_mutable_item_alert(boost::array<char, 32> k | | dht_mutable_item_alert(boost::array<char, 32> k | |
| , boost::array<char, 64> sig | | , boost::array<char, 64> sig | |
| , boost::uint64_t sequence | | , boost::uint64_t sequence | |
| , std::string const& s | | , std::string const& s | |
|
| , entry const& i) | | , entry const& i); | |
| : key(k), signature(sig), seq(sequence), salt(s), it | | | |
| em(i) {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_mutable_item_alert); | | TORRENT_DEFINE_ALERT(dht_mutable_item_alert); | |
| | | | |
| const static int static_category = alert::error_notification | | const static int static_category = alert::error_notification | |
| | alert::dht_notification; | | | alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| virtual bool discardable() const { return false; } | | virtual bool discardable() const { return false; } | |
| | | | |
| // the public key that was looked up | | // the public key that was looked up | |
| boost::array<char, 32> key; | | boost::array<char, 32> key; | |
| | | | |
| skipping to change at line 2010 | | skipping to change at line 1714 | |
| | | | |
| // the data for this item | | // the data for this item | |
| entry item; | | entry item; | |
| }; | | }; | |
| | | | |
| // this is posted when a DHT put operation completes. This is useful
if the | | // this is posted when a DHT put operation completes. This is useful
if the | |
| // client is waiting for a put to complete before shutting down for
instance. | | // client is waiting for a put to complete before shutting down for
instance. | |
| struct TORRENT_EXPORT dht_put_alert: alert | | struct TORRENT_EXPORT dht_put_alert: alert | |
| { | | { | |
| // internal | | // internal | |
|
| dht_put_alert(sha1_hash const& t) | | dht_put_alert(sha1_hash const& t); | |
| : target(t) | | | |
| , seq(0) | | | |
| {} | | | |
| dht_put_alert(boost::array<char, 32> key | | dht_put_alert(boost::array<char, 32> key | |
| , boost::array<char, 64> sig | | , boost::array<char, 64> sig | |
| , std::string s | | , std::string s | |
|
| , boost::uint64_t sequence_number) | | , boost::uint64_t sequence_number); | |
| : target(0) | | | |
| , public_key(key) | | | |
| , signature(sig) | | | |
| , salt(s) | | | |
| , seq(sequence_number) | | | |
| {} | | | |
| | | | |
| TORRENT_DEFINE_ALERT(dht_put_alert); | | TORRENT_DEFINE_ALERT(dht_put_alert); | |
| | | | |
| const static int static_category = alert::dht_notification; | | const static int static_category = alert::dht_notification; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the target hash the item was stored under if this was an
*immutable* | | // the target hash the item was stored under if this was an
*immutable* | |
| // item. | | // item. | |
| sha1_hash target; | | sha1_hash target; | |
| | | | |
| | | | |
| skipping to change at line 2045 | | skipping to change at line 1740 | |
| // salt and sequence number the item was stored under. | | // salt and sequence number the item was stored under. | |
| boost::array<char, 32> public_key; | | boost::array<char, 32> public_key; | |
| boost::array<char, 64> signature; | | boost::array<char, 64> signature; | |
| std::string salt; | | std::string salt; | |
| boost::uint64_t seq; | | boost::uint64_t seq; | |
| }; | | }; | |
| | | | |
| // this alert is used to report errors in the i2p SAM connection | | // this alert is used to report errors in the i2p SAM connection | |
| struct TORRENT_EXPORT i2p_alert : alert | | struct TORRENT_EXPORT i2p_alert : alert | |
| { | | { | |
|
| i2p_alert(error_code const& ec) : error(ec) {} | | i2p_alert(error_code const& ec); | |
| | | | |
| TORRENT_DEFINE_ALERT(i2p_alert); | | TORRENT_DEFINE_ALERT(i2p_alert); | |
| | | | |
| const static int static_category = alert::error_notification
; | | const static int static_category = alert::error_notification
; | |
| virtual std::string message() const; | | virtual std::string message() const; | |
| | | | |
| // the error that occurred in the i2p SAM connection | | // the error that occurred in the i2p SAM connection | |
| error_code error; | | error_code error; | |
| }; | | }; | |
| | | | |
| | | | |
End of changes. 94 change blocks. |
| 429 lines changed or deleted | | 112 lines changed or added | |
|