tcp_client.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_H
20 #define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
21 
23 
25 #include <grpc/support/time.h>
26 
31 
32 typedef struct grpc_tcp_client_vtable {
34  grpc_pollset_set* interested_parties,
35  const grpc_channel_args* channel_args,
37  grpc_core::Timestamp deadline);
38  bool (*cancel_connect)(int64_t connection_handle);
40 
41 /* Asynchronously connect to an address (specified as (addr, len)), and call
42  cb with arg and the completed connection when done (or call cb with arg and
43  NULL on failure).
44  interested_parties points to a set of pollsets that would be interested
45  in this connection being established (in order to continue their work). It
46  returns a handle to the connect operation which can be used to cancel the
47  connection attempt. */
49  grpc_endpoint** endpoint,
50  grpc_pollset_set* interested_parties,
51  const grpc_channel_args* channel_args,
53  grpc_core::Timestamp deadline);
54 
55 // Returns true if a connect attempt corresponding to the provided handle
56 // is successfully cancelled. Otherwise it returns false. If the connect
57 // attempt is successfully cancelled, then the on_connect closure passed to
58 // grpc_tcp_client_connect will not be executed. Its upto the caller to free
59 // up any resources that may have been allocated to create the closure.
60 bool grpc_tcp_client_cancel_connect(int64_t connection_handle);
61 
62 extern void grpc_tcp_client_global_init();
63 
65 
66 #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */
grpc_set_tcp_client_impl
void grpc_set_tcp_client_impl(grpc_tcp_client_vtable *impl)
Definition: tcp_client.cc:39
bool
bool
Definition: setup_once.h:312
grpc_tcp_client_vtable::cancel_connect
bool(* cancel_connect)(int64_t connection_handle)
Definition: tcp_client.h:38
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
grpc_core::Timestamp
Definition: src/core/lib/gprpp/time.h:62
resolve_address.h
grpc_resolved_address
Definition: resolved_address.h:34
time.h
grpc_channel_args
Definition: grpc_types.h:132
grpc_types.h
int64_t
signed __int64 int64_t
Definition: stdint-msvc2008.h:89
grpc_tcp_client_connect
int64_t grpc_tcp_client_connect(grpc_closure *on_connect, grpc_endpoint **endpoint, grpc_pollset_set *interested_parties, const grpc_channel_args *channel_args, const grpc_resolved_address *addr, grpc_core::Timestamp deadline)
Definition: tcp_client.cc:25
grpc_tcp_client_cancel_connect
bool grpc_tcp_client_cancel_connect(int64_t connection_handle)
Definition: tcp_client.cc:35
pollset_set.h
on_connect
void on_connect(uv_connect_t *req, int status)
Definition: libuv/docs/code/dns/main.c:32
grpc_tcp_client_vtable
struct grpc_tcp_client_vtable grpc_tcp_client_vtable
grpc_tcp_client_vtable::connect
int64_t(* connect)(grpc_closure *on_connect, grpc_endpoint **endpoint, grpc_pollset_set *interested_parties, const grpc_channel_args *channel_args, const grpc_resolved_address *addr, grpc_core::Timestamp deadline)
Definition: tcp_client.h:33
memory_quota.h
grpc_tcp_client_global_init
void grpc_tcp_client_global_init()
grpc_tcp_client_vtable
Definition: tcp_client.h:32
endpoint.h
grpc_closure
Definition: closure.h:56
grpc_endpoint
Definition: endpoint.h:105
addr
struct sockaddr_in addr
Definition: libuv/docs/code/tcp-echo-server/main.c:10
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:29