1 #region Copyright notice and license
2 // Copyright 2015 gRPC authors.
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
21 namespace Grpc.Core.Internal
23 internal interface IUnaryResponseClientCallback
25 void OnUnaryResponseClient(bool success, ClientSideStatus receivedStatus, byte[] receivedMessage, Metadata responseHeaders);
28 // Received status for streaming response calls.
29 internal interface IReceivedStatusOnClientCallback
31 void OnReceivedStatusOnClient(bool success, ClientSideStatus receivedStatus);
34 internal interface IReceivedMessageCallback
36 void OnReceivedMessage(bool success, byte[] receivedMessage);
39 internal interface IReceivedResponseHeadersCallback
41 void OnReceivedResponseHeaders(bool success, Metadata responseHeaders);
44 internal interface ISendCompletionCallback
46 void OnSendCompletion(bool success);
49 internal interface ISendStatusFromServerCompletionCallback
51 void OnSendStatusFromServerCompletion(bool success);
54 internal interface IReceivedCloseOnServerCallback
56 void OnReceivedCloseOnServer(bool success, bool cancelled);
60 /// Abstraction of a native call object.
62 internal interface INativeCall : IDisposable
66 void CancelWithStatus(Status status);
70 void StartUnary(IUnaryResponseClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags);
72 void StartUnary(BatchContextSafeHandle ctx, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags);
74 void StartClientStreaming(IUnaryResponseClientCallback callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags);
76 void StartServerStreaming(IReceivedStatusOnClientCallback callback, byte[] payload, WriteFlags writeFlags, MetadataArraySafeHandle metadataArray, CallFlags callFlags);
78 void StartDuplexStreaming(IReceivedStatusOnClientCallback callback, MetadataArraySafeHandle metadataArray, CallFlags callFlags);
80 void StartReceiveMessage(IReceivedMessageCallback callback);
82 void StartReceiveInitialMetadata(IReceivedResponseHeadersCallback callback);
84 void StartSendInitialMetadata(ISendCompletionCallback callback, MetadataArraySafeHandle metadataArray);
86 void StartSendMessage(ISendCompletionCallback callback, byte[] payload, WriteFlags writeFlags, bool sendEmptyInitialMetadata);
88 void StartSendCloseFromClient(ISendCompletionCallback callback);
90 void StartSendStatusFromServer(ISendStatusFromServerCompletionCallback callback, Status status, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata, byte[] optionalPayload, WriteFlags writeFlags);
92 void StartServerSide(IReceivedCloseOnServerCallback callback);