diff options
Diffstat (limited to 'src/csharp')
57 files changed, 1340 insertions, 604 deletions
diff --git a/src/csharp/Grpc.Auth/Grpc.Auth.csproj b/src/csharp/Grpc.Auth/Grpc.Auth.csproj index db55ed5a6c..9ef98529e8 100644 --- a/src/csharp/Grpc.Auth/Grpc.Auth.csproj +++ b/src/csharp/Grpc.Auth/Grpc.Auth.csproj @@ -34,32 +34,26 @@ <Reference Include="System.Net" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http.WebRequest" /> - <Reference Include="BouncyCastle.Crypto"> - <HintPath>..\packages\BouncyCastle.1.7.0\lib\Net40-Client\BouncyCastle.Crypto.dll</HintPath> - </Reference> - <Reference Include="Newtonsoft.Json"> - <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="log4net"> - <HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Core"> - <HintPath>..\packages\Google.Apis.Core.1.16.0\lib\net45\Google.Apis.Core.dll</HintPath> - </Reference> <Reference Include="Zlib.Portable"> <HintPath>..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath> </Reference> + <Reference Include="Google.Apis.Core"> + <HintPath>..\packages\Google.Apis.Core.1.21.0\lib\net45\Google.Apis.Core.dll</HintPath> + </Reference> <Reference Include="Google.Apis"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.dll</HintPath> + <HintPath>..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.dll</HintPath> </Reference> <Reference Include="Google.Apis.PlatformServices"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath> + <HintPath>..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath> </Reference> <Reference Include="Google.Apis.Auth"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.dll</HintPath> + <HintPath>..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.dll</HintPath> </Reference> <Reference Include="Google.Apis.Auth.PlatformServices"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> + <HintPath>..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Auth/packages.config b/src/csharp/Grpc.Auth/packages.config index 11c6375c63..aecc65e849 100644 --- a/src/csharp/Grpc.Auth/packages.config +++ b/src/csharp/Grpc.Auth/packages.config @@ -1,10 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="BouncyCastle" version="1.7.0" targetFramework="net45" /> - <package id="Google.Apis" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Auth" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Core" version="1.16.0" targetFramework="net45" /> - <package id="log4net" version="2.0.3" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> + <package id="Google.Apis" version="1.21.0" targetFramework="net45" /> + <package id="Google.Apis.Auth" version="1.21.0" targetFramework="net45" /> + <package id="Google.Apis.Core" version="1.21.0" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" /> <package id="Zlib.Portable.Signed" version="1.11.0" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.Auth/project.json b/src/csharp/Grpc.Auth/project.json index 3805f4759e..170149ace5 100644 --- a/src/csharp/Grpc.Auth/project.json +++ b/src/csharp/Grpc.Auth/project.json @@ -22,7 +22,7 @@ }, "dependencies": { "Grpc.Core": "1.2.0-dev", - "Google.Apis.Auth": "1.16.0" + "Google.Apis.Auth": "1.21.0" }, "frameworks": { "net45": { }, diff --git a/src/csharp/Grpc.Core.Tests/AuthContextTest.cs b/src/csharp/Grpc.Core.Tests/AuthContextTest.cs new file mode 100644 index 0000000000..f5fa469520 --- /dev/null +++ b/src/csharp/Grpc.Core.Tests/AuthContextTest.cs @@ -0,0 +1,86 @@ +#region Copyright notice and license + +// Copyright 2015, 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.Generic; +using NUnit.Framework; +using Grpc.Core; +using System.Linq; + +namespace Grpc.Core.Tests +{ + public class AuthContextTest + { + [Test] + public void EmptyContext() + { + var context = new AuthContext(null, new Dictionary<string, List<AuthProperty>>()); + Assert.IsFalse(context.IsPeerAuthenticated); + Assert.IsNull(context.PeerIdentityPropertyName); + Assert.AreEqual(0, context.PeerIdentity.Count()); + Assert.AreEqual(0, context.Properties.Count()); + Assert.AreEqual(0, context.FindPropertiesByName("nonexistent").Count()); + } + + [Test] + public void AuthenticatedContext() + { + var property1 = AuthProperty.Create("abc", new byte[] { 68, 69, 70 }); + var context = new AuthContext("some_identity", new Dictionary<string, List<AuthProperty>> + { + {"some_identity", new List<AuthProperty> {property1}} + }); + Assert.IsTrue(context.IsPeerAuthenticated); + Assert.AreEqual("some_identity", context.PeerIdentityPropertyName); + Assert.AreEqual(1, context.PeerIdentity.Count()); + } + + [Test] + public void FindPropertiesByName() + { + var property1 = AuthProperty.Create("abc", new byte[] {68, 69, 70}); + var property2 = AuthProperty.Create("abc", new byte[] {71, 72, 73 }); + var property3 = AuthProperty.Create("abc", new byte[] {}); + var context = new AuthContext(null, new Dictionary<string, List<AuthProperty>> + { + {"existent", new List<AuthProperty> {property1, property2}}, + {"foobar", new List<AuthProperty> {property3}}, + }); + Assert.AreEqual(3, context.Properties.Count()); + Assert.AreEqual(0, context.FindPropertiesByName("nonexistent").Count()); + + var existentProperties = new List<AuthProperty>(context.FindPropertiesByName("existent")); + Assert.AreEqual(2, existentProperties.Count); + } + } +} diff --git a/src/csharp/Grpc.Core.Tests/AuthPropertyTest.cs b/src/csharp/Grpc.Core.Tests/AuthPropertyTest.cs new file mode 100644 index 0000000000..745191b80d --- /dev/null +++ b/src/csharp/Grpc.Core.Tests/AuthPropertyTest.cs @@ -0,0 +1,82 @@ +#region Copyright notice and license + +// Copyright 2015, 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 NUnit.Framework; + +namespace Grpc.Core.Tests +{ + public class AuthPropertyTest + { + [Test] + public void Create_NameIsNotNull() + { + Assert.Throws(typeof(ArgumentNullException), () => AuthProperty.Create(null, new byte[0])); + Assert.Throws(typeof(ArgumentNullException), () => AuthProperty.CreateUnsafe(null, new byte[0])); + } + + [Test] + public void Create_ValueIsNotNull() + { + Assert.Throws(typeof(ArgumentNullException), () => AuthProperty.Create("abc", null)); + Assert.Throws(typeof(ArgumentNullException), () => AuthProperty.CreateUnsafe("abc", null)); + } + + [Test] + public void Create() + { + var valueBytes = new byte[] { 68, 69, 70 }; + var authProperty = AuthProperty.Create("abc", valueBytes); + + Assert.AreEqual("abc", authProperty.Name); + Assert.AreNotSame(valueBytes, authProperty.ValueBytesUnsafe); + CollectionAssert.AreEqual(valueBytes, authProperty.ValueBytes); + CollectionAssert.AreEqual(valueBytes, authProperty.ValueBytesUnsafe); + Assert.AreEqual("DEF", authProperty.Value); + } + + [Test] + public void CreateUnsafe() + { + var valueBytes = new byte[] { 68, 69, 70 }; + var authProperty = AuthProperty.CreateUnsafe("abc", valueBytes); + + Assert.AreEqual("abc", authProperty.Name); + Assert.AreSame(valueBytes, authProperty.ValueBytesUnsafe); + Assert.AreNotSame(valueBytes, authProperty.ValueBytes); + CollectionAssert.AreEqual(valueBytes, authProperty.ValueBytes); + CollectionAssert.AreEqual(valueBytes, authProperty.ValueBytesUnsafe); + Assert.AreEqual("DEF", authProperty.Value); + } + } +} diff --git a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs index 6bf9756962..3a99107c42 100644 --- a/src/csharp/Grpc.Core.Tests/ClientServerTest.cs +++ b/src/csharp/Grpc.Core.Tests/ClientServerTest.cs @@ -376,6 +376,18 @@ namespace Grpc.Core.Tests } [Test] + public void ServerCallContext_AuthContextNotPopulated() + { + helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => + { + Assert.IsFalse(context.AuthContext.IsPeerAuthenticated); + Assert.AreEqual(0, context.AuthContext.Properties.Count()); + return "PASS"; + }); + Assert.AreEqual("PASS", Calls.BlockingUnaryCall(helper.CreateUnaryCall(), "abc")); + } + + [Test] public async Task Channel_WaitForStateChangedAsync() { helper.UnaryHandler = new UnaryServerMethod<string, string>(async (request, context) => diff --git a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj index 646effe21a..a1a2e4eebd 100644 --- a/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj +++ b/src/csharp/Grpc.Core.Tests/Grpc.Core.Tests.csproj @@ -27,17 +27,17 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> - <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> - </Reference> - <Reference Include="nunitlite"> - <HintPath>..\packages\NUnitLite.3.2.0\lib\net45\nunitlite.dll</HintPath> + <Reference Include="System.Interactive.Async"> + <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> </Reference> <Reference Include="Newtonsoft.Json"> - <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> + <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> - <Reference Include="System.Interactive.Async"> - <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> + <Reference Include="nunit.framework"> + <HintPath>..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="nunitlite"> + <HintPath>..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> @@ -64,7 +64,6 @@ <Compile Include="ChannelOptionsTest.cs" /> <Compile Include="Internal\TimespecTest.cs" /> <Compile Include="TimeoutsTest.cs" /> - <Compile Include="NUnitVersionTest.cs" /> <Compile Include="ChannelTest.cs" /> <Compile Include="MockServiceHelper.cs" /> <Compile Include="ResponseHeadersTest.cs" /> @@ -81,6 +80,8 @@ <Compile Include="ShutdownHookPendingCallTest.cs" /> <Compile Include="ShutdownHookClientTest.cs" /> <Compile Include="AppDomainUnloadTest.cs" /> + <Compile Include="AuthContextTest.cs" /> + <Compile Include="AuthPropertyTest.cs" /> </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <ItemGroup> diff --git a/src/csharp/Grpc.Core.Tests/TestResult.xml b/src/csharp/Grpc.Core.Tests/TestResult.xml deleted file mode 100644 index 13da80739c..0000000000 --- a/src/csharp/Grpc.Core.Tests/TestResult.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="no"?> -<!--This file represents the results of running a test suite--> -<test-results name="/usr/local/google/home/jtattermusch/github/grpc/src/csharp/GrpcCoreTests/bin/Debug/GrpcCoreTests.dll" total="3" errors="0" failures="0" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2015-01-29" time="19:40:47"> - <environment nunit-version="2.6.0.0" clr-version="4.0.30319.17020" os-version="Unix 3.13.0.43" platform="Unix" cwd="/usr/local/google/home/jtattermusch/github/grpc/src/csharp/GrpcCoreTests" machine-name="jtattermusch.mtv.corp.google.com" user="jtattermusch" user-domain="jtattermusch.mtv.corp.google.com" /> - <culture-info current-culture="en-US" current-uiculture="en-US" /> - <test-suite type="Assembly" name="/usr/local/google/home/jtattermusch/github/grpc/src/csharp/GrpcCoreTests/bin/Debug/GrpcCoreTests.dll" executed="True" result="Success" success="True" time="0.172" asserts="0"> - <results> - <test-suite type="Namespace" name="Google" executed="True" result="Success" success="True" time="0.166" asserts="0"> - <results> - <test-suite type="Namespace" name="GRPC" executed="True" result="Success" success="True" time="0.166" asserts="0"> - <results> - <test-suite type="Namespace" name="Core" executed="True" result="Success" success="True" time="0.166" asserts="0"> - <results> - <test-suite type="Namespace" name="Tests" executed="True" result="Success" success="True" time="0.166" asserts="0"> - <results> - <test-suite type="TestFixture" name="CallsTest" executed="True" result="Success" success="True" time="0.009" asserts="0"> - <results> - <test-case name="Grpc.Core.Tests.CallsTest.Test1" executed="True" result="Success" success="True" time="0.004" asserts="0" /> - </results> - </test-suite> - <test-suite type="TestFixture" name="ClientServerTest" executed="True" result="Success" success="True" time="0.149" asserts="0"> - <results> - <test-case name="Grpc.Core.Tests.ClientServerTest.EmptyCall" executed="True" result="Success" success="True" time="0.111" asserts="0" /> - </results> - </test-suite> - <test-suite type="TestFixture" name="ServerTest" executed="True" result="Success" success="True" time="0.001" asserts="0"> - <results> - <test-case name="Grpc.Core.Tests.ServerTest.StartAndShutdownServer" executed="True" result="Success" success="True" time="0.001" asserts="0" /> - </results> - </test-suite> - </results> - </test-suite> - </results> - </test-suite> - </results> - </test-suite> - </results> - </test-suite> - </results> - </test-suite> -</test-results>
\ No newline at end of file diff --git a/src/csharp/Grpc.Core.Tests/packages.config b/src/csharp/Grpc.Core.Tests/packages.config index 4750735fad..994a278762 100644 --- a/src/csharp/Grpc.Core.Tests/packages.config +++ b/src/csharp/Grpc.Core.Tests/packages.config @@ -1,9 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> - <package id="NUnit" version="3.2.0" targetFramework="net45" /> - <package id="NUnit.ConsoleRunner" version="3.2.0" /> - <package id="NUnitLite" version="3.2.0" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" /> + <package id="NUnit" version="3.6.0" targetFramework="net45" /> + <package id="NUnitLite" version="3.6.0" targetFramework="net45" /> <package id="OpenCover" version="4.6.519" /> <package id="ReportGenerator" version="2.4.4.0" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> diff --git a/src/csharp/Grpc.Core.Tests/project.json b/src/csharp/Grpc.Core.Tests/project.json index 045207a413..14e5ed51ad 100644 --- a/src/csharp/Grpc.Core.Tests/project.json +++ b/src/csharp/Grpc.Core.Tests/project.json @@ -45,10 +45,10 @@ "Grpc.Core": { "target": "project" }, - "Newtonsoft.Json": "8.0.3", - "NUnit": "3.2.0", - "NUnitLite": "3.2.0-*", - "NUnit.ConsoleRunner": "3.2.0", + "Newtonsoft.Json": "9.0.1", + "NUnit": "3.6.0", + "NUnitLite": "3.6.0", + "NUnit.ConsoleRunner": "3.6.0", "OpenCover": "4.6.519", "ReportGenerator": "2.4.4.0" }, diff --git a/src/csharp/Grpc.Core/AuthContext.cs b/src/csharp/Grpc.Core/AuthContext.cs new file mode 100644 index 0000000000..340b2201c7 --- /dev/null +++ b/src/csharp/Grpc.Core/AuthContext.cs @@ -0,0 +1,128 @@ +#region Copyright notice and license + +// Copyright 2015, 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.Generic; +using System.Linq; +using Grpc.Core.Internal; +using Grpc.Core.Utils; + +namespace Grpc.Core +{ + /// <summary> + /// Authentication context for a call. + /// AuthContext is the only reliable source of truth when it comes to authenticating calls. + /// Using any other call/context properties for authentication purposes is wrong and inherently unsafe. + /// Note: experimental API that can change or be removed without any prior notice. + /// </summary> + public class AuthContext + { + string peerIdentityPropertyName; + Dictionary<string, List<AuthProperty>> properties; + + /// <summary> + /// Initializes a new instance of the <see cref="T:Grpc.Core.AuthContext"/> class. + /// </summary> + /// <param name="peerIdentityPropertyName">Peer identity property name.</param> + /// <param name="properties">Multimap of auth properties by name.</param> + internal AuthContext(string peerIdentityPropertyName, Dictionary<string, List<AuthProperty>> properties) + { + this.peerIdentityPropertyName = peerIdentityPropertyName; + this.properties = GrpcPreconditions.CheckNotNull(properties); + } + + /// <summary> + /// Returns <c>true</c> if the peer is authenticated. + /// </summary> + public bool IsPeerAuthenticated + { + get + { + return peerIdentityPropertyName != null; + } + } + + /// <summary> + /// Gets the name of the property that indicates the peer identity. Returns <c>null</c> + /// if the peer is not authenticated. + /// </summary> + public string PeerIdentityPropertyName + { + get + { + return peerIdentityPropertyName; + } + } + + /// <summary> + /// Gets properties that represent the peer identity (there can be more than one). Returns an empty collection + /// if the peer is not authenticated. + /// </summary> + public IEnumerable<AuthProperty> PeerIdentity + { + get + { + if (peerIdentityPropertyName == null) + { + return Enumerable.Empty<AuthProperty>(); + } + return properties[peerIdentityPropertyName]; + } + } + + /// <summary> + /// Gets the auth properties of this context. + /// </summary> + public IEnumerable<AuthProperty> Properties + { + get + { + return properties.Values.SelectMany(v => v); + } + } + + /// <summary> + /// Returns the auth properties with given name (there can be more than one). + /// If no properties of given name exist, an empty collection will be returned. + /// </summary> + public IEnumerable<AuthProperty> FindPropertiesByName(string propertyName) + { + List<AuthProperty> result; + if (!properties.TryGetValue(propertyName, out result)) + { + return Enumerable.Empty<AuthProperty>(); + } + return result; + } + } +} diff --git a/src/csharp/Grpc.Core/AuthProperty.cs b/src/csharp/Grpc.Core/AuthProperty.cs new file mode 100644 index 0000000000..c7a132b09e --- /dev/null +++ b/src/csharp/Grpc.Core/AuthProperty.cs @@ -0,0 +1,126 @@ +#region Copyright notice and license + +// Copyright 2015, 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.Generic; +using System.Linq; +using Grpc.Core.Internal; +using Grpc.Core.Utils; + +namespace Grpc.Core +{ + /// <summary> + /// A property of an <see cref="AuthContext"/>. + /// Note: experimental API that can change or be removed without any prior notice. + /// </summary> + public class AuthProperty + { + string name; + byte[] valueBytes; + Lazy<string> value; + + private AuthProperty(string name, byte[] valueBytes) + { + this.name = GrpcPreconditions.CheckNotNull(name); + this.valueBytes = GrpcPreconditions.CheckNotNull(valueBytes); + this.value = new Lazy<string>(() => MarshalUtils.GetStringUTF8(this.valueBytes)); + } + + /// <summary> + /// Gets the name of the property. + /// </summary> + public string Name + { + get + { + return name; + } + } + + /// <summary> + /// Gets the string value of the property. + /// </summary> + public string Value + { + get + { + return value.Value; + } + } + + /// <summary> + /// Gets the binary value of the property. + /// </summary> + public byte[] ValueBytes + { + get + { + var valueCopy = new byte[valueBytes.Length]; + Buffer.BlockCopy(valueBytes, 0, valueCopy, 0, valueBytes.Length); + return valueCopy; + } + } + + /// <summary> + /// Creates an instance of <c>AuthProperty</c>. + /// </summary> + /// <param name="name">the name</param> + /// <param name="valueBytes">the binary value of the property</param> + public static AuthProperty Create(string name, byte[] valueBytes) + { + GrpcPreconditions.CheckNotNull(valueBytes); + var valueCopy = new byte[valueBytes.Length]; + Buffer.BlockCopy(valueBytes, 0, valueCopy, 0, valueBytes.Length); + return new AuthProperty(name, valueCopy); + } + + /// <summary> + /// Gets the binary value of the property (without making a defensive copy). + /// </summary> + internal byte[] ValueBytesUnsafe + { + get + { + return valueBytes; + } + } + + /// <summary> + /// Creates and instance of <c>AuthProperty</c> without making a defensive copy of <c>valueBytes</c>. + /// </summary> + internal static AuthProperty CreateUnsafe(string name, byte[] valueBytes) + { + return new AuthProperty(name, valueBytes); + } + } +} diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj index 23e1ddcf7f..d6d8dfac22 100644 --- a/src/csharp/Grpc.Core/Grpc.Core.csproj +++ b/src/csharp/Grpc.Core/Grpc.Core.csproj @@ -131,6 +131,10 @@ <Compile Include="Internal\RequestCallContextSafeHandle.cs" /> <Compile Include="Utils\TaskUtils.cs" /> <Compile Include="Internal\CallFlags.cs" /> + <Compile Include="AuthContext.cs" /> + <Compile Include="Internal\AuthContextSafeHandle.cs" /> + <Compile Include="Internal\MarshalUtils.cs" /> + <Compile Include="AuthProperty.cs" /> </ItemGroup> <ItemGroup> <None Include="Grpc.Core.project.json" /> diff --git a/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs new file mode 100644 index 0000000000..59e33a0fdf --- /dev/null +++ b/src/csharp/Grpc.Core/Internal/AuthContextSafeHandle.cs @@ -0,0 +1,119 @@ +#region Copyright notice and license + +// Copyright 2017, 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.Generic; +using System.Runtime.InteropServices; +using System.Text; +using Grpc.Core; +using Grpc.Core.Utils; + +namespace Grpc.Core.Internal +{ + /// <summary> + /// grpc_auth_context + /// </summary> + internal class AuthContextSafeHandle : SafeHandleZeroIsInvalid + { + static readonly NativeMethods Native = NativeMethods.Get(); + + private AuthContextSafeHandle() + { + } + + /// <summary> + /// Copies contents of the native auth context into a new <c>AuthContext</c> instance. + /// </summary> + public AuthContext ToAuthContext() + { + if (IsInvalid) + { + return new AuthContext(null, new Dictionary<string, List<AuthProperty>>()); + } + + var peerIdentityPropertyName = Marshal.PtrToStringAnsi(Native.grpcsharp_auth_context_peer_identity_property_name(this)); + + var propertiesDict = new Dictionary<string, List<AuthProperty>>(); + + var it = Native.grpcsharp_auth_context_property_iterator(this); + IntPtr authPropertyPtr = IntPtr.Zero; + while ((authPropertyPtr = Native.grpcsharp_auth_property_iterator_next(ref it)) != IntPtr.Zero) + { + var authProperty = PtrToAuthProperty(authPropertyPtr); + + if (!propertiesDict.ContainsKey(authProperty.Name)) + { + propertiesDict[authProperty.Name] = new List<AuthProperty>(); + } + propertiesDict[authProperty.Name].Add(authProperty); + } + + return new AuthContext(peerIdentityPropertyName, propertiesDict); + } + + protected override bool ReleaseHandle() + { + Native.grpcsharp_auth_context_release(handle); + return true; + } + + private AuthProperty PtrToAuthProperty(IntPtr authPropertyPtr) + { + var nativeAuthProperty = (NativeAuthProperty) Marshal.PtrToStructure(authPropertyPtr, typeof(NativeAuthProperty)); + var name = Marshal.PtrToStringAnsi(nativeAuthProperty.Name); + var valueBytes = new byte[(int) nativeAuthProperty.ValueLength]; + Marshal.Copy(nativeAuthProperty.Value, valueBytes, 0, (int)nativeAuthProperty.ValueLength); + return AuthProperty.CreateUnsafe(name, valueBytes); + } + + /// <summary> + /// grpc_auth_property + /// </summary> + internal struct NativeAuthProperty + { + public IntPtr Name; + public IntPtr Value; + public UIntPtr ValueLength; + } + + /// <summary> + /// grpc_auth_property_iterator + /// </summary> + internal struct NativeAuthPropertyIterator + { + public IntPtr AuthContext; + public UIntPtr Index; + public IntPtr Name; + } + } +} diff --git a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs index efae149f09..6dee6d8c35 100644 --- a/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/BatchContextSafeHandle.cs @@ -43,7 +43,6 @@ namespace Grpc.Core.Internal /// </summary> internal class BatchContextSafeHandle : SafeHandleZeroIsInvalid { - static readonly Encoding EncodingUTF8 = System.Text.Encoding.UTF8; static readonly NativeMethods Native = NativeMethods.Get(); private BatchContextSafeHandle() @@ -75,7 +74,7 @@ namespace Grpc.Core.Internal { UIntPtr detailsLength; IntPtr detailsPtr = Native.grpcsharp_batch_context_recv_status_on_client_details(this, out detailsLength); - string details = PtrToStringUtf8(detailsPtr, (int) detailsLength.ToUInt32()); + string details = MarshalUtils.PtrToStringUTF8(detailsPtr, (int) detailsLength.ToUInt32()); var status = new Status(Native.grpcsharp_batch_context_recv_status_on_client_status(this), details); IntPtr metadataArrayPtr = Native.grpcsharp_batch_context_recv_status_on_client_trailing_metadata(this); @@ -108,12 +107,5 @@ namespace Grpc.Core.Internal Native.grpcsharp_batch_context_destroy(handle); return true; } - - string PtrToStringUtf8(IntPtr ptr, int len) - { - var bytes = new byte[len]; - Marshal.Copy(ptr, bytes, 0, len); - return EncodingUTF8.GetString(bytes); - } } } diff --git a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs index 710ca480e8..3c368fbc6c 100644 --- a/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs +++ b/src/csharp/Grpc.Core/Internal/CallSafeHandle.cs @@ -45,7 +45,6 @@ namespace Grpc.Core.Internal internal class CallSafeHandle : SafeHandleZeroIsInvalid, INativeCall { public static readonly CallSafeHandle NullInstance = new CallSafeHandle(); - static readonly Encoding EncodingUTF8 = System.Text.Encoding.UTF8; static readonly NativeMethods Native = NativeMethods.Get(); const uint GRPC_WRITE_BUFFER_HINT = 1; @@ -140,7 +139,7 @@ namespace Grpc.Core.Internal var ctx = BatchContextSafeHandle.Create(); var optionalPayloadLength = optionalPayload != null ? new UIntPtr((ulong)optionalPayload.Length) : UIntPtr.Zero; completionQueue.CompletionRegistry.RegisterBatchCompletion(ctx, (success, context) => callback(success)); - var statusDetailBytes = EncodingUTF8.GetBytes(status.Detail); + var statusDetailBytes = MarshalUtils.GetBytesUTF8(status.Detail); Native.grpcsharp_call_send_status_from_server(this, ctx, status.StatusCode, statusDetailBytes, new UIntPtr((ulong)statusDetailBytes.Length), metadataArray, sendEmptyInitialMetadata, optionalPayload, optionalPayloadLength, writeFlags).CheckOk(); } @@ -204,6 +203,11 @@ namespace Grpc.Core.Internal } } + public AuthContextSafeHandle GetAuthContext() + { + return Native.grpcsharp_call_auth_context(this); + } + protected override bool ReleaseHandle() { Native.grpcsharp_call_destroy(handle); diff --git a/src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs b/src/csharp/Grpc.Core/Internal/MarshalUtils.cs index 1a9e441611..897e2f70bb 100644 --- a/src/csharp/Grpc.Core.Tests/NUnitVersionTest.cs +++ b/src/csharp/Grpc.Core/Internal/MarshalUtils.cs @@ -32,46 +32,59 @@ #endregion using System; -using System.Threading; -using System.Threading.Tasks; -using Grpc.Core; -using Grpc.Core.Internal; -using Grpc.Core.Utils; -using NUnit.Framework; +using System.Runtime.InteropServices; +using System.Text; -namespace Grpc.Core.Tests +namespace Grpc.Core.Internal { /// <summary> - /// Tests if the version of nunit-console used is sufficient to run async tests. + /// Useful methods for native/managed marshalling. /// </summary> - public class NUnitVersionTest + internal static class MarshalUtils { - private int testRunCount = 0; + static readonly Encoding EncodingUTF8 = System.Text.Encoding.UTF8; + static readonly Encoding EncodingASCII = System.Text.Encoding.ASCII; - [TestFixtureTearDown] - public void Cleanup() + /// <summary> + /// Converts <c>IntPtr</c> pointing to a UTF-8 encoded byte array to <c>string</c>. + /// </summary> + public static string PtrToStringUTF8(IntPtr ptr, int len) { - if (testRunCount != 2) - { - Console.Error.WriteLine("You are using and old version of NUnit that doesn't support async tests and skips them instead. " + - "This test has failed to indicate that."); - Console.Error.Flush(); - throw new Exception("NUnitVersionTest has failed."); - } + var bytes = new byte[len]; + Marshal.Copy(ptr, bytes, 0, len); + return EncodingUTF8.GetString(bytes); } - [Test] - public void NUnitVersionTest1() + /// <summary> + /// Returns byte array containing UTF-8 encoding of given string. + /// </summary> + public static byte[] GetBytesUTF8(string str) { - testRunCount++; + return EncodingUTF8.GetBytes(str); } - // Old version of NUnit will skip this test - [Test] - public async Task NUnitVersionTest2() + /// <summary> + /// Get string from a UTF8 encoded byte array. + /// </summary> + public static string GetStringUTF8(byte[] bytes) { - testRunCount++; - await Task.Delay(10); + return EncodingUTF8.GetString(bytes); + } + + /// <summary> + /// Returns byte array containing ASCII encoding of given string. + /// </summary> + public static byte[] GetBytesASCII(string str) + { + return EncodingASCII.GetBytes(str); + } + + /// <summary> + /// Get string from an ASCII encoded byte array. + /// </summary> + public static string GetStringASCII(byte[] bytes) + { + return EncodingASCII.GetString(bytes); } } } diff --git a/src/csharp/Grpc.Core/Internal/NativeMethods.cs b/src/csharp/Grpc.Core/Internal/NativeMethods.cs index aff9550e8d..dd65f05217 100644 --- a/src/csharp/Grpc.Core/Internal/NativeMethods.cs +++ b/src/csharp/Grpc.Core/Internal/NativeMethods.cs @@ -148,6 +148,12 @@ namespace Grpc.Core.Internal 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.grpcsharp_call_auth_context_delegate grpcsharp_call_auth_context; + public readonly Delegates.grpcsharp_auth_context_peer_identity_property_name_delegate grpcsharp_auth_context_peer_identity_property_name; + public readonly Delegates.grpcsharp_auth_context_property_iterator_delegate grpcsharp_auth_context_property_iterator; + public readonly Delegates.grpcsharp_auth_property_iterator_next_delegate grpcsharp_auth_property_iterator_next; + public readonly Delegates.grpcsharp_auth_context_release_delegate grpcsharp_auth_context_release; + 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; @@ -256,6 +262,12 @@ namespace Grpc.Core.Internal 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.grpcsharp_call_auth_context = GetMethodDelegate<Delegates.grpcsharp_call_auth_context_delegate>(library); + this.grpcsharp_auth_context_peer_identity_property_name = GetMethodDelegate<Delegates.grpcsharp_auth_context_peer_identity_property_name_delegate>(library); + this.grpcsharp_auth_context_property_iterator = GetMethodDelegate<Delegates.grpcsharp_auth_context_property_iterator_delegate>(library); + this.grpcsharp_auth_property_iterator_next = GetMethodDelegate<Delegates.grpcsharp_auth_property_iterator_next_delegate>(library); + this.grpcsharp_auth_context_release = GetMethodDelegate<Delegates.grpcsharp_auth_context_release_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); @@ -404,6 +416,12 @@ namespace Grpc.Core.Internal 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 AuthContextSafeHandle grpcsharp_call_auth_context_delegate(CallSafeHandle call); + public delegate IntPtr grpcsharp_auth_context_peer_identity_property_name_delegate(AuthContextSafeHandle authContext); // returns const char* + public delegate AuthContextSafeHandle.NativeAuthPropertyIterator grpcsharp_auth_context_property_iterator_delegate(AuthContextSafeHandle authContext); + public delegate IntPtr grpcsharp_auth_property_iterator_next_delegate(ref AuthContextSafeHandle.NativeAuthPropertyIterator iterator); // returns const auth_property* + public delegate void grpcsharp_auth_context_release_delegate(IntPtr authContext); + public delegate Timespec gprsharp_now_delegate(ClockType clockType); public delegate Timespec gprsharp_inf_future_delegate(ClockType clockType); public delegate Timespec gprsharp_inf_past_delegate(ClockType clockType); diff --git a/src/csharp/Grpc.Core/Metadata.cs b/src/csharp/Grpc.Core/Metadata.cs index 6fc715d6ee..6e195b49cc 100644 --- a/src/csharp/Grpc.Core/Metadata.cs +++ b/src/csharp/Grpc.Core/Metadata.cs @@ -32,12 +32,10 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Collections.Specialized; -using System.Globalization; -using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; +using Grpc.Core.Internal; using Grpc.Core.Utils; namespace Grpc.Core @@ -242,7 +240,6 @@ namespace Grpc.Core /// </summary> public class Entry { - private static readonly Encoding Encoding = Encoding.ASCII; private static readonly Regex ValidKeyRegex = new Regex("^[a-z0-9_-]+$"); readonly string key; @@ -306,7 +303,7 @@ namespace Grpc.Core { if (valueBytes == null) { - return Encoding.GetBytes(value); + return MarshalUtils.GetBytesASCII(value); } // defensive copy to guarantee immutability @@ -324,7 +321,7 @@ namespace Grpc.Core get { GrpcPreconditions.CheckState(!IsBinary, "Cannot access string value of a binary metadata entry"); - return value ?? Encoding.GetString(valueBytes); + return value ?? MarshalUtils.GetStringASCII(valueBytes); } } @@ -358,7 +355,7 @@ namespace Grpc.Core /// </summary> internal byte[] GetSerializedValueUnsafe() { - return valueBytes ?? Encoding.GetBytes(value); + return valueBytes ?? MarshalUtils.GetBytesASCII(value); } /// <summary> @@ -371,7 +368,7 @@ namespace Grpc.Core { return new Entry(key, null, valueBytes); } - return new Entry(key, Encoding.GetString(valueBytes), null); + return new Entry(key, MarshalUtils.GetStringASCII(valueBytes), null); } private static string NormalizeKey(string key) diff --git a/src/csharp/Grpc.Core/ServerCallContext.cs b/src/csharp/Grpc.Core/ServerCallContext.cs index 8f28fbc045..c8950b7677 100644 --- a/src/csharp/Grpc.Core/ServerCallContext.cs +++ b/src/csharp/Grpc.Core/ServerCallContext.cs @@ -32,7 +32,6 @@ #endregion using System; -using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; @@ -56,6 +55,7 @@ namespace Grpc.Core private Status status = Status.DefaultSuccess; private Func<Metadata, Task> writeHeadersFunc; private IHasWriteOptions writeOptionsHolder; + private Lazy<AuthContext> authContext; internal ServerCallContext(CallSafeHandle callHandle, string method, string host, DateTime deadline, Metadata requestHeaders, CancellationToken cancellationToken, Func<Metadata, Task> writeHeadersFunc, IHasWriteOptions writeOptionsHolder) @@ -68,6 +68,7 @@ namespace Grpc.Core this.cancellationToken = cancellationToken; this.writeHeadersFunc = writeHeadersFunc; this.writeOptionsHolder = writeOptionsHolder; + this.authContext = new Lazy<AuthContext>(GetAuthContextEager); } /// <summary> @@ -187,6 +188,26 @@ namespace Grpc.Core writeOptionsHolder.WriteOptions = value; } } + + /// <summary> + /// Gets the <c>AuthContext</c> associated with this call. + /// Note: Access to AuthContext is an experimental API that can change without any prior notice. + /// </summary> + public AuthContext AuthContext + { + get + { + return authContext.Value; + } + } + + private AuthContext GetAuthContextEager() + { + using (var authContextNative = callHandle.GetAuthContext()) + { + return authContextNative.ToAuthContext(); + } + } } /// <summary> diff --git a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj index d22fe87825..c96243b1c7 100644 --- a/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj +++ b/src/csharp/Grpc.Examples.Tests/Grpc.Examples.Tests.csproj @@ -27,17 +27,17 @@ </PropertyGroup> <ItemGroup> <Reference Include="System" /> + <Reference Include="System.Interactive.Async"> + <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> + </Reference> <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> + <HintPath>..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll</HintPath> </Reference> <Reference Include="nunitlite"> - <HintPath>..\packages\NUnitLite.3.2.0\lib\net45\nunitlite.dll</HintPath> + <HintPath>..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll</HintPath> </Reference> <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> - </Reference> - <Reference Include="System.Interactive.Async"> - <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Examples.Tests/packages.config b/src/csharp/Grpc.Examples.Tests/packages.config index 0fed4dbd41..8a7f7a0652 100644 --- a/src/csharp/Grpc.Examples.Tests/packages.config +++ b/src/csharp/Grpc.Examples.Tests/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0" targetFramework="net45" /> - <package id="NUnit" version="3.2.0" targetFramework="net45" /> - <package id="NUnitLite" version="3.2.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> + <package id="NUnit" version="3.6.0" targetFramework="net45" /> + <package id="NUnitLite" version="3.6.0" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.Examples.Tests/project.json b/src/csharp/Grpc.Examples.Tests/project.json index e509621a29..4ffcaf57fd 100644 --- a/src/csharp/Grpc.Examples.Tests/project.json +++ b/src/csharp/Grpc.Examples.Tests/project.json @@ -45,8 +45,8 @@ "Grpc.Examples": { "target": "project" }, - "NUnit": "3.2.0", - "NUnitLite": "3.2.0-*" + "NUnit": "3.6.0", + "NUnitLite": "3.6.0" }, "frameworks": { "net45": { }, diff --git a/src/csharp/Grpc.Examples/Grpc.Examples.csproj b/src/csharp/Grpc.Examples/Grpc.Examples.csproj index 44acb6c2e3..fc927543f7 100644 --- a/src/csharp/Grpc.Examples/Grpc.Examples.csproj +++ b/src/csharp/Grpc.Examples/Grpc.Examples.csproj @@ -3,8 +3,6 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>10.0.0</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{7DC1433E-3225-42C7-B7EA-546D56E27A4B}</ProjectGuid> <OutputType>Library</OutputType> <RootNamespace>Grpc.Examples</RootNamespace> @@ -28,17 +26,17 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> - </Reference> <Reference Include="System" /> <Reference Include="System.Data.Linq" /> - <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> - </Reference> <Reference Include="System.Interactive.Async"> <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> </Reference> + <Reference Include="nunit.framework"> + <HintPath>..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="Google.Protobuf"> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\Grpc.Core\Version.cs"> diff --git a/src/csharp/Grpc.Examples/packages.config b/src/csharp/Grpc.Examples/packages.config index c7db26bd64..79a898081e 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" targetFramework="net45" /> - <package id="NUnit" version="3.2.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> + <package id="NUnit" version="3.6.0" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.Examples/project.json b/src/csharp/Grpc.Examples/project.json index 21a730cb22..3ee0a71356 100644 --- a/src/csharp/Grpc.Examples/project.json +++ b/src/csharp/Grpc.Examples/project.json @@ -6,15 +6,10 @@ "Grpc.Core": { "target": "project" }, - "Google.Protobuf": "3.0.0" + "Google.Protobuf": "3.2.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { diff --git a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj index b82f976861..71f0ee19b8 100644 --- a/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj +++ b/src/csharp/Grpc.HealthCheck.Tests/Grpc.HealthCheck.Tests.csproj @@ -35,14 +35,14 @@ <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> + <Reference Include="Google.Protobuf"> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> + <HintPath>..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll</HintPath> </Reference> <Reference Include="nunitlite"> - <HintPath>..\packages\NUnitLite.3.2.0\lib\net45\nunitlite.dll</HintPath> - </Reference> - <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> + <HintPath>..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.HealthCheck.Tests/packages.config b/src/csharp/Grpc.HealthCheck.Tests/packages.config index e796d6b135..48c94bc4a3 100644 --- a/src/csharp/Grpc.HealthCheck.Tests/packages.config +++ b/src/csharp/Grpc.HealthCheck.Tests/packages.config @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0" targetFramework="net45" /> - <package id="NUnit" version="3.2.0" targetFramework="net45" /> - <package id="NUnitLite" version="3.2.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> + <package id="NUnit" version="3.6.0" targetFramework="net45" /> + <package id="NUnitLite" version="3.6.0" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.HealthCheck.Tests/project.json b/src/csharp/Grpc.HealthCheck.Tests/project.json index 654454d1cb..2814cbfe46 100644 --- a/src/csharp/Grpc.HealthCheck.Tests/project.json +++ b/src/csharp/Grpc.HealthCheck.Tests/project.json @@ -45,8 +45,8 @@ "Grpc.HealthCheck": { "target": "project" }, - "NUnit": "3.2.0", - "NUnitLite": "3.2.0-*" + "NUnit": "3.6.0", + "NUnitLite": "3.6.0" }, "frameworks": { "net45": { }, diff --git a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj index 63aa18584d..171525b708 100644 --- a/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj +++ b/src/csharp/Grpc.HealthCheck/Grpc.HealthCheck.csproj @@ -36,12 +36,12 @@ <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> - <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> - </Reference> <Reference Include="System.Interactive.Async"> <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> </Reference> + <Reference Include="Google.Protobuf"> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\Grpc.Core\Version.cs"> diff --git a/src/csharp/Grpc.HealthCheck/packages.config b/src/csharp/Grpc.HealthCheck/packages.config index 5ab40b7a8c..eec292b306 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" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.HealthCheck/project.json b/src/csharp/Grpc.HealthCheck/project.json index 5d3b2f554b..9e9d245cae 100644 --- a/src/csharp/Grpc.HealthCheck/project.json +++ b/src/csharp/Grpc.HealthCheck/project.json @@ -22,15 +22,10 @@ }, "dependencies": { "Grpc.Core": "1.2.0-dev", - "Google.Protobuf": "3.0.0" + "Google.Protobuf": "3.2.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netstandard1.5": { "dependencies": { "NETStandard.Library": "1.6.0" diff --git a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj index 6bb5f33966..a793f3f6df 100644 --- a/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj +++ b/src/csharp/Grpc.IntegrationTesting.Client/Grpc.IntegrationTesting.Client.csproj @@ -34,33 +34,6 @@ <Reference Include="System.Net" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http.WebRequest" /> - <Reference Include="BouncyCastle.Crypto"> - <HintPath>..\packages\BouncyCastle.1.7.0\lib\Net40-Client\BouncyCastle.Crypto.dll</HintPath> - </Reference> - <Reference Include="Newtonsoft.Json"> - <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="log4net"> - <HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Core"> - <HintPath>..\packages\Google.Apis.Core.1.16.0\lib\net45\Google.Apis.Core.dll</HintPath> - </Reference> - <Reference Include="Zlib.Portable"> - <HintPath>..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath> - </Reference> - <Reference Include="Google.Apis"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.PlatformServices"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Auth"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Auth.PlatformServices"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> - </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\Grpc.Core\Version.cs"> @@ -82,6 +55,5 @@ </ItemGroup> <ItemGroup> <None Include="Grpc.IntegrationTesting.Client.project.json" /> - <None Include="packages.config" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.Client/packages.config b/src/csharp/Grpc.IntegrationTesting.Client/packages.config deleted file mode 100644 index 11c6375c63..0000000000 --- a/src/csharp/Grpc.IntegrationTesting.Client/packages.config +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="BouncyCastle" version="1.7.0" targetFramework="net45" /> - <package id="Google.Apis" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Auth" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Core" version="1.16.0" targetFramework="net45" /> - <package id="log4net" version="2.0.3" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> - <package id="Zlib.Portable.Signed" version="1.11.0" targetFramework="net45" /> -</packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.QpsWorker/packages.config b/src/csharp/Grpc.IntegrationTesting.QpsWorker/packages.config deleted file mode 100644 index 79ece06bef..0000000000 --- a/src/csharp/Grpc.IntegrationTesting.QpsWorker/packages.config +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> -</packages> diff --git a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj index 081dc24fbf..80d36363f7 100644 --- a/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj +++ b/src/csharp/Grpc.IntegrationTesting.Server/Grpc.IntegrationTesting.Server.csproj @@ -34,33 +34,6 @@ <Reference Include="System.Net" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http.WebRequest" /> - <Reference Include="BouncyCastle.Crypto"> - <HintPath>..\packages\BouncyCastle.1.7.0\lib\Net40-Client\BouncyCastle.Crypto.dll</HintPath> - </Reference> - <Reference Include="Newtonsoft.Json"> - <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="log4net"> - <HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Core"> - <HintPath>..\packages\Google.Apis.Core.1.16.0\lib\net45\Google.Apis.Core.dll</HintPath> - </Reference> - <Reference Include="Zlib.Portable"> - <HintPath>..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath> - </Reference> - <Reference Include="Google.Apis"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.PlatformServices"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Auth"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.dll</HintPath> - </Reference> - <Reference Include="Google.Apis.Auth.PlatformServices"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> - </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\Grpc.Core\Version.cs"> @@ -82,6 +55,5 @@ </ItemGroup> <ItemGroup> <None Include="Grpc.IntegrationTesting.Server.project.json" /> - <None Include="packages.config" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.Server/packages.config b/src/csharp/Grpc.IntegrationTesting.Server/packages.config deleted file mode 100644 index 11c6375c63..0000000000 --- a/src/csharp/Grpc.IntegrationTesting.Server/packages.config +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> - <package id="BouncyCastle" version="1.7.0" targetFramework="net45" /> - <package id="Google.Apis" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Auth" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Core" version="1.16.0" targetFramework="net45" /> - <package id="log4net" version="2.0.3" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> - <package id="Zlib.Portable.Signed" version="1.11.0" targetFramework="net45" /> -</packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting.StressClient/packages.config b/src/csharp/Grpc.IntegrationTesting.StressClient/packages.config deleted file mode 100644 index 79ece06bef..0000000000 --- a/src/csharp/Grpc.IntegrationTesting.StressClient/packages.config +++ /dev/null @@ -1,3 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<packages> -</packages> diff --git a/src/csharp/Grpc.IntegrationTesting/Control.cs b/src/csharp/Grpc.IntegrationTesting/Control.cs index 3f4862d567..6c0176fb43 100644 --- a/src/csharp/Grpc.IntegrationTesting/Control.cs +++ b/src/csharp/Grpc.IntegrationTesting/Control.cs @@ -30,63 +30,66 @@ namespace Grpc.Testing { "cnBjLnRlc3RpbmcuQ2xvc2VkTG9vcFBhcmFtc0gAEi4KB3BvaXNzb24YAiAB", "KAsyGy5ncnBjLnRlc3RpbmcuUG9pc3NvblBhcmFtc0gAQgYKBGxvYWQiQwoO", "U2VjdXJpdHlQYXJhbXMSEwoLdXNlX3Rlc3RfY2EYASABKAgSHAoUc2VydmVy", - "X2hvc3Rfb3ZlcnJpZGUYAiABKAki8AMKDENsaWVudENvbmZpZxIWCg5zZXJ2", - "ZXJfdGFyZ2V0cxgBIAMoCRItCgtjbGllbnRfdHlwZRgCIAEoDjIYLmdycGMu", - "dGVzdGluZy5DbGllbnRUeXBlEjUKD3NlY3VyaXR5X3BhcmFtcxgDIAEoCzIc", - "LmdycGMudGVzdGluZy5TZWN1cml0eVBhcmFtcxIkChxvdXRzdGFuZGluZ19y", - "cGNzX3Blcl9jaGFubmVsGAQgASgFEhcKD2NsaWVudF9jaGFubmVscxgFIAEo", - "BRIcChRhc3luY19jbGllbnRfdGhyZWFkcxgHIAEoBRInCghycGNfdHlwZRgI", - "IAEoDjIVLmdycGMudGVzdGluZy5ScGNUeXBlEi0KC2xvYWRfcGFyYW1zGAog", - "ASgLMhguZ3JwYy50ZXN0aW5nLkxvYWRQYXJhbXMSMwoOcGF5bG9hZF9jb25m", - "aWcYCyABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxI3ChBoaXN0", - "b2dyYW1fcGFyYW1zGAwgASgLMh0uZ3JwYy50ZXN0aW5nLkhpc3RvZ3JhbVBh", - "cmFtcxIRCgljb3JlX2xpc3QYDSADKAUSEgoKY29yZV9saW1pdBgOIAEoBRIY", - "ChBvdGhlcl9jbGllbnRfYXBpGA8gASgJIjgKDENsaWVudFN0YXR1cxIoCgVz", - "dGF0cxgBIAEoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cyIVCgRNYXJr", - "Eg0KBXJlc2V0GAEgASgIImgKCkNsaWVudEFyZ3MSKwoFc2V0dXAYASABKAsy", - "Gi5ncnBjLnRlc3RpbmcuQ2xpZW50Q29uZmlnSAASIgoEbWFyaxgCIAEoCzIS", - "LmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSK0AgoMU2VydmVyQ29u", - "ZmlnEi0KC3NlcnZlcl90eXBlGAEgASgOMhguZ3JwYy50ZXN0aW5nLlNlcnZl", - "clR5cGUSNQoPc2VjdXJpdHlfcGFyYW1zGAIgASgLMhwuZ3JwYy50ZXN0aW5n", - "LlNlY3VyaXR5UGFyYW1zEgwKBHBvcnQYBCABKAUSHAoUYXN5bmNfc2VydmVy", - "X3RocmVhZHMYByABKAUSEgoKY29yZV9saW1pdBgIIAEoBRIzCg5wYXlsb2Fk", - "X2NvbmZpZxgJIAEoCzIbLmdycGMudGVzdGluZy5QYXlsb2FkQ29uZmlnEhEK", - "CWNvcmVfbGlzdBgKIAMoBRIYChBvdGhlcl9zZXJ2ZXJfYXBpGAsgASgJEhwK", - "E3Jlc291cmNlX3F1b3RhX3NpemUY6QcgASgFImgKClNlcnZlckFyZ3MSKwoF", - "c2V0dXAYASABKAsyGi5ncnBjLnRlc3RpbmcuU2VydmVyQ29uZmlnSAASIgoE", - "bWFyaxgCIAEoCzISLmdycGMudGVzdGluZy5NYXJrSABCCQoHYXJndHlwZSJV", - "CgxTZXJ2ZXJTdGF0dXMSKAoFc3RhdHMYASABKAsyGS5ncnBjLnRlc3Rpbmcu", - "U2VydmVyU3RhdHMSDAoEcG9ydBgCIAEoBRINCgVjb3JlcxgDIAEoBSINCgtD", - "b3JlUmVxdWVzdCIdCgxDb3JlUmVzcG9uc2USDQoFY29yZXMYASABKAUiBgoE", - "Vm9pZCL9AQoIU2NlbmFyaW8SDAoEbmFtZRgBIAEoCRIxCg1jbGllbnRfY29u", - "ZmlnGAIgASgLMhouZ3JwYy50ZXN0aW5nLkNsaWVudENvbmZpZxITCgtudW1f", - "Y2xpZW50cxgDIAEoBRIxCg1zZXJ2ZXJfY29uZmlnGAQgASgLMhouZ3JwYy50", - "ZXN0aW5nLlNlcnZlckNvbmZpZxITCgtudW1fc2VydmVycxgFIAEoBRIWCg53", - "YXJtdXBfc2Vjb25kcxgGIAEoBRIZChFiZW5jaG1hcmtfc2Vjb25kcxgHIAEo", - "BRIgChhzcGF3bl9sb2NhbF93b3JrZXJfY291bnQYCCABKAUiNgoJU2NlbmFy", - "aW9zEikKCXNjZW5hcmlvcxgBIAMoCzIWLmdycGMudGVzdGluZy5TY2VuYXJp", - "byL4AgoVU2NlbmFyaW9SZXN1bHRTdW1tYXJ5EgsKA3FwcxgBIAEoARIbChNx", - "cHNfcGVyX3NlcnZlcl9jb3JlGAIgASgBEhoKEnNlcnZlcl9zeXN0ZW1fdGlt", - "ZRgDIAEoARIYChBzZXJ2ZXJfdXNlcl90aW1lGAQgASgBEhoKEmNsaWVudF9z", - "eXN0ZW1fdGltZRgFIAEoARIYChBjbGllbnRfdXNlcl90aW1lGAYgASgBEhIK", - "CmxhdGVuY3lfNTAYByABKAESEgoKbGF0ZW5jeV85MBgIIAEoARISCgpsYXRl", - "bmN5Xzk1GAkgASgBEhIKCmxhdGVuY3lfOTkYCiABKAESEwoLbGF0ZW5jeV85", - "OTkYCyABKAESGAoQc2VydmVyX2NwdV91c2FnZRgMIAEoARImCh5zdWNjZXNz", - "ZnVsX3JlcXVlc3RzX3Blcl9zZWNvbmQYDSABKAESIgoaZmFpbGVkX3JlcXVl", - "c3RzX3Blcl9zZWNvbmQYDiABKAEigwMKDlNjZW5hcmlvUmVzdWx0EigKCHNj", - "ZW5hcmlvGAEgASgLMhYuZ3JwYy50ZXN0aW5nLlNjZW5hcmlvEi4KCWxhdGVu", - "Y2llcxgCIAEoCzIbLmdycGMudGVzdGluZy5IaXN0b2dyYW1EYXRhEi8KDGNs", - "aWVudF9zdGF0cxgDIAMoCzIZLmdycGMudGVzdGluZy5DbGllbnRTdGF0cxIv", - "CgxzZXJ2ZXJfc3RhdHMYBCADKAsyGS5ncnBjLnRlc3RpbmcuU2VydmVyU3Rh", - "dHMSFAoMc2VydmVyX2NvcmVzGAUgAygFEjQKB3N1bW1hcnkYBiABKAsyIy5n", - "cnBjLnRlc3RpbmcuU2NlbmFyaW9SZXN1bHRTdW1tYXJ5EhYKDmNsaWVudF9z", - "dWNjZXNzGAcgAygIEhYKDnNlcnZlcl9zdWNjZXNzGAggAygIEjkKD3JlcXVl", - "c3RfcmVzdWx0cxgJIAMoCzIgLmdycGMudGVzdGluZy5SZXF1ZXN0UmVzdWx0", - "Q291bnQqQQoKQ2xpZW50VHlwZRIPCgtTWU5DX0NMSUVOVBAAEhAKDEFTWU5D", - "X0NMSUVOVBABEhAKDE9USEVSX0NMSUVOVBACKlsKClNlcnZlclR5cGUSDwoL", - "U1lOQ19TRVJWRVIQABIQCgxBU1lOQ19TRVJWRVIQARIYChRBU1lOQ19HRU5F", - "UklDX1NFUlZFUhACEhAKDE9USEVSX1NFUlZFUhADKiMKB1JwY1R5cGUSCQoF", - "VU5BUlkQABINCglTVFJFQU1JTkcQAWIGcHJvdG8z")); + "X2hvc3Rfb3ZlcnJpZGUYAiABKAkiTQoKQ2hhbm5lbEFyZxIMCgRuYW1lGAEg", + "ASgJEhMKCXN0cl92YWx1ZRgCIAEoCUgAEhMKCWludF92YWx1ZRgDIAEoBUgA", + "QgcKBXZhbHVlIqAECgxDbGllbnRDb25maWcSFgoOc2VydmVyX3RhcmdldHMY", + "ASADKAkSLQoLY2xpZW50X3R5cGUYAiABKA4yGC5ncnBjLnRlc3RpbmcuQ2xp", + "ZW50VHlwZRI1Cg9zZWN1cml0eV9wYXJhbXMYAyABKAsyHC5ncnBjLnRlc3Rp", + "bmcuU2VjdXJpdHlQYXJhbXMSJAocb3V0c3RhbmRpbmdfcnBjc19wZXJfY2hh", + "bm5lbBgEIAEoBRIXCg9jbGllbnRfY2hhbm5lbHMYBSABKAUSHAoUYXN5bmNf", + "Y2xpZW50X3RocmVhZHMYByABKAUSJwoIcnBjX3R5cGUYCCABKA4yFS5ncnBj", + "LnRlc3RpbmcuUnBjVHlwZRItCgtsb2FkX3BhcmFtcxgKIAEoCzIYLmdycGMu", + "dGVzdGluZy5Mb2FkUGFyYW1zEjMKDnBheWxvYWRfY29uZmlnGAsgASgLMhsu", + "Z3JwYy50ZXN0aW5nLlBheWxvYWRDb25maWcSNwoQaGlzdG9ncmFtX3BhcmFt", + "cxgMIAEoCzIdLmdycGMudGVzdGluZy5IaXN0b2dyYW1QYXJhbXMSEQoJY29y", + "ZV9saXN0GA0gAygFEhIKCmNvcmVfbGltaXQYDiABKAUSGAoQb3RoZXJfY2xp", + "ZW50X2FwaRgPIAEoCRIuCgxjaGFubmVsX2FyZ3MYECADKAsyGC5ncnBjLnRl", + "c3RpbmcuQ2hhbm5lbEFyZyI4CgxDbGllbnRTdGF0dXMSKAoFc3RhdHMYASAB", + "KAsyGS5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHMiFQoETWFyaxINCgVyZXNl", + "dBgBIAEoCCJoCgpDbGllbnRBcmdzEisKBXNldHVwGAEgASgLMhouZ3JwYy50", + "ZXN0aW5nLkNsaWVudENvbmZpZ0gAEiIKBG1hcmsYAiABKAsyEi5ncnBjLnRl", + "c3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUitAIKDFNlcnZlckNvbmZpZxItCgtz", + "ZXJ2ZXJfdHlwZRgBIAEoDjIYLmdycGMudGVzdGluZy5TZXJ2ZXJUeXBlEjUK", + "D3NlY3VyaXR5X3BhcmFtcxgCIAEoCzIcLmdycGMudGVzdGluZy5TZWN1cml0", + "eVBhcmFtcxIMCgRwb3J0GAQgASgFEhwKFGFzeW5jX3NlcnZlcl90aHJlYWRz", + "GAcgASgFEhIKCmNvcmVfbGltaXQYCCABKAUSMwoOcGF5bG9hZF9jb25maWcY", + "CSABKAsyGy5ncnBjLnRlc3RpbmcuUGF5bG9hZENvbmZpZxIRCgljb3JlX2xp", + "c3QYCiADKAUSGAoQb3RoZXJfc2VydmVyX2FwaRgLIAEoCRIcChNyZXNvdXJj", + "ZV9xdW90YV9zaXplGOkHIAEoBSJoCgpTZXJ2ZXJBcmdzEisKBXNldHVwGAEg", + "ASgLMhouZ3JwYy50ZXN0aW5nLlNlcnZlckNvbmZpZ0gAEiIKBG1hcmsYAiAB", + "KAsyEi5ncnBjLnRlc3RpbmcuTWFya0gAQgkKB2FyZ3R5cGUiVQoMU2VydmVy", + "U3RhdHVzEigKBXN0YXRzGAEgASgLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0", + "YXRzEgwKBHBvcnQYAiABKAUSDQoFY29yZXMYAyABKAUiDQoLQ29yZVJlcXVl", + "c3QiHQoMQ29yZVJlc3BvbnNlEg0KBWNvcmVzGAEgASgFIgYKBFZvaWQi/QEK", + "CFNjZW5hcmlvEgwKBG5hbWUYASABKAkSMQoNY2xpZW50X2NvbmZpZxgCIAEo", + "CzIaLmdycGMudGVzdGluZy5DbGllbnRDb25maWcSEwoLbnVtX2NsaWVudHMY", + "AyABKAUSMQoNc2VydmVyX2NvbmZpZxgEIAEoCzIaLmdycGMudGVzdGluZy5T", + "ZXJ2ZXJDb25maWcSEwoLbnVtX3NlcnZlcnMYBSABKAUSFgoOd2FybXVwX3Nl", + "Y29uZHMYBiABKAUSGQoRYmVuY2htYXJrX3NlY29uZHMYByABKAUSIAoYc3Bh", + "d25fbG9jYWxfd29ya2VyX2NvdW50GAggASgFIjYKCVNjZW5hcmlvcxIpCglz", + "Y2VuYXJpb3MYASADKAsyFi5ncnBjLnRlc3RpbmcuU2NlbmFyaW8i+AIKFVNj", + "ZW5hcmlvUmVzdWx0U3VtbWFyeRILCgNxcHMYASABKAESGwoTcXBzX3Blcl9z", + "ZXJ2ZXJfY29yZRgCIAEoARIaChJzZXJ2ZXJfc3lzdGVtX3RpbWUYAyABKAES", + "GAoQc2VydmVyX3VzZXJfdGltZRgEIAEoARIaChJjbGllbnRfc3lzdGVtX3Rp", + "bWUYBSABKAESGAoQY2xpZW50X3VzZXJfdGltZRgGIAEoARISCgpsYXRlbmN5", + "XzUwGAcgASgBEhIKCmxhdGVuY3lfOTAYCCABKAESEgoKbGF0ZW5jeV85NRgJ", + "IAEoARISCgpsYXRlbmN5Xzk5GAogASgBEhMKC2xhdGVuY3lfOTk5GAsgASgB", + "EhgKEHNlcnZlcl9jcHVfdXNhZ2UYDCABKAESJgoec3VjY2Vzc2Z1bF9yZXF1", + "ZXN0c19wZXJfc2Vjb25kGA0gASgBEiIKGmZhaWxlZF9yZXF1ZXN0c19wZXJf", + "c2Vjb25kGA4gASgBIoMDCg5TY2VuYXJpb1Jlc3VsdBIoCghzY2VuYXJpbxgB", + "IAEoCzIWLmdycGMudGVzdGluZy5TY2VuYXJpbxIuCglsYXRlbmNpZXMYAiAB", + "KAsyGy5ncnBjLnRlc3RpbmcuSGlzdG9ncmFtRGF0YRIvCgxjbGllbnRfc3Rh", + "dHMYAyADKAsyGS5ncnBjLnRlc3RpbmcuQ2xpZW50U3RhdHMSLwoMc2VydmVy", + "X3N0YXRzGAQgAygLMhkuZ3JwYy50ZXN0aW5nLlNlcnZlclN0YXRzEhQKDHNl", + "cnZlcl9jb3JlcxgFIAMoBRI0CgdzdW1tYXJ5GAYgASgLMiMuZ3JwYy50ZXN0", + "aW5nLlNjZW5hcmlvUmVzdWx0U3VtbWFyeRIWCg5jbGllbnRfc3VjY2VzcxgH", + "IAMoCBIWCg5zZXJ2ZXJfc3VjY2VzcxgIIAMoCBI5Cg9yZXF1ZXN0X3Jlc3Vs", + "dHMYCSADKAsyIC5ncnBjLnRlc3RpbmcuUmVxdWVzdFJlc3VsdENvdW50KkEK", + "CkNsaWVudFR5cGUSDwoLU1lOQ19DTElFTlQQABIQCgxBU1lOQ19DTElFTlQQ", + "ARIQCgxPVEhFUl9DTElFTlQQAipbCgpTZXJ2ZXJUeXBlEg8KC1NZTkNfU0VS", + "VkVSEAASEAoMQVNZTkNfU0VSVkVSEAESGAoUQVNZTkNfR0VORVJJQ19TRVJW", + "RVIQAhIQCgxPVEhFUl9TRVJWRVIQAyojCgdScGNUeXBlEgkKBVVOQVJZEAAS", + "DQoJU1RSRUFNSU5HEAFiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Grpc.Testing.PayloadsReflection.Descriptor, global::Grpc.Testing.StatsReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.ClientType), typeof(global::Grpc.Testing.ServerType), typeof(global::Grpc.Testing.RpcType), }, new pbr::GeneratedClrTypeInfo[] { @@ -94,7 +97,8 @@ namespace Grpc.Testing { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClosedLoopParams), global::Grpc.Testing.ClosedLoopParams.Parser, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadParams), global::Grpc.Testing.LoadParams.Parser, new[]{ "ClosedLoop", "Poisson" }, new[]{ "Load" }, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.SecurityParams), global::Grpc.Testing.SecurityParams.Parser, new[]{ "UseTestCa", "ServerHostOverride" }, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi" }, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ChannelArg), global::Grpc.Testing.ChannelArg.Parser, new[]{ "Name", "StrValue", "IntValue" }, new[]{ "Value" }, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientConfig), global::Grpc.Testing.ClientConfig.Parser, new[]{ "ServerTargets", "ClientType", "SecurityParams", "OutstandingRpcsPerChannel", "ClientChannels", "AsyncClientThreads", "RpcType", "LoadParams", "PayloadConfig", "HistogramParams", "CoreList", "CoreLimit", "OtherClientApi", "ChannelArgs" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientStatus), global::Grpc.Testing.ClientStatus.Parser, new[]{ "Stats" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.Mark), global::Grpc.Testing.Mark.Parser, new[]{ "Reset" }, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ClientArgs), global::Grpc.Testing.ClientArgs.Parser, new[]{ "Setup", "Mark" }, new[]{ "Argtype" }, null, null), @@ -116,13 +120,13 @@ namespace Grpc.Testing { #region Enums public enum ClientType { /// <summary> - /// Many languages support a basic distinction between using - /// sync or async client, and this allows the specification + /// Many languages support a basic distinction between using + /// sync or async client, and this allows the specification /// </summary> [pbr::OriginalName("SYNC_CLIENT")] SyncClient = 0, [pbr::OriginalName("ASYNC_CLIENT")] AsyncClient = 1, /// <summary> - /// used for some language-specific variants + /// used for some language-specific variants /// </summary> [pbr::OriginalName("OTHER_CLIENT")] OtherClient = 2, } @@ -132,7 +136,7 @@ namespace Grpc.Testing { [pbr::OriginalName("ASYNC_SERVER")] AsyncServer = 1, [pbr::OriginalName("ASYNC_GENERIC_SERVER")] AsyncGenericServer = 2, /// <summary> - /// used for some language-specific variants + /// used for some language-specific variants /// </summary> [pbr::OriginalName("OTHER_SERVER")] OtherServer = 3, } @@ -146,8 +150,8 @@ namespace Grpc.Testing { #region Messages /// <summary> - /// Parameters of poisson process distribution, which is a good representation - /// of activity coming in from independent identical stationary sources. + /// Parameters of poisson process distribution, which is a good representation + /// of activity coming in from independent identical stationary sources. /// </summary> public sealed partial class PoissonParams : pb::IMessage<PoissonParams> { private static readonly pb::MessageParser<PoissonParams> _parser = new pb::MessageParser<PoissonParams>(() => new PoissonParams()); @@ -185,7 +189,7 @@ namespace Grpc.Testing { public const int OfferedLoadFieldNumber = 1; private double offeredLoad_; /// <summary> - /// The rate of arrivals (a.k.a. lambda parameter of the exp distribution). + /// The rate of arrivals (a.k.a. lambda parameter of the exp distribution). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double OfferedLoad { @@ -270,8 +274,8 @@ namespace Grpc.Testing { } /// <summary> - /// Once an RPC finishes, immediately start a new one. - /// No configuration parameters needed. + /// Once an RPC finishes, immediately start a new one. + /// No configuration parameters needed. /// </summary> public sealed partial class ClosedLoopParams : pb::IMessage<ClosedLoopParams> { private static readonly pb::MessageParser<ClosedLoopParams> _parser = new pb::MessageParser<ClosedLoopParams>(() => new ClosedLoopParams()); @@ -549,7 +553,7 @@ namespace Grpc.Testing { } /// <summary> - /// presence of SecurityParams implies use of TLS + /// presence of SecurityParams implies use of TLS /// </summary> public sealed partial class SecurityParams : pb::IMessage<SecurityParams> { private static readonly pb::MessageParser<SecurityParams> _parser = new pb::MessageParser<SecurityParams>(() => new SecurityParams()); @@ -696,6 +700,210 @@ namespace Grpc.Testing { } + public sealed partial class ChannelArg : pb::IMessage<ChannelArg> { + private static readonly pb::MessageParser<ChannelArg> _parser = new pb::MessageParser<ChannelArg>(() => new ChannelArg()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser<ChannelArg> Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[4]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChannelArg() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChannelArg(ChannelArg other) : this() { + name_ = other.name_; + switch (other.ValueCase) { + case ValueOneofCase.StrValue: + StrValue = other.StrValue; + break; + case ValueOneofCase.IntValue: + IntValue = other.IntValue; + break; + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ChannelArg Clone() { + return new ChannelArg(this); + } + + /// <summary>Field number for the "name" field.</summary> + public const int NameFieldNumber = 1; + private string name_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Name { + get { return name_; } + set { + name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// <summary>Field number for the "str_value" field.</summary> + public const int StrValueFieldNumber = 2; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string StrValue { + get { return valueCase_ == ValueOneofCase.StrValue ? (string) value_ : ""; } + set { + value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + valueCase_ = ValueOneofCase.StrValue; + } + } + + /// <summary>Field number for the "int_value" field.</summary> + public const int IntValueFieldNumber = 3; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int IntValue { + get { return valueCase_ == ValueOneofCase.IntValue ? (int) value_ : 0; } + set { + value_ = value; + valueCase_ = ValueOneofCase.IntValue; + } + } + + private object value_; + /// <summary>Enum of possible cases for the "value" oneof.</summary> + public enum ValueOneofCase { + None = 0, + StrValue = 2, + IntValue = 3, + } + private ValueOneofCase valueCase_ = ValueOneofCase.None; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ValueOneofCase ValueCase { + get { return valueCase_; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void ClearValue() { + valueCase_ = ValueOneofCase.None; + value_ = null; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ChannelArg); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ChannelArg other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Name != other.Name) return false; + if (StrValue != other.StrValue) return false; + if (IntValue != other.IntValue) return false; + if (ValueCase != other.ValueCase) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Name.Length != 0) hash ^= Name.GetHashCode(); + if (valueCase_ == ValueOneofCase.StrValue) hash ^= StrValue.GetHashCode(); + if (valueCase_ == ValueOneofCase.IntValue) hash ^= IntValue.GetHashCode(); + hash ^= (int) valueCase_; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Name.Length != 0) { + output.WriteRawTag(10); + output.WriteString(Name); + } + if (valueCase_ == ValueOneofCase.StrValue) { + output.WriteRawTag(18); + output.WriteString(StrValue); + } + if (valueCase_ == ValueOneofCase.IntValue) { + output.WriteRawTag(24); + output.WriteInt32(IntValue); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Name.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); + } + if (valueCase_ == ValueOneofCase.StrValue) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(StrValue); + } + if (valueCase_ == ValueOneofCase.IntValue) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(IntValue); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ChannelArg other) { + if (other == null) { + return; + } + if (other.Name.Length != 0) { + Name = other.Name; + } + switch (other.ValueCase) { + case ValueOneofCase.StrValue: + StrValue = other.StrValue; + break; + case ValueOneofCase.IntValue: + IntValue = other.IntValue; + break; + } + + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + Name = input.ReadString(); + break; + } + case 18: { + StrValue = input.ReadString(); + break; + } + case 24: { + IntValue = input.ReadInt32(); + break; + } + } + } + } + + } + public sealed partial class ClientConfig : pb::IMessage<ClientConfig> { private static readonly pb::MessageParser<ClientConfig> _parser = new pb::MessageParser<ClientConfig>(() => new ClientConfig()); [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -703,7 +911,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[4]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[5]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -733,6 +941,7 @@ namespace Grpc.Testing { coreList_ = other.coreList_.Clone(); coreLimit_ = other.coreLimit_; otherClientApi_ = other.otherClientApi_; + channelArgs_ = other.channelArgs_.Clone(); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -746,7 +955,7 @@ namespace Grpc.Testing { = 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. + /// List of targets to connect to. At least one target needs to be specified. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<string> ServerTargets { @@ -779,8 +988,8 @@ namespace Grpc.Testing { 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. + /// How many concurrent RPCs to start for each channel. + /// For synchronous client, use a separate thread for each outstanding RPC. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int OutstandingRpcsPerChannel { @@ -794,8 +1003,8 @@ namespace Grpc.Testing { 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()] + /// Number of independent client channels to create. + /// i-th channel will connect to server_target[i % server_targets.size()] /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ClientChannels { @@ -809,7 +1018,7 @@ namespace Grpc.Testing { public const int AsyncClientThreadsFieldNumber = 7; private int asyncClientThreads_; /// <summary> - /// Only for async client. Number of threads to use to start/manage RPCs. + /// Only for async client. Number of threads to use to start/manage RPCs. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int AsyncClientThreads { @@ -834,7 +1043,7 @@ namespace Grpc.Testing { public const int LoadParamsFieldNumber = 10; private global::Grpc.Testing.LoadParams loadParams_; /// <summary> - /// The requested load for the entire client (aggregated over all the threads). + /// The requested load for the entire client (aggregated over all the threads). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.LoadParams LoadParams { @@ -872,7 +1081,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForInt32(106); private readonly pbc::RepeatedField<int> coreList_ = new pbc::RepeatedField<int>(); /// <summary> - /// Specify the cores we should run the client on, if desired + /// Specify the cores we should run the client on, if desired /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<int> CoreList { @@ -894,7 +1103,7 @@ namespace Grpc.Testing { public const int OtherClientApiFieldNumber = 15; private string otherClientApi_ = ""; /// <summary> - /// If we use an OTHER_CLIENT client_type, this string gives more detail + /// If we use an OTHER_CLIENT client_type, this string gives more detail /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string OtherClientApi { @@ -904,6 +1113,16 @@ namespace Grpc.Testing { } } + /// <summary>Field number for the "channel_args" field.</summary> + public const int ChannelArgsFieldNumber = 16; + private static readonly pb::FieldCodec<global::Grpc.Testing.ChannelArg> _repeated_channelArgs_codec + = pb::FieldCodec.ForMessage(130, global::Grpc.Testing.ChannelArg.Parser); + private readonly pbc::RepeatedField<global::Grpc.Testing.ChannelArg> channelArgs_ = new pbc::RepeatedField<global::Grpc.Testing.ChannelArg>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Grpc.Testing.ChannelArg> ChannelArgs { + get { return channelArgs_; } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as ClientConfig); @@ -930,6 +1149,7 @@ namespace Grpc.Testing { if(!coreList_.Equals(other.coreList_)) return false; if (CoreLimit != other.CoreLimit) return false; if (OtherClientApi != other.OtherClientApi) return false; + if(!channelArgs_.Equals(other.channelArgs_)) return false; return true; } @@ -949,6 +1169,7 @@ namespace Grpc.Testing { hash ^= coreList_.GetHashCode(); if (CoreLimit != 0) hash ^= CoreLimit.GetHashCode(); if (OtherClientApi.Length != 0) hash ^= OtherClientApi.GetHashCode(); + hash ^= channelArgs_.GetHashCode(); return hash; } @@ -1005,6 +1226,7 @@ namespace Grpc.Testing { output.WriteRawTag(122); output.WriteString(OtherClientApi); } + channelArgs_.WriteTo(output, _repeated_channelArgs_codec); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1045,6 +1267,7 @@ namespace Grpc.Testing { if (OtherClientApi.Length != 0) { size += 1 + pb::CodedOutputStream.ComputeStringSize(OtherClientApi); } + size += channelArgs_.CalculateSize(_repeated_channelArgs_codec); return size; } @@ -1100,6 +1323,7 @@ namespace Grpc.Testing { if (other.OtherClientApi.Length != 0) { OtherClientApi = other.OtherClientApi; } + channelArgs_.Add(other.channelArgs_); } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1175,6 +1399,10 @@ namespace Grpc.Testing { OtherClientApi = input.ReadString(); break; } + case 130: { + channelArgs_.AddEntriesFrom(input, _repeated_channelArgs_codec); + break; + } } } } @@ -1188,7 +1416,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[5]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[6]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1305,7 +1533,7 @@ namespace Grpc.Testing { } /// <summary> - /// Request current stats + /// Request current stats /// </summary> public sealed partial class Mark : pb::IMessage<Mark> { private static readonly pb::MessageParser<Mark> _parser = new pb::MessageParser<Mark>(() => new Mark()); @@ -1314,7 +1542,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[6]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[7]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1343,7 +1571,7 @@ namespace Grpc.Testing { public const int ResetFieldNumber = 1; private bool reset_; /// <summary> - /// if true, the stats will be reset after taking their snapshot. + /// if true, the stats will be reset after taking their snapshot. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Reset { @@ -1434,7 +1662,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[7]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[8]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1620,7 +1848,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[8]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[9]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -1679,7 +1907,7 @@ namespace Grpc.Testing { public const int PortFieldNumber = 4; private int port_; /// <summary> - /// Port on which to listen. Zero means pick unused port. + /// Port on which to listen. Zero means pick unused port. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Port { @@ -1693,7 +1921,7 @@ namespace Grpc.Testing { public const int AsyncServerThreadsFieldNumber = 7; private int asyncServerThreads_; /// <summary> - /// Only for async server. Number of threads used to serve the requests. + /// Only for async server. Number of threads used to serve the requests. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int AsyncServerThreads { @@ -1707,7 +1935,7 @@ namespace Grpc.Testing { public const int CoreLimitFieldNumber = 8; private int coreLimit_; /// <summary> - /// Specify the number of cores to limit server to, if desired + /// Specify the number of cores to limit server to, if desired /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int CoreLimit { @@ -1721,7 +1949,10 @@ namespace Grpc.Testing { public const int PayloadConfigFieldNumber = 9; private global::Grpc.Testing.PayloadConfig payloadConfig_; /// <summary> - /// payload config, used in generic server + /// payload config, used in generic server. + /// Note this must NOT be used in proto (non-generic) servers. For proto servers, + /// 'response sizes' must be configured from the 'response_size' field of the + /// 'SimpleRequest' objects in RPC requests. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.PayloadConfig PayloadConfig { @@ -1737,7 +1968,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForInt32(82); private readonly pbc::RepeatedField<int> coreList_ = new pbc::RepeatedField<int>(); /// <summary> - /// Specify the cores we should run the server on, if desired + /// Specify the cores we should run the server on, if desired /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<int> CoreList { @@ -1748,7 +1979,7 @@ namespace Grpc.Testing { public const int OtherServerApiFieldNumber = 11; private string otherServerApi_ = ""; /// <summary> - /// If we use an OTHER_SERVER client_type, this string gives more detail + /// If we use an OTHER_SERVER client_type, this string gives more detail /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string OtherServerApi { @@ -1762,7 +1993,7 @@ namespace Grpc.Testing { public const int ResourceQuotaSizeFieldNumber = 1001; private int resourceQuotaSize_; /// <summary> - /// Buffer pool size (no buffer pool specified if unset) + /// Buffer pool size (no buffer pool specified if unset) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ResourceQuotaSize { @@ -1987,7 +2218,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[9]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[10]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2173,7 +2404,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[10]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[11]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2215,7 +2446,7 @@ namespace Grpc.Testing { public const int PortFieldNumber = 2; private int port_; /// <summary> - /// the port bound by the server + /// the port bound by the server /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Port { @@ -2229,7 +2460,7 @@ namespace Grpc.Testing { public const int CoresFieldNumber = 3; private int cores_; /// <summary> - /// Number of cores available to the server + /// Number of cores available to the server /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Cores { @@ -2358,7 +2589,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[11]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[12]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2447,7 +2678,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[12]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[13]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2476,7 +2707,7 @@ namespace Grpc.Testing { public const int CoresFieldNumber = 1; private int cores_; /// <summary> - /// Number of cores available on the server + /// Number of cores available on the server /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Cores { @@ -2567,7 +2798,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[13]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[14]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2650,7 +2881,7 @@ namespace Grpc.Testing { } /// <summary> - /// A single performance scenario: input to qps_json_driver + /// A single performance scenario: input to qps_json_driver /// </summary> public sealed partial class Scenario : pb::IMessage<Scenario> { private static readonly pb::MessageParser<Scenario> _parser = new pb::MessageParser<Scenario>(() => new Scenario()); @@ -2659,7 +2890,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[14]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[15]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -2695,7 +2926,7 @@ namespace Grpc.Testing { public const int NameFieldNumber = 1; private string name_ = ""; /// <summary> - /// Human readable name for this scenario + /// Human readable name for this scenario /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -2709,7 +2940,7 @@ namespace Grpc.Testing { public const int ClientConfigFieldNumber = 2; private global::Grpc.Testing.ClientConfig clientConfig_; /// <summary> - /// Client configuration + /// Client configuration /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.ClientConfig ClientConfig { @@ -2723,7 +2954,7 @@ namespace Grpc.Testing { public const int NumClientsFieldNumber = 3; private int numClients_; /// <summary> - /// Number of clients to start for the test + /// Number of clients to start for the test /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int NumClients { @@ -2737,7 +2968,7 @@ namespace Grpc.Testing { public const int ServerConfigFieldNumber = 4; private global::Grpc.Testing.ServerConfig serverConfig_; /// <summary> - /// Server configuration + /// Server configuration /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.ServerConfig ServerConfig { @@ -2751,7 +2982,7 @@ namespace Grpc.Testing { public const int NumServersFieldNumber = 5; private int numServers_; /// <summary> - /// Number of servers to start for the test + /// Number of servers to start for the test /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int NumServers { @@ -2765,7 +2996,7 @@ namespace Grpc.Testing { public const int WarmupSecondsFieldNumber = 6; private int warmupSeconds_; /// <summary> - /// Warmup period, in seconds + /// Warmup period, in seconds /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int WarmupSeconds { @@ -2779,7 +3010,7 @@ namespace Grpc.Testing { public const int BenchmarkSecondsFieldNumber = 7; private int benchmarkSeconds_; /// <summary> - /// Benchmark time, in seconds + /// Benchmark time, in seconds /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int BenchmarkSeconds { @@ -2793,7 +3024,7 @@ namespace Grpc.Testing { public const int SpawnLocalWorkerCountFieldNumber = 8; private int spawnLocalWorkerCount_; /// <summary> - /// Number of workers to spawn locally (usually zero) + /// Number of workers to spawn locally (usually zero) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int SpawnLocalWorkerCount { @@ -3002,7 +3233,7 @@ namespace Grpc.Testing { } /// <summary> - /// A set of scenarios to be run with qps_json_driver + /// A set of scenarios to be run with qps_json_driver /// </summary> public sealed partial class Scenarios : pb::IMessage<Scenarios> { private static readonly pb::MessageParser<Scenarios> _parser = new pb::MessageParser<Scenarios>(() => new Scenarios()); @@ -3011,7 +3242,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[15]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[16]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3114,8 +3345,8 @@ namespace Grpc.Testing { } /// <summary> - /// Basic summary that can be computed from ClientStats and ServerStats - /// once the scenario has finished. + /// Basic summary that can be computed from ClientStats and ServerStats + /// once the scenario has finished. /// </summary> public sealed partial class ScenarioResultSummary : pb::IMessage<ScenarioResultSummary> { private static readonly pb::MessageParser<ScenarioResultSummary> _parser = new pb::MessageParser<ScenarioResultSummary>(() => new ScenarioResultSummary()); @@ -3124,7 +3355,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[16]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[17]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3166,7 +3397,7 @@ namespace Grpc.Testing { public const int QpsFieldNumber = 1; private double qps_; /// <summary> - /// Total number of operations per second over all clients. + /// Total number of operations per second over all clients. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double Qps { @@ -3180,7 +3411,7 @@ namespace Grpc.Testing { public const int QpsPerServerCoreFieldNumber = 2; private double qpsPerServerCore_; /// <summary> - /// QPS per one server core. + /// QPS per one server core. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double QpsPerServerCore { @@ -3194,7 +3425,7 @@ namespace Grpc.Testing { public const int ServerSystemTimeFieldNumber = 3; private double serverSystemTime_; /// <summary> - /// server load based on system_time (0.85 => 85%) + /// server load based on system_time (0.85 => 85%) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double ServerSystemTime { @@ -3208,7 +3439,7 @@ namespace Grpc.Testing { public const int ServerUserTimeFieldNumber = 4; private double serverUserTime_; /// <summary> - /// server load based on user_time (0.85 => 85%) + /// server load based on user_time (0.85 => 85%) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double ServerUserTime { @@ -3222,7 +3453,7 @@ namespace Grpc.Testing { public const int ClientSystemTimeFieldNumber = 5; private double clientSystemTime_; /// <summary> - /// client load based on system_time (0.85 => 85%) + /// client load based on system_time (0.85 => 85%) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double ClientSystemTime { @@ -3236,7 +3467,7 @@ namespace Grpc.Testing { public const int ClientUserTimeFieldNumber = 6; private double clientUserTime_; /// <summary> - /// client load based on user_time (0.85 => 85%) + /// client load based on user_time (0.85 => 85%) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double ClientUserTime { @@ -3250,7 +3481,7 @@ namespace Grpc.Testing { public const int Latency50FieldNumber = 7; private double latency50_; /// <summary> - /// X% latency percentiles (in nanoseconds) + /// X% latency percentiles (in nanoseconds) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double Latency50 { @@ -3308,7 +3539,7 @@ namespace Grpc.Testing { public const int ServerCpuUsageFieldNumber = 12; private double serverCpuUsage_; /// <summary> - /// server cpu usage percentage + /// server cpu usage percentage /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double ServerCpuUsage { @@ -3322,7 +3553,7 @@ namespace Grpc.Testing { public const int SuccessfulRequestsPerSecondFieldNumber = 13; private double successfulRequestsPerSecond_; /// <summary> - /// Number of requests that succeeded/failed + /// Number of requests that succeeded/failed /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double SuccessfulRequestsPerSecond { @@ -3626,7 +3857,7 @@ namespace Grpc.Testing { } /// <summary> - /// Results of a single benchmark scenario. + /// Results of a single benchmark scenario. /// </summary> public sealed partial class ScenarioResult : pb::IMessage<ScenarioResult> { private static readonly pb::MessageParser<ScenarioResult> _parser = new pb::MessageParser<ScenarioResult>(() => new ScenarioResult()); @@ -3635,7 +3866,7 @@ namespace Grpc.Testing { [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public static pbr::MessageDescriptor Descriptor { - get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[17]; } + get { return global::Grpc.Testing.ControlReflection.Descriptor.MessageTypes[18]; } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -3672,7 +3903,7 @@ namespace Grpc.Testing { public const int ScenarioFieldNumber = 1; private global::Grpc.Testing.Scenario scenario_; /// <summary> - /// Inputs used to run the scenario. + /// Inputs used to run the scenario. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.Scenario Scenario { @@ -3686,7 +3917,7 @@ namespace Grpc.Testing { public const int LatenciesFieldNumber = 2; private global::Grpc.Testing.HistogramData latencies_; /// <summary> - /// Histograms from all clients merged into one histogram. + /// Histograms from all clients merged into one histogram. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.HistogramData Latencies { @@ -3702,7 +3933,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForMessage(26, global::Grpc.Testing.ClientStats.Parser); private readonly pbc::RepeatedField<global::Grpc.Testing.ClientStats> clientStats_ = new pbc::RepeatedField<global::Grpc.Testing.ClientStats>(); /// <summary> - /// Client stats for each client + /// Client stats for each client /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Grpc.Testing.ClientStats> ClientStats { @@ -3715,7 +3946,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForMessage(34, global::Grpc.Testing.ServerStats.Parser); private readonly pbc::RepeatedField<global::Grpc.Testing.ServerStats> serverStats_ = new pbc::RepeatedField<global::Grpc.Testing.ServerStats>(); /// <summary> - /// Server stats for each server + /// Server stats for each server /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Grpc.Testing.ServerStats> ServerStats { @@ -3728,7 +3959,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForInt32(42); private readonly pbc::RepeatedField<int> serverCores_ = new pbc::RepeatedField<int>(); /// <summary> - /// Number of cores available to each server + /// Number of cores available to each server /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<int> ServerCores { @@ -3739,7 +3970,7 @@ namespace Grpc.Testing { public const int SummaryFieldNumber = 6; private global::Grpc.Testing.ScenarioResultSummary summary_; /// <summary> - /// An after-the-fact computed summary + /// An after-the-fact computed summary /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.ScenarioResultSummary Summary { @@ -3755,7 +3986,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForBool(58); private readonly pbc::RepeatedField<bool> clientSuccess_ = new pbc::RepeatedField<bool>(); /// <summary> - /// Information on success or failure of each worker + /// Information on success or failure of each worker /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<bool> ClientSuccess { @@ -3778,7 +4009,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForMessage(74, global::Grpc.Testing.RequestResultCount.Parser); private readonly pbc::RepeatedField<global::Grpc.Testing.RequestResultCount> requestResults_ = new pbc::RepeatedField<global::Grpc.Testing.RequestResultCount>(); /// <summary> - /// Number of failed requests (one row per status code seen) + /// Number of failed requests (one row per status code seen) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Grpc.Testing.RequestResultCount> RequestResults { diff --git a/src/csharp/Grpc.IntegrationTesting/Empty.cs b/src/csharp/Grpc.IntegrationTesting/Empty.cs index 3017e664b9..24ffd61741 100644 --- a/src/csharp/Grpc.IntegrationTesting/Empty.cs +++ b/src/csharp/Grpc.IntegrationTesting/Empty.cs @@ -35,13 +35,13 @@ namespace Grpc.Testing { } #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: + /// 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) { }; - /// }; + /// service Foo { + /// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; + /// }; /// </summary> public sealed partial class Empty : pb::IMessage<Empty> { private static readonly pb::MessageParser<Empty> _parser = new pb::MessageParser<Empty>(() => new Empty()); diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj index f7abcf8046..38b9a5d3c5 100644 --- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj +++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj @@ -33,53 +33,47 @@ <Reference Include="System.Net" /> <Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http.WebRequest" /> - <Reference Include="BouncyCastle.Crypto"> - <HintPath>..\packages\BouncyCastle.1.7.0\lib\Net40-Client\BouncyCastle.Crypto.dll</HintPath> - </Reference> - <Reference Include="Newtonsoft.Json"> - <HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> - </Reference> - <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> - </Reference> - <Reference Include="nunitlite"> - <HintPath>..\packages\NUnitLite.3.2.0\lib\net45\nunitlite.dll</HintPath> - </Reference> - <Reference Include="CommandLineParser.Unofficial"> - <HintPath>..\packages\CommandLineParser.Unofficial.2.0.275\lib\net45\CommandLineParser.Unofficial.dll</HintPath> + <Reference Include="Zlib.Portable"> + <HintPath>..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath> </Reference> - <Reference Include="log4net"> - <HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath> + <Reference Include="System.Interactive.Async"> + <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> </Reference> <Reference Include="Google.Apis.Core"> - <HintPath>..\packages\Google.Apis.Core.1.16.0\lib\net45\Google.Apis.Core.dll</HintPath> - </Reference> - <Reference Include="Zlib.Portable"> - <HintPath>..\packages\Zlib.Portable.Signed.1.11.0\lib\portable-net4+sl5+wp8+win8+wpa81+MonoTouch+MonoAndroid\Zlib.Portable.dll</HintPath> + <HintPath>..\packages\Google.Apis.Core.1.21.0\lib\net45\Google.Apis.Core.dll</HintPath> </Reference> <Reference Include="Google.Apis"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.dll</HintPath> + <HintPath>..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.dll</HintPath> </Reference> <Reference Include="Google.Apis.PlatformServices"> - <HintPath>..\packages\Google.Apis.1.16.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath> + <HintPath>..\packages\Google.Apis.1.21.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath> </Reference> <Reference Include="Google.Apis.Auth"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.dll</HintPath> + <HintPath>..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.dll</HintPath> </Reference> <Reference Include="Google.Apis.Auth.PlatformServices"> - <HintPath>..\packages\Google.Apis.Auth.1.16.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> + <HintPath>..\packages\Google.Apis.Auth.1.21.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath> </Reference> <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> + <Reference Include="nunit.framework"> + <HintPath>..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="nunitlite"> + <HintPath>..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll</HintPath> + </Reference> + <Reference Include="Newtonsoft.Json"> + <HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> </Reference> <Reference Include="Castle.Core"> - <HintPath>..\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll</HintPath> + <HintPath>..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll</HintPath> </Reference> <Reference Include="Moq"> - <HintPath>..\packages\Moq.4.6.38-alpha\lib\net45\Moq.dll</HintPath> + <HintPath>..\packages\Moq.4.7.0\lib\net45\Moq.dll</HintPath> </Reference> - <Reference Include="System.Interactive.Async"> - <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> + <Reference Include="CommandLine"> + <HintPath>..\packages\CommandLineParser.2.1.1-beta\lib\net45\CommandLine.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.IntegrationTesting/Messages.cs b/src/csharp/Grpc.IntegrationTesting/Messages.cs index 369fe738d6..278ef662e4 100644 --- a/src/csharp/Grpc.IntegrationTesting/Messages.cs +++ b/src/csharp/Grpc.IntegrationTesting/Messages.cs @@ -75,12 +75,12 @@ namespace Grpc.Testing { } #region Enums /// <summary> - /// DEPRECATED, don't use. To be removed shortly. - /// The type of payload that should be returned. + /// DEPRECATED, don't use. To be removed shortly. + /// The type of payload that should be returned. /// </summary> public enum PayloadType { /// <summary> - /// Compressable text format. + /// Compressable text format. /// </summary> [pbr::OriginalName("COMPRESSABLE")] Compressable = 0, } @@ -89,9 +89,9 @@ namespace Grpc.Testing { #region Messages /// <summary> - /// TODO(dgq): Go back to using well-known types once - /// https://github.com/grpc/grpc/issues/6980 has been fixed. - /// import "google/protobuf/wrappers.proto"; + /// TODO(dgq): Go back to using well-known types once + /// https://github.com/grpc/grpc/issues/6980 has been fixed. + /// import "google/protobuf/wrappers.proto"; /// </summary> public sealed partial class BoolValue : pb::IMessage<BoolValue> { private static readonly pb::MessageParser<BoolValue> _parser = new pb::MessageParser<BoolValue>(() => new BoolValue()); @@ -129,7 +129,7 @@ namespace Grpc.Testing { public const int ValueFieldNumber = 1; private bool value_; /// <summary> - /// The bool value. + /// The bool value. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool Value { @@ -214,7 +214,7 @@ namespace Grpc.Testing { } /// <summary> - /// A block of data, to simply increase gRPC message size. + /// A block of data, to simply increase gRPC message size. /// </summary> public sealed partial class Payload : pb::IMessage<Payload> { private static readonly pb::MessageParser<Payload> _parser = new pb::MessageParser<Payload>(() => new Payload()); @@ -253,8 +253,8 @@ namespace Grpc.Testing { public const int TypeFieldNumber = 1; private global::Grpc.Testing.PayloadType type_ = 0; /// <summary> - /// DEPRECATED, don't use. To be removed shortly. - /// The type of data in body. + /// DEPRECATED, don't use. To be removed shortly. + /// The type of data in body. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.PayloadType Type { @@ -268,7 +268,7 @@ namespace Grpc.Testing { public const int BodyFieldNumber = 2; private pb::ByteString body_ = pb::ByteString.Empty; /// <summary> - /// Primary contents of payload. + /// Primary contents of payload. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pb::ByteString Body { @@ -369,8 +369,8 @@ 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. + /// A protobuf representation for grpc status. This is used by test + /// clients to specify a status that the server should attempt to return. /// </summary> public sealed partial class EchoStatus : pb::IMessage<EchoStatus> { private static readonly pb::MessageParser<EchoStatus> _parser = new pb::MessageParser<EchoStatus>(() => new EchoStatus()); @@ -518,7 +518,7 @@ namespace Grpc.Testing { } /// <summary> - /// Unary request. + /// Unary request. /// </summary> public sealed partial class SimpleRequest : pb::IMessage<SimpleRequest> { private static readonly pb::MessageParser<SimpleRequest> _parser = new pb::MessageParser<SimpleRequest>(() => new SimpleRequest()); @@ -563,9 +563,9 @@ namespace Grpc.Testing { public const int ResponseTypeFieldNumber = 1; private global::Grpc.Testing.PayloadType responseType_ = 0; /// <summary> - /// DEPRECATED, don't use. To be removed shortly. - /// Desired payload type in the response from the server. - /// If response_type is RANDOM, server randomly chooses one from other formats. + /// DEPRECATED, don't use. To be removed shortly. + /// Desired payload type in the response from the server. + /// If response_type is RANDOM, server randomly chooses one from other formats. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.PayloadType ResponseType { @@ -579,7 +579,7 @@ namespace Grpc.Testing { public const int ResponseSizeFieldNumber = 2; private int responseSize_; /// <summary> - /// Desired payload size in the response from the server. + /// Desired payload size in the response from the server. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ResponseSize { @@ -593,7 +593,7 @@ namespace Grpc.Testing { public const int PayloadFieldNumber = 3; private global::Grpc.Testing.Payload payload_; /// <summary> - /// Optional input payload sent along with the request. + /// Optional input payload sent along with the request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.Payload Payload { @@ -607,7 +607,7 @@ namespace Grpc.Testing { public const int FillUsernameFieldNumber = 4; private bool fillUsername_; /// <summary> - /// Whether SimpleResponse should include username. + /// Whether SimpleResponse should include username. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool FillUsername { @@ -621,7 +621,7 @@ namespace Grpc.Testing { public const int FillOauthScopeFieldNumber = 5; private bool fillOauthScope_; /// <summary> - /// Whether SimpleResponse should include OAuth scope. + /// Whether SimpleResponse should include OAuth scope. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public bool FillOauthScope { @@ -635,10 +635,10 @@ namespace Grpc.Testing { public const int ResponseCompressedFieldNumber = 6; private global::Grpc.Testing.BoolValue responseCompressed_; /// <summary> - /// Whether to request the server to compress the response. This field is - /// "nullable" in order to interoperate seamlessly with clients not able to - /// implement the full compression tests by introspecting the call to verify - /// the response's compression status. + /// Whether to request the server to compress the response. This field is + /// "nullable" in order to interoperate seamlessly with clients not able to + /// implement the full compression tests by introspecting the call to verify + /// the response's compression status. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.BoolValue ResponseCompressed { @@ -652,7 +652,7 @@ namespace Grpc.Testing { public const int ResponseStatusFieldNumber = 7; private global::Grpc.Testing.EchoStatus responseStatus_; /// <summary> - /// Whether server should return a given status + /// Whether server should return a given status /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.EchoStatus ResponseStatus { @@ -666,7 +666,7 @@ namespace Grpc.Testing { public const int ExpectCompressedFieldNumber = 8; private global::Grpc.Testing.BoolValue expectCompressed_; /// <summary> - /// Whether the server should expect this request to be compressed. + /// Whether the server should expect this request to be compressed. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.BoolValue ExpectCompressed { @@ -887,7 +887,7 @@ namespace Grpc.Testing { } /// <summary> - /// Unary response, as configured by the request. + /// Unary response, as configured by the request. /// </summary> public sealed partial class SimpleResponse : pb::IMessage<SimpleResponse> { private static readonly pb::MessageParser<SimpleResponse> _parser = new pb::MessageParser<SimpleResponse>(() => new SimpleResponse()); @@ -927,7 +927,7 @@ namespace Grpc.Testing { public const int PayloadFieldNumber = 1; private global::Grpc.Testing.Payload payload_; /// <summary> - /// Payload to increase message size. + /// Payload to increase message size. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.Payload Payload { @@ -941,8 +941,8 @@ namespace Grpc.Testing { 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. + /// The user the request came from, for verifying authentication was + /// successful when the client expected it. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Username { @@ -956,7 +956,7 @@ namespace Grpc.Testing { public const int OauthScopeFieldNumber = 3; private string oauthScope_ = ""; /// <summary> - /// OAuth scope. + /// OAuth scope. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string OauthScope { @@ -1079,7 +1079,7 @@ namespace Grpc.Testing { } /// <summary> - /// Client-streaming request. + /// Client-streaming request. /// </summary> public sealed partial class StreamingInputCallRequest : pb::IMessage<StreamingInputCallRequest> { private static readonly pb::MessageParser<StreamingInputCallRequest> _parser = new pb::MessageParser<StreamingInputCallRequest>(() => new StreamingInputCallRequest()); @@ -1118,7 +1118,7 @@ namespace Grpc.Testing { public const int PayloadFieldNumber = 1; private global::Grpc.Testing.Payload payload_; /// <summary> - /// Optional input payload sent along with the request. + /// Optional input payload sent along with the request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.Payload Payload { @@ -1132,10 +1132,10 @@ namespace Grpc.Testing { public const int ExpectCompressedFieldNumber = 2; private global::Grpc.Testing.BoolValue expectCompressed_; /// <summary> - /// Whether the server should expect this request to be compressed. This field - /// is "nullable" in order to interoperate seamlessly with servers not able to - /// implement the full compression tests by introspecting the call to verify - /// the request's compression status. + /// Whether the server should expect this request to be compressed. This field + /// is "nullable" in order to interoperate seamlessly with servers not able to + /// implement the full compression tests by introspecting the call to verify + /// the request's compression status. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.BoolValue ExpectCompressed { @@ -1248,7 +1248,7 @@ namespace Grpc.Testing { } /// <summary> - /// Client-streaming response. + /// Client-streaming response. /// </summary> public sealed partial class StreamingInputCallResponse : pb::IMessage<StreamingInputCallResponse> { private static readonly pb::MessageParser<StreamingInputCallResponse> _parser = new pb::MessageParser<StreamingInputCallResponse>(() => new StreamingInputCallResponse()); @@ -1286,7 +1286,7 @@ namespace Grpc.Testing { public const int AggregatedPayloadSizeFieldNumber = 1; private int aggregatedPayloadSize_; /// <summary> - /// Aggregated size of payloads received from the client. + /// Aggregated size of payloads received from the client. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int AggregatedPayloadSize { @@ -1371,7 +1371,7 @@ namespace Grpc.Testing { } /// <summary> - /// Configuration for a particular response. + /// Configuration for a particular response. /// </summary> public sealed partial class ResponseParameters : pb::IMessage<ResponseParameters> { private static readonly pb::MessageParser<ResponseParameters> _parser = new pb::MessageParser<ResponseParameters>(() => new ResponseParameters()); @@ -1411,7 +1411,7 @@ namespace Grpc.Testing { public const int SizeFieldNumber = 1; private int size_; /// <summary> - /// Desired payload sizes in responses from the server. + /// Desired payload sizes in responses from the server. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int Size { @@ -1425,8 +1425,8 @@ namespace Grpc.Testing { public const int IntervalUsFieldNumber = 2; private int intervalUs_; /// <summary> - /// Desired interval between consecutive responses in the response stream in - /// microseconds. + /// Desired interval between consecutive responses in the response stream in + /// microseconds. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int IntervalUs { @@ -1440,10 +1440,10 @@ namespace Grpc.Testing { public const int CompressedFieldNumber = 3; private global::Grpc.Testing.BoolValue compressed_; /// <summary> - /// Whether to request the server to compress the response. This field is - /// "nullable" in order to interoperate seamlessly with clients not able to - /// implement the full compression tests by introspecting the call to verify - /// the response's compression status. + /// Whether to request the server to compress the response. This field is + /// "nullable" in order to interoperate seamlessly with clients not able to + /// implement the full compression tests by introspecting the call to verify + /// the response's compression status. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.BoolValue Compressed { @@ -1566,7 +1566,7 @@ namespace Grpc.Testing { } /// <summary> - /// Server-streaming request. + /// Server-streaming request. /// </summary> public sealed partial class StreamingOutputCallRequest : pb::IMessage<StreamingOutputCallRequest> { private static readonly pb::MessageParser<StreamingOutputCallRequest> _parser = new pb::MessageParser<StreamingOutputCallRequest>(() => new StreamingOutputCallRequest()); @@ -1607,11 +1607,11 @@ namespace Grpc.Testing { public const int ResponseTypeFieldNumber = 1; private global::Grpc.Testing.PayloadType responseType_ = 0; /// <summary> - /// DEPRECATED, don't use. To be removed shortly. - /// 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. + /// DEPRECATED, don't use. To be removed shortly. + /// 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> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.PayloadType ResponseType { @@ -1627,7 +1627,7 @@ namespace Grpc.Testing { = 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. + /// Configuration for each expected response message. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Grpc.Testing.ResponseParameters> ResponseParameters { @@ -1638,7 +1638,7 @@ namespace Grpc.Testing { public const int PayloadFieldNumber = 3; private global::Grpc.Testing.Payload payload_; /// <summary> - /// Optional input payload sent along with the request. + /// Optional input payload sent along with the request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.Payload Payload { @@ -1652,7 +1652,7 @@ namespace Grpc.Testing { public const int ResponseStatusFieldNumber = 7; private global::Grpc.Testing.EchoStatus responseStatus_; /// <summary> - /// Whether server should return a given status + /// Whether server should return a given status /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.EchoStatus ResponseStatus { @@ -1790,7 +1790,7 @@ namespace Grpc.Testing { } /// <summary> - /// Server-streaming response, as configured by the request and parameters. + /// Server-streaming response, as configured by the request and parameters. /// </summary> public sealed partial class StreamingOutputCallResponse : pb::IMessage<StreamingOutputCallResponse> { private static readonly pb::MessageParser<StreamingOutputCallResponse> _parser = new pb::MessageParser<StreamingOutputCallResponse>(() => new StreamingOutputCallResponse()); @@ -1828,7 +1828,7 @@ namespace Grpc.Testing { public const int PayloadFieldNumber = 1; private global::Grpc.Testing.Payload payload_; /// <summary> - /// Payload to increase response size. + /// Payload to increase response size. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.Payload Payload { @@ -1919,8 +1919,8 @@ namespace Grpc.Testing { } /// <summary> - /// For reconnect interop test only. - /// Client tells server what reconnection parameters it used. + /// For reconnect interop test only. + /// Client tells server what reconnection parameters it used. /// </summary> public sealed partial class ReconnectParams : pb::IMessage<ReconnectParams> { private static readonly pb::MessageParser<ReconnectParams> _parser = new pb::MessageParser<ReconnectParams>(() => new ReconnectParams()); @@ -2040,9 +2040,9 @@ 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. + /// For reconnect interop test only. + /// Server tells client whether its reconnects are following the spec and the + /// reconnect backoffs it saw. /// </summary> public sealed partial class ReconnectInfo : pb::IMessage<ReconnectInfo> { private static readonly pb::MessageParser<ReconnectInfo> _parser = new pb::MessageParser<ReconnectInfo>(() => new ReconnectInfo()); diff --git a/src/csharp/Grpc.IntegrationTesting/Metrics.cs b/src/csharp/Grpc.IntegrationTesting/Metrics.cs index 4de1847e5f..84eb09af4f 100644 --- a/src/csharp/Grpc.IntegrationTesting/Metrics.cs +++ b/src/csharp/Grpc.IntegrationTesting/Metrics.cs @@ -44,7 +44,7 @@ namespace Grpc.Testing { } #region Messages /// <summary> - /// Reponse message containing the gauge name and value + /// Reponse message containing the gauge name and value /// </summary> public sealed partial class GaugeResponse : pb::IMessage<GaugeResponse> { private static readonly pb::MessageParser<GaugeResponse> _parser = new pb::MessageParser<GaugeResponse>(() => new GaugeResponse()); @@ -282,7 +282,7 @@ namespace Grpc.Testing { } /// <summary> - /// Request message containing the gauge name + /// Request message containing the gauge name /// </summary> public sealed partial class GaugeRequest : pb::IMessage<GaugeRequest> { private static readonly pb::MessageParser<GaugeRequest> _parser = new pb::MessageParser<GaugeRequest>(() => new GaugeRequest()); diff --git a/src/csharp/Grpc.IntegrationTesting/Payloads.cs b/src/csharp/Grpc.IntegrationTesting/Payloads.cs index 7aef35cda3..f918b9576b 100644 --- a/src/csharp/Grpc.IntegrationTesting/Payloads.cs +++ b/src/csharp/Grpc.IntegrationTesting/Payloads.cs @@ -335,8 +335,8 @@ namespace Grpc.Testing { } /// <summary> - /// TODO (vpai): Fill this in once the details of complex, representative - /// protos are decided + /// TODO (vpai): Fill this in once the details of complex, representative + /// protos are decided /// </summary> public sealed partial class ComplexProtoParams : pb::IMessage<ComplexProtoParams> { private static readonly pb::MessageParser<ComplexProtoParams> _parser = new pb::MessageParser<ComplexProtoParams>(() => new ComplexProtoParams()); diff --git a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs index f85e272711..377dad63f4 100644 --- a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs +++ b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs @@ -37,6 +37,7 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Google.Protobuf; using Grpc.Core; using Grpc.Core.Utils; using Grpc.Testing; @@ -68,7 +69,7 @@ namespace Grpc.IntegrationTesting server = new Server { - Services = { TestService.BindService(new TestServiceImpl()) }, + Services = { TestService.BindService(new SslCredentialsTestServiceImpl()) }, Ports = { { Host, ServerPort.PickUnused, serverCredentials } } }; server.Start(); @@ -95,5 +96,40 @@ namespace Grpc.IntegrationTesting var response = client.UnaryCall(new SimpleRequest { ResponseSize = 10 }); Assert.AreEqual(10, response.Payload.Body.Length); } + + [Test] + public async Task AuthContextIsPopulated() + { + var call = client.StreamingInputCall(); + await call.RequestStream.CompleteAsync(); + var response = await call.ResponseAsync; + Assert.AreEqual(12345, response.AggregatedPayloadSize); + } + + private class SslCredentialsTestServiceImpl : TestService.TestServiceBase + { + public override async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context) + { + return new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) }; + } + + public override async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream, ServerCallContext context) + { + var authContext = context.AuthContext; + await requestStream.ForEachAsync(async request => {}); + + Assert.IsTrue(authContext.IsPeerAuthenticated); + Assert.AreEqual("x509_subject_alternative_name", authContext.PeerIdentityPropertyName); + Assert.IsTrue(authContext.PeerIdentity.Count() > 0); + Assert.AreEqual("ssl", authContext.FindPropertiesByName("transport_security_type").First().Value); + + return new StreamingInputCallResponse { AggregatedPayloadSize = 12345 }; + } + + private static Payload CreateZerosPayload(int size) + { + return new Payload { Body = ByteString.CopyFrom(new byte[size]) }; + } + } } } diff --git a/src/csharp/Grpc.IntegrationTesting/Stats.cs b/src/csharp/Grpc.IntegrationTesting/Stats.cs index 504aa11d8a..79ff220436 100644 --- a/src/csharp/Grpc.IntegrationTesting/Stats.cs +++ b/src/csharp/Grpc.IntegrationTesting/Stats.cs @@ -90,7 +90,7 @@ namespace Grpc.Testing { public const int TimeElapsedFieldNumber = 1; private double timeElapsed_; /// <summary> - /// wall clock time change in seconds since last reset + /// wall clock time change in seconds since last reset /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double TimeElapsed { @@ -104,7 +104,7 @@ namespace Grpc.Testing { public const int TimeUserFieldNumber = 2; private double timeUser_; /// <summary> - /// change in user time (in seconds) used by the server since last reset + /// change in user time (in seconds) used by the server since last reset /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double TimeUser { @@ -118,8 +118,8 @@ namespace Grpc.Testing { 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 + /// change in server time (in seconds) used by the server process and all + /// threads since last reset /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double TimeSystem { @@ -133,7 +133,7 @@ namespace Grpc.Testing { public const int TotalCpuTimeFieldNumber = 4; private ulong totalCpuTime_; /// <summary> - /// change in total cpu time of the server (data from proc/stat) + /// change in total cpu time of the server (data from proc/stat) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong TotalCpuTime { @@ -147,7 +147,7 @@ namespace Grpc.Testing { public const int IdleCpuTimeFieldNumber = 5; private ulong idleCpuTime_; /// <summary> - /// change in idle time of the server (data from proc/stat) + /// change in idle time of the server (data from proc/stat) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public ulong IdleCpuTime { @@ -296,7 +296,7 @@ namespace Grpc.Testing { } /// <summary> - /// Histogram params based on grpc/support/histogram.c + /// Histogram params based on grpc/support/histogram.c /// </summary> public sealed partial class HistogramParams : pb::IMessage<HistogramParams> { private static readonly pb::MessageParser<HistogramParams> _parser = new pb::MessageParser<HistogramParams>(() => new HistogramParams()); @@ -335,7 +335,7 @@ namespace Grpc.Testing { public const int ResolutionFieldNumber = 1; private double resolution_; /// <summary> - /// first bucket is [0, 1 + resolution) + /// first bucket is [0, 1 + resolution) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double Resolution { @@ -349,7 +349,7 @@ namespace Grpc.Testing { public const int MaxPossibleFieldNumber = 2; private double maxPossible_; /// <summary> - /// use enough buckets to allow this value + /// use enough buckets to allow this value /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double MaxPossible { @@ -450,7 +450,7 @@ namespace Grpc.Testing { } /// <summary> - /// Histogram data based on grpc/support/histogram.c + /// Histogram data based on grpc/support/histogram.c /// </summary> public sealed partial class HistogramData : pb::IMessage<HistogramData> { private static readonly pb::MessageParser<HistogramData> _parser = new pb::MessageParser<HistogramData>(() => new HistogramData()); @@ -887,7 +887,7 @@ namespace Grpc.Testing { public const int LatenciesFieldNumber = 1; private global::Grpc.Testing.HistogramData latencies_; /// <summary> - /// Latency histogram. Data points are in nanoseconds. + /// Latency histogram. Data points are in nanoseconds. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Testing.HistogramData Latencies { @@ -901,7 +901,7 @@ namespace Grpc.Testing { public const int TimeElapsedFieldNumber = 2; private double timeElapsed_; /// <summary> - /// See ServerStats for details. + /// See ServerStats for details. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public double TimeElapsed { @@ -939,7 +939,7 @@ namespace Grpc.Testing { = pb::FieldCodec.ForMessage(42, global::Grpc.Testing.RequestResultCount.Parser); private readonly pbc::RepeatedField<global::Grpc.Testing.RequestResultCount> requestResults_ = new pbc::RepeatedField<global::Grpc.Testing.RequestResultCount>(); /// <summary> - /// Number of failed requests (one row per status code seen) + /// Number of failed requests (one row per status code seen) /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Grpc.Testing.RequestResultCount> RequestResults { diff --git a/src/csharp/Grpc.IntegrationTesting/packages.config b/src/csharp/Grpc.IntegrationTesting/packages.config index a03ee926f4..030f9d97b8 100644 --- a/src/csharp/Grpc.IntegrationTesting/packages.config +++ b/src/csharp/Grpc.IntegrationTesting/packages.config @@ -1,17 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="BouncyCastle" version="1.7.0" targetFramework="net45" /> - <package id="Castle.Core" version="3.3.3" targetFramework="net45" /> - <package id="CommandLineParser.Unofficial" version="2.0.275" targetFramework="net45" /> - <package id="Google.Apis" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Auth" version="1.16.0" targetFramework="net45" /> - <package id="Google.Apis.Core" version="1.16.0" targetFramework="net45" /> - <package id="Google.Protobuf" version="3.0.0" targetFramework="net45" /> - <package id="log4net" version="2.0.3" targetFramework="net45" /> - <package id="Moq" version="4.6.38-alpha" targetFramework="net45" /> - <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> - <package id="NUnit" version="3.2.0" targetFramework="net45" /> - <package id="NUnitLite" version="3.2.0" targetFramework="net45" /> + <package id="Castle.Core" version="4.0.0" targetFramework="net45" /> + <package id="CommandLineParser" version="2.1.1-beta" targetFramework="net45" /> + <package id="Google.Apis" version="1.21.0" targetFramework="net45" /> + <package id="Google.Apis.Auth" version="1.21.0" targetFramework="net45" /> + <package id="Google.Apis.Core" version="1.21.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> + <package id="Moq" version="4.7.0" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" /> + <package id="NUnit" version="3.6.0" targetFramework="net45" /> + <package id="NUnitLite" version="3.6.0" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> <package id="Zlib.Portable.Signed" version="1.11.0" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.IntegrationTesting/project.json b/src/csharp/Grpc.IntegrationTesting/project.json index eba54318a5..40fc566adc 100644 --- a/src/csharp/Grpc.IntegrationTesting/project.json +++ b/src/csharp/Grpc.IntegrationTesting/project.json @@ -54,18 +54,15 @@ "Grpc.Core": { "target": "project" }, - "Google.Protobuf": "3.0.0", - "CommandLineParser.Unofficial": "2.0.275", - "Moq": "4.6.38-alpha", - "NUnit": "3.2.0", - "NUnitLite": "3.2.0-*" + "Google.Protobuf": "3.2.0", + "CommandLineParser": "2.1.1-beta", + "Moq": "4.7.0", + "NUnit": "3.6.0", + "NUnitLite": "3.6.0" }, "frameworks": { "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } + "frameworkAssemblies": {} }, "netcoreapp1.0": { "imports": [ diff --git a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj index c5918b194e..7e2b551799 100644 --- a/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj +++ b/src/csharp/Grpc.Reflection.Tests/Grpc.Reflection.Tests.csproj @@ -35,17 +35,17 @@ <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> - <Reference Include="nunit.framework"> - <HintPath>..\packages\NUnit.3.2.0\lib\net45\nunit.framework.dll</HintPath> - </Reference> - <Reference Include="nunitlite"> - <HintPath>..\packages\NUnitLite.3.2.0\lib\net45\nunitlite.dll</HintPath> + <Reference Include="System.Interactive.Async"> + <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> </Reference> <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> </Reference> - <Reference Include="System.Interactive.Async"> - <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> + <Reference Include="nunit.framework"> + <HintPath>..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll</HintPath> + </Reference> + <Reference Include="nunitlite"> + <HintPath>..\packages\NUnitLite.3.6.0\lib\net45\nunitlite.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> diff --git a/src/csharp/Grpc.Reflection.Tests/packages.config b/src/csharp/Grpc.Reflection.Tests/packages.config index 0fed4dbd41..8a7f7a0652 100644 --- a/src/csharp/Grpc.Reflection.Tests/packages.config +++ b/src/csharp/Grpc.Reflection.Tests/packages.config @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0" targetFramework="net45" /> - <package id="NUnit" version="3.2.0" targetFramework="net45" /> - <package id="NUnitLite" version="3.2.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> + <package id="NUnit" version="3.6.0" targetFramework="net45" /> + <package id="NUnitLite" version="3.6.0" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.Reflection.Tests/project.json b/src/csharp/Grpc.Reflection.Tests/project.json index b90834a25e..fc05557c88 100644 --- a/src/csharp/Grpc.Reflection.Tests/project.json +++ b/src/csharp/Grpc.Reflection.Tests/project.json @@ -45,8 +45,8 @@ "Grpc.Reflection": { "target": "project" }, - "NUnit": "3.2.0", - "NUnitLite": "3.2.0-*" + "NUnit": "3.6.0", + "NUnitLite": "3.6.0" }, "frameworks": { "net45": { }, diff --git a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj index 4e254a0b53..b0ab170e3f 100644 --- a/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj +++ b/src/csharp/Grpc.Reflection/Grpc.Reflection.csproj @@ -36,12 +36,12 @@ <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> <Reference Include="System.Xml" /> - <Reference Include="Google.Protobuf"> - <HintPath>..\packages\Google.Protobuf.3.0.0\lib\net45\Google.Protobuf.dll</HintPath> - </Reference> <Reference Include="System.Interactive.Async"> <HintPath>..\packages\System.Interactive.Async.3.1.1\lib\net45\System.Interactive.Async.dll</HintPath> </Reference> + <Reference Include="Google.Protobuf"> + <HintPath>..\packages\Google.Protobuf.3.2.0\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="..\Grpc.Core\Version.cs"> diff --git a/src/csharp/Grpc.Reflection/Reflection.cs b/src/csharp/Grpc.Reflection/Reflection.cs index 06c5d08030..86e9aace8c 100644 --- a/src/csharp/Grpc.Reflection/Reflection.cs +++ b/src/csharp/Grpc.Reflection/Reflection.cs @@ -70,7 +70,7 @@ namespace Grpc.Reflection.V1Alpha { } #region Messages /// <summary> - /// The message sent by the client when calling ServerReflectionInfo method. + /// The message sent by the client when calling ServerReflectionInfo method. /// </summary> public sealed partial class ServerReflectionRequest : pb::IMessage<ServerReflectionRequest> { private static readonly pb::MessageParser<ServerReflectionRequest> _parser = new pb::MessageParser<ServerReflectionRequest>(() => new ServerReflectionRequest()); @@ -136,7 +136,7 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "file_by_filename" field.</summary> public const int FileByFilenameFieldNumber = 3; /// <summary> - /// Find a proto file by the file name. + /// Find a proto file by the file name. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FileByFilename { @@ -150,9 +150,9 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "file_containing_symbol" field.</summary> public const int FileContainingSymbolFieldNumber = 4; /// <summary> - /// Find the proto file that declares the given fully-qualified symbol name. - /// This field should be a fully-qualified symbol name - /// (e.g. <package>.<service>[.<method>] or <package>.<type>). + /// Find the proto file that declares the given fully-qualified symbol name. + /// This field should be a fully-qualified symbol name + /// (e.g. <package>.<service>[.<method>] or <package>.<type>). /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string FileContainingSymbol { @@ -166,8 +166,8 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "file_containing_extension" field.</summary> public const int FileContainingExtensionFieldNumber = 5; /// <summary> - /// Find the proto file which defines an extension extending the given - /// message type with the given field number. + /// Find the proto file which defines an extension extending the given + /// message type with the given field number. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Reflection.V1Alpha.ExtensionRequest FileContainingExtension { @@ -181,14 +181,14 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "all_extension_numbers_of_type" field.</summary> public const int AllExtensionNumbersOfTypeFieldNumber = 6; /// <summary> - /// Finds the tag numbers used by all known extensions of the given message - /// type, and appends them to ExtensionNumberResponse in an undefined order. - /// Its corresponding method is best-effort: it's not guaranteed that the - /// reflection service will implement this method, and it's not guaranteed - /// that this method will provide all extensions. Returns - /// StatusCode::UNIMPLEMENTED if it's not implemented. - /// This field should be a fully-qualified type name. The format is - /// <package>.<type> + /// Finds the tag numbers used by all known extensions of the given message + /// type, and appends them to ExtensionNumberResponse in an undefined order. + /// Its corresponding method is best-effort: it's not guaranteed that the + /// reflection service will implement this method, and it's not guaranteed + /// that this method will provide all extensions. Returns + /// StatusCode::UNIMPLEMENTED if it's not implemented. + /// This field should be a fully-qualified type name. The format is + /// <package>.<type> /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string AllExtensionNumbersOfType { @@ -202,8 +202,8 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "list_services" field.</summary> public const int ListServicesFieldNumber = 7; /// <summary> - /// List the full names of registered services. The content will not be - /// checked. + /// List the full names of registered services. The content will not be + /// checked. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ListServices { @@ -401,8 +401,8 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// The type name and extension number sent by the client when requesting - /// file_containing_extension. + /// The type name and extension number sent by the client when requesting + /// file_containing_extension. /// </summary> public sealed partial class ExtensionRequest : pb::IMessage<ExtensionRequest> { private static readonly pb::MessageParser<ExtensionRequest> _parser = new pb::MessageParser<ExtensionRequest>(() => new ExtensionRequest()); @@ -441,7 +441,7 @@ namespace Grpc.Reflection.V1Alpha { public const int ContainingTypeFieldNumber = 1; private string containingType_ = ""; /// <summary> - /// Fully-qualified type name. The format should be <package>.<type> + /// Fully-qualified type name. The format should be <package>.<type> /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string ContainingType { @@ -553,7 +553,7 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// The message sent by the server to answer ServerReflectionInfo method. + /// The message sent by the server to answer ServerReflectionInfo method. /// </summary> public sealed partial class ServerReflectionResponse : pb::IMessage<ServerReflectionResponse> { private static readonly pb::MessageParser<ServerReflectionResponse> _parser = new pb::MessageParser<ServerReflectionResponse>(() => new ServerReflectionResponse()); @@ -628,12 +628,12 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "file_descriptor_response" field.</summary> public const int FileDescriptorResponseFieldNumber = 4; /// <summary> - /// This message is used to answer file_by_filename, file_containing_symbol, - /// file_containing_extension requests with transitive dependencies. As - /// the repeated label is not allowed in oneof fields, we use a - /// FileDescriptorResponse message to encapsulate the repeated fields. - /// The reflection service is allowed to avoid sending FileDescriptorProtos - /// that were previously sent in response to earlier requests in the stream. + /// This message is used to answer file_by_filename, file_containing_symbol, + /// file_containing_extension requests with transitive dependencies. As + /// the repeated label is not allowed in oneof fields, we use a + /// FileDescriptorResponse message to encapsulate the repeated fields. + /// The reflection service is allowed to avoid sending FileDescriptorProtos + /// that were previously sent in response to earlier requests in the stream. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Reflection.V1Alpha.FileDescriptorResponse FileDescriptorResponse { @@ -647,7 +647,7 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "all_extension_numbers_response" field.</summary> public const int AllExtensionNumbersResponseFieldNumber = 5; /// <summary> - /// This message is used to answer all_extension_numbers_of_type requst. + /// This message is used to answer all_extension_numbers_of_type requst. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Reflection.V1Alpha.ExtensionNumberResponse AllExtensionNumbersResponse { @@ -661,7 +661,7 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "list_services_response" field.</summary> public const int ListServicesResponseFieldNumber = 6; /// <summary> - /// This message is used to answer list_services request. + /// This message is used to answer list_services request. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Reflection.V1Alpha.ListServiceResponse ListServicesResponse { @@ -675,7 +675,7 @@ namespace Grpc.Reflection.V1Alpha { /// <summary>Field number for the "error_response" field.</summary> public const int ErrorResponseFieldNumber = 7; /// <summary> - /// This message is used when an error occurs. + /// This message is used when an error occurs. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public global::Grpc.Reflection.V1Alpha.ErrorResponse ErrorResponse { @@ -893,9 +893,9 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// Serialized FileDescriptorProto messages sent by the server answering - /// a file_by_filename, file_containing_symbol, or file_containing_extension - /// request. + /// Serialized FileDescriptorProto messages sent by the server answering + /// a file_by_filename, file_containing_symbol, or file_containing_extension + /// request. /// </summary> public sealed partial class FileDescriptorResponse : pb::IMessage<FileDescriptorResponse> { private static readonly pb::MessageParser<FileDescriptorResponse> _parser = new pb::MessageParser<FileDescriptorResponse>(() => new FileDescriptorResponse()); @@ -935,9 +935,9 @@ namespace Grpc.Reflection.V1Alpha { = pb::FieldCodec.ForBytes(10); private readonly pbc::RepeatedField<pb::ByteString> fileDescriptorProto_ = new pbc::RepeatedField<pb::ByteString>(); /// <summary> - /// Serialized FileDescriptorProto messages. We avoid taking a dependency on - /// descriptor.proto, which uses proto2 only features, by making them opaque - /// bytes instead. + /// Serialized FileDescriptorProto messages. We avoid taking a dependency on + /// descriptor.proto, which uses proto2 only features, by making them opaque + /// bytes instead. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<pb::ByteString> FileDescriptorProto { @@ -1012,8 +1012,8 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// A list of extension numbers sent by the server answering - /// all_extension_numbers_of_type request. + /// A list of extension numbers sent by the server answering + /// all_extension_numbers_of_type request. /// </summary> public sealed partial class ExtensionNumberResponse : pb::IMessage<ExtensionNumberResponse> { private static readonly pb::MessageParser<ExtensionNumberResponse> _parser = new pb::MessageParser<ExtensionNumberResponse>(() => new ExtensionNumberResponse()); @@ -1052,8 +1052,8 @@ namespace Grpc.Reflection.V1Alpha { public const int BaseTypeNameFieldNumber = 1; private string baseTypeName_ = ""; /// <summary> - /// Full name of the base type, including the package name. The format - /// is <package>.<type> + /// Full name of the base type, including the package name. The format + /// is <package>.<type> /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string BaseTypeName { @@ -1158,7 +1158,7 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// A list of ServiceResponse sent by the server answering list_services request. + /// A list of ServiceResponse sent by the server answering list_services request. /// </summary> public sealed partial class ListServiceResponse : pb::IMessage<ListServiceResponse> { private static readonly pb::MessageParser<ListServiceResponse> _parser = new pb::MessageParser<ListServiceResponse>(() => new ListServiceResponse()); @@ -1198,8 +1198,8 @@ namespace Grpc.Reflection.V1Alpha { = pb::FieldCodec.ForMessage(10, global::Grpc.Reflection.V1Alpha.ServiceResponse.Parser); private readonly pbc::RepeatedField<global::Grpc.Reflection.V1Alpha.ServiceResponse> service_ = new pbc::RepeatedField<global::Grpc.Reflection.V1Alpha.ServiceResponse>(); /// <summary> - /// The information of each service may be expanded in the future, so we use - /// ServiceResponse message to encapsulate it. + /// The information of each service may be expanded in the future, so we use + /// ServiceResponse message to encapsulate it. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public pbc::RepeatedField<global::Grpc.Reflection.V1Alpha.ServiceResponse> Service { @@ -1274,8 +1274,8 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// The information of a single service used by ListServiceResponse to answer - /// list_services request. + /// The information of a single service used by ListServiceResponse to answer + /// list_services request. /// </summary> public sealed partial class ServiceResponse : pb::IMessage<ServiceResponse> { private static readonly pb::MessageParser<ServiceResponse> _parser = new pb::MessageParser<ServiceResponse>(() => new ServiceResponse()); @@ -1313,8 +1313,8 @@ namespace Grpc.Reflection.V1Alpha { public const int NameFieldNumber = 1; private string name_ = ""; /// <summary> - /// Full name of a registered service, including its package name. The format - /// is <package>.<service> + /// Full name of a registered service, including its package name. The format + /// is <package>.<service> /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public string Name { @@ -1399,7 +1399,7 @@ namespace Grpc.Reflection.V1Alpha { } /// <summary> - /// The error code and error message sent by the server when an error occurs. + /// The error code and error message sent by the server when an error occurs. /// </summary> public sealed partial class ErrorResponse : pb::IMessage<ErrorResponse> { private static readonly pb::MessageParser<ErrorResponse> _parser = new pb::MessageParser<ErrorResponse>(() => new ErrorResponse()); @@ -1438,7 +1438,7 @@ namespace Grpc.Reflection.V1Alpha { public const int ErrorCodeFieldNumber = 1; private int errorCode_; /// <summary> - /// This field uses the error codes defined in grpc::StatusCode. + /// This field uses the error codes defined in grpc::StatusCode. /// </summary> [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public int ErrorCode { diff --git a/src/csharp/Grpc.Reflection/packages.config b/src/csharp/Grpc.Reflection/packages.config index 5ab40b7a8c..eec292b306 100644 --- a/src/csharp/Grpc.Reflection/packages.config +++ b/src/csharp/Grpc.Reflection/packages.config @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Google.Protobuf" version="3.0.0" targetFramework="net45" /> + <package id="Google.Protobuf" version="3.2.0" targetFramework="net45" /> <package id="System.Interactive.Async" version="3.1.1" targetFramework="net45" /> </packages>
\ No newline at end of file diff --git a/src/csharp/Grpc.Reflection/project.json b/src/csharp/Grpc.Reflection/project.json index bfc57661eb..8bfe722f78 100644 --- a/src/csharp/Grpc.Reflection/project.json +++ b/src/csharp/Grpc.Reflection/project.json @@ -22,15 +22,10 @@ }, "dependencies": { "Grpc.Core": "1.2.0-dev", - "Google.Protobuf": "3.0.0" + "Google.Protobuf": "3.2.0" }, "frameworks": { - "net45": { - "frameworkAssemblies": { - "System.Runtime": "", - "System.IO": "" - } - }, + "net45": {}, "netstandard1.5": { "dependencies": { "NETStandard.Library": "1.6.0" diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c index 6a241190b2..491df4de6a 100644 --- a/src/csharp/ext/grpc_csharp_ext.c +++ b/src/csharp/ext/grpc_csharp_ext.c @@ -1023,6 +1023,31 @@ GPR_EXPORT grpc_call_credentials *GPR_CALLTYPE grpcsharp_metadata_credentials_cr return grpc_metadata_credentials_create_from_plugin(plugin, NULL); } +/* Auth context */ + +GPR_EXPORT grpc_auth_context *GPR_CALLTYPE grpcsharp_call_auth_context(grpc_call *call) { + return grpc_call_auth_context(call); +} + +GPR_EXPORT const char *GPR_CALLTYPE grpcsharp_auth_context_peer_identity_property_name( + const grpc_auth_context *ctx) { + return grpc_auth_context_peer_identity_property_name(ctx); +} + +GPR_EXPORT grpc_auth_property_iterator GPR_CALLTYPE +grpcsharp_auth_context_property_iterator(const grpc_auth_context *ctx) { + return grpc_auth_context_property_iterator(ctx); +} + +GPR_EXPORT const grpc_auth_property *GPR_CALLTYPE grpcsharp_auth_property_iterator_next( + grpc_auth_property_iterator *it) { + return grpc_auth_property_iterator_next(it); +} + +GPR_EXPORT void GPR_CALLTYPE grpcsharp_auth_context_release(grpc_auth_context *ctx) { + grpc_auth_context_release(ctx); +} + /* Logging */ typedef void(GPR_CALLTYPE *grpcsharp_log_func)(const char *file, int32_t line, diff --git a/src/csharp/tests.json b/src/csharp/tests.json index 4ce6769eee..707d140f62 100644 --- a/src/csharp/tests.json +++ b/src/csharp/tests.json @@ -8,6 +8,8 @@ "Grpc.Core.Internal.Tests.MetadataArraySafeHandleTest", "Grpc.Core.Internal.Tests.TimespecTest", "Grpc.Core.Tests.AppDomainUnloadTest", + "Grpc.Core.Tests.AuthContextTest", + "Grpc.Core.Tests.AuthPropertyTest", "Grpc.Core.Tests.CallCredentialsTest", "Grpc.Core.Tests.CallOptionsTest", "Grpc.Core.Tests.ChannelCredentialsTest", @@ -20,7 +22,6 @@ "Grpc.Core.Tests.HalfcloseTest", "Grpc.Core.Tests.MarshallingErrorsTest", "Grpc.Core.Tests.MetadataTest", - "Grpc.Core.Tests.NUnitVersionTest", "Grpc.Core.Tests.PerformanceTest", "Grpc.Core.Tests.PInvokeTest", "Grpc.Core.Tests.ResponseHeadersTest", |