endpoint.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 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 #ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_H
20 #define GRPC_CORE_LIB_IOMGR_ENDPOINT_H
21 
23 
24 #include "absl/strings/string_view.h"
25 
26 #include <grpc/slice.h>
27 #include <grpc/slice_buffer.h>
28 #include <grpc/support/time.h>
29 
32 
33 /* An endpoint caps a streaming channel between two communicating processes.
34  Examples may be: a tcp socket, <stdin+stdout>, or some shared memory. */
35 
38 
41  bool urgent, int min_progress_size);
43  void* arg, int max_frame_size);
44  void (*add_to_pollset)(grpc_endpoint* ep, grpc_pollset* pollset);
48  void (*destroy)(grpc_endpoint* ep);
53 };
54 
55 /* When data is available on the connection, calls the callback with slices.
56  Callback success indicates that the endpoint can accept more reads, failure
57  indicates the endpoint is closed.
58  Valid slices may be placed into \a slices even when the callback is
59  invoked with !GRPC_ERROR_IS_NONE(error). */
61  grpc_closure* cb, bool urgent, int min_progress_size);
62 
64 
66 
67 /* Get the file descriptor used by \a ep. Return -1 if \a ep is not using an fd.
68  */
70 
71 /* Write slices out to the socket.
72 
73  If the connection is ready for more data after the end of the call, it
74  returns GRPC_ENDPOINT_DONE.
75  Otherwise it returns GRPC_ENDPOINT_PENDING and calls cb when the
76  connection is ready for more data.
77  \a slices may be mutated at will by the endpoint until cb is called.
78  No guarantee is made to the content of slices after a write EXCEPT that
79  it is a valid slice buffer.
80  \a arg is platform specific. It is currently only used by TCP on linux
81  platforms as an argument that would be forwarded to the timestamps callback.
82  \a max_frame_size. A hint to the endpoint implementation to construct
83  frames which do not exceed the specified size.
84  */
86  grpc_closure* cb, void* arg, int max_frame_size);
87 
88 /* Causes any pending and future read/write callbacks to run immediately with
89  success==0 */
92 
93 /* Add an endpoint to a pollset or pollset_set, so that when the pollset is
94  polled, events from this endpoint are considered */
97  grpc_pollset_set* pollset_set);
98 
99 /* Delete an endpoint from a pollset_set */
101  grpc_pollset_set* pollset_set);
102 
104 
107 };
108 
109 #endif /* GRPC_CORE_LIB_IOMGR_ENDPOINT_H */
grpc_endpoint_vtable
Definition: endpoint.h:39
pollset.h
grpc_endpoint_can_track_err
bool grpc_endpoint_can_track_err(grpc_endpoint *ep)
Definition: endpoint.cc:65
bool
bool
Definition: setup_once.h:312
slice.h
grpc_pollset_set
struct grpc_pollset_set grpc_pollset_set
Definition: iomgr_fwd.h:23
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_endpoint::vtable
const grpc_endpoint_vtable * vtable
Definition: endpoint.h:106
grpc_endpoint_get_peer
absl::string_view grpc_endpoint_get_peer(grpc_endpoint *ep)
Definition: endpoint.cc:55
grpc_endpoint_add_to_pollset
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset)
Definition: endpoint.cc:35
grpc_endpoint_vtable::delete_from_pollset_set
void(* delete_from_pollset_set)(grpc_endpoint *ep, grpc_pollset_set *pollset)
Definition: endpoint.h:46
time.h
grpc_endpoint_vtable::destroy
void(* destroy)(grpc_endpoint *ep)
Definition: endpoint.h:48
grpc_endpoint_write
void grpc_endpoint_write(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, void *arg, int max_frame_size)
Definition: endpoint.cc:30
xds_interop_client.int
int
Definition: xds_interop_client.py:113
grpc_endpoint_add_to_pollset_set
void grpc_endpoint_add_to_pollset_set(grpc_endpoint *ep, grpc_pollset_set *pollset_set)
Definition: endpoint.cc:39
grpc_endpoint_vtable::get_peer
absl::string_view(* get_peer)(grpc_endpoint *ep)
Definition: endpoint.h:49
pollset_set.h
grpc_endpoint_vtable::write
void(* write)(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, void *arg, int max_frame_size)
Definition: endpoint.h:42
slice_buffer.h
arg
Definition: cmdline.cc:40
grpc_endpoint_read
void grpc_endpoint_read(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, bool urgent, int min_progress_size)
Definition: endpoint.cc:25
grpc_endpoint_vtable::add_to_pollset
void(* add_to_pollset)(grpc_endpoint *ep, grpc_pollset *pollset)
Definition: endpoint.h:44
grpc_endpoint_shutdown
void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_error_handle why)
Definition: endpoint.cc:49
grpc_endpoint_vtable::add_to_pollset_set
void(* add_to_pollset_set)(grpc_endpoint *ep, grpc_pollset_set *pollset)
Definition: endpoint.h:45
grpc_endpoint_delete_from_pollset_set
void grpc_endpoint_delete_from_pollset_set(grpc_endpoint *ep, grpc_pollset_set *pollset_set)
Definition: endpoint.cc:44
grpc_endpoint_vtable::shutdown
void(* shutdown)(grpc_endpoint *ep, grpc_error_handle why)
Definition: endpoint.h:47
string_view
absl::string_view string_view
Definition: attr.cc:22
slices
SliceBuffer * slices
Definition: retry_filter.cc:631
arg
struct arg arg
grpc_endpoint_vtable::can_track_err
bool(* can_track_err)(grpc_endpoint *ep)
Definition: endpoint.h:52
grpc_endpoint_vtable::get_fd
int(* get_fd)(grpc_endpoint *ep)
Definition: endpoint.h:51
grpc_slice_buffer
Definition: include/grpc/impl/codegen/slice.h:83
grpc_endpoint_destroy
void grpc_endpoint_destroy(grpc_endpoint *ep)
Definition: endpoint.cc:53
grpc_error
Definition: error_internal.h:42
grpc_endpoint_vtable::read
void(* read)(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, bool urgent, int min_progress_size)
Definition: endpoint.h:40
grpc_pollset
Definition: bm_cq_multiple_threads.cc:37
grpc_endpoint_get_local_address
absl::string_view grpc_endpoint_get_local_address(grpc_endpoint *ep)
Definition: endpoint.cc:59
grpc_closure
Definition: closure.h:56
grpc_endpoint_vtable::get_local_address
absl::string_view(* get_local_address)(grpc_endpoint *ep)
Definition: endpoint.h:50
grpc_endpoint
Definition: endpoint.h:105
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
grpc_endpoint_get_fd
int grpc_endpoint_get_fd(grpc_endpoint *ep)
Definition: endpoint.cc:63
port_platform.h


grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:15