11 #ifndef ASIO_IP_BASIC_RESOLVER_HPP 12 #define ASIO_IP_BASIC_RESOLVER_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 20 #include "asio/any_io_executor.hpp" 21 #include "asio/async_result.hpp" 22 #include "asio/detail/handler_type_requirements.hpp" 23 #include "asio/detail/io_object_impl.hpp" 24 #include "asio/detail/non_const_lvalue.hpp" 25 #include "asio/detail/string_view.hpp" 26 #include "asio/detail/throw_error.hpp" 27 #include "asio/error.hpp" 28 #include "asio/execution_context.hpp" 29 #include "asio/ip/basic_resolver_iterator.hpp" 30 #include "asio/ip/basic_resolver_query.hpp" 31 #include "asio/ip/basic_resolver_results.hpp" 32 #include "asio/ip/resolver_base.hpp" 33 #if defined(ASIO_WINDOWS_RUNTIME) 34 # include "asio/detail/winrt_resolver_service.hpp" 36 # include "asio/detail/resolver_service.hpp" 39 #if defined(ASIO_HAS_MOVE) 41 #endif // defined(ASIO_HAS_MOVE) 43 #include "asio/detail/push_options.hpp" 48 #if !defined(ASIO_IP_BASIC_RESOLVER_FWD_DECL) 49 #define ASIO_IP_BASIC_RESOLVER_FWD_DECL 52 template <
typename InternetProtocol,
typename Executor = any_io_executor>
55 #endif // !defined(ASIO_IP_BASIC_RESOLVER_FWD_DECL) 66 template <
typename InternetProtocol,
typename Executor>
75 template <
typename Executor1>
88 #if !defined(ASIO_NO_DEPRECATED) 94 #endif // !defined(ASIO_NO_DEPRECATED) 120 template <
typename ExecutionContext>
123 is_convertible<ExecutionContext&, execution_context&>::value
129 #if defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 141 : impl_(std::move(
other.impl_))
146 template <
typename InternetProtocol1,
typename Executor1>
159 template <
typename Executor1>
162 is_convertible<Executor1, Executor>::value
164 : impl_(std::move(
other.impl_))
182 impl_ = std::move(
other.impl_);
198 template <
typename Executor1>
200 is_convertible<Executor1, Executor>::value,
205 impl_ = std::move(tmp.impl_);
208 #endif // defined(ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) 223 return impl_.get_executor();
234 return impl_.get_service().cancel(impl_.get_implementation());
237 #if !defined(ASIO_NO_DEPRECATED) 254 results_type r = impl_.get_service().resolve(
255 impl_.get_implementation(), q, ec);
256 asio::detail::throw_error(ec,
"resolve");
275 return impl_.get_service().resolve(impl_.get_implementation(), q, ec);
277 #endif // !defined(ASIO_NO_DEPRECATED) 312 results_type
resolve(ASIO_STRING_VIEW_PARAM host,
313 ASIO_STRING_VIEW_PARAM service)
315 return resolve(host, service, resolver_base::flags());
351 results_type
resolve(ASIO_STRING_VIEW_PARAM host,
354 return resolve(host, service, resolver_base::flags(), ec);
395 results_type
resolve(ASIO_STRING_VIEW_PARAM host,
396 ASIO_STRING_VIEW_PARAM service, resolver_base::flags resolve_flags)
400 static_cast<std::string>(service), resolve_flags);
401 results_type r = impl_.get_service().resolve(
402 impl_.get_implementation(), q, ec);
403 asio::detail::throw_error(ec,
"resolve");
445 results_type
resolve(ASIO_STRING_VIEW_PARAM host,
446 ASIO_STRING_VIEW_PARAM service, resolver_base::flags resolve_flags,
450 static_cast<std::string>(service), resolve_flags);
451 return impl_.get_service().resolve(impl_.get_implementation(), q, ec);
490 results_type
resolve(
const protocol_type& protocol,
491 ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service)
493 return resolve(protocol, host, service, resolver_base::flags());
532 results_type
resolve(
const protocol_type& protocol,
533 ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
536 return resolve(protocol, host, service, resolver_base::flags(), ec);
580 results_type
resolve(
const protocol_type& protocol,
581 ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
582 resolver_base::flags resolve_flags)
586 protocol, static_cast<std::string>(host),
587 static_cast<std::string>(service), resolve_flags);
588 results_type r = impl_.get_service().resolve(
589 impl_.get_implementation(), q, ec);
590 asio::detail::throw_error(ec,
"resolve");
635 results_type
resolve(
const protocol_type& protocol,
636 ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
640 protocol, static_cast<std::string>(host),
641 static_cast<std::string>(service), resolve_flags);
642 return impl_.get_service().resolve(impl_.get_implementation(), q, ec);
645 #if !defined(ASIO_NO_DEPRECATED) 671 results_type)) ResolveHandler
672 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
675 async_resolve(
const query& q,
676 ASIO_MOVE_ARG(ResolveHandler) handler
677 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
679 return asio::async_initiate<ResolveHandler,
681 initiate_async_resolve(
this), handler, q);
683 #endif // !defined(ASIO_NO_DEPRECATED) 729 results_type)) ResolveHandler
730 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
733 async_resolve(ASIO_STRING_VIEW_PARAM host,
734 ASIO_STRING_VIEW_PARAM service,
735 ASIO_MOVE_ARG(ResolveHandler) handler
736 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
738 return async_resolve(host, service, resolver_base::flags(),
739 ASIO_MOVE_CAST(ResolveHandler)(handler));
791 results_type)) ResolveHandler
792 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
795 async_resolve(ASIO_STRING_VIEW_PARAM host,
796 ASIO_STRING_VIEW_PARAM service,
797 resolver_base::flags resolve_flags,
798 ASIO_MOVE_ARG(ResolveHandler) handler
799 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
802 static_cast<std::string>(service), resolve_flags);
804 return asio::async_initiate<ResolveHandler,
806 initiate_async_resolve(
this), handler, q);
856 results_type)) ResolveHandler
857 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
860 async_resolve(
const protocol_type& protocol,
861 ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
862 ASIO_MOVE_ARG(ResolveHandler) handler
863 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
865 return async_resolve(protocol, host, service, resolver_base::flags(),
866 ASIO_MOVE_CAST(ResolveHandler)(handler));
921 results_type)) ResolveHandler
922 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
925 async_resolve(
const protocol_type& protocol,
926 ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service,
927 resolver_base::flags resolve_flags,
928 ASIO_MOVE_ARG(ResolveHandler) handler
929 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
932 protocol, static_cast<std::string>(host),
933 static_cast<std::string>(service), resolve_flags);
935 return asio::async_initiate<ResolveHandler,
937 initiate_async_resolve(
this), handler, q);
957 results_type i = impl_.get_service().resolve(
958 impl_.get_implementation(), e, ec);
959 asio::detail::throw_error(ec,
"resolve");
979 return impl_.get_service().resolve(impl_.get_implementation(), e, ec);
1008 results_type)) ResolveHandler
1009 ASIO_DEFAULT_COMPLETION_TOKEN_TYPE(executor_type)>
1012 async_resolve(
const endpoint_type& e,
1013 ASIO_MOVE_ARG(ResolveHandler) handler
1014 ASIO_DEFAULT_COMPLETION_TOKEN(executor_type))
1016 return asio::async_initiate<ResolveHandler,
1018 initiate_async_resolve(
this), handler, e);
1026 class initiate_async_resolve
1038 return self_->get_executor();
1041 template <
typename ResolveHandler,
typename Query>
1042 void operator()(ASIO_MOVE_ARG(ResolveHandler) handler,
1043 const Query& q)
const 1047 ASIO_RESOLVE_HANDLER_CHECK(
1048 ResolveHandler, handler, results_type) type_check;
1051 self_->impl_.get_service().async_resolve(
1052 self_->impl_.get_implementation(), q,
1053 handler2.value, self_->impl_.get_executor());
1060 # if defined(ASIO_WINDOWS_RUNTIME) 1062 asio::detail::winrt_resolver_service<InternetProtocol>,
1074 #include "asio/detail/pop_options.hpp" 1076 #endif // ASIO_IP_BASIC_RESOLVER_HPP basic_resolver< InternetProtocol, Executor1 > other
The resolver type when rebound to the specified executor.
Definition: basic_resolver.hpp:79
An query to be passed to a resolver.
Definition: basic_resolver_query.hpp:38
Rebinds the resolver type to another executor.
Definition: basic_resolver.hpp:76
~basic_resolver()
Destroys the resolver.
Definition: basic_resolver.hpp:216
results_type resolve(ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service, asio::error_code &ec)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:351
basic_resolver(const executor_type &ex)
Construct with executor.
Definition: basic_resolver.hpp:107
results_type resolve(const protocol_type &protocol, ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service, resolver_base::flags resolve_flags)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:580
basic_resolver(ExecutionContext &context, typename enable_if< is_convertible< ExecutionContext &, execution_context &>::value >::type *=0)
Construct with execution context.
Definition: basic_resolver.hpp:121
basic_resolver_results< InternetProtocol > results_type
The results type.
Definition: basic_resolver.hpp:97
results_type resolve(ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service, resolver_base::flags resolve_flags, asio::error_code &ec)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:445
results_type resolve(const query &q, asio::error_code &ec)
(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a...
Definition: basic_resolver.hpp:273
results_type resolve(ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service, resolver_base::flags resolve_flags)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:395
basic_resolver_iterator< InternetProtocol > iterator
(Deprecated.) The iterator type.
Definition: basic_resolver.hpp:93
Definition: resolver_service.hpp:36
results_type resolve(const protocol_type &protocol, ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service, resolver_base::flags resolve_flags, asio::error_code &ec)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:635
ASIO_INITFN_AUTO_RESULT_TYPE(ResolveHandler, void(asio::error_code, results_type)) async_resolve(const query &q
(Deprecated: Use overload with separate host and service parameters.) Asynchronously perform forward ...
Definition: type_traits.hpp:97
Definition: non_const_lvalue.hpp:27
results_type resolve(const protocol_type &protocol, ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:490
A range of entries produced by a resolver.
Definition: basic_resolver_results.hpp:50
results_type resolve(const endpoint_type &e)
Perform reverse resolution of an endpoint to a list of entries.
Definition: basic_resolver.hpp:954
results_type resolve(const endpoint_type &e, asio::error_code &ec)
Perform reverse resolution of an endpoint to a list of entries.
Definition: basic_resolver.hpp:977
InternetProtocol::endpoint endpoint_type
The endpoint type.
Definition: basic_resolver.hpp:86
Class to represent an error code value.
Definition: error_code.hpp:80
Definition: io_object_impl.hpp:33
basic_resolver_query< InternetProtocol > query
(Deprecated.) The query type.
Definition: basic_resolver.hpp:90
results_type resolve(const query &q)
(Deprecated: Use overload with separate host and service parameters.) Perform forward resolution of a...
Definition: basic_resolver.hpp:251
The resolver_base class is used as a base for the basic_resolver class templates to provide a common ...
Definition: resolver_base.hpp:28
Executor executor_type
The type of the executor associated with the object.
Definition: basic_resolver.hpp:72
Provides endpoint resolution functionality.
Definition: basic_resolver.hpp:53
An iterator over the entries produced by a resolver.
Definition: basic_resolver_iterator.hpp:51
results_type resolve(const protocol_type &protocol, ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service, asio::error_code &ec)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:532
void cancel()
Cancel any asynchronous operations that are waiting on the resolver.
Definition: basic_resolver.hpp:232
InternetProtocol protocol_type
The protocol type.
Definition: basic_resolver.hpp:83
executor_type get_executor() ASIO_NOEXCEPT
Get the executor associated with the object.
Definition: basic_resolver.hpp:221
Definition: any_io_executor.hpp:28
results_type resolve(ASIO_STRING_VIEW_PARAM host, ASIO_STRING_VIEW_PARAM service)
Perform forward resolution of a query to a list of entries.
Definition: basic_resolver.hpp:312