1 // 2 // ssl/detail/verify_callback.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_VERIFY_CALLBACK_HPP 12 #define BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_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/verify_context.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 verify_callback_base 30 { 31 public: ~verify_callback_base()32 virtual ~verify_callback_base() 33 { 34 } 35 36 virtual bool call(bool preverified, verify_context& ctx) = 0; 37 }; 38 39 template <typename VerifyCallback> 40 class verify_callback : public verify_callback_base 41 { 42 public: verify_callback(VerifyCallback callback)43 explicit verify_callback(VerifyCallback callback) 44 : callback_(callback) 45 { 46 } 47 call(bool preverified,verify_context & ctx)48 virtual bool call(bool preverified, verify_context& ctx) 49 { 50 return callback_(preverified, ctx); 51 } 52 53 private: 54 VerifyCallback callback_; 55 }; 56 57 } // namespace detail 58 } // namespace ssl 59 } // namespace asio 60 } // namespace boost 61 62 #include <boost/asio/detail/pop_options.hpp> 63 64 #endif // BOOST_ASIO_SSL_DETAIL_VERIFY_CALLBACK_HPP 65