├── Android.mk
├── CMakeLists.txt
├── README.md
├── build
├── NUL_
├── android
│ ├── CMakeCache.android.initial.cmake
│ ├── README.android
│ ├── android.toolchain.cmake
│ └── scripts
│ │ ├── build.cmd
│ │ ├── cmake_android.cmd
│ │ ├── cmake_android.sh
│ │ ├── cmake_android_armeabi.sh
│ │ ├── cmake_android_neon.sh
│ │ ├── package.sh
│ │ └── wincfg.cmd.tmpl
├── cmake
│ ├── Boost.cmake
│ ├── Function.cmake
│ ├── MakeBoost.cmake
│ ├── MakeOpenssl.cmake
│ └── MakeProtobuf.cmake
├── jni
│ ├── Android.mk
│ ├── Android.mk.bak
│ ├── Application.mk
│ ├── Apps.mk
│ ├── Apps.mk.bak
│ ├── Boost.mk
│ ├── Include.mk
│ ├── Libs.mk
│ ├── Openssl.mk
│ ├── Protobuf.mk
│ ├── build_arm.cmd
│ ├── build_arm_4.0-.cmd
│ ├── build_mips.cmd
│ ├── build_mips_p2v.sh
│ ├── build_p2v - x.sh
│ ├── build_p2v.sh
│ └── sh.exe.stackdump
└── msvc
│ ├── msvc10
│ ├── pbi_p2p.sln
│ └── pbi_p2p.suo
│ ├── msvc11
│ ├── pbi_p2p.sln
│ ├── pbi_p2p.v11.suo
│ └── pbi_p2p.v12.suo
│ ├── msvc12
│ ├── baidu_p.sln
│ ├── baidu_p.v12.suo
│ ├── baidu_p2p.suo
│ └── suoF462.tmp
│ ├── msvc8
│ └── pbi_p2p_vod.sln
│ └── msvc9
│ └── pbi_p2p_vod.sln
├── clean_msvc_useless.cmd
├── contrib
├── CMakeLists.txt
└── cppdb
│ ├── CMakeLists.txt
│ ├── cppdb.vcproj
│ ├── cppdb.vcxproj
│ ├── cppdb.vcxproj.user
│ ├── cppdb
│ ├── atomic_counter.h
│ ├── backend.h
│ ├── conn_manager.h
│ ├── connection_specific.h
│ ├── defs.h
│ ├── driver_manager.h
│ ├── errors.h
│ ├── frontend.h
│ ├── mutex.h
│ ├── numeric_util.h
│ ├── pool.h
│ ├── ref_ptr.h
│ ├── shared_object.h
│ └── utils.h
│ ├── drivers
│ ├── mysql_backend.cpp
│ ├── odbc_backend.cpp
│ ├── postgres_backend.cpp
│ └── sqlite3_backend.cpp
│ ├── src
│ ├── atomic_counter.cpp
│ ├── backend.cpp
│ ├── conn_manager.cpp
│ ├── driver_manager.cpp
│ ├── frontend.cpp
│ ├── mutex.cpp
│ ├── pool.cpp
│ ├── shared_object.cpp
│ └── utils.cpp
│ └── template_header.h
└── src
├── CMakeLists.txt
├── app
├── p2s_mds
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── auth.cpp
│ ├── auth.h
│ ├── cmd_receiver.cpp
│ ├── cmd_receiver.h
│ ├── cms_acceptor.h
│ ├── main.cpp
│ ├── media_relay.cpp
│ ├── media_relay.h
│ ├── media_server.cpp
│ ├── media_server.h
│ ├── p2s_mds.vcproj
│ ├── p2s_mds.vcxproj
│ ├── p2s_mds_2.vcxproj
│ ├── p2s_mds_2.vcxproj.user
│ ├── progress_alive_alarm.cpp
│ ├── progress_alive_alarm.h
│ ├── utility.cpp
│ ├── utility.h
│ └── version.h
├── p2s_mds_cache
│ ├── cache.h
│ ├── cache_policy.h
│ ├── main.cpp
│ ├── mds_cache_service.cpp
│ ├── mds_cache_service.h
│ ├── p2s_mds_cache.vcproj
│ ├── p2s_mds_cache.vcxproj
│ ├── p2s_mds_cache.vcxproj.user
│ └── version.h
├── p2s_mds_control
│ ├── main.cpp
│ ├── mds_control.cpp
│ ├── mds_control.h
│ ├── mds_db.db
│ ├── p2s_mds_control.vcproj
│ ├── p2s_mds_control.vcxproj
│ ├── p2s_mds_control.vcxproj.user
│ ├── utility.cpp
│ ├── utility.h
│ └── version.h
├── p2s_ppc
│ ├── CMakeLists.txt
│ ├── channel_req_processor.cpp
│ ├── channel_req_processor.h
│ ├── main.cpp
│ ├── main_interface.cpp
│ ├── main_interface.h
│ ├── nat_type
│ ├── p2p_processor.cpp
│ ├── p2p_processor.hpp
│ ├── p2s_ppc.vcproj
│ ├── p2s_ppc.vcxproj
│ ├── p2s_ppc.vcxproj.user
│ ├── pa_handler_log.txt
│ ├── parse_ams_xml.cpp
│ ├── parse_ams_xml.h
│ ├── request_session_ams.cpp
│ ├── request_session_ams.h
│ ├── request_session_base.cpp
│ ├── request_session_base.h
│ ├── rsa_rc4.cpp
│ ├── rsa_rc4.h
│ ├── server.cpp
│ ├── server.hpp
│ ├── typedef.h
│ ├── url_crack_process.cpp
│ ├── url_crack_processor.h
│ ├── utility.cpp
│ ├── utility.h
│ ├── version.h
│ ├── viewing_state_processor.cpp
│ └── viewing_state_processor.h
├── p2s_shunt
│ ├── alive_alarm.cpp
│ ├── alive_alarm.h
│ ├── main.cpp
│ ├── make_proto.bat
│ ├── nat_type
│ ├── p2s_shunt.vcproj
│ ├── p2s_shunt.vcxproj
│ ├── p2s_shunt.vcxproj.user
│ ├── shunt.pb.cc
│ ├── shunt.pb.h
│ ├── shunt.proto
│ ├── shunt.xml
│ └── version.h
├── p2s_shunt_control
│ ├── main.cpp
│ ├── p2s_shunt_control.vcproj
│ ├── p2s_shunt_control.vcxproj
│ ├── p2s_shunt_control.vcxproj.user
│ ├── shunt_control.cpp
│ ├── shunt_control.h
│ └── version.h
├── p2s_tracker
│ ├── main.cpp
│ ├── p2s_tracker.vcproj
│ ├── p2s_tracker.vcxproj
│ ├── p2s_tracker.vcxproj.user
│ └── version.h
└── win_service
│ ├── config.ini
│ ├── service.cpp
│ ├── service.h
│ ├── version.h
│ ├── win_service.vcproj
│ ├── win_service.vcxproj
│ ├── win_service.vcxproj.filters
│ └── win_service.vcxproj.user
├── compile_settings
├── configration.props
├── configration.vsprops
├── libtorrent_upnp.vsprops
├── test_props.props
└── test_props.vsprops
├── lib
├── app_common
│ ├── app_common.h
│ ├── app_common.vcproj
│ ├── app_common.vcxproj
│ ├── app_common.vcxproj.user
│ ├── control_base.cpp
│ ├── control_base.h
│ ├── interprocess.cpp
│ ├── interprocess.h
│ ├── level_db.cpp
│ ├── level_db.h
│ ├── make.bat
│ ├── mds.pb.cc
│ ├── mds.pb.h
│ ├── mds.proto
│ ├── mds_db.cpp
│ ├── mds_db.h
│ ├── process_killer.cpp
│ ├── process_killer.h
│ ├── protoc.exe
│ ├── shunt_db.cpp
│ ├── shunt_db.h
│ └── typedef.h
├── asfio
│ ├── asfio.vcproj
│ ├── asfio.vcxproj
│ ├── asfio.vcxproj.user
│ ├── async_dskcache.h
│ ├── config.h
│ ├── disk_cache_impl.cpp
│ ├── disk_cache_impl.hpp
│ ├── dispatch_helper.hpp
│ ├── new_timeshift_io.cpp
│ ├── new_timeshift_io.hpp
│ ├── os_api.cpp
│ └── os_api.hpp
├── client
│ ├── __client
│ ├── cache
│ │ ├── cache_service.cpp
│ │ └── cache_service.h
│ ├── client.vcproj
│ ├── client.vcxproj
│ ├── client.vcxproj.filters
│ ├── client.vcxproj.user
│ ├── client_service.cpp
│ ├── client_service.h
│ ├── client_service_logic.cpp
│ ├── client_service_logic.h
│ ├── hub
│ │ ├── hub_scheduling.cpp
│ │ ├── hub_scheduling.h
│ │ ├── hub_topology.cpp
│ │ └── hub_topology.h
│ ├── local_param.h
│ ├── nat.cpp
│ ├── nat.h
│ ├── neighbor_map.cpp
│ ├── neighbor_map.h
│ ├── overlay.cpp
│ ├── overlay.h
│ ├── pa_handler.cpp
│ ├── pa_handler.h
│ ├── peer.cpp
│ ├── peer.h
│ ├── peer_connection.cpp
│ ├── peer_connection.h
│ ├── scheduling_base.h
│ ├── stream
│ │ ├── absent_packet_info.cpp
│ │ ├── absent_packet_info.h
│ │ ├── absent_packet_list.cpp
│ │ ├── absent_packet_list.h
│ │ ├── buffer_manager.cpp
│ │ ├── buffer_manager.h
│ │ ├── heuristic_scheduling_strategy.cpp
│ │ ├── heuristic_scheduling_strategy.h
│ │ ├── live_media_dispatcher.cpp
│ │ ├── live_media_dispatcher.h
│ │ ├── media_dispatcher.cpp
│ │ ├── media_dispatcher.h
│ │ ├── scheduling_typedef.cpp
│ │ ├── scheduling_typedef.h
│ │ ├── stream_monitor.cpp
│ │ ├── stream_monitor.h
│ │ ├── stream_scheduling.cpp
│ │ ├── stream_scheduling.h
│ │ ├── stream_seed.cpp
│ │ ├── stream_seed.h
│ │ ├── stream_topology.cpp
│ │ ├── stream_topology.h
│ │ ├── vod_media_dispatcher.cpp
│ │ └── vod_media_dispatcher.h
│ ├── stun
│ │ ├── stun.cpp
│ │ ├── stun.h
│ │ ├── udp.cpp
│ │ └── udp.h
│ ├── tracker_manager.cpp
│ ├── tracker_manager.h
│ └── typedef.h
├── common
│ ├── Makefile
│ ├── bignumber.h
│ ├── common.h
│ ├── common.vcproj
│ ├── common.vcxproj
│ ├── common.vcxproj.filters
│ ├── common.vcxproj.user
│ ├── config.h
│ ├── const_define.cpp
│ ├── const_define.h
│ ├── curve25519.cpp
│ ├── curve25519.h
│ ├── fec.cpp
│ ├── fec.h
│ ├── make.bat
│ ├── make_pa_proto.bat
│ ├── md5.cpp
│ ├── md5.h
│ ├── media_packet.h
│ ├── message.pb.cc
│ ├── message.pb.h
│ ├── message.proto
│ ├── message_type.h
│ ├── pa_message.pb.cc
│ ├── pa_message.pb.h
│ ├── pa_message.proto
│ ├── packet_buffer.cpp
│ ├── packet_buffer.h
│ ├── parameter.cpp
│ ├── parameter.h
│ ├── policy.cpp
│ ├── policy.h
│ ├── protoc.exe
│ ├── security_policy.cpp
│ ├── security_policy.h
│ ├── smoother.cpp
│ ├── smoother.h
│ ├── tsparse.cpp
│ ├── tsparse.h
│ ├── typedef.h
│ ├── upload_capacity_detect.cpp
│ ├── upload_capacity_detector.h
│ ├── utility.cpp
│ └── utility.h
├── httpdownload
│ ├── ReadMe.txt
│ ├── http_download_base.cpp
│ ├── http_download_base.hpp
│ ├── http_download_file.cpp
│ ├── http_download_file.hpp
│ ├── http_download_memory.cpp
│ ├── http_download_memory.hpp
│ ├── httpdownload.vcproj
│ ├── httpdownload.vcxproj
│ ├── httpdownload.vcxproj.filters
│ └── httpdownload.vcxproj.user
├── lib_template
│ └── lib_template.vcproj
├── libupnp
│ ├── buffer.hpp
│ ├── device_xml_fetcher.h
│ ├── error_code.hpp
│ ├── escape_string.hpp
│ ├── http_parser.hpp
│ ├── libtorrent_upnp.vcxproj
│ ├── libtorrent_upnp.vcxproj.filters
│ ├── libtorrent_upnp.vcxproj.user
│ ├── libupnp.vcproj
│ ├── src
│ │ ├── device_xml_fetcher.cpp
│ │ ├── error_code.cpp
│ │ ├── escape_string.cpp
│ │ ├── http_parser.cpp
│ │ └── upnp.cpp
│ ├── upnp.hpp
│ ├── utility.h
│ ├── version.hpp
│ └── xml_parse.hpp
├── natpunch
│ ├── auto_mapping.h
│ ├── natpunch.vcproj
│ ├── natpunch.vcxproj
│ ├── natpunch.vcxproj.user
│ ├── port_mapping.h
│ ├── src
│ │ ├── auto_mapping.cpp
│ │ └── upnp_punch.cpp
│ └── upnp_punch.h
├── p2engine
│ ├── CMakeList.txt
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── p2engine-10.0.vcxproj
│ ├── p2engine-9.0.vcproj
│ ├── p2engine.vcproj
│ ├── p2engine.vcxproj
│ ├── p2engine.vcxproj.filters
│ ├── p2engine.vcxproj.user
│ ├── p2engine
│ │ ├── acceptor.hpp
│ │ ├── atomic.hpp
│ │ ├── basic_dispatcher.hpp
│ │ ├── basic_engine_object.hpp
│ │ ├── basic_memory_pool.hpp
│ │ ├── basic_object.hpp
│ │ ├── basic_object_allocator.hpp
│ │ ├── basic_packet.hpp
│ │ ├── bool_convertable.hpp
│ │ ├── broadcast_socket.hpp
│ │ ├── byteorder.hpp
│ │ ├── compressed_bitset.hpp
│ │ ├── config.hpp
│ │ ├── config
│ │ │ ├── function.hpp
│ │ │ └── std_or_boost.hpp
│ │ ├── connection.hpp
│ │ ├── contrib.hpp
│ │ ├── convertutf.h
│ │ ├── coroutine.hpp
│ │ ├── enum_net.hpp
│ │ ├── fast_stl.hpp
│ │ ├── file
│ │ │ ├── aiofile.hpp
│ │ │ ├── basic_aiofile.hpp
│ │ │ ├── basic_io_handle.hpp
│ │ │ ├── file_api.hpp
│ │ │ ├── file_background_service.hpp
│ │ │ ├── normal_aiofile_service.hpp
│ │ │ ├── posix_aiofile_service.hpp
│ │ │ └── win_aiofile_service.hpp
│ │ ├── fssignal.hpp
│ │ ├── get_derived_this.hpp
│ │ ├── gzip.hpp
│ │ ├── handler_allocator.hpp
│ │ ├── http
│ │ │ ├── atom.hpp
│ │ │ ├── basic_http_dispatcher.hpp
│ │ │ ├── header.hpp
│ │ │ ├── http.hpp
│ │ │ ├── http_acceptor.hpp
│ │ │ ├── http_acceptor_base.hpp
│ │ │ ├── http_connection.hpp
│ │ │ ├── http_connection_base.hpp
│ │ │ ├── http_connection_impl.hpp
│ │ │ ├── mime_types.hpp
│ │ │ ├── request.hpp
│ │ │ └── response.hpp
│ │ ├── intrusive_ptr_base.hpp
│ │ ├── io.hpp
│ │ ├── io_service_pool.hpp
│ │ ├── keeper.hpp
│ │ ├── local_id_allocator.hpp
│ │ ├── logging.hpp
│ │ ├── macro.hpp
│ │ ├── mutex.hpp
│ │ ├── nedmalloc
│ │ │ ├── malloc.c.h
│ │ │ └── nedmalloc.h
│ │ ├── ntp.hpp
│ │ ├── object_allocator.hpp
│ │ ├── operation_mark.hpp
│ │ ├── operation_queue.hpp
│ │ ├── p2engine.hpp
│ │ ├── packet.hpp
│ │ ├── packet_format_def.hpp
│ │ ├── pop_warning_option.hpp
│ │ ├── post_in_constructor.hpp
│ │ ├── puff.hpp
│ │ ├── push_warning_option.hpp
│ │ ├── random.hpp
│ │ ├── raw_buffer.hpp
│ │ ├── rdp.hpp
│ │ ├── rdp
│ │ │ ├── basic_shared_tcp_layer.hpp
│ │ │ ├── basic_shared_udp_layer.hpp
│ │ │ ├── basic_urdp_visitor.hpp
│ │ │ ├── const_define.hpp
│ │ │ ├── rdp_fwd.hpp
│ │ │ ├── trdp_acceptor.hpp
│ │ │ ├── trdp_connection.hpp
│ │ │ ├── trdp_flow.hpp
│ │ │ ├── urdp_acceptor.hpp
│ │ │ ├── urdp_connection.hpp
│ │ │ ├── urdp_flow.hpp
│ │ │ └── urdp_visitor.hpp
│ │ ├── running_service.hpp
│ │ ├── safe_buffer.hpp
│ │ ├── safe_buffer_io.hpp
│ │ ├── shared_access.hpp
│ │ ├── singleton.hpp
│ │ ├── socket_utility.hpp
│ │ ├── speed_meter.hpp
│ │ ├── spinlock.hpp
│ │ ├── ssl_stream_wrapper.hpp
│ │ ├── time.hpp
│ │ ├── timer.hpp
│ │ ├── trafic_statistics.hpp
│ │ ├── type_traits.hpp
│ │ ├── typedef.hpp
│ │ ├── uri.hpp
│ │ ├── utf8.hpp
│ │ ├── utilities.hpp
│ │ ├── variant_endpoint.hpp
│ │ └── wrappable_integer.hpp
│ └── src
│ │ ├── basic_dispatcher.cpp
│ │ ├── broadcast_socket.cpp
│ │ ├── convertutf.cpp
│ │ ├── enum_net.cpp
│ │ ├── file
│ │ └── file_api.cpp
│ │ ├── gzip.cpp
│ │ ├── http
│ │ ├── basic_http_dispatcher.cpp
│ │ ├── header.cpp
│ │ ├── http_connection_impl.cpp
│ │ ├── mime_types.cpp
│ │ ├── request.cpp
│ │ └── response.cpp
│ │ ├── logging.cpp
│ │ ├── nedmalloc
│ │ └── nedmalloc.cpp
│ │ ├── ntp.cpp
│ │ ├── puff.cpp
│ │ ├── rdp
│ │ ├── basic_shared_tcp_layer.cpp
│ │ ├── basic_shared_udp_layer.cpp
│ │ ├── rdp.rar
│ │ ├── trdp_flow.cpp
│ │ └── urdp_flow.cpp
│ │ ├── safe_buffer.cpp
│ │ ├── socket_utility.cpp
│ │ ├── time.cpp
│ │ ├── uri.cpp
│ │ └── utf8.cpp
├── server
│ ├── CMakeList.txt
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── config.h
│ ├── media_distributor.cpp
│ ├── media_distributor.h
│ ├── seed_connection.cpp
│ ├── seed_connection.h
│ ├── server.vcproj
│ ├── server.vcxproj
│ ├── server.vcxproj.filters
│ ├── server.vcxproj.user
│ ├── server_service.cpp
│ ├── server_service.h
│ ├── server_service_logic.h
│ ├── tracker_session.cpp
│ └── tracker_session.h
├── shunt
│ ├── config.h
│ ├── creator.cpp
│ ├── creator.h
│ ├── fluid_media_convert.h
│ ├── fluid_receiver.cpp
│ ├── fluid_receiver.h
│ ├── fluid_sender.cpp
│ ├── fluid_sender.h
│ ├── media_receiver.cpp
│ ├── media_receiver.h
│ ├── media_sender.cpp
│ ├── media_sender.h
│ ├── receiver.h
│ ├── sender.h
│ ├── shunt.cpp
│ ├── shunt.h
│ ├── shunt.vcproj
│ ├── shunt.vcxproj
│ ├── shunt.vcxproj.user
│ ├── typedef.h
│ └── vlc
│ │ ├── deprecated.h
│ │ ├── libvlc.h
│ │ ├── libvlc_events.h
│ │ ├── libvlc_media.h
│ │ ├── libvlc_media_discoverer.h
│ │ ├── libvlc_media_library.h
│ │ ├── libvlc_media_list.h
│ │ ├── libvlc_media_list_player.h
│ │ ├── libvlc_media_player.h
│ │ ├── libvlc_structures.h
│ │ ├── libvlc_version.h.in
│ │ ├── libvlc_vlm.h
│ │ └── vlc.h
├── simple_server
│ ├── config.h
│ ├── distributor_Impl.hpp
│ ├── distributor_scheduling.cpp
│ ├── distributor_scheduling.h
│ ├── multi_source_distributor.cpp
│ ├── multi_source_distributor.h
│ ├── peer_connection.cpp
│ ├── peer_connection.h
│ ├── simple_distributor.cpp
│ ├── simple_distributor.h
│ ├── simple_server.vcproj
│ ├── simple_server.vcxproj
│ ├── simple_server.vcxproj.user
│ ├── utility.cpp
│ └── utility.h
├── tracker
│ ├── CMakeLists.txt
│ ├── Makefile
│ ├── cache_service.cpp
│ ├── cache_service.h
│ ├── cache_table.cpp
│ ├── cache_table.h
│ ├── config.h
│ ├── member_service.cpp
│ ├── member_service.h
│ ├── member_table.cpp
│ ├── member_table.h
│ ├── tracker.csi
│ ├── tracker.vcproj
│ ├── tracker.vcxproj
│ ├── tracker.vcxproj.filters
│ ├── tracker.vcxproj.user
│ ├── tracker_service.cpp
│ ├── tracker_service.h
│ ├── tracker_service_logic.cpp
│ └── tracker_service_logic.h
└── urlcrack
│ ├── crack_letv_urls.cpp
│ ├── crack_letv_urls.hpp
│ ├── crack_qiyi_urls.cpp
│ ├── crack_qiyi_urls.hpp
│ ├── crack_qq_urls.cpp
│ ├── crack_qq_urls.hpp
│ ├── crack_sohu_urls.cpp
│ ├── crack_sohu_urls.hpp
│ ├── crack_urls_adapter.cpp
│ ├── crack_urls_adapter.hpp
│ ├── crack_urls_base.cpp
│ ├── crack_urls_base.hpp
│ ├── crack_youku_urls.cpp
│ ├── crack_youku_urls.hpp
│ ├── urlcrack.vcproj
│ ├── urlcrack.vcxproj
│ ├── urlcrack.vcxproj.filters
│ └── urlcrack.vcxproj.user
└── test
├── asfile_test
├── asfile_test.cpp
└── asfile_test.vcproj
├── client_test
├── client_test.cpp
└── client_test.vcproj
├── dht_test
├── ReadMe.txt
├── channel_list_send.cpp
├── dht_test.vcxproj
├── dht_test.vcxproj.filters
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── dht_test_1
├── ReadMe.txt
├── channel_list_get.cpp
├── command_manager.vcxproj
├── stdafx.cpp
├── stdafx.h
└── targetver.h
├── peer_test
├── command_line_interpreter.hpp
├── peer_test.cpp
├── peer_test.vcproj
└── peer_test.vcxproj
├── server_test
├── server_test.cpp
└── server_test.vcproj
├── test
├── RemoveCommentary.exe
├── fssignal.cpp
├── fssignal.hpp
├── include
│ ├── utf8.h
│ └── utf8
│ │ ├── checked.h
│ │ ├── core.h
│ │ └── unchecked.h
├── server.cpp
├── server.cpp.tmp
├── tcp-fast.cpp
├── tcp-fast.h
├── test.cpp
├── test.cpp.tmp
├── test.vcproj
├── test.vcxproj
├── test.vcxproj.filters
└── test.vcxproj.user
├── test_playe
├── test_player.cpp
└── test_player.vcproj
├── tracker_test
├── tracker_test.cpp
└── tracker_test.vcproj
└── unit_test.h
/README.md:
--------------------------------------------------------------------------------
1 | # P2Streaming
2 | P2Streaming is a system of streaming media content, such as videos or audio, over a peer-to-peer network. P2Streaming can support both Video on Demand (VOD) and live streaming scenarios in a Peer-to-Peer (P2P) context. In traditional client-server streaming, the content is delivered from a central server to multiple clients. In P2Streaming, the content is distributed among multiple peers (users) who simultaneously receive and relay the content to other peers.
3 |
4 | P2Streaming leverages the collective resources of the peers in the network, such as their upload bandwidth and processing power, to distribute the streaming workload. Each peer in the network acts as both a receiver and a sender of data. When a peer receives a portion of the media content, it can relay that portion to other peers who request it, reducing the strain on the central server and improving scalability.
5 |
6 | P2Streaming can provide several benefits, including:
7 |
8 | * Scalability: By distributing the streaming workload among multiple peers, P2Streaming can handle increased demand without relying solely on a central server.
9 |
10 | * Redundancy: Since the content is distributed across multiple peers, P2Streaming can provide resilience against failures or network disruptions. If one peer becomes unavailable, other peers can continue to relay the content.
11 |
12 | * Lower server bandwidth costs: With P2Streaming, the server's bandwidth requirements can be reduced since the content is shared among peers. This can be particularly advantageous for popular or bandwidth-intensive content.
13 |
14 | * Faster streaming start time: P2Streaming can enable faster start times for streaming media since the content can be retrieved from multiple sources simultaneously.
15 |
16 | The repository contains the server-side, client-side, and multi-cloud remote transmission components of the system.
17 |
--------------------------------------------------------------------------------
/build/NUL_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/NUL_
--------------------------------------------------------------------------------
/build/android/CMakeCache.android.initial.cmake:
--------------------------------------------------------------------------------
1 | ########################
2 | # Initial cache settings for opencv on android
3 | # run cmake with:
4 | # cmake -C
5 | ########################
6 |
7 | #Build shared libraries (.dll/.so CACHE BOOL "" ) instead of static ones (.lib/.a CACHE BOOL "" )
8 | set(BUILD_SHARED_LIBS OFF CACHE BOOL "" )
9 |
10 | #Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.
11 | set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" )
12 |
--------------------------------------------------------------------------------
/build/android/README.android:
--------------------------------------------------------------------------------
1 | See http://opencv.willowgarage.com/wiki/Android
2 |
--------------------------------------------------------------------------------
/build/android/scripts/cmake_android.cmd:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | PUSHD %~dp0..
4 | CALL .\scripts\build.cmd %*
5 | POPD
--------------------------------------------------------------------------------
/build/android/scripts/cmake_android.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cd `dirname $0`/..
3 |
4 | mkdir -p build
5 | cd build
6 |
7 | cmake -C ../CMakeCache.android.initial.cmake -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..
8 |
9 |
--------------------------------------------------------------------------------
/build/android/scripts/cmake_android_armeabi.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cd `dirname $0`/..
3 |
4 | mkdir -p build_armeabi
5 | cd build_armeabi
6 |
7 | cmake -C ../CMakeCache.android.initial.cmake -DANDROID_ABI=armeabi -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..
8 |
9 |
--------------------------------------------------------------------------------
/build/android/scripts/cmake_android_neon.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cd `dirname $0`/..
3 |
4 | mkdir -p build_neon
5 | cd build_neon
6 |
7 | cmake -C ../CMakeCache.android.initial.cmake -DANDROID_ABI="armeabi-v7a with NEON" -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake $@ ../..
8 |
9 |
--------------------------------------------------------------------------------
/build/android/scripts/wincfg.cmd.tmpl:
--------------------------------------------------------------------------------
1 | :: variables required for OpenCV build ::
2 | :: Note: all pathes should be specified without tailing slashes!
3 | SET ANDROID_NDK=C:\full\path\to\your\copy\of\android\NDK\android-ndk-r7
4 | SET CMAKE_EXE=C:\full\path\to\cmake\utility\cmake.exe
5 | SET MAKE_EXE=%ANDROID_NDK%\prebuilt\windows\bin\make.exe
6 |
7 | :: variables required for android-opencv build ::
8 | SET ANDROID_SDK=C:\full\path\to\your\copy\of\android\SDK\android-sdk-windows
9 | SET ANT_DIR=C:\full\path\to\ant\directory\apache-ant-1.8.2
10 | SET JAVA_HOME=C:\full\path\to\JDK\jdk1.6.0_25
11 |
12 | :: configuration options ::
13 | :::: general ARM-V7 settings
14 | SET ANDROID_ABI=armeabi-v7a
15 | SET BUILD_DIR=build
16 |
17 | :::: uncomment following lines to compile for old emulator or old device
18 | ::SET ANDROID_ABI=armeabi
19 | ::SET BUILD_DIR=build_armeabi
20 |
21 | :::: uncomment following lines to compile for ARM-V7 with NEON support
22 | ::SET ANDROID_ABI=armeabi-v7a with NEON
23 | ::SET BUILD_DIR=build_neon
24 |
25 | :::: uncomment following lines to compile for x86
26 | ::SET ANDROID_ABI=x86
27 | ::SET BUILD_DIR=build_x86
28 |
29 | :::: other options
30 | ::SET ANDROID_NATIVE_API_LEVEL=8 &:: android-3 is enough for native part of OpenCV but android-8 is required for Java API and samples
31 |
--------------------------------------------------------------------------------
/build/jni/Android.mk:
--------------------------------------------------------------------------------
1 | include $(APP_PROJECT_PATH)/Apps.mk
2 | include $(APP_PROJECT_PATH)/Libs.mk
3 | include $(APP_PROJECT_PATH)/Boost.mk
4 | include $(APP_PROJECT_PATH)/Openssl.mk
5 | include $(APP_PROJECT_PATH)/Protobuf.mk
6 |
--------------------------------------------------------------------------------
/build/jni/Android.mk.bak:
--------------------------------------------------------------------------------
1 | LOCAL_EXPORT_CPPFLAGS += -ffunction-sections -fdata-sections -fvisibility=hidden -flto
2 | LOCAL_EXPORT_CFLAGS += -ffunction-sections -fdata-sections -flto
3 | ifeq ($(TARGET_ARCH),mips)
4 | LOCAL_EXPORT_LDFLAGS += -Wl,--gc-sections
5 | else
6 | LOCAL_EXPORT_LDFLAGS += -Wl,--gc-sections,--icf=safe
7 | endif
8 |
9 | include $(APP_PROJECT_PATH)/Apps.mk
10 | include $(APP_PROJECT_PATH)/Libs.mk
11 | include $(APP_PROJECT_PATH)/Boost.mk
12 | include $(APP_PROJECT_PATH)/Openssl.mk
13 | include $(APP_PROJECT_PATH)/Protobuf.mk
14 |
--------------------------------------------------------------------------------
/build/jni/Application.mk:
--------------------------------------------------------------------------------
1 | APP_PROJECT_PATH := $(shell pwd)
2 |
3 | APP_CPPFLAGS += -fexceptions
4 | APP_CPPFLAGS += -frtti
5 |
6 | APP_STL := gnustl_static
7 |
8 | APP_CFLAGS+=-DANDROID=1\
9 | -D_GLIBCXX_USE_WCHAR_T=1
10 |
11 | APP_BUILD_SCRIPT := $(APP_PROJECT_PATH)/Android.mk
12 |
--------------------------------------------------------------------------------
/build/jni/Apps.mk:
--------------------------------------------------------------------------------
1 | #===================================================================
2 | #p2s_ppc
3 | #===================================================================
4 | LOCAL_PATH:= $(call my-dir)
5 | SRC_PATH_ROOT:=$(LOCAL_PATH)/../../src
6 |
7 | include $(CLEAR_VARS)
8 | include $(APP_PROJECT_PATH)/Include.mk
9 |
10 | LOCAL_MODULE := p2s_ppc
11 | LOCAL_MODULE_TAGS := release
12 | LOCAL_FORCE_STATIC_EXECUTABLE := true
13 |
14 | #LOCAL_LDLIBS +=../obj/local/$(APP_ABI)/libgnustl_static.a
15 |
16 | LOCAL_STATIC_LIBRARIES += \
17 | libclient \
18 | libcommon \
19 | simple_server\
20 | liburlcrack\
21 | libhttpdownload\
22 | libasfio\
23 | libnatpunch \
24 | libupnp \
25 | libp2engine \
26 | libmessage \
27 | \
28 | libprotobuf\
29 | \
30 | libboost_filesystem\
31 | libboost_date_time\
32 | libboost_system\
33 | libboost_program_options\
34 | libboost_thread\
35 | libboost_regex\
36 | \
37 | libssl\
38 | libcrypto\
39 | \
40 | libgnustl_static\
41 |
42 |
43 | LOCAL_LDFLAGS += \
44 |
45 |
46 | #find all c files in source dir
47 | local_src_files := $(wildcard $(SRC_PATH_ROOT)/app/p2s_ppc/*.cpp)
48 |
49 | #remove parent path of all c files in source dir
50 | local_src_files := $(local_src_files:$(LOCAL_PATH)/%=%)
51 |
52 | LOCAL_SRC_FILES := $(local_src_files)
53 |
54 | include $(BUILD_EXECUTABLE)
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/build/jni/Apps.mk.bak:
--------------------------------------------------------------------------------
1 | #===================================================================
2 | #p2s_ppc
3 | #===================================================================
4 | LOCAL_PATH:= $(call my-dir)
5 | SRC_PATH_ROOT:=$(LOCAL_PATH)/../../src
6 |
7 | include $(CLEAR_VARS)
8 | include $(APP_PROJECT_PATH)/Include.mk
9 |
10 | LOCAL_MODULE := p2s_ppc
11 | LOCAL_MODULE_TAGS := release
12 | LOCAL_FORCE_STATIC_EXECUTABLE := true
13 |
14 | #LOCAL_LDLIBS +=../obj/local/$(APP_ABI)/libgnustl_static.a
15 |
16 | LOCAL_STATIC_LIBRARIES += \
17 | libclient \
18 | libcommon \
19 | simple_server\
20 | liburlcrack\
21 | libhttpdownload\
22 | libasfio\
23 | libnatpunch \
24 | libupnp \
25 | libp2engine \
26 | libmessage \
27 | \
28 | libprotobuf\
29 | \
30 | libboost_filesystem\
31 | libboost_date_time\
32 | libboost_system\
33 | libboost_program_options\
34 | libboost_thread\
35 | libboost_regex\
36 | \
37 | libssl\
38 | libcrypto\
39 | \
40 | libgnustl_static\
41 |
42 |
43 | LOCAL_LDFLAGS += \
44 |
45 |
46 | #find all c files in source dir
47 | local_src_files := $(wildcard $(SRC_PATH_ROOT)/app/p2s_ppc/*.cpp)
48 |
49 | #remove parent path of all c files in source dir
50 | local_src_files := $(local_src_files:$(LOCAL_PATH)/%=%)
51 |
52 | LOCAL_SRC_FILES := $(local_src_files)
53 |
54 |
55 | include $(BUILD_EXECUTABLE)
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/build/jni/Include.mk:
--------------------------------------------------------------------------------
1 | LOCAL_CPP_FEATURES += exceptions
2 |
3 | LOCAL_C_INCLUDES += \
4 | $(APP_PROJECT_PATH)/../../src/lib \
5 | $(APP_PROJECT_PATH)/../../src/lib/p2engine \
6 | $(APP_PROJECT_PATH)/../../src/app \
7 | \
8 | $(BOOST_PATH) \
9 | $(OPENSSL_PATH)/include \
10 | $(PROTOBUF_PATH)/include \
11 | $(ANDROID_NDK)/sources/cxx-stl/gnu-libstdc++/include\
12 |
--------------------------------------------------------------------------------
/build/jni/Openssl.mk:
--------------------------------------------------------------------------------
1 | ####################################################################
2 | #openssl libs
3 | ####################################################################
4 | include $(OPENSSL_PATH)/Android.mk
5 |
--------------------------------------------------------------------------------
/build/jni/Protobuf.mk:
--------------------------------------------------------------------------------
1 | ####################################################################
2 | #openssl libs
3 | ####################################################################
4 |
5 | include $(PROTOBUF_PATH)/Android.mk
6 |
--------------------------------------------------------------------------------
/build/jni/build_arm.cmd:
--------------------------------------------------------------------------------
1 | set PATH_ORG=%PATH%
2 |
3 | set BOOST_PATH=D:/lib/boost
4 | set OPENSSL_PATH=D:/lib/openssl
5 |
6 | set PROTOBUF_PATH=D:/lib/protobuf
7 | set JEMALLOC_PATH=D:/lib/jemalloc-3.0.0
8 |
9 | set ANDROID_NDK=D:/dev/android-ndk/android-ndk-r8b
10 | set NDK_ROOT=%ANDROID_NDK%
11 | set PATH=%NDK_ROOT%;%PATH_ORG%
12 |
13 | cd D:/dev/p2v/trunk/build/jni/
14 |
15 | call %NDK_ROOT%/ndk-build.cmd -j3 APP_ABI=armeabi TARGET_PLATFORM='android-14' NDK_PROJECT_PATH=./.. APP_PROJECT_PATH:=.
16 |
17 | PAUSE
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/build/jni/build_arm_4.0-.cmd:
--------------------------------------------------------------------------------
1 | set PATH_ORG=%PATH%
2 |
3 | set BOOST_PATH=D:/lib/boost
4 | set OPENSSL_PATH=D:/lib/openssl_android
5 |
6 | set PROTOBUF_PATH=D:/lib/protobuf
7 |
8 | set ANDROID_NDK=D:/dev/android-ndk/android-ndk-r9d
9 | set NDK_ROOT=%ANDROID_NDK%
10 | set PATH=%NDK_ROOT%;%PATH_ORG%
11 |
12 | set ROOT_JNI_PATH=D:/dev/p2v/trunk/build/jni/
13 | cd %ROOT_JNI_PATH%;
14 |
15 | call %NDK_ROOT%/ndk-build.cmd -j3 NDK_DEBUG=0 APP_ABI:=armeabi TARGET_PLATFORM='android-8' NDK_PROJECT_PATH=./.. APP_PROJECT_PATH:=.
16 |
17 | PAUSE
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/build/jni/build_mips.cmd:
--------------------------------------------------------------------------------
1 | set PATH_ORG=%PATH%
2 |
3 | set BOOST_PATH=D:/lib/boost
4 | set OPENSSL_PATH=D:/lib/openssl
5 | set PROTOBUF_PATH=D:/lib/protobuf
6 | set JEMALLOC_PATH=D:/lib/jemalloc-3.0.0
7 |
8 | set ANDROID_NDK=D:/dev/android-ndk/android-ndk-r8b
9 | set NDK_ROOT=%ANDROID_NDK%
10 | set PATH=%NDK_ROOT%;%PATH_ORG%
11 |
12 | cd D:/dev/p2v/trunk/build/jni/
13 |
14 | call %NDK_ROOT%/ndk-build.cmd -j3 APP_ABI=mips TARGET_PLATFORM='android-8' NDK_PROJECT_PATH=./.. APP_PROJECT_PATH:=.
15 |
16 | PAUSE
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/build/jni/build_mips_p2v.sh:
--------------------------------------------------------------------------------
1 | export ANDROID_NDK="/cygdrive/d/dev/android-ndk/android-ndk-r7m"
2 | export NDK_ROOT=$ANDROID_NDK
3 |
4 | export PATH="$NDK_ROOT:$PATH_ORG"
5 |
6 | cd /cygdrive/d/dev/p2v/trunk/build/jni/
7 | ndk-build -j4 HOST_AWK=gawk APP_ABI=mips APP_TOOLCHAIN_VERSION='4.4.3' NDK_PROJECT_PATH=../
8 |
--------------------------------------------------------------------------------
/build/jni/build_p2v - x.sh:
--------------------------------------------------------------------------------
1 | export ANDROID_NDK="D:/android-ndk-r9d"
2 | export NDK_ROOT=$ANDROID_NDK
3 |
4 | export PATH="$NDK_ROOT:$PATH_ORG"
5 |
6 | cd D:/project/p2v/trunk/build/jni
7 | ndk-build clean
8 | ndk-build -j4 HOST_AWK=gawk APP_ABI=armeabi APP_TOOLCHAIN_VERSION='4.4.3' NDK_PROJECT_PATH=../
9 |
--------------------------------------------------------------------------------
/build/jni/build_p2v.sh:
--------------------------------------------------------------------------------
1 | export ANDROID_NDK="/cygdrive/d/dev/android-ndk/android-ndk-r7m"
2 | export NDK_ROOT=$ANDROID_NDK
3 |
4 | export PATH="$NDK_ROOT:$PATH_ORG"
5 |
6 | cd /cygdrive/d/dev/p2v/trunk/build/jni/
7 | ndk-build clean
8 | ndk-build -j4 HOST_AWK=gawk APP_ABI=armeabi APP_TOOLCHAIN_VERSION='4.4.3' NDK_PROJECT_PATH=../
9 |
--------------------------------------------------------------------------------
/build/jni/sh.exe.stackdump:
--------------------------------------------------------------------------------
1 | Exception: STATUS_ACCESS_VIOLATION at eip=6102048B
2 | eax=00AF07E8 ebx=61245934 ecx=76730F81 edx=002D51F8 esi=00000000 edi=0028F9F4
3 | ebp=61020C00 esp=0028C7C4 program=D:\cygwin\bin\sh.exe, pid 6464, thread main
4 | cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
5 | Stack trace:
6 | Frame Function Args
7 | End of stack trace
8 |
--------------------------------------------------------------------------------
/build/msvc/msvc10/pbi_p2p.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/msvc/msvc10/pbi_p2p.suo
--------------------------------------------------------------------------------
/build/msvc/msvc11/pbi_p2p.v11.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/msvc/msvc11/pbi_p2p.v11.suo
--------------------------------------------------------------------------------
/build/msvc/msvc11/pbi_p2p.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/msvc/msvc11/pbi_p2p.v12.suo
--------------------------------------------------------------------------------
/build/msvc/msvc12/baidu_p.v12.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/msvc/msvc12/baidu_p.v12.suo
--------------------------------------------------------------------------------
/build/msvc/msvc12/baidu_p2p.suo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/msvc/msvc12/baidu_p2p.suo
--------------------------------------------------------------------------------
/build/msvc/msvc12/suoF462.tmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/build/msvc/msvc12/suoF462.tmp
--------------------------------------------------------------------------------
/clean_msvc_useless.cmd:
--------------------------------------------------------------------------------
1 | del *.ncb /F /Q /S
2 | del *.ipch /F /Q /S
3 | del *.sdf /F /Q /S
4 |
--------------------------------------------------------------------------------
/contrib/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/contrib/cppdb/cppdb.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
--------------------------------------------------------------------------------
/contrib/cppdb/cppdb/connection_specific.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) 2010-2011 Artyom Beilis (Tonkikh)
4 | //
5 | // Distributed under:
6 | //
7 | // the Boost Software License, Version 1.0.
8 | // (See accompanying file LICENSE_1_0.txt or copy at
9 | // http://www.boost.org/LICENSE_1_0.txt)
10 | //
11 | // or (at your opinion) under:
12 | //
13 | // The MIT License
14 | // (See accompanying file MIT.txt or a copy at
15 | // http://www.opensource.org/licenses/mit-license.php)
16 | //
17 | ///////////////////////////////////////////////////////////////////////////////
18 | #ifndef CPPDB_CONNECTION_SPECIFIC_H
19 | #define CPPDB_CONNECTION_SPECIFIC_H
20 |
21 | #include
22 | #include
23 |
24 | namespace cppdb {
25 | ///
26 | /// \brief Special abstract object that holds a connection specific data
27 | ///
28 | /// The user is expected to derive its own object from this class
29 | /// and save them withing the connection
30 | ///
31 | class CPPDB_API connection_specific_data {
32 | connection_specific_data(connection_specific_data const &);
33 | void operator=(connection_specific_data const &);
34 | public:
35 | connection_specific_data();
36 | virtual ~connection_specific_data();
37 |
38 | private:
39 | struct data;
40 | std::auto_ptr d;
41 | };
42 |
43 |
44 | } // cppdb
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/contrib/cppdb/cppdb/defs.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) 2010-2011 Artyom Beilis (Tonkikh)
4 | //
5 | // Distributed under:
6 | //
7 | // the Boost Software License, Version 1.0.
8 | // (See accompanying file LICENSE_1_0.txt or copy at
9 | // http://www.boost.org/LICENSE_1_0.txt)
10 | //
11 | // or (at your opinion) under:
12 | //
13 | // The MIT License
14 | // (See accompanying file MIT.txt or a copy at
15 | // http://www.opensource.org/licenses/mit-license.php)
16 | //
17 | ///////////////////////////////////////////////////////////////////////////////
18 | #ifndef CPPDB_DEFS_H
19 | #define CPPDB_DEFS_H
20 |
21 | #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__CYGWIN__)
22 | # if defined(DLL_EXPORT) || defined(CPPDB_EXPORTS) || defined(CPPDB_DRIVER_EXPORTS)
23 | # ifdef CPPDB_SOURCE
24 | # define CPPDB_API __declspec(dllexport)
25 | # else
26 | # define CPPDB_API __declspec(dllimport)
27 | # endif
28 | # endif
29 | # if defined(DLL_EXPORT) || defined(CPPDB_DRIVER_EXPORTS)
30 | # ifdef CPPDB_DRIVER_SOURCE
31 | # define CPPDB_DRIVER_API __declspec(dllexport)
32 | # else
33 | # define CPPDB_DRIVER_API __declspec(dllimport)
34 | # endif
35 | # endif
36 | #endif
37 |
38 |
39 | #ifndef CPPDB_API
40 | # define CPPDB_API
41 | #endif
42 |
43 | #ifndef CPPDB_DRIVER_API
44 | # define CPPDB_DRIVER_API
45 | #endif
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/contrib/cppdb/cppdb/mutex.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) 2010-2011 Artyom Beilis (Tonkikh)
4 | //
5 | // Distributed under:
6 | //
7 | // the Boost Software License, Version 1.0.
8 | // (See accompanying file LICENSE_1_0.txt or copy at
9 | // http://www.boost.org/LICENSE_1_0.txt)
10 | //
11 | // or (at your opinion) under:
12 | //
13 | // The MIT License
14 | // (See accompanying file MIT.txt or a copy at
15 | // http://www.opensource.org/licenses/mit-license.php)
16 | //
17 | ///////////////////////////////////////////////////////////////////////////////
18 | #ifndef CPPDB_MUTEX_H
19 | #define CPPDB_MUTEX_H
20 |
21 | #include
22 |
23 | namespace cppdb {
24 |
25 | ///
26 | /// \brief mutex class, used internally
27 | ///
28 | class CPPDB_API mutex {
29 | mutex(mutex const &);
30 | void operator=(mutex const &);
31 | public:
32 | class guard;
33 | /// Create mutex
34 | mutex();
35 | /// Destroy mutex
36 | ~mutex();
37 | /// Lock mutex
38 | void lock();
39 | /// Unlock mutex
40 | void unlock();
41 | private:
42 | void *mutex_impl_;
43 | };
44 |
45 | ///
46 | /// \brief scoped guard for mutex
47 | ///
48 | class mutex::guard {
49 | guard(guard const &);
50 | void operator=(guard const &);
51 | public:
52 | /// Create scoped lock
53 | guard(mutex &m) : m_(&m)
54 | {
55 | m_->lock();
56 | }
57 | /// unlock the mutex
58 | ~guard()
59 | {
60 | m_->unlock();
61 | }
62 | private:
63 | mutex *m_;
64 | };
65 | }
66 | #endif
67 |
--------------------------------------------------------------------------------
/contrib/cppdb/template_header.h:
--------------------------------------------------------------------------------
1 | ///////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright (C) 2010-2011 Artyom Beilis (Tonkikh)
4 | //
5 | // Distributed under:
6 | //
7 | // the Boost Software License, Version 1.0.
8 | // (See accompanying file LICENSE_1_0.txt or copy at
9 | // http://www.boost.org/LICENSE_1_0.txt)
10 | //
11 | // or (at your opinion) under:
12 | //
13 | // The MIT License
14 | // (See accompanying file MIT.txt or a copy at
15 | // http://www.opensource.org/licenses/mit-license.php)
16 | //
17 | ///////////////////////////////////////////////////////////////////////////////
18 |
19 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | include_directories(include)
3 | make_executable(p2s_mds)
4 |
5 | ##detail config for p2s_mds
6 | add_dependencies(p2s_mds miniupnpc)
7 | add_dependencies(p2s_mds p2engine)
8 | add_dependencies(p2s_mds natpunch)
9 | add_dependencies(p2s_mds common)
10 | add_dependencies(p2s_mds client)
11 | add_dependencies(p2s_mds tracker)
12 | add_dependencies(p2s_mds server)
13 | add_dependencies(p2s_mds interface)
14 | add_dependencies(p2s_mds service_logic)
15 |
16 |
17 | target_link_libraries(p2s_mds interface)
18 | target_link_libraries(p2s_mds service_logic)
19 | target_link_libraries(p2s_mds client)
20 | target_link_libraries(p2s_mds server)
21 | target_link_libraries(p2s_mds tracker)
22 | target_link_libraries(p2s_mds natpunch)
23 | target_link_libraries(p2s_mds common)
24 | target_link_libraries(p2s_mds p2engine)
25 | target_link_libraries(p2s_mds miniupnpc)
26 | link_boost(p2s_mds
27 | boost_system
28 | boost_regex
29 | boost_thread
30 | boost_date_time
31 | boost_filesystem
32 | )
33 | link_protobuf(p2s_mds)
34 |
35 | set_target_properties(p2s_mds PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PREFIX}/bin)
36 | #set_target_properties(p2s_mds PROPERTIES LINK_FLAGS "-static -s -pthread -lrt -fcommon -MMD -MP -MF -Wno-deprecated")
37 |
38 | #if(${PLATFORM} STREQUAL "windows")
39 | # LINK_THIRD_PARTY_LIBS(p2s_mds Rpcrt4)
40 | #elseif(${PLATFORM} STREQUAL "linux")
41 | # LINK_THIRD_PARTY_LIBS(p2s_mds pthread rt)
42 | #endif()
43 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/auth.h:
--------------------------------------------------------------------------------
1 | #ifndef __COMMON_AUTH
2 | #define __COMMON_AUTH
3 |
4 | #include "p2s_mds/media_server.h"
5 | #include
6 | #include
7 | #include
8 |
9 | using namespace p2engine;
10 |
11 | class auth
12 | :public basic_engine_object
13 | {
14 | typedef auth this_type;
15 | typedef http::http_connection http_connection;
16 | typedef boost::function on_message_handler;
17 | SHARED_ACCESS_DECLARE;
18 |
19 | protected:
20 | auth(io_service& ios);
21 | ~auth();
22 |
23 | public:
24 | static shared_ptr create(io_service& ios)
25 | {
26 | return shared_ptr(new this_type(ios),
27 | shared_access_destroy()
28 | );
29 | }
30 | void reset_regist_code(const std::string& regist_code)
31 | {
32 | regist_code_=regist_code;
33 | }
34 | void run(const std::string& regist_code);
35 | void stop();
36 | on_message_handler& on_error_signal(){return on_error_signal_;}
37 | on_message_handler& on_auth_signal(){return on_auth_signal_;}
38 |
39 | protected:
40 | void on_timer();
41 | void do_auth(const http::response& resp=http::response(),
42 | const safe_buffer& buf=safe_buffer(),
43 | error_code ec=error_code(), coroutine=coroutine()
44 | );
45 | private:
46 | void handle_error(const std::string& errorMsg);
47 | protected:
48 | boost::shared_ptr timer_;
49 |
50 | //����֤�������Ľ���
51 | boost::shared_ptr auth_conn_;
52 | boost::int64_t auth_content_len_;
53 | std::string auth_content_;
54 | std::pair auth_key_pair_;
55 | int auth_failed_cnt_;
56 | std::string challenge_;
57 |
58 | std::string regist_code_;
59 | on_message_handler on_error_signal_;
60 | on_message_handler on_auth_signal_;
61 | };
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/media_relay.h:
--------------------------------------------------------------------------------
1 | #ifndef _MDS_MEDIA_SENDER_H__
2 | #define _MDS_MEDIA_SENDER_H__
3 |
4 | #include
5 | #include
6 |
7 | using namespace p2engine;
8 |
9 | class media_relay
10 | :public p2engine::basic_engine_object
11 | {
12 | typedef media_relay this_type;
13 | SHARED_ACCESS_DECLARE;
14 |
15 | typedef boost::asio::ip::tcp tcp;
16 | typedef http::basic_http_connection connection_type;
17 | typedef http::basic_http_acceptor http_acceptor;
18 | typedef boost::shared_ptr connection_sptr;
19 |
20 | protected:
21 | media_relay(io_service& ios, int listenPort);
22 | virtual ~media_relay();
23 |
24 | public:
25 | static shared_ptr create(io_service& ios, int listenPort)
26 | {
27 | return shared_ptr(new this_type(ios, listenPort),
28 | shared_access_destroy());
29 | }
30 |
31 | void handle_media(const safe_buffer& buf);
32 |
33 | protected:
34 | /// Perform work associated with the server.
35 | void on_accept(connection_sptr conn, error_code ec);
36 |
37 | void on_request(const http::request& req, connection_type* conn);
38 |
39 | void on_disconnected(connection_type* conn);
40 |
41 | void on_data(safe_buffer);
42 | private:
43 | boost::shared_ptr acceptor_;
44 | std::maphttp_connections_;
45 | timed_keeper_set http_connections_keeper_;
46 | };
47 |
48 | #endif // _MDS_MEDIA_SENDER_H__
49 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/media_server.h:
--------------------------------------------------------------------------------
1 | #ifndef __P2S_MDS
2 | #define __P2S_MDS
3 |
4 | #include "common/common.h"
5 | #include "p2s_mds/media_relay.h"
6 | #include "server/server_service_logic.h"
7 | #include "tracker/tracker_service_logic.h"
8 | #include "shunt/receiver.h"
9 |
10 | using namespace p2engine;
11 | using namespace p2server;
12 | using namespace p2shunt;
13 |
14 | //������������������VLC����������������ݺ�ַ�
15 | class p2s_mds
16 | :public server_service_logic_base
17 | {
18 | typedef p2s_mds this_type;
19 | SHARED_ACCESS_DECLARE;
20 |
21 | public:
22 | static shared_ptr create(io_service& ios,
23 | const server_param_base& param,
24 | const std::string& fluidistorUrl
25 | )
26 | {
27 | return shared_ptr(new this_type(ios, param, fluidistorUrl),
28 | shared_access_destroy()
29 | );
30 | }
31 |
32 | void start(error_code& ec);
33 | void reset(error_code& ec);
34 | void stop(error_code& ec);
35 |
36 | protected:
37 | p2s_mds(io_service& ios,
38 | const server_param_base& param,
39 | const std::string& fluidistorUrl
40 | );
41 | virtual ~p2s_mds();
42 |
43 | private:
44 | bool open_distributor(const server_param_base& param);
45 | void handle_media(const safe_buffer& buf);
46 |
47 | private:
48 | std::string fluidistor_url_;
49 |
50 | //boost::shared_ptr media_relay_;
51 |
52 | boost::shared_ptr receiver_;
53 |
54 | udp::endpoint multicast_endpoint_;
55 | boost::scoped_ptr multicast_socket_;
56 |
57 | server_param_base param_;
58 | };
59 |
60 | #endif//__P2S_MDS
61 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/p2s_mds.vcproj:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/guangzhuwu/p2streaming/b0451d11e33f1f150f0eaad3b1abee108d018473/src/app/p2s_mds/p2s_mds.vcproj
--------------------------------------------------------------------------------
/src/app/p2s_mds/p2s_mds_2.vcxproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/progress_alive_alarm.h:
--------------------------------------------------------------------------------
1 | #ifndef MDS_PROGRESS_ALIVE_ALARM_H__
2 | #define MDS_PROGRESS_ALIVE_ALARM_H__
3 |
4 | #include "p2s_mds/media_server.h"
5 | #include
6 | #include
7 | #include
8 |
9 | namespace p2control{
10 | class interprocess_client;
11 | }
12 |
13 | using namespace p2engine;
14 | using namespace p2control;
15 |
16 | class progress_alive_alarm
17 | :public basic_engine_object
18 | {
19 | typedef progress_alive_alarm this_type;
20 | typedef http::http_connection http_connection;
21 | typedef boost::function on_alarm_handler;
22 | SHARED_ACCESS_DECLARE;
23 |
24 | protected:
25 | progress_alive_alarm(boost::shared_ptr s,
26 | const time_duration& interval, const std::string& id, int type, int guardPort
27 | );
28 | ~progress_alive_alarm();
29 |
30 | public:
31 | static shared_ptr create(boost::shared_ptr s
32 | , const time_duration& interval, const std::string& id, int type, int guardPort
33 | )
34 | {
35 | return shared_ptr(new this_type(s, interval, id, type, guardPort),
36 | shared_access_destroy()
37 | );
38 | }
39 | void reset_alarm_port(int port);
40 | void start(boost::shared_ptr, error_code& ec);
41 | void stop();
42 | void reset(error_code& ec);
43 | bool is_stoped()const{return !timer_;}
44 |
45 | protected:
46 | void on_timer();
47 | void on_quality_reported(const safe_buffer& buf);
48 |
49 | protected:
50 | boost::shared_ptr timer_;
51 |
52 | //���ؽ��̵�http����
53 | udp::socket guard_socket_;
54 | udp::endpoint guard_remote_edp_;
55 |
56 | std::string id_;
57 | int type_;
58 | boost::shared_ptr server_;
59 | boost::weak_ptr interprocess_client_;
60 |
61 | int interval_;
62 | ptime last_alarm_time_;
63 | };
64 |
65 | #endif//MDS_PROGRESS_ALIVE_ALARM_H__
66 |
67 |
--------------------------------------------------------------------------------
/src/app/p2s_mds/utility.cpp:
--------------------------------------------------------------------------------
1 | #include "p2s_mds/auth.h"
2 | #include "p2s_mds/media_server.h"
3 | #include "p2s_mds/utility.h"
4 |
5 | #include
6 | #include
7 | #include