GRPC Core  9.0.0
tcp_client_posix.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_TCP_CLIENT_POSIX_H
20 #define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H
21 
23 
27 
28 /* Create an endpoint from a connected grpc_fd.
29 
30  fd: a connected FD. Ownership is taken.
31  channel_args: may contain custom settings for the endpoint
32  addr_str: destination address in printable format
33  Returns: a new endpoint
34 */
36  grpc_fd* fd, const grpc_channel_args* channel_args, const char* addr_str);
37 
38 /* Return a configured, unbound, unconnected TCP client grpc_fd.
39 
40  channel_args: may contain custom settings for the fd
41  addr: the destination address
42  mapped_addr: out parameter. addr mapped to an address appropriate to the
43  type of socket FD created. For example, if addr is IPv4 and dual stack
44  sockets are available, mapped_addr will be an IPv4-mapped IPv6 address
45  fdobj: out parameter. The new FD
46  Returns: error, if any. Out parameters are not set on error
47 */
49  const grpc_resolved_address* addr,
50  grpc_resolved_address* mapped_addr,
51  grpc_fd** fdobj);
52 
53 /* Connect a configured TCP client grpc_fd.
54 
55  interested_parties: a set of pollsets that would be interested in this
56  connection being established (in order to continue their work
57  closure: called when complete. On success, *ep will be set.
58  fdobj: an FD returned from grpc_tcp_client_prepare_fd(). Ownership is taken
59  channel_args: may contain custom settings for the endpoint
60  deadline: connection deadline
61  ep: out parameter. Set before closure is called if successful
62 */
64  grpc_pollset_set* interested_parties, grpc_closure* closure, grpc_fd* fdobj,
65  const grpc_channel_args* channel_args, const grpc_resolved_address* addr,
66  grpc_millis deadline, grpc_endpoint** ep);
67 
68 #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_POSIX_H */
int64_t grpc_millis
Definition: exec_ctx.h:35
An array of arguments that can be passed around.
Definition: grpc_types.h:132
Definition: resolve_address.h:44
Definition: error_internal.h:39
grpc_error * grpc_tcp_client_prepare_fd(const grpc_channel_args *channel_args, const grpc_resolved_address *addr, grpc_resolved_address *mapped_addr, grpc_fd **fdobj)
struct grpc_fd grpc_fd
Definition: ev_posix.h:44
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
void grpc_tcp_client_create_from_prepared_fd(grpc_pollset_set *interested_parties, grpc_closure *closure, grpc_fd *fdobj, const grpc_channel_args *channel_args, const grpc_resolved_address *addr, grpc_millis deadline, grpc_endpoint **ep)
Definition: endpoint.h:102
grpc_endpoint * grpc_tcp_client_create_from_fd(grpc_fd *fd, const grpc_channel_args *channel_args, const char *addr_str)