|
|
@ -46,6 +46,9 @@ namespace Grpc.Core.Internal |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern BatchContextSafeHandle grpcsharp_batch_context_create(); |
|
|
|
static extern BatchContextSafeHandle grpcsharp_batch_context_create(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
|
|
|
|
static extern IntPtr grpcsharp_batch_context_receive_initial_metadata(BatchContextSafeHandle ctx); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx); |
|
|
|
static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx); |
|
|
|
|
|
|
|
|
|
|
@ -58,12 +61,18 @@ namespace Grpc.Core.Internal |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx); // returns const char* |
|
|
|
static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx); // returns const char* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
|
|
|
|
static extern IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern CallSafeHandle grpcsharp_batch_context_server_rpc_new_call(BatchContextSafeHandle ctx); |
|
|
|
static extern CallSafeHandle grpcsharp_batch_context_server_rpc_new_call(BatchContextSafeHandle ctx); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern IntPtr grpcsharp_batch_context_server_rpc_new_method(BatchContextSafeHandle ctx); // returns const char* |
|
|
|
static extern IntPtr grpcsharp_batch_context_server_rpc_new_method(BatchContextSafeHandle ctx); // returns const char* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
|
|
|
|
static extern IntPtr grpcsharp_batch_context_server_rpc_new_request_metadata(BatchContextSafeHandle ctx); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx); |
|
|
|
static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx); |
|
|
|
|
|
|
|
|
|
|
@ -87,13 +96,24 @@ namespace Grpc.Core.Internal |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Metadata GetReceivedInitialMetadata() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IntPtr metadataArrayPtr = grpcsharp_batch_context_receive_initial_metadata(this); |
|
|
|
|
|
|
|
return MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Status GetReceivedStatus() |
|
|
|
public Status GetReceivedStatus() |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO: can the native method return string directly? |
|
|
|
|
|
|
|
string details = Marshal.PtrToStringAnsi(grpcsharp_batch_context_recv_status_on_client_details(this)); |
|
|
|
string details = Marshal.PtrToStringAnsi(grpcsharp_batch_context_recv_status_on_client_details(this)); |
|
|
|
return new Status(grpcsharp_batch_context_recv_status_on_client_status(this), details); |
|
|
|
return new Status(grpcsharp_batch_context_recv_status_on_client_status(this), details); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Metadata GetReceivedStatusTrailingMetadata() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IntPtr metadataArrayPtr = grpcsharp_batch_context_recv_status_on_client_trailing_metadata(this); |
|
|
|
|
|
|
|
return MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public byte[] GetReceivedMessage() |
|
|
|
public byte[] GetReceivedMessage() |
|
|
|
{ |
|
|
|
{ |
|
|
|
IntPtr len = grpcsharp_batch_context_recv_message_length(this); |
|
|
|
IntPtr len = grpcsharp_batch_context_recv_message_length(this); |
|
|
@ -116,6 +136,12 @@ namespace Grpc.Core.Internal |
|
|
|
return Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_method(this)); |
|
|
|
return Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_method(this)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Metadata GetServerRpcNewRequestMetadata() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IntPtr metadataArrayPtr = grpcsharp_batch_context_server_rpc_new_request_metadata(this); |
|
|
|
|
|
|
|
return MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public bool GetReceivedCloseOnServerCancelled() |
|
|
|
public bool GetReceivedCloseOnServerCancelled() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0; |
|
|
|
return grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0; |
|
|
|