hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject [26/50] [abbrv] hadoop git commit: HDFS-8724. Import third_party libraries into the repository.
Date Sat, 11 Jul 2015 00:07:49 GMT
http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/buffered_write_stream.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/buffered_write_stream.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/buffered_write_stream.hpp
new file mode 100644
index 0000000..1e51c11
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/buffered_write_stream.hpp
@@ -0,0 +1,338 @@
+//
+// impl/buffered_write_stream.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_IMPL_BUFFERED_WRITE_STREAM_HPP
+#define ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/handler_alloc_helpers.hpp"
+#include "asio/detail/handler_cont_helpers.hpp"
+#include "asio/detail/handler_invoke_helpers.hpp"
+#include "asio/detail/handler_type_requirements.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+template <typename Stream>
+std::size_t buffered_write_stream<Stream>::flush()
+{
+  std::size_t bytes_written = write(next_layer_,
+      buffer(storage_.data(), storage_.size()));
+  storage_.consume(bytes_written);
+  return bytes_written;
+}
+
+template <typename Stream>
+std::size_t buffered_write_stream<Stream>::flush(asio::error_code& ec)
+{
+  std::size_t bytes_written = write(next_layer_,
+      buffer(storage_.data(), storage_.size()),
+      transfer_all(), ec);
+  storage_.consume(bytes_written);
+  return bytes_written;
+}
+
+namespace detail
+{
+  template <typename WriteHandler>
+  class buffered_flush_handler
+  {
+  public:
+    buffered_flush_handler(detail::buffered_stream_storage& storage,
+        WriteHandler& handler)
+      : storage_(storage),
+        handler_(handler)
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    buffered_flush_handler(const buffered_flush_handler& other)
+      : storage_(other.storage_),
+        handler_(other.handler_)
+    {
+    }
+
+    buffered_flush_handler(buffered_flush_handler&& other)
+      : storage_(other.storage_),
+        handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec,
+        const std::size_t bytes_written)
+    {
+      storage_.consume(bytes_written);
+      handler_(ec, bytes_written);
+    }
+
+  //private:
+    detail::buffered_stream_storage& storage_;
+    WriteHandler handler_;
+  };
+
+  template <typename WriteHandler>
+  inline void* asio_handler_allocate(std::size_t size,
+      buffered_flush_handler<WriteHandler>* this_handler)
+  {
+    return asio_handler_alloc_helpers::allocate(
+        size, this_handler->handler_);
+  }
+
+  template <typename WriteHandler>
+  inline void asio_handler_deallocate(void* pointer, std::size_t size,
+      buffered_flush_handler<WriteHandler>* this_handler)
+  {
+    asio_handler_alloc_helpers::deallocate(
+        pointer, size, this_handler->handler_);
+  }
+
+  template <typename WriteHandler>
+  inline bool asio_handler_is_continuation(
+      buffered_flush_handler<WriteHandler>* this_handler)
+  {
+    return asio_handler_cont_helpers::is_continuation(
+          this_handler->handler_);
+  }
+
+  template <typename Function, typename WriteHandler>
+  inline void asio_handler_invoke(Function& function,
+      buffered_flush_handler<WriteHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+
+  template <typename Function, typename WriteHandler>
+  inline void asio_handler_invoke(const Function& function,
+      buffered_flush_handler<WriteHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+}
+
+template <typename Stream>
+template <typename WriteHandler>
+ASIO_INITFN_RESULT_TYPE(WriteHandler,
+    void (asio::error_code, std::size_t))
+buffered_write_stream<Stream>::async_flush(
+    ASIO_MOVE_ARG(WriteHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a WriteHandler.
+  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+  detail::async_result_init<
+    WriteHandler, void (asio::error_code, std::size_t)> init(
+      ASIO_MOVE_CAST(WriteHandler)(handler));
+
+  async_write(next_layer_, buffer(storage_.data(), storage_.size()),
+      detail::buffered_flush_handler<ASIO_HANDLER_TYPE(
+        WriteHandler, void (asio::error_code, std::size_t))>(
+        storage_, init.handler));
+
+  return init.result.get();
+}
+
+template <typename Stream>
+template <typename ConstBufferSequence>
+std::size_t buffered_write_stream<Stream>::write_some(
+    const ConstBufferSequence& buffers)
+{
+  if (asio::buffer_size(buffers) == 0)
+    return 0;
+
+  if (storage_.size() == storage_.capacity())
+    this->flush();
+
+  return this->copy(buffers);
+}
+
+template <typename Stream>
+template <typename ConstBufferSequence>
+std::size_t buffered_write_stream<Stream>::write_some(
+    const ConstBufferSequence& buffers, asio::error_code& ec)
+{
+  ec = asio::error_code();
+
+  if (asio::buffer_size(buffers) == 0)
+    return 0;
+
+  if (storage_.size() == storage_.capacity() && !flush(ec))
+    return 0;
+
+  return this->copy(buffers);
+}
+
+namespace detail
+{
+  template <typename ConstBufferSequence, typename WriteHandler>
+  class buffered_write_some_handler
+  {
+  public:
+    buffered_write_some_handler(detail::buffered_stream_storage& storage,
+        const ConstBufferSequence& buffers, WriteHandler& handler)
+      : storage_(storage),
+        buffers_(buffers),
+        handler_(handler)
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+      buffered_write_some_handler(const buffered_write_some_handler& other)
+        : storage_(other.storage_),
+          buffers_(other.buffers_),
+          handler_(other.handler_)
+      {
+      }
+
+      buffered_write_some_handler(buffered_write_some_handler&& other)
+        : storage_(other.storage_),
+          buffers_(other.buffers_),
+          handler_(ASIO_MOVE_CAST(WriteHandler)(other.handler_))
+      {
+      }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec, std::size_t)
+    {
+      if (ec)
+      {
+        const std::size_t length = 0;
+        handler_(ec, length);
+      }
+      else
+      {
+        std::size_t orig_size = storage_.size();
+        std::size_t space_avail = storage_.capacity() - orig_size;
+        std::size_t bytes_avail = asio::buffer_size(buffers_);
+        std::size_t length = bytes_avail < space_avail
+          ? bytes_avail : space_avail;
+        storage_.resize(orig_size + length);
+        const std::size_t bytes_copied = asio::buffer_copy(
+            storage_.data() + orig_size, buffers_, length);
+        handler_(ec, bytes_copied);
+      }
+    }
+
+  //private:
+    detail::buffered_stream_storage& storage_;
+    ConstBufferSequence buffers_;
+    WriteHandler handler_;
+  };
+
+  template <typename ConstBufferSequence, typename WriteHandler>
+  inline void* asio_handler_allocate(std::size_t size,
+      buffered_write_some_handler<
+        ConstBufferSequence, WriteHandler>* this_handler)
+  {
+    return asio_handler_alloc_helpers::allocate(
+        size, this_handler->handler_);
+  }
+
+  template <typename ConstBufferSequence, typename WriteHandler>
+  inline void asio_handler_deallocate(void* pointer, std::size_t size,
+      buffered_write_some_handler<
+        ConstBufferSequence, WriteHandler>* this_handler)
+  {
+    asio_handler_alloc_helpers::deallocate(
+        pointer, size, this_handler->handler_);
+  }
+
+  template <typename ConstBufferSequence, typename WriteHandler>
+  inline bool asio_handler_is_continuation(
+      buffered_write_some_handler<
+        ConstBufferSequence, WriteHandler>* this_handler)
+  {
+    return asio_handler_cont_helpers::is_continuation(
+          this_handler->handler_);
+  }
+
+  template <typename Function, typename ConstBufferSequence,
+      typename WriteHandler>
+  inline void asio_handler_invoke(Function& function,
+      buffered_write_some_handler<
+        ConstBufferSequence, WriteHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+
+  template <typename Function, typename ConstBufferSequence,
+      typename WriteHandler>
+  inline void asio_handler_invoke(const Function& function,
+      buffered_write_some_handler<
+        ConstBufferSequence, WriteHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+} // namespace detail
+
+template <typename Stream>
+template <typename ConstBufferSequence, typename WriteHandler>
+ASIO_INITFN_RESULT_TYPE(WriteHandler,
+    void (asio::error_code, std::size_t))
+buffered_write_stream<Stream>::async_write_some(
+    const ConstBufferSequence& buffers,
+    ASIO_MOVE_ARG(WriteHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a WriteHandler.
+  ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check;
+
+  detail::async_result_init<
+    WriteHandler, void (asio::error_code, std::size_t)> init(
+      ASIO_MOVE_CAST(WriteHandler)(handler));
+
+  if (asio::buffer_size(buffers) == 0
+      || storage_.size() < storage_.capacity())
+  {
+    next_layer_.async_write_some(asio::const_buffers_1(0, 0),
+        detail::buffered_write_some_handler<
+          ConstBufferSequence, ASIO_HANDLER_TYPE(
+            WriteHandler, void (asio::error_code, std::size_t))>(
+            storage_, buffers, init.handler));
+  }
+  else
+  {
+    this->async_flush(detail::buffered_write_some_handler<
+          ConstBufferSequence, ASIO_HANDLER_TYPE(
+            WriteHandler, void (asio::error_code, std::size_t))>(
+            storage_, buffers, init.handler));
+  }
+
+  return init.result.get();
+}
+
+template <typename Stream>
+template <typename ConstBufferSequence>
+std::size_t buffered_write_stream<Stream>::copy(
+    const ConstBufferSequence& buffers)
+{
+  std::size_t orig_size = storage_.size();
+  std::size_t space_avail = storage_.capacity() - orig_size;
+  std::size_t bytes_avail = asio::buffer_size(buffers);
+  std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail;
+  storage_.resize(orig_size + length);
+  return asio::buffer_copy(
+      storage_.data() + orig_size, buffers, length);
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_BUFFERED_WRITE_STREAM_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/connect.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/connect.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/connect.hpp
new file mode 100644
index 0000000..523e551
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/connect.hpp
@@ -0,0 +1,428 @@
+//
+// impl/connect.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_IMPL_CONNECT_HPP
+#define ASIO_IMPL_CONNECT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/bind_handler.hpp"
+#include "asio/detail/consuming_buffers.hpp"
+#include "asio/detail/handler_alloc_helpers.hpp"
+#include "asio/detail/handler_cont_helpers.hpp"
+#include "asio/detail/handler_invoke_helpers.hpp"
+#include "asio/detail/handler_type_requirements.hpp"
+#include "asio/detail/throw_error.hpp"
+#include "asio/error.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+namespace detail
+{
+  struct default_connect_condition
+  {
+    template <typename Iterator>
+    Iterator operator()(const asio::error_code&, Iterator next)
+    {
+      return next;
+    }
+  };
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin)
+{
+  asio::error_code ec;
+  Iterator result = connect(s, begin, ec);
+  asio::detail::throw_error(ec, "connect");
+  return result;
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+inline Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, asio::error_code& ec)
+{
+  return connect(s, begin, Iterator(), detail::default_connect_condition(), ec);
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, Iterator end)
+{
+  asio::error_code ec;
+  Iterator result = connect(s, begin, end, ec);
+  asio::detail::throw_error(ec, "connect");
+  return result;
+}
+
+template <typename Protocol, typename SocketService, typename Iterator>
+inline Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, Iterator end, asio::error_code& ec)
+{
+  return connect(s, begin, end, detail::default_connect_condition(), ec);
+}
+
+template <typename Protocol, typename SocketService,
+    typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, ConnectCondition connect_condition)
+{
+  asio::error_code ec;
+  Iterator result = connect(s, begin, connect_condition, ec);
+  asio::detail::throw_error(ec, "connect");
+  return result;
+}
+
+template <typename Protocol, typename SocketService,
+    typename Iterator, typename ConnectCondition>
+inline Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, ConnectCondition connect_condition,
+    asio::error_code& ec)
+{
+  return connect(s, begin, Iterator(), connect_condition, ec);
+}
+
+template <typename Protocol, typename SocketService,
+    typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, Iterator end, ConnectCondition connect_condition)
+{
+  asio::error_code ec;
+  Iterator result = connect(s, begin, end, connect_condition, ec);
+  asio::detail::throw_error(ec, "connect");
+  return result;
+}
+
+template <typename Protocol, typename SocketService,
+    typename Iterator, typename ConnectCondition>
+Iterator connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, Iterator end, ConnectCondition connect_condition,
+    asio::error_code& ec)
+{
+  ec = asio::error_code();
+
+  for (Iterator iter = begin; iter != end; ++iter)
+  {
+    iter = connect_condition(ec, iter);
+    if (iter != end)
+    {
+      s.close(ec);
+      s.connect(*iter, ec);
+      if (!ec)
+        return iter;
+    }
+  }
+
+  if (!ec)
+    ec = asio::error::not_found;
+
+  return end;
+}
+
+namespace detail
+{
+  // Enable the empty base class optimisation for the connect condition.
+  template <typename ConnectCondition>
+  class base_from_connect_condition
+  {
+  protected:
+    explicit base_from_connect_condition(
+        const ConnectCondition& connect_condition)
+      : connect_condition_(connect_condition)
+    {
+    }
+
+    template <typename Iterator>
+    void check_condition(const asio::error_code& ec,
+        Iterator& iter, Iterator& end)
+    {
+      if (iter != end)
+        iter = connect_condition_(ec, static_cast<const Iterator&>(iter));
+    }
+
+  private:
+    ConnectCondition connect_condition_;
+  };
+
+  // The default_connect_condition implementation is essentially a no-op. This
+  // template specialisation lets us eliminate all costs associated with it.
+  template <>
+  class base_from_connect_condition<default_connect_condition>
+  {
+  protected:
+    explicit base_from_connect_condition(const default_connect_condition&)
+    {
+    }
+
+    template <typename Iterator>
+    void check_condition(const asio::error_code&, Iterator&, Iterator&)
+    {
+    }
+  };
+
+  template <typename Protocol, typename SocketService, typename Iterator,
+      typename ConnectCondition, typename ComposedConnectHandler>
+  class connect_op : base_from_connect_condition<ConnectCondition>
+  {
+  public:
+    connect_op(basic_socket<Protocol, SocketService>& sock,
+        const Iterator& begin, const Iterator& end,
+        const ConnectCondition& connect_condition,
+        ComposedConnectHandler& handler)
+      : base_from_connect_condition<ConnectCondition>(connect_condition),
+        socket_(sock),
+        iter_(begin),
+        end_(end),
+        start_(0),
+        handler_(ASIO_MOVE_CAST(ComposedConnectHandler)(handler))
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    connect_op(const connect_op& other)
+      : base_from_connect_condition<ConnectCondition>(other),
+        socket_(other.socket_),
+        iter_(other.iter_),
+        end_(other.end_),
+        start_(other.start_),
+        handler_(other.handler_)
+    {
+    }
+
+    connect_op(connect_op&& other)
+      : base_from_connect_condition<ConnectCondition>(other),
+        socket_(other.socket_),
+        iter_(other.iter_),
+        end_(other.end_),
+        start_(other.start_),
+        handler_(ASIO_MOVE_CAST(ComposedConnectHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(asio::error_code ec, int start = 0)
+    {
+      switch (start_ = start)
+      {
+        case 1:
+        for (;;)
+        {
+          this->check_condition(ec, iter_, end_);
+
+          if (iter_ != end_)
+          {
+            socket_.close(ec);
+            socket_.async_connect(*iter_,
+                ASIO_MOVE_CAST(connect_op)(*this));
+            return;
+          }
+
+          if (start)
+          {
+            ec = asio::error::not_found;
+            socket_.get_io_service().post(detail::bind_handler(*this, ec));
+            return;
+          }
+
+          default:
+
+          if (iter_ == end_)
+            break;
+
+          if (!socket_.is_open())
+          {
+            ec = asio::error::operation_aborted;
+            break;
+          }
+
+          if (!ec)
+            break;
+
+          ++iter_;
+        }
+
+        handler_(static_cast<const asio::error_code&>(ec),
+            static_cast<const Iterator&>(iter_));
+      }
+    }
+
+  //private:
+    basic_socket<Protocol, SocketService>& socket_;
+    Iterator iter_;
+    Iterator end_;
+    int start_;
+    ComposedConnectHandler handler_;
+  };
+
+  template <typename Protocol, typename SocketService, typename Iterator,
+      typename ConnectCondition, typename ComposedConnectHandler>
+  inline void* asio_handler_allocate(std::size_t size,
+      connect_op<Protocol, SocketService, Iterator,
+        ConnectCondition, ComposedConnectHandler>* this_handler)
+  {
+    return asio_handler_alloc_helpers::allocate(
+        size, this_handler->handler_);
+  }
+
+  template <typename Protocol, typename SocketService, typename Iterator,
+      typename ConnectCondition, typename ComposedConnectHandler>
+  inline void asio_handler_deallocate(void* pointer, std::size_t size,
+      connect_op<Protocol, SocketService, Iterator,
+        ConnectCondition, ComposedConnectHandler>* this_handler)
+  {
+    asio_handler_alloc_helpers::deallocate(
+        pointer, size, this_handler->handler_);
+  }
+
+  template <typename Protocol, typename SocketService, typename Iterator,
+      typename ConnectCondition, typename ComposedConnectHandler>
+  inline bool asio_handler_is_continuation(
+      connect_op<Protocol, SocketService, Iterator,
+        ConnectCondition, ComposedConnectHandler>* this_handler)
+  {
+    return asio_handler_cont_helpers::is_continuation(
+        this_handler->handler_);
+  }
+
+  template <typename Function, typename Protocol,
+      typename SocketService, typename Iterator,
+      typename ConnectCondition, typename ComposedConnectHandler>
+  inline void asio_handler_invoke(Function& function,
+      connect_op<Protocol, SocketService, Iterator,
+        ConnectCondition, ComposedConnectHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+
+  template <typename Function, typename Protocol,
+      typename SocketService, typename Iterator,
+      typename ConnectCondition, typename ComposedConnectHandler>
+  inline void asio_handler_invoke(const Function& function,
+      connect_op<Protocol, SocketService, Iterator,
+        ConnectCondition, ComposedConnectHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+} // namespace detail
+
+template <typename Protocol, typename SocketService,
+    typename Iterator, typename ComposedConnectHandler>
+inline ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+    void (asio::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ComposedConnectHandler.
+  ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+      ComposedConnectHandler, handler, Iterator) type_check;
+
+  detail::async_result_init<ComposedConnectHandler,
+    void (asio::error_code, Iterator)> init(
+      ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+  detail::connect_op<Protocol, SocketService, Iterator,
+    detail::default_connect_condition, ASIO_HANDLER_TYPE(
+      ComposedConnectHandler, void (asio::error_code, Iterator))>(s,
+        begin, Iterator(), detail::default_connect_condition(), init.handler)(
+          asio::error_code(), 1);
+
+  return init.result.get();
+}
+
+template <typename Protocol, typename SocketService,
+    typename Iterator, typename ComposedConnectHandler>
+inline ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+    void (asio::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, Iterator end,
+    ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ComposedConnectHandler.
+  ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+      ComposedConnectHandler, handler, Iterator) type_check;
+
+  detail::async_result_init<ComposedConnectHandler,
+    void (asio::error_code, Iterator)> init(
+      ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+  detail::connect_op<Protocol, SocketService, Iterator,
+    detail::default_connect_condition, ASIO_HANDLER_TYPE(
+      ComposedConnectHandler, void (asio::error_code, Iterator))>(s,
+        begin, end, detail::default_connect_condition(), init.handler)(
+          asio::error_code(), 1);
+
+  return init.result.get();
+}
+
+template <typename Protocol, typename SocketService, typename Iterator,
+    typename ConnectCondition, typename ComposedConnectHandler>
+inline ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+    void (asio::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, ConnectCondition connect_condition,
+    ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ComposedConnectHandler.
+  ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+      ComposedConnectHandler, handler, Iterator) type_check;
+
+  detail::async_result_init<ComposedConnectHandler,
+    void (asio::error_code, Iterator)> init(
+      ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+  detail::connect_op<Protocol, SocketService, Iterator,
+    ConnectCondition, ASIO_HANDLER_TYPE(
+      ComposedConnectHandler, void (asio::error_code, Iterator))>(s,
+        begin, Iterator(), connect_condition, init.handler)(
+          asio::error_code(), 1);
+
+  return init.result.get();
+}
+
+template <typename Protocol, typename SocketService, typename Iterator,
+    typename ConnectCondition, typename ComposedConnectHandler>
+inline ASIO_INITFN_RESULT_TYPE(ComposedConnectHandler,
+    void (asio::error_code, Iterator))
+async_connect(basic_socket<Protocol, SocketService>& s,
+    Iterator begin, Iterator end, ConnectCondition connect_condition,
+    ASIO_MOVE_ARG(ComposedConnectHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ComposedConnectHandler.
+  ASIO_COMPOSED_CONNECT_HANDLER_CHECK(
+      ComposedConnectHandler, handler, Iterator) type_check;
+
+  detail::async_result_init<ComposedConnectHandler,
+    void (asio::error_code, Iterator)> init(
+      ASIO_MOVE_CAST(ComposedConnectHandler)(handler));
+
+  detail::connect_op<Protocol, SocketService, Iterator,
+    ConnectCondition, ASIO_HANDLER_TYPE(
+      ComposedConnectHandler, void (asio::error_code, Iterator))>(s,
+        begin, end, connect_condition, init.handler)(
+          asio::error_code(), 1);
+
+  return init.result.get();
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_CONNECT_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error.ipp
new file mode 100644
index 0000000..7c5a414
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error.ipp
@@ -0,0 +1,128 @@
+//
+// impl/error.ipp
+// ~~~~~~~~~~~~~~
+//
+// 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_IMPL_ERROR_IPP
+#define ASIO_IMPL_ERROR_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include <string>
+#include "asio/error.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace error {
+
+#if !defined(ASIO_WINDOWS) && !defined(__CYGWIN__)
+
+namespace detail {
+
+class netdb_category : public asio::error_category
+{
+public:
+  const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
+  {
+    return "asio.netdb";
+  }
+
+  std::string message(int value) const
+  {
+    if (value == error::host_not_found)
+      return "Host not found (authoritative)";
+    if (value == error::host_not_found_try_again)
+      return "Host not found (non-authoritative), try again later";
+    if (value == error::no_data)
+      return "The query is valid, but it does not have associated data";
+    if (value == error::no_recovery)
+      return "A non-recoverable error occurred during database lookup";
+    return "asio.netdb error";
+  }
+};
+
+} // namespace detail
+
+const asio::error_category& get_netdb_category()
+{
+  static detail::netdb_category instance;
+  return instance;
+}
+
+namespace detail {
+
+class addrinfo_category : public asio::error_category
+{
+public:
+  const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
+  {
+    return "asio.addrinfo";
+  }
+
+  std::string message(int value) const
+  {
+    if (value == error::service_not_found)
+      return "Service not found";
+    if (value == error::socket_type_not_supported)
+      return "Socket type not supported";
+    return "asio.addrinfo error";
+  }
+};
+
+} // namespace detail
+
+const asio::error_category& get_addrinfo_category()
+{
+  static detail::addrinfo_category instance;
+  return instance;
+}
+
+#endif // !defined(ASIO_WINDOWS) && !defined(__CYGWIN__)
+
+namespace detail {
+
+class misc_category : public asio::error_category
+{
+public:
+  const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
+  {
+    return "asio.misc";
+  }
+
+  std::string message(int value) const
+  {
+    if (value == error::already_open)
+      return "Already open";
+    if (value == error::eof)
+      return "End of file";
+    if (value == error::not_found)
+      return "Element not found";
+    if (value == error::fd_set_failure)
+      return "The descriptor does not fit into the select call's fd_set";
+    return "asio.misc error";
+  }
+};
+
+} // namespace detail
+
+const asio::error_category& get_misc_category()
+{
+  static detail::misc_category instance;
+  return instance;
+}
+
+} // namespace error
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_ERROR_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error_code.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error_code.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error_code.ipp
new file mode 100644
index 0000000..ec0536e
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/error_code.ipp
@@ -0,0 +1,128 @@
+//
+// impl/error_code.ipp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// 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_IMPL_ERROR_CODE_IPP
+#define ASIO_IMPL_ERROR_CODE_IPP
+
+#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(__CYGWIN__)
+# include <winerror.h>
+#elif defined(ASIO_WINDOWS_RUNTIME)
+# include <windows.h>
+#else
+# include <cerrno>
+# include <cstring>
+# include <string>
+#endif
+#include "asio/detail/local_free_on_block_exit.hpp"
+#include "asio/detail/socket_types.hpp"
+#include "asio/error_code.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace detail {
+
+class system_category : public error_category
+{
+public:
+  const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
+  {
+    return "asio.system";
+  }
+
+  std::string message(int value) const
+  {
+#if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
+    char* msg = 0;
+    DWORD length = ::FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
+        | FORMAT_MESSAGE_FROM_SYSTEM
+        | FORMAT_MESSAGE_IGNORE_INSERTS, 0, value,
+        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (char*)&msg, 0, 0);
+    detail::local_free_on_block_exit local_free_obj(msg);
+    if (length && msg[length - 1] == '\n')
+      msg[--length] = '\0';
+    if (length && msg[length - 1] == '\r')
+      msg[--length] = '\0';
+    if (length)
+      return msg;
+    else
+      return "asio.system error";
+#elif defined(ASIO_WINDOWS_RUNTIME)
+    std::wstring wmsg(128, wchar_t());
+    for (;;)
+    {
+      DWORD wlength = ::FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM
+          | FORMAT_MESSAGE_IGNORE_INSERTS, 0, value,
+          MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), &wmsg[0], wmsg.size(), 0);
+      if (wlength == 0 && ::GetLastError() == ERROR_INSUFFICIENT_BUFFER)
+      {
+        wmsg.resize(wmsg.size() + wmsg.size() / 2);
+        continue;
+      }
+      if (wlength && wmsg[wlength - 1] == '\n')
+        --wlength;
+      if (wlength && wmsg[wlength - 1] == '\r')
+        --wlength;
+      if (wlength)
+      {
+        std::string msg(wlength * 2, char());
+        int length = ::WideCharToMultiByte(CP_ACP, 0,
+            wmsg.c_str(), static_cast<int>(wlength),
+            &msg[0], static_cast<int>(wlength * 2), 0, 0);
+        if (length <= 0)
+          return "asio.system error";
+        msg.resize(static_cast<std::size_t>(length));
+        return msg;
+      }
+      else
+        return "asio.system error";
+    }
+#else // defined(ASIO_WINDOWS)
+#if !defined(__sun)
+    if (value == ECANCELED)
+      return "Operation aborted.";
+#endif // !defined(__sun)
+#if defined(__sun) || defined(__QNX__) || defined(__SYMBIAN32__)
+    using namespace std;
+    return strerror(value);
+#elif defined(__MACH__) && defined(__APPLE__) \
+  || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) \
+  || defined(_AIX) || defined(__hpux) || defined(__osf__) \
+  || defined(__ANDROID__)
+    char buf[256] = "";
+    using namespace std;
+    strerror_r(value, buf, sizeof(buf));
+    return buf;
+#else
+    char buf[256] = "";
+    return strerror_r(value, buf, sizeof(buf));
+#endif
+#endif // defined(ASIO_WINDOWS)
+  }
+};
+
+} // namespace detail
+
+const error_category& system_category()
+{
+  static detail::system_category instance;
+  return instance;
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_ERROR_CODE_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/handler_alloc_hook.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/handler_alloc_hook.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/handler_alloc_hook.ipp
new file mode 100644
index 0000000..8691ef5
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/handler_alloc_hook.ipp
@@ -0,0 +1,77 @@
+//
+// impl/handler_alloc_hook.ipp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// 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_IMPL_HANDLER_ALLOC_HOOK_IPP
+#define ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include "asio/detail/call_stack.hpp"
+#include "asio/handler_alloc_hook.hpp"
+
+#if !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+# if defined(ASIO_HAS_IOCP)
+#  include "asio/detail/win_iocp_thread_info.hpp"
+# else // defined(ASIO_HAS_IOCP)
+#  include "asio/detail/task_io_service_thread_info.hpp"
+# endif // defined(ASIO_HAS_IOCP)
+#endif // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+#if defined(ASIO_HAS_IOCP)
+namespace detail { class win_iocp_io_service; }
+#endif // defined(ASIO_HAS_IOCP)
+
+void* asio_handler_allocate(std::size_t size, ...)
+{
+#if !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+# if defined(ASIO_HAS_IOCP)
+  typedef detail::win_iocp_io_service io_service_impl;
+  typedef detail::win_iocp_thread_info thread_info;
+# else // defined(ASIO_HAS_IOCP)
+  typedef detail::task_io_service io_service_impl;
+  typedef detail::task_io_service_thread_info thread_info;
+# endif // defined(ASIO_HAS_IOCP)
+  typedef detail::call_stack<io_service_impl, thread_info> call_stack;
+  return thread_info::allocate(call_stack::top(), size);
+#else // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+  return ::operator new(size);
+#endif // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+}
+
+void asio_handler_deallocate(void* pointer, std::size_t size, ...)
+{
+#if !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+# if defined(ASIO_HAS_IOCP)
+  typedef detail::win_iocp_io_service io_service_impl;
+  typedef detail::win_iocp_thread_info thread_info;
+# else // defined(ASIO_HAS_IOCP)
+  typedef detail::task_io_service io_service_impl;
+  typedef detail::task_io_service_thread_info thread_info;
+# endif // defined(ASIO_HAS_IOCP)
+  typedef detail::call_stack<io_service_impl, thread_info> call_stack;
+  thread_info::deallocate(call_stack::top(), pointer, size);
+#else // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+  (void)size;
+  ::operator delete(pointer);
+#endif // !defined(ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.hpp
new file mode 100644
index 0000000..6e590ac
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.hpp
@@ -0,0 +1,152 @@
+//
+// impl/io_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_IMPL_IO_SERVICE_HPP
+#define ASIO_IMPL_IO_SERVICE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/handler_type_requirements.hpp"
+#include "asio/detail/service_registry.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+template <typename Service>
+inline Service& use_service(io_service& ios)
+{
+  // Check that Service meets the necessary type requirements.
+  (void)static_cast<io_service::service*>(static_cast<Service*>(0));
+  (void)static_cast<const io_service::id*>(&Service::id);
+
+  return ios.service_registry_->template use_service<Service>();
+}
+
+template <>
+inline detail::io_service_impl& use_service<detail::io_service_impl>(
+    io_service& ios)
+{
+  return ios.impl_;
+}
+
+template <typename Service>
+inline void add_service(io_service& ios, Service* svc)
+{
+  // Check that Service meets the necessary type requirements.
+  (void)static_cast<io_service::service*>(static_cast<Service*>(0));
+  (void)static_cast<const io_service::id*>(&Service::id);
+
+  ios.service_registry_->template add_service<Service>(svc);
+}
+
+template <typename Service>
+inline bool has_service(io_service& ios)
+{
+  // Check that Service meets the necessary type requirements.
+  (void)static_cast<io_service::service*>(static_cast<Service*>(0));
+  (void)static_cast<const io_service::id*>(&Service::id);
+
+  return ios.service_registry_->template has_service<Service>();
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#if defined(ASIO_HAS_IOCP)
+# include "asio/detail/win_iocp_io_service.hpp"
+#else
+# include "asio/detail/task_io_service.hpp"
+#endif
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+template <typename CompletionHandler>
+inline ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ())
+io_service::dispatch(ASIO_MOVE_ARG(CompletionHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a CompletionHandler.
+  ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
+
+  detail::async_result_init<
+    CompletionHandler, void ()> init(
+      ASIO_MOVE_CAST(CompletionHandler)(handler));
+
+  impl_.dispatch(init.handler);
+
+  return init.result.get();
+}
+
+template <typename CompletionHandler>
+inline ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ())
+io_service::post(ASIO_MOVE_ARG(CompletionHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a CompletionHandler.
+  ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check;
+
+  detail::async_result_init<
+    CompletionHandler, void ()> init(
+      ASIO_MOVE_CAST(CompletionHandler)(handler));
+
+  impl_.post(init.handler);
+
+  return init.result.get();
+}
+
+template <typename Handler>
+#if defined(GENERATING_DOCUMENTATION)
+unspecified
+#else
+inline detail::wrapped_handler<io_service&, Handler>
+#endif
+io_service::wrap(Handler handler)
+{
+  return detail::wrapped_handler<io_service&, Handler>(*this, handler);
+}
+
+inline io_service::work::work(asio::io_service& io_service)
+  : io_service_impl_(io_service.impl_)
+{
+  io_service_impl_.work_started();
+}
+
+inline io_service::work::work(const work& other)
+  : io_service_impl_(other.io_service_impl_)
+{
+  io_service_impl_.work_started();
+}
+
+inline io_service::work::~work()
+{
+  io_service_impl_.work_finished();
+}
+
+inline asio::io_service& io_service::work::get_io_service()
+{
+  return io_service_impl_.get_io_service();
+}
+
+inline asio::io_service& io_service::service::get_io_service()
+{
+  return owner_;
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_IO_SERVICE_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.ipp
new file mode 100644
index 0000000..4844ef3
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/io_service.ipp
@@ -0,0 +1,155 @@
+//
+// impl/io_service.ipp
+// ~~~~~~~~~~~~~~~~~~~
+//
+// 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_IMPL_IO_SERVICE_IPP
+#define ASIO_IMPL_IO_SERVICE_IPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include "asio/io_service.hpp"
+#include "asio/detail/limits.hpp"
+#include "asio/detail/scoped_ptr.hpp"
+#include "asio/detail/service_registry.hpp"
+#include "asio/detail/throw_error.hpp"
+
+#if defined(ASIO_HAS_IOCP)
+# include "asio/detail/win_iocp_io_service.hpp"
+#else
+# include "asio/detail/task_io_service.hpp"
+#endif
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+io_service::io_service()
+  : service_registry_(new asio::detail::service_registry(
+        *this, static_cast<impl_type*>(0),
+        (std::numeric_limits<std::size_t>::max)())),
+    impl_(service_registry_->first_service<impl_type>())
+{
+}
+
+io_service::io_service(std::size_t concurrency_hint)
+  : service_registry_(new asio::detail::service_registry(
+        *this, static_cast<impl_type*>(0), concurrency_hint)),
+    impl_(service_registry_->first_service<impl_type>())
+{
+}
+
+io_service::~io_service()
+{
+  delete service_registry_;
+}
+
+std::size_t io_service::run()
+{
+  asio::error_code ec;
+  std::size_t s = impl_.run(ec);
+  asio::detail::throw_error(ec);
+  return s;
+}
+
+std::size_t io_service::run(asio::error_code& ec)
+{
+  return impl_.run(ec);
+}
+
+std::size_t io_service::run_one()
+{
+  asio::error_code ec;
+  std::size_t s = impl_.run_one(ec);
+  asio::detail::throw_error(ec);
+  return s;
+}
+
+std::size_t io_service::run_one(asio::error_code& ec)
+{
+  return impl_.run_one(ec);
+}
+
+std::size_t io_service::poll()
+{
+  asio::error_code ec;
+  std::size_t s = impl_.poll(ec);
+  asio::detail::throw_error(ec);
+  return s;
+}
+
+std::size_t io_service::poll(asio::error_code& ec)
+{
+  return impl_.poll(ec);
+}
+
+std::size_t io_service::poll_one()
+{
+  asio::error_code ec;
+  std::size_t s = impl_.poll_one(ec);
+  asio::detail::throw_error(ec);
+  return s;
+}
+
+std::size_t io_service::poll_one(asio::error_code& ec)
+{
+  return impl_.poll_one(ec);
+}
+
+void io_service::stop()
+{
+  impl_.stop();
+}
+
+bool io_service::stopped() const
+{
+  return impl_.stopped();
+}
+
+void io_service::reset()
+{
+  impl_.reset();
+}
+
+void io_service::notify_fork(asio::io_service::fork_event event)
+{
+  service_registry_->notify_fork(event);
+}
+
+io_service::service::service(asio::io_service& owner)
+  : owner_(owner),
+    next_(0)
+{
+}
+
+io_service::service::~service()
+{
+}
+
+void io_service::service::fork_service(asio::io_service::fork_event)
+{
+}
+
+service_already_exists::service_already_exists()
+  : std::logic_error("Service already exists.")
+{
+}
+
+invalid_service_owner::invalid_service_owner()
+  : std::logic_error("Invalid service owner.")
+{
+}
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_IO_SERVICE_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f03d4a5/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/read.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/read.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/read.hpp
new file mode 100644
index 0000000..63fba77
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/impl/read.hpp
@@ -0,0 +1,753 @@
+//
+// impl/read.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_IMPL_READ_HPP
+#define ASIO_IMPL_READ_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <algorithm>
+#include "asio/buffer.hpp"
+#include "asio/completion_condition.hpp"
+#include "asio/detail/array_fwd.hpp"
+#include "asio/detail/base_from_completion_cond.hpp"
+#include "asio/detail/bind_handler.hpp"
+#include "asio/detail/consuming_buffers.hpp"
+#include "asio/detail/dependent_type.hpp"
+#include "asio/detail/handler_alloc_helpers.hpp"
+#include "asio/detail/handler_cont_helpers.hpp"
+#include "asio/detail/handler_invoke_helpers.hpp"
+#include "asio/detail/handler_type_requirements.hpp"
+#include "asio/detail/throw_error.hpp"
+#include "asio/error.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+
+template <typename SyncReadStream, typename MutableBufferSequence,
+    typename CompletionCondition>
+std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
+    CompletionCondition completion_condition, asio::error_code& ec)
+{
+  ec = asio::error_code();
+  asio::detail::consuming_buffers<
+    mutable_buffer, MutableBufferSequence> tmp(buffers);
+  std::size_t total_transferred = 0;
+  tmp.prepare(detail::adapt_completion_condition_result(
+        completion_condition(ec, total_transferred)));
+  while (tmp.begin() != tmp.end())
+  {
+    std::size_t bytes_transferred = s.read_some(tmp, ec);
+    tmp.consume(bytes_transferred);
+    total_transferred += bytes_transferred;
+    tmp.prepare(detail::adapt_completion_condition_result(
+          completion_condition(ec, total_transferred)));
+  }
+  return total_transferred;
+}
+
+template <typename SyncReadStream, typename MutableBufferSequence>
+inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers)
+{
+  asio::error_code ec;
+  std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec);
+  asio::detail::throw_error(ec, "read");
+  return bytes_transferred;
+}
+
+template <typename SyncReadStream, typename MutableBufferSequence>
+inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
+    asio::error_code& ec)
+{
+  return read(s, buffers, transfer_all(), ec);
+}
+
+template <typename SyncReadStream, typename MutableBufferSequence,
+    typename CompletionCondition>
+inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers,
+    CompletionCondition completion_condition)
+{
+  asio::error_code ec;
+  std::size_t bytes_transferred = read(s, buffers, completion_condition, ec);
+  asio::detail::throw_error(ec, "read");
+  return bytes_transferred;
+}
+
+#if !defined(ASIO_NO_IOSTREAM)
+
+template <typename SyncReadStream, typename Allocator,
+    typename CompletionCondition>
+std::size_t read(SyncReadStream& s,
+    asio::basic_streambuf<Allocator>& b,
+    CompletionCondition completion_condition, asio::error_code& ec)
+{
+  ec = asio::error_code();
+  std::size_t total_transferred = 0;
+  std::size_t max_size = detail::adapt_completion_condition_result(
+        completion_condition(ec, total_transferred));
+  std::size_t bytes_available = read_size_helper(b, max_size);
+  while (bytes_available > 0)
+  {
+    std::size_t bytes_transferred = s.read_some(b.prepare(bytes_available), ec);
+    b.commit(bytes_transferred);
+    total_transferred += bytes_transferred;
+    max_size = detail::adapt_completion_condition_result(
+          completion_condition(ec, total_transferred));
+    bytes_available = read_size_helper(b, max_size);
+  }
+  return total_transferred;
+}
+
+template <typename SyncReadStream, typename Allocator>
+inline std::size_t read(SyncReadStream& s,
+    asio::basic_streambuf<Allocator>& b)
+{
+  asio::error_code ec;
+  std::size_t bytes_transferred = read(s, b, transfer_all(), ec);
+  asio::detail::throw_error(ec, "read");
+  return bytes_transferred;
+}
+
+template <typename SyncReadStream, typename Allocator>
+inline std::size_t read(SyncReadStream& s,
+    asio::basic_streambuf<Allocator>& b,
+    asio::error_code& ec)
+{
+  return read(s, b, transfer_all(), ec);
+}
+
+template <typename SyncReadStream, typename Allocator,
+    typename CompletionCondition>
+inline std::size_t read(SyncReadStream& s,
+    asio::basic_streambuf<Allocator>& b,
+    CompletionCondition completion_condition)
+{
+  asio::error_code ec;
+  std::size_t bytes_transferred = read(s, b, completion_condition, ec);
+  asio::detail::throw_error(ec, "read");
+  return bytes_transferred;
+}
+
+#endif // !defined(ASIO_NO_IOSTREAM)
+
+namespace detail
+{
+  template <typename AsyncReadStream, typename MutableBufferSequence,
+      typename CompletionCondition, typename ReadHandler>
+  class read_op
+    : detail::base_from_completion_cond<CompletionCondition>
+  {
+  public:
+    read_op(AsyncReadStream& stream, const MutableBufferSequence& buffers,
+        CompletionCondition completion_condition, ReadHandler& handler)
+      : detail::base_from_completion_cond<
+          CompletionCondition>(completion_condition),
+        stream_(stream),
+        buffers_(buffers),
+        start_(0),
+        total_transferred_(0),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(handler))
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    read_op(const read_op& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffers_(other.buffers_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(other.handler_)
+    {
+    }
+
+    read_op(read_op&& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffers_(other.buffers_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec,
+        std::size_t bytes_transferred, int start = 0)
+    {
+      switch (start_ = start)
+      {
+        case 1:
+        buffers_.prepare(this->check_for_completion(ec, total_transferred_));
+        for (;;)
+        {
+          stream_.async_read_some(buffers_,
+              ASIO_MOVE_CAST(read_op)(*this));
+          return; default:
+          total_transferred_ += bytes_transferred;
+          buffers_.consume(bytes_transferred);
+          buffers_.prepare(this->check_for_completion(ec, total_transferred_));
+          if ((!ec && bytes_transferred == 0)
+              || buffers_.begin() == buffers_.end())
+            break;
+        }
+
+        handler_(ec, static_cast<const std::size_t&>(total_transferred_));
+      }
+    }
+
+  //private:
+    AsyncReadStream& stream_;
+    asio::detail::consuming_buffers<
+      mutable_buffer, MutableBufferSequence> buffers_;
+    int start_;
+    std::size_t total_transferred_;
+    ReadHandler handler_;
+  };
+
+  template <typename AsyncReadStream,
+      typename CompletionCondition, typename ReadHandler>
+  class read_op<AsyncReadStream, asio::mutable_buffers_1,
+      CompletionCondition, ReadHandler>
+    : detail::base_from_completion_cond<CompletionCondition>
+  {
+  public:
+    read_op(AsyncReadStream& stream,
+        const asio::mutable_buffers_1& buffers,
+        CompletionCondition completion_condition, ReadHandler& handler)
+      : detail::base_from_completion_cond<
+          CompletionCondition>(completion_condition),
+        stream_(stream),
+        buffer_(buffers),
+        start_(0),
+        total_transferred_(0),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(handler))
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    read_op(const read_op& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffer_(other.buffer_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(other.handler_)
+    {
+    }
+
+    read_op(read_op&& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffer_(other.buffer_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec,
+        std::size_t bytes_transferred, int start = 0)
+    {
+      std::size_t n = 0;
+      switch (start_ = start)
+      {
+        case 1:
+        n = this->check_for_completion(ec, total_transferred_);
+        for (;;)
+        {
+          stream_.async_read_some(
+              asio::buffer(buffer_ + total_transferred_, n),
+              ASIO_MOVE_CAST(read_op)(*this));
+          return; default:
+          total_transferred_ += bytes_transferred;
+          if ((!ec && bytes_transferred == 0)
+              || (n = this->check_for_completion(ec, total_transferred_)) == 0
+              || total_transferred_ == asio::buffer_size(buffer_))
+            break;
+        }
+
+        handler_(ec, static_cast<const std::size_t&>(total_transferred_));
+      }
+    }
+
+  //private:
+    AsyncReadStream& stream_;
+    asio::mutable_buffer buffer_;
+    int start_;
+    std::size_t total_transferred_;
+    ReadHandler handler_;
+  };
+
+  template <typename AsyncReadStream, typename Elem,
+      typename CompletionCondition, typename ReadHandler>
+  class read_op<AsyncReadStream, boost::array<Elem, 2>,
+      CompletionCondition, ReadHandler>
+    : detail::base_from_completion_cond<CompletionCondition>
+  {
+  public:
+    read_op(AsyncReadStream& stream, const boost::array<Elem, 2>& buffers,
+        CompletionCondition completion_condition, ReadHandler& handler)
+      : detail::base_from_completion_cond<
+          CompletionCondition>(completion_condition),
+        stream_(stream),
+        buffers_(buffers),
+        start_(0),
+        total_transferred_(0),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(handler))
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    read_op(const read_op& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffers_(other.buffers_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(other.handler_)
+    {
+    }
+
+    read_op(read_op&& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffers_(other.buffers_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec,
+        std::size_t bytes_transferred, int start = 0)
+    {
+      typename asio::detail::dependent_type<Elem,
+          boost::array<asio::mutable_buffer, 2> >::type bufs = {{
+        asio::mutable_buffer(buffers_[0]),
+        asio::mutable_buffer(buffers_[1]) }};
+      std::size_t buffer_size0 = asio::buffer_size(bufs[0]);
+      std::size_t buffer_size1 = asio::buffer_size(bufs[1]);
+      std::size_t n = 0;
+      switch (start_ = start)
+      {
+        case 1:
+        n = this->check_for_completion(ec, total_transferred_);
+        for (;;)
+        {
+          bufs[0] = asio::buffer(bufs[0] + total_transferred_, n);
+          bufs[1] = asio::buffer(
+              bufs[1] + (total_transferred_ < buffer_size0
+                ? 0 : total_transferred_ - buffer_size0),
+              n - asio::buffer_size(bufs[0]));
+          stream_.async_read_some(bufs, ASIO_MOVE_CAST(read_op)(*this));
+          return; default:
+          total_transferred_ += bytes_transferred;
+          if ((!ec && bytes_transferred == 0)
+              || (n = this->check_for_completion(ec, total_transferred_)) == 0
+              || total_transferred_ == buffer_size0 + buffer_size1)
+            break;
+        }
+
+        handler_(ec, static_cast<const std::size_t&>(total_transferred_));
+      }
+    }
+
+  //private:
+    AsyncReadStream& stream_;
+    boost::array<Elem, 2> buffers_;
+    int start_;
+    std::size_t total_transferred_;
+    ReadHandler handler_;
+  };
+
+#if defined(ASIO_HAS_STD_ARRAY)
+
+  template <typename AsyncReadStream, typename Elem,
+      typename CompletionCondition, typename ReadHandler>
+  class read_op<AsyncReadStream, std::array<Elem, 2>,
+      CompletionCondition, ReadHandler>
+    : detail::base_from_completion_cond<CompletionCondition>
+  {
+  public:
+    read_op(AsyncReadStream& stream, const std::array<Elem, 2>& buffers,
+        CompletionCondition completion_condition, ReadHandler& handler)
+      : detail::base_from_completion_cond<
+          CompletionCondition>(completion_condition),
+        stream_(stream),
+        buffers_(buffers),
+        start_(0),
+        total_transferred_(0),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(handler))
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    read_op(const read_op& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffers_(other.buffers_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(other.handler_)
+    {
+    }
+
+    read_op(read_op&& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        buffers_(other.buffers_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec,
+        std::size_t bytes_transferred, int start = 0)
+    {
+      typename asio::detail::dependent_type<Elem,
+          std::array<asio::mutable_buffer, 2> >::type bufs = {{
+        asio::mutable_buffer(buffers_[0]),
+        asio::mutable_buffer(buffers_[1]) }};
+      std::size_t buffer_size0 = asio::buffer_size(bufs[0]);
+      std::size_t buffer_size1 = asio::buffer_size(bufs[1]);
+      std::size_t n = 0;
+      switch (start_ = start)
+      {
+        case 1:
+        n = this->check_for_completion(ec, total_transferred_);
+        for (;;)
+        {
+          bufs[0] = asio::buffer(bufs[0] + total_transferred_, n);
+          bufs[1] = asio::buffer(
+              bufs[1] + (total_transferred_ < buffer_size0
+                ? 0 : total_transferred_ - buffer_size0),
+              n - asio::buffer_size(bufs[0]));
+          stream_.async_read_some(bufs, ASIO_MOVE_CAST(read_op)(*this));
+          return; default:
+          total_transferred_ += bytes_transferred;
+          if ((!ec && bytes_transferred == 0)
+              || (n = this->check_for_completion(ec, total_transferred_)) == 0
+              || total_transferred_ == buffer_size0 + buffer_size1)
+            break;
+        }
+
+        handler_(ec, static_cast<const std::size_t&>(total_transferred_));
+      }
+    }
+
+  //private:
+    AsyncReadStream& stream_;
+    std::array<Elem, 2> buffers_;
+    int start_;
+    std::size_t total_transferred_;
+    ReadHandler handler_;
+  };
+
+#endif // defined(ASIO_HAS_STD_ARRAY)
+
+  template <typename AsyncReadStream, typename MutableBufferSequence,
+      typename CompletionCondition, typename ReadHandler>
+  inline void* asio_handler_allocate(std::size_t size,
+      read_op<AsyncReadStream, MutableBufferSequence,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    return asio_handler_alloc_helpers::allocate(
+        size, this_handler->handler_);
+  }
+
+  template <typename AsyncReadStream, typename MutableBufferSequence,
+      typename CompletionCondition, typename ReadHandler>
+  inline void asio_handler_deallocate(void* pointer, std::size_t size,
+      read_op<AsyncReadStream, MutableBufferSequence,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    asio_handler_alloc_helpers::deallocate(
+        pointer, size, this_handler->handler_);
+  }
+
+  template <typename AsyncReadStream, typename MutableBufferSequence,
+      typename CompletionCondition, typename ReadHandler>
+  inline bool asio_handler_is_continuation(
+      read_op<AsyncReadStream, MutableBufferSequence,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    return this_handler->start_ == 0 ? true
+      : asio_handler_cont_helpers::is_continuation(
+          this_handler->handler_);
+  }
+
+  template <typename Function, typename AsyncReadStream,
+      typename MutableBufferSequence, typename CompletionCondition,
+      typename ReadHandler>
+  inline void asio_handler_invoke(Function& function,
+      read_op<AsyncReadStream, MutableBufferSequence,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+
+  template <typename Function, typename AsyncReadStream,
+      typename MutableBufferSequence, typename CompletionCondition,
+      typename ReadHandler>
+  inline void asio_handler_invoke(const Function& function,
+      read_op<AsyncReadStream, MutableBufferSequence,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+} // namespace detail
+
+template <typename AsyncReadStream, typename MutableBufferSequence,
+    typename CompletionCondition, typename ReadHandler>
+inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
+    void (asio::error_code, std::size_t))
+async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
+    CompletionCondition completion_condition,
+    ASIO_MOVE_ARG(ReadHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ReadHandler.
+  ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+  detail::async_result_init<
+    ReadHandler, void (asio::error_code, std::size_t)> init(
+      ASIO_MOVE_CAST(ReadHandler)(handler));
+
+  detail::read_op<AsyncReadStream, MutableBufferSequence,
+    CompletionCondition, ASIO_HANDLER_TYPE(
+      ReadHandler, void (asio::error_code, std::size_t))>(
+        s, buffers, completion_condition, init.handler)(
+          asio::error_code(), 0, 1);
+
+  return init.result.get();
+}
+
+template <typename AsyncReadStream, typename MutableBufferSequence,
+    typename ReadHandler>
+inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
+    void (asio::error_code, std::size_t))
+async_read(AsyncReadStream& s, const MutableBufferSequence& buffers,
+    ASIO_MOVE_ARG(ReadHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ReadHandler.
+  ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+  detail::async_result_init<
+    ReadHandler, void (asio::error_code, std::size_t)> init(
+      ASIO_MOVE_CAST(ReadHandler)(handler));
+
+  detail::read_op<AsyncReadStream, MutableBufferSequence,
+    detail::transfer_all_t, ASIO_HANDLER_TYPE(
+      ReadHandler, void (asio::error_code, std::size_t))>(
+        s, buffers, transfer_all(), init.handler)(
+          asio::error_code(), 0, 1);
+
+  return init.result.get();
+}
+
+#if !defined(ASIO_NO_IOSTREAM)
+
+namespace detail
+{
+  template <typename AsyncReadStream, typename Allocator,
+      typename CompletionCondition, typename ReadHandler>
+  class read_streambuf_op
+    : detail::base_from_completion_cond<CompletionCondition>
+  {
+  public:
+    read_streambuf_op(AsyncReadStream& stream,
+        basic_streambuf<Allocator>& streambuf,
+        CompletionCondition completion_condition, ReadHandler& handler)
+      : detail::base_from_completion_cond<
+          CompletionCondition>(completion_condition),
+        stream_(stream),
+        streambuf_(streambuf),
+        start_(0),
+        total_transferred_(0),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(handler))
+    {
+    }
+
+#if defined(ASIO_HAS_MOVE)
+    read_streambuf_op(const read_streambuf_op& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        streambuf_(other.streambuf_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(other.handler_)
+    {
+    }
+
+    read_streambuf_op(read_streambuf_op&& other)
+      : detail::base_from_completion_cond<CompletionCondition>(other),
+        stream_(other.stream_),
+        streambuf_(other.streambuf_),
+        start_(other.start_),
+        total_transferred_(other.total_transferred_),
+        handler_(ASIO_MOVE_CAST(ReadHandler)(other.handler_))
+    {
+    }
+#endif // defined(ASIO_HAS_MOVE)
+
+    void operator()(const asio::error_code& ec,
+        std::size_t bytes_transferred, int start = 0)
+    {
+      std::size_t max_size, bytes_available;
+      switch (start_ = start)
+      {
+        case 1:
+        max_size = this->check_for_completion(ec, total_transferred_);
+        bytes_available = read_size_helper(streambuf_, max_size);
+        for (;;)
+        {
+          stream_.async_read_some(streambuf_.prepare(bytes_available),
+              ASIO_MOVE_CAST(read_streambuf_op)(*this));
+          return; default:
+          total_transferred_ += bytes_transferred;
+          streambuf_.commit(bytes_transferred);
+          max_size = this->check_for_completion(ec, total_transferred_);
+          bytes_available = read_size_helper(streambuf_, max_size);
+          if ((!ec && bytes_transferred == 0) || bytes_available == 0)
+            break;
+        }
+
+        handler_(ec, static_cast<const std::size_t&>(total_transferred_));
+      }
+    }
+
+  //private:
+    AsyncReadStream& stream_;
+    asio::basic_streambuf<Allocator>& streambuf_;
+    int start_;
+    std::size_t total_transferred_;
+    ReadHandler handler_;
+  };
+
+  template <typename AsyncReadStream, typename Allocator,
+      typename CompletionCondition, typename ReadHandler>
+  inline void* asio_handler_allocate(std::size_t size,
+      read_streambuf_op<AsyncReadStream, Allocator,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    return asio_handler_alloc_helpers::allocate(
+        size, this_handler->handler_);
+  }
+
+  template <typename AsyncReadStream, typename Allocator,
+      typename CompletionCondition, typename ReadHandler>
+  inline void asio_handler_deallocate(void* pointer, std::size_t size,
+      read_streambuf_op<AsyncReadStream, Allocator,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    asio_handler_alloc_helpers::deallocate(
+        pointer, size, this_handler->handler_);
+  }
+
+  template <typename AsyncReadStream, typename Allocator,
+      typename CompletionCondition, typename ReadHandler>
+  inline bool asio_handler_is_continuation(
+      read_streambuf_op<AsyncReadStream, Allocator,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    return this_handler->start_ == 0 ? true
+      : asio_handler_cont_helpers::is_continuation(
+          this_handler->handler_);
+  }
+
+  template <typename Function, typename AsyncReadStream,
+      typename Allocator, typename CompletionCondition, typename ReadHandler>
+  inline void asio_handler_invoke(Function& function,
+      read_streambuf_op<AsyncReadStream, Allocator,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+
+  template <typename Function, typename AsyncReadStream,
+      typename Allocator, typename CompletionCondition, typename ReadHandler>
+  inline void asio_handler_invoke(const Function& function,
+      read_streambuf_op<AsyncReadStream, Allocator,
+        CompletionCondition, ReadHandler>* this_handler)
+  {
+    asio_handler_invoke_helpers::invoke(
+        function, this_handler->handler_);
+  }
+} // namespace detail
+
+template <typename AsyncReadStream, typename Allocator,
+    typename CompletionCondition, typename ReadHandler>
+inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
+    void (asio::error_code, std::size_t))
+async_read(AsyncReadStream& s,
+    asio::basic_streambuf<Allocator>& b,
+    CompletionCondition completion_condition,
+    ASIO_MOVE_ARG(ReadHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ReadHandler.
+  ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+  detail::async_result_init<
+    ReadHandler, void (asio::error_code, std::size_t)> init(
+      ASIO_MOVE_CAST(ReadHandler)(handler));
+
+  detail::read_streambuf_op<AsyncReadStream, Allocator,
+    CompletionCondition, ASIO_HANDLER_TYPE(
+      ReadHandler, void (asio::error_code, std::size_t))>(
+        s, b, completion_condition, init.handler)(
+          asio::error_code(), 0, 1);
+
+  return init.result.get();
+}
+
+template <typename AsyncReadStream, typename Allocator, typename ReadHandler>
+inline ASIO_INITFN_RESULT_TYPE(ReadHandler,
+    void (asio::error_code, std::size_t))
+async_read(AsyncReadStream& s,
+    asio::basic_streambuf<Allocator>& b,
+    ASIO_MOVE_ARG(ReadHandler) handler)
+{
+  // If you get an error on the following line it means that your handler does
+  // not meet the documented type requirements for a ReadHandler.
+  ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check;
+
+  detail::async_result_init<
+    ReadHandler, void (asio::error_code, std::size_t)> init(
+      ASIO_MOVE_CAST(ReadHandler)(handler));
+
+  detail::read_streambuf_op<AsyncReadStream, Allocator,
+    detail::transfer_all_t, ASIO_HANDLER_TYPE(
+      ReadHandler, void (asio::error_code, std::size_t))>(
+        s, b, transfer_all(), init.handler)(
+          asio::error_code(), 0, 1);
+
+  return init.result.get();
+}
+
+#endif // !defined(ASIO_NO_IOSTREAM)
+
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_IMPL_READ_HPP


Mime
View raw message