ANSC_STATUS
CosaDdnsRegGetDdnsInfo
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PCOSA_DATAMODEL_DDNS            pMyObject         = (PCOSA_DATAMODEL_DDNS     )hThisObject;
    PSLIST_HEADER                   pListHead         = (PSLIST_HEADER            )&pMyObject->ContextHead;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoDdns   = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderDdns;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoDdnsSp = (PPOAM_IREP_FOLDER_OBJECT )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext      = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_DML_DDNS_SERVICE          pDdnsService      = (PCOSA_DML_DDNS_SERVICE   )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry       = (PSINGLE_LINK_ENTRY       )NULL;
    PSLAP_VARIABLE                  pSlapVariable     = (PSLAP_VARIABLE           )NULL;
    ULONG                           ulEntryCount      = 0;
    ULONG                           ulIndex           = 0;
    ULONG                           ulInstanceNumber  = 0;
    char*                           pFolderName       = NULL;
    char*                           pAlias            = NULL;

    if ( !pPoamIrepFoDdns )
    {
        return ANSC_STATUS_FAILURE;
    }

    /* Load the newly added but not yet commited entries */

    ulEntryCount = pPoamIrepFoDdns->GetFolderCount((ANSC_HANDLE)pPoamIrepFoDdns);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pFolderName =
            pPoamIrepFoDdns->EnumFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoDdns,
                    ulIndex
                );

        if ( !pFolderName )
        {
            continue;
        }

        pPoamIrepFoDdnsSp = pPoamIrepFoDdns->GetFolder((ANSC_HANDLE)pPoamIrepFoDdns, pFolderName);

        AnscFreeMemory(pFolderName);

        if ( !pPoamIrepFoDdnsSp )
        {
            continue;
        }

        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoDdnsSp->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoDdnsSp,
                        COSA_DML_RR_NAME_DdnsServiceInsNum,
                        NULL
                    );

            if ( pSlapVariable )
            {
                ulInstanceNumber = pSlapVariable->Variant.varUint32;

                SlapFreeVariable(pSlapVariable);
            }
        }

        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoDdnsSp->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoDdnsSp,
                        COSA_DML_RR_NAME_DdnsServiceAlias,
                        NULL
                    );

            if ( pSlapVariable )
            {
                pAlias = AnscCloneString(pSlapVariable->Variant.varString);

                SlapFreeVariable(pSlapVariable);
            }

            if ( pAlias == NULL )
            {
                continue;
            }
        }

        pPoamIrepFoDdnsSp->Remove((ANSC_HANDLE)pPoamIrepFoDdnsSp);

        pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

        if ( !pCosaContext )
        {
            AnscFreeMemory(pAlias);

            return ANSC_STATUS_RESOURCES;
        }

        pDdnsService = (PCOSA_DML_DDNS_SERVICE)AnscAllocateMemory(sizeof(COSA_DML_DDNS_SERVICE));

        if ( !pDdnsService )
        {
            AnscFreeMemory(pCosaContext);
            AnscFreeMemory(pAlias);

            return ANSC_STATUS_RESOURCES;
        }

        pDdnsService->InstanceNumber = ulInstanceNumber;
        AnscCopyString(pDdnsService->Alias, pAlias);

        AnscFreeMemory(pAlias);

        pCosaContext->InstanceNumber   = ulInstanceNumber;
        pCosaContext->bNew             = TRUE;
        pCosaContext->hContext         = (ANSC_HANDLE)pDdnsService;
        pCosaContext->hParentTable     = NULL;
        pCosaContext->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoDdns;
        pCosaContext->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoDdnsSp;

        CosaSListPushEntryByInsNum(pListHead, pCosaContext);    
    }

    return ANSC_STATUS_SUCCESS;
}
Exemplo n.º 2
0
ANSC_STATUS
CosaNatRegGetNatInfo
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_NAT             pMyObject         = ( PCOSA_DATAMODEL_NAT )hThisObject;

    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoNat      = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderNat;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoNatPt    = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderNatPt;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoEnumNat  = (PPOAM_IREP_FOLDER_OBJECT )NULL;
    PCOSA_CONTEXT_PMAPPING_LINK_OBJECT     pCosaNatContext   = NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaNatPtContext   = NULL;
    PCOSA_DML_NAT_PMAPPING          pCosaNat          = NULL;
    PCOSA_DML_NAT_PTRIGGER          pCosaNatPt        = NULL;
    PSLAP_VARIABLE                  pSlapVariable     = NULL;
    ULONG                           ulEntryCount      = 0;
    ULONG                           ulIndex           = 0;
    ULONG                           uInstanceNumber   = 0;
    BOOL                            bNew              = FALSE;
    char*                           pAliasNat         = NULL;
    char*                           pFolderName       = NULL;

    CcspTraceWarning(("!!!!!! In CosaNatRegGetNatInfo !!!!!!\n"));

    if ( !pPoamIrepFoNat || !pPoamIrepFoNatPt )
    {
        CcspTraceWarning(("!!!!!! pPoamIrepFoNat: %p, pPoamIrepFoNatPt: %p !!!!!!\n", pPoamIrepFoNat, pPoamIrepFoNatPt));
        return ANSC_STATUS_FAILURE;
    }

    /* This is saved structure for nat
        *****************************************
              <Nat>
                  <1>
                       <alias>xxx</>
                       <bNew>false</>
                 </1>
                 <2>
                      <alias>xxx</>
                      <bNew>false</>
                 </2>
            </Nat>
      ****************************************************
      */

    /* enumerate Portmapping.{i} */
    ulEntryCount = pPoamIrepFoNat->GetFolderCount((ANSC_HANDLE)pPoamIrepFoNat);
    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        /* Get i in Portmapping.{i} */
        pFolderName =
            pPoamIrepFoNat->EnumFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoNat,
                    ulIndex
                );

        if ( !pFolderName )
        {
            continue;
        }

        uInstanceNumber = _ansc_atol(pFolderName);

        if ( uInstanceNumber == 0 )
        {
            AnscFreeMemory(pFolderName);
            continue;
        }

        pPoamIrepFoEnumNat = pPoamIrepFoNat->GetFolder((ANSC_HANDLE)pPoamIrepFoNat, pFolderName);

        AnscFreeMemory(pFolderName);

        if ( !pPoamIrepFoEnumNat )
        {
            continue;
        }

        /* Get PortMapping.{i}.Alias value*/
        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoEnumNat->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoEnumNat,
                        COSA_DML_RR_NAME_NATAlias,
                        NULL
                    );

            if ( pSlapVariable )
            {
                pAliasNat = AnscCloneString(pSlapVariable->Variant.varString);

                SlapFreeVariable(pSlapVariable);
            }
        }

        /* Get PortMapping.{i}.bNew value*/
        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoEnumNat->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoEnumNat,
                        COSA_DML_RR_NAME_NATbNew,
                        NULL
                    );

            if ( pSlapVariable )
            {
                bNew = pSlapVariable->Variant.varBool;

                SlapFreeVariable(pSlapVariable);
            }
            else
            {
                bNew = TRUE;
            }
        }

        /* Create one entry and keep this delay_added entry */
        pCosaNat = (PCOSA_DML_NAT_PMAPPING)AnscAllocateMemory(sizeof(COSA_DML_NAT_PMAPPING));
        if ( !pCosaNat )
        {
            returnStatus = ANSC_STATUS_FAILURE;
            goto EXIT1;
        }

        /* set some default value firstly */
        NAT_PORTMAPPING_SET_DEFAULTVALUE(pCosaNat);

        /* save alias and instanceNumber */
        pCosaNat->InstanceNumber = uInstanceNumber;
        AnscCopyString( pCosaNat->Alias, pAliasNat );

        /* Create one link point */
        pCosaNatContext = (PCOSA_CONTEXT_PMAPPING_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_PMAPPING_LINK_OBJECT));
        if ( !pCosaNatContext )
        {
            returnStatus = ANSC_STATUS_FAILURE;
            goto EXIT2;
        }

        NAT_PMAPPING_INITIATION_CONTEXT(pCosaNatContext)

        pCosaNatContext->InstanceNumber = pCosaNat->InstanceNumber;
        pCosaNatContext->hContext       = (ANSC_HANDLE)pCosaNat;
        pCosaNat                        = 0;
        pCosaNatContext->bNew           = bNew;

        CosaSListPushEntryByInsNum(&pMyObject->NatPMappingList, (PCOSA_CONTEXT_LINK_OBJECT)pCosaNatContext);

        /* release some memory */
        if (pAliasNat)
        {
            AnscFreeMemory(pAliasNat);
            pAliasNat = NULL;
        }

        pPoamIrepFoEnumNat->Remove((ANSC_HANDLE)pPoamIrepFoEnumNat);
        pPoamIrepFoEnumNat = NULL;
    }

    /* This is saved structure for nat port trigger
        *****************************************
              <Nat>
                <PortTrigger>
                  <Record>NextInsNumber</Record>
                  <1>
                       <alias>xxx</>
                       <bNew>true</>
                 </1>
                 <2>
                      <alias>xxx</>
                      <bNew>true</>
                 </2>
                 </PortTrigger>
            </Nat>
      ****************************************************
      */

    /* enumerate PortTrigger.{i} */
    ulEntryCount = pPoamIrepFoNatPt->GetFolderCount((ANSC_HANDLE)pPoamIrepFoNatPt);
    CcspTraceWarning(("!!!!!! ulEntryCount for PortTrigger: %d !!!!!!\n", ulEntryCount));

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        /* Get i in PortTrigger.{i} */
        pFolderName =
            pPoamIrepFoNatPt->EnumFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoNatPt,
                    ulIndex
                );
        CcspTraceWarning(("!!!!!! pFolderName: %s !!!!!!\n", pFolderName));

        if ( !pFolderName )
        {
            continue;
        }

        uInstanceNumber = _ansc_atol(pFolderName);

        if ( uInstanceNumber == 0 )
        {
            AnscFreeMemory(pFolderName);
            continue;
        }

        pPoamIrepFoEnumNat = pPoamIrepFoNatPt->GetFolder((ANSC_HANDLE)pPoamIrepFoNatPt, pFolderName);

        AnscFreeMemory(pFolderName);

        if ( !pPoamIrepFoEnumNat )
        {
            continue;
        }

        /* Get PortTrigger.{i}.Alias value*/
        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoEnumNat->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoEnumNat,
                        COSA_DML_RR_NAME_NATAlias,
                        NULL
                    );

            if ( pSlapVariable )
            {
                pAliasNat = AnscCloneString(pSlapVariable->Variant.varString);

                SlapFreeVariable(pSlapVariable);
            }
        }

        /* Get PortTrigger.{i}.bNew value*/
        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoEnumNat->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoEnumNat,
                        COSA_DML_RR_NAME_NATbNew,
                        NULL
                    );

            if ( pSlapVariable )
            {
                bNew = pSlapVariable->Variant.varBool;

                SlapFreeVariable(pSlapVariable);
            }
            else
            {
                bNew = TRUE;
            }
        }

        /* Create one entry and keep this delay_added entry */
        pCosaNatPt = (PCOSA_DML_NAT_PTRIGGER)AnscAllocateMemory(sizeof(COSA_DML_NAT_PTRIGGER));

        if ( !pCosaNatPt )
        {
            returnStatus = ANSC_STATUS_RESOURCES;
            goto EXIT1;
        }

        /* set some default value firstly */
        COSA_DML_NAT_PTRIGGER_INIT(pCosaNatPt);

        /* save alias and instanceNumber */
        pCosaNatPt->InstanceNumber = uInstanceNumber;
        AnscCopyString( pCosaNatPt->Alias, pAliasNat );

        CcspTraceWarning(("!!!!!! pCosaNatPt->InstanceNumber: %d, pCosaNatPt->Alias: %s !!!!!!\n", pCosaNatPt->InstanceNumber, pCosaNatPt->Alias));

        /* Create one link point */
        pCosaNatPtContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));
        if ( !pCosaNatPtContext )
        {
            AnscFreeMemory(pCosaNatPt); /*RDKB-6742, CID-33206, Free unused resources after use*/
            pCosaNatPt = NULL;
            returnStatus = ANSC_STATUS_FAILURE;
            goto EXIT2;
        }

         COSA_CONTEXT_LINK_INITIATION_CONTENT(pCosaNatPtContext)

        pCosaNatPtContext->InstanceNumber = pCosaNatPt->InstanceNumber;
        pCosaNatPtContext->hContext       = (ANSC_HANDLE)pCosaNatPt;
        pCosaNatPtContext->bNew           = bNew;

        CosaSListPushEntryByInsNum(&pMyObject->NatPTriggerList, (PCOSA_CONTEXT_LINK_OBJECT)pCosaNatPtContext);

        /* release some memory */
        if (pAliasNat)
        {
            AnscFreeMemory(pAliasNat);
            pAliasNat = NULL;
        }

        pPoamIrepFoEnumNat->Remove((ANSC_HANDLE)pPoamIrepFoEnumNat);
        pPoamIrepFoEnumNat = NULL;
    }



EXIT2:
    if(pCosaNat)
        AnscFreeMemory(pCosaNat);

EXIT1:

    if(pAliasNat)
        AnscFreeMemory(pAliasNat);

    if ( pPoamIrepFoEnumNat )
        pPoamIrepFoEnumNat->Remove((ANSC_HANDLE)pPoamIrepFoEnumNat);

    return returnStatus;
}
Exemplo n.º 3
0
ANSC_STATUS
CosaUsersRegGetUserInfo
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus      = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_USERS           pMyObject         = ( PCOSA_DATAMODEL_USERS )hThisObject;

    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoUser      = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderUser;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoEnumUser  = (PPOAM_IREP_FOLDER_OBJECT )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaUserContext  = NULL;
    PCOSA_DML_USER                  pCosaUser         = NULL;
    
    PSLAP_VARIABLE                  pSlapVariable     = NULL;
    ULONG                           ulEntryCount      = 0;
    ULONG                           ulIndex           = 0;
    ULONG                           uInstanceNumber   = 0;
    BOOL                            bNew              = FALSE;
    char*                           pAliasUser        = NULL;
    char*                           pFolderName       = NULL;


    if ( !pPoamIrepFoUser )
    {
        return ANSC_STATUS_FAILURE;
    }

    /* This is saved structure for user
        *****************************************
              <User>
                  <NextInstanceNumber> xxx </>
                  <1>
                       <alias>xxx</>
                       <bNew>false</>
                 </1>
                 <2>
                      <alias>xxx</>
                      <bNew>false</>
                </2>
            </User>
      ****************************************************
      */

    /* Get Maximum number */
    if ( TRUE )
    {
        pSlapVariable =
            (PSLAP_VARIABLE)pPoamIrepFoUser->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoUser,
                    COSA_DML_RR_NAME_UserNextInsNunmber,
                    NULL
                );

        if ( pSlapVariable )
        {
            pMyObject->maxInstanceOfUser = pSlapVariable->Variant.varUint32;

            SlapFreeVariable(pSlapVariable);
        }
    }

    /* enumerate user.{i} */
    ulEntryCount = pPoamIrepFoUser->GetFolderCount((ANSC_HANDLE)pPoamIrepFoUser);
    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        /* Get i in user.{i} */
        pFolderName =
            pPoamIrepFoUser->EnumFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoUser,
                    ulIndex
                );

        if ( !pFolderName )
        {
            continue;
        }

        uInstanceNumber = _ansc_atol(pFolderName);

        if ( uInstanceNumber == 0 )
        {
            AnscFreeMemory(pFolderName);
            continue;
        }

        pPoamIrepFoEnumUser = pPoamIrepFoUser->GetFolder((ANSC_HANDLE)pPoamIrepFoUser, pFolderName);

        AnscFreeMemory(pFolderName);

        if ( !pPoamIrepFoEnumUser )
        {
            continue;
        }

        /* Get user.{i}.Username value*/
        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoEnumUser->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoEnumUser,
                        COSA_DML_RR_NAME_UserAlias,
                        NULL
                    );

            if ( pSlapVariable )
            {
                pAliasUser = AnscCloneString(pSlapVariable->Variant.varString);

                SlapFreeVariable(pSlapVariable);
            }
        }

        /* Get user.{i}.bNew value*/
        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoEnumUser->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoEnumUser,
                        COSA_DML_RR_NAME_UserbNew,
                        NULL
                    );

            if ( pSlapVariable )
            {
                bNew = pSlapVariable->Variant.varBool;

                SlapFreeVariable(pSlapVariable);
            }
            else
            {
                bNew = TRUE;
            }
        }

        /* Create one entry and keep this delay_added entry */
        pCosaUser = (PCOSA_DML_USER)AnscAllocateMemory(sizeof(COSA_DML_USER));
        if ( !pCosaUser )
        {
            returnStatus = ANSC_STATUS_FAILURE;            
            goto EXIT1;
        }

        /* set some default value firstly */
        USERS_USER_SET_DEFAULTVALUE(pCosaUser);

        /* save alias and instanceNumber */
        pCosaUser->InstanceNumber = uInstanceNumber;
        AnscCopyString( pCosaUser->Username, pAliasUser );

        /* Create one link point */
        pCosaUserContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));
        if ( !pCosaUserContext )
        {
            returnStatus = ANSC_STATUS_FAILURE;
            goto EXIT2;
        }

        COSA_CONTEXT_LINK_INITIATION_CONTENT(pCosaUserContext)

        pCosaUserContext->InstanceNumber = uInstanceNumber;
        pCosaUserContext->hContext       = (ANSC_HANDLE)pCosaUser;
        pCosaUser                        = 0;
        pCosaUserContext->bNew           = bNew;

        CosaSListPushEntryByInsNum(&pMyObject->UserList, (PCOSA_CONTEXT_LINK_OBJECT)pCosaUserContext);

        /* release some memory */
        if (pAliasUser)
        {
            AnscFreeMemory(pAliasUser);
            pAliasUser = NULL;
        }
        
        pPoamIrepFoEnumUser->Remove((ANSC_HANDLE)pPoamIrepFoEnumUser);
        pPoamIrepFoEnumUser = NULL;
    }


    
EXIT2:
    if(pCosaUser)
        AnscFreeMemory(pCosaUser);
        
EXIT1:
    
    if(pAliasUser)
        AnscFreeMemory(pAliasUser);
        
    if ( pPoamIrepFoEnumUser )
        pPoamIrepFoEnumUser->Remove((ANSC_HANDLE)pPoamIrepFoEnumUser);

    return returnStatus;
}
Exemplo n.º 4
0
ANSC_STATUS
CosaRaRegGetInfo

    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_RA              pMyObject       = (PCOSA_DATAMODEL_RA)hThisObject;
    PSLIST_HEADER                   pRAIFHead       = (PSLIST_HEADER)&pMyObject->InterfaceList;
    PCOSA_DML_RA_IF_FULL2           pRAInterface    = (PCOSA_DML_RA_IF_FULL2)NULL;
    PCOSA_DML_RA_IF_FULL2           pRAEntry        = (PCOSA_DML_RA_IF_FULL2)NULL;
    PCOSA_DML_RA_OPTION             pRAOption       = (PCOSA_DML_RA_OPTION)NULL;
    PSINGLE_LINK_ENTRY              pLink           = (PSINGLE_LINK_ENTRY )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext    = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pSubCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoRAHA = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderRAInterfaceHA;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoRAIF = (PPOAM_IREP_FOLDER_OBJECT)NULL;
    PSLAP_VARIABLE                  pSlapVariable   = (PSLAP_VARIABLE          )NULL;
    ULONG                           ulEntryCount            = 0;
    ULONG                           ulIndex                 = 0;
    ULONG                           ulInstanceNumber        = 0;
    ULONG                           ulUpperInstanceNumber   = 0;
    char*                           pFolderName             = NULL;
    char*                           pAlias                  = NULL;

    if ( !pPoamIrepFoRAHA )
    {
        return ANSC_STATUS_FAILURE;
    }

    /* Load the newly added but not yet commited entries */

    ulEntryCount = pPoamIrepFoRAHA->GetFolderCount((ANSC_HANDLE)pPoamIrepFoRAHA);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pFolderName = pPoamIrepFoRAHA->EnumFolder
            (
                (ANSC_HANDLE)pPoamIrepFoRAHA,
                ulIndex
            );

        if ( !pFolderName )
        {
            continue;
        }

        pPoamIrepFoRAIF = (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoRAHA->GetFolder
            (
                (ANSC_HANDLE)pPoamIrepFoRAHA, 
                pFolderName
            );

        if ( !pPoamIrepFoRAIF )
        {
            continue;
        }

        if ( _ansc_strstr(pFolderName, COSA_DML_RR_NAME_RAIF_Prefix) )
        {

            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoRAIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoRAIF,
                    COSA_DML_RR_NAME_RAIF_InsNum,
                    NULL
                );

            if ( pSlapVariable )
            {
                ulInstanceNumber = pSlapVariable->Variant.varUint32;
                SlapFreeVariable(pSlapVariable);
            }
            


            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoRAIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoRAIF,
                    COSA_DML_RR_NAME_RAIF_Alias,
                    NULL
                );

            if ( pSlapVariable )
            {
                pAlias = AnscCloneString(pSlapVariable->Variant.varString);  
                    
                SlapFreeVariable(pSlapVariable);
            }


            pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

            if ( !pCosaContext )
            {
                returnStatus = ANSC_STATUS_RESOURCES;
                goto EXIT;
            }

            pRAInterface = (PCOSA_DML_RA_IF_FULL2)AnscAllocateMemory(sizeof(COSA_DML_RA_IF_FULL2));

            if ( !pRAInterface )
            {
                AnscFreeMemory(pCosaContext);
                
                returnStatus = ANSC_STATUS_RESOURCES;
                
                goto EXIT;
            }

            AnscSListInitializeHeader(&pRAInterface->OptionList);
            
            pRAInterface->ulNextOptionInsNum    = 1;
            
            pRAInterface->Cfg.InstanceNumber = ulInstanceNumber;
            AnscCopyString(pRAInterface->Cfg.Alias, pAlias);

            pCosaContext->InstanceNumber   = ulInstanceNumber;
            pCosaContext->bNew             = TRUE;
            pCosaContext->hContext         = (ANSC_HANDLE)pRAInterface;
            pCosaContext->hParentTable     = NULL;
            pCosaContext->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoRAHA;
            pCosaContext->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoRAIF;
            
            CosaSListPushEntryByInsNum(pRAIFHead, pCosaContext);
        }
        else
        {
            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoRAIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoRAIF,
                    COSA_DML_RR_NAME_RAIF_Upper_InsNum,
                    NULL
                );

            if ( pSlapVariable )
            {
                ulUpperInstanceNumber = pSlapVariable->Variant.varUint32;
                    
                SlapFreeVariable(pSlapVariable);
            }

            if ( ulUpperInstanceNumber != 0 )
            {
                pLink = AnscSListGetFirstEntry(pRAIFHead);

                while ( pLink )
                {
                    pCosaContext  = ACCESS_COSA_CONTEXT_LINK_OBJECT(pLink);
                    pLink   = AnscSListGetNextEntry(pLink);

                    pRAEntry = (PCOSA_DML_RA_IF_FULL2)pCosaContext->hContext;

                    if ( pRAEntry && (pRAEntry->Cfg.InstanceNumber == ulUpperInstanceNumber) )
                    {
                        break;
                    }
                }

                if ( !pRAEntry )
                {
                    returnStatus = ANSC_STATUS_FAILURE;

                    goto EXIT;
                }
            }
            else
            {
                returnStatus = ANSC_STATUS_FAILURE;

                goto EXIT;
            }


            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoRAIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoRAIF,
                    COSA_DML_RR_NAME_RAIF_InsNum,
                    NULL
                );
            
            if ( pSlapVariable )
            {
                ulInstanceNumber = pSlapVariable->Variant.varUint32;            

                SlapFreeVariable(pSlapVariable);
            }
            

            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoRAIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoRAIF,
                    COSA_DML_RR_NAME_RAIF_Alias,
                    NULL
                );
            
            if ( pSlapVariable )
            {
                pAlias = AnscCloneString(pSlapVariable->Variant.varString);            

                SlapFreeVariable(pSlapVariable);
            }
            
            if ( _ansc_strstr(pFolderName, COSA_DML_RR_NAME_RAIF_OPTION_Prefix) )
            {
                pRAOption = (PCOSA_DML_RA_OPTION)AnscAllocateMemory(sizeof(COSA_DML_RA_OPTION));

                if ( !pRAOption )
                {
                    returnStatus = ANSC_STATUS_RESOURCES;

                    goto EXIT;
                }

                pSubCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

                if ( !pSubCosaContext )
                {
                    AnscFreeMemory(pRAOption);            

                    returnStatus = ANSC_STATUS_RESOURCES;

                    goto EXIT;
                }

                pRAOption->InstanceNumber = ulInstanceNumber;
                AnscCopyString(pRAOption->Alias, pAlias);

                pSubCosaContext->InstanceNumber  = ulInstanceNumber;
                pSubCosaContext->hContext        = (ANSC_HANDLE)pRAOption;
                pSubCosaContext->hParentTable    = (ANSC_HANDLE)pRAEntry;
                pSubCosaContext->bNew            = TRUE;
                pSubCosaContext->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoRAHA;
                pSubCosaContext->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoRAIF;

                CosaSListPushEntryByInsNum(&pRAEntry->OptionList, pSubCosaContext);
            }

        }
    
        if ( pAlias )
        {
            AnscFreeMemory(pAlias);
            pAlias = NULL;
        }

        if ( pFolderName )
        {
            AnscFreeMemory(pFolderName);
            pFolderName = NULL;
        }
    }

EXIT:

    if ( pAlias )
    {
        AnscFreeMemory(pAlias);
    }

    return returnStatus;
}
ANSC_STATUS
CosaNeighdiscRegGetInfo

    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus    = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_NEIGHDISC       pMyObject       = (PCOSA_DATAMODEL_NEIGHDISC)hThisObject;
    PSLIST_HEADER                   pNeighdiscIFHead       = (PSLIST_HEADER)&pMyObject->InterfaceList;
    PCOSA_DML_NEIGHDISC_IF_FULL     pNeighdiscInterface    = (PCOSA_DML_NEIGHDISC_IF_FULL)NULL;
    PCOSA_DML_NEIGHDISC_IF_FULL     pNeighdiscEntry        = (PCOSA_DML_NEIGHDISC_IF_FULL)NULL;
    PSINGLE_LINK_ENTRY              pLink           = (PSINGLE_LINK_ENTRY )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext    = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pSubCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoNeighdiscHA = (PPOAM_IREP_FOLDER_OBJECT)pMyObject->hIrepFolderNeighdiscInterfaceHA;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoNeighdiscIF = (PPOAM_IREP_FOLDER_OBJECT)NULL;
    PSLAP_VARIABLE                  pSlapVariable   = (PSLAP_VARIABLE          )NULL;
    ULONG                           ulEntryCount            = 0;
    ULONG                           ulIndex                 = 0;
    ULONG                           ulInstanceNumber        = 0;
    ULONG                           ulUpperInstanceNumber   = 0;
    char*                           pFolderName             = NULL;
    char*                           pAlias                  = NULL;

    if ( !pPoamIrepFoNeighdiscHA )
    {
        return ANSC_STATUS_FAILURE;
    }

    /* Load the newly added but not yet commited entries */

    ulEntryCount = pPoamIrepFoNeighdiscHA->GetFolderCount((ANSC_HANDLE)pPoamIrepFoNeighdiscHA);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pFolderName = pPoamIrepFoNeighdiscHA->EnumFolder
            (
                (ANSC_HANDLE)pPoamIrepFoNeighdiscHA,
                ulIndex
            );

        if ( !pFolderName )
        {
            continue;
        }

        pPoamIrepFoNeighdiscIF = (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoNeighdiscHA->GetFolder
            (
                (ANSC_HANDLE)pPoamIrepFoNeighdiscHA, 
                pFolderName
            );

        if ( !pPoamIrepFoNeighdiscIF )
        {
            continue;
        }

        if ( _ansc_strstr(pFolderName, COSA_DML_RR_NAME_NeighdiscIF_Prefix) )
        {

            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoNeighdiscIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoNeighdiscIF,
                    COSA_DML_RR_NAME_NeighdiscIF_InsNum,
                    NULL
                );

            if ( pSlapVariable )
            {
                ulInstanceNumber = pSlapVariable->Variant.varUint32;
                SlapFreeVariable(pSlapVariable);
            }

            pSlapVariable = (PSLAP_VARIABLE)pPoamIrepFoNeighdiscIF->GetRecord
                (
                    (ANSC_HANDLE)pPoamIrepFoNeighdiscIF,
                    COSA_DML_RR_NAME_NeighdiscIF_Alias,
                    NULL
                );

            if ( pSlapVariable )
            {
                pAlias = AnscCloneString(pSlapVariable->Variant.varString);  
                    
                SlapFreeVariable(pSlapVariable);
            }


            pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

            if ( !pCosaContext )
            {
                returnStatus = ANSC_STATUS_RESOURCES;
                goto EXIT;
            }

            pNeighdiscInterface = (PCOSA_DML_NEIGHDISC_IF_FULL)AnscAllocateMemory(sizeof(COSA_DML_NEIGHDISC_IF_FULL));

            if ( !pNeighdiscInterface )
            {
                AnscFreeMemory(pCosaContext);
                
                returnStatus = ANSC_STATUS_RESOURCES;
                
                goto EXIT;
            }

            pNeighdiscInterface->Cfg.InstanceNumber = ulInstanceNumber;
            AnscCopyString(pNeighdiscInterface->Cfg.Alias, pAlias);

            pCosaContext->InstanceNumber   = ulInstanceNumber;
            pCosaContext->bNew             = TRUE;
            pCosaContext->hContext         = (ANSC_HANDLE)pNeighdiscInterface;
            pCosaContext->hParentTable     = NULL;
            pCosaContext->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoNeighdiscHA;
            pCosaContext->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoNeighdiscIF;
            
            CosaSListPushEntryByInsNum(pNeighdiscIFHead, pCosaContext);
        }
    
        if ( pAlias )
        {
            AnscFreeMemory(pAlias);
            pAlias = NULL;
        }

        if ( pFolderName )
        {
            AnscFreeMemory(pFolderName);
            pFolderName = NULL;
        }
    }

EXIT:

    if ( pAlias )
    {
        AnscFreeMemory(pAlias);
    }

    return returnStatus;
}
ANSC_STATUS
CosaTSIPSubnetRegGetInfo
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PCOSA_DATAMODEL_TSIP            pMyObject               = (PCOSA_DATAMODEL_TSIP     )hThisObject;
    PSLIST_HEADER                   pListHead               = (PSLIST_HEADER            )&pMyObject->SubnetList;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoTSIPSubnet   = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderTSIPSubnet;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoTSIPSubnetSp = (PPOAM_IREP_FOLDER_OBJECT )NULL;
    PCOSA_DML_TSIP_SUBNET_ENTRY     pEntry                  = (PCOSA_DML_TSIP_SUBNET_ENTRY)NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext            = (PCOSA_CONTEXT_LINK_OBJECT)NULL;
    PSLAP_VARIABLE                  pSlapVariable           = (PSLAP_VARIABLE           )NULL;
    ULONG                           ulEntryCount            = 0;
    ULONG                           ulIndex                 = 0;
    ULONG                           ulInstanceNumber        = 0;
    char*                           pFolderName             = NULL;
    char*                           pAlias                  = NULL;

    if ( !pPoamIrepFoTSIPSubnet )
    {
        return ANSC_STATUS_FAILURE;
    }

    /* Load the newly added but not yet commited entries */
    
    ulEntryCount = pPoamIrepFoTSIPSubnet->GetFolderCount((ANSC_HANDLE)pPoamIrepFoTSIPSubnet);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pFolderName =
            pPoamIrepFoTSIPSubnet->EnumFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoTSIPSubnet,
                    ulIndex
                );

        if ( !pFolderName )
        {
            continue;
        }

        pPoamIrepFoTSIPSubnetSp = pPoamIrepFoTSIPSubnet->GetFolder((ANSC_HANDLE)pPoamIrepFoTSIPSubnet, pFolderName);

        AnscFreeMemory(pFolderName);

        if ( !pPoamIrepFoTSIPSubnetSp )
        {
            continue;
        }

        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoTSIPSubnetSp->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoTSIPSubnetSp,
                        COSA_DML_RR_NAME_TSIP_SUBNETInsNum,
                        NULL
                    );

            if ( pSlapVariable )
            {
                ulInstanceNumber = pSlapVariable->Variant.varUint32;

                SlapFreeVariable(pSlapVariable);
            }
        }

        if ( TRUE )
        {
            pSlapVariable =
                (PSLAP_VARIABLE)pPoamIrepFoTSIPSubnetSp->GetRecord
                    (
                        (ANSC_HANDLE)pPoamIrepFoTSIPSubnetSp,
                        COSA_DML_RR_NAME_TSIP_SUBNETAlias,
                        NULL
                    );

            if ( pSlapVariable )
            {
                pAlias = AnscCloneString(pSlapVariable->Variant.varString);

                SlapFreeVariable(pSlapVariable);
            }
        }

        pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

        if ( !pCosaContext )
        {
            AnscFreeMemory(pAlias);

            return ANSC_STATUS_RESOURCES;
        }

        pEntry = (PCOSA_DML_TSIP_SUBNET_ENTRY)AnscAllocateMemory(sizeof(COSA_DML_TSIP_SUBNET_ENTRY));

        if ( !pEntry )
        {
            AnscFreeMemory(pAlias);
            AnscFreeMemory(pCosaContext);

            return ANSC_STATUS_RESOURCES;
        }

        AnscCopyString(pEntry->Alias, pAlias);

        pEntry->InstanceNumber = ulInstanceNumber;

        pCosaContext->InstanceNumber        = ulInstanceNumber;
        pCosaContext->bNew                  = TRUE;
        pCosaContext->hContext              = (ANSC_HANDLE)pEntry;
        pCosaContext->hParentTable          = NULL;
        pCosaContext->hPoamIrepUpperFo      = (ANSC_HANDLE)pPoamIrepFoTSIPSubnet;
        pCosaContext->hPoamIrepFo           = (ANSC_HANDLE)pPoamIrepFoTSIPSubnetSp;

        CosaSListPushEntryByInsNum(pListHead, pCosaContext);

        if ( pAlias )
        {
            AnscFreeMemory(pAlias);

            pAlias = NULL;
        }
    }
    
    return ANSC_STATUS_SUCCESS;
}
Exemplo n.º 7
0
ANSC_STATUS
CosaBridgingRegGetInfo
    (
        ANSC_HANDLE                 hThisObject
    )
{
    ANSC_STATUS                     returnStatus            = ANSC_STATUS_SUCCESS;
    PCOSA_DATAMODEL_BRIDGING        pMyObject               = (PCOSA_DATAMODEL_BRIDGING    )hThisObject;
    PSLIST_HEADER                   pBridgeHead             = (PSLIST_HEADER               )&pMyObject->BridgeList;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoBRGHA        = (PPOAM_IREP_FOLDER_OBJECT    )pMyObject->hIrepFolderBRGHA;
    PPOAM_IREP_FOLDER_OBJECT        pPoamIrepFoBRGBrg       = (PPOAM_IREP_FOLDER_OBJECT    )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext            = (PCOSA_CONTEXT_LINK_OBJECT   )NULL;
    PCOSA_CONTEXT_LINK_OBJECT       pCosaContext2           = (PCOSA_CONTEXT_LINK_OBJECT   )NULL;
    PCOSA_DML_BRG_FULL_ALL          pDmlBridge              = (PCOSA_DML_BRG_FULL_ALL      )NULL;
    PCOSA_DML_BRG_FULL_ALL          pDmlBrgEntry            = (PCOSA_DML_BRG_FULL_ALL      )NULL;
    PCOSA_DML_BRG_PORT_FULL         pPort                   = (PCOSA_DML_BRG_PORT_FULL     )NULL;
    PSLAP_VARIABLE                  pSlapVariable           = (PSLAP_VARIABLE              )NULL;
    PSINGLE_LINK_ENTRY              pSLinkEntry             = (PSINGLE_LINK_ENTRY          )NULL;
    ULONG                           ulEntryCount            = 0;
    ULONG                           ulIndex                 = 0;
    ULONG                           ulInstanceNumber        = 0;
    ULONG                           ulUpperInstanceNumber   = 0;
    char*                           pFolderName             = NULL;
    char*                           pBridgeName             = NULL;
    char*                           pAlias                  = NULL;
    BOOLEAN                         found = FALSE;
    if ( !pPoamIrepFoBRGHA )
    {
        return ANSC_STATUS_FAILURE;
    }

    /* Load the newly added but not yet commited entries */

    ulEntryCount = pPoamIrepFoBRGHA->GetFolderCount((ANSC_HANDLE)pPoamIrepFoBRGHA);

    for ( ulIndex = 0; ulIndex < ulEntryCount; ulIndex++ )
    {
        pFolderName =
            pPoamIrepFoBRGHA->EnumFolder
                (
                    (ANSC_HANDLE)pPoamIrepFoBRGHA,
                    ulIndex
                );

        if ( !pFolderName )
        {
            continue;
        }

        pPoamIrepFoBRGBrg = pPoamIrepFoBRGHA->GetFolder((ANSC_HANDLE)pPoamIrepFoBRGHA, pFolderName);

        if ( !pPoamIrepFoBRGBrg )
        {
            continue;
        }


        if ( _ansc_strstr(pFolderName, "Bridge") )
        {
            if ( TRUE )
            {
                pSlapVariable =
                    (PSLAP_VARIABLE)pPoamIrepFoBRGBrg->GetRecord
                        (
                            (ANSC_HANDLE)pPoamIrepFoBRGBrg,
                            COSA_DML_RR_NAME_Bridge_InsNum,
                            NULL
                        );

                if ( pSlapVariable )
                {
                    ulInstanceNumber = pSlapVariable->Variant.varUint32;
                    SlapFreeVariable(pSlapVariable);
                }
            }

            if ( TRUE )
            {
                pSlapVariable =
                    (PSLAP_VARIABLE)pPoamIrepFoBRGBrg->GetRecord
                        (
                            (ANSC_HANDLE)pPoamIrepFoBRGBrg,
                            COSA_DML_RR_NAME_Bridge_Alias,
                            NULL
                        );

                if ( pSlapVariable )
                {
                    pAlias = AnscCloneString(pSlapVariable->Variant.varString);
                    SlapFreeVariable(pSlapVariable);
                }
            }

            pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

            if ( !pCosaContext )
            {
                returnStatus = ANSC_STATUS_RESOURCES;

                goto EXIT;
            }

            pDmlBridge = (PCOSA_DML_BRG_FULL_ALL)AnscAllocateMemory(sizeof(COSA_DML_BRG_FULL_ALL));

            if ( !pDmlBridge )
            {
                AnscFreeMemory(pCosaContext);

                returnStatus = ANSC_STATUS_RESOURCES;

                goto EXIT;
            }

            AnscSListInitializeHeader(&pDmlBridge->PortList   );
            AnscSListInitializeHeader(&pDmlBridge->VLANList   );
            AnscSListInitializeHeader(&pDmlBridge->VLANPortList);

            pDmlBridge->ulNextPortInsNum = 1;
            pDmlBridge->ulNextVLANInsNum = 1;
            pDmlBridge->ulNextVLANPortInsNum = 1;
            pDmlBridge->Cfg.bAllowDelete = TRUE;
            pDmlBridge->Cfg.InstanceNumber = ulInstanceNumber;
            AnscCopyString(pDmlBridge->Cfg.Alias, pAlias);

            pCosaContext->InstanceNumber   = ulInstanceNumber;
            pCosaContext->bNew             = TRUE;
            pCosaContext->hContext         = (ANSC_HANDLE)pDmlBridge;
            pCosaContext->hParentTable     = NULL;
            pCosaContext->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoBRGHA;
            pCosaContext->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoBRGBrg;
            
            CosaSListPushEntryByInsNum(pBridgeHead, pCosaContext);            
        }
        else
        {
            found = FALSE;
            if ( TRUE )
            {
                pSlapVariable =
                    (PSLAP_VARIABLE)pPoamIrepFoBRGBrg->GetRecord
                        (
                            (ANSC_HANDLE)pPoamIrepFoBRGBrg,
                            COSA_DML_RR_NAME_Bridge_Upper_InsNum,
                            NULL
                        );

                if ( pSlapVariable )
                {
                    ulUpperInstanceNumber = pSlapVariable->Variant.varUint32;
                    SlapFreeVariable(pSlapVariable);
                }

                if ( ulUpperInstanceNumber != 0 )
                {
                    pSLinkEntry = AnscSListGetFirstEntry(pBridgeHead);

                    while ( pSLinkEntry )
                    {
                        pCosaContext  = ACCESS_COSA_CONTEXT_LINK_OBJECT(pSLinkEntry);
                        pSLinkEntry   = AnscSListGetNextEntry(pSLinkEntry);

                        pDmlBrgEntry  = (PCOSA_DML_BRG_FULL_ALL)pCosaContext->hContext;

                        if ( pDmlBrgEntry && (pDmlBrgEntry->Cfg.InstanceNumber == ulUpperInstanceNumber) )
                        {
                            found = TRUE;
                            break;
                        }
                    }
                }
                else
                {
                    return ANSC_STATUS_FAILURE;
                }
            }

            if (found==FALSE)
            {
                //$HL 4/29/2013
                pPoamIrepFoBRGHA->EnableFileSync((ANSC_HANDLE)pPoamIrepFoBRGHA, FALSE);
                pPoamIrepFoBRGBrg->Close((ANSC_HANDLE)pPoamIrepFoBRGBrg);
        
                pPoamIrepFoBRGHA->DelFolder
                    (
                        (ANSC_HANDLE)pPoamIrepFoBRGHA, 
                        pPoamIrepFoBRGBrg->GetFolderName((ANSC_HANDLE)pPoamIrepFoBRGBrg)
                    );

                pPoamIrepFoBRGHA->EnableFileSync((ANSC_HANDLE)pPoamIrepFoBRGHA, TRUE);

                AnscFreeMemory(pPoamIrepFoBRGBrg);
                continue;
            }
            if ( TRUE )
            {
                pSlapVariable =
                    (PSLAP_VARIABLE)pPoamIrepFoBRGBrg->GetRecord
                        (
                            (ANSC_HANDLE)pPoamIrepFoBRGBrg,
                            COSA_DML_RR_NAME_Bridge_InsNum,
                            NULL
                        );

                if ( pSlapVariable )
                {
                    ulInstanceNumber = pSlapVariable->Variant.varUint32;
                    SlapFreeVariable(pSlapVariable);
                }
            }

            if ( TRUE )
            {
                pSlapVariable =
                    (PSLAP_VARIABLE)pPoamIrepFoBRGBrg->GetRecord
                        (
                            (ANSC_HANDLE)pPoamIrepFoBRGBrg,
                            COSA_DML_RR_NAME_Bridge_Alias,
                            NULL
                        );

                if ( pSlapVariable )
                {
                    pAlias = AnscCloneString(pSlapVariable->Variant.varString);
                    SlapFreeVariable(pSlapVariable);
                }
            }

            if ( _ansc_strstr(pFolderName, "Port") )
            {
                pPort = (PCOSA_DML_BRG_PORT_FULL)AnscAllocateMemory(sizeof(COSA_DML_BRG_PORT_FULL));

                if ( !pPort )
                {
                    returnStatus = ANSC_STATUS_RESOURCES;

                    goto EXIT;
                }

                pCosaContext2 = (PCOSA_CONTEXT_LINK_OBJECT)AnscAllocateMemory(sizeof(COSA_CONTEXT_LINK_OBJECT));

                if ( !pCosaContext2 )
                {
                    AnscFreeMemory(pPort);
            
                    returnStatus = ANSC_STATUS_RESOURCES;

                    goto EXIT;
                }

                pPort->Cfg.InstanceNumber = ulInstanceNumber;
                AnscCopyString(pPort->Cfg.Alias, pAlias);
                pPort->Cfg.bAllowDelete = TRUE;
                pCosaContext2->InstanceNumber  = ulInstanceNumber;
                pCosaContext2->hContext        = (ANSC_HANDLE)pPort;
                pCosaContext2->hParentTable    = (ANSC_HANDLE)pDmlBrgEntry;
                pCosaContext2->bNew            = TRUE;
                pCosaContext2->hPoamIrepUpperFo = (ANSC_HANDLE)pPoamIrepFoBRGHA;
                pCosaContext2->hPoamIrepFo      = (ANSC_HANDLE)pPoamIrepFoBRGBrg;

                //$HL 5/1/2013
                pDmlBrgEntry->ulNextPortInsNum = ulInstanceNumber >=pDmlBrgEntry->ulNextPortInsNum ? 
                    ulInstanceNumber+1:pDmlBrgEntry->ulNextPortInsNum;
                CosaSListPushEntryByInsNum(&pDmlBrgEntry->PortList, pCosaContext2);
            }
        }
    }

EXIT:

    AnscFreeMemory(pAlias);

    return returnStatus;
}