Example #1
0
        internal ReplicationNeighbor(IntPtr addr, DirectoryServer server, Hashtable table)
        {
            DS_REPL_NEIGHBOR neighbor = new DS_REPL_NEIGHBOR();
            Marshal.PtrToStructure(addr, neighbor);

            _namingContext = Marshal.PtrToStringUni(neighbor.pszNamingContext);
            _sourceServerDN = Marshal.PtrToStringUni(neighbor.pszSourceDsaDN);

            string transportDN = Marshal.PtrToStringUni(neighbor.pszAsyncIntersiteTransportDN);
            if (transportDN != null)
            {
                string rdn = Utils.GetRdnFromDN(transportDN);
                string transport = (Utils.GetDNComponents(rdn))[0].Value;

                if (String.Compare(transport, "SMTP", StringComparison.OrdinalIgnoreCase) == 0)
                    _transportType = ActiveDirectoryTransportType.Smtp;
                else
                    _transportType = ActiveDirectoryTransportType.Rpc;
            }

            _replicaFlags = (ReplicationNeighborOptions)neighbor.dwReplicaFlags;
            _uuidSourceDsaInvocationID = neighbor.uuidSourceDsaInvocationID;
            _usnLastObjChangeSynced = neighbor.usnLastObjChangeSynced;
            _usnAttributeFilter = neighbor.usnAttributeFilter;
            _timeLastSyncSuccess = DateTime.FromFileTime(neighbor.ftimeLastSyncSuccess);
            _timeLastSyncAttempt = DateTime.FromFileTime(neighbor.ftimeLastSyncAttempt);
            _lastSyncResult = neighbor.dwLastSyncResult;
            _consecutiveSyncFailures = neighbor.cNumConsecutiveSyncFailures;

            _server = server;
            _nameTable = table;
        }
 internal ReplicationNeighbor(IntPtr addr, DirectoryServer server, Hashtable table)
 {
     DS_REPL_NEIGHBOR structure = new DS_REPL_NEIGHBOR();
     Marshal.PtrToStructure(addr, structure);
     this.namingContext = Marshal.PtrToStringUni(structure.pszNamingContext);
     this.sourceServerDN = Marshal.PtrToStringUni(structure.pszSourceDsaDN);
     string distinguishedName = Marshal.PtrToStringUni(structure.pszAsyncIntersiteTransportDN);
     if (distinguishedName != null)
     {
         if (string.Compare(Utils.GetDNComponents(Utils.GetRdnFromDN(distinguishedName))[0].Value, "SMTP", StringComparison.OrdinalIgnoreCase) == 0)
         {
             this.transportType = ActiveDirectoryTransportType.Smtp;
         }
         else
         {
             this.transportType = ActiveDirectoryTransportType.Rpc;
         }
     }
     this.replicaFlags = (ReplicationNeighborOptions) structure.dwReplicaFlags;
     this.uuidSourceDsaInvocationID = structure.uuidSourceDsaInvocationID;
     this.usnLastObjChangeSynced = structure.usnLastObjChangeSynced;
     this.usnAttributeFilter = structure.usnAttributeFilter;
     this.timeLastSyncSuccess = DateTime.FromFileTime(structure.ftimeLastSyncSuccess);
     this.timeLastSyncAttempt = DateTime.FromFileTime(structure.ftimeLastSyncAttempt);
     this.lastSyncResult = structure.dwLastSyncResult;
     this.consecutiveSyncFailures = structure.cNumConsecutiveSyncFailures;
     this.server = server;
     this.nameTable = table;
 }