├── .gitignore ├── COPYING ├── README.md ├── libtorrent ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── Jamfile ├── Jamroot.jam ├── LICENSE ├── Makefile.am ├── NEWS ├── README ├── autotool.sh ├── bindings │ ├── Makefile.am │ ├── README.txt │ ├── c │ │ ├── Jamfile │ │ ├── library.cpp │ │ ├── libtorrent.h │ │ └── simple_client.c │ └── python │ │ ├── Jamfile │ │ ├── Makefile.am │ │ ├── client.py │ │ ├── make_torrent.py │ │ ├── rss_reader.py │ │ ├── setup.py.in │ │ ├── simple_client.py │ │ └── src │ │ ├── alert.cpp │ │ ├── big_number.cpp │ │ ├── converters.cpp │ │ ├── create_torrent.cpp │ │ ├── datetime.cpp │ │ ├── entry.cpp │ │ ├── error_code.cpp │ │ ├── fingerprint.cpp │ │ ├── gil.hpp │ │ ├── ip_filter.cpp │ │ ├── magnet_uri.cpp │ │ ├── module.cpp │ │ ├── optional.hpp │ │ ├── peer_info.cpp │ │ ├── session.cpp │ │ ├── session_settings.cpp │ │ ├── string.cpp │ │ ├── torrent.cpp │ │ ├── torrent_handle.cpp │ │ ├── torrent_info.cpp │ │ ├── torrent_status.cpp │ │ ├── utility.cpp │ │ └── version.cpp ├── build_dist.sh ├── configure.ac ├── darwin_valgrind.suppressions ├── dht_flood.py ├── docs │ ├── Linkage.png │ ├── arctic_thumb.png │ ├── bitbuddy_thumb.jpg │ ├── bitfox.png │ ├── bitrocket_thumb.png │ ├── bitscast_thumb.png │ ├── bitslug_thumb.png │ ├── btg_thumb.jpg │ ├── bubba.png │ ├── building.html │ ├── building.rst │ ├── client_test.html │ ├── client_test.png │ ├── client_test.rst │ ├── contributing.html │ ├── contributing.rst │ ├── cwnd.png │ ├── cwnd_thumb.png │ ├── delays.png │ ├── delays_thumb.png │ ├── deluge.png │ ├── dht_extensions.html │ ├── dht_extensions.rst │ ├── dht_rss.html │ ├── dht_rss.rst │ ├── dht_sec.html │ ├── dht_sec.rst │ ├── dht_store.html │ ├── dht_store.rst │ ├── disk_access.png │ ├── disk_access_elevator.png │ ├── disk_access_no_elevator.png │ ├── disk_buffer.png │ ├── disk_buffer_before_optimization.png │ ├── disk_buffer_sample.png │ ├── disk_io.png │ ├── electric_sheep_thumb.jpg │ ├── examples.html │ ├── examples.rst │ ├── extension_protocol.html │ ├── extension_protocol.rst │ ├── fatrat.png │ ├── fdm.png │ ├── features.html │ ├── features.rst │ ├── firetorrent.png │ ├── flush.jpg │ ├── folx.png │ ├── hacking.rst │ ├── halite_thumb.png │ ├── im_thumb.jpg │ ├── index.html │ ├── index.rst │ ├── ip_id_v4.png │ ├── ip_id_v6.png │ ├── ips.py │ ├── leechcraft.png │ ├── libtorrent_plugins.html │ ├── libtorrent_plugins.rst │ ├── libtorrent_screen.png │ ├── limewire.png │ ├── lince.png │ ├── make_thumb.sh │ ├── make_torrent.html │ ├── make_torrent.rst │ ├── makefile │ ├── manual.html │ ├── manual.rst │ ├── merkle_tree.graffle │ ├── merkle_tree.png │ ├── miro.jpg │ ├── moopolice_thumb.gif │ ├── our_delay_base.png │ ├── our_delay_base_thumb.png │ ├── projects.html │ ├── projects.rst │ ├── pump.png │ ├── python_binding.html │ ├── python_binding.rst │ ├── qbittorrent_thumb.jpg │ ├── read_disk_buffers.dot │ ├── read_disk_buffers.graffle │ ├── read_disk_buffers.png │ ├── running_tests.html │ ├── running_tests.rst │ ├── session_stats_peers.png │ ├── storage.graffle │ ├── storage.png │ ├── style.css │ ├── stylesheet │ ├── t2e.jpg │ ├── template.txt │ ├── todo.html │ ├── tonidoplug.png │ ├── troubleshooting.dot │ ├── troubleshooting.png │ ├── tuning.html │ ├── tuning.rst │ ├── tvblob.jpg │ ├── tvitty.jpg │ ├── udp_tracker_protocol.html │ ├── udp_tracker_protocol.rst │ ├── unicode_support.png │ ├── utp.html │ ├── utp.rst │ ├── write_disk_buffers.dot │ ├── write_disk_buffers.graffle │ ├── write_disk_buffers.png │ ├── ziptorrent_thumb.gif │ └── zyxel.png ├── examples │ ├── Jamfile │ ├── Makefile.am │ ├── client_test.cpp │ ├── connection_tester.cpp │ ├── dump_torrent.cpp │ ├── enum_if.cpp │ ├── fragmentation_test.cpp │ ├── make_torrent.cpp │ ├── parse_request_log.cpp │ ├── rss_reader.cpp │ ├── run_benchmarks.py │ ├── simple_client.cpp │ ├── upnp_test.cpp │ └── utp_test.cpp ├── gen_todo.py ├── include │ ├── libtorrent.vcproj │ ├── libtorrent.vcxproj │ ├── libtorrent.vcxproj.filters │ └── libtorrent │ │ ├── ConvertUTF.h │ │ ├── GeoIP.h │ │ ├── Makefile.am │ │ ├── add_torrent_params.hpp │ │ ├── address.hpp │ │ ├── alert.hpp │ │ ├── alert_dispatcher.hpp │ │ ├── alert_types.hpp │ │ ├── alloca.hpp │ │ ├── allocator.hpp │ │ ├── assert.hpp │ │ ├── aux_ │ │ └── session_impl.hpp │ │ ├── bandwidth_limit.hpp │ │ ├── bandwidth_manager.hpp │ │ ├── bandwidth_queue_entry.hpp │ │ ├── bandwidth_socket.hpp │ │ ├── bencode.hpp │ │ ├── bitfield.hpp │ │ ├── bloom_filter.hpp │ │ ├── broadcast_socket.hpp │ │ ├── bt_peer_connection.hpp │ │ ├── buffer.hpp │ │ ├── build_config.hpp │ │ ├── chained_buffer.hpp │ │ ├── config.hpp │ │ ├── connection_queue.hpp │ │ ├── copy_ptr.hpp │ │ ├── create_torrent.hpp │ │ ├── deadline_timer.hpp │ │ ├── debug.hpp │ │ ├── disk_buffer_holder.hpp │ │ ├── disk_buffer_pool.hpp │ │ ├── disk_io_thread.hpp │ │ ├── entry.hpp │ │ ├── enum_net.hpp │ │ ├── error.hpp │ │ ├── error_code.hpp │ │ ├── escape_string.hpp │ │ ├── extensions.hpp │ │ ├── extensions │ │ ├── logger.hpp │ │ ├── lt_trackers.hpp │ │ ├── metadata_transfer.hpp │ │ ├── smart_ban.hpp │ │ ├── ut_metadata.hpp │ │ └── ut_pex.hpp │ │ ├── extern_read_op.hpp │ │ ├── file.hpp │ │ ├── file_pool.hpp │ │ ├── file_storage.hpp │ │ ├── fingerprint.hpp │ │ ├── gzip.hpp │ │ ├── hasher.hpp │ │ ├── http_connection.hpp │ │ ├── http_parser.hpp │ │ ├── http_seed_connection.hpp │ │ ├── http_server.hpp │ │ ├── http_stream.hpp │ │ ├── http_tracker_connection.hpp │ │ ├── i2p_stream.hpp │ │ ├── identify_client.hpp │ │ ├── instantiate_connection.hpp │ │ ├── intrusive_ptr_base.hpp │ │ ├── invariant_check.hpp │ │ ├── io.hpp │ │ ├── io_service.hpp │ │ ├── io_service_fwd.hpp │ │ ├── ip_filter.hpp │ │ ├── ip_voter.hpp │ │ ├── kademlia │ │ ├── dht_observer.hpp │ │ ├── dht_tracker.hpp │ │ ├── find_data.hpp │ │ ├── logging.hpp │ │ ├── msg.hpp │ │ ├── node.hpp │ │ ├── node_entry.hpp │ │ ├── node_id.hpp │ │ ├── observer.hpp │ │ ├── refresh.hpp │ │ ├── routing_table.hpp │ │ ├── rpc_manager.hpp │ │ └── traversal_algorithm.hpp │ │ ├── lazy_entry.hpp │ │ ├── lsd.hpp │ │ ├── magnet_uri.hpp │ │ ├── max.hpp │ │ ├── natpmp.hpp │ │ ├── packet_buffer.hpp │ │ ├── parse_url.hpp │ │ ├── pch.hpp │ │ ├── pe_crypto.hpp │ │ ├── peer.hpp │ │ ├── peer_connection.hpp │ │ ├── peer_id.hpp │ │ ├── peer_info.hpp │ │ ├── peer_request.hpp │ │ ├── piece_block_progress.hpp │ │ ├── piece_picker.hpp │ │ ├── policy.hpp │ │ ├── proxy_base.hpp │ │ ├── ptime.hpp │ │ ├── puff.hpp │ │ ├── random.hpp │ │ ├── rsa.hpp │ │ ├── rss.hpp │ │ ├── session.hpp │ │ ├── session_settings.hpp │ │ ├── session_status.hpp │ │ ├── settings.hpp │ │ ├── size_type.hpp │ │ ├── sliding_average.hpp │ │ ├── socket.hpp │ │ ├── socket_io.hpp │ │ ├── socket_type.hpp │ │ ├── socket_type_fwd.hpp │ │ ├── socks5_stream.hpp │ │ ├── ssl_stream.hpp │ │ ├── stat.hpp │ │ ├── storage.hpp │ │ ├── storage_defs.hpp │ │ ├── string_util.hpp │ │ ├── struct_debug.hpp │ │ ├── thread.hpp │ │ ├── time.hpp │ │ ├── timestamp_history.hpp │ │ ├── tommath.h │ │ ├── tommath_class.h │ │ ├── tommath_superclass.h │ │ ├── torrent.hpp │ │ ├── torrent_handle.hpp │ │ ├── torrent_info.hpp │ │ ├── torrent_server.hpp │ │ ├── tracker_manager.hpp │ │ ├── udp_socket.hpp │ │ ├── udp_tracker_connection.hpp │ │ ├── union_endpoint.hpp │ │ ├── upnp.hpp │ │ ├── utf8.hpp │ │ ├── utp_socket_manager.hpp │ │ ├── utp_stream.hpp │ │ ├── version.hpp │ │ ├── web_connection_base.hpp │ │ ├── web_peer_connection.hpp │ │ └── xml_parse.hpp ├── libtorrent-rasterbar-cmake.pc.in ├── libtorrent-rasterbar.pc.in ├── list_files.py ├── m4 │ ├── ax_boost_base.m4 │ ├── ax_boost_python.m4 │ ├── ax_boost_system.m4 │ ├── ax_check_geoip.m4 │ ├── ax_check_openssl.m4 │ ├── ax_pthread.m4 │ ├── ax_python_devel.m4 │ ├── config.rpath │ ├── gettext-lib.m4 │ ├── iconv.m4 │ └── pkgconfig.m4 ├── parse_bandwidth_log.py ├── parse_buffer_log.py ├── parse_dht_log.py ├── parse_dht_rtt.py ├── parse_dht_stats.py ├── parse_disk_access.py ├── parse_disk_buffer_log.py ├── parse_disk_log.py ├── parse_memory_log.py ├── parse_sample.py ├── parse_session_stats.py ├── parse_utp_log.py ├── sanity-checker.xml ├── set_version.py ├── src │ ├── ConvertUTF.cpp │ ├── GeoIP.c │ ├── Makefile.am │ ├── alert.cpp │ ├── allocator.cpp │ ├── asio.cpp │ ├── asio_ssl.cpp │ ├── assert.cpp │ ├── bandwidth_limit.cpp │ ├── bandwidth_manager.cpp │ ├── bandwidth_queue_entry.cpp │ ├── bloom_filter.cpp │ ├── broadcast_socket.cpp │ ├── bt_peer_connection.cpp │ ├── chained_buffer.cpp │ ├── connection_queue.cpp │ ├── create_torrent.cpp │ ├── disk_buffer_holder.cpp │ ├── disk_buffer_pool.cpp │ ├── disk_io_thread.cpp │ ├── entry.cpp │ ├── enum_net.cpp │ ├── error_code.cpp │ ├── escape_string.cpp │ ├── file.cpp │ ├── file_pool.cpp │ ├── file_storage.cpp │ ├── gzip.cpp │ ├── http_connection.cpp │ ├── http_parser.cpp │ ├── http_seed_connection.cpp │ ├── http_stream.cpp │ ├── http_tracker_connection.cpp │ ├── i2p_stream.cpp │ ├── identify_client.cpp │ ├── instantiate_connection.cpp │ ├── ip_filter.cpp │ ├── ip_voter.cpp │ ├── kademlia │ │ ├── dht_tracker.cpp │ │ ├── find_data.cpp │ │ ├── node.cpp │ │ ├── node_id.cpp │ │ ├── refresh.cpp │ │ ├── routing_table.cpp │ │ ├── rpc_manager.cpp │ │ └── traversal_algorithm.cpp │ ├── lazy_bdecode.cpp │ ├── logger.cpp │ ├── lsd.cpp │ ├── lt_trackers.cpp │ ├── magnet_uri.cpp │ ├── metadata_transfer.cpp │ ├── mpi.c │ ├── natpmp.cpp │ ├── packet_buffer.cpp │ ├── parse_url.cpp │ ├── pe_crypto.cpp │ ├── peer_connection.cpp │ ├── piece_picker.cpp │ ├── policy.cpp │ ├── puff.cpp │ ├── random.cpp │ ├── rsa.cpp │ ├── rss.cpp │ ├── session.cpp │ ├── session_impl.cpp │ ├── settings.cpp │ ├── sha1.cpp │ ├── smart_ban.cpp │ ├── socket_io.cpp │ ├── socket_type.cpp │ ├── socks5_stream.cpp │ ├── stat.cpp │ ├── storage.cpp │ ├── string_util.cpp │ ├── thread.cpp │ ├── time.cpp │ ├── timestamp_history.cpp │ ├── torrent.cpp │ ├── torrent_handle.cpp │ ├── torrent_info.cpp │ ├── torrent_server.cpp │ ├── tracker_manager.cpp │ ├── udp_socket.cpp │ ├── udp_tracker_connection.cpp │ ├── upnp.cpp │ ├── ut_metadata.cpp │ ├── ut_pex.cpp │ ├── utf8.cpp │ ├── utp_socket_manager.cpp │ ├── utp_stream.cpp │ ├── web_connection_base.cpp │ └── web_peer_connection.cpp ├── test │ ├── Jamfile │ ├── Makefile.am │ ├── cb.xml │ ├── eztv.xml │ ├── kat.xml │ ├── main.cpp │ ├── mn.xml │ ├── pb.xml │ ├── root1.xml │ ├── root2.xml │ ├── setup_transfer.cpp │ ├── setup_transfer.hpp │ ├── test.hpp │ ├── test_auto_unchoke.cpp │ ├── test_bandwidth_limiter.cpp │ ├── test_bdecode_performance.cpp │ ├── test_bencoding.cpp │ ├── test_buffer.cpp │ ├── test_checking.cpp │ ├── test_dht.cpp │ ├── test_fast_extension.cpp │ ├── test_file.cpp │ ├── test_hasher.cpp │ ├── test_http_connection.cpp │ ├── test_ip_filter.cpp │ ├── test_lsd.cpp │ ├── test_metadata_extension.cpp │ ├── test_natpmp.cpp │ ├── test_pe_crypto.cpp │ ├── test_peer_priority.cpp │ ├── test_pex.cpp │ ├── test_piece_picker.cpp │ ├── test_primitives.cpp │ ├── test_rss.cpp │ ├── test_storage.cpp │ ├── test_swarm.cpp │ ├── test_threads.cpp │ ├── test_torrent.cpp │ ├── test_torrent_parse.cpp │ ├── test_torrents │ │ ├── backslash_path.torrent │ │ ├── base.torrent │ │ ├── creation_date.torrent │ │ ├── duplicate_files.torrent │ │ ├── empty_httpseed.torrent │ │ ├── empty_path.torrent │ │ ├── hidden_parent_path.torrent │ │ ├── httpseed.torrent │ │ ├── invalid_file_size.torrent │ │ ├── invalid_info.torrent │ │ ├── invalid_name.torrent │ │ ├── invalid_name2.torrent │ │ ├── invalid_path_list.torrent │ │ ├── invalid_piece_len.torrent │ │ ├── invalid_pieces.torrent │ │ ├── invalid_root_hash.torrent │ │ ├── invalid_root_hash2.torrent │ │ ├── long_name.torrent │ │ ├── missing_path_list.torrent │ │ ├── missing_piece_len.torrent │ │ ├── negative_file_size.torrent │ │ ├── negative_piece_len.torrent │ │ ├── negative_size.torrent │ │ ├── no_creation_date.torrent │ │ ├── no_name.torrent │ │ ├── pad_file.torrent │ │ ├── parent_path.torrent │ │ ├── root_hash.torrent │ │ ├── single_multi_file.torrent │ │ ├── slash_path.torrent │ │ ├── string.torrent │ │ ├── unaligned_pieces.torrent │ │ ├── url_list.torrent │ │ ├── url_list2.torrent │ │ ├── url_list3.torrent │ │ ├── url_seed.torrent │ │ ├── url_seed_multi.torrent │ │ ├── url_seed_multi_space.torrent │ │ ├── url_seed_multi_space_nolist.torrent │ │ └── whitespace_url.torrent │ ├── test_tracker.cpp │ ├── test_trackers_extension.cpp │ ├── test_transfer.cpp │ ├── test_upnp.cpp │ ├── test_utp.cpp │ └── test_web_seed.cpp ├── tools │ ├── Jamfile │ ├── Makefile.am │ └── parse_hash_fails.cpp └── update_copyright.py ├── server ├── asio.cpp ├── main.cpp ├── torrent_server-vc08.sln ├── torrent_server.sln ├── torrent_server.vcproj ├── torrent_server.vcxproj └── torrent_server.vcxproj.filters └── third_party └── openssl ├── include └── openssl │ ├── aes.h │ ├── applink.c │ ├── asn1.h │ ├── asn1_mac.h │ ├── asn1t.h │ ├── bio.h │ ├── blowfish.h │ ├── bn.h │ ├── buffer.h │ ├── camellia.h │ ├── cast.h │ ├── cmac.h │ ├── cms.h │ ├── comp.h │ ├── conf.h │ ├── conf_api.h │ ├── crypto.h │ ├── des.h │ ├── des_old.h │ ├── dh.h │ ├── dsa.h │ ├── dso.h │ ├── dtls1.h │ ├── e_os2.h │ ├── ebcdic.h │ ├── ec.h │ ├── ecdh.h │ ├── ecdsa.h │ ├── engine.h │ ├── err.h │ ├── evp.h │ ├── hmac.h │ ├── idea.h │ ├── krb5_asn.h │ ├── kssl.h │ ├── lhash.h │ ├── md4.h │ ├── md5.h │ ├── mdc2.h │ ├── modes.h │ ├── obj_mac.h │ ├── objects.h │ ├── ocsp.h │ ├── opensslconf.h │ ├── opensslv.h │ ├── ossl_typ.h │ ├── pem.h │ ├── pem2.h │ ├── pkcs12.h │ ├── pkcs7.h │ ├── pqueue.h │ ├── rand.h │ ├── rc2.h │ ├── rc4.h │ ├── ripemd.h │ ├── rsa.h │ ├── safestack.h │ ├── seed.h │ ├── sha.h │ ├── srp.h │ ├── srtp.h │ ├── ssl.h │ ├── ssl2.h │ ├── ssl23.h │ ├── ssl3.h │ ├── stack.h │ ├── symhacks.h │ ├── tls1.h │ ├── ts.h │ ├── txt_db.h │ ├── ui.h │ ├── ui_compat.h │ ├── whrlpool.h │ ├── x509.h │ ├── x509_vfy.h │ └── x509v3.h └── libs ├── libeay32.lib ├── libeay64.lib ├── ssleay32.lib └── ssleay64.lib /.gitignore: -------------------------------------------------------------------------------- 1 | *.log 2 | *.lib 3 | *.rsp 4 | *.obj 5 | *.tlog 6 | *.lastbuildstate 7 | *.idb 8 | *.pdb 9 | *.resume 10 | *.wmv 11 | *.ses_state 12 | *.rmvb 13 | *.7z 14 | *.exe 15 | *.ilk 16 | *.cache 17 | *.opensdf 18 | *.sdf 19 | *.v11.suo 20 | *.user 21 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU General Public License, version 3 or any later version. 2 | See GPL-3 for the full text of this license. 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 一个BT实现的P2P点播后端服务 2 | =========================== 3 | 4 | p2p下载服务, 可用于P2P播放器的后端. 5 | 6 | 7 | ##### 使用方法: 8 | 9 | 在编译后运行命令 10 | 11 | ``` 12 | torrent_server.exe girls-xvid-1080p-04.avi.torrent 13 | ``` 14 | 15 | 然后使用vlc打开: 16 | 17 | http://127.0.0.1:8889/girls-xvid-1080p-04.avi 18 | 19 | 即可享用p2p下载播放服务. 20 | 21 | 22 | 23 | ##### bin下载: 24 | 25 | https://sourceforge.net/projects/avplayer/files/exe/bt_stream.7z/download 26 | 27 | -------------------------------------------------------------------------------- /libtorrent/AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/AUTHORS -------------------------------------------------------------------------------- /libtorrent/COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003 - 2007, Arvid Norberg 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the distribution. 13 | * Neither the name of Rasterbar Software nor the names of its 14 | contributors may be used to endorse or promote products derived 15 | from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 | POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /libtorrent/Jamroot.jam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/Jamroot.jam -------------------------------------------------------------------------------- /libtorrent/NEWS: -------------------------------------------------------------------------------- 1 | 2 | initial release of libtorrent 0.9 3 | 4 | -------------------------------------------------------------------------------- /libtorrent/README: -------------------------------------------------------------------------------- 1 | libtorrent is a C++ library that aims to be a good alternative to all the 2 | other bittorrent implementations around. It is a 3 | library and not a full featured client, although it comes with a working 4 | example client. 5 | 6 | The main goals of libtorrent are: 7 | 8 | * to be cpu efficient 9 | * to be memory efficient 10 | * to be very easy to use 11 | 12 | See docs/manual.html for more detailed build and usage instructions. 13 | 14 | To build with autotools, run: 15 | 16 | ./configure 17 | 18 | Followed by 19 | 20 | make 21 | 22 | When libtorrent is built, finish off by running the tests: 23 | 24 | make check 25 | 26 | -------------------------------------------------------------------------------- /libtorrent/bindings/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | SUBDIRS = python 3 | 4 | EXTRA_DIST = README.txt 5 | -------------------------------------------------------------------------------- /libtorrent/bindings/README.txt: -------------------------------------------------------------------------------- 1 | Documentation covering building and using the python binding for libtorrent 2 | is located in the main doc directory. See docs/python_binding.html 3 | 4 | -------------------------------------------------------------------------------- /libtorrent/bindings/c/Jamfile: -------------------------------------------------------------------------------- 1 | use-project /torrent : ../.. ; 2 | 3 | rule libtorrent_linking ( properties * ) 4 | { 5 | local result ; 6 | 7 | if gcc in $(properties) && shared in $(properties) 8 | { 9 | result += on ; 10 | } 11 | 12 | # if gcc in $(properties) || darwin in $(properties) 13 | # { 14 | # result += hidden ; 15 | # } 16 | 17 | return $(result) ; 18 | } 19 | 20 | lib torrentc 21 | 22 | : # sources 23 | library.cpp 24 | 25 | : # requirements 26 | @libtorrent_linking 27 | /torrent//torrent/static 28 | . 29 | 30 | : # default build 31 | static 32 | 33 | : # usage-requirements 34 | . 35 | ; 36 | 37 | exe simple_client : simple_client.c torrentc ; 38 | 39 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/Jamfile: -------------------------------------------------------------------------------- 1 | import python ; 2 | 3 | use-project /torrent : ../.. ; 4 | 5 | lib boost_python : : darwin boost_python-mt $(boost-library-search-path) ; 6 | lib boost_python : : boost_python ; 7 | 8 | rule libtorrent_linking ( properties * ) 9 | { 10 | local result ; 11 | 12 | if gcc in $(properties) 13 | { 14 | result += on ; 15 | } 16 | 17 | if gcc in $(properties) 18 | || darwin in $(properties) 19 | || clang in $(properties) 20 | { 21 | result += -fvisibility=hidden ; 22 | } 23 | 24 | if source in $(properties) 25 | { 26 | if static in $(properties) || static in $(properties) 27 | { 28 | result += /boost/python//boost_python/static ; 29 | result += /torrent//torrent/static ; 30 | } 31 | else 32 | { 33 | result += /boost/python//boost_python/shared ; 34 | result += /torrent//torrent/shared/shared ; 35 | } 36 | } 37 | else 38 | { 39 | result += boost_python ; 40 | result += /torrent//torrent/shared/shared ; 41 | } 42 | 43 | return $(result) ; 44 | } 45 | 46 | python-extension libtorrent 47 | : src/module.cpp 48 | src/big_number.cpp 49 | src/converters.cpp 50 | src/create_torrent.cpp 51 | src/fingerprint.cpp 52 | src/utility.cpp 53 | src/session.cpp 54 | src/entry.cpp 55 | src/torrent_info.cpp 56 | src/string.cpp 57 | src/torrent_handle.cpp 58 | src/torrent_status.cpp 59 | src/session_settings.cpp 60 | src/version.cpp 61 | src/alert.cpp 62 | src/datetime.cpp 63 | src/torrent.cpp 64 | src/peer_info.cpp 65 | src/ip_filter.cpp 66 | src/magnet_uri.cpp 67 | src/error_code.cpp 68 | : src 69 | @libtorrent_linking 70 | : 71 | static 72 | ; 73 | 74 | install stage_module : libtorrent : . ; 75 | 76 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | EXTRA_DIST = \ 3 | Jamfile \ 4 | setup.py \ 5 | client.py \ 6 | rss_reader.py \ 7 | simple_client.py \ 8 | make_torrent.py \ 9 | src/alert.cpp \ 10 | src/big_number.cpp \ 11 | src/converters.cpp \ 12 | src/create_torrent.cpp \ 13 | src/datetime.cpp \ 14 | src/entry.cpp \ 15 | src/error_code.cpp \ 16 | src/fingerprint.cpp \ 17 | src/gil.hpp \ 18 | src/ip_filter.cpp \ 19 | src/magnet_uri.cpp \ 20 | src/module.cpp \ 21 | src/optional.hpp \ 22 | src/peer_info.cpp \ 23 | src/session.cpp \ 24 | src/session_settings.cpp \ 25 | src/string.cpp \ 26 | src/torrent.cpp \ 27 | src/torrent_handle.cpp \ 28 | src/torrent_info.cpp \ 29 | src/torrent_status.cpp \ 30 | src/utility.cpp \ 31 | src/version.cpp 32 | 33 | if ENABLE_PYTHON_BINDING 34 | 35 | all-local: 36 | $(PYTHON) setup.py build 37 | 38 | install-exec-local: 39 | $(PYTHON) setup.py install @PYTHON_INSTALL_PARAMS@ 40 | 41 | uninstall-local: 42 | rm -rf $(DESTDIR)$(libdir)/python*/*-packages/*libtorrent* 43 | 44 | clean-local: 45 | $(PYTHON) setup.py clean --all 46 | 47 | endif 48 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/make_torrent.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | 3 | import sys 4 | import os 5 | import libtorrent 6 | 7 | if len(sys.argv) < 3: 8 | print 'usage make_torrent.py file tracker-url' 9 | sys.exit(1) 10 | 11 | input = os.path.abspath(sys.argv[1]) 12 | 13 | fs = libtorrent.file_storage() 14 | libtorrent.add_files(fs, input) 15 | if fs.num_files() == 0: 16 | print 'no files added' 17 | sys.exit(1) 18 | 19 | t = libtorrent.create_torrent(fs, 0, 4 * 1024 * 1024) 20 | 21 | t.add_tracker(sys.argv[2]) 22 | t.set_creator('libtorrent %s' % libtorrent.version) 23 | 24 | libtorrent.set_piece_hashes(t, os.path.split(input)[0], lambda x: sys.stderr.write('.')) 25 | sys.stderr.write('\n') 26 | 27 | print libtorrent.bencode(t.generate()) 28 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/rss_reader.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import sys 4 | import libtorrent as lt 5 | import time 6 | 7 | if len(sys.argv) != 2: 8 | print('usage: rss_reader.py rss-feed-url') 9 | sys.exit(1) 10 | 11 | ses = lt.session() 12 | 13 | h = ses.add_feed({'url': sys.argv[1], 'auto_download': False}) 14 | f = h.get_feed_status() 15 | spinner = ['|', '/', '-', '\\'] 16 | i = 0 17 | while f['updating']: 18 | time.sleep(0.1) 19 | i = (i + 1) % 4 20 | print('\b%s' % spinner[i]), 21 | sys.stdout.flush() 22 | f = h.get_feed_status() 23 | 24 | print('\n\nFEED: %s' % f['url']) 25 | if len(f['error']) > 0: 26 | print('ERROR: %s' % f['error']) 27 | 28 | print(' %s\n %s\n' % (f['title'], f['description'])) 29 | print(' ttl: %d minutes' % f['ttl']) 30 | 31 | for item in f['items']: 32 | print('\n%s\n------------------------------------------------------' % item['title']) 33 | print(' url: %s\n size: %d\n uuid: %s\n description: %s' % (item['url'], item['size'], item['uuid'], item['description'])) 34 | print(' comment: %s\n category: %s' % (item['comment'], item['category'])) 35 | 36 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/simple_client.py: -------------------------------------------------------------------------------- 1 | #!/bin/python 2 | # Copyright Arvid Norberg 2008. Use, modification and distribution is 3 | # subject to the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | 7 | import libtorrent as lt 8 | import time 9 | import sys 10 | 11 | ses = lt.session() 12 | ses.listen_on(6881, 6891) 13 | 14 | info = lt.torrent_info(sys.argv[1]) 15 | h = ses.add_torrent({'ti': info, 'save_path': './'}) 16 | print('starting', h.name()) 17 | 18 | while (not h.is_seed()): 19 | s = h.status() 20 | 21 | state_str = ['queued', 'checking', 'downloading metadata', \ 22 | 'downloading', 'finished', 'seeding', 'allocating', 'checking fastresume'] 23 | print('\r%.2f%% complete (down: %.1f kb/s up: %.1f kB/s peers: %d) %s' % \ 24 | (s.progress * 100, s.download_rate / 1000, s.upload_rate / 1000, \ 25 | s.num_peers, state_str[s.state]), end=' ') 26 | sys.stdout.flush() 27 | 28 | time.sleep(1) 29 | 30 | print(h.name(), 'complete') 31 | 32 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/big_number.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | void bind_big_number() 9 | { 10 | using namespace boost::python; 11 | using namespace libtorrent; 12 | 13 | class_("big_number") 14 | .def(self == self) 15 | .def(self != self) 16 | .def(self < self) 17 | .def(self_ns::str(self)) 18 | .def(init()) 19 | .def("clear", &big_number::clear) 20 | .def("is_all_zeros", &big_number::is_all_zeros) 21 | .def("to_string", &big_number::to_string) 22 | // .def("__getitem__", &big_number::opreator[]) 23 | ; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/converters.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Andrew Resch 2009. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | 7 | using namespace boost::python; 8 | 9 | template 10 | struct pair_to_tuple 11 | { 12 | static PyObject* convert(const std::pair& p) 13 | { 14 | return incref(make_tuple(p.first, p.second).ptr()); 15 | } 16 | }; 17 | 18 | template 19 | struct tuple_to_pair 20 | { 21 | tuple_to_pair() 22 | { 23 | converter::registry::push_back( 24 | &convertible, &construct, type_id >() 25 | ); 26 | } 27 | 28 | static void* convertible(PyObject* x) 29 | { 30 | return PyTuple_Check(x) ? x: 0; 31 | } 32 | 33 | static void construct(PyObject* x, converter::rvalue_from_python_stage1_data* data) 34 | { 35 | void* storage = ((converter::rvalue_from_python_storage< 36 | std::pair >*)data)->storage.bytes; 37 | 38 | object o(borrowed(x)); 39 | std::pair p; 40 | p.first = extract(o[0]); 41 | p.second = extract(o[1]); 42 | new (storage) std::pair(p); 43 | data->convertible = storage; 44 | } 45 | }; 46 | 47 | void bind_converters() 48 | { 49 | to_python_converter, pair_to_tuple >(); 50 | tuple_to_pair(); 51 | } 52 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/datetime.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include "optional.hpp" 8 | #include 9 | 10 | using namespace boost::python; 11 | 12 | #if BOOST_VERSION < 103400 13 | 14 | // From Boost 1.34 15 | object import(str name) 16 | { 17 | // should be 'char const *' but older python versions don't use 'const' yet. 18 | char *n = extract(name); 19 | handle<> module(borrowed(PyImport_ImportModule(n))); 20 | return object(module); 21 | } 22 | 23 | #endif 24 | 25 | object datetime_timedelta; 26 | object datetime_datetime; 27 | 28 | struct time_duration_to_python 29 | { 30 | static PyObject* convert(boost::posix_time::time_duration const& d) 31 | { 32 | object result = datetime_timedelta( 33 | 0 // days 34 | , 0 // seconds 35 | , d.total_microseconds() 36 | ); 37 | 38 | return incref(result.ptr()); 39 | } 40 | }; 41 | 42 | struct ptime_to_python 43 | { 44 | static PyObject* convert(boost::posix_time::ptime const& pt) 45 | { 46 | boost::gregorian::date date = pt.date(); 47 | boost::posix_time::time_duration td = pt.time_of_day(); 48 | 49 | object result = datetime_datetime( 50 | (int)date.year() 51 | , (int)date.month() 52 | , (int)date.day() 53 | , td.hours() 54 | , td.minutes() 55 | , td.seconds() 56 | ); 57 | 58 | return incref(result.ptr()); 59 | } 60 | }; 61 | 62 | void bind_datetime() 63 | { 64 | object datetime = import("datetime").attr("__dict__"); 65 | 66 | datetime_timedelta = datetime["timedelta"]; 67 | datetime_datetime = datetime["datetime"]; 68 | 69 | to_python_converter< 70 | boost::posix_time::time_duration 71 | , time_duration_to_python 72 | >(); 73 | 74 | to_python_converter< 75 | boost::posix_time::ptime 76 | , ptime_to_python 77 | >(); 78 | 79 | optional_to_python(); 80 | } 81 | 82 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/error_code.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2011, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | using namespace boost::python; 37 | using namespace libtorrent; 38 | 39 | void bind_error_code() 40 | { 41 | class_("error_code") 42 | .def(init<>()) 43 | .def("message", &error_code::message) 44 | .def("value", &error_code::value) 45 | .def("clear", &error_code::clear) 46 | ; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/fingerprint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | void bind_fingerprint() 9 | { 10 | using namespace boost::python; 11 | using namespace libtorrent; 12 | 13 | class_("fingerprint", no_init) 14 | .def( 15 | init( 16 | (arg("id"), "major", "minor", "revision", "tag") 17 | ) 18 | ) 19 | .def("__str__", &fingerprint::to_string) 20 | .def_readonly("name", &fingerprint::name) 21 | .def_readonly("major_version", &fingerprint::major_version) 22 | .def_readonly("minor_version", &fingerprint::minor_version) 23 | .def_readonly("revision_version", &fingerprint::revision_version) 24 | .def_readonly("tag_version", &fingerprint::tag_version) 25 | ; 26 | } 27 | 28 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/ip_filter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Andrew Resch 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include "gil.hpp" 8 | 9 | using namespace boost::python; 10 | using namespace libtorrent; 11 | 12 | namespace 13 | { 14 | void add_rule(ip_filter& filter, std::string start, std::string end, int flags) 15 | { 16 | return filter.add_rule(address::from_string(start), address::from_string(end), flags); 17 | } 18 | 19 | int access0(ip_filter& filter, std::string addr) 20 | { 21 | return filter.access(address::from_string(addr)); 22 | } 23 | } 24 | 25 | void bind_ip_filter() 26 | { 27 | class_("ip_filter") 28 | .def("add_rule", add_rule) 29 | .def("access", access0) 30 | .def("export_filter", allow_threads(&ip_filter::export_filter)) 31 | ; 32 | } 33 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/magnet_uri.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Andrew Resch 2008. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "gil.hpp" 10 | 11 | using namespace boost::python; 12 | using namespace libtorrent; 13 | 14 | extern void dict_to_add_torrent_params(dict params 15 | , add_torrent_params& p, std::vector& rd); 16 | 17 | namespace { 18 | 19 | #ifndef TORRENT_NO_DEPRECATE 20 | torrent_handle _add_magnet_uri(session& s, std::string uri, dict params) 21 | { 22 | add_torrent_params p; 23 | 24 | std::vector resume_buf; 25 | dict_to_add_torrent_params(params, p, resume_buf); 26 | 27 | allow_threading_guard guard; 28 | 29 | #ifndef BOOST_NO_EXCEPTIONS 30 | return add_magnet_uri(s, uri, p); 31 | #else 32 | error_code ec; 33 | return add_magnet_uri(s, uri, p, ec); 34 | #endif 35 | } 36 | #endif 37 | 38 | dict parse_magnet_uri_wrap(std::string const& uri) 39 | { 40 | add_torrent_params p; 41 | error_code ec; 42 | parse_magnet_uri(uri, p, ec); 43 | 44 | if (ec) throw libtorrent_exception(ec); 45 | 46 | dict ret; 47 | 48 | ret["ti"] = p.ti; 49 | list tracker_list; 50 | for (std::vector::const_iterator i = p.trackers.begin() 51 | , end(p.trackers.end()); i != end; ++i) 52 | tracker_list.append(*i); 53 | ret["trackers"] = tracker_list; 54 | 55 | list nodes_list; 56 | for (std::vector >::const_iterator i = p.dht_nodes.begin() 57 | , end(p.dht_nodes.end()); i != end; ++i) 58 | tracker_list.append(make_tuple(i->first, i->second)); 59 | ret["dht_nodes"] = nodes_list; 60 | ret["info_hash"] = p.info_hash; 61 | ret["name"] = p.name; 62 | ret["save_path"] = p.save_path; 63 | ret["storage_mode"] = p.storage_mode; 64 | ret["url"] = p.url; 65 | ret["uuid"] = p.uuid; 66 | ret["source_feed_url"] = p.source_feed_url; 67 | ret["flags"] = p.flags; 68 | return ret; 69 | } 70 | 71 | std::string (*make_magnet_uri0)(torrent_handle const&) = make_magnet_uri; 72 | std::string (*make_magnet_uri1)(torrent_info const&) = make_magnet_uri; 73 | } 74 | 75 | void bind_magnet_uri() 76 | { 77 | #ifndef TORRENT_NO_DEPRECATE 78 | def("add_magnet_uri", &_add_magnet_uri); 79 | #endif 80 | def("make_magnet_uri", make_magnet_uri0); 81 | def("make_magnet_uri", make_magnet_uri1); 82 | def("parse_magnet_uri", parse_magnet_uri_wrap); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/module.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifdef __GNUC__ 6 | #define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY 1 7 | #endif 8 | 9 | #include "libtorrent/config.hpp" 10 | #include 11 | 12 | void bind_utility(); 13 | void bind_fingerprint(); 14 | void bind_big_number(); 15 | void bind_session(); 16 | void bind_entry(); 17 | void bind_torrent_info(); 18 | void bind_unicode_string_conversion(); 19 | void bind_torrent_handle(); 20 | void bind_torrent_status(); 21 | void bind_session_settings(); 22 | void bind_version(); 23 | void bind_alert(); 24 | void bind_datetime(); 25 | void bind_torrent(); 26 | void bind_peer_info(); 27 | void bind_ip_filter(); 28 | void bind_magnet_uri(); 29 | void bind_converters(); 30 | void bind_create_torrent(); 31 | void bind_error_code(); 32 | 33 | BOOST_PYTHON_MODULE(libtorrent) 34 | { 35 | Py_Initialize(); 36 | PyEval_InitThreads(); 37 | 38 | bind_error_code(); 39 | bind_utility(); 40 | bind_fingerprint(); 41 | bind_big_number(); 42 | bind_entry(); 43 | bind_session(); 44 | bind_torrent_info(); 45 | #if TORRENT_USE_WSTRING 46 | bind_unicode_string_conversion(); 47 | #endif 48 | bind_torrent_handle(); 49 | bind_torrent_status(); 50 | bind_session_settings(); 51 | bind_version(); 52 | bind_alert(); 53 | bind_datetime(); 54 | bind_torrent(); 55 | bind_peer_info(); 56 | bind_ip_filter(); 57 | bind_magnet_uri(); 58 | bind_converters(); 59 | bind_create_torrent(); 60 | } 61 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/optional.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2007. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef OPTIONAL_070108_HPP 6 | # define OPTIONAL_070108_HPP 7 | 8 | # include 9 | # include 10 | 11 | template 12 | struct optional_to_python 13 | { 14 | optional_to_python() 15 | { 16 | boost::python::to_python_converter< 17 | boost::optional, optional_to_python 18 | >(); 19 | } 20 | 21 | static PyObject* convert(boost::optional const& x) 22 | { 23 | if (!x) 24 | return boost::python::incref(Py_None); 25 | 26 | return boost::python::incref(boost::python::object(*x).ptr()); 27 | } 28 | }; 29 | 30 | #endif // OPTIONAL_070108_HPP 31 | 32 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/string.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include "libtorrent/config.hpp" 7 | #include "libtorrent/utf8.hpp" 8 | #include 9 | 10 | #if TORRENT_USE_WSTRING 11 | 12 | using namespace boost::python; 13 | using namespace libtorrent; 14 | 15 | struct unicode_from_python 16 | { 17 | unicode_from_python() 18 | { 19 | converter::registry::push_back( 20 | &convertible, &construct, type_id() 21 | ); 22 | } 23 | 24 | static void* convertible(PyObject* x) 25 | { 26 | #if PY_VERSION_HEX >= 0x03020000 27 | return PyBytes_Check(x) ? x : PyUnicode_Check(x) ? x : 0; 28 | #else 29 | return PyString_Check(x) ? x : PyUnicode_Check(x) ? x : 0; 30 | #endif 31 | } 32 | 33 | static void construct(PyObject* x, converter::rvalue_from_python_stage1_data* data) 34 | { 35 | using libtorrent::wchar_utf8; 36 | void* storage = ((converter::rvalue_from_python_storage< 37 | std::string>*)data)->storage.bytes; 38 | 39 | if (PyUnicode_Check(x)) 40 | { 41 | std::wstring str; 42 | str.resize(PyUnicode_GetSize(x) + 1, 0); 43 | #if PY_VERSION_HEX >= 0x03020000 44 | int len = PyUnicode_AsWideChar(x, &str[0], str.size()); 45 | #else 46 | int len = PyUnicode_AsWideChar((PyUnicodeObject*)x, &str[0], str.size()); 47 | #endif 48 | if (len > -1) 49 | { 50 | assert(len < str.size()); 51 | str[len] = 0; 52 | } 53 | else str[str.size()-1] = 0; 54 | 55 | std::string utf8; 56 | int ret = wchar_utf8(str, utf8); 57 | new (storage) std::string(utf8); 58 | } 59 | else 60 | { 61 | #if PY_VERSION_HEX >= 0x03000000 62 | new (storage) std::string(PyBytes_AsString(x)); 63 | #else 64 | new (storage) std::string(PyString_AsString(x)); 65 | #endif 66 | } 67 | data->convertible = storage; 68 | } 69 | }; 70 | 71 | void bind_unicode_string_conversion() 72 | { 73 | unicode_from_python(); 74 | } 75 | 76 | #endif // TORRENT_USE_WSTRING 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/torrent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2007. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | using namespace boost::python; 9 | using namespace libtorrent; 10 | 11 | void bind_torrent() 12 | { 13 | class_("torrent", no_init); 14 | } 15 | 16 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/utility.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | using namespace boost::python; 10 | using namespace libtorrent; 11 | 12 | object client_fingerprint_(peer_id const& id) 13 | { 14 | boost::optional result = client_fingerprint(id); 15 | return result ? object(*result) : object(); 16 | } 17 | 18 | entry bdecode_(std::string const& data) 19 | { 20 | return bdecode(data.begin(), data.end()); 21 | } 22 | 23 | std::string bencode_(entry const& e) 24 | { 25 | std::string result; 26 | bencode(std::back_inserter(result), e); 27 | return result; 28 | } 29 | 30 | void bind_utility() 31 | { 32 | def("identify_client", &libtorrent::identify_client); 33 | def("client_fingerprint", &client_fingerprint_); 34 | def("bdecode", &bdecode_); 35 | def("bencode", &bencode_); 36 | } 37 | 38 | -------------------------------------------------------------------------------- /libtorrent/bindings/python/src/version.cpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2006. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #include 6 | #include 7 | 8 | using namespace boost::python; 9 | 10 | void bind_version() 11 | { 12 | scope().attr("version") = LIBTORRENT_VERSION; 13 | scope().attr("version_major") = LIBTORRENT_VERSION_MAJOR; 14 | scope().attr("version_minor") = LIBTORRENT_VERSION_MINOR; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /libtorrent/build_dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | #clear out any extended attributes that Finder may add 5 | sudo xattr -r -d com.apple.FinderInfo * 6 | 7 | rm -f config.log config.report configure 8 | rm -f m4/libtool.m4 m4/lt~obsolete.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/ltoptions.m4 9 | rm -fr autom4te.cache build-aux 10 | rm -f Makefile Makefile.in 11 | rm -f src/Makefile src/Makefile.in 12 | rm -f include/libtorrent/Makefile include/libtorrent/Makefile.in 13 | rm -f examples/Makefile examples/Makefile.in examples/.dep examples/.libs 14 | rm -rf test/Makefile test/Makefile.in test/.dep test/.lib 15 | rm -rf bindings/Makefile bindings/Makefile.in bindings/.dep bindings/.libs 16 | rm -f bindings/python/Makefile bindings/python/Makefile.in 17 | chmod a-x docs/*.rst docs/*.htm* src/*.cpp include/libtorrent/*.hpp 18 | 19 | ./autotool.sh 20 | ./configure --enable-python-binding --enable-examples=yes --enable-tests=yes --with-boost-system=mt --with-boost-python=mt --enable-tests 21 | make V=1 -j8 dist check 22 | -------------------------------------------------------------------------------- /libtorrent/dht_flood.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | import socket 4 | import sys 5 | from types import StringType, IntType, LongType, DictType, ListType, TupleType 6 | import random 7 | 8 | port = int(sys.argv[1]) 9 | 10 | # from BitTorrent 4.3.0 11 | def encode_bencached(x,r): 12 | r.append(x.bencoded) 13 | 14 | def encode_int(x, r): 15 | r.extend(('i', str(x), 'e')) 16 | 17 | def encode_string(x, r): 18 | r.extend((str(len(x)), ':', x)) 19 | 20 | def encode_list(x, r): 21 | r.append('l') 22 | for i in x: 23 | encode_func[type(i)](i, r) 24 | r.append('e') 25 | 26 | def encode_dict(x,r): 27 | r.append('d') 28 | ilist = x.items() 29 | ilist.sort() 30 | for k, v in ilist: 31 | r.extend((str(len(k)), ':', k)) 32 | encode_func[type(v)](v, r) 33 | r.append('e') 34 | 35 | encode_func = {} 36 | encode_func[IntType] = encode_int 37 | encode_func[LongType] = encode_int 38 | encode_func[StringType] = encode_string 39 | encode_func[ListType] = encode_list 40 | encode_func[TupleType] = encode_list 41 | encode_func[DictType] = encode_dict 42 | 43 | def bencode(x): 44 | r = [] 45 | encode_func[type(x)](x, r) 46 | return ''.join(r) 47 | 48 | def send_dht_message(msg): 49 | s.sendto(bencode(msg), 0, ('127.0.0.1', port)) 50 | 51 | def random_key(): 52 | ret = '' 53 | for i in range(0, 20): 54 | ret += chr(random.randint(0, 255)) 55 | return ret 56 | 57 | s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 58 | node_id = '1' * 20; 59 | query = 'get_peers' 60 | 61 | print 'test random info-hashes' 62 | for i in xrange(1, 30000): 63 | send_dht_message({'a': {'id': node_id, 'info_hash': random_key()}, 'q': query, 'y': 'q', 't': '%d' % i}) 64 | 65 | print 'test random peer-ids' 66 | for i in xrange(1, 30000): 67 | send_dht_message({'a': {'id': random_key(), 'info_hash': random_key()}, 'q': query, 'y': 'q', 't': '%d' % i}) 68 | 69 | -------------------------------------------------------------------------------- /libtorrent/docs/Linkage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/Linkage.png -------------------------------------------------------------------------------- /libtorrent/docs/arctic_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/arctic_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/bitbuddy_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/bitbuddy_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/bitfox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/bitfox.png -------------------------------------------------------------------------------- /libtorrent/docs/bitrocket_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/bitrocket_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/bitscast_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/bitscast_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/bitslug_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/bitslug_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/btg_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/btg_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/bubba.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/bubba.png -------------------------------------------------------------------------------- /libtorrent/docs/client_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/client_test.png -------------------------------------------------------------------------------- /libtorrent/docs/client_test.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | client_test example program 3 | =========================== 4 | 5 | Client test is a, more or less, complete bittorrent client. It lacks most 6 | settings and you can't start or stop torrents once you've started it. All 7 | the settings are hardcoded. The commandline arguments are:: 8 | 9 | client_test ... 10 | 11 | You can start any number of torrent downloads/seeds via the commandline. 12 | If one argument starts with ``http://`` it is interpreted as a tracker 13 | announce url, and it expects an info-hash as the next argument. The info-hash 14 | has to be hex-encoded. For example: ``2410d4554d5ed856d69f426c38791673c59f4418``. 15 | If you pass an announce url and info-hash, a torrent-less download is started. 16 | It relies on that at least one peer on the tracker is running a libtorrent based 17 | client and has the metadata (.torrent file). The metadata extension in 18 | libtorrent will then download it from that peer (or from those peers if more 19 | than one). 20 | 21 | While running, the ``client_test`` sample will look something like this: 22 | 23 | .. image:: client_test.png 24 | 25 | The commands available in the client are: 26 | 27 | * ``q`` quits the client (there will be a delay while the client waits 28 | for tracker responses) 29 | * ``l`` toggle log. Will display the log at the bottom, informing about 30 | tracker and peer events. 31 | * ``i`` toggles torrent info. Will show the peer list for each torrent. 32 | * ``d`` toggle download info. Will show the block list for each torrent, 33 | showing downloaded and requested blocks. 34 | * ``p`` pause all torrents. 35 | * ``u`` unpause all torrents. 36 | * ``r`` force tracker reannounce for all torrents. 37 | * ``f`` toggle show file progress. Displays a list of all files and the 38 | download progress for each file. 39 | 40 | The list at the bottom (shown if you press ``d``) shows which blocks has 41 | been requested from which peer. The green background means that it has been 42 | downloaded. It shows that fast peers will prefer to request whole pieces 43 | instead of dowloading parts of pieces. It may make it easier to determine 44 | which peer that sent the corrupt data if a piece fails the hash test. 45 | 46 | .. image:: unicode_support.png 47 | 48 | There's unicode support on linux, MacOS X and Windows. 49 | 50 | 51 | -------------------------------------------------------------------------------- /libtorrent/docs/contributing.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | libtorrent manual 3 | ================= 4 | 5 | :Author: Arvid Norberg, arvid@rasterbar.com 6 | :Version: 1.0.0 7 | 8 | .. contents:: Table of contents 9 | :depth: 2 10 | :backlinks: none 11 | 12 | contributing to libtorrent 13 | ========================== 14 | 15 | There are several ways to contribute to libtorrent at various levels. Any help is 16 | much appreciated. If you're interested in something libtorrent related that's not 17 | enumerated on this page, please contact arvid@rasterbar.com or the `mailing list`_. 18 | 19 | .. _`mailing list`: http://lists.sourceforge.net/lists/listinfo/libtorrent-discuss 20 | 21 | 1. Testing 22 | This is not just limited to finding bugs and ways to reproduce crashes, but also 23 | sub-optimal behavior is certain scenarios and finding ways to reproduce those. Please 24 | report any issue to the bug tracker at `google code`_. 25 | 26 | New features that need testing are streaming (``set_piece_deadline()``), the different 27 | choking algorithms (especially the new BitTyrant choker), the disk cache options (such 28 | as ``explicit_cache``). 29 | 30 | .. _`google code`: http://code.google.com/p/libtorrent/issues/entry 31 | 32 | 2. Documentation 33 | Finding typos or outdated sections in the documentation. Contributing documentation 34 | based on your own experience and experimentation with the library or with BitTorrent 35 | in general. Non-reference documentation is very much welcome as well, higher level 36 | descriptions on how to configure libtorrent for various situations for instance. 37 | 38 | 3. Code 39 | Contributing code for new features or bug-fixes is highly welcome. If you're interested 40 | in adding a feature but not sure where to start, please contact the `mailing list`_ or 41 | ``#libtorrent`` @ ``irc.freenode.net``. 42 | 43 | New features might be better support for integrating with other services, new choking 44 | algorithms, seeding policies, ports to new platforms etc. 45 | 46 | For an overview of the internals of libtorrent, see the hacking_ page. 47 | 48 | For outstanding things to do, see the `todo list`_. 49 | 50 | .. _hacking: hacking.html 51 | 52 | .. _`todo list`: todo.html 53 | 54 | -------------------------------------------------------------------------------- /libtorrent/docs/cwnd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/cwnd.png -------------------------------------------------------------------------------- /libtorrent/docs/cwnd_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/cwnd_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/delays.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/delays.png -------------------------------------------------------------------------------- /libtorrent/docs/delays_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/delays_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/deluge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/deluge.png -------------------------------------------------------------------------------- /libtorrent/docs/dht_extensions.rst: -------------------------------------------------------------------------------- 1 | :Author: Arvid Norberg, arvid@rasterbar.com 2 | 3 | Mainline DHT extensions 4 | ======================= 5 | 6 | libtorrent implements a few extensions to the Mainline DHT protocol. 7 | 8 | get_peers response 9 | ------------------ 10 | 11 | libtorrent always responds with ``nodes`` to a get_peers request. If it has 12 | peers for the specified info-hash, it will return ``values`` as well. This is 13 | because just because some peer announced to us, doesn't mean that we are 14 | among the 8 closest nodes of the info hash. libtorrent also keeps traversing 15 | nodes using get_peers until it has found the 8 closest ones, and then announces 16 | to those nodes. 17 | 18 | forward compatibility 19 | --------------------- 20 | 21 | In order to support future DHT messages, any message which is not recognized 22 | but has either an ``info_hash`` or ``target`` argument is interpreted as 23 | find node for that target. i.e. it returns nodes. This allows future messages 24 | to be properly forwarded by clients that don't understand them instead of 25 | being blocked. 26 | 27 | client identification 28 | --------------------- 29 | 30 | In each DHT packet, an extra key is inserted named "v". This is a string 31 | describing the client and version used. This can help alot when debugging 32 | and finding errors in client implementations. The string is encoded as four 33 | characters, two characters describing the client and two characters interpreted 34 | as a binary number describing the client version. 35 | 36 | Currently known clients: 37 | 38 | +---------------+--------+ 39 | | uTorrent | ``UT`` | 40 | +---------------+--------+ 41 | | libtorrent | ``LT`` | 42 | +---------------+--------+ 43 | | MooPolice | ``MP`` | 44 | +---------------+--------+ 45 | | GetRight | ``GR`` | 46 | +---------------+--------+ 47 | 48 | IPv6 support 49 | ------------ 50 | 51 | **This extension is superseeded by** `BEP 32`_. 52 | 53 | .. _`BEP 32`: http://bittorrent.org/beps/bep_0032.html 54 | 55 | The DHT messages that don't support IPv6 are the ``nodes`` replies. 56 | They encode all the contacts as 6 bytes packed together in sequence in a 57 | string. The problem is that IPv6 endpoints cannot be encoded as 6 bytes, but 58 | needs 18 bytes. The extension libtorrent applies is to add another key, called 59 | ``nodes2``. 60 | 61 | ``nodes2`` may be present in replies that contains a ``nodes`` key. It is encoded 62 | as a list of strings. Each string represents one contact and is encoded as 20 63 | bytes node-id and then a variable length encoded IP address (6 bytes in IPv4 case 64 | and 18 bytes in IPv6 case). 65 | 66 | As an optimization, libtorrent does not include the extra key in case there are 67 | only IPv4 nodes present. 68 | 69 | -------------------------------------------------------------------------------- /libtorrent/docs/disk_access.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_access.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_access_elevator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_access_elevator.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_access_no_elevator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_access_no_elevator.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_buffer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_buffer.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_buffer_before_optimization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_buffer_before_optimization.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_buffer_sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_buffer_sample.png -------------------------------------------------------------------------------- /libtorrent/docs/disk_io.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/disk_io.png -------------------------------------------------------------------------------- /libtorrent/docs/electric_sheep_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/electric_sheep_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/fatrat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/fatrat.png -------------------------------------------------------------------------------- /libtorrent/docs/fdm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/fdm.png -------------------------------------------------------------------------------- /libtorrent/docs/firetorrent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/firetorrent.png -------------------------------------------------------------------------------- /libtorrent/docs/flush.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/flush.jpg -------------------------------------------------------------------------------- /libtorrent/docs/folx.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/folx.png -------------------------------------------------------------------------------- /libtorrent/docs/halite_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/halite_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/im_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/im_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/ip_id_v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/ip_id_v4.png -------------------------------------------------------------------------------- /libtorrent/docs/ip_id_v6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/ip_id_v6.png -------------------------------------------------------------------------------- /libtorrent/docs/ips.py: -------------------------------------------------------------------------------- 1 | #/bin/python 2 | 3 | import os 4 | import sys 5 | 6 | def num_ids(bits, total_bits): 7 | 8 | if total_bits == 32: 9 | bit_dec = 2 10 | else: 11 | bit_dec = 1 12 | 13 | num_used = 7; 14 | ret = 3 15 | 16 | while bits > 0: 17 | ret += min(num_used, bits) 18 | num_used -= bit_dec 19 | if num_used < 0: num_used = 0 20 | bits -= 8 21 | 22 | return 1 << ret 23 | 24 | f = open('ip_id_v4.dat', 'w+') 25 | for i in range(0, 33): 26 | print >>f, '%d\t%d\t%d' % (i, num_ids(i, 32), 1 << i) 27 | f.close() 28 | 29 | f = open('ip_id_v6.dat', 'w+') 30 | for i in range(0, 65): 31 | print >>f, '%d\t%d\t%d' % (i, num_ids(i, 64), 1 << i) 32 | f.close() 33 | 34 | f = open('ip_id.gnuplot', 'w+') 35 | 36 | f.write(''' 37 | set term png size 600,300 38 | set output "ip_id_v4.png" 39 | set logscale y 40 | set title "Number of possible node IDs" 41 | set ylabel "possible node IDs" 42 | set xlabel "bits controlled in IPv4" 43 | set xtics 4 44 | set grid 45 | plot "ip_id_v4.dat" using 1:2 title "octet-wise modulus" with lines, \ 46 | "ip_id_v4.dat" using 1:3 title "hash of IP" with lines 47 | 48 | set output "ip_id_v6.png" 49 | set title "Number of possible node IDs" 50 | set xlabel "bits controlled in IPv6" 51 | plot "ip_id_v6.dat" using 1:2 title "octet-wise modulus" with lines, \ 52 | "ip_id_v6.dat" using 1:3 title "hash of IP" with lines 53 | ''') 54 | f.close() 55 | os.system('gnuplot ip_id.gnuplot') 56 | 57 | -------------------------------------------------------------------------------- /libtorrent/docs/leechcraft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/leechcraft.png -------------------------------------------------------------------------------- /libtorrent/docs/libtorrent_screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/libtorrent_screen.png -------------------------------------------------------------------------------- /libtorrent/docs/limewire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/limewire.png -------------------------------------------------------------------------------- /libtorrent/docs/lince.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/lince.png -------------------------------------------------------------------------------- /libtorrent/docs/make_thumb.sh: -------------------------------------------------------------------------------- 1 | convert $1 -resize 150x130 $1 2 | 3 | -------------------------------------------------------------------------------- /libtorrent/docs/makefile: -------------------------------------------------------------------------------- 1 | # this makefile assumes that you have docutils and rst2pdf installed 2 | 3 | WEB_PATH = ~/Documents/rasterbar/web/products/libtorrent 4 | 5 | TARGETS = index \ 6 | udp_tracker_protocol \ 7 | dht_rss \ 8 | dht_store \ 9 | client_test \ 10 | manual \ 11 | building \ 12 | features \ 13 | contributing\ 14 | examples \ 15 | extension_protocol \ 16 | make_torrent \ 17 | dht_extensions \ 18 | dht_sec \ 19 | libtorrent_plugins \ 20 | python_binding \ 21 | projects \ 22 | running_tests \ 23 | utp \ 24 | tuning \ 25 | hacking 26 | 27 | FIGURES = read_disk_buffers write_disk_buffers troubleshooting 28 | 29 | html: $(TARGETS:=.html) $(FIGURES:=.png) 30 | 31 | pdf: $(TARGETS:=.pdf) $(FIGURES:=.eps) 32 | 33 | epub: $(TARGETS:=.epub) $(FIGURES:=.png) 34 | 35 | all: html 36 | 37 | %.epub:%.rst 38 | rst2epub $? $@ 39 | 40 | %.pdf:%.rst 41 | rst2pdf $? -o $@ --stylesheets stylesheet 42 | 43 | %.html:%.rst 44 | rst2html-2.6.py --template=template.txt --stylesheet-path=style.css --link-stylesheet --no-toc-backlinks $? > $@ 45 | cp $@ $(WEB_PATH)/$@ 46 | 47 | %.png:%.dot 48 | dot -Tpng $? >$@ 49 | cp $@ $(WEB_PATH)/$@ 50 | 51 | %.eps:%.dot 52 | dot -Teps $? >$@ 53 | cp $@ $(WEB_PATH)/$@ 54 | 55 | clean: 56 | rm -f $(TARGETS:=.html) $(TARGETS:=.pdf) 57 | 58 | -------------------------------------------------------------------------------- /libtorrent/docs/merkle_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/merkle_tree.png -------------------------------------------------------------------------------- /libtorrent/docs/miro.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/miro.jpg -------------------------------------------------------------------------------- /libtorrent/docs/moopolice_thumb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/moopolice_thumb.gif -------------------------------------------------------------------------------- /libtorrent/docs/our_delay_base.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/our_delay_base.png -------------------------------------------------------------------------------- /libtorrent/docs/our_delay_base_thumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/our_delay_base_thumb.png -------------------------------------------------------------------------------- /libtorrent/docs/pump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/pump.png -------------------------------------------------------------------------------- /libtorrent/docs/qbittorrent_thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/qbittorrent_thumb.jpg -------------------------------------------------------------------------------- /libtorrent/docs/read_disk_buffers.dot: -------------------------------------------------------------------------------- 1 | digraph uploading { 2 | 3 | node [shape=box]; 4 | 5 | subgraph user_space { 6 | rank=same; 7 | "disk cache" -> "send buffer" [label="copy into peer's send buffer (copy)"] 8 | "send buffer" -> "encrypted send buffer" [label="encrypt in-place (no copy)" style=dashed]; 9 | } 10 | 11 | subgraph kernel { 12 | rank=same; 13 | "kernel page cache"; 14 | "socket kernel buffer" 15 | } 16 | 17 | "encrypted send buffer" -> "socket kernel buffer" [label="write() to socket (copy)"]; 18 | "kernel page cache" -> "disk cache" [label="read() from file (copy)"] 19 | } 20 | 21 | -------------------------------------------------------------------------------- /libtorrent/docs/read_disk_buffers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/read_disk_buffers.png -------------------------------------------------------------------------------- /libtorrent/docs/running_tests.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | libtorrent manual 3 | ================= 4 | 5 | :Author: Arvid Norberg, arvid@rasterbar.com 6 | 7 | .. contents:: Table of contents 8 | :depth: 2 9 | :backlinks: none 10 | 11 | running and building tests 12 | ========================== 13 | 14 | Some of the tests of libtorrent are not self contained. For instance, in 15 | order to test the ``http_connection`` class in libtorrent, the test requires 16 | lighty_. This document outlines the requirements of the tests as well as 17 | describes how to set up your environment to be able to run them. 18 | 19 | .. _lighty: http://www.lighttpd.net 20 | 21 | lighty 22 | ====== 23 | 24 | Download lighty_. I've tested with ``lighttpd-1.4.19``. If libtorrent is built 25 | with SSL support (which it is by default), lighty needs SSL support as well. 26 | 27 | To build lighty with SSL support do:: 28 | 29 | ./configure --with-openssl 30 | 31 | Followed by:: 32 | 33 | sudo make install 34 | 35 | Make sure you have SSL support in lighty by running:: 36 | 37 | lighttpd -V 38 | 39 | Which gives you a list of all enabled features. 40 | 41 | delegate 42 | ======== 43 | 44 | Delegate_ can act as many different proxies, which makes it a convenient 45 | tool to use to test libtorrent's support for SOCKS4, SOCKS5, HTTPS and 46 | HTTP proxies. 47 | 48 | .. _Delegate: http://www.delegate.org 49 | 50 | You can download prebuilt binaries for the most common platforms on 51 | `deletate's download page`_. Make sure to name the executable ``delegated`` 52 | and put it in a place where a shell can pick it up, in its ``PATH``. For 53 | instance ``/bin``. 54 | 55 | .. _`deletate's download page`: http://www.delegate.org/delegate/download/ 56 | 57 | OpenSSL 58 | ======= 59 | 60 | In order to create an SSL certificate for lighty_, openssl is used. More 61 | specifically, the following command is issued by the test to create the 62 | certificate file:: 63 | 64 | echo -e "AU\ntest province\ntest city\ntest company\ntest department\n\ 65 | tester\ntest@test.com" | openssl req -new -x509 -keyout server.pem \ 66 | -out server.pem -days 365 -nodes 67 | 68 | This will write ``server.pem`` which is referenced in the lighty 69 | confiuration file. 70 | 71 | OpenSSL comes installed with most Linux and BSD distros, including Mac OS X. 72 | You can download it from `the openssl homepage`_. 73 | 74 | .. _`the openssl homepage`: http://www.openssl.org/ 75 | 76 | -------------------------------------------------------------------------------- /libtorrent/docs/session_stats_peers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/session_stats_peers.png -------------------------------------------------------------------------------- /libtorrent/docs/storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/storage.png -------------------------------------------------------------------------------- /libtorrent/docs/t2e.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/t2e.jpg -------------------------------------------------------------------------------- /libtorrent/docs/template.txt: -------------------------------------------------------------------------------- 1 | %(head_prefix)s 2 | %(head)s 3 | 4 | 5 | 16 | %(stylesheet)s 17 | 22 | %(body_prefix)s 23 |
24 |
25 | 30 |
31 | 35 |
36 | %(body_pre_docinfo)s 37 | %(docinfo)s 38 | %(body)s 39 |
40 | 43 |
44 | 46 | 50 | %(body_suffix)s 51 | -------------------------------------------------------------------------------- /libtorrent/docs/tonidoplug.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/tonidoplug.png -------------------------------------------------------------------------------- /libtorrent/docs/troubleshooting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/troubleshooting.png -------------------------------------------------------------------------------- /libtorrent/docs/tvblob.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/tvblob.jpg -------------------------------------------------------------------------------- /libtorrent/docs/tvitty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/tvitty.jpg -------------------------------------------------------------------------------- /libtorrent/docs/udp_tracker_protocol.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/udp_tracker_protocol.html -------------------------------------------------------------------------------- /libtorrent/docs/unicode_support.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/unicode_support.png -------------------------------------------------------------------------------- /libtorrent/docs/write_disk_buffers.dot: -------------------------------------------------------------------------------- 1 | digraph downloading { 2 | label="" 3 | node [shape=box]; 4 | 5 | subgraph user_space { 6 | rank=same; 7 | "receive buffer" -> "plain text buffer" [label="decrypt in-place (no copy)" style=dashed]; 8 | "plain text buffer" -> "disk cache" [label="move buffer reference (no copy)" style=dashed] 9 | } 10 | 11 | subgraph kernel { 12 | rank=same; 13 | "socket kernel buffer"; 14 | "kernel page cache" 15 | } 16 | 17 | "socket kernel buffer" -> "receive buffer" [label="read() on socket (copy)"]; 18 | "disk cache" -> "kernel page cache" [label="write() to file (copy)"] 19 | } 20 | 21 | -------------------------------------------------------------------------------- /libtorrent/docs/write_disk_buffers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/write_disk_buffers.png -------------------------------------------------------------------------------- /libtorrent/docs/ziptorrent_thumb.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/ziptorrent_thumb.gif -------------------------------------------------------------------------------- /libtorrent/docs/zyxel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/docs/zyxel.png -------------------------------------------------------------------------------- /libtorrent/examples/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /torrent : .. ; 6 | 7 | if $(BOOST_ROOT) 8 | { 9 | use-project /boost : $(BOOST_ROOT) ; 10 | } 11 | 12 | project client_test 13 | : requirements 14 | multi /torrent//torrent 15 | : default-build 16 | static 17 | ; 18 | 19 | exe client_test : client_test.cpp ; 20 | 21 | exe simple_client : simple_client.cpp ; 22 | exe dump_torrent : dump_torrent.cpp ; 23 | exe make_torrent : make_torrent.cpp ; 24 | exe enum_if : enum_if.cpp ; 25 | exe connection_tester : connection_tester.cpp ; 26 | exe fragmentation_test : fragmentation_test.cpp ; 27 | exe rss_reader : rss_reader.cpp ; 28 | exe upnp_test : upnp_test.cpp ; 29 | 30 | exe parse_request_log : parse_request_log.cpp ; 31 | 32 | -------------------------------------------------------------------------------- /libtorrent/examples/Makefile.am: -------------------------------------------------------------------------------- 1 | example_programs = \ 2 | client_test \ 3 | dump_torrent \ 4 | enum_if \ 5 | fragmentation_test\ 6 | make_torrent \ 7 | simple_client \ 8 | rss_reader \ 9 | parse_request_log \ 10 | upnp_test \ 11 | utp_test \ 12 | connection_tester 13 | 14 | if ENABLE_EXAMPLES 15 | bin_PROGRAMS = $(example_programs) 16 | endif 17 | 18 | EXTRA_PROGRAMS = $(example_programs) 19 | EXTRA_DIST = Jamfile 20 | 21 | client_test_SOURCES = client_test.cpp 22 | #client_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 23 | 24 | dump_torrent_SOURCES = dump_torrent.cpp 25 | #dump_torrent_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 26 | 27 | make_torrent_SOURCES = make_torrent.cpp 28 | #make_torrent_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 29 | 30 | simple_client_SOURCES = simple_client.cpp 31 | #simple_client_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 32 | 33 | enum_if_SOURCES = enum_if.cpp 34 | #enum_if_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 35 | 36 | connection_tester_SOURCES = connection_tester.cpp 37 | #connection_tester_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 38 | 39 | rss_reader_SOURCES = rss_reader.cpp 40 | #rss_reader_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 41 | 42 | utp_test_SOURCES = rss_reader.cpp 43 | #utp_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 44 | 45 | parse_request_log_SOURCES = parse_request_log.cpp 46 | #parse_request_log_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 47 | 48 | fragmentation_test_SOURCES = fragmentation_test.cpp 49 | #fragmentation_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 50 | 51 | upnp_test_SOURCES = upnp_test.cpp 52 | #upnp_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 53 | 54 | LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 55 | 56 | AM_CPPFLAGS = -ftemplate-depth-50 -I$(top_srcdir)/include @DEBUGFLAGS@ 57 | 58 | AM_LDFLAGS = @BOOST_SYSTEM_LIB@ 59 | #AM_LDFLAGS = $(LDFLAGS) @BOOST_SYSTEM_LIB@ @BOOST_FILESYSTEM_LIB@ @BOOST_THREAD_LIB@ @OPENSSL_LDFLAGS@ @OPENSSL_LIBS@ 60 | #AM_LDFLAGS = @OPENSSL_LDFLAGS@ 61 | -------------------------------------------------------------------------------- /libtorrent/examples/simple_client.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | #include "libtorrent/entry.hpp" 35 | #include "libtorrent/bencode.hpp" 36 | #include "libtorrent/session.hpp" 37 | 38 | int main(int argc, char* argv[]) 39 | { 40 | using namespace libtorrent; 41 | 42 | if (argc != 2) 43 | { 44 | fputs("usage: ./simple_client torrent-file\n" 45 | "to stop the client, press return.\n", stderr); 46 | return 1; 47 | } 48 | 49 | session s; 50 | error_code ec; 51 | s.listen_on(std::make_pair(6881, 6889), ec); 52 | if (ec) 53 | { 54 | fprintf(stderr, "failed to open listen socket: %s\n", ec.message().c_str()); 55 | return 1; 56 | } 57 | add_torrent_params p; 58 | p.save_path = "./"; 59 | p.ti = new torrent_info(argv[1], ec); 60 | if (ec) 61 | { 62 | fprintf(stderr, "%s\n", ec.message().c_str()); 63 | return 1; 64 | } 65 | s.add_torrent(p, ec); 66 | if (ec) 67 | { 68 | fprintf(stderr, "%s\n", ec.message().c_str()); 69 | return 1; 70 | } 71 | 72 | // wait for the user to end 73 | char a; 74 | scanf("%c\n", &a); 75 | return 0; 76 | } 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/include/libtorrent.vcproj -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/address.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_ADDRESS_HPP_INCLUDED 34 | #define TORRENT_ADDRESS_HPP_INCLUDED 35 | 36 | #include 37 | #include "libtorrent/config.hpp" 38 | 39 | #ifdef __OBJC__ 40 | #define Protocol Protocol_ 41 | #endif 42 | 43 | #if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN 44 | // asio assumes that the windows error codes are defined already 45 | #include 46 | #endif 47 | 48 | #if BOOST_VERSION < 103500 49 | #include 50 | #else 51 | #include 52 | #endif 53 | 54 | #ifdef __OBJC__ 55 | #undef Protocol 56 | #endif 57 | 58 | namespace libtorrent 59 | { 60 | 61 | #if BOOST_VERSION < 103500 62 | typedef ::asio::ip::address address; 63 | typedef ::asio::ip::address_v4 address_v4; 64 | #if TORRENT_USE_IPV6 65 | typedef ::asio::ip::address_v6 address_v6; 66 | #endif 67 | #else 68 | typedef boost::asio::ip::address address; 69 | typedef boost::asio::ip::address_v4 address_v4; 70 | #if TORRENT_USE_IPV6 71 | typedef boost::asio::ip::address_v6 address_v6; 72 | #endif 73 | #endif 74 | } 75 | 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/alert_dispatcher.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_ALERT_DISPATCHER_HPP_INCLUDED 34 | #define TORRENT_ALERT_DISPATCHER_HPP_INCLUDED 35 | 36 | namespace libtorrent 37 | { 38 | class alert; 39 | 40 | struct alert_dispatcher 41 | { 42 | // return true if the alert was swallowed (i.e. 43 | // ownership was taken over). In this case, the 44 | // alert will not be passed on to any one else 45 | virtual bool post_alert(alert* a) = 0; 46 | }; 47 | } 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/alloca.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2008-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_ALLOCA 34 | 35 | #include "libtorrent/config.hpp" 36 | 37 | #if defined TORRENT_WINDOWS || defined TORRENT_MINGW 38 | 39 | #include 40 | #define TORRENT_ALLOCA(t, n) static_cast(_alloca(sizeof(t) * (n))) 41 | 42 | #elif defined TORRENT_BSD 43 | 44 | #include 45 | #define TORRENT_ALLOCA(t, n) static_cast(alloca(sizeof(t) * (n))) 46 | 47 | #else 48 | 49 | #include 50 | #define TORRENT_ALLOCA(t, n) static_cast(alloca(sizeof(t) * (n))) 51 | 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/allocator.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_ALLOCATOR_HPP_INCLUDED 34 | #define TORRENT_ALLOCATOR_HPP_INCLUDED 35 | 36 | #include 37 | #include "libtorrent/config.hpp" 38 | 39 | namespace libtorrent 40 | { 41 | 42 | TORRENT_EXTRA_EXPORT int page_size(); 43 | 44 | struct TORRENT_EXTRA_EXPORT page_aligned_allocator 45 | { 46 | typedef std::size_t size_type; 47 | typedef std::ptrdiff_t difference_type; 48 | 49 | static char* malloc(const size_type bytes); 50 | static void free(char* const block); 51 | }; 52 | 53 | struct TORRENT_EXTRA_EXPORT aligned_holder 54 | { 55 | aligned_holder(): m_buf(0) {} 56 | aligned_holder(int size): m_buf(page_aligned_allocator::malloc(size)) {} 57 | ~aligned_holder() { if (m_buf) page_aligned_allocator::free(m_buf); } 58 | char* get() const { return m_buf; } 59 | void reset(char* buf = 0) 60 | { 61 | if (m_buf) page_aligned_allocator::free(m_buf); 62 | m_buf = buf; 63 | } 64 | void swap(aligned_holder& h) 65 | { 66 | char* tmp = m_buf; 67 | m_buf = h.m_buf; 68 | h.m_buf = tmp; 69 | } 70 | private: 71 | char* m_buf; 72 | }; 73 | 74 | } 75 | 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/bandwidth_queue_entry.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2007-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED 34 | #define TORRENT_BANDWIDTH_QUEUE_ENTRY_HPP_INCLUDED 35 | 36 | #include 37 | #include "libtorrent/bandwidth_limit.hpp" 38 | #include "libtorrent/bandwidth_socket.hpp" 39 | 40 | namespace libtorrent { 41 | 42 | struct TORRENT_EXTRA_EXPORT bw_request 43 | { 44 | bw_request(boost::intrusive_ptr const& pe 45 | , int blk, int prio); 46 | 47 | boost::intrusive_ptr peer; 48 | // 1 is normal prio 49 | int priority; 50 | // the number of bytes assigned to this request so far 51 | int assigned; 52 | // once assigned reaches this, we dispatch the request function 53 | int request_size; 54 | 55 | // the max number of rounds for this request to survive 56 | // this ensures that requests gets responses at very low 57 | // rate limits, when the requested size would take a long 58 | // time to satisfy 59 | int ttl; 60 | 61 | // loops over the bandwidth channels and assigns bandwidth 62 | // from the most limiting one 63 | int assign_bandwidth(); 64 | 65 | bandwidth_channel* channel[5]; 66 | }; 67 | 68 | } 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/bandwidth_socket.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | 34 | #ifndef TORRENT_BANDWIDTH_SOCKET_HPP_INCLUDED 35 | #define TORRENT_BANDWIDTH_SOCKET_HPP_INCLUDED 36 | 37 | #include "libtorrent/intrusive_ptr_base.hpp" 38 | 39 | namespace libtorrent 40 | { 41 | struct bandwidth_socket 42 | : public intrusive_ptr_base 43 | { 44 | virtual void assign_bandwidth(int channel, int amount) = 0; 45 | virtual bool is_disconnecting() const = 0; 46 | virtual ~bandwidth_socket() {} 47 | }; 48 | } 49 | 50 | #endif // TORRENT_BANDWIDTH_SOCKET_HPP_INCLUDED 51 | 52 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/copy_ptr.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2010-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_COPY_PTR 34 | #define TORRENT_COPY_PTR 35 | 36 | namespace libtorrent 37 | { 38 | template 39 | struct copy_ptr 40 | { 41 | copy_ptr(): m_ptr(0) {} 42 | copy_ptr(T* t): m_ptr(t) {} 43 | copy_ptr(copy_ptr const& p): m_ptr(p.m_ptr ? new T(*p.m_ptr) : 0) {} 44 | void reset(T* t = 0) { delete m_ptr; m_ptr = t; } 45 | copy_ptr& operator=(copy_ptr const& p) 46 | { 47 | delete m_ptr; 48 | m_ptr = p.m_ptr ? new T(*p.m_ptr) : 0; 49 | return *this; 50 | } 51 | T* operator->() { return m_ptr; } 52 | T const* operator->() const { return m_ptr; } 53 | T& operator*() { return *m_ptr; } 54 | T const& operator*() const { return *m_ptr; } 55 | void swap(copy_ptr& p) 56 | { 57 | T* tmp = m_ptr; 58 | m_ptr = p.m_ptr; 59 | p.m_ptr = tmp; 60 | } 61 | operator bool() const { return m_ptr != 0; } 62 | ~copy_ptr() { delete m_ptr; } 63 | private: 64 | T* m_ptr; 65 | }; 66 | } 67 | 68 | #endif // TORRENT_COPY_PTR 69 | 70 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/disk_buffer_holder.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2008-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_DISK_BUFFER_HOLDER_HPP_INCLUDED 34 | #define TORRENT_DISK_BUFFER_HOLDER_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | #include "libtorrent/assert.hpp" 38 | #include 39 | 40 | namespace libtorrent 41 | { 42 | 43 | namespace aux { struct session_impl; } 44 | struct disk_buffer_pool; 45 | 46 | struct TORRENT_EXTRA_EXPORT disk_buffer_holder 47 | { 48 | disk_buffer_holder(aux::session_impl& ses, char* buf); 49 | disk_buffer_holder(disk_buffer_pool& disk_pool, char* buf); 50 | ~disk_buffer_holder(); 51 | char* release(); 52 | char* get() const { return m_buf; } 53 | void reset(char* buf = 0); 54 | void swap(disk_buffer_holder& h) 55 | { 56 | TORRENT_ASSERT(&h.m_disk_pool == &m_disk_pool); 57 | std::swap(h.m_buf, m_buf); 58 | } 59 | 60 | typedef char* (disk_buffer_holder::*unspecified_bool_type)(); 61 | operator unspecified_bool_type() const 62 | { return m_buf == 0? 0: &disk_buffer_holder::release; } 63 | 64 | private: 65 | disk_buffer_pool& m_disk_pool; 66 | char* m_buf; 67 | }; 68 | 69 | } 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/error.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_ERROR_HPP_INCLUDED 34 | #define TORRENT_ERROR_HPP_INCLUDED 35 | 36 | #include 37 | #include "libtorrent/config.hpp" 38 | 39 | #if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN 40 | // asio assumes that the windows error codes are defined already 41 | #include 42 | #endif 43 | 44 | #if BOOST_VERSION < 103500 45 | #include 46 | #else 47 | #include 48 | #endif 49 | 50 | namespace libtorrent 51 | { 52 | 53 | #if BOOST_VERSION < 103500 54 | namespace error = asio::error; 55 | #else 56 | namespace error = boost::asio::error; 57 | #endif 58 | 59 | } 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/extensions/logger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2006, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_LOGGER_HPP_INCLUDED 34 | #define TORRENT_LOGGER_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | 42 | #ifdef _MSC_VER 43 | #pragma warning(pop) 44 | #endif 45 | 46 | #include "libtorrent/config.hpp" 47 | 48 | #if TORRENT_USE_IOSTREAM 49 | 50 | namespace libtorrent 51 | { 52 | struct torrent_plugin; 53 | class torrent; 54 | boost::shared_ptr create_logger_plugin(torrent*); 55 | } 56 | 57 | #endif 58 | 59 | #endif // TORRENT_LOGGER_HPP_INCLUDED 60 | 61 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/extensions/lt_trackers.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2008, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_LT_TRACKERS_HPP_INCLUDED 34 | #define TORRENT_LT_TRACKERS_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | #include "libtorrent/config.hpp" 42 | 43 | #ifdef _MSC_VER 44 | #pragma warning(pop) 45 | #endif 46 | 47 | namespace libtorrent 48 | { 49 | struct torrent_plugin; 50 | class torrent; 51 | boost::shared_ptr TORRENT_EXPORT create_lt_trackers_plugin(torrent*, void*); 52 | } 53 | 54 | #endif // TORRENT_LT_TRACKERS_HPP_INCLUDED 55 | 56 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/extensions/metadata_transfer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2006, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_METADATA_TRANSFER_HPP_INCLUDED 34 | #define TORRENT_METADATA_TRANSFER_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | #include "libtorrent/config.hpp" 42 | 43 | #ifdef _MSC_VER 44 | #pragma warning(pop) 45 | #endif 46 | 47 | namespace libtorrent 48 | { 49 | struct torrent_plugin; 50 | class torrent; 51 | TORRENT_EXPORT boost::shared_ptr create_metadata_plugin(torrent*, void*); 52 | } 53 | 54 | #endif // TORRENT_METADATA_TRANSFER_HPP_INCLUDED 55 | 56 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/extensions/smart_ban.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2007, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_SMART_BAN_HPP_INCLUDED 34 | #define TORRENT_SMART_BAN_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | #include "libtorrent/config.hpp" 42 | 43 | #ifdef _MSC_VER 44 | #pragma warning(pop) 45 | #endif 46 | 47 | namespace libtorrent 48 | { 49 | struct torrent_plugin; 50 | class torrent; 51 | TORRENT_EXPORT boost::shared_ptr create_smart_ban_plugin(torrent*, void*); 52 | } 53 | 54 | #endif // TORRENT_SMART_BAN_HPP_INCLUDED 55 | 56 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/extensions/ut_metadata.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2007, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_UT_METADATA_HPP_INCLUDED 34 | #define TORRENT_UT_METADATA_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | #include "libtorrent/config.hpp" 42 | 43 | #ifdef _MSC_VER 44 | #pragma warning(pop) 45 | #endif 46 | 47 | namespace libtorrent 48 | { 49 | struct torrent_plugin; 50 | class torrent; 51 | TORRENT_EXPORT boost::shared_ptr create_ut_metadata_plugin(torrent*, void*); 52 | } 53 | 54 | #endif // TORRENT_UT_METADATA_HPP_INCLUDED 55 | 56 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/extensions/ut_pex.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2006, MassaRoddel 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_UT_PEX_EXTENSION_HPP_INCLUDED 34 | #define TORRENT_UT_PEX_EXTENSION_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | #include "libtorrent/config.hpp" 42 | 43 | #ifdef _MSC_VER 44 | #pragma warning(pop) 45 | #endif 46 | 47 | namespace libtorrent 48 | { 49 | struct torrent_plugin; 50 | class torrent; 51 | TORRENT_EXPORT boost::shared_ptr create_ut_pex_plugin(torrent*, void*); 52 | } 53 | 54 | #endif // TORRENT_UT_PEX_EXTENSION_HPP_INCLUDED 55 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/gzip.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2007-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_GZIP_HPP_INCLUDED 34 | #define TORRENT_GZIP_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | #include 38 | #include 39 | 40 | namespace libtorrent 41 | { 42 | 43 | TORRENT_EXTRA_EXPORT bool inflate_gzip( 44 | char const* in, int size 45 | , std::vector& buffer 46 | , int maximum_size 47 | , std::string& error); 48 | 49 | } 50 | 51 | #endif 52 | 53 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/http_server.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/include/libtorrent/http_server.hpp -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/identify_client.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED 34 | #define TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | 42 | #ifdef _MSC_VER 43 | #pragma warning(pop) 44 | #endif 45 | 46 | #include "libtorrent/peer_id.hpp" 47 | #include "libtorrent/fingerprint.hpp" 48 | #include "libtorrent/config.hpp" 49 | 50 | namespace libtorrent 51 | { 52 | 53 | TORRENT_EXPORT std::string identify_client(const peer_id& p); 54 | TORRENT_EXPORT boost::optional client_fingerprint(peer_id const& p); 55 | 56 | } 57 | 58 | #endif // TORRENT_IDENTIFY_CLIENT_HPP_INCLUDED 59 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/instantiate_connection.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2007-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_INSTANTIATE_CONNECTION 34 | #define TORRENT_INSTANTIATE_CONNECTION 35 | 36 | #include "libtorrent/socket_type.hpp" 37 | #include 38 | 39 | namespace libtorrent 40 | { 41 | struct proxy_settings; 42 | struct utp_socket_manager; 43 | struct socket_type; 44 | 45 | // instantiate a socket_type (s) according to the specified criteria 46 | TORRENT_EXTRA_EXPORT bool instantiate_connection(io_service& ios 47 | , proxy_settings const& ps, socket_type& s 48 | , void* ssl_context = 0 49 | , utp_socket_manager* sm = 0 50 | , bool peer_connection = false); 51 | } 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/invariant_check.hpp: -------------------------------------------------------------------------------- 1 | // Copyright Daniel Wallin 2004. Use, modification and distribution is 2 | // subject to the Boost Software License, Version 1.0. (See accompanying 3 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 4 | 5 | #ifndef TORRENT_INVARIANT_ACCESS_HPP_INCLUDED 6 | #define TORRENT_INVARIANT_ACCESS_HPP_INCLUDED 7 | 8 | #include "libtorrent/assert.hpp" 9 | 10 | namespace libtorrent 11 | { 12 | 13 | class invariant_access 14 | { 15 | public: 16 | template 17 | static void check_invariant(T const& self) 18 | { 19 | self.check_invariant(); 20 | } 21 | }; 22 | 23 | template 24 | void check_invariant(T const& x) 25 | { 26 | invariant_access::check_invariant(x); 27 | } 28 | 29 | struct invariant_checker {}; 30 | 31 | template 32 | struct invariant_checker_impl : invariant_checker 33 | { 34 | invariant_checker_impl(T const& self_) 35 | : self(self_) 36 | { 37 | try 38 | { 39 | check_invariant(self); 40 | } 41 | catch (...) 42 | { 43 | TORRENT_ASSERT(false); 44 | } 45 | } 46 | 47 | ~invariant_checker_impl() 48 | { 49 | try 50 | { 51 | check_invariant(self); 52 | } 53 | catch (...) 54 | { 55 | TORRENT_ASSERT(false); 56 | } 57 | } 58 | 59 | T const& self; 60 | }; 61 | 62 | template 63 | invariant_checker_impl make_invariant_checker(T const& x) 64 | { 65 | return invariant_checker_impl(x); 66 | } 67 | } 68 | 69 | #if defined TORRENT_DEBUG && !defined TORRENT_DISABLE_INVARIANT_CHECKS 70 | #define INVARIANT_CHECK \ 71 | invariant_checker const& _invariant_check = make_invariant_checker(*this); \ 72 | (void)_invariant_check; \ 73 | do {} while (false) 74 | #else 75 | #define INVARIANT_CHECK do {} while (false) 76 | #endif 77 | 78 | #endif // TORRENT_INVARIANT_ACCESS_HPP_INCLUDED 79 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/io_service.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_IO_SERVICE_HPP_INCLUDED 34 | #define TORRENT_IO_SERVICE_HPP_INCLUDED 35 | 36 | #ifdef __OBJC__ 37 | #define Protocol Protocol_ 38 | #endif 39 | 40 | #ifdef _MSC_VER 41 | #pragma warning(push, 1) 42 | #endif 43 | 44 | #include 45 | 46 | #if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN 47 | // asio assumes that the windows error codes are defined already 48 | #include 49 | #endif 50 | 51 | #if BOOST_VERSION < 103500 52 | #include 53 | #else 54 | #include 55 | #endif 56 | 57 | #ifdef _MSC_VER 58 | #pragma warning(pop) 59 | #endif 60 | 61 | #ifdef __OBJC__ 62 | #undef Protocol 63 | #endif 64 | 65 | namespace libtorrent 66 | { 67 | 68 | #if BOOST_VERSION < 103500 69 | typedef ::asio::io_service io_service; 70 | #else 71 | typedef boost::asio::io_service io_service; 72 | #endif 73 | } 74 | 75 | #endif 76 | 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/io_service_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_IO_SERVICE_FWD_HPP_INCLUDED 34 | #define TORRENT_IO_SERVICE_FWD_HPP_INCLUDED 35 | 36 | #ifdef __OBJC__ 37 | #define Protocol Protocol_ 38 | #endif 39 | 40 | #ifdef _MSC_VER 41 | #pragma warning(push, 1) 42 | #endif 43 | 44 | #include 45 | 46 | #ifdef _MSC_VER 47 | #pragma warning(pop) 48 | #endif 49 | 50 | #ifdef __OBJC__ 51 | #undef Protocol 52 | #endif 53 | 54 | #if BOOST_VERSION >= 103500 55 | namespace boost { 56 | #endif 57 | namespace asio { 58 | 59 | class io_service; 60 | 61 | } 62 | #if BOOST_VERSION >= 103500 63 | } 64 | #endif 65 | 66 | namespace libtorrent 67 | { 68 | 69 | #if BOOST_VERSION < 103500 70 | typedef ::asio::io_service io_service; 71 | #else 72 | typedef boost::asio::io_service io_service; 73 | #endif 74 | } 75 | 76 | #endif 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/kademlia/dht_observer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef DHT_OBSERVER_HPP 34 | #define DHT_OBSERVER_HPP 35 | 36 | #include "libtorrent/address.hpp" 37 | 38 | namespace libtorrent { namespace dht 39 | { 40 | struct dht_observer 41 | { 42 | virtual void set_external_address(address const& addr 43 | , address const& source) = 0; 44 | }; 45 | }} 46 | 47 | #endif 48 | 49 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/kademlia/refresh.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2006-2012, Arvid Norberg & Daniel Wallin 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef REFRESH_050324_HPP 34 | #define REFRESH_050324_HPP 35 | 36 | #include 37 | #include 38 | #include 39 | 40 | namespace libtorrent { namespace dht 41 | { 42 | 43 | class routing_table; 44 | class rpc_manager; 45 | 46 | class refresh : public find_data 47 | { 48 | public: 49 | typedef find_data::nodes_callback done_callback; 50 | 51 | refresh(node_impl& node, node_id target 52 | , done_callback const& callback); 53 | 54 | virtual char const* name() const; 55 | 56 | protected: 57 | 58 | observer_ptr new_observer(void* ptr, udp::endpoint const& ep, node_id const& id); 59 | virtual bool invoke(observer_ptr o); 60 | }; 61 | 62 | class bootstrap : public refresh 63 | { 64 | public: 65 | bootstrap(node_impl& node, node_id target 66 | , done_callback const& callback); 67 | 68 | virtual char const* name() const; 69 | 70 | protected: 71 | 72 | virtual void done(); 73 | 74 | }; 75 | 76 | } } // namespace libtorrent::dht 77 | 78 | #endif // REFRESH_050324_HPP 79 | 80 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/parse_url.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2008-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_PARSE_URL_HPP_INCLUDED 34 | #define TORRENT_PARSE_URL_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | 42 | #ifdef _MSC_VER 43 | #pragma warning(pop) 44 | #endif 45 | 46 | #include 47 | #include "libtorrent/config.hpp" 48 | #include "libtorrent/error_code.hpp" 49 | 50 | namespace libtorrent 51 | { 52 | 53 | TORRENT_EXTRA_EXPORT boost::tuple 55 | parse_url_components(std::string url, error_code& ec); 56 | 57 | } 58 | 59 | #endif 60 | 61 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/peer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_PEER_HPP_INCLUDED 34 | #define TORRENT_PEER_HPP_INCLUDED 35 | 36 | #include 37 | 38 | #include "libtorrent/peer_id.hpp" 39 | 40 | namespace libtorrent 41 | { 42 | 43 | struct TORRENT_EXTRA_EXPORT peer_entry 44 | { 45 | std::string ip; 46 | int port; 47 | peer_id pid; 48 | 49 | bool operator==(const peer_entry& p) const 50 | { 51 | return pid == p.pid; 52 | } 53 | 54 | bool operator<(const peer_entry& p) const 55 | { 56 | return pid < p.pid; 57 | } 58 | }; 59 | 60 | } 61 | 62 | #endif // TORRENT_PEER_HPP_INCLUDED 63 | 64 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/peer_request.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2006-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_PEER_REQUEST_HPP_INCLUDED 34 | #define TORRENT_PEER_REQUEST_HPP_INCLUDED 35 | 36 | namespace libtorrent 37 | { 38 | struct TORRENT_EXTRA_EXPORT peer_request 39 | { 40 | int piece; 41 | int start; 42 | int length; 43 | bool operator==(peer_request const& r) const 44 | { return piece == r.piece && start == r.start && length == r.length; } 45 | }; 46 | } 47 | 48 | #endif // TORRENT_PEER_REQUEST_HPP_INCLUDED 49 | 50 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/piece_block_progress.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_PIECE_BLOCK_PROGRESS_HPP_INCLUDED 34 | #define TORRENT_PIECE_BLOCK_PROGRESS_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | 38 | namespace libtorrent 39 | { 40 | struct TORRENT_EXPORT piece_block_progress 41 | { 42 | // the piece and block index 43 | // determines exactly which 44 | // part of the torrent that 45 | // is currently being downloaded 46 | int piece_index; 47 | int block_index; 48 | // the number of bytes we have received 49 | // of this block 50 | int bytes_downloaded; 51 | // the number of bytes in the block 52 | int full_block_bytes; 53 | }; 54 | } 55 | 56 | #endif // TORRENT_PIECE_BLOCK_PROGRESS_HPP_INCLUDED 57 | 58 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/piece_picker.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/include/libtorrent/piece_picker.hpp -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/puff.hpp: -------------------------------------------------------------------------------- 1 | /* puff.h 2 | Copyright (C) 2002, 2003 Mark Adler, all rights reserved 3 | version 1.7, 3 Mar 2002 4 | 5 | This software is provided 'as-is', without any express or implied 6 | warranty. In no event will the author be held liable for any damages 7 | arising from the use of this software. 8 | 9 | Permission is granted to anyone to use this software for any purpose, 10 | including commercial applications, and to alter it and redistribute it 11 | freely, subject to the following restrictions: 12 | 13 | 1. The origin of this software must not be misrepresented; you must not 14 | claim that you wrote the original software. If you use this software 15 | in a product, an acknowledgment in the product documentation would be 16 | appreciated but is not required. 17 | 2. Altered source versions must be plainly marked as such, and must not be 18 | misrepresented as being the original software. 19 | 3. This notice may not be removed or altered from any source distribution. 20 | 21 | Mark Adler madler@alumni.caltech.edu 22 | */ 23 | 24 | 25 | /* 26 | * See puff.c for purpose and usage. 27 | */ 28 | #include 29 | 30 | int puff(unsigned char *dest, /* pointer to destination pointer */ 31 | boost::uint32_t *destlen, /* amount of output space */ 32 | unsigned char *source, /* pointer to source data pointer */ 33 | boost::uint32_t *sourcelen); /* amount of input available */ 34 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/random.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2011-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | 35 | namespace libtorrent 36 | { 37 | void random_seed(boost::uint32_t v); 38 | boost::uint32_t random(); 39 | } 40 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/rsa.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2011-2012, Arvid Norberg, Magnus Jonsson 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_SIGN_HPP_INCLUDED 34 | #define TORRENT_SIGN_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | #include "libtorrent/hasher.hpp" 38 | 39 | namespace libtorrent 40 | { 41 | // both of these use SHA-1 as the message digest to be signed/verified 42 | 43 | // returns the size of the resulting signature 44 | TORRENT_EXTRA_EXPORT int sign_rsa(sha1_hash const& digest 45 | , char const* private_key, int private_len 46 | , char* signature, int sig_len); 47 | 48 | // returns true if the signature is valid 49 | TORRENT_EXTRA_EXPORT bool verify_rsa(sha1_hash const& digest 50 | , char const* public_key, int public_len 51 | , char const* signature, int sig_len); 52 | 53 | // returns false if it fails, for instance if the key 54 | // buffers are too small. public_len and private_len 55 | // are in-out values, set to the actual sizes 56 | TORRENT_EXTRA_EXPORT bool generate_rsa_keys(char* public_key, int* public_len 57 | , char* private_key, int* private_len, int key_size); 58 | } 59 | 60 | #endif // TORRENT_SIGN_HPP_INCLUDED 61 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/settings.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2010-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef SETTINGS_HPP_INCLUDED 34 | #define SETTINGS_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | #include "libtorrent/session_settings.hpp" 38 | 39 | namespace libtorrent 40 | { 41 | struct lazy_entry; 42 | class entry; 43 | 44 | enum { std_string, character, integer 45 | , floating_point, boolean, size_integer 46 | , time_integer }; 47 | 48 | // this is used to map struct entries 49 | // to names in a bencoded dictionary to 50 | // save and load the struct 51 | struct bencode_map_entry 52 | { 53 | char const* name; 54 | int offset; // struct offset 55 | int type; 56 | }; 57 | 58 | void load_struct(lazy_entry const& e, void* s, bencode_map_entry const* m, int num); 59 | void save_struct(entry& e, void const* s, bencode_map_entry const* m, int num, void const* def = 0); 60 | } 61 | 62 | #endif 63 | 64 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/size_type.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_SIZE_TYPE_HPP_INCLUDED 34 | #define TORRENT_SIZE_TYPE_HPP_INCLUDED 35 | 36 | #ifdef _MSC_VER 37 | #pragma warning(push, 1) 38 | #endif 39 | 40 | #include 41 | 42 | #ifdef _MSC_VER 43 | #pragma warning(pop) 44 | #endif 45 | 46 | namespace libtorrent 47 | { 48 | typedef boost::int64_t size_type; 49 | typedef boost::uint64_t unsigned_size_type; 50 | } 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/socket_type_fwd.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_SOCKET_TYPE_FWD_HPP 34 | #define TORRENT_SOCKET_TYPE_FWD_HPP 35 | 36 | namespace libtorrent 37 | { 38 | struct socket_type; 39 | } 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/string_util.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_STRING_UTIL_HPP_INCLUDED 34 | #define TORRENT_STRING_UTIL_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | 38 | namespace libtorrent 39 | { 40 | TORRENT_EXTRA_EXPORT bool is_alpha(char c); 41 | TORRENT_EXPORT bool is_digit(char c); 42 | TORRENT_EXTRA_EXPORT bool is_print(char c); 43 | TORRENT_EXTRA_EXPORT bool is_space(char c); 44 | TORRENT_EXTRA_EXPORT char to_lower(char c); 45 | 46 | TORRENT_EXTRA_EXPORT int split_string(char const** tags, int buf_size, char* in); 47 | TORRENT_EXTRA_EXPORT bool string_begins_no_case(char const* s1, char const* s2); 48 | TORRENT_EXTRA_EXPORT bool string_equal_no_case(char const* s1, char const* s2); 49 | 50 | TORRENT_EXTRA_EXPORT void url_random(char* begin, char* end); 51 | 52 | // strdup is not part of the C standard. Some systems 53 | // don't have it and it won't be available when building 54 | // in strict ansi mode 55 | char* allocate_string_copy(char const* str); 56 | 57 | // returns p + x such that the pointer is 8 bytes aligned 58 | // x cannot be greater than 7 59 | void* align_pointer(void* p); 60 | 61 | } 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/struct_debug.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2011-2012, Arvid Norberg, Magnus Jonsson 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_STRUCT_DEBUG 34 | #define TORRENT_STRUCT_DEBUG 35 | 36 | #define PRINT_SIZEOF(x) snprintf(tmp, sizeof(tmp), "\nsizeof(" #x ") = %d\n", int(sizeof(x))); \ 37 | l << tmp; \ 38 | temp = 0; \ 39 | prev_size = 0; 40 | 41 | #define PRINT_OFFSETOF(x, y) if (offsetof(x, y) > 0) { \ 42 | snprintf(tmp, sizeof(tmp), "\tsize: %-3d\tpadding: %-3d\n" \ 43 | , prev_size \ 44 | , int((offsetof(x, y) - temp)) - prev_size); \ 45 | l << tmp; \ 46 | } \ 47 | snprintf(tmp, sizeof(tmp), "%-50s: %-3d" \ 48 | , #x "::" #y \ 49 | , int(offsetof(x, y))); \ 50 | temp = offsetof(x, y); \ 51 | prev_size = sizeof(reinterpret_cast(0)->y); \ 52 | l << tmp; 53 | 54 | #define PRINT_OFFSETOF_END(x) snprintf(tmp, sizeof(tmp), "\tsize: %-3d\tpadding: %-3d\n" \ 55 | , prev_size, int((sizeof(x) - temp) - prev_size)); \ 56 | l << tmp; 57 | 58 | #endif // TORRENT_STRUCT_DEBUG 59 | 60 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/torrent.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/include/libtorrent/torrent.hpp -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/torrent_handle.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/include/libtorrent/torrent_handle.hpp -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/torrent_server.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/include/libtorrent/torrent_server.hpp -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/utf8.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2006-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_UTF8_HPP_INCLUDED 34 | #define TORRENT_UTF8_HPP_INCLUDED 35 | 36 | #include "libtorrent/config.hpp" 37 | 38 | // on windows we need these functions for 39 | // convert_to_native and convert_from_native 40 | #if TORRENT_USE_WSTRING || defined TORRENT_WINDOWS 41 | 42 | #include 43 | #include 44 | 45 | namespace libtorrent 46 | { 47 | TORRENT_EXPORT int utf8_wchar(const std::string &utf8, std::wstring &wide); 48 | TORRENT_EXPORT int wchar_utf8(const std::wstring &wide, std::string &utf8); 49 | } 50 | #endif // !BOOST_NO_STD_WSTRING 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /libtorrent/include/libtorrent/version.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #ifndef TORRENT_VERSION_HPP_INCLUDED 34 | #define TORRENT_VERSION_HPP_INCLUDED 35 | 36 | #define LIBTORRENT_VERSION_MAJOR 1 37 | #define LIBTORRENT_VERSION_MINOR 0 38 | #define LIBTORRENT_VERSION_TINY 0 39 | 40 | // the format of this version is: MMmmtt 41 | // M = Major version, m = minor version, t = tiny version 42 | #define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTORRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY) 43 | 44 | #define LIBTORRENT_VERSION "1.0.0.0" 45 | #define LIBTORRENT_REVISION "$Rev: 8187 $" 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /libtorrent/libtorrent-rasterbar-cmake.pc.in: -------------------------------------------------------------------------------- 1 | Name: libtorrent-rasterbar 2 | Description: Bittorrent library. 3 | Version: @VERSION@ 4 | Libs: -L${CMAKE_INSTALL_PREFIX}/lib -ltorrent-rasterbar 5 | Cflags: -I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/libtorrent @COMPILETIME_OPTIONS@ @CXX_DEFINES@ 6 | 7 | -------------------------------------------------------------------------------- /libtorrent/libtorrent-rasterbar.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | bindir=@bindir@ 4 | libdir=@libdir@ 5 | datarootdir=@datarootdir@ 6 | datadir=@datadir@ 7 | sysconfdir=@sysconfdir@ 8 | includedir=@includedir@ 9 | package=@PACKAGE@ 10 | 11 | Name: libtorrent-rasterbar 12 | Description: Bittorrent library. 13 | Version: @VERSION@ 14 | Libs: -L${libdir} -ltorrent-rasterbar 15 | Libs.private: @LIBS@ @BOOST_SYSTEM_LIB@ @PTHREAD_LIBS@ @OPENSSL_LIBS@ 16 | Cflags: -I${includedir} -I${includedir}/libtorrent @COMPILETIME_OPTIONS@ 17 | -------------------------------------------------------------------------------- /libtorrent/list_files.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | # Copyright Arvid Norberg 2008. Use, modification and distribution is 3 | # subject to the Boost Software License, Version 1.0. (See accompanying 4 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 | 6 | import os 7 | import sys 8 | 9 | def list_directory(path): 10 | tree = os.walk(path) 11 | for i in tree: 12 | dirs = i[0].split('/') 13 | if 'CVS' in dirs: continue 14 | if '.svn' in dirs: continue 15 | 16 | for file in i[2]: 17 | if file.startswith('.#'): continue 18 | if file == '.DS_Store': continue 19 | print os.path.join(i[0], file) + ' \\' 20 | 21 | list_directory(sys.argv[1]) 22 | 23 | -------------------------------------------------------------------------------- /libtorrent/m4/ax_check_geoip.m4: -------------------------------------------------------------------------------- 1 | # =========================================================================== 2 | # 3 | # SYNOPSIS 4 | # 5 | # AX_CHECK_GEOIP([action-if-found], [action-if-not-found]) 6 | # 7 | # DESCRIPTION 8 | # 9 | # Tests for the GeoIP (libgeoip) library. 10 | # 11 | # This macro calls: 12 | # 13 | # AC_SUBST(GEOIP_CFLAGS) / AC_SUBST(GEOIP_LIBS) 14 | # 15 | # LAST MODIFICATION 16 | # 17 | # 2009-09-05 18 | # 19 | # LICENSE 20 | # 21 | # Copyright (c) 2009 Cristian Greco 22 | # 23 | # Copying and distribution of this file, with or without modification, are 24 | # permitted in any medium without royalty provided the copyright notice 25 | # and this notice are preserved. 26 | 27 | AC_DEFUN([AC_CHECK_GEOIP], 28 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl 29 | 30 | ac_geoip_found="no" 31 | 32 | AC_MSG_CHECKING([for libgeoip with pkg-config]) 33 | PKG_CHECK_EXISTS([geoip], [ 34 | AC_MSG_RESULT([yes]) 35 | PKG_CHECK_MODULES([GEOIP], [geoip], [ 36 | ac_geoip_found="yes" 37 | ], [ 38 | AC_MSG_WARN([pkg-config: geoip module not found]) 39 | ]) 40 | ], [ 41 | AC_MSG_RESULT([no]) 42 | 43 | CPPFLAGS_SAVED="$CPPFLAGS" 44 | LDFLAGS_SAVED="$LDFLAGS" 45 | CFLAGS_SAVED="$CFLAGS" 46 | LIBS_SAVED="$LIBS" 47 | 48 | AC_CHECK_HEADER([GeoIP.h], [ 49 | AC_CHECK_LIB([GeoIP], [GeoIP_new], [ 50 | GEOIP_CFLAGS="" 51 | GEOIP_LIBS="-lGeoIP" 52 | ac_geoip_found="yes" 53 | ], [ 54 | AC_MSG_WARN([libgeoip library not found]) 55 | ]) 56 | ], [ 57 | for ac_geoip_path in /usr /usr/local /opt /opt/local; do 58 | AC_MSG_CHECKING([for GeoIP.h in $ac_geoip_path]) 59 | if test -d "$ac_geoip_path/include/" -a -r "$ac_geoip_path/include/GeoIP.h"; then 60 | AC_MSG_RESULT([yes]) 61 | GEOIP_CFLAGS="-I$ac_geoip_path/include" 62 | GEOIP_LIBS="-lGeoIP" 63 | break; 64 | else 65 | AC_MSG_RESULT([no]) 66 | fi 67 | done 68 | 69 | CFLAGS="$GEOIP_CFLAGS $CFLAGS" 70 | export CFLAGS 71 | LIBS="$GEOIP_LIBS $LIBS" 72 | export LIBS 73 | 74 | AC_MSG_CHECKING([for GeoIP_new in -lGeoIP]) 75 | AC_LINK_IFELSE([ 76 | AC_LANG_PROGRAM([[ #include ]], [[ GeoIP *g = GeoIP_new(GEOIP_STANDARD); ]]) 77 | ], [ 78 | AC_MSG_RESULT([yes]) 79 | ac_geoip_found="yes" 80 | ], [ 81 | AC_MSG_RESULT([no]) 82 | ]) 83 | ]) 84 | 85 | CPPFLAGS="$CPPFLAGS_SAVED" 86 | LDFLAGS="$LDFLAGS_SAVED" 87 | CFLAGS="$CFLAGS_SAVED" 88 | LIBS="$LIBS_SAVED" 89 | ]) 90 | 91 | AS_IF([ test "x$ac_geoip_found" != xno ], [$1], [$2]) 92 | 93 | AC_SUBST([GEOIP_CFLAGS]) 94 | AC_SUBST([GEOIP_LIBS]) 95 | ]) 96 | -------------------------------------------------------------------------------- /libtorrent/parse_bandwidth_log.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import os, sys, time 3 | 4 | keys = [['upload rate', 'x1y1', 6], ['history entries', 'x1y2', 10], ['queue', 'x1y2', 4]] 5 | 6 | out = open('bandwidth.gnuplot', 'wb') 7 | print >>out, "set term png size 1200,700" 8 | print >>out, 'set output "bandwidth_manager.png"' 9 | print >>out, 'set xrange [0:*]' 10 | print >>out, 'set xlabel "time (ms)"' 11 | print >>out, 'set ylabel "Rate (B/s)"' 12 | print >>out, 'set ytics 10000' 13 | print >>out, 'set y2label "number"' 14 | print >>out, 'set y2range [0:*]' 15 | #print >>out, "set style data lines" 16 | print >>out, "set key box" 17 | print >>out, 'plot', 18 | for k, a, c in keys: 19 | print >>out, ' "%s" using 1:%d title "%s" axes %s with steps,' % (sys.argv[1], c, k, a), 20 | print >>out, 'x=0' 21 | out.close() 22 | 23 | os.system('gnuplot bandwidth.gnuplot'); 24 | 25 | -------------------------------------------------------------------------------- /libtorrent/parse_dht_rtt.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | import sys 4 | import os 5 | 6 | quantize = 100 7 | max_rtt = 5000 8 | 9 | f = open(sys.argv[1]) 10 | distribution = {} 11 | num_messages = 0 12 | 13 | for i in range(0, max_rtt, quantize): 14 | distribution[i] = 0 15 | 16 | for line in f: 17 | time = int(line.split('\t')[1]) 18 | if (time < 0 or time > max_rtt - quantize): continue 19 | num_messages += 1 20 | time /= quantize 21 | time *= quantize 22 | distribution[time] += 1 23 | 24 | f = open('round_trip_distribution.log', 'w+') 25 | 26 | for k, v in distribution.items(): 27 | print >>f, '%f %d' % ((k + (quantize / 2)) / 1000.0, v) 28 | f.close(); 29 | 30 | f = open('round_trip_distribution.gnuplot', 'w+') 31 | 32 | f.write(''' 33 | set term png size 1200,700 34 | set title "Message round trip times" 35 | set terminal postscript 36 | set ylabel "# of requests" 37 | set xlabel "Round trip time (seconds)" 38 | set grid 39 | set style fill solid border -1 pattern 2 40 | set output "round_trip_distribution.ps" 41 | set boxwidth %f 42 | plot "round_trip_distribution.log" using 1:2 title "requests" with boxes 43 | 44 | set terminal png small 45 | set output "round_trip_distribution.png" 46 | replot 47 | ''' % (float(quantize) / 1000.0)) 48 | f.close() 49 | 50 | os.system('gnuplot round_trip_distribution.gnuplot'); 51 | 52 | -------------------------------------------------------------------------------- /libtorrent/parse_dht_stats.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import sys 3 | import os 4 | 5 | gnuplot_scripts = [] 6 | 7 | def gen_stats_gnuplot(name, y, lines): 8 | 9 | global gnuplot_scripts 10 | 11 | stat = open(sys.argv[1]) 12 | line = stat.readline() 13 | while not 'minute:' in line: 14 | line = stat.readline() 15 | 16 | names = line.strip().split(':') 17 | counter = 1 18 | for i in names: 19 | print '%d: %s' % (counter, i) 20 | counter += 1 21 | 22 | out = open('%s.gnuplot' % name, 'w+') 23 | out.write(''' 24 | set term png size 1200,700 small 25 | set output "%s.png" 26 | set title "%s" 27 | set ylabel "%s" 28 | set xlabel "time (minutes)" 29 | plot ''' % (name, name.strip('_'), y)) 30 | first = True 31 | for i in lines: 32 | if not first: 33 | out.write(', \\\n') 34 | first = False 35 | out.write('"%s" using 1:%d title "%s" with lines' % (sys.argv[1], names.index(i)+1, i)) 36 | out.write('\n') 37 | 38 | out.write('''set terminal postscript 39 | set output "%s.ps" 40 | replot 41 | ''' % (name)) 42 | out.close() 43 | gnuplot_scripts += [name] 44 | 45 | gen_stats_gnuplot('dht_routing_table_size', 'nodes', ['active nodes','passive nodes']) 46 | gen_stats_gnuplot('dht_tracker_table_size', '', ['num torrents', 'num peers']) 47 | gen_stats_gnuplot('dht_announces', 'messages per minute', ['announces per min', 'failed announces per min']) 48 | gen_stats_gnuplot('dht_clients', 'messages per minute', ['total msgs per min', 'az msgs per min', 'ut msgs per min', 'lt msgs per min', 'mp msgs per min', 'gr msgs per min']) 49 | gen_stats_gnuplot('dht_rate', 'bytes per second', ['bytes in per sec', 'bytes out per sec']) 50 | gen_stats_gnuplot('dht_errors', 'messages per minute', ['error replies sent', 'error queries recvd']) 51 | 52 | for i in gnuplot_scripts: 53 | os.system('gnuplot %s.gnuplot' % i); 54 | -------------------------------------------------------------------------------- /libtorrent/parse_disk_buffer_log.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | 3 | import os, sys, time 4 | 5 | lines = open(sys.argv[1], 'rb').readlines() 6 | 7 | # logfile format: 8 | # : 9 | # example: 10 | # 16434 read cache: 17 11 | 12 | key_order = ['receive buffer', 'send buffer', 'released send buffer', 'posted send buffer', 13 | 'received send buffer', 'dispatched send buffer', 'queued send buffer', 14 | 'write cache', 'read cache', 'hash temp'] 15 | colors = ['30f030', '001070', '101080', '2040a0', 16 | '4070d0', '80a0f0', 'f03030', 17 | '80f080', 'f08080', '4040ff'] 18 | 19 | keys = [] 20 | fields = {} 21 | maximum = {} 22 | out = open('disk_buffer_log.dat', 'w+') 23 | 24 | field_sum = {} 25 | field_num_samples = {} 26 | field_timestamp = {} 27 | 28 | for c in key_order: 29 | keys.append(c) 30 | fields[c] = 0 31 | maximum[c] = 0 32 | field_sum[c] = 0 33 | field_num_samples[c] = 0 34 | field_timestamp[c] = 0 35 | 36 | last_t = 0 37 | for l in lines: 38 | try: 39 | t = int(l[0:l.find(' ')]) 40 | c = l[l.find(' ')+1:l.find(':')] 41 | n = int(l[l.find(':')+1:-1]) 42 | except: 43 | print l 44 | continue 45 | 46 | if last_t != t: 47 | print >>out, '%d\t' % last_t, 48 | for i in keys: 49 | print >>out, '%d\t' % maximum[i], 50 | print >>out, '\n', 51 | 52 | if not c in keys: continue 53 | 54 | field_sum[c] += fields[c] * float(t - field_timestamp[c]) 55 | field_timestamp[c] = t 56 | 57 | fields[c] = n 58 | 59 | if n > maximum[c]: maximum[c] = n 60 | 61 | if last_t != t: 62 | last_t = t 63 | maximum = fields 64 | 65 | for i in keys: 66 | print '%s: avg: %f' % (i, field_sum[i] / last_t) 67 | print 68 | 69 | out.close() 70 | 71 | out = open('disk_buffer.gnuplot', 'wb') 72 | print >>out, "set term png size 1200,700" 73 | print >>out, 'set output "disk_buffer.png"' 74 | print >>out, 'set xrange [0:*]' 75 | print >>out, 'set xlabel "time (ms)"' 76 | print >>out, 'set ylabel "buffers"' 77 | print >>out, "set style data lines" 78 | print >>out, "set key box" 79 | print >>out, 'plot', 80 | count = 1 + len(keys) 81 | keys.reverse() 82 | for k in keys: 83 | expr = "$%d" % count 84 | for i in xrange(2, count): expr += "+$%d" % i 85 | count -= 1 86 | print >>out, ' "disk_buffer_log.dat" using 1:(%s) title "%s" with filledcurves x1 lt rgb "#%s",' % (expr, k, colors[count-1]), 87 | print >>out, 'x=0' 88 | out.close() 89 | 90 | os.system('gnuplot disk_buffer.gnuplot') 91 | 92 | -------------------------------------------------------------------------------- /libtorrent/sanity-checker.xml: -------------------------------------------------------------------------------- 1 | 2 | 0.16.2 3 | 4 | 5 | 6 | include/libtorrent 7 | 8 | 9 | 10 | include/ 11 | include/libtorrent/ 12 | /Users/arvid/Documents/dev/boost_1_47_0/ 13 | 14 | 15 | 16 | #define BOOST_ALL_NO_LIB 1 17 | #define BOOST_ASIO_DYN_LINK 1 18 | #define BOOST_ASIO_ENABLE_CANCELIO 1 19 | #define BOOST_ASIO_HASH_MAP_BUCKETS 1021 20 | #define BOOST_ASIO_SEPARATE_COMPILATION 1 21 | #define BOOST_ASIO_SOURCE 1 22 | #define BOOST_EXCEPTION_DISABLE 1 23 | #define BOOST_SYSTEM_SOURCE 1 24 | #define BOOST_SYSTEM_STATIC_LINK 1 25 | #define BOOST_THREAD_USE_LIB 1 26 | #define TORRENT_BUILDING_SHARED 1 27 | #define TORRENT_DEBUG 1 28 | #define TORRENT_DISABLE_GEO_IP 1 29 | #define TORRENT_USE_TOMMATH 1 30 | #define UNICODE 1 31 | #define _FILE_OFFSET_BITS 64 32 | #define _UNICODE 1 33 | #define TORRENT_USE_OPENSSL 1 34 | 35 | 36 | 37 | libtorrent::aux 38 | 39 | 40 | 41 | bin/darwin-4.2.1/debug/boost-source/threading-multi/libtorrent.dylib.0.16.1 42 | 43 | -------------------------------------------------------------------------------- /libtorrent/set_version.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import os 3 | import sys 4 | import glob 5 | 6 | version = (int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]), int(sys.argv[4])) 7 | 8 | def substitute_file(name): 9 | subst = '' 10 | f = open(name) 11 | for l in f: 12 | if '#define LIBTORRENT_VERSION_MAJOR' in l and name.endswith('.hpp'): 13 | l = '#define LIBTORRENT_VERSION_MAJOR %d\n' % version[0] 14 | elif '#define LIBTORRENT_VERSION_MINOR' in l and name.endswith('.hpp'): 15 | l = '#define LIBTORRENT_VERSION_MINOR %d\n' % version[1] 16 | elif '#define LIBTORRENT_VERSION_TINY' in l and name.endswith('.hpp'): 17 | l = '#define LIBTORRENT_VERSION_TINY %d\n' % version[2] 18 | elif '#define LIBTORRENT_VERSION ' in l and name.endswith('.hpp'): 19 | l = '#define LIBTORRENT_VERSION "%d.%d.%d.%d"\n' % (version[0], version[1], version[2], version[3]) 20 | elif 'AC_INIT([libtorrent-rasterbar]' in l and name.endswith('.ac'): 21 | l = 'AC_INIT([libtorrent-rasterbar],[%d.%d.%d],[arvid@cs.umu.se],\n' % (version[0], version[1], version[2]) 22 | elif 'set (VERSION ' in l and name.endswith('.txt'): 23 | l = 'set (VERSION "%d.%d.%d")\n' % (version[0], version[1], version[2]) 24 | elif ':Version: ' in l and name.endswith('.rst'): 25 | l = ':Version: %d.%d.%d\n' % (version[0], version[1], version[2]) 26 | elif 'VERSION = ' in l and name.endswith('Jamfile'): 27 | l = 'VERSION = %d.%d.%d ;\n' % (version[0], version[1], version[2]) 28 | 29 | subst += l 30 | 31 | f.close() 32 | open(name, 'w+').write(subst) 33 | 34 | 35 | substitute_file('include/libtorrent/version.hpp') 36 | substitute_file('CMakeLists.txt') 37 | substitute_file('configure.ac') 38 | for i in glob.glob('docs/*.rst'): 39 | substitute_file(i) 40 | substitute_file('Jamfile') 41 | 42 | 43 | -------------------------------------------------------------------------------- /libtorrent/src/asio.cpp: -------------------------------------------------------------------------------- 1 | // builds all boost.asio source as a separate compilation unit 2 | #include 3 | 4 | #ifndef BOOST_ASIO_SOURCE 5 | #define BOOST_ASIO_SOURCE 6 | #endif 7 | 8 | #include "libtorrent/config.hpp" 9 | 10 | #define TORRENT_HAS_ASIO_DECL x ## BOOST_ASIO_DECL 11 | 12 | // only define BOOST_ASIO_DECL if it hasn't already been defined 13 | // or if it has been defined to an empty string 14 | #if TORRENT_HAS_ASIO_DECL == x 15 | #define BOOST_ASIO_DECL BOOST_SYMBOL_EXPORT 16 | #endif 17 | 18 | #if BOOST_VERSION >= 104500 19 | #include 20 | #elif BOOST_VERSION >= 104400 21 | #include 22 | #endif 23 | 24 | -------------------------------------------------------------------------------- /libtorrent/src/asio_ssl.cpp: -------------------------------------------------------------------------------- 1 | // builds all boost.asio SSL source as a separate compilation unit 2 | #include 3 | 4 | #if BOOST_VERSION >= 104610 5 | #include 6 | #endif 7 | 8 | -------------------------------------------------------------------------------- /libtorrent/src/disk_buffer_holder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2008-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/disk_buffer_holder.hpp" 34 | #include "libtorrent/aux_/session_impl.hpp" 35 | #include "libtorrent/disk_io_thread.hpp" 36 | 37 | namespace libtorrent 38 | { 39 | 40 | disk_buffer_holder::disk_buffer_holder(aux::session_impl& ses, char* buf) 41 | : m_disk_pool(ses.m_disk_thread), m_buf(buf) 42 | { 43 | TORRENT_ASSERT(buf == 0 || m_disk_pool.is_disk_buffer(buf)); 44 | } 45 | 46 | disk_buffer_holder::disk_buffer_holder(disk_buffer_pool& iothread, char* buf) 47 | : m_disk_pool(iothread), m_buf(buf) 48 | { 49 | TORRENT_ASSERT(buf == 0 || m_disk_pool.is_disk_buffer(buf)); 50 | } 51 | 52 | void disk_buffer_holder::reset(char* buf) 53 | { 54 | if (m_buf) m_disk_pool.free_buffer(m_buf); 55 | m_buf = buf; 56 | } 57 | 58 | char* disk_buffer_holder::release() 59 | { 60 | char* ret = m_buf; 61 | m_buf = 0; 62 | return ret; 63 | } 64 | 65 | disk_buffer_holder::~disk_buffer_holder() 66 | { 67 | if (m_buf) m_disk_pool.free_buffer(m_buf); 68 | } 69 | } 70 | 71 | -------------------------------------------------------------------------------- /libtorrent/src/file.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/src/file.cpp -------------------------------------------------------------------------------- /libtorrent/src/peer_connection.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/src/peer_connection.cpp -------------------------------------------------------------------------------- /libtorrent/src/piece_picker.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/src/piece_picker.cpp -------------------------------------------------------------------------------- /libtorrent/src/random.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2011-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/random.hpp" 34 | 35 | namespace libtorrent 36 | { 37 | 38 | namespace 39 | { 40 | boost::uint32_t x = 123456789; 41 | } 42 | 43 | void random_seed(boost::uint32_t v) 44 | { 45 | x = v; 46 | } 47 | 48 | // this is an xorshift random number generator 49 | // see: http://en.wikipedia.org/wiki/Xorshift 50 | boost::uint32_t random() 51 | { 52 | static boost::uint32_t y = 362436069; 53 | static boost::uint32_t z = 521288629; 54 | static boost::uint32_t w = 88675123; 55 | boost::uint32_t t; 56 | 57 | t = x ^ (x << 11); 58 | x = y; y = z; z = w; 59 | return w = w ^ (w >> 19) ^ (t ^ (t >> 8)); 60 | } 61 | } 62 | 63 | -------------------------------------------------------------------------------- /libtorrent/src/stat.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2003-2012, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/pch.hpp" 34 | 35 | #include 36 | #include 37 | 38 | #include "libtorrent/stat.hpp" 39 | 40 | namespace libtorrent { 41 | 42 | void stat_channel::second_tick(int tick_interval_ms) 43 | { 44 | int sample = int(size_type(m_counter) * 1000 / tick_interval_ms); 45 | TORRENT_ASSERT(sample >= 0); 46 | m_5_sec_average = size_type(m_5_sec_average) * 4 / 5 + sample / 5; 47 | m_30_sec_average = size_type(m_30_sec_average) * 29 / 30 + sample / 30; 48 | m_counter = 0; 49 | } 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /libtorrent/src/torrent.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/src/torrent.cpp -------------------------------------------------------------------------------- /libtorrent/src/torrent_handle.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/src/torrent_handle.cpp -------------------------------------------------------------------------------- /libtorrent/src/torrent_server.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/src/torrent_server.cpp -------------------------------------------------------------------------------- /libtorrent/test/Jamfile: -------------------------------------------------------------------------------- 1 | import testing ; 2 | 3 | use-project /torrent : .. ; 4 | 5 | exe test_natpmp : test_natpmp.cpp /torrent//torrent 6 | : multi on full ; 7 | 8 | explicit test_natpmp ; 9 | 10 | rule libtorrent_dependency ( properties * ) 11 | { 12 | local result ; 13 | 14 | if msvc in $(properties) 15 | { 16 | # for some reason, the visual studio debugger seems 17 | # to get very confused with the dynamic linking. 18 | # since debugging unit tests is common, just link 19 | # statically with msvc 20 | result += /torrent//torrent/static/static/on ; 21 | } 22 | else 23 | { 24 | result += /torrent//torrent/shared/shared/on ; 25 | } 26 | 27 | return $(result) ; 28 | } 29 | 30 | project 31 | : requirements 32 | @libtorrent_dependency 33 | main.cpp 34 | setup_transfer.cpp 35 | : default-build 36 | multi 37 | full 38 | on 39 | ; 40 | 41 | test-suite libtorrent : 42 | [ run test_peer_priority.cpp ] 43 | [ run test_file.cpp ] 44 | [ run test_threads.cpp ] 45 | [ run test_rss.cpp ] 46 | [ run test_bandwidth_limiter.cpp ] 47 | [ run test_buffer.cpp ] 48 | [ run test_piece_picker.cpp ] 49 | [ run test_bencoding.cpp ] 50 | [ run test_fast_extension.cpp ] 51 | [ run test_primitives.cpp ] 52 | [ run test_ip_filter.cpp ] 53 | [ run test_hasher.cpp ] 54 | [ run test_dht.cpp ] 55 | [ run test_storage.cpp ] 56 | [ run test_torrent_parse.cpp ] 57 | [ run test_upnp.cpp ] 58 | 59 | [ run test_tracker.cpp ] 60 | [ run test_checking.cpp ] 61 | [ run test_web_seed.cpp ] 62 | [ run test_bdecode_performance.cpp ] 63 | [ run test_pe_crypto.cpp ] 64 | 65 | [ run test_utp.cpp ] 66 | [ run test_auto_unchoke.cpp ] 67 | [ run test_http_connection.cpp ] 68 | [ run test_torrent.cpp ] 69 | [ run test_transfer.cpp ] 70 | # [ run test_entry.cpp ] 71 | [ run test_metadata_extension.cpp ] 72 | [ run test_trackers_extension.cpp ] 73 | [ run test_swarm.cpp ] 74 | [ run test_lsd.cpp ] 75 | [ run test_pex.cpp ] 76 | ; 77 | 78 | -------------------------------------------------------------------------------- /libtorrent/test/root2.xml: -------------------------------------------------------------------------------- 1 | 10http://127.0.0.1:%durn:schemas-upnp-org:device:InternetGatewayDevice:1http://192.168.0.1:80D-Link RouterD-Linkhttp://www.dlink.comInternet Access RouterD-Link Routeruuid:upnp-InternetGatewayDevice-1_0-12345678900001123456789001urn:schemas-upnp-org:service:Layer3Forwarding:1urn:upnp-org:serviceId:L3Forwarding1/Layer3Forwarding/Layer3Forwarding/Layer3Forwarding.xmlurn:schemas-upnp-org:device:WANDevice:1WANDeviceD-Linkhttp://www.dlink.comInternet Access RouterD-Link Router1http://support.dlink.com12345678900001uuid:upnp-WANDevice-1_0-12345678900001123456789001urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1urn:upnp-org:serviceId:WANCommonInterfaceConfig/WANCommonInterfaceConfig/WANCommonInterfaceConfig/WANCommonInterfaceConfig.xmlurn:schemas-upnp-org:device:WANConnectionDevice:1WAN Connection DeviceD-Linkhttp://www.dlink.comInternet Access RouterD-Link Router1http://support.dlink.com12345678900001uuid:upnp-WANConnectionDevice-1_0-12345678900001123456789001urn:schemas-upnp-org:service:WANIPConnection:1urn:upnp-org:serviceId:WANIPConnection/WANIPConnection/WANIPConnection/WANIPConnection.xml 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_bdecode_performance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2009, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include "libtorrent/lazy_entry.hpp" 34 | #include 35 | #include 36 | 37 | #include "test.hpp" 38 | #include "libtorrent/time.hpp" 39 | 40 | using namespace libtorrent; 41 | 42 | int test_main() 43 | { 44 | using namespace libtorrent; 45 | 46 | ptime start(time_now()); 47 | 48 | for (int i = 0; i < 100000; ++i) 49 | { 50 | char b[] = "d1:ai12453e1:b3:aaa1:c3:bbbe"; 51 | lazy_entry e; 52 | error_code ec; 53 | lazy_bdecode(b, b + sizeof(b)-1, e, ec); 54 | } 55 | ptime stop(time_now()); 56 | 57 | std::cout << "done in " << total_milliseconds(stop - start) / 100. << " seconds per million message" << std::endl; 58 | return 0; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /libtorrent/test/test_threads.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Copyright (c) 2010, Arvid Norberg 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in 14 | the documentation and/or other materials provided with the distribution. 15 | * Neither the name of the author nor the names of its 16 | contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | */ 32 | 33 | #include 34 | #include 35 | #include "libtorrent/thread.hpp" 36 | #include "test.hpp" 37 | 38 | using namespace libtorrent; 39 | 40 | void fun(condition_variable* s, libtorrent::mutex* m, int i) 41 | { 42 | fprintf(stderr, "thread %d waiting\n", i); 43 | libtorrent::mutex::scoped_lock l(*m); 44 | s->wait(l); 45 | fprintf(stderr, "thread %d done\n", i); 46 | } 47 | 48 | int test_main() 49 | { 50 | condition_variable cond; 51 | libtorrent::mutex m; 52 | std::list threads; 53 | for (int i = 0; i < 20; ++i) 54 | { 55 | threads.push_back(new thread(boost::bind(&fun, &cond, &m, i))); 56 | } 57 | 58 | // make sure all threads are waiting on the condition_variable 59 | sleep(10); 60 | 61 | libtorrent::mutex::scoped_lock l(m); 62 | cond.notify_all(); 63 | l.unlock(); 64 | 65 | for (std::list::iterator i = threads.begin(); i != threads.end(); ++i) 66 | { 67 | (*i)->join(); 68 | delete *i; 69 | } 70 | 71 | return 0; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/backslash_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/backslash_path.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/base.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/base.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/creation_date.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1234567e4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:pieces20:01234567890123456789ee 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/duplicate_files.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/duplicate_files.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/empty_httpseed.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/empty_httpseed.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/empty_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/empty_path.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/hidden_parent_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/hidden_parent_path.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/httpseed.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/httpseed.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_file_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/invalid_file_size.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_info.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:info5:filese 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/invalid_name.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_name2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/invalid_name2.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_path_list.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/invalid_path_list.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_piece_len.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/invalid_piece_len.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_pieces.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:piecesi-23eee 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_root_hash.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/invalid_root_hash.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/invalid_root_hash2.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod6:lengthi425e4:name4:temp12:piece lengthi16384e9:root hashi1343eee 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/long_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/long_name.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/missing_path_list.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/missing_path_list.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/missing_piece_len.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/missing_piece_len.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/negative_file_size.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/negative_file_size.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/negative_piece_len.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/negative_piece_len.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/negative_size.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod6:lengthi-425e4:name4:temp12:piece lengthi16384e6:pieces20:cdcdcdcdcdcdcdcdcdcdee 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/no_creation_date.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:pieces20:01234567890123456789ee 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/no_name.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/no_name.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/pad_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/pad_file.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/parent_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/parent_path.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/root_hash.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/root_hash.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/single_multi_file.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/single_multi_file.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/slash_path.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/slash_path.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/string.torrent: -------------------------------------------------------------------------------- 1 | 10:libtorrent 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/unaligned_pieces.torrent: -------------------------------------------------------------------------------- 1 | d10:created by10:libtorrent13:creation datei1359599503e4:infod5:filesld6:lengthi425e4:pathl3:foo7:bar.txteed6:lengthi425e4:pathl3:foo7:var.txteee4:name4:temp12:piece lengthi16384e6:pieces24:012345678901234567890123ee 2 | -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_list.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_list.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_list2.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_list2.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_list3.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_list3.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_seed.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_seed.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_seed_multi.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_seed_multi.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_seed_multi_space.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_seed_multi_space.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/url_seed_multi_space_nolist.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/url_seed_multi_space_nolist.torrent -------------------------------------------------------------------------------- /libtorrent/test/test_torrents/whitespace_url.torrent: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/libtorrent/test/test_torrents/whitespace_url.torrent -------------------------------------------------------------------------------- /libtorrent/tools/Jamfile: -------------------------------------------------------------------------------- 1 | import modules ; 2 | 3 | BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ; 4 | 5 | use-project /torrent : .. ; 6 | 7 | if $(BOOST_ROOT) 8 | { 9 | use-project /boost : $(BOOST_ROOT) ; 10 | } 11 | 12 | project tools 13 | : requirements 14 | multi /torrent//torrent 15 | : default-build 16 | static 17 | ; 18 | 19 | exe parse_hash_fails : parse_hash_fails.cpp ; 20 | 21 | -------------------------------------------------------------------------------- /libtorrent/tools/Makefile.am: -------------------------------------------------------------------------------- 1 | tool_programs = \ 2 | parse_hash_fails 3 | 4 | if ENABLE_EXAMPLES 5 | bin_PROGRAMS = $(tool_programs) 6 | endif 7 | 8 | EXTRA_PROGRAMS = $(tool_programs) 9 | EXTRA_DIST = Jamfile 10 | 11 | parse_hash_fails_SOURCES = parse_hash_fails.cpp 12 | #client_test_LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 13 | 14 | LDADD = $(top_builddir)/src/libtorrent-rasterbar.la 15 | 16 | AM_CPPFLAGS = -ftemplate-depth-50 -I$(top_srcdir)/include @DEBUGFLAGS@ 17 | 18 | AM_LDFLAGS = @BOOST_SYSTEM_LIB@ 19 | #AM_LDFLAGS = $(LDFLAGS) @BOOST_SYSTEM_LIB@ @OPENSSL_LDFLAGS@ @OPENSSL_LIBS@ 20 | #AM_LDFLAGS = @OPENSSL_LDFLAGS@ 21 | -------------------------------------------------------------------------------- /libtorrent/update_copyright.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python 2 | import os 3 | import sys 4 | import glob 5 | import datetime 6 | 7 | this_year = datetime.date.today().year 8 | print 'current year: %d' % this_year 9 | 10 | def update_file(name): 11 | subst = '' 12 | f = open(name) 13 | for l in f: 14 | if l.startswith('Copyright (c) '): 15 | first_year = int(l[14:18]) 16 | if first_year != this_year: 17 | if l[18] == '-': 18 | l = l[:19] + str(this_year) + l[23:] 19 | else: 20 | l = l[:18] + '-' + str(this_year) + l[18:] 21 | 22 | subst += l 23 | 24 | f.close() 25 | open(name, 'w+').write(subst) 26 | 27 | for i in glob.glob('src/*.cpp') + glob.glob('include/libtorrent/*.hpp') + \ 28 | glob.glob('include/libtorrent/kademlia/*.hpp') + glob.glob('src/kademlia/*.cpp'): 29 | update_file(i) 30 | 31 | -------------------------------------------------------------------------------- /server/asio.cpp: -------------------------------------------------------------------------------- 1 | // builds all boost.asio source as a separate compilation unit 2 | #ifndef BOOST_ASIO_SOURCE 3 | #define BOOST_ASIO_SOURCE 4 | #endif 5 | 6 | #include 7 | 8 | // for openssl. 9 | #if BOOST_VERSION >= 104610 10 | #include 11 | #endif 12 | -------------------------------------------------------------------------------- /server/main.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/server/main.cpp -------------------------------------------------------------------------------- /server/torrent_server-vc08.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtorrent", "..\libtorrent\include\libtorrent.vcproj", "{0795F713-7B86-4250-8B4E-4F4663AF6956}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "torrent_server", "torrent_server.vcproj", "{787C285C-2931-4CDA-A27C-CA4662DE9643}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {0795F713-7B86-4250-8B4E-4F4663AF6956} = {0795F713-7B86-4250-8B4E-4F4663AF6956} 9 | EndProjectSection 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Win32 = Debug|Win32 14 | Release|Win32 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 17 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Debug|Win32.ActiveCfg = Debug|Win32 18 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Debug|Win32.Build.0 = Debug|Win32 19 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Release|Win32.ActiveCfg = Release|Win32 20 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Release|Win32.Build.0 = Release|Win32 21 | {787C285C-2931-4CDA-A27C-CA4662DE9643}.Debug|Win32.ActiveCfg = Debug|Win32 22 | {787C285C-2931-4CDA-A27C-CA4662DE9643}.Debug|Win32.Build.0 = Debug|Win32 23 | {787C285C-2931-4CDA-A27C-CA4662DE9643}.Release|Win32.ActiveCfg = Release|Win32 24 | {787C285C-2931-4CDA-A27C-CA4662DE9643}.Release|Win32.Build.0 = Release|Win32 25 | EndGlobalSection 26 | GlobalSection(SolutionProperties) = preSolution 27 | HideSolutionNode = FALSE 28 | EndGlobalSection 29 | EndGlobal 30 | -------------------------------------------------------------------------------- /server/torrent_server.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "torrent_server", "torrent_server.vcxproj", "{1CFC1F92-2342-4366-AA27-0A013FAED9A4}" 5 | ProjectSection(ProjectDependencies) = postProject 6 | {0795F713-7B86-4250-8B4E-4F4663AF6956} = {0795F713-7B86-4250-8B4E-4F4663AF6956} 7 | EndProjectSection 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtorrent", "..\libtorrent\include\libtorrent.vcxproj", "{0795F713-7B86-4250-8B4E-4F4663AF6956}" 10 | EndProject 11 | Global 12 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 13 | Debug|Win32 = Debug|Win32 14 | Debug|x64 = Debug|x64 15 | Release|Win32 = Release|Win32 16 | Release|x64 = Release|x64 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Debug|Win32.ActiveCfg = Debug|Win32 20 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Debug|Win32.Build.0 = Debug|Win32 21 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Debug|x64.ActiveCfg = Debug|x64 22 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Debug|x64.Build.0 = Debug|x64 23 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Release|Win32.ActiveCfg = Release|Win32 24 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Release|Win32.Build.0 = Release|Win32 25 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Release|x64.ActiveCfg = Release|x64 26 | {1CFC1F92-2342-4366-AA27-0A013FAED9A4}.Release|x64.Build.0 = Release|x64 27 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Debug|Win32.ActiveCfg = Debug|Win32 28 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Debug|Win32.Build.0 = Debug|Win32 29 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Debug|x64.ActiveCfg = Debug|x64 30 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Debug|x64.Build.0 = Debug|x64 31 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Release|Win32.ActiveCfg = Release|Win32 32 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Release|Win32.Build.0 = Release|Win32 33 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Release|x64.ActiveCfg = Release|x64 34 | {0795F713-7B86-4250-8B4E-4F4663AF6956}.Release|x64.Build.0 = Release|x64 35 | EndGlobalSection 36 | GlobalSection(SolutionProperties) = preSolution 37 | HideSolutionNode = FALSE 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /server/torrent_server.vcproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/server/torrent_server.vcproj -------------------------------------------------------------------------------- /server/torrent_server.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 源文件 20 | 21 | 22 | 源文件 23 | 24 | 25 | -------------------------------------------------------------------------------- /third_party/openssl/include/openssl/comp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HEADER_COMP_H 3 | #define HEADER_COMP_H 4 | 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct comp_ctx_st COMP_CTX; 12 | 13 | typedef struct comp_method_st 14 | { 15 | int type; /* NID for compression library */ 16 | const char *name; /* A text string to identify the library */ 17 | int (*init)(COMP_CTX *ctx); 18 | void (*finish)(COMP_CTX *ctx); 19 | int (*compress)(COMP_CTX *ctx, 20 | unsigned char *out, unsigned int olen, 21 | unsigned char *in, unsigned int ilen); 22 | int (*expand)(COMP_CTX *ctx, 23 | unsigned char *out, unsigned int olen, 24 | unsigned char *in, unsigned int ilen); 25 | /* The following two do NOTHING, but are kept for backward compatibility */ 26 | long (*ctrl)(void); 27 | long (*callback_ctrl)(void); 28 | } COMP_METHOD; 29 | 30 | struct comp_ctx_st 31 | { 32 | COMP_METHOD *meth; 33 | unsigned long compress_in; 34 | unsigned long compress_out; 35 | unsigned long expand_in; 36 | unsigned long expand_out; 37 | 38 | CRYPTO_EX_DATA ex_data; 39 | }; 40 | 41 | 42 | COMP_CTX *COMP_CTX_new(COMP_METHOD *meth); 43 | void COMP_CTX_free(COMP_CTX *ctx); 44 | int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen, 45 | unsigned char *in, int ilen); 46 | int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen, 47 | unsigned char *in, int ilen); 48 | COMP_METHOD *COMP_rle(void ); 49 | COMP_METHOD *COMP_zlib(void ); 50 | void COMP_zlib_cleanup(void); 51 | 52 | #ifdef HEADER_BIO_H 53 | #ifdef ZLIB 54 | BIO_METHOD *BIO_f_zlib(void); 55 | #endif 56 | #endif 57 | 58 | /* BEGIN ERROR CODES */ 59 | /* The following lines are auto generated by the script mkerr.pl. Any changes 60 | * made after this point may be overwritten when the script is next run. 61 | */ 62 | void ERR_load_COMP_strings(void); 63 | 64 | /* Error codes for the COMP functions. */ 65 | 66 | /* Function codes. */ 67 | #define COMP_F_BIO_ZLIB_FLUSH 99 68 | #define COMP_F_BIO_ZLIB_NEW 100 69 | #define COMP_F_BIO_ZLIB_READ 101 70 | #define COMP_F_BIO_ZLIB_WRITE 102 71 | 72 | /* Reason codes. */ 73 | #define COMP_R_ZLIB_DEFLATE_ERROR 99 74 | #define COMP_R_ZLIB_INFLATE_ERROR 100 75 | #define COMP_R_ZLIB_NOT_SUPPORTED 101 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif 81 | -------------------------------------------------------------------------------- /third_party/openssl/include/openssl/ebcdic.h: -------------------------------------------------------------------------------- 1 | /* crypto/ebcdic.h */ 2 | 3 | #ifndef HEADER_EBCDIC_H 4 | #define HEADER_EBCDIC_H 5 | 6 | #include 7 | 8 | /* Avoid name clashes with other applications */ 9 | #define os_toascii _openssl_os_toascii 10 | #define os_toebcdic _openssl_os_toebcdic 11 | #define ebcdic2ascii _openssl_ebcdic2ascii 12 | #define ascii2ebcdic _openssl_ascii2ebcdic 13 | 14 | extern const unsigned char os_toascii[256]; 15 | extern const unsigned char os_toebcdic[256]; 16 | void *ebcdic2ascii(void *dest, const void *srce, size_t count); 17 | void *ascii2ebcdic(void *dest, const void *srce, size_t count); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /third_party/openssl/include/openssl/whrlpool.h: -------------------------------------------------------------------------------- 1 | #ifndef HEADER_WHRLPOOL_H 2 | #define HEADER_WHRLPOOL_H 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #define WHIRLPOOL_DIGEST_LENGTH (512/8) 12 | #define WHIRLPOOL_BBLOCK 512 13 | #define WHIRLPOOL_COUNTER (256/8) 14 | 15 | typedef struct { 16 | union { 17 | unsigned char c[WHIRLPOOL_DIGEST_LENGTH]; 18 | /* double q is here to ensure 64-bit alignment */ 19 | double q[WHIRLPOOL_DIGEST_LENGTH/sizeof(double)]; 20 | } H; 21 | unsigned char data[WHIRLPOOL_BBLOCK/8]; 22 | unsigned int bitoff; 23 | size_t bitlen[WHIRLPOOL_COUNTER/sizeof(size_t)]; 24 | } WHIRLPOOL_CTX; 25 | 26 | #ifndef OPENSSL_NO_WHIRLPOOL 27 | #ifdef OPENSSL_FIPS 28 | int private_WHIRLPOOL_Init(WHIRLPOOL_CTX *c); 29 | #endif 30 | int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); 31 | int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); 32 | void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); 33 | int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); 34 | unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md); 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /third_party/openssl/libs/libeay32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/third_party/openssl/libs/libeay32.lib -------------------------------------------------------------------------------- /third_party/openssl/libs/libeay64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/third_party/openssl/libs/libeay64.lib -------------------------------------------------------------------------------- /third_party/openssl/libs/ssleay32.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/third_party/openssl/libs/ssleay32.lib -------------------------------------------------------------------------------- /third_party/openssl/libs/ssleay64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avplayer/torrent_server/e067614496060f56acce598e1377e927c3ea8e9e/third_party/openssl/libs/ssleay64.lib --------------------------------------------------------------------------------