3 * Copyright 2015 gRPC authors.
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
20 #define GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H
22 #include <grpc/support/port_platform.h>
24 #include <grpc/impl/codegen/grpc_types.h>
25 #include <grpc/support/time.h>
27 #include "src/core/lib/iomgr/endpoint.h"
28 #include "src/core/lib/iomgr/pollset_set.h"
29 #include "src/core/lib/iomgr/resolve_address.h"
30 #include "src/core/lib/iomgr/resource_quota.h"
32 typedef struct grpc_tcp_client_vtable {
33 void (*connect)(grpc_closure* on_connect, grpc_endpoint** endpoint,
34 grpc_slice_allocator* slice_allocator,
35 grpc_pollset_set* interested_parties,
36 const grpc_channel_args* channel_args,
37 const grpc_resolved_address* addr, grpc_millis deadline);
38 } grpc_tcp_client_vtable;
40 /* Asynchronously connect to an address (specified as (addr, len)), and call
41 cb with arg and the completed connection when done (or call cb with arg and
43 interested_parties points to a set of pollsets that would be interested
44 in this connection being established (in order to continue their work) */
45 void grpc_tcp_client_connect(grpc_closure* on_connect, grpc_endpoint** endpoint,
46 grpc_slice_allocator* slice_allocator,
47 grpc_pollset_set* interested_parties,
48 const grpc_channel_args* channel_args,
49 const grpc_resolved_address* addr,
50 grpc_millis deadline);
52 void grpc_tcp_client_global_init();
54 void grpc_set_tcp_client_impl(grpc_tcp_client_vtable* impl);
56 #endif /* GRPC_CORE_LIB_IOMGR_TCP_CLIENT_H */