4.1.10.6.14 ProcessLinkValue

 procedure ProcessLinkValue(
   replValinf: REPLVALINF_NATIVE,
   nc: DSName,
   sourcePrefixTable: PrefixTable,
   ulFlags: ULONG,
   ulMoreFlags: ULONG): DWORD

Informative summary of behavior: The ProcessLinkValue procedure applies the replicated update of a link value. Following are the input parameters for this procedure.

  • replValinf: The link value replicated update.

  • nc: The DSName of the root of the NC replica where the replicated update is applied.

  • sourcePrefixTable: The prefix table from the server.

  • ulFlags: A DRS_OPTIONS bit field.

  • ulMoreFlags: A DRS_MORE_GETCHGREQ_OPTIONS bit field.

     updateObject: DSName
     targetObject: DSName
     isDeleted: boolean
     attribute: ATTRTYP
     attributeValue: attribute value
     attributeValues: set of attribute value
     newAttributeValue: attribute value
     localValueStamp: LinkValueStamp
     remoteValueStamp: LinkValueStamp
      
     updateObject := replValinf.pObject^
      
     if (not ObjExists(updateObject)) then
       /* The client will stop processing the reply message. It will
        * resend the IDL_DRSGetNCChanges request with DRS_GET_ANC set
        * in ulFlags. It is an error for this condition to occur if the
        * request already  included DRS_GET_ANC in ulFlags. */ 
       return ERROR_DS_DRA_MISSING_PARENT
     endif
      
     if (IsRecycleBinEnabled()) then
        isRecycled := updateObject!isRecycled
        if (isRecycled = true) then
           if (DRS_GET_ANC in ulFlags) then
             /* Local object is recycled, and it is up-to-date. 
                Replicated update is not applied on a recycled object */
             return 0
           else 
             /* Local object is recycled, but it might not be up-to-date. */
             return ERROR_DS_DRA_MISSING_PARENT
           endif
        endif
     else
         isDeleted := updateObject!isDeleted
         if (isDeleted = true) then
           if (DRS_GET_ANC in ulFlags) then
             /* Local object is deleted, and it is up-to-date. 
                Replicated update is not applied on a deleted object.*/
             return 0
           else 
             /* Local object is deleted, but it might not be up-to-date. */
             return ERROR_DS_DRA_MISSING_PARENT
           endif
        endif
     endif
      
     attribute := replValinf.attrTyp
     attributeValues := GetAttrVals(updateObject, attribute, true)
     attributeValue := select one k from attributeValues where 
         (k = ValueFromATTRVAL(
                sourcePrefixTable, Syntax(attribute), replValInf.pAval))
     if (attributeValue = null) then
       localValueStamp := null
     else
       /* If attributeValue was last updated when the forest functional
        * level was DS_BEHAVIOR_WIN2000, no LinkValueStamp is  
        * associated with attributeValue. In that case the procedure
        * LinkStamp() returns null.
        */
       localValueStamp :=
           LinkStamp(updateObject, attribute, attributeValue)
     endif
      
     remoteValueStamp := AbstractLinkValStampFromConcreteLinkValStamp(
                           replValinf.MetaData)
      
     if (localValueStamp = null) or 
        (LinkValueStampCompare(localValueStamp, remoteValueStamp) < 0)
           then
       /* The replicated update is more up to date. Apply that change and
        * modify the stamp. */
      
       newAttributeValue = ValueFromATTRVAL(
           sourcePrefixTable, Syntax(attribute), replValInf.pAval)
       targetObject := GetDSNameFromAttrVal( replValinf.attrTyp, replValInf.pAval)
       if (targetObject = null)
           return ERROR_DS_INVALID_ATTRIBUTE_SYNTAX
       if ((IsRecycleBinEnabled() and targetObject!isRecycled) or
           (not IsRecycleBinEnabled() and targetObject!isDeleted)) then
          if (DRS_GET_TGT in ulMoreFlags) then 
             /* nothing to do */
             return 0
          else
             return ERROR_DS_DRA_RECYCLED_TARGET
       endif
       if (not attributeValue = null) then
         /* Remove the old attribute value. */
         RemoveAttrVal(updateObject, attribute, attributeValue)
       endif
      
       SetAttrVal(updateObject, attribute, newAttributeValue)  
       /* If the abstract variable timeDeleted associated with the
        * attribute  value has a non-zero value, it indicates that the
        * value has been  deleted from the NC replica. */
       if (replValInf.fIsPresent = false) then
         remoteValueStamp.timeDeleted := current time on the client
       else
         remoteValueStamp.timeDeleted := 0
       endif
       SetLinkStamp(updateObject, attribute, newAttributeValue,
           remoteValueStamp)
     endif
     return 0