示例#1
0
            // Token: 0x06004FA3 RID: 20387 RVA: 0x0012629C File Offset: 0x0012449C
            public static byte[][] Rescope(ExchangeTopologyScope topologyScope, byte[][] data)
            {
                byte[][] array = new byte[3][];
                data.CopyTo(array, 0);
                bool flag  = ExchangeTopologyDiscovery.IncludeServices(topologyScope);
                bool flag2 = ExchangeTopologyDiscovery.IncludeADServers(topologyScope);

                if (!flag)
                {
                    array[1] = new byte[12];
                }
                if (!flag2)
                {
                    array[2] = new byte[4];
                }
                return(array);
            }
示例#2
0
        public ExchangeTopology ReadExchangeTopology(DateTime timestamp, ExchangeTopologyScope topologyScope, bool forceRefresh)
        {
            ExchangeTopology result;

            try
            {
                using (TopologyServiceClient topologyServiceClient = TopologyServiceClient.CreateClient("localhost"))
                {
                    byte[][] exchangeTopology = topologyServiceClient.GetExchangeTopology(timestamp, topologyScope, forceRefresh);
                    if (exchangeTopology == null)
                    {
                        result = null;
                    }
                    else
                    {
                        ExchangeTopologyDiscovery.Simple topology          = ExchangeTopologyDiscovery.Simple.Deserialize(exchangeTopology);
                        ExchangeTopologyDiscovery        topologyDiscovery = ExchangeTopologyDiscovery.Simple.CreateFrom(topology);
                        result = ExchangeTopologyDiscovery.Populate(topologyDiscovery);
                    }
                }
            }
            catch (DataSourceOperationException innerException)
            {
                ServiceDiscoveryPermanentException ex = new ServiceDiscoveryPermanentException(ServerStrings.ExReadExchangeTopologyFailed, innerException);
                ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryPermanentException>(0L, "ExchangeTopologyBridge::ReadExchangeTopology. Read ExchangeTopology failed. Throwing exception: {0}.", ex);
                throw ex;
            }
            catch (Exception ex2)
            {
                if (!(ex2 is CommunicationException) && !(ex2 is TimeoutException) && !(ex2 is InvalidOperationException))
                {
                    throw;
                }
                ServiceDiscoveryTransientException ex3 = new ServiceDiscoveryTransientException(ServerStrings.ExReadExchangeTopologyFailed, ex2);
                ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryTransientException>(0L, "ExchangeTopologyBridge::ReadExchangeTopology. Read ExchangeTopology failed. Throwing exception: {0}.", ex3);
                throw ex3;
            }
            return(result);
        }
示例#3
0
        // Token: 0x0600035A RID: 858 RVA: 0x00012274 File Offset: 0x00010474
        public static ADNotificationRequestCookie RegisterExchangeTopologyChangeNotification(ADNotificationCallback callback, object context, ExchangeTopologyScope topologyType)
        {
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(true, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromRootOrgScopeSet(), 387, "RegisterExchangeTopologyChangeNotification", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ADNotificationAdapter.cs");
            ADObjectId childId        = topologyConfigurationSession.ConfigurationNamingContext.GetChildId("CN", "Sites");
            ADObjectId childId2       = childId.GetChildId("CN", "Inter-Site Transports").GetChildId("CN", "IP");
            ADObjectId orgContainerId = topologyConfigurationSession.GetOrgContainerId();

            ADNotificationRequest[] requests;
            switch (topologyType)
            {
            case ExchangeTopologyScope.Complete:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSubnet>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ReceiveConnector>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADEmailTransport>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0]
                };
                break;

            case ExchangeTopologyScope.ADAndExchangeServerAndSiteAndVirtualDirectoryTopology:
                requests = new ADNotificationRequest[]
                {
                    ADNotificationAdapter.RegisterChangeNotification <ADServer>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSite>(childId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADSiteLink>(childId2, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <Server>(orgContainerId, callback, context).Requests[0],
                    ADNotificationAdapter.RegisterChangeNotification <ADVirtualDirectory>(orgContainerId, callback, context).Requests[0]
                };
                break;

            default:
                throw new ArgumentException("topologyType", "topologyType");
            }
            return(new ADNotificationRequestCookie(requests));
        }
示例#4
0
 public IRegisteredExchangeTopologyNotification RegisterExchangeTopologyNotification(ADNotificationCallback callback, ExchangeTopologyScope scope)
 {
     return(new RegisteredExchangeTopologyNotification(callback, scope));
 }
示例#5
0
 internal RegisteredExchangeTopologyNotification(ADNotificationCallback callback, ExchangeTopologyScope scope)
 {
     try
     {
         this.adNotificationRequestCookie = ADNotificationAdapter.RegisterExchangeTopologyChangeNotification(callback, null, scope);
     }
     catch (DataSourceOperationException innerException)
     {
         ServiceDiscoveryPermanentException ex = new ServiceDiscoveryPermanentException(ServerStrings.ExFailedToRegisterExchangeTopologyNotification, innerException);
         ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryPermanentException>(0L, "RegisteredExchangeTopologyNotification::Constructor. Failed to register. Throwing exception: {0}.", ex);
         throw ex;
     }
     catch (ADTransientException innerException2)
     {
         ServiceDiscoveryTransientException ex2 = new ServiceDiscoveryTransientException(ServerStrings.ExFailedToRegisterExchangeTopologyNotification, innerException2);
         ExTraceGlobals.ServiceDiscoveryTracer.TraceError <ServiceDiscoveryTransientException>(0L, "RegisteredExchangeTopologyNotification::Constructor. Failed to register. Throwing exception: {0}.", ex2);
         throw ex2;
     }
 }
示例#6
0
        // Token: 0x06004F84 RID: 20356 RVA: 0x00124DF0 File Offset: 0x00122FF0
        internal static ExchangeTopologyDiscovery Create(ITopologyConfigurationSession session, ExchangeTopologyScope scope)
        {
            ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, ExchangeTopologyScope, string>(0L, "PFD ADPEXT {0} - Exchange Topology discovery with scope {1} started using {2} AD session", 21429, scope, (session != null) ? "caller specified" : "internally created");
            if (session == null)
            {
                session = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 155, "Create", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\ExchangeTopology\\ExchangeTopologyDiscovery.cs");
            }
            ExchangeTopologyDiscovery exchangeTopologyDiscovery = new ExchangeTopologyDiscovery(DateTime.UtcNow, scope);

            exchangeTopologyDiscovery.ReadFromAD(session);
            return(exchangeTopologyDiscovery);
        }
示例#7
0
 // Token: 0x06004F82 RID: 20354 RVA: 0x00124DDC File Offset: 0x00122FDC
 internal static bool IncludeServices(ExchangeTopologyScope topologyScope)
 {
     return(topologyScope == ExchangeTopologyScope.Complete);
 }
示例#8
0
 // Token: 0x06004F83 RID: 20355 RVA: 0x00124DE2 File Offset: 0x00122FE2
 internal static bool IncludeADServers(ExchangeTopologyScope topologyScope)
 {
     return(topologyScope == ExchangeTopologyScope.Complete || topologyScope == ExchangeTopologyScope.ADAndExchangeServerAndSiteTopology);
 }
示例#9
0
 // Token: 0x06004F80 RID: 20352 RVA: 0x00124DBE File Offset: 0x00122FBE
 private ExchangeTopologyDiscovery(DateTime discoveryStarted, ExchangeTopologyScope topologyScope)
 {
     this.discoveryStarted = discoveryStarted;
     this.topologyScope    = topologyScope;
 }
示例#10
0
        public static ExchangeTopology Discover(ITopologyConfigurationSession session, ExchangeTopologyScope scope)
        {
            ExchangeTopologyDiscovery topologyDiscovery = ExchangeTopologyDiscovery.Create(session, scope);

            return(ExchangeTopologyDiscovery.Populate(topologyDiscovery));
        }
示例#11
0
 public static ExchangeTopology Discover(ExchangeTopologyScope scope)
 {
     return(ExchangeTopology.Discover(null, scope));
 }
示例#12
0
 internal ExchangeTopology(DateTime discoveryStarted, ExchangeTopologyScope topologyScope, ReadOnlyCollection <TopologyServer> allTopologyServers, ReadOnlyCollection <TopologySite> allTopologySites, ReadOnlyCollection <TopologySiteLink> allTopologySiteLinks, ReadOnlyCollection <MiniVirtualDirectory> allVirtualDirectories, ReadOnlyCollection <MiniEmailTransport> allEmailTransports, ReadOnlyCollection <MiniReceiveConnector> allSmtpReceiveConnectors, ReadOnlyCollection <ADServer> allAdServers, Dictionary <string, TopologySite> aDServerSiteDictionary, Dictionary <string, ReadOnlyCollection <ADServer> > siteADServerDictionary, Dictionary <string, TopologySite> siteDictionary, string localServerFqdn)
 {
     this.discoveryStarted         = discoveryStarted;
     this.topologyScope            = topologyScope;
     this.allTopologyServers       = allTopologyServers;
     this.allTopologySites         = allTopologySites;
     this.allTopologySiteLinks     = allTopologySiteLinks;
     this.allVirtualDirectories    = allVirtualDirectories;
     this.allEmailTransports       = allEmailTransports;
     this.allSmtpReceiveConnectors = allSmtpReceiveConnectors;
     this.aDServerSiteDictionary   = aDServerSiteDictionary;
     this.siteADServerDictionary   = siteADServerDictionary;
     this.whenCreated = DateTime.UtcNow;
     ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int>(0L, "PFD ADPEXT {0} - Creating ExchangeTopology for public consumption", 25525);
     this.exchangeServerDictionary = new Dictionary <string, TopologyServer>(this.allTopologyServers.Count, StringComparer.OrdinalIgnoreCase);
     foreach (TopologyServer topologyServer in this.allTopologyServers)
     {
         this.exchangeServerDictionary.Add(topologyServer.Id.DistinguishedName, topologyServer);
         if (this.localServer == null && string.Compare(localServerFqdn, topologyServer.Fqdn, StringComparison.OrdinalIgnoreCase) == 0)
         {
             this.localServer = topologyServer;
         }
     }
     ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string>(0L, "PFD ADPEXT {0} - The local server is {1}", 17333, (this.localServer != null) ? this.localServer.Fqdn : "<undefined>");
     if (this.localServer != null)
     {
         this.localSite = this.localServer.TopologySite;
         ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string>(0L, "Local site: {0}", (this.localSite != null) ? this.localSite.Name : "none");
     }
     else
     {
         string siteName = NativeHelpers.GetSiteName(false);
         if (string.IsNullOrEmpty(siteName))
         {
             ExTraceGlobals.ExchangeTopologyTracer.TraceDebug(0L, "Computer doesn't belong to any site");
         }
         else
         {
             ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string>(0L, "GetSiteName returned: {0}", siteName);
             foreach (TopologySite topologySite in this.allTopologySites)
             {
                 if (string.Compare(topologySite.Name, siteName) == 0)
                 {
                     this.localSite = topologySite;
                     ExTraceGlobals.ExchangeTopologyTracer.TraceDebug <string>(0L, "Local site: {0}", this.localSite.Name);
                     break;
                 }
             }
         }
     }
     ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string>(0L, "PFD ADPEXT {0} - The local site is {1}", 31669, (this.localSite != null) ? this.localSite.Name : "<undefined>");
     if (allAdServers != null)
     {
         this.adServerDictionary = new Dictionary <string, ADServer>(allAdServers.Count, StringComparer.OrdinalIgnoreCase);
         foreach (ADServer adserver in allAdServers)
         {
             this.adServerDictionary.Add(adserver.DnsHostName, adserver);
         }
     }
     if (ExTraceGlobals.ExchangeTopologyTracer.IsTraceEnabled(TraceType.PfdTrace))
     {
         foreach (TopologyServer topologyServer2 in this.allTopologyServers)
         {
             ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string, string>((long)this.GetHashCode(), "PFD ADPEXT {0} - Server: {1} belongs to {2}", 23477, topologyServer2.Name, (topologyServer2.TopologySite == null) ? "no site" : topologyServer2.TopologySite.Name);
             ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string, string>((long)this.GetHashCode(), "PFD ADPEXT {0} - Server: FQDN for {1} is {2}", 22453, topologyServer2.Name, topologyServer2.Fqdn);
         }
         foreach (TopologySite topologySite2 in this.allTopologySites)
         {
             StringBuilder stringBuilder = new StringBuilder();
             foreach (ITopologySiteLink topologySiteLink in topologySite2.TopologySiteLinks)
             {
                 TopologySiteLink topologySiteLink2 = (TopologySiteLink)topologySiteLink;
                 stringBuilder.Append(topologySiteLink2.Name);
                 stringBuilder.Append(", ");
             }
             ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string, StringBuilder>((long)this.GetHashCode(), "PFD ADPEXT {0} - Site: {1} links to {2}", 30645, topologySite2.Name, stringBuilder);
         }
         foreach (TopologySiteLink topologySiteLink3 in this.allTopologySiteLinks)
         {
             StringBuilder stringBuilder2 = new StringBuilder();
             foreach (ITopologySite topologySite3 in topologySiteLink3.TopologySites)
             {
                 TopologySite topologySite4 = (TopologySite)topologySite3;
                 stringBuilder2.Append(topologySite4.Name);
                 stringBuilder2.Append(", ");
             }
             ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string, StringBuilder>((long)this.GetHashCode(), "PFD ADPEXT {0} - SiteLink: {1} connects {2}", 19381, topologySiteLink3.Name, stringBuilder2);
         }
         if (this.allVirtualDirectories != null)
         {
             foreach (MiniVirtualDirectory miniVirtualDirectory in this.allVirtualDirectories)
             {
                 ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string, ADObjectId>((long)this.GetHashCode(), "PFD ADPEXT {0} - VirtualDirectory: {1} on {2}", 27573, miniVirtualDirectory.Name, miniVirtualDirectory.Server);
             }
         }
         if (this.allEmailTransports != null)
         {
             foreach (MiniEmailTransport miniEmailTransport in this.allEmailTransports)
             {
                 ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string>((long)this.GetHashCode(), "PFD ADPEXT {0} - Email Transport: {1}", 63987, miniEmailTransport.Name);
             }
         }
         if (this.allSmtpReceiveConnectors != null)
         {
             foreach (MiniReceiveConnector miniReceiveConnector in this.allSmtpReceiveConnectors)
             {
                 ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string>((long)this.GetHashCode(), "PFD ADPEXT {0} - SMTP Receive Connector: {1}", 47603, miniReceiveConnector.Name);
             }
         }
         if (allAdServers != null)
         {
             foreach (ADServer adserver2 in allAdServers)
             {
                 ExTraceGlobals.ExchangeTopologyTracer.TracePfd <int, string, AdName>((long)this.GetHashCode(), "PFD ADPEXT {0} - Domain Controller: {1} on Site {2}", 54149, adserver2.DnsHostName, adserver2.Id.Parent.Parent.Rdn);
             }
         }
     }
 }
示例#13
0
 public byte[][] GetExchangeTopology(DateTime currentTopologyTimeStamp, ExchangeTopologyScope topologyScope, bool forceRefresh)
 {
     return(base.Channel.GetExchangeTopology(currentTopologyTimeStamp, topologyScope, forceRefresh));
 }