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 "src/core/lib/iomgr/tcp_server.h"
22
23 grpc_tcp_server_vtable* grpc_tcp_server_impl;
24
grpc_tcp_server_create(grpc_closure * shutdown_complete,const grpc_channel_args * args,grpc_tcp_server ** server)25 grpc_error* grpc_tcp_server_create(grpc_closure* shutdown_complete,
26 const grpc_channel_args* args,
27 grpc_tcp_server** server) {
28 return grpc_tcp_server_impl->create(shutdown_complete, args, server);
29 }
30
grpc_tcp_server_start(grpc_tcp_server * server,const std::vector<grpc_pollset * > * pollsets,grpc_tcp_server_cb on_accept_cb,void * cb_arg)31 void grpc_tcp_server_start(grpc_tcp_server* server,
32 const std::vector<grpc_pollset*>* pollsets,
33 grpc_tcp_server_cb on_accept_cb, void* cb_arg) {
34 grpc_tcp_server_impl->start(server, pollsets, on_accept_cb, cb_arg);
35 }
36
grpc_tcp_server_add_port(grpc_tcp_server * s,const grpc_resolved_address * addr,int * out_port)37 grpc_error* grpc_tcp_server_add_port(grpc_tcp_server* s,
38 const grpc_resolved_address* addr,
39 int* out_port) {
40 return grpc_tcp_server_impl->add_port(s, addr, out_port);
41 }
42
grpc_tcp_server_create_fd_handler(grpc_tcp_server * s)43 grpc_core::TcpServerFdHandler* grpc_tcp_server_create_fd_handler(
44 grpc_tcp_server* s) {
45 return grpc_tcp_server_impl->create_fd_handler(s);
46 }
47
grpc_tcp_server_port_fd_count(grpc_tcp_server * s,unsigned port_index)48 unsigned grpc_tcp_server_port_fd_count(grpc_tcp_server* s,
49 unsigned port_index) {
50 return grpc_tcp_server_impl->port_fd_count(s, port_index);
51 }
52
grpc_tcp_server_port_fd(grpc_tcp_server * s,unsigned port_index,unsigned fd_index)53 int grpc_tcp_server_port_fd(grpc_tcp_server* s, unsigned port_index,
54 unsigned fd_index) {
55 return grpc_tcp_server_impl->port_fd(s, port_index, fd_index);
56 }
57
grpc_tcp_server_ref(grpc_tcp_server * s)58 grpc_tcp_server* grpc_tcp_server_ref(grpc_tcp_server* s) {
59 return grpc_tcp_server_impl->ref(s);
60 }
61
grpc_tcp_server_shutdown_starting_add(grpc_tcp_server * s,grpc_closure * shutdown_starting)62 void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server* s,
63 grpc_closure* shutdown_starting) {
64 grpc_tcp_server_impl->shutdown_starting_add(s, shutdown_starting);
65 }
66
grpc_tcp_server_unref(grpc_tcp_server * s)67 void grpc_tcp_server_unref(grpc_tcp_server* s) {
68 grpc_tcp_server_impl->unref(s);
69 }
70
grpc_tcp_server_shutdown_listeners(grpc_tcp_server * s)71 void grpc_tcp_server_shutdown_listeners(grpc_tcp_server* s) {
72 grpc_tcp_server_impl->shutdown_listeners(s);
73 }
74
grpc_set_tcp_server_impl(grpc_tcp_server_vtable * impl)75 void grpc_set_tcp_server_impl(grpc_tcp_server_vtable* impl) {
76 grpc_tcp_server_impl = impl;
77 }
78