1 /*
2 *
3 * Copyright 2018 gRPC authors.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18
19 #include <grpc/support/port_platform.h>
20
21 #include <grpc/support/alloc.h>
22 #include "src/core/lib/iomgr/resolve_address.h"
23
24 grpc_address_resolver_vtable* grpc_resolve_address_impl;
25
grpc_set_resolver_impl(grpc_address_resolver_vtable * vtable)26 void grpc_set_resolver_impl(grpc_address_resolver_vtable* vtable) {
27 grpc_resolve_address_impl = vtable;
28 }
29
grpc_resolve_address(const char * addr,const char * default_port,grpc_pollset_set * interested_parties,grpc_closure * on_done,grpc_resolved_addresses ** addresses)30 void grpc_resolve_address(const char* addr, const char* default_port,
31 grpc_pollset_set* interested_parties,
32 grpc_closure* on_done,
33 grpc_resolved_addresses** addresses) {
34 grpc_resolve_address_impl->resolve_address(
35 addr, default_port, interested_parties, on_done, addresses);
36 }
37
grpc_resolved_addresses_destroy(grpc_resolved_addresses * addresses)38 void grpc_resolved_addresses_destroy(grpc_resolved_addresses* addresses) {
39 if (addresses != nullptr) {
40 gpr_free(addresses->addrs);
41 }
42 gpr_free(addresses);
43 }
44
grpc_blocking_resolve_address(const char * name,const char * default_port,grpc_resolved_addresses ** addresses)45 grpc_error* grpc_blocking_resolve_address(const char* name,
46 const char* default_port,
47 grpc_resolved_addresses** addresses) {
48 return grpc_resolve_address_impl->blocking_resolve_address(name, default_port,
49 addresses);
50 }
51