aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp/GrpcCore/Internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/csharp/GrpcCore/Internal')
-rw-r--r--src/csharp/GrpcCore/Internal/CallSafeHandle.cs36
-rw-r--r--src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs4
-rw-r--r--src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs12
-rw-r--r--src/csharp/GrpcCore/Internal/Enums.cs37
-rw-r--r--src/csharp/GrpcCore/Internal/Event.cs40
-rw-r--r--src/csharp/GrpcCore/Internal/ServerSafeHandle.cs16
-rw-r--r--src/csharp/GrpcCore/Internal/Timespec.cs2
7 files changed, 77 insertions, 70 deletions
diff --git a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs
index 6c9c58a4c3..bbb830b355 100644
--- a/src/csharp/GrpcCore/Internal/CallSafeHandle.cs
+++ b/src/csharp/GrpcCore/Internal/CallSafeHandle.cs
@@ -15,66 +15,66 @@ namespace Google.GRPC.Core.Internal
{
const UInt32 GRPC_WRITE_BUFFER_HINT = 1;
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern CallSafeHandle grpc_channel_create_call_old(ChannelSafeHandle channel, string method, string host, Timespec deadline);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_add_metadata(CallSafeHandle call, IntPtr metadata, UInt32 flags);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_invoke_old(CallSafeHandle call, CompletionQueueSafeHandle cq, IntPtr metadataReadTag, IntPtr finishedTag, UInt32 flags);
- [DllImport("libgrpc.so", EntryPoint = "grpc_call_invoke_old")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_call_invoke_old")]
static extern GRPCCallError grpc_call_invoke_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle cq,
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate metadataReadCallback,
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback,
UInt32 flags);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_server_accept_old(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, IntPtr finishedTag);
- [DllImport("libgrpc.so", EntryPoint = "grpc_call_server_accept_old")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_call_server_accept_old")]
static extern GRPCCallError grpc_call_server_accept_old_CALLBACK(CallSafeHandle call, CompletionQueueSafeHandle completionQueue, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate finishedCallback);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_server_end_initial_metadata_old(CallSafeHandle call, UInt32 flags);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_cancel(CallSafeHandle call);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_start_write_status_old(CallSafeHandle call, StatusCode statusCode, string statusMessage, IntPtr tag);
- [DllImport("libgrpc.so", EntryPoint = "grpc_call_start_write_status_old")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_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);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_writes_done_old(CallSafeHandle call, IntPtr tag);
- [DllImport("libgrpc.so", EntryPoint = "grpc_call_writes_done_old")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_call_writes_done_old")]
static extern GRPCCallError grpc_call_writes_done_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern GRPCCallError grpc_call_start_read_old(CallSafeHandle call, IntPtr tag);
- [DllImport("libgrpc.so", EntryPoint = "grpc_call_start_read_old")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_call_start_read_old")]
static extern GRPCCallError grpc_call_start_read_old_CALLBACK(CallSafeHandle call, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern void grpc_call_start_write_from_copied_buffer(CallSafeHandle call,
byte[] buffer, UIntPtr length,
IntPtr tag, UInt32 flags);
- [DllImport("libgrpc_csharp_ext.so", EntryPoint = "grpc_call_start_write_from_copied_buffer")]
+ [DllImport("grpc_csharp_ext.dll", EntryPoint = "grpc_call_start_write_from_copied_buffer")]
static extern void grpc_call_start_write_from_copied_buffer_CALLBACK(CallSafeHandle call,
byte[] buffer, UIntPtr length,
[MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback,
UInt32 flags);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_call_destroy(IntPtr call);
private CallSafeHandle()
diff --git a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs
index 3a09d8b1b6..0f38d63f98 100644
--- a/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs
+++ b/src/csharp/GrpcCore/Internal/ChannelSafeHandle.cs
@@ -10,10 +10,10 @@ namespace Google.GRPC.Core.Internal
/// </summary>
internal class ChannelSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern ChannelSafeHandle grpc_channel_create(string target, IntPtr channelArgs);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_channel_destroy(IntPtr channel);
private ChannelSafeHandle()
diff --git a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs
index 73dd3edde3..f098de6820 100644
--- a/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs
+++ b/src/csharp/GrpcCore/Internal/CompletionQueueSafeHandle.cs
@@ -9,22 +9,22 @@ namespace Google.GRPC.Core.Internal
/// </summary>
internal class CompletionQueueSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern CompletionQueueSafeHandle grpc_completion_queue_create();
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern EventSafeHandle grpc_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag, Timespec deadline);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern EventSafeHandle grpc_completion_queue_next(CompletionQueueSafeHandle cq, Timespec deadline);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_completion_queue_shutdown(CompletionQueueSafeHandle cq);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCCompletionType grpc_completion_queue_next_with_callback(CompletionQueueSafeHandle cq);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_completion_queue_destroy(IntPtr cq);
private CompletionQueueSafeHandle()
diff --git a/src/csharp/GrpcCore/Internal/Enums.cs b/src/csharp/GrpcCore/Internal/Enums.cs
index 46e3bca6eb..1151e94899 100644
--- a/src/csharp/GrpcCore/Internal/Enums.cs
+++ b/src/csharp/GrpcCore/Internal/Enums.cs
@@ -36,29 +36,36 @@ namespace Google.GRPC.Core.Internal
/// </summary>
internal enum GRPCCompletionType
{
- GRPC_QUEUE_SHUTDOWN,
/* Shutting down */
- GRPC_READ,
+ GRPC_QUEUE_SHUTDOWN,
+
+ /* operation completion */
+ GRPC_OP_COMPLETE,
+
/* A read has completed */
- GRPC_INVOKE_ACCEPTED,
- /* An invoke call has been accepted by flow
- control */
+ GRPC_READ,
+
+ /* A write has been accepted by flow control */
GRPC_WRITE_ACCEPTED,
- /* A write has been accepted by
- flow control */
- GRPC_FINISH_ACCEPTED,
+
/* writes_done or write_status has been accepted */
+ GRPC_FINISH_ACCEPTED,
+
+ /* The metadata array sent by server received at client */
GRPC_CLIENT_METADATA_READ,
- /* The metadata array sent by server received at
- client */
+
+ /* An RPC has finished. The event contains status.
+ * On the server this will be OK or Cancelled. */
GRPC_FINISHED,
- /* An RPC has finished. The event contains status.
- On the server this will be OK or Cancelled. */
- GRPC_SERVER_RPC_NEW,
+
/* A new RPC has arrived at the server */
+ GRPC_SERVER_RPC_NEW,
+
+ /* The server has finished shutting down */
+ GRPC_SERVER_SHUTDOWN,
+
+ /* must be last, forces users to include a default: case */
GRPC_COMPLETION_DO_NOT_USE
- /* must be last, forces users to include
- a default: case */
}
/// <summary>
diff --git a/src/csharp/GrpcCore/Internal/Event.cs b/src/csharp/GrpcCore/Internal/Event.cs
index 7056005ba6..5853ddd570 100644
--- a/src/csharp/GrpcCore/Internal/Event.cs
+++ b/src/csharp/GrpcCore/Internal/Event.cs
@@ -9,34 +9,34 @@ namespace Google.GRPC.Core.Internal
/// </summary>
internal class EventSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_event_finish(IntPtr ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCCompletionType grpc_event_type(EventSafeHandle ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern CallSafeHandle grpc_event_call(EventSafeHandle ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCOpError grpc_event_write_accepted(EventSafeHandle ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCOpError grpc_event_finish_accepted(EventSafeHandle ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern StatusCode grpc_event_finished_status(EventSafeHandle ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern IntPtr grpc_event_finished_details(EventSafeHandle ev); // returns const char*
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern IntPtr grpc_event_read_length(EventSafeHandle ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern void grpc_event_read_copy_to_buffer(EventSafeHandle ev, byte[] buffer, UIntPtr bufferLen);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern IntPtr grpc_event_server_rpc_new_method(EventSafeHandle ev); // returns const char*
public GRPCCompletionType GetCompletionType()
@@ -98,34 +98,34 @@ namespace Google.GRPC.Core.Internal
/// </summary>
internal class EventSafeHandleNotOwned : SafeHandleZeroIsInvalid
{
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_event_finish(IntPtr ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCCompletionType grpc_event_type(EventSafeHandleNotOwned ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern CallSafeHandle grpc_event_call(EventSafeHandleNotOwned ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCOpError grpc_event_write_accepted(EventSafeHandleNotOwned ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern GRPCOpError grpc_event_finish_accepted(EventSafeHandleNotOwned ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern StatusCode grpc_event_finished_status(EventSafeHandleNotOwned ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern IntPtr grpc_event_finished_details(EventSafeHandleNotOwned ev); // returns const char*
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern IntPtr grpc_event_read_length(EventSafeHandleNotOwned ev);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern void grpc_event_read_copy_to_buffer(EventSafeHandleNotOwned ev, byte[] buffer, UIntPtr bufferLen);
- [DllImport("libgrpc_csharp_ext.so")]
+ [DllImport("grpc_csharp_ext.dll")]
static extern IntPtr grpc_event_server_rpc_new_method(EventSafeHandleNotOwned ev); // returns const char*
public EventSafeHandleNotOwned() : base(false)
diff --git a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs
index 08d4cf0192..d363b34f0b 100644
--- a/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs
+++ b/src/csharp/GrpcCore/Internal/ServerSafeHandle.cs
@@ -10,30 +10,30 @@ namespace Google.GRPC.Core.Internal
/// </summary>
internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("libgrpc.so", EntryPoint = "grpc_server_request_call_old")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_server_request_call_old")]
static extern GRPCCallError grpc_server_request_call_old_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern ServerSafeHandle grpc_server_create(CompletionQueueSafeHandle cq, IntPtr args);
// TODO: check int representation size
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern int grpc_server_add_http2_port(ServerSafeHandle server, string addr);
// TODO: check int representation size
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern int grpc_server_add_secure_http2_port(ServerSafeHandle server, string addr);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_server_start(ServerSafeHandle server);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_server_shutdown(ServerSafeHandle server);
- [DllImport("libgrpc.so", EntryPoint = "grpc_server_shutdown_and_notify")]
+ [DllImport("grpc.dll", EntryPoint = "grpc_server_shutdown_and_notify")]
static extern void grpc_server_shutdown_and_notify_CALLBACK(ServerSafeHandle server, [MarshalAs(UnmanagedType.FunctionPtr)] EventCallbackDelegate callback);
- [DllImport("libgrpc.so")]
+ [DllImport("grpc.dll")]
static extern void grpc_server_destroy(IntPtr server);
private ServerSafeHandle()
diff --git a/src/csharp/GrpcCore/Internal/Timespec.cs b/src/csharp/GrpcCore/Internal/Timespec.cs
index 8ffaf70bbf..5a197e121c 100644
--- a/src/csharp/GrpcCore/Internal/Timespec.cs
+++ b/src/csharp/GrpcCore/Internal/Timespec.cs
@@ -13,7 +13,7 @@ namespace Google.GRPC.Core.Internal
const int nanosPerSecond = 1000 * 1000 * 1000;
const int nanosPerTick = 100;
- [DllImport("libgpr.so")]
+ [DllImport("gpr.dll")]
static extern Timespec gpr_now();
// TODO: this only works on 64bit linux, can we autoselect the right size of ints?