|
|
@ -15,67 +15,67 @@ namespace Google.GRPC.Core.Internal |
|
|
|
{ |
|
|
|
{ |
|
|
|
const UInt32 GRPC_WRITE_BUFFER_HINT = 1; |
|
|
|
const UInt32 GRPC_WRITE_BUFFER_HINT = 1; |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern CallSafeHandle grpc_channel_create_call_old(ChannelSafeHandle channel, string method, string host, Timespec deadline); |
|
|
|
static extern CallSafeHandle grpcsharp_channel_create_call_old(ChannelSafeHandle channel, string method, string host, Timespec deadline); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_add_metadata(CallSafeHandle call, IntPtr metadata, UInt32 flags); |
|
|
|
static extern GRPCCallError grpcsharp_call_add_metadata(CallSafeHandle call, IntPtr metadata, UInt32 flags); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_invoke_old(CallSafeHandle call, CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, UInt32 flags); |
|
|
|
static extern GRPCCallError grpcsharp_call_invoke_old(CallSafeHandle call, CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, UInt32 flags); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll", EntryPoint = "grpc_call_invoke_old")] |
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_invoke_old")] |
|
|
|
static extern GRPCCallError grpc_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq, |
|
|
|
static extern GRPCCallError grpcsharp_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq, |
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, |
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback, |
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, |
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback, |
|
|
|
UInt32 flags); |
|
|
|
UInt32 flags); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_server_accept_old(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, IntPtr finishedTag); |
|
|
|
static extern GRPCCallError grpcsharp_call_server_accept_old(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, IntPtr finishedTag); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll", EntryPoint = "grpc_call_server_accept_old")] |
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_server_accept_old")] |
|
|
|
static extern GRPCCallError grpc_call_server_accept_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback); |
|
|
|
static extern GRPCCallError grpcsharp_call_server_accept_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_server_end_initial_metadata_old(CallSafeHandle call, UInt32 flags); |
|
|
|
static extern GRPCCallError grpcsharp_call_server_end_initial_metadata_old(CallSafeHandle call, UInt32 flags); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_cancel(CallSafeHandle call); |
|
|
|
static extern GRPCCallError grpcsharp_call_cancel(CallSafeHandle call); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); |
|
|
|
static extern GRPCCallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_start_write_status_old(CallSafeHandle call, StatusCode statusCode, string statusMessage, IntPtr tag); |
|
|
|
static extern GRPCCallError grpcsharp_call_start_write_status_old(CallSafeHandle call, StatusCode statusCode, string statusMessage, IntPtr tag); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll", EntryPoint = "grpc_call_start_write_status_old")] |
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_start_write_status_old")] |
|
|
|
static extern GRPCCallError grpc_call_start_write_status_old_CALLBACK(CallSafeHandle call, StatusCode statusCode, string statusMessage, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); |
|
|
|
static extern GRPCCallError grpcsharp_call_start_write_status_old_CALLBACK(CallSafeHandle call, StatusCode statusCode, string statusMessage, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_writes_done_old(CallSafeHandle call, IntPtr tag); |
|
|
|
static extern GRPCCallError grpcsharp_call_writes_done_old(CallSafeHandle call, IntPtr tag); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll", EntryPoint = "grpc_call_writes_done_old")] |
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_writes_done_old")] |
|
|
|
static extern GRPCCallError grpc_call_writes_done_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); |
|
|
|
static extern GRPCCallError grpcsharp_call_writes_done_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern GRPCCallError grpc_call_start_read_old(CallSafeHandle call, IntPtr tag); |
|
|
|
static extern GRPCCallError grpcsharp_call_start_read_old(CallSafeHandle call, IntPtr tag); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll", EntryPoint = "grpc_call_start_read_old")] |
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_start_read_old")] |
|
|
|
static extern GRPCCallError grpc_call_start_read_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); |
|
|
|
static extern GRPCCallError grpcsharp_call_start_read_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern void grpc_call_start_write_from_copied_buffer(CallSafeHandle call, |
|
|
|
static extern void grpcsharp_call_start_write_from_copied_buffer(CallSafeHandle call, |
|
|
|
byte[] buffer, UIntPtr length, |
|
|
|
byte[] buffer, UIntPtr length, |
|
|
|
IntPtr tag, UInt32 flags); |
|
|
|
IntPtr tag, UInt32 flags); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpc_call_start_write_from_copied_buffer")] |
|
|
|
[DllImport("grpc_csharp_ext.dll", EntryPoint = "grpcsharp_call_start_write_from_copied_buffer")] |
|
|
|
static extern void grpc_call_start_write_from_copied_buffer_CALLBACK(CallSafeHandle call, |
|
|
|
static extern void grpcsharp_call_start_write_from_copied_buffer_CALLBACK(CallSafeHandle call, |
|
|
|
byte[] buffer, UIntPtr length, |
|
|
|
byte[] buffer, UIntPtr length, |
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback, |
|
|
|
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback, |
|
|
|
UInt32 flags); |
|
|
|
UInt32 flags); |
|
|
|
|
|
|
|
|
|
|
|
[DllImport("grpc.dll")] |
|
|
|
[DllImport("grpc_csharp_ext.dll")] |
|
|
|
static extern void grpc_call_destroy(IntPtr call); |
|
|
|
static extern void grpcsharp_call_destroy(IntPtr call); |
|
|
|
|
|
|
|
|
|
|
|
private CallSafeHandle() |
|
|
|
private CallSafeHandle() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -86,87 +86,87 @@ namespace Google.GRPC.Core.Internal |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public static CallSafeHandle Create(ChannelSafeHandle channel, string method, string host, Timespec deadline) |
|
|
|
public static CallSafeHandle Create(ChannelSafeHandle channel, string method, string host, Timespec deadline) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return grpc_channel_create_call_old(channel, method, host, deadline); |
|
|
|
return grpcsharp_channel_create_call_old(channel, method, host, deadline); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Invoke(CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, bool buffered) |
|
|
|
public void Invoke(CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, bool buffered) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_invoke_old(this, cq, metadataReadTag, finishedTag, GetFlags(buffered))); |
|
|
|
AssertCallOk(grpcsharp_call_invoke_old(this, cq, metadataReadTag, finishedTag, GetFlags(buffered))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Invoke(CompletionQueueSafeHandle cq, bool buffered, EventCallbackDelegate metadataReadCallback, EventCallbackDelegate finishedCallback) |
|
|
|
public void Invoke(CompletionQueueSafeHandle cq, bool buffered, EventCallbackDelegate metadataReadCallback, EventCallbackDelegate finishedCallback) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_invoke_old_CALLBACK(this, cq, metadataReadCallback, finishedCallback, GetFlags(buffered))); |
|
|
|
AssertCallOk(grpcsharp_call_invoke_old_CALLBACK(this, cq, metadataReadCallback, finishedCallback, GetFlags(buffered))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void ServerAccept(CompletionQueueSafeHandle cq, IntPtr finishedTag) |
|
|
|
public void ServerAccept(CompletionQueueSafeHandle cq, IntPtr finishedTag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_server_accept_old(this, cq, finishedTag)); |
|
|
|
AssertCallOk(grpcsharp_call_server_accept_old(this, cq, finishedTag)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void ServerAccept(CompletionQueueSafeHandle cq, EventCallbackDelegate callback) |
|
|
|
public void ServerAccept(CompletionQueueSafeHandle cq, EventCallbackDelegate callback) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_server_accept_old_CALLBACK(this, cq, callback)); |
|
|
|
AssertCallOk(grpcsharp_call_server_accept_old_CALLBACK(this, cq, callback)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void ServerEndInitialMetadata(UInt32 flags) |
|
|
|
public void ServerEndInitialMetadata(UInt32 flags) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_server_end_initial_metadata_old(this, flags)); |
|
|
|
AssertCallOk(grpcsharp_call_server_end_initial_metadata_old(this, flags)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartWrite(byte[] payload, IntPtr tag, bool buffered) |
|
|
|
public void StartWrite(byte[] payload, IntPtr tag, bool buffered) |
|
|
|
{ |
|
|
|
{ |
|
|
|
grpc_call_start_write_from_copied_buffer(this, payload, new UIntPtr((ulong) payload.Length), tag, GetFlags(buffered)); |
|
|
|
grpcsharp_call_start_write_from_copied_buffer(this, payload, new UIntPtr((ulong) payload.Length), tag, GetFlags(buffered)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartWrite(byte[] payload, bool buffered, EventCallbackDelegate callback) |
|
|
|
public void StartWrite(byte[] payload, bool buffered, EventCallbackDelegate callback) |
|
|
|
{ |
|
|
|
{ |
|
|
|
grpc_call_start_write_from_copied_buffer_CALLBACK(this, payload, new UIntPtr((ulong) payload.Length), callback, GetFlags(buffered)); |
|
|
|
grpcsharp_call_start_write_from_copied_buffer_CALLBACK(this, payload, new UIntPtr((ulong) payload.Length), callback, GetFlags(buffered)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartWriteStatus(Status status, IntPtr tag) |
|
|
|
public void StartWriteStatus(Status status, IntPtr tag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_start_write_status_old(this, status.StatusCode, status.Detail, tag)); |
|
|
|
AssertCallOk(grpcsharp_call_start_write_status_old(this, status.StatusCode, status.Detail, tag)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartWriteStatus(Status status, EventCallbackDelegate callback) |
|
|
|
public void StartWriteStatus(Status status, EventCallbackDelegate callback) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_start_write_status_old_CALLBACK(this, status.StatusCode, status.Detail, callback)); |
|
|
|
AssertCallOk(grpcsharp_call_start_write_status_old_CALLBACK(this, status.StatusCode, status.Detail, callback)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void WritesDone(IntPtr tag) |
|
|
|
public void WritesDone(IntPtr tag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_writes_done_old(this, tag)); |
|
|
|
AssertCallOk(grpcsharp_call_writes_done_old(this, tag)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void WritesDone(EventCallbackDelegate callback) |
|
|
|
public void WritesDone(EventCallbackDelegate callback) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_writes_done_old_CALLBACK(this, callback)); |
|
|
|
AssertCallOk(grpcsharp_call_writes_done_old_CALLBACK(this, callback)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartRead(IntPtr tag) |
|
|
|
public void StartRead(IntPtr tag) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_start_read_old(this, tag)); |
|
|
|
AssertCallOk(grpcsharp_call_start_read_old(this, tag)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void StartRead(EventCallbackDelegate callback) |
|
|
|
public void StartRead(EventCallbackDelegate callback) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_start_read_old_CALLBACK(this, callback)); |
|
|
|
AssertCallOk(grpcsharp_call_start_read_old_CALLBACK(this, callback)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void Cancel() |
|
|
|
public void Cancel() |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_cancel(this)); |
|
|
|
AssertCallOk(grpcsharp_call_cancel(this)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void CancelWithStatus(Status status) |
|
|
|
public void CancelWithStatus(Status status) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AssertCallOk(grpc_call_cancel_with_status(this, status.StatusCode, status.Detail)); |
|
|
|
AssertCallOk(grpcsharp_call_cancel_with_status(this, status.StatusCode, status.Detail)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected override bool ReleaseHandle() |
|
|
|
protected override bool ReleaseHandle() |
|
|
|
{ |
|
|
|
{ |
|
|
|
grpc_call_destroy(handle); |
|
|
|
grpcsharp_call_destroy(handle); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|