hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From whe...@apache.org
Subject [10/46] hadoop git commit: HDFS-8724. Import third_party libraries into the repository. Contributed by Haohui Mai.
Date Sat, 11 Jul 2015 00:09:29 GMT
http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/io.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/io.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/io.hpp
new file mode 100644
index 0000000..bb60ccc
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/io.hpp
@@ -0,0 +1,347 @@
+//
+// ssl/detail/io.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_SSL_DETAIL_IO_HPP
+#define ASIO_SSL_DETAIL_IO_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_ENABLE_OLD_SSL)
+# include "asio/ssl/detail/engine.hpp"
+# include "asio/ssl/detail/stream_core.hpp"
+# include "asio/write.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+template <typename Stream, typename Operation>
+std::size_t io(Stream& next_layer, stream_core& core,
+    const Operation& op, asio::error_code& ec)
+{
+  std::size_t bytes_transferred = 0;
+  do switch (op(core.engine_, ec, bytes_transferred))
+  {
+  case engine::want_input_and_retry:
+
+    // If the input buffer is empty then we need to read some more data from
+    // the underlying transport.
+    if (asio::buffer_size(core.input_) == 0)
+      core.input_ = asio::buffer(core.input_buffer_,
+          next_layer.read_some(core.input_buffer_, ec));
+
+    // Pass the new input data to the engine.
+    core.input_ = core.engine_.put_input(core.input_);
+
+    // Try the operation again.
+    continue;
+
+  case engine::want_output_and_retry:
+
+    // Get output data from the engine and write it to the underlying
+    // transport.
+    asio::write(next_layer,
+        core.engine_.get_output(core.output_buffer_), ec);
+
+    // Try the operation again.
+    continue;
+
+  case engine::want_output:
+
+    // Get output data from the engine and write it to the underlying
+    // transport.
+    asio::write(next_layer,
+        core.engine_.get_output(core.output_buffer_), ec);
+
+    // Operation is complete. Return result to caller.
+    core.engine_.map_error_code(ec);
+    return bytes_transferred;
+
+  default:
+
+    // Operation is complete. Return result to caller.
+    core.engine_.map_error_code(ec);
+    return bytes_transferred;
+
+  } while (!ec);
+
+  // Operation failed. Return result to caller.
+  core.engine_.map_error_code(ec);
+  return 0;
+}
+
+template <typename Stream, typename Operation, typename Handler>
+class io_op
+{
+public:
+  io_op(Stream& next_layer, stream_core& core,
+      const Operation& op, Handler& handler)
+    : next_layer_(next_layer),
+      core_(core),
+      op_(op),
+      start_(0),
+      want_(engine::want_nothing),
+      bytes_transferred_(0),
+      handler_(ASIO_MOVE_CAST(Handler)(handler))
+  {
+  }
+
+#if defined(ASIO_HAS_MOVE)
+  io_op(const io_op& other)
+    : next_layer_(other.next_layer_),
+      core_(other.core_),
+      op_(other.op_),
+      start_(other.start_),
+      want_(other.want_),
+      ec_(other.ec_),
+      bytes_transferred_(other.bytes_transferred_),
+      handler_(other.handler_)
+  {
+  }
+
+  io_op(io_op&& other)
+    : next_layer_(other.next_layer_),
+      core_(other.core_),
+      op_(other.op_),
+      start_(other.start_),
+      want_(other.want_),
+      ec_(other.ec_),
+      bytes_transferred_(other.bytes_transferred_),
+      handler_(ASIO_MOVE_CAST(Handler)(other.handler_))
+  {
+  }
+#endif // defined(ASIO_HAS_MOVE)
+
+  void operator()(asio::error_code ec,
+      std::size_t bytes_transferred = ~std::size_t(0), int start = 0)
+  {
+    switch (start_ = start)
+    {
+    case 1: // Called after at least one async operation.
+      do
+      {
+        switch (want_ = op_(core_.engine_, ec_, bytes_transferred_))
+        {
+        case engine::want_input_and_retry:
+
+          // If the input buffer already has data in it we can pass it to the
+          // engine and then retry the operation immediately.
+          if (asio::buffer_size(core_.input_) != 0)
+          {
+            core_.input_ = core_.engine_.put_input(core_.input_);
+            continue;
+          }
+
+          // The engine wants more data to be read from input. However, we
+          // cannot allow more than one read operation at a time on the
+          // underlying transport. The pending_read_ timer's expiry is set to
+          // pos_infin if a read is in progress, and neg_infin otherwise.
+          if (core_.pending_read_.expires_at() == core_.neg_infin())
+          {
+            // Prevent other read operations from being started.
+            core_.pending_read_.expires_at(core_.pos_infin());
+
+            // Start reading some data from the underlying transport.
+            next_layer_.async_read_some(
+                asio::buffer(core_.input_buffer_),
+                ASIO_MOVE_CAST(io_op)(*this));
+          }
+          else
+          {
+            // Wait until the current read operation completes.
+            core_.pending_read_.async_wait(ASIO_MOVE_CAST(io_op)(*this));
+          }
+
+          // Yield control until asynchronous operation completes. Control
+          // resumes at the "default:" label below.
+          return;
+
+        case engine::want_output_and_retry:
+        case engine::want_output:
+
+          // The engine wants some data to be written to the output. However, we
+          // cannot allow more than one write operation at a time on the
+          // underlying transport. The pending_write_ timer's expiry is set to
+          // pos_infin if a write is in progress, and neg_infin otherwise.
+          if (core_.pending_write_.expires_at() == core_.neg_infin())
+          {
+            // Prevent other write operations from being started.
+            core_.pending_write_.expires_at(core_.pos_infin());
+
+            // Start writing all the data to the underlying transport.
+            asio::async_write(next_layer_,
+                core_.engine_.get_output(core_.output_buffer_),
+                ASIO_MOVE_CAST(io_op)(*this));
+          }
+          else
+          {
+            // Wait until the current write operation completes.
+            core_.pending_write_.async_wait(ASIO_MOVE_CAST(io_op)(*this));
+          }
+
+          // Yield control until asynchronous operation completes. Control
+          // resumes at the "default:" label below.
+          return;
+
+        default:
+
+          // The SSL operation is done and we can invoke the handler, but we
+          // have to keep in mind that this function might be being called from
+          // the async operation's initiating function. In this case we're not
+          // allowed to call the handler directly. Instead, issue a zero-sized
+          // read so the handler runs "as-if" posted using io_service::post().
+          if (start)
+          {
+            next_layer_.async_read_some(
+                asio::buffer(core_.input_buffer_, 0),
+                ASIO_MOVE_CAST(io_op)(*this));
+
+            // Yield control until asynchronous operation completes. Control
+            // resumes at the "default:" label below.
+            return;
+          }
+          else
+          {
+            // Continue on to run handler directly.
+            break;
+          }
+        }
+
+        default:
+        if (bytes_transferred != ~std::size_t(0) && !ec_)
+          ec_ = ec;
+
+        switch (want_)
+        {
+        case engine::want_input_and_retry:
+
+          // Add received data to the engine's input.
+          core_.input_ = asio::buffer(
+              core_.input_buffer_, bytes_transferred);
+          core_.input_ = core_.engine_.put_input(core_.input_);
+
+          // Release any waiting read operations.
+          core_.pending_read_.expires_at(core_.neg_infin());
+
+          // Try the operation again.
+          continue;
+
+        case engine::want_output_and_retry:
+
+          // Release any waiting write operations.
+          core_.pending_write_.expires_at(core_.neg_infin());
+
+          // Try the operation again.
+          continue;
+
+        case engine::want_output:
+
+          // Release any waiting write operations.
+          core_.pending_write_.expires_at(core_.neg_infin());
+
+          // Fall through to call handler.
+
+        default:
+
+          // Pass the result to the handler.
+          op_.call_handler(handler_,
+              core_.engine_.map_error_code(ec_),
+              ec_ ? 0 : bytes_transferred_);
+
+          // Our work here is done.
+          return;
+        }
+      } while (!ec_);
+
+      // Operation failed. Pass the result to the handler.
+      op_.call_handler(handler_, core_.engine_.map_error_code(ec_), 0);
+    }
+  }
+
+//private:
+  Stream& next_layer_;
+  stream_core& core_;
+  Operation op_;
+  int start_;
+  engine::want want_;
+  asio::error_code ec_;
+  std::size_t bytes_transferred_;
+  Handler handler_;
+};
+
+template <typename Stream, typename Operation,  typename Handler>
+inline void* asio_handler_allocate(std::size_t size,
+    io_op<Stream, Operation, Handler>* this_handler)
+{
+  return asio_handler_alloc_helpers::allocate(
+      size, this_handler->handler_);
+}
+
+template <typename Stream, typename Operation, typename Handler>
+inline void asio_handler_deallocate(void* pointer, std::size_t size,
+    io_op<Stream, Operation, Handler>* this_handler)
+{
+  asio_handler_alloc_helpers::deallocate(
+      pointer, size, this_handler->handler_);
+}
+
+template <typename Stream, typename Operation, typename Handler>
+inline bool asio_handler_is_continuation(
+    io_op<Stream, Operation, Handler>* this_handler)
+{
+  return this_handler->start_ == 0 ? true
+    : asio_handler_cont_helpers::is_continuation(this_handler->handler_);
+}
+
+template <typename Function, typename Stream,
+    typename Operation, typename Handler>
+inline void asio_handler_invoke(Function& function,
+    io_op<Stream, Operation, Handler>* this_handler)
+{
+  asio_handler_invoke_helpers::invoke(
+      function, this_handler->handler_);
+}
+
+template <typename Function, typename Stream,
+    typename Operation, typename Handler>
+inline void asio_handler_invoke(const Function& function,
+    io_op<Stream, Operation, Handler>* this_handler)
+{
+  asio_handler_invoke_helpers::invoke(
+      function, this_handler->handler_);
+}
+
+template <typename Stream, typename Operation, typename Handler>
+inline void async_io(Stream& next_layer, stream_core& core,
+    const Operation& op, Handler& handler)
+{
+  io_op<Stream, Operation, Handler>(
+    next_layer, core, op, handler)(
+      asio::error_code(), 0, 1);
+}
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_IO_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_init.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_init.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_init.hpp
new file mode 100644
index 0000000..317ba1f
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_init.hpp
@@ -0,0 +1,101 @@
+//
+// ssl/detail/openssl_init.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_SSL_DETAIL_OPENSSL_INIT_HPP
+#define ASIO_SSL_DETAIL_OPENSSL_INIT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include <cstring>
+#include "asio/detail/noncopyable.hpp"
+#include "asio/detail/shared_ptr.hpp"
+#include "asio/ssl/detail/openssl_types.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+class openssl_init_base
+  : private noncopyable
+{
+protected:
+  // Class that performs the actual initialisation.
+  class do_init;
+
+  // Helper function to manage a do_init singleton. The static instance of the
+  // openssl_init object ensures that this function is always called before
+  // main, and therefore before any other threads can get started. The do_init
+  // instance must be static in this function to ensure that it gets
+  // initialised before any other global objects try to use it.
+  ASIO_DECL static asio::detail::shared_ptr<do_init> instance();
+
+#if !defined(SSL_OP_NO_COMPRESSION) \
+  && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+  // Get an empty stack of compression methods, to be used when disabling
+  // compression.
+  ASIO_DECL static STACK_OF(SSL_COMP)* get_null_compression_methods();
+#endif // !defined(SSL_OP_NO_COMPRESSION)
+       // && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+};
+
+template <bool Do_Init = true>
+class openssl_init : private openssl_init_base
+{
+public:
+  // Constructor.
+  openssl_init()
+    : ref_(instance())
+  {
+    using namespace std; // For memmove.
+
+    // Ensure openssl_init::instance_ is linked in.
+    openssl_init* tmp = &instance_;
+    memmove(&tmp, &tmp, sizeof(openssl_init*));
+  }
+
+  // Destructor.
+  ~openssl_init()
+  {
+  }
+
+#if !defined(SSL_OP_NO_COMPRESSION) \
+  && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+  using openssl_init_base::get_null_compression_methods;
+#endif // !defined(SSL_OP_NO_COMPRESSION)
+       // && (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+
+private:
+  // Instance to force initialisation of openssl at global scope.
+  static openssl_init instance_;
+
+  // Reference to singleton do_init object to ensure that openssl does not get
+  // cleaned up until the last user has finished with it.
+  asio::detail::shared_ptr<do_init> ref_;
+};
+
+template <bool Do_Init>
+openssl_init<Do_Init> openssl_init<Do_Init>::instance_;
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#if defined(ASIO_HEADER_ONLY)
+# include "asio/ssl/detail/impl/openssl_init.ipp"
+#endif // defined(ASIO_HEADER_ONLY)
+
+#endif // ASIO_SSL_DETAIL_OPENSSL_INIT_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_types.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_types.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_types.hpp
new file mode 100644
index 0000000..21b9dab
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/openssl_types.hpp
@@ -0,0 +1,28 @@
+//
+// ssl/detail/openssl_types.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_SSL_DETAIL_OPENSSL_TYPES_HPP
+#define ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include <openssl/conf.h>
+#include <openssl/ssl.h>
+#if !defined(OPENSSL_NO_ENGINE)
+# include <openssl/engine.h>
+#endif // !defined(OPENSSL_NO_ENGINE)
+#include <openssl/err.h>
+#include <openssl/x509v3.h>
+#include "asio/detail/socket_types.hpp"
+
+#endif // ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/password_callback.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/password_callback.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/password_callback.hpp
new file mode 100644
index 0000000..7801702
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/password_callback.hpp
@@ -0,0 +1,72 @@
+//
+// ssl/detail/password_callback.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_SSL_DETAIL_PASSWORD_CALLBACK_HPP
+#define ASIO_SSL_DETAIL_PASSWORD_CALLBACK_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_ENABLE_OLD_SSL)
+# include <cstddef>
+# include <string>
+# include "asio/ssl/context_base.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+class password_callback_base
+{
+public:
+  virtual ~password_callback_base()
+  {
+  }
+
+  virtual std::string call(std::size_t size,
+      context_base::password_purpose purpose) = 0;
+};
+
+template <typename PasswordCallback>
+class password_callback : public password_callback_base
+{
+public:
+  explicit password_callback(PasswordCallback callback)
+    : callback_(callback)
+  {
+  }
+
+  virtual std::string call(std::size_t size,
+      context_base::password_purpose purpose)
+  {
+    return callback_(size, purpose);
+  }
+
+private:
+  PasswordCallback callback_;
+};
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_PASSWORD_CALLBACK_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/read_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/read_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/read_op.hpp
new file mode 100644
index 0000000..b48efbe
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/read_op.hpp
@@ -0,0 +1,73 @@
+//
+// ssl/detail/read_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_SSL_DETAIL_READ_OP_HPP
+#define ASIO_SSL_DETAIL_READ_OP_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_ENABLE_OLD_SSL)
+# include "asio/detail/buffer_sequence_adapter.hpp"
+# include "asio/ssl/detail/engine.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+template <typename MutableBufferSequence>
+class read_op
+{
+public:
+  read_op(const MutableBufferSequence& buffers)
+    : buffers_(buffers)
+  {
+  }
+
+  engine::want operator()(engine& eng,
+      asio::error_code& ec,
+      std::size_t& bytes_transferred) const
+  {
+    asio::mutable_buffer buffer =
+      asio::detail::buffer_sequence_adapter<asio::mutable_buffer,
+        MutableBufferSequence>::first(buffers_);
+
+    return eng.read(buffer, ec, bytes_transferred);
+  }
+
+  template <typename Handler>
+  void call_handler(Handler& handler,
+      const asio::error_code& ec,
+      const std::size_t& bytes_transferred) const
+  {
+    handler(ec, bytes_transferred);
+  }
+
+private:
+  MutableBufferSequence buffers_;
+};
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_READ_OP_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/shutdown_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/shutdown_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/shutdown_op.hpp
new file mode 100644
index 0000000..f220ee2
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/shutdown_op.hpp
@@ -0,0 +1,60 @@
+//
+// ssl/detail/shutdown_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_SSL_DETAIL_SHUTDOWN_OP_HPP
+#define ASIO_SSL_DETAIL_SHUTDOWN_OP_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_ENABLE_OLD_SSL)
+# include "asio/ssl/detail/engine.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+class shutdown_op
+{
+public:
+  engine::want operator()(engine& eng,
+      asio::error_code& ec,
+      std::size_t& bytes_transferred) const
+  {
+    bytes_transferred = 0;
+    return eng.shutdown(ec);
+  }
+
+  template <typename Handler>
+  void call_handler(Handler& handler,
+      const asio::error_code& ec,
+      const std::size_t&) const
+  {
+    handler(ec);
+  }
+};
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_SHUTDOWN_OP_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/stream_core.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/stream_core.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/stream_core.hpp
new file mode 100644
index 0000000..b29bbfc
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/stream_core.hpp
@@ -0,0 +1,126 @@
+//
+// ssl/detail/stream_core.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_SSL_DETAIL_STREAM_CORE_HPP
+#define ASIO_SSL_DETAIL_STREAM_CORE_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_ENABLE_OLD_SSL)
+# if defined(ASIO_HAS_BOOST_DATE_TIME)
+#  include "asio/deadline_timer.hpp"
+# else // defined(ASIO_HAS_BOOST_DATE_TIME)
+#  include "asio/steady_timer.hpp"
+# endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+# include "asio/ssl/detail/engine.hpp"
+# include "asio/buffer.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+struct stream_core
+{
+  // According to the OpenSSL documentation, this is the buffer size that is
+  // sufficient to hold the largest possible TLS record.
+  enum { max_tls_record_size = 17 * 1024 };
+
+  stream_core(SSL_CTX* context, asio::io_service& io_service)
+    : engine_(context),
+      pending_read_(io_service),
+      pending_write_(io_service),
+      output_buffer_space_(max_tls_record_size),
+      output_buffer_(asio::buffer(output_buffer_space_)),
+      input_buffer_space_(max_tls_record_size),
+      input_buffer_(asio::buffer(input_buffer_space_))
+  {
+    pending_read_.expires_at(neg_infin());
+    pending_write_.expires_at(neg_infin());
+  }
+
+  ~stream_core()
+  {
+  }
+
+  // The SSL engine.
+  engine engine_;
+
+#if defined(ASIO_HAS_BOOST_DATE_TIME)
+  // Timer used for storing queued read operations.
+  asio::deadline_timer pending_read_;
+
+  // Timer used for storing queued write operations.
+  asio::deadline_timer pending_write_;
+
+  // Helper function for obtaining a time value that always fires.
+  static asio::deadline_timer::time_type neg_infin()
+  {
+    return boost::posix_time::neg_infin;
+  }
+
+  // Helper function for obtaining a time value that never fires.
+  static asio::deadline_timer::time_type pos_infin()
+  {
+    return boost::posix_time::pos_infin;
+  }
+#else // defined(ASIO_HAS_BOOST_DATE_TIME)
+  // Timer used for storing queued read operations.
+  asio::steady_timer pending_read_;
+
+  // Timer used for storing queued write operations.
+  asio::steady_timer pending_write_;
+
+  // Helper function for obtaining a time value that always fires.
+  static asio::steady_timer::time_point neg_infin()
+  {
+    return (asio::steady_timer::time_point::min)();
+  }
+
+  // Helper function for obtaining a time value that never fires.
+  static asio::steady_timer::time_point pos_infin()
+  {
+    return (asio::steady_timer::time_point::max)();
+  }
+#endif // defined(ASIO_HAS_BOOST_DATE_TIME)
+
+  // Buffer space used to prepare output intended for the transport.
+  std::vector<unsigned char> output_buffer_space_;
+
+  // A buffer that may be used to prepare output intended for the transport.
+  const asio::mutable_buffers_1 output_buffer_;
+
+  // Buffer space used to read input intended for the engine.
+  std::vector<unsigned char> input_buffer_space_;
+
+  // A buffer that may be used to read input intended for the engine.
+  const asio::mutable_buffers_1 input_buffer_;
+
+  // The buffer pointing to the engine's unconsumed input.
+  asio::const_buffer input_;
+};
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_STREAM_CORE_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/verify_callback.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/verify_callback.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/verify_callback.hpp
new file mode 100644
index 0000000..48df350
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/verify_callback.hpp
@@ -0,0 +1,68 @@
+//
+// ssl/detail/verify_callback.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_SSL_DETAIL_VERIFY_CALLBACK_HPP
+#define ASIO_SSL_DETAIL_VERIFY_CALLBACK_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_ENABLE_OLD_SSL)
+# include "asio/ssl/verify_context.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+class verify_callback_base
+{
+public:
+  virtual ~verify_callback_base()
+  {
+  }
+
+  virtual bool call(bool preverified, verify_context& ctx) = 0;
+};
+
+template <typename VerifyCallback>
+class verify_callback : public verify_callback_base
+{
+public:
+  explicit verify_callback(VerifyCallback callback)
+    : callback_(callback)
+  {
+  }
+
+  virtual bool call(bool preverified, verify_context& ctx)
+  {
+    return callback_(preverified, ctx);
+  }
+
+private:
+  VerifyCallback callback_;
+};
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/write_op.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/write_op.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/write_op.hpp
new file mode 100644
index 0000000..f95c2a8
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/detail/write_op.hpp
@@ -0,0 +1,73 @@
+//
+// ssl/detail/write_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_SSL_DETAIL_WRITE_OP_HPP
+#define ASIO_SSL_DETAIL_WRITE_OP_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_ENABLE_OLD_SSL)
+# include "asio/detail/buffer_sequence_adapter.hpp"
+# include "asio/ssl/detail/engine.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace detail {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+template <typename ConstBufferSequence>
+class write_op
+{
+public:
+  write_op(const ConstBufferSequence& buffers)
+    : buffers_(buffers)
+  {
+  }
+
+  engine::want operator()(engine& eng,
+      asio::error_code& ec,
+      std::size_t& bytes_transferred) const
+  {
+    asio::const_buffer buffer =
+      asio::detail::buffer_sequence_adapter<asio::const_buffer,
+        ConstBufferSequence>::first(buffers_);
+
+    return eng.write(buffer, ec, bytes_transferred);
+  }
+
+  template <typename Handler>
+  void call_handler(Handler& handler,
+      const asio::error_code& ec,
+      const std::size_t& bytes_transferred) const
+  {
+    handler(ec, bytes_transferred);
+  }
+
+private:
+  ConstBufferSequence buffers_;
+};
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace detail
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_DETAIL_WRITE_OP_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/error.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/error.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/error.hpp
new file mode 100644
index 0000000..b5369c0
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/error.hpp
@@ -0,0 +1,68 @@
+//
+// ssl/error.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_SSL_ERROR_HPP
+#define ASIO_SSL_ERROR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include "asio/error_code.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace error {
+
+enum ssl_errors
+{
+};
+
+extern ASIO_DECL
+const asio::error_category& get_ssl_category();
+
+static const asio::error_category& ssl_category
+  = asio::error::get_ssl_category();
+
+} // namespace error
+} // namespace asio
+
+#if defined(ASIO_HAS_STD_SYSTEM_ERROR)
+namespace std {
+
+template<> struct is_error_code_enum<asio::error::ssl_errors>
+{
+  static const bool value = true;
+};
+
+} // namespace std
+#endif // defined(ASIO_HAS_STD_SYSTEM_ERROR)
+
+namespace asio {
+namespace error {
+
+inline asio::error_code make_error_code(ssl_errors e)
+{
+  return asio::error_code(
+      static_cast<int>(e), get_ssl_category());
+}
+
+} // namespace error
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#if defined(ASIO_HEADER_ONLY)
+# include "asio/ssl/impl/error.ipp"
+#endif // defined(ASIO_HEADER_ONLY)
+
+#endif // ASIO_SSL_ERROR_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.hpp
new file mode 100644
index 0000000..115a3e4
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.hpp
@@ -0,0 +1,71 @@
+//
+// ssl/impl/context.hpp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-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_SSL_IMPL_CONTEXT_HPP
+#define ASIO_SSL_IMPL_CONTEXT_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_ENABLE_OLD_SSL)
+# include "asio/detail/throw_error.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+template <typename VerifyCallback>
+void context::set_verify_callback(VerifyCallback callback)
+{
+  asio::error_code ec;
+  this->set_verify_callback(callback, ec);
+  asio::detail::throw_error(ec, "set_verify_callback");
+}
+
+template <typename VerifyCallback>
+asio::error_code context::set_verify_callback(
+    VerifyCallback callback, asio::error_code& ec)
+{
+  return do_set_verify_callback(
+      new detail::verify_callback<VerifyCallback>(callback), ec);
+}
+
+template <typename PasswordCallback>
+void context::set_password_callback(PasswordCallback callback)
+{
+  asio::error_code ec;
+  this->set_password_callback(callback, ec);
+  asio::detail::throw_error(ec, "set_password_callback");
+}
+
+template <typename PasswordCallback>
+asio::error_code context::set_password_callback(
+    PasswordCallback callback, asio::error_code& ec)
+{
+  return do_set_password_callback(
+      new detail::password_callback<PasswordCallback>(callback), ec);
+}
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_IMPL_CONTEXT_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.ipp
new file mode 100644
index 0000000..785b3ee
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/context.ipp
@@ -0,0 +1,950 @@
+//
+// ssl/impl/context.ipp
+// ~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-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_SSL_IMPL_CONTEXT_IPP
+#define ASIO_SSL_IMPL_CONTEXT_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_ENABLE_OLD_SSL)
+# include <cstring>
+# include "asio/detail/throw_error.hpp"
+# include "asio/error.hpp"
+# include "asio/ssl/context.hpp"
+# include "asio/ssl/error.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+struct context::bio_cleanup
+{
+  BIO* p;
+  ~bio_cleanup() { if (p) ::BIO_free(p); }
+};
+
+struct context::x509_cleanup
+{
+  X509* p;
+  ~x509_cleanup() { if (p) ::X509_free(p); }
+};
+
+struct context::evp_pkey_cleanup
+{
+  EVP_PKEY* p;
+  ~evp_pkey_cleanup() { if (p) ::EVP_PKEY_free(p); }
+};
+
+struct context::rsa_cleanup
+{
+  RSA* p;
+  ~rsa_cleanup() { if (p) ::RSA_free(p); }
+};
+
+struct context::dh_cleanup
+{
+  DH* p;
+  ~dh_cleanup() { if (p) ::DH_free(p); }
+};
+
+context::context(context::method m)
+  : handle_(0)
+{
+  switch (m)
+  {
+#if defined(OPENSSL_NO_SSL2)
+  case context::sslv2:
+  case context::sslv2_client:
+  case context::sslv2_server:
+    asio::detail::throw_error(
+        asio::error::invalid_argument, "context");
+    break;
+#else // defined(OPENSSL_NO_SSL2)
+  case context::sslv2:
+    handle_ = ::SSL_CTX_new(::SSLv2_method());
+    break;
+  case context::sslv2_client:
+    handle_ = ::SSL_CTX_new(::SSLv2_client_method());
+    break;
+  case context::sslv2_server:
+    handle_ = ::SSL_CTX_new(::SSLv2_server_method());
+    break;
+#endif // defined(OPENSSL_NO_SSL2)
+  case context::sslv3:
+    handle_ = ::SSL_CTX_new(::SSLv3_method());
+    break;
+  case context::sslv3_client:
+    handle_ = ::SSL_CTX_new(::SSLv3_client_method());
+    break;
+  case context::sslv3_server:
+    handle_ = ::SSL_CTX_new(::SSLv3_server_method());
+    break;
+  case context::tlsv1:
+    handle_ = ::SSL_CTX_new(::TLSv1_method());
+    break;
+  case context::tlsv1_client:
+    handle_ = ::SSL_CTX_new(::TLSv1_client_method());
+    break;
+  case context::tlsv1_server:
+    handle_ = ::SSL_CTX_new(::TLSv1_server_method());
+    break;
+  case context::sslv23:
+    handle_ = ::SSL_CTX_new(::SSLv23_method());
+    break;
+  case context::sslv23_client:
+    handle_ = ::SSL_CTX_new(::SSLv23_client_method());
+    break;
+  case context::sslv23_server:
+    handle_ = ::SSL_CTX_new(::SSLv23_server_method());
+    break;
+#if defined(SSL_TXT_TLSV1_1)
+  case context::tlsv11:
+    handle_ = ::SSL_CTX_new(::TLSv1_1_method());
+    break;
+  case context::tlsv11_client:
+    handle_ = ::SSL_CTX_new(::TLSv1_1_client_method());
+    break;
+  case context::tlsv11_server:
+    handle_ = ::SSL_CTX_new(::TLSv1_1_server_method());
+    break;
+#else // defined(SSL_TXT_TLSV1_1)
+  case context::tlsv11:
+  case context::tlsv11_client:
+  case context::tlsv11_server:
+    asio::detail::throw_error(
+        asio::error::invalid_argument, "context");
+    break;
+#endif // defined(SSL_TXT_TLSV1_1)
+#if defined(SSL_TXT_TLSV1_2)
+  case context::tlsv12:
+    handle_ = ::SSL_CTX_new(::TLSv1_2_method());
+    break;
+  case context::tlsv12_client:
+    handle_ = ::SSL_CTX_new(::TLSv1_2_client_method());
+    break;
+  case context::tlsv12_server:
+    handle_ = ::SSL_CTX_new(::TLSv1_2_server_method());
+    break;
+#else // defined(SSL_TXT_TLSV1_2) 
+  case context::tlsv12:
+  case context::tlsv12_client:
+  case context::tlsv12_server:
+    asio::detail::throw_error(
+        asio::error::invalid_argument, "context");
+    break;
+#endif // defined(SSL_TXT_TLSV1_2) 
+  default:
+    handle_ = ::SSL_CTX_new(0);
+    break;
+  }
+
+  if (handle_ == 0)
+  {
+    asio::error_code ec(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    asio::detail::throw_error(ec, "context");
+  }
+
+  set_options(no_compression);
+}
+
+context::context(asio::io_service&, context::method m)
+  : handle_(0)
+{
+  context tmp(m);
+  handle_ = tmp.handle_;
+  tmp.handle_ = 0;
+}
+
+#if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+context::context(context&& other)
+{
+  handle_ = other.handle_;
+  other.handle_ = 0;
+}
+
+context& context::operator=(context&& other)
+{
+  context tmp(ASIO_MOVE_CAST(context)(*this));
+  handle_ = other.handle_;
+  other.handle_ = 0;
+  return *this;
+}
+#endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+
+context::~context()
+{
+  if (handle_)
+  {
+    if (handle_->default_passwd_callback_userdata)
+    {
+      detail::password_callback_base* callback =
+        static_cast<detail::password_callback_base*>(
+            handle_->default_passwd_callback_userdata);
+      delete callback;
+      handle_->default_passwd_callback_userdata = 0;
+    }
+
+    if (SSL_CTX_get_app_data(handle_))
+    {
+      detail::verify_callback_base* callback =
+        static_cast<detail::verify_callback_base*>(
+            SSL_CTX_get_app_data(handle_));
+      delete callback;
+      SSL_CTX_set_app_data(handle_, 0);
+    }
+
+    ::SSL_CTX_free(handle_);
+  }
+}
+
+context::native_handle_type context::native_handle()
+{
+  return handle_;
+}
+
+context::impl_type context::impl()
+{
+  return handle_;
+}
+
+void context::clear_options(context::options o)
+{
+  asio::error_code ec;
+  clear_options(o, ec);
+  asio::detail::throw_error(ec, "clear_options");
+}
+
+asio::error_code context::clear_options(
+    context::options o, asio::error_code& ec)
+{
+#if (OPENSSL_VERSION_NUMBER >= 0x009080DFL) \
+  && (OPENSSL_VERSION_NUMBER != 0x00909000L)
+# if !defined(SSL_OP_NO_COMPRESSION)
+  if ((o & context::no_compression) != 0)
+  {
+# if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+    handle_->comp_methods = SSL_COMP_get_compression_methods();
+# endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+    o ^= context::no_compression;
+  }
+# endif // !defined(SSL_OP_NO_COMPRESSION)
+
+  ::SSL_CTX_clear_options(handle_, o);
+
+  ec = asio::error_code();
+#else // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
+      //   && (OPENSSL_VERSION_NUMBER != 0x00909000L)
+  (void)o;
+  ec = asio::error::operation_not_supported;
+#endif // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
+       //   && (OPENSSL_VERSION_NUMBER != 0x00909000L)
+  return ec;
+}
+
+void context::set_options(context::options o)
+{
+  asio::error_code ec;
+  set_options(o, ec);
+  asio::detail::throw_error(ec, "set_options");
+}
+
+asio::error_code context::set_options(
+    context::options o, asio::error_code& ec)
+{
+#if !defined(SSL_OP_NO_COMPRESSION)
+  if ((o & context::no_compression) != 0)
+  {
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+    handle_->comp_methods =
+      asio::ssl::detail::openssl_init<>::get_null_compression_methods();
+#endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
+    o ^= context::no_compression;
+  }
+#endif // !defined(SSL_OP_NO_COMPRESSION)
+
+  ::SSL_CTX_set_options(handle_, o);
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::set_verify_mode(verify_mode v)
+{
+  asio::error_code ec;
+  set_verify_mode(v, ec);
+  asio::detail::throw_error(ec, "set_verify_mode");
+}
+
+asio::error_code context::set_verify_mode(
+    verify_mode v, asio::error_code& ec)
+{
+  ::SSL_CTX_set_verify(handle_, v, ::SSL_CTX_get_verify_callback(handle_));
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::set_verify_depth(int depth)
+{
+  asio::error_code ec;
+  set_verify_depth(depth, ec);
+  asio::detail::throw_error(ec, "set_verify_depth");
+}
+
+asio::error_code context::set_verify_depth(
+    int depth, asio::error_code& ec)
+{
+  ::SSL_CTX_set_verify_depth(handle_, depth);
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::load_verify_file(const std::string& filename)
+{
+  asio::error_code ec;
+  load_verify_file(filename, ec);
+  asio::detail::throw_error(ec, "load_verify_file");
+}
+
+asio::error_code context::load_verify_file(
+    const std::string& filename, asio::error_code& ec)
+{
+  if (::SSL_CTX_load_verify_locations(handle_, filename.c_str(), 0) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::add_certificate_authority(const const_buffer& ca)
+{
+  asio::error_code ec;
+  add_certificate_authority(ca, ec);
+  asio::detail::throw_error(ec, "add_certificate_authority");
+}
+
+asio::error_code context::add_certificate_authority(
+    const const_buffer& ca, asio::error_code& ec)
+{
+  ::ERR_clear_error();
+
+  bio_cleanup bio = { make_buffer_bio(ca) };
+  if (bio.p)
+  {
+    x509_cleanup cert = { ::PEM_read_bio_X509(bio.p, 0, 0, 0) };
+    if (cert.p)
+    {
+      if (X509_STORE* store = ::SSL_CTX_get_cert_store(handle_))
+      {
+        if (::X509_STORE_add_cert(store, cert.p) == 1)
+        {
+          ec = asio::error_code();
+          return ec;
+        }
+      }
+    }
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+void context::set_default_verify_paths()
+{
+  asio::error_code ec;
+  set_default_verify_paths(ec);
+  asio::detail::throw_error(ec, "set_default_verify_paths");
+}
+
+asio::error_code context::set_default_verify_paths(
+    asio::error_code& ec)
+{
+  if (::SSL_CTX_set_default_verify_paths(handle_) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::add_verify_path(const std::string& path)
+{
+  asio::error_code ec;
+  add_verify_path(path, ec);
+  asio::detail::throw_error(ec, "add_verify_path");
+}
+
+asio::error_code context::add_verify_path(
+    const std::string& path, asio::error_code& ec)
+{
+  if (::SSL_CTX_load_verify_locations(handle_, 0, path.c_str()) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::use_certificate(
+    const const_buffer& certificate, file_format format)
+{
+  asio::error_code ec;
+  use_certificate(certificate, format, ec);
+  asio::detail::throw_error(ec, "use_certificate");
+}
+
+asio::error_code context::use_certificate(
+    const const_buffer& certificate, file_format format,
+    asio::error_code& ec)
+{
+  ::ERR_clear_error();
+
+  if (format == context_base::asn1)
+  {
+    if (::SSL_CTX_use_certificate_ASN1(handle_,
+          static_cast<int>(buffer_size(certificate)),
+          buffer_cast<const unsigned char*>(certificate)) == 1)
+    {
+      ec = asio::error_code();
+      return ec;
+    }
+  }
+  else if (format == context_base::pem)
+  {
+    bio_cleanup bio = { make_buffer_bio(certificate) };
+    if (bio.p)
+    {
+      x509_cleanup cert = { ::PEM_read_bio_X509(bio.p, 0, 0, 0) };
+      if (cert.p)
+      {
+        if (::SSL_CTX_use_certificate(handle_, cert.p) == 1)
+        {
+          ec = asio::error_code();
+          return ec;
+        }
+      }
+    }
+  }
+  else
+  {
+    ec = asio::error::invalid_argument;
+    return ec;
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+void context::use_certificate_file(
+    const std::string& filename, file_format format)
+{
+  asio::error_code ec;
+  use_certificate_file(filename, format, ec);
+  asio::detail::throw_error(ec, "use_certificate_file");
+}
+
+asio::error_code context::use_certificate_file(
+    const std::string& filename, file_format format,
+    asio::error_code& ec)
+{
+  int file_type;
+  switch (format)
+  {
+  case context_base::asn1:
+    file_type = SSL_FILETYPE_ASN1;
+    break;
+  case context_base::pem:
+    file_type = SSL_FILETYPE_PEM;
+    break;
+  default:
+    {
+      ec = asio::error::invalid_argument;
+      return ec;
+    }
+  }
+
+  if (::SSL_CTX_use_certificate_file(handle_, filename.c_str(), file_type) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::use_certificate_chain(const const_buffer& chain)
+{
+  asio::error_code ec;
+  use_certificate_chain(chain, ec);
+  asio::detail::throw_error(ec, "use_certificate_chain");
+}
+
+asio::error_code context::use_certificate_chain(
+    const const_buffer& chain, asio::error_code& ec)
+{
+  ::ERR_clear_error();
+
+  bio_cleanup bio = { make_buffer_bio(chain) };
+  if (bio.p)
+  {
+    x509_cleanup cert = {
+      ::PEM_read_bio_X509_AUX(bio.p, 0,
+          handle_->default_passwd_callback,
+          handle_->default_passwd_callback_userdata) };
+    if (!cert.p)
+    {
+      ec = asio::error_code(ERR_R_PEM_LIB,
+          asio::error::get_ssl_category());
+      return ec;
+    }
+
+    int result = ::SSL_CTX_use_certificate(handle_, cert.p);
+    if (result == 0 || ::ERR_peek_error() != 0)
+    {
+      ec = asio::error_code(
+          static_cast<int>(::ERR_get_error()),
+          asio::error::get_ssl_category());
+      return ec;
+    }
+
+    if (handle_->extra_certs)
+    {
+      ::sk_X509_pop_free(handle_->extra_certs, X509_free);
+      handle_->extra_certs = 0;
+    }
+
+    while (X509* cacert = ::PEM_read_bio_X509(bio.p, 0,
+          handle_->default_passwd_callback,
+          handle_->default_passwd_callback_userdata))
+    {
+      if (!::SSL_CTX_add_extra_chain_cert(handle_, cacert))
+      {
+        ec = asio::error_code(
+            static_cast<int>(::ERR_get_error()),
+            asio::error::get_ssl_category());
+        return ec;
+      }
+    }
+  
+    result = ::ERR_peek_last_error();
+    if ((ERR_GET_LIB(result) == ERR_LIB_PEM)
+        && (ERR_GET_REASON(result) == PEM_R_NO_START_LINE))
+    {
+      ::ERR_clear_error();
+      ec = asio::error_code();
+      return ec;
+    }
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+void context::use_certificate_chain_file(const std::string& filename)
+{
+  asio::error_code ec;
+  use_certificate_chain_file(filename, ec);
+  asio::detail::throw_error(ec, "use_certificate_chain_file");
+}
+
+asio::error_code context::use_certificate_chain_file(
+    const std::string& filename, asio::error_code& ec)
+{
+  if (::SSL_CTX_use_certificate_chain_file(handle_, filename.c_str()) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::use_private_key(
+    const const_buffer& private_key, context::file_format format)
+{
+  asio::error_code ec;
+  use_private_key(private_key, format, ec);
+  asio::detail::throw_error(ec, "use_private_key");
+}
+
+asio::error_code context::use_private_key(
+    const const_buffer& private_key, context::file_format format,
+    asio::error_code& ec)
+{
+  ::ERR_clear_error();
+
+  bio_cleanup bio = { make_buffer_bio(private_key) };
+  if (bio.p)
+  {
+    evp_pkey_cleanup evp_private_key = { 0 };
+    switch (format)
+    {
+    case context_base::asn1:
+      evp_private_key.p = ::d2i_PrivateKey_bio(bio.p, 0);
+      break;
+    case context_base::pem:
+      evp_private_key.p = ::PEM_read_bio_PrivateKey(bio.p, 0, 0, 0);
+      break;
+    default:
+      {
+        ec = asio::error::invalid_argument;
+        return ec;
+      }
+    }
+
+    if (evp_private_key.p)
+    {
+      if (::SSL_CTX_use_PrivateKey(handle_, evp_private_key.p) == 1)
+      {
+        ec = asio::error_code();
+        return ec;
+      }
+    }
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+void context::use_private_key_file(
+    const std::string& filename, context::file_format format)
+{
+  asio::error_code ec;
+  use_private_key_file(filename, format, ec);
+  asio::detail::throw_error(ec, "use_private_key_file");
+}
+
+void context::use_rsa_private_key(
+    const const_buffer& private_key, context::file_format format)
+{
+  asio::error_code ec;
+  use_rsa_private_key(private_key, format, ec);
+  asio::detail::throw_error(ec, "use_rsa_private_key");
+}
+
+asio::error_code context::use_rsa_private_key(
+    const const_buffer& private_key, context::file_format format,
+    asio::error_code& ec)
+{
+  ::ERR_clear_error();
+
+  bio_cleanup bio = { make_buffer_bio(private_key) };
+  if (bio.p)
+  {
+    rsa_cleanup rsa_private_key = { 0 };
+    switch (format)
+    {
+    case context_base::asn1:
+      rsa_private_key.p = ::d2i_RSAPrivateKey_bio(bio.p, 0);
+      break;
+    case context_base::pem:
+      rsa_private_key.p = ::PEM_read_bio_RSAPrivateKey(bio.p, 0, 0, 0);
+      break;
+    default:
+      {
+        ec = asio::error::invalid_argument;
+        return ec;
+      }
+    }
+
+    if (rsa_private_key.p)
+    {
+      if (::SSL_CTX_use_RSAPrivateKey(handle_, rsa_private_key.p) == 1)
+      {
+        ec = asio::error_code();
+        return ec;
+      }
+    }
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+asio::error_code context::use_private_key_file(
+    const std::string& filename, context::file_format format,
+    asio::error_code& ec)
+{
+  int file_type;
+  switch (format)
+  {
+  case context_base::asn1:
+    file_type = SSL_FILETYPE_ASN1;
+    break;
+  case context_base::pem:
+    file_type = SSL_FILETYPE_PEM;
+    break;
+  default:
+    {
+      ec = asio::error::invalid_argument;
+      return ec;
+    }
+  }
+
+  if (::SSL_CTX_use_PrivateKey_file(handle_, filename.c_str(), file_type) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::use_rsa_private_key_file(
+    const std::string& filename, context::file_format format)
+{
+  asio::error_code ec;
+  use_rsa_private_key_file(filename, format, ec);
+  asio::detail::throw_error(ec, "use_rsa_private_key_file");
+}
+
+asio::error_code context::use_rsa_private_key_file(
+    const std::string& filename, context::file_format format,
+    asio::error_code& ec)
+{
+  int file_type;
+  switch (format)
+  {
+  case context_base::asn1:
+    file_type = SSL_FILETYPE_ASN1;
+    break;
+  case context_base::pem:
+    file_type = SSL_FILETYPE_PEM;
+    break;
+  default:
+    {
+      ec = asio::error::invalid_argument;
+      return ec;
+    }
+  }
+
+  if (::SSL_CTX_use_RSAPrivateKey_file(
+        handle_, filename.c_str(), file_type) != 1)
+  {
+    ec = asio::error_code(
+        static_cast<int>(::ERR_get_error()),
+        asio::error::get_ssl_category());
+    return ec;
+  }
+
+  ec = asio::error_code();
+  return ec;
+}
+
+void context::use_tmp_dh(const const_buffer& dh)
+{
+  asio::error_code ec;
+  use_tmp_dh(dh, ec);
+  asio::detail::throw_error(ec, "use_tmp_dh");
+}
+
+asio::error_code context::use_tmp_dh(
+    const const_buffer& dh, asio::error_code& ec)
+{
+  bio_cleanup bio = { make_buffer_bio(dh) };
+  if (bio.p)
+  {
+    return do_use_tmp_dh(bio.p, ec);
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+void context::use_tmp_dh_file(const std::string& filename)
+{
+  asio::error_code ec;
+  use_tmp_dh_file(filename, ec);
+  asio::detail::throw_error(ec, "use_tmp_dh_file");
+}
+
+asio::error_code context::use_tmp_dh_file(
+    const std::string& filename, asio::error_code& ec)
+{
+  bio_cleanup bio = { ::BIO_new_file(filename.c_str(), "r") };
+  if (bio.p)
+  {
+    return do_use_tmp_dh(bio.p, ec);
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+asio::error_code context::do_use_tmp_dh(
+    BIO* bio, asio::error_code& ec)
+{
+  ::ERR_clear_error();
+
+  dh_cleanup dh = { ::PEM_read_bio_DHparams(bio, 0, 0, 0) };
+  if (dh.p)
+  {
+    if (::SSL_CTX_set_tmp_dh(handle_, dh.p) == 1)
+    {
+      ec = asio::error_code();
+      return ec;
+    }
+  }
+
+  ec = asio::error_code(
+      static_cast<int>(::ERR_get_error()),
+      asio::error::get_ssl_category());
+  return ec;
+}
+
+asio::error_code context::do_set_verify_callback(
+    detail::verify_callback_base* callback, asio::error_code& ec)
+{
+  if (SSL_CTX_get_app_data(handle_))
+  {
+    delete static_cast<detail::verify_callback_base*>(
+        SSL_CTX_get_app_data(handle_));
+  }
+
+  SSL_CTX_set_app_data(handle_, callback);
+
+  ::SSL_CTX_set_verify(handle_,
+      ::SSL_CTX_get_verify_mode(handle_),
+      &context::verify_callback_function);
+
+  ec = asio::error_code();
+  return ec;
+}
+
+int context::verify_callback_function(int preverified, X509_STORE_CTX* ctx)
+{
+  if (ctx)
+  {
+    if (SSL* ssl = static_cast<SSL*>(
+          ::X509_STORE_CTX_get_ex_data(
+            ctx, ::SSL_get_ex_data_X509_STORE_CTX_idx())))
+    {
+      if (SSL_CTX* handle = ::SSL_get_SSL_CTX(ssl))
+      {
+        if (SSL_CTX_get_app_data(handle))
+        {
+          detail::verify_callback_base* callback =
+            static_cast<detail::verify_callback_base*>(
+                SSL_CTX_get_app_data(handle));
+
+          verify_context verify_ctx(ctx);
+          return callback->call(preverified != 0, verify_ctx) ? 1 : 0;
+        }
+      }
+    }
+  }
+
+  return 0;
+}
+
+asio::error_code context::do_set_password_callback(
+    detail::password_callback_base* callback, asio::error_code& ec)
+{
+  if (handle_->default_passwd_callback_userdata)
+    delete static_cast<detail::password_callback_base*>(
+        handle_->default_passwd_callback_userdata);
+
+  handle_->default_passwd_callback_userdata = callback;
+
+  SSL_CTX_set_default_passwd_cb(handle_, &context::password_callback_function);
+
+  ec = asio::error_code();
+  return ec;
+}
+
+int context::password_callback_function(
+    char* buf, int size, int purpose, void* data)
+{
+  using namespace std; // For strncat and strlen.
+
+  if (data)
+  {
+    detail::password_callback_base* callback =
+      static_cast<detail::password_callback_base*>(data);
+
+    std::string passwd = callback->call(static_cast<std::size_t>(size),
+        purpose ? context_base::for_writing : context_base::for_reading);
+
+#if defined(ASIO_HAS_SECURE_RTL)
+    strcpy_s(buf, size, passwd.c_str());
+#else // defined(ASIO_HAS_SECURE_RTL)
+    *buf = '\0';
+    strncat(buf, passwd.c_str(), size);
+#endif // defined(ASIO_HAS_SECURE_RTL)
+
+    return static_cast<int>(strlen(buf));
+  }
+
+  return 0;
+}
+
+BIO* context::make_buffer_bio(const const_buffer& b)
+{
+  return ::BIO_new_mem_buf(
+      const_cast<void*>(buffer_cast<const void*>(b)),
+      static_cast<int>(buffer_size(b)));
+}
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_IMPL_CONTEXT_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/error.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/error.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/error.ipp
new file mode 100644
index 0000000..93626f1
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/error.ipp
@@ -0,0 +1,57 @@
+//
+// ssl/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_SSL_IMPL_ERROR_IPP
+#define ASIO_SSL_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 "asio/ssl/error.hpp"
+#include "asio/ssl/detail/openssl_init.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace error {
+
+namespace detail {
+
+class ssl_category : public asio::error_category
+{
+public:
+  const char* name() const ASIO_ERROR_CATEGORY_NOEXCEPT
+  {
+    return "asio.ssl";
+  }
+
+  std::string message(int value) const
+  {
+    const char* s = ::ERR_reason_error_string(value);
+    return s ? s : "asio.ssl error";
+  }
+};
+
+} // namespace detail
+
+const asio::error_category& get_ssl_category()
+{
+  static detail::ssl_category instance;
+  return instance;
+}
+
+} // namespace error
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_IMPL_ERROR_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/rfc2818_verification.ipp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/rfc2818_verification.ipp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/rfc2818_verification.ipp
new file mode 100644
index 0000000..86cb23d
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/rfc2818_verification.ipp
@@ -0,0 +1,166 @@
+//
+// ssl/impl/rfc2818_verification.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_SSL_IMPL_RFC2818_VERIFICATION_IPP
+#define ASIO_SSL_IMPL_RFC2818_VERIFICATION_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_ENABLE_OLD_SSL)
+# include <cctype>
+# include <cstring>
+# include "asio/ip/address.hpp"
+# include "asio/ssl/rfc2818_verification.hpp"
+# include "asio/ssl/detail/openssl_types.hpp"
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+
+#if !defined(ASIO_ENABLE_OLD_SSL)
+
+bool rfc2818_verification::operator()(
+    bool preverified, verify_context& ctx) const
+{
+  using namespace std; // For memcmp.
+
+  // Don't bother looking at certificates that have failed pre-verification.
+  if (!preverified)
+    return false;
+
+  // We're only interested in checking the certificate at the end of the chain.
+  int depth = X509_STORE_CTX_get_error_depth(ctx.native_handle());
+  if (depth > 0)
+    return true;
+
+  // Try converting the host name to an address. If it is an address then we
+  // need to look for an IP address in the certificate rather than a host name.
+  asio::error_code ec;
+  ip::address address = ip::address::from_string(host_, ec);
+  bool is_address = !ec;
+
+  X509* cert = X509_STORE_CTX_get_current_cert(ctx.native_handle());
+
+  // Go through the alternate names in the certificate looking for matching DNS
+  // or IP address entries.
+  GENERAL_NAMES* gens = static_cast<GENERAL_NAMES*>(
+      X509_get_ext_d2i(cert, NID_subject_alt_name, 0, 0));
+  for (int i = 0; i < sk_GENERAL_NAME_num(gens); ++i)
+  {
+    GENERAL_NAME* gen = sk_GENERAL_NAME_value(gens, i);
+    if (gen->type == GEN_DNS && !is_address)
+    {
+      ASN1_IA5STRING* domain = gen->d.dNSName;
+      if (domain->type == V_ASN1_IA5STRING && domain->data && domain->length)
+      {
+        const char* pattern = reinterpret_cast<const char*>(domain->data);
+        std::size_t pattern_length = domain->length;
+        if (match_pattern(pattern, pattern_length, host_.c_str()))
+        {
+          GENERAL_NAMES_free(gens);
+          return true;
+        }
+      }
+    }
+    else if (gen->type == GEN_IPADD && is_address)
+    {
+      ASN1_OCTET_STRING* ip_address = gen->d.iPAddress;
+      if (ip_address->type == V_ASN1_OCTET_STRING && ip_address->data)
+      {
+        if (address.is_v4() && ip_address->length == 4)
+        {
+          ip::address_v4::bytes_type bytes = address.to_v4().to_bytes();
+          if (memcmp(bytes.data(), ip_address->data, 4) == 0)
+          {
+            GENERAL_NAMES_free(gens);
+            return true;
+          }
+        }
+        else if (address.is_v6() && ip_address->length == 16)
+        {
+          ip::address_v6::bytes_type bytes = address.to_v6().to_bytes();
+          if (memcmp(bytes.data(), ip_address->data, 16) == 0)
+          {
+            GENERAL_NAMES_free(gens);
+            return true;
+          }
+        }
+      }
+    }
+  }
+  GENERAL_NAMES_free(gens);
+
+  // No match in the alternate names, so try the common names. We should only
+  // use the "most specific" common name, which is the last one in the list.
+  X509_NAME* name = X509_get_subject_name(cert);
+  int i = -1;
+  ASN1_STRING* common_name = 0;
+  while ((i = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0)
+  {
+    X509_NAME_ENTRY* name_entry = X509_NAME_get_entry(name, i);
+    common_name = X509_NAME_ENTRY_get_data(name_entry);
+  }
+  if (common_name && common_name->data && common_name->length)
+  {
+    const char* pattern = reinterpret_cast<const char*>(common_name->data);
+    std::size_t pattern_length = common_name->length;
+    if (match_pattern(pattern, pattern_length, host_.c_str()))
+      return true;
+  }
+
+  return false;
+}
+
+bool rfc2818_verification::match_pattern(const char* pattern,
+    std::size_t pattern_length, const char* host)
+{
+  using namespace std; // For tolower.
+
+  const char* p = pattern;
+  const char* p_end = p + pattern_length;
+  const char* h = host;
+
+  while (p != p_end && *h)
+  {
+    if (*p == '*')
+    {
+      ++p;
+      while (*h && *h != '.')
+        if (match_pattern(p, p_end - p, h++))
+          return true;
+    }
+    else if (tolower(*p) == tolower(*h))
+    {
+      ++p;
+      ++h;
+    }
+    else
+    {
+      return false;
+    }
+  }
+
+  return p == p_end && !*h;
+}
+
+#endif // !defined(ASIO_ENABLE_OLD_SSL)
+
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_IMPL_RFC2818_VERIFICATION_IPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/src.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/src.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/src.hpp
new file mode 100644
index 0000000..43fd909
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/impl/src.hpp
@@ -0,0 +1,28 @@
+//
+// impl/ssl/src.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_SSL_IMPL_SRC_HPP
+#define ASIO_SSL_IMPL_SRC_HPP
+
+#define ASIO_SOURCE
+
+#include "asio/detail/config.hpp"
+
+#if defined(ASIO_HEADER_ONLY)
+# error Do not compile Asio library source with ASIO_HEADER_ONLY defined
+#endif
+
+#include "asio/ssl/impl/context.ipp"
+#include "asio/ssl/impl/error.ipp"
+#include "asio/ssl/detail/impl/engine.ipp"
+#include "asio/ssl/detail/impl/openssl_init.ipp"
+#include "asio/ssl/impl/rfc2818_verification.ipp"
+
+#endif // ASIO_SSL_IMPL_SRC_HPP

http://git-wip-us.apache.org/repos/asf/hadoop/blob/5b488f3e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/old/basic_context.hpp
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/old/basic_context.hpp b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/old/basic_context.hpp
new file mode 100644
index 0000000..f53fddd
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/native/libhdfspp/third_party/asio-1.10.2/include/asio/ssl/old/basic_context.hpp
@@ -0,0 +1,434 @@
+//
+// ssl/old/basic_context.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2005 Voipster / Indrek dot Juhani at voipster dot com
+// Copyright (c) 2005-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_SSL_OLD_BASIC_CONTEXT_HPP
+#define ASIO_SSL_OLD_BASIC_CONTEXT_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include "asio/detail/config.hpp"
+#include <string>
+#include <boost/noncopyable.hpp>
+#include "asio/detail/throw_error.hpp"
+#include "asio/error.hpp"
+#include "asio/io_service.hpp"
+#include "asio/ssl/context_base.hpp"
+
+#include "asio/detail/push_options.hpp"
+
+namespace asio {
+namespace ssl {
+namespace old {
+
+/// SSL context.
+template <typename Service>
+class basic_context
+  : public context_base,
+    private boost::noncopyable
+{
+public:
+  /// The type of the service that will be used to provide context operations.
+  typedef Service service_type;
+
+  /// The native implementation type of the SSL context.
+  typedef typename service_type::impl_type impl_type;
+
+  /// Constructor.
+  basic_context(asio::io_service& io_service, method m)
+    : service_(asio::use_service<Service>(io_service)),
+      impl_(service_.null())
+  {
+    service_.create(impl_, m);
+  }
+
+  /// Destructor.
+  ~basic_context()
+  {
+    service_.destroy(impl_);
+  }
+
+  /// Get the underlying implementation in the native type.
+  /**
+   * This function may be used to obtain the underlying implementation of the
+   * context. This is intended to allow access to context functionality that is
+   * not otherwise provided.
+   */
+  impl_type impl()
+  {
+    return impl_;
+  }
+
+  /// Set options on the context.
+  /**
+   * This function may be used to configure the SSL options used by the context.
+   *
+   * @param o A bitmask of options. The available option values are defined in
+   * the context_base class. The options are bitwise-ored with any existing
+   * value for the options.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void set_options(options o)
+  {
+    asio::error_code ec;
+    service_.set_options(impl_, o, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Set options on the context.
+  /**
+   * This function may be used to configure the SSL options used by the context.
+   *
+   * @param o A bitmask of options. The available option values are defined in
+   * the context_base class. The options are bitwise-ored with any existing
+   * value for the options.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code set_options(options o,
+      asio::error_code& ec)
+  {
+    return service_.set_options(impl_, o, ec);
+  }
+
+  /// Set the peer verification mode.
+  /**
+   * This function may be used to configure the peer verification mode used by
+   * the context.
+   *
+   * @param v A bitmask of peer verification modes. The available verify_mode
+   * values are defined in the context_base class.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void set_verify_mode(verify_mode v)
+  {
+    asio::error_code ec;
+    service_.set_verify_mode(impl_, v, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Set the peer verification mode.
+  /**
+   * This function may be used to configure the peer verification mode used by
+   * the context.
+   *
+   * @param v A bitmask of peer verification modes. The available verify_mode
+   * values are defined in the context_base class.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code set_verify_mode(verify_mode v,
+      asio::error_code& ec)
+  {
+    return service_.set_verify_mode(impl_, v, ec);
+  }
+
+  /// Load a certification authority file for performing verification.
+  /**
+   * This function is used to load one or more trusted certification authorities
+   * from a file.
+   *
+   * @param filename The name of a file containing certification authority
+   * certificates in PEM format.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void load_verify_file(const std::string& filename)
+  {
+    asio::error_code ec;
+    service_.load_verify_file(impl_, filename, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Load a certification authority file for performing verification.
+  /**
+   * This function is used to load the certificates for one or more trusted
+   * certification authorities from a file.
+   *
+   * @param filename The name of a file containing certification authority
+   * certificates in PEM format.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code load_verify_file(const std::string& filename,
+      asio::error_code& ec)
+  {
+    return service_.load_verify_file(impl_, filename, ec);
+  }
+
+  /// Add a directory containing certificate authority files to be used for
+  /// performing verification.
+  /**
+   * This function is used to specify the name of a directory containing
+   * certification authority certificates. Each file in the directory must
+   * contain a single certificate. The files must be named using the subject
+   * name's hash and an extension of ".0".
+   *
+   * @param path The name of a directory containing the certificates.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void add_verify_path(const std::string& path)
+  {
+    asio::error_code ec;
+    service_.add_verify_path(impl_, path, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Add a directory containing certificate authority files to be used for
+  /// performing verification.
+  /**
+   * This function is used to specify the name of a directory containing
+   * certification authority certificates. Each file in the directory must
+   * contain a single certificate. The files must be named using the subject
+   * name's hash and an extension of ".0".
+   *
+   * @param path The name of a directory containing the certificates.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code add_verify_path(const std::string& path,
+      asio::error_code& ec)
+  {
+    return service_.add_verify_path(impl_, path, ec);
+  }
+
+  /// Use a certificate from a file.
+  /**
+   * This function is used to load a certificate into the context from a file.
+   *
+   * @param filename The name of the file containing the certificate.
+   *
+   * @param format The file format (ASN.1 or PEM).
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void use_certificate_file(const std::string& filename, file_format format)
+  {
+    asio::error_code ec;
+    service_.use_certificate_file(impl_, filename, format, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Use a certificate from a file.
+  /**
+   * This function is used to load a certificate into the context from a file.
+   *
+   * @param filename The name of the file containing the certificate.
+   *
+   * @param format The file format (ASN.1 or PEM).
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code use_certificate_file(const std::string& filename,
+      file_format format, asio::error_code& ec)
+  {
+    return service_.use_certificate_file(impl_, filename, format, ec);
+  }
+
+  /// Use a certificate chain from a file.
+  /**
+   * This function is used to load a certificate chain into the context from a
+   * file.
+   *
+   * @param filename The name of the file containing the certificate. The file
+   * must use the PEM format.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void use_certificate_chain_file(const std::string& filename)
+  {
+    asio::error_code ec;
+    service_.use_certificate_chain_file(impl_, filename, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Use a certificate chain from a file.
+  /**
+   * This function is used to load a certificate chain into the context from a
+   * file.
+   *
+   * @param filename The name of the file containing the certificate. The file
+   * must use the PEM format.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code use_certificate_chain_file(
+      const std::string& filename, asio::error_code& ec)
+  {
+    return service_.use_certificate_chain_file(impl_, filename, ec);
+  }
+
+  /// Use a private key from a file.
+  /**
+   * This function is used to load a private key into the context from a file.
+   *
+   * @param filename The name of the file containing the private key.
+   *
+   * @param format The file format (ASN.1 or PEM).
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void use_private_key_file(const std::string& filename, file_format format)
+  {
+    asio::error_code ec;
+    service_.use_private_key_file(impl_, filename, format, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Use a private key from a file.
+  /**
+   * This function is used to load a private key into the context from a file.
+   *
+   * @param filename The name of the file containing the private key.
+   *
+   * @param format The file format (ASN.1 or PEM).
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code use_private_key_file(const std::string& filename,
+      file_format format, asio::error_code& ec)
+  {
+    return service_.use_private_key_file(impl_, filename, format, ec);
+  }
+
+  /// Use an RSA private key from a file.
+  /**
+   * This function is used to load an RSA private key into the context from a
+   * file.
+   *
+   * @param filename The name of the file containing the RSA private key.
+   *
+   * @param format The file format (ASN.1 or PEM).
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void use_rsa_private_key_file(const std::string& filename, file_format format)
+  {
+    asio::error_code ec;
+    service_.use_rsa_private_key_file(impl_, filename, format, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Use an RSA private key from a file.
+  /**
+   * This function is used to load an RSA private key into the context from a
+   * file.
+   *
+   * @param filename The name of the file containing the RSA private key.
+   *
+   * @param format The file format (ASN.1 or PEM).
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code use_rsa_private_key_file(
+      const std::string& filename, file_format format,
+      asio::error_code& ec)
+  {
+    return service_.use_rsa_private_key_file(impl_, filename, format, ec);
+  }
+
+  /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+  /**
+   * This function is used to load Diffie-Hellman parameters into the context
+   * from a file.
+   *
+   * @param filename The name of the file containing the Diffie-Hellman
+   * parameters. The file must use the PEM format.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  void use_tmp_dh_file(const std::string& filename)
+  {
+    asio::error_code ec;
+    service_.use_tmp_dh_file(impl_, filename, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Use the specified file to obtain the temporary Diffie-Hellman parameters.
+  /**
+   * This function is used to load Diffie-Hellman parameters into the context
+   * from a file.
+   *
+   * @param filename The name of the file containing the Diffie-Hellman
+   * parameters. The file must use the PEM format.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  asio::error_code use_tmp_dh_file(const std::string& filename,
+      asio::error_code& ec)
+  {
+    return service_.use_tmp_dh_file(impl_, filename, ec);
+  }
+
+  /// Set the password callback.
+  /**
+   * This function is used to specify a callback function to obtain password
+   * information about an encrypted key in PEM format.
+   *
+   * @param callback The function object to be used for obtaining the password.
+   * The function signature of the handler must be:
+   * @code std::string password_callback(
+   *   std::size_t max_length,  // The maximum size for a password.
+   *   password_purpose purpose // Whether password is for reading or writing.
+   * ); @endcode
+   * The return value of the callback is a string containing the password.
+   *
+   * @throws asio::system_error Thrown on failure.
+   */
+  template <typename PasswordCallback>
+  void set_password_callback(PasswordCallback callback)
+  {
+    asio::error_code ec;
+    service_.set_password_callback(impl_, callback, ec);
+    asio::detail::throw_error(ec);
+  }
+
+  /// Set the password callback.
+  /**
+   * This function is used to specify a callback function to obtain password
+   * information about an encrypted key in PEM format.
+   *
+   * @param callback The function object to be used for obtaining the password.
+   * The function signature of the handler must be:
+   * @code std::string password_callback(
+   *   std::size_t max_length,  // The maximum size for a password.
+   *   password_purpose purpose // Whether password is for reading or writing.
+   * ); @endcode
+   * The return value of the callback is a string containing the password.
+   *
+   * @param ec Set to indicate what error occurred, if any.
+   */
+  template <typename PasswordCallback>
+  asio::error_code set_password_callback(PasswordCallback callback,
+      asio::error_code& ec)
+  {
+    return service_.set_password_callback(impl_, callback, ec);
+  }
+
+private:
+  /// The backend service implementation.
+  service_type& service_;
+
+  /// The underlying native implementation.
+  impl_type impl_;
+};
+
+} // namespace old
+} // namespace ssl
+} // namespace asio
+
+#include "asio/detail/pop_options.hpp"
+
+#endif // ASIO_SSL_OLD_BASIC_CONTEXT_HPP


Mime
View raw message