public void CollectConnectionStatus(RpcDatabaseCopyStatus2 copyStatus)
        {
            TcpListener tcpListener = RemoteDataProvider.GetTcpListener();

            if (tcpListener == null)
            {
                ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug <string>((long)this.GetHashCode(), "CollectConnectionStatus ( {0} ): tcpListener is null, so skipping collecting connection status.", this.DatabaseName);
                return;
            }
            NetworkChannel networkChannel = tcpListener.FindSeedingChannel(this);

            if (networkChannel != null)
            {
                ConnectionStatus obj            = new ConnectionStatus(networkChannel.PartnerNodeName, networkChannel.NetworkName, null, ConnectionDirection.Outgoing, true);
                byte[]           seedingNetwork = Serialization.ObjectToBytes(obj);
                copyStatus.SeedingNetwork = seedingNetwork;
            }
            List <ConnectionStatus> list = new List <ConnectionStatus>();

            lock (this.m_activeLogCopyClients)
            {
                foreach (LogCopyServerContext logCopyServerContext in this.m_activeLogCopyClients)
                {
                    ConnectionStatus item = logCopyServerContext.CollectConnectionStatus();
                    list.Add(item);
                }
            }
            ConnectionStatus[] obj2 = list.ToArray();
            byte[]             outgoingConnections = Serialization.ObjectToBytes(obj2);
            copyStatus.OutgoingConnections = outgoingConnections;
        }
示例#2
0
        // Token: 0x0600239E RID: 9118 RVA: 0x000A73DC File Offset: 0x000A55DC
        public static bool GuidTryParse(string str, out Guid guid)
        {
            Guid?guid2 = RemoteDataProvider.StringToGuid(str);

            if (guid2 != null)
            {
                guid = guid2.Value;
                return(true);
            }
            guid = Guid.NewGuid();
            return(false);
        }
示例#3
0
        // Token: 0x06001894 RID: 6292 RVA: 0x00064FAC File Offset: 0x000631AC
        public static TcpServerChannel AuthenticateAsServer(TcpListener listener, Socket connection)
        {
            TcpServerChannel tcpServerChannel = null;
            int             iotimeoutInMSec   = listener.ListenerConfig.IOTimeoutInMSec;
            NegotiateStream negotiateStream   = null;

            using (DisposeGuard disposeGuard = default(DisposeGuard))
            {
                NetworkStream networkStream = new NetworkStream(connection, false);
                disposeGuard.Add <NetworkStream>(networkStream);
                negotiateStream = new NegotiateStream(networkStream, false);
                disposeGuard.Add <NegotiateStream>(negotiateStream);
                negotiateStream.WriteTimeout = iotimeoutInMSec;
                negotiateStream.ReadTimeout  = iotimeoutInMSec;
                negotiateStream.AuthenticateAsServer(CredentialCache.DefaultNetworkCredentials, ProtectionLevel.None, TokenImpersonationLevel.Identification);
                if (!negotiateStream.IsAuthenticated)
                {
                    string text = "Authentication failed";
                    ExTraceGlobals.TcpServerTracer.TraceError((long)connection.GetHashCode(), text);
                    ReplayCrimsonEvents.ServerSideConnectionFailure.LogPeriodic <string, string, string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, connection.RemoteEndPoint.ToString(), connection.LocalEndPoint.ToString(), text);
                }
                if (!negotiateStream.IsMutuallyAuthenticated)
                {
                    ExTraceGlobals.TcpServerTracer.TraceError((long)connection.GetHashCode(), "Mutual Authentication failed");
                }
                WindowsIdentity wid   = negotiateStream.RemoteIdentity as WindowsIdentity;
                string          text2 = null;
                try
                {
                    text2 = negotiateStream.RemoteIdentity.Name;
                }
                catch (SystemException ex)
                {
                    string text3 = string.Format("RemoteIdentity.Name failed: {0}", ex.ToString());
                    ExTraceGlobals.TcpServerTracer.TraceError((long)connection.GetHashCode(), text3);
                    ReplayCrimsonEvents.ServerSideConnectionFailure.LogPeriodic <string, string, string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, connection.RemoteEndPoint.ToString(), connection.LocalEndPoint.ToString(), text3);
                }
                if (!RemoteDataProvider.AuthorizeRequest(wid))
                {
                    ExTraceGlobals.TcpServerTracer.TraceError <string, string>((long)connection.GetHashCode(), "Authorization failed. ClientMachine={0}, User={1}", connection.RemoteEndPoint.ToString(), text2);
                    ReplayCrimsonEvents.ServerSideConnectionFailure.LogPeriodic <string, string, string>(Environment.MachineName, DiagCore.DefaultEventSuppressionInterval, connection.RemoteEndPoint.ToString(), connection.LocalEndPoint.ToString(), string.Format("AuthorizeRequest failed. User={0}", text2));
                    return(null);
                }
                tcpServerChannel = new TcpServerChannel(connection, negotiateStream, listener.ListenerConfig.IOTimeoutInMSec, listener.ListenerConfig.IdleLimit);
                ExTraceGlobals.TcpServerTracer.TraceDebug <string, bool, bool>((long)tcpServerChannel.GetHashCode(), "Connection authenticated as {0}. Encrypted={1} Signed={2}", text2, negotiateStream.IsEncrypted, negotiateStream.IsSigned);
                if (tcpServerChannel != null)
                {
                    disposeGuard.Success();
                }
            }
            return(tcpServerChannel);
        }
示例#4
0
        // Token: 0x060023A0 RID: 9120 RVA: 0x000A7438 File Offset: 0x000A5638
        public static MonitoredDatabase GetMonitoredDatabase(Guid dbGuid)
        {
            string dbGuid2 = dbGuid.ToString();

            return(RemoteDataProvider.GetMonitoredDatabase(dbGuid2));
        }
 // Token: 0x060023B2 RID: 9138 RVA: 0x000A76D1 File Offset: 0x000A58D1
 public void Stop()
 {
     RemoteDataProvider.StopMonitoring();
     NetworkManager.Shutdown();
 }
 // Token: 0x060023B1 RID: 9137 RVA: 0x000A76B3 File Offset: 0x000A58B3
 public bool Start()
 {
     ExTraceGlobals.MonitoredDatabaseTracer.TraceError(0L, "Start RemoteDatabaseProviderWrapper");
     NetworkManager.Start();
     return(RemoteDataProvider.StartListening(true));
 }
示例#7
0
 public MonitoredDatabase FindMonitoredDatabase(string nodeName, Guid dbGuid)
 {
     return(RemoteDataProvider.GetMonitoredDatabase(dbGuid));
 }