make settings_pack enums specify a narrower underlying type and remove deprecated, internal enums
This commit is contained in:
parent
bac57a6e69
commit
12cbcfd380
|
@ -52,7 +52,7 @@ void bind_session_settings()
|
||||||
.value("enabled", settings_pack::pe_enabled)
|
.value("enabled", settings_pack::pe_enabled)
|
||||||
.value("disabled", settings_pack::pe_disabled)
|
.value("disabled", settings_pack::pe_disabled)
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_<settings_pack::enc_level>("enc_level")
|
enum_<settings_pack::enc_level>("enc_level")
|
||||||
.value("pe_rc4", settings_pack::pe_rc4)
|
.value("pe_rc4", settings_pack::pe_rc4)
|
||||||
|
@ -65,7 +65,7 @@ void bind_session_settings()
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
enum_<settings_pack::proxy_type_t>("proxy_type_t")
|
scope s = enum_<settings_pack::proxy_type_t>("proxy_type_t")
|
||||||
.value("none", settings_pack::none)
|
.value("none", settings_pack::none)
|
||||||
.value("socks4", settings_pack::socks4)
|
.value("socks4", settings_pack::socks4)
|
||||||
.value("socks5", settings_pack::socks5)
|
.value("socks5", settings_pack::socks5)
|
||||||
|
@ -76,15 +76,7 @@ void bind_session_settings()
|
||||||
;
|
;
|
||||||
|
|
||||||
#if TORRENT_ABI_VERSION == 1
|
#if TORRENT_ABI_VERSION == 1
|
||||||
enum_<proxy_settings::proxy_type>("proxy_type")
|
scope().attr("proxy_type") = s;
|
||||||
.value("none", proxy_settings::none)
|
|
||||||
.value("socks4", proxy_settings::socks4)
|
|
||||||
.value("socks5", proxy_settings::socks5)
|
|
||||||
.value("socks5_pw", proxy_settings::socks5_pw)
|
|
||||||
.value("http", proxy_settings::http)
|
|
||||||
.value("http_pw", proxy_settings::http_pw)
|
|
||||||
.value("i2p_proxy", proxy_settings::i2p_proxy)
|
|
||||||
;
|
|
||||||
|
|
||||||
class_<proxy_settings>("proxy_settings")
|
class_<proxy_settings>("proxy_settings")
|
||||||
.def_readwrite("hostname", &proxy_settings::hostname)
|
.def_readwrite("hostname", &proxy_settings::hostname)
|
||||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_PROXY_SETTINGS_HPP_INCLUDED
|
#define TORRENT_PROXY_SETTINGS_HPP_INCLUDED
|
||||||
|
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
|
#include "libtorrent/settings_pack.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -67,57 +68,9 @@ namespace aux {
|
||||||
std::string username;
|
std::string username;
|
||||||
std::string password;
|
std::string password;
|
||||||
|
|
||||||
#if TORRENT_ABI_VERSION == 1
|
// tells libtorrent what kind of proxy server it is. See proxy_type_t
|
||||||
// the type of proxy to use. Assign one of these to the
|
|
||||||
// proxy_settings::type field.
|
|
||||||
enum proxy_type
|
|
||||||
{
|
|
||||||
// This is the default, no proxy server is used, all other fields are
|
|
||||||
// ignored.
|
|
||||||
none,
|
|
||||||
|
|
||||||
// The server is assumed to be a `SOCKS4 server`_ that requires a
|
|
||||||
// username.
|
|
||||||
//
|
|
||||||
// .. _`SOCKS4 server`: http://www.ufasoft.com/doc/socks4_protocol.htm
|
|
||||||
socks4,
|
|
||||||
|
|
||||||
// The server is assumed to be a SOCKS5 server (`RFC 1928`_) that does
|
|
||||||
// not require any authentication. The username and password are
|
|
||||||
// ignored.
|
|
||||||
//
|
|
||||||
// .. _`RFC 1928`: http://www.faqs.org/rfcs/rfc1928.html
|
|
||||||
socks5,
|
|
||||||
|
|
||||||
// The server is assumed to be a SOCKS5 server that supports plain
|
|
||||||
// text username and password authentication (`RFC 1929`_). The
|
|
||||||
// username and password specified may be sent to the proxy if it
|
|
||||||
// requires.
|
|
||||||
//
|
|
||||||
// .. _`RFC 1929`: http://www.faqs.org/rfcs/rfc1929.html
|
|
||||||
socks5_pw,
|
|
||||||
|
|
||||||
// The server is assumed to be an HTTP proxy. If the transport used
|
|
||||||
// for the connection is non-HTTP, the server is assumed to support
|
|
||||||
// the CONNECT_ method. i.e. for web seeds and HTTP trackers, a plain
|
|
||||||
// proxy will suffice. The proxy is assumed to not require
|
|
||||||
// authorization. The username and password will not be used.
|
|
||||||
//
|
|
||||||
// .. _CONNECT: http://tools.ietf.org/html/draft-luotonen-web-proxy-tunneling-01
|
|
||||||
http,
|
|
||||||
|
|
||||||
// The server is assumed to be an HTTP proxy that requires user
|
|
||||||
// authorization. The username and password will be sent to the proxy.
|
|
||||||
http_pw,
|
|
||||||
|
|
||||||
// route through an i2p SAM proxy
|
|
||||||
i2p_proxy
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// tells libtorrent what kind of proxy server it is. See proxy_type
|
|
||||||
// enum for options
|
// enum for options
|
||||||
std::uint8_t type = 0;
|
settings_pack::proxy_type_t type = settings_pack::none;
|
||||||
|
|
||||||
// the port the proxy server is running on
|
// the port the proxy server is running on
|
||||||
std::uint16_t port = 0;
|
std::uint16_t port = 0;
|
||||||
|
|
|
@ -1668,30 +1668,30 @@ namespace libtorrent {
|
||||||
max_int_setting_internal
|
max_int_setting_internal
|
||||||
};
|
};
|
||||||
|
|
||||||
enum settings_counts_t
|
enum settings_counts_t : std::uint8_t
|
||||||
{
|
{
|
||||||
num_string_settings = max_string_setting_internal - string_type_base,
|
num_string_settings = max_string_setting_internal - string_type_base,
|
||||||
num_bool_settings = max_bool_setting_internal - bool_type_base,
|
num_bool_settings = max_bool_setting_internal - bool_type_base,
|
||||||
num_int_settings = max_int_setting_internal - int_type_base
|
num_int_settings = max_int_setting_internal - int_type_base
|
||||||
};
|
};
|
||||||
|
|
||||||
enum suggest_mode_t { no_piece_suggestions = 0, suggest_read_cache = 1 };
|
enum suggest_mode_t : std::uint8_t { no_piece_suggestions = 0, suggest_read_cache = 1 };
|
||||||
|
|
||||||
enum choking_algorithm_t
|
enum choking_algorithm_t : std::uint8_t
|
||||||
{
|
{
|
||||||
fixed_slots_choker = 0,
|
fixed_slots_choker = 0,
|
||||||
rate_based_choker = 2,
|
rate_based_choker = 2,
|
||||||
bittyrant_choker = 3
|
bittyrant_choker = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum seed_choking_algorithm_t
|
enum seed_choking_algorithm_t : std::uint8_t
|
||||||
{
|
{
|
||||||
round_robin,
|
round_robin,
|
||||||
fastest_upload,
|
fastest_upload,
|
||||||
anti_leech
|
anti_leech
|
||||||
};
|
};
|
||||||
|
|
||||||
enum io_buffer_mode_t
|
enum io_buffer_mode_t : std::uint8_t
|
||||||
{
|
{
|
||||||
enable_os_cache = 0,
|
enable_os_cache = 0,
|
||||||
#if TORRENT_ABI_VERSION == 1
|
#if TORRENT_ABI_VERSION == 1
|
||||||
|
@ -1702,7 +1702,7 @@ namespace libtorrent {
|
||||||
disable_os_cache = 2
|
disable_os_cache = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
enum bandwidth_mixed_algo_t
|
enum bandwidth_mixed_algo_t : std::uint8_t
|
||||||
{
|
{
|
||||||
// disables the mixed mode bandwidth balancing
|
// disables the mixed mode bandwidth balancing
|
||||||
prefer_tcp = 0,
|
prefer_tcp = 0,
|
||||||
|
@ -1714,7 +1714,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
// the encoding policy options for use with
|
// the encoding policy options for use with
|
||||||
// settings_pack::out_enc_policy and settings_pack::in_enc_policy.
|
// settings_pack::out_enc_policy and settings_pack::in_enc_policy.
|
||||||
enum enc_policy
|
enum enc_policy : std::uint8_t
|
||||||
{
|
{
|
||||||
// Only encrypted connections are allowed. Incoming connections that
|
// Only encrypted connections are allowed. Incoming connections that
|
||||||
// are not encrypted are closed and if the encrypted outgoing
|
// are not encrypted are closed and if the encrypted outgoing
|
||||||
|
@ -1733,7 +1733,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
// the encryption levels, to be used with
|
// the encryption levels, to be used with
|
||||||
// settings_pack::allowed_enc_level.
|
// settings_pack::allowed_enc_level.
|
||||||
enum enc_level
|
enum enc_level : std::uint8_t
|
||||||
{
|
{
|
||||||
// use only plaintext encryption
|
// use only plaintext encryption
|
||||||
pe_plaintext = 1,
|
pe_plaintext = 1,
|
||||||
|
@ -1743,7 +1743,7 @@ namespace libtorrent {
|
||||||
pe_both = 3
|
pe_both = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum proxy_type_t
|
enum proxy_type_t : std::uint8_t
|
||||||
{
|
{
|
||||||
// This is the default, no proxy server is used, all other fields are
|
// This is the default, no proxy server is used, all other fields are
|
||||||
// ignored.
|
// ignored.
|
||||||
|
|
|
@ -41,7 +41,7 @@ inline lt::aux::proxy_settings make_proxy_settings(
|
||||||
using namespace lt;
|
using namespace lt;
|
||||||
|
|
||||||
aux::proxy_settings ps;
|
aux::proxy_settings ps;
|
||||||
ps.type = std::uint8_t(proxy_type);
|
ps.type = proxy_type;
|
||||||
ps.proxy_hostnames = false;
|
ps.proxy_hostnames = false;
|
||||||
// this IP and ports are specific to test_http_connection.cpp
|
// this IP and ports are specific to test_http_connection.cpp
|
||||||
if (proxy_type != settings_pack::none)
|
if (proxy_type != settings_pack::none)
|
||||||
|
|
|
@ -44,7 +44,7 @@ void init(proxy_settings& p, Settings const& sett)
|
||||||
p.hostname = sett.get_str(settings_pack::proxy_hostname);
|
p.hostname = sett.get_str(settings_pack::proxy_hostname);
|
||||||
p.username = sett.get_str(settings_pack::proxy_username);
|
p.username = sett.get_str(settings_pack::proxy_username);
|
||||||
p.password = sett.get_str(settings_pack::proxy_password);
|
p.password = sett.get_str(settings_pack::proxy_password);
|
||||||
p.type = std::uint8_t(sett.get_int(settings_pack::proxy_type));
|
p.type = settings_pack::proxy_type_t(sett.get_int(settings_pack::proxy_type));
|
||||||
p.port = std::uint16_t(sett.get_int(settings_pack::proxy_port));
|
p.port = std::uint16_t(sett.get_int(settings_pack::proxy_port));
|
||||||
p.proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
p.proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
||||||
p.proxy_peer_connections = sett.get_bool(
|
p.proxy_peer_connections = sett.get_bool(
|
||||||
|
|
|
@ -1051,7 +1051,7 @@ namespace {
|
||||||
// setting
|
// setting
|
||||||
settings_pack pack;
|
settings_pack pack;
|
||||||
pack.set_bool(settings_pack::proxy_tracker_connections
|
pack.set_bool(settings_pack::proxy_tracker_connections
|
||||||
, s.type != aux::proxy_settings::none);
|
, s.type != settings_pack::none);
|
||||||
apply_settings(pack);
|
apply_settings(pack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue