1 // 2 // ssl/detail/handshake_op.hpp 3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2021 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_HANDSHAKE_OP_HPP 12 #define BOOST_ASIO_SSL_DETAIL_HANDSHAKE_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/ssl/detail/engine.hpp> 21 22 #include <boost/asio/detail/push_options.hpp> 23 24 namespace boost { 25 namespace asio { 26 namespace ssl { 27 namespace detail { 28 29 class handshake_op 30 { 31 public: tracking_name()32 static BOOST_ASIO_CONSTEXPR const char* tracking_name() 33 { 34 return "ssl::stream<>::async_handshake"; 35 } 36 handshake_op(stream_base::handshake_type type)37 handshake_op(stream_base::handshake_type type) 38 : type_(type) 39 { 40 } 41 operator ()(engine & eng,boost::system::error_code & ec,std::size_t & bytes_transferred) const42 engine::want operator()(engine& eng, 43 boost::system::error_code& ec, 44 std::size_t& bytes_transferred) const 45 { 46 bytes_transferred = 0; 47 return eng.handshake(type_, ec); 48 } 49 50 template <typename Handler> call_handler(Handler & handler,const boost::system::error_code & ec,const std::size_t &) const51 void call_handler(Handler& handler, 52 const boost::system::error_code& ec, 53 const std::size_t&) const 54 { 55 BOOST_ASIO_MOVE_OR_LVALUE(Handler)(handler)(ec); 56 } 57 58 private: 59 stream_base::handshake_type type_; 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_HANDSHAKE_OP_HPP 70