1 //
2 // Copyright 2015 gRPC authors.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef GRPC_SRC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_WINDOWS_H
18 #define GRPC_SRC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_WINDOWS_H
19 
20 #include <grpc/support/port_platform.h>
21 
22 #include <functional>
23 
24 #include "src/core/lib/iomgr/port.h"
25 #include "src/core/lib/iomgr/resolve_address.h"
26 
27 namespace grpc_core {
28 
29 // A DNS resolver which uses the native platform's getaddrinfo API.
30 class NativeDNSResolver : public DNSResolver {
31  public:
32   NativeDNSResolver();
33 
34   TaskHandle LookupHostname(
35       std::function<void(absl::StatusOr<std::vector<grpc_resolved_address>>)>
36           on_resolved,
37       absl::string_view name, absl::string_view default_port, Duration timeout,
38       grpc_pollset_set* interested_parties,
39       absl::string_view name_server) override;
40 
41   absl::StatusOr<std::vector<grpc_resolved_address>> LookupHostnameBlocking(
42       absl::string_view name, absl::string_view default_port) override;
43 
44   TaskHandle LookupSRV(
45       std::function<void(absl::StatusOr<std::vector<grpc_resolved_address>>)>
46           on_resolved,
47       absl::string_view name, Duration timeout,
48       grpc_pollset_set* interested_parties,
49       absl::string_view name_server) override;
50 
51   TaskHandle LookupTXT(
52       std::function<void(absl::StatusOr<std::string>)> on_resolved,
53       absl::string_view name, Duration timeout,
54       grpc_pollset_set* interested_parties,
55       absl::string_view name_server) override;
56 
57   // NativeDNSResolver does not support cancellation.
58   bool Cancel(TaskHandle handle) override;
59 };
60 
61 }  // namespace grpc_core
62 
63 #endif  // GRPC_SRC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_WINDOWS_H
64