00001 /* 00002 Free Download Manager Copyright (c) 2003-2007 FreeDownloadManager.ORG 00003 */ 00004 00005 00006 00007 00008 #include <libtorrent/identify_client.hpp> 00009 #include <libtorrent/bencode.hpp> 00010 #include <boost/python.hpp> 00011 00012 using namespace boost::python; 00013 using namespace libtorrent; 00014 00015 object client_fingerprint_(peer_id const& id) 00016 { 00017 boost::optional<fingerprint> result = client_fingerprint(id); 00018 return result ? object(*result) : object(); 00019 } 00020 00021 entry bdecode_(std::string const& data) 00022 { 00023 return bdecode(data.begin(), data.end()); 00024 } 00025 00026 std::string bencode_(entry const& e) 00027 { 00028 std::string result; 00029 bencode(std::back_inserter(result), e); 00030 return result; 00031 } 00032 00033 void bind_utility() 00034 { 00035 def("identify_client", &libtorrent::identify_client); 00036 def("client_fingerprint", &client_fingerprint_); 00037 def("bdecode", &bdecode_); 00038 def("bencode", &bencode_); 00039 } 00040
1.5.6