33 #ifndef _IDENTT_HTTP_ASIO_COMPAT_HPP_ 34 #define _IDENTT_HTTP_ASIO_COMPAT_HPP_ 38 #include <boost/asio.hpp> 39 #include <boost/asio/steady_timer.hpp> 44 namespace asio = boost::asio;
45 namespace error = asio::error;
46 using error_code = boost::system::error_code;
47 namespace errc = boost::system::errc;
48 using system_error = boost::system::system_error;
49 namespace make_error_code = boost::system::errc;
56 #if(BOOST_ASIO_VERSION >= 101300) 57 using io_context = asio::io_context;
58 using io_whatever = asio::io_context;
59 using resolver_results = asio::ip::tcp::resolver::results_type;
60 using async_connect_endpoint = asio::ip::tcp::endpoint;
62 inline void restart(io_context &context) noexcept
66 inline asio::ip::address make_address(
const std::string &str) noexcept
68 return asio::ip::make_address(str);
70 template <
typename socket_type>
71 asio::executor get_socket_executor(socket_type &socket)
73 return socket.get_executor();
75 template <
typename handler_type>
76 void async_resolve(asio::ip::tcp::resolver &resolver,
const std::pair<std::string, std::string> &host_port, handler_type &&handler)
78 resolver.async_resolve(host_port.first, host_port.second, std::forward<handler_type>(handler));
81 using io_context = asio::io_service;
82 using io_whatever = asio::io_service;
83 using resolver_results = asio::ip::tcp::resolver::iterator;
84 using async_connect_endpoint = asio::ip::tcp::resolver::iterator;
86 inline void restart(io_context &context) noexcept
90 inline asio::ip::address make_address(
const std::string &str) noexcept
92 return asio::ip::address::from_string(str);
94 template <
typename socket_type>
95 io_context &get_socket_executor(socket_type &socket)
97 return socket.get_io_service();
99 template <
typename handler_type>
100 void async_resolve(asio::ip::tcp::resolver &resolver,
const std::pair<std::string, std::string> &host_port, handler_type &&handler)
102 resolver.async_resolve(asio::ip::tcp::resolver::query(host_port.first, host_port.second), std::forward<handler_type>(handler));
108 #endif // _IDENTT_HTTP_ASIO_COMPAT_HPP_ Definition: CryptoBase.hpp:49