2008-07-18 01:41:46 +02:00
|
|
|
/*
|
|
|
|
|
2016-01-18 00:57:46 +01:00
|
|
|
Copyright (c) 2008-2016, Arvid Norberg
|
2008-07-18 01:41:46 +02:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions
|
|
|
|
are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
* Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in
|
|
|
|
the documentation and/or other materials provided with the distribution.
|
|
|
|
* Neither the name of the author nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived
|
|
|
|
from this software without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TORRENT_ERROR_CODE_HPP_INCLUDED
|
|
|
|
#define TORRENT_ERROR_CODE_HPP_INCLUDED
|
|
|
|
|
2009-11-26 23:30:50 +01:00
|
|
|
#include "libtorrent/config.hpp"
|
2015-04-18 04:33:39 +02:00
|
|
|
|
|
|
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
2008-07-18 01:41:46 +02:00
|
|
|
#include <boost/system/error_code.hpp>
|
2016-05-15 06:33:06 +02:00
|
|
|
#include <boost/system/system_error.hpp>
|
2015-04-18 04:33:39 +02:00
|
|
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
2016-12-22 16:42:33 +01:00
|
|
|
#include "libtorrent/units.hpp"
|
2009-02-23 02:21:19 +01:00
|
|
|
|
2017-04-12 19:00:57 +02:00
|
|
|
namespace libtorrent {
|
2008-07-18 12:22:16 +02:00
|
|
|
|
|
|
|
namespace errors
|
|
|
|
{
|
2015-04-18 04:33:39 +02:00
|
|
|
// libtorrent uses boost.system's ``error_code`` class to represent
|
|
|
|
// errors. libtorrent has its own error category
|
2016-10-02 21:27:50 +02:00
|
|
|
// libtorrent_category() with the error codes defined by
|
2015-04-18 04:33:39 +02:00
|
|
|
// error_code_enum.
|
2008-07-18 12:22:16 +02:00
|
|
|
enum error_code_enum
|
|
|
|
{
|
2013-08-05 08:08:10 +02:00
|
|
|
// Not an error
|
2008-07-18 12:22:16 +02:00
|
|
|
no_error = 0,
|
2013-08-05 08:08:10 +02:00
|
|
|
// Two torrents has files which end up overwriting each other
|
2009-02-03 08:46:24 +01:00
|
|
|
file_collision,
|
2013-08-05 08:08:10 +02:00
|
|
|
// A piece did not match its piece hash
|
2009-02-13 20:01:02 +01:00
|
|
|
failed_hash_check,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file does not contain a bencoded dictionary at
|
|
|
|
// its top level
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_is_no_dict,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file does not have an ``info`` dictionary
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_missing_info,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file's ``info`` entry is not a dictionary
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_info_no_dict,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file does not have a ``piece length`` entry
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_missing_piece_length,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file does not have a ``name`` entry
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_missing_name,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file's name entry is invalid
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_invalid_name,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The length of a file, or of the whole .torrent file is invalid.
|
|
|
|
// Either negative or not an integer
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_invalid_length,
|
2013-08-05 08:08:10 +02:00
|
|
|
// Failed to parse a file entry in the .torrent
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_file_parse_failed,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The ``pieces`` field is missing or invalid in the .torrent file
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_missing_pieces,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The ``pieces`` string has incorrect length
|
2009-02-13 20:01:02 +01:00
|
|
|
torrent_invalid_hashes,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file has more pieces than is supported by libtorrent
|
2009-02-23 02:21:19 +01:00
|
|
|
too_many_pieces_in_torrent,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The metadata (.torrent file) that was received from the swarm
|
|
|
|
// matched the info-hash, but failed to be parsed
|
2009-02-23 02:21:19 +01:00
|
|
|
invalid_swarm_metadata,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The file or buffer is not correctly bencoded
|
2009-02-23 02:21:19 +01:00
|
|
|
invalid_bencoding,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The .torrent file does not contain any files
|
2009-02-23 02:21:19 +01:00
|
|
|
no_files_in_torrent,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The string was not properly url-encoded as expected
|
2009-02-23 02:21:19 +01:00
|
|
|
invalid_escaped_string,
|
2013-08-05 08:08:10 +02:00
|
|
|
// Operation is not permitted since the session is shutting down
|
2009-02-23 02:21:19 +01:00
|
|
|
session_is_closing,
|
2013-08-05 08:08:10 +02:00
|
|
|
// There's already a torrent with that info-hash added to the
|
|
|
|
// session
|
2009-02-23 02:21:19 +01:00
|
|
|
duplicate_torrent,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The supplied torrent_handle is not referring to a valid torrent
|
2009-02-23 02:21:19 +01:00
|
|
|
invalid_torrent_handle,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The type requested from the entry did not match its type
|
2009-02-23 02:21:19 +01:00
|
|
|
invalid_entry_type,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The specified URI does not contain a valid info-hash
|
2009-02-26 08:09:56 +01:00
|
|
|
missing_info_hash_in_uri,
|
2016-04-22 19:51:06 +02:00
|
|
|
// One of the files in the torrent was unexpectedly small. This
|
2013-08-05 08:08:10 +02:00
|
|
|
// might be caused by files being changed by an external process
|
2009-05-21 18:15:05 +02:00
|
|
|
file_too_short,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The URL used an unknown protocol. Currently ``http`` and
|
|
|
|
// ``https`` (if built with openssl support) are recognized. For
|
|
|
|
// trackers ``udp`` is recognized as well.
|
2009-05-30 20:50:38 +02:00
|
|
|
unsupported_url_protocol,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The URL did not conform to URL syntax and failed to be parsed
|
2009-05-30 20:50:38 +02:00
|
|
|
url_parse_error,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent a 'piece' message of length 0
|
2009-06-12 18:40:38 +02:00
|
|
|
peer_sent_empty_piece,
|
2016-04-22 19:51:06 +02:00
|
|
|
// A bencoded structure was corrupt and failed to be parsed
|
2009-06-12 18:40:38 +02:00
|
|
|
parse_failed,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The fast resume file was missing or had an invalid file version
|
|
|
|
// tag
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_file_tag,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The fast resume file was missing or had an invalid info-hash
|
2009-06-12 18:40:38 +02:00
|
|
|
missing_info_hash,
|
2013-09-14 12:09:30 +02:00
|
|
|
// The info-hash did not match the torrent
|
2009-06-12 18:40:38 +02:00
|
|
|
mismatching_info_hash,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The URL contained an invalid hostname
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_hostname,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The URL had an invalid port
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_port,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The port is blocked by the port-filter, and prevented the
|
|
|
|
// connection
|
2009-06-12 18:40:38 +02:00
|
|
|
port_blocked,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The IPv6 address was expected to end with ']'
|
2009-06-12 18:40:38 +02:00
|
|
|
expected_close_bracket_in_address,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The torrent is being destructed, preventing the operation to
|
|
|
|
// succeed
|
2009-06-12 18:40:38 +02:00
|
|
|
destructing_torrent,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The connection timed out
|
2009-06-12 18:40:38 +02:00
|
|
|
timed_out,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer is upload only, and we are upload only. There's no point
|
|
|
|
// in keeping the connection
|
2009-06-12 18:40:38 +02:00
|
|
|
upload_upload_connection,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer is upload only, and we're not interested in it. There's
|
|
|
|
// no point in keeping the connection
|
2009-06-12 18:40:38 +02:00
|
|
|
uninteresting_upload_peer,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an unknown info-hash
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_info_hash,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The torrent is paused, preventing the operation from succeeding
|
2009-06-12 18:40:38 +02:00
|
|
|
torrent_paused,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid have message, either wrong size or
|
|
|
|
// referring to a piece that doesn't exist in the torrent
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_have,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The bitfield message had the incorrect size
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_bitfield_size,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer kept requesting pieces after it was choked, possible
|
|
|
|
// abuse attempt.
|
2009-06-12 18:40:38 +02:00
|
|
|
too_many_requests_when_choked,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent a piece message that does not correspond to a
|
|
|
|
// piece request sent by the client
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_piece,
|
2013-08-05 08:08:10 +02:00
|
|
|
// memory allocation failed
|
2009-06-12 18:40:38 +02:00
|
|
|
no_memory,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The torrent is aborted, preventing the operation to succeed
|
2009-06-12 18:40:38 +02:00
|
|
|
torrent_aborted,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer is a connection to ourself, no point in keeping it
|
2009-06-12 18:40:38 +02:00
|
|
|
self_connection,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent a piece message with invalid size, either negative
|
|
|
|
// or greater than one block
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_piece_size,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer has not been interesting or interested in us for too
|
|
|
|
// long, no point in keeping it around
|
2009-06-12 18:40:38 +02:00
|
|
|
timed_out_no_interest,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer has not said anything in a long time, possibly dead
|
2009-06-12 18:40:38 +02:00
|
|
|
timed_out_inactivity,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer did not send a handshake within a reasonable amount of
|
|
|
|
// time, it might not be a bittorrent peer
|
2009-06-12 18:40:38 +02:00
|
|
|
timed_out_no_handshake,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer has been unchoked for too long without requesting any
|
|
|
|
// data. It might be lying about its interest in us
|
2009-06-12 18:40:38 +02:00
|
|
|
timed_out_no_request,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid choke message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_choke,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer send an invalid unchoke message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_unchoke,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid interested message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_interested,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid not-interested message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_not_interested,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid piece request message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_request,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid hash-list message (this is part of the
|
|
|
|
// merkle-torrent extension)
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_hash_list,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid hash-piece message (this is part of the
|
|
|
|
// merkle-torrent extension)
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_hash_piece,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid cancel message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_cancel,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid DHT port-message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_dht_port,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid suggest piece-message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_suggest,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid have all-message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_have_all,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid have none-message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_have_none,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid reject message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_reject,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid allow fast-message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_allow_fast,
|
2016-04-22 19:51:06 +02:00
|
|
|
// The peer sent an invalid extension message ID
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_extended,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid message ID
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_message,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The synchronization hash was not found in the encrypted handshake
|
2009-06-12 18:40:38 +02:00
|
|
|
sync_hash_not_found,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The encryption constant in the handshake is invalid
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_encryption_constant,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer does not support plaintext, which is the selected mode
|
2009-06-12 18:40:38 +02:00
|
|
|
no_plaintext_mode,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer does not support rc4, which is the selected mode
|
2009-06-12 18:40:38 +02:00
|
|
|
no_rc4_mode,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer does not support any of the encryption modes that the
|
|
|
|
// client supports
|
2009-06-12 18:40:38 +02:00
|
|
|
unsupported_encryption_mode,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer selected an encryption mode that the client did not
|
|
|
|
// advertise and does not support
|
2009-06-12 18:40:38 +02:00
|
|
|
unsupported_encryption_mode_selected,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The pad size used in the encryption handshake is of invalid size
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_pad_size,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The encryption handshake is invalid
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_encrypt_handshake,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The client is set to not support incoming encrypted connections
|
|
|
|
// and this is an encrypted connection
|
2009-06-12 18:40:38 +02:00
|
|
|
no_incoming_encrypted,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The client is set to not support incoming regular bittorrent
|
|
|
|
// connections, and this is a regular connection
|
2009-06-12 18:40:38 +02:00
|
|
|
no_incoming_regular,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The client is already connected to this peer-ID
|
2009-06-12 18:40:38 +02:00
|
|
|
duplicate_peer_id,
|
2013-08-05 08:08:10 +02:00
|
|
|
// Torrent was removed
|
2009-06-12 18:40:38 +02:00
|
|
|
torrent_removed,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The packet size exceeded the upper sanity check-limit
|
2009-06-12 18:40:38 +02:00
|
|
|
packet_too_large,
|
2013-08-05 08:08:10 +02:00
|
|
|
|
2010-02-23 17:26:24 +01:00
|
|
|
reserved,
|
2015-06-06 08:10:53 +02:00
|
|
|
|
2013-08-05 08:08:10 +02:00
|
|
|
// The web server responded with an error
|
2009-06-12 18:40:38 +02:00
|
|
|
http_error,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The web server response is missing a location header
|
2009-06-12 18:40:38 +02:00
|
|
|
missing_location,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The web seed redirected to a path that no longer matches the
|
|
|
|
// .torrent directory structure
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_redirection,
|
2016-04-22 19:51:06 +02:00
|
|
|
// The connection was closed because it redirected to a different
|
2013-08-05 08:08:10 +02:00
|
|
|
// URL
|
2009-06-12 18:40:38 +02:00
|
|
|
redirecting,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The HTTP range header is invalid
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_range,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The HTTP response did not have a content length
|
2009-06-12 18:40:38 +02:00
|
|
|
no_content_length,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The IP is blocked by the IP filter
|
2009-06-12 18:40:38 +02:00
|
|
|
banned_by_ip_filter,
|
2013-08-05 08:08:10 +02:00
|
|
|
// At the connection limit
|
2009-06-12 18:40:38 +02:00
|
|
|
too_many_connections,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer is marked as banned
|
2009-06-12 18:40:38 +02:00
|
|
|
peer_banned,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The torrent is stopping, causing the operation to fail
|
2009-06-12 18:40:38 +02:00
|
|
|
stopping_torrent,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer has sent too many corrupt pieces and is banned
|
2009-06-12 18:40:38 +02:00
|
|
|
too_many_corrupt_pieces,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The torrent is not ready to receive peers
|
2009-06-12 18:40:38 +02:00
|
|
|
torrent_not_ready,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer is not completely constructed yet
|
2009-06-12 18:40:38 +02:00
|
|
|
peer_not_constructed,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The session is closing, causing the operation to fail
|
2009-06-12 18:40:38 +02:00
|
|
|
session_closing,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer was disconnected in order to leave room for a
|
|
|
|
// potentially better peer
|
2009-06-12 18:40:38 +02:00
|
|
|
optimistic_disconnect,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The torrent is finished
|
2009-06-12 18:40:38 +02:00
|
|
|
torrent_finished,
|
2013-08-05 08:08:10 +02:00
|
|
|
// No UPnP router found
|
2009-06-12 18:40:38 +02:00
|
|
|
no_router,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The metadata message says the metadata exceeds the limit
|
2009-06-12 18:40:38 +02:00
|
|
|
metadata_too_large,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid metadata request message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_metadata_request,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer advertised an invalid metadata size
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_metadata_size,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent a message with an invalid metadata offset
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_metadata_offset,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid metadata message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_metadata_message,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent a peer exchange message that was too large
|
2009-06-12 18:40:38 +02:00
|
|
|
pex_message_too_large,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid peer exchange message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_pex_message,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid tracker exchange message
|
2009-06-12 18:40:38 +02:00
|
|
|
invalid_lt_tracker_message,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an pex messages too often. This is a possible
|
|
|
|
// attempt of and attack
|
2010-11-29 02:33:05 +01:00
|
|
|
too_frequent_pex,
|
2013-08-05 08:08:10 +02:00
|
|
|
// 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.
|
2011-03-04 07:17:55 +01:00
|
|
|
no_metadata,
|
2016-04-22 19:51:06 +02:00
|
|
|
// The peer sent an invalid ``dont_have`` message. The don't have
|
2013-08-05 08:08:10 +02:00
|
|
|
// message is an extension to allow peers to advertise that the
|
2015-06-06 08:10:53 +02:00
|
|
|
// no longer has a piece they previously had.
|
2011-08-07 02:41:13 +02:00
|
|
|
invalid_dont_have,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer tried to connect to an SSL torrent without connecting
|
|
|
|
// over SSL.
|
2012-01-14 17:04:25 +01:00
|
|
|
requires_ssl_connection,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer tried to connect to a torrent with a certificate
|
|
|
|
// for a different torrent.
|
2012-01-14 17:04:25 +01:00
|
|
|
invalid_ssl_cert,
|
2014-01-20 02:01:03 +01:00
|
|
|
// the torrent is not an SSL torrent, and the operation requires
|
|
|
|
// an SSL torrent
|
|
|
|
not_an_ssl_torrent,
|
2014-07-06 21:18:00 +02:00
|
|
|
// peer was banned because its listen port is within a banned port
|
|
|
|
// range, as specified by the port_filter.
|
|
|
|
banned_by_port_filter,
|
2017-05-28 12:41:50 +02:00
|
|
|
// The session_handle is not referring to a valid session_impl
|
|
|
|
invalid_session_handle,
|
2013-08-05 08:08:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
// 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
|
2009-06-12 18:40:38 +02:00
|
|
|
natpmp_not_authorized,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The NAT-PMP router failed because of a network failure
|
2009-06-12 18:40:38 +02:00
|
|
|
network_failure,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The NAT-PMP router failed because of lack of resources
|
2009-06-12 18:40:38 +02:00
|
|
|
no_resources,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The NAT-PMP router failed because an unsupported opcode was sent
|
2009-06-12 18:40:38 +02:00
|
|
|
unsupported_opcode,
|
2009-06-28 02:36:41 +02:00
|
|
|
|
2013-08-05 08:08:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
// The resume data file is missing the 'file sizes' entry
|
|
|
|
missing_file_sizes = 130,
|
|
|
|
// The resume data file 'file sizes' entry is empty
|
2009-06-28 02:36:41 +02:00
|
|
|
no_files_in_resume_data,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The resume data file is missing the 'pieces' and 'slots' entry
|
2009-06-28 02:36:41 +02:00
|
|
|
missing_pieces,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The number of files in the resume data does not match the number
|
|
|
|
// of files in the torrent
|
2009-06-28 02:36:41 +02:00
|
|
|
mismatching_number_of_files,
|
2013-08-05 08:08:10 +02:00
|
|
|
// One of the files on disk has a different size than in the fast
|
|
|
|
// resume file
|
2009-06-28 02:36:41 +02:00
|
|
|
mismatching_file_size,
|
2013-08-05 08:08:10 +02:00
|
|
|
// One of the files on disk has a different timestamp than in the
|
|
|
|
// fast resume file
|
2009-06-28 02:36:41 +02:00
|
|
|
mismatching_file_timestamp,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The resume data file is not a dictionary
|
2009-06-28 02:36:41 +02:00
|
|
|
not_a_dictionary,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The 'blocks per piece' entry is invalid in the resume data file
|
2009-06-28 02:36:41 +02:00
|
|
|
invalid_blocks_per_piece,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The resume file is missing the 'slots' entry, which is required
|
2016-03-21 00:14:46 +01:00
|
|
|
// for torrents with compact allocation. *DEPRECATED*
|
2009-06-28 02:36:41 +02:00
|
|
|
missing_slots,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The resume file contains more slots than the torrent
|
2009-06-28 02:36:41 +02:00
|
|
|
too_many_slots,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The 'slot' entry is invalid in the resume data
|
2009-06-28 02:36:41 +02:00
|
|
|
invalid_slot_list,
|
2013-08-05 08:08:10 +02:00
|
|
|
// One index in the 'slot' list is invalid
|
2009-06-28 02:36:41 +02:00
|
|
|
invalid_piece_index,
|
2013-08-05 08:08:10 +02:00
|
|
|
// 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
|
2016-03-21 00:14:46 +01:00
|
|
|
// to be moved to their right position. *DEPRECATED*
|
2009-06-28 02:36:41 +02:00
|
|
|
pieces_need_reorder,
|
2014-07-06 21:18:00 +02:00
|
|
|
// this error is returned when asking to save resume data and
|
|
|
|
// specifying the flag to only save when there's anything new to save
|
|
|
|
// (torrent_handle::only_if_modified) and there wasn't anything changed.
|
|
|
|
resume_data_not_modified,
|
2011-11-13 04:35:03 +01:00
|
|
|
|
2013-08-05 08:08:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
// 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
|
2009-12-06 00:03:48 +01:00
|
|
|
http_missing_location,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The HTTP response was encoded with gzip or deflate but
|
|
|
|
// decompressing it failed
|
2009-12-06 00:03:48 +01:00
|
|
|
http_failed_decompress,
|
2011-11-13 04:35:03 +01:00
|
|
|
|
2010-02-23 22:53:45 +01:00
|
|
|
|
2013-08-05 08:08:10 +02:00
|
|
|
|
|
|
|
// The URL specified an i2p address, but no i2p router is configured
|
|
|
|
no_i2p_router = 160,
|
2015-06-21 02:35:33 +02:00
|
|
|
// i2p acceptor is not available yet, can't announce without endpoint
|
|
|
|
no_i2p_endpoint = 161,
|
2013-08-05 08:08:10 +02:00
|
|
|
|
2015-06-06 08:10:53 +02:00
|
|
|
|
2013-08-05 08:08:10 +02:00
|
|
|
|
|
|
|
// 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
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_tracker_response,
|
2013-08-05 08:08:10 +02:00
|
|
|
// invalid peer dictionary entry. Not a dictionary
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_peer_dict,
|
2013-08-05 08:08:10 +02:00
|
|
|
// tracker sent a failure message
|
2010-02-23 22:53:45 +01:00
|
|
|
tracker_failure,
|
2013-08-05 08:08:10 +02:00
|
|
|
// missing or invalid 'files' entry
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_files_entry,
|
2013-08-05 08:08:10 +02:00
|
|
|
// missing or invalid 'hash' entry
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_hash_entry,
|
2013-08-05 08:08:10 +02:00
|
|
|
// missing or invalid 'peers' and 'peers6' entry
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_peers_entry,
|
2013-08-05 08:08:10 +02:00
|
|
|
// udp tracker response packet has invalid size
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_tracker_response_length,
|
2013-08-05 08:08:10 +02:00
|
|
|
// invalid transaction id in udp tracker response
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_tracker_transaction_id,
|
2013-08-05 08:08:10 +02:00
|
|
|
// invalid action field in udp tracker response
|
2010-02-23 22:53:45 +01:00
|
|
|
invalid_tracker_action,
|
2010-10-28 06:01:59 +02:00
|
|
|
|
2013-10-23 01:57:12 +02:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2013-08-05 08:08:10 +02:00
|
|
|
// expected string in bencoded string
|
|
|
|
expected_string = 190,
|
|
|
|
// expected colon in bencoded string
|
2010-10-28 06:01:59 +02:00
|
|
|
expected_colon,
|
2013-08-05 08:08:10 +02:00
|
|
|
// unexpected end of file in bencoded string
|
2010-10-28 06:01:59 +02:00
|
|
|
unexpected_eof,
|
2013-08-05 08:08:10 +02:00
|
|
|
// expected value (list, dict, int or string) in bencoded string
|
2010-10-28 06:01:59 +02:00
|
|
|
expected_value,
|
2013-08-05 08:08:10 +02:00
|
|
|
// bencoded recursion depth limit exceeded
|
2010-10-28 06:01:59 +02:00
|
|
|
depth_exceeded,
|
2013-08-05 08:08:10 +02:00
|
|
|
// bencoded item count limit exceeded
|
2010-11-25 03:49:50 +01:00
|
|
|
limit_exceeded,
|
2014-04-04 05:21:15 +02:00
|
|
|
// integer overflow
|
|
|
|
overflow,
|
2013-10-23 01:57:12 +02:00
|
|
|
#endif
|
2009-08-30 09:38:52 +02:00
|
|
|
|
2017-01-16 15:50:56 +01:00
|
|
|
// random number generation failed
|
|
|
|
no_entropy = 200,
|
|
|
|
|
2013-08-05 08:08:10 +02:00
|
|
|
// the number of error codes
|
2009-08-30 09:38:52 +02:00
|
|
|
error_code_max
|
2008-07-18 12:22:16 +02:00
|
|
|
};
|
2011-01-16 03:54:59 +01:00
|
|
|
|
2013-08-11 08:04:24 +02:00
|
|
|
// HTTP errors are reported in the libtorrent::http_category, with error code enums in
|
|
|
|
// the ``libtorrent::errors`` namespace.
|
2011-01-16 03:54:59 +01:00
|
|
|
enum http_errors
|
|
|
|
{
|
|
|
|
cont = 100,
|
|
|
|
ok = 200,
|
|
|
|
created = 201,
|
|
|
|
accepted = 202,
|
|
|
|
no_content = 204,
|
|
|
|
multiple_choices = 300,
|
|
|
|
moved_permanently = 301,
|
|
|
|
moved_temporarily = 302,
|
|
|
|
not_modified = 304,
|
|
|
|
bad_request = 400,
|
|
|
|
unauthorized = 401,
|
|
|
|
forbidden = 403,
|
|
|
|
not_found = 404,
|
|
|
|
internal_server_error = 500,
|
|
|
|
not_implemented = 501,
|
|
|
|
bad_gateway = 502,
|
|
|
|
service_unavailable = 503
|
|
|
|
};
|
2009-11-29 08:06:38 +01:00
|
|
|
|
2014-07-21 05:19:58 +02:00
|
|
|
// hidden
|
|
|
|
TORRENT_EXPORT boost::system::error_code make_error_code(error_code_enum e);
|
2009-11-29 08:06:38 +01:00
|
|
|
|
2014-07-21 05:19:58 +02:00
|
|
|
} // namespace errors
|
2008-07-18 12:22:16 +02:00
|
|
|
|
2013-11-27 21:09:44 +01:00
|
|
|
// return the instance of the libtorrent_error_category which
|
|
|
|
// maps libtorrent error codes to human readable error messages.
|
2016-10-02 21:27:50 +02:00
|
|
|
TORRENT_EXPORT boost::system::error_category& libtorrent_category();
|
2013-11-27 21:09:44 +01:00
|
|
|
|
|
|
|
// returns the error_category for HTTP errors
|
2016-10-02 21:27:50 +02:00
|
|
|
TORRENT_EXPORT boost::system::error_category& http_category();
|
2011-01-16 03:54:59 +01:00
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
using boost::system::error_code;
|
2015-11-22 19:12:11 +01:00
|
|
|
using boost::system::error_condition;
|
2009-02-23 02:21:19 +01:00
|
|
|
|
2013-11-29 06:29:39 +01:00
|
|
|
// internal
|
2015-11-22 19:12:11 +01:00
|
|
|
using boost::system::generic_category;
|
|
|
|
using boost::system::system_category;
|
2013-09-09 09:06:12 +02:00
|
|
|
|
2016-05-15 06:33:06 +02:00
|
|
|
using boost::system::system_error;
|
|
|
|
|
2017-05-28 06:17:36 +02:00
|
|
|
#ifndef BOOST_NO_EXCEPTIONS
|
2016-10-02 21:27:50 +02:00
|
|
|
|
2017-05-28 06:17:36 +02:00
|
|
|
#ifndef TORRENT_NO_DEPRECATE
|
2016-10-02 21:27:50 +02:00
|
|
|
TORRENT_DEPRECATED
|
|
|
|
inline boost::system::error_category& get_libtorrent_category()
|
|
|
|
{ return libtorrent_category(); }
|
|
|
|
|
|
|
|
TORRENT_DEPRECATED
|
|
|
|
inline boost::system::error_category& get_http_category()
|
|
|
|
{ return http_category(); }
|
2015-08-02 01:55:28 +02:00
|
|
|
#endif
|
2009-02-23 02:21:19 +01:00
|
|
|
#endif
|
2014-07-06 21:18:00 +02:00
|
|
|
|
|
|
|
// used by storage to return errors
|
|
|
|
// also includes which underlying file the
|
|
|
|
// error happened on
|
|
|
|
struct TORRENT_EXPORT storage_error
|
|
|
|
{
|
2016-12-22 16:42:33 +01:00
|
|
|
storage_error(): file_idx(-1), operation(0) {}
|
|
|
|
explicit storage_error(error_code e): ec(e), file_idx(-1), operation(0) {}
|
2014-07-06 21:18:00 +02:00
|
|
|
|
2016-12-12 00:44:52 +01:00
|
|
|
explicit operator bool() const { return ec.value() != 0; }
|
2015-04-20 06:52:49 +02:00
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// the error that occurred
|
|
|
|
error_code ec;
|
|
|
|
|
2016-12-22 16:42:33 +01:00
|
|
|
file_index_t file() const { return file_index_t(file_idx); }
|
|
|
|
void file(file_index_t f) { file_idx = static_cast<int>(f); }
|
|
|
|
|
2014-07-06 21:18:00 +02:00
|
|
|
// the file the error occurred on
|
2016-12-22 16:42:33 +01:00
|
|
|
std::int32_t file_idx:24;
|
2014-07-06 21:18:00 +02:00
|
|
|
|
|
|
|
// A code from file_operation_t enum, indicating what
|
|
|
|
// kind of operation failed.
|
2016-06-18 20:01:38 +02:00
|
|
|
std::uint32_t operation:8;
|
2014-07-06 21:18:00 +02:00
|
|
|
|
|
|
|
enum file_operation_t {
|
|
|
|
none,
|
|
|
|
stat,
|
|
|
|
mkdir,
|
|
|
|
open,
|
|
|
|
rename,
|
|
|
|
remove,
|
|
|
|
copy,
|
|
|
|
read,
|
|
|
|
write,
|
|
|
|
fallocate,
|
|
|
|
alloc_cache_piece,
|
|
|
|
partfile_move,
|
|
|
|
partfile_read,
|
|
|
|
partfile_write,
|
2015-03-21 01:12:40 +01:00
|
|
|
check_resume,
|
2016-10-19 07:18:05 +02:00
|
|
|
hard_link,
|
|
|
|
exception
|
2014-07-06 21:18:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// Returns a string literal representing the file operation
|
|
|
|
// that failed. If there were no failure, it returns
|
|
|
|
// an empty string.
|
|
|
|
char const* operation_str() const
|
|
|
|
{
|
2017-01-22 16:33:43 +01:00
|
|
|
static char const* ops[] =
|
2014-07-06 21:18:00 +02:00
|
|
|
{
|
|
|
|
"", "stat", "mkdir", "open", "rename", "remove", "copy"
|
|
|
|
, "read", "write", "fallocate", "allocate cache piece"
|
|
|
|
, "partfile move", "partfile read", "partfile write"
|
2016-10-19 07:18:05 +02:00
|
|
|
, "check resume", "hard_link", "exception"
|
2014-07-06 21:18:00 +02:00
|
|
|
};
|
|
|
|
return ops[operation];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
}
|
|
|
|
|
2014-07-21 05:19:58 +02:00
|
|
|
namespace boost { namespace system {
|
|
|
|
|
|
|
|
template<> struct is_error_code_enum<libtorrent::errors::error_code_enum>
|
|
|
|
{ static const bool value = true; };
|
|
|
|
|
|
|
|
template<> struct is_error_code_enum<libtorrent::errors::http_errors>
|
|
|
|
{ static const bool value = true; };
|
|
|
|
} }
|
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
#endif
|