| 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 |
|
| 25 |
grpc_error_handle grpc_tcp_server_create( |
| 26 |
grpc_closure* shutdown_complete, |
| 27 |
const grpc_event_engine::experimental::EndpointConfig& config, |
| 28 |
grpc_tcp_server** server) { |
| 29 |
return grpc_tcp_server_impl->create(shutdown_complete, config, server); |
| 30 |
} |
| 31 |
|
| 32 |
void grpc_tcp_server_start(grpc_tcp_server* server, |
| 33 |
const std::vector<grpc_pollset*>* pollsets, |
| 34 |
grpc_tcp_server_cb on_accept_cb, void* cb_arg) { |
| 35 |
grpc_tcp_server_impl->start(server, pollsets, on_accept_cb, cb_arg); |
| 36 |
} |
| 37 |
|
| 38 |
grpc_error_handle 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 |
|
| 44 |
grpc_core::TcpServerFdHandler* grpc_tcp_server_create_fd_handler( |
| 45 |
grpc_tcp_server* s) { |
| 46 |
return grpc_tcp_server_impl->create_fd_handler(s); |
| 47 |
} |
| 48 |
|
| 49 |
unsigned grpc_tcp_server_port_fd_count(grpc_tcp_server* s, |
| 50 |
unsigned port_index) { |
| 51 |
return grpc_tcp_server_impl->port_fd_count(s, port_index); |
| 52 |
} |
| 53 |
|
| 54 |
int grpc_tcp_server_port_fd(grpc_tcp_server* s, unsigned port_index, |
| 55 |
unsigned fd_index) { |
| 56 |
return grpc_tcp_server_impl->port_fd(s, port_index, fd_index); |
| 57 |
} |
| 58 |
|
| 59 |
grpc_tcp_server* grpc_tcp_server_ref(grpc_tcp_server* s) { |
| 60 |
return grpc_tcp_server_impl->ref(s); |
| 61 |
} |
| 62 |
|
| 63 |
void grpc_tcp_server_shutdown_starting_add(grpc_tcp_server* s, |
| 64 |
grpc_closure* shutdown_starting) { |
| 65 |
grpc_tcp_server_impl->shutdown_starting_add(s, shutdown_starting); |
| 66 |
} |
| 67 |
|
| 68 |
void grpc_tcp_server_unref(grpc_tcp_server* s) { |
| 69 |
grpc_tcp_server_impl->unref(s); |
| 70 |
} |
| 71 |
|
| 72 |
void grpc_tcp_server_shutdown_listeners(grpc_tcp_server* s) { |
| 73 |
grpc_tcp_server_impl->shutdown_listeners(s); |
| 74 |
} |
| 75 |
|
| 76 |
void grpc_set_tcp_server_impl(grpc_tcp_server_vtable* impl) { |
| 77 |
grpc_tcp_server_impl = impl; |
| 78 |
} |