• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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,grpc_pollset ** pollsets,size_t pollset_count,grpc_tcp_server_cb on_accept_cb,void * cb_arg)31 void grpc_tcp_server_start(grpc_tcp_server* server, grpc_pollset** pollsets,
32                            size_t pollset_count,
33                            grpc_tcp_server_cb on_accept_cb, void* cb_arg) {
34   grpc_tcp_server_impl->start(server, pollsets, pollset_count, on_accept_cb,
35                               cb_arg);
36 }
37 
grpc_tcp_server_add_port(grpc_tcp_server * s,const grpc_resolved_address * addr,int * out_port)38 grpc_error* grpc_tcp_server_add_port(grpc_tcp_server* s,
39                                      const grpc_resolved_address* addr,
40                                      int* out_port) {
41   return grpc_tcp_server_impl->add_port(s, addr, out_port);
42 }
43 
grpc_tcp_server_port_fd_count(grpc_tcp_server * s,unsigned port_index)44 unsigned grpc_tcp_server_port_fd_count(grpc_tcp_server* s,
45                                        unsigned port_index) {
46   return grpc_tcp_server_impl->port_fd_count(s, port_index);
47 }
48 
grpc_tcp_server_port_fd(grpc_tcp_server * s,unsigned port_index,unsigned fd_index)49 int grpc_tcp_server_port_fd(grpc_tcp_server* s, unsigned port_index,
50                             unsigned fd_index) {
51   return grpc_tcp_server_impl->port_fd(s, port_index, fd_index);
52 }
53 
grpc_tcp_server_ref(grpc_tcp_server * s)54 grpc_tcp_server* grpc_tcp_server_ref(grpc_tcp_server* s) {
55   return grpc_tcp_server_impl->ref(s);
56 }
57 
grpc_tcp_server_shutdown_starting_add(grpc_tcp_server * s,grpc_closure * shutdown_starting)58 void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server* s,
59                                            grpc_closure* shutdown_starting) {
60   grpc_tcp_server_impl->shutdown_starting_add(s, shutdown_starting);
61 }
62 
grpc_tcp_server_unref(grpc_tcp_server * s)63 void grpc_tcp_server_unref(grpc_tcp_server* s) {
64   grpc_tcp_server_impl->unref(s);
65 }
66 
grpc_tcp_server_shutdown_listeners(grpc_tcp_server * s)67 void grpc_tcp_server_shutdown_listeners(grpc_tcp_server* s) {
68   grpc_tcp_server_impl->shutdown_listeners(s);
69 }
70 
grpc_set_tcp_server_impl(grpc_tcp_server_vtable * impl)71 void grpc_set_tcp_server_impl(grpc_tcp_server_vtable* impl) {
72   grpc_tcp_server_impl = impl;
73 }
74