You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by wh...@apache.org on 2015/10/29 18:57:18 UTC
[32/54] [abbrv] [partial] hadoop git commit: HDFS-9207. Move the
implementation to the hdfs-native-client module. Contributed by Haohui Mai.
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/posix_tss_ptr.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/posix_tss_ptr.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/posix_tss_ptr.hpp
deleted file mode 100644
index 23f93ae..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/posix_tss_ptr.hpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//
-// detail/posix_tss_ptr.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_POSIX_TSS_PTR_HPP
-#define ASIO_DETAIL_POSIX_TSS_PTR_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-
-#if defined(ASIO_HAS_PTHREADS)
-
-#include <pthread.h>
-#include "asio/detail/noncopyable.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-// Helper function to create thread-specific storage.
-ASIO_DECL void posix_tss_ptr_create(pthread_key_t& key);
-
-template <typename T>
-class posix_tss_ptr
- : private noncopyable
-{
-public:
- // Constructor.
- posix_tss_ptr()
- {
- posix_tss_ptr_create(tss_key_);
- }
-
- // Destructor.
- ~posix_tss_ptr()
- {
- ::pthread_key_delete(tss_key_);
- }
-
- // Get the value.
- operator T*() const
- {
- return static_cast<T*>(::pthread_getspecific(tss_key_));
- }
-
- // Set the value.
- void operator=(T* value)
- {
- ::pthread_setspecific(tss_key_, value);
- }
-
-private:
- // Thread-specific storage to allow unlocked access to determine whether a
- // thread is a member of the pool.
- pthread_key_t tss_key_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#if defined(ASIO_HEADER_ONLY)
-# include "asio/detail/impl/posix_tss_ptr.ipp"
-#endif // defined(ASIO_HEADER_ONLY)
-
-#endif // defined(ASIO_HAS_PTHREADS)
-
-#endif // ASIO_DETAIL_POSIX_TSS_PTR_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/push_options.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/push_options.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/push_options.hpp
deleted file mode 100644
index c5ccd47..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/push_options.hpp
+++ /dev/null
@@ -1,138 +0,0 @@
-//
-// detail/push_options.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-// No header guard
-
-#if defined(__COMO__)
-
-// Comeau C++
-
-#elif defined(__DMC__)
-
-// Digital Mars C++
-
-#elif defined(__INTEL_COMPILER) || defined(__ICL) \
- || defined(__ICC) || defined(__ECC)
-
-// Intel C++
-
-#elif defined(__GNUC__)
-
-// GNU C++
-
-# if defined(__MINGW32__) || defined(__CYGWIN__)
-# pragma pack (push, 8)
-# endif
-
-# if defined(__OBJC__)
-# if !defined(__APPLE_CC__) || (__APPLE_CC__ <= 1)
-# if !defined(ASIO_DISABLE_OBJC_WORKAROUND)
-# if !defined(Protocol) && !defined(id)
-# define Protocol cpp_Protocol
-# define id cpp_id
-# define ASIO_OBJC_WORKAROUND
-# endif
-# endif
-# endif
-# endif
-
-#elif defined(__KCC)
-
-// Kai C++
-
-#elif defined(__sgi)
-
-// SGI MIPSpro C++
-
-#elif defined(__DECCXX)
-
-// Compaq Tru64 Unix cxx
-
-#elif defined(__ghs)
-
-// Greenhills C++
-
-#elif defined(__BORLANDC__)
-
-// Borland C++
-
-# pragma option push -a8 -b -Ve- -Vx- -w-inl -vi-
-# pragma nopushoptwarn
-# pragma nopackwarning
-# if !defined(__MT__)
-# error Multithreaded RTL must be selected.
-# endif // !defined(__MT__)
-
-#elif defined(__MWERKS__)
-
-// Metrowerks CodeWarrior
-
-#elif defined(__SUNPRO_CC)
-
-// Sun Workshop Compiler C++
-
-#elif defined(__HP_aCC)
-
-// HP aCC
-
-#elif defined(__MRC__) || defined(__SC__)
-
-// MPW MrCpp or SCpp
-
-#elif defined(__IBMCPP__)
-
-// IBM Visual Age
-
-#elif defined(_MSC_VER)
-
-// Microsoft Visual C++
-//
-// Must remain the last #elif since some other vendors (Metrowerks, for example)
-// also #define _MSC_VER
-
-# pragma warning (disable:4103)
-# pragma warning (push)
-# pragma warning (disable:4127)
-# pragma warning (disable:4180)
-# pragma warning (disable:4244)
-# pragma warning (disable:4355)
-# pragma warning (disable:4510)
-# pragma warning (disable:4512)
-# pragma warning (disable:4610)
-# pragma warning (disable:4675)
-# if defined(_M_IX86) && defined(_Wp64)
-// The /Wp64 option is broken. If you want to check 64 bit portability, use a
-// 64 bit compiler!
-# pragma warning (disable:4311)
-# pragma warning (disable:4312)
-# endif // defined(_M_IX86) && defined(_Wp64)
-# pragma pack (push, 8)
-// Note that if the /Og optimisation flag is enabled with MSVC6, the compiler
-// has a tendency to incorrectly optimise away some calls to member template
-// functions, even though those functions contain code that should not be
-// optimised away! Therefore we will always disable this optimisation option
-// for the MSVC6 compiler.
-# if (_MSC_VER < 1300)
-# pragma optimize ("g", off)
-# endif
-# if !defined(_MT)
-# error Multithreaded RTL must be selected.
-# endif // !defined(_MT)
-
-# if defined(__cplusplus_cli) || defined(__cplusplus_winrt)
-# if !defined(ASIO_DISABLE_CLR_WORKAROUND)
-# if !defined(generic)
-# define generic cpp_generic
-# define ASIO_CLR_WORKAROUND
-# endif
-# endif
-# endif
-
-#endif
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_descriptor_service.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_descriptor_service.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_descriptor_service.hpp
deleted file mode 100644
index d5c0ea9..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_descriptor_service.hpp
+++ /dev/null
@@ -1,322 +0,0 @@
-//
-// detail/reactive_descriptor_service.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP
-#define ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-
-#if !defined(ASIO_WINDOWS) \
- && !defined(ASIO_WINDOWS_RUNTIME) \
- && !defined(__CYGWIN__)
-
-#include "asio/buffer.hpp"
-#include "asio/io_service.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/descriptor_ops.hpp"
-#include "asio/detail/descriptor_read_op.hpp"
-#include "asio/detail/descriptor_write_op.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/noncopyable.hpp"
-#include "asio/detail/reactive_null_buffers_op.hpp"
-#include "asio/detail/reactor.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-class reactive_descriptor_service
-{
-public:
- // The native type of a descriptor.
- typedef int native_handle_type;
-
- // The implementation type of the descriptor.
- class implementation_type
- : private asio::detail::noncopyable
- {
- public:
- // Default constructor.
- implementation_type()
- : descriptor_(-1),
- state_(0)
- {
- }
-
- private:
- // Only this service will have access to the internal values.
- friend class reactive_descriptor_service;
-
- // The native descriptor representation.
- int descriptor_;
-
- // The current state of the descriptor.
- descriptor_ops::state_type state_;
-
- // Per-descriptor data used by the reactor.
- reactor::per_descriptor_data reactor_data_;
- };
-
- // Constructor.
- ASIO_DECL reactive_descriptor_service(
- asio::io_service& io_service);
-
- // Destroy all user-defined handler objects owned by the service.
- ASIO_DECL void shutdown_service();
-
- // Construct a new descriptor implementation.
- ASIO_DECL void construct(implementation_type& impl);
-
- // Move-construct a new descriptor implementation.
- ASIO_DECL void move_construct(implementation_type& impl,
- implementation_type& other_impl);
-
- // Move-assign from another descriptor implementation.
- ASIO_DECL void move_assign(implementation_type& impl,
- reactive_descriptor_service& other_service,
- implementation_type& other_impl);
-
- // Destroy a descriptor implementation.
- ASIO_DECL void destroy(implementation_type& impl);
-
- // Assign a native descriptor to a descriptor implementation.
- ASIO_DECL asio::error_code assign(implementation_type& impl,
- const native_handle_type& native_descriptor,
- asio::error_code& ec);
-
- // Determine whether the descriptor is open.
- bool is_open(const implementation_type& impl) const
- {
- return impl.descriptor_ != -1;
- }
-
- // Destroy a descriptor implementation.
- ASIO_DECL asio::error_code close(implementation_type& impl,
- asio::error_code& ec);
-
- // Get the native descriptor representation.
- native_handle_type native_handle(const implementation_type& impl) const
- {
- return impl.descriptor_;
- }
-
- // Release ownership of the native descriptor representation.
- ASIO_DECL native_handle_type release(implementation_type& impl);
-
- // Cancel all operations associated with the descriptor.
- ASIO_DECL asio::error_code cancel(implementation_type& impl,
- asio::error_code& ec);
-
- // Perform an IO control command on the descriptor.
- template <typename IO_Control_Command>
- asio::error_code io_control(implementation_type& impl,
- IO_Control_Command& command, asio::error_code& ec)
- {
- descriptor_ops::ioctl(impl.descriptor_, impl.state_,
- command.name(), static_cast<ioctl_arg_type*>(command.data()), ec);
- return ec;
- }
-
- // Gets the non-blocking mode of the descriptor.
- bool non_blocking(const implementation_type& impl) const
- {
- return (impl.state_ & descriptor_ops::user_set_non_blocking) != 0;
- }
-
- // Sets the non-blocking mode of the descriptor.
- asio::error_code non_blocking(implementation_type& impl,
- bool mode, asio::error_code& ec)
- {
- descriptor_ops::set_user_non_blocking(
- impl.descriptor_, impl.state_, mode, ec);
- return ec;
- }
-
- // Gets the non-blocking mode of the native descriptor implementation.
- bool native_non_blocking(const implementation_type& impl) const
- {
- return (impl.state_ & descriptor_ops::internal_non_blocking) != 0;
- }
-
- // Sets the non-blocking mode of the native descriptor implementation.
- asio::error_code native_non_blocking(implementation_type& impl,
- bool mode, asio::error_code& ec)
- {
- descriptor_ops::set_internal_non_blocking(
- impl.descriptor_, impl.state_, mode, ec);
- return ec;
- }
-
- // Write some data to the descriptor.
- template <typename ConstBufferSequence>
- size_t write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, asio::error_code& ec)
- {
- buffer_sequence_adapter<asio::const_buffer,
- ConstBufferSequence> bufs(buffers);
-
- return descriptor_ops::sync_write(impl.descriptor_, impl.state_,
- bufs.buffers(), bufs.count(), bufs.all_empty(), ec);
- }
-
- // Wait until data can be written without blocking.
- size_t write_some(implementation_type& impl,
- const null_buffers&, asio::error_code& ec)
- {
- // Wait for descriptor to become ready.
- descriptor_ops::poll_write(impl.descriptor_, impl.state_, ec);
-
- return 0;
- }
-
- // Start an asynchronous write. The data being sent must be valid for the
- // lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
- void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef descriptor_write_op<ConstBufferSequence, Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.descriptor_, buffers, handler);
-
- ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_write_some"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, true,
- buffer_sequence_adapter<asio::const_buffer,
- ConstBufferSequence>::all_empty(buffers));
- p.v = p.p = 0;
- }
-
- // Start an asynchronous wait until data can be written without blocking.
- template <typename Handler>
- void async_write_some(implementation_type& impl,
- const null_buffers&, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- ASIO_HANDLER_CREATION((p.p, "descriptor",
- &impl, "async_write_some(null_buffers)"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Read some data from the stream. Returns the number of bytes read.
- template <typename MutableBufferSequence>
- size_t read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, asio::error_code& ec)
- {
- buffer_sequence_adapter<asio::mutable_buffer,
- MutableBufferSequence> bufs(buffers);
-
- return descriptor_ops::sync_read(impl.descriptor_, impl.state_,
- bufs.buffers(), bufs.count(), bufs.all_empty(), ec);
- }
-
- // Wait until data can be read without blocking.
- size_t read_some(implementation_type& impl,
- const null_buffers&, asio::error_code& ec)
- {
- // Wait for descriptor to become ready.
- descriptor_ops::poll_read(impl.descriptor_, impl.state_, ec);
-
- return 0;
- }
-
- // Start an asynchronous read. The buffer for the data being read must be
- // valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef descriptor_read_op<MutableBufferSequence, Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.descriptor_, buffers, handler);
-
- ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_read_some"));
-
- start_op(impl, reactor::read_op, p.p, is_continuation, true,
- buffer_sequence_adapter<asio::mutable_buffer,
- MutableBufferSequence>::all_empty(buffers));
- p.v = p.p = 0;
- }
-
- // Wait until data can be read without blocking.
- template <typename Handler>
- void async_read_some(implementation_type& impl,
- const null_buffers&, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- ASIO_HANDLER_CREATION((p.p, "descriptor",
- &impl, "async_read_some(null_buffers)"));
-
- start_op(impl, reactor::read_op, p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
-private:
- // Start the asynchronous operation.
- ASIO_DECL void start_op(implementation_type& impl, int op_type,
- reactor_op* op, bool is_continuation, bool is_non_blocking, bool noop);
-
- // The selector that performs event demultiplexing for the service.
- reactor& reactor_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#if defined(ASIO_HEADER_ONLY)
-# include "asio/detail/impl/reactive_descriptor_service.ipp"
-#endif // defined(ASIO_HEADER_ONLY)
-
-#endif // !defined(ASIO_WINDOWS)
- // && !defined(ASIO_WINDOWS_RUNTIME)
- // && !defined(__CYGWIN__)
-
-#endif // ASIO_DETAIL_REACTIVE_DESCRIPTOR_SERVICE_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_null_buffers_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_null_buffers_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_null_buffers_op.hpp
deleted file mode 100644
index c4c4213..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_null_buffers_op.hpp
+++ /dev/null
@@ -1,88 +0,0 @@
-//
-// detail/reactive_null_buffers_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_NULL_BUFFERS_OP_HPP
-#define ASIO_DETAIL_REACTIVE_NULL_BUFFERS_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/handler_alloc_helpers.hpp"
-#include "asio/detail/handler_invoke_helpers.hpp"
-#include "asio/detail/reactor_op.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename Handler>
-class reactive_null_buffers_op : public reactor_op
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_null_buffers_op);
-
- reactive_null_buffers_op(Handler& handler)
- : reactor_op(&reactive_null_buffers_op::do_perform,
- &reactive_null_buffers_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static bool do_perform(reactor_op*)
- {
- return true;
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_null_buffers_op* o(static_cast<reactive_null_buffers_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder2<Handler, asio::error_code, std::size_t>
- handler(o->handler_, o->ec_, o->bytes_transferred_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_NULL_BUFFERS_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_serial_port_service.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_serial_port_service.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_serial_port_service.hpp
deleted file mode 100644
index 5361c48..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_serial_port_service.hpp
+++ /dev/null
@@ -1,234 +0,0 @@
-//
-// detail/reactive_serial_port_service.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP
-#define ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-
-#if defined(ASIO_HAS_SERIAL_PORT)
-#if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__)
-
-#include <string>
-#include "asio/error.hpp"
-#include "asio/io_service.hpp"
-#include "asio/serial_port_base.hpp"
-#include "asio/detail/descriptor_ops.hpp"
-#include "asio/detail/reactive_descriptor_service.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-// Extend reactive_descriptor_service to provide serial port support.
-class reactive_serial_port_service
-{
-public:
- // The native type of a serial port.
- typedef reactive_descriptor_service::native_handle_type native_handle_type;
-
- // The implementation type of the serial port.
- typedef reactive_descriptor_service::implementation_type implementation_type;
-
- ASIO_DECL reactive_serial_port_service(
- asio::io_service& io_service);
-
- // Destroy all user-defined handler objects owned by the service.
- ASIO_DECL void shutdown_service();
-
- // Construct a new serial port implementation.
- void construct(implementation_type& impl)
- {
- descriptor_service_.construct(impl);
- }
-
- // Move-construct a new serial port implementation.
- void move_construct(implementation_type& impl,
- implementation_type& other_impl)
- {
- descriptor_service_.move_construct(impl, other_impl);
- }
-
- // Move-assign from another serial port implementation.
- void move_assign(implementation_type& impl,
- reactive_serial_port_service& other_service,
- implementation_type& other_impl)
- {
- descriptor_service_.move_assign(impl,
- other_service.descriptor_service_, other_impl);
- }
-
- // Destroy a serial port implementation.
- void destroy(implementation_type& impl)
- {
- descriptor_service_.destroy(impl);
- }
-
- // Open the serial port using the specified device name.
- ASIO_DECL asio::error_code open(implementation_type& impl,
- const std::string& device, asio::error_code& ec);
-
- // Assign a native descriptor to a serial port implementation.
- asio::error_code assign(implementation_type& impl,
- const native_handle_type& native_descriptor,
- asio::error_code& ec)
- {
- return descriptor_service_.assign(impl, native_descriptor, ec);
- }
-
- // Determine whether the serial port is open.
- bool is_open(const implementation_type& impl) const
- {
- return descriptor_service_.is_open(impl);
- }
-
- // Destroy a serial port implementation.
- asio::error_code close(implementation_type& impl,
- asio::error_code& ec)
- {
- return descriptor_service_.close(impl, ec);
- }
-
- // Get the native serial port representation.
- native_handle_type native_handle(implementation_type& impl)
- {
- return descriptor_service_.native_handle(impl);
- }
-
- // Cancel all operations associated with the serial port.
- asio::error_code cancel(implementation_type& impl,
- asio::error_code& ec)
- {
- return descriptor_service_.cancel(impl, ec);
- }
-
- // Set an option on the serial port.
- template <typename SettableSerialPortOption>
- asio::error_code set_option(implementation_type& impl,
- const SettableSerialPortOption& option, asio::error_code& ec)
- {
- return do_set_option(impl,
- &reactive_serial_port_service::store_option<SettableSerialPortOption>,
- &option, ec);
- }
-
- // Get an option from the serial port.
- template <typename GettableSerialPortOption>
- asio::error_code get_option(const implementation_type& impl,
- GettableSerialPortOption& option, asio::error_code& ec) const
- {
- return do_get_option(impl,
- &reactive_serial_port_service::load_option<GettableSerialPortOption>,
- &option, ec);
- }
-
- // Send a break sequence to the serial port.
- asio::error_code send_break(implementation_type& impl,
- asio::error_code& ec)
- {
- errno = 0;
- descriptor_ops::error_wrapper(::tcsendbreak(
- descriptor_service_.native_handle(impl), 0), ec);
- return ec;
- }
-
- // Write the given data. Returns the number of bytes sent.
- template <typename ConstBufferSequence>
- size_t write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, asio::error_code& ec)
- {
- return descriptor_service_.write_some(impl, buffers, ec);
- }
-
- // Start an asynchronous write. The data being written must be valid for the
- // lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
- void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
- {
- descriptor_service_.async_write_some(impl, buffers, handler);
- }
-
- // Read some data. Returns the number of bytes received.
- template <typename MutableBufferSequence>
- size_t read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, asio::error_code& ec)
- {
- return descriptor_service_.read_some(impl, buffers, ec);
- }
-
- // Start an asynchronous read. The buffer for the data being received must be
- // valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
- {
- descriptor_service_.async_read_some(impl, buffers, handler);
- }
-
-private:
- // Function pointer type for storing a serial port option.
- typedef asio::error_code (*store_function_type)(
- const void*, termios&, asio::error_code&);
-
- // Helper function template to store a serial port option.
- template <typename SettableSerialPortOption>
- static asio::error_code store_option(const void* option,
- termios& storage, asio::error_code& ec)
- {
- return static_cast<const SettableSerialPortOption*>(option)->store(
- storage, ec);
- }
-
- // Helper function to set a serial port option.
- ASIO_DECL asio::error_code do_set_option(
- implementation_type& impl, store_function_type store,
- const void* option, asio::error_code& ec);
-
- // Function pointer type for loading a serial port option.
- typedef asio::error_code (*load_function_type)(
- void*, const termios&, asio::error_code&);
-
- // Helper function template to load a serial port option.
- template <typename GettableSerialPortOption>
- static asio::error_code load_option(void* option,
- const termios& storage, asio::error_code& ec)
- {
- return static_cast<GettableSerialPortOption*>(option)->load(storage, ec);
- }
-
- // Helper function to get a serial port option.
- ASIO_DECL asio::error_code do_get_option(
- const implementation_type& impl, load_function_type load,
- void* option, asio::error_code& ec) const;
-
- // The implementation used for initiating asynchronous operations.
- reactive_descriptor_service descriptor_service_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#if defined(ASIO_HEADER_ONLY)
-# include "asio/detail/impl/reactive_serial_port_service.ipp"
-#endif // defined(ASIO_HEADER_ONLY)
-
-#endif // !defined(ASIO_WINDOWS) && !defined(__CYGWIN__)
-#endif // defined(ASIO_HAS_SERIAL_PORT)
-
-#endif // ASIO_DETAIL_REACTIVE_SERIAL_PORT_SERVICE_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_accept_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_accept_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_accept_op.hpp
deleted file mode 100644
index 35e83c6..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_accept_op.hpp
+++ /dev/null
@@ -1,136 +0,0 @@
-//
-// detail/reactive_socket_accept_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_ACCEPT_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_ACCEPT_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_holder.hpp"
-#include "asio/detail/socket_ops.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename Socket, typename Protocol>
-class reactive_socket_accept_op_base : public reactor_op
-{
-public:
- reactive_socket_accept_op_base(socket_type socket,
- socket_ops::state_type state, Socket& peer, const Protocol& protocol,
- typename Protocol::endpoint* peer_endpoint, func_type complete_func)
- : reactor_op(&reactive_socket_accept_op_base::do_perform, complete_func),
- socket_(socket),
- state_(state),
- peer_(peer),
- protocol_(protocol),
- peer_endpoint_(peer_endpoint)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_accept_op_base* o(
- static_cast<reactive_socket_accept_op_base*>(base));
-
- std::size_t addrlen = o->peer_endpoint_ ? o->peer_endpoint_->capacity() : 0;
- socket_type new_socket = invalid_socket;
- bool result = socket_ops::non_blocking_accept(o->socket_,
- o->state_, o->peer_endpoint_ ? o->peer_endpoint_->data() : 0,
- o->peer_endpoint_ ? &addrlen : 0, o->ec_, new_socket);
-
- // On success, assign new connection to peer socket object.
- if (new_socket != invalid_socket)
- {
- socket_holder new_socket_holder(new_socket);
- if (o->peer_endpoint_)
- o->peer_endpoint_->resize(addrlen);
- if (!o->peer_.assign(o->protocol_, new_socket, o->ec_))
- new_socket_holder.release();
- }
-
- return result;
- }
-
-private:
- socket_type socket_;
- socket_ops::state_type state_;
- Socket& peer_;
- Protocol protocol_;
- typename Protocol::endpoint* peer_endpoint_;
-};
-
-template <typename Socket, typename Protocol, typename Handler>
-class reactive_socket_accept_op :
- public reactive_socket_accept_op_base<Socket, Protocol>
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_accept_op);
-
- reactive_socket_accept_op(socket_type socket,
- socket_ops::state_type state, Socket& peer, const Protocol& protocol,
- typename Protocol::endpoint* peer_endpoint, Handler& handler)
- : reactive_socket_accept_op_base<Socket, Protocol>(socket, state, peer,
- protocol, peer_endpoint, &reactive_socket_accept_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_accept_op* o(static_cast<reactive_socket_accept_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder1<Handler, asio::error_code>
- handler(o->handler_, o->ec_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_ACCEPT_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_connect_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_connect_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_connect_op.hpp
deleted file mode 100644
index 5f15221..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_connect_op.hpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// detail/reactive_socket_connect_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_CONNECT_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_CONNECT_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_ops.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-class reactive_socket_connect_op_base : public reactor_op
-{
-public:
- reactive_socket_connect_op_base(socket_type socket, func_type complete_func)
- : reactor_op(&reactive_socket_connect_op_base::do_perform, complete_func),
- socket_(socket)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_connect_op_base* o(
- static_cast<reactive_socket_connect_op_base*>(base));
-
- return socket_ops::non_blocking_connect(o->socket_, o->ec_);
- }
-
-private:
- socket_type socket_;
-};
-
-template <typename Handler>
-class reactive_socket_connect_op : public reactive_socket_connect_op_base
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_connect_op);
-
- reactive_socket_connect_op(socket_type socket, Handler& handler)
- : reactive_socket_connect_op_base(socket,
- &reactive_socket_connect_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_connect_op* o
- (static_cast<reactive_socket_connect_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder1<Handler, asio::error_code>
- handler(o->handler_, o->ec_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_));
- asio_handler_invoke_helpers::invoke(handler, handler);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_CONNECT_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recv_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recv_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recv_op.hpp
deleted file mode 100644
index 1e8b8d0..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recv_op.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// detail/reactive_socket_recv_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_RECV_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_RECV_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_ops.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename MutableBufferSequence>
-class reactive_socket_recv_op_base : public reactor_op
-{
-public:
- reactive_socket_recv_op_base(socket_type socket,
- socket_ops::state_type state, const MutableBufferSequence& buffers,
- socket_base::message_flags flags, func_type complete_func)
- : reactor_op(&reactive_socket_recv_op_base::do_perform, complete_func),
- socket_(socket),
- state_(state),
- buffers_(buffers),
- flags_(flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_recv_op_base* o(
- static_cast<reactive_socket_recv_op_base*>(base));
-
- buffer_sequence_adapter<asio::mutable_buffer,
- MutableBufferSequence> bufs(o->buffers_);
-
- return socket_ops::non_blocking_recv(o->socket_,
- bufs.buffers(), bufs.count(), o->flags_,
- (o->state_ & socket_ops::stream_oriented) != 0,
- o->ec_, o->bytes_transferred_);
- }
-
-private:
- socket_type socket_;
- socket_ops::state_type state_;
- MutableBufferSequence buffers_;
- socket_base::message_flags flags_;
-};
-
-template <typename MutableBufferSequence, typename Handler>
-class reactive_socket_recv_op :
- public reactive_socket_recv_op_base<MutableBufferSequence>
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_recv_op);
-
- reactive_socket_recv_op(socket_type socket,
- socket_ops::state_type state, const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
- : reactive_socket_recv_op_base<MutableBufferSequence>(socket, state,
- buffers, flags, &reactive_socket_recv_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_recv_op* o(static_cast<reactive_socket_recv_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder2<Handler, asio::error_code, std::size_t>
- handler(o->handler_, o->ec_, o->bytes_transferred_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_RECV_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvfrom_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvfrom_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvfrom_op.hpp
deleted file mode 100644
index 32da2b3..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvfrom_op.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// detail/reactive_socket_recvfrom_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_RECVFROM_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_RECVFROM_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_ops.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename MutableBufferSequence, typename Endpoint>
-class reactive_socket_recvfrom_op_base : public reactor_op
-{
-public:
- reactive_socket_recvfrom_op_base(socket_type socket, int protocol_type,
- const MutableBufferSequence& buffers, Endpoint& endpoint,
- socket_base::message_flags flags, func_type complete_func)
- : reactor_op(&reactive_socket_recvfrom_op_base::do_perform, complete_func),
- socket_(socket),
- protocol_type_(protocol_type),
- buffers_(buffers),
- sender_endpoint_(endpoint),
- flags_(flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_recvfrom_op_base* o(
- static_cast<reactive_socket_recvfrom_op_base*>(base));
-
- buffer_sequence_adapter<asio::mutable_buffer,
- MutableBufferSequence> bufs(o->buffers_);
-
- std::size_t addr_len = o->sender_endpoint_.capacity();
- bool result = socket_ops::non_blocking_recvfrom(o->socket_,
- bufs.buffers(), bufs.count(), o->flags_,
- o->sender_endpoint_.data(), &addr_len,
- o->ec_, o->bytes_transferred_);
-
- if (result && !o->ec_)
- o->sender_endpoint_.resize(addr_len);
-
- return result;
- }
-
-private:
- socket_type socket_;
- int protocol_type_;
- MutableBufferSequence buffers_;
- Endpoint& sender_endpoint_;
- socket_base::message_flags flags_;
-};
-
-template <typename MutableBufferSequence, typename Endpoint, typename Handler>
-class reactive_socket_recvfrom_op :
- public reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvfrom_op);
-
- reactive_socket_recvfrom_op(socket_type socket, int protocol_type,
- const MutableBufferSequence& buffers, Endpoint& endpoint,
- socket_base::message_flags flags, Handler& handler)
- : reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>(
- socket, protocol_type, buffers, endpoint, flags,
- &reactive_socket_recvfrom_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_recvfrom_op* o(
- static_cast<reactive_socket_recvfrom_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder2<Handler, asio::error_code, std::size_t>
- handler(o->handler_, o->ec_, o->bytes_transferred_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_RECVFROM_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvmsg_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvmsg_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvmsg_op.hpp
deleted file mode 100644
index 13f3f8c..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_recvmsg_op.hpp
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// detail/reactive_socket_recvmsg_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_ops.hpp"
-#include "asio/socket_base.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename MutableBufferSequence>
-class reactive_socket_recvmsg_op_base : public reactor_op
-{
-public:
- reactive_socket_recvmsg_op_base(socket_type socket,
- const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, func_type complete_func)
- : reactor_op(&reactive_socket_recvmsg_op_base::do_perform, complete_func),
- socket_(socket),
- buffers_(buffers),
- in_flags_(in_flags),
- out_flags_(out_flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_recvmsg_op_base* o(
- static_cast<reactive_socket_recvmsg_op_base*>(base));
-
- buffer_sequence_adapter<asio::mutable_buffer,
- MutableBufferSequence> bufs(o->buffers_);
-
- return socket_ops::non_blocking_recvmsg(o->socket_,
- bufs.buffers(), bufs.count(),
- o->in_flags_, o->out_flags_,
- o->ec_, o->bytes_transferred_);
- }
-
-private:
- socket_type socket_;
- MutableBufferSequence buffers_;
- socket_base::message_flags in_flags_;
- socket_base::message_flags& out_flags_;
-};
-
-template <typename MutableBufferSequence, typename Handler>
-class reactive_socket_recvmsg_op :
- public reactive_socket_recvmsg_op_base<MutableBufferSequence>
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvmsg_op);
-
- reactive_socket_recvmsg_op(socket_type socket,
- const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
- : reactive_socket_recvmsg_op_base<MutableBufferSequence>(socket, buffers,
- in_flags, out_flags, &reactive_socket_recvmsg_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_recvmsg_op* o(
- static_cast<reactive_socket_recvmsg_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder2<Handler, asio::error_code, std::size_t>
- handler(o->handler_, o->ec_, o->bytes_transferred_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_send_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_send_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_send_op.hpp
deleted file mode 100644
index 3862a7f..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_send_op.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// detail/reactive_socket_send_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_SEND_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_SEND_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_ops.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename ConstBufferSequence>
-class reactive_socket_send_op_base : public reactor_op
-{
-public:
- reactive_socket_send_op_base(socket_type socket,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, func_type complete_func)
- : reactor_op(&reactive_socket_send_op_base::do_perform, complete_func),
- socket_(socket),
- buffers_(buffers),
- flags_(flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_send_op_base* o(
- static_cast<reactive_socket_send_op_base*>(base));
-
- buffer_sequence_adapter<asio::const_buffer,
- ConstBufferSequence> bufs(o->buffers_);
-
- return socket_ops::non_blocking_send(o->socket_,
- bufs.buffers(), bufs.count(), o->flags_,
- o->ec_, o->bytes_transferred_);
- }
-
-private:
- socket_type socket_;
- ConstBufferSequence buffers_;
- socket_base::message_flags flags_;
-};
-
-template <typename ConstBufferSequence, typename Handler>
-class reactive_socket_send_op :
- public reactive_socket_send_op_base<ConstBufferSequence>
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_send_op);
-
- reactive_socket_send_op(socket_type socket,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
- : reactive_socket_send_op_base<ConstBufferSequence>(socket,
- buffers, flags, &reactive_socket_send_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_send_op* o(static_cast<reactive_socket_send_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder2<Handler, asio::error_code, std::size_t>
- handler(o->handler_, o->ec_, o->bytes_transferred_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_SEND_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_sendto_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_sendto_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_sendto_op.hpp
deleted file mode 100644
index fa2ac45..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_sendto_op.hpp
+++ /dev/null
@@ -1,123 +0,0 @@
-//
-// detail/reactive_socket_sendto_op.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_SENDTO_OP_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_SENDTO_OP_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/bind_handler.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_ops.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename ConstBufferSequence, typename Endpoint>
-class reactive_socket_sendto_op_base : public reactor_op
-{
-public:
- reactive_socket_sendto_op_base(socket_type socket,
- const ConstBufferSequence& buffers, const Endpoint& endpoint,
- socket_base::message_flags flags, func_type complete_func)
- : reactor_op(&reactive_socket_sendto_op_base::do_perform, complete_func),
- socket_(socket),
- buffers_(buffers),
- destination_(endpoint),
- flags_(flags)
- {
- }
-
- static bool do_perform(reactor_op* base)
- {
- reactive_socket_sendto_op_base* o(
- static_cast<reactive_socket_sendto_op_base*>(base));
-
- buffer_sequence_adapter<asio::const_buffer,
- ConstBufferSequence> bufs(o->buffers_);
-
- return socket_ops::non_blocking_sendto(o->socket_,
- bufs.buffers(), bufs.count(), o->flags_,
- o->destination_.data(), o->destination_.size(),
- o->ec_, o->bytes_transferred_);
- }
-
-private:
- socket_type socket_;
- ConstBufferSequence buffers_;
- Endpoint destination_;
- socket_base::message_flags flags_;
-};
-
-template <typename ConstBufferSequence, typename Endpoint, typename Handler>
-class reactive_socket_sendto_op :
- public reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>
-{
-public:
- ASIO_DEFINE_HANDLER_PTR(reactive_socket_sendto_op);
-
- reactive_socket_sendto_op(socket_type socket,
- const ConstBufferSequence& buffers, const Endpoint& endpoint,
- socket_base::message_flags flags, Handler& handler)
- : reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>(socket,
- buffers, endpoint, flags, &reactive_socket_sendto_op::do_complete),
- handler_(ASIO_MOVE_CAST(Handler)(handler))
- {
- }
-
- static void do_complete(io_service_impl* owner, operation* base,
- const asio::error_code& /*ec*/,
- std::size_t /*bytes_transferred*/)
- {
- // Take ownership of the handler object.
- reactive_socket_sendto_op* o(static_cast<reactive_socket_sendto_op*>(base));
- ptr p = { asio::detail::addressof(o->handler_), o, o };
-
- ASIO_HANDLER_COMPLETION((o));
-
- // Make a copy of the handler so that the memory can be deallocated before
- // the upcall is made. Even if we're not about to make an upcall, a
- // sub-object of the handler may be the true owner of the memory associated
- // with the handler. Consequently, a local copy of the handler is required
- // to ensure that any owning sub-object remains valid until after we have
- // deallocated the memory here.
- detail::binder2<Handler, asio::error_code, std::size_t>
- handler(o->handler_, o->ec_, o->bytes_transferred_);
- p.h = asio::detail::addressof(handler.handler_);
- p.reset();
-
- // Make the upcall if required.
- if (owner)
- {
- fenced_block b(fenced_block::half);
- ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_));
- asio_handler_invoke_helpers::invoke(handler, handler.handler_);
- ASIO_HANDLER_INVOCATION_END;
- }
- }
-
-private:
- Handler handler_;
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_SENDTO_OP_HPP
http://git-wip-us.apache.org/repos/asf/hadoop/blob/76a1e894/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_service.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_service.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_service.hpp
deleted file mode 100644
index c7f77b1..0000000
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/detail/reactive_socket_service.hpp
+++ /dev/null
@@ -1,457 +0,0 @@
-//
-// detail/reactive_socket_service.hpp
-// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_HPP
-#define ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/config.hpp"
-
-#if !defined(ASIO_HAS_IOCP)
-
-#include "asio/buffer.hpp"
-#include "asio/error.hpp"
-#include "asio/io_service.hpp"
-#include "asio/socket_base.hpp"
-#include "asio/detail/addressof.hpp"
-#include "asio/detail/buffer_sequence_adapter.hpp"
-#include "asio/detail/noncopyable.hpp"
-#include "asio/detail/reactive_null_buffers_op.hpp"
-#include "asio/detail/reactive_socket_accept_op.hpp"
-#include "asio/detail/reactive_socket_connect_op.hpp"
-#include "asio/detail/reactive_socket_recvfrom_op.hpp"
-#include "asio/detail/reactive_socket_sendto_op.hpp"
-#include "asio/detail/reactive_socket_service_base.hpp"
-#include "asio/detail/reactor.hpp"
-#include "asio/detail/reactor_op.hpp"
-#include "asio/detail/socket_holder.hpp"
-#include "asio/detail/socket_ops.hpp"
-#include "asio/detail/socket_types.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-namespace detail {
-
-template <typename Protocol>
-class reactive_socket_service :
- public reactive_socket_service_base
-{
-public:
- // The protocol type.
- typedef Protocol protocol_type;
-
- // The endpoint type.
- typedef typename Protocol::endpoint endpoint_type;
-
- // The native type of a socket.
- typedef socket_type native_handle_type;
-
- // The implementation type of the socket.
- struct implementation_type :
- reactive_socket_service_base::base_implementation_type
- {
- // Default constructor.
- implementation_type()
- : protocol_(endpoint_type().protocol())
- {
- }
-
- // The protocol associated with the socket.
- protocol_type protocol_;
- };
-
- // Constructor.
- reactive_socket_service(asio::io_service& io_service)
- : reactive_socket_service_base(io_service)
- {
- }
-
- // Move-construct a new socket implementation.
- void move_construct(implementation_type& impl,
- implementation_type& other_impl)
- {
- this->base_move_construct(impl, other_impl);
-
- impl.protocol_ = other_impl.protocol_;
- other_impl.protocol_ = endpoint_type().protocol();
- }
-
- // Move-assign from another socket implementation.
- void move_assign(implementation_type& impl,
- reactive_socket_service_base& other_service,
- implementation_type& other_impl)
- {
- this->base_move_assign(impl, other_service, other_impl);
-
- impl.protocol_ = other_impl.protocol_;
- other_impl.protocol_ = endpoint_type().protocol();
- }
-
- // Move-construct a new socket implementation from another protocol type.
- template <typename Protocol1>
- void converting_move_construct(implementation_type& impl,
- typename reactive_socket_service<
- Protocol1>::implementation_type& other_impl)
- {
- this->base_move_construct(impl, other_impl);
-
- impl.protocol_ = protocol_type(other_impl.protocol_);
- other_impl.protocol_ = typename Protocol1::endpoint().protocol();
- }
-
- // Open a new socket implementation.
- asio::error_code open(implementation_type& impl,
- const protocol_type& protocol, asio::error_code& ec)
- {
- if (!do_open(impl, protocol.family(),
- protocol.type(), protocol.protocol(), ec))
- impl.protocol_ = protocol;
- return ec;
- }
-
- // Assign a native socket to a socket implementation.
- asio::error_code assign(implementation_type& impl,
- const protocol_type& protocol, const native_handle_type& native_socket,
- asio::error_code& ec)
- {
- if (!do_assign(impl, protocol.type(), native_socket, ec))
- impl.protocol_ = protocol;
- return ec;
- }
-
- // Get the native socket representation.
- native_handle_type native_handle(implementation_type& impl)
- {
- return impl.socket_;
- }
-
- // Bind the socket to the specified local endpoint.
- asio::error_code bind(implementation_type& impl,
- const endpoint_type& endpoint, asio::error_code& ec)
- {
- socket_ops::bind(impl.socket_, endpoint.data(), endpoint.size(), ec);
- return ec;
- }
-
- // Set a socket option.
- template <typename Option>
- asio::error_code set_option(implementation_type& impl,
- const Option& option, asio::error_code& ec)
- {
- socket_ops::setsockopt(impl.socket_, impl.state_,
- option.level(impl.protocol_), option.name(impl.protocol_),
- option.data(impl.protocol_), option.size(impl.protocol_), ec);
- return ec;
- }
-
- // Set a socket option.
- template <typename Option>
- asio::error_code get_option(const implementation_type& impl,
- Option& option, asio::error_code& ec) const
- {
- std::size_t size = option.size(impl.protocol_);
- socket_ops::getsockopt(impl.socket_, impl.state_,
- option.level(impl.protocol_), option.name(impl.protocol_),
- option.data(impl.protocol_), &size, ec);
- if (!ec)
- option.resize(impl.protocol_, size);
- return ec;
- }
-
- // Get the local endpoint.
- endpoint_type local_endpoint(const implementation_type& impl,
- asio::error_code& ec) const
- {
- endpoint_type endpoint;
- std::size_t addr_len = endpoint.capacity();
- if (socket_ops::getsockname(impl.socket_, endpoint.data(), &addr_len, ec))
- return endpoint_type();
- endpoint.resize(addr_len);
- return endpoint;
- }
-
- // Get the remote endpoint.
- endpoint_type remote_endpoint(const implementation_type& impl,
- asio::error_code& ec) const
- {
- endpoint_type endpoint;
- std::size_t addr_len = endpoint.capacity();
- if (socket_ops::getpeername(impl.socket_,
- endpoint.data(), &addr_len, false, ec))
- return endpoint_type();
- endpoint.resize(addr_len);
- return endpoint;
- }
-
- // Send a datagram to the specified endpoint. Returns the number of bytes
- // sent.
- template <typename ConstBufferSequence>
- size_t send_to(implementation_type& impl, const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags,
- asio::error_code& ec)
- {
- buffer_sequence_adapter<asio::const_buffer,
- ConstBufferSequence> bufs(buffers);
-
- return socket_ops::sync_sendto(impl.socket_, impl.state_,
- bufs.buffers(), bufs.count(), flags,
- destination.data(), destination.size(), ec);
- }
-
- // Wait until data can be sent without blocking.
- size_t send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags,
- asio::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_write(impl.socket_, impl.state_, ec);
-
- return 0;
- }
-
- // Start an asynchronous send. The data being sent must be valid for the
- // lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
- void async_send_to(implementation_type& impl,
- const ConstBufferSequence& buffers,
- const endpoint_type& destination, socket_base::message_flags flags,
- Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_sendto_op<ConstBufferSequence,
- endpoint_type, Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler);
-
- ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, true, false);
- p.v = p.p = 0;
- }
-
- // Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
- void async_send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_send_to(null_buffers)"));
-
- start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Receive a datagram with the endpoint of the sender. Returns the number of
- // bytes received.
- template <typename MutableBufferSequence>
- size_t receive_from(implementation_type& impl,
- const MutableBufferSequence& buffers,
- endpoint_type& sender_endpoint, socket_base::message_flags flags,
- asio::error_code& ec)
- {
- buffer_sequence_adapter<asio::mutable_buffer,
- MutableBufferSequence> bufs(buffers);
-
- std::size_t addr_len = sender_endpoint.capacity();
- std::size_t bytes_recvd = socket_ops::sync_recvfrom(
- impl.socket_, impl.state_, bufs.buffers(), bufs.count(),
- flags, sender_endpoint.data(), &addr_len, ec);
-
- if (!ec)
- sender_endpoint.resize(addr_len);
-
- return bytes_recvd;
- }
-
- // Wait until data can be received without blocking.
- size_t receive_from(implementation_type& impl, const null_buffers&,
- endpoint_type& sender_endpoint, socket_base::message_flags,
- asio::error_code& ec)
- {
- // Wait for socket to become ready.
- socket_ops::poll_read(impl.socket_, impl.state_, ec);
-
- // Reset endpoint since it can be given no sensible value at this time.
- sender_endpoint = endpoint_type();
-
- return 0;
- }
-
- // Start an asynchronous receive. The buffer for the data being received and
- // the sender_endpoint object must both be valid for the lifetime of the
- // asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_receive_from(implementation_type& impl,
- const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_recvfrom_op<MutableBufferSequence,
- endpoint_type, Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- int protocol = impl.protocol_.type();
- p.p = new (p.v) op(impl.socket_, protocol,
- buffers, sender_endpoint, flags, handler);
-
- ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_receive_from"));
-
- start_op(impl,
- (flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation, true, false);
- p.v = p.p = 0;
- }
-
- // Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_from(implementation_type& impl,
- const null_buffers&, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(handler);
-
- ASIO_HANDLER_CREATION((p.p, "socket",
- &impl, "async_receive_from(null_buffers)"));
-
- // Reset endpoint since it can be given no sensible value at this time.
- sender_endpoint = endpoint_type();
-
- start_op(impl,
- (flags & socket_base::message_out_of_band)
- ? reactor::except_op : reactor::read_op,
- p.p, is_continuation, false, false);
- p.v = p.p = 0;
- }
-
- // Accept a new connection.
- template <typename Socket>
- asio::error_code accept(implementation_type& impl,
- Socket& peer, endpoint_type* peer_endpoint, asio::error_code& ec)
- {
- // We cannot accept a socket that is already open.
- if (peer.is_open())
- {
- ec = asio::error::already_open;
- return ec;
- }
-
- std::size_t addr_len = peer_endpoint ? peer_endpoint->capacity() : 0;
- socket_holder new_socket(socket_ops::sync_accept(impl.socket_,
- impl.state_, peer_endpoint ? peer_endpoint->data() : 0,
- peer_endpoint ? &addr_len : 0, ec));
-
- // On success, assign new connection to peer socket object.
- if (new_socket.get() != invalid_socket)
- {
- if (peer_endpoint)
- peer_endpoint->resize(addr_len);
- if (!peer.assign(impl.protocol_, new_socket.get(), ec))
- new_socket.release();
- }
-
- return ec;
- }
-
- // Start an asynchronous accept. The peer and peer_endpoint objects
- // must be valid until the accept's handler is invoked.
- template <typename Socket, typename Handler>
- void async_accept(implementation_type& impl, Socket& peer,
- endpoint_type* peer_endpoint, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_accept_op<Socket, Protocol, Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, impl.state_, peer,
- impl.protocol_, peer_endpoint, handler);
-
- ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept"));
-
- start_accept_op(impl, p.p, is_continuation, peer.is_open());
- p.v = p.p = 0;
- }
-
- // Connect the socket to the specified endpoint.
- asio::error_code connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, asio::error_code& ec)
- {
- socket_ops::sync_connect(impl.socket_,
- peer_endpoint.data(), peer_endpoint.size(), ec);
- return ec;
- }
-
- // Start an asynchronous connect.
- template <typename Handler>
- void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
- {
- bool is_continuation =
- asio_handler_cont_helpers::is_continuation(handler);
-
- // Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_connect_op<Handler> op;
- typename op::ptr p = { asio::detail::addressof(handler),
- asio_handler_alloc_helpers::allocate(
- sizeof(op), handler), 0 };
- p.p = new (p.v) op(impl.socket_, handler);
-
- ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect"));
-
- start_connect_op(impl, p.p, is_continuation,
- peer_endpoint.data(), peer_endpoint.size());
- p.v = p.p = 0;
- }
-};
-
-} // namespace detail
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // !defined(ASIO_HAS_IOCP)
-
-#endif // ASIO_DETAIL_REACTIVE_SOCKET_SERVICE_HPP