int CcspCcMbi_AddTblRow ( int sessionId, char * objectName, int * instanceNumber, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); int iStatus = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); } if ( (g_currentSessionID != 0) && (sessionId != g_currentSessionID) ) { AnscTraceWarning(("!!! AddTblRow discarded, session id is NOT match !!!\n")); return ANSC_STATUS_DISCARD; } if ( !objectName || !instanceNumber ) { AnscTraceError(("Input parameter invalid for ssp_SsdMbi_AddTblRow\n")); returnStatus = CCSP_ERR_INVALID_ARGUMENTS; goto EXIT; } if ( !pDslhMpaIf ) { AnscTraceError(("pDslhMpaIf is NULL for ssp_SsdMbi_AddTblRow\n")); returnStatus = ANSC_STATUS_INTERNAL_ERROR; goto EXIT; } returnStatus = pDslhMpaIf->AddObject ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, objectName, instanceNumber, &iStatus ); EXIT: return (returnStatus == ANSC_STATUS_SUCCESS) ? CCSP_SUCCESS : returnStatus; }
int CcspCcMbi_SetCommit ( int sessionId, unsigned int writeID, dbus_bool commit, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_CWMP_SOAP_FAULT pCwmpSoapFault = (PDSLH_CWMP_SOAP_FAULT )NULL; int iStatus = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); } if ( (g_currentSessionID != 0) && (sessionId != g_currentSessionID) ) { AnscTraceWarning(("!!! SetCommit discarded, session id is NOT match !!!\n")); return ANSC_STATUS_DISCARD; } if ( !pDslhMpaIf ) { AnscTraceError(("pDslhMpaIf is NULL for ssp_SsdMbi_AddTblRow\n")); returnStatus = ANSC_STATUS_INTERNAL_ERROR; goto EXIT; } returnStatus = pDslhMpaIf->SetCommit ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, &iStatus, sessionId, writeID, commit ); EXIT: return (returnStatus == ANSC_STATUS_SUCCESS) ? CCSP_SUCCESS : CCSP_FAILURE; }
ANSC_STATUS ssp_cancel_tad ( ) { /*RDKB-7459, CID-33428, null check and free */ if(pDslhCpeController) { pDslhCpeController->Cancel((ANSC_HANDLE)pDslhCpeController); AnscFreeMemory(pDslhCpeController); pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT )NULL; } if(hDiagPlugin) { AnscFreeLibrary(hDiagPlugin); hDiagPlugin = NULL; } return ANSC_STATUS_SUCCESS; }
ANSC_STATUS ssp_cancel_wifi ( PCCSP_COMPONENT_CFG pStartCfg ) { int nRet = 0; char CrName[256]; char CpName[256]; if( pDslhCpeController == NULL) { return ANSC_STATUS_SUCCESS; } if ( g_Subsystem[0] != 0 ) { _ansc_sprintf(CrName, "%s%s", g_Subsystem, CCSP_DBUS_INTERFACE_CR); _ansc_sprintf(CpName, "%s%s", g_Subsystem, pStartCfg->ComponentName); } else { _ansc_sprintf(CrName, "%s", CCSP_DBUS_INTERFACE_CR); _ansc_sprintf(CpName, "%s", pStartCfg->ComponentName); } /* unregister component */ nRet = CcspBaseIf_unregisterComponent(bus_handle, CrName, CpName ); AnscTrace("unregisterComponent returns %d\n", nRet); pDslhCpeController->Cancel((ANSC_HANDLE)pDslhCpeController); AnscFreeMemory(pDslhCpeController); pDslhCpeController = NULL; return ANSC_STATUS_SUCCESS; }
ANSC_STATUS ssp_engage_wifi ( PCCSP_COMPONENT_CFG pStartCfg ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; char CrName[256] = {0}; PCCSP_DM_XML_CFG_LIST pXmlCfgList = NULL; g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Yellow; if ( pWifiCcdIf ) { pWifiFcContext->hCcspCcdIf = (ANSC_HANDLE)pWifiCcdIf; pWifiFcContext->hMessageBus = bus_handle; } g_DslhDataModelAgent->SetFcContext((ANSC_HANDLE)g_DslhDataModelAgent, (ANSC_HANDLE)pWifiFcContext); pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)MsgHelper_CreateCcdMbiIf((void*)bus_handle,g_Subsystem)); pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)pWifiCcdIf); pDslhCpeController->SetDbusHandle((ANSC_HANDLE)pDslhCpeController, bus_handle); pDslhCpeController->Engage((ANSC_HANDLE)pDslhCpeController); if ( g_Subsystem[0] != 0 ) { _ansc_sprintf(CrName, "%s%s", g_Subsystem, CCSP_DBUS_INTERFACE_CR); } else { _ansc_sprintf(CrName, "%s", CCSP_DBUS_INTERFACE_CR); } returnStatus = CcspComponentLoadDmXmlList(pStartCfg->DmXmlCfgFileName, &pXmlCfgList); if ( returnStatus != ANSC_STATUS_SUCCESS ) { return returnStatus; } returnStatus = pDslhCpeController->RegisterCcspDataModel ( (ANSC_HANDLE)pDslhCpeController, CrName, /* CCSP CR ID */ pXmlCfgList->FileList[0], /* Data Model XML file. Can be empty if only base data model supported. */ pStartCfg->ComponentName, /* Component Name */ pStartCfg->Version, /* Component Version */ pStartCfg->DbusPath, /* Component Path */ g_Subsystem /* Component Prefix */ ); if ( returnStatus == ANSC_STATUS_SUCCESS || returnStatus == CCSP_SUCCESS ) { /* System is fully initialized */ g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Green; } AnscFreeMemory(pXmlCfgList); return ANSC_STATUS_SUCCESS; }
ANSC_STATUS DslhDmagntEngage ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_DATAMODEL_AGENT_OBJECT pMyObject = (PDSLH_DATAMODEL_AGENT_OBJECT)hThisObject; PANSC_ATOM_TABLE_OBJECT pAtomFunctions = (PANSC_ATOM_TABLE_OBJECT)pMyObject->hAtomFunctions; PDSLH_CPE_CONTROLLER_OBJECT pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT)pMyObject->hDslhCpeController; PSLAP_OBJECT_DESCRIPTOR pObjDescriptor = (PSLAP_OBJECT_DESCRIPTOR )NULL; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoRoot = (PPOAM_IREP_FOLDER_OBJECT )NULL; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoProvision = (PPOAM_IREP_FOLDER_OBJECT )NULL; PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoCOSA = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFolderCOSA; PDSLH_MWS_INTERFACE pDslhMwsIf = (PDSLH_MWS_INTERFACE )pMyObject->hDslhMwsIf; if ( pMyObject->bActive ) { return ANSC_STATUS_SUCCESS; } if( pDslhMwsIf != NULL) { pDslhCpeController->AddInterface(pDslhCpeController, pMyObject->hDslhMwsIf); } pMyObject->hDslhCcdIf = pDslhCpeController->GetInterfaceByName(pDslhCpeController, CCSP_CCD_INTERFACE_NAME); pMyObject->hDslhLcbIf = pDslhCpeController->GetInterfaceByName(pDslhCpeController, CCSP_LIBCBK_INTERFACE_NAME); /* register internal apis */ if( pAtomFunctions == NULL) { pMyObject->hAtomFunctions = AnscCreateAtomTable ( pMyObject->hContainerContext, (ANSC_HANDLE)pMyObject, NULL ); pAtomFunctions = (PANSC_ATOM_TABLE_OBJECT)pMyObject->hAtomFunctions; } if( pAtomFunctions != NULL) { /* Register the API exported by framework */ pMyObject->RegisterInternalApi(pMyObject, "COSANotifyValueChange", COSANotifyValueChange); pMyObject->RegisterInternalApi(pMyObject, "COSANotifyDiagComplete", COSANotifyDiagComplete); pMyObject->RegisterInternalApi(pMyObject, "COSAValidateHierarchyInterface", COSAValidateHierarchyInterface); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueBool", COSAGetParamValueBool); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueInt", COSAGetParamValueInt); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueUlong", COSAGetParamValueUlong); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueString", COSAGetParamValueString); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValue", COSAGetParamValue); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueBool", COSASetParamValueBool); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueInt", COSASetParamValueInt); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueUlong", COSASetParamValueUlong); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueString", COSASetParamValueString); pMyObject->RegisterInternalApi(pMyObject, "COSAGetRegistryRootFolder", COSAGetRegistryRootFolder); pMyObject->RegisterInternalApi(pMyObject, "COSAGetInstanceNumberByIndex", COSAGetInstanceNumberByIndex); pMyObject->RegisterInternalApi(pMyObject, "COSAGetInterfaceByName", COSAGetInterfaceByName); pMyObject->RegisterInternalApi(pMyObject, "COSAGetMessageBusHandle", COSAGetMessageBusHandle); pMyObject->RegisterInternalApi(pMyObject, "COSARegisterCallBackAfterInitDml", COSARegisterCallBackAfterInitDml); pMyObject->RegisterInternalApi(pMyObject, "COSAGetSubsystemPrefix", COSAGetSubsystemPrefix); pMyObject->RegisterInternalApi(pMyObject, "COSARepopulateTable", COSARepopulateTable); pMyObject->RegisterInternalApi(pMyObject, "COSAGetParamValueByPathName", COSAGetParamValueByPathName); pMyObject->RegisterInternalApi(pMyObject, "COSASetParamValueByPathName", COSASetParamValueByPathName); pMyObject->RegisterInternalApi(pMyObject, "COSAGetInstanceNumbers", COSAGetInstanceNumbers); /* Register the API for CCSP Common Components*/ #if 0 pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetParamUlongValue", CcspComp_GetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetParamStringValue", CcspComp_GetParamStringValue); #endif pMyObject->RegisterInternalApi(pMyObject, "CcspComp_GetBulkParamValues", CcspComp_GetBulkParamValues); pMyObject->RegisterInternalApi(pMyObject, "CcspComp_SetParamBoolValue", CcspComp_SetParamBoolValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetParamBoolValue", CcspLog_GetParamBoolValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetParamUlongValue", CcspLog_GetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetParamBoolValue", CcspLog_SetParamBoolValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetParamUlongValue", CcspLog_SetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Validate", CcspLog_Validate ); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Commit", CcspLog_Commit ); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_Rollback", CcspLog_Rollback ); pMyObject->RegisterInternalApi(pMyObject, "CcspMem_GetParamUlongValue", CcspMem_GetParamUlongValue); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_GetBulkParamValues", CcspLog_GetBulkParamValues); pMyObject->RegisterInternalApi(pMyObject, "CcspLog_SetBulkParamValues", CcspLog_SetBulkParamValues); } /* * Enroll and create PoamIrepFolder object. */ if ( TRUE ) { pPoamIrepFoRoot = (PPOAM_IREP_FOLDER_OBJECT)PoamIrepFoCreate(NULL, NULL, ""); if ( !pPoamIrepFoRoot ) { AnscTrace("DslhDataModelAgent: Cannot access Root Folder!!\n"); returnStatus = ANSC_STATUS_FAILURE; goto EXIT2; } pPoamIrepFoProvision = (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoRoot->GetFolder ( (ANSC_HANDLE)pPoamIrepFoRoot, "Provision" ); if ( !pPoamIrepFoProvision ) { AnscTrace("DslhDataModelAgent: Cannot access /Configuration/Provision folder!!\n"); returnStatus = ANSC_STATUS_FAILURE; goto EXIT3; } pPoamIrepFoCOSA = (PPOAM_IREP_FOLDER_OBJECT)pPoamIrepFoProvision->GetFolder ( (ANSC_HANDLE)pPoamIrepFoProvision, COSA_IREP_FOLDER_NAME ); if ( !pPoamIrepFoCOSA ) { pPoamIrepFoCOSA = pPoamIrepFoProvision->AddFolder ( (ANSC_HANDLE)pPoamIrepFoProvision, COSA_IREP_FOLDER_NAME, 0 ); } if ( !pPoamIrepFoCOSA ) { AnscTrace("DslhDataModelAgent: Cannot access /Configuration/Provision/%s folder!!\n", COSA_IREP_FOLDER_NAME); returnStatus = ANSC_STATUS_FAILURE; goto EXIT4; } else { pMyObject->hIrepFolderCOSA = (ANSC_HANDLE)pPoamIrepFoCOSA; } } pMyObject->bActive = TRUE; returnStatus = ANSC_STATUS_SUCCESS; /****************************************************************** GRACEFUL ROLLBACK PROCEDURES AND EXIT DOORS ******************************************************************/ EXIT4: if ( pPoamIrepFoProvision ) { pPoamIrepFoProvision->Remove((ANSC_HANDLE)pPoamIrepFoProvision); } EXIT3: if ( pPoamIrepFoRoot ) { pPoamIrepFoRoot->Remove((ANSC_HANDLE)pPoamIrepFoRoot); } EXIT2: return returnStatus; }
ANSC_STATUS DslhVarroNotifyValueChanged ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_VAR_RECORD_OBJECT pMyObject = (PDSLH_VAR_RECORD_OBJECT )hThisObject; PDSLH_OBJ_RECORD_OBJECT pObjRecord = (PDSLH_OBJ_RECORD_OBJECT )pMyObject->hDslhObjRecord; PDSLH_CPE_CONTROLLER_OBJECT pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT )pObjRecord->hDslhCpeController; PCCC_MBI_INTERFACE pDslhMbiIf = (PCCC_MBI_INTERFACE )pDslhCpeController->GetInterfaceByName((ANSC_HANDLE)pDslhCpeController, CCC_MBI_INTERFACE_NAME); PDSLH_VAR_ENTITY_OBJECT pVarEntity = (PDSLH_VAR_ENTITY_OBJECT )pMyObject->hDslhVarEntity; PSLAP_VARIABLE pNewValue = (PSLAP_VARIABLE )NULL; char* pParamFullName = NULL; char* pAccessList = NULL; if ( !pDslhMbiIf ) { AnscTraceError(("DslhVarroNotifyValueChanged: pDslhMbiIf is NULL\n")); return ANSC_STATUS_FAILURE; } pParamFullName = pMyObject->GetFullName((ANSC_HANDLE)pMyObject); if ( pMyObject->TempParamValue ) { SlapAllocVariable(pNewValue); if ( !pNewValue ) { returnStatus = ANSC_STATUS_RESOURCES; return returnStatus; } SlapCloneVariable(pMyObject->TempParamValue, pNewValue); } else { /* New value has to be present all the time. Get current value */ pNewValue = pMyObject->GetValue((ANSC_HANDLE)pMyObject); } if(pNewValue != NULL) { pNewValue->ReqSenderID = pMyObject->ReqSenderID; } pAccessList = AnscCloneString(pMyObject->AccessList); returnStatus = pDslhMbiIf->SendParameterValueChangeSignal ( (void*)pDslhMbiIf->hOwnerContext, pParamFullName, pMyObject->OldParamValue, pNewValue, pAccessList ); if ( pNewValue ) { SlapFreeVariable(pNewValue); } if ( pParamFullName ) { AnscFreeMemory(pParamFullName); } if ( pAccessList ) { AnscFreeMemory(pAccessList); } return returnStatus; }
ANSC_STATUS DslhVarroReset ( ANSC_HANDLE hThisObject ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_VAR_RECORD_OBJECT pMyObject = (PDSLH_VAR_RECORD_OBJECT )hThisObject; PDSLH_OBJ_RECORD_OBJECT pObjRecord = (PDSLH_OBJ_RECORD_OBJECT )pMyObject->hDslhObjRecord; PDSLH_CPE_CONTROLLER_OBJECT pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT)pObjRecord->hDslhCpeController; PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)pDslhCpeController); /*PPOAM_IREP_FOLDER_OBJECT pPoamIrepFoParameter = (PPOAM_IREP_FOLDER_OBJECT )pMyObject->hIrepFoParameter;*/ if ( (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_passive) || (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_active ) ) { returnStatus = pDslhMprIf->DelNotifyParam ( pDslhMprIf->hOwnerContext, (ANSC_HANDLE)pMyObject ); } if ( pMyObject->AccessList ) { AnscFreeMemory(pMyObject->AccessList); pMyObject->AccessList = NULL; } /* if ( pPoamIrepFoParameter ) { pPoamIrepFoParameter->Remove((ANSC_HANDLE)pPoamIrepFoParameter); } pMyObject->hIrepFoParameter = (ANSC_HANDLE)NULL; */ if ( pMyObject->TempParamValue ) { SlapFreeVariable(pMyObject->TempParamValue); pMyObject->TempParamValue = NULL; } if ( pMyObject->TempParamValueTrans ) { if ( (pMyObject->TempParamValueTrans->Syntax == SLAP_VAR_SYNTAX_handle) && pMyObject->TempParamValueTrans->Variant.varHandle ) { AnscFreeMemory(pMyObject->TempParamValueTrans->Variant.varHandle); } SlapFreeVariable(pMyObject->TempParamValueTrans); pMyObject->TempParamValueTrans = NULL; } if ( pMyObject->OldParamValue ) { SlapFreeVariable(pMyObject->OldParamValue); pMyObject->OldParamValue = NULL; } pMyObject->bAlreadySet = FALSE; return ANSC_STATUS_SUCCESS; }
ANSC_STATUS DslhVarroSetNotification ( ANSC_HANDLE hThisObject, int iNotification ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_VAR_RECORD_OBJECT pMyObject = (PDSLH_VAR_RECORD_OBJECT )hThisObject; PDSLH_VAR_ENTITY_OBJECT pVarEntity = (PDSLH_VAR_ENTITY_OBJECT )pMyObject->hDslhVarEntity; PDSLH_OBJ_RECORD_OBJECT pObjRecord = (PDSLH_OBJ_RECORD_OBJECT )pMyObject->hDslhObjRecord; PDSLH_CPE_CONTROLLER_OBJECT pDslhCpeController = (PDSLH_CPE_CONTROLLER_OBJECT)pObjRecord->hDslhCpeController; PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)pDslhCpeController); PCHAR pFullName = NULL; /* we don't allow Notification to be changed if it's defined as Forced or always Off notification */ if ( pVarEntity->ParamDescr->NotifyStatus != DSLH_CWMP_NOTIFY_STATUS_configurable && pVarEntity->ParamDescr->NotifyStatus != DSLH_CWMP_NOTIFY_STATUS_configActive) { return ANSC_STATUS_UNAPPLICABLE; } pFullName = pMyObject->GetFullName(pMyObject); if(strstr(pFullName,"NumberOfEntries")) { AnscTraceEntry(("Param '%s' cannot be set to Notification Active.\n", pFullName)); return ANSC_STATUS_UNAPPLICABLE; } if ( iNotification == DSLH_CWMP_NOTIFICATION_active && pVarEntity->ParamDescr->NotifyStatus != DSLH_CWMP_NOTIFY_STATUS_configActive) { pFullName = pMyObject->GetFullName(pMyObject); AnscTraceEntry(("Param '%s' cannot be set to Notification Active.\n", pFullName)); AnscFreeMemory(pFullName); return ANSC_STATUS_UNAPPLICABLE; } if( pMyObject->Notification == iNotification) { return ANSC_STATUS_SUCCESS; } if ( (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_passive) || (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_active ) ) { if((iNotification == DSLH_CWMP_NOTIFICATION_passive) || (iNotification == DSLH_CWMP_NOTIFICATION_active ) ) { pMyObject->Notification = iNotification; /* Bin updated in Plugfest on 06/27/2007 * * Since it's already in the monitor queue and the monitor parameter will retrieve * the notification state from VarRecord directly, we don't need to * do anything and exit. */ return ANSC_STATUS_SUCCESS; } returnStatus = pDslhMprIf->DelNotifyParam ( pDslhMprIf->hOwnerContext, (ANSC_HANDLE)pMyObject ); } pMyObject->Notification = iNotification; /* * Whenever a parameter change is sent in the Inform message due to a non-zero Notification * setting, the Event code "4 VALUE CHANGE" MUST be included in the list of events. The CPE may * return a "notification request rejected" error if an attempt is made to set notification on * a parameter deemed inappropriate for Active Notification. */ if ( (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_passive) || (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_active ) ) { if ( (pVarEntity->DataType == DSLH_CWMP_DATA_TYPE_string) && (pVarEntity->FormatValue1 >= 8192 ) ) { /* * The parameter value is too big. The backend should initiate the Notification when * the parameter value is modified. */ } else { returnStatus = pDslhMprIf->RegNotifyParam ( pDslhMprIf->hOwnerContext, (ANSC_HANDLE)pMyObject, (pMyObject->Notification == DSLH_CWMP_NOTIFICATION_active) ); } } return ANSC_STATUS_SUCCESS; }
ANSC_STATUS ssp_engage_tad ( ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; char CrName[256]; g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Yellow; if ( pTadCcdIf ) { pTadFcContext->hCcspCcdIf = (ANSC_HANDLE)pTadCcdIf; pTadFcContext->hMessageBus = bus_handle; } g_DslhDataModelAgent->SetFcContext((ANSC_HANDLE)g_DslhDataModelAgent, (ANSC_HANDLE)pTadFcContext); /*RDKB-7459, CID-33428, null check before use */ if(!pDslhCpeController) { pDslhCpeController = DslhCreateCpeController(NULL, NULL, NULL); if ( !pDslhCpeController ) { CcspTraceWarning(("Null Value, CANNOT Create pDslhCpeController... Exit!\n")); return ANSC_STATUS_RESOURCES; } } pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)MsgHelper_CreateCcdMbiIf((void*)bus_handle, g_Subsystem)); pDslhCpeController->AddInterface((ANSC_HANDLE)pDslhCpeController, (ANSC_HANDLE)pTadCcdIf); pDslhCpeController->SetDbusHandle((ANSC_HANDLE)pDslhCpeController, bus_handle); pDslhCpeController->Engage((ANSC_HANDLE)pDslhCpeController); if ( g_Subsystem[0] != 0 ) { _ansc_sprintf(CrName, "%s%s", g_Subsystem, CCSP_DBUS_INTERFACE_CR); } else { _ansc_sprintf(CrName, "%s", CCSP_DBUS_INTERFACE_CR); } if ( TRUE ) { /*RDKB-7459, CID-33428, Load Lib if handle is null */ if( hDiagPlugin == NULL) { hDiagPlugin = (ANSC_HANDLE)AnscLoadLibrary(COSA_DIAG_PLUGIN_LIBRARY_NAME); } if( hDiagPlugin == NULL) { CcspTraceWarning(("Unable to load library -- %s\n", COSA_DIAG_PLUGIN_LIBRARY_NAME)); #ifdef _ANSC_LINUX CcspTraceWarning(("cause:%s\n", dlerror() )); #endif g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.InitProc = (COSADiagInitProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_INIT_PROC ); if ( g_CosaDiagPluginInfo.InitProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_INIT_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.UnloadProc = (COSADiagUnloadProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_UNLOAD_PROC ); if ( g_CosaDiagPluginInfo.UnloadProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_UNLOAD_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.GetResultsProc = (CosaDiagGetResultsProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_GETRESULTS_PROC ); if ( g_CosaDiagPluginInfo.GetResultsProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_GETRESULTS_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.ScheduleDiagnosticProc = (CosaDiagScheduleDiagnosticProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_SCHEDIAG_PROC ); if ( g_CosaDiagPluginInfo.ScheduleDiagnosticProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_SCHEDIAG_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.SetDiagParamsProc = (CosaDiagSetDiagParamsProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_SETDIAGPARAMS_PROC ); if ( g_CosaDiagPluginInfo.SetDiagParamsProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_SETDIAGPARAMS_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.SetDiagStateProc = (CosaDiagSetDiagStateProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_SETDIAGSTATE_PROC ); if ( g_CosaDiagPluginInfo.SetDiagStateProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_SETDIAGSTATE_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.CancelDiagnosticProc = (CosaDiagCancelDiagnosticProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_CANCELDIAG_PROC ); if ( g_CosaDiagPluginInfo.CancelDiagnosticProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_CANCELDIAG_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.MemoryUsageProc = (CosaDiagMemoryUsageProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_MEMORYUSAGE_PROC ); if ( g_CosaDiagPluginInfo.MemoryUsageProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_MEMORYUSAGE_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.MemoryTableProc = (CosaDiagMemoryTableProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_MEMORYTABLE_PROC ); if ( g_CosaDiagPluginInfo.MemoryTableProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_MEMORYTABLE_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.GetConfigsProc = (CosaDiagGetConfigsProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_GETCONFIGS_PROC ); if ( g_CosaDiagPluginInfo.GetConfigsProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_GETCONFIGS_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } else { g_CosaDiagPluginInfo.ExportFuncProc = (CosaDiagExportFuncProc) AnscGetProcAddress ( hDiagPlugin, COSA_DIAG_PLUGIN_EXPORTFUNC_PROC ); if ( g_CosaDiagPluginInfo.ExportFuncProc == NULL ) { AnscTraceWarning(("Unable to Get ProcAddress of '%s'\n", COSA_DIAG_PLUGIN_EXPORTFUNC_PROC)); g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_LOAD_LIBRARY; } } } } } } } } } } } } if ( g_CosaDiagPluginInfo.uLoadStatus == COSA_STATUS_SUCCESS ) { /* COSA Diagnostic library loaded successfully */ g_CosaDiagPluginInfo.uPluginVersion = 1; returnStatus = g_CosaDiagPluginInfo.InitProc(bus_handle); if ( returnStatus != ANSC_STATUS_SUCCESS ) { g_CosaDiagPluginInfo.uLoadStatus = COSA_STATUS_ERROR_INIT; } g_DslhDataModelAgent->RegisterInternalApi(g_DslhDataModelAgent, "COSAGetDiagPluginInfo", COSAGetDiagPluginInfo); } } if ( g_GetParamValueByPathNameProc == NULL ) { g_GetParamValueByPathNameProc = (COSAGetParamValueByPathNameProc)COSAAcquireFunction("COSAGetParamValueByPathName"); if ( !g_GetParamValueByPathNameProc ) { printf("Test and Diagnostic - failed to load the function COSAGetParamValueByPathName!\n"); } } returnStatus = pDslhCpeController->RegisterCcspDataModel ( (ANSC_HANDLE)pDslhCpeController, CrName, /*CCSP_DBUS_INTERFACE_CR,*/ /* CCSP CR ID */ COSA_PLUGIN_XML_FILE, /* Data Model XML file. Can be empty if only base data model supported. */ CCSP_COMPONENT_NAME_TAD, /* Component Name */ CCSP_COMPONENT_VERSION_TAD, /* Component Version */ CCSP_COMPONENT_PATH_TAD, /* Component Path */ g_Subsystem /* Component Prefix */ ); if ( returnStatus == ANSC_STATUS_SUCCESS || CCSP_SUCCESS == returnStatus) { /* System is fully initialized */ g_pComponent_Common_Dm->Health = CCSP_COMMON_COMPONENT_HEALTH_Green; } pollTime(); return ANSC_STATUS_SUCCESS; }
int CcspCcMbi_GetParameterNames ( char * parameterName, dbus_bool nextLevel, int *size , parameterInfoStruct_t ***val, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )g_pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_CWMP_PARAM_INFO pParamInfoArray = (PDSLH_CWMP_PARAM_INFO )NULL; ULONG ulArraySize = (ULONG )0; parameterInfoStruct_t** ppReturnVal = NULL; ULONG i = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); pDslhMprIf = (PDSLH_MPR_INTERFACE )pCpeco->GetDslhMprIf((ANSC_HANDLE)pCpeco); } if ( !parameterName ) { AnscTraceError(("Input parameter invalid for ssp_SsdMbi_GetParameterNames\n")); returnStatus = CCSP_ERR_INVALID_PARAMETER_NAME; goto EXIT; } if ( !pDslhMpaIf ) { AnscTraceError(("pDslhMpaIf is NULL for ssp_SsdMbi_GetParameterNames\n")); returnStatus = ANSC_STATUS_INTERNAL_ERROR; goto EXIT; } /* increase the request counter by one */ pDslhMprIf->IncReqCounter(pDslhMprIf->hOwnerContext); returnStatus = pDslhMpaIf->GetParameterNames ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, parameterName, nextLevel, &pParamInfoArray, &ulArraySize ); if ( returnStatus != ANSC_STATUS_SUCCESS ) { /* * Something serious has screwed up (e.g. we have run out of system memory), abort! */ goto EXIT1; } ppReturnVal = AnscAllocateMemory(ulArraySize * sizeof(parameterInfoStruct_t *)); if ( !ppReturnVal ) { AnscTraceError(("ssp_SsdMbi_GetParameterNames -- No Resource\n")); returnStatus = ANSC_STATUS_RESOURCES; goto EXIT1; } AnscZeroMemory(ppReturnVal, ulArraySize * sizeof(parameterInfoStruct_t *)); for ( i = 0; i < ulArraySize; i++ ) { ppReturnVal[i] = AnscAllocateMemory(sizeof(parameterInfoStruct_t)); if ( !ppReturnVal[i] ) { AnscTraceError(("ssp_SsdMbi_GetParameterNames -- No Resource\n")); returnStatus = ANSC_STATUS_RESOURCES; goto EXIT1; } AnscZeroMemory(ppReturnVal[i], sizeof(parameterInfoStruct_t)); ppReturnVal[i]->parameterName = AnscCloneString(pParamInfoArray[i].Name); ppReturnVal[i]->writable = pParamInfoArray[i].bWritable; } EXIT1: *val = ppReturnVal; *size = i; if ( pParamInfoArray ) { for ( i = 0; i < ulArraySize; i++ ) { DslhCwmpCleanParamInfo((&pParamInfoArray[i])); } AnscFreeMemory(pParamInfoArray); } EXIT: return (returnStatus == ANSC_STATUS_SUCCESS) ? CCSP_SUCCESS : returnStatus; }
int CcspCcMbi_GetParameterAttributes ( char* parameterNames[], int size, int* val_size, parameterAttributeStruct_t ***val, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )g_pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)g_pDslhCpeController); PSLAP_STRING_ARRAY pParamNameArray = (PSLAP_STRING_ARRAY )NULL; PDSLH_CWMP_PARAM_ATTRIB pParamAttribArray = (PDSLH_CWMP_PARAM_ATTRIB )NULL; ULONG ulArraySize = (ULONG )0; parameterAttributeStruct_t** ppReturnVal = NULL; ULONG i = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); pDslhMprIf = (PDSLH_MPR_INTERFACE )pCpeco->GetDslhMprIf((ANSC_HANDLE)pCpeco); } *val = ppReturnVal; *val_size = ulArraySize; if ( !parameterNames || ( size == 0 ) ) { AnscTraceError(("Input parameter invalid for ssp_SsdMbi_GetParameterAttributes\n")); returnStatus = CCSP_ERR_INVALID_PARAMETER_NAME; goto EXIT; } SlapAllocStringArray2(size, pParamNameArray); if( pParamNameArray == NULL ) { goto EXIT; } for ( i = 0; i < (ULONG)size; i++ ) { pParamNameArray->Array.arrayString[i] = AnscCloneString(parameterNames[i]); } /* increase the request counter by one */ pDslhMprIf->IncReqCounter(pDslhMprIf->hOwnerContext); if ( pDslhMpaIf != NULL ) { returnStatus = pDslhMpaIf->GetParameterAttributes ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, pParamNameArray, g_uMaxParamInResponse, &pParamAttribArray, &ulArraySize ); if ( (returnStatus != ANSC_STATUS_SUCCESS) || (ulArraySize == 0) ) { /* * Something serious has screwed up (e.g. we have run out of system memory), abort! */ goto EXIT1; } ppReturnVal = AnscAllocateMemory(ulArraySize * sizeof(parameterAttributeStruct_t *)); if ( !ppReturnVal ) { AnscTraceError(("ssp_SsdMbi_GetParameterAttributes -- No Resource\n")); returnStatus = ANSC_STATUS_RESOURCES; goto EXIT2; } AnscZeroMemory(ppReturnVal, ulArraySize * sizeof(parameterAttributeStruct_t *)); for ( i = 0; i < ulArraySize; i++ ) { ppReturnVal[i] = AnscAllocateMemory(sizeof(parameterAttributeStruct_t)); if ( !ppReturnVal[i] ) { AnscTraceError(("ssp_SsdMbi_GetParameterAttributes -- No Resource\n")); returnStatus = ANSC_STATUS_RESOURCES; goto EXIT2; } AnscZeroMemory(ppReturnVal[i], sizeof(parameterAttributeStruct_t)); ppReturnVal[i]->parameterName = AnscCloneString(pParamAttribArray[i].Name); ppReturnVal[i]->notification = (pParamAttribArray[i].Notification == DSLH_CWMP_NOTIFICATION_off) ? FALSE : TRUE; ppReturnVal[i]->notificationChanged = FALSE; /*pParamAttribArray[i].bNotificationChange*/ ppReturnVal[i]->accessControlBitmask = AccessListToAccessControlBitMask(pParamAttribArray[i].AccessList); } } *val = ppReturnVal; *val_size = ulArraySize; EXIT2: if ( pParamAttribArray ) { for ( i = 0; i < ulArraySize; i++ ) { DslhCwmpCleanParamAttrib((&pParamAttribArray[i])); } AnscFreeMemory(pParamAttribArray); } EXIT1: if( pParamNameArray != NULL) { SlapFreeVarArray(pParamNameArray); } EXIT: return (returnStatus == ANSC_STATUS_SUCCESS) ? CCSP_SUCCESS : returnStatus; }
int CcspCcMbi_SetParameterAttributes ( int sessionId, parameterAttributeStruct_t *val, int size, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )g_pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)g_pDslhCpeController); ULONG uMaxParam = 128; PDSLH_CWMP_SET_PARAM_ATTRIB pParamArray = NULL; PDSLH_CWMP_SET_PARAM_ATTRIB pParamAttr = NULL; int i = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); pDslhMprIf = (PDSLH_MPR_INTERFACE )pCpeco->GetDslhMprIf((ANSC_HANDLE)pCpeco); } if ( (g_currentSessionID != 0) && (sessionId != g_currentSessionID) ) { AnscTraceWarning(("!!! SetParameterAttributes discarded, session id is NOT match !!!\n")); return ANSC_STATUS_DISCARD; } if ( !val || size == 0 ) { AnscTraceError(("Input parameter invalid for ssp_SsdMbiSetParameterAttributes\n")); returnStatus = CCSP_ERR_INVALID_ARGUMENTS; goto EXIT; } if( (ULONG)size >= uMaxParam ) { AnscTrace("Too many params in 'SetParameterAttributes'\n"); returnStatus = CCSP_ERR_INVALID_ARGUMENTS; goto EXIT; } if ( !pDslhMpaIf ) { AnscTraceError(("pDslhMpaIf is NULL for ssp_SsdMbiSetParameterValues\n")); returnStatus = ANSC_STATUS_INTERNAL_ERROR; goto EXIT; } /* increase the request counter by one */ pDslhMprIf->IncReqCounter(pDslhMprIf->hOwnerContext); pParamArray = (PDSLH_CWMP_SET_PARAM_ATTRIB) AnscAllocateMemory(sizeof(DSLH_CWMP_SET_PARAM_ATTRIB) * size); if( pParamArray == NULL) { returnStatus = CCSP_ERR_INVALID_ARGUMENTS; goto EXIT; } for ( i = 0; i < size; i++ ) { pParamAttr = &pParamArray[i]; pParamAttr->Name = AnscCloneString(val[i].parameterName); pParamAttr->bNotificationChange = val[i].notificationChanged; pParamAttr->Notification = val[i].notification ? DSLH_CWMP_NOTIFICATION_passive : DSLH_CWMP_NOTIFICATION_off; pParamAttr->bAccessListChange = val[i].accessControlChanged; pParamAttr->AccessList = AccessControlBitMaskToAccessList(val[i].accessControlBitmask); } returnStatus = pDslhMpaIf->SetParameterAttributes ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, (ANSC_HANDLE)pParamArray, size ); if( pParamArray != NULL) { for( i = 0; i < size; i ++ ) { pParamAttr = &pParamArray[i]; DslhCwmpCleanSetParamAttrib(pParamAttr); } AnscFreeMemory(pParamArray); } EXIT: return (returnStatus == ANSC_STATUS_SUCCESS) ? CCSP_SUCCESS : returnStatus; }
int CcspCcMbi_SetParameterValues ( int sessionId, unsigned int writeID, parameterValStruct_t *val, int size, dbus_bool commit, char ** invalidParameterName, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )g_pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_CWMP_PARAM_VALUE pParamArray = NULL; PDSLH_CWMP_PARAM_VALUE pParamValue = NULL; PSLAP_VARIABLE pSlapVariable = (PSLAP_VARIABLE)NULL; PDSLH_CWMP_SOAP_FAULT pCwmpSoapFault = (PDSLH_CWMP_SOAP_FAULT )NULL; int iStatus = 0; int i = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); pDslhMprIf = (PDSLH_MPR_INTERFACE )pCpeco->GetDslhMprIf((ANSC_HANDLE)pCpeco); } if ( (g_currentSessionID != 0) && (sessionId != g_currentSessionID) ) { AnscTraceWarning(("!!! SetParameterValues discarded, session id is NOT match !!!\n")); return ANSC_STATUS_DISCARD; } if ( !val || size == 0 ) { AnscTraceError(("Input parameter invalid for ssp_SsdMbi_GetParameterValues\n")); returnStatus = CCSP_ERR_INVALID_ARGUMENTS; goto EXIT; } if ( !pDslhMpaIf ) { AnscTraceError(("pDslhMpaIf is NULL for ssp_SsdMbiSetParameterValues\n")); returnStatus = ANSC_STATUS_INTERNAL_ERROR; goto EXIT; } /* increase the request counter by one */ pDslhMprIf->IncReqCounter(pDslhMprIf->hOwnerContext); pParamArray = (PDSLH_CWMP_PARAM_VALUE) AnscAllocateMemory(sizeof(DSLH_CWMP_PARAM_VALUE) * size); if( pParamArray == NULL) { returnStatus = ANSC_STATUS_RESOURCES; goto EXIT; } for ( i = 0; i < size; i++ ) { pParamValue = &pParamArray[i]; pParamValue->Name = AnscCloneString(val[i].parameterName); pSlapVariable = (PSLAP_VARIABLE)AnscAllocateMemory(sizeof(SLAP_VARIABLE)); if ( !pSlapVariable ) { returnStatus = ANSC_STATUS_RESOURCES; goto EXIT1; } SlapInitVariable(pSlapVariable); pParamValue->Value = pSlapVariable; pSlapVariable->Name = NULL; pSlapVariable->ContentType = 0; pSlapVariable->UsageType = 0; if ( val[i].type == ccsp_string ) { pSlapVariable->Syntax = SLAP_VAR_SYNTAX_string; pSlapVariable->Variant.varString = AnscCloneString(val[i].parameterValue); } else if ( val[i].type == ccsp_int ) { if ( CcspCcMbi_ValidateINT(val[i].parameterValue, 1) != 0 ) { returnStatus = CCSP_ERR_INVALID_PARAMETER_VALUE; goto EXIT1; } pSlapVariable->Syntax = SLAP_VAR_SYNTAX_int; pSlapVariable->Variant.varInt = SlapVcoStringToInt(NULL, val[i].parameterValue); } else if ( (val[i].type == ccsp_unsignedInt) || (val[i].type == ccsp_long) ) { if ( CcspCcMbi_ValidateINT(val[i].parameterValue, 0) != 0 ) { returnStatus = CCSP_ERR_INVALID_PARAMETER_VALUE; goto EXIT1; } pSlapVariable->Syntax = SLAP_VAR_SYNTAX_uint32; pSlapVariable->Variant.varUint32 = SlapVcoStringToUint32(NULL, val[i].parameterValue); } else if ( val[i].type == ccsp_boolean ) { if ( CcspCcMbi_ValidateBoolean(val[i].parameterValue) != 0 ) { returnStatus = CCSP_ERR_INVALID_PARAMETER_VALUE; goto EXIT1; } pSlapVariable->Syntax = SLAP_VAR_SYNTAX_bool; pSlapVariable->Variant.varBool = SlapVcoStringToBool(NULL, val[i].parameterValue); /* This function will be adjust to be consistent with CCSP */ } else if ( val[i].type == ccsp_dateTime ) { pSlapVariable->Syntax = SLAP_VAR_SYNTAX_string; pSlapVariable->ContentType = SLAP_CONTENT_TYPE_CALENDAR_TIME; pSlapVariable->Variant.varString = AnscCloneString(val[i].parameterValue); } else if ( val[i].type == ccsp_base64 ) { pSlapVariable->Syntax = SLAP_VAR_SYNTAX_string; pSlapVariable->Variant.varString = AnscCloneString(val[i].parameterValue); } else { returnStatus = CCSP_ERR_INVALID_PARAMETER_TYPE; goto EXIT1; } } g_currentWriteEntity = writeID; returnStatus = pDslhMpaIf->SetParameterValues /* TODO: sessionID */ ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, pParamArray, size, &iStatus, sessionId, writeID, commit, invalidParameterName ); EXIT1: if( pParamArray != NULL) { for( i = 0; i < size; i ++) { pParamValue = &pParamArray[i]; if( pParamValue->Value == (ANSC_HANDLE)DSLH_CWMP_DATA_INVALID_VALUE_TYPE) { pParamValue->Value = NULL; } DslhCwmpCleanParamValue(pParamValue); } AnscFreeMemory(pParamArray); } EXIT: if( *invalidParameterName != NULL) { AnscTrace("Invalid parameter name '%s'\n", *invalidParameterName); } if( returnStatus == ANSC_STATUS_SUCCESS) { return CCSP_SUCCESS; } AnscTrace("Error = %d in 'CcspCcMbi_SetParameterValues'\n", returnStatus); return returnStatus; }
int CcspCcMbi_GetParameterValues ( unsigned int writeID, char * parameterNames[], int size, int *val_size, parameterValStruct_t ***val, void * user_data ) { ANSC_STATUS returnStatus = ANSC_STATUS_SUCCESS; PDSLH_MPA_INTERFACE pDslhMpaIf = (PDSLH_MPA_INTERFACE )g_pDslhCpeController->GetDslhMpaIf((ANSC_HANDLE)g_pDslhCpeController); PDSLH_MPR_INTERFACE pDslhMprIf = (PDSLH_MPR_INTERFACE )g_pDslhCpeController->GetDslhMprIf((ANSC_HANDLE)g_pDslhCpeController); PSLAP_STRING_ARRAY pParamNameArray = (PSLAP_STRING_ARRAY )NULL; PDSLH_CWMP_PARAM_VALUE pParamValueArray = (PDSLH_CWMP_PARAM_VALUE )NULL; ULONG ulArraySize = (ULONG )0; parameterValStruct_t** ppReturnVal = NULL; ULONG i = 0; /*with component binding, we have multiple CpeController handle, each for a component*/ if (user_data) { PDSLH_CPE_CONTROLLER_OBJECT pCpeco = user_data; pDslhMpaIf = (PDSLH_MPA_INTERFACE )pCpeco->GetDslhMpaIf((ANSC_HANDLE)pCpeco); pDslhMprIf = (PDSLH_MPR_INTERFACE )pCpeco->GetDslhMprIf((ANSC_HANDLE)pCpeco); } if ( !parameterNames || ( size == 0 ) ) { AnscTraceError(("Input parameter invalid for ssp_SsdMbi_GetParameterValues\n")); returnStatus = CCSP_ERR_INVALID_PARAMETER_NAME; goto EXIT; } /* increase the request counter by one */ pDslhMprIf->IncReqCounter(pDslhMprIf->hOwnerContext); SlapAllocStringArray2(size, pParamNameArray); if( pParamNameArray == NULL ) { goto EXIT; } for ( i = 0; i < (ULONG)size; i++ ) { pParamNameArray->Array.arrayString[i] = AnscCloneString(parameterNames[i]); } if ( pDslhMpaIf != NULL ) { returnStatus = pDslhMpaIf->GetParameterValues ( pDslhMpaIf->hOwnerContext, DSLH_MPA_ENTITY_ACS, pParamNameArray, g_uMaxParamInResponse, &pParamValueArray, &ulArraySize, writeID ); if ( returnStatus != ANSC_STATUS_SUCCESS) { /* * Something serious has screwed up (e.g. we have run out of system memory), abort! */ AnscTraceError(("CcspCcMbi_GetParameterValues -- Something has screwed up. Failure status returned\n")); for ( i = 0; i < (ULONG)size; i++ ) { AnscTraceError((" \t\t when get parameters: %s \n",parameterNames[i])); } goto EXIT1; } else if( ulArraySize == 0) { AnscTraceError(("CcspCcMbi_GetParameterValues -- No parameter value returned.\n")); goto EXIT1; } ppReturnVal = AnscAllocateMemory(ulArraySize * sizeof(parameterValStruct_t *)); if ( !ppReturnVal ) { AnscTraceError(("CcspCcMbi_GetParameterValues -- No Resource\n")); returnStatus = ANSC_STATUS_RESOURCES; goto EXIT2; } AnscZeroMemory(ppReturnVal, ulArraySize * sizeof(parameterValStruct_t *)); for ( i = 0; i < ulArraySize; i++ ) { ppReturnVal[i] = AnscAllocateMemory(sizeof(parameterValStruct_t)); if ( !ppReturnVal[i] ) { AnscTraceError(("CcspCcMbi_GetParameterValues -- No Resource\n")); returnStatus = ANSC_STATUS_RESOURCES; goto EXIT2; } AnscZeroMemory(ppReturnVal[i], sizeof(parameterValStruct_t)); ppReturnVal[i]->parameterName = AnscCloneString(pParamValueArray[i].Name); if( pParamValueArray[i].Value == NULL) { AnscTraceError(("CcspCcMbi_GetParameterValues -- No value for '%s'\n", ppReturnVal[i]->parameterName)); ppReturnVal[i]->parameterValue = SlapVcoIntToString(NULL, 0); ppReturnVal[i]->type = ccsp_unsignedInt; } else if ( pParamValueArray[i].Value->Syntax == SLAP_VAR_SYNTAX_uint32 ) { if ( pParamValueArray[i].Value->ContentType == SLAP_CONTENT_TYPE_IP4_ADDR ) { ppReturnVal[i]->parameterValue = SlapVcoIp4AddrToString(NULL, pParamValueArray[i].Value->Variant.varUint32); ppReturnVal[i]->type = ccsp_string; } else { ppReturnVal[i]->parameterValue = SlapVcoUint32ToString(NULL, pParamValueArray[i].Value->Variant.varUint32); ppReturnVal[i]->type = ccsp_unsignedInt; } } else if ( pParamValueArray[i].Value->Syntax == SLAP_VAR_SYNTAX_string ) { if ( pParamValueArray[i].Value->ContentType == SLAP_CONTENT_TYPE_CALENDAR_TIME ) { ppReturnVal[i]->type = ccsp_dateTime; } else { ppReturnVal[i]->type = ccsp_string; } ppReturnVal[i]->parameterValue = AnscCloneString(pParamValueArray[i].Value->Variant.varString); } else if ( pParamValueArray[i].Value->Syntax == SLAP_VAR_SYNTAX_bool ) { if ( ( writeID == DSLH_MPA_ACCESS_CONTROL_SNMP ) && ( pParamValueArray[i].Value->Variant.varBool == 2 ) ) { ppReturnVal[i]->parameterValue = AnscCloneString("notready");; } else { ppReturnVal[i]->parameterValue = SlapVcoBoolToString(NULL, pParamValueArray[i].Value->Variant.varBool); /* This function will be adjust to be consistent with CCSP */ } ppReturnVal[i]->type = ccsp_boolean; } else if ( pParamValueArray[i].Value->Syntax == SLAP_VAR_SYNTAX_int ) { ppReturnVal[i]->parameterValue = SlapVcoIntToString(NULL, pParamValueArray[i].Value->Variant.varInt); ppReturnVal[i]->type = ccsp_int; } } } *val = ppReturnVal; *val_size = ulArraySize; EXIT2: if ( pParamValueArray ) { for ( i = 0; i < ulArraySize; i++ ) { DslhCwmpCleanParamValue((&pParamValueArray[i])); } AnscFreeMemory(pParamValueArray); } EXIT1: if( pParamNameArray != NULL ) { SlapFreeVarArray(pParamNameArray); } EXIT: return (returnStatus == 0) ? CCSP_SUCCESS : returnStatus; }