Skip to content

Commit cc23e04

Browse files
authored
Merge | Managed SNI (#3345)
* Move all SNI files to common project * Move all managed SNI classes to ManagedSni namespace * SNIError => SniError * SNIHandle => SniHandle * SNILoadHandle => SniLoadHandle * SNIMarsConnection => SniMarsConnection * SNIMarsHandle => SniMarsHandle * SNINpHandle => SniNpHandle * SNIPacket => SniPacket * SNIPhysicalHandle => SniPhysicalHandle * SNIProxy => SniProxy * SNITcpHandle => SniTcpHandle * Extract SniAsyncCallback to its own file * Extract SniProviders to its own file * Extract SniSmuxHeader to its own file * Extract SniSmuxFlags to its own file * SNICommon => SniCommon * Extract SniSslStream to its own file * Extract SniNetworkStream to its own file, delete SniStreams file * Merge value task partial into the appropriate stream classes * Wrap all files in #if NET * SNISMUXHeader => SniSmuxHeader ... whoops * Rename SSRP to SsrpClient * Change reflection references to SNI * Fix release-only reference * I can't trust any changes I make to the test projects, so I'm just gonna roll back this change.
1 parent 85f00ea commit cc23e04

38 files changed

+997
-812
lines changed

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 70 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,69 @@
275275
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\LocalAppContextSwitches.cs">
276276
<Link>Microsoft\Data\SqlClient\LocalAppContextSwitches.cs</Link>
277277
</Compile>
278+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\ConcurrentQueueSemaphore.netcore.cs">
279+
<Link>Microsoft\Data\SqlClient\ManagedSni\ConcurrentQueueSemaphore.netcore.cs</Link>
280+
</Compile>
281+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniAsyncCallback.netcore.cs">
282+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniAsyncCallback.netcore.cs</Link>
283+
</Compile>
284+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniError.netcore.cs">
285+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniError.netcore.cs</Link>
286+
</Compile>
287+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniCommon.netcore.cs">
288+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniCommon.netcore.cs</Link>
289+
</Compile>
290+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniHandle.netcore.cs">
291+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniHandle.netcore.cs</Link>
292+
</Compile>
293+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniLoadHandle.netcore.cs">
294+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniLoadHandle.netcore.cs</Link>
295+
</Compile>
296+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniMarsConnection.netcore.cs">
297+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniMarsConnection.netcore.cs</Link>
298+
</Compile>
299+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniMarsHandle.netcore.cs">
300+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniMarsHandle.netcore.cs</Link>
301+
</Compile>
302+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniNetworkStream.netcore.cs">
303+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniNetworkStream.netcore.cs</Link>
304+
</Compile>
305+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniNpHandle.netcore.cs">
306+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniNpHandle.netcore.cs</Link>
307+
</Compile>
308+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniPacket.netcore.cs">
309+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniPacket.netcore.cs</Link>
310+
</Compile>
311+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniPhysicalHandle.netcore.cs">
312+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniPhysicalHandle.netcore.cs</Link>
313+
</Compile>
314+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniProviders.netcore.cs">
315+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniProviders.netcore.cs</Link>
316+
</Compile>
317+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniProxy.netcore.cs">
318+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniProxy.netcore.cs</Link>
319+
</Compile>
320+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniSmuxFlags.netcore.cs">
321+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniSmuxFlags.netcore.cs</Link>
322+
</Compile>
323+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniSmuxHeader.netcore.cs">
324+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniSmuxHeader.netcore.cs</Link>
325+
</Compile>
326+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniSslStream.netcore.cs">
327+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniSslStream.netcore.cs</Link>
328+
</Compile>
329+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SniTcpHandle.netcore.cs">
330+
<Link>Microsoft\Data\SqlClient\ManagedSni\SniTcpHandle.netcore.cs</Link>
331+
</Compile>
332+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.netcore.cs">
333+
<Link>Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.netcore.cs</Link>
334+
</Compile>
335+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.NetCoreApp.cs">
336+
<Link>Microsoft\Data\SqlClient\ManagedSni\SslOverTdsStream.NetCoreApp.cs</Link>
337+
</Compile>
338+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\SsrpClient.netcore.cs">
339+
<Link>Microsoft\Data\SqlClient\ManagedSni\SsrpClient.netcore.cs</Link>
340+
</Compile>
278341
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\NoneAttestationEnclaveProvider.cs">
279342
<Link>Microsoft\Data\SqlClient\NoneAttestationEnclaveProvider.cs</Link>
280343
</Compile>
@@ -731,25 +794,8 @@
731794
<Compile Include="$(CommonSourceRoot)System\Diagnostics\CodeAnalysis.cs">
732795
<Link>System\Diagnostics\CodeAnalysis.cs</Link>
733796
</Compile>
734-
797+
735798
<Compile Include="Microsoft\Data\Common\ConnectionString\DbConnectionOptions.netcore.cs" />
736-
<Compile Include="Microsoft\Data\SqlClient\SNI\ConcurrentQueueSemaphore.cs" />
737-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIError.cs" />
738-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNICommon.cs" />
739-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIHandle.cs" />
740-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNILoadHandle.cs" />
741-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIMarsConnection.cs" />
742-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIMarsHandle.cs" />
743-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNINpHandle.cs" />
744-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIPacket.cs" />
745-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIPhysicalHandle.cs" />
746-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIProxy.cs" />
747-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIStreams.cs" />
748-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNIStreams.ValueTask.cs" />
749-
<Compile Include="Microsoft\Data\SqlClient\SNI\SNITcpHandle.cs" />
750-
<Compile Include="Microsoft\Data\SqlClient\SNI\SslOverTdsStream.cs" />
751-
<Compile Include="Microsoft\Data\SqlClient\SNI\SslOverTdsStream.NetCoreApp.cs" />
752-
<Compile Include="Microsoft\Data\SqlClient\SNI\SSRP.cs" />
753799
<Compile Include="Microsoft\Data\SqlClient\SqlAppContextSwitchManager.NetCoreApp.cs" />
754800
<Compile Include="Microsoft\Data\SqlClient\SqlBulkCopy.cs" />
755801
<Compile Include="Microsoft\Data\SqlClient\SqlConnectionFactory.AssemblyLoadContext.cs" />
@@ -882,6 +928,9 @@
882928
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Windows.cs">
883929
<Link>Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Windows.cs</Link>
884930
</Compile>
931+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Windows.cs">
932+
<Link>Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Windows.cs</Link>
933+
</Compile>
885934
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\PacketHandle.Windows.cs">
886935
<Link>Microsoft\Data\SqlClient\PacketHandle.Windows.cs</Link>
887936
</Compile>
@@ -910,7 +959,6 @@
910959
<Link>Microsoft\Data\SqlTypes\SqlFileStream.Windows.cs</Link>
911960
</Compile>
912961

913-
<Compile Include="Microsoft\Data\SqlClient\SNI\LocalDB.Windows.cs" />
914962
<Compile Include="Microsoft\Data\SqlClient\TdsParser.Windows.cs" />
915963
<Compile Include="Microsoft\Data\SqlClient\TdsParserStateObjectNative.cs" />
916964
</ItemGroup>
@@ -929,6 +977,9 @@
929977
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Unix.cs">
930978
<Link>Microsoft\Data\SqlClient\LocalDb\LocalDbApi.Unix.cs</Link>
931979
</Compile>
980+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Unix.cs">
981+
<Link>Microsoft\Data\SqlClient\ManagedSni\LocalDB.netcore.Unix.cs</Link>
982+
</Compile>
932983
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\PacketHandle.netcore.Unix.cs">
933984
<Link>Microsoft\Data\SqlClient\PacketHandle.netcore.Unix.cs</Link>
934985
</Compile>
@@ -951,7 +1002,6 @@
9511002
<Link>Microsoft\Data\SqlTypes\SqlFileStream.netcore.Unix.cs</Link>
9521003
</Compile>
9531004

954-
<Compile Include="Microsoft\Data\SqlClient\SNI\LocalDB.Unix.cs" />
9551005
<Compile Include="Microsoft\Data\SqlClient\TdsParser.Unix.cs" />
9561006
</ItemGroup>
9571007

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.ValueTask.cs

Lines changed: 0 additions & 109 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SNI/SNIStreams.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Unix.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using Microsoft.Data.SqlClient.SNI;
5+
using Microsoft.Data.SqlClient.ManagedSni;
66

77
namespace Microsoft.Data.SqlClient
88
{
@@ -26,7 +26,7 @@ private void WaitForSSLHandShakeToComplete(ref uint error, ref int protocolVersi
2626
private SNIErrorDetails GetSniErrorDetails()
2727
{
2828
SNIErrorDetails details;
29-
SNIError sniError = SNIProxy.Instance.GetLastError();
29+
SniError sniError = SniProxy.Instance.GetLastError();
3030
details.sniErrorNumber = sniError.sniError;
3131
details.errorMessage = sniError.errorMessage;
3232
details.nativeError = sniError.nativeError;

src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/TdsParser.Windows.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
using System;
66
using System.Diagnostics;
77
using Interop.Windows.Sni;
8-
using Microsoft.Data.SqlClient.SNI;
8+
using Microsoft.Data.SqlClient.ManagedSni;
9+
using SniError = Microsoft.Data.SqlClient.ManagedSni.SniError;
910

1011
namespace Microsoft.Data.SqlClient
1112
{
@@ -68,7 +69,7 @@ private SNIErrorDetails GetSniErrorDetails()
6869

6970
if (TdsParserStateObjectFactory.UseManagedSNI)
7071
{
71-
SNIError sniError = SNIProxy.Instance.GetLastError();
72+
SniError sniError = SniProxy.Instance.GetLastError();
7273
details.sniErrorNumber = sniError.sniError;
7374
details.errorMessage = sniError.errorMessage;
7475
details.nativeError = sniError.nativeError;
@@ -79,7 +80,7 @@ private SNIErrorDetails GetSniErrorDetails()
7980
}
8081
else
8182
{
82-
SniNativeWrapper.SniGetLastError(out SniError sniError);
83+
SniNativeWrapper.SniGetLastError(out Interop.Windows.Sni.SniError sniError);
8384
details.sniErrorNumber = sniError.sniError;
8485
details.errorMessage = sniError.errorMessage;
8586
details.nativeError = sniError.nativeError;

0 commit comments

Comments
 (0)