2008-07-18 01:41:46 +02:00
|
|
|
/*
|
|
|
|
|
2012-10-02 05:16:33 +02:00
|
|
|
Copyright (c) 2008-2012, 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
|
|
|
|
|
|
|
|
#include <boost/version.hpp>
|
2009-11-26 23:30:50 +01:00
|
|
|
#include "libtorrent/config.hpp"
|
|
|
|
|
|
|
|
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
|
|
|
|
// asio assumes that the windows error codes are defined already
|
|
|
|
#include <winsock2.h>
|
|
|
|
#endif
|
2008-07-18 01:41:46 +02:00
|
|
|
|
|
|
|
#if BOOST_VERSION < 103500
|
|
|
|
#include <asio/error_code.hpp>
|
|
|
|
#else
|
|
|
|
#include <boost/system/error_code.hpp>
|
|
|
|
#endif
|
|
|
|
|
2012-08-26 17:26:17 +02:00
|
|
|
#include "libtorrent/string_util.hpp" // for allocate_string_copy
|
2009-12-09 10:55:19 +01:00
|
|
|
#include <stdlib.h> // free
|
2009-02-23 02:21:19 +01:00
|
|
|
|
2013-09-25 21:44:29 +02:00
|
|
|
#ifndef BOOST_SYSTEM_NOEXCEPT
|
|
|
|
#define BOOST_SYSTEM_NOEXCEPT throw()
|
|
|
|
#endif
|
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
namespace libtorrent
|
|
|
|
{
|
2008-07-18 12:22:16 +02:00
|
|
|
|
|
|
|
namespace errors
|
|
|
|
{
|
2013-08-05 08:08:10 +02:00
|
|
|
// 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.
|
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,
|
2013-08-05 08:08:10 +02:00
|
|
|
// One of the files in the torrent was unexpectadly small. This
|
|
|
|
// 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,
|
2013-08-05 08:08:10 +02:00
|
|
|
// A bencoded structure was currupt 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,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The peer sent an invalid extesion 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,
|
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,
|
2013-08-05 08:08:10 +02:00
|
|
|
// The connection was closed becaused it redirected to a different
|
|
|
|
// 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,
|
2013-08-05 08:08:10 +02:00
|
|
|
// 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.
|
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,
|
2009-06-12 18:40:38 +02:00
|
|
|
|
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
|
|
|
|
// for torrents with compact allocation
|
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
|
|
|
|
// to be moved to their right position
|
2009-06-28 02:36:41 +02:00
|
|
|
pieces_need_reorder,
|
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,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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,
|
2013-10-23 01:57:12 +02:00
|
|
|
#endif
|
2009-08-30 09:38:52 +02:00
|
|
|
|
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
|
|
|
|
};
|
2008-07-18 12:22:16 +02:00
|
|
|
}
|
2009-11-29 08:06:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#if BOOST_VERSION >= 103500
|
|
|
|
|
|
|
|
namespace boost { namespace system {
|
|
|
|
|
|
|
|
template<> struct is_error_code_enum<libtorrent::errors::error_code_enum>
|
|
|
|
{ static const bool value = true; };
|
|
|
|
|
|
|
|
template<> struct is_error_condition_enum<libtorrent::errors::error_code_enum>
|
|
|
|
{ static const bool value = true; };
|
|
|
|
} }
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
namespace libtorrent
|
|
|
|
{
|
2008-07-18 12:22:16 +02:00
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
#if BOOST_VERSION < 103500
|
|
|
|
typedef asio::error_code error_code;
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2008-07-18 01:41:46 +02:00
|
|
|
inline asio::error::error_category get_posix_category() { return asio::error::system_category; }
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2008-07-20 13:14:54 +02:00
|
|
|
inline asio::error::error_category get_system_category() { return asio::error::system_category; }
|
2009-03-06 09:57:00 +01:00
|
|
|
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2009-11-29 08:06:38 +01:00
|
|
|
boost::system::error_category const& get_libtorrent_category()
|
|
|
|
{
|
|
|
|
static ::asio::error::error_category libtorrent_category(20);
|
|
|
|
return libtorrent_category;
|
|
|
|
}
|
|
|
|
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2011-01-16 03:54:59 +01:00
|
|
|
boost::system::error_category const& get_http_category()
|
|
|
|
{
|
|
|
|
static ::asio::error::error_category http_category(21);
|
|
|
|
return http_category;
|
|
|
|
}
|
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
#else
|
2008-07-18 12:22:16 +02:00
|
|
|
|
2011-01-16 03:54:59 +01:00
|
|
|
struct TORRENT_EXPORT http_error_category : boost::system::error_category
|
|
|
|
{
|
2013-09-25 21:44:29 +02:00
|
|
|
virtual const char* name() const BOOST_SYSTEM_NOEXCEPT;
|
|
|
|
virtual std::string message(int ev) const BOOST_SYSTEM_NOEXCEPT;
|
|
|
|
virtual boost::system::error_condition default_error_condition(int ev) const BOOST_SYSTEM_NOEXCEPT
|
2011-01-16 03:54:59 +01:00
|
|
|
{ return boost::system::error_condition(ev, *this); }
|
|
|
|
};
|
|
|
|
|
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.
|
2013-06-24 02:14:17 +02:00
|
|
|
TORRENT_EXPORT boost::system::error_category& get_libtorrent_category();
|
2013-11-27 21:09:44 +01:00
|
|
|
|
|
|
|
// returns the error_category for HTTP errors
|
2013-06-24 02:14:17 +02:00
|
|
|
TORRENT_EXPORT boost::system::error_category& get_http_category();
|
2011-01-16 03:54:59 +01:00
|
|
|
|
2009-11-29 08:06:38 +01:00
|
|
|
namespace errors
|
|
|
|
{
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2009-11-29 08:06:38 +01:00
|
|
|
inline boost::system::error_code make_error_code(error_code_enum e)
|
|
|
|
{
|
|
|
|
return boost::system::error_code(e, get_libtorrent_category());
|
|
|
|
}
|
|
|
|
}
|
2008-07-18 12:22:16 +02:00
|
|
|
|
2008-07-18 01:41:46 +02:00
|
|
|
using boost::system::error_code;
|
2012-09-22 07:18:10 +02:00
|
|
|
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2008-07-20 13:14:54 +02:00
|
|
|
inline boost::system::error_category const& get_system_category()
|
2013-07-21 23:23:21 +02:00
|
|
|
#if BOOST_VERSION < 104400
|
2008-07-20 13:14:54 +02:00
|
|
|
{ return boost::system::get_system_category(); }
|
2012-09-22 07:18:10 +02:00
|
|
|
#else
|
|
|
|
{ return boost::system::system_category(); }
|
|
|
|
#endif
|
|
|
|
|
2013-07-21 23:23:21 +02:00
|
|
|
// hidden
|
2008-07-18 01:41:46 +02:00
|
|
|
inline boost::system::error_category const& get_posix_category()
|
2008-08-16 23:11:27 +02:00
|
|
|
#if BOOST_VERSION < 103600
|
2008-07-18 01:41:46 +02:00
|
|
|
{ return boost::system::get_posix_category(); }
|
2012-09-22 07:18:10 +02:00
|
|
|
#elif BOOST_VERSION < 104400
|
2008-08-16 23:11:27 +02:00
|
|
|
{ return boost::system::get_generic_category(); }
|
2012-09-22 07:18:10 +02:00
|
|
|
#else
|
|
|
|
{ return boost::system::generic_category(); }
|
2009-11-29 08:06:38 +01:00
|
|
|
#endif // BOOST_VERSION < 103600
|
|
|
|
#endif // BOOST_VERSION < 103500
|
2009-02-23 02:21:19 +01:00
|
|
|
|
2013-11-29 06:29:39 +01:00
|
|
|
// internal
|
2013-09-09 09:06:12 +02:00
|
|
|
inline boost::system::error_category const& generic_category()
|
|
|
|
{ return get_posix_category(); }
|
|
|
|
|
2009-02-23 02:21:19 +01:00
|
|
|
#ifndef BOOST_NO_EXCEPTIONS
|
|
|
|
struct TORRENT_EXPORT libtorrent_exception: std::exception
|
|
|
|
{
|
2009-11-23 09:38:50 +01:00
|
|
|
libtorrent_exception(error_code const& s): m_error(s), m_msg(0) {}
|
2012-09-30 21:35:08 +02:00
|
|
|
virtual const char* what() const throw();
|
|
|
|
virtual ~libtorrent_exception() throw();
|
2009-02-23 02:21:19 +01:00
|
|
|
error_code error() const { return m_error; }
|
|
|
|
private:
|
|
|
|
error_code m_error;
|
2009-11-23 09:38:50 +01:00
|
|
|
mutable char* m_msg;
|
2009-02-23 02:21:19 +01:00
|
|
|
};
|
|
|
|
#endif
|
2008-07-18 01:41:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|