ANSC_STATUS CosaRARegDelInfo ( ANSC_HANDLE hThisObject, ANSC_HANDLE hCosaContext ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PCOSA_DATAMODEL_RA pMyObject = (PCOSA_DATAMODEL_RA )hThisObject; PCOSA_CONTEXT_LINK_OBJECT pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)hCosaContext; PPOAM_IREP_FOLDER_OBJECT pPoamIrepUpperFo = (PPOAM_IREP_FOLDER_OBJECT )pCosaContext->hPoamIrepUpperFo; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFo = (PPOAM_IREP_FOLDER_OBJECT )pCosaContext->hPoamIrepFo; if ( !pPoamIrepUpperFo || !pPoamIrepFo ) { return ANSC_STATUS_FAILURE; } else { pPoamIrepUpperFo->EnableFileSync((ANSC_HANDLE)pPoamIrepUpperFo, FALSE); } if ( TRUE ) { pPoamIrepFo->Close((ANSC_HANDLE)pPoamIrepFo); pPoamIrepUpperFo->DelFolder ( (ANSC_HANDLE)pPoamIrepUpperFo, pPoamIrepFo->GetFolderName((ANSC_HANDLE)pPoamIrepFo) ); pPoamIrepUpperFo->EnableFileSync((ANSC_HANDLE)pPoamIrepUpperFo, TRUE); AnscFreeMemory((ANSC_HANDLE)pPoamIrepFo); } return ANSC_STATUS_SUCCESS; }
ANSC_STATUS CosaDdnsRegDelDdnsInfo ( ANSC_HANDLE hThisObject, ANSC_HANDLE hCosaContext ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PCOSA_DATAMODEL_DDNS pMyObject = (PCOSA_DATAMODEL_DDNS )hThisObject; PCOSA_CONTEXT_LINK_OBJECT pCosaContext = (PCOSA_CONTEXT_LINK_OBJECT)hCosaContext; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoDdns = (PPOAM_IREP_FOLDER_OBJECT )pCosaContext->hPoamIrepUpperFo; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoDdnsSp = (PPOAM_IREP_FOLDER_OBJECT )pCosaContext->hPoamIrepFo; if ( !pPoamIrepFoDdns || !pPoamIrepFoDdnsSp ) { return ANSC_STATUS_FAILURE; } else { pPoamIrepFoDdns->EnableFileSync((ANSC_HANDLE)pPoamIrepFoDdns, FALSE); } if ( TRUE ) { pPoamIrepFoDdnsSp->Close((ANSC_HANDLE)pPoamIrepFoDdnsSp); pPoamIrepFoDdns->DelFolder ( (ANSC_HANDLE)pPoamIrepFoDdns, pPoamIrepFoDdnsSp->GetFolderName((ANSC_HANDLE)pPoamIrepFoDdnsSp) ); AnscFreeMemory(pPoamIrepFoDdnsSp); } pPoamIrepFoDdns->EnableFileSync((ANSC_HANDLE)pPoamIrepFoDdns, TRUE); return ANSC_STATUS_SUCCESS; }
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; }