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_TRANSPORT_TRANSPORT_IMPL_H
20 #define GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H
22 #include <grpc/support/port_platform.h>
24 #include "src/core/lib/transport/transport.h"
26 typedef struct grpc_transport_vtable {
27 /* Memory required for a single stream element - this is allocated by upper
28 layers and initialized by the transport */
29 size_t sizeof_stream; /* = sizeof(transport stream) */
31 /* name of this transport implementation */
34 /* implementation of grpc_transport_init_stream */
35 int (*init_stream)(grpc_transport* self, grpc_stream* stream,
36 grpc_stream_refcount* refcount, const void* server_data,
37 grpc_core::Arena* arena);
39 /* implementation of grpc_transport_set_pollset */
40 void (*set_pollset)(grpc_transport* self, grpc_stream* stream,
41 grpc_pollset* pollset);
43 /* implementation of grpc_transport_set_pollset */
44 void (*set_pollset_set)(grpc_transport* self, grpc_stream* stream,
45 grpc_pollset_set* pollset_set);
47 /* implementation of grpc_transport_perform_stream_op */
48 void (*perform_stream_op)(grpc_transport* self, grpc_stream* stream,
49 grpc_transport_stream_op_batch* op);
51 /* implementation of grpc_transport_perform_op */
52 void (*perform_op)(grpc_transport* self, grpc_transport_op* op);
54 /* implementation of grpc_transport_destroy_stream */
55 void (*destroy_stream)(grpc_transport* self, grpc_stream* stream,
56 grpc_closure* then_schedule_closure);
58 /* implementation of grpc_transport_destroy */
59 void (*destroy)(grpc_transport* self);
61 /* implementation of grpc_transport_get_endpoint */
62 grpc_endpoint* (*get_endpoint)(grpc_transport* self);
63 } grpc_transport_vtable;
65 /* an instance of a grpc transport */
66 struct grpc_transport {
67 /* pointer to a vtable defining operations on this transport */
68 const grpc_transport_vtable* vtable;
71 #endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_IMPL_H */