aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/csharp
diff options
context:
space:
mode:
authorGravatar Craig Tiller <craig.tiller@gmail.com>2016-01-22 19:24:23 -0800
committerGravatar Craig Tiller <craig.tiller@gmail.com>2016-01-22 19:24:23 -0800
commitd8e6f8d4f58cb9e9c492204dae1fbb2fac0b7349 (patch)
tree7a66d41bd297c19b789707c069f9a957be061c73 /src/csharp
parent7391f133375f0840a4219db24f9a93a96887742e (diff)
parentea05099f521c4de062f86675095827b658f123d6 (diff)
Merge github.com:grpc/grpc into sceq
Diffstat (limited to 'src/csharp')
-rw-r--r--src/csharp/Grpc.Auth/Grpc.Auth.csproj2
-rw-r--r--src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj2
-rw-r--r--src/csharp/Grpc.Core.Tests/PInvokeTest.cs16
-rw-r--r--src/csharp/Grpc.Core/Grpc.Core.csproj25
-rw-r--r--src/csharp/Grpc.Core/GrpcEnvironment.cs18
-rw-r--r--src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs70
-rw-r--r--src/csharp/Grpc.Core/Internal/CStringSafeHandle.cs7
-rw-r--r--src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs12
-rw-r--r--src/csharp/Grpc.Core/Internal/CallSafeHandle.cs95
-rw-r--r--src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs22
-rw-r--r--src/csharp/Grpc.Core/Internal/ChannelCredentialsSafeHandle.cs19
-rw-r--r--src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs38
-rw-r--r--src/csharp/Grpc.Core/Internal/CompletionQueueEvent.cs7
-rw-r--r--src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs29
-rw-r--r--src/csharp/Grpc.Core/Internal/MetadataArraySafeHandle.cs37
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeExtension.cs158
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeLogRedirector.cs9
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs17
-rw-r--r--src/csharp/Grpc.Core/Internal/NativeMethods.cs816
-rw-r--r--src/csharp/Grpc.Core/Internal/PlatformApis.cs110
-rw-r--r--src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs18
-rw-r--r--src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs42
-rw-r--r--src/csharp/Grpc.Core/Internal/Timespec.cs30
-rw-r--r--src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs158
-rw-r--r--src/csharp/Grpc.Core/NativeDeps.Linux.targets9
-rw-r--r--src/csharp/Grpc.Core/NativeDeps.Mac.targets9
-rw-r--r--src/csharp/Grpc.Core/NativeDeps.Windows.targets9
-rw-r--r--src/csharp/Grpc.Core/NativeDeps.targets28
-rw-r--r--src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj2
-rw-r--r--src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj2
-rw-r--r--src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj4
-rw-r--r--src/csharp/Grpc.Examples.Tests/packages.config2
-rw-r--r--src/csharp/Grpc.Examples/Grpc.Examples.csproj6
-rw-r--r--src/csharp/Grpc.Examples/Math.cs96
-rw-r--r--src/csharp/Grpc.Examples/MathGrpc.cs2
-rw-r--r--src/csharp/Grpc.Examples/packages.config2
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj4
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/packages.config2
-rw-r--r--src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj6
-rw-r--r--src/csharp/Grpc.HealthCheck/Health.cs73
-rw-r--r--src/csharp/Grpc.HealthCheck/HealthGrpc.cs2
-rw-r--r--src/csharp/Grpc.HealthCheck/packages.config2
-rw-r--r--src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj2
-rw-r--r--src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj2
-rw-r--r--src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj2
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Control.cs285
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Empty.cs60
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj9
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Messages.cs279
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Payloads.cs66
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Services.cs34
-rw-r--r--src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs6
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Stats.cs97
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Test.cs53
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestGrpc.cs8
-rw-r--r--src/csharp/Grpc.IntegrationTesting/packages.config3
-rw-r--r--src/csharp/build_packages.bat39
-rw-r--r--src/csharp/buildall.bat4
-rwxr-xr-xsrc/csharp/generate_proto_csharp.sh2
-rw-r--r--src/csharp/grpc.native.csharp/README.md22
-rw-r--r--src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec27
-rw-r--r--src/csharp/grpc.native.csharp/grpc.native.csharp.targets29
-rw-r--r--src/csharp/keys/Grpc.snkbin0 -> 596 bytes
-rw-r--r--src/csharp/keys/README.md6
64 files changed, 2271 insertions, 781 deletions
diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.csproj b/src/csharp/Grpc.Auth/Grpc.Auth.csproj
index 55bde6e194..7e106544a7 100644
--- a/src/csharp/Grpc.Auth/Grpc.Auth.csproj
+++ b/src/csharp/Grpc.Auth/Grpc.Auth.csproj
@@ -36,7 +36,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj
index 475c792347..8307828193 100644
--- a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj
+++ b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj
@@ -32,7 +32,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="nunit.core">
diff --git a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs
index af55cb0566..da0ea2e6dc 100644
--- a/src/csharp/Grpc.Core.Tests/PInvokeTest.cs
+++ b/src/csharp/Grpc.Core.Tests/PInvokeTest.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -45,13 +45,9 @@ namespace Grpc.Core.Tests
{
public class PInvokeTest
{
- int counter;
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] OpCompletionDelegate callback);
+ static readonly NativeMethods Native = NativeMethods.Get();
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
+ int counter;
/// <summary>
/// (~1.26us .NET Windows)
@@ -87,7 +83,7 @@ namespace Grpc.Core.Tests
1000000, 10000000,
() =>
{
- grpcsharp_test_callback(handler);
+ Native.grpcsharp_test_callback(handler);
});
Assert.AreNotEqual(0, counter);
}
@@ -106,7 +102,7 @@ namespace Grpc.Core.Tests
10000, 10000,
() =>
{
- grpcsharp_test_callback(new OpCompletionDelegate(Handler));
+ Native.grpcsharp_test_callback(new OpCompletionDelegate(Handler));
});
Assert.AreNotEqual(0, counter);
}
@@ -122,7 +118,7 @@ namespace Grpc.Core.Tests
1000000, 100000000,
() =>
{
- grpcsharp_test_nop(IntPtr.Zero);
+ Native.grpcsharp_test_nop(IntPtr.Zero);
});
}
diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj
index 852b212114..38398a2afd 100644
--- a/src/csharp/Grpc.Core/Grpc.Core.csproj
+++ b/src/csharp/Grpc.Core/Grpc.Core.csproj
@@ -19,7 +19,6 @@
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <NativeDependenciesConfiguration>Debug</NativeDependenciesConfiguration>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -27,7 +26,6 @@
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
- <NativeDependenciesConfiguration>Release</NativeDependenciesConfiguration>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseSigned|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -37,8 +35,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
- <NativeDependenciesConfiguration>Release</NativeDependenciesConfiguration>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -52,6 +49,10 @@
<Compile Include="AsyncAuthInterceptor.cs" />
<Compile Include="CallCredentials.cs" />
<Compile Include="IClientStreamWriter.cs" />
+ <Compile Include="Internal\NativeMethods.cs" />
+ <Compile Include="Internal\PlatformApis.cs" />
+ <Compile Include="Internal\NativeExtension.cs" />
+ <Compile Include="Internal\UnmanagedLibrary.cs" />
<Compile Include="Internal\NativeMetadataCredentialsPlugin.cs" />
<Compile Include="Internal\INativeCall.cs" />
<Compile Include="IServerStreamWriter.cs" />
@@ -131,20 +132,6 @@
<None Include="Grpc.Core.nuspec" />
<None Include="packages.config" />
</ItemGroup>
- <Choose>
- <!-- Under older versions of Monodevelop, Choose is not supported and is just
- ignored, which gives us the desired effect. -->
- <When Condition=" '$(OS)' != 'Unix' ">
- <ItemGroup>
- <Content Include="..\..\..\vsprojects\$(NativeDependenciesConfiguration)\grpc_csharp_ext.dll">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- </When>
- <Otherwise />
- </Choose>
+ <Import Project="NativeDeps.targets" />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup />
- <ItemGroup />
- <ItemGroup />
</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.Core/GrpcEnvironment.cs b/src/csharp/Grpc.Core/GrpcEnvironment.cs
index e7c04185c2..f3aa3d79de 100644
--- a/src/csharp/Grpc.Core/GrpcEnvironment.cs
+++ b/src/csharp/Grpc.Core/GrpcEnvironment.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -47,15 +47,6 @@ namespace Grpc.Core
{
const int THREAD_POOL_SIZE = 4;
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_init();
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_shutdown();
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_version_string(); // returns not-owned const char*
-
static object staticLock = new object();
static GrpcEnvironment instance;
static int refCount;
@@ -136,7 +127,6 @@ namespace Grpc.Core
/// </summary>
private GrpcEnvironment()
{
- NativeLogRedirector.Redirect();
GrpcNativeInit();
completionRegistry = new CompletionRegistry(this);
threadPool = new GrpcThreadPool(this, THREAD_POOL_SIZE);
@@ -181,18 +171,18 @@ namespace Grpc.Core
/// </summary>
internal static string GetCoreVersionString()
{
- var ptr = grpcsharp_version_string(); // the pointer is not owned
+ var ptr = NativeMethods.Get().grpcsharp_version_string(); // the pointer is not owned
return Marshal.PtrToStringAnsi(ptr);
}
internal static void GrpcNativeInit()
{
- grpcsharp_init();
+ NativeMethods.Get().grpcsharp_init();
}
internal static void GrpcNativeShutdown()
{
- grpcsharp_shutdown();
+ NativeMethods.Get().grpcsharp_shutdown();
}
/// <summary>
diff --git a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs
index 125fb40b32..0e2108f0f2 100644
--- a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs
@@ -42,47 +42,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class BatchContextSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern BatchContextSafeHandle grpcsharp_batch_context_create();
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- 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")]
- static extern CallSafeHandle grpcsharp_batch_context_server_rpc_new_call(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- 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_host(BatchContextSafeHandle ctx); // returns const char*
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern Timespec grpcsharp_batch_context_server_rpc_new_deadline(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_batch_context_server_rpc_new_request_metadata(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_batch_context_destroy(IntPtr ctx);
+ static readonly NativeMethods Native = NativeMethods.Get();
private BatchContextSafeHandle()
{
@@ -90,7 +50,7 @@ namespace Grpc.Core.Internal
public static BatchContextSafeHandle Create()
{
- return grpcsharp_batch_context_create();
+ return Native.grpcsharp_batch_context_create();
}
public IntPtr Handle
@@ -104,17 +64,17 @@ namespace Grpc.Core.Internal
// Gets data of recv_initial_metadata completion.
public Metadata GetReceivedInitialMetadata()
{
- IntPtr metadataArrayPtr = grpcsharp_batch_context_recv_initial_metadata(this);
+ IntPtr metadataArrayPtr = Native.grpcsharp_batch_context_recv_initial_metadata(this);
return MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr);
}
// Gets data of recv_status_on_client completion.
public ClientSideStatus GetReceivedStatusOnClient()
{
- string details = Marshal.PtrToStringAnsi(grpcsharp_batch_context_recv_status_on_client_details(this));
- var status = new Status(grpcsharp_batch_context_recv_status_on_client_status(this), details);
+ string details = Marshal.PtrToStringAnsi(Native.grpcsharp_batch_context_recv_status_on_client_details(this));
+ var status = new Status(Native.grpcsharp_batch_context_recv_status_on_client_status(this), details);
- IntPtr metadataArrayPtr = grpcsharp_batch_context_recv_status_on_client_trailing_metadata(this);
+ IntPtr metadataArrayPtr = Native.grpcsharp_batch_context_recv_status_on_client_trailing_metadata(this);
var metadata = MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr);
return new ClientSideStatus(status, metadata);
@@ -123,26 +83,26 @@ namespace Grpc.Core.Internal
// Gets data of recv_message completion.
public byte[] GetReceivedMessage()
{
- IntPtr len = grpcsharp_batch_context_recv_message_length(this);
+ IntPtr len = Native.grpcsharp_batch_context_recv_message_length(this);
if (len == new IntPtr(-1))
{
return null;
}
byte[] data = new byte[(int)len];
- grpcsharp_batch_context_recv_message_to_buffer(this, data, new UIntPtr((ulong)data.Length));
+ Native.grpcsharp_batch_context_recv_message_to_buffer(this, data, new UIntPtr((ulong)data.Length));
return data;
}
// Gets data of server_rpc_new completion.
public ServerRpcNew GetServerRpcNew(Server server)
{
- var call = grpcsharp_batch_context_server_rpc_new_call(this);
+ var call = Native.grpcsharp_batch_context_server_rpc_new_call(this);
- var method = Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_method(this));
- var host = Marshal.PtrToStringAnsi(grpcsharp_batch_context_server_rpc_new_host(this));
- var deadline = grpcsharp_batch_context_server_rpc_new_deadline(this);
+ var method = Marshal.PtrToStringAnsi(Native.grpcsharp_batch_context_server_rpc_new_method(this));
+ var host = Marshal.PtrToStringAnsi(Native.grpcsharp_batch_context_server_rpc_new_host(this));
+ var deadline = Native.grpcsharp_batch_context_server_rpc_new_deadline(this);
- IntPtr metadataArrayPtr = grpcsharp_batch_context_server_rpc_new_request_metadata(this);
+ IntPtr metadataArrayPtr = Native.grpcsharp_batch_context_server_rpc_new_request_metadata(this);
var metadata = MetadataArraySafeHandle.ReadMetadataFromPtrUnsafe(metadataArrayPtr);
return new ServerRpcNew(server, call, method, host, deadline, metadata);
@@ -151,12 +111,12 @@ namespace Grpc.Core.Internal
// Gets data of receive_close_on_server completion.
public bool GetReceivedCloseOnServerCancelled()
{
- return grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0;
+ return Native.grpcsharp_batch_context_recv_close_on_server_cancelled(this) != 0;
}
protected override bool ReleaseHandle()
{
- grpcsharp_batch_context_destroy(handle);
+ Native.grpcsharp_batch_context_destroy(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/CStringSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CStringSafeHandle.cs
index 92fbe8cf0f..4ae57aa773 100644
--- a/src/csharp/Grpc.Core/Internal/CStringSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/CStringSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -39,8 +39,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class CStringSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern void gprsharp_free(IntPtr ptr);
+ static readonly NativeMethods Native = NativeMethods.Get();
private CStringSafeHandle()
{
@@ -53,7 +52,7 @@ namespace Grpc.Core.Internal
protected override bool ReleaseHandle()
{
- gprsharp_free(handle);
+ Native.gprsharp_free(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
index 3678c7dd86..0f36337f11 100644
--- a/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/CallCredentialsSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -40,11 +40,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class CallCredentialsSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_call_credentials_release(IntPtr credentials);
+ static readonly NativeMethods Native = NativeMethods.Get();
private CallCredentialsSafeHandle()
{
@@ -52,12 +48,12 @@ namespace Grpc.Core.Internal
public static CallCredentialsSafeHandle CreateComposite(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2)
{
- return grpcsharp_composite_call_credentials_create(creds1, creds2);
+ return Native.grpcsharp_composite_call_credentials_create(creds1, creds2);
}
protected override bool ReleaseHandle()
{
- grpcsharp_call_credentials_release(handle);
+ Native.grpcsharp_call_credentials_release(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs
index 298c5e29ab..bc045b67b1 100644
--- a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs
@@ -44,71 +44,12 @@ namespace Grpc.Core.Internal
internal class CallSafeHandle : SafeHandleZeroIsInvalid, INativeCall
{
public static readonly CallSafeHandle NullInstance = new CallSafeHandle();
+ static readonly NativeMethods Native = NativeMethods.Get();
const uint GRPC_WRITE_BUFFER_HINT = 1;
CompletionRegistry completionRegistry;
CompletionQueueSafeHandle completionQueue;
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_cancel(CallSafeHandle call);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_start_unary(CallSafeHandle call,
- BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_start_client_streaming(CallSafeHandle call,
- BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_start_server_streaming(CallSafeHandle call,
- BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
- MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call,
- BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_send_message(CallSafeHandle call,
- BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, WriteFlags writeFlags, bool sendEmptyInitialMetadata);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_send_close_from_client(CallSafeHandle call,
- BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_send_status_from_server(CallSafeHandle call,
- BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_recv_message(CallSafeHandle call,
- BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call,
- BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_start_serverside(CallSafeHandle call,
- BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_send_initial_metadata(CallSafeHandle call,
- BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_call_destroy(IntPtr call);
-
private CallSafeHandle()
{
}
@@ -121,7 +62,7 @@ namespace Grpc.Core.Internal
public void SetCredentials(CallCredentialsSafeHandle credentials)
{
- grpcsharp_call_set_credentials(this, credentials).CheckOk();
+ Native.grpcsharp_call_set_credentials(this, credentials).CheckOk();
}
public void StartUnary(UnaryResponseClientHandler callback, byte[] payload, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags)
@@ -130,7 +71,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
- grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
+ Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
.CheckOk();
}
}
@@ -139,7 +80,7 @@ namespace Grpc.Core.Internal
{
using (Profilers.ForCurrentThread().NewScope("CallSafeHandle.StartUnary"))
{
- grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
+ Native.grpcsharp_call_start_unary(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags)
.CheckOk();
}
}
@@ -150,7 +91,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient(), context.GetReceivedMessage(), context.GetReceivedInitialMetadata()));
- grpcsharp_call_start_client_streaming(this, ctx, metadataArray).CheckOk();
+ Native.grpcsharp_call_start_client_streaming(this, ctx, metadataArray).CheckOk();
}
}
@@ -160,7 +101,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
- grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags).CheckOk();
+ Native.grpcsharp_call_start_server_streaming(this, ctx, payload, new UIntPtr((ulong)payload.Length), metadataArray, writeFlags).CheckOk();
}
}
@@ -170,7 +111,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedStatusOnClient()));
- grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray).CheckOk();
+ Native.grpcsharp_call_start_duplex_streaming(this, ctx, metadataArray).CheckOk();
}
}
@@ -180,7 +121,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
- grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata).CheckOk();
+ Native.grpcsharp_call_send_message(this, ctx, payload, new UIntPtr((ulong)payload.Length), writeFlags, sendEmptyInitialMetadata).CheckOk();
}
}
@@ -190,7 +131,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
- grpcsharp_call_send_close_from_client(this, ctx).CheckOk();
+ Native.grpcsharp_call_send_close_from_client(this, ctx).CheckOk();
}
}
@@ -200,7 +141,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
- grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, status.Detail, metadataArray, sendEmptyInitialMetadata).CheckOk();
+ Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, status.Detail, metadataArray, sendEmptyInitialMetadata).CheckOk();
}
}
@@ -210,7 +151,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedMessage()));
- grpcsharp_call_recv_message(this, ctx).CheckOk();
+ Native.grpcsharp_call_recv_message(this, ctx).CheckOk();
}
}
@@ -220,7 +161,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedInitialMetadata()));
- grpcsharp_call_recv_initial_metadata(this, ctx).CheckOk();
+ Native.grpcsharp_call_recv_initial_metadata(this, ctx).CheckOk();
}
}
@@ -230,7 +171,7 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success, context.GetReceivedCloseOnServerCancelled()));
- grpcsharp_call_start_serverside(this, ctx).CheckOk();
+ Native.grpcsharp_call_start_serverside(this, ctx).CheckOk();
}
}
@@ -240,23 +181,23 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success));
- grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
+ Native.grpcsharp_call_send_initial_metadata(this, ctx, metadataArray).CheckOk();
}
}
public void Cancel()
{
- grpcsharp_call_cancel(this).CheckOk();
+ Native.grpcsharp_call_cancel(this).CheckOk();
}
public void CancelWithStatus(Status status)
{
- grpcsharp_call_cancel_with_status(this, status.StatusCode, status.Detail).CheckOk();
+ Native.grpcsharp_call_cancel_with_status(this, status.StatusCode, status.Detail).CheckOk();
}
public string GetPeer()
{
- using (var cstring = grpcsharp_call_get_peer(this))
+ using (var cstring = Native.grpcsharp_call_get_peer(this))
{
return cstring.GetValue();
}
@@ -264,7 +205,7 @@ namespace Grpc.Core.Internal
protected override bool ReleaseHandle()
{
- grpcsharp_call_destroy(handle);
+ Native.grpcsharp_call_destroy(handle);
return true;
}
diff --git a/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs
index ea5b52374e..f6aa710b21 100644
--- a/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/ChannelArgsSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -39,17 +39,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class ChannelArgsSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs);
-
- [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
- static extern void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
-
- [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
- static extern void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_channel_args_destroy(IntPtr args);
+ static readonly NativeMethods Native = NativeMethods.Get();
private ChannelArgsSafeHandle()
{
@@ -62,22 +52,22 @@ namespace Grpc.Core.Internal
public static ChannelArgsSafeHandle Create(int size)
{
- return grpcsharp_channel_args_create(new UIntPtr((uint)size));
+ return Native.grpcsharp_channel_args_create(new UIntPtr((uint)size));
}
public void SetString(int index, string key, string value)
{
- grpcsharp_channel_args_set_string(this, new UIntPtr((uint)index), key, value);
+ Native.grpcsharp_channel_args_set_string(this, new UIntPtr((uint)index), key, value);
}
public void SetInteger(int index, string key, int value)
{
- grpcsharp_channel_args_set_integer(this, new UIntPtr((uint)index), key, value);
+ Native.grpcsharp_channel_args_set_integer(this, new UIntPtr((uint)index), key, value);
}
protected override bool ReleaseHandle()
{
- grpcsharp_channel_args_destroy(handle);
+ Native.grpcsharp_channel_args_destroy(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/ChannelCredentialsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ChannelCredentialsSafeHandle.cs
index 8a58c64478..65cc2e019f 100644
--- a/src/csharp/Grpc.Core/Internal/ChannelCredentialsSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/ChannelCredentialsSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -40,14 +40,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class ChannelCredentialsSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
- static extern ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_channel_credentials_release(IntPtr credentials);
+ static readonly NativeMethods Native = NativeMethods.Get();
private ChannelCredentialsSafeHandle()
{
@@ -64,22 +57,22 @@ namespace Grpc.Core.Internal
{
if (keyCertPair != null)
{
- return grpcsharp_ssl_credentials_create(pemRootCerts, keyCertPair.CertificateChain, keyCertPair.PrivateKey);
+ return Native.grpcsharp_ssl_credentials_create(pemRootCerts, keyCertPair.CertificateChain, keyCertPair.PrivateKey);
}
else
{
- return grpcsharp_ssl_credentials_create(pemRootCerts, null, null);
+ return Native.grpcsharp_ssl_credentials_create(pemRootCerts, null, null);
}
}
public static ChannelCredentialsSafeHandle CreateComposite(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds)
{
- return grpcsharp_composite_channel_credentials_create(channelCreds, callCreds);
+ return Native.grpcsharp_composite_channel_credentials_create(channelCreds, callCreds);
}
protected override bool ReleaseHandle()
{
- grpcsharp_channel_credentials_release(handle);
+ Native.grpcsharp_channel_credentials_release(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs
index 4a5584121e..2199905cc6 100644
--- a/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/ChannelSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -41,27 +41,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class ChannelSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState,
- Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_channel_destroy(IntPtr channel);
+ static readonly NativeMethods Native = NativeMethods.Get();
private ChannelSafeHandle()
{
@@ -72,7 +52,7 @@ namespace Grpc.Core.Internal
// Increment reference count for the native gRPC environment to make sure we don't do grpc_shutdown() before destroying the server handle.
// Doing so would make object finalizer crash if we end up abandoning the handle.
GrpcEnvironment.GrpcNativeInit();
- return grpcsharp_insecure_channel_create(target, channelArgs);
+ return Native.grpcsharp_insecure_channel_create(target, channelArgs);
}
public static ChannelSafeHandle CreateSecure(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs)
@@ -80,14 +60,14 @@ namespace Grpc.Core.Internal
// Increment reference count for the native gRPC environment to make sure we don't do grpc_shutdown() before destroying the server handle.
// Doing so would make object finalizer crash if we end up abandoning the handle.
GrpcEnvironment.GrpcNativeInit();
- return grpcsharp_secure_channel_create(credentials, target, channelArgs);
+ return Native.grpcsharp_secure_channel_create(credentials, target, channelArgs);
}
public CallSafeHandle CreateCall(CompletionRegistry registry, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline, CallCredentialsSafeHandle credentials)
{
using (Profilers.ForCurrentThread().NewScope("ChannelSafeHandle.CreateCall"))
{
- var result = grpcsharp_channel_create_call(this, parentCall, propagationMask, cq, method, host, deadline);
+ var result = Native.grpcsharp_channel_create_call(this, parentCall, propagationMask, cq, method, host, deadline);
if (credentials != null)
{
result.SetCredentials(credentials);
@@ -99,7 +79,7 @@ namespace Grpc.Core.Internal
public ChannelState CheckConnectivityState(bool tryToConnect)
{
- return grpcsharp_channel_check_connectivity_state(this, tryToConnect ? 1 : 0);
+ return Native.grpcsharp_channel_check_connectivity_state(this, tryToConnect ? 1 : 0);
}
public void WatchConnectivityState(ChannelState lastObservedState, Timespec deadline, CompletionQueueSafeHandle cq,
@@ -107,12 +87,12 @@ namespace Grpc.Core.Internal
{
var ctx = BatchContextSafeHandle.Create();
completionRegistry.RegisterBatchCompletion(ctx, callback);
- grpcsharp_channel_watch_connectivity_state(this, lastObservedState, deadline, cq, ctx);
+ Native.grpcsharp_channel_watch_connectivity_state(this, lastObservedState, deadline, cq, ctx);
}
public string GetTarget()
{
- using (var cstring = grpcsharp_channel_get_target(this))
+ using (var cstring = Native.grpcsharp_channel_get_target(this))
{
return cstring.GetValue();
}
@@ -120,7 +100,7 @@ namespace Grpc.Core.Internal
protected override bool ReleaseHandle()
{
- grpcsharp_channel_destroy(handle);
+ Native.grpcsharp_channel_destroy(handle);
GrpcEnvironment.GrpcNativeShutdown();
return true;
}
diff --git a/src/csharp/Grpc.Core/Internal/CompletionQueueEvent.cs b/src/csharp/Grpc.Core/Internal/CompletionQueueEvent.cs
index 3f517514a3..36a92ecd8e 100644
--- a/src/csharp/Grpc.Core/Internal/CompletionQueueEvent.cs
+++ b/src/csharp/Grpc.Core/Internal/CompletionQueueEvent.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -42,8 +42,7 @@ namespace Grpc.Core.Internal
[StructLayout(LayoutKind.Sequential)]
internal struct CompletionQueueEvent
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern int grpcsharp_sizeof_grpc_event();
+ static readonly NativeMethods Native = NativeMethods.Get();
public GRPCCompletionType type;
public int success;
@@ -53,7 +52,7 @@ namespace Grpc.Core.Internal
{
get
{
- return grpcsharp_sizeof_grpc_event();
+ return Native.grpcsharp_sizeof_grpc_event();
}
}
}
diff --git a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs
index 3754ad382e..9d7a990c42 100644
--- a/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/CompletionQueueSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -42,22 +42,9 @@ namespace Grpc.Core.Internal
/// </summary>
internal class CompletionQueueSafeHandle : SafeHandleZeroIsInvalid
{
- AtomicCounter shutdownRefcount = new AtomicCounter(1);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create();
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq);
+ static readonly NativeMethods Native = NativeMethods.Get();
- [DllImport("grpc_csharp_ext.dll")]
- static extern CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_completion_queue_destroy(IntPtr cq);
+ AtomicCounter shutdownRefcount = new AtomicCounter(1);
private CompletionQueueSafeHandle()
{
@@ -65,20 +52,20 @@ namespace Grpc.Core.Internal
public static CompletionQueueSafeHandle Create()
{
- return grpcsharp_completion_queue_create();
+ return Native.grpcsharp_completion_queue_create();
}
public CompletionQueueEvent Next()
{
- return grpcsharp_completion_queue_next(this);
+ return Native.grpcsharp_completion_queue_next(this);
}
public CompletionQueueEvent Pluck(IntPtr tag)
{
using (Profilers.ForCurrentThread().NewScope("CompletionQueueSafeHandle.Pluck"))
{
- return grpcsharp_completion_queue_pluck(this, tag);
+ return Native.grpcsharp_completion_queue_pluck(this, tag);
}
}
@@ -98,7 +85,7 @@ namespace Grpc.Core.Internal
protected override bool ReleaseHandle()
{
- grpcsharp_completion_queue_destroy(handle);
+ Native.grpcsharp_completion_queue_destroy(handle);
return true;
}
@@ -106,7 +93,7 @@ namespace Grpc.Core.Internal
{
if (shutdownRefcount.Decrement() == 0)
{
- grpcsharp_completion_queue_shutdown(this);
+ Native.grpcsharp_completion_queue_shutdown(this);
}
}
diff --git a/src/csharp/Grpc.Core/Internal/MetadataArraySafeHandle.cs b/src/csharp/Grpc.Core/Internal/MetadataArraySafeHandle.cs
index ed1bd24498..81760d7a10 100644
--- a/src/csharp/Grpc.Core/Internal/MetadataArraySafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/MetadataArraySafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -40,26 +40,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class MetadataArraySafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity);
-
- [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
- static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern UIntPtr grpcsharp_metadata_array_get_value_length(IntPtr metadataArray, UIntPtr index);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_metadata_array_destroy_full(IntPtr array);
+ static readonly NativeMethods Native = NativeMethods.Get();
private MetadataArraySafeHandle()
{
@@ -70,11 +51,11 @@ namespace Grpc.Core.Internal
using (Profilers.ForCurrentThread().NewScope("MetadataArraySafeHandle.Create"))
{
// TODO(jtattermusch): we might wanna check that the metadata is readonly
- var metadataArray = grpcsharp_metadata_array_create(new UIntPtr((ulong)metadata.Count));
+ var metadataArray = Native.grpcsharp_metadata_array_create(new UIntPtr((ulong)metadata.Count));
for (int i = 0; i < metadata.Count; i++)
{
var valueBytes = metadata[i].GetSerializedValueUnsafe();
- grpcsharp_metadata_array_add(metadataArray, metadata[i].Key, valueBytes, new UIntPtr((ulong)valueBytes.Length));
+ Native.grpcsharp_metadata_array_add(metadataArray, metadata[i].Key, valueBytes, new UIntPtr((ulong)valueBytes.Length));
}
return metadataArray;
}
@@ -90,15 +71,15 @@ namespace Grpc.Core.Internal
return null;
}
- ulong count = grpcsharp_metadata_array_count(metadataArray).ToUInt64();
+ ulong count = Native.grpcsharp_metadata_array_count(metadataArray).ToUInt64();
var metadata = new Metadata();
for (ulong i = 0; i < count; i++)
{
var index = new UIntPtr(i);
- string key = Marshal.PtrToStringAnsi(grpcsharp_metadata_array_get_key(metadataArray, index));
- var bytes = new byte[grpcsharp_metadata_array_get_value_length(metadataArray, index).ToUInt64()];
- Marshal.Copy(grpcsharp_metadata_array_get_value(metadataArray, index), bytes, 0, bytes.Length);
+ string key = Marshal.PtrToStringAnsi(Native.grpcsharp_metadata_array_get_key(metadataArray, index));
+ var bytes = new byte[Native.grpcsharp_metadata_array_get_value_length(metadataArray, index).ToUInt64()];
+ Marshal.Copy(Native.grpcsharp_metadata_array_get_value(metadataArray, index), bytes, 0, bytes.Length);
metadata.Add(Metadata.Entry.CreateUnsafe(key, bytes));
}
return metadata;
@@ -114,7 +95,7 @@ namespace Grpc.Core.Internal
protected override bool ReleaseHandle()
{
- grpcsharp_metadata_array_destroy_full(handle);
+ Native.grpcsharp_metadata_array_destroy_full(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/NativeExtension.cs b/src/csharp/Grpc.Core/Internal/NativeExtension.cs
new file mode 100644
index 0000000000..137533b3ef
--- /dev/null
+++ b/src/csharp/Grpc.Core/Internal/NativeExtension.cs
@@ -0,0 +1,158 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.IO;
+using System.Reflection;
+
+using Grpc.Core.Logging;
+
+namespace Grpc.Core.Internal
+{
+ /// <summary>
+ /// Takes care of loading C# native extension and provides access to PInvoke calls the library exports.
+ /// </summary>
+ internal sealed class NativeExtension
+ {
+ const string NativeLibrariesDir = "nativelibs";
+
+ static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<NativeExtension>();
+ static readonly object staticLock = new object();
+ static volatile NativeExtension instance;
+
+ readonly NativeMethods nativeMethods;
+
+ private NativeExtension()
+ {
+ this.nativeMethods = new NativeMethods(Load());
+
+ // Redirect the the native logs as the very first thing after loading the native extension
+ // to make sure we don't lose any logs.
+ NativeLogRedirector.Redirect(this.nativeMethods);
+
+ Logger.Debug("gRPC native library loaded successfully.");
+ }
+
+ /// <summary>
+ /// Gets singleton instance of this class.
+ /// The native extension is loaded when called for the first time.
+ /// </summary>
+ public static NativeExtension Get()
+ {
+ if (instance == null)
+ {
+ lock (staticLock)
+ {
+ if (instance == null) {
+ instance = new NativeExtension();
+ }
+ }
+ }
+ return instance;
+ }
+
+ /// <summary>
+ /// Provides access to the exported native methods.
+ /// </summary>
+ public NativeMethods NativeMethods
+ {
+ get { return this.nativeMethods; }
+ }
+
+ /// <summary>
+ /// Detects which configuration of native extension to load and load it.
+ /// </summary>
+ private static UnmanagedLibrary Load()
+ {
+ // TODO: allow customizing path to native extension (possibly through exposing a GrpcEnvironment property).
+
+ var libraryFlavor = string.Format("{0}_{1}", GetPlatformString(), GetArchitectureString());
+ var fullPath = Path.Combine(GetExecutingAssemblyDirectory(),
+ NativeLibrariesDir, libraryFlavor, GetNativeLibraryFilename());
+ return new UnmanagedLibrary(fullPath);
+ }
+
+ private static string GetExecutingAssemblyDirectory()
+ {
+ return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ }
+
+ private static string GetPlatformString()
+ {
+ if (PlatformApis.IsWindows)
+ {
+ return "windows";
+ }
+ if (PlatformApis.IsLinux)
+ {
+ return "linux";
+ }
+ if (PlatformApis.IsMacOSX)
+ {
+ return "macosx";
+ }
+ throw new InvalidOperationException("Unsupported platform.");
+ }
+
+ // Currently, only Intel platform is supported.
+ private static string GetArchitectureString()
+ {
+ if (PlatformApis.Is64Bit)
+ {
+ return "x64";
+ }
+ else
+ {
+ return "x86";
+ }
+ }
+
+ // platform specific file name of the extension library
+ private static string GetNativeLibraryFilename()
+ {
+ if (PlatformApis.IsWindows)
+ {
+ return "grpc_csharp_ext.dll";
+ }
+ if (PlatformApis.IsLinux)
+ {
+ return "libgrpc_csharp_ext.so";
+ }
+ if (PlatformApis.IsMacOSX)
+ {
+ return "libgrpc_csharp_ext.dylib";
+ }
+ throw new InvalidOperationException("Unsupported platform.");
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Core/Internal/NativeLogRedirector.cs b/src/csharp/Grpc.Core/Internal/NativeLogRedirector.cs
index b8a55c5fe8..4bbbb4808c 100644
--- a/src/csharp/Grpc.Core/Internal/NativeLogRedirector.cs
+++ b/src/csharp/Grpc.Core/Internal/NativeLogRedirector.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -51,20 +51,17 @@ namespace Grpc.Core.Internal
static object staticLock = new object();
static GprLogDelegate writeCallback;
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_redirect_log(GprLogDelegate callback);
-
/// <summary>
/// Redirects logs from native gRPC C core library to a general logger.
/// </summary>
- public static void Redirect()
+ public static void Redirect(NativeMethods native)
{
lock (staticLock)
{
if (writeCallback == null)
{
writeCallback = new GprLogDelegate(HandleWrite);
- grpcsharp_redirect_log(writeCallback);
+ native.grpcsharp_redirect_log(writeCallback);
}
}
}
diff --git a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
index 8bb646d303..36b865c09c 100644
--- a/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
+++ b/src/csharp/Grpc.Core/Internal/NativeMetadataCredentialsPlugin.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -44,12 +44,7 @@ namespace Grpc.Core.Internal
{
const string GetMetadataExceptionMsg = "Exception occured in metadata credentials plugin.";
static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<NativeMetadataCredentialsPlugin>();
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor);
-
- [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
- static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
+ static readonly NativeMethods Native = NativeMethods.Get();
AsyncAuthInterceptor interceptor;
GCHandle gcHandle;
@@ -63,7 +58,7 @@ namespace Grpc.Core.Internal
// Make sure the callback doesn't get garbage collected until it is destroyed.
this.gcHandle = GCHandle.Alloc(this.nativeInterceptor, GCHandleType.Normal);
- this.credentials = grpcsharp_metadata_credentials_create_from_plugin(nativeInterceptor);
+ this.credentials = Native.grpcsharp_metadata_credentials_create_from_plugin(nativeInterceptor);
}
public CallCredentialsSafeHandle Credentials
@@ -87,7 +82,7 @@ namespace Grpc.Core.Internal
}
catch (Exception e)
{
- grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, MetadataArraySafeHandle.Create(Metadata.Empty), StatusCode.Unknown, GetMetadataExceptionMsg);
+ Native.grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, MetadataArraySafeHandle.Create(Metadata.Empty), StatusCode.Unknown, GetMetadataExceptionMsg);
Logger.Error(e, GetMetadataExceptionMsg);
}
}
@@ -101,12 +96,12 @@ namespace Grpc.Core.Internal
using (var metadataArray = MetadataArraySafeHandle.Create(metadata))
{
- grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, metadataArray, StatusCode.OK, null);
+ Native.grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, metadataArray, StatusCode.OK, null);
}
}
catch (Exception e)
{
- grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, MetadataArraySafeHandle.Create(Metadata.Empty), StatusCode.Unknown, GetMetadataExceptionMsg);
+ Native.grpcsharp_metadata_credentials_notify_from_plugin(callbackPtr, userDataPtr, MetadataArraySafeHandle.Create(Metadata.Empty), StatusCode.Unknown, GetMetadataExceptionMsg);
Logger.Error(e, GetMetadataExceptionMsg);
}
}
diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.cs
new file mode 100644
index 0000000000..af37d61c73
--- /dev/null
+++ b/src/csharp/Grpc.Core/Internal/NativeMethods.cs
@@ -0,0 +1,816 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+using Grpc.Core.Logging;
+using Grpc.Core.Utils;
+
+namespace Grpc.Core.Internal
+{
+ /// <summary>
+ /// Provides access to all native methods provided by <c>NativeExtension</c>.
+ /// An extra level of indirection is added to P/Invoke calls to allow intelligent loading
+ /// of the right configuration of the native extension based on current platform, architecture etc.
+ /// </summary>
+ internal class NativeMethods
+ {
+ #region Native methods
+
+ public readonly Delegates.grpcsharp_init_delegate grpcsharp_init;
+ public readonly Delegates.grpcsharp_shutdown_delegate grpcsharp_shutdown;
+ public readonly Delegates.grpcsharp_version_string_delegate grpcsharp_version_string;
+
+ public readonly Delegates.grpcsharp_batch_context_create_delegate grpcsharp_batch_context_create;
+ public readonly Delegates.grpcsharp_batch_context_recv_initial_metadata_delegate grpcsharp_batch_context_recv_initial_metadata;
+ public readonly Delegates.grpcsharp_batch_context_recv_message_length_delegate grpcsharp_batch_context_recv_message_length;
+ public readonly Delegates.grpcsharp_batch_context_recv_message_to_buffer_delegate grpcsharp_batch_context_recv_message_to_buffer;
+ public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_status_delegate grpcsharp_batch_context_recv_status_on_client_status;
+ public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate grpcsharp_batch_context_recv_status_on_client_details;
+ public readonly Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
+ public readonly Delegates.grpcsharp_batch_context_server_rpc_new_call_delegate grpcsharp_batch_context_server_rpc_new_call;
+ public readonly Delegates.grpcsharp_batch_context_server_rpc_new_method_delegate grpcsharp_batch_context_server_rpc_new_method;
+ public readonly Delegates.grpcsharp_batch_context_server_rpc_new_host_delegate grpcsharp_batch_context_server_rpc_new_host;
+ public readonly Delegates.grpcsharp_batch_context_server_rpc_new_deadline_delegate grpcsharp_batch_context_server_rpc_new_deadline;
+ public readonly Delegates.grpcsharp_batch_context_server_rpc_new_request_metadata_delegate grpcsharp_batch_context_server_rpc_new_request_metadata;
+ public readonly Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate grpcsharp_batch_context_recv_close_on_server_cancelled;
+ public readonly Delegates.grpcsharp_batch_context_destroy_delegate grpcsharp_batch_context_destroy;
+
+ public readonly Delegates.grpcsharp_composite_call_credentials_create_delegate grpcsharp_composite_call_credentials_create;
+ public readonly Delegates.grpcsharp_call_credentials_release_delegate grpcsharp_call_credentials_release;
+
+ public readonly Delegates.grpcsharp_call_cancel_delegate grpcsharp_call_cancel;
+ public readonly Delegates.grpcsharp_call_cancel_with_status_delegate grpcsharp_call_cancel_with_status;
+ public readonly Delegates.grpcsharp_call_start_unary_delegate grpcsharp_call_start_unary;
+ public readonly Delegates.grpcsharp_call_start_client_streaming_delegate grpcsharp_call_start_client_streaming;
+ public readonly Delegates.grpcsharp_call_start_server_streaming_delegate grpcsharp_call_start_server_streaming;
+ public readonly Delegates.grpcsharp_call_start_duplex_streaming_delegate grpcsharp_call_start_duplex_streaming;
+ public readonly Delegates.grpcsharp_call_send_message_delegate grpcsharp_call_send_message;
+ public readonly Delegates.grpcsharp_call_send_close_from_client_delegate grpcsharp_call_send_close_from_client;
+ public readonly Delegates.grpcsharp_call_send_status_from_server_delegate grpcsharp_call_send_status_from_server;
+ public readonly Delegates.grpcsharp_call_recv_message_delegate grpcsharp_call_recv_message;
+ public readonly Delegates.grpcsharp_call_recv_initial_metadata_delegate grpcsharp_call_recv_initial_metadata;
+ public readonly Delegates.grpcsharp_call_start_serverside_delegate grpcsharp_call_start_serverside;
+ public readonly Delegates.grpcsharp_call_send_initial_metadata_delegate grpcsharp_call_send_initial_metadata;
+ public readonly Delegates.grpcsharp_call_set_credentials_delegate grpcsharp_call_set_credentials;
+ public readonly Delegates.grpcsharp_call_get_peer_delegate grpcsharp_call_get_peer;
+ public readonly Delegates.grpcsharp_call_destroy_delegate grpcsharp_call_destroy;
+
+ public readonly Delegates.grpcsharp_channel_args_create_delegate grpcsharp_channel_args_create;
+ public readonly Delegates.grpcsharp_channel_args_set_string_delegate grpcsharp_channel_args_set_string;
+ public readonly Delegates.grpcsharp_channel_args_set_integer_delegate grpcsharp_channel_args_set_integer;
+ public readonly Delegates.grpcsharp_channel_args_destroy_delegate grpcsharp_channel_args_destroy;
+
+ public readonly Delegates.grpcsharp_ssl_credentials_create_delegate grpcsharp_ssl_credentials_create;
+ public readonly Delegates.grpcsharp_composite_channel_credentials_create_delegate grpcsharp_composite_channel_credentials_create;
+ public readonly Delegates.grpcsharp_channel_credentials_release_delegate grpcsharp_channel_credentials_release;
+
+ public readonly Delegates.grpcsharp_insecure_channel_create_delegate grpcsharp_insecure_channel_create;
+ public readonly Delegates.grpcsharp_secure_channel_create_delegate grpcsharp_secure_channel_create;
+ public readonly Delegates.grpcsharp_channel_create_call_delegate grpcsharp_channel_create_call;
+ public readonly Delegates.grpcsharp_channel_check_connectivity_state_delegate grpcsharp_channel_check_connectivity_state;
+ public readonly Delegates.grpcsharp_channel_watch_connectivity_state_delegate grpcsharp_channel_watch_connectivity_state;
+ public readonly Delegates.grpcsharp_channel_get_target_delegate grpcsharp_channel_get_target;
+ public readonly Delegates.grpcsharp_channel_destroy_delegate grpcsharp_channel_destroy;
+
+ public readonly Delegates.grpcsharp_sizeof_grpc_event_delegate grpcsharp_sizeof_grpc_event;
+
+ public readonly Delegates.grpcsharp_completion_queue_create_delegate grpcsharp_completion_queue_create;
+ public readonly Delegates.grpcsharp_completion_queue_shutdown_delegate grpcsharp_completion_queue_shutdown;
+ public readonly Delegates.grpcsharp_completion_queue_next_delegate grpcsharp_completion_queue_next;
+ public readonly Delegates.grpcsharp_completion_queue_pluck_delegate grpcsharp_completion_queue_pluck;
+ public readonly Delegates.grpcsharp_completion_queue_destroy_delegate grpcsharp_completion_queue_destroy;
+
+ public readonly Delegates.gprsharp_free_delegate gprsharp_free;
+
+ public readonly Delegates.grpcsharp_metadata_array_create_delegate grpcsharp_metadata_array_create;
+ public readonly Delegates.grpcsharp_metadata_array_add_delegate grpcsharp_metadata_array_add;
+ public readonly Delegates.grpcsharp_metadata_array_count_delegate grpcsharp_metadata_array_count;
+ public readonly Delegates.grpcsharp_metadata_array_get_key_delegate grpcsharp_metadata_array_get_key;
+ public readonly Delegates.grpcsharp_metadata_array_get_value_delegate grpcsharp_metadata_array_get_value;
+ public readonly Delegates.grpcsharp_metadata_array_get_value_length_delegate grpcsharp_metadata_array_get_value_length;
+ public readonly Delegates.grpcsharp_metadata_array_destroy_full_delegate grpcsharp_metadata_array_destroy_full;
+
+ public readonly Delegates.grpcsharp_redirect_log_delegate grpcsharp_redirect_log;
+
+ public readonly Delegates.grpcsharp_metadata_credentials_create_from_plugin_delegate grpcsharp_metadata_credentials_create_from_plugin;
+ public readonly Delegates.grpcsharp_metadata_credentials_notify_from_plugin_delegate grpcsharp_metadata_credentials_notify_from_plugin;
+
+ public readonly Delegates.grpcsharp_ssl_server_credentials_create_delegate grpcsharp_ssl_server_credentials_create;
+ public readonly Delegates.grpcsharp_server_credentials_release_delegate grpcsharp_server_credentials_release;
+
+ public readonly Delegates.grpcsharp_server_create_delegate grpcsharp_server_create;
+ public readonly Delegates.grpcsharp_server_add_insecure_http2_port_delegate grpcsharp_server_add_insecure_http2_port;
+ public readonly Delegates.grpcsharp_server_add_secure_http2_port_delegate grpcsharp_server_add_secure_http2_port;
+ public readonly Delegates.grpcsharp_server_start_delegate grpcsharp_server_start;
+ public readonly Delegates.grpcsharp_server_request_call_delegate grpcsharp_server_request_call;
+ public readonly Delegates.grpcsharp_server_cancel_all_calls_delegate grpcsharp_server_cancel_all_calls;
+ public readonly Delegates.grpcsharp_server_shutdown_and_notify_callback_delegate grpcsharp_server_shutdown_and_notify_callback;
+ public readonly Delegates.grpcsharp_server_destroy_delegate grpcsharp_server_destroy;
+
+ public readonly Delegates.gprsharp_now_delegate gprsharp_now;
+ public readonly Delegates.gprsharp_inf_future_delegate gprsharp_inf_future;
+ public readonly Delegates.gprsharp_inf_past_delegate gprsharp_inf_past;
+ public readonly Delegates.gprsharp_convert_clock_type_delegate gprsharp_convert_clock_type;
+ public readonly Delegates.gprsharp_sizeof_timespec_delegate gprsharp_sizeof_timespec;
+
+ public readonly Delegates.grpcsharp_test_callback_delegate grpcsharp_test_callback;
+ public readonly Delegates.grpcsharp_test_nop_delegate grpcsharp_test_nop;
+
+ #endregion
+
+ public NativeMethods(UnmanagedLibrary library)
+ {
+ if (PlatformApis.IsLinux || PlatformApis.IsMacOSX)
+ {
+ this.grpcsharp_init = GetMethodDelegate<Delegates.grpcsharp_init_delegate>(library);
+ this.grpcsharp_shutdown = GetMethodDelegate<Delegates.grpcsharp_shutdown_delegate>(library);
+ this.grpcsharp_version_string = GetMethodDelegate<Delegates.grpcsharp_version_string_delegate>(library);
+
+ this.grpcsharp_batch_context_create = GetMethodDelegate<Delegates.grpcsharp_batch_context_create_delegate>(library);
+ this.grpcsharp_batch_context_recv_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_initial_metadata_delegate>(library);
+ this.grpcsharp_batch_context_recv_message_length = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_message_length_delegate>(library);
+ this.grpcsharp_batch_context_recv_message_to_buffer = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_message_to_buffer_delegate>(library);
+ this.grpcsharp_batch_context_recv_status_on_client_status = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_status_delegate>(library);
+ this.grpcsharp_batch_context_recv_status_on_client_details = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_details_delegate>(library);
+ this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate>(library);
+ this.grpcsharp_batch_context_server_rpc_new_call = GetMethodDelegate<Delegates.grpcsharp_batch_context_server_rpc_new_call_delegate>(library);
+ this.grpcsharp_batch_context_server_rpc_new_method = GetMethodDelegate<Delegates.grpcsharp_batch_context_server_rpc_new_method_delegate>(library);
+ this.grpcsharp_batch_context_server_rpc_new_host = GetMethodDelegate<Delegates.grpcsharp_batch_context_server_rpc_new_host_delegate>(library);
+ this.grpcsharp_batch_context_server_rpc_new_deadline = GetMethodDelegate<Delegates.grpcsharp_batch_context_server_rpc_new_deadline_delegate>(library);
+ this.grpcsharp_batch_context_server_rpc_new_request_metadata = GetMethodDelegate<Delegates.grpcsharp_batch_context_server_rpc_new_request_metadata_delegate>(library);
+ this.grpcsharp_batch_context_recv_close_on_server_cancelled = GetMethodDelegate<Delegates.grpcsharp_batch_context_recv_close_on_server_cancelled_delegate>(library);
+ this.grpcsharp_batch_context_destroy = GetMethodDelegate<Delegates.grpcsharp_batch_context_destroy_delegate>(library);
+
+ this.grpcsharp_composite_call_credentials_create = GetMethodDelegate<Delegates.grpcsharp_composite_call_credentials_create_delegate>(library);
+ this.grpcsharp_call_credentials_release = GetMethodDelegate<Delegates.grpcsharp_call_credentials_release_delegate>(library);
+
+ this.grpcsharp_call_cancel = GetMethodDelegate<Delegates.grpcsharp_call_cancel_delegate>(library);
+ this.grpcsharp_call_cancel_with_status = GetMethodDelegate<Delegates.grpcsharp_call_cancel_with_status_delegate>(library);
+ this.grpcsharp_call_start_unary = GetMethodDelegate<Delegates.grpcsharp_call_start_unary_delegate>(library);
+ this.grpcsharp_call_start_client_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_client_streaming_delegate>(library);
+ this.grpcsharp_call_start_server_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_server_streaming_delegate>(library);
+ this.grpcsharp_call_start_duplex_streaming = GetMethodDelegate<Delegates.grpcsharp_call_start_duplex_streaming_delegate>(library);
+ this.grpcsharp_call_send_message = GetMethodDelegate<Delegates.grpcsharp_call_send_message_delegate>(library);
+ this.grpcsharp_call_send_close_from_client = GetMethodDelegate<Delegates.grpcsharp_call_send_close_from_client_delegate>(library);
+ this.grpcsharp_call_send_status_from_server = GetMethodDelegate<Delegates.grpcsharp_call_send_status_from_server_delegate>(library);
+ this.grpcsharp_call_recv_message = GetMethodDelegate<Delegates.grpcsharp_call_recv_message_delegate>(library);
+ this.grpcsharp_call_recv_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_call_recv_initial_metadata_delegate>(library);
+ this.grpcsharp_call_start_serverside = GetMethodDelegate<Delegates.grpcsharp_call_start_serverside_delegate>(library);
+ this.grpcsharp_call_send_initial_metadata = GetMethodDelegate<Delegates.grpcsharp_call_send_initial_metadata_delegate>(library);
+ this.grpcsharp_call_set_credentials = GetMethodDelegate<Delegates.grpcsharp_call_set_credentials_delegate>(library);
+ this.grpcsharp_call_get_peer = GetMethodDelegate<Delegates.grpcsharp_call_get_peer_delegate>(library);
+ this.grpcsharp_call_destroy = GetMethodDelegate<Delegates.grpcsharp_call_destroy_delegate>(library);
+
+ this.grpcsharp_channel_args_create = GetMethodDelegate<Delegates.grpcsharp_channel_args_create_delegate>(library);
+ this.grpcsharp_channel_args_set_string = GetMethodDelegate<Delegates.grpcsharp_channel_args_set_string_delegate>(library);
+ this.grpcsharp_channel_args_set_integer = GetMethodDelegate<Delegates.grpcsharp_channel_args_set_integer_delegate>(library);
+ this.grpcsharp_channel_args_destroy = GetMethodDelegate<Delegates.grpcsharp_channel_args_destroy_delegate>(library);
+
+ this.grpcsharp_ssl_credentials_create = GetMethodDelegate<Delegates.grpcsharp_ssl_credentials_create_delegate>(library);
+ this.grpcsharp_composite_channel_credentials_create = GetMethodDelegate<Delegates.grpcsharp_composite_channel_credentials_create_delegate>(library);
+ this.grpcsharp_channel_credentials_release = GetMethodDelegate<Delegates.grpcsharp_channel_credentials_release_delegate>(library);
+
+ this.grpcsharp_insecure_channel_create = GetMethodDelegate<Delegates.grpcsharp_insecure_channel_create_delegate>(library);
+ this.grpcsharp_secure_channel_create = GetMethodDelegate<Delegates.grpcsharp_secure_channel_create_delegate>(library);
+ this.grpcsharp_channel_create_call = GetMethodDelegate<Delegates.grpcsharp_channel_create_call_delegate>(library);
+ this.grpcsharp_channel_check_connectivity_state = GetMethodDelegate<Delegates.grpcsharp_channel_check_connectivity_state_delegate>(library);
+ this.grpcsharp_channel_watch_connectivity_state = GetMethodDelegate<Delegates.grpcsharp_channel_watch_connectivity_state_delegate>(library);
+ this.grpcsharp_channel_get_target = GetMethodDelegate<Delegates.grpcsharp_channel_get_target_delegate>(library);
+ this.grpcsharp_channel_destroy = GetMethodDelegate<Delegates.grpcsharp_channel_destroy_delegate>(library);
+
+ this.grpcsharp_sizeof_grpc_event = GetMethodDelegate<Delegates.grpcsharp_sizeof_grpc_event_delegate>(library);
+
+ this.grpcsharp_completion_queue_create = GetMethodDelegate<Delegates.grpcsharp_completion_queue_create_delegate>(library);
+ this.grpcsharp_completion_queue_shutdown = GetMethodDelegate<Delegates.grpcsharp_completion_queue_shutdown_delegate>(library);
+ this.grpcsharp_completion_queue_next = GetMethodDelegate<Delegates.grpcsharp_completion_queue_next_delegate>(library);
+ this.grpcsharp_completion_queue_pluck = GetMethodDelegate<Delegates.grpcsharp_completion_queue_pluck_delegate>(library);
+ this.grpcsharp_completion_queue_destroy = GetMethodDelegate<Delegates.grpcsharp_completion_queue_destroy_delegate>(library);
+
+ this.gprsharp_free = GetMethodDelegate<Delegates.gprsharp_free_delegate>(library);
+
+ this.grpcsharp_metadata_array_create = GetMethodDelegate<Delegates.grpcsharp_metadata_array_create_delegate>(library);
+ this.grpcsharp_metadata_array_add = GetMethodDelegate<Delegates.grpcsharp_metadata_array_add_delegate>(library);
+ this.grpcsharp_metadata_array_count = GetMethodDelegate<Delegates.grpcsharp_metadata_array_count_delegate>(library);
+ this.grpcsharp_metadata_array_get_key = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_key_delegate>(library);
+ this.grpcsharp_metadata_array_get_value = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_value_delegate>(library);
+ this.grpcsharp_metadata_array_get_value_length = GetMethodDelegate<Delegates.grpcsharp_metadata_array_get_value_length_delegate>(library);
+ this.grpcsharp_metadata_array_destroy_full = GetMethodDelegate<Delegates.grpcsharp_metadata_array_destroy_full_delegate>(library);
+
+ this.grpcsharp_redirect_log = GetMethodDelegate<Delegates.grpcsharp_redirect_log_delegate>(library);
+
+ this.grpcsharp_metadata_credentials_create_from_plugin = GetMethodDelegate<Delegates.grpcsharp_metadata_credentials_create_from_plugin_delegate>(library);
+ this.grpcsharp_metadata_credentials_notify_from_plugin = GetMethodDelegate<Delegates.grpcsharp_metadata_credentials_notify_from_plugin_delegate>(library);
+
+ this.grpcsharp_ssl_server_credentials_create = GetMethodDelegate<Delegates.grpcsharp_ssl_server_credentials_create_delegate>(library);
+ this.grpcsharp_server_credentials_release = GetMethodDelegate<Delegates.grpcsharp_server_credentials_release_delegate>(library);
+
+ this.grpcsharp_server_create = GetMethodDelegate<Delegates.grpcsharp_server_create_delegate>(library);
+ this.grpcsharp_server_add_insecure_http2_port = GetMethodDelegate<Delegates.grpcsharp_server_add_insecure_http2_port_delegate>(library);
+ this.grpcsharp_server_add_secure_http2_port = GetMethodDelegate<Delegates.grpcsharp_server_add_secure_http2_port_delegate>(library);
+ this.grpcsharp_server_start = GetMethodDelegate<Delegates.grpcsharp_server_start_delegate>(library);
+ this.grpcsharp_server_request_call = GetMethodDelegate<Delegates.grpcsharp_server_request_call_delegate>(library);
+ this.grpcsharp_server_cancel_all_calls = GetMethodDelegate<Delegates.grpcsharp_server_cancel_all_calls_delegate>(library);
+ this.grpcsharp_server_shutdown_and_notify_callback = GetMethodDelegate<Delegates.grpcsharp_server_shutdown_and_notify_callback_delegate>(library);
+ this.grpcsharp_server_destroy = GetMethodDelegate<Delegates.grpcsharp_server_destroy_delegate>(library);
+
+ this.gprsharp_now = GetMethodDelegate<Delegates.gprsharp_now_delegate>(library);
+ this.gprsharp_inf_future = GetMethodDelegate<Delegates.gprsharp_inf_future_delegate>(library);
+ this.gprsharp_inf_past = GetMethodDelegate<Delegates.gprsharp_inf_past_delegate>(library);
+ this.gprsharp_convert_clock_type = GetMethodDelegate<Delegates.gprsharp_convert_clock_type_delegate>(library);
+ this.gprsharp_sizeof_timespec = GetMethodDelegate<Delegates.gprsharp_sizeof_timespec_delegate>(library);
+
+ this.grpcsharp_test_callback = GetMethodDelegate<Delegates.grpcsharp_test_callback_delegate>(library);
+ this.grpcsharp_test_nop = GetMethodDelegate<Delegates.grpcsharp_test_nop_delegate>(library);
+ }
+ else
+ {
+ // Windows or fallback
+ this.grpcsharp_init = PInvokeMethods.grpcsharp_init;
+ this.grpcsharp_shutdown = PInvokeMethods.grpcsharp_shutdown;
+ this.grpcsharp_version_string = PInvokeMethods.grpcsharp_version_string;
+
+ this.grpcsharp_batch_context_create = PInvokeMethods.grpcsharp_batch_context_create;
+ this.grpcsharp_batch_context_recv_initial_metadata = PInvokeMethods.grpcsharp_batch_context_recv_initial_metadata;
+ this.grpcsharp_batch_context_recv_message_length = PInvokeMethods.grpcsharp_batch_context_recv_message_length;
+ this.grpcsharp_batch_context_recv_message_to_buffer = PInvokeMethods.grpcsharp_batch_context_recv_message_to_buffer;
+ this.grpcsharp_batch_context_recv_status_on_client_status = PInvokeMethods.grpcsharp_batch_context_recv_status_on_client_status;
+ this.grpcsharp_batch_context_recv_status_on_client_details = PInvokeMethods.grpcsharp_batch_context_recv_status_on_client_details;
+ this.grpcsharp_batch_context_recv_status_on_client_trailing_metadata = PInvokeMethods.grpcsharp_batch_context_recv_status_on_client_trailing_metadata;
+ this.grpcsharp_batch_context_server_rpc_new_call = PInvokeMethods.grpcsharp_batch_context_server_rpc_new_call;
+ this.grpcsharp_batch_context_server_rpc_new_method = PInvokeMethods.grpcsharp_batch_context_server_rpc_new_method;
+ this.grpcsharp_batch_context_server_rpc_new_host = PInvokeMethods.grpcsharp_batch_context_server_rpc_new_host;
+ this.grpcsharp_batch_context_server_rpc_new_deadline = PInvokeMethods.grpcsharp_batch_context_server_rpc_new_deadline;
+ this.grpcsharp_batch_context_server_rpc_new_request_metadata = PInvokeMethods.grpcsharp_batch_context_server_rpc_new_request_metadata;
+ this.grpcsharp_batch_context_recv_close_on_server_cancelled = PInvokeMethods.grpcsharp_batch_context_recv_close_on_server_cancelled;
+ this.grpcsharp_batch_context_destroy = PInvokeMethods.grpcsharp_batch_context_destroy;
+
+ this.grpcsharp_composite_call_credentials_create = PInvokeMethods.grpcsharp_composite_call_credentials_create;
+ this.grpcsharp_call_credentials_release = PInvokeMethods.grpcsharp_call_credentials_release;
+
+ this.grpcsharp_call_cancel = PInvokeMethods.grpcsharp_call_cancel;
+ this.grpcsharp_call_cancel_with_status = PInvokeMethods.grpcsharp_call_cancel_with_status;
+ this.grpcsharp_call_start_unary = PInvokeMethods.grpcsharp_call_start_unary;
+ this.grpcsharp_call_start_client_streaming = PInvokeMethods.grpcsharp_call_start_client_streaming;
+ this.grpcsharp_call_start_server_streaming = PInvokeMethods.grpcsharp_call_start_server_streaming;
+ this.grpcsharp_call_start_duplex_streaming = PInvokeMethods.grpcsharp_call_start_duplex_streaming;
+ this.grpcsharp_call_send_message = PInvokeMethods.grpcsharp_call_send_message;
+ this.grpcsharp_call_send_close_from_client = PInvokeMethods.grpcsharp_call_send_close_from_client;
+ this.grpcsharp_call_send_status_from_server = PInvokeMethods.grpcsharp_call_send_status_from_server;
+ this.grpcsharp_call_recv_message = PInvokeMethods.grpcsharp_call_recv_message;
+ this.grpcsharp_call_recv_initial_metadata = PInvokeMethods.grpcsharp_call_recv_initial_metadata;
+ this.grpcsharp_call_start_serverside = PInvokeMethods.grpcsharp_call_start_serverside;
+ this.grpcsharp_call_send_initial_metadata = PInvokeMethods.grpcsharp_call_send_initial_metadata;
+ this.grpcsharp_call_set_credentials = PInvokeMethods.grpcsharp_call_set_credentials;
+ this.grpcsharp_call_get_peer = PInvokeMethods.grpcsharp_call_get_peer;
+ this.grpcsharp_call_destroy = PInvokeMethods.grpcsharp_call_destroy;
+
+ this.grpcsharp_channel_args_create = PInvokeMethods.grpcsharp_channel_args_create;
+ this.grpcsharp_channel_args_set_string = PInvokeMethods.grpcsharp_channel_args_set_string;
+ this.grpcsharp_channel_args_set_integer = PInvokeMethods.grpcsharp_channel_args_set_integer;
+ this.grpcsharp_channel_args_destroy = PInvokeMethods.grpcsharp_channel_args_destroy;
+
+ this.grpcsharp_ssl_credentials_create = PInvokeMethods.grpcsharp_ssl_credentials_create;
+ this.grpcsharp_composite_channel_credentials_create = PInvokeMethods.grpcsharp_composite_channel_credentials_create;
+ this.grpcsharp_channel_credentials_release = PInvokeMethods.grpcsharp_channel_credentials_release;
+
+ this.grpcsharp_insecure_channel_create = PInvokeMethods.grpcsharp_insecure_channel_create;
+ this.grpcsharp_secure_channel_create = PInvokeMethods.grpcsharp_secure_channel_create;
+ this.grpcsharp_channel_create_call = PInvokeMethods.grpcsharp_channel_create_call;
+ this.grpcsharp_channel_check_connectivity_state = PInvokeMethods.grpcsharp_channel_check_connectivity_state;
+ this.grpcsharp_channel_watch_connectivity_state = PInvokeMethods.grpcsharp_channel_watch_connectivity_state;
+ this.grpcsharp_channel_get_target = PInvokeMethods.grpcsharp_channel_get_target;
+ this.grpcsharp_channel_destroy = PInvokeMethods.grpcsharp_channel_destroy;
+
+ this.grpcsharp_sizeof_grpc_event = PInvokeMethods.grpcsharp_sizeof_grpc_event;
+
+ this.grpcsharp_completion_queue_create = PInvokeMethods.grpcsharp_completion_queue_create;
+ this.grpcsharp_completion_queue_shutdown = PInvokeMethods.grpcsharp_completion_queue_shutdown;
+ this.grpcsharp_completion_queue_next = PInvokeMethods.grpcsharp_completion_queue_next;
+ this.grpcsharp_completion_queue_pluck = PInvokeMethods.grpcsharp_completion_queue_pluck;
+ this.grpcsharp_completion_queue_destroy = PInvokeMethods.grpcsharp_completion_queue_destroy;
+
+ this.gprsharp_free = PInvokeMethods.gprsharp_free;
+
+ this.grpcsharp_metadata_array_create = PInvokeMethods.grpcsharp_metadata_array_create;
+ this.grpcsharp_metadata_array_add = PInvokeMethods.grpcsharp_metadata_array_add;
+ this.grpcsharp_metadata_array_count = PInvokeMethods.grpcsharp_metadata_array_count;
+ this.grpcsharp_metadata_array_get_key = PInvokeMethods.grpcsharp_metadata_array_get_key;
+ this.grpcsharp_metadata_array_get_value = PInvokeMethods.grpcsharp_metadata_array_get_value;
+ this.grpcsharp_metadata_array_get_value_length = PInvokeMethods.grpcsharp_metadata_array_get_value_length;
+ this.grpcsharp_metadata_array_destroy_full = PInvokeMethods.grpcsharp_metadata_array_destroy_full;
+
+ this.grpcsharp_redirect_log = PInvokeMethods.grpcsharp_redirect_log;
+
+ this.grpcsharp_metadata_credentials_create_from_plugin = PInvokeMethods.grpcsharp_metadata_credentials_create_from_plugin;
+ this.grpcsharp_metadata_credentials_notify_from_plugin = PInvokeMethods.grpcsharp_metadata_credentials_notify_from_plugin;
+
+ this.grpcsharp_ssl_server_credentials_create = PInvokeMethods.grpcsharp_ssl_server_credentials_create;
+ this.grpcsharp_server_credentials_release = PInvokeMethods.grpcsharp_server_credentials_release;
+
+ this.grpcsharp_server_create = PInvokeMethods.grpcsharp_server_create;
+ this.grpcsharp_server_add_insecure_http2_port = PInvokeMethods.grpcsharp_server_add_insecure_http2_port;
+ this.grpcsharp_server_add_secure_http2_port = PInvokeMethods.grpcsharp_server_add_secure_http2_port;
+ this.grpcsharp_server_start = PInvokeMethods.grpcsharp_server_start;
+ this.grpcsharp_server_request_call = PInvokeMethods.grpcsharp_server_request_call;
+ this.grpcsharp_server_cancel_all_calls = PInvokeMethods.grpcsharp_server_cancel_all_calls;
+ this.grpcsharp_server_shutdown_and_notify_callback = PInvokeMethods.grpcsharp_server_shutdown_and_notify_callback;
+ this.grpcsharp_server_destroy = PInvokeMethods.grpcsharp_server_destroy;
+
+ this.gprsharp_now = PInvokeMethods.gprsharp_now;
+ this.gprsharp_inf_future = PInvokeMethods.gprsharp_inf_future;
+ this.gprsharp_inf_past = PInvokeMethods.gprsharp_inf_past;
+ this.gprsharp_convert_clock_type = PInvokeMethods.gprsharp_convert_clock_type;
+ this.gprsharp_sizeof_timespec = PInvokeMethods.gprsharp_sizeof_timespec;
+
+ this.grpcsharp_test_callback = PInvokeMethods.grpcsharp_test_callback;
+ this.grpcsharp_test_nop = PInvokeMethods.grpcsharp_test_nop;
+ }
+ }
+
+ /// <summary>
+ /// Gets singleton instance of this class.
+ /// </summary>
+ public static NativeMethods Get()
+ {
+ return NativeExtension.Get().NativeMethods;
+ }
+
+ static T GetMethodDelegate<T>(UnmanagedLibrary library)
+ where T : class
+ {
+ var methodName = RemoveStringSuffix(typeof(T).Name, "_delegate");
+ return library.GetNativeMethodDelegate<T>(methodName);
+ }
+
+ static string RemoveStringSuffix(string str, string toRemove)
+ {
+ if (!str.EndsWith(toRemove))
+ {
+ return str;
+ }
+ return str.Substring(0, str.Length - toRemove.Length);
+ }
+
+ /// <summary>
+ /// Delegate types for all published native methods. Declared under inner class to prevent scope pollution.
+ /// </summary>
+ public class Delegates
+ {
+ public delegate void grpcsharp_init_delegate();
+ public delegate void grpcsharp_shutdown_delegate();
+ public delegate IntPtr grpcsharp_version_string_delegate(); // returns not-owned const char*
+
+ public delegate BatchContextSafeHandle grpcsharp_batch_context_create_delegate();
+ public delegate IntPtr grpcsharp_batch_context_recv_initial_metadata_delegate(BatchContextSafeHandle ctx);
+ public delegate IntPtr grpcsharp_batch_context_recv_message_length_delegate(BatchContextSafeHandle ctx);
+ public delegate void grpcsharp_batch_context_recv_message_to_buffer_delegate(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen);
+ public delegate StatusCode grpcsharp_batch_context_recv_status_on_client_status_delegate(BatchContextSafeHandle ctx);
+ public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_details_delegate(BatchContextSafeHandle ctx); // returns const char*
+ public delegate IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata_delegate(BatchContextSafeHandle ctx);
+ public delegate CallSafeHandle grpcsharp_batch_context_server_rpc_new_call_delegate(BatchContextSafeHandle ctx);
+ public delegate IntPtr grpcsharp_batch_context_server_rpc_new_method_delegate(BatchContextSafeHandle ctx); // returns const char*
+ public delegate IntPtr grpcsharp_batch_context_server_rpc_new_host_delegate(BatchContextSafeHandle ctx); // returns const char*
+ public delegate Timespec grpcsharp_batch_context_server_rpc_new_deadline_delegate(BatchContextSafeHandle ctx);
+ public delegate IntPtr grpcsharp_batch_context_server_rpc_new_request_metadata_delegate(BatchContextSafeHandle ctx);
+ public delegate int grpcsharp_batch_context_recv_close_on_server_cancelled_delegate(BatchContextSafeHandle ctx);
+ public delegate void grpcsharp_batch_context_destroy_delegate(IntPtr ctx);
+
+ public delegate CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create_delegate(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
+ public delegate void grpcsharp_call_credentials_release_delegate(IntPtr credentials);
+
+ public delegate GRPCCallError grpcsharp_call_cancel_delegate(CallSafeHandle call);
+ public delegate GRPCCallError grpcsharp_call_cancel_with_status_delegate(CallSafeHandle call, StatusCode status, string description);
+ public delegate GRPCCallError grpcsharp_call_start_unary_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
+ public delegate GRPCCallError grpcsharp_call_start_client_streaming_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
+ public delegate GRPCCallError grpcsharp_call_start_server_streaming_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
+ MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
+ public delegate GRPCCallError grpcsharp_call_start_duplex_streaming_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
+ public delegate GRPCCallError grpcsharp_call_send_message_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, WriteFlags writeFlags, bool sendEmptyInitialMetadata);
+ public delegate GRPCCallError grpcsharp_call_send_close_from_client_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+ public delegate GRPCCallError grpcsharp_call_send_status_from_server_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata);
+ public delegate GRPCCallError grpcsharp_call_recv_message_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+ public delegate GRPCCallError grpcsharp_call_recv_initial_metadata_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+ public delegate GRPCCallError grpcsharp_call_start_serverside_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+ public delegate GRPCCallError grpcsharp_call_send_initial_metadata_delegate(CallSafeHandle call,
+ BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
+ public delegate GRPCCallError grpcsharp_call_set_credentials_delegate(CallSafeHandle call, CallCredentialsSafeHandle credentials);
+ public delegate CStringSafeHandle grpcsharp_call_get_peer_delegate(CallSafeHandle call);
+ public delegate void grpcsharp_call_destroy_delegate(IntPtr call);
+
+ public delegate ChannelArgsSafeHandle grpcsharp_channel_args_create_delegate(UIntPtr numArgs);
+ public delegate void grpcsharp_channel_args_set_string_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
+ public delegate void grpcsharp_channel_args_set_integer_delegate(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
+ public delegate void grpcsharp_channel_args_destroy_delegate(IntPtr args);
+
+ public delegate ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create_delegate(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey);
+ public delegate ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create_delegate(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
+ public delegate void grpcsharp_channel_credentials_release_delegate(IntPtr credentials);
+
+ public delegate ChannelSafeHandle grpcsharp_insecure_channel_create_delegate(string target, ChannelArgsSafeHandle channelArgs);
+ public delegate ChannelSafeHandle grpcsharp_secure_channel_create_delegate(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
+ public delegate CallSafeHandle grpcsharp_channel_create_call_delegate(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
+ public delegate ChannelState grpcsharp_channel_check_connectivity_state_delegate(ChannelSafeHandle channel, int tryToConnect);
+ public delegate void grpcsharp_channel_watch_connectivity_state_delegate(ChannelSafeHandle channel, ChannelState lastObservedState,
+ Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
+ public delegate CStringSafeHandle grpcsharp_channel_get_target_delegate(ChannelSafeHandle call);
+ public delegate void grpcsharp_channel_destroy_delegate(IntPtr channel);
+
+ public delegate int grpcsharp_sizeof_grpc_event_delegate();
+
+ public delegate CompletionQueueSafeHandle grpcsharp_completion_queue_create_delegate();
+ public delegate void grpcsharp_completion_queue_shutdown_delegate(CompletionQueueSafeHandle cq);
+ public delegate CompletionQueueEvent grpcsharp_completion_queue_next_delegate(CompletionQueueSafeHandle cq);
+ public delegate CompletionQueueEvent grpcsharp_completion_queue_pluck_delegate(CompletionQueueSafeHandle cq, IntPtr tag);
+ public delegate void grpcsharp_completion_queue_destroy_delegate(IntPtr cq);
+
+ public delegate void gprsharp_free_delegate(IntPtr ptr);
+
+ public delegate MetadataArraySafeHandle grpcsharp_metadata_array_create_delegate(UIntPtr capacity);
+ public delegate void grpcsharp_metadata_array_add_delegate(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
+ public delegate UIntPtr grpcsharp_metadata_array_count_delegate(IntPtr metadataArray);
+ public delegate IntPtr grpcsharp_metadata_array_get_key_delegate(IntPtr metadataArray, UIntPtr index);
+ public delegate IntPtr grpcsharp_metadata_array_get_value_delegate(IntPtr metadataArray, UIntPtr index);
+ public delegate UIntPtr grpcsharp_metadata_array_get_value_length_delegate(IntPtr metadataArray, UIntPtr index);
+ public delegate void grpcsharp_metadata_array_destroy_full_delegate(IntPtr array);
+
+ public delegate void grpcsharp_redirect_log_delegate(GprLogDelegate callback);
+
+ public delegate CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin_delegate(NativeMetadataInterceptor interceptor);
+ public delegate void grpcsharp_metadata_credentials_notify_from_plugin_delegate(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
+
+ public delegate ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create_delegate(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, bool forceClientAuth);
+ public delegate void grpcsharp_server_credentials_release_delegate(IntPtr credentials);
+
+ public delegate ServerSafeHandle grpcsharp_server_create_delegate(CompletionQueueSafeHandle cq, ChannelArgsSafeHandle args);
+ public delegate int grpcsharp_server_add_insecure_http2_port_delegate(ServerSafeHandle server, string addr);
+ public delegate int grpcsharp_server_add_secure_http2_port_delegate(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
+ public delegate void grpcsharp_server_start_delegate(ServerSafeHandle server);
+ public delegate GRPCCallError grpcsharp_server_request_call_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
+ public delegate void grpcsharp_server_cancel_all_calls_delegate(ServerSafeHandle server);
+ public delegate void grpcsharp_server_shutdown_and_notify_callback_delegate(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
+ public delegate void grpcsharp_server_destroy_delegate(IntPtr server);
+
+ public delegate Timespec gprsharp_now_delegate(GPRClockType clockType);
+ public delegate Timespec gprsharp_inf_future_delegate(GPRClockType clockType);
+ public delegate Timespec gprsharp_inf_past_delegate(GPRClockType clockType);
+
+ public delegate Timespec gprsharp_convert_clock_type_delegate(Timespec t, GPRClockType targetClock);
+ public delegate int gprsharp_sizeof_timespec_delegate();
+
+ public delegate GRPCCallError grpcsharp_test_callback_delegate([MarshalAs(UnmanagedType.FunctionPtr)] OpCompletionDelegate callback);
+ public delegate IntPtr grpcsharp_test_nop_delegate(IntPtr ptr);
+ }
+
+ /// <summary>
+ /// Default PInvoke bindings for native methods that are used on Windows.
+ /// Alternatively, they can also be used as a fallback on Mono
+ /// (if libgrpc_csharp_ext is installed on your system, or is made accessible through e.g. LD_LIBRARY_PATH environment variable
+ /// or using Mono's dllMap feature).
+ /// </summary>
+ private class PInvokeMethods
+ {
+ // Environment
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_init();
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_shutdown();
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_version_string(); // returns not-owned const char*
+
+ // BatchContextSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern BatchContextSafeHandle grpcsharp_batch_context_create();
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_recv_initial_metadata(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_recv_message_length(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_batch_context_recv_message_to_buffer(BatchContextSafeHandle ctx, byte[] buffer, UIntPtr bufferLen);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern StatusCode grpcsharp_batch_context_recv_status_on_client_status(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_details(BatchContextSafeHandle ctx); // returns const char*
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_recv_status_on_client_trailing_metadata(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CallSafeHandle grpcsharp_batch_context_server_rpc_new_call(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_server_rpc_new_method(BatchContextSafeHandle ctx); // returns const char*
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_server_rpc_new_host(BatchContextSafeHandle ctx); // returns const char*
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern Timespec grpcsharp_batch_context_server_rpc_new_deadline(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_batch_context_server_rpc_new_request_metadata(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern int grpcsharp_batch_context_recv_close_on_server_cancelled(BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_batch_context_destroy(IntPtr ctx);
+
+ // CallCredentialsSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CallCredentialsSafeHandle grpcsharp_composite_call_credentials_create(CallCredentialsSafeHandle creds1, CallCredentialsSafeHandle creds2);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_call_credentials_release(IntPtr credentials);
+
+ // CallSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_cancel(CallSafeHandle call);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_cancel_with_status(CallSafeHandle call, StatusCode status, string description);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_start_unary(CallSafeHandle call,
+ BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_start_client_streaming(CallSafeHandle call,
+ BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_start_server_streaming(CallSafeHandle call,
+ BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len,
+ MetadataArraySafeHandle metadataArray, WriteFlags writeFlags);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_start_duplex_streaming(CallSafeHandle call,
+ BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_send_message(CallSafeHandle call,
+ BatchContextSafeHandle ctx, byte[] send_buffer, UIntPtr send_buffer_len, WriteFlags writeFlags, bool sendEmptyInitialMetadata);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_send_close_from_client(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_send_status_from_server(CallSafeHandle call,
+ BatchContextSafeHandle ctx, StatusCode statusCode, string statusMessage, MetadataArraySafeHandle metadataArray, bool sendEmptyInitialMetadata);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_recv_message(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_recv_initial_metadata(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_start_serverside(CallSafeHandle call,
+ BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_send_initial_metadata(CallSafeHandle call,
+ BatchContextSafeHandle ctx, MetadataArraySafeHandle metadataArray);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_call_set_credentials(CallSafeHandle call, CallCredentialsSafeHandle credentials);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CStringSafeHandle grpcsharp_call_get_peer(CallSafeHandle call);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_call_destroy(IntPtr call);
+
+ // ChannelArgsSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern ChannelArgsSafeHandle grpcsharp_channel_args_create(UIntPtr numArgs);
+
+ [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
+ public static extern void grpcsharp_channel_args_set_string(ChannelArgsSafeHandle args, UIntPtr index, string key, string value);
+
+ [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
+ public static extern void grpcsharp_channel_args_set_integer(ChannelArgsSafeHandle args, UIntPtr index, string key, int value);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_channel_args_destroy(IntPtr args);
+
+ // ChannelCredentialsSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
+ public static extern ChannelCredentialsSafeHandle grpcsharp_ssl_credentials_create(string pemRootCerts, string keyCertPairCertChain, string keyCertPairPrivateKey);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern ChannelCredentialsSafeHandle grpcsharp_composite_channel_credentials_create(ChannelCredentialsSafeHandle channelCreds, CallCredentialsSafeHandle callCreds);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_channel_credentials_release(IntPtr credentials);
+
+ // ChannelSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern ChannelSafeHandle grpcsharp_insecure_channel_create(string target, ChannelArgsSafeHandle channelArgs);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern ChannelSafeHandle grpcsharp_secure_channel_create(ChannelCredentialsSafeHandle credentials, string target, ChannelArgsSafeHandle channelArgs);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CallSafeHandle grpcsharp_channel_create_call(ChannelSafeHandle channel, CallSafeHandle parentCall, ContextPropagationFlags propagationMask, CompletionQueueSafeHandle cq, string method, string host, Timespec deadline);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern ChannelState grpcsharp_channel_check_connectivity_state(ChannelSafeHandle channel, int tryToConnect);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_channel_watch_connectivity_state(ChannelSafeHandle channel, ChannelState lastObservedState,
+ Timespec deadline, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CStringSafeHandle grpcsharp_channel_get_target(ChannelSafeHandle call);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_channel_destroy(IntPtr channel);
+
+ // CompletionQueueEvent
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern int grpcsharp_sizeof_grpc_event();
+
+ // CompletionQueueSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CompletionQueueSafeHandle grpcsharp_completion_queue_create();
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_completion_queue_shutdown(CompletionQueueSafeHandle cq);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CompletionQueueEvent grpcsharp_completion_queue_next(CompletionQueueSafeHandle cq);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CompletionQueueEvent grpcsharp_completion_queue_pluck(CompletionQueueSafeHandle cq, IntPtr tag);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_completion_queue_destroy(IntPtr cq);
+
+ // CStringSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void gprsharp_free(IntPtr ptr);
+
+ // MetadataArraySafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern MetadataArraySafeHandle grpcsharp_metadata_array_create(UIntPtr capacity);
+
+ [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
+ public static extern void grpcsharp_metadata_array_add(MetadataArraySafeHandle array, string key, byte[] value, UIntPtr valueLength);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern UIntPtr grpcsharp_metadata_array_count(IntPtr metadataArray);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_metadata_array_get_key(IntPtr metadataArray, UIntPtr index);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_metadata_array_get_value(IntPtr metadataArray, UIntPtr index);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern UIntPtr grpcsharp_metadata_array_get_value_length(IntPtr metadataArray, UIntPtr index);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_metadata_array_destroy_full(IntPtr array);
+
+ // NativeLogRedirector
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_redirect_log(GprLogDelegate callback);
+
+ // NativeMetadataCredentialsPlugin
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern CallCredentialsSafeHandle grpcsharp_metadata_credentials_create_from_plugin(NativeMetadataInterceptor interceptor);
+
+ [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
+ public static extern void grpcsharp_metadata_credentials_notify_from_plugin(IntPtr callbackPtr, IntPtr userData, MetadataArraySafeHandle metadataArray, StatusCode statusCode, string errorDetails);
+
+ // ServerCredentialsSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
+ public static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, bool forceClientAuth);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_server_credentials_release(IntPtr credentials);
+
+ // ServerSafeHandle
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern ServerSafeHandle grpcsharp_server_create(CompletionQueueSafeHandle cq, ChannelArgsSafeHandle args);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_server_start(ServerSafeHandle server);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_server_cancel_all_calls(ServerSafeHandle server);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern void grpcsharp_server_destroy(IntPtr server);
+
+ // Timespec
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern Timespec gprsharp_now(GPRClockType clockType);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern Timespec gprsharp_inf_future(GPRClockType clockType);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern Timespec gprsharp_inf_past(GPRClockType clockType);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern Timespec gprsharp_convert_clock_type(Timespec t, GPRClockType targetClock);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern int gprsharp_sizeof_timespec();
+
+ // Testing
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern GRPCCallError grpcsharp_test_callback([MarshalAs(UnmanagedType.FunctionPtr)] OpCompletionDelegate callback);
+
+ [DllImport("grpc_csharp_ext.dll")]
+ public static extern IntPtr grpcsharp_test_nop(IntPtr ptr);
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Core/Internal/PlatformApis.cs b/src/csharp/Grpc.Core/Internal/PlatformApis.cs
new file mode 100644
index 0000000000..d71e7eccdd
--- /dev/null
+++ b/src/csharp/Grpc.Core/Internal/PlatformApis.cs
@@ -0,0 +1,110 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+namespace Grpc.Core.Internal
+{
+ /// <summary>
+ /// Utility methods for detecting platform and architecture.
+ /// </summary>
+ internal static class PlatformApis
+ {
+ static readonly bool isLinux;
+ static readonly bool isMacOSX;
+ static readonly bool isWindows;
+
+ static PlatformApis()
+ {
+ var platform = Environment.OSVersion.Platform;
+
+ // PlatformID.MacOSX is never returned, commonly used trick is to identify Mac is by using uname.
+ isMacOSX = (platform == PlatformID.Unix && GetUname() == "Darwin");
+ isLinux = (platform == PlatformID.Unix && !isMacOSX);
+ isWindows = (platform == PlatformID.Win32NT || platform == PlatformID.Win32S || platform == PlatformID.Win32Windows);
+ }
+
+ public static bool IsLinux
+ {
+ get { return isLinux; }
+ }
+
+ public static bool IsMacOSX
+ {
+ get { return isMacOSX; }
+ }
+
+ public static bool IsWindows
+ {
+ get { return isWindows; }
+ }
+
+ public static bool Is64Bit
+ {
+ get { return IntPtr.Size == 8; }
+ }
+
+ [DllImport("libc")]
+ static extern int uname(IntPtr buf);
+
+ static string GetUname()
+ {
+ var buffer = Marshal.AllocHGlobal(8192);
+ try
+ {
+ if (uname(buffer) == 0)
+ {
+ return Marshal.PtrToStringAnsi(buffer);
+ }
+ return string.Empty;
+ }
+ catch
+ {
+ return string.Empty;
+ }
+ finally
+ {
+ if (buffer != IntPtr.Zero)
+ {
+ Marshal.FreeHGlobal(buffer);
+ }
+ }
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs
index 51e352a18b..a1d080c7f1 100644
--- a/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/ServerCredentialsSafeHandle.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -41,11 +41,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal class ServerCredentialsSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll", CharSet = CharSet.Ansi)]
- static extern ServerCredentialsSafeHandle grpcsharp_ssl_server_credentials_create(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, UIntPtr numKeyCertPairs, bool forceClientAuth);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_server_credentials_release(IntPtr credentials);
+ static readonly NativeMethods Native = NativeMethods.Get();
private ServerCredentialsSafeHandle()
{
@@ -54,15 +50,15 @@ namespace Grpc.Core.Internal
public static ServerCredentialsSafeHandle CreateSslCredentials(string pemRootCerts, string[] keyCertPairCertChainArray, string[] keyCertPairPrivateKeyArray, bool forceClientAuth)
{
Preconditions.CheckArgument(keyCertPairCertChainArray.Length == keyCertPairPrivateKeyArray.Length);
- return grpcsharp_ssl_server_credentials_create(pemRootCerts,
- keyCertPairCertChainArray, keyCertPairPrivateKeyArray,
- new UIntPtr((ulong)keyCertPairCertChainArray.Length),
- forceClientAuth);
+ return Native.grpcsharp_ssl_server_credentials_create(pemRootCerts,
+ keyCertPairCertChainArray, keyCertPairPrivateKeyArray,
+ new UIntPtr((ulong)keyCertPairCertChainArray.Length),
+ forceClientAuth);
}
protected override bool ReleaseHandle()
{
- grpcsharp_server_credentials_release(handle);
+ Native.grpcsharp_server_credentials_release(handle);
return true;
}
}
diff --git a/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs b/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs
index 5ee7ac14e8..a57fb3b789 100644
--- a/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs
+++ b/src/csharp/Grpc.Core/Internal/ServerSafeHandle.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -44,29 +44,7 @@ namespace Grpc.Core.Internal
/// </summary>
internal sealed class ServerSafeHandle : SafeHandleZeroIsInvalid
{
- [DllImport("grpc_csharp_ext.dll")]
- static extern ServerSafeHandle grpcsharp_server_create(CompletionQueueSafeHandle cq, ChannelArgsSafeHandle args);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern int grpcsharp_server_add_insecure_http2_port(ServerSafeHandle server, string addr);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern int grpcsharp_server_add_secure_http2_port(ServerSafeHandle server, string addr, ServerCredentialsSafeHandle creds);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_server_start(ServerSafeHandle server);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern GRPCCallError grpcsharp_server_request_call(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_server_cancel_all_calls(ServerSafeHandle server);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_server_shutdown_and_notify_callback(ServerSafeHandle server, CompletionQueueSafeHandle cq, BatchContextSafeHandle ctx);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern void grpcsharp_server_destroy(IntPtr server);
+ static readonly NativeMethods Native = NativeMethods.Get();
private ServerSafeHandle()
{
@@ -77,41 +55,41 @@ namespace Grpc.Core.Internal
// Increment reference count for the native gRPC environment to make sure we don't do grpc_shutdown() before destroying the server handle.
// Doing so would make object finalizer crash if we end up abandoning the handle.
GrpcEnvironment.GrpcNativeInit();
- return grpcsharp_server_create(cq, args);
+ return Native.grpcsharp_server_create(cq, args);
}
public int AddInsecurePort(string addr)
{
- return grpcsharp_server_add_insecure_http2_port(this, addr);
+ return Native.grpcsharp_server_add_insecure_http2_port(this, addr);
}
public int AddSecurePort(string addr, ServerCredentialsSafeHandle credentials)
{
- return grpcsharp_server_add_secure_http2_port(this, addr, credentials);
+ return Native.grpcsharp_server_add_secure_http2_port(this, addr, credentials);
}
public void Start()
{
- grpcsharp_server_start(this);
+ Native.grpcsharp_server_start(this);
}
public void ShutdownAndNotify(BatchCompletionDelegate callback, GrpcEnvironment environment)
{
var ctx = BatchContextSafeHandle.Create();
environment.CompletionRegistry.RegisterBatchCompletion(ctx, callback);
- grpcsharp_server_shutdown_and_notify_callback(this, environment.CompletionQueue, ctx);
+ Native.grpcsharp_server_shutdown_and_notify_callback(this, environment.CompletionQueue, ctx);
}
public void RequestCall(BatchCompletionDelegate callback, GrpcEnvironment environment)
{
var ctx = BatchContextSafeHandle.Create();
environment.CompletionRegistry.RegisterBatchCompletion(ctx, callback);
- grpcsharp_server_request_call(this, environment.CompletionQueue, ctx).CheckOk();
+ Native.grpcsharp_server_request_call(this, environment.CompletionQueue, ctx).CheckOk();
}
protected override bool ReleaseHandle()
{
- grpcsharp_server_destroy(handle);
+ Native.grpcsharp_server_destroy(handle);
GrpcEnvironment.GrpcNativeShutdown();
return true;
}
@@ -119,7 +97,7 @@ namespace Grpc.Core.Internal
// Only to be called after ShutdownAndNotify.
public void CancelAllCalls()
{
- grpcsharp_server_cancel_all_calls(this);
+ Native.grpcsharp_server_cancel_all_calls(this);
}
}
}
diff --git a/src/csharp/Grpc.Core/Internal/Timespec.cs b/src/csharp/Grpc.Core/Internal/Timespec.cs
index 3031175c8a..148d877da5 100644
--- a/src/csharp/Grpc.Core/Internal/Timespec.cs
+++ b/src/csharp/Grpc.Core/Internal/Timespec.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -46,23 +46,9 @@ namespace Grpc.Core.Internal
const long NanosPerTick = 100;
const long TicksPerSecond = NanosPerSecond / NanosPerTick;
+ static readonly NativeMethods Native = NativeMethods.Get();
static readonly DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
- [DllImport("grpc_csharp_ext.dll")]
- static extern Timespec gprsharp_now(GPRClockType clockType);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern Timespec gprsharp_inf_future(GPRClockType clockType);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern Timespec gprsharp_inf_past(GPRClockType clockType);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern Timespec gprsharp_convert_clock_type(Timespec t, GPRClockType targetClock);
-
- [DllImport("grpc_csharp_ext.dll")]
- static extern int gprsharp_sizeof_timespec();
-
public Timespec(long tv_sec, int tv_nsec) : this(tv_sec, tv_nsec, GPRClockType.Realtime)
{
}
@@ -85,7 +71,7 @@ namespace Grpc.Core.Internal
{
get
{
- return gprsharp_inf_future(GPRClockType.Realtime);
+ return Native.gprsharp_inf_future(GPRClockType.Realtime);
}
}
@@ -96,7 +82,7 @@ namespace Grpc.Core.Internal
{
get
{
- return gprsharp_inf_past(GPRClockType.Realtime);
+ return Native.gprsharp_inf_past(GPRClockType.Realtime);
}
}
@@ -107,7 +93,7 @@ namespace Grpc.Core.Internal
{
get
{
- return gprsharp_now(GPRClockType.Realtime);
+ return Native.gprsharp_now(GPRClockType.Realtime);
}
}
@@ -138,7 +124,7 @@ namespace Grpc.Core.Internal
/// </summary>
public Timespec ToClockType(GPRClockType targetClock)
{
- return gprsharp_convert_clock_type(this, targetClock);
+ return Native.gprsharp_convert_clock_type(this, targetClock);
}
/// <summary>
@@ -241,7 +227,7 @@ namespace Grpc.Core.Internal
{
get
{
- return gprsharp_now(GPRClockType.Precise);
+ return Native.gprsharp_now(GPRClockType.Precise);
}
}
@@ -249,7 +235,7 @@ namespace Grpc.Core.Internal
{
get
{
- return gprsharp_sizeof_timespec();
+ return Native.gprsharp_sizeof_timespec();
}
}
}
diff --git a/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs b/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
new file mode 100644
index 0000000000..e614cab6ab
--- /dev/null
+++ b/src/csharp/Grpc.Core/Internal/UnmanagedLibrary.cs
@@ -0,0 +1,158 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Concurrent;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+
+using Grpc.Core.Logging;
+using Grpc.Core.Utils;
+
+namespace Grpc.Core.Internal
+{
+ /// <summary>
+ /// Represents a dynamically loaded unmanaged library in a (partially) platform independent manner.
+ /// An important difference in library loading semantics is that on Windows, once we load a dynamic library using LoadLibrary,
+ /// that library becomes instantly available for <c>DllImport</c> P/Invoke calls referring to the same library name.
+ /// On Unix systems, dlopen has somewhat different semantics, so we need to use dlsym and <c>Marshal.GetDelegateForFunctionPointer</c>
+ /// to obtain delegates to native methods.
+ /// See http://stackoverflow.com/questions/13461989/p-invoke-to-dynamically-loaded-library-on-mono.
+ /// </summary>
+ internal class UnmanagedLibrary
+ {
+ static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<UnmanagedLibrary>();
+
+ // flags for dlopen
+ const int RTLD_LAZY = 1;
+ const int RTLD_GLOBAL = 8;
+
+ readonly string libraryPath;
+ readonly IntPtr handle;
+
+ public UnmanagedLibrary(string libraryPath)
+ {
+ this.libraryPath = Preconditions.CheckNotNull(libraryPath);
+
+ if (!File.Exists(this.libraryPath))
+ {
+ throw new FileNotFoundException("Error loading native library. File does not exist.", this.libraryPath);
+ }
+
+ Logger.Debug("Attempting to load native library \"{0}\"", this.libraryPath);
+
+ this.handle = PlatformSpecificLoadLibrary(this.libraryPath);
+
+ if (this.handle == IntPtr.Zero)
+ {
+ throw new IOException(string.Format("Error loading native library \"{0}\"", this.libraryPath));
+ }
+ }
+
+ /// <summary>
+ /// Loads symbol in a platform specific way.
+ /// </summary>
+ /// <param name="symbolName"></param>
+ /// <returns></returns>
+ public IntPtr LoadSymbol(string symbolName)
+ {
+ if (PlatformApis.IsLinux)
+ {
+ return Linux.dlsym(this.handle, symbolName);
+ }
+ if (PlatformApis.IsMacOSX)
+ {
+ return MacOSX.dlsym(this.handle, symbolName);
+ }
+ throw new InvalidOperationException("Unsupported platform.");
+ }
+
+ public T GetNativeMethodDelegate<T>(string methodName)
+ where T : class
+ {
+ var ptr = LoadSymbol(methodName);
+ if (ptr == IntPtr.Zero)
+ {
+ throw new MissingMethodException(string.Format("The native method \"{0}\" does not exist", methodName));
+ }
+ return Marshal.GetDelegateForFunctionPointer(ptr, typeof(T)) as T;
+ }
+
+ /// <summary>
+ /// Loads library in a platform specific way.
+ /// </summary>
+ private static IntPtr PlatformSpecificLoadLibrary(string libraryPath)
+ {
+ if (PlatformApis.IsWindows)
+ {
+ return Windows.LoadLibrary(libraryPath);
+ }
+ if (PlatformApis.IsLinux)
+ {
+ return Linux.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY);
+ }
+ if (PlatformApis.IsMacOSX)
+ {
+ return MacOSX.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY);
+ }
+ throw new InvalidOperationException("Unsupported platform.");
+ }
+
+ private static class Windows
+ {
+ [DllImport("kernel32.dll")]
+ internal static extern IntPtr LoadLibrary(string filename);
+ }
+
+ private static class Linux
+ {
+ [DllImport("libdl.so")]
+ internal static extern IntPtr dlopen(string filename, int flags);
+
+ [DllImport("libdl.so")]
+ internal static extern IntPtr dlsym(IntPtr handle, string symbol);
+ }
+
+ private static class MacOSX
+ {
+ [DllImport("libSystem.dylib")]
+ internal static extern IntPtr dlopen(string filename, int flags);
+
+ [DllImport("libSystem.dylib")]
+ internal static extern IntPtr dlsym(IntPtr handle, string symbol);
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Core/NativeDeps.Linux.targets b/src/csharp/Grpc.Core/NativeDeps.Linux.targets
new file mode 100644
index 0000000000..a3848c6f2e
--- /dev/null
+++ b/src/csharp/Grpc.Core/NativeDeps.Linux.targets
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Content Include="..\..\..\libs\$(NativeDependenciesConfigurationUnix)\libgrpc_csharp_ext.so">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\linux_x64\libgrpc_csharp_ext.so</Link>
+ </Content>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.Core/NativeDeps.Mac.targets b/src/csharp/Grpc.Core/NativeDeps.Mac.targets
new file mode 100644
index 0000000000..c3c6264fd3
--- /dev/null
+++ b/src/csharp/Grpc.Core/NativeDeps.Mac.targets
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Content Include="..\..\..\libs\$(NativeDependenciesConfigurationUnix)\libgrpc_csharp_ext.dylib">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\macosx_x86\libgrpc_csharp_ext.dylib</Link>
+ </Content>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.Core/NativeDeps.Windows.targets b/src/csharp/Grpc.Core/NativeDeps.Windows.targets
new file mode 100644
index 0000000000..f6a3405e29
--- /dev/null
+++ b/src/csharp/Grpc.Core/NativeDeps.Windows.targets
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Content Include="..\..\..\vsprojects\$(NativeDependenciesConfiguration)\grpc_csharp_ext.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\windows_x86\grpc_csharp_ext.dll</Link>
+ </Content>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.Core/NativeDeps.targets b/src/csharp/Grpc.Core/NativeDeps.targets
new file mode 100644
index 0000000000..66c5ec1292
--- /dev/null
+++ b/src/csharp/Grpc.Core/NativeDeps.targets
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+ <PropertyGroup Condition=" '$(NativeDependenciesConfiguration)' == '' ">
+ <NativeDependenciesConfiguration Condition=" '$(Configuration)' == 'Debug' ">Debug</NativeDependenciesConfiguration>
+ <NativeDependenciesConfiguration Condition=" '$(Configuration)' == 'Release' ">Release</NativeDependenciesConfiguration>
+ <NativeDependenciesConfiguration Condition=" '$(Configuration)' == 'ReleaseSigned' ">Release</NativeDependenciesConfiguration>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(NativeDependenciesConfigurationUnix)' == '' ">
+ <NativeDependenciesConfigurationUnix Condition=" '$(Configuration)' == 'Debug' ">dbg</NativeDependenciesConfigurationUnix>
+ <NativeDependenciesConfigurationUnix Condition=" '$(Configuration)' == 'Release' ">opt</NativeDependenciesConfigurationUnix>
+ <NativeDependenciesConfigurationUnix Condition=" '$(Configuration)' == 'ReleaseSigned' ">opt</NativeDependenciesConfigurationUnix>
+ </PropertyGroup>
+
+ <!-- Autodetect platform -->
+ <PropertyGroup Condition=" '$(OS)' != 'Unix' ">
+ <NativeDepsPlatform>Windows</NativeDepsPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(OS)' == 'Unix' And Exists('/Applications') And Exists('/Library') And Exists('/System') ">
+ <NativeDepsPlatform>Mac</NativeDepsPlatform>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(OS)' == 'Unix' And '$(NativeDepsPlatform)' == '' ">
+ <NativeDepsPlatform>Linux</NativeDepsPlatform>
+ </PropertyGroup>
+
+ <Import Project="NativeDeps.$(NativeDepsPlatform).targets" />
+</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj
index b603e3af3c..35c0646a3f 100644
--- a/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj
+++ b/src/csharp/Grpc.Examples.MathClient/Grpc.Examples.MathClient.csproj
@@ -34,7 +34,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj
index 5f74b58773..74d79b44d9 100644
--- a/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj
+++ b/src/csharp/Grpc.Examples.MathServer/Grpc.Examples.MathServer.csproj
@@ -34,7 +34,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj
index c4c1ee6d00..54c68c1f92 100644
--- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj
+++ b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj
@@ -34,12 +34,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Google.Protobuf.3.0.0-alpha4\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
+ <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
diff --git a/src/csharp/Grpc.Examples.Tests/packages.config b/src/csharp/Grpc.Examples.Tests/packages.config
index 7266fa1763..10bf1e82d0 100644
--- a/src/csharp/Grpc.Examples.Tests/packages.config
+++ b/src/csharp/Grpc.Examples.Tests/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Google.Protobuf" version="3.0.0-alpha4" targetFramework="net45" />
+ <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" />
<package id="Ix-Async" version="1.2.3" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/src/csharp/Grpc.Examples/Grpc.Examples.csproj b/src/csharp/Grpc.Examples/Grpc.Examples.csproj
index 53b2bb78c4..c9b01950e5 100644
--- a/src/csharp/Grpc.Examples/Grpc.Examples.csproj
+++ b/src/csharp/Grpc.Examples/Grpc.Examples.csproj
@@ -34,12 +34,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Google.Protobuf.3.0.0-alpha4\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
+ <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data.Linq" />
@@ -67,4 +67,4 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.Examples/Math.cs b/src/csharp/Grpc.Examples/Math.cs
index d0e1ee8aae..33c4f8d9c0 100644
--- a/src/csharp/Grpc.Examples/Math.cs
+++ b/src/csharp/Grpc.Examples/Math.cs
@@ -9,42 +9,41 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Math {
- namespace Proto {
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Math {
-
- #region Descriptor
- public static pbr::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbr::FileDescriptor descriptor;
-
- static Math() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "CgptYXRoLnByb3RvEgRtYXRoIiwKB0RpdkFyZ3MSEAoIZGl2aWRlbmQYASAB",
- "KAMSDwoHZGl2aXNvchgCIAEoAyIvCghEaXZSZXBseRIQCghxdW90aWVudBgB",
- "IAEoAxIRCglyZW1haW5kZXIYAiABKAMiGAoHRmliQXJncxINCgVsaW1pdBgB",
- "IAEoAyISCgNOdW0SCwoDbnVtGAEgASgDIhkKCEZpYlJlcGx5Eg0KBWNvdW50",
- "GAEgASgDMqQBCgRNYXRoEiYKA0RpdhINLm1hdGguRGl2QXJncxoOLm1hdGgu",
- "RGl2UmVwbHkiABIuCgdEaXZNYW55Eg0ubWF0aC5EaXZBcmdzGg4ubWF0aC5E",
- "aXZSZXBseSIAKAEwARIjCgNGaWISDS5tYXRoLkZpYkFyZ3MaCS5tYXRoLk51",
- "bSIAMAESHwoDU3VtEgkubWF0aC5OdW0aCS5tYXRoLk51bSIAKAFiBnByb3Rv",
- "Mw=="));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbr::FileDescriptor[] { },
- new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Math.DivArgs), new[]{ "Dividend", "Divisor" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Math.DivReply), new[]{ "Quotient", "Remainder" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Math.FibArgs), new[]{ "Limit" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Math.Num), new[]{ "Num_" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Math.FibReply), new[]{ "Count" }, null, null, null)
- }));
- }
- #endregion
+ /// <summary>Holder for reflection information generated from math.proto</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class MathReflection {
+
+ #region Descriptor
+ /// <summary>File descriptor for math.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static MathReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "CgptYXRoLnByb3RvEgRtYXRoIiwKB0RpdkFyZ3MSEAoIZGl2aWRlbmQYASAB",
+ "KAMSDwoHZGl2aXNvchgCIAEoAyIvCghEaXZSZXBseRIQCghxdW90aWVudBgB",
+ "IAEoAxIRCglyZW1haW5kZXIYAiABKAMiGAoHRmliQXJncxINCgVsaW1pdBgB",
+ "IAEoAyISCgNOdW0SCwoDbnVtGAEgASgDIhkKCEZpYlJlcGx5Eg0KBWNvdW50",
+ "GAEgASgDMqQBCgRNYXRoEiYKA0RpdhINLm1hdGguRGl2QXJncxoOLm1hdGgu",
+ "RGl2UmVwbHkiABIuCgdEaXZNYW55Eg0ubWF0aC5EaXZBcmdzGg4ubWF0aC5E",
+ "aXZSZXBseSIAKAEwARIjCgNGaWISDS5tYXRoLkZpYkFyZ3MaCS5tYXRoLk51",
+ "bSIAMAESHwoDU3VtEgkubWF0aC5OdW0aCS5tYXRoLk51bSIAKAFiBnByb3Rv",
+ "Mw=="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
+ new pbr::GeneratedCodeInfo(typeof(global::Math.DivArgs), global::Math.DivArgs.Parser, new[]{ "Dividend", "Divisor" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Math.DivReply), global::Math.DivReply.Parser, new[]{ "Quotient", "Remainder" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Math.FibArgs), global::Math.FibArgs.Parser, new[]{ "Limit" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Math.Num), global::Math.Num.Parser, new[]{ "Num_" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Math.FibReply), global::Math.FibReply.Parser, new[]{ "Count" }, null, null, null)
+ }));
+ }
+ #endregion
- }
}
#region Messages
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -53,7 +52,7 @@ namespace Math {
public static pb::MessageParser<DivArgs> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Math.Proto.Math.Descriptor.MessageTypes[0]; }
+ get { return global::Math.MathReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -75,6 +74,7 @@ namespace Math {
return new DivArgs(this);
}
+ /// <summary>Field number for the "dividend" field.</summary>
public const int DividendFieldNumber = 1;
private long dividend_;
public long Dividend {
@@ -84,6 +84,7 @@ namespace Math {
}
}
+ /// <summary>Field number for the "divisor" field.</summary>
public const int DivisorFieldNumber = 2;
private long divisor_;
public long Divisor {
@@ -117,7 +118,7 @@ namespace Math {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -181,7 +182,7 @@ namespace Math {
public static pb::MessageParser<DivReply> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Math.Proto.Math.Descriptor.MessageTypes[1]; }
+ get { return global::Math.MathReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -203,6 +204,7 @@ namespace Math {
return new DivReply(this);
}
+ /// <summary>Field number for the "quotient" field.</summary>
public const int QuotientFieldNumber = 1;
private long quotient_;
public long Quotient {
@@ -212,6 +214,7 @@ namespace Math {
}
}
+ /// <summary>Field number for the "remainder" field.</summary>
public const int RemainderFieldNumber = 2;
private long remainder_;
public long Remainder {
@@ -245,7 +248,7 @@ namespace Math {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -309,7 +312,7 @@ namespace Math {
public static pb::MessageParser<FibArgs> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Math.Proto.Math.Descriptor.MessageTypes[2]; }
+ get { return global::Math.MathReflection.Descriptor.MessageTypes[2]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -330,6 +333,7 @@ namespace Math {
return new FibArgs(this);
}
+ /// <summary>Field number for the "limit" field.</summary>
public const int LimitFieldNumber = 1;
private long limit_;
public long Limit {
@@ -361,7 +365,7 @@ namespace Math {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -411,7 +415,7 @@ namespace Math {
public static pb::MessageParser<Num> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Math.Proto.Math.Descriptor.MessageTypes[3]; }
+ get { return global::Math.MathReflection.Descriptor.MessageTypes[3]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -432,6 +436,7 @@ namespace Math {
return new Num(this);
}
+ /// <summary>Field number for the "num" field.</summary>
public const int Num_FieldNumber = 1;
private long num_;
public long Num_ {
@@ -463,7 +468,7 @@ namespace Math {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -513,7 +518,7 @@ namespace Math {
public static pb::MessageParser<FibReply> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Math.Proto.Math.Descriptor.MessageTypes[4]; }
+ get { return global::Math.MathReflection.Descriptor.MessageTypes[4]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -534,6 +539,7 @@ namespace Math {
return new FibReply(this);
}
+ /// <summary>Field number for the "count" field.</summary>
public const int CountFieldNumber = 1;
private long count_;
public long Count {
@@ -565,7 +571,7 @@ namespace Math {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs
index 175d110f76..a6e878d0f4 100644
--- a/src/csharp/Grpc.Examples/MathGrpc.cs
+++ b/src/csharp/Grpc.Examples/MathGrpc.cs
@@ -48,7 +48,7 @@ namespace Math {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Math.Proto.Math.Descriptor.Services[0]; }
+ get { return global::Math.MathReflection.Descriptor.Services[0]; }
}
// client interface
diff --git a/src/csharp/Grpc.Examples/packages.config b/src/csharp/Grpc.Examples/packages.config
index adf8da2363..f5131b8509 100644
--- a/src/csharp/Grpc.Examples/packages.config
+++ b/src/csharp/Grpc.Examples/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Google.Protobuf" version="3.0.0-alpha4" targetFramework="net45" />
+ <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" />
<package id="Ix-Async" version="1.2.3" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj
index 396dc43a02..bb6488b4f1 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj
+++ b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj
@@ -34,12 +34,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Google.Protobuf.3.0.0-alpha4\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
+ <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
diff --git a/src/csharp/Grpc.HealthCheck.Tests/packages.config b/src/csharp/Grpc.HealthCheck.Tests/packages.config
index 40ffb85203..4728093979 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/packages.config
+++ b/src/csharp/Grpc.HealthCheck.Tests/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Google.Protobuf" version="3.0.0-alpha4" targetFramework="net45" />
+ <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj
index 4e775a7a0c..7ffab4b692 100644
--- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj
+++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj
@@ -35,12 +35,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\packages\Google.Protobuf.3.0.0-alpha4\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
+ <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -80,4 +80,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project>
+</Project> \ No newline at end of file
diff --git a/src/csharp/Grpc.HealthCheck/Health.cs b/src/csharp/Grpc.HealthCheck/Health.cs
index 570e274544..56673f1adf 100644
--- a/src/csharp/Grpc.HealthCheck/Health.cs
+++ b/src/csharp/Grpc.HealthCheck/Health.cs
@@ -9,39 +9,38 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Health.V1Alpha {
- namespace Proto {
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Health {
-
- #region Descriptor
- public static pbr::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbr::FileDescriptor descriptor;
-
- static Health() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "CgxoZWFsdGgucHJvdG8SE2dycGMuaGVhbHRoLnYxYWxwaGEiMwoSSGVhbHRo",
- "Q2hlY2tSZXF1ZXN0EgwKBGhvc3QYASABKAkSDwoHc2VydmljZRgCIAEoCSKZ",
- "AQoTSGVhbHRoQ2hlY2tSZXNwb25zZRJGCgZzdGF0dXMYASABKA4yNi5ncnBj",
- "LmhlYWx0aC52MWFscGhhLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0",
- "YXR1cyI6Cg1TZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5H",
- "EAESDwoLTk9UX1NFUlZJTkcQAjJkCgZIZWFsdGgSWgoFQ2hlY2sSJy5ncnBj",
- "LmhlYWx0aC52MWFscGhhLkhlYWx0aENoZWNrUmVxdWVzdBooLmdycGMuaGVh",
- "bHRoLnYxYWxwaGEuSGVhbHRoQ2hlY2tSZXNwb25zZUIWqgITR3JwYy5IZWFs",
- "dGguVjFBbHBoYWIGcHJvdG8z"));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbr::FileDescriptor[] { },
- new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Health.V1Alpha.HealthCheckRequest), new[]{ "Host", "Service" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Health.V1Alpha.HealthCheckResponse), new[]{ "Status" }, null, new[]{ typeof(global::Grpc.Health.V1Alpha.HealthCheckResponse.Types.ServingStatus) }, null)
- }));
- }
- #endregion
+ /// <summary>Holder for reflection information generated from health.proto</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class HealthReflection {
+ #region Descriptor
+ /// <summary>File descriptor for health.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static HealthReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "CgxoZWFsdGgucHJvdG8SE2dycGMuaGVhbHRoLnYxYWxwaGEiMwoSSGVhbHRo",
+ "Q2hlY2tSZXF1ZXN0EgwKBGhvc3QYASABKAkSDwoHc2VydmljZRgCIAEoCSKZ",
+ "AQoTSGVhbHRoQ2hlY2tSZXNwb25zZRJGCgZzdGF0dXMYASABKA4yNi5ncnBj",
+ "LmhlYWx0aC52MWFscGhhLkhlYWx0aENoZWNrUmVzcG9uc2UuU2VydmluZ1N0",
+ "YXR1cyI6Cg1TZXJ2aW5nU3RhdHVzEgsKB1VOS05PV04QABILCgdTRVJWSU5H",
+ "EAESDwoLTk9UX1NFUlZJTkcQAjJkCgZIZWFsdGgSWgoFQ2hlY2sSJy5ncnBj",
+ "LmhlYWx0aC52MWFscGhhLkhlYWx0aENoZWNrUmVxdWVzdBooLmdycGMuaGVh",
+ "bHRoLnYxYWxwaGEuSGVhbHRoQ2hlY2tSZXNwb25zZUIWqgITR3JwYy5IZWFs",
+ "dGguVjFBbHBoYWIGcHJvdG8z"));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Health.V1Alpha.HealthCheckRequest), global::Grpc.Health.V1Alpha.HealthCheckRequest.Parser, new[]{ "Host", "Service" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Health.V1Alpha.HealthCheckResponse), global::Grpc.Health.V1Alpha.HealthCheckResponse.Parser, new[]{ "Status" }, null, new[]{ typeof(global::Grpc.Health.V1Alpha.HealthCheckResponse.Types.ServingStatus) }, null)
+ }));
}
+ #endregion
+
}
#region Messages
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
@@ -50,7 +49,7 @@ namespace Grpc.Health.V1Alpha {
public static pb::MessageParser<HealthCheckRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Health.V1Alpha.Proto.Health.Descriptor.MessageTypes[0]; }
+ get { return global::Grpc.Health.V1Alpha.HealthReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -72,6 +71,7 @@ namespace Grpc.Health.V1Alpha {
return new HealthCheckRequest(this);
}
+ /// <summary>Field number for the "host" field.</summary>
public const int HostFieldNumber = 1;
private string host_ = "";
public string Host {
@@ -81,6 +81,7 @@ namespace Grpc.Health.V1Alpha {
}
}
+ /// <summary>Field number for the "service" field.</summary>
public const int ServiceFieldNumber = 2;
private string service_ = "";
public string Service {
@@ -114,7 +115,7 @@ namespace Grpc.Health.V1Alpha {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -178,7 +179,7 @@ namespace Grpc.Health.V1Alpha {
public static pb::MessageParser<HealthCheckResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Health.V1Alpha.Proto.Health.Descriptor.MessageTypes[1]; }
+ get { return global::Grpc.Health.V1Alpha.HealthReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -199,6 +200,7 @@ namespace Grpc.Health.V1Alpha {
return new HealthCheckResponse(this);
}
+ /// <summary>Field number for the "status" field.</summary>
public const int StatusFieldNumber = 1;
private global::Grpc.Health.V1Alpha.HealthCheckResponse.Types.ServingStatus status_ = global::Grpc.Health.V1Alpha.HealthCheckResponse.Types.ServingStatus.UNKNOWN;
public global::Grpc.Health.V1Alpha.HealthCheckResponse.Types.ServingStatus Status {
@@ -230,7 +232,7 @@ namespace Grpc.Health.V1Alpha {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -273,6 +275,7 @@ namespace Grpc.Health.V1Alpha {
}
#region Nested types
+ /// <summary>Container for nested types declared in the HealthCheckResponse message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public static partial class Types {
public enum ServingStatus {
diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs
index da721ce5f6..882edd5627 100644
--- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs
+++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs
@@ -25,7 +25,7 @@ namespace Grpc.Health.V1Alpha {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Grpc.Health.V1Alpha.Proto.Health.Descriptor.Services[0]; }
+ get { return global::Grpc.Health.V1Alpha.HealthReflection.Descriptor.Services[0]; }
}
// client interface
diff --git a/src/csharp/Grpc.HealthCheck/packages.config b/src/csharp/Grpc.HealthCheck/packages.config
index cafff6123a..04eb42d1aa 100644
--- a/src/csharp/Grpc.HealthCheck/packages.config
+++ b/src/csharp/Grpc.HealthCheck/packages.config
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Google.Protobuf" version="3.0.0-alpha4" targetFramework="net45" />
+ <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" />
<package id="Ix-Async" version="1.2.3" targetFramework="net45" />
</packages> \ No newline at end of file
diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
index 8bc2082a1d..74d73e88d1 100644
--- a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
+++ b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj
@@ -36,7 +36,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4137.9688, Culture=neutral, PublicKeyToken=a4292a325f69b123, processorArchitecture=MSIL">
diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj
index 342eead1a3..0dc2751b04 100644
--- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj
+++ b/src/csharp/Grpc.IntegrationTesting.QpsWorker/Grpc.IntegrationTesting.QpsWorker.csproj
@@ -34,7 +34,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
index 1eadbeb920..f877b7fba2 100644
--- a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
+++ b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj
@@ -36,7 +36,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="BouncyCastle.Crypto, Version=1.7.4137.9688, Culture=neutral, PublicKeyToken=a4292a325f69b123, processorArchitecture=MSIL">
diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs
index 4764e1072b..b90243c2bd 100644
--- a/src/csharp/Grpc.IntegrationTesting/Control.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Control.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/benchmarks/control.proto
+// source: src/proto/grpc/testing/control.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,78 +9,80 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/control.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Control {
+ public static partial class ControlReflection {
#region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/control.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static Control() {
+ static ControlReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiN0ZXN0L3Byb3RvL2JlbmNobWFya3MvY29udHJvbC5wcm90bxIMZ3JwYy50",
- "ZXN0aW5nGiR0ZXN0L3Byb3RvL2JlbmNobWFya3MvcGF5bG9hZHMucHJvdG8a",
- "IXRlc3QvcHJvdG8vYmVuY2htYXJrcy9zdGF0cy5wcm90byIlCg1Qb2lzc29u",
- "UGFyYW1zEhQKDG9mZmVyZWRfbG9hZBgBIAEoASJBCg1Vbmlmb3JtUGFyYW1z",
- "EhcKD2ludGVyYXJyaXZhbF9sbxgBIAEoARIXCg9pbnRlcmFycml2YWxfaGkY",
- "AiABKAEiKwoTRGV0ZXJtaW5pc3RpY1BhcmFtcxIUCgxvZmZlcmVkX2xvYWQY",
- "ASABKAEiOAoMUGFyZXRvUGFyYW1zEhkKEWludGVyYXJyaXZhbF9iYXNlGAEg",
- "ASgBEg0KBWFscGhhGAIgASgBIhIKEENsb3NlZExvb3BQYXJhbXMijgIKCkxv",
- "YWRQYXJhbXMSNQoLY2xvc2VkX2xvb3AYASABKAsyHi5ncnBjLnRlc3Rpbmcu",
- "Q2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiABKAsyGy5ncnBjLnRl",
- "c3RpbmcuUG9pc3NvblBhcmFtc0gAEi4KB3VuaWZvcm0YAyABKAsyGy5ncnBj",
- "LnRlc3RpbmcuVW5pZm9ybVBhcmFtc0gAEjMKBmRldGVybRgEIAEoCzIhLmdy",
- "cGMudGVzdGluZy5EZXRlcm1pbmlzdGljUGFyYW1zSAASLAoGcGFyZXRvGAUg",
- "ASgLMhouZ3JwYy50ZXN0aW5nLlBhcmV0b1BhcmFtc0gAQgYKBGxvYWQiQwoO",
- "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy",
- "X2hvc3Rfb3ZlcnJpZGUYAiABKAkirwMKDENsaWVudENvbmZpZxIWCg5zZXJ2",
- "ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdycGMu",
- "dGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEoCzIc",
- "LmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGluZ19y",
- "cGNzX3Blcl9jaGFubmVsGAQgASgFEhcKD2NsaWVudF9jaGFubmVscxgFIAEo",
- "BRIcChRhc3luY19jbGllbnRfdGhyZWFkcxgHIAEoBRInCghycGNfdHlwZRgI",
- "IAEoDjIVLmdycGMudGVzdGluZy5ScGNUeXBlEi0KC2xvYWRfcGFyYW1zGAog",
- "ASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9jb25m",
- "aWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxI3ChBoaXN0",
- "b2dyYW1fcGFyYW1zGAwgASgLMh0uZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbVBh",
- "cmFtcyI4CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5ncnBjLnRl",
- "c3RpbmcuQ2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNldBgBIAEoCCJoCgpD",
- "bGllbnRBcmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50ZXN0aW5nLkNsaWVu",
- "dENvbmZpZ0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRlc3RpbmcuTWFya0gA",
- "QgkKB2FyZ3R5cGUi9wEKDFNlcnZlckNvbmZpZxItCgtzZXJ2ZXJfdHlwZRgB",
- "IAEoDjIYLmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUKD3NlY3VyaXR5X3Bh",
- "cmFtcxgCIAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIMCgRo",
- "b3N0GAMgASgJEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVyX3RocmVh",
- "ZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2FkX2NvbmZp",
- "ZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnImgKClNlcnZl",
- "ckFyZ3MSKwoFc2V0dXAYASABKAsyGi5ncnBjLnRlc3RpbmcuU2VydmVyQ29u",
- "ZmlnSAASIgoEbWFyaxgCIAEoCzISLmdycGMudGVzdGluZy5NYXJrSABCCQoH",
- "YXJndHlwZSJVCgxTZXJ2ZXJTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5ncnBj",
- "LnRlc3RpbmcuU2VydmVyU3RhdHMSDAoEcG9ydBgCIAEoBRINCgVjb3JlcxgD",
- "IAEoBSovCgpDbGllbnRUeXBlEg8KC1NZTkNfQ0xJRU5UEAASEAoMQVNZTkNf",
- "Q0xJRU5UEAEqLwoKU2VydmVyVHlwZRIPCgtTWU5DX1NFUlZFUhAAEhAKDEFT",
- "WU5DX1NFUlZFUhABKiMKB1JwY1R5cGUSCQoFVU5BUlkQABINCglTVFJFQU1J",
- "TkcQAWIGcHJvdG8z"));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbr::FileDescriptor[] { global::Grpc.Testing.Payloads.Descriptor, global::Grpc.Testing.Stats.Descriptor, },
+ "CiRzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL2NvbnRyb2wucHJvdG8SDGdycGMu",
+ "dGVzdGluZxolc3JjL3Byb3RvL2dycGMvdGVzdGluZy9wYXlsb2Fkcy5wcm90",
+ "bxoic3JjL3Byb3RvL2dycGMvdGVzdGluZy9zdGF0cy5wcm90byIlCg1Qb2lz",
+ "c29uUGFyYW1zEhQKDG9mZmVyZWRfbG9hZBgBIAEoASJBCg1Vbmlmb3JtUGFy",
+ "YW1zEhcKD2ludGVyYXJyaXZhbF9sbxgBIAEoARIXCg9pbnRlcmFycml2YWxf",
+ "aGkYAiABKAEiKwoTRGV0ZXJtaW5pc3RpY1BhcmFtcxIUCgxvZmZlcmVkX2xv",
+ "YWQYASABKAEiOAoMUGFyZXRvUGFyYW1zEhkKEWludGVyYXJyaXZhbF9iYXNl",
+ "GAEgASgBEg0KBWFscGhhGAIgASgBIhIKEENsb3NlZExvb3BQYXJhbXMijgIK",
+ "CkxvYWRQYXJhbXMSNQoLY2xvc2VkX2xvb3AYASABKAsyHi5ncnBjLnRlc3Rp",
+ "bmcuQ2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiABKAsyGy5ncnBj",
+ "LnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAEi4KB3VuaWZvcm0YAyABKAsyGy5n",
+ "cnBjLnRlc3RpbmcuVW5pZm9ybVBhcmFtc0gAEjMKBmRldGVybRgEIAEoCzIh",
+ "LmdycGMudGVzdGluZy5EZXRlcm1pbmlzdGljUGFyYW1zSAASLAoGcGFyZXRv",
+ "GAUgASgLMhouZ3JwYy50ZXN0aW5nLlBhcmV0b1BhcmFtc0gAQgYKBGxvYWQi",
+ "QwoOU2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2Vy",
+ "dmVyX2hvc3Rfb3ZlcnJpZGUYAiABKAkirwMKDENsaWVudENvbmZpZxIWCg5z",
+ "ZXJ2ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdy",
+ "cGMudGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEo",
+ "CzIcLmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGlu",
+ "Z19ycGNzX3Blcl9jaGFubmVsGAQgASgFEhcKD2NsaWVudF9jaGFubmVscxgF",
+ "IAEoBRIcChRhc3luY19jbGllbnRfdGhyZWFkcxgHIAEoBRInCghycGNfdHlw",
+ "ZRgIIAEoDjIVLmdycGMudGVzdGluZy5ScGNUeXBlEi0KC2xvYWRfcGFyYW1z",
+ "GAogASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9j",
+ "b25maWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxI3ChBo",
+ "aXN0b2dyYW1fcGFyYW1zGAwgASgLMh0uZ3JwYy50ZXN0aW5nLkhpc3RvZ3Jh",
+ "bVBhcmFtcyI4CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5ncnBj",
+ "LnRlc3RpbmcuQ2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNldBgBIAEoCCJo",
+ "CgpDbGllbnRBcmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50ZXN0aW5nLkNs",
+ "aWVudENvbmZpZ0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRlc3RpbmcuTWFy",
+ "a0gAQgkKB2FyZ3R5cGUi9wEKDFNlcnZlckNvbmZpZxItCgtzZXJ2ZXJfdHlw",
+ "ZRgBIAEoDjIYLmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUKD3NlY3VyaXR5",
+ "X3BhcmFtcxgCIAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIM",
+ "CgRob3N0GAMgASgJEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVyX3Ro",
+ "cmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2FkX2Nv",
+ "bmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnImgKClNl",
+ "cnZlckFyZ3MSKwoFc2V0dXAYASABKAsyGi5ncnBjLnRlc3RpbmcuU2VydmVy",
+ "Q29uZmlnSAASIgoEbWFyaxgCIAEoCzISLmdycGMudGVzdGluZy5NYXJrSABC",
+ "CQoHYXJndHlwZSJVCgxTZXJ2ZXJTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5n",
+ "cnBjLnRlc3RpbmcuU2VydmVyU3RhdHMSDAoEcG9ydBgCIAEoBRINCgVjb3Jl",
+ "cxgDIAEoBSovCgpDbGllbnRUeXBlEg8KC1NZTkNfQ0xJRU5UEAASEAoMQVNZ",
+ "TkNfQ0xJRU5UEAEqLwoKU2VydmVyVHlwZRIPCgtTWU5DX1NFUlZFUhAAEhAK",
+ "DEFTWU5DX1NFUlZFUhABKiMKB1JwY1R5cGUSCQoFVU5BUlkQABINCglTVFJF",
+ "QU1JTkcQAWIGcHJvdG8z"));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, },
new pbr::GeneratedCodeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.PoissonParams), new[]{ "OfferedLoad" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.UniformParams), new[]{ "InterarrivalLo", "InterarrivalHi" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.DeterministicParams), new[]{ "OfferedLoad" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ParetoParams), new[]{ "InterarrivalBase", "Alpha" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), null, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.LoadParams), new[]{ "ClosedLoop", "Poisson", "Uniform", "Determ", "Pareto" }, new[]{ "Load" }, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SecurityParams), new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStatus), new[]{ "Stats" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Mark), new[]{ "Reset" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientArgs), new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), new[]{ "ServerType", "SecurityParams", "Host", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerArgs), new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStatus), new[]{ "Stats", "Port", "Cores" }, null, null, null)
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.PoissonParams), global::Grpc.Testing.PoissonParams.Parser, new[]{ "OfferedLoad" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.UniformParams), global::Grpc.Testing.UniformParams.Parser, new[]{ "InterarrivalLo", "InterarrivalHi" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.DeterministicParams), global::Grpc.Testing.DeterministicParams.Parser, new[]{ "OfferedLoad" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ParetoParams), global::Grpc.Testing.ParetoParams.Parser, new[]{ "InterarrivalBase", "Alpha" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson", "Uniform", "Determ", "Pareto" }, new[]{ "Load" }, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerConfig), global::Grpc.Testing.ServerConfig.Parser, new[]{ "ServerType", "SecurityParams", "Host", "Port", "AsyncServerThreads", "CoreLimit", "PayloadConfig" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerArgs), global::Grpc.Testing.ServerArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStatus), global::Grpc.Testing.ServerStatus.Parser, new[]{ "Stats", "Port", "Cores" }, null, null, null)
}));
}
#endregion
@@ -105,13 +107,17 @@ namespace Grpc.Testing {
#endregion
#region Messages
+ /// <summary>
+ /// Parameters of poisson process distribution, which is a good representation
+ /// of activity coming in from independent identical stationary sources.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class PoissonParams : pb::IMessage<PoissonParams> {
private static readonly pb::MessageParser<PoissonParams> _parser = new pb::MessageParser<PoissonParams>(() => new PoissonParams());
public static pb::MessageParser<PoissonParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[0]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -132,8 +138,12 @@ namespace Grpc.Testing {
return new PoissonParams(this);
}
+ /// <summary>Field number for the "offered_load" field.</summary>
public const int OfferedLoadFieldNumber = 1;
private double offeredLoad_;
+ /// <summary>
+ /// The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
+ /// </summary>
public double OfferedLoad {
get { return offeredLoad_; }
set {
@@ -163,7 +173,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -213,7 +223,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<UniformParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[1]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -235,6 +245,7 @@ namespace Grpc.Testing {
return new UniformParams(this);
}
+ /// <summary>Field number for the "interarrival_lo" field.</summary>
public const int InterarrivalLoFieldNumber = 1;
private double interarrivalLo_;
public double InterarrivalLo {
@@ -244,6 +255,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "interarrival_hi" field.</summary>
public const int InterarrivalHiFieldNumber = 2;
private double interarrivalHi_;
public double InterarrivalHi {
@@ -277,7 +289,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -341,7 +353,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<DeterministicParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[2]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[2]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -362,6 +374,7 @@ namespace Grpc.Testing {
return new DeterministicParams(this);
}
+ /// <summary>Field number for the "offered_load" field.</summary>
public const int OfferedLoadFieldNumber = 1;
private double offeredLoad_;
public double OfferedLoad {
@@ -393,7 +406,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -443,7 +456,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ParetoParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[3]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[3]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -465,6 +478,7 @@ namespace Grpc.Testing {
return new ParetoParams(this);
}
+ /// <summary>Field number for the "interarrival_base" field.</summary>
public const int InterarrivalBaseFieldNumber = 1;
private double interarrivalBase_;
public double InterarrivalBase {
@@ -474,6 +488,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "alpha" field.</summary>
public const int AlphaFieldNumber = 2;
private double alpha_;
public double Alpha {
@@ -507,7 +522,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -565,13 +580,17 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Once an RPC finishes, immediately start a new one.
+ /// No configuration parameters needed.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ClosedLoopParams : pb::IMessage<ClosedLoopParams> {
private static readonly pb::MessageParser<ClosedLoopParams> _parser = new pb::MessageParser<ClosedLoopParams>(() => new ClosedLoopParams());
public static pb::MessageParser<ClosedLoopParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[4]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[4]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -611,7 +630,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -647,7 +666,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<LoadParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[5]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[5]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -685,6 +704,7 @@ namespace Grpc.Testing {
return new LoadParams(this);
}
+ /// <summary>Field number for the "closed_loop" field.</summary>
public const int ClosedLoopFieldNumber = 1;
public global::Grpc.Testing.ClosedLoopParams ClosedLoop {
get { return loadCase_ == LoadOneofCase.ClosedLoop ? (global::Grpc.Testing.ClosedLoopParams) load_ : null; }
@@ -694,6 +714,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "poisson" field.</summary>
public const int PoissonFieldNumber = 2;
public global::Grpc.Testing.PoissonParams Poisson {
get { return loadCase_ == LoadOneofCase.Poisson ? (global::Grpc.Testing.PoissonParams) load_ : null; }
@@ -703,6 +724,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "uniform" field.</summary>
public const int UniformFieldNumber = 3;
public global::Grpc.Testing.UniformParams Uniform {
get { return loadCase_ == LoadOneofCase.Uniform ? (global::Grpc.Testing.UniformParams) load_ : null; }
@@ -712,6 +734,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "determ" field.</summary>
public const int DetermFieldNumber = 4;
public global::Grpc.Testing.DeterministicParams Determ {
get { return loadCase_ == LoadOneofCase.Determ ? (global::Grpc.Testing.DeterministicParams) load_ : null; }
@@ -721,6 +744,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "pareto" field.</summary>
public const int ParetoFieldNumber = 5;
public global::Grpc.Testing.ParetoParams Pareto {
get { return loadCase_ == LoadOneofCase.Pareto ? (global::Grpc.Testing.ParetoParams) load_ : null; }
@@ -731,6 +755,7 @@ namespace Grpc.Testing {
}
private object load_;
+ /// <summary>Enum of possible cases for the "load" oneof.</summary>
public enum LoadOneofCase {
None = 0,
ClosedLoop = 1,
@@ -765,6 +790,7 @@ namespace Grpc.Testing {
if (!object.Equals(Uniform, other.Uniform)) return false;
if (!object.Equals(Determ, other.Determ)) return false;
if (!object.Equals(Pareto, other.Pareto)) return false;
+ if (LoadCase != other.LoadCase) return false;
return true;
}
@@ -775,11 +801,12 @@ namespace Grpc.Testing {
if (loadCase_ == LoadOneofCase.Uniform) hash ^= Uniform.GetHashCode();
if (loadCase_ == LoadOneofCase.Determ) hash ^= Determ.GetHashCode();
if (loadCase_ == LoadOneofCase.Pareto) hash ^= Pareto.GetHashCode();
+ hash ^= (int) loadCase_;
return hash;
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -907,13 +934,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// presence of SecurityParams implies use of TLS
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class SecurityParams : pb::IMessage<SecurityParams> {
private static readonly pb::MessageParser<SecurityParams> _parser = new pb::MessageParser<SecurityParams>(() => new SecurityParams());
public static pb::MessageParser<SecurityParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[6]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[6]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -935,6 +965,7 @@ namespace Grpc.Testing {
return new SecurityParams(this);
}
+ /// <summary>Field number for the "use_test_ca" field.</summary>
public const int UseTestCaFieldNumber = 1;
private bool useTestCa_;
public bool UseTestCa {
@@ -944,6 +975,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "server_host_override" field.</summary>
public const int ServerHostOverrideFieldNumber = 2;
private string serverHostOverride_ = "";
public string ServerHostOverride {
@@ -977,7 +1009,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1041,7 +1073,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ClientConfig> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[7]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[7]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1071,14 +1103,19 @@ namespace Grpc.Testing {
return new ClientConfig(this);
}
+ /// <summary>Field number for the "server_targets" field.</summary>
public const int ServerTargetsFieldNumber = 1;
private static readonly pb::FieldCodec<string> _repeated_serverTargets_codec
= pb::FieldCodec.ForString(10);
private readonly pbc::RepeatedField<string> serverTargets_ = new pbc::RepeatedField<string>();
+ /// <summary>
+ /// List of targets to connect to. At least one target needs to be specified.
+ /// </summary>
public pbc::RepeatedField<string> ServerTargets {
get { return serverTargets_; }
}
+ /// <summary>Field number for the "client_type" field.</summary>
public const int ClientTypeFieldNumber = 2;
private global::Grpc.Testing.ClientType clientType_ = global::Grpc.Testing.ClientType.SYNC_CLIENT;
public global::Grpc.Testing.ClientType ClientType {
@@ -1088,6 +1125,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "security_params" field.</summary>
public const int SecurityParamsFieldNumber = 3;
private global::Grpc.Testing.SecurityParams securityParams_;
public global::Grpc.Testing.SecurityParams SecurityParams {
@@ -1097,8 +1135,13 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "outstanding_rpcs_per_channel" field.</summary>
public const int OutstandingRpcsPerChannelFieldNumber = 4;
private int outstandingRpcsPerChannel_;
+ /// <summary>
+ /// How many concurrent RPCs to start for each channel.
+ /// For synchronous client, use a separate thread for each outstanding RPC.
+ /// </summary>
public int OutstandingRpcsPerChannel {
get { return outstandingRpcsPerChannel_; }
set {
@@ -1106,8 +1149,13 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "client_channels" field.</summary>
public const int ClientChannelsFieldNumber = 5;
private int clientChannels_;
+ /// <summary>
+ /// Number of independent client channels to create.
+ /// i-th channel will connect to server_target[i % server_targets.size()]
+ /// </summary>
public int ClientChannels {
get { return clientChannels_; }
set {
@@ -1115,8 +1163,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "async_client_threads" field.</summary>
public const int AsyncClientThreadsFieldNumber = 7;
private int asyncClientThreads_;
+ /// <summary>
+ /// Only for async client. Number of threads to use to start/manage RPCs.
+ /// </summary>
public int AsyncClientThreads {
get { return asyncClientThreads_; }
set {
@@ -1124,6 +1176,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "rpc_type" field.</summary>
public const int RpcTypeFieldNumber = 8;
private global::Grpc.Testing.RpcType rpcType_ = global::Grpc.Testing.RpcType.UNARY;
public global::Grpc.Testing.RpcType RpcType {
@@ -1133,8 +1186,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "load_params" field.</summary>
public const int LoadParamsFieldNumber = 10;
private global::Grpc.Testing.LoadParams loadParams_;
+ /// <summary>
+ /// The requested load for the entire client (aggregated over all the threads).
+ /// </summary>
public global::Grpc.Testing.LoadParams LoadParams {
get { return loadParams_; }
set {
@@ -1142,6 +1199,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "payload_config" field.</summary>
public const int PayloadConfigFieldNumber = 11;
private global::Grpc.Testing.PayloadConfig payloadConfig_;
public global::Grpc.Testing.PayloadConfig PayloadConfig {
@@ -1151,6 +1209,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "histogram_params" field.</summary>
public const int HistogramParamsFieldNumber = 12;
private global::Grpc.Testing.HistogramParams histogramParams_;
public global::Grpc.Testing.HistogramParams HistogramParams {
@@ -1200,7 +1259,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1393,7 +1452,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ClientStatus> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[8]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[8]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1414,6 +1473,7 @@ namespace Grpc.Testing {
return new ClientStatus(this);
}
+ /// <summary>Field number for the "stats" field.</summary>
public const int StatsFieldNumber = 1;
private global::Grpc.Testing.ClientStats stats_;
public global::Grpc.Testing.ClientStats Stats {
@@ -1445,7 +1505,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1495,13 +1555,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Request current stats
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Mark : pb::IMessage<Mark> {
private static readonly pb::MessageParser<Mark> _parser = new pb::MessageParser<Mark>(() => new Mark());
public static pb::MessageParser<Mark> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[9]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[9]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1522,8 +1585,12 @@ namespace Grpc.Testing {
return new Mark(this);
}
+ /// <summary>Field number for the "reset" field.</summary>
public const int ResetFieldNumber = 1;
private bool reset_;
+ /// <summary>
+ /// if true, the stats will be reset after taking their snapshot.
+ /// </summary>
public bool Reset {
get { return reset_; }
set {
@@ -1553,7 +1620,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1603,7 +1670,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ClientArgs> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[10]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[10]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1632,6 +1699,7 @@ namespace Grpc.Testing {
return new ClientArgs(this);
}
+ /// <summary>Field number for the "setup" field.</summary>
public const int SetupFieldNumber = 1;
public global::Grpc.Testing.ClientConfig Setup {
get { return argtypeCase_ == ArgtypeOneofCase.Setup ? (global::Grpc.Testing.ClientConfig) argtype_ : null; }
@@ -1641,6 +1709,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "mark" field.</summary>
public const int MarkFieldNumber = 2;
public global::Grpc.Testing.Mark Mark {
get { return argtypeCase_ == ArgtypeOneofCase.Mark ? (global::Grpc.Testing.Mark) argtype_ : null; }
@@ -1651,6 +1720,7 @@ namespace Grpc.Testing {
}
private object argtype_;
+ /// <summary>Enum of possible cases for the "argtype" oneof.</summary>
public enum ArgtypeOneofCase {
None = 0,
Setup = 1,
@@ -1679,6 +1749,7 @@ namespace Grpc.Testing {
}
if (!object.Equals(Setup, other.Setup)) return false;
if (!object.Equals(Mark, other.Mark)) return false;
+ if (ArgtypeCase != other.ArgtypeCase) return false;
return true;
}
@@ -1686,11 +1757,12 @@ namespace Grpc.Testing {
int hash = 1;
if (argtypeCase_ == ArgtypeOneofCase.Setup) hash ^= Setup.GetHashCode();
if (argtypeCase_ == ArgtypeOneofCase.Mark) hash ^= Mark.GetHashCode();
+ hash ^= (int) argtypeCase_;
return hash;
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1767,7 +1839,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ServerConfig> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[11]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[11]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1794,6 +1866,7 @@ namespace Grpc.Testing {
return new ServerConfig(this);
}
+ /// <summary>Field number for the "server_type" field.</summary>
public const int ServerTypeFieldNumber = 1;
private global::Grpc.Testing.ServerType serverType_ = global::Grpc.Testing.ServerType.SYNC_SERVER;
public global::Grpc.Testing.ServerType ServerType {
@@ -1803,6 +1876,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "security_params" field.</summary>
public const int SecurityParamsFieldNumber = 2;
private global::Grpc.Testing.SecurityParams securityParams_;
public global::Grpc.Testing.SecurityParams SecurityParams {
@@ -1812,8 +1886,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "host" field.</summary>
public const int HostFieldNumber = 3;
private string host_ = "";
+ /// <summary>
+ /// Host on which to listen.
+ /// </summary>
public string Host {
get { return host_; }
set {
@@ -1821,8 +1899,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "port" field.</summary>
public const int PortFieldNumber = 4;
private int port_;
+ /// <summary>
+ /// Port on which to listen. Zero means pick unused port.
+ /// </summary>
public int Port {
get { return port_; }
set {
@@ -1830,8 +1912,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "async_server_threads" field.</summary>
public const int AsyncServerThreadsFieldNumber = 7;
private int asyncServerThreads_;
+ /// <summary>
+ /// Only for async server. Number of threads used to serve the requests.
+ /// </summary>
public int AsyncServerThreads {
get { return asyncServerThreads_; }
set {
@@ -1839,8 +1925,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "core_limit" field.</summary>
public const int CoreLimitFieldNumber = 8;
private int coreLimit_;
+ /// <summary>
+ /// restrict core usage, currently unused
+ /// </summary>
public int CoreLimit {
get { return coreLimit_; }
set {
@@ -1848,6 +1938,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "payload_config" field.</summary>
public const int PayloadConfigFieldNumber = 9;
private global::Grpc.Testing.PayloadConfig payloadConfig_;
public global::Grpc.Testing.PayloadConfig PayloadConfig {
@@ -1891,7 +1982,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -2037,7 +2128,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ServerArgs> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[12]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[12]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -2066,6 +2157,7 @@ namespace Grpc.Testing {
return new ServerArgs(this);
}
+ /// <summary>Field number for the "setup" field.</summary>
public const int SetupFieldNumber = 1;
public global::Grpc.Testing.ServerConfig Setup {
get { return argtypeCase_ == ArgtypeOneofCase.Setup ? (global::Grpc.Testing.ServerConfig) argtype_ : null; }
@@ -2075,6 +2167,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "mark" field.</summary>
public const int MarkFieldNumber = 2;
public global::Grpc.Testing.Mark Mark {
get { return argtypeCase_ == ArgtypeOneofCase.Mark ? (global::Grpc.Testing.Mark) argtype_ : null; }
@@ -2085,6 +2178,7 @@ namespace Grpc.Testing {
}
private object argtype_;
+ /// <summary>Enum of possible cases for the "argtype" oneof.</summary>
public enum ArgtypeOneofCase {
None = 0,
Setup = 1,
@@ -2113,6 +2207,7 @@ namespace Grpc.Testing {
}
if (!object.Equals(Setup, other.Setup)) return false;
if (!object.Equals(Mark, other.Mark)) return false;
+ if (ArgtypeCase != other.ArgtypeCase) return false;
return true;
}
@@ -2120,11 +2215,12 @@ namespace Grpc.Testing {
int hash = 1;
if (argtypeCase_ == ArgtypeOneofCase.Setup) hash ^= Setup.GetHashCode();
if (argtypeCase_ == ArgtypeOneofCase.Mark) hash ^= Mark.GetHashCode();
+ hash ^= (int) argtypeCase_;
return hash;
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -2201,7 +2297,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ServerStatus> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Control.Descriptor.MessageTypes[13]; }
+ get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[13]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -2224,6 +2320,7 @@ namespace Grpc.Testing {
return new ServerStatus(this);
}
+ /// <summary>Field number for the "stats" field.</summary>
public const int StatsFieldNumber = 1;
private global::Grpc.Testing.ServerStats stats_;
public global::Grpc.Testing.ServerStats Stats {
@@ -2233,8 +2330,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "port" field.</summary>
public const int PortFieldNumber = 2;
private int port_;
+ /// <summary>
+ /// the port bound by the server
+ /// </summary>
public int Port {
get { return port_; }
set {
@@ -2242,8 +2343,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "cores" field.</summary>
public const int CoresFieldNumber = 3;
private int cores_;
+ /// <summary>
+ /// Number of cores on the server. See gpr_cpu_num_cores.
+ /// </summary>
public int Cores {
get { return cores_; }
set {
@@ -2277,7 +2382,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
diff --git a/src/csharp/Grpc.IntegrationTesting/Empty.cs b/src/csharp/Grpc.IntegrationTesting/Empty.cs
index 9bf2b8f7cf..4323c5a09f 100644
--- a/src/csharp/Grpc.IntegrationTesting/Empty.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Empty.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/empty.proto
+// source: src/proto/grpc/testing/empty.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,40 +9,48 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
- namespace Proto {
-
- [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Empty {
-
- #region Descriptor
- public static pbr::FileDescriptor Descriptor {
- get { return descriptor; }
- }
- private static pbr::FileDescriptor descriptor;
-
- static Empty() {
- byte[] descriptorData = global::System.Convert.FromBase64String(
- string.Concat(
- "ChZ0ZXN0L3Byb3RvL2VtcHR5LnByb3RvEgxncnBjLnRlc3RpbmciBwoFRW1w",
- "dHliBnByb3RvMw=="));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbr::FileDescriptor[] { },
- new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Empty), null, null, null, null)
- }));
- }
- #endregion
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/empty.proto</summary>
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ public static partial class EmptyReflection {
+ #region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/empty.proto</summary>
+ public static pbr::FileDescriptor Descriptor {
+ get { return descriptor; }
+ }
+ private static pbr::FileDescriptor descriptor;
+
+ static EmptyReflection() {
+ byte[] descriptorData = global::System.Convert.FromBase64String(
+ string.Concat(
+ "CiJzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL2VtcHR5LnByb3RvEgxncnBjLnRl",
+ "c3RpbmciBwoFRW1wdHliBnByb3RvMw=="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { },
+ new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Empty), global::Grpc.Testing.Empty.Parser, null, null, null, null)
+ }));
}
+ #endregion
+
}
#region Messages
+ /// <summary>
+ /// An empty message that you can re-use to avoid defining duplicated empty
+ /// messages in your project. A typical example is to use it as argument or the
+ /// return value of a service API. For instance:
+ ///
+ /// service Foo {
+ /// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { };
+ /// };
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Empty : pb::IMessage<Empty> {
private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty());
public static pb::MessageParser<Empty> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Proto.Empty.Descriptor.MessageTypes[0]; }
+ get { return global::Grpc.Testing.EmptyReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -82,7 +90,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
index b0d920a34c..30423313c0 100644
--- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
+++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
@@ -35,12 +35,16 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>C:\keys\Grpc.snk</AssemblyOriginatorKeyFile>
+ <AssemblyOriginatorKeyFile>..\keys\Grpc.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\packages\CommandLineParser.1.9.71\lib\net45\CommandLine.dll</HintPath>
</Reference>
+ <Reference Include="Google.Protobuf, Version=3.0.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\packages\Google.Protobuf.3.0.0-beta2\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
+ </Reference>
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
</Reference>
@@ -66,9 +70,6 @@
<Reference Include="Google.Apis.Core">
<HintPath>..\packages\Google.Apis.Core.1.9.3\lib\portable-net40+sl50+win+wpa81+wp80\Google.Apis.Core.dll</HintPath>
</Reference>
- <Reference Include="Google.Protobuf">
- <HintPath>..\packages\Google.Protobuf.3.0.0-alpha4\lib\portable-net45+netcore45+wpa81+wp8\Google.Protobuf.dll</HintPath>
- </Reference>
<Reference Include="Microsoft.Threading.Tasks">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
diff --git a/src/csharp/Grpc.IntegrationTesting/Messages.cs b/src/csharp/Grpc.IntegrationTesting/Messages.cs
index 51a56f067b..7ca47860f6 100644
--- a/src/csharp/Grpc.IntegrationTesting/Messages.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Messages.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/messages.proto
+// source: src/proto/grpc/testing/messages.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,73 +9,93 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/messages.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Messages {
+ public static partial class MessagesReflection {
#region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/messages.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static Messages() {
+ static MessagesReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "Chl0ZXN0L3Byb3RvL21lc3NhZ2VzLnByb3RvEgxncnBjLnRlc3RpbmciQAoH",
- "UGF5bG9hZBInCgR0eXBlGAEgASgOMhkuZ3JwYy50ZXN0aW5nLlBheWxvYWRU",
- "eXBlEgwKBGJvZHkYAiABKAwiKwoKRWNob1N0YXR1cxIMCgRjb2RlGAEgASgF",
- "Eg8KB21lc3NhZ2UYAiABKAkioQIKDVNpbXBsZVJlcXVlc3QSMAoNcmVzcG9u",
- "c2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlwZRIVCg1y",
- "ZXNwb25zZV9zaXplGAIgASgFEiYKB3BheWxvYWQYAyABKAsyFS5ncnBjLnRl",
- "c3RpbmcuUGF5bG9hZBIVCg1maWxsX3VzZXJuYW1lGAQgASgIEhgKEGZpbGxf",
- "b2F1dGhfc2NvcGUYBSABKAgSOwoUcmVzcG9uc2VfY29tcHJlc3Npb24YBiAB",
- "KA4yHS5ncnBjLnRlc3RpbmcuQ29tcHJlc3Npb25UeXBlEjEKD3Jlc3BvbnNl",
- "X3N0YXR1cxgHIAEoCzIYLmdycGMudGVzdGluZy5FY2hvU3RhdHVzIl8KDlNp",
- "bXBsZVJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3Rpbmcu",
- "UGF5bG9hZBIQCgh1c2VybmFtZRgCIAEoCRITCgtvYXV0aF9zY29wZRgDIAEo",
- "CSJDChlTdHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYKB3BheWxvYWQYASAB",
- "KAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZCI9ChpTdHJlYW1pbmdJbnB1dENh",
- "bGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRfc2l6ZRgBIAEoBSI3",
- "ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEoBRITCgtpbnRlcnZh",
- "bF91cxgCIAEoBSKlAgoaU3RyZWFtaW5nT3V0cHV0Q2FsbFJlcXVlc3QSMAoN",
- "cmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXlsb2FkVHlw",
- "ZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAuZ3JwYy50ZXN0aW5n",
- "LlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMgASgLMhUuZ3JwYy50",
- "ZXN0aW5nLlBheWxvYWQSOwoUcmVzcG9uc2VfY29tcHJlc3Npb24YBiABKA4y",
- "HS5ncnBjLnRlc3RpbmcuQ29tcHJlc3Npb25UeXBlEjEKD3Jlc3BvbnNlX3N0",
- "YXR1cxgHIAEoCzIYLmdycGMudGVzdGluZy5FY2hvU3RhdHVzIkUKG1N0cmVh",
- "bWluZ091dHB1dENhbGxSZXNwb25zZRImCgdwYXlsb2FkGAEgASgLMhUuZ3Jw",
- "Yy50ZXN0aW5nLlBheWxvYWQiMwoNUmVjb25uZWN0SW5mbxIOCgZwYXNzZWQY",
- "ASABKAgSEgoKYmFja29mZl9tcxgCIAMoBSo/CgtQYXlsb2FkVHlwZRIQCgxD",
- "T01QUkVTU0FCTEUQABISCg5VTkNPTVBSRVNTQUJMRRABEgoKBlJBTkRPTRAC",
- "KjIKD0NvbXByZXNzaW9uVHlwZRIICgROT05FEAASCAoER1pJUBABEgsKB0RF",
- "RkxBVEUQAmIGcHJvdG8z"));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
+ "CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL21lc3NhZ2VzLnByb3RvEgxncnBj",
+ "LnRlc3RpbmciQAoHUGF5bG9hZBInCgR0eXBlGAEgASgOMhkuZ3JwYy50ZXN0",
+ "aW5nLlBheWxvYWRUeXBlEgwKBGJvZHkYAiABKAwiKwoKRWNob1N0YXR1cxIM",
+ "CgRjb2RlGAEgASgFEg8KB21lc3NhZ2UYAiABKAkioQIKDVNpbXBsZVJlcXVl",
+ "c3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGluZy5QYXls",
+ "b2FkVHlwZRIVCg1yZXNwb25zZV9zaXplGAIgASgFEiYKB3BheWxvYWQYAyAB",
+ "KAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZBIVCg1maWxsX3VzZXJuYW1lGAQg",
+ "ASgIEhgKEGZpbGxfb2F1dGhfc2NvcGUYBSABKAgSOwoUcmVzcG9uc2VfY29t",
+ "cHJlc3Npb24YBiABKA4yHS5ncnBjLnRlc3RpbmcuQ29tcHJlc3Npb25UeXBl",
+ "EjEKD3Jlc3BvbnNlX3N0YXR1cxgHIAEoCzIYLmdycGMudGVzdGluZy5FY2hv",
+ "U3RhdHVzIl8KDlNpbXBsZVJlc3BvbnNlEiYKB3BheWxvYWQYASABKAsyFS5n",
+ "cnBjLnRlc3RpbmcuUGF5bG9hZBIQCgh1c2VybmFtZRgCIAEoCRITCgtvYXV0",
+ "aF9zY29wZRgDIAEoCSJDChlTdHJlYW1pbmdJbnB1dENhbGxSZXF1ZXN0EiYK",
+ "B3BheWxvYWQYASABKAsyFS5ncnBjLnRlc3RpbmcuUGF5bG9hZCI9ChpTdHJl",
+ "YW1pbmdJbnB1dENhbGxSZXNwb25zZRIfChdhZ2dyZWdhdGVkX3BheWxvYWRf",
+ "c2l6ZRgBIAEoBSI3ChJSZXNwb25zZVBhcmFtZXRlcnMSDAoEc2l6ZRgBIAEo",
+ "BRITCgtpbnRlcnZhbF91cxgCIAEoBSKlAgoaU3RyZWFtaW5nT3V0cHV0Q2Fs",
+ "bFJlcXVlc3QSMAoNcmVzcG9uc2VfdHlwZRgBIAEoDjIZLmdycGMudGVzdGlu",
+ "Zy5QYXlsb2FkVHlwZRI9ChNyZXNwb25zZV9wYXJhbWV0ZXJzGAIgAygLMiAu",
+ "Z3JwYy50ZXN0aW5nLlJlc3BvbnNlUGFyYW1ldGVycxImCgdwYXlsb2FkGAMg",
+ "ASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQSOwoUcmVzcG9uc2VfY29tcHJl",
+ "c3Npb24YBiABKA4yHS5ncnBjLnRlc3RpbmcuQ29tcHJlc3Npb25UeXBlEjEK",
+ "D3Jlc3BvbnNlX3N0YXR1cxgHIAEoCzIYLmdycGMudGVzdGluZy5FY2hvU3Rh",
+ "dHVzIkUKG1N0cmVhbWluZ091dHB1dENhbGxSZXNwb25zZRImCgdwYXlsb2Fk",
+ "GAEgASgLMhUuZ3JwYy50ZXN0aW5nLlBheWxvYWQiMwoNUmVjb25uZWN0SW5m",
+ "bxIOCgZwYXNzZWQYASABKAgSEgoKYmFja29mZl9tcxgCIAMoBSo/CgtQYXls",
+ "b2FkVHlwZRIQCgxDT01QUkVTU0FCTEUQABISCg5VTkNPTVBSRVNTQUJMRRAB",
+ "EgoKBlJBTkRPTRACKjIKD0NvbXByZXNzaW9uVHlwZRIICgROT05FEAASCAoE",
+ "R1pJUBABEgsKB0RFRkxBVEUQAmIGcHJvdG8z"));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), typeof(global::Grpc.Testing.CompressionType), }, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Payload), new[]{ "Type", "Body" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.EchoStatus), new[]{ "Code", "Message" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SimpleRequest), new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompression", "ResponseStatus" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SimpleResponse), new[]{ "Payload", "Username", "OauthScope" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), new[]{ "Payload" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), new[]{ "AggregatedPayloadSize" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ResponseParameters), new[]{ "Size", "IntervalUs" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingOutputCallRequest), new[]{ "ResponseType", "ResponseParameters", "Payload", "ResponseCompression", "ResponseStatus" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingOutputCallResponse), new[]{ "Payload" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ReconnectInfo), new[]{ "Passed", "BackoffMs" }, null, null, null)
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.Payload), global::Grpc.Testing.Payload.Parser, new[]{ "Type", "Body" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.EchoStatus), global::Grpc.Testing.EchoStatus.Parser, new[]{ "Code", "Message" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SimpleRequest), global::Grpc.Testing.SimpleRequest.Parser, new[]{ "ResponseType", "ResponseSize", "Payload", "FillUsername", "FillOauthScope", "ResponseCompression", "ResponseStatus" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SimpleResponse), global::Grpc.Testing.SimpleResponse.Parser, new[]{ "Payload", "Username", "OauthScope" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingInputCallRequest), global::Grpc.Testing.StreamingInputCallRequest.Parser, new[]{ "Payload" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingInputCallResponse), global::Grpc.Testing.StreamingInputCallResponse.Parser, new[]{ "AggregatedPayloadSize" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ResponseParameters), global::Grpc.Testing.ResponseParameters.Parser, new[]{ "Size", "IntervalUs" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingOutputCallRequest), global::Grpc.Testing.StreamingOutputCallRequest.Parser, new[]{ "ResponseType", "ResponseParameters", "Payload", "ResponseCompression", "ResponseStatus" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.StreamingOutputCallResponse), global::Grpc.Testing.StreamingOutputCallResponse.Parser, new[]{ "Payload" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ReconnectInfo), global::Grpc.Testing.ReconnectInfo.Parser, new[]{ "Passed", "BackoffMs" }, null, null, null)
}));
}
#endregion
}
#region Enums
+ /// <summary>
+ /// The type of payload that should be returned.
+ /// </summary>
public enum PayloadType {
+ /// <summary>
+ /// Compressable text format.
+ /// </summary>
COMPRESSABLE = 0,
+ /// <summary>
+ /// Uncompressable binary format.
+ /// </summary>
UNCOMPRESSABLE = 1,
+ /// <summary>
+ /// Randomly chosen from all other formats defined in this enum.
+ /// </summary>
RANDOM = 2,
}
+ /// <summary>
+ /// Compression algorithms
+ /// </summary>
public enum CompressionType {
+ /// <summary>
+ /// No compression
+ /// </summary>
NONE = 0,
GZIP = 1,
DEFLATE = 2,
@@ -84,13 +104,16 @@ namespace Grpc.Testing {
#endregion
#region Messages
+ /// <summary>
+ /// A block of data, to simply increase gRPC message size.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class Payload : pb::IMessage<Payload> {
private static readonly pb::MessageParser<Payload> _parser = new pb::MessageParser<Payload>(() => new Payload());
public static pb::MessageParser<Payload> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[0]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -112,8 +135,12 @@ namespace Grpc.Testing {
return new Payload(this);
}
+ /// <summary>Field number for the "type" field.</summary>
public const int TypeFieldNumber = 1;
private global::Grpc.Testing.PayloadType type_ = global::Grpc.Testing.PayloadType.COMPRESSABLE;
+ /// <summary>
+ /// The type of data in body.
+ /// </summary>
public global::Grpc.Testing.PayloadType Type {
get { return type_; }
set {
@@ -121,8 +148,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "body" field.</summary>
public const int BodyFieldNumber = 2;
private pb::ByteString body_ = pb::ByteString.Empty;
+ /// <summary>
+ /// Primary contents of payload.
+ /// </summary>
public pb::ByteString Body {
get { return body_; }
set {
@@ -154,7 +185,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -212,13 +243,17 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// A protobuf representation for grpc status. This is used by test
+ /// clients to specify a status that the server should attempt to return.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class EchoStatus : pb::IMessage<EchoStatus> {
private static readonly pb::MessageParser<EchoStatus> _parser = new pb::MessageParser<EchoStatus>(() => new EchoStatus());
public static pb::MessageParser<EchoStatus> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[1]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -240,6 +275,7 @@ namespace Grpc.Testing {
return new EchoStatus(this);
}
+ /// <summary>Field number for the "code" field.</summary>
public const int CodeFieldNumber = 1;
private int code_;
public int Code {
@@ -249,6 +285,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "message" field.</summary>
public const int MessageFieldNumber = 2;
private string message_ = "";
public string Message {
@@ -282,7 +319,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -340,13 +377,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Unary request.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class SimpleRequest : pb::IMessage<SimpleRequest> {
private static readonly pb::MessageParser<SimpleRequest> _parser = new pb::MessageParser<SimpleRequest>(() => new SimpleRequest());
public static pb::MessageParser<SimpleRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[2]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[2]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -373,8 +413,13 @@ namespace Grpc.Testing {
return new SimpleRequest(this);
}
+ /// <summary>Field number for the "response_type" field.</summary>
public const int ResponseTypeFieldNumber = 1;
private global::Grpc.Testing.PayloadType responseType_ = global::Grpc.Testing.PayloadType.COMPRESSABLE;
+ /// <summary>
+ /// Desired payload type in the response from the server.
+ /// If response_type is RANDOM, server randomly chooses one from other formats.
+ /// </summary>
public global::Grpc.Testing.PayloadType ResponseType {
get { return responseType_; }
set {
@@ -382,8 +427,13 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "response_size" field.</summary>
public const int ResponseSizeFieldNumber = 2;
private int responseSize_;
+ /// <summary>
+ /// Desired payload size in the response from the server.
+ /// If response_type is COMPRESSABLE, this denotes the size before compression.
+ /// </summary>
public int ResponseSize {
get { return responseSize_; }
set {
@@ -391,8 +441,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "payload" field.</summary>
public const int PayloadFieldNumber = 3;
private global::Grpc.Testing.Payload payload_;
+ /// <summary>
+ /// Optional input payload sent along with the request.
+ /// </summary>
public global::Grpc.Testing.Payload Payload {
get { return payload_; }
set {
@@ -400,8 +454,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "fill_username" field.</summary>
public const int FillUsernameFieldNumber = 4;
private bool fillUsername_;
+ /// <summary>
+ /// Whether SimpleResponse should include username.
+ /// </summary>
public bool FillUsername {
get { return fillUsername_; }
set {
@@ -409,8 +467,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "fill_oauth_scope" field.</summary>
public const int FillOauthScopeFieldNumber = 5;
private bool fillOauthScope_;
+ /// <summary>
+ /// Whether SimpleResponse should include OAuth scope.
+ /// </summary>
public bool FillOauthScope {
get { return fillOauthScope_; }
set {
@@ -418,8 +480,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "response_compression" field.</summary>
public const int ResponseCompressionFieldNumber = 6;
private global::Grpc.Testing.CompressionType responseCompression_ = global::Grpc.Testing.CompressionType.NONE;
+ /// <summary>
+ /// Compression algorithm to be used by the server for the response (stream)
+ /// </summary>
public global::Grpc.Testing.CompressionType ResponseCompression {
get { return responseCompression_; }
set {
@@ -427,8 +493,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "response_status" field.</summary>
public const int ResponseStatusFieldNumber = 7;
private global::Grpc.Testing.EchoStatus responseStatus_;
+ /// <summary>
+ /// Whether server should return a given status
+ /// </summary>
public global::Grpc.Testing.EchoStatus ResponseStatus {
get { return responseStatus_; }
set {
@@ -470,7 +540,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -610,13 +680,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Unary response, as configured by the request.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class SimpleResponse : pb::IMessage<SimpleResponse> {
private static readonly pb::MessageParser<SimpleResponse> _parser = new pb::MessageParser<SimpleResponse>(() => new SimpleResponse());
public static pb::MessageParser<SimpleResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[3]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[3]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -639,8 +712,12 @@ namespace Grpc.Testing {
return new SimpleResponse(this);
}
+ /// <summary>Field number for the "payload" field.</summary>
public const int PayloadFieldNumber = 1;
private global::Grpc.Testing.Payload payload_;
+ /// <summary>
+ /// Payload to increase message size.
+ /// </summary>
public global::Grpc.Testing.Payload Payload {
get { return payload_; }
set {
@@ -648,8 +725,13 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "username" field.</summary>
public const int UsernameFieldNumber = 2;
private string username_ = "";
+ /// <summary>
+ /// The user the request came from, for verifying authentication was
+ /// successful when the client expected it.
+ /// </summary>
public string Username {
get { return username_; }
set {
@@ -657,8 +739,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "oauth_scope" field.</summary>
public const int OauthScopeFieldNumber = 3;
private string oauthScope_ = "";
+ /// <summary>
+ /// OAuth scope.
+ /// </summary>
public string OauthScope {
get { return oauthScope_; }
set {
@@ -692,7 +778,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -770,13 +856,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Client-streaming request.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class StreamingInputCallRequest : pb::IMessage<StreamingInputCallRequest> {
private static readonly pb::MessageParser<StreamingInputCallRequest> _parser = new pb::MessageParser<StreamingInputCallRequest>(() => new StreamingInputCallRequest());
public static pb::MessageParser<StreamingInputCallRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[4]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[4]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -797,8 +886,12 @@ namespace Grpc.Testing {
return new StreamingInputCallRequest(this);
}
+ /// <summary>Field number for the "payload" field.</summary>
public const int PayloadFieldNumber = 1;
private global::Grpc.Testing.Payload payload_;
+ /// <summary>
+ /// Optional input payload sent along with the request.
+ /// </summary>
public global::Grpc.Testing.Payload Payload {
get { return payload_; }
set {
@@ -828,7 +921,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -878,13 +971,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Client-streaming response.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class StreamingInputCallResponse : pb::IMessage<StreamingInputCallResponse> {
private static readonly pb::MessageParser<StreamingInputCallResponse> _parser = new pb::MessageParser<StreamingInputCallResponse>(() => new StreamingInputCallResponse());
public static pb::MessageParser<StreamingInputCallResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[5]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[5]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -905,8 +1001,12 @@ namespace Grpc.Testing {
return new StreamingInputCallResponse(this);
}
+ /// <summary>Field number for the "aggregated_payload_size" field.</summary>
public const int AggregatedPayloadSizeFieldNumber = 1;
private int aggregatedPayloadSize_;
+ /// <summary>
+ /// Aggregated size of payloads received from the client.
+ /// </summary>
public int AggregatedPayloadSize {
get { return aggregatedPayloadSize_; }
set {
@@ -936,7 +1036,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -980,13 +1080,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Configuration for a particular response.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ResponseParameters : pb::IMessage<ResponseParameters> {
private static readonly pb::MessageParser<ResponseParameters> _parser = new pb::MessageParser<ResponseParameters>(() => new ResponseParameters());
public static pb::MessageParser<ResponseParameters> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[6]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[6]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1008,8 +1111,13 @@ namespace Grpc.Testing {
return new ResponseParameters(this);
}
+ /// <summary>Field number for the "size" field.</summary>
public const int SizeFieldNumber = 1;
private int size_;
+ /// <summary>
+ /// Desired payload sizes in responses from the server.
+ /// If response_type is COMPRESSABLE, this denotes the size before compression.
+ /// </summary>
public int Size {
get { return size_; }
set {
@@ -1017,8 +1125,13 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "interval_us" field.</summary>
public const int IntervalUsFieldNumber = 2;
private int intervalUs_;
+ /// <summary>
+ /// Desired interval between consecutive responses in the response stream in
+ /// microseconds.
+ /// </summary>
public int IntervalUs {
get { return intervalUs_; }
set {
@@ -1050,7 +1163,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1108,13 +1221,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Server-streaming request.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class StreamingOutputCallRequest : pb::IMessage<StreamingOutputCallRequest> {
private static readonly pb::MessageParser<StreamingOutputCallRequest> _parser = new pb::MessageParser<StreamingOutputCallRequest>(() => new StreamingOutputCallRequest());
public static pb::MessageParser<StreamingOutputCallRequest> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[7]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[7]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1139,8 +1255,15 @@ namespace Grpc.Testing {
return new StreamingOutputCallRequest(this);
}
+ /// <summary>Field number for the "response_type" field.</summary>
public const int ResponseTypeFieldNumber = 1;
private global::Grpc.Testing.PayloadType responseType_ = global::Grpc.Testing.PayloadType.COMPRESSABLE;
+ /// <summary>
+ /// Desired payload type in the response from the server.
+ /// If response_type is RANDOM, the payload from each response in the stream
+ /// might be of different types. This is to simulate a mixed type of payload
+ /// stream.
+ /// </summary>
public global::Grpc.Testing.PayloadType ResponseType {
get { return responseType_; }
set {
@@ -1148,16 +1271,24 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "response_parameters" field.</summary>
public const int ResponseParametersFieldNumber = 2;
private static readonly pb::FieldCodec<global::Grpc.Testing.ResponseParameters> _repeated_responseParameters_codec
= pb::FieldCodec.ForMessage(18, global::Grpc.Testing.ResponseParameters.Parser);
private readonly pbc::RepeatedField<global::Grpc.Testing.ResponseParameters> responseParameters_ = new pbc::RepeatedField<global::Grpc.Testing.ResponseParameters>();
+ /// <summary>
+ /// Configuration for each expected response message.
+ /// </summary>
public pbc::RepeatedField<global::Grpc.Testing.ResponseParameters> ResponseParameters {
get { return responseParameters_; }
}
+ /// <summary>Field number for the "payload" field.</summary>
public const int PayloadFieldNumber = 3;
private global::Grpc.Testing.Payload payload_;
+ /// <summary>
+ /// Optional input payload sent along with the request.
+ /// </summary>
public global::Grpc.Testing.Payload Payload {
get { return payload_; }
set {
@@ -1165,8 +1296,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "response_compression" field.</summary>
public const int ResponseCompressionFieldNumber = 6;
private global::Grpc.Testing.CompressionType responseCompression_ = global::Grpc.Testing.CompressionType.NONE;
+ /// <summary>
+ /// Compression algorithm to be used by the server for the response (stream)
+ /// </summary>
public global::Grpc.Testing.CompressionType ResponseCompression {
get { return responseCompression_; }
set {
@@ -1174,8 +1309,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "response_status" field.</summary>
public const int ResponseStatusFieldNumber = 7;
private global::Grpc.Testing.EchoStatus responseStatus_;
+ /// <summary>
+ /// Whether server should return a given status
+ /// </summary>
public global::Grpc.Testing.EchoStatus ResponseStatus {
get { return responseStatus_; }
set {
@@ -1213,7 +1352,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1318,13 +1457,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Server-streaming response, as configured by the request and parameters.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class StreamingOutputCallResponse : pb::IMessage<StreamingOutputCallResponse> {
private static readonly pb::MessageParser<StreamingOutputCallResponse> _parser = new pb::MessageParser<StreamingOutputCallResponse>(() => new StreamingOutputCallResponse());
public static pb::MessageParser<StreamingOutputCallResponse> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[8]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[8]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1345,8 +1487,12 @@ namespace Grpc.Testing {
return new StreamingOutputCallResponse(this);
}
+ /// <summary>Field number for the "payload" field.</summary>
public const int PayloadFieldNumber = 1;
private global::Grpc.Testing.Payload payload_;
+ /// <summary>
+ /// Payload to increase response size.
+ /// </summary>
public global::Grpc.Testing.Payload Payload {
get { return payload_; }
set {
@@ -1376,7 +1522,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -1426,13 +1572,18 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// For reconnect interop test only.
+ /// Server tells client whether its reconnects are following the spec and the
+ /// reconnect backoffs it saw.
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ReconnectInfo : pb::IMessage<ReconnectInfo> {
private static readonly pb::MessageParser<ReconnectInfo> _parser = new pb::MessageParser<ReconnectInfo>(() => new ReconnectInfo());
public static pb::MessageParser<ReconnectInfo> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Messages.Descriptor.MessageTypes[9]; }
+ get { return global::Grpc.Testing.MessagesReflection.Descriptor.MessageTypes[9]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -1454,6 +1605,7 @@ namespace Grpc.Testing {
return new ReconnectInfo(this);
}
+ /// <summary>Field number for the "passed" field.</summary>
public const int PassedFieldNumber = 1;
private bool passed_;
public bool Passed {
@@ -1463,6 +1615,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "backoff_ms" field.</summary>
public const int BackoffMsFieldNumber = 2;
private static readonly pb::FieldCodec<int> _repeated_backoffMs_codec
= pb::FieldCodec.ForInt32(18);
@@ -1495,7 +1648,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
diff --git a/src/csharp/Grpc.IntegrationTesting/Payloads.cs b/src/csharp/Grpc.IntegrationTesting/Payloads.cs
index a37dd9a685..663f625aa7 100644
--- a/src/csharp/Grpc.IntegrationTesting/Payloads.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Payloads.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/benchmarks/payloads.proto
+// source: src/proto/grpc/testing/payloads.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,34 +9,36 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/payloads.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Payloads {
+ public static partial class PayloadsReflection {
#region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/payloads.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static Payloads() {
+ static PayloadsReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiR0ZXN0L3Byb3RvL2JlbmNobWFya3MvcGF5bG9hZHMucHJvdG8SDGdycGMu",
- "dGVzdGluZyI3ChBCeXRlQnVmZmVyUGFyYW1zEhAKCHJlcV9zaXplGAEgASgF",
- "EhEKCXJlc3Bfc2l6ZRgCIAEoBSI4ChFTaW1wbGVQcm90b1BhcmFtcxIQCghy",
- "ZXFfc2l6ZRgBIAEoBRIRCglyZXNwX3NpemUYAiABKAUiFAoSQ29tcGxleFBy",
- "b3RvUGFyYW1zIsoBCg1QYXlsb2FkQ29uZmlnEjgKDmJ5dGVidWZfcGFyYW1z",
- "GAEgASgLMh4uZ3JwYy50ZXN0aW5nLkJ5dGVCdWZmZXJQYXJhbXNIABI4Cg1z",
- "aW1wbGVfcGFyYW1zGAIgASgLMh8uZ3JwYy50ZXN0aW5nLlNpbXBsZVByb3Rv",
- "UGFyYW1zSAASOgoOY29tcGxleF9wYXJhbXMYAyABKAsyIC5ncnBjLnRlc3Rp",
- "bmcuQ29tcGxleFByb3RvUGFyYW1zSABCCQoHcGF5bG9hZGIGcHJvdG8z"));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
+ "CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3BheWxvYWRzLnByb3RvEgxncnBj",
+ "LnRlc3RpbmciNwoQQnl0ZUJ1ZmZlclBhcmFtcxIQCghyZXFfc2l6ZRgBIAEo",
+ "BRIRCglyZXNwX3NpemUYAiABKAUiOAoRU2ltcGxlUHJvdG9QYXJhbXMSEAoI",
+ "cmVxX3NpemUYASABKAUSEQoJcmVzcF9zaXplGAIgASgFIhQKEkNvbXBsZXhQ",
+ "cm90b1BhcmFtcyLKAQoNUGF5bG9hZENvbmZpZxI4Cg5ieXRlYnVmX3BhcmFt",
+ "cxgBIAEoCzIeLmdycGMudGVzdGluZy5CeXRlQnVmZmVyUGFyYW1zSAASOAoN",
+ "c2ltcGxlX3BhcmFtcxgCIAEoCzIfLmdycGMudGVzdGluZy5TaW1wbGVQcm90",
+ "b1BhcmFtc0gAEjoKDmNvbXBsZXhfcGFyYW1zGAMgASgLMiAuZ3JwYy50ZXN0",
+ "aW5nLkNvbXBsZXhQcm90b1BhcmFtc0gAQgkKB3BheWxvYWRiBnByb3RvMw=="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ByteBufferParams), new[]{ "ReqSize", "RespSize" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SimpleProtoParams), new[]{ "ReqSize", "RespSize" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ComplexProtoParams), null, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.PayloadConfig), new[]{ "BytebufParams", "SimpleParams", "ComplexParams" }, new[]{ "Payload" }, null, null)
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ByteBufferParams), global::Grpc.Testing.ByteBufferParams.Parser, new[]{ "ReqSize", "RespSize" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.SimpleProtoParams), global::Grpc.Testing.SimpleProtoParams.Parser, new[]{ "ReqSize", "RespSize" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ComplexProtoParams), global::Grpc.Testing.ComplexProtoParams.Parser, null, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.PayloadConfig), global::Grpc.Testing.PayloadConfig.Parser, new[]{ "BytebufParams", "SimpleParams", "ComplexParams" }, new[]{ "Payload" }, null, null)
}));
}
#endregion
@@ -49,7 +51,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ByteBufferParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Payloads.Descriptor.MessageTypes[0]; }
+ get { return global::Grpc.Testing.PayloadsReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -71,6 +73,7 @@ namespace Grpc.Testing {
return new ByteBufferParams(this);
}
+ /// <summary>Field number for the "req_size" field.</summary>
public const int ReqSizeFieldNumber = 1;
private int reqSize_;
public int ReqSize {
@@ -80,6 +83,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "resp_size" field.</summary>
public const int RespSizeFieldNumber = 2;
private int respSize_;
public int RespSize {
@@ -113,7 +117,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -177,7 +181,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<SimpleProtoParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Payloads.Descriptor.MessageTypes[1]; }
+ get { return global::Grpc.Testing.PayloadsReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -199,6 +203,7 @@ namespace Grpc.Testing {
return new SimpleProtoParams(this);
}
+ /// <summary>Field number for the "req_size" field.</summary>
public const int ReqSizeFieldNumber = 1;
private int reqSize_;
public int ReqSize {
@@ -208,6 +213,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "resp_size" field.</summary>
public const int RespSizeFieldNumber = 2;
private int respSize_;
public int RespSize {
@@ -241,7 +247,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -299,13 +305,17 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// TODO (vpai): Fill this in once the details of complex, representative
+ /// protos are decided
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class ComplexProtoParams : pb::IMessage<ComplexProtoParams> {
private static readonly pb::MessageParser<ComplexProtoParams> _parser = new pb::MessageParser<ComplexProtoParams>(() => new ComplexProtoParams());
public static pb::MessageParser<ComplexProtoParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Payloads.Descriptor.MessageTypes[2]; }
+ get { return global::Grpc.Testing.PayloadsReflection.Descriptor.MessageTypes[2]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -345,7 +355,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -381,7 +391,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<PayloadConfig> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Payloads.Descriptor.MessageTypes[3]; }
+ get { return global::Grpc.Testing.PayloadsReflection.Descriptor.MessageTypes[3]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -413,6 +423,7 @@ namespace Grpc.Testing {
return new PayloadConfig(this);
}
+ /// <summary>Field number for the "bytebuf_params" field.</summary>
public const int BytebufParamsFieldNumber = 1;
public global::Grpc.Testing.ByteBufferParams BytebufParams {
get { return payloadCase_ == PayloadOneofCase.BytebufParams ? (global::Grpc.Testing.ByteBufferParams) payload_ : null; }
@@ -422,6 +433,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "simple_params" field.</summary>
public const int SimpleParamsFieldNumber = 2;
public global::Grpc.Testing.SimpleProtoParams SimpleParams {
get { return payloadCase_ == PayloadOneofCase.SimpleParams ? (global::Grpc.Testing.SimpleProtoParams) payload_ : null; }
@@ -431,6 +443,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "complex_params" field.</summary>
public const int ComplexParamsFieldNumber = 3;
public global::Grpc.Testing.ComplexProtoParams ComplexParams {
get { return payloadCase_ == PayloadOneofCase.ComplexParams ? (global::Grpc.Testing.ComplexProtoParams) payload_ : null; }
@@ -441,6 +454,7 @@ namespace Grpc.Testing {
}
private object payload_;
+ /// <summary>Enum of possible cases for the "payload" oneof.</summary>
public enum PayloadOneofCase {
None = 0,
BytebufParams = 1,
@@ -471,6 +485,7 @@ namespace Grpc.Testing {
if (!object.Equals(BytebufParams, other.BytebufParams)) return false;
if (!object.Equals(SimpleParams, other.SimpleParams)) return false;
if (!object.Equals(ComplexParams, other.ComplexParams)) return false;
+ if (PayloadCase != other.PayloadCase) return false;
return true;
}
@@ -479,11 +494,12 @@ namespace Grpc.Testing {
if (payloadCase_ == PayloadOneofCase.BytebufParams) hash ^= BytebufParams.GetHashCode();
if (payloadCase_ == PayloadOneofCase.SimpleParams) hash ^= SimpleParams.GetHashCode();
if (payloadCase_ == PayloadOneofCase.ComplexParams) hash ^= ComplexParams.GetHashCode();
+ hash ^= (int) payloadCase_;
return hash;
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
diff --git a/src/csharp/Grpc.IntegrationTesting/Services.cs b/src/csharp/Grpc.IntegrationTesting/Services.cs
index b648da6734..04a092ccd7 100644
--- a/src/csharp/Grpc.IntegrationTesting/Services.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Services.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/benchmarks/services.proto
+// source: src/proto/grpc/testing/services.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,31 +9,33 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/services.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Services {
+ public static partial class ServicesReflection {
#region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/services.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static Services() {
+ static ServicesReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiR0ZXN0L3Byb3RvL2JlbmNobWFya3Mvc2VydmljZXMucHJvdG8SDGdycGMu",
- "dGVzdGluZxoZdGVzdC9wcm90by9tZXNzYWdlcy5wcm90bxojdGVzdC9wcm90",
- "by9iZW5jaG1hcmtzL2NvbnRyb2wucHJvdG8yqgEKEEJlbmNobWFya1NlcnZp",
- "Y2USRgoJVW5hcnlDYWxsEhsuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlcXVlc3Qa",
- "HC5ncnBjLnRlc3RpbmcuU2ltcGxlUmVzcG9uc2USTgoNU3RyZWFtaW5nQ2Fs",
- "bBIbLmdycGMudGVzdGluZy5TaW1wbGVSZXF1ZXN0GhwuZ3JwYy50ZXN0aW5n",
- "LlNpbXBsZVJlc3BvbnNlKAEwATKdAQoNV29ya2VyU2VydmljZRJFCglSdW5T",
- "ZXJ2ZXISGC5ncnBjLnRlc3RpbmcuU2VydmVyQXJncxoaLmdycGMudGVzdGlu",
- "Zy5TZXJ2ZXJTdGF0dXMoATABEkUKCVJ1bkNsaWVudBIYLmdycGMudGVzdGlu",
- "Zy5DbGllbnRBcmdzGhouZ3JwYy50ZXN0aW5nLkNsaWVudFN0YXR1cygBMAFi",
- "BnByb3RvMw=="));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbr::FileDescriptor[] { global::Grpc.Testing.Messages.Descriptor, global::Grpc.Testing.Control.Descriptor, },
+ "CiVzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3NlcnZpY2VzLnByb3RvEgxncnBj",
+ "LnRlc3RpbmcaJXNyYy9wcm90by9ncnBjL3Rlc3RpbmcvbWVzc2FnZXMucHJv",
+ "dG8aJHNyYy9wcm90by9ncnBjL3Rlc3RpbmcvY29udHJvbC5wcm90bzKqAQoQ",
+ "QmVuY2htYXJrU2VydmljZRJGCglVbmFyeUNhbGwSGy5ncnBjLnRlc3Rpbmcu",
+ "U2ltcGxlUmVxdWVzdBocLmdycGMudGVzdGluZy5TaW1wbGVSZXNwb25zZRJO",
+ "Cg1TdHJlYW1pbmdDYWxsEhsuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlcXVlc3Qa",
+ "HC5ncnBjLnRlc3RpbmcuU2ltcGxlUmVzcG9uc2UoATABMp0BCg1Xb3JrZXJT",
+ "ZXJ2aWNlEkUKCVJ1blNlcnZlchIYLmdycGMudGVzdGluZy5TZXJ2ZXJBcmdz",
+ "GhouZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXR1cygBMAESRQoJUnVuQ2xpZW50",
+ "EhguZ3JwYy50ZXN0aW5nLkNsaWVudEFyZ3MaGi5ncnBjLnRlc3RpbmcuQ2xp",
+ "ZW50U3RhdHVzKAEwAWIGcHJvdG8z"));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { global::Grpc.Testing.MessagesReflection.Descriptor, global::Grpc.Testing.ControlReflection.Descriptor, },
new pbr::GeneratedCodeInfo(null, null));
}
#endregion
diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
index ce388c6d5c..dd30afb427 100644
--- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
+++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/benchmarks/services.proto
+// source: src/proto/grpc/testing/services.proto
#region Designer generated code
using System;
@@ -32,7 +32,7 @@ namespace Grpc.Testing {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Grpc.Testing.Services.Descriptor.Services[0]; }
+ get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[0]; }
}
// client interface
@@ -132,7 +132,7 @@ namespace Grpc.Testing {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Grpc.Testing.Services.Descriptor.Services[1]; }
+ get { return global::Grpc.Testing.ServicesReflection.Descriptor.Services[1]; }
}
// client interface
diff --git a/src/csharp/Grpc.IntegrationTesting/Stats.cs b/src/csharp/Grpc.IntegrationTesting/Stats.cs
index 4ae66baffa..39c00ea88c 100644
--- a/src/csharp/Grpc.IntegrationTesting/Stats.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Stats.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/benchmarks/stats.proto
+// source: src/proto/grpc/testing/stats.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,35 +9,37 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/stats.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Stats {
+ public static partial class StatsReflection {
#region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/stats.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static Stats() {
+ static StatsReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "CiF0ZXN0L3Byb3RvL2JlbmNobWFya3Mvc3RhdHMucHJvdG8SDGdycGMudGVz",
- "dGluZyJLCgtTZXJ2ZXJTdGF0cxIUCgx0aW1lX2VsYXBzZWQYASABKAESEQoJ",
- "dGltZV91c2VyGAIgASgBEhMKC3RpbWVfc3lzdGVtGAMgASgBIjsKD0hpc3Rv",
- "Z3JhbVBhcmFtcxISCgpyZXNvbHV0aW9uGAEgASgBEhQKDG1heF9wb3NzaWJs",
- "ZRgCIAEoASJ3Cg1IaXN0b2dyYW1EYXRhEg4KBmJ1Y2tldBgBIAMoDRIQCght",
- "aW5fc2VlbhgCIAEoARIQCghtYXhfc2VlbhgDIAEoARILCgNzdW0YBCABKAES",
- "FgoOc3VtX29mX3NxdWFyZXMYBSABKAESDQoFY291bnQYBiABKAEiewoLQ2xp",
- "ZW50U3RhdHMSLgoJbGF0ZW5jaWVzGAEgASgLMhsuZ3JwYy50ZXN0aW5nLkhp",
- "c3RvZ3JhbURhdGESFAoMdGltZV9lbGFwc2VkGAIgASgBEhEKCXRpbWVfdXNl",
- "chgDIAEoARITCgt0aW1lX3N5c3RlbRgEIAEoAWIGcHJvdG8z"));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
+ "CiJzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3N0YXRzLnByb3RvEgxncnBjLnRl",
+ "c3RpbmciSwoLU2VydmVyU3RhdHMSFAoMdGltZV9lbGFwc2VkGAEgASgBEhEK",
+ "CXRpbWVfdXNlchgCIAEoARITCgt0aW1lX3N5c3RlbRgDIAEoASI7Cg9IaXN0",
+ "b2dyYW1QYXJhbXMSEgoKcmVzb2x1dGlvbhgBIAEoARIUCgxtYXhfcG9zc2li",
+ "bGUYAiABKAEidwoNSGlzdG9ncmFtRGF0YRIOCgZidWNrZXQYASADKA0SEAoI",
+ "bWluX3NlZW4YAiABKAESEAoIbWF4X3NlZW4YAyABKAESCwoDc3VtGAQgASgB",
+ "EhYKDnN1bV9vZl9zcXVhcmVzGAUgASgBEg0KBWNvdW50GAYgASgBInsKC0Ns",
+ "aWVudFN0YXRzEi4KCWxhdGVuY2llcxgBIAEoCzIbLmdycGMudGVzdGluZy5I",
+ "aXN0b2dyYW1EYXRhEhQKDHRpbWVfZWxhcHNlZBgCIAEoARIRCgl0aW1lX3Vz",
+ "ZXIYAyABKAESEwoLdGltZV9zeXN0ZW0YBCABKAFiBnByb3RvMw=="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedCodeInfo(null, new pbr::GeneratedCodeInfo[] {
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStats), new[]{ "TimeElapsed", "TimeUser", "TimeSystem" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.HistogramParams), new[]{ "Resolution", "MaxPossible" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.HistogramData), new[]{ "Bucket", "MinSeen", "MaxSeen", "Sum", "SumOfSquares", "Count" }, null, null, null),
- new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStats), new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem" }, null, null, null)
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ServerStats), global::Grpc.Testing.ServerStats.Parser, new[]{ "TimeElapsed", "TimeUser", "TimeSystem" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.HistogramParams), global::Grpc.Testing.HistogramParams.Parser, new[]{ "Resolution", "MaxPossible" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.HistogramData), global::Grpc.Testing.HistogramData.Parser, new[]{ "Bucket", "MinSeen", "MaxSeen", "Sum", "SumOfSquares", "Count" }, null, null, null),
+ new pbr::GeneratedCodeInfo(typeof(global::Grpc.Testing.ClientStats), global::Grpc.Testing.ClientStats.Parser, new[]{ "Latencies", "TimeElapsed", "TimeUser", "TimeSystem" }, null, null, null)
}));
}
#endregion
@@ -50,7 +52,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ServerStats> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[0]; }
+ get { return global::Grpc.Testing.StatsReflection.Descriptor.MessageTypes[0]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -73,8 +75,12 @@ namespace Grpc.Testing {
return new ServerStats(this);
}
+ /// <summary>Field number for the "time_elapsed" field.</summary>
public const int TimeElapsedFieldNumber = 1;
private double timeElapsed_;
+ /// <summary>
+ /// wall clock time change in seconds since last reset
+ /// </summary>
public double TimeElapsed {
get { return timeElapsed_; }
set {
@@ -82,8 +88,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "time_user" field.</summary>
public const int TimeUserFieldNumber = 2;
private double timeUser_;
+ /// <summary>
+ /// change in user time (in seconds) used by the server since last reset
+ /// </summary>
public double TimeUser {
get { return timeUser_; }
set {
@@ -91,8 +101,13 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "time_system" field.</summary>
public const int TimeSystemFieldNumber = 3;
private double timeSystem_;
+ /// <summary>
+ /// change in server time (in seconds) used by the server process and all
+ /// threads since last reset
+ /// </summary>
public double TimeSystem {
get { return timeSystem_; }
set {
@@ -126,7 +141,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -198,13 +213,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Histogram params based on grpc/support/histogram.c
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class HistogramParams : pb::IMessage<HistogramParams> {
private static readonly pb::MessageParser<HistogramParams> _parser = new pb::MessageParser<HistogramParams>(() => new HistogramParams());
public static pb::MessageParser<HistogramParams> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[1]; }
+ get { return global::Grpc.Testing.StatsReflection.Descriptor.MessageTypes[1]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -226,8 +244,12 @@ namespace Grpc.Testing {
return new HistogramParams(this);
}
+ /// <summary>Field number for the "resolution" field.</summary>
public const int ResolutionFieldNumber = 1;
private double resolution_;
+ /// <summary>
+ /// first bucket is [0, 1 + resolution)
+ /// </summary>
public double Resolution {
get { return resolution_; }
set {
@@ -235,8 +257,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "max_possible" field.</summary>
public const int MaxPossibleFieldNumber = 2;
private double maxPossible_;
+ /// <summary>
+ /// use enough buckets to allow this value
+ /// </summary>
public double MaxPossible {
get { return maxPossible_; }
set {
@@ -268,7 +294,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -326,13 +352,16 @@ namespace Grpc.Testing {
}
+ /// <summary>
+ /// Histogram data based on grpc/support/histogram.c
+ /// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public sealed partial class HistogramData : pb::IMessage<HistogramData> {
private static readonly pb::MessageParser<HistogramData> _parser = new pb::MessageParser<HistogramData>(() => new HistogramData());
public static pb::MessageParser<HistogramData> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[2]; }
+ get { return global::Grpc.Testing.StatsReflection.Descriptor.MessageTypes[2]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -358,6 +387,7 @@ namespace Grpc.Testing {
return new HistogramData(this);
}
+ /// <summary>Field number for the "bucket" field.</summary>
public const int BucketFieldNumber = 1;
private static readonly pb::FieldCodec<uint> _repeated_bucket_codec
= pb::FieldCodec.ForUInt32(10);
@@ -366,6 +396,7 @@ namespace Grpc.Testing {
get { return bucket_; }
}
+ /// <summary>Field number for the "min_seen" field.</summary>
public const int MinSeenFieldNumber = 2;
private double minSeen_;
public double MinSeen {
@@ -375,6 +406,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "max_seen" field.</summary>
public const int MaxSeenFieldNumber = 3;
private double maxSeen_;
public double MaxSeen {
@@ -384,6 +416,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "sum" field.</summary>
public const int SumFieldNumber = 4;
private double sum_;
public double Sum {
@@ -393,6 +426,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "sum_of_squares" field.</summary>
public const int SumOfSquaresFieldNumber = 5;
private double sumOfSquares_;
public double SumOfSquares {
@@ -402,6 +436,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "count" field.</summary>
public const int CountFieldNumber = 6;
private double count_;
public double Count {
@@ -443,7 +478,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
@@ -557,7 +592,7 @@ namespace Grpc.Testing {
public static pb::MessageParser<ClientStats> Parser { get { return _parser; } }
public static pbr::MessageDescriptor Descriptor {
- get { return global::Grpc.Testing.Stats.Descriptor.MessageTypes[3]; }
+ get { return global::Grpc.Testing.StatsReflection.Descriptor.MessageTypes[3]; }
}
pbr::MessageDescriptor pb::IMessage.Descriptor {
@@ -581,8 +616,12 @@ namespace Grpc.Testing {
return new ClientStats(this);
}
+ /// <summary>Field number for the "latencies" field.</summary>
public const int LatenciesFieldNumber = 1;
private global::Grpc.Testing.HistogramData latencies_;
+ /// <summary>
+ /// Latency histogram. Data points are in nanoseconds.
+ /// </summary>
public global::Grpc.Testing.HistogramData Latencies {
get { return latencies_; }
set {
@@ -590,8 +629,12 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "time_elapsed" field.</summary>
public const int TimeElapsedFieldNumber = 2;
private double timeElapsed_;
+ /// <summary>
+ /// See ServerStats for details.
+ /// </summary>
public double TimeElapsed {
get { return timeElapsed_; }
set {
@@ -599,6 +642,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "time_user" field.</summary>
public const int TimeUserFieldNumber = 3;
private double timeUser_;
public double TimeUser {
@@ -608,6 +652,7 @@ namespace Grpc.Testing {
}
}
+ /// <summary>Field number for the "time_system" field.</summary>
public const int TimeSystemFieldNumber = 4;
private double timeSystem_;
public double TimeSystem {
@@ -645,7 +690,7 @@ namespace Grpc.Testing {
}
public override string ToString() {
- return pb::JsonFormatter.Default.Format(this);
+ return pb::JsonFormatter.ToDiagnosticString(this);
}
public void WriteTo(pb::CodedOutputStream output) {
diff --git a/src/csharp/Grpc.IntegrationTesting/Test.cs b/src/csharp/Grpc.IntegrationTesting/Test.cs
index cf47707058..91e0a1e04c 100644
--- a/src/csharp/Grpc.IntegrationTesting/Test.cs
+++ b/src/csharp/Grpc.IntegrationTesting/Test.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/test.proto
+// source: src/proto/grpc/testing/test.proto
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
@@ -9,40 +9,43 @@ using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Grpc.Testing {
+ /// <summary>Holder for reflection information generated from src/proto/grpc/testing/test.proto</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
- public static partial class Test {
+ public static partial class TestReflection {
#region Descriptor
+ /// <summary>File descriptor for src/proto/grpc/testing/test.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
- static Test() {
+ static TestReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
- "ChV0ZXN0L3Byb3RvL3Rlc3QucHJvdG8SDGdycGMudGVzdGluZxoWdGVzdC9w",
- "cm90by9lbXB0eS5wcm90bxoZdGVzdC9wcm90by9tZXNzYWdlcy5wcm90bzK7",
- "BAoLVGVzdFNlcnZpY2USNQoJRW1wdHlDYWxsEhMuZ3JwYy50ZXN0aW5nLkVt",
- "cHR5GhMuZ3JwYy50ZXN0aW5nLkVtcHR5EkYKCVVuYXJ5Q2FsbBIbLmdycGMu",
- "dGVzdGluZy5TaW1wbGVSZXF1ZXN0GhwuZ3JwYy50ZXN0aW5nLlNpbXBsZVJl",
- "c3BvbnNlEmwKE1N0cmVhbWluZ091dHB1dENhbGwSKC5ncnBjLnRlc3Rpbmcu",
- "U3RyZWFtaW5nT3V0cHV0Q2FsbFJlcXVlc3QaKS5ncnBjLnRlc3RpbmcuU3Ry",
- "ZWFtaW5nT3V0cHV0Q2FsbFJlc3BvbnNlMAESaQoSU3RyZWFtaW5nSW5wdXRD",
- "YWxsEicuZ3JwYy50ZXN0aW5nLlN0cmVhbWluZ0lucHV0Q2FsbFJlcXVlc3Qa",
- "KC5ncnBjLnRlc3RpbmcuU3RyZWFtaW5nSW5wdXRDYWxsUmVzcG9uc2UoARJp",
- "Cg5GdWxsRHVwbGV4Q2FsbBIoLmdycGMudGVzdGluZy5TdHJlYW1pbmdPdXRw",
- "dXRDYWxsUmVxdWVzdBopLmdycGMudGVzdGluZy5TdHJlYW1pbmdPdXRwdXRD",
- "YWxsUmVzcG9uc2UoATABEmkKDkhhbGZEdXBsZXhDYWxsEiguZ3JwYy50ZXN0",
- "aW5nLlN0cmVhbWluZ091dHB1dENhbGxSZXF1ZXN0GikuZ3JwYy50ZXN0aW5n",
- "LlN0cmVhbWluZ091dHB1dENhbGxSZXNwb25zZSgBMAEyVQoUVW5pbXBsZW1l",
- "bnRlZFNlcnZpY2USPQoRVW5pbXBsZW1lbnRlZENhbGwSEy5ncnBjLnRlc3Rp",
- "bmcuRW1wdHkaEy5ncnBjLnRlc3RpbmcuRW1wdHkyfwoQUmVjb25uZWN0U2Vy",
- "dmljZRIxCgVTdGFydBITLmdycGMudGVzdGluZy5FbXB0eRoTLmdycGMudGVz",
- "dGluZy5FbXB0eRI4CgRTdG9wEhMuZ3JwYy50ZXN0aW5nLkVtcHR5GhsuZ3Jw",
- "Yy50ZXN0aW5nLlJlY29ubmVjdEluZm9iBnByb3RvMw=="));
- descriptor = pbr::FileDescriptor.InternalBuildGeneratedFileFrom(descriptorData,
- new pbr::FileDescriptor[] { global::Grpc.Testing.Proto.Empty.Descriptor, global::Grpc.Testing.Messages.Descriptor, },
+ "CiFzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL3Rlc3QucHJvdG8SDGdycGMudGVz",
+ "dGluZxoic3JjL3Byb3RvL2dycGMvdGVzdGluZy9lbXB0eS5wcm90bxolc3Jj",
+ "L3Byb3RvL2dycGMvdGVzdGluZy9tZXNzYWdlcy5wcm90bzK7BAoLVGVzdFNl",
+ "cnZpY2USNQoJRW1wdHlDYWxsEhMuZ3JwYy50ZXN0aW5nLkVtcHR5GhMuZ3Jw",
+ "Yy50ZXN0aW5nLkVtcHR5EkYKCVVuYXJ5Q2FsbBIbLmdycGMudGVzdGluZy5T",
+ "aW1wbGVSZXF1ZXN0GhwuZ3JwYy50ZXN0aW5nLlNpbXBsZVJlc3BvbnNlEmwK",
+ "E1N0cmVhbWluZ091dHB1dENhbGwSKC5ncnBjLnRlc3RpbmcuU3RyZWFtaW5n",
+ "T3V0cHV0Q2FsbFJlcXVlc3QaKS5ncnBjLnRlc3RpbmcuU3RyZWFtaW5nT3V0",
+ "cHV0Q2FsbFJlc3BvbnNlMAESaQoSU3RyZWFtaW5nSW5wdXRDYWxsEicuZ3Jw",
+ "Yy50ZXN0aW5nLlN0cmVhbWluZ0lucHV0Q2FsbFJlcXVlc3QaKC5ncnBjLnRl",
+ "c3RpbmcuU3RyZWFtaW5nSW5wdXRDYWxsUmVzcG9uc2UoARJpCg5GdWxsRHVw",
+ "bGV4Q2FsbBIoLmdycGMudGVzdGluZy5TdHJlYW1pbmdPdXRwdXRDYWxsUmVx",
+ "dWVzdBopLmdycGMudGVzdGluZy5TdHJlYW1pbmdPdXRwdXRDYWxsUmVzcG9u",
+ "c2UoATABEmkKDkhhbGZEdXBsZXhDYWxsEiguZ3JwYy50ZXN0aW5nLlN0cmVh",
+ "bWluZ091dHB1dENhbGxSZXF1ZXN0GikuZ3JwYy50ZXN0aW5nLlN0cmVhbWlu",
+ "Z091dHB1dENhbGxSZXNwb25zZSgBMAEyVQoUVW5pbXBsZW1lbnRlZFNlcnZp",
+ "Y2USPQoRVW5pbXBsZW1lbnRlZENhbGwSEy5ncnBjLnRlc3RpbmcuRW1wdHka",
+ "Ey5ncnBjLnRlc3RpbmcuRW1wdHkyfwoQUmVjb25uZWN0U2VydmljZRIxCgVT",
+ "dGFydBITLmdycGMudGVzdGluZy5FbXB0eRoTLmdycGMudGVzdGluZy5FbXB0",
+ "eRI4CgRTdG9wEhMuZ3JwYy50ZXN0aW5nLkVtcHR5GhsuZ3JwYy50ZXN0aW5n",
+ "LlJlY29ubmVjdEluZm9iBnByb3RvMw=="));
+ descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+ new pbr::FileDescriptor[] { global::Grpc.Testing.EmptyReflection.Descriptor, global::Grpc.Testing.MessagesReflection.Descriptor, },
new pbr::GeneratedCodeInfo(null, null));
}
#endregion
diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
index 8c884b7408..2c469080d9 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
@@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
-// source: test/proto/test.proto
+// source: src/proto/grpc/testing/test.proto
#region Designer generated code
using System;
@@ -65,7 +65,7 @@ namespace Grpc.Testing {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Grpc.Testing.Test.Descriptor.Services[0]; }
+ get { return global::Grpc.Testing.TestReflection.Descriptor.Services[0]; }
}
// client interface
@@ -223,7 +223,7 @@ namespace Grpc.Testing {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Grpc.Testing.Test.Descriptor.Services[1]; }
+ get { return global::Grpc.Testing.TestReflection.Descriptor.Services[1]; }
}
// client interface
@@ -307,7 +307,7 @@ namespace Grpc.Testing {
// service descriptor
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
- get { return global::Grpc.Testing.Test.Descriptor.Services[2]; }
+ get { return global::Grpc.Testing.TestReflection.Descriptor.Services[2]; }
}
// client interface
diff --git a/src/csharp/Grpc.IntegrationTesting/packages.config b/src/csharp/Grpc.IntegrationTesting/packages.config
index 5c59af1b7d..68490dceec 100644
--- a/src/csharp/Grpc.IntegrationTesting/packages.config
+++ b/src/csharp/Grpc.IntegrationTesting/packages.config
@@ -4,8 +4,7 @@
<package id="CommandLineParser" version="1.9.71" targetFramework="net45" />
<package id="Google.Apis.Auth" version="1.9.3" targetFramework="net45" />
<package id="Google.Apis.Core" version="1.9.3" targetFramework="net45" />
- <package id="Google.Protobuf" version="3.0.0-alpha4" targetFramework="net45" />
- <package id="Google.ProtocolBuffers" version="2.4.1.521" targetFramework="net45" />
+ <package id="Google.Protobuf" version="3.0.0-beta2" targetFramework="net45" />
<package id="Ix-Async" version="1.2.3" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net45" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
diff --git a/src/csharp/build_packages.bat b/src/csharp/build_packages.bat
index 45f6b26c66..6912dad213 100644
--- a/src/csharp/build_packages.bat
+++ b/src/csharp/build_packages.bat
@@ -3,7 +3,7 @@
@rem Current package versions
set VERSION=0.12.0
set CORE_VERSION=0.12.0
-set PROTOBUF_VERSION=3.0.0-alpha4
+set PROTOBUF_VERSION=3.0.0-beta2
@rem Packages that depend on prerelease packages (like Google.Protobuf) need to have prerelease suffix as well.
set VERSION_WITH_BETA=%VERSION%-beta
@@ -11,22 +11,45 @@ set VERSION_WITH_BETA=%VERSION%-beta
@rem Adjust the location of nuget.exe
set NUGET=C:\nuget\nuget.exe
+@rem Collect the artifacts built by the previous build step if running on Jenkins
+@rem TODO(jtattermusch): is there a better way to do this?
+xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x86\
+xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=windows\artifacts\* grpc.native.csharp\windows_x64\
+xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x86\
+xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=linux\artifacts\* grpc.native.csharp\linux_x64\
+xcopy /Y /I ..\..\architecture=x86,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x86\
+xcopy /Y /I ..\..\architecture=x64,language=csharp,platform=macos\artifacts\* grpc.native.csharp\macosx_x64\
+
+@rem Fetch all dependencies
+%NUGET% restore ..\..\vsprojects\grpc_csharp_ext.sln || goto :error
+%NUGET% restore Grpc.sln || goto :error
+
setlocal
-cd ..\..\vsprojects\nuget_package
-@call buildall.bat || goto :error
-endlocal
-@call buildall.bat BUILD_SIGNED || goto :error
+@call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" x86
-@call ..\..\vsprojects\build_plugins.bat || goto :error
+@rem We won't use the native libraries from this step, but without this Grpc.sln will fail.
+msbuild ..\..\vsprojects\grpc_csharp_ext.sln /p:Configuration=Release /p:PlatformToolset=v120 || goto :error
-%NUGET% pack ..\..\vsprojects\nuget_package\grpc.native.csharp.nuspec -Version %CORE_VERSION% || goto :error
+msbuild Grpc.sln /p:Configuration=ReleaseSigned || goto :error
+
+endlocal
+
+@rem TODO(jtattermusch): re-enable protoc plugin building
+@rem @call ..\..\vsprojects\build_plugins.bat || goto :error
+
+%NUGET% pack grpc.native.csharp\grpc.native.csharp.nuspec -Version %CORE_VERSION% || goto :error
%NUGET% pack Grpc.Auth\Grpc.Auth.nuspec -Symbols -Version %VERSION% || goto :error
%NUGET% pack Grpc.Core\Grpc.Core.nuspec -Symbols -Version %VERSION% -Properties GrpcNativeCsharpVersion=%CORE_VERSION% || goto :error
%NUGET% pack Grpc.HealthCheck\Grpc.HealthCheck.nuspec -Symbols -Version %VERSION_WITH_BETA% -Properties ProtobufVersion=%PROTOBUF_VERSION% || goto :error
-%NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error
%NUGET% pack Grpc.nuspec -Version %VERSION% || goto :error
+@rem TODO(jtattermusch): re-enable building Grpc.Tools package
+@rem %NUGET% pack Grpc.Tools.nuspec -Version %VERSION% || goto :error
+
+@rem copy resulting nuget packages to artifacts directory
+xcopy /Y /I *.nupkg ..\..\artifacts\
+
goto :EOF
:error
diff --git a/src/csharp/buildall.bat b/src/csharp/buildall.bat
index 08d4bdb335..fcc8442656 100644
--- a/src/csharp/buildall.bat
+++ b/src/csharp/buildall.bat
@@ -15,10 +15,6 @@ msbuild ..\..\vsprojects\grpc_csharp_ext.sln /p:Configuration=Release /p:Platfor
msbuild Grpc.sln /p:Configuration=Debug || goto :error
msbuild Grpc.sln /p:Configuration=Release || goto :error
-if "%1" == "BUILD_SIGNED" (
-msbuild Grpc.sln /p:Configuration=ReleaseSigned || goto :error
-)
-
endlocal
goto :EOF
diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh
index 3aeda21ba3..0261a458af 100755
--- a/src/csharp/generate_proto_csharp.sh
+++ b/src/csharp/generate_proto_csharp.sh
@@ -45,4 +45,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$HEALTHCHECK_DIR --grpc_out=$HEALTHCHECK_D
-I src/proto/grpc/health/v1alpha src/proto/grpc/health/v1alpha/health.proto
$PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \
- -I . src/proto/grpc/testing/{empty,messages,test}.proto test/proto/benchmarks/*.proto
+ -I . src/proto/grpc/testing/{control,empty,messages,payloads,services,stats,test}.proto
diff --git a/src/csharp/grpc.native.csharp/README.md b/src/csharp/grpc.native.csharp/README.md
new file mode 100644
index 0000000000..77f1cb9b1f
--- /dev/null
+++ b/src/csharp/grpc.native.csharp/README.md
@@ -0,0 +1,22 @@
+gRPC Native Nuget package
+=========================
+
+Prerequisites
+-------------
+
+NuGet binary
+
+Building the package
+--------------------
+
+To build the native package, you need precompiled versions
+of grpc_csharp_ext library artifacts for Windows, Linux and Mac.
+In the normal gRPC release process, these are built by a Jenkins
+job and they are copied to the expected location before building
+the native nuget package is attempted.
+
+See tools/run_tests/build_artifacts.py for more details how
+precompiled artifacts are built.
+
+When building the native NuGet package, ignore the "Assembly outside lib folder"
+warnings (the DLLs are not assemblies, they are native libraries).
diff --git a/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec b/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec
new file mode 100644
index 0000000000..6a1795b709
--- /dev/null
+++ b/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<package>
+ <metadata>
+ <id>grpc.native.csharp</id>
+ <version>$version$</version>
+ <authors>Google Inc.</authors>
+ <owners>grpc-packages</owners>
+ <licenseUrl>https://github.com/grpc/grpc/blob/master/LICENSE</licenseUrl>
+ <projectUrl>http://github.com/grpc/grpc</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency.</description>
+ <releaseNotes>Release of gRPC C core $version$ libraries.</releaseNotes>
+ <copyright>Copyright 2015-2016</copyright>
+ <title>gRPC C# Native Extension</title>
+ <summary>Native library required by gRPC C#</summary>
+ <tags>gRPC native</tags>
+ </metadata>
+ <files>
+ <file src="grpc.native.csharp.targets" target="\build\portable-net45+netcore45+wpa81+wp8\grpc.native.csharp.targets" />
+ <file src="windows_x86/grpc_csharp_ext.dll" target="/build/native/bin/windows_x86/grpc_csharp_ext.dll" />
+ <file src="windows_x64/grpc_csharp_ext.dll" target="/build/native/bin/windows_x64/grpc_csharp_ext.dll" />
+ <file src="linux_x86/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x86/libgrpc_csharp_ext.so" />
+ <file src="linux_x64/libgrpc_csharp_ext.so" target="/build/native/bin/linux_x64/libgrpc_csharp_ext.so" />
+ <file src="macosx_x86/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x86/libgrpc_csharp_ext.dylib" />
+ <file src="macosx_x64/libgrpc_csharp_ext.dylib" target="/build/native/bin/macosx_x64/libgrpc_csharp_ext.dylib" />
+ </files>
+</package>
diff --git a/src/csharp/grpc.native.csharp/grpc.native.csharp.targets b/src/csharp/grpc.native.csharp/grpc.native.csharp.targets
new file mode 100644
index 0000000000..501fc50548
--- /dev/null
+++ b/src/csharp/grpc.native.csharp/grpc.native.csharp.targets
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\windows_x86\grpc_csharp_ext.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\windows_x86\grpc_csharp_ext.dll</Link>
+ </Content>
+ <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\windows_x64\grpc_csharp_ext.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\windows_x64\grpc_csharp_ext.dll</Link>
+ </Content>
+ <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\linux_x86\libgrpc_csharp_ext.so">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\linux_x86\libgrpc_csharp_ext.so</Link>
+ </Content>
+ <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\linux_x64\libgrpc_csharp_ext.so">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\linux_x64\libgrpc_csharp_ext.so</Link>
+ </Content>
+ <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\macosx_x86\libgrpc_csharp_ext.dylib">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\macosx_x86\libgrpc_csharp_ext.dylib</Link>
+ </Content>
+ <Content Include="$(MSBuildThisFileDirectory)..\..\build\native\bin\macosx_x64\libgrpc_csharp_ext.dylib">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>nativelibs\macosx_x64\libgrpc_csharp_ext.dylib</Link>
+ </Content>
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/src/csharp/keys/Grpc.snk b/src/csharp/keys/Grpc.snk
new file mode 100644
index 0000000000..cbeb68d3da
--- /dev/null
+++ b/src/csharp/keys/Grpc.snk
Binary files differ
diff --git a/src/csharp/keys/README.md b/src/csharp/keys/README.md
index f3e9a3cb56..968749aa0d 100644
--- a/src/csharp/keys/README.md
+++ b/src/csharp/keys/README.md
@@ -2,4 +2,8 @@ Contents
--------
- Grpc.public.snk:
- Public key to verify strong name of gRPC assemblies. \ No newline at end of file
+ Public key to verify strong name of gRPC assemblies.
+- Grpc.snk:
+ Signing key to provide strong name of gRPC assemblies.
+ As per https://msdn.microsoft.com/en-us/library/wd40t7ad(v=vs.110).aspx
+ signing key should be checked into the repository. \ No newline at end of file