Exemple #1
0
        internal override uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, ref byte[] sendBuff, ref uint sendLength, byte[] _sniSpnBuffer)
        {
            if (_sspiClientContextStatus == null)
            {
                _sspiClientContextStatus = new SspiClientContextStatus();
            }

            SNIProxy.GetInstance().GenSspiClientContext(_sspiClientContextStatus, receivedBuff, ref sendBuff, _sniSpnBuffer);
            sendLength = (uint)(sendBuff != null ? sendBuff.Length : 0);
            return(0);
        }
Exemple #2
0
        internal override PacketHandle ReadSyncOverAsync(int timeoutRemaining, out uint error)
        {
            SNIHandle handle = Handle;

            if (handle == null)
            {
                throw ADP.ClosedConnectionError();
            }
            error = SNIProxy.GetInstance().ReadSyncOverAsync(handle, out SNIPacket packet, timeoutRemaining);
            return(PacketHandle.FromManagedPacket(packet));
        }
Exemple #3
0
        internal override uint GenerateSspiClientContext(byte[] receivedBuff, uint receivedLength, ref byte[] sendBuff, ref uint sendLength, byte[][] _sniSpnBuffer)
        {
            if (_sspiClientContextStatus == null)
            {
                _sspiClientContextStatus = new SspiClientContextStatus();
            }

            SNIProxy.GetInstance().GenSspiClientContext(_sspiClientContextStatus, receivedBuff, ref sendBuff, _sniSpnBuffer);
            SqlClientEventSource.Log.TryTraceEvent("SNIProxy.GenerateSspiClientContext | Info | Session Id {0}", _sessionHandle?.ConnectionId);
            sendLength = (uint)(sendBuff != null ? sendBuff.Length : 0);
            return(0);
        }
Exemple #4
0
 internal override void CreatePhysicalSNIHandle(string serverName, bool ignoreSniOpenTimeout, long timerExpire, out byte[] instanceName, ref byte[] spnBuffer, bool flushCache, bool async, bool parallel, string cachedFQDN, ref SQLDNSInfo pendingDNSInfo, bool isIntegratedSecurity)
 {
     _sessionHandle = SNIProxy.GetInstance().CreateConnectionHandle(this, serverName, ignoreSniOpenTimeout, timerExpire, out instanceName, ref spnBuffer, flushCache, async, parallel, isIntegratedSecurity, cachedFQDN, ref pendingDNSInfo);
     if (_sessionHandle == null)
     {
         _parser.ProcessSNIError(this);
     }
     else if (async)
     {
         // Create call backs and allocate to the session handle
         _sessionHandle.SetAsyncCallbacks(ReadAsyncCallback, WriteAsyncCallback);
     }
 }
Exemple #5
0
        internal override PacketHandle ReadSyncOverAsync(int timeoutRemaining, out uint error)
        {
            SNIHandle handle = Handle;

            if (handle == null)
            {
                throw ADP.ClosedConnectionError();
            }
            error = SNIProxy.GetInstance().ReadSyncOverAsync(handle, out SNIPacket packet, timeoutRemaining);
            SqlClientEventSource.Log.TryTraceEvent("TdsParserStateObjectManaged.ReadSyncOverAsync | Info | State Object Id {0}, Session Id {1}", _objectID, _sessionHandle?.ConnectionId);
#if DEBUG
            SqlClientEventSource.Log.TryAdvancedTraceEvent("TdsParserStateObjectManaged.ReadSyncOverAsync | TRC | State Object Id {0}, Session Id {1}, Packet {2} received, Packet owner Id {3}, Packet dataLeft {4}", _objectID, _sessionHandle?.ConnectionId, packet?._id, packet?._owner.ConnectionId, packet?.DataLeft);
#endif
            return(PacketHandle.FromManagedPacket(packet));
        }
Exemple #6
0
 internal override void CreatePhysicalSNIHandle(string serverName, bool ignoreSniOpenTimeout, long timerExpire, out byte[] instanceName, ref byte[][] spnBuffer, bool flushCache, bool async, bool parallel, string cachedFQDN, ref SQLDNSInfo pendingDNSInfo, bool isIntegratedSecurity)
 {
     _sessionHandle = SNIProxy.GetInstance().CreateConnectionHandle(serverName, ignoreSniOpenTimeout, timerExpire, out instanceName, ref spnBuffer, flushCache, async, parallel, isIntegratedSecurity, cachedFQDN, ref pendingDNSInfo);
     if (_sessionHandle == null)
     {
         _parser.ProcessSNIError(this);
     }
     else
     {
         SqlClientEventSource.Log.TryTraceEvent("TdsParserStateObjectManaged.CreatePhysicalSNIHandle | Info | State Object Id {0}, Session Id {1}, ServerName {2}, Async = {3}", _objectID, _sessionHandle?.ConnectionId, serverName, async);
         if (async)
         {
             // Create call backs and allocate to the session handle
             _sessionHandle.SetAsyncCallbacks(ReadAsyncCallback, WriteAsyncCallback);
         }
     }
 }
Exemple #7
0
 protected override uint SNIPacketGetData(PacketHandle packet, byte[] _inBuff, ref uint dataSize)
 => SNIProxy.GetInstance().PacketGetData(packet.ManagedPacket, _inBuff, ref dataSize);
Exemple #8
0
 internal override uint SetConnectionBufferSize(ref uint unsignedPacketSize) => SNIProxy.GetInstance().SetConnectionBufferSize(Handle, unsignedPacketSize);
Exemple #9
0
 internal override uint EnableSsl(ref uint info) => SNIProxy.GetInstance().EnableSsl(Handle, info);
Exemple #10
0
 internal override uint DisableSsl() => SNIProxy.GetInstance().DisableSsl(Handle);
Exemple #11
0
 internal override uint SniGetConnectionId(ref Guid clientConnectionId) => SNIProxy.GetInstance().GetConnectionId(Handle, ref clientConnectionId);
Exemple #12
0
 internal override void SetPacketData(PacketHandle packet, byte[] buffer, int bytesUsed) => SNIProxy.GetInstance().PacketSetData(packet.ManagedPacket, buffer, bytesUsed);
Exemple #13
0
 internal override uint WritePacket(PacketHandle packet, bool sync) =>
 SNIProxy.GetInstance().WritePacket(Handle, packet.ManagedPacket, sync);
Exemple #14
0
 internal override PacketHandle ReadAsync(SessionHandle handle, out uint error)
 {
     error = SNIProxy.GetInstance().ReadAsync(handle.ManagedHandle, out SNIPacket packet);
     return(PacketHandle.FromManagedPacket(packet));
 }
Exemple #15
0
        internal override uint CheckConnection()
        {
            SNIHandle handle = Handle;

            return(handle == null ? TdsEnums.SNI_SUCCESS : SNIProxy.GetInstance().CheckConnection(handle));
        }
Exemple #16
0
 internal override PacketHandle ReadAsync(SessionHandle handle, out uint error)
 {
     error = SNIProxy.GetInstance().ReadAsync(handle.ManagedHandle, out SNIPacket packet);
     SqlClientEventSource.Log.TryTraceEvent("TdsParserStateObjectManaged.ReadAsync | Info | State Object Id {0}, Session Id {1}, Packet DataLeft {2}", _objectID, _sessionHandle?.ConnectionId, packet?.DataLeft);
     return(PacketHandle.FromManagedPacket(packet));
 }