├── .gitignore ├── README.md ├── include ├── asio │ ├── buffered_stream_fwd.hpp │ ├── version.hpp │ ├── buffered_read_stream_fwd.hpp │ ├── buffered_write_stream_fwd.hpp │ ├── detail │ │ ├── select_reactor_fwd.hpp │ │ ├── task_io_service_fwd.hpp │ │ ├── service_registry_fwd.hpp │ │ ├── timer_queue_fwd.hpp │ │ ├── regex_fwd.hpp │ │ ├── epoll_reactor_fwd.hpp │ │ ├── dev_poll_reactor_fwd.hpp │ │ ├── reactor.hpp │ │ ├── kqueue_reactor_fwd.hpp │ │ ├── win_iocp_io_service_fwd.hpp │ │ ├── fd_set_adapter.hpp │ │ ├── operation.hpp │ │ ├── array_fwd.hpp │ │ ├── array.hpp │ │ ├── null_fenced_block.hpp │ │ ├── timer_scheduler.hpp │ │ ├── weak_ptr.hpp │ │ ├── shared_ptr.hpp │ │ ├── timer_op.hpp │ │ ├── atomic_count.hpp │ │ ├── signal_init.hpp │ │ ├── signal_op.hpp │ │ ├── solaris_fenced_block.hpp │ │ ├── event.hpp │ │ ├── impl │ │ │ ├── throw_error.ipp │ │ │ ├── win_event.ipp │ │ │ ├── posix_event.ipp │ │ │ ├── posix_mutex.ipp │ │ │ ├── posix_tss_ptr.ipp │ │ │ ├── win_tss_ptr.ipp │ │ │ ├── winsock_init.ipp │ │ │ ├── posix_thread.ipp │ │ │ ├── service_registry.hpp │ │ │ ├── win_mutex.ipp │ │ │ ├── epoll_reactor.hpp │ │ │ ├── task_io_service.hpp │ │ │ ├── dev_poll_reactor.hpp │ │ │ └── kqueue_reactor.hpp │ │ ├── mutex.hpp │ │ ├── macos_fenced_block.hpp │ │ ├── select_interrupter.hpp │ │ ├── signal_blocker.hpp │ │ ├── throw_error.hpp │ │ ├── null_static_mutex.hpp │ │ ├── null_mutex.hpp │ │ ├── thread.hpp │ │ ├── noncopyable.hpp │ │ ├── gcc_x86_fenced_block.hpp │ │ ├── reactor_fwd.hpp │ │ ├── gcc_hppa_fenced_block.hpp │ │ ├── local_free_on_block_exit.hpp │ │ ├── null_tss_ptr.hpp │ │ ├── null_thread.hpp │ │ ├── static_mutex.hpp │ │ ├── timer_scheduler_fwd.hpp │ │ ├── scoped_ptr.hpp │ │ ├── handler_invoke_helpers.hpp │ │ ├── reactor_op.hpp │ │ ├── posix_static_mutex.hpp │ │ ├── null_event.hpp │ │ ├── gcc_sync_fenced_block.hpp │ │ ├── null_signal_blocker.hpp │ │ ├── tss_ptr.hpp │ │ ├── buffer_resize_guard.hpp │ │ ├── timer_queue_base.hpp │ │ ├── timer_queue_set.hpp │ │ ├── base_from_completion_cond.hpp │ │ ├── posix_mutex.hpp │ │ ├── win_static_mutex.hpp │ │ ├── win_tss_ptr.hpp │ │ ├── task_io_service_operation.hpp │ │ ├── pop_options.hpp │ │ ├── win_mutex.hpp │ │ ├── scoped_lock.hpp │ │ ├── posix_tss_ptr.hpp │ │ ├── posix_fd_set_adapter.hpp │ │ ├── win_fenced_block.hpp │ │ ├── gcc_arm_fenced_block.hpp │ │ ├── win_event.hpp │ │ ├── posix_signal_blocker.hpp │ │ ├── call_stack.hpp │ │ └── win_iocp_operation.hpp │ ├── impl │ │ ├── src.cpp │ │ └── serial_port_base.hpp │ ├── signal_set.hpp │ ├── ssl │ │ ├── impl │ │ │ ├── src.hpp │ │ │ ├── error.ipp │ │ │ └── context.hpp │ │ ├── detail │ │ │ ├── openssl_types.hpp │ │ │ ├── shutdown_op.hpp │ │ │ ├── handshake_op.hpp │ │ │ ├── verify_callback.hpp │ │ │ ├── password_callback.hpp │ │ │ ├── write_op.hpp │ │ │ └── read_op.hpp │ │ ├── basic_context.hpp │ │ ├── stream_service.hpp │ │ ├── context_service.hpp │ │ ├── stream_base.hpp │ │ ├── error.hpp │ │ ├── verify_mode.hpp │ │ └── verify_context.hpp │ ├── streambuf.hpp │ ├── basic_streambuf_fwd.hpp │ ├── ssl.hpp │ ├── serial_port.hpp │ ├── deadline_timer.hpp │ ├── windows │ │ ├── stream_handle.hpp │ │ └── random_access_handle.hpp │ ├── ip │ │ ├── host_name.hpp │ │ ├── impl │ │ │ ├── address.hpp │ │ │ ├── host_name.ipp │ │ │ ├── address_v4.hpp │ │ │ ├── address_v6.hpp │ │ │ └── basic_endpoint.hpp │ │ ├── unicast.hpp │ │ └── v6_only.hpp │ ├── posix │ │ └── stream_descriptor.hpp │ ├── is_read_buffered.hpp │ ├── is_write_buffered.hpp │ ├── local │ │ └── datagram_protocol.hpp │ ├── time_traits.hpp │ └── handler_invoke_hook.hpp ├── table_delete.h ├── table_insert.h ├── table_update.h ├── access_method_factory.h ├── row_of_fields.h ├── table_index.h ├── utilities.h ├── rowset.h └── file_driver.h ├── CMakeLists.txt ├── src ├── CMakeLists.txt └── row_of_fields.cpp └── example └── basic-1.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | CMakeCache.txt 3 | CMakeFiles 4 | cmake_install.cmake 5 | lib 6 | tags 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | mysql-replication-listener 2 | ========================= 3 | 4 | A listener to fetch binlog from mysql server. 5 | 6 | Reference: 7 | https://code.launchpad.net/mysql-replication-listener 8 | https://github.com/wangmh/mysql-replication-listener 9 | -------------------------------------------------------------------------------- /include/asio/buffered_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // buffered_stream_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BUFFERED_STREAM_FWD_HPP 12 | #define ASIO_BUFFERED_STREAM_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | 20 | template 21 | class buffered_stream; 22 | 23 | } // namespace asio 24 | 25 | #endif // ASIO_BUFFERED_STREAM_FWD_HPP 26 | -------------------------------------------------------------------------------- /include/asio/version.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // version.hpp 3 | // ~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_VERSION_HPP 12 | #define ASIO_VERSION_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | // ASIO_VERSION % 100 is the sub-minor version 19 | // ASIO_VERSION / 100 % 1000 is the minor version 20 | // ASIO_VERSION / 100000 is the major version 21 | #define ASIO_VERSION 100503 // 1.5.3 22 | 23 | #endif // ASIO_VERSION_HPP 24 | -------------------------------------------------------------------------------- /include/asio/buffered_read_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // buffered_read_stream_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BUFFERED_READ_STREAM_FWD_HPP 12 | #define ASIO_BUFFERED_READ_STREAM_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | 20 | template 21 | class buffered_read_stream; 22 | 23 | } // namespace asio 24 | 25 | #endif // ASIO_BUFFERED_READ_STREAM_FWD_HPP 26 | -------------------------------------------------------------------------------- /include/asio/buffered_write_stream_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // buffered_write_stream_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BUFFERED_WRITE_STREAM_FWD_HPP 12 | #define ASIO_BUFFERED_WRITE_STREAM_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | 20 | template 21 | class buffered_write_stream; 22 | 23 | } // namespace asio 24 | 25 | #endif // ASIO_BUFFERED_WRITE_STREAM_FWD_HPP 26 | -------------------------------------------------------------------------------- /include/asio/detail/select_reactor_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/select_reactor_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SELECT_REACTOR_FWD_HPP 12 | #define ASIO_DETAIL_SELECT_REACTOR_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | namespace detail { 20 | 21 | class select_reactor; 22 | 23 | } // namespace detail 24 | } // namespace asio 25 | 26 | #endif // ASIO_DETAIL_SELECT_REACTOR_FWD_HPP 27 | -------------------------------------------------------------------------------- /include/asio/detail/task_io_service_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/task_io_service_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TASK_IO_SERVICE_FWD_HPP 12 | #define ASIO_DETAIL_TASK_IO_SERVICE_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | namespace detail { 20 | 21 | class task_io_service; 22 | 23 | } // namespace detail 24 | } // namespace asio 25 | 26 | #endif // ASIO_DETAIL_TASK_IO_SERVICE_FWD_HPP 27 | -------------------------------------------------------------------------------- /include/asio/detail/service_registry_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/service_registry_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SERVICE_REGISTRY_FWD_HPP 12 | #define ASIO_DETAIL_SERVICE_REGISTRY_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | namespace detail { 20 | 21 | class service_registry; 22 | 23 | } // namespace detail 24 | } // namespace asio 25 | 26 | #endif // ASIO_DETAIL_SERVICE_REGISTRY_FWD_HPP 27 | -------------------------------------------------------------------------------- /include/asio/detail/timer_queue_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_queue_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_QUEUE_FWD_HPP 12 | #define ASIO_DETAIL_TIMER_QUEUE_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | namespace asio { 19 | namespace detail { 20 | 21 | template 22 | class timer_queue; 23 | 24 | } // namespace detail 25 | } // namespace asio 26 | 27 | #endif // ASIO_DETAIL_TIMER_QUEUE_FWD_HPP 28 | -------------------------------------------------------------------------------- /include/asio/impl/src.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/src.cpp 3 | // ~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #if defined(_MSC_VER) \ 12 | || defined(__BORLANDC__) \ 13 | || defined(__DMC__) 14 | # pragma message ( \ 15 | "This file is deprecated. " \ 16 | "Please #include instead.") 17 | #elif defined(__GNUC__) \ 18 | || defined(__HP_aCC) \ 19 | || defined(__SUNPRO_CC) \ 20 | || defined(__IBMCPP__) 21 | # warning "This file is deprecated." 22 | # warning "Please #include instead." 23 | #endif 24 | 25 | #include "asio/impl/src.hpp" 26 | -------------------------------------------------------------------------------- /include/asio/signal_set.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // signal_set.hpp 3 | // ~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SIGNAL_SET_HPP 12 | #define ASIO_SIGNAL_SET_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/basic_signal_set.hpp" 20 | 21 | namespace asio { 22 | 23 | /// Typedef for the typical usage of a signal set. 24 | typedef basic_signal_set<> signal_set; 25 | 26 | } // namespace asio 27 | 28 | #endif // ASIO_SIGNAL_SET_HPP 29 | -------------------------------------------------------------------------------- /include/asio/ssl/impl/src.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/ssl/src.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IMPL_SRC_HPP 12 | #define ASIO_IMPL_SRC_HPP 13 | 14 | #define ASIO_SOURCE 15 | 16 | #include "asio/detail/config.hpp" 17 | 18 | #if defined(ASIO_HEADER_ONLY) 19 | # error Do not compile Asio library source with ASIO_HEADER_ONLY defined 20 | #endif 21 | 22 | #include "asio/ssl/impl/context.ipp" 23 | #include "asio/ssl/impl/error.ipp" 24 | #include "asio/ssl/detail/impl/engine.ipp" 25 | #include "asio/ssl/detail/impl/openssl_init.ipp" 26 | #include "asio/ssl/impl/rfc2818_verification.ipp" 27 | 28 | #endif // ASIO_IMPL_SRC_HPP 29 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/openssl_types.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/openssl_types.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP 12 | #define ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include "asio/detail/socket_types.hpp" 25 | 26 | #endif // ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP 27 | -------------------------------------------------------------------------------- /include/asio/detail/regex_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/regex_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REGEX_FWD_HPP 12 | #define ASIO_DETAIL_REGEX_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include 19 | #include 20 | 21 | namespace boost { 22 | 23 | template 24 | struct sub_match; 25 | 26 | template 27 | class match_results; 28 | 29 | } // namespace boost 30 | 31 | #endif // ASIO_DETAIL_REGEX_FWD_HPP 32 | -------------------------------------------------------------------------------- /include/asio/streambuf.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // streambuf.hpp 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_STREAMBUF_HPP 12 | #define ASIO_STREAMBUF_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_NO_IOSTREAM) 21 | 22 | #include "asio/basic_streambuf.hpp" 23 | 24 | namespace asio { 25 | 26 | /// Typedef for the typical usage of basic_streambuf. 27 | typedef basic_streambuf<> streambuf; 28 | 29 | } // namespace asio 30 | 31 | #endif // !defined(BOOST_NO_IOSTREAM) 32 | 33 | #endif // ASIO_STREAMBUF_HPP 34 | -------------------------------------------------------------------------------- /include/asio/detail/epoll_reactor_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/epoll_reactor_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_EPOLL_REACTOR_FWD_HPP 12 | #define ASIO_DETAIL_EPOLL_REACTOR_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_EPOLL) 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | class epoll_reactor; 26 | 27 | } // namespace detail 28 | } // namespace asio 29 | 30 | #endif // defined(ASIO_HAS_EPOLL) 31 | 32 | #endif // ASIO_DETAIL_EPOLL_REACTOR_FWD_HPP 33 | -------------------------------------------------------------------------------- /include/asio/basic_streambuf_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // basic_streambuf_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_BASIC_STREAMBUF_FWD_HPP 12 | #define ASIO_BASIC_STREAMBUF_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_NO_IOSTREAM) 21 | 22 | #include 23 | 24 | namespace asio { 25 | 26 | template > 27 | class basic_streambuf; 28 | 29 | } // namespace asio 30 | 31 | #endif // !defined(BOOST_NO_IOSTREAM) 32 | 33 | #endif // ASIO_BASIC_STREAMBUF_FWD_HPP 34 | -------------------------------------------------------------------------------- /include/asio/detail/dev_poll_reactor_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/dev_poll_reactor_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_DEV_POLL_REACTOR_FWD_HPP 12 | #define ASIO_DETAIL_DEV_POLL_REACTOR_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_DEV_POLL) 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | class dev_poll_reactor; 26 | 27 | } // namespace detail 28 | } // namespace asio 29 | 30 | #endif // defined(ASIO_HAS_DEV_POLL) 31 | 32 | #endif // ASIO_DETAIL_DEV_POLL_REACTOR_FWD_HPP 33 | -------------------------------------------------------------------------------- /include/asio/detail/reactor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/reactor.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REACTOR_HPP 12 | #define ASIO_DETAIL_REACTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/reactor_fwd.hpp" 19 | 20 | #if defined(ASIO_HAS_EPOLL) 21 | # include "asio/detail/epoll_reactor.hpp" 22 | #elif defined(ASIO_HAS_KQUEUE) 23 | # include "asio/detail/kqueue_reactor.hpp" 24 | #elif defined(ASIO_HAS_DEV_POLL) 25 | # include "asio/detail/dev_poll_reactor.hpp" 26 | #else 27 | # include "asio/detail/select_reactor.hpp" 28 | #endif 29 | 30 | #endif // ASIO_DETAIL_REACTOR_HPP 31 | -------------------------------------------------------------------------------- /include/asio/ssl.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl.hpp 3 | // ~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_HPP 12 | #define ASIO_SSL_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/ssl/basic_context.hpp" 19 | #include "asio/ssl/context.hpp" 20 | #include "asio/ssl/context_base.hpp" 21 | #include "asio/ssl/context_service.hpp" 22 | #include "asio/ssl/error.hpp" 23 | #include "asio/ssl/rfc2818_verification.hpp" 24 | #include "asio/ssl/stream.hpp" 25 | #include "asio/ssl/stream_base.hpp" 26 | #include "asio/ssl/stream_service.hpp" 27 | #include "asio/ssl/verify_context.hpp" 28 | #include "asio/ssl/verify_mode.hpp" 29 | 30 | #endif // ASIO_SSL_HPP 31 | -------------------------------------------------------------------------------- /include/asio/detail/kqueue_reactor_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/kqueue_reactor_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_DETAIL_KQUEUE_REACTOR_FWD_HPP 13 | #define ASIO_DETAIL_KQUEUE_REACTOR_FWD_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/config.hpp" 20 | 21 | #if defined(ASIO_HAS_KQUEUE) 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class kqueue_reactor; 27 | 28 | } // namespace detail 29 | } // namespace asio 30 | 31 | #endif // defined(ASIO_HAS_KQUEUE) 32 | 33 | #endif // ASIO_DETAIL_KQUEUE_REACTOR_FWD_HPP 34 | -------------------------------------------------------------------------------- /include/asio/detail/win_iocp_io_service_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_iocp_io_service_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_IOCP_IO_SERVICE_FWD_HPP 12 | #define ASIO_DETAIL_WIN_IOCP_IO_SERVICE_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_IOCP) 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | class win_iocp_io_service; 26 | class win_iocp_overlapped_ptr; 27 | 28 | } // namespace detail 29 | } // namespace asio 30 | 31 | #endif // defined(ASIO_HAS_IOCP) 32 | 33 | #endif // ASIO_DETAIL_WIN_IOCP_IO_SERVICE_FWD_HPP 34 | -------------------------------------------------------------------------------- /include/asio/detail/fd_set_adapter.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/fd_set_adapter.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_FD_SET_ADAPTER_HPP 12 | #define ASIO_DETAIL_FD_SET_ADAPTER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/posix_fd_set_adapter.hpp" 20 | #include "asio/detail/win_fd_set_adapter.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) 26 | typedef win_fd_set_adapter fd_set_adapter; 27 | #else 28 | typedef posix_fd_set_adapter fd_set_adapter; 29 | #endif 30 | 31 | } // namespace detail 32 | } // namespace asio 33 | 34 | #endif // ASIO_DETAIL_FD_SET_ADAPTER_HPP 35 | -------------------------------------------------------------------------------- /include/asio/detail/operation.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/operation.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_OPERATION_HPP 12 | #define ASIO_DETAIL_OPERATION_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_IOCP) 21 | # include "asio/detail/win_iocp_operation.hpp" 22 | #else 23 | # include "asio/detail/task_io_service_operation.hpp" 24 | #endif 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_IOCP) 30 | typedef win_iocp_operation operation; 31 | #else 32 | typedef task_io_service_operation operation; 33 | #endif 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_OPERATION_HPP 39 | -------------------------------------------------------------------------------- /include/asio/detail/array_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/array_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_ARRAY_FWD_HPP 12 | #define ASIO_DETAIL_ARRAY_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | namespace boost { 21 | 22 | template 23 | class array; 24 | 25 | } // namespace boost 26 | 27 | // Standard library components can't be forward declared, so we'll have to 28 | // include the array header. Fortunately, it's fairly lightweight and doesn't 29 | // add significantly to the compile time. 30 | #if defined(ASIO_HAS_STD_ARRAY) 31 | # include 32 | #endif // defined(ASIO_HAS_STD_ARRAY) 33 | 34 | #endif // ASIO_DETAIL_ARRAY_FWD_HPP 35 | -------------------------------------------------------------------------------- /include/asio/detail/array.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/array.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_ARRAY_HPP 12 | #define ASIO_DETAIL_ARRAY_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_STD_ARRAY) 21 | # include 22 | #else // defined(ASIO_HAS_STD_ARRAY) 23 | # include 24 | #endif // defined(ASIO_HAS_STD_ARRAY) 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_STD_ARRAY) 30 | using std::array; 31 | #else // defined(ASIO_HAS_STD_ARRAY) 32 | using boost::array; 33 | #endif // defined(ASIO_HAS_STD_ARRAY) 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_ARRAY_HPP 39 | -------------------------------------------------------------------------------- /include/asio/detail/null_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_NULL_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/push_options.hpp" 19 | 20 | namespace asio { 21 | namespace detail { 22 | 23 | class null_fenced_block 24 | : private noncopyable 25 | { 26 | public: 27 | // Constructor. 28 | null_fenced_block() 29 | { 30 | } 31 | 32 | // Destructor. 33 | ~null_fenced_block() 34 | { 35 | } 36 | }; 37 | 38 | } // namespace detail 39 | } // namespace asio 40 | 41 | #include "asio/detail/pop_options.hpp" 42 | 43 | #endif // ASIO_DETAIL_NULL_FENCED_BLOCK_HPP 44 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project (mysql-replication-listener) 2 | cmake_minimum_required (VERSION 2.6) 3 | 4 | set(MySQL_BINLOG_VERSION_MAJOR "0") 5 | set(MySQL_BINLOG_VERSION_MINOR "0.1") 6 | set(MRL_VERSION "${MySQL_BINLOG_VERSION_MAJOR}.${MySQL_BINLOG_VERSION_MINOR}") 7 | 8 | set(CMAKE_VERSION_STRING "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}") 9 | 10 | # General settings 11 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 12 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) 13 | 14 | include_directories(include) 15 | link_directories(${PROJECT_BINARY_DIR}/lib) 16 | 17 | # TODO: order: find asio -> allow to define asio directory -> use include/asio 18 | # For ASIO headers 19 | INCLUDE_DIRECTORIES(include/asio) 20 | 21 | # --------- Find crypt ------------------------------------------ 22 | FIND_LIBRARY(LIB_CRYPTO crypto /opt/local/lib /opt/lib /usr/lib /usr/local/lib) 23 | 24 | add_subdirectory(src) 25 | 26 | include(InstallRequiredSystemLibraries) 27 | 28 | # installation configuration 29 | install(DIRECTORY include DESTINATION /usr FILES_MATCHING PATTERN "*.h") 30 | 31 | -------------------------------------------------------------------------------- /include/asio/serial_port.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // serial_port.hpp 3 | // ~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_SERIAL_PORT_HPP 13 | #define ASIO_SERIAL_PORT_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/config.hpp" 20 | 21 | #if defined(ASIO_HAS_SERIAL_PORT) \ 22 | || defined(GENERATING_DOCUMENTATION) 23 | 24 | #include "asio/basic_serial_port.hpp" 25 | 26 | namespace asio { 27 | 28 | /// Typedef for the typical usage of a serial port. 29 | typedef basic_serial_port<> serial_port; 30 | 31 | } // namespace asio 32 | 33 | #endif // defined(ASIO_HAS_SERIAL_PORT) 34 | // || defined(GENERATING_DOCUMENTATION) 35 | 36 | #endif // ASIO_SERIAL_PORT_HPP 37 | -------------------------------------------------------------------------------- /include/asio/deadline_timer.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // deadline_timer.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DEADLINE_TIMER_HPP 12 | #define ASIO_DEADLINE_TIMER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/socket_types.hpp" // Must come before posix_time. 20 | #include "asio/basic_deadline_timer.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | #include 24 | #include "asio/detail/pop_options.hpp" 25 | 26 | namespace asio { 27 | 28 | /// Typedef for the typical usage of timer. Uses a UTC clock. 29 | typedef basic_deadline_timer deadline_timer; 30 | 31 | } // namespace asio 32 | 33 | #endif // ASIO_DEADLINE_TIMER_HPP 34 | -------------------------------------------------------------------------------- /include/asio/ssl/basic_context.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/basic_context.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_BASIC_CONTEXT_HPP 12 | #define ASIO_SSL_BASIC_CONTEXT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/ssl/old/basic_context.hpp" 22 | #endif // defined(ASIO_ENABLE_OLD_SSL) 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ssl { 28 | 29 | #if defined(ASIO_ENABLE_OLD_SSL) 30 | 31 | using asio::ssl::old::basic_context; 32 | 33 | #endif // defined(ASIO_ENABLE_OLD_SSL) 34 | 35 | } // namespace ssl 36 | } // namespace asio 37 | 38 | #include "asio/detail/pop_options.hpp" 39 | 40 | #endif // ASIO_SSL_BASIC_CONTEXT_HPP 41 | -------------------------------------------------------------------------------- /include/asio/ssl/stream_service.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/stream_service.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_STREAM_SERVICE_HPP 12 | #define ASIO_SSL_STREAM_SERVICE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/ssl/old/stream_service.hpp" 22 | #endif // defined(ASIO_ENABLE_OLD_SSL) 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ssl { 28 | 29 | #if defined(ASIO_ENABLE_OLD_SSL) 30 | 31 | using asio::ssl::old::stream_service; 32 | 33 | #endif // defined(ASIO_ENABLE_OLD_SSL) 34 | 35 | } // namespace ssl 36 | } // namespace asio 37 | 38 | #include "asio/detail/pop_options.hpp" 39 | 40 | #endif // ASIO_SSL_STREAM_SERVICE_HPP 41 | -------------------------------------------------------------------------------- /include/asio/detail/timer_scheduler.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_scheduler.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_SCHEDULER_HPP 12 | #define ASIO_DETAIL_TIMER_SCHEDULER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/timer_scheduler_fwd.hpp" 20 | 21 | #if defined(ASIO_HAS_IOCP) 22 | # include "asio/detail/win_iocp_io_service.hpp" 23 | #elif defined(ASIO_HAS_EPOLL) 24 | # include "asio/detail/epoll_reactor.hpp" 25 | #elif defined(ASIO_HAS_KQUEUE) 26 | # include "asio/detail/kqueue_reactor.hpp" 27 | #elif defined(ASIO_HAS_DEV_POLL) 28 | # include "asio/detail/dev_poll_reactor.hpp" 29 | #else 30 | # include "asio/detail/select_reactor.hpp" 31 | #endif 32 | 33 | #endif // ASIO_DETAIL_TIMER_SCHEDULER_HPP 34 | -------------------------------------------------------------------------------- /include/asio/detail/weak_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/weak_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WEAK_PTR_HPP 12 | #define ASIO_DETAIL_WEAK_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_STD_SHARED_PTR) 21 | # include 22 | #else // defined(ASIO_HAS_STD_SHARED_PTR) 23 | # include 24 | #endif // defined(ASIO_HAS_STD_SHARED_PTR) 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_STD_SHARED_PTR) 30 | using std::weak_ptr; 31 | #else // defined(ASIO_HAS_STD_SHARED_PTR) 32 | using boost::weak_ptr; 33 | #endif // defined(ASIO_HAS_STD_SHARED_PTR) 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_WEAK_PTR_HPP 39 | -------------------------------------------------------------------------------- /include/asio/ssl/context_service.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/context_service.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_CONTEXT_SERVICE_HPP 12 | #define ASIO_SSL_CONTEXT_SERVICE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/ssl/old/context_service.hpp" 22 | #endif // defined(ASIO_ENABLE_OLD_SSL) 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ssl { 28 | 29 | #if defined(ASIO_ENABLE_OLD_SSL) 30 | 31 | using asio::ssl::old::context_service; 32 | 33 | #endif // defined(ASIO_ENABLE_OLD_SSL) 34 | 35 | } // namespace ssl 36 | } // namespace asio 37 | 38 | #include "asio/detail/pop_options.hpp" 39 | 40 | #endif // ASIO_SSL_CONTEXT_SERVICE_HPP 41 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This configuration file builds both the static and shared version of 2 | # the library. 3 | set(replication_sources 4 | access_method_factory.cpp field_iterator.cpp row_of_fields.cpp 5 | binlog_driver.cpp basic_transaction_parser.cpp tcp_driver.cpp 6 | file_driver.cpp binary_log.cpp protocol.cpp value.cpp binlog_event.cpp 7 | resultset_iterator.cpp basic_transaction_parser.cpp 8 | basic_content_handler.cpp utilities.cpp) 9 | 10 | # Configure for building static library 11 | add_library(replication_static STATIC ${replication_sources}) 12 | target_link_libraries(replication_static crypto pthread) 13 | set_target_properties(replication_static PROPERTIES 14 | OUTPUT_NAME "replication") 15 | 16 | # Configure for building shared library 17 | add_library(replication_shared SHARED ${replication_sources}) 18 | target_link_libraries(replication_shared crypto pthread) 19 | 20 | set_target_properties(replication_shared PROPERTIES 21 | VERSION 0.1 SOVERSION 1 22 | OUTPUT_NAME "replication") 23 | 24 | install(TARGETS replication_shared LIBRARY DESTINATION lib) 25 | install(TARGETS replication_static ARCHIVE DESTINATION lib) 26 | -------------------------------------------------------------------------------- /include/asio/detail/shared_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/shared_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SHARED_PTR_HPP 12 | #define ASIO_DETAIL_SHARED_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_STD_SHARED_PTR) 21 | # include 22 | #else // defined(ASIO_HAS_STD_SHARED_PTR) 23 | # include 24 | #endif // defined(ASIO_HAS_STD_SHARED_PTR) 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_STD_SHARED_PTR) 30 | using std::shared_ptr; 31 | #else // defined(ASIO_HAS_STD_SHARED_PTR) 32 | using boost::shared_ptr; 33 | #endif // defined(ASIO_HAS_STD_SHARED_PTR) 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_SHARED_PTR_HPP 39 | -------------------------------------------------------------------------------- /include/asio/detail/timer_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_OP_HPP 12 | #define ASIO_DETAIL_TIMER_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/operation.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class timer_op 27 | : public operation 28 | { 29 | public: 30 | // The error code to be passed to the completion handler. 31 | asio::error_code ec_; 32 | 33 | protected: 34 | timer_op(func_type func) 35 | : operation(func) 36 | { 37 | } 38 | }; 39 | 40 | } // namespace detail 41 | } // namespace asio 42 | 43 | #include "asio/detail/pop_options.hpp" 44 | 45 | #endif // ASIO_DETAIL_TIMER_OP_HPP 46 | -------------------------------------------------------------------------------- /include/table_delete.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | /* 22 | * File: table_delete.h 23 | * Author: thek 24 | * 25 | * Created on den 17 juni 2010, 14:28 26 | */ 27 | 28 | #ifndef _TABLE_DELETE_H 29 | #define _TABLE_DELETE_H 30 | #include 31 | #include "binlog_api.h" 32 | 33 | void table_delete(std::string table_name, mysql::Row_of_fields &fields); 34 | 35 | #endif /* _TABLE_DELETE_H */ 36 | -------------------------------------------------------------------------------- /include/table_insert.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | /* 22 | * File: table_insert.h 23 | * Author: thek 24 | * 25 | * Created on den 15 juni 2010, 09:34 26 | */ 27 | 28 | #ifndef _TABLE_INSERT_H 29 | #define _TABLE_INSERT_H 30 | 31 | #include 32 | #include "binlog_api.h" 33 | 34 | void table_insert(std::string table_name, mysql::Row_of_fields &fields); 35 | 36 | #endif /* _TABLE_INSERT_H */ 37 | -------------------------------------------------------------------------------- /include/asio/windows/stream_handle.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // windows/stream_handle.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_WINDOWS_STREAM_HANDLE_HPP 12 | #define ASIO_WINDOWS_STREAM_HANDLE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/windows/basic_stream_handle.hpp" 24 | 25 | namespace asio { 26 | namespace windows { 27 | 28 | /// Typedef for the typical usage of a stream-oriented handle. 29 | typedef basic_stream_handle<> stream_handle; 30 | 31 | } // namespace windows 32 | } // namespace asio 33 | 34 | #endif // defined(ASIO_HAS_WINDOWS_STREAM_HANDLE) 35 | // || defined(GENERATING_DOCUMENTATION) 36 | 37 | #endif // ASIO_WINDOWS_STREAM_HANDLE_HPP 38 | -------------------------------------------------------------------------------- /include/asio/ip/host_name.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/host_name.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_HOST_NAME_HPP 12 | #define ASIO_IP_HOST_NAME_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include "asio/error_code.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | 27 | /// Get the current host name. 28 | ASIO_DECL std::string host_name(); 29 | 30 | /// Get the current host name. 31 | ASIO_DECL std::string host_name(asio::error_code& ec); 32 | 33 | } // namespace ip 34 | } // namespace asio 35 | 36 | #include "asio/detail/pop_options.hpp" 37 | 38 | #if defined(ASIO_HEADER_ONLY) 39 | # include "asio/ip/impl/host_name.ipp" 40 | #endif // defined(ASIO_HEADER_ONLY) 41 | 42 | #endif // ASIO_IP_HOST_NAME_HPP 43 | -------------------------------------------------------------------------------- /include/table_update.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | /* 22 | * File: table_update.h 23 | * Author: thek 24 | * 25 | * Created on den 17 juni 2010, 14:27 26 | */ 27 | 28 | #ifndef _TABLE_UPDATE_H 29 | #define _TABLE_UPDATE_H 30 | #include 31 | #include "binlog_api.h" 32 | void table_update(std::string table_name, mysql::Row_of_fields &old_fields, mysql::Row_of_fields &new_fields); 33 | 34 | #endif /* _TABLE_UPDATE_H */ 35 | -------------------------------------------------------------------------------- /include/asio/detail/atomic_count.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/atomic_count.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_ATOMIC_COUNT_HPP 12 | #define ASIO_DETAIL_ATOMIC_COUNT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_STD_ATOMIC) 21 | # include 22 | #else // defined(ASIO_HAS_STD_ATOMIC) 23 | # include 24 | #endif // defined(ASIO_HAS_STD_ATOMIC) 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | #if defined(ASIO_HAS_STD_ATOMIC) 30 | typedef std::atomic atomic_count; 31 | #else // defined(ASIO_HAS_STD_ATOMIC) 32 | typedef boost::detail::atomic_count atomic_count; 33 | #endif // defined(ASIO_HAS_STD_ATOMIC) 34 | 35 | } // namespace detail 36 | } // namespace asio 37 | 38 | #endif // ASIO_DETAIL_ATOMIC_COUNT_HPP 39 | -------------------------------------------------------------------------------- /include/asio/posix/stream_descriptor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // posix/stream_descriptor.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_POSIX_STREAM_DESCRIPTOR_HPP 12 | #define ASIO_POSIX_STREAM_DESCRIPTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/posix/basic_stream_descriptor.hpp" 24 | 25 | namespace asio { 26 | namespace posix { 27 | 28 | /// Typedef for the typical usage of a stream-oriented descriptor. 29 | typedef basic_stream_descriptor<> stream_descriptor; 30 | 31 | } // namespace posix 32 | } // namespace asio 33 | 34 | #endif // defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR) 35 | // || defined(GENERATING_DOCUMENTATION) 36 | 37 | #endif // ASIO_POSIX_STREAM_DESCRIPTOR_HPP 38 | -------------------------------------------------------------------------------- /include/asio/detail/signal_init.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/signal_init.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SIGNAL_INIT_HPP 12 | #define ASIO_DETAIL_SIGNAL_INIT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) 21 | 22 | #include 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | template 30 | class signal_init 31 | { 32 | public: 33 | // Constructor. 34 | signal_init() 35 | { 36 | std::signal(Signal, SIG_IGN); 37 | } 38 | }; 39 | 40 | } // namespace detail 41 | } // namespace asio 42 | 43 | #include "asio/detail/pop_options.hpp" 44 | 45 | #endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) 46 | 47 | #endif // ASIO_DETAIL_SIGNAL_INIT_HPP 48 | -------------------------------------------------------------------------------- /include/asio/windows/random_access_handle.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // windows/random_access_handle.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP 12 | #define ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/windows/basic_random_access_handle.hpp" 24 | 25 | namespace asio { 26 | namespace windows { 27 | 28 | /// Typedef for the typical usage of a random-access handle. 29 | typedef basic_random_access_handle<> random_access_handle; 30 | 31 | } // namespace windows 32 | } // namespace asio 33 | 34 | #endif // defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) 35 | // || defined(GENERATING_DOCUMENTATION) 36 | 37 | #endif // ASIO_WINDOWS_RANDOM_ACCESS_HANDLE_HPP 38 | -------------------------------------------------------------------------------- /include/asio/detail/signal_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/signal_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SIGNAL_OP_HPP 12 | #define ASIO_DETAIL_SIGNAL_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/operation.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class signal_op 27 | : public operation 28 | { 29 | public: 30 | // The error code to be passed to the completion handler. 31 | asio::error_code ec_; 32 | 33 | // The signal number to be passed to the completion handler. 34 | int signal_number_; 35 | 36 | protected: 37 | signal_op(func_type func) 38 | : operation(func), 39 | signal_number_(0) 40 | { 41 | } 42 | }; 43 | 44 | } // namespace detail 45 | } // namespace asio 46 | 47 | #include "asio/detail/pop_options.hpp" 48 | 49 | #endif // ASIO_DETAIL_SIGNAL_OP_HPP 50 | -------------------------------------------------------------------------------- /include/asio/detail/solaris_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/solaris_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SOLARIS_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_SOLARIS_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(__sun) 21 | 22 | #include 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | class solaris_fenced_block 30 | : private noncopyable 31 | { 32 | public: 33 | // Constructor. 34 | solaris_fenced_block() 35 | { 36 | membar_consumer(); 37 | } 38 | 39 | // Destructor. 40 | ~solaris_fenced_block() 41 | { 42 | membar_producer(); 43 | } 44 | }; 45 | 46 | } // namespace detail 47 | } // namespace asio 48 | 49 | #include "asio/detail/pop_options.hpp" 50 | 51 | #endif // defined(__sun) 52 | 53 | #endif // ASIO_DETAIL_SOLARIS_FENCED_BLOCK_HPP 54 | -------------------------------------------------------------------------------- /include/asio/detail/event.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/event.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_EVENT_HPP 12 | #define ASIO_DETAIL_EVENT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | # include "asio/detail/null_event.hpp" 22 | #elif defined(BOOST_WINDOWS) 23 | # include "asio/detail/win_event.hpp" 24 | #elif defined(BOOST_HAS_PTHREADS) 25 | # include "asio/detail/posix_event.hpp" 26 | #else 27 | # error Only Windows and POSIX are supported! 28 | #endif 29 | 30 | namespace asio { 31 | namespace detail { 32 | 33 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 34 | typedef null_event event; 35 | #elif defined(BOOST_WINDOWS) 36 | typedef win_event event; 37 | #elif defined(BOOST_HAS_PTHREADS) 38 | typedef posix_event event; 39 | #endif 40 | 41 | } // namespace detail 42 | } // namespace asio 43 | 44 | #endif // ASIO_DETAIL_EVENT_HPP 45 | -------------------------------------------------------------------------------- /include/asio/detail/impl/throw_error.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/throw_error.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_THROW_ERROR_IPP 12 | #define ASIO_DETAIL_IMPL_THROW_ERROR_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include "asio/detail/throw_error.hpp" 21 | #include "asio/system_error.hpp" 22 | 23 | #include "asio/detail/push_options.hpp" 24 | 25 | namespace asio { 26 | namespace detail { 27 | 28 | void do_throw_error(const asio::error_code& err) 29 | { 30 | asio::system_error e(err); 31 | boost::throw_exception(e); 32 | } 33 | 34 | void do_throw_error(const asio::error_code& err, const char* location) 35 | { 36 | asio::system_error e(err, location); 37 | boost::throw_exception(e); 38 | } 39 | 40 | } // namespace detail 41 | } // namespace asio 42 | 43 | #include "asio/detail/pop_options.hpp" 44 | 45 | #endif // ASIO_DETAIL_IMPL_THROW_ERROR_IPP 46 | -------------------------------------------------------------------------------- /include/asio/detail/mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/mutex.hpp 3 | // ~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_MUTEX_HPP 12 | #define ASIO_DETAIL_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | # include "asio/detail/null_mutex.hpp" 22 | #elif defined(BOOST_WINDOWS) 23 | # include "asio/detail/win_mutex.hpp" 24 | #elif defined(BOOST_HAS_PTHREADS) 25 | # include "asio/detail/posix_mutex.hpp" 26 | #else 27 | # error Only Windows and POSIX are supported! 28 | #endif 29 | 30 | namespace asio { 31 | namespace detail { 32 | 33 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 34 | typedef null_mutex mutex; 35 | #elif defined(BOOST_WINDOWS) 36 | typedef win_mutex mutex; 37 | #elif defined(BOOST_HAS_PTHREADS) 38 | typedef posix_mutex mutex; 39 | #endif 40 | 41 | } // namespace detail 42 | } // namespace asio 43 | 44 | #endif // ASIO_DETAIL_MUTEX_HPP 45 | -------------------------------------------------------------------------------- /include/asio/detail/macos_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/macos_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_MACOS_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_MACOS_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(__MACH__) && defined(__APPLE__) 21 | 22 | #include 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | class macos_fenced_block 30 | : private noncopyable 31 | { 32 | public: 33 | // Constructor. 34 | macos_fenced_block() 35 | { 36 | OSMemoryBarrier(); 37 | } 38 | 39 | // Destructor. 40 | ~macos_fenced_block() 41 | { 42 | OSMemoryBarrier(); 43 | } 44 | }; 45 | 46 | } // namespace detail 47 | } // namespace asio 48 | 49 | #include "asio/detail/pop_options.hpp" 50 | 51 | #endif // defined(__MACH__) && defined(__APPLE__) 52 | 53 | #endif // ASIO_DETAIL_MACOS_FENCED_BLOCK_HPP 54 | -------------------------------------------------------------------------------- /include/access_method_factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | #ifndef _ACCESS_METHOD_FACTORY_H 22 | #define _ACCESS_METHOD_FACTORY_H 23 | 24 | #include "binlog_driver.h" 25 | 26 | namespace mysql { 27 | namespace system { 28 | Binary_log_driver *create_transport(const char *url); 29 | Binary_log_driver *parse_mysql_url(char *url, 30 | const char *mysql_access_method); 31 | Binary_log_driver *parse_file_url(char *url, 32 | const char *file_access_method); 33 | } 34 | } 35 | 36 | #endif /* _ACCESS_METHOD_FACTORY_H */ 37 | -------------------------------------------------------------------------------- /include/asio/detail/impl/win_event.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_event.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_WIN_EVENT_IPP 12 | #define ASIO_DETAIL_IMPL_WIN_EVENT_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include "asio/detail/throw_error.hpp" 23 | #include "asio/detail/win_event.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | win_event::win_event() 32 | : event_(::CreateEvent(0, true, false, 0)) 33 | { 34 | if (!event_) 35 | { 36 | DWORD last_error = ::GetLastError(); 37 | asio::error_code ec(last_error, 38 | asio::error::get_system_category()); 39 | asio::detail::throw_error(ec, "event"); 40 | } 41 | } 42 | 43 | } // namespace detail 44 | } // namespace asio 45 | 46 | #include "asio/detail/pop_options.hpp" 47 | 48 | #endif // defined(BOOST_WINDOWS) 49 | 50 | #endif // ASIO_DETAIL_IMPL_WIN_EVENT_IPP 51 | -------------------------------------------------------------------------------- /include/asio/detail/impl/posix_event.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/posix_event.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_POSIX_EVENT_IPP 12 | #define ASIO_DETAIL_IMPL_POSIX_EVENT_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/posix_event.hpp" 23 | #include "asio/detail/throw_error.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | posix_event::posix_event() 31 | : signalled_(false) 32 | { 33 | int error = ::pthread_cond_init(&cond_, 0); 34 | asio::error_code ec(error, 35 | asio::error::get_system_category()); 36 | asio::detail::throw_error(ec, "event"); 37 | } 38 | 39 | } // namespace detail 40 | } // namespace asio 41 | 42 | #include "asio/detail/pop_options.hpp" 43 | 44 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 45 | 46 | #endif // ASIO_DETAIL_IMPL_POSIX_EVENT_IPP 47 | -------------------------------------------------------------------------------- /include/asio/detail/impl/posix_mutex.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/posix_mutex.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 12 | #define ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/posix_mutex.hpp" 23 | #include "asio/detail/throw_error.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | posix_mutex::posix_mutex() 32 | { 33 | int error = ::pthread_mutex_init(&mutex_, 0); 34 | asio::error_code ec(error, 35 | asio::error::get_system_category()); 36 | asio::detail::throw_error(ec, "mutex"); 37 | } 38 | 39 | } // namespace detail 40 | } // namespace asio 41 | 42 | #include "asio/detail/pop_options.hpp" 43 | 44 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 45 | 46 | #endif // ASIO_DETAIL_IMPL_POSIX_MUTEX_IPP 47 | -------------------------------------------------------------------------------- /include/asio/detail/impl/posix_tss_ptr.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/posix_tss_ptr.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_POSIX_TSS_PTR_IPP 12 | #define ASIO_DETAIL_IMPL_POSIX_TSS_PTR_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/posix_tss_ptr.hpp" 23 | #include "asio/detail/throw_error.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | void posix_tss_ptr_create(pthread_key_t& key) 32 | { 33 | int error = ::pthread_key_create(&key, 0); 34 | asio::error_code ec(error, 35 | asio::error::get_system_category()); 36 | asio::detail::throw_error(ec, "tss"); 37 | } 38 | 39 | } // namespace detail 40 | } // namespace asio 41 | 42 | #include "asio/detail/pop_options.hpp" 43 | 44 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 45 | 46 | #endif // ASIO_DETAIL_IMPL_POSIX_TSS_PTR_IPP 47 | -------------------------------------------------------------------------------- /include/asio/detail/select_interrupter.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/select_interrupter.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SELECT_INTERRUPTER_HPP 12 | #define ASIO_DETAIL_SELECT_INTERRUPTER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__SYMBIAN32__) 21 | # include "asio/detail/socket_select_interrupter.hpp" 22 | #elif defined(ASIO_HAS_EVENTFD) 23 | # include "asio/detail/eventfd_select_interrupter.hpp" 24 | #else 25 | # include "asio/detail/pipe_select_interrupter.hpp" 26 | #endif 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__SYMBIAN32__) 32 | typedef socket_select_interrupter select_interrupter; 33 | #elif defined(ASIO_HAS_EVENTFD) 34 | typedef eventfd_select_interrupter select_interrupter; 35 | #else 36 | typedef pipe_select_interrupter select_interrupter; 37 | #endif 38 | 39 | } // namespace detail 40 | } // namespace asio 41 | 42 | #endif // ASIO_DETAIL_SELECT_INTERRUPTER_HPP 43 | -------------------------------------------------------------------------------- /include/asio/ssl/impl/error.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/impl/error.ipp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_IMPL_ERROR_IPP 12 | #define ASIO_SSL_IMPL_ERROR_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/ssl/error.hpp" 20 | #include "asio/ssl/detail/openssl_init.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace error { 26 | 27 | namespace detail { 28 | 29 | class ssl_category : public asio::error_category 30 | { 31 | public: 32 | const char* name() const 33 | { 34 | return "asio.ssl"; 35 | } 36 | 37 | std::string message(int value) const 38 | { 39 | const char* s = ::ERR_reason_error_string(value); 40 | return s ? s : "asio.ssl error"; 41 | } 42 | }; 43 | 44 | } // namespace detail 45 | 46 | const asio::error_category& get_ssl_category() 47 | { 48 | static detail::ssl_category instance; 49 | return instance; 50 | } 51 | 52 | } // namespace error 53 | } // namespace asio 54 | 55 | #include "asio/detail/pop_options.hpp" 56 | 57 | #endif // ASIO_SSL_IMPL_ERROR_IPP 58 | -------------------------------------------------------------------------------- /include/row_of_fields.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | #ifndef _ROW_OF_FIELDS_H 21 | #define _ROW_OF_FIELDS_H 22 | 23 | #include 24 | #include 25 | #include "value.h" 26 | 27 | using namespace mysql; 28 | 29 | namespace mysql 30 | { 31 | 32 | class Row_of_fields : public std::vector 33 | { 34 | public: 35 | Row_of_fields() : std::vector(0) { } 36 | Row_of_fields(int field_count) : std::vector(field_count) {} 37 | virtual ~Row_of_fields() {} 38 | 39 | Row_of_fields& operator=(const Row_of_fields &right); 40 | Row_of_fields& operator=(Row_of_fields &right); 41 | 42 | private: 43 | 44 | }; 45 | 46 | } 47 | 48 | #endif /* _ROW_OF_FIELDS_H */ 49 | -------------------------------------------------------------------------------- /include/asio/detail/signal_blocker.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/signal_blocker.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SIGNAL_BLOCKER_HPP 12 | #define ASIO_DETAIL_SIGNAL_BLOCKER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) \ 21 | || defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__SYMBIAN32__) 22 | # include "asio/detail/null_signal_blocker.hpp" 23 | #elif defined(BOOST_HAS_PTHREADS) 24 | # include "asio/detail/posix_signal_blocker.hpp" 25 | #else 26 | # error Only Windows and POSIX are supported! 27 | #endif 28 | 29 | namespace asio { 30 | namespace detail { 31 | 32 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) \ 33 | || defined(BOOST_WINDOWS) || defined(__CYGWIN__) || defined(__SYMBIAN32__) 34 | typedef null_signal_blocker signal_blocker; 35 | #elif defined(BOOST_HAS_PTHREADS) 36 | typedef posix_signal_blocker signal_blocker; 37 | #endif 38 | 39 | } // namespace detail 40 | } // namespace asio 41 | 42 | #endif // ASIO_DETAIL_SIGNAL_BLOCKER_HPP 43 | -------------------------------------------------------------------------------- /include/asio/detail/throw_error.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/throw_error.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_THROW_ERROR_HPP 12 | #define ASIO_DETAIL_THROW_ERROR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/error_code.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | ASIO_DECL void do_throw_error(const asio::error_code& err); 27 | 28 | ASIO_DECL void do_throw_error(const asio::error_code& err, 29 | const char* location); 30 | 31 | inline void throw_error(const asio::error_code& err) 32 | { 33 | if (err) 34 | do_throw_error(err); 35 | } 36 | 37 | inline void throw_error(const asio::error_code& err, 38 | const char* location) 39 | { 40 | if (err) 41 | do_throw_error(err, location); 42 | } 43 | 44 | } // namespace detail 45 | } // namespace asio 46 | 47 | #include "asio/detail/pop_options.hpp" 48 | 49 | #if defined(ASIO_HEADER_ONLY) 50 | # include "asio/detail/impl/throw_error.ipp" 51 | #endif // defined(ASIO_HEADER_ONLY) 52 | 53 | #endif // ASIO_DETAIL_THROW_ERROR_HPP 54 | -------------------------------------------------------------------------------- /include/asio/detail/null_static_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_static_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_STATIC_MUTEX_HPP 12 | #define ASIO_DETAIL_NULL_STATIC_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/scoped_lock.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | struct null_static_mutex 30 | { 31 | typedef asio::detail::scoped_lock scoped_lock; 32 | 33 | // Initialise the mutex. 34 | void init() 35 | { 36 | } 37 | 38 | // Lock the mutex. 39 | void lock() 40 | { 41 | } 42 | 43 | // Unlock the mutex. 44 | void unlock() 45 | { 46 | } 47 | 48 | int unused_; 49 | }; 50 | 51 | #define ASIO_NULL_STATIC_MUTEX_INIT { 0 } 52 | 53 | } // namespace detail 54 | } // namespace asio 55 | 56 | #include "asio/detail/pop_options.hpp" 57 | 58 | #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 59 | 60 | #endif // ASIO_DETAIL_NULL_STATIC_MUTEX_HPP 61 | -------------------------------------------------------------------------------- /include/asio/detail/null_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_MUTEX_HPP 12 | #define ASIO_DETAIL_NULL_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | #include "asio/detail/scoped_lock.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | class null_mutex 31 | : private noncopyable 32 | { 33 | public: 34 | typedef asio::detail::scoped_lock scoped_lock; 35 | 36 | // Constructor. 37 | null_mutex() 38 | { 39 | } 40 | 41 | // Destructor. 42 | ~null_mutex() 43 | { 44 | } 45 | 46 | // Lock the mutex. 47 | void lock() 48 | { 49 | } 50 | 51 | // Unlock the mutex. 52 | void unlock() 53 | { 54 | } 55 | }; 56 | 57 | } // namespace detail 58 | } // namespace asio 59 | 60 | #include "asio/detail/pop_options.hpp" 61 | 62 | #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 63 | 64 | #endif // ASIO_DETAIL_NULL_MUTEX_HPP 65 | -------------------------------------------------------------------------------- /include/asio/detail/thread.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/thread.hpp 3 | // ~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_THREAD_HPP 12 | #define ASIO_DETAIL_THREAD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | # include "asio/detail/null_thread.hpp" 22 | #elif defined(BOOST_WINDOWS) 23 | # if defined(UNDER_CE) 24 | # include "asio/detail/wince_thread.hpp" 25 | # else 26 | # include "asio/detail/win_thread.hpp" 27 | # endif 28 | #elif defined(BOOST_HAS_PTHREADS) 29 | # include "asio/detail/posix_thread.hpp" 30 | #else 31 | # error Only Windows and POSIX are supported! 32 | #endif 33 | 34 | namespace asio { 35 | namespace detail { 36 | 37 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 38 | typedef null_thread thread; 39 | #elif defined(BOOST_WINDOWS) 40 | # if defined(UNDER_CE) 41 | typedef wince_thread thread; 42 | # else 43 | typedef win_thread thread; 44 | # endif 45 | #elif defined(BOOST_HAS_PTHREADS) 46 | typedef posix_thread thread; 47 | #endif 48 | 49 | } // namespace detail 50 | } // namespace asio 51 | 52 | #endif // ASIO_DETAIL_THREAD_HPP 53 | -------------------------------------------------------------------------------- /include/asio/detail/noncopyable.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/noncopyable.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NONCOPYABLE_HPP 12 | #define ASIO_DETAIL_NONCOPYABLE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 28 | // Redefine the noncopyable class for Borland C++ since that compiler does not 29 | // apply the empty base optimisation unless the base class contains a dummy 30 | // char data member. 31 | class noncopyable 32 | { 33 | protected: 34 | noncopyable() {} 35 | ~noncopyable() {} 36 | private: 37 | noncopyable(const noncopyable&); 38 | const noncopyable& operator=(const noncopyable&); 39 | char dummy_; 40 | }; 41 | #else 42 | using boost::noncopyable; 43 | #endif 44 | 45 | } // namespace detail 46 | 47 | using asio::detail::noncopyable; 48 | 49 | } // namespace asio 50 | 51 | #include "asio/detail/pop_options.hpp" 52 | 53 | #endif // ASIO_DETAIL_NONCOPYABLE_HPP 54 | -------------------------------------------------------------------------------- /include/asio/detail/gcc_x86_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/gcc_x86_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_GCC_X86_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_GCC_X86_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | class gcc_x86_fenced_block 28 | : private noncopyable 29 | { 30 | public: 31 | // Constructor. 32 | gcc_x86_fenced_block() 33 | { 34 | barrier(); 35 | } 36 | 37 | // Destructor. 38 | ~gcc_x86_fenced_block() 39 | { 40 | barrier(); 41 | } 42 | 43 | private: 44 | static int barrier() 45 | { 46 | int r = 0; 47 | __asm__ __volatile__ ("xchgl %%eax, %0" : "=m" (r) : : "memory", "cc"); 48 | return r; 49 | } 50 | }; 51 | 52 | } // namespace detail 53 | } // namespace asio 54 | 55 | #include "asio/detail/pop_options.hpp" 56 | 57 | #endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 58 | 59 | #endif // ASIO_DETAIL_GCC_X86_FENCED_BLOCK_HPP 60 | -------------------------------------------------------------------------------- /include/asio/detail/reactor_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/reactor_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REACTOR_FWD_HPP 12 | #define ASIO_DETAIL_REACTOR_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_IOCP) 21 | # include "asio/detail/select_reactor_fwd.hpp" 22 | #elif defined(ASIO_HAS_EPOLL) 23 | # include "asio/detail/epoll_reactor_fwd.hpp" 24 | #elif defined(ASIO_HAS_KQUEUE) 25 | # include "asio/detail/kqueue_reactor_fwd.hpp" 26 | #elif defined(ASIO_HAS_DEV_POLL) 27 | # include "asio/detail/dev_poll_reactor_fwd.hpp" 28 | #else 29 | # include "asio/detail/select_reactor_fwd.hpp" 30 | #endif 31 | 32 | namespace asio { 33 | namespace detail { 34 | 35 | #if defined(ASIO_HAS_IOCP) 36 | typedef select_reactor reactor; 37 | #elif defined(ASIO_HAS_EPOLL) 38 | typedef epoll_reactor reactor; 39 | #elif defined(ASIO_HAS_KQUEUE) 40 | typedef kqueue_reactor reactor; 41 | #elif defined(ASIO_HAS_DEV_POLL) 42 | typedef dev_poll_reactor reactor; 43 | #else 44 | typedef select_reactor reactor; 45 | #endif 46 | 47 | } // namespace detail 48 | } // namespace asio 49 | 50 | #endif // ASIO_DETAIL_REACTOR_FWD_HPP 51 | -------------------------------------------------------------------------------- /include/asio/ip/impl/address.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/impl/address.hpp 3 | // ~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_IMPL_ADDRESS_HPP 12 | #define ASIO_IP_IMPL_ADDRESS_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #if !defined(BOOST_NO_IOSTREAM) 19 | 20 | #include "asio/detail/throw_error.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | 27 | template 28 | std::basic_ostream& operator<<( 29 | std::basic_ostream& os, const address& addr) 30 | { 31 | asio::error_code ec; 32 | std::string s = addr.to_string(ec); 33 | if (ec) 34 | { 35 | if (os.exceptions() & std::basic_ostream::failbit) 36 | asio::detail::throw_error(ec); 37 | else 38 | os.setstate(std::basic_ostream::failbit); 39 | } 40 | else 41 | for (std::string::iterator i = s.begin(); i != s.end(); ++i) 42 | os << os.widen(*i); 43 | return os; 44 | } 45 | 46 | } // namespace ip 47 | } // namespace asio 48 | 49 | #include "asio/detail/pop_options.hpp" 50 | 51 | #endif // !defined(BOOST_NO_IOSTREAM) 52 | 53 | #endif // ASIO_IP_IMPL_ADDRESS_HPP 54 | -------------------------------------------------------------------------------- /include/asio/ip/impl/host_name.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/impl/host_name.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_IMPL_HOST_NAME_IPP 12 | #define ASIO_IP_IMPL_HOST_NAME_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/socket_ops.hpp" 20 | #include "asio/detail/throw_error.hpp" 21 | #include "asio/detail/winsock_init.hpp" 22 | #include "asio/ip/host_name.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ip { 28 | 29 | std::string host_name() 30 | { 31 | char name[1024]; 32 | asio::error_code ec; 33 | if (asio::detail::socket_ops::gethostname(name, sizeof(name), ec) != 0) 34 | { 35 | asio::detail::throw_error(ec); 36 | return std::string(); 37 | } 38 | return std::string(name); 39 | } 40 | 41 | std::string host_name(asio::error_code& ec) 42 | { 43 | char name[1024]; 44 | if (asio::detail::socket_ops::gethostname(name, sizeof(name), ec) != 0) 45 | return std::string(); 46 | return std::string(name); 47 | } 48 | 49 | } // namespace ip 50 | } // namespace asio 51 | 52 | #include "asio/detail/pop_options.hpp" 53 | 54 | #endif // ASIO_IP_IMPL_HOST_NAME_IPP 55 | -------------------------------------------------------------------------------- /include/asio/detail/gcc_hppa_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/gcc_hppa_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | class gcc_hppa_fenced_block 28 | : private noncopyable 29 | { 30 | public: 31 | // Constructor. 32 | gcc_hppa_fenced_block() 33 | { 34 | barrier(); 35 | } 36 | 37 | // Destructor. 38 | ~gcc_hppa_fenced_block() 39 | { 40 | barrier(); 41 | } 42 | 43 | private: 44 | static void barrier() 45 | { 46 | // This is just a placeholder and almost certainly not sufficient. 47 | __asm__ __volatile__ ("" : : : "memory"); 48 | } 49 | }; 50 | 51 | } // namespace detail 52 | } // namespace asio 53 | 54 | #include "asio/detail/pop_options.hpp" 55 | 56 | #endif // defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) 57 | 58 | #endif // ASIO_DETAIL_GCC_HPPA_FENCED_BLOCK_HPP 59 | -------------------------------------------------------------------------------- /include/table_index.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | /* 22 | * File: table_index.h 23 | * Author: thek 24 | * 25 | * Created on den 8 september 2010, 13:47 26 | */ 27 | 28 | #ifndef TABLE_INDEX_H 29 | #define TABLE_INDEX_H 30 | #include "binlog_event.h" 31 | #include 32 | #include "basic_content_handler.h" 33 | 34 | typedef std::pair Event_index_element; 35 | typedef std::map Int2event_map; 36 | 37 | class Table_index : public mysql::Content_handler, public Int2event_map 38 | { 39 | public: 40 | mysql::Binary_log_event *process_event(mysql::Table_map_event *tm); 41 | 42 | ~Table_index(); 43 | 44 | int get_table_name(int table_id, std::string out); 45 | 46 | }; 47 | 48 | 49 | #endif /* TABLE_INDEX_H */ 50 | -------------------------------------------------------------------------------- /include/asio/ip/impl/address_v4.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/impl/address_v4.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_IMPL_ADDRESS_V4_HPP 12 | #define ASIO_IP_IMPL_ADDRESS_V4_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #if !defined(BOOST_NO_IOSTREAM) 19 | 20 | #include "asio/detail/throw_error.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | 27 | template 28 | std::basic_ostream& operator<<( 29 | std::basic_ostream& os, const address_v4& addr) 30 | { 31 | asio::error_code ec; 32 | std::string s = addr.to_string(ec); 33 | if (ec) 34 | { 35 | if (os.exceptions() & std::basic_ostream::failbit) 36 | asio::detail::throw_error(ec); 37 | else 38 | os.setstate(std::basic_ostream::failbit); 39 | } 40 | else 41 | for (std::string::iterator i = s.begin(); i != s.end(); ++i) 42 | os << os.widen(*i); 43 | return os; 44 | } 45 | 46 | } // namespace ip 47 | } // namespace asio 48 | 49 | #include "asio/detail/pop_options.hpp" 50 | 51 | #endif // !defined(BOOST_NO_IOSTREAM) 52 | 53 | #endif // ASIO_IP_IMPL_ADDRESS_V4_HPP 54 | -------------------------------------------------------------------------------- /include/asio/ip/impl/address_v6.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/impl/address_v6.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_IMPL_ADDRESS_V6_HPP 12 | #define ASIO_IP_IMPL_ADDRESS_V6_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #if !defined(BOOST_NO_IOSTREAM) 19 | 20 | #include "asio/detail/throw_error.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | 27 | template 28 | std::basic_ostream& operator<<( 29 | std::basic_ostream& os, const address_v6& addr) 30 | { 31 | asio::error_code ec; 32 | std::string s = addr.to_string(ec); 33 | if (ec) 34 | { 35 | if (os.exceptions() & std::basic_ostream::failbit) 36 | asio::detail::throw_error(ec); 37 | else 38 | os.setstate(std::basic_ostream::failbit); 39 | } 40 | else 41 | for (std::string::iterator i = s.begin(); i != s.end(); ++i) 42 | os << os.widen(*i); 43 | return os; 44 | } 45 | 46 | } // namespace ip 47 | } // namespace asio 48 | 49 | #include "asio/detail/pop_options.hpp" 50 | 51 | #endif // !defined(BOOST_NO_IOSTREAM) 52 | 53 | #endif // ASIO_IP_IMPL_ADDRESS_V6_HPP 54 | -------------------------------------------------------------------------------- /include/asio/detail/local_free_on_block_exit.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/local_free_on_block_exit.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP 12 | #define ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | #include "asio/detail/socket_types.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | class local_free_on_block_exit 31 | : private noncopyable 32 | { 33 | public: 34 | // Constructor blocks all signals for the calling thread. 35 | explicit local_free_on_block_exit(void* p) 36 | : p_(p) 37 | { 38 | } 39 | 40 | // Destructor restores the previous signal mask. 41 | ~local_free_on_block_exit() 42 | { 43 | ::LocalFree(p_); 44 | } 45 | 46 | private: 47 | void* p_; 48 | }; 49 | 50 | } // namespace detail 51 | } // namespace asio 52 | 53 | #include "asio/detail/pop_options.hpp" 54 | 55 | #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) 56 | 57 | #endif // ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP 58 | -------------------------------------------------------------------------------- /include/asio/detail/null_tss_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_tss_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_TSS_PTR_HPP 12 | #define ASIO_DETAIL_NULL_TSS_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | template 30 | class null_tss_ptr 31 | : private noncopyable 32 | { 33 | public: 34 | // Constructor. 35 | null_tss_ptr() 36 | : value_(0) 37 | { 38 | } 39 | 40 | // Destructor. 41 | ~null_tss_ptr() 42 | { 43 | } 44 | 45 | // Get the value. 46 | operator T*() const 47 | { 48 | return value_; 49 | } 50 | 51 | // Set the value. 52 | void operator=(T* value) 53 | { 54 | value_ = value; 55 | } 56 | 57 | private: 58 | T* value_; 59 | }; 60 | 61 | } // namespace detail 62 | } // namespace asio 63 | 64 | #include "asio/detail/pop_options.hpp" 65 | 66 | #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 67 | 68 | #endif // ASIO_DETAIL_NULL_TSS_PTR_HPP 69 | -------------------------------------------------------------------------------- /include/utilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | #ifndef _UTILITIES_H 22 | #define _UTILITIES_H 23 | 24 | #include "value.h" 25 | #include "protocol.h" 26 | 27 | 28 | using namespace mysql; 29 | 30 | namespace mysql { 31 | 32 | typedef enum 33 | { 34 | Q_FLAGS2_CODE= 0, 35 | Q_SQL_MODE_CODE, 36 | Q_CATALOG_CODE, 37 | Q_AUTO_INCREMENT, 38 | Q_CHARSET_CODE, 39 | Q_TIME_ZONE_CODE, 40 | Q_CATALOG_NZ_CODE, 41 | Q_LC_TIME_NAMES_CODE, 42 | Q_CHARSET_DATABASE_CODE, 43 | Q_TABLE_MAP_FOR_UPDATE_CODE, 44 | Q_MASTER_DATA_WRITTEN_CODE, 45 | Q_INVOKER 46 | } enum_var_types; 47 | 48 | int server_var_decoder (std::map *my_var_map, 49 | std::vector variables); 50 | 51 | } 52 | 53 | #endif /* _UTILITIES_H */ 54 | -------------------------------------------------------------------------------- /include/asio/detail/impl/win_tss_ptr.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/win_tss_ptr.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP 12 | #define ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include "asio/detail/throw_error.hpp" 23 | #include "asio/detail/win_tss_ptr.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | DWORD win_tss_ptr_create() 32 | { 33 | #if defined(UNDER_CE) 34 | enum { out_of_indexes = 0xFFFFFFFF }; 35 | #else 36 | enum { out_of_indexes = TLS_OUT_OF_INDEXES }; 37 | #endif 38 | 39 | DWORD tss_key = ::TlsAlloc(); 40 | if (tss_key == out_of_indexes) 41 | { 42 | DWORD last_error = ::GetLastError(); 43 | asio::error_code ec(last_error, 44 | asio::error::get_system_category()); 45 | asio::detail::throw_error(ec, "tss"); 46 | } 47 | return tss_key; 48 | } 49 | 50 | } // namespace detail 51 | } // namespace asio 52 | 53 | #include "asio/detail/pop_options.hpp" 54 | 55 | #endif // defined(BOOST_WINDOWS) 56 | 57 | #endif // ASIO_DETAIL_IMPL_WIN_TSS_PTR_IPP 58 | -------------------------------------------------------------------------------- /include/asio/detail/null_thread.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_thread.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_THREAD_HPP 12 | #define ASIO_DETAIL_NULL_THREAD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | #include "asio/detail/throw_error.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | class null_thread 32 | : private noncopyable 33 | { 34 | public: 35 | // Constructor. 36 | template 37 | null_thread(Function, unsigned int = 0) 38 | { 39 | asio::detail::throw_error( 40 | asio::error::operation_not_supported, "thread"); 41 | } 42 | 43 | // Destructor. 44 | ~null_thread() 45 | { 46 | } 47 | 48 | // Wait for the thread to exit. 49 | void join() 50 | { 51 | } 52 | }; 53 | 54 | } // namespace detail 55 | } // namespace asio 56 | 57 | #include "asio/detail/pop_options.hpp" 58 | 59 | #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 60 | 61 | #endif // ASIO_DETAIL_NULL_THREAD_HPP 62 | -------------------------------------------------------------------------------- /include/asio/impl/serial_port_base.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // impl/serial_port_base.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_IMPL_SERIAL_PORT_BASE_HPP 13 | #define ASIO_IMPL_SERIAL_PORT_BASE_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/push_options.hpp" 20 | 21 | namespace asio { 22 | 23 | inline serial_port_base::baud_rate::baud_rate(unsigned int rate) 24 | : value_(rate) 25 | { 26 | } 27 | 28 | inline unsigned int serial_port_base::baud_rate::value() const 29 | { 30 | return value_; 31 | } 32 | 33 | inline serial_port_base::flow_control::type 34 | serial_port_base::flow_control::value() const 35 | { 36 | return value_; 37 | } 38 | 39 | inline serial_port_base::parity::type serial_port_base::parity::value() const 40 | { 41 | return value_; 42 | } 43 | 44 | inline serial_port_base::stop_bits::type 45 | serial_port_base::stop_bits::value() const 46 | { 47 | return value_; 48 | } 49 | 50 | inline unsigned int serial_port_base::character_size::value() const 51 | { 52 | return value_; 53 | } 54 | 55 | } // namespace asio 56 | 57 | #include "asio/detail/pop_options.hpp" 58 | 59 | #endif // ASIO_IMPL_SERIAL_PORT_BASE_HPP 60 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/shutdown_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/shutdown_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP 12 | #define ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/ssl/detail/engine.hpp" 22 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ssl { 28 | namespace detail { 29 | 30 | #if !defined(ASIO_ENABLE_OLD_SSL) 31 | 32 | class shutdown_op 33 | { 34 | public: 35 | engine::want operator()(engine& eng, 36 | asio::error_code& ec, 37 | std::size_t& bytes_transferred) const 38 | { 39 | bytes_transferred = 0; 40 | return eng.shutdown(ec); 41 | } 42 | 43 | template 44 | void call_handler(Handler& handler, 45 | const asio::error_code& ec, 46 | const std::size_t&) const 47 | { 48 | handler(ec); 49 | } 50 | }; 51 | 52 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 53 | 54 | } // namespace detail 55 | } // namespace ssl 56 | } // namespace asio 57 | 58 | #include "asio/detail/pop_options.hpp" 59 | 60 | #endif // ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP 61 | -------------------------------------------------------------------------------- /include/asio/detail/static_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/static_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_STATIC_MUTEX_HPP 12 | #define ASIO_DETAIL_STATIC_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | # include "asio/detail/null_static_mutex.hpp" 22 | #elif defined(BOOST_WINDOWS) 23 | # include "asio/detail/win_static_mutex.hpp" 24 | #elif defined(BOOST_HAS_PTHREADS) 25 | # include "asio/detail/posix_static_mutex.hpp" 26 | #else 27 | # error Only Windows and POSIX are supported! 28 | #endif 29 | 30 | namespace asio { 31 | namespace detail { 32 | 33 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 34 | typedef null_static_mutex static_mutex; 35 | # define ASIO_STATIC_MUTEX_INIT ASIO_NULL_STATIC_MUTEX_INIT 36 | #elif defined(BOOST_WINDOWS) 37 | typedef win_static_mutex static_mutex; 38 | # define ASIO_STATIC_MUTEX_INIT ASIO_WIN_STATIC_MUTEX_INIT 39 | #elif defined(BOOST_HAS_PTHREADS) 40 | typedef posix_static_mutex static_mutex; 41 | # define ASIO_STATIC_MUTEX_INIT ASIO_POSIX_STATIC_MUTEX_INIT 42 | #endif 43 | 44 | } // namespace detail 45 | } // namespace asio 46 | 47 | #endif // ASIO_DETAIL_STATIC_MUTEX_HPP 48 | -------------------------------------------------------------------------------- /include/asio/ssl/stream_base.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/stream_base.hpp 3 | // ~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_STREAM_BASE_HPP 12 | #define ASIO_SSL_STREAM_BASE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace ssl { 25 | 26 | /// The stream_base class is used as a base for the asio::ssl::stream 27 | /// class template so that we have a common place to define various enums. 28 | class stream_base 29 | { 30 | public: 31 | /// Different handshake types. 32 | enum handshake_type 33 | { 34 | /// Perform handshaking as a client. 35 | client, 36 | 37 | /// Perform handshaking as a server. 38 | server 39 | }; 40 | 41 | protected: 42 | /// Protected destructor to prevent deletion through this type. 43 | ~stream_base() 44 | { 45 | } 46 | 47 | #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) 48 | private: 49 | // Workaround to enable the empty base optimisation with Borland C++. 50 | char dummy_; 51 | #endif 52 | }; 53 | 54 | } // namespace ssl 55 | } // namespace asio 56 | 57 | #include "asio/detail/pop_options.hpp" 58 | 59 | #endif // ASIO_SSL_STREAM_BASE_HPP 60 | -------------------------------------------------------------------------------- /include/asio/detail/timer_scheduler_fwd.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_scheduler_fwd.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_SCHEDULER_FWD_HPP 12 | #define ASIO_DETAIL_TIMER_SCHEDULER_FWD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_IOCP) 21 | # include "asio/detail/win_iocp_io_service_fwd.hpp" 22 | #elif defined(ASIO_HAS_EPOLL) 23 | # include "asio/detail/epoll_reactor_fwd.hpp" 24 | #elif defined(ASIO_HAS_KQUEUE) 25 | # include "asio/detail/kqueue_reactor_fwd.hpp" 26 | #elif defined(ASIO_HAS_DEV_POLL) 27 | # include "asio/detail/dev_poll_reactor_fwd.hpp" 28 | #else 29 | # include "asio/detail/select_reactor_fwd.hpp" 30 | #endif 31 | 32 | namespace asio { 33 | namespace detail { 34 | 35 | #if defined(ASIO_HAS_IOCP) 36 | typedef win_iocp_io_service timer_scheduler; 37 | #elif defined(ASIO_HAS_EPOLL) 38 | typedef epoll_reactor timer_scheduler; 39 | #elif defined(ASIO_HAS_KQUEUE) 40 | typedef kqueue_reactor timer_scheduler; 41 | #elif defined(ASIO_HAS_DEV_POLL) 42 | typedef dev_poll_reactor timer_scheduler; 43 | #else 44 | typedef select_reactor timer_scheduler; 45 | #endif 46 | 47 | } // namespace detail 48 | } // namespace asio 49 | 50 | #endif // ASIO_DETAIL_TIMER_SCHEDULER_FWD_HPP 51 | -------------------------------------------------------------------------------- /include/asio/detail/scoped_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/scoped_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SCOPED_PTR_HPP 12 | #define ASIO_DETAIL_SCOPED_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | template 26 | class scoped_ptr 27 | { 28 | public: 29 | // Constructor. 30 | explicit scoped_ptr(T* p = 0) 31 | : p_(p) 32 | { 33 | } 34 | 35 | // Destructor. 36 | ~scoped_ptr() 37 | { 38 | delete p_; 39 | } 40 | 41 | // Access. 42 | T* get() 43 | { 44 | return p_; 45 | } 46 | 47 | // Access. 48 | T* operator->() 49 | { 50 | return p_; 51 | } 52 | 53 | // Dereference. 54 | T& operator*() 55 | { 56 | return *p_; 57 | } 58 | 59 | // Reset pointer. 60 | void reset(T* p = 0) 61 | { 62 | delete p_; 63 | p_ = p; 64 | } 65 | 66 | private: 67 | // Disallow copying and assignment. 68 | scoped_ptr(const scoped_ptr&); 69 | scoped_ptr& operator=(const scoped_ptr&); 70 | 71 | T* p_; 72 | }; 73 | 74 | } // namespace detail 75 | } // namespace asio 76 | 77 | #include "asio/detail/pop_options.hpp" 78 | 79 | #endif // ASIO_DETAIL_SCOPED_PTR_HPP 80 | -------------------------------------------------------------------------------- /include/asio/detail/handler_invoke_helpers.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/handler_invoke_helpers.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP 12 | #define ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include 21 | #include "asio/handler_invoke_hook.hpp" 22 | 23 | #include "asio/detail/push_options.hpp" 24 | 25 | // Calls to asio_handler_invoke must be made from a namespace that does not 26 | // contain overloads of this function. The asio_handler_invoke_helpers 27 | // namespace is defined here for that purpose. 28 | namespace asio_handler_invoke_helpers { 29 | 30 | template 31 | inline void invoke(const Function& function, Context& context) 32 | { 33 | #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ 34 | || BOOST_WORKAROUND(__GNUC__, < 3) 35 | Function tmp(function); 36 | tmp(); 37 | #else 38 | using namespace asio; 39 | asio_handler_invoke(function, boost::addressof(context)); 40 | #endif 41 | } 42 | 43 | } // namespace asio_handler_invoke_helpers 44 | 45 | #include "asio/detail/pop_options.hpp" 46 | 47 | #endif // ASIO_DETAIL_HANDLER_INVOKE_HELPERS_HPP 48 | -------------------------------------------------------------------------------- /include/asio/detail/reactor_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/reactor_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_REACTOR_OP_HPP 12 | #define ASIO_DETAIL_REACTOR_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/operation.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class reactor_op 27 | : public operation 28 | { 29 | public: 30 | // The error code to be passed to the completion handler. 31 | asio::error_code ec_; 32 | 33 | // The number of bytes transferred, to be passed to the completion handler. 34 | std::size_t bytes_transferred_; 35 | 36 | // Perform the operation. Returns true if it is finished. 37 | bool perform() 38 | { 39 | return perform_func_(this); 40 | } 41 | 42 | protected: 43 | typedef bool (*perform_func_type)(reactor_op*); 44 | 45 | reactor_op(perform_func_type perform_func, func_type complete_func) 46 | : operation(complete_func), 47 | bytes_transferred_(0), 48 | perform_func_(perform_func) 49 | { 50 | } 51 | 52 | private: 53 | perform_func_type perform_func_; 54 | }; 55 | 56 | } // namespace detail 57 | } // namespace asio 58 | 59 | #include "asio/detail/pop_options.hpp" 60 | 61 | #endif // ASIO_DETAIL_REACTOR_OP_HPP 62 | -------------------------------------------------------------------------------- /include/asio/ip/impl/basic_endpoint.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/impl/basic_endpoint.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_IMPL_BASIC_ENDPOINT_HPP 12 | #define ASIO_IP_IMPL_BASIC_ENDPOINT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #if !defined(BOOST_NO_IOSTREAM) 19 | 20 | #include "asio/detail/throw_error.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | 27 | template 28 | std::basic_ostream& operator<<( 29 | std::basic_ostream& os, 30 | const basic_endpoint& endpoint) 31 | { 32 | asio::ip::detail::endpoint tmp_ep(endpoint.address(), endpoint.port()); 33 | asio::error_code ec; 34 | std::string s = tmp_ep.to_string(ec); 35 | if (ec) 36 | { 37 | if (os.exceptions() & std::basic_ostream::failbit) 38 | asio::detail::throw_error(ec); 39 | else 40 | os.setstate(std::basic_ostream::failbit); 41 | } 42 | else 43 | for (std::string::iterator i = s.begin(); i != s.end(); ++i) 44 | os << os.widen(*i); 45 | return os; 46 | } 47 | 48 | } // namespace ip 49 | } // namespace asio 50 | 51 | #include "asio/detail/pop_options.hpp" 52 | 53 | #endif // !defined(BOOST_NO_IOSTREAM) 54 | 55 | #endif // ASIO_IP_IMPL_BASIC_ENDPOINT_HPP 56 | -------------------------------------------------------------------------------- /include/asio/ssl/error.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/error.hpp 3 | // ~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_ERROR_HPP 12 | #define ASIO_SSL_ERROR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/error_code.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace error { 25 | 26 | enum ssl_errors 27 | { 28 | }; 29 | 30 | extern ASIO_DECL 31 | const asio::error_category& get_ssl_category(); 32 | 33 | static const asio::error_category& ssl_category 34 | = asio::error::get_ssl_category(); 35 | 36 | } // namespace error 37 | } // namespace asio 38 | 39 | #if defined(ASIO_HAS_STD_SYSTEM_ERROR) 40 | namespace std { 41 | 42 | template<> struct is_error_code_enum 43 | { 44 | static const bool value = true; 45 | }; 46 | 47 | } // namespace std 48 | #endif // defined(ASIO_HAS_STD_SYSTEM_ERROR) 49 | 50 | namespace asio { 51 | namespace error { 52 | 53 | inline asio::error_code make_error_code(ssl_errors e) 54 | { 55 | return asio::error_code( 56 | static_cast(e), get_ssl_category()); 57 | } 58 | 59 | } // namespace error 60 | } // namespace asio 61 | 62 | #include "asio/detail/pop_options.hpp" 63 | 64 | #if defined(ASIO_HEADER_ONLY) 65 | # include "asio/ssl/impl/error.ipp" 66 | #endif // defined(ASIO_HEADER_ONLY) 67 | 68 | #endif // ASIO_SSL_ERROR_HPP 69 | -------------------------------------------------------------------------------- /include/asio/detail/posix_static_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/posix_static_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP 12 | #define ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include 23 | #include "asio/detail/scoped_lock.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | struct posix_static_mutex 31 | { 32 | typedef asio::detail::scoped_lock scoped_lock; 33 | 34 | // Initialise the mutex. 35 | void init() 36 | { 37 | // Nothing to do. 38 | } 39 | 40 | // Lock the mutex. 41 | void lock() 42 | { 43 | (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL. 44 | } 45 | 46 | // Unlock the mutex. 47 | void unlock() 48 | { 49 | (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL. 50 | } 51 | 52 | ::pthread_mutex_t mutex_; 53 | }; 54 | 55 | #define ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER } 56 | 57 | } // namespace detail 58 | } // namespace asio 59 | 60 | #include "asio/detail/pop_options.hpp" 61 | 62 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 63 | 64 | #endif // ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP 65 | -------------------------------------------------------------------------------- /include/asio/detail/null_event.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_event.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_EVENT_HPP 12 | #define ASIO_DETAIL_NULL_EVENT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | class null_event 30 | : private noncopyable 31 | { 32 | public: 33 | // Constructor. 34 | null_event() 35 | { 36 | } 37 | 38 | // Destructor. 39 | ~null_event() 40 | { 41 | } 42 | 43 | // Signal the event. 44 | template 45 | void signal(Lock&) 46 | { 47 | } 48 | 49 | // Signal the event and unlock the mutex. 50 | template 51 | void signal_and_unlock(Lock&) 52 | { 53 | } 54 | 55 | // Reset the event. 56 | template 57 | void clear(Lock&) 58 | { 59 | } 60 | 61 | // Wait for the event to become signalled. 62 | template 63 | void wait(Lock&) 64 | { 65 | } 66 | }; 67 | 68 | } // namespace detail 69 | } // namespace asio 70 | 71 | #include "asio/detail/pop_options.hpp" 72 | 73 | #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 74 | 75 | #endif // ASIO_DETAIL_NULL_EVENT_HPP 76 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/handshake_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/handshake_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP 12 | #define ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/ssl/detail/engine.hpp" 22 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ssl { 28 | namespace detail { 29 | 30 | #if !defined(ASIO_ENABLE_OLD_SSL) 31 | 32 | class handshake_op 33 | { 34 | public: 35 | handshake_op(stream_base::handshake_type type) 36 | : type_(type) 37 | { 38 | } 39 | 40 | engine::want operator()(engine& eng, 41 | asio::error_code& ec, 42 | std::size_t& bytes_transferred) const 43 | { 44 | bytes_transferred = 0; 45 | return eng.handshake(type_, ec); 46 | } 47 | 48 | template 49 | void call_handler(Handler& handler, 50 | const asio::error_code& ec, 51 | const std::size_t&) const 52 | { 53 | handler(ec); 54 | } 55 | 56 | private: 57 | stream_base::handshake_type type_; 58 | }; 59 | 60 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 61 | 62 | } // namespace detail 63 | } // namespace ssl 64 | } // namespace asio 65 | 66 | #include "asio/detail/pop_options.hpp" 67 | 68 | #endif // ASIO_SSL_DETAIL_HANDSHAKE_OP_HPP 69 | -------------------------------------------------------------------------------- /include/asio/detail/gcc_sync_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/gcc_sync_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_GCC_SYNC_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_GCC_SYNC_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(__GNUC__) \ 21 | && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ 22 | && !defined(__INTEL_COMPILER) && !defined(__ICL) \ 23 | && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | class gcc_sync_fenced_block 31 | : private noncopyable 32 | { 33 | public: 34 | // Constructor. 35 | gcc_sync_fenced_block() 36 | : value_(0) 37 | { 38 | __sync_lock_test_and_set(&value_, 1); 39 | } 40 | 41 | // Destructor. 42 | ~gcc_sync_fenced_block() 43 | { 44 | __sync_lock_release(&value_); 45 | } 46 | 47 | private: 48 | int value_; 49 | }; 50 | 51 | } // namespace detail 52 | } // namespace asio 53 | 54 | #include "asio/detail/pop_options.hpp" 55 | 56 | #endif // defined(__GNUC__) 57 | // && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) 58 | // && !defined(__INTEL_COMPILER) && !defined(__ICL) 59 | // && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) 60 | 61 | #endif // ASIO_DETAIL_GCC_SYNC_FENCED_BLOCK_HPP 62 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/verify_callback.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/verify_callback.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP 12 | #define ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/ssl/verify_context.hpp" 22 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace ssl { 28 | namespace detail { 29 | 30 | #if !defined(ASIO_ENABLE_OLD_SSL) 31 | 32 | class verify_callback_base 33 | { 34 | public: 35 | virtual ~verify_callback_base() 36 | { 37 | } 38 | 39 | virtual bool call(bool preverified, verify_context& ctx) = 0; 40 | }; 41 | 42 | template 43 | class verify_callback : public verify_callback_base 44 | { 45 | public: 46 | explicit verify_callback(VerifyCallback callback) 47 | : callback_(callback) 48 | { 49 | } 50 | 51 | virtual bool call(bool preverified, verify_context& ctx) 52 | { 53 | return callback_(preverified, ctx); 54 | } 55 | 56 | private: 57 | VerifyCallback callback_; 58 | }; 59 | 60 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 61 | 62 | } // namespace detail 63 | } // namespace ssl 64 | } // namespace asio 65 | 66 | #include "asio/detail/pop_options.hpp" 67 | 68 | #endif // ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP 69 | -------------------------------------------------------------------------------- /src/row_of_fields.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | #include 21 | #include 22 | 23 | #include "row_of_fields.h" 24 | #include "value.h" 25 | 26 | using namespace mysql; 27 | 28 | Row_of_fields& Row_of_fields::operator=(const Row_of_fields &right) 29 | { 30 | if (size() != right.size()) { 31 | this->resize(right.size()); 32 | //throw std::length_error("Row dimension doesn't match."); 33 | } 34 | int i= 0; 35 | // Because the parameter passed in is (const Row_of_fields &), 36 | // begin() will return a const_iterator 37 | for(std::vector::const_iterator it=right.begin(); it != right.end(); it++) 38 | { 39 | this->assign(++i, *it); 40 | } 41 | return *this; 42 | } 43 | 44 | Row_of_fields& Row_of_fields::operator=(Row_of_fields &right) 45 | { 46 | if (size() != right.size()) { 47 | this->resize(right.size()); 48 | } 49 | int i= 0; 50 | for(std::vector::iterator it=right.begin(); it != right.end(); it++) 51 | { 52 | this->assign(++i, *it); 53 | } 54 | return *this; 55 | } 56 | -------------------------------------------------------------------------------- /include/asio/is_read_buffered.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // is_read_buffered.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IS_READ_BUFFERED_HPP 12 | #define ASIO_IS_READ_BUFFERED_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/buffered_read_stream_fwd.hpp" 20 | #include "asio/buffered_stream_fwd.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | 26 | namespace detail { 27 | 28 | template 29 | char is_read_buffered_helper(buffered_stream* s); 30 | 31 | template 32 | char is_read_buffered_helper(buffered_read_stream* s); 33 | 34 | struct is_read_buffered_big_type { char data[10]; }; 35 | is_read_buffered_big_type is_read_buffered_helper(...); 36 | 37 | } // namespace detail 38 | 39 | /// The is_read_buffered class is a traits class that may be used to determine 40 | /// whether a stream type supports buffering of read data. 41 | template 42 | class is_read_buffered 43 | { 44 | public: 45 | #if defined(GENERATING_DOCUMENTATION) 46 | /// The value member is true only if the Stream type supports buffering of 47 | /// read data. 48 | static const bool value; 49 | #else 50 | BOOST_STATIC_CONSTANT(bool, 51 | value = sizeof(detail::is_read_buffered_helper((Stream*)0)) == 1); 52 | #endif 53 | }; 54 | 55 | } // namespace asio 56 | 57 | #include "asio/detail/pop_options.hpp" 58 | 59 | #endif // ASIO_IS_READ_BUFFERED_HPP 60 | -------------------------------------------------------------------------------- /include/rowset.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | #ifndef _ROWSET_H 21 | #define _ROWSET_H 22 | 23 | #include "field_iterator.h" 24 | #include "resultset_iterator.h" 25 | 26 | using namespace mysql; 27 | 28 | namespace mysql { 29 | 30 | class Row_event; 31 | class Table_map_event; 32 | 33 | class Row_event_set 34 | { 35 | public: 36 | typedef Row_event_iterator iterator; 37 | typedef Row_event_iterator const_iterator; 38 | 39 | Row_event_set(Row_event *arg1, Table_map_event *arg2) { source(arg1, arg2); } 40 | 41 | iterator begin() { return iterator(m_row_event, m_table_map_event); } 42 | iterator end() { return iterator(); } 43 | const_iterator begin() const { return const_iterator(m_row_event, m_table_map_event); } 44 | const_iterator end() const { return const_iterator(); } 45 | 46 | private: 47 | void source(Row_event *arg1, Table_map_event *arg2) { m_row_event= arg1; m_table_map_event= arg2; } 48 | Row_event *m_row_event; 49 | Table_map_event *m_table_map_event; 50 | }; 51 | 52 | } 53 | #endif /* _ROWSET_H */ 54 | -------------------------------------------------------------------------------- /include/asio/detail/null_signal_blocker.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/null_signal_blocker.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_NULL_SIGNAL_BLOCKER_HPP 12 | #define ASIO_DETAIL_NULL_SIGNAL_BLOCKER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) \ 21 | || defined(ASIO_DISABLE_THREADS) \ 22 | || defined(BOOST_WINDOWS) \ 23 | || defined(__CYGWIN__) \ 24 | || defined(__SYMBIAN32__) 25 | 26 | #include "asio/detail/noncopyable.hpp" 27 | 28 | #include "asio/detail/push_options.hpp" 29 | 30 | namespace asio { 31 | namespace detail { 32 | 33 | class null_signal_blocker 34 | : private noncopyable 35 | { 36 | public: 37 | // Constructor blocks all signals for the calling thread. 38 | null_signal_blocker() 39 | { 40 | } 41 | 42 | // Destructor restores the previous signal mask. 43 | ~null_signal_blocker() 44 | { 45 | } 46 | 47 | // Block all signals for the calling thread. 48 | void block() 49 | { 50 | } 51 | 52 | // Restore the previous signal mask. 53 | void unblock() 54 | { 55 | } 56 | }; 57 | 58 | } // namespace detail 59 | } // namespace asio 60 | 61 | #include "asio/detail/pop_options.hpp" 62 | 63 | #endif // !defined(BOOST_HAS_THREADS) 64 | // || defined(ASIO_DISABLE_THREADS) 65 | // || defined(BOOST_WINDOWS) 66 | // || defined(__CYGWIN__) 67 | // || defined(__SYMBIAN32__) 68 | 69 | #endif // ASIO_DETAIL_NULL_SIGNAL_BLOCKER_HPP 70 | -------------------------------------------------------------------------------- /include/asio/detail/tss_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/tss_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TSS_PTR_HPP 12 | #define ASIO_DETAIL_TSS_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 21 | # include "asio/detail/null_tss_ptr.hpp" 22 | #elif defined(BOOST_WINDOWS) 23 | # include "asio/detail/win_tss_ptr.hpp" 24 | #elif defined(BOOST_HAS_PTHREADS) 25 | # include "asio/detail/posix_tss_ptr.hpp" 26 | #else 27 | # error Only Windows and POSIX are supported! 28 | #endif 29 | 30 | #include "asio/detail/push_options.hpp" 31 | 32 | namespace asio { 33 | namespace detail { 34 | 35 | template 36 | class tss_ptr 37 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 38 | : public null_tss_ptr 39 | #elif defined(BOOST_WINDOWS) 40 | : public win_tss_ptr 41 | #elif defined(BOOST_HAS_PTHREADS) 42 | : public posix_tss_ptr 43 | #endif 44 | { 45 | public: 46 | void operator=(T* value) 47 | { 48 | #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS) 49 | null_tss_ptr::operator=(value); 50 | #elif defined(BOOST_WINDOWS) 51 | win_tss_ptr::operator=(value); 52 | #elif defined(BOOST_HAS_PTHREADS) 53 | posix_tss_ptr::operator=(value); 54 | #endif 55 | } 56 | }; 57 | 58 | } // namespace detail 59 | } // namespace asio 60 | 61 | #include "asio/detail/pop_options.hpp" 62 | 63 | #endif // ASIO_DETAIL_TSS_PTR_HPP 64 | -------------------------------------------------------------------------------- /include/asio/is_write_buffered.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // is_write_buffered.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IS_WRITE_BUFFERED_HPP 12 | #define ASIO_IS_WRITE_BUFFERED_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/buffered_stream_fwd.hpp" 20 | #include "asio/buffered_write_stream_fwd.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | 26 | namespace detail { 27 | 28 | template 29 | char is_write_buffered_helper(buffered_stream* s); 30 | 31 | template 32 | char is_write_buffered_helper(buffered_write_stream* s); 33 | 34 | struct is_write_buffered_big_type { char data[10]; }; 35 | is_write_buffered_big_type is_write_buffered_helper(...); 36 | 37 | } // namespace detail 38 | 39 | /// The is_write_buffered class is a traits class that may be used to determine 40 | /// whether a stream type supports buffering of written data. 41 | template 42 | class is_write_buffered 43 | { 44 | public: 45 | #if defined(GENERATING_DOCUMENTATION) 46 | /// The value member is true only if the Stream type supports buffering of 47 | /// written data. 48 | static const bool value; 49 | #else 50 | BOOST_STATIC_CONSTANT(bool, 51 | value = sizeof(detail::is_write_buffered_helper((Stream*)0)) == 1); 52 | #endif 53 | }; 54 | 55 | } // namespace asio 56 | 57 | #include "asio/detail/pop_options.hpp" 58 | 59 | #endif // ASIO_IS_WRITE_BUFFERED_HPP 60 | -------------------------------------------------------------------------------- /include/asio/ip/unicast.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/unicast.hpp 3 | // ~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_UNICAST_HPP 12 | #define ASIO_IP_UNICAST_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | #include "asio/ip/detail/socket_option.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace ip { 26 | namespace unicast { 27 | 28 | /// Socket option for time-to-live associated with outgoing unicast packets. 29 | /** 30 | * Implements the IPPROTO_IP/IP_UNICAST_TTL socket option. 31 | * 32 | * @par Examples 33 | * Setting the option: 34 | * @code 35 | * asio::ip::udp::socket socket(io_service); 36 | * ... 37 | * asio::ip::unicast::hops option(4); 38 | * socket.set_option(option); 39 | * @endcode 40 | * 41 | * @par 42 | * Getting the current option value: 43 | * @code 44 | * asio::ip::udp::socket socket(io_service); 45 | * ... 46 | * asio::ip::unicast::hops option; 47 | * socket.get_option(option); 48 | * int ttl = option.value(); 49 | * @endcode 50 | * 51 | * @par Concepts: 52 | * GettableSocketOption, SettableSocketOption. 53 | */ 54 | #if defined(GENERATING_DOCUMENTATION) 55 | typedef implementation_defined hops; 56 | #else 57 | typedef asio::ip::detail::socket_option::unicast_hops< 58 | IPPROTO_IP, IP_TTL, IPPROTO_IPV6, IPV6_UNICAST_HOPS> hops; 59 | #endif 60 | 61 | } // namespace unicast 62 | } // namespace ip 63 | } // namespace asio 64 | 65 | #include "asio/detail/pop_options.hpp" 66 | 67 | #endif // ASIO_IP_UNICAST_HPP 68 | -------------------------------------------------------------------------------- /include/asio/detail/buffer_resize_guard.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/buffer_resize_guard.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_BUFFER_RESIZE_GUARD_HPP 12 | #define ASIO_DETAIL_BUFFER_RESIZE_GUARD_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | // Helper class to manage buffer resizing in an exception safe way. 27 | template 28 | class buffer_resize_guard 29 | { 30 | public: 31 | // Constructor. 32 | buffer_resize_guard(Buffer& buffer) 33 | : buffer_(buffer), 34 | old_size_(buffer.size()) 35 | { 36 | } 37 | 38 | // Destructor rolls back the buffer resize unless commit was called. 39 | ~buffer_resize_guard() 40 | { 41 | if (old_size_ 42 | != std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION()) 43 | { 44 | buffer_.resize(old_size_); 45 | } 46 | } 47 | 48 | // Commit the resize transaction. 49 | void commit() 50 | { 51 | old_size_ 52 | = std::numeric_limits::max BOOST_PREVENT_MACRO_SUBSTITUTION(); 53 | } 54 | 55 | private: 56 | // The buffer being managed. 57 | Buffer& buffer_; 58 | 59 | // The size of the buffer at the time the guard was constructed. 60 | size_t old_size_; 61 | }; 62 | 63 | } // namespace detail 64 | } // namespace asio 65 | 66 | #include "asio/detail/pop_options.hpp" 67 | 68 | #endif // ASIO_DETAIL_BUFFER_RESIZE_GUARD_HPP 69 | -------------------------------------------------------------------------------- /include/asio/detail/timer_queue_base.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_queue_base.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_QUEUE_BASE_HPP 12 | #define ASIO_DETAIL_TIMER_QUEUE_BASE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/noncopyable.hpp" 20 | #include "asio/detail/op_queue.hpp" 21 | #include "asio/detail/operation.hpp" 22 | 23 | #include "asio/detail/push_options.hpp" 24 | 25 | namespace asio { 26 | namespace detail { 27 | 28 | class timer_queue_base 29 | : private noncopyable 30 | { 31 | public: 32 | // Constructor. 33 | timer_queue_base() : next_(0) {} 34 | 35 | // Destructor. 36 | virtual ~timer_queue_base() {} 37 | 38 | // Whether there are no timers in the queue. 39 | virtual bool empty() const = 0; 40 | 41 | // Get the time to wait until the next timer. 42 | virtual long wait_duration_msec(long max_duration) const = 0; 43 | 44 | // Get the time to wait until the next timer. 45 | virtual long wait_duration_usec(long max_duration) const = 0; 46 | 47 | // Dequeue all ready timers. 48 | virtual void get_ready_timers(op_queue& ops) = 0; 49 | 50 | // Dequeue all timers. 51 | virtual void get_all_timers(op_queue& ops) = 0; 52 | 53 | private: 54 | friend class timer_queue_set; 55 | 56 | // Next timer queue in the set. 57 | timer_queue_base* next_; 58 | }; 59 | 60 | } // namespace detail 61 | } // namespace asio 62 | 63 | #include "asio/detail/pop_options.hpp" 64 | 65 | #endif // ASIO_DETAIL_TIMER_QUEUE_BASE_HPP 66 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/password_callback.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/password_callback.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP 12 | #define ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include 22 | # include 23 | # include "asio/ssl/context_base.hpp" 24 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace ssl { 30 | namespace detail { 31 | 32 | #if !defined(ASIO_ENABLE_OLD_SSL) 33 | 34 | class password_callback_base 35 | { 36 | public: 37 | virtual ~password_callback_base() 38 | { 39 | } 40 | 41 | virtual std::string call(std::size_t size, 42 | context_base::password_purpose purpose) = 0; 43 | }; 44 | 45 | template 46 | class password_callback : public password_callback_base 47 | { 48 | public: 49 | explicit password_callback(PasswordCallback callback) 50 | : callback_(callback) 51 | { 52 | } 53 | 54 | virtual std::string call(std::size_t size, 55 | context_base::password_purpose purpose) 56 | { 57 | return callback_(size, purpose); 58 | } 59 | 60 | private: 61 | PasswordCallback callback_; 62 | }; 63 | 64 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 65 | 66 | } // namespace detail 67 | } // namespace ssl 68 | } // namespace asio 69 | 70 | #include "asio/detail/pop_options.hpp" 71 | 72 | #endif // ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP 73 | -------------------------------------------------------------------------------- /include/asio/ssl/verify_mode.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/verify_mode.hpp 3 | // ~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_VERIFY_MODE_HPP 12 | #define ASIO_SSL_VERIFY_MODE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/ssl/detail/openssl_types.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace ssl { 25 | 26 | /// Bitmask type for peer verification. 27 | /** 28 | * Possible values are: 29 | * @li @ref verify_none 30 | * @li @ref verify_peer 31 | * @li @ref verify_fail_if_no_peer_cert 32 | * @li @ref verify_client_once 33 | */ 34 | typedef int verify_mode; 35 | 36 | #if defined(GENERATING_DOCUMENTATION) 37 | /// No verification. 38 | const int verify_none = implementation_defined; 39 | 40 | /// Verify the peer. 41 | const int verify_peer = implementation_defined; 42 | 43 | /// Fail verification if the peer has no certificate. Ignored unless 44 | /// @ref verify_peer is set. 45 | const int verify_fail_if_no_peer_cert = implementation_defined; 46 | 47 | /// Do not request client certificate on renegotiation. Ignored unless 48 | /// @ref verify_peer is set. 49 | const int verify_client_once = implementation_defined; 50 | #else 51 | const int verify_none = SSL_VERIFY_NONE; 52 | const int verify_peer = SSL_VERIFY_PEER; 53 | const int verify_fail_if_no_peer_cert = SSL_VERIFY_FAIL_IF_NO_PEER_CERT; 54 | const int verify_client_once = SSL_VERIFY_CLIENT_ONCE; 55 | #endif 56 | 57 | } // namespace ssl 58 | } // namespace asio 59 | 60 | #include "asio/detail/pop_options.hpp" 61 | 62 | #endif // ASIO_SSL_VERIFY_MODE_HPP 63 | -------------------------------------------------------------------------------- /include/asio/detail/timer_queue_set.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/timer_queue_set.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TIMER_QUEUE_SET_HPP 12 | #define ASIO_DETAIL_TIMER_QUEUE_SET_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/timer_queue_base.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | class timer_queue_set 27 | { 28 | public: 29 | // Constructor. 30 | ASIO_DECL timer_queue_set(); 31 | 32 | // Add a timer queue to the set. 33 | ASIO_DECL void insert(timer_queue_base* q); 34 | 35 | // Remove a timer queue from the set. 36 | ASIO_DECL void erase(timer_queue_base* q); 37 | 38 | // Determine whether all queues are empty. 39 | ASIO_DECL bool all_empty() const; 40 | 41 | // Get the wait duration in milliseconds. 42 | ASIO_DECL long wait_duration_msec(long max_duration) const; 43 | 44 | // Get the wait duration in microseconds. 45 | ASIO_DECL long wait_duration_usec(long max_duration) const; 46 | 47 | // Dequeue all ready timers. 48 | ASIO_DECL void get_ready_timers(op_queue& ops); 49 | 50 | // Dequeue all timers. 51 | ASIO_DECL void get_all_timers(op_queue& ops); 52 | 53 | private: 54 | timer_queue_base* first_; 55 | }; 56 | 57 | } // namespace detail 58 | } // namespace asio 59 | 60 | #include "asio/detail/pop_options.hpp" 61 | 62 | #if defined(ASIO_HEADER_ONLY) 63 | # include "asio/detail/impl/timer_queue_set.ipp" 64 | #endif // defined(ASIO_HEADER_ONLY) 65 | 66 | #endif // ASIO_DETAIL_TIMER_QUEUE_SET_HPP 67 | -------------------------------------------------------------------------------- /include/asio/detail/base_from_completion_cond.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/base_from_completion_cond.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP 12 | #define ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/completion_condition.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace detail { 25 | 26 | template 27 | class base_from_completion_cond 28 | { 29 | protected: 30 | explicit base_from_completion_cond(CompletionCondition completion_condition) 31 | : completion_condition_(completion_condition) 32 | { 33 | } 34 | 35 | std::size_t check_for_completion( 36 | const asio::error_code& ec, 37 | std::size_t total_transferred) 38 | { 39 | return detail::adapt_completion_condition_result( 40 | completion_condition_(ec, total_transferred)); 41 | } 42 | 43 | private: 44 | CompletionCondition completion_condition_; 45 | }; 46 | 47 | template <> 48 | class base_from_completion_cond 49 | { 50 | protected: 51 | explicit base_from_completion_cond(transfer_all_t) 52 | { 53 | } 54 | 55 | static std::size_t check_for_completion( 56 | const asio::error_code& ec, 57 | std::size_t total_transferred) 58 | { 59 | return transfer_all_t()(ec, total_transferred); 60 | } 61 | }; 62 | 63 | } // namespace detail 64 | } // namespace asio 65 | 66 | #include "asio/detail/pop_options.hpp" 67 | 68 | #endif // ASIO_DETAIL_BASE_FROM_COMPLETION_COND_HPP 69 | -------------------------------------------------------------------------------- /include/asio/detail/posix_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/posix_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_POSIX_MUTEX_HPP 12 | #define ASIO_DETAIL_POSIX_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include 23 | #include "asio/detail/noncopyable.hpp" 24 | #include "asio/detail/scoped_lock.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | class posix_event; 32 | 33 | class posix_mutex 34 | : private noncopyable 35 | { 36 | public: 37 | typedef asio::detail::scoped_lock scoped_lock; 38 | 39 | // Constructor. 40 | ASIO_DECL posix_mutex(); 41 | 42 | // Destructor. 43 | ~posix_mutex() 44 | { 45 | ::pthread_mutex_destroy(&mutex_); // Ignore EBUSY. 46 | } 47 | 48 | // Lock the mutex. 49 | void lock() 50 | { 51 | (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL. 52 | } 53 | 54 | // Unlock the mutex. 55 | void unlock() 56 | { 57 | (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL. 58 | } 59 | 60 | private: 61 | friend class posix_event; 62 | ::pthread_mutex_t mutex_; 63 | }; 64 | 65 | } // namespace detail 66 | } // namespace asio 67 | 68 | #include "asio/detail/pop_options.hpp" 69 | 70 | #if defined(ASIO_HEADER_ONLY) 71 | # include "asio/detail/impl/posix_mutex.ipp" 72 | #endif // defined(ASIO_HEADER_ONLY) 73 | 74 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 75 | 76 | #endif // ASIO_DETAIL_POSIX_MUTEX_HPP 77 | -------------------------------------------------------------------------------- /include/asio/detail/win_static_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_static_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_STATIC_MUTEX_HPP 12 | #define ASIO_DETAIL_WIN_STATIC_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include "asio/detail/scoped_lock.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | struct win_static_mutex 30 | { 31 | typedef asio::detail::scoped_lock scoped_lock; 32 | 33 | // Initialise the mutex. 34 | ASIO_DECL void init(); 35 | 36 | // Initialisation must be performed in a separate function to the "public" 37 | // init() function since the compiler does not support the use of structured 38 | // exceptions and C++ exceptions in the same function. 39 | ASIO_DECL int do_init(); 40 | 41 | // Lock the mutex. 42 | void lock() 43 | { 44 | ::EnterCriticalSection(&crit_section_); 45 | } 46 | 47 | // Unlock the mutex. 48 | void unlock() 49 | { 50 | ::LeaveCriticalSection(&crit_section_); 51 | } 52 | 53 | bool initialised_; 54 | ::CRITICAL_SECTION crit_section_; 55 | }; 56 | 57 | #define ASIO_WIN_STATIC_MUTEX_INIT { false, { 0, 0, 0, 0, 0, 0 } } 58 | 59 | } // namespace detail 60 | } // namespace asio 61 | 62 | #include "asio/detail/pop_options.hpp" 63 | 64 | #if defined(ASIO_HEADER_ONLY) 65 | # include "asio/detail/impl/win_static_mutex.ipp" 66 | #endif // defined(ASIO_HEADER_ONLY) 67 | 68 | #endif // defined(BOOST_WINDOWS) 69 | 70 | #endif // ASIO_DETAIL_WIN_STATIC_MUTEX_HPP 71 | -------------------------------------------------------------------------------- /include/asio/ip/v6_only.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ip/v6_only.hpp 3 | // ~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_IP_V6_ONLY_HPP 12 | #define ASIO_IP_V6_ONLY_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/socket_option.hpp" 20 | 21 | #include "asio/detail/push_options.hpp" 22 | 23 | namespace asio { 24 | namespace ip { 25 | 26 | /// Socket option for determining whether an IPv6 socket supports IPv6 27 | /// communication only. 28 | /** 29 | * Implements the IPPROTO_IPV6/IP_V6ONLY socket option. 30 | * 31 | * @par Examples 32 | * Setting the option: 33 | * @code 34 | * asio::ip::tcp::socket socket(io_service); 35 | * ... 36 | * asio::ip::v6_only option(true); 37 | * socket.set_option(option); 38 | * @endcode 39 | * 40 | * @par 41 | * Getting the current option value: 42 | * @code 43 | * asio::ip::tcp::socket socket(io_service); 44 | * ... 45 | * asio::ip::v6_only option; 46 | * socket.get_option(option); 47 | * bool v6_only = option.value(); 48 | * @endcode 49 | * 50 | * @par Concepts: 51 | * GettableSocketOption, SettableSocketOption. 52 | */ 53 | #if defined(GENERATING_DOCUMENTATION) 54 | typedef implementation_defined v6_only; 55 | #elif defined(IPV6_V6ONLY) 56 | typedef asio::detail::socket_option::boolean< 57 | IPPROTO_IPV6, IPV6_V6ONLY> v6_only; 58 | #else 59 | typedef asio::detail::socket_option::boolean< 60 | asio::detail::custom_socket_option_level, 61 | asio::detail::always_fail_option> v6_only; 62 | #endif 63 | 64 | } // namespace ip 65 | } // namespace asio 66 | 67 | #include "asio/detail/pop_options.hpp" 68 | 69 | #endif // ASIO_IP_V6_ONLY_HPP 70 | -------------------------------------------------------------------------------- /include/asio/detail/impl/winsock_init.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/winsock_init.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_WINSOCK_INIT_IPP 12 | #define ASIO_DETAIL_IMPL_WINSOCK_INIT_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) 21 | 22 | #include "asio/detail/socket_types.hpp" 23 | #include "asio/detail/winsock_init.hpp" 24 | #include "asio/detail/throw_error.hpp" 25 | #include "asio/error.hpp" 26 | 27 | #include "asio/detail/push_options.hpp" 28 | 29 | namespace asio { 30 | namespace detail { 31 | 32 | void winsock_init_base::startup(data& d, 33 | unsigned char major, unsigned char minor) 34 | { 35 | if (::InterlockedIncrement(&d.init_count_) == 1) 36 | { 37 | WSADATA wsa_data; 38 | long result = ::WSAStartup(MAKEWORD(major, minor), &wsa_data); 39 | ::InterlockedExchange(&d.result_, result); 40 | } 41 | } 42 | 43 | void winsock_init_base::cleanup(data& d) 44 | { 45 | if (::InterlockedDecrement(&d.init_count_) == 0) 46 | { 47 | ::WSACleanup(); 48 | } 49 | } 50 | 51 | void winsock_init_base::throw_on_error(data& d) 52 | { 53 | long result = ::InterlockedExchangeAdd(&d.result_, 0); 54 | if (result != 0) 55 | { 56 | asio::error_code ec(result, 57 | asio::error::get_system_category()); 58 | asio::detail::throw_error(ec, "winsock"); 59 | } 60 | } 61 | 62 | } // namespace detail 63 | } // namespace asio 64 | 65 | #include "asio/detail/pop_options.hpp" 66 | 67 | #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) 68 | 69 | #endif // ASIO_DETAIL_IMPL_WINSOCK_INIT_IPP 70 | -------------------------------------------------------------------------------- /include/asio/detail/win_tss_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_tss_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_TSS_PTR_HPP 12 | #define ASIO_DETAIL_WIN_TSS_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | #include "asio/detail/socket_types.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | // Helper function to create thread-specific storage. 31 | ASIO_DECL DWORD win_tss_ptr_create(); 32 | 33 | template 34 | class win_tss_ptr 35 | : private noncopyable 36 | { 37 | public: 38 | // Constructor. 39 | win_tss_ptr() 40 | : tss_key_(win_tss_ptr_create()) 41 | { 42 | } 43 | 44 | // Destructor. 45 | ~win_tss_ptr() 46 | { 47 | ::TlsFree(tss_key_); 48 | } 49 | 50 | // Get the value. 51 | operator T*() const 52 | { 53 | return static_cast(::TlsGetValue(tss_key_)); 54 | } 55 | 56 | // Set the value. 57 | void operator=(T* value) 58 | { 59 | ::TlsSetValue(tss_key_, value); 60 | } 61 | 62 | private: 63 | // Thread-specific storage to allow unlocked access to determine whether a 64 | // thread is a member of the pool. 65 | DWORD tss_key_; 66 | }; 67 | 68 | } // namespace detail 69 | } // namespace asio 70 | 71 | #include "asio/detail/pop_options.hpp" 72 | 73 | #if defined(ASIO_HEADER_ONLY) 74 | # include "asio/detail/impl/win_tss_ptr.ipp" 75 | #endif // defined(ASIO_HEADER_ONLY) 76 | 77 | #endif // defined(BOOST_WINDOWS) 78 | 79 | #endif // ASIO_DETAIL_WIN_TSS_PTR_HPP 80 | -------------------------------------------------------------------------------- /include/asio/detail/task_io_service_operation.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/task_io_service_operation.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP 12 | #define ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/error_code.hpp" 19 | #include "asio/detail/handler_tracking.hpp" 20 | #include "asio/detail/op_queue.hpp" 21 | #include "asio/detail/task_io_service_fwd.hpp" 22 | 23 | #include "asio/detail/push_options.hpp" 24 | 25 | namespace asio { 26 | namespace detail { 27 | 28 | // Base class for all operations. A function pointer is used instead of virtual 29 | // functions to avoid the associated overhead. 30 | class task_io_service_operation ASIO_INHERIT_TRACKED_HANDLER 31 | { 32 | public: 33 | void complete(task_io_service& owner) 34 | { 35 | func_(&owner, this, asio::error_code(), 0); 36 | } 37 | 38 | void destroy() 39 | { 40 | func_(0, this, asio::error_code(), 0); 41 | } 42 | 43 | protected: 44 | typedef void (*func_type)(task_io_service*, 45 | task_io_service_operation*, 46 | asio::error_code, std::size_t); 47 | 48 | task_io_service_operation(func_type func) 49 | : next_(0), 50 | func_(func) 51 | { 52 | } 53 | 54 | // Prevents deletion through this type. 55 | ~task_io_service_operation() 56 | { 57 | } 58 | 59 | private: 60 | friend class op_queue_access; 61 | task_io_service_operation* next_; 62 | func_type func_; 63 | }; 64 | 65 | } // namespace detail 66 | } // namespace asio 67 | 68 | #include "asio/detail/pop_options.hpp" 69 | 70 | #endif // ASIO_DETAIL_TASK_IO_SERVICE_OPERATION_HPP 71 | -------------------------------------------------------------------------------- /include/asio/detail/impl/posix_thread.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/posix_thread.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_POSIX_THREAD_IPP 12 | #define ASIO_DETAIL_IMPL_POSIX_THREAD_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include "asio/detail/posix_thread.hpp" 23 | #include "asio/detail/throw_error.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | posix_thread::~posix_thread() 32 | { 33 | if (!joined_) 34 | ::pthread_detach(thread_); 35 | } 36 | 37 | void posix_thread::join() 38 | { 39 | if (!joined_) 40 | { 41 | ::pthread_join(thread_, 0); 42 | joined_ = true; 43 | } 44 | } 45 | 46 | void posix_thread::start_thread(func_base* arg) 47 | { 48 | int error = ::pthread_create(&thread_, 0, 49 | asio_detail_posix_thread_function, arg); 50 | if (error != 0) 51 | { 52 | delete arg; 53 | asio::error_code ec(error, 54 | asio::error::get_system_category()); 55 | asio::detail::throw_error(ec, "thread"); 56 | } 57 | } 58 | 59 | void* asio_detail_posix_thread_function(void* arg) 60 | { 61 | posix_thread::auto_func_base_ptr func = { 62 | static_cast(arg) }; 63 | func.ptr->run(); 64 | return 0; 65 | } 66 | 67 | } // namespace detail 68 | } // namespace asio 69 | 70 | #include "asio/detail/pop_options.hpp" 71 | 72 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 73 | 74 | #endif // ASIO_DETAIL_IMPL_POSIX_THREAD_IPP 75 | -------------------------------------------------------------------------------- /example/basic-1.cpp: -------------------------------------------------------------------------------- 1 | #include "binlog_api.h" 2 | 3 | /** 4 | @file basic-1 5 | @author Mats Kindahl 6 | 7 | modified by ideal 8 | 9 | This is a basic example that just opens a binary log either from a 10 | file or a server and print out what events are found. It uses a 11 | simple event loop and checks information in the events using a 12 | switch. 13 | */ 14 | 15 | // Actually namespace mysql has been using in many headers like rowset.h 16 | // and rowset.h is included by binlog_api.h 。。。。 17 | //using mysql::Binary_log; 18 | using mysql::system::create_transport; 19 | 20 | int main(int argc, char** argv) { 21 | 22 | if (argc != 2) { 23 | std::cerr << "Usage: basic-1 " << std::endl; 24 | exit(2); 25 | } 26 | 27 | Binary_log binlog(create_transport(argv[1])); 28 | binlog.connect(); 29 | 30 | Converter converter; 31 | 32 | Binary_log_event *event; 33 | Table_map_event *tmev; 34 | 35 | while (true) { 36 | int result = binlog.wait_for_next_event(&event); 37 | if (result == ERR_EOF) 38 | break; 39 | std::cout << "Found event of type " 40 | << event->get_event_type(); 41 | int event_type = event->get_event_type(); 42 | if (event_type == mysql::TABLE_MAP_EVENT) { 43 | tmev = (mysql::Table_map_event *)event; 44 | } 45 | if (event_type == mysql::WRITE_ROWS_EVENT) { 46 | mysql::Row_event *row_event = (mysql::Row_event *)event; 47 | mysql::Row_event_set rows(row_event, tmev); 48 | mysql::Row_event_set::iterator itor = rows.begin(); 49 | do { 50 | mysql::Row_of_fields fields = *itor; 51 | mysql::Row_of_fields::iterator it = fields.begin(); 52 | do { 53 | std::string out; 54 | converter.to(out, *it); 55 | std::cout << "\t" << out; 56 | } while(++it != fields.end()); 57 | } while (++itor != rows.end()); 58 | } 59 | std::cout << std::endl; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /include/asio/detail/pop_options.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/pop_options.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | // No header guard 12 | 13 | #if defined(__COMO__) 14 | 15 | // Comeau C++ 16 | 17 | #elif defined(__DMC__) 18 | 19 | // Digital Mars C++ 20 | 21 | #elif defined(__INTEL_COMPILER) || defined(__ICL) \ 22 | || defined(__ICC) || defined(__ECC) 23 | 24 | // Intel C++ 25 | 26 | #elif defined(__GNUC__) 27 | 28 | // GNU C++ 29 | 30 | # if defined(__MINGW32__) || defined(__CYGWIN__) 31 | # pragma pack (pop) 32 | # endif 33 | 34 | # if defined(__OBJC__) 35 | # if !defined(__APPLE_CC__) || (__APPLE_CC__ <= 1) 36 | # if defined(ASIO_OBJC_WORKAROUND) 37 | # undef Protocol 38 | # undef id 39 | # undef ASIO_OBJC_WORKAROUND 40 | # endif 41 | # endif 42 | # endif 43 | 44 | #elif defined(__KCC) 45 | 46 | // Kai C++ 47 | 48 | #elif defined(__sgi) 49 | 50 | // SGI MIPSpro C++ 51 | 52 | #elif defined(__DECCXX) 53 | 54 | // Compaq Tru64 Unix cxx 55 | 56 | #elif defined(__ghs) 57 | 58 | // Greenhills C++ 59 | 60 | #elif defined(__BORLANDC__) 61 | 62 | // Borland C++ 63 | 64 | # pragma option pop 65 | # pragma nopushoptwarn 66 | # pragma nopackwarning 67 | 68 | #elif defined(__MWERKS__) 69 | 70 | // Metrowerks CodeWarrior 71 | 72 | #elif defined(__SUNPRO_CC) 73 | 74 | // Sun Workshop Compiler C++ 75 | 76 | #elif defined(__HP_aCC) 77 | 78 | // HP aCC 79 | 80 | #elif defined(__MRC__) || defined(__SC__) 81 | 82 | // MPW MrCpp or SCpp 83 | 84 | #elif defined(__IBMCPP__) 85 | 86 | // IBM Visual Age 87 | 88 | #elif defined(_MSC_VER) 89 | 90 | // Microsoft Visual C++ 91 | // 92 | // Must remain the last #elif since some other vendors (Metrowerks, for example) 93 | // also #define _MSC_VER 94 | 95 | # pragma warning (pop) 96 | # pragma pack (pop) 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/write_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/write_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_WRITE_OP_HPP 12 | #define ASIO_SSL_DETAIL_WRITE_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/detail/buffer_sequence_adapter.hpp" 22 | # include "asio/ssl/detail/engine.hpp" 23 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace ssl { 29 | namespace detail { 30 | 31 | #if !defined(ASIO_ENABLE_OLD_SSL) 32 | 33 | template 34 | class write_op 35 | { 36 | public: 37 | write_op(const ConstBufferSequence& buffers) 38 | : buffers_(buffers) 39 | { 40 | } 41 | 42 | engine::want operator()(engine& eng, 43 | asio::error_code& ec, 44 | std::size_t& bytes_transferred) const 45 | { 46 | asio::const_buffer buffer = 47 | asio::detail::buffer_sequence_adapter::first(buffers_); 49 | 50 | return eng.write(buffer, ec, bytes_transferred); 51 | } 52 | 53 | template 54 | void call_handler(Handler& handler, 55 | const asio::error_code& ec, 56 | const std::size_t& bytes_transferred) const 57 | { 58 | handler(ec, bytes_transferred); 59 | } 60 | 61 | private: 62 | ConstBufferSequence buffers_; 63 | }; 64 | 65 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 66 | 67 | } // namespace detail 68 | } // namespace ssl 69 | } // namespace asio 70 | 71 | #include "asio/detail/pop_options.hpp" 72 | 73 | #endif // ASIO_SSL_DETAIL_WRITE_OP_HPP 74 | -------------------------------------------------------------------------------- /include/asio/ssl/detail/read_op.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/detail/read_op.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_DETAIL_READ_OP_HPP 12 | #define ASIO_SSL_DETAIL_READ_OP_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/detail/buffer_sequence_adapter.hpp" 22 | # include "asio/ssl/detail/engine.hpp" 23 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace ssl { 29 | namespace detail { 30 | 31 | #if !defined(ASIO_ENABLE_OLD_SSL) 32 | 33 | template 34 | class read_op 35 | { 36 | public: 37 | read_op(const MutableBufferSequence& buffers) 38 | : buffers_(buffers) 39 | { 40 | } 41 | 42 | engine::want operator()(engine& eng, 43 | asio::error_code& ec, 44 | std::size_t& bytes_transferred) const 45 | { 46 | asio::mutable_buffer buffer = 47 | asio::detail::buffer_sequence_adapter::first(buffers_); 49 | 50 | return eng.read(buffer, ec, bytes_transferred); 51 | } 52 | 53 | template 54 | void call_handler(Handler& handler, 55 | const asio::error_code& ec, 56 | const std::size_t& bytes_transferred) const 57 | { 58 | handler(ec, bytes_transferred); 59 | } 60 | 61 | private: 62 | MutableBufferSequence buffers_; 63 | }; 64 | 65 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 66 | 67 | } // namespace detail 68 | } // namespace ssl 69 | } // namespace asio 70 | 71 | #include "asio/detail/pop_options.hpp" 72 | 73 | #endif // ASIO_SSL_DETAIL_READ_OP_HPP 74 | -------------------------------------------------------------------------------- /include/asio/detail/win_mutex.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_mutex.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_MUTEX_HPP 12 | #define ASIO_DETAIL_WIN_MUTEX_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include "asio/detail/noncopyable.hpp" 23 | #include "asio/detail/scoped_lock.hpp" 24 | #include "asio/detail/socket_types.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | class win_mutex 32 | : private noncopyable 33 | { 34 | public: 35 | typedef asio::detail::scoped_lock scoped_lock; 36 | 37 | // Constructor. 38 | ASIO_DECL win_mutex(); 39 | 40 | // Destructor. 41 | ~win_mutex() 42 | { 43 | ::DeleteCriticalSection(&crit_section_); 44 | } 45 | 46 | // Lock the mutex. 47 | void lock() 48 | { 49 | ::EnterCriticalSection(&crit_section_); 50 | } 51 | 52 | // Unlock the mutex. 53 | void unlock() 54 | { 55 | ::LeaveCriticalSection(&crit_section_); 56 | } 57 | 58 | private: 59 | // Initialisation must be performed in a separate function to the constructor 60 | // since the compiler does not support the use of structured exceptions and 61 | // C++ exceptions in the same function. 62 | ASIO_DECL int do_init(); 63 | 64 | ::CRITICAL_SECTION crit_section_; 65 | }; 66 | 67 | } // namespace detail 68 | } // namespace asio 69 | 70 | #include "asio/detail/pop_options.hpp" 71 | 72 | #if defined(ASIO_HEADER_ONLY) 73 | # include "asio/detail/impl/win_mutex.ipp" 74 | #endif // defined(ASIO_HEADER_ONLY) 75 | 76 | #endif // defined(BOOST_WINDOWS) 77 | 78 | #endif // ASIO_DETAIL_WIN_MUTEX_HPP 79 | -------------------------------------------------------------------------------- /include/asio/detail/scoped_lock.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/scoped_lock.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_SCOPED_LOCK_HPP 12 | #define ASIO_DETAIL_SCOPED_LOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/noncopyable.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | // Helper class to lock and unlock a mutex automatically. 26 | template 27 | class scoped_lock 28 | : private noncopyable 29 | { 30 | public: 31 | // Constructor acquires the lock. 32 | scoped_lock(Mutex& m) 33 | : mutex_(m) 34 | { 35 | mutex_.lock(); 36 | locked_ = true; 37 | } 38 | 39 | // Destructor releases the lock. 40 | ~scoped_lock() 41 | { 42 | if (locked_) 43 | mutex_.unlock(); 44 | } 45 | 46 | // Explicitly acquire the lock. 47 | void lock() 48 | { 49 | if (!locked_) 50 | { 51 | mutex_.lock(); 52 | locked_ = true; 53 | } 54 | } 55 | 56 | // Explicitly release the lock. 57 | void unlock() 58 | { 59 | if (locked_) 60 | { 61 | mutex_.unlock(); 62 | locked_ = false; 63 | } 64 | } 65 | 66 | // Test whether the lock is held. 67 | bool locked() const 68 | { 69 | return locked_; 70 | } 71 | 72 | // Get the underlying mutex. 73 | Mutex& mutex() 74 | { 75 | return mutex_; 76 | } 77 | 78 | private: 79 | // The underlying mutex. 80 | Mutex& mutex_; 81 | 82 | // Whether the mutex is currently locked or unlocked. 83 | bool locked_; 84 | }; 85 | 86 | } // namespace detail 87 | } // namespace asio 88 | 89 | #include "asio/detail/pop_options.hpp" 90 | 91 | #endif // ASIO_DETAIL_SCOPED_LOCK_HPP 92 | -------------------------------------------------------------------------------- /include/asio/detail/posix_tss_ptr.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/posix_tss_ptr.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_POSIX_TSS_PTR_HPP 12 | #define ASIO_DETAIL_POSIX_TSS_PTR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include 23 | #include "asio/detail/noncopyable.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | // Helper function to create thread-specific storage. 31 | ASIO_DECL void posix_tss_ptr_create(pthread_key_t& key); 32 | 33 | template 34 | class posix_tss_ptr 35 | : private noncopyable 36 | { 37 | public: 38 | // Constructor. 39 | posix_tss_ptr() 40 | { 41 | posix_tss_ptr_create(tss_key_); 42 | } 43 | 44 | // Destructor. 45 | ~posix_tss_ptr() 46 | { 47 | ::pthread_key_delete(tss_key_); 48 | } 49 | 50 | // Get the value. 51 | operator T*() const 52 | { 53 | return static_cast(::pthread_getspecific(tss_key_)); 54 | } 55 | 56 | // Set the value. 57 | void operator=(T* value) 58 | { 59 | ::pthread_setspecific(tss_key_, value); 60 | } 61 | 62 | private: 63 | // Thread-specific storage to allow unlocked access to determine whether a 64 | // thread is a member of the pool. 65 | pthread_key_t tss_key_; 66 | 67 | }; 68 | 69 | } // namespace detail 70 | } // namespace asio 71 | 72 | #include "asio/detail/pop_options.hpp" 73 | 74 | #if defined(ASIO_HEADER_ONLY) 75 | # include "asio/detail/impl/posix_tss_ptr.ipp" 76 | #endif // defined(ASIO_HEADER_ONLY) 77 | 78 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 79 | 80 | #endif // ASIO_DETAIL_POSIX_TSS_PTR_HPP 81 | -------------------------------------------------------------------------------- /include/asio/detail/impl/service_registry.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/service_registry.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_SERVICE_REGISTRY_HPP 12 | #define ASIO_DETAIL_IMPL_SERVICE_REGISTRY_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/push_options.hpp" 19 | 20 | namespace asio { 21 | namespace detail { 22 | 23 | template 24 | Service& service_registry::use_service() 25 | { 26 | asio::io_service::service::key key; 27 | init_key(key, Service::id); 28 | factory_type factory = &service_registry::create; 29 | return *static_cast(do_use_service(key, factory)); 30 | } 31 | 32 | template 33 | void service_registry::add_service(Service* new_service) 34 | { 35 | asio::io_service::service::key key; 36 | init_key(key, Service::id); 37 | return do_add_service(key, new_service); 38 | } 39 | 40 | template 41 | bool service_registry::has_service() const 42 | { 43 | asio::io_service::service::key key; 44 | init_key(key, Service::id); 45 | return do_has_service(key); 46 | } 47 | 48 | #if !defined(ASIO_NO_TYPEID) 49 | template 50 | void service_registry::init_key(asio::io_service::service::key& key, 51 | const asio::detail::service_id& /*id*/) 52 | { 53 | key.type_info_ = &typeid(typeid_wrapper); 54 | key.id_ = 0; 55 | } 56 | #endif // !defined(ASIO_NO_TYPEID) 57 | 58 | template 59 | asio::io_service::service* service_registry::create( 60 | asio::io_service& owner) 61 | { 62 | return new Service(owner); 63 | } 64 | 65 | } // namespace detail 66 | } // namespace asio 67 | 68 | #include "asio/detail/pop_options.hpp" 69 | 70 | #endif // ASIO_DETAIL_IMPL_SERVICE_REGISTRY_HPP 71 | -------------------------------------------------------------------------------- /include/asio/ssl/verify_context.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/verify_context.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_SSL_VERIFY_CONTEXT_HPP 12 | #define ASIO_SSL_VERIFY_CONTEXT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(ASIO_ENABLE_OLD_SSL) 21 | # include "asio/detail/noncopyable.hpp" 22 | # include "asio/ssl/detail/openssl_types.hpp" 23 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace ssl { 29 | 30 | #if !defined(ASIO_ENABLE_OLD_SSL) 31 | 32 | /// A simple wrapper around the X509_STORE_CTX type, used during verification of 33 | /// a peer certificate. 34 | /** 35 | * @note The verify_context does not own the underlying X509_STORE_CTX object. 36 | */ 37 | class verify_context 38 | : private noncopyable 39 | { 40 | public: 41 | /// The native handle type of the verification context. 42 | typedef X509_STORE_CTX* native_handle_type; 43 | 44 | /// Constructor. 45 | explicit verify_context(native_handle_type handle) 46 | : handle_(handle) 47 | { 48 | } 49 | 50 | /// Get the underlying implementation in the native type. 51 | /** 52 | * This function may be used to obtain the underlying implementation of the 53 | * context. This is intended to allow access to context functionality that is 54 | * not otherwise provided. 55 | */ 56 | native_handle_type native_handle() 57 | { 58 | return handle_; 59 | } 60 | 61 | private: 62 | // The underlying native implementation. 63 | native_handle_type handle_; 64 | }; 65 | 66 | #endif // defined(ASIO_ENABLE_OLD_SSL) 67 | 68 | } // namespace ssl 69 | } // namespace asio 70 | 71 | #include "asio/detail/pop_options.hpp" 72 | 73 | #endif // ASIO_SSL_VERIFY_CONTEXT_HPP 74 | -------------------------------------------------------------------------------- /include/asio/detail/posix_fd_set_adapter.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/posix_fd_set_adapter.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP 12 | #define ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) 21 | 22 | #include 23 | #include "asio/detail/socket_types.hpp" 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace detail { 29 | 30 | // Adapts the FD_SET type to meet the Descriptor_Set concept's requirements. 31 | class posix_fd_set_adapter 32 | { 33 | public: 34 | posix_fd_set_adapter() 35 | : max_descriptor_(invalid_socket) 36 | { 37 | using namespace std; // Needed for memset on Solaris. 38 | FD_ZERO(&fd_set_); 39 | } 40 | 41 | bool set(socket_type descriptor) 42 | { 43 | if (descriptor < (socket_type)FD_SETSIZE) 44 | { 45 | if (max_descriptor_ == invalid_socket || descriptor > max_descriptor_) 46 | max_descriptor_ = descriptor; 47 | FD_SET(descriptor, &fd_set_); 48 | return true; 49 | } 50 | return false; 51 | } 52 | 53 | bool is_set(socket_type descriptor) const 54 | { 55 | return FD_ISSET(descriptor, &fd_set_) != 0; 56 | } 57 | 58 | operator fd_set*() 59 | { 60 | return &fd_set_; 61 | } 62 | 63 | socket_type max_descriptor() const 64 | { 65 | return max_descriptor_; 66 | } 67 | 68 | private: 69 | mutable fd_set fd_set_; 70 | socket_type max_descriptor_; 71 | }; 72 | 73 | } // namespace detail 74 | } // namespace asio 75 | 76 | #include "asio/detail/pop_options.hpp" 77 | 78 | #endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) 79 | 80 | #endif // ASIO_DETAIL_POSIX_FD_SET_ADAPTER_HPP 81 | -------------------------------------------------------------------------------- /include/asio/detail/win_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_WIN_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) && !defined(UNDER_CE) 21 | 22 | #include "asio/detail/socket_types.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | class win_fenced_block 30 | : private noncopyable 31 | { 32 | public: 33 | // Constructor. 34 | win_fenced_block() 35 | { 36 | #if defined(__BORLANDC__) 37 | LONG barrier = 0; 38 | ::InterlockedExchange(&barrier, 1); 39 | #elif defined(BOOST_MSVC) && ((BOOST_MSVC < 1400) || !defined(MemoryBarrier)) 40 | # if defined(_M_IX86) 41 | # pragma warning(push) 42 | # pragma warning(disable:4793) 43 | LONG barrier; 44 | __asm { xchg barrier, eax } 45 | # pragma warning(pop) 46 | # endif // defined(_M_IX86) 47 | #else 48 | MemoryBarrier(); 49 | #endif 50 | } 51 | 52 | // Destructor. 53 | ~win_fenced_block() 54 | { 55 | #if defined(__BORLANDC__) 56 | LONG barrier = 0; 57 | ::InterlockedExchange(&barrier, 1); 58 | #elif defined(BOOST_MSVC) && ((BOOST_MSVC < 1400) || !defined(MemoryBarrier)) 59 | # if defined(_M_IX86) 60 | # pragma warning(push) 61 | # pragma warning(disable:4793) 62 | LONG barrier; 63 | __asm { xchg barrier, eax } 64 | # pragma warning(pop) 65 | # endif // defined(_M_IX86) 66 | #else 67 | MemoryBarrier(); 68 | #endif 69 | } 70 | }; 71 | 72 | } // namespace detail 73 | } // namespace asio 74 | 75 | #include "asio/detail/pop_options.hpp" 76 | 77 | #endif // defined(BOOST_WINDOWS) && !defined(UNDER_CE) 78 | 79 | #endif // ASIO_DETAIL_WIN_FENCED_BLOCK_HPP 80 | -------------------------------------------------------------------------------- /include/file_driver.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights 3 | reserved. 4 | 5 | This program is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU General Public License 7 | as published by the Free Software Foundation; version 2 of 8 | the License. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this program; if not, write to the Free Software 17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 18 | 02110-1301 USA 19 | */ 20 | 21 | #ifndef _FILE_DRIVER_H 22 | #define _FILE_DRIVER_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "binlog_api.h" 31 | #include "binlog_driver.h" 32 | #include "protocol.h" 33 | 34 | #define MAGIC_NUMBER_SIZE 4 35 | 36 | namespace mysql { 37 | namespace system { 38 | 39 | class Binlog_file_driver 40 | : public Binary_log_driver 41 | { 42 | public: 43 | template 44 | Binlog_file_driver(const TFilename& filename = TFilename(), 45 | unsigned int offset = 0) 46 | : Binary_log_driver(filename, offset) 47 | { 48 | } 49 | 50 | int connect(); 51 | int disconnect(); 52 | int wait_for_next_event(mysql::Binary_log_event **event); 53 | int set_position(const std::string &str, unsigned long position); 54 | int get_position(std::string *str, unsigned long *position); 55 | 56 | private: 57 | 58 | unsigned long m_binlog_file_size; 59 | 60 | /* 61 | Bytes that has been read so for from the file. 62 | Updated after every event is read. 63 | */ 64 | unsigned long m_bytes_read; 65 | 66 | std::ifstream m_binlog_file; 67 | 68 | Log_event_header m_event_log_header; 69 | }; 70 | 71 | } // namespace mysql::system 72 | } // namespace mysql 73 | 74 | #endif /* _FILE_DRIVER_H */ 75 | -------------------------------------------------------------------------------- /include/asio/detail/impl/win_mutex.ipp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/win_mutex.ipp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_WIN_MUTEX_IPP 12 | #define ASIO_DETAIL_IMPL_WIN_MUTEX_IPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include "asio/detail/throw_error.hpp" 23 | #include "asio/detail/win_mutex.hpp" 24 | #include "asio/error.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | win_mutex::win_mutex() 32 | { 33 | int error = do_init(); 34 | asio::error_code ec(error, 35 | asio::error::get_system_category()); 36 | asio::detail::throw_error(ec, "mutex"); 37 | } 38 | 39 | int win_mutex::do_init() 40 | { 41 | #if defined(__MINGW32__) 42 | // Not sure if MinGW supports structured exception handling, so for now 43 | // we'll just call the Windows API and hope. 44 | # if defined(UNDER_CE) 45 | ::InitializeCriticalSection(&crit_section_); 46 | # else 47 | if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) 48 | return ::GetLastError(); 49 | # endif 50 | return 0; 51 | #else 52 | __try 53 | { 54 | # if defined(UNDER_CE) 55 | ::InitializeCriticalSection(&crit_section_); 56 | # else 57 | if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) 58 | return ::GetLastError(); 59 | # endif 60 | } 61 | __except(GetExceptionCode() == STATUS_NO_MEMORY 62 | ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) 63 | { 64 | return ERROR_OUTOFMEMORY; 65 | } 66 | 67 | return 0; 68 | #endif 69 | } 70 | 71 | } // namespace detail 72 | } // namespace asio 73 | 74 | #include "asio/detail/pop_options.hpp" 75 | 76 | #endif // defined(BOOST_WINDOWS) 77 | 78 | #endif // ASIO_DETAIL_IMPL_WIN_MUTEX_IPP 79 | -------------------------------------------------------------------------------- /include/asio/ssl/impl/context.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // ssl/impl/context.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com 6 | // Copyright (c) 2005-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_SSL_IMPL_CONTEXT_HPP 13 | #define ASIO_SSL_IMPL_CONTEXT_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/config.hpp" 20 | 21 | #if !defined(ASIO_ENABLE_OLD_SSL) 22 | # include "asio/detail/throw_error.hpp" 23 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 24 | 25 | #include "asio/detail/push_options.hpp" 26 | 27 | namespace asio { 28 | namespace ssl { 29 | 30 | #if !defined(ASIO_ENABLE_OLD_SSL) 31 | 32 | template 33 | void context::set_verify_callback(VerifyCallback callback) 34 | { 35 | asio::error_code ec; 36 | this->set_verify_callback(callback, ec); 37 | asio::detail::throw_error(ec, "set_verify_callback"); 38 | } 39 | 40 | template 41 | asio::error_code context::set_verify_callback( 42 | VerifyCallback callback, asio::error_code& ec) 43 | { 44 | return do_set_verify_callback( 45 | new detail::verify_callback(callback), ec); 46 | } 47 | 48 | template 49 | void context::set_password_callback(PasswordCallback callback) 50 | { 51 | asio::error_code ec; 52 | this->set_password_callback(callback, ec); 53 | asio::detail::throw_error(ec, "set_password_callback"); 54 | } 55 | 56 | template 57 | asio::error_code context::set_password_callback( 58 | PasswordCallback callback, asio::error_code& ec) 59 | { 60 | return do_set_password_callback( 61 | new detail::password_callback(callback), ec); 62 | } 63 | 64 | #endif // !defined(ASIO_ENABLE_OLD_SSL) 65 | 66 | } // namespace ssl 67 | } // namespace asio 68 | 69 | #include "asio/detail/pop_options.hpp" 70 | 71 | #endif // ASIO_SSL_IMPL_CONTEXT_HPP 72 | -------------------------------------------------------------------------------- /include/asio/local/datagram_protocol.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // local/datagram_protocol.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP 12 | #define ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_LOCAL_SOCKETS) \ 21 | || defined(GENERATING_DOCUMENTATION) 22 | 23 | #include "asio/basic_datagram_socket.hpp" 24 | #include "asio/detail/socket_types.hpp" 25 | #include "asio/local/basic_endpoint.hpp" 26 | 27 | #include "asio/detail/push_options.hpp" 28 | 29 | namespace asio { 30 | namespace local { 31 | 32 | /// Encapsulates the flags needed for datagram-oriented UNIX sockets. 33 | /** 34 | * The asio::local::datagram_protocol class contains flags necessary for 35 | * datagram-oriented UNIX domain sockets. 36 | * 37 | * @par Thread Safety 38 | * @e Distinct @e objects: Safe.@n 39 | * @e Shared @e objects: Safe. 40 | * 41 | * @par Concepts: 42 | * Protocol. 43 | */ 44 | class datagram_protocol 45 | { 46 | public: 47 | /// Obtain an identifier for the type of the protocol. 48 | int type() const 49 | { 50 | return SOCK_DGRAM; 51 | } 52 | 53 | /// Obtain an identifier for the protocol. 54 | int protocol() const 55 | { 56 | return 0; 57 | } 58 | 59 | /// Obtain an identifier for the protocol family. 60 | int family() const 61 | { 62 | return AF_UNIX; 63 | } 64 | 65 | /// The type of a UNIX domain endpoint. 66 | typedef basic_endpoint endpoint; 67 | 68 | /// The UNIX domain socket type. 69 | typedef basic_datagram_socket socket; 70 | }; 71 | 72 | } // namespace local 73 | } // namespace asio 74 | 75 | #include "asio/detail/pop_options.hpp" 76 | 77 | #endif // defined(ASIO_HAS_LOCAL_SOCKETS) 78 | // || defined(GENERATING_DOCUMENTATION) 79 | 80 | #endif // ASIO_LOCAL_DATAGRAM_PROTOCOL_HPP 81 | -------------------------------------------------------------------------------- /include/asio/detail/impl/epoll_reactor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/epoll_reactor.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_EPOLL_REACTOR_HPP 12 | #define ASIO_DETAIL_IMPL_EPOLL_REACTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #if defined(ASIO_HAS_EPOLL) 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | namespace detail { 24 | 25 | template 26 | void epoll_reactor::add_timer_queue(timer_queue& queue) 27 | { 28 | do_add_timer_queue(queue); 29 | } 30 | 31 | template 32 | void epoll_reactor::remove_timer_queue(timer_queue& queue) 33 | { 34 | do_remove_timer_queue(queue); 35 | } 36 | 37 | template 38 | void epoll_reactor::schedule_timer(timer_queue& queue, 39 | const typename Time_Traits::time_type& time, 40 | typename timer_queue::per_timer_data& timer, timer_op* op) 41 | { 42 | mutex::scoped_lock lock(mutex_); 43 | 44 | if (shutdown_) 45 | { 46 | io_service_.post_immediate_completion(op); 47 | return; 48 | } 49 | 50 | bool earliest = queue.enqueue_timer(time, timer, op); 51 | io_service_.work_started(); 52 | if (earliest) 53 | update_timeout(); 54 | } 55 | 56 | template 57 | std::size_t epoll_reactor::cancel_timer(timer_queue& queue, 58 | typename timer_queue::per_timer_data& timer, 59 | std::size_t max_cancelled) 60 | { 61 | mutex::scoped_lock lock(mutex_); 62 | op_queue ops; 63 | std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); 64 | lock.unlock(); 65 | io_service_.post_deferred_completions(ops); 66 | return n; 67 | } 68 | 69 | } // namespace detail 70 | } // namespace asio 71 | 72 | #include "asio/detail/pop_options.hpp" 73 | 74 | #endif // defined(ASIO_HAS_EPOLL) 75 | 76 | #endif // ASIO_DETAIL_IMPL_EPOLL_REACTOR_HPP 77 | -------------------------------------------------------------------------------- /include/asio/detail/gcc_arm_fenced_block.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/gcc_arm_fenced_block.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_GCC_ARM_FENCED_BLOCK_HPP 12 | #define ASIO_DETAIL_GCC_ARM_FENCED_BLOCK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(__GNUC__) && defined(__arm__) 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | class gcc_arm_fenced_block 28 | : private noncopyable 29 | { 30 | public: 31 | // Constructor. 32 | gcc_arm_fenced_block() 33 | { 34 | barrier(); 35 | } 36 | 37 | // Destructor. 38 | ~gcc_arm_fenced_block() 39 | { 40 | barrier(); 41 | } 42 | 43 | private: 44 | static void barrier() 45 | { 46 | #if defined(__ARM_ARCH_4__) \ 47 | || defined(__ARM_ARCH_4T__) \ 48 | || defined(__ARM_ARCH_5__) \ 49 | || defined(__ARM_ARCH_5E__) \ 50 | || defined(__ARM_ARCH_5T__) \ 51 | || defined(__ARM_ARCH_5TE__) \ 52 | || defined(__ARM_ARCH_5TEJ__) \ 53 | || defined(__ARM_ARCH_6__) \ 54 | || defined(__ARM_ARCH_6J__) \ 55 | || defined(__ARM_ARCH_6K__) \ 56 | || defined(__ARM_ARCH_6Z__) \ 57 | || defined(__ARM_ARCH_6ZK__) \ 58 | || defined(__ARM_ARCH_6T2__) 59 | # if defined(__thumb__) 60 | // This is just a placeholder and almost certainly not sufficient. 61 | __asm__ __volatile__ ("" : : : "memory"); 62 | # else // defined(__thumb__) 63 | int a = 0, b = 0; 64 | __asm__ __volatile__ ("swp %0, %1, [%2]" 65 | : "=&r"(a) : "r"(1), "r"(&b) : "memory", "cc"); 66 | # endif // defined(__thumb__) 67 | #else 68 | // ARMv7 and later. 69 | __asm__ __volatile__ ("dmb" : : : "memory"); 70 | #endif 71 | } 72 | }; 73 | 74 | } // namespace detail 75 | } // namespace asio 76 | 77 | #include "asio/detail/pop_options.hpp" 78 | 79 | #endif // defined(__GNUC__) && defined(__arm__) 80 | 81 | #endif // ASIO_DETAIL_GCC_ARM_FENCED_BLOCK_HPP 82 | -------------------------------------------------------------------------------- /include/asio/detail/win_event.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_event.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_EVENT_HPP 12 | #define ASIO_DETAIL_WIN_EVENT_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_WINDOWS) 21 | 22 | #include 23 | #include "asio/detail/noncopyable.hpp" 24 | #include "asio/detail/socket_types.hpp" 25 | 26 | #include "asio/detail/push_options.hpp" 27 | 28 | namespace asio { 29 | namespace detail { 30 | 31 | class win_event 32 | : private noncopyable 33 | { 34 | public: 35 | // Constructor. 36 | ASIO_DECL win_event(); 37 | 38 | // Destructor. 39 | ~win_event() 40 | { 41 | ::CloseHandle(event_); 42 | } 43 | 44 | // Signal the event. 45 | template 46 | void signal(Lock& lock) 47 | { 48 | BOOST_ASSERT(lock.locked()); 49 | (void)lock; 50 | ::SetEvent(event_); 51 | } 52 | 53 | // Signal the event and unlock the mutex. 54 | template 55 | void signal_and_unlock(Lock& lock) 56 | { 57 | BOOST_ASSERT(lock.locked()); 58 | lock.unlock(); 59 | ::SetEvent(event_); 60 | } 61 | 62 | // Reset the event. 63 | template 64 | void clear(Lock& lock) 65 | { 66 | BOOST_ASSERT(lock.locked()); 67 | (void)lock; 68 | ::ResetEvent(event_); 69 | } 70 | 71 | // Wait for the event to become signalled. 72 | template 73 | void wait(Lock& lock) 74 | { 75 | BOOST_ASSERT(lock.locked()); 76 | lock.unlock(); 77 | ::WaitForSingleObject(event_, INFINITE); 78 | lock.lock(); 79 | } 80 | 81 | private: 82 | HANDLE event_; 83 | }; 84 | 85 | } // namespace detail 86 | } // namespace asio 87 | 88 | #include "asio/detail/pop_options.hpp" 89 | 90 | #if defined(ASIO_HEADER_ONLY) 91 | # include "asio/detail/impl/win_event.ipp" 92 | #endif // defined(ASIO_HEADER_ONLY) 93 | 94 | #endif // defined(BOOST_WINDOWS) 95 | 96 | #endif // ASIO_DETAIL_WIN_EVENT_HPP 97 | -------------------------------------------------------------------------------- /include/asio/detail/posix_signal_blocker.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/posix_signal_blocker.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_POSIX_SIGNAL_BLOCKER_HPP 12 | #define ASIO_DETAIL_POSIX_SIGNAL_BLOCKER_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 21 | 22 | #include 23 | #include 24 | #include 25 | #include "asio/detail/noncopyable.hpp" 26 | 27 | #include "asio/detail/push_options.hpp" 28 | 29 | namespace asio { 30 | namespace detail { 31 | 32 | class posix_signal_blocker 33 | : private noncopyable 34 | { 35 | public: 36 | // Constructor blocks all signals for the calling thread. 37 | posix_signal_blocker() 38 | : blocked_(false) 39 | { 40 | sigset_t new_mask; 41 | sigfillset(&new_mask); 42 | blocked_ = (pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask_) == 0); 43 | } 44 | 45 | // Destructor restores the previous signal mask. 46 | ~posix_signal_blocker() 47 | { 48 | if (blocked_) 49 | pthread_sigmask(SIG_SETMASK, &old_mask_, 0); 50 | } 51 | 52 | // Block all signals for the calling thread. 53 | void block() 54 | { 55 | if (!blocked_) 56 | { 57 | sigset_t new_mask; 58 | sigfillset(&new_mask); 59 | blocked_ = (pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask_) == 0); 60 | } 61 | } 62 | 63 | // Restore the previous signal mask. 64 | void unblock() 65 | { 66 | if (blocked_) 67 | blocked_ = (pthread_sigmask(SIG_SETMASK, &old_mask_, 0) != 0); 68 | } 69 | 70 | private: 71 | // Have signals been blocked. 72 | bool blocked_; 73 | 74 | // The previous signal mask. 75 | sigset_t old_mask_; 76 | }; 77 | 78 | } // namespace detail 79 | } // namespace asio 80 | 81 | #include "asio/detail/pop_options.hpp" 82 | 83 | #endif // defined(BOOST_HAS_PTHREADS) && !defined(ASIO_DISABLE_THREADS) 84 | 85 | #endif // ASIO_DETAIL_POSIX_SIGNAL_BLOCKER_HPP 86 | -------------------------------------------------------------------------------- /include/asio/detail/impl/task_io_service.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/task_io_service.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_TASK_IO_SERVICE_HPP 12 | #define ASIO_DETAIL_IMPL_TASK_IO_SERVICE_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/call_stack.hpp" 19 | #include "asio/detail/completion_handler.hpp" 20 | #include "asio/detail/fenced_block.hpp" 21 | #include "asio/detail/handler_alloc_helpers.hpp" 22 | #include "asio/detail/handler_invoke_helpers.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | namespace detail { 28 | 29 | template 30 | void task_io_service::dispatch(Handler& handler) 31 | { 32 | if (call_stack::contains(this)) 33 | { 34 | asio::detail::fenced_block b; 35 | asio_handler_invoke_helpers::invoke(handler, handler); 36 | } 37 | else 38 | { 39 | // Allocate and construct an operation to wrap the handler. 40 | typedef completion_handler op; 41 | typename op::ptr p = { boost::addressof(handler), 42 | asio_handler_alloc_helpers::allocate( 43 | sizeof(op), handler), 0 }; 44 | p.p = new (p.v) op(handler); 45 | 46 | ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); 47 | 48 | post_immediate_completion(p.p); 49 | p.v = p.p = 0; 50 | } 51 | } 52 | 53 | template 54 | void task_io_service::post(Handler& handler) 55 | { 56 | // Allocate and construct an operation to wrap the handler. 57 | typedef completion_handler op; 58 | typename op::ptr p = { boost::addressof(handler), 59 | asio_handler_alloc_helpers::allocate( 60 | sizeof(op), handler), 0 }; 61 | p.p = new (p.v) op(handler); 62 | 63 | ASIO_HANDLER_CREATION((p.p, "io_service", this, "post")); 64 | 65 | post_immediate_completion(p.p); 66 | p.v = p.p = 0; 67 | } 68 | 69 | } // namespace detail 70 | } // namespace asio 71 | 72 | #include "asio/detail/pop_options.hpp" 73 | 74 | #endif // ASIO_DETAIL_IMPL_TASK_IO_SERVICE_HPP 75 | -------------------------------------------------------------------------------- /include/asio/detail/impl/dev_poll_reactor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/dev_poll_reactor.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_IMPL_DEV_POLL_REACTOR_HPP 12 | #define ASIO_DETAIL_IMPL_DEV_POLL_REACTOR_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_DEV_POLL) 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | template 28 | void dev_poll_reactor::add_timer_queue(timer_queue& queue) 29 | { 30 | do_add_timer_queue(queue); 31 | } 32 | 33 | template 34 | void dev_poll_reactor::remove_timer_queue(timer_queue& queue) 35 | { 36 | do_remove_timer_queue(queue); 37 | } 38 | 39 | template 40 | void dev_poll_reactor::schedule_timer(timer_queue& queue, 41 | const typename Time_Traits::time_type& time, 42 | typename timer_queue::per_timer_data& timer, timer_op* op) 43 | { 44 | asio::detail::mutex::scoped_lock lock(mutex_); 45 | 46 | if (shutdown_) 47 | { 48 | io_service_.post_immediate_completion(op); 49 | return; 50 | } 51 | 52 | bool earliest = queue.enqueue_timer(time, timer, op); 53 | io_service_.work_started(); 54 | if (earliest) 55 | interrupter_.interrupt(); 56 | } 57 | 58 | template 59 | std::size_t dev_poll_reactor::cancel_timer(timer_queue& queue, 60 | typename timer_queue::per_timer_data& timer, 61 | std::size_t max_cancelled) 62 | { 63 | asio::detail::mutex::scoped_lock lock(mutex_); 64 | op_queue ops; 65 | std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); 66 | lock.unlock(); 67 | io_service_.post_deferred_completions(ops); 68 | return n; 69 | } 70 | 71 | } // namespace detail 72 | } // namespace asio 73 | 74 | #include "asio/detail/pop_options.hpp" 75 | 76 | #endif // defined(ASIO_HAS_DEV_POLL) 77 | 78 | #endif // ASIO_DETAIL_IMPL_DEV_POLL_REACTOR_HPP 79 | -------------------------------------------------------------------------------- /include/asio/detail/call_stack.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/call_stack.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_CALL_STACK_HPP 12 | #define ASIO_DETAIL_CALL_STACK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | #include "asio/detail/noncopyable.hpp" 20 | #include "asio/detail/tss_ptr.hpp" 21 | 22 | #include "asio/detail/push_options.hpp" 23 | 24 | namespace asio { 25 | namespace detail { 26 | 27 | // Helper class to determine whether or not the current thread is inside an 28 | // invocation of io_service::run() for a specified io_service object. 29 | template 30 | class call_stack 31 | { 32 | public: 33 | // Context class automatically pushes an owner on to the stack. 34 | class context 35 | : private noncopyable 36 | { 37 | public: 38 | // Push the owner on to the stack. 39 | explicit context(Owner* d) 40 | : owner_(d), 41 | next_(call_stack::top_) 42 | { 43 | call_stack::top_ = this; 44 | } 45 | 46 | // Pop the owner from the stack. 47 | ~context() 48 | { 49 | call_stack::top_ = next_; 50 | } 51 | 52 | private: 53 | friend class call_stack; 54 | 55 | // The owner associated with the context. 56 | Owner* owner_; 57 | 58 | // The next element in the stack. 59 | context* next_; 60 | }; 61 | 62 | friend class context; 63 | 64 | // Determine whether the specified owner is on the stack. 65 | static bool contains(Owner* d) 66 | { 67 | context* elem = top_; 68 | while (elem) 69 | { 70 | if (elem->owner_ == d) 71 | return true; 72 | elem = elem->next_; 73 | } 74 | return false; 75 | } 76 | 77 | private: 78 | // The top of the stack of calls for the current thread. 79 | static tss_ptr top_; 80 | }; 81 | 82 | template 83 | tss_ptr::context> 84 | call_stack::top_; 85 | 86 | } // namespace detail 87 | } // namespace asio 88 | 89 | #include "asio/detail/pop_options.hpp" 90 | 91 | #endif // ASIO_DETAIL_CALL_STACK_HPP 92 | -------------------------------------------------------------------------------- /include/asio/detail/win_iocp_operation.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/win_iocp_operation.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_DETAIL_WIN_IOCP_OPERATION_HPP 12 | #define ASIO_DETAIL_WIN_IOCP_OPERATION_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #if defined(ASIO_HAS_IOCP) 21 | 22 | #include "asio/detail/handler_tracking.hpp" 23 | #include "asio/detail/op_queue.hpp" 24 | #include "asio/detail/win_iocp_io_service_fwd.hpp" 25 | #include "asio/error_code.hpp" 26 | 27 | #include "asio/detail/push_options.hpp" 28 | 29 | namespace asio { 30 | namespace detail { 31 | 32 | // Base class for all operations. A function pointer is used instead of virtual 33 | // functions to avoid the associated overhead. 34 | class win_iocp_operation 35 | : public OVERLAPPED 36 | ASIO_ALSO_INHERIT_TRACKED_HANDLER 37 | { 38 | public: 39 | void complete(win_iocp_io_service& owner, 40 | const asio::error_code& ec = asio::error_code(), 41 | std::size_t bytes_transferred = 0) 42 | { 43 | func_(&owner, this, ec, bytes_transferred); 44 | } 45 | 46 | void destroy() 47 | { 48 | func_(0, this, asio::error_code(), 0); 49 | } 50 | 51 | protected: 52 | typedef void (*func_type)(win_iocp_io_service*, 53 | win_iocp_operation*, asio::error_code, std::size_t); 54 | 55 | win_iocp_operation(func_type func) 56 | : next_(0), 57 | func_(func) 58 | { 59 | reset(); 60 | } 61 | 62 | // Prevents deletion through this type. 63 | ~win_iocp_operation() 64 | { 65 | } 66 | 67 | void reset() 68 | { 69 | Internal = 0; 70 | InternalHigh = 0; 71 | Offset = 0; 72 | OffsetHigh = 0; 73 | hEvent = 0; 74 | ready_ = 0; 75 | } 76 | 77 | private: 78 | friend class op_queue_access; 79 | friend class win_iocp_io_service; 80 | win_iocp_operation* next_; 81 | func_type func_; 82 | long ready_; 83 | }; 84 | 85 | } // namespace detail 86 | } // namespace asio 87 | 88 | #include "asio/detail/pop_options.hpp" 89 | 90 | #endif // defined(ASIO_HAS_IOCP) 91 | 92 | #endif // ASIO_DETAIL_WIN_IOCP_OPERATION_HPP 93 | -------------------------------------------------------------------------------- /include/asio/time_traits.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // time_traits.hpp 3 | // ~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_TIME_TRAITS_HPP 12 | #define ASIO_TIME_TRAITS_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/socket_types.hpp" // Must come before posix_time. 19 | 20 | #include "asio/detail/push_options.hpp" 21 | #include 22 | #include "asio/detail/pop_options.hpp" 23 | 24 | #include "asio/detail/push_options.hpp" 25 | 26 | namespace asio { 27 | 28 | /// Time traits suitable for use with the deadline timer. 29 | template 30 | struct time_traits; 31 | 32 | /// Time traits specialised for posix_time. 33 | template <> 34 | struct time_traits 35 | { 36 | /// The time type. 37 | typedef boost::posix_time::ptime time_type; 38 | 39 | /// The duration type. 40 | typedef boost::posix_time::time_duration duration_type; 41 | 42 | /// Get the current time. 43 | static time_type now() 44 | { 45 | #if defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) 46 | return boost::posix_time::microsec_clock::local_time(); 47 | #else // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) 48 | return boost::posix_time::second_clock::local_time(); 49 | #endif // defined(BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK) 50 | } 51 | 52 | /// Add a duration to a time. 53 | static time_type add(const time_type& t, const duration_type& d) 54 | { 55 | return t + d; 56 | } 57 | 58 | /// Subtract one time from another. 59 | static duration_type subtract(const time_type& t1, const time_type& t2) 60 | { 61 | return t1 - t2; 62 | } 63 | 64 | /// Test whether one time is less than another. 65 | static bool less_than(const time_type& t1, const time_type& t2) 66 | { 67 | return t1 < t2; 68 | } 69 | 70 | /// Convert to POSIX duration type. 71 | static boost::posix_time::time_duration to_posix_duration( 72 | const duration_type& d) 73 | { 74 | return d; 75 | } 76 | }; 77 | 78 | } // namespace asio 79 | 80 | #include "asio/detail/pop_options.hpp" 81 | 82 | #endif // ASIO_TIME_TRAITS_HPP 83 | -------------------------------------------------------------------------------- /include/asio/handler_invoke_hook.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // handler_invoke_hook.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // 7 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9 | // 10 | 11 | #ifndef ASIO_HANDLER_INVOKE_HOOK_HPP 12 | #define ASIO_HANDLER_INVOKE_HOOK_HPP 13 | 14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 | # pragma once 16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 | 18 | #include "asio/detail/config.hpp" 19 | 20 | #include "asio/detail/push_options.hpp" 21 | 22 | namespace asio { 23 | 24 | /// Default invoke function for handlers. 25 | /** 26 | * Completion handlers for asynchronous operations are invoked by the 27 | * io_service associated with the corresponding object (e.g. a socket or 28 | * deadline_timer). Certain guarantees are made on when the handler may be 29 | * invoked, in particular that a handler can only be invoked from a thread that 30 | * is currently calling @c run() on the corresponding io_service object. 31 | * Handlers may subsequently be invoked through other objects (such as 32 | * io_service::strand objects) that provide additional guarantees. 33 | * 34 | * When asynchronous operations are composed from other asynchronous 35 | * operations, all intermediate handlers should be invoked using the same 36 | * method as the final handler. This is required to ensure that user-defined 37 | * objects are not accessed in a way that may violate the guarantees. This 38 | * hooking function ensures that the invoked method used for the final handler 39 | * is accessible at each intermediate step. 40 | * 41 | * Implement asio_handler_invoke for your own handlers to specify a custom 42 | * invocation strategy. 43 | * 44 | * This default implementation is simply: 45 | * @code 46 | * function(); 47 | * @endcode 48 | * 49 | * @par Example 50 | * @code 51 | * class my_handler; 52 | * 53 | * template 54 | * void asio_handler_invoke(Function function, my_handler* context) 55 | * { 56 | * context->strand_.dispatch(function); 57 | * } 58 | * @endcode 59 | */ 60 | template 61 | inline void asio_handler_invoke(Function function, ...) 62 | { 63 | function(); 64 | } 65 | 66 | } // namespace asio 67 | 68 | #include "asio/detail/pop_options.hpp" 69 | 70 | #endif // ASIO_HANDLER_INVOKE_HOOK_HPP 71 | -------------------------------------------------------------------------------- /include/asio/detail/impl/kqueue_reactor.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // detail/impl/kqueue_reactor.hpp 3 | // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 | // 5 | // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 | // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) 7 | // 8 | // Distributed under the Boost Software License, Version 1.0. (See accompanying 9 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 10 | // 11 | 12 | #ifndef ASIO_DETAIL_IMPL_KQUEUE_REACTOR_HPP 13 | #define ASIO_DETAIL_IMPL_KQUEUE_REACTOR_HPP 14 | 15 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 | # pragma once 17 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 | 19 | #include "asio/detail/config.hpp" 20 | 21 | #if defined(ASIO_HAS_KQUEUE) 22 | 23 | #include "asio/detail/push_options.hpp" 24 | 25 | namespace asio { 26 | namespace detail { 27 | 28 | template 29 | void kqueue_reactor::add_timer_queue(timer_queue& queue) 30 | { 31 | do_add_timer_queue(queue); 32 | } 33 | 34 | // Remove a timer queue from the reactor. 35 | template 36 | void kqueue_reactor::remove_timer_queue(timer_queue& queue) 37 | { 38 | do_remove_timer_queue(queue); 39 | } 40 | 41 | template 42 | void kqueue_reactor::schedule_timer(timer_queue& queue, 43 | const typename Time_Traits::time_type& time, 44 | typename timer_queue::per_timer_data& timer, timer_op* op) 45 | { 46 | asio::detail::mutex::scoped_lock lock(mutex_); 47 | 48 | if (shutdown_) 49 | { 50 | io_service_.post_immediate_completion(op); 51 | return; 52 | } 53 | 54 | bool earliest = queue.enqueue_timer(time, timer, op); 55 | io_service_.work_started(); 56 | if (earliest) 57 | interrupt(); 58 | } 59 | 60 | template 61 | std::size_t kqueue_reactor::cancel_timer(timer_queue& queue, 62 | typename timer_queue::per_timer_data& timer, 63 | std::size_t max_cancelled) 64 | { 65 | asio::detail::mutex::scoped_lock lock(mutex_); 66 | op_queue ops; 67 | std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); 68 | lock.unlock(); 69 | io_service_.post_deferred_completions(ops); 70 | return n; 71 | } 72 | 73 | } // namespace detail 74 | } // namespace asio 75 | 76 | #include "asio/detail/pop_options.hpp" 77 | 78 | #endif // defined(ASIO_HAS_KQUEUE) 79 | 80 | #endif // ASIO_DETAIL_IMPL_KQUEUE_REACTOR_HPP 81 | --------------------------------------------------------------------------------