GRPC C++  1.39.1
resolve_address.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 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 #ifndef GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
20 #define GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H
21 
23 
24 #include <stddef.h>
25 
27 
28 #ifdef GRPC_UV
29 #include <uv.h>
30 #endif
31 
32 #ifdef GRPC_WINSOCK_SOCKET
33 #include <ws2tcpip.h>
34 #endif
35 
36 #if defined(GRPC_POSIX_SOCKET) || defined(GRPC_CFSTREAM)
37 #include <sys/socket.h>
38 #endif
39 
41 
42 #define GRPC_MAX_SOCKADDR_SIZE 128
43 
46  socklen_t len;
47 };
49  size_t naddrs;
51 };
52 
53 namespace grpc_core {
54 extern const char* kDefaultSecurePort;
55 constexpr int kDefaultSecurePortInt = 443;
56 } // namespace grpc_core
57 
59  void (*resolve_address)(const char* addr, const char* default_port,
60  grpc_pollset_set* interested_parties,
61  grpc_closure* on_done,
62  grpc_resolved_addresses** addresses);
64  const char* name, const char* default_port,
65  grpc_resolved_addresses** addresses);
67 
69 
70 /* Asynchronously resolve addr. Use default_port if a port isn't designated
71  in addr, otherwise use the port in addr. */
72 /* TODO(apolcyn): add a timeout here */
73 void grpc_resolve_address(const char* addr, const char* default_port,
74  grpc_pollset_set* interested_parties,
75  grpc_closure* on_done,
76  grpc_resolved_addresses** addresses);
77 
78 /* Destroy resolved addresses */
80 
81 /* Resolve addr in a blocking fashion. On success,
82  result must be freed with grpc_resolved_addresses_destroy. */
84  const char* name, const char* default_port,
85  grpc_resolved_addresses** addresses);
86 
87 #endif /* GRPC_CORE_LIB_IOMGR_RESOLVE_ADDRESS_H */
grpc_error * grpc_error_handle
Definition: error.h:48
Round Robin Policy.
Definition: backend_metric.cc:26
const char * kDefaultSecurePort
Definition: resolve_address.cc:25
constexpr int kDefaultSecurePortInt
Definition: resolve_address.h:55
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
grpc_error_handle grpc_blocking_resolve_address(const char *name, const char *default_port, grpc_resolved_addresses **addresses)
Definition: resolve_address.cc:49
#define GRPC_MAX_SOCKADDR_SIZE
Definition: resolve_address.h:42
void grpc_resolve_address(const char *addr, const char *default_port, grpc_pollset_set *interested_parties, grpc_closure *on_done, grpc_resolved_addresses **addresses)
Definition: resolve_address.cc:34
void grpc_set_resolver_impl(grpc_address_resolver_vtable *vtable)
Definition: resolve_address.cc:30
struct grpc_address_resolver_vtable grpc_address_resolver_vtable
void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addresses)
Definition: resolve_address.cc:42
Definition: resolve_address.h:58
grpc_error_handle(* blocking_resolve_address)(const char *name, const char *default_port, grpc_resolved_addresses **addresses)
Definition: resolve_address.h:63
void(* resolve_address)(const char *addr, const char *default_port, grpc_pollset_set *interested_parties, grpc_closure *on_done, grpc_resolved_addresses **addresses)
Definition: resolve_address.h:59
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
Definition: error_internal.h:41
Definition: resolve_address.h:44
char addr[128]
Definition: resolve_address.h:45
socklen_t len
Definition: resolve_address.h:46
Definition: resolve_address.h:48
size_t naddrs
Definition: resolve_address.h:49
grpc_resolved_address * addrs
Definition: resolve_address.h:50