4.1.10.5.5 GetChangesInScope

 procedure GetChangesInScope(
   scope: set of DSName,
   pUtd: ADDRESS OF UPTODATE_VECTOR_V1_EXT,
   ulExtendedOp: DWORD,
   partialAttrs: set of ATTRTYP,
   partialAttrsEx: set of ATTRTYP,
   dirSyncFlags: ULONG,
   var changedObjs: set of ObjAtts,
   var changedLinks: set of ObjAttVal)

Informative summary of behavior: The GetChangesInScope procedure inspects the objects in scope and returns the object and link value updates that are sent to the client over the course of the replication cycle or as a result of processing LDAP Search request with LDAP_SERVER_DIRSYNC_OID control, as determined by the up-to-date vector (pUtd), the extended operation (ulExtendedOp), flags (dirSyncFlags) associated with the LDAP_SERVER_DIRSYNC_OID control, and the partial replica attribute filters (partialAttrs and partialAttrsEx).

 o: DSName
 a: ATTRTYP
 attrsFound: set of ATTRTYP
 attrsReq: set of ATTRTYP
 stamp: AttributeStamp
 cursor: UPTODATE_CURSOR_V2
  
 /* Get the set of objects in scope with attribute stamps that the
  * client did not have knowledge of at the beginning of this 
  * cycle. */
 changedObjs := {}
 foreach o in scope 
   attrsFound := {}
   attrsReq := {}
   foreach a of o's object class
     stamp := AttrStamp(o, a)
     if stamp ≠ null and
        ((ulExtendedOp = EXOP_REPL_SECRETS and IsSecretAttribute(a))
         or not FilterAttribute(o, a, stamp, pUtd,
             partialAttrs, partialAttrsEx, dirSyncFlags)) then
       attrsFound := attrsFound + {a}
     endif
     if(a = instanceType or a = proxiedObjectName) then
       attrsReq := attrsReq + {a}
     endif
   endfor
   if attrsFound ≠ {} then
     changedObjs := changedObjs + [obj: o, atts: attrsFound + attrsReq]
   else if (IT_NC_HEAD in o!instanceType and pUtd ≠ null)
     stamp := AttrStamp(o, uSNChanged)
     cursor := select one c from pUtd^.rgCursors where c.uuidDsa =
       stamp.uuidOriginating
     if cursor = null or cursor.usnHighPropUpdate < stamp.usnOriginating
     then
        changedObjs := changedObjs + [obj: o, atts: attrsFound + attrsReq]
     endif
   endif
 endfor
  
 /* Get the set of link values in scope with stamps that the client
  * did not have knowledge of at the beginning of this cycle. */
 if (GetForestFunctionalLevel() ≥ 1 or dc.fLinkValueStampEnabled = true) then
   changedLinks := {}
   foreach o in scope
     foreach a in Link Attributes of o's object class
       foreach v in GetAttVals(o, a, true)
         stamp := LinkStamp(o, a, v)
         /* If v was last updated in win2k forest mode 
          * then it does not have LinkValueStamp associated with it.
          * LinkStamp() returns null in that case and this value will
          * not be added to changedLinks.
          */ 
         if stamp ≠ null
             and not FilterAttribute(o, a, stamp, pUtd,
                partialAttrs, partialAttrsEx, dirSyncFlags) then
           changedLinks := changedLinks + [obj: o, att: a, val: v]
         endif
       endfor
     endfor
   endfor
 endif