Add upnp, natpmp and pe_settings support to libtorrent bindings.

This commit is contained in:
Andrew Resch 2007-09-20 22:09:23 +00:00
parent ec5c970499
commit d3c5064353
3 changed files with 27 additions and 3 deletions

View File

@ -156,11 +156,22 @@ char const* session_set_max_half_open_connections_doc =
char const* session_set_settings_doc = char const* session_set_settings_doc =
""; "";
char const* session_set_pe_settings_doc =
"";
char const* session_get_pe_settings_doc =
"";
char const* session_set_severity_level_doc = char const* session_set_severity_level_doc =
""; "";
char const* session_pop_alert_doc = char const* session_pop_alert_doc =
""; "";
char const* session_start_upnp_doc =
"";
char const* session_stop_upnp_doc =
"";
char const* session_start_natpmp_doc =
"";
char const* session_stop_natpmp_doc =
"";
// -- alert ----------------------------------------------------------------- // -- alert -----------------------------------------------------------------
char const* alert_doc = char const* alert_doc =

View File

@ -45,8 +45,14 @@ extern char const* session_set_max_uploads_doc;
extern char const* session_set_max_connections_doc; extern char const* session_set_max_connections_doc;
extern char const* session_set_max_half_open_connections_doc; extern char const* session_set_max_half_open_connections_doc;
extern char const* session_set_settings_doc; extern char const* session_set_settings_doc;
extern char const* session_set_pe_settings_doc;
extern char const* session_get_pe_settings_doc;
extern char const* session_set_severity_level_doc; extern char const* session_set_severity_level_doc;
extern char const* session_pop_alert_doc; extern char const* session_pop_alert_doc;
extern char const* session_start_upnp_doc;
extern char const* session_stop_upnp_doc;
extern char const* session_start_natpmp_doc;
extern char const* session_stop_natpmp_doc;
namespace namespace
{ {
@ -205,6 +211,8 @@ void bind_session()
, session_set_max_half_open_connections_doc , session_set_max_half_open_connections_doc
) )
.def("set_settings", allow_threads(&session::set_settings), session_set_settings_doc) .def("set_settings", allow_threads(&session::set_settings), session_set_settings_doc)
.def("set_pe_settings", allow_threads(&session::set_pe_settings), session_set_pe_settings_doc)
.def_readonly("get_pe_settings", allow_threads(&session::get_pe_settings), session_get_pe_settings_doc)
.def( .def(
"set_severity_level", allow_threads(&session::set_severity_level) "set_severity_level", allow_threads(&session::set_severity_level)
, session_set_severity_level_doc , session_set_severity_level_doc
@ -217,6 +225,10 @@ void bind_session()
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT
.def("set_dht_proxy", allow_threads(&session::set_dht_proxy)) .def("set_dht_proxy", allow_threads(&session::set_dht_proxy))
#endif #endif
.def("start_upnp", allow_threads(&session::start_upnp), session_start_upnp_doc)
.def("stop_upnp", allow_threads(&session::stop_upnp), session_stop_upnp_doc)
.def("start_natpmp", allow_threads(&session::start_natpmp), session_start_natpmp_doc)
.def("stop_natpmp", allow_threads(&session::stop_natpmp), session_stop_natpmp_doc)
; ;
def("supports_sparse_files", &supports_sparse_files); def("supports_sparse_files", &supports_sparse_files);

View File

@ -47,7 +47,7 @@ void bind_session_settings()
.value("http", proxy_settings::http) .value("http", proxy_settings::http)
.value("http_pw", proxy_settings::http_pw) .value("http_pw", proxy_settings::http_pw)
; ;
scope ps = class_<proxy_settings>("proxy_settings") class_<proxy_settings>("proxy_settings")
.def_readwrite("hostname", &proxy_settings::hostname) .def_readwrite("hostname", &proxy_settings::hostname)
.def_readwrite("port", &proxy_settings::port) .def_readwrite("port", &proxy_settings::port)
.def_readwrite("password", &proxy_settings::password) .def_readwrite("password", &proxy_settings::password)
@ -64,9 +64,10 @@ void bind_session_settings()
enum_<pe_settings::enc_level>("enc_level") enum_<pe_settings::enc_level>("enc_level")
.value("rc4", pe_settings::rc4) .value("rc4", pe_settings::rc4)
.value("plaintext", pe_settings::plaintext) .value("plaintext", pe_settings::plaintext)
.value("both", pe_settings::both)
; ;
scope pes = class_<pe_settings>("pe_settings") class_<pe_settings>("pe_settings")
.def_readwrite("out_enc_policy", &pe_settings::out_enc_policy) .def_readwrite("out_enc_policy", &pe_settings::out_enc_policy)
.def_readwrite("in_enc_policy", &pe_settings::in_enc_policy) .def_readwrite("in_enc_policy", &pe_settings::in_enc_policy)
.def_readwrite("allowed_enc_level", &pe_settings::allowed_enc_level) .def_readwrite("allowed_enc_level", &pe_settings::allowed_enc_level)