blob: bf6e98146a4e91d294cea4816bc056629c5ce268 [file] [log] [blame]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08001/*
2 *
Craig Tiller6169d5f2016-03-31 07:46:18 -07003 * Copyright 2015, Google Inc.
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08004 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
Craig Tiller9533d042016-03-25 17:11:06 -070034#include "src/core/lib/iomgr/endpoint.h"
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080035
Craig Tillera82950e2015-09-22 12:33:20 -070036void grpc_endpoint_read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
Craig Tillerd41a4a72016-10-26 16:16:06 -070037 grpc_slice_buffer* slices, grpc_closure* cb) {
Craig Tillera82950e2015-09-22 12:33:20 -070038 ep->vtable->read(exec_ctx, ep, slices, cb);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080039}
40
Craig Tillera82950e2015-09-22 12:33:20 -070041void grpc_endpoint_write(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
Craig Tillerd41a4a72016-10-26 16:16:06 -070042 grpc_slice_buffer* slices, grpc_closure* cb) {
Craig Tillera82950e2015-09-22 12:33:20 -070043 ep->vtable->write(exec_ctx, ep, slices, cb);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080044}
45
Craig Tillera82950e2015-09-22 12:33:20 -070046void grpc_endpoint_add_to_pollset(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
47 grpc_pollset* pollset) {
48 ep->vtable->add_to_pollset(exec_ctx, ep, pollset);
ctillerd79b4862014-12-17 16:36:59 -080049}
50
Craig Tillera82950e2015-09-22 12:33:20 -070051void grpc_endpoint_add_to_pollset_set(grpc_exec_ctx* exec_ctx,
52 grpc_endpoint* ep,
53 grpc_pollset_set* pollset_set) {
54 ep->vtable->add_to_pollset_set(exec_ctx, ep, pollset_set);
Craig Tiller1ada6ad2015-07-16 16:19:14 -070055}
56
Craig Tillercda759d2017-01-27 11:37:37 -080057void grpc_endpoint_shutdown(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
58 grpc_error* why) {
59 ep->vtable->shutdown(exec_ctx, ep, why);
Craig Tillerd1bec032015-09-18 17:29:00 -070060}
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080061
Craig Tillera82950e2015-09-22 12:33:20 -070062void grpc_endpoint_destroy(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep) {
63 ep->vtable->destroy(exec_ctx, ep);
Craig Tillerd1bec032015-09-18 17:29:00 -070064}
Craig Tiller1b22b9d2015-07-20 13:42:22 -070065
Craig Tillera82950e2015-09-22 12:33:20 -070066char* grpc_endpoint_get_peer(grpc_endpoint* ep) {
67 return ep->vtable->get_peer(ep);
Craig Tiller1b22b9d2015-07-20 13:42:22 -070068}
Craig Tiller70bd4832016-06-30 14:20:46 -070069
Yuchen Zeng68413c22016-11-02 11:57:37 -070070int grpc_endpoint_get_fd(grpc_endpoint* ep) { return ep->vtable->get_fd(ep); }
71
Craig Tiller70bd4832016-06-30 14:20:46 -070072grpc_workqueue* grpc_endpoint_get_workqueue(grpc_endpoint* ep) {
73 return ep->vtable->get_workqueue(ep);
74}
Craig Tillerd4673482016-09-23 13:50:04 -070075
Craig Tiller20afa3d2016-10-17 14:52:14 -070076grpc_resource_user* grpc_endpoint_get_resource_user(grpc_endpoint* ep) {
77 return ep->vtable->get_resource_user(ep);
Craig Tillerd4673482016-09-23 13:50:04 -070078}