transport_stream_receiver.h
Go to the documentation of this file.
1 // Copyright 2021 gRPC authors.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef GRPC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_H
16 #define GRPC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_H
17 
19 
20 #include <functional>
21 #include <string>
22 #include <vector>
23 
24 #include "absl/status/statusor.h"
25 
27 
28 namespace grpc_binder {
29 
30 typedef int StreamIdentifier;
31 
33  public:
34  virtual ~TransportStreamReceiver() = default;
35 
42 
43  // Only handles single time invocation. Callback object will be deleted.
44  // The callback should be valid until invocation or unregister.
47  virtual void RegisterRecvMessage(StreamIdentifier id,
49  virtual void RegisterRecvTrailingMetadata(
51 
52  // For the following functions, the second arguments are the transaction
53  // result received from the lower level. If it is None, that means there's
54  // something wrong when receiving the corresponding transaction. In such case,
55  // we should cancel the gRPC callback as well.
56  virtual void NotifyRecvInitialMetadata(
57  StreamIdentifier id, absl::StatusOr<Metadata> initial_metadata) = 0;
58  virtual void NotifyRecvMessage(StreamIdentifier id,
60  virtual void NotifyRecvTrailingMetadata(
62  int status) = 0;
63  // Remove all entries associated with stream number `id`.
64  virtual void CancelStream(StreamIdentifier id) = 0;
65 
67 };
68 
69 } // namespace grpc_binder
70 
71 #endif // GRPC_CORE_EXT_TRANSPORT_BINDER_UTILS_TRANSPORT_STREAM_RECEIVER_H
grpc_binder::TransportStreamReceiver::NotifyRecvTrailingMetadata
virtual void NotifyRecvTrailingMetadata(StreamIdentifier id, absl::StatusOr< Metadata > trailing_metadata, int status)=0
transaction.h
grpc_binder::TransportStreamReceiver::CancelStream
virtual void CancelStream(StreamIdentifier id)=0
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_binder
Definition: connection_id_generator.cc:45
status
absl::Status status
Definition: rls.cc:251
grpc_binder::TransportStreamReceiver::InitialMetadataCallbackType
std::function< void(absl::StatusOr< Metadata >)> InitialMetadataCallbackType
Definition: transport_stream_receiver.h:37
grpc_binder::TransportStreamReceiver::NotifyRecvMessage
virtual void NotifyRecvMessage(StreamIdentifier id, absl::StatusOr< std::string > message)=0
message
char * message
Definition: libuv/docs/code/tty-gravity/main.c:12
grpc_binder::TransportStreamReceiver::TrailingMetadataCallbackType
std::function< void(absl::StatusOr< Metadata >, int)> TrailingMetadataCallbackType
Definition: transport_stream_receiver.h:41
grpc_status._async.trailing_metadata
trailing_metadata
Definition: grpcio_status/grpc_status/_async.py:36
grpc_binder::TransportStreamReceiver::NotifyRecvInitialMetadata
virtual void NotifyRecvInitialMetadata(StreamIdentifier id, absl::StatusOr< Metadata > initial_metadata)=0
grpc_binder::TransportStreamReceiver::kGrpcBinderTransportCancelledGracefully
static const absl::string_view kGrpcBinderTransportCancelledGracefully
Definition: transport_stream_receiver.h:66
grpc_binder::TransportStreamReceiver::MessageDataCallbackType
std::function< void(absl::StatusOr< std::string >)> MessageDataCallbackType
Definition: transport_stream_receiver.h:39
grpc_binder::StreamIdentifier
int StreamIdentifier
Definition: transport_stream_receiver.h:30
grpc_binder::TransportStreamReceiver::RegisterRecvInitialMetadata
virtual void RegisterRecvInitialMetadata(StreamIdentifier id, InitialMetadataCallbackType cb)=0
grpc_binder::TransportStreamReceiver::RegisterRecvTrailingMetadata
virtual void RegisterRecvTrailingMetadata(StreamIdentifier id, TrailingMetadataCallbackType cb)=0
grpc_binder::TransportStreamReceiver::~TransportStreamReceiver
virtual ~TransportStreamReceiver()=default
grpc_binder::TransportStreamReceiver::RegisterRecvMessage
virtual void RegisterRecvMessage(StreamIdentifier id, MessageDataCallbackType cb)=0
absl::StatusOr
Definition: abseil-cpp/absl/status/statusor.h:187
grpc_binder::TransportStreamReceiver
Definition: transport_stream_receiver.h:32
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
cb
OPENSSL_EXPORT pem_password_cb * cb
Definition: pem.h:351
port_platform.h


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:40