2006-04-25 23:04:48 +02:00
|
|
|
/*
|
|
|
|
|
2018-04-09 09:04:33 +02:00
|
|
|
Copyright (c) 2003-2018, Arvid Norberg
|
2006-04-25 23:04:48 +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_SESSION_SETTINGS_HPP_INCLUDED
|
|
|
|
#define TORRENT_SESSION_SETTINGS_HPP_INCLUDED
|
|
|
|
|
2018-04-26 09:01:14 +02:00
|
|
|
#if TORRENT_ABI_VERSION == 1
|
2017-09-02 23:58:10 +02:00
|
|
|
|
2007-04-25 20:26:35 +02:00
|
|
|
#include "libtorrent/config.hpp"
|
2015-06-07 06:23:30 +02:00
|
|
|
#include "libtorrent/settings_pack.hpp"
|
2015-08-25 04:18:10 +02:00
|
|
|
#include "libtorrent/aux_/proxy_settings.hpp"
|
2017-09-02 23:58:10 +02:00
|
|
|
#include "libtorrent/kademlia/dht_settings.hpp"
|
2006-05-21 01:24:19 +02:00
|
|
|
|
2010-10-10 04:22:57 +02:00
|
|
|
#include <string>
|
|
|
|
|
2017-04-12 19:00:57 +02:00
|
|
|
namespace libtorrent {
|
2006-04-25 23:04:48 +02:00
|
|
|
|
2017-09-02 23:58:10 +02:00
|
|
|
using dht_settings = dht::dht_settings;
|
2014-02-03 03:41:24 +01:00
|
|
|
|
2016-04-30 06:24:45 +02:00
|
|
|
using aux::proxy_settings;
|
2014-07-06 21:18:00 +02:00
|
|
|
|
2013-08-08 03:03:54 +02:00
|
|
|
// The ``pe_settings`` structure is used to control the settings related
|
|
|
|
// to peer protocol encryption.
|
2017-09-02 23:58:10 +02:00
|
|
|
struct TORRENT_DEPRECATED_EXPORT pe_settings
|
2007-06-06 02:41:20 +02:00
|
|
|
{
|
2016-05-02 00:15:25 +02:00
|
|
|
// initializes the encryption settings with the default values
|
2007-06-06 02:41:20 +02:00
|
|
|
pe_settings()
|
|
|
|
: out_enc_policy(enabled)
|
|
|
|
, in_enc_policy(enabled)
|
|
|
|
, allowed_enc_level(both)
|
|
|
|
, prefer_rc4(false)
|
|
|
|
{}
|
|
|
|
|
2014-02-03 03:41:24 +01:00
|
|
|
// the encoding policy options for use with pe_settings::out_enc_policy
|
|
|
|
// and pe_settings::in_enc_policy.
|
2007-06-06 02:41:20 +02:00
|
|
|
enum enc_policy
|
|
|
|
{
|
2014-02-03 03:41:24 +01:00
|
|
|
// Only encrypted connections are allowed. Incoming connections that
|
|
|
|
// are not encrypted are closed and if the encrypted outgoing
|
|
|
|
// connection fails, a non-encrypted retry will not be made.
|
2013-08-08 03:03:54 +02:00
|
|
|
forced,
|
|
|
|
|
2014-02-03 03:41:24 +01:00
|
|
|
// encrypted connections are enabled, but non-encrypted connections
|
|
|
|
// are allowed. An incoming non-encrypted connection will be accepted,
|
|
|
|
// and if an outgoing encrypted connection fails, a non- encrypted
|
|
|
|
// connection will be tried.
|
2013-08-08 03:03:54 +02:00
|
|
|
enabled,
|
2015-12-19 08:09:06 +01:00
|
|
|
|
2013-08-08 03:03:54 +02:00
|
|
|
// only non-encrypted connections are allowed.
|
|
|
|
disabled
|
2007-06-06 02:41:20 +02:00
|
|
|
};
|
|
|
|
|
2014-02-03 03:41:24 +01:00
|
|
|
// the encryption levels, to be used with pe_settings::allowed_enc_level.
|
2007-06-06 02:41:20 +02:00
|
|
|
enum enc_level
|
|
|
|
{
|
2014-02-03 03:41:24 +01:00
|
|
|
// use only plaintext encryption
|
|
|
|
plaintext = 1,
|
2015-12-19 08:09:06 +01:00
|
|
|
// use only rc4 encryption
|
2014-02-03 03:41:24 +01:00
|
|
|
rc4 = 2,
|
|
|
|
// allow both
|
|
|
|
both = 3
|
2007-06-06 02:41:20 +02:00
|
|
|
};
|
|
|
|
|
2013-08-08 03:03:54 +02:00
|
|
|
// control the settings for incoming
|
|
|
|
// and outgoing connections respectively.
|
|
|
|
// see enc_policy enum for the available options.
|
2016-06-18 20:01:38 +02:00
|
|
|
std::uint8_t out_enc_policy;
|
|
|
|
std::uint8_t in_enc_policy;
|
2007-06-06 02:41:20 +02:00
|
|
|
|
2013-08-08 03:03:54 +02:00
|
|
|
// determines the encryption level of the
|
|
|
|
// connections. This setting will adjust which encryption scheme is
|
|
|
|
// offered to the other peer, as well as which encryption scheme is
|
|
|
|
// selected by the client. See enc_level enum for options.
|
2016-06-18 20:01:38 +02:00
|
|
|
std::uint8_t allowed_enc_level;
|
2013-08-08 03:03:54 +02:00
|
|
|
|
2007-06-06 02:41:20 +02:00
|
|
|
// if the allowed encryption level is both, setting this to
|
|
|
|
// true will prefer rc4 if both methods are offered, plaintext
|
|
|
|
// otherwise
|
|
|
|
bool prefer_rc4;
|
|
|
|
};
|
2006-04-25 23:04:48 +02:00
|
|
|
}
|
|
|
|
|
2018-04-26 09:01:14 +02:00
|
|
|
#endif // TORRENT_ABI_VERSION
|
2006-04-25 23:04:48 +02:00
|
|
|
#endif
|