Partager via


4.1.10.4.1 ReplicateNCRequestMsg

 procedure ReplicateNCRequestMsg(
   hDrs: DRS_HANDLE,
   version: DWORD,
   nc: DSName,
   rf: RepsFrom,
   ulFlags: ULONG,
   ulMoreFlags: ULONG,
   cMaxObjects: ULONG,
   cMaxBytes: ULONG,
   var msgRequest: DRS_MSG_GETCHGREQ)

Informative summary of behavior: The client sends an IDL_DRSGetNCChanges request to a server to replicate the server's changes in an NC replica. The ReplicateNCRequestMsg procedure specifies how the client constructs the request message for this operation.

The procedure has the following arguments:

  • hDrs: The DRS_HANDLE that is derived by sending an IDL_DRSBind message to the server.

  • version: The version number of the input message negotiated between the client and server.

  • nc: The DSName of the root of the NC replica that is to be replicated.

  • rf: The RepsFrom that corresponds to the server from which to replicate.

  • ulFlags: Zero or more of the following bit flags. The client MUST supply the same flags for each request in a given replication cycle, with the exception of DRS_ADD_REF, DRS_GET_ANC, DRS_USE_COMPRESSION, and DRS_GET_NC_SIZE.

    • DRS_ADD_REF: Requests that the server add an entry to the repsTo attribute for the client on the root object of the NC replica that is being replicated.

    • DRS_WRIT_REP: Indicates that the client contains (or is constructing) a full, writable NC replica.

    • DRS_ASYNC_REP: Requests that the server send only the root object of the NC replica.

    • DRS_CRITICAL_ONLY: Signals the server not to send objects o where o!isCriticalSystemObject is absent or o!isCriticalSystemObject is false.

    • DRS_GET_ANC: Signals the server to send all updates for each ancestor object of object o before sending updates for object o.

    • DRS_GET_NC_SIZE: Signals the server to set cNumNcSizeObjects in pmsgOut to an estimate of the number of objects in its NC replica.

    • DRS_FULL_SYNC_PACKET: Requests that the server send all attributes of the objects in its reply, rather than sending only the updated attributes.

    • DRS_SYNC_FORCED: Signals the server to honor the request even if its replication has otherwise been disabled.

    • DRS_USE_COMPRESSION: Requests that the server reply by using one of the compressed reply versions (DRS_MSG_GETCHGREPLY_V2 or DRS_MSG_GETCHGREPLY_V7).

    • DRS_SYNC_PAS: Indicates replication of additional attributes to the partial replica already present on the client.

    • DRS_SPECIAL_SECRET_PROCESSING: Requests that the server not ship attribute values of attributes that contain secret data. Servers prior to Windows Server 2008 operating system ignore this flag.

    • DRS_GET_ALL_GROUP_MEMBERSHIP: Requests that the server ship all group membership. If this flag is not specified, the server ships only universal group membership. Servers prior to Windows Server 2008 ignore this flag.

    • DRS_REF_GCSPN: Requests that the server add an entry to repsTo for the client on the root object of the NC replica that is being replicated. When repsTo is set using this flag, the notifying client DC contacts the server DC using the service principal name that begins with "GC" (section 2.2.3.2).

  • ulMoreFlags: Zero or more of the following bit flags. The client MUST supply the same flags for each request in a given replication cycle, with the exception of DRS_GET_TGT.

    • DRS_GET_TGT: Signals the server to send all updates for the target object of a link value update before sending the link value update.

  • cMaxObjects: Recommended limit on the number of objects to include in the reply.

  • cMaxBytes: Recommended limit on the number of bytes to include in the reply.

  • msgRequest: The procedure populates corresponding fields in this structure depending on the value that is passed in the version parameter.

     msgIn: DRS_MSG_GETCHGREQ_V10
     msgRequest: DRS_MSG_GETCHGREQ 
     prefixEntry: PrefixTableEntry
     partialAttrSetSeq: sequence of DSName
     schemaSignature: sequence of BYTE
     ncType: ULONG
      
     /* NTDSDSA_OPT_DISABLE_INBOUND_REPL defined in
      * [MS-ADTS] section 6.1.1.2.2.1.2.1.1, "nTDSDSA Object"*/
     if NTDSDSA_OPT_DISABLE_INBOUND_REPL in DSAObj()!options and
        not DRS_SYNC_FORCED in ulFlags then
       return ERROR_DS_DRA_SINK_DISABLED
     endif
      
       if IsAdlds() and ServerExtensions(hDrs).ConfigObjGUID  ≠ NULLGUID and ServerExtensions(hDrs).ConfigObjGUID ≠  ConfigNC().GUID then
            return ERROR_DS_DIFFERENT_REPL_EPOCHS;
       endif
      
     msgIn.ulMoreFlags := ulMoreFlags
     msgIn.cMaxObjects := cMaxObjects
     msgIn.cMaxBytes := cMaxBytes
     msgIn.ulExtendedOp := 0
     msgIn.uuidDsaObjDest := dc.serverGuid
     msgIn.pNC := ADR(nc) 
     msgIn.liFsmoInfo := 0
      
     if (ObjExists(nc)) then
       msgIn.pUpToDateVecDest := 
         ConcreteUTDFromAbstractUTD(nc!replUpToDateVector) 
     else
       msgIn.pUpToDateVecDest := null
     endif
      
     /* Fill usnvecFrom and uuidInvocIdSrc fields. 
      * usnvecFrom: This field contains the value of the usnVec field in 
      * RepsFrom tuple corresponding to the IDL_DRSGetNCChanges server
      * DC, or zeros if no such repsFrom is present.
      * uuidInvocIdSrc: If the usnvecFrom field is not zeros, this field
      * MUST contain the uuidInvocId from the same tuple from which the
      * usnVec field was retrieved. Otherwise, this field contains
      * zeros.*/
      
     if (rf = null) then 
       msgIn.usnvecFrom := 0
       msgIn.uuidInvocIdSrc := 0
     else
       msgIn.usnvecFrom := rf.usnVec
       msgIn.uuidInvocIdSrc := rf.uuidInvocId
     endif
      
     if AmIRODC()then
       if DRS_WRIT_REP in ulFlags then
         return ERROR_DS_DRA_INVALID_PARAMETER
       endif
       ext := ServerExtensions(hDrs)
       if not DRS_EXT_LH_BETA2 in ext.dwFlags and
          msgIn.pNC^ = SchemaNC() then
         ulFlags := ulFlags + {DRS_WRIT_REP}
       endif
     endif
     ncType = GetNCType(nc)
     if not NCT_GC_PARTIAL in ncType then
       ulFlags := ulFlags + {DRS_GET_ALL_GROUP_MEMBERSHIP}
     endif
     msgIn.ulFlags := ulFlags
      
     if (DRS_WRIT_REP in ulFlags) or 
        (not DRS_SYNC_PAS in ulFlags) then
       msgIn.pPartialAttrSetEx := null
     else
       msgIn.pPartialAttrSetEx := ConcretePASFromAbstractPAS(rf.pasData)
     endif
      
     /* set msgIn.pPartialAttrSet field */
     if ObjExists(nc) and nc!partialAttributeSet ≠ null then
         msgIn.pPartialAttrSet := ConcretePASFromAbstractPAS(
                                      nc!partialAttributeSet)
     else
       if (NCT_GC_PARTIAL in ncType  and 
           NCT_FILTERED_ATTRIBUTE_SET in ncType)} then
         msgIn.pPartialAttrSet := FilteredGCPAS()
       else if NCT_FILTERED_ATTRIBUTE_SET in ncType then
         msgIn.pPartialAttrSet := FilteredPAS()
       else if NCT_GC_PARTIAL in ncType then
         msgIn.pPartialAttrSet := GCPAS()
       else
         msgIn.pPartialAttrSet := null
       endif
     endif
      
     msgIn.PrefixTableDest = ConcretePTFromAbstractPT(dc.prefixTable)
      
     /* Add schema signature to msgIn.PrefixTableDest */
     schemaSignature := SchemaInfo()
     prefixEntry.ndx := 0
     prefixEntry.prefix.length := schemaSignature.length
     prefixEntry.prefix.element := elements of schemaSignature
     Append prefixEntry to msgIn.PrefixTableDest.pPrefixEntry
     msgIn.PrefixTableDest.PrefixCount := 
         msgIn.PrefixTableDest.PrefixCount + 1
      
     if version = 5 then
       msgRequest.V5 := msgIn
       msgRequest.V5.pUpToDateVecDestV1 := msgIn.pUpToDateVecDest
     else if version = 8 then
       msgRequest.V8 := msgIn
     else
       msgRequest.V10 := msgIn
     endif