diff --git a/docs/manual.rst b/docs/manual.rst index a54949604..68cf927e0 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -5609,425 +5609,8 @@ libtorrent_exception error_code ========== -libtorrent uses boost.system's ``error_code`` class to represent errors. libtorrent has -its own error category (``libtorrent::get_libtorrent_category()``) whith the following error -codes: - -====== ========================================= ================================================================= -code symbol description -====== ========================================= ================================================================= -0 no_error Not an error ------- ----------------------------------------- ----------------------------------------------------------------- -1 file_collision Two torrents has files which end up overwriting each other ------- ----------------------------------------- ----------------------------------------------------------------- -2 failed_hash_check A piece did not match its piece hash ------- ----------------------------------------- ----------------------------------------------------------------- -3 torrent_is_no_dict The .torrent file does not contain a bencoded dictionary at - its top level ------- ----------------------------------------- ----------------------------------------------------------------- -4 torrent_missing_info The .torrent file does not have an ``info`` dictionary ------- ----------------------------------------- ----------------------------------------------------------------- -5 torrent_info_no_dict The .torrent file's ``info`` entry is not a dictionary ------- ----------------------------------------- ----------------------------------------------------------------- -6 torrent_missing_piece_length The .torrent file does not have a ``piece length`` entry ------- ----------------------------------------- ----------------------------------------------------------------- -7 torrent_missing_name The .torrent file does not have a ``name`` entry ------- ----------------------------------------- ----------------------------------------------------------------- -8 torrent_invalid_name The .torrent file's name entry is invalid ------- ----------------------------------------- ----------------------------------------------------------------- -9 torrent_invalid_length The length of a file, or of the whole .torrent file is invalid. - Either negative or not an integer ------- ----------------------------------------- ----------------------------------------------------------------- -10 torrent_file_parse_failed Failed to parse a file entry in the .torrent ------- ----------------------------------------- ----------------------------------------------------------------- -11 torrent_missing_pieces The ``pieces`` field is missing or invalid in the .torrent file ------- ----------------------------------------- ----------------------------------------------------------------- -12 torrent_invalid_hashes The ``pieces`` string has incorrect length ------- ----------------------------------------- ----------------------------------------------------------------- -13 too_many_pieces_in_torrent The .torrent file has more pieces than is supported by libtorrent ------- ----------------------------------------- ----------------------------------------------------------------- -14 invalid_swarm_metadata The metadata (.torrent file) that was received from the swarm - matched the info-hash, but failed to be parsed ------- ----------------------------------------- ----------------------------------------------------------------- -15 invalid_bencoding The file or buffer is not correctly bencoded ------- ----------------------------------------- ----------------------------------------------------------------- -16 no_files_in_torrent The .torrent file does not contain any files ------- ----------------------------------------- ----------------------------------------------------------------- -17 invalid_escaped_string The string was not properly url-encoded as expected ------- ----------------------------------------- ----------------------------------------------------------------- -18 session_is_closing Operation is not permitted since the session is shutting down ------- ----------------------------------------- ----------------------------------------------------------------- -19 duplicate_torrent There's already a torrent with that info-hash added to the - session ------- ----------------------------------------- ----------------------------------------------------------------- -20 invalid_torrent_handle The supplied torrent_handle is not referring to a valid torrent ------- ----------------------------------------- ----------------------------------------------------------------- -21 invalid_entry_type The type requested from the entry did not match its type ------- ----------------------------------------- ----------------------------------------------------------------- -22 missing_info_hash_in_uri The specified URI does not contain a valid info-hash ------- ----------------------------------------- ----------------------------------------------------------------- -23 file_too_short One of the files in the torrent was unexpectadly small. This - might be caused by files being changed by an external process ------- ----------------------------------------- ----------------------------------------------------------------- -24 unsupported_url_protocol The URL used an unknown protocol. Currently ``http`` and - ``https`` (if built with openssl support) are recognized. For - trackers ``udp`` is recognized as well. ------- ----------------------------------------- ----------------------------------------------------------------- -25 url_parse_error The URL did not conform to URL syntax and failed to be parsed ------- ----------------------------------------- ----------------------------------------------------------------- -26 peer_sent_empty_piece The peer sent a 'piece' message of length 0 ------- ----------------------------------------- ----------------------------------------------------------------- -27 parse_failed A bencoded structure was currupt and failed to be parsed ------- ----------------------------------------- ----------------------------------------------------------------- -28 invalid_file_tag The fast resume file was missing or had an invalid file version - tag ------- ----------------------------------------- ----------------------------------------------------------------- -29 missing_info_hash The fast resume file was missing or had an invalid info-hash ------- ----------------------------------------- ----------------------------------------------------------------- -30 mismatching_info_hash The info-hash in the resume file did not match the torrent ------- ----------------------------------------- ----------------------------------------------------------------- -31 invalid_hostname The URL contained an invalid hostname ------- ----------------------------------------- ----------------------------------------------------------------- -32 invalid_port The URL had an invalid port ------- ----------------------------------------- ----------------------------------------------------------------- -33 port_blocked The port is blocked by the port-filter, and prevented the - connection ------- ----------------------------------------- ----------------------------------------------------------------- -34 expected_close_bracket_in_address The IPv6 address was expected to end with ']' ------- ----------------------------------------- ----------------------------------------------------------------- -35 destructing_torrent The torrent is being destructed, preventing the operation to - succeed ------- ----------------------------------------- ----------------------------------------------------------------- -36 timed_out The connection timed out ------- ----------------------------------------- ----------------------------------------------------------------- -37 upload_upload_connection The peer is upload only, and we are upload only. There's no point - in keeping the connection ------- ----------------------------------------- ----------------------------------------------------------------- -38 uninteresting_upload_peer The peer is upload only, and we're not interested in it. There's - no point in keeping the connection ------- ----------------------------------------- ----------------------------------------------------------------- -39 invalid_info_hash The peer sent an unknown info-hash ------- ----------------------------------------- ----------------------------------------------------------------- -40 torrent_paused The torrent is paused, preventing the operation from succeeding ------- ----------------------------------------- ----------------------------------------------------------------- -41 invalid_have The peer sent an invalid have message, either wrong size or - referring to a piece that doesn't exist in the torrent ------- ----------------------------------------- ----------------------------------------------------------------- -42 invalid_bitfield_size The bitfield message had the incorrect size ------- ----------------------------------------- ----------------------------------------------------------------- -43 too_many_requests_when_choked The peer kept requesting pieces after it was choked, possible - abuse attempt. ------- ----------------------------------------- ----------------------------------------------------------------- -44 invalid_piece The peer sent a piece message that does not correspond to a - piece request sent by the client ------- ----------------------------------------- ----------------------------------------------------------------- -45 no_memory memory allocation failed ------- ----------------------------------------- ----------------------------------------------------------------- -46 torrent_aborted The torrent is aborted, preventing the operation to succeed ------- ----------------------------------------- ----------------------------------------------------------------- -47 self_connection The peer is a connection to ourself, no point in keeping it ------- ----------------------------------------- ----------------------------------------------------------------- -48 invalid_piece_size The peer sent a piece message with invalid size, either negative - or greater than one block ------- ----------------------------------------- ----------------------------------------------------------------- -49 timed_out_no_interest The peer has not been interesting or interested in us for too - long, no point in keeping it around ------- ----------------------------------------- ----------------------------------------------------------------- -50 timed_out_inactivity The peer has not said anything in a long time, possibly dead ------- ----------------------------------------- ----------------------------------------------------------------- -51 timed_out_no_handshake The peer did not send a handshake within a reasonable amount of - time, it might not be a bittorrent peer ------- ----------------------------------------- ----------------------------------------------------------------- -52 timed_out_no_request The peer has been unchoked for too long without requesting any - data. It might be lying about its interest in us ------- ----------------------------------------- ----------------------------------------------------------------- -53 invalid_choke The peer sent an invalid choke message ------- ----------------------------------------- ----------------------------------------------------------------- -54 invalid_unchoke The peer send an invalid unchoke message ------- ----------------------------------------- ----------------------------------------------------------------- -55 invalid_interested The peer sent an invalid interested message ------- ----------------------------------------- ----------------------------------------------------------------- -56 invalid_not_interested The peer sent an invalid not-interested message ------- ----------------------------------------- ----------------------------------------------------------------- -57 invalid_request The peer sent an invalid piece request message ------- ----------------------------------------- ----------------------------------------------------------------- -58 invalid_hash_list The peer sent an invalid hash-list message (this is part of the - merkle-torrent extension) ------- ----------------------------------------- ----------------------------------------------------------------- -59 invalid_hash_piece The peer sent an invalid hash-piece message (this is part of the - merkle-torrent extension) ------- ----------------------------------------- ----------------------------------------------------------------- -60 invalid_cancel The peer sent an invalid cancel message ------- ----------------------------------------- ----------------------------------------------------------------- -61 invalid_dht_port The peer sent an invalid DHT port-message ------- ----------------------------------------- ----------------------------------------------------------------- -62 invalid_suggest The peer sent an invalid suggest piece-message ------- ----------------------------------------- ----------------------------------------------------------------- -63 invalid_have_all The peer sent an invalid have all-message ------- ----------------------------------------- ----------------------------------------------------------------- -64 invalid_have_none The peer sent an invalid have none-message ------- ----------------------------------------- ----------------------------------------------------------------- -65 invalid_reject The peer sent an invalid reject message ------- ----------------------------------------- ----------------------------------------------------------------- -66 invalid_allow_fast The peer sent an invalid allow fast-message ------- ----------------------------------------- ----------------------------------------------------------------- -67 invalid_extended The peer sent an invalid extesion message ID ------- ----------------------------------------- ----------------------------------------------------------------- -68 invalid_message The peer sent an invalid message ID ------- ----------------------------------------- ----------------------------------------------------------------- -69 sync_hash_not_found The synchronization hash was not found in the encrypted handshake ------- ----------------------------------------- ----------------------------------------------------------------- -70 invalid_encryption_constant The encryption constant in the handshake is invalid ------- ----------------------------------------- ----------------------------------------------------------------- -71 no_plaintext_mode The peer does not support plaintext, which is the selected mode ------- ----------------------------------------- ----------------------------------------------------------------- -72 no_rc4_mode The peer does not support rc4, which is the selected mode ------- ----------------------------------------- ----------------------------------------------------------------- -73 unsupported_encryption_mode The peer does not support any of the encryption modes that the - client supports ------- ----------------------------------------- ----------------------------------------------------------------- -74 unsupported_encryption_mode_selected The peer selected an encryption mode that the client did not - advertise and does not support ------- ----------------------------------------- ----------------------------------------------------------------- -75 invalid_pad_size The pad size used in the encryption handshake is of invalid size ------- ----------------------------------------- ----------------------------------------------------------------- -76 invalid_encrypt_handshake The encryption handshake is invalid ------- ----------------------------------------- ----------------------------------------------------------------- -77 no_incoming_encrypted The client is set to not support incoming encrypted connections - and this is an encrypted connection ------- ----------------------------------------- ----------------------------------------------------------------- -78 no_incoming_regular The client is set to not support incoming regular bittorrent - connections, and this is a regular connection ------- ----------------------------------------- ----------------------------------------------------------------- -79 duplicate_peer_id The client is already connected to this peer-ID ------- ----------------------------------------- ----------------------------------------------------------------- -80 torrent_removed Torrent was removed ------- ----------------------------------------- ----------------------------------------------------------------- -81 packet_too_large The packet size exceeded the upper sanity check-limit ------- ----------------------------------------- ----------------------------------------------------------------- -82 reserved ------- ----------------------------------------- ----------------------------------------------------------------- -83 http_error The web server responded with an error ------- ----------------------------------------- ----------------------------------------------------------------- -84 missing_location The web server response is missing a location header ------- ----------------------------------------- ----------------------------------------------------------------- -85 invalid_redirection The web seed redirected to a path that no longer matches the - .torrent directory structure ------- ----------------------------------------- ----------------------------------------------------------------- -86 redirecting The connection was closed becaused it redirected to a different - URL ------- ----------------------------------------- ----------------------------------------------------------------- -87 invalid_range The HTTP range header is invalid ------- ----------------------------------------- ----------------------------------------------------------------- -88 no_content_length The HTTP response did not have a content length ------- ----------------------------------------- ----------------------------------------------------------------- -89 banned_by_ip_filter The IP is blocked by the IP filter ------- ----------------------------------------- ----------------------------------------------------------------- -90 too_many_connections At the connection limit ------- ----------------------------------------- ----------------------------------------------------------------- -91 peer_banned The peer is marked as banned ------- ----------------------------------------- ----------------------------------------------------------------- -92 stopping_torrent The torrent is stopping, causing the operation to fail ------- ----------------------------------------- ----------------------------------------------------------------- -93 too_many_corrupt_pieces The peer has sent too many corrupt pieces and is banned ------- ----------------------------------------- ----------------------------------------------------------------- -94 torrent_not_ready The torrent is not ready to receive peers ------- ----------------------------------------- ----------------------------------------------------------------- -95 peer_not_constructed The peer is not completely constructed yet ------- ----------------------------------------- ----------------------------------------------------------------- -96 session_closing The session is closing, causing the operation to fail ------- ----------------------------------------- ----------------------------------------------------------------- -97 optimistic_disconnect The peer was disconnected in order to leave room for a - potentially better peer ------- ----------------------------------------- ----------------------------------------------------------------- -98 torrent_finished The torrent is finished ------- ----------------------------------------- ----------------------------------------------------------------- -99 no_router No UPnP router found ------- ----------------------------------------- ----------------------------------------------------------------- -100 metadata_too_large The metadata message says the metadata exceeds the limit ------- ----------------------------------------- ----------------------------------------------------------------- -101 invalid_metadata_request The peer sent an invalid metadata request message ------- ----------------------------------------- ----------------------------------------------------------------- -102 invalid_metadata_size The peer advertised an invalid metadata size ------- ----------------------------------------- ----------------------------------------------------------------- -103 invalid_metadata_offset The peer sent a message with an invalid metadata offset ------- ----------------------------------------- ----------------------------------------------------------------- -104 invalid_metadata_message The peer sent an invalid metadata message ------- ----------------------------------------- ----------------------------------------------------------------- -105 pex_message_too_large The peer sent a peer exchange message that was too large ------- ----------------------------------------- ----------------------------------------------------------------- -106 invalid_pex_message The peer sent an invalid peer exchange message ------- ----------------------------------------- ----------------------------------------------------------------- -107 invalid_lt_tracker_message The peer sent an invalid tracker exchange message ------- ----------------------------------------- ----------------------------------------------------------------- -108 too_frequent_pex The peer sent an pex messages too often. This is a possible - attempt of and attack ------- ----------------------------------------- ----------------------------------------------------------------- -109 no_metadata The operation failed because it requires the torrent to have - the metadata (.torrent file) and it doesn't have it yet. - This happens for magnet links before they have downloaded the - metadata, and also torrents added by URL. ------- ----------------------------------------- ----------------------------------------------------------------- -110 invalid_dont_have The peer sent an invalid ``dont_have`` message. The dont have - message is an extension to allow peers to advertise that the - no longer has a piece they previously had. ------- ----------------------------------------- ----------------------------------------------------------------- -111 requires_ssl_connection The peer tried to connect to an SSL torrent without connecting - over SSL. ------- ----------------------------------------- ----------------------------------------------------------------- -112 invalid_ssl_cert The peer tried to connect to a torrent with a certificate - for a different torrent. -====== ========================================= ================================================================= - -NAT-PMP errors: - -====== ========================================= ================================================================= -code symbol description -====== ========================================= ================================================================= -120 unsupported_protocol_version The NAT-PMP router responded with an unsupported protocol version ------- ----------------------------------------- ----------------------------------------------------------------- -121 natpmp_not_authorized You are not authorized to map ports on this NAT-PMP router ------- ----------------------------------------- ----------------------------------------------------------------- -122 network_failure The NAT-PMP router failed because of a network failure ------- ----------------------------------------- ----------------------------------------------------------------- -123 no_resources The NAT-PMP router failed because of lack of resources ------- ----------------------------------------- ----------------------------------------------------------------- -124 unsupported_opcode The NAT-PMP router failed because an unsupported opcode was sent -====== ========================================= ================================================================= - -fastresume data errors: - -====== ========================================= ================================================================= -code symbol description -====== ========================================= ================================================================= -130 missing_file_sizes The resume data file is missing the 'file sizes' entry ------- ----------------------------------------- ----------------------------------------------------------------- -131 no_files_in_resume_data The resume data file 'file sizes' entry is empty ------- ----------------------------------------- ----------------------------------------------------------------- -132 missing_pieces The resume data file is missing the 'pieces' and 'slots' entry ------- ----------------------------------------- ----------------------------------------------------------------- -133 mismatching_number_of_files The number of files in the resume data does not match the number - of files in the torrent ------- ----------------------------------------- ----------------------------------------------------------------- -134 mismatching_files_size One of the files on disk has a different size than in the fast - resume file ------- ----------------------------------------- ----------------------------------------------------------------- -135 mismatching_file_timestamp One of the files on disk has a different timestamp than in the - fast resume file ------- ----------------------------------------- ----------------------------------------------------------------- -136 not_a_dictionary The resume data file is not a dictionary ------- ----------------------------------------- ----------------------------------------------------------------- -137 invalid_blocks_per_piece The 'blocks per piece' entry is invalid in the resume data file ------- ----------------------------------------- ----------------------------------------------------------------- -138 missing_slots The resume file is missing the 'slots' entry, which is required - for torrents with compact allocation ------- ----------------------------------------- ----------------------------------------------------------------- -139 too_many_slots The resume file contains more slots than the torrent ------- ----------------------------------------- ----------------------------------------------------------------- -140 invalid_slot_list The 'slot' entry is invalid in the resume data ------- ----------------------------------------- ----------------------------------------------------------------- -141 invalid_piece_index One index in the 'slot' list is invalid ------- ----------------------------------------- ----------------------------------------------------------------- -142 pieces_need_reorder The pieces on disk needs to be re-ordered for the specified - allocation mode. This happens if you specify sparse allocation - and the files on disk are using compact storage. The pieces needs - to be moved to their right position -====== ========================================= ================================================================= - -HTTP errors: - -====== ========================================= ================================================================= -150 http_parse_error The HTTP header was not correctly formatted ------- ----------------------------------------- ----------------------------------------------------------------- -151 http_missing_location The HTTP response was in the 300-399 range but lacked a location - header ------- ----------------------------------------- ----------------------------------------------------------------- -152 http_failed_decompress The HTTP response was encoded with gzip or deflate but - decompressing it failed -====== ========================================= ================================================================= - -I2P errors: - -====== ========================================= ================================================================= -160 no_i2p_router The URL specified an i2p address, but no i2p router is configured -====== ========================================= ================================================================= - -tracker errors: - -====== ========================================= ================================================================= -170 scrape_not_available The tracker URL doesn't support transforming it into a scrape - URL. i.e. it doesn't contain "announce. ------- ----------------------------------------- ----------------------------------------------------------------- -171 invalid_tracker_response invalid tracker response ------- ----------------------------------------- ----------------------------------------------------------------- -172 invalid_peer_dict invalid peer dictionary entry. Not a dictionary ------- ----------------------------------------- ----------------------------------------------------------------- -173 tracker_failure tracker sent a failure message ------- ----------------------------------------- ----------------------------------------------------------------- -174 invalid_files_entry missing or invalid 'files' entry ------- ----------------------------------------- ----------------------------------------------------------------- -175 invalid_hash_entry missing or invalid 'hash' entry ------- ----------------------------------------- ----------------------------------------------------------------- -176 invalid_peers_entry missing or invalid 'peers' and 'peers6' entry ------- ----------------------------------------- ----------------------------------------------------------------- -177 invalid_tracker_response_length udp tracker response packet has invalid size ------- ----------------------------------------- ----------------------------------------------------------------- -178 invalid_tracker_transaction_id invalid transaction id in udp tracker response ------- ----------------------------------------- ----------------------------------------------------------------- -179 invalid_tracker_action invalid action field in udp tracker response ------- ----------------------------------------- ----------------------------------------------------------------- -190 expected_string expected string in bencoded string ------- ----------------------------------------- ----------------------------------------------------------------- -191 expected_colon expected colon in bencoded string ------- ----------------------------------------- ----------------------------------------------------------------- -192 unexpected_eof unexpected end of file in bencoded string ------- ----------------------------------------- ----------------------------------------------------------------- -193 expected_value expected value (list, dict, int or string) in bencoded string ------- ----------------------------------------- ----------------------------------------------------------------- -194 depth_exceeded bencoded recursion depth limit exceeded ------- ----------------------------------------- ----------------------------------------------------------------- -195 item_limit_exceeded bencoded item count limit exceeded -====== ========================================= ================================================================= - The names of these error codes are declared in then ``libtorrent::errors`` namespace. -There is also another error category, ``libtorrent::upnp_category``, defining errors -retrned by UPnP routers. Here's a (possibly incomplete) list of UPnP error codes: - -====== ========================================= ==================================================== -code symbol description -====== ========================================= ==================================================== -0 no_error No error ------- ----------------------------------------- ---------------------------------------------------- -402 invalid_argument One of the arguments in the request is invalid ------- ----------------------------------------- ---------------------------------------------------- -501 action_failed The request failed ------- ----------------------------------------- ---------------------------------------------------- -714 value_not_in_array The specified value does not exist in the array ------- ----------------------------------------- ---------------------------------------------------- -715 source_ip_cannot_be_wildcarded The source IP address cannot be wild-carded, but - must be fully specified ------- ----------------------------------------- ---------------------------------------------------- -716 external_port_cannot_be_wildcarded The external port cannot be wildcarded, but must - be specified ------- ----------------------------------------- ---------------------------------------------------- -718 port_mapping_conflict The port mapping entry specified conflicts with a - mapping assigned previously to another client ------- ----------------------------------------- ---------------------------------------------------- -724 internal_port_must_match_external Internal and external port value must be the same ------- ----------------------------------------- ---------------------------------------------------- -725 only_permanent_leases_supported The NAT implementation only supports permanent - lease times on port mappings ------- ----------------------------------------- ---------------------------------------------------- -726 remote_host_must_be_wildcard RemoteHost must be a wildcard and cannot be a - specific IP addres or DNS name ------- ----------------------------------------- ---------------------------------------------------- -727 external_port_must_be_wildcard ExternalPort must be a wildcard and cannot be a - specific port -====== ========================================= ==================================================== - -The UPnP errors are declared in the ``libtorrent::upnp_errors`` namespace. - HTTP errors are reported in the ``libtorrent::http_category``, with error code enums in the ``libtorrent::errors`` namespace. diff --git a/include/libtorrent/error_code.hpp b/include/libtorrent/error_code.hpp index d230ad56b..c7b92b597 100644 --- a/include/libtorrent/error_code.hpp +++ b/include/libtorrent/error_code.hpp @@ -55,217 +55,378 @@ namespace libtorrent namespace errors { + // libtorrent uses boost.system's ``error_code`` class to represent errors. libtorrent has + // its own error category get_libtorrent_category() whith the error codes defined by error_code_enum. enum error_code_enum { + // Not an error no_error = 0, + // Two torrents has files which end up overwriting each other file_collision, + // A piece did not match its piece hash failed_hash_check, + // The .torrent file does not contain a bencoded dictionary at + // its top level torrent_is_no_dict, + // The .torrent file does not have an ``info`` dictionary torrent_missing_info, + // The .torrent file's ``info`` entry is not a dictionary torrent_info_no_dict, + // The .torrent file does not have a ``piece length`` entry torrent_missing_piece_length, + // The .torrent file does not have a ``name`` entry torrent_missing_name, + // The .torrent file's name entry is invalid torrent_invalid_name, + // The length of a file, or of the whole .torrent file is invalid. + // Either negative or not an integer torrent_invalid_length, + // Failed to parse a file entry in the .torrent torrent_file_parse_failed, + // The ``pieces`` field is missing or invalid in the .torrent file torrent_missing_pieces, + // The ``pieces`` string has incorrect length torrent_invalid_hashes, + // The .torrent file has more pieces than is supported by libtorrent too_many_pieces_in_torrent, + // The metadata (.torrent file) that was received from the swarm + // matched the info-hash, but failed to be parsed invalid_swarm_metadata, + // The file or buffer is not correctly bencoded invalid_bencoding, + // The .torrent file does not contain any files no_files_in_torrent, + // The string was not properly url-encoded as expected invalid_escaped_string, + // Operation is not permitted since the session is shutting down session_is_closing, + // There's already a torrent with that info-hash added to the + // session duplicate_torrent, + // The supplied torrent_handle is not referring to a valid torrent invalid_torrent_handle, + // The type requested from the entry did not match its type invalid_entry_type, + // The specified URI does not contain a valid info-hash missing_info_hash_in_uri, + // One of the files in the torrent was unexpectadly small. This + // might be caused by files being changed by an external process file_too_short, + // The URL used an unknown protocol. Currently ``http`` and + // ``https`` (if built with openssl support) are recognized. For + // trackers ``udp`` is recognized as well. unsupported_url_protocol, + // The URL did not conform to URL syntax and failed to be parsed url_parse_error, + // The peer sent a 'piece' message of length 0 peer_sent_empty_piece, + // A bencoded structure was currupt and failed to be parsed parse_failed, + // The fast resume file was missing or had an invalid file version + // tag invalid_file_tag, + // The fast resume file was missing or had an invalid info-hash missing_info_hash, + // The info-hash in the resume file did not match the torrent mismatching_info_hash, + // The URL contained an invalid hostname invalid_hostname, + // The URL had an invalid port invalid_port, + // The port is blocked by the port-filter, and prevented the + // connection port_blocked, + // The IPv6 address was expected to end with ']' expected_close_bracket_in_address, + // The torrent is being destructed, preventing the operation to + // succeed destructing_torrent, + // The connection timed out timed_out, + // The peer is upload only, and we are upload only. There's no point + // in keeping the connection upload_upload_connection, + // The peer is upload only, and we're not interested in it. There's + // no point in keeping the connection uninteresting_upload_peer, + // The peer sent an unknown info-hash invalid_info_hash, + // The torrent is paused, preventing the operation from succeeding torrent_paused, + // The peer sent an invalid have message, either wrong size or + // referring to a piece that doesn't exist in the torrent invalid_have, + // The bitfield message had the incorrect size invalid_bitfield_size, + // The peer kept requesting pieces after it was choked, possible + // abuse attempt. too_many_requests_when_choked, + // The peer sent a piece message that does not correspond to a + // piece request sent by the client invalid_piece, + // memory allocation failed no_memory, + // The torrent is aborted, preventing the operation to succeed torrent_aborted, + // The peer is a connection to ourself, no point in keeping it self_connection, + // The peer sent a piece message with invalid size, either negative + // or greater than one block invalid_piece_size, + // The peer has not been interesting or interested in us for too + // long, no point in keeping it around timed_out_no_interest, + // The peer has not said anything in a long time, possibly dead timed_out_inactivity, + // The peer did not send a handshake within a reasonable amount of + // time, it might not be a bittorrent peer timed_out_no_handshake, + // The peer has been unchoked for too long without requesting any + // data. It might be lying about its interest in us timed_out_no_request, + // The peer sent an invalid choke message invalid_choke, + // The peer send an invalid unchoke message invalid_unchoke, + // The peer sent an invalid interested message invalid_interested, + // The peer sent an invalid not-interested message invalid_not_interested, + // The peer sent an invalid piece request message invalid_request, + // The peer sent an invalid hash-list message (this is part of the + // merkle-torrent extension) invalid_hash_list, + // The peer sent an invalid hash-piece message (this is part of the + // merkle-torrent extension) invalid_hash_piece, + // The peer sent an invalid cancel message invalid_cancel, + // The peer sent an invalid DHT port-message invalid_dht_port, + // The peer sent an invalid suggest piece-message invalid_suggest, + // The peer sent an invalid have all-message invalid_have_all, + // The peer sent an invalid have none-message invalid_have_none, + // The peer sent an invalid reject message invalid_reject, + // The peer sent an invalid allow fast-message invalid_allow_fast, + // The peer sent an invalid extesion message ID invalid_extended, + // The peer sent an invalid message ID invalid_message, + // The synchronization hash was not found in the encrypted handshake sync_hash_not_found, + // The encryption constant in the handshake is invalid invalid_encryption_constant, + // The peer does not support plaintext, which is the selected mode no_plaintext_mode, + // The peer does not support rc4, which is the selected mode no_rc4_mode, + // The peer does not support any of the encryption modes that the + // client supports unsupported_encryption_mode, + // The peer selected an encryption mode that the client did not + // advertise and does not support unsupported_encryption_mode_selected, + // The pad size used in the encryption handshake is of invalid size invalid_pad_size, + // The encryption handshake is invalid invalid_encrypt_handshake, + // The client is set to not support incoming encrypted connections + // and this is an encrypted connection no_incoming_encrypted, + // The client is set to not support incoming regular bittorrent + // connections, and this is a regular connection no_incoming_regular, + // The client is already connected to this peer-ID duplicate_peer_id, + // Torrent was removed torrent_removed, + // The packet size exceeded the upper sanity check-limit packet_too_large, + reserved, + + // The web server responded with an error http_error, + // The web server response is missing a location header missing_location, + // The web seed redirected to a path that no longer matches the + // .torrent directory structure invalid_redirection, + // The connection was closed becaused it redirected to a different + // URL redirecting, + // The HTTP range header is invalid invalid_range, + // The HTTP response did not have a content length no_content_length, + // The IP is blocked by the IP filter banned_by_ip_filter, + // At the connection limit too_many_connections, + // The peer is marked as banned peer_banned, + // The torrent is stopping, causing the operation to fail stopping_torrent, + // The peer has sent too many corrupt pieces and is banned too_many_corrupt_pieces, + // The torrent is not ready to receive peers torrent_not_ready, + // The peer is not completely constructed yet peer_not_constructed, + // The session is closing, causing the operation to fail session_closing, + // The peer was disconnected in order to leave room for a + // potentially better peer optimistic_disconnect, + // The torrent is finished torrent_finished, + // No UPnP router found no_router, + // The metadata message says the metadata exceeds the limit metadata_too_large, + // The peer sent an invalid metadata request message invalid_metadata_request, + // The peer advertised an invalid metadata size invalid_metadata_size, + // The peer sent a message with an invalid metadata offset invalid_metadata_offset, + // The peer sent an invalid metadata message invalid_metadata_message, + // The peer sent a peer exchange message that was too large pex_message_too_large, + // The peer sent an invalid peer exchange message invalid_pex_message, + // The peer sent an invalid tracker exchange message invalid_lt_tracker_message, + // The peer sent an pex messages too often. This is a possible + // attempt of and attack too_frequent_pex, + // The operation failed because it requires the torrent to have + // the metadata (.torrent file) and it doesn't have it yet. + // This happens for magnet links before they have downloaded the + // metadata, and also torrents added by URL. no_metadata, + // The peer sent an invalid ``dont_have`` message. The dont have + // message is an extension to allow peers to advertise that the + // no longer has a piece they previously had. invalid_dont_have, + // The peer tried to connect to an SSL torrent without connecting + // over SSL. requires_ssl_connection, + // The peer tried to connect to a torrent with a certificate + // for a different torrent. invalid_ssl_cert, - reserved113, - reserved114, - reserved115, - reserved116, - reserved117, - reserved118, - reserved119, -// natpmp errors - unsupported_protocol_version, // 120 + + + // The NAT-PMP router responded with an unsupported protocol version + unsupported_protocol_version = 120, + // You are not authorized to map ports on this NAT-PMP router natpmp_not_authorized, + // The NAT-PMP router failed because of a network failure network_failure, + // The NAT-PMP router failed because of lack of resources no_resources, + // The NAT-PMP router failed because an unsupported opcode was sent unsupported_opcode, - reserved125, - reserved126, - reserved127, - reserved128, - reserved129, -// fastresume errors - missing_file_sizes, // 130 + + + // The resume data file is missing the 'file sizes' entry + missing_file_sizes = 130, + // The resume data file 'file sizes' entry is empty no_files_in_resume_data, + // The resume data file is missing the 'pieces' and 'slots' entry missing_pieces, + // The number of files in the resume data does not match the number + // of files in the torrent mismatching_number_of_files, + // One of the files on disk has a different size than in the fast + // resume file mismatching_file_size, + // One of the files on disk has a different timestamp than in the + // fast resume file mismatching_file_timestamp, + // The resume data file is not a dictionary not_a_dictionary, + // The 'blocks per piece' entry is invalid in the resume data file invalid_blocks_per_piece, + // The resume file is missing the 'slots' entry, which is required + // for torrents with compact allocation missing_slots, + // The resume file contains more slots than the torrent too_many_slots, + // The 'slot' entry is invalid in the resume data invalid_slot_list, + // One index in the 'slot' list is invalid invalid_piece_index, + // The pieces on disk needs to be re-ordered for the specified + // allocation mode. This happens if you specify sparse allocation + // and the files on disk are using compact storage. The pieces needs + // to be moved to their right position pieces_need_reorder, - reserved143, - reserved144, - reserved145, - reserved146, - reserved147, - reserved148, - reserved149, -// HTTP errors - http_parse_error, // 150 + + + // The HTTP header was not correctly formatted + http_parse_error = 150, + // The HTTP response was in the 300-399 range but lacked a location + // header http_missing_location, + // The HTTP response was encoded with gzip or deflate but + // decompressing it failed http_failed_decompress, - reserved153, - reserved154, - reserved155, - reserved156, - reserved157, - reserved158, - reserved159, -// i2p errors - no_i2p_router, // 160 - reserved161, - reserved162, - reserved163, - reserved164, - reserved165, - reserved166, - reserved167, - reserved168, - reserved169, -// tracker errors - scrape_not_available, // 170 + + // The URL specified an i2p address, but no i2p router is configured + no_i2p_router = 160, + + + + // The tracker URL doesn't support transforming it into a scrape + // URL. i.e. it doesn't contain "announce. + scrape_not_available = 170, + // invalid tracker response invalid_tracker_response, + // invalid peer dictionary entry. Not a dictionary invalid_peer_dict, + // tracker sent a failure message tracker_failure, + // missing or invalid 'files' entry invalid_files_entry, + // missing or invalid 'hash' entry invalid_hash_entry, + // missing or invalid 'peers' and 'peers6' entry invalid_peers_entry, + // udp tracker response packet has invalid size invalid_tracker_response_length, + // invalid transaction id in udp tracker response invalid_tracker_transaction_id, + // invalid action field in udp tracker response invalid_tracker_action, - reserved180, - reserved181, - reserved182, - reserved183, - reserved184, - reserved185, - reserved186, - reserved187, - reserved188, - reserved189, -// bdecode errors - expected_string, // 190 + + // expected string in bencoded string + expected_string = 190, + // expected colon in bencoded string expected_colon, + // unexpected end of file in bencoded string unexpected_eof, + // expected value (list, dict, int or string) in bencoded string expected_value, + // bencoded recursion depth limit exceeded depth_exceeded, + // bencoded item count limit exceeded limit_exceeded, + // the number of error codes error_code_max }; diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index 4629545e4..f715d2953 100644 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -280,10 +280,10 @@ namespace libtorrent // the metadata. The metadata will be created by libtorrent as soon as it has been downloaded // from the swarm. // - // The constructor that takes a ``lazy_entry`` will create a ``torrent_info`` object from the - // information found in the given torrent_file. The ``lazy_entry`` represents a tree node in + // The constructor that takes a lazy_entry will create a torrent_info object from the + // information found in the given torrent_file. The lazy_entry represents a tree node in // an bencoded file. To load an ordinary .torrent file - // into a ``lazy_entry``, use `lazy_bdecode()`_. + // into a lazy_entry, use lazy_bdecode(). // // The version that takes a buffer pointer and a size will decode it as a .torrent file and // initialize the torrent_info object for you. @@ -350,14 +350,14 @@ namespace libtorrent // returned by ``orig_files()``. // // If you want to rename the base name of the torrent (for a multifile torrent), you - // can copy the ``file_storage`` (see `files() orig_files()`_), change the name, and + // can copy the ``file_storage`` (see files() and orig_files() ), change the name, and // then use `remap_files()`_. // // The ``new_filename`` can both be a relative path, in which case the file name // is relative to the ``save_path`` of the torrent. If the ``new_filename`` is // an absolute path (i.e. ``is_complete(new_filename) == true``), then the file // is detached from the ``save_path`` of the torrent. In this case the file is - // not moved when move_storage_ is invoked. + // not moved when move_storage() is invoked. void rename_file(int index, std::string const& new_filename) { copy_on_write(); diff --git a/include/libtorrent/upnp.hpp b/include/libtorrent/upnp.hpp index 1f98fd1a7..303f8547b 100644 --- a/include/libtorrent/upnp.hpp +++ b/include/libtorrent/upnp.hpp @@ -58,18 +58,37 @@ namespace libtorrent namespace upnp_errors { + // error codes for the upnp_error_category. They hold error codes + // returned by UPnP routers when mapping ports enum error_code_enum { + // No error no_error = 0, + // One of the arguments in the request is invalid invalid_argument = 402, + // The request failed action_failed = 501, + // The specified value does not exist in the array value_not_in_array = 714, + // The source IP address cannot be wild-carded, but + // must be fully specified source_ip_cannot_be_wildcarded = 715, + // The external port cannot be wildcarded, but must + // be specified external_port_cannot_be_wildcarded = 716, + // The port mapping entry specified conflicts with a + // mapping assigned previously to another client port_mapping_conflict = 718, + // Internal and external port value must be the same internal_port_must_match_external = 724, + // The NAT implementation only supports permanent + // lease times on port mappings only_permanent_leases_supported = 725, + // RemoteHost must be a wildcard and cannot be a + // specific IP addres or DNS name remote_host_must_be_wildcard = 726, + // ExternalPort must be a wildcard and cannot be a + // specific port external_port_must_be_wildcard = 727 }; }