From 0940f9072ebf55012434dc5e4a9122b344b43015 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 17 Feb 2008 05:33:59 +0000 Subject: [PATCH] Add ip_filter.cpp --- libtorrent/bindings/python/src/ip_filter.cpp | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 libtorrent/bindings/python/src/ip_filter.cpp diff --git a/libtorrent/bindings/python/src/ip_filter.cpp b/libtorrent/bindings/python/src/ip_filter.cpp new file mode 100644 index 000000000..d8e6808a4 --- /dev/null +++ b/libtorrent/bindings/python/src/ip_filter.cpp @@ -0,0 +1,27 @@ +// Copyright Andrew Resch 2008. Use, modification and distribution is +// subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include "gil.hpp" + +using namespace boost::python; +using namespace libtorrent; + +namespace +{ + void add_rule(ip_filter& filter, std::string start, std::string end, int flags) + { + return filter.add_rule(address_v4::from_string(start), address_v4::from_string(end), flags); + } +} + +void bind_ip_filter() +{ + class_("ip_filter") + .def("add_rule", &add_rule) + .def("access", allow_threads(&ip_filter::access)) + .def_readonly("export_filter", allow_threads(&ip_filter::export_filter)) + ; +}