]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/asio/ssl/detail/write_op.hpp
bump version to 18.2.2-pve1
[ceph.git] / ceph / src / boost / boost / asio / ssl / detail / write_op.hpp
CommitLineData
7c673cae
FG
1//
2// ssl/detail/write_op.hpp
3// ~~~~~~~~~~~~~~~~~~~~~~~
4//
1e59de90 5// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7c673cae
FG
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_WRITE_OP_HPP
12#define BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP
13
14#if defined(_MSC_VER) && (_MSC_VER >= 1200)
15# pragma once
16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18#include <boost/asio/detail/config.hpp>
19
b32b8144
FG
20#include <boost/asio/detail/buffer_sequence_adapter.hpp>
21#include <boost/asio/ssl/detail/engine.hpp>
7c673cae
FG
22
23#include <boost/asio/detail/push_options.hpp>
24
25namespace boost {
26namespace asio {
27namespace ssl {
28namespace detail {
29
7c673cae
FG
30template <typename ConstBufferSequence>
31class write_op
32{
33public:
20effc67
TL
34 static BOOST_ASIO_CONSTEXPR const char* tracking_name()
35 {
36 return "ssl::stream<>::async_write_some";
37 }
38
7c673cae
FG
39 write_op(const ConstBufferSequence& buffers)
40 : buffers_(buffers)
41 {
42 }
43
44 engine::want operator()(engine& eng,
45 boost::system::error_code& ec,
46 std::size_t& bytes_transferred) const
47 {
20effc67
TL
48 unsigned char storage[
49 boost::asio::detail::buffer_sequence_adapter<boost::asio::const_buffer,
50 ConstBufferSequence>::linearisation_storage_size];
51
7c673cae
FG
52 boost::asio::const_buffer buffer =
53 boost::asio::detail::buffer_sequence_adapter<boost::asio::const_buffer,
20effc67 54 ConstBufferSequence>::linearise(buffers_, boost::asio::buffer(storage));
7c673cae
FG
55
56 return eng.write(buffer, ec, bytes_transferred);
57 }
58
59 template <typename Handler>
60 void call_handler(Handler& handler,
61 const boost::system::error_code& ec,
62 const std::size_t& bytes_transferred) const
63 {
1e59de90 64 BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec, bytes_transferred);
7c673cae
FG
65 }
66
67private:
68 ConstBufferSequence buffers_;
69};
70
7c673cae
FG
71} // namespace detail
72} // namespace ssl
73} // namespace asio
74} // namespace boost
75
76#include <boost/asio/detail/pop_options.hpp>
77
78#endif // BOOST_ASIO_SSL_DETAIL_WRITE_OP_HPP