]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/ssl/detail/read_op.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / asio / ssl / detail / read_op.hpp
1 //
2 // ssl/detail/read_op.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10
11 #ifndef BOOST_ASIO_SSL_DETAIL_READ_OP_HPP
12 #define BOOST_ASIO_SSL_DETAIL_READ_OP_HPP
13
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18 #include <boost/asio/detail/config.hpp>
19
20 #include <boost/asio/detail/buffer_sequence_adapter.hpp>
21 #include <boost/asio/ssl/detail/engine.hpp>
22
23 #include <boost/asio/detail/push_options.hpp>
24
25 namespace boost {
26 namespace asio {
27 namespace ssl {
28 namespace detail {
29
30 template <typename MutableBufferSequence>
31 class read_op
32 {
33 public:
34 read_op(const MutableBufferSequence& buffers)
35 : buffers_(buffers)
36 {
37 }
38
39 engine::want operator()(engine& eng,
40 boost::system::error_code& ec,
41 std::size_t& bytes_transferred) const
42 {
43 boost::asio::mutable_buffer buffer =
44 boost::asio::detail::buffer_sequence_adapter<boost::asio::mutable_buffer,
45 MutableBufferSequence>::first(buffers_);
46
47 return eng.read(buffer, ec, bytes_transferred);
48 }
49
50 template <typename Handler>
51 void call_handler(Handler& handler,
52 const boost::system::error_code& ec,
53 const std::size_t& bytes_transferred) const
54 {
55 handler(ec, bytes_transferred);
56 }
57
58 private:
59 MutableBufferSequence buffers_;
60 };
61
62 } // namespace detail
63 } // namespace ssl
64 } // namespace asio
65 } // namespace boost
66
67 #include <boost/asio/detail/pop_options.hpp>
68
69 #endif // BOOST_ASIO_SSL_DETAIL_READ_OP_HPP