diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhCpeController/dslh_cpeco_control.c b/source/ccsp/components/common/DataModel/dml/components/DslhCpeController/dslh_cpeco_control.c index 2ba20c3ed..ac0a5ff18 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhCpeController/dslh_cpeco_control.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhCpeController/dslh_cpeco_control.c @@ -524,6 +524,8 @@ DslhCpecoRegisterObject pParameterArray[pMyObject->uParameterArrayIndex++].dataType = ccsp_string; else if ( !_ansc_strncmp( pParamDescr->DataType, DSLH_CWMP_DATA_NAME_int, _ansc_strlen(DSLH_CWMP_DATA_NAME_int) )) pParameterArray[pMyObject->uParameterArrayIndex++].dataType = ccsp_int; + else if ( !_ansc_strncmp( pParamDescr->DataType, DSLH_CWMP_DATA_NAME_unsignedLong, _ansc_strlen(DSLH_CWMP_DATA_NAME_unsignedLong) )) + pParameterArray[pMyObject->uParameterArrayIndex++].dataType = ccsp_unsignedLong; else if ( !_ansc_strncmp( pParamDescr->DataType, DSLH_CWMP_DATA_NAME_unsignedInt, _ansc_strlen(DSLH_CWMP_DATA_NAME_unsignedInt) )) pParameterArray[pMyObject->uParameterArrayIndex++].dataType = ccsp_unsignedInt; else if ( !_ansc_strncmp( pParamDescr->DataType, DSLH_CWMP_DATA_NAME_boolean, _ansc_strlen(DSLH_CWMP_DATA_NAME_boolean) )) diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhDataModelAgent/dslh_dmagnt_utilities.c b/source/ccsp/components/common/DataModel/dml/components/DslhDataModelAgent/dslh_dmagnt_utilities.c index 93bacf1cf..442de1c29 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhDataModelAgent/dslh_dmagnt_utilities.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhDataModelAgent/dslh_dmagnt_utilities.c @@ -1431,6 +1431,14 @@ DslhDmagntParseObjFuncInfo pDslhTr69If->SetEntryParamUlong = (PFN_DSLHTR69_SET_ULONG)hProc; } + else if( strcmp(pName, COSA_XML_NODE_func_SetParamUint64Value) == 0 ) + { + pDslhTr69If->SetEntryParamUint64 = (PFN_DSLHTR69_SET_UINT64)hProc; + } + else if( strcmp(pName, COSA_XML_NODE_func_GetParamUint64Value) == 0 ) + { + pDslhTr69If->GetEntryParamUint64 = (PFN_DSLHTR69_GET_UINT64)hProc; + } else if( strcmp(pName, COSA_XML_NODE_func_SetParamStringValue) == 0 ) { pDslhTr69If->SetEntryParamString = (PFN_DSLHTR69_SET_STRING)hProc; @@ -1616,6 +1624,14 @@ DslhDmagntParseRootFuncInfo pDslhTr69If->SetEntryParamUlong = (PFN_DSLHTR69_SET_ULONG)hProc; } + else if( strcmp(pName, COSA_XML_NODE_func_SetParamUint64Value) == 0 ) + { + pDslhTr69If->SetEntryParamUint64 = (PFN_DSLHTR69_SET_UINT64)hProc; + } + else if( strcmp(pName, COSA_XML_NODE_func_GetParamUint64Value) == 0 ) + { + pDslhTr69If->GetEntryParamUint64 = (PFN_DSLHTR69_GET_UINT64)hProc; + } else if( strcmp(pName, COSA_XML_NODE_func_SetParamStringValue) == 0 ) { pDslhTr69If->SetEntryParamString = (PFN_DSLHTR69_SET_STRING)hProc; diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhObjController/dslh_objco_access.c b/source/ccsp/components/common/DataModel/dml/components/DslhObjController/dslh_objco_access.c index f87372d7c..106d1355e 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhObjController/dslh_objco_access.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhObjController/dslh_objco_access.c @@ -1,3 +1,4 @@ +#include /* * If not stated otherwise in this file or this component's Licenses.txt file the * following copyright and licenses apply: @@ -355,6 +356,26 @@ DslhObjcoValidate break; + case SLAP_VAR_SYNTAX_uint64 : + + if( pInterface->SetEntryParamUint64 != NULL) + { + unsigned long long ullVal = 0; + if ( !pDslhRvqIf->GetParamValueUint64 ) + { + *ppFaultParamName = AnscCloneString(pParamDescr->Name); + return FALSE; + } + ullVal = pDslhRvqIf->GetParamValueUint64(pDslhRvqIf->hOwnerContext, pParamDescr->Name); + if(!pInterface->SetEntryParamUint64(pMyObject->hInsContext, pCallingName, ullVal)) + { + *ppFaultParamName = AnscCloneString(pParamDescr->Name); + return FALSE; + } + } + + break; + case SLAP_VAR_SYNTAX_ucharArray : case SLAP_VAR_SYNTAX_string : @@ -1096,6 +1117,59 @@ DslhObjcoGetParamValueByName { bReturn = pInterface->GetEntryParamUlong(pMyObject->hInsContext,pName, &pSlapVariable->Variant.varUint32); } + else if( pInterface->GetEntryParamUint64 != NULL) + { + /* uint32 param but only Uint64 getter registered */ + ULONG64 tmp64 = 0; + bReturn = pInterface->GetEntryParamUint64(pMyObject->hInsContext, pName, &tmp64); + if (bReturn) + { + pSlapVariable->Variant.varUint32 = (SLAP_UINT32)tmp64; + } + } + else + { + AnscTraceWarning(("GetParamValueByName '%s': GetEntryParamUlong/Uint64 are NULL\n", pName)); + } + + if (!bReturn) + { + AnscTraceWarning(("GetParamValueByName '%s': uint32 getter returned FALSE (ptrUlong=%p ptrUint64=%p)\n", + pName, + (void*)pInterface->GetEntryParamUlong, + (void*)pInterface->GetEntryParamUint64)); + } + + break; + + case SLAP_VAR_SYNTAX_uint64 : + + if( pInterface->GetEntryParamUint64 != NULL) + { + bReturn = pInterface->GetEntryParamUint64(pMyObject->hInsContext, pName, &pSlapVariable->Variant.varUint64); + } + else if( pInterface->GetEntryParamUlong != NULL) + { + /* uint64 param but only Ulong getter registered (legacy DML) */ + ULONG tmp32 = 0; + bReturn = pInterface->GetEntryParamUlong(pMyObject->hInsContext, pName, &tmp32); + if (bReturn) + { + pSlapVariable->Variant.varUint64 = (SLAP_UINT64)tmp32; + } + } + else + { + AnscTraceWarning(("GetParamValueByName '%s': GetEntryParamUint64/Ulong are NULL\n", pName)); + } + + if (!bReturn) + { + AnscTraceWarning(("GetParamValueByName '%s': uint64 getter returned FALSE (ptrUint64=%p ptrUlong=%p)\n", + pName, + (void*)pInterface->GetEntryParamUint64, + (void*)pInterface->GetEntryParamUlong)); + } break; diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_base.c b/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_base.c index d924084b5..e41aa11a4 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_base.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_base.c @@ -214,6 +214,7 @@ DslhObjroCreate pDslhRvqIf->GetParamValueString = DslhObjroRvqGetParamValueString; pDslhRvqIf->GetParamValueInt = DslhObjroRvqGetParamValueInt; pDslhRvqIf->GetParamValueUint32 = DslhObjroRvqGetParamValueUint32; + pDslhRvqIf->GetParamValueUint64 = DslhObjroRvqGetParamValueUint64; pDslhRvqIf->GetParamValueBool = DslhObjroRvqGetParamValueBool; pDslhRvqIf->GetParamValueUint32Array = DslhObjroRvqGetParamValueUint32Array; pDslhRvqIf->GetParamValueUcharArray = DslhObjroRvqGetParamValueUcharArray; diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_internal_api.h b/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_internal_api.h index 87c4cd72c..767953682 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_internal_api.h +++ b/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_internal_api.h @@ -351,6 +351,13 @@ DslhObjroRvqGetParamValueInt char* pParamName ); +unsigned long long +DslhObjroRvqGetParamValueUint64 + ( + ANSC_HANDLE hThisObject, + char* pParamName + ); + ULONG DslhObjroRvqGetParamValueUint32 ( diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_rvqif.c b/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_rvqif.c index 19ef32b64..edb2f7f0d 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_rvqif.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhObjRecord/dslh_objro_rvqif.c @@ -54,6 +54,7 @@ * DslhObjroRvqGetParamValueString * DslhObjroRvqGetParamValueInt * DslhObjroRvqGetParamValueUint32 + * DslhObjroRvqGetParamValueUint64 * DslhObjroRvqGetParamValueBool * DslhObjroRvqGetParamValueUint32Array * DslhObjroRvqGetParamValueUcharArray @@ -398,6 +399,55 @@ DslhObjroRvqGetParamValueInt **********************************************************************/ + +/********************************************************************** + + caller: owner of this object + + prototype: + + unsigned long long + DslhObjroRvqGetParamValueUint64 + ( + ANSC_HANDLE hThisObject, + char* pParamName + ); + + description: + + Retrieve modified unsignedLong / uint64 parameter value. + +**********************************************************************/ + +unsigned long long +DslhObjroRvqGetParamValueUint64 + ( + ANSC_HANDLE hThisObject, + char* pParamName + ) +{ + PDSLH_OBJ_RECORD_OBJECT pMyObject = (PDSLH_OBJ_RECORD_OBJECT)hThisObject; + PSLAP_VARIABLE pParamValue = (PSLAP_VARIABLE )NULL; + PDSLH_RVQ_INTERFACE pDslhRvqIf = (PDSLH_RVQ_INTERFACE )pMyObject->hDslhRvqIf; + + pParamValue = + (PSLAP_VARIABLE)pDslhRvqIf->GetParamValue + ( + (ANSC_HANDLE)pMyObject, + pParamName + ); + + if ( !pParamValue ) + { + return 0; + } + + if ( pParamValue->Syntax == SLAP_VAR_SYNTAX_uint64 ) + return (unsigned long long)pParamValue->Variant.varUint64; + + return (unsigned long long)pParamValue->Variant.varUint32; +} + ULONG DslhObjroRvqGetParamValueUint32 ( diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhVarRecord/dslh_varro_access.c b/source/ccsp/components/common/DataModel/dml/components/DslhVarRecord/dslh_varro_access.c index 0f8bfc87c..8b15c9fb4 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhVarRecord/dslh_varro_access.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhVarRecord/dslh_varro_access.c @@ -207,6 +207,10 @@ DslhVarroGetValue { pSlapVariable->Variant.varUint32 = 0; } + else if( pSlapVariable->Syntax == SLAP_VAR_SYNTAX_uint64) + { + pSlapVariable->Variant.varUint64 = 0; + } } } @@ -332,6 +336,14 @@ DslhVarroGetValue break; + case SLAP_VAR_SYNTAX_uint64 : + + pSlapVariable->Variant.varUint64 = + ((PFN_DSLHPARAM_GET_UINT64)pfnGetValueMethod) + ((ANSC_HANDLE)pObjController); + + break; + case SLAP_VAR_SYNTAX_uint32Array : pSlapVariable->Variant.varUint32Array = @@ -664,6 +676,20 @@ DslhVarroTstValue break; + case DSLH_CWMP_DATA_TYPE_unsignedLong : + + /* TR-181 unsignedLong is slap uint64 only (dmcli ulong). */ + if ( pNewValue->Syntax != SLAP_VAR_SYNTAX_uint64 ) + { + return FALSE; + } + if ( pNewValue->Variant.varUint64 < (SLAP_UINT64)pVarEntity->FormatValue1 ) + { + return FALSE; + } + + break; + case DSLH_CWMP_DATA_TYPE_boolean : if ( (pNewValue->Syntax != SLAP_VAR_SYNTAX_bool ) && @@ -712,7 +738,31 @@ DslhVarroTstValue * (digits 0-9, letters A-F or a-f) displayed as six pairs of digits separated * by colons. */ - if ( pVarEntity->ContentType == SLAP_CONTENT_TYPE_UNSPECIFIED ) + /* + * TR-181 unsignedLong uses ContentType UNSIGNED_LONG + slap uint64. + * Handle it alone so it never falls into the string ContentType path + * (that path's default returns FALSE → invalid parameter value). + */ + if ( pVarEntity->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG ) + { + if ( !bTestBypass ) + { + if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_uint64 ) + { + bTestResult = + ((PFN_DSLHPARAM_TST_UINT64)pfnTstValueMethod) + ( + (ANSC_HANDLE)pObjController, + pNewValue->Variant.varUint64 + ); + } + else + { + bTestResult = FALSE; + } + } + } + else if ( pVarEntity->ContentType == SLAP_CONTENT_TYPE_UNSPECIFIED ) { switch ( pVarEntity->Syntax ) { @@ -786,6 +836,18 @@ DslhVarroTstValue break; + case SLAP_VAR_SYNTAX_uint64 : + + if ( !bTestBypass ) + { + bTestResult = + ((PFN_DSLHPARAM_TST_UINT64)pfnTstValueMethod) + ((ANSC_HANDLE)pObjController, + pNewValue->Variant.varUint64); + } + + break; + case SLAP_VAR_SYNTAX_handle : if ( !bTestBypass ) @@ -1314,7 +1376,16 @@ DslhVarroSetValue */ - if ( pVarEntity->ContentType == SLAP_CONTENT_TYPE_UNSPECIFIED ) + if ( pVarEntity->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG ) + { + returnStatus = + ((PFN_DSLHPARAM_SET_UINT64)pfnSetValueMethod) + ( + (ANSC_HANDLE)pObjController, + pNewValue->Variant.varUint64 + ); + } + else if ( pVarEntity->ContentType == SLAP_CONTENT_TYPE_UNSPECIFIED ) { switch ( pVarEntity->Syntax ) { @@ -1373,6 +1444,17 @@ DslhVarroSetValue break; + case SLAP_VAR_SYNTAX_uint64 : + + returnStatus = + ((PFN_DSLHPARAM_SET_UINT64)pfnSetValueMethod) + ( + (ANSC_HANDLE)pObjController, + pNewValue->Variant.varUint64 + ); + + break; + case SLAP_VAR_SYNTAX_handle : returnStatus = diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mpaif.c b/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mpaif.c index 6d6b3ed36..73116de22 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mpaif.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mpaif.c @@ -772,6 +772,19 @@ DslhWmpdoMpaSetParameterValues break; } } + else if( dataType == DSLH_CWMP_DATA_TYPE_unsignedLong) + { + if( pParameterValueArray[i].Value->Syntax != SLAP_VAR_SYNTAX_uint64) + { + bFaultEncountered = TRUE; + + *ppInvalidParameterName = AnscCloneString(pParameterValueArray[i].Name); + + returnStatus = CCSP_ERR_INVALID_PARAMETER_TYPE; + + break; + } + } else { if( pParameterValueArray[i].Value->Syntax != SLAP_VAR_SYNTAX_string) diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mprif.c b/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mprif.c index 312bf2566..4e3eb79ac 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mprif.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mprif.c @@ -308,6 +308,11 @@ DslhWmpdoMprRegParameter // Assign appropriate ContentType for 'dateTime', or the object type will default to 'string'. RTian 2013/11/11 if(pVarEntity->DataType == DSLH_CWMP_DATA_TYPE_dateTime) pVarEntity->ContentType = SLAP_CONTENT_TYPE_CALENDAR_TIME; + if(pVarEntity->DataType == DSLH_CWMP_DATA_TYPE_unsignedLong) + { + pVarEntity->Syntax = SLAP_VAR_SYNTAX_uint64; + pVarEntity->ContentType = SLAP_CONTENT_TYPE_UNSIGNED_LONG; + } if ( pParamEnumTokens ) { diff --git a/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_utilities.c b/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_utilities.c index b18b52fe9..fafd1089f 100644 --- a/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_utilities.c +++ b/source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_utilities.c @@ -413,6 +413,17 @@ DslhWmpdoParseParamDataType AnscTcFree((ANSC_HANDLE)pFormatValueChain); } } + else if ( strcmp(pDataTypeToken->Name,DSLH_CWMP_DATA_NAME_unsignedLong) == 0 ) + { + /* + * TR-181 unsignedLong / StatsCounter64 on ILP32+LP64. + * Use slap uint64 storage (not ULONG/uint32). FormatValue2 ULONG max is + * not used as an upper bound for this type (see dslh_varro_access). + */ + *pulDataType = DSLH_CWMP_DATA_TYPE_unsignedLong; + *pulFormatValue1 = (ULONG)0; + *pulFormatValue2 = (ULONG)0; /* 0 = no ULONG-range cap; uint64 path validates */ + } else if ( strcmp(pDataTypeToken->Name,DSLH_CWMP_DATA_NAME_boolean) == 0 ) { *pulDataType = DSLH_CWMP_DATA_TYPE_boolean; @@ -535,6 +546,9 @@ DslhWmpdoParseParamSyntax *pulSyntax = SLAP_VAR_SYNTAX_TYPE_string; else if ( _ansc_strcmp(SLAP_VAR_SYNTAX_NAME_uint32, pTokenSyntax->Name) == 0 ) *pulSyntax = SLAP_VAR_SYNTAX_TYPE_uint32; + else if ( _ansc_strcmp(SLAP_VAR_SYNTAX_NAME_uint64, pTokenSyntax->Name) == 0 || + _ansc_strcmp("uint64", pTokenSyntax->Name) == 0 ) + *pulSyntax = SLAP_VAR_SYNTAX_TYPE_uint64; else if ( _ansc_strcmp(SLAP_VAR_SYNTAX_NAME_int, pTokenSyntax->Name) == 0 ) *pulSyntax = SLAP_VAR_SYNTAX_TYPE_int; else if ( _ansc_strcmp(SLAP_VAR_SYNTAX_NAME_handle, pTokenSyntax->Name) == 0 ) diff --git a/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_helper.c b/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_helper.c index 31e2c618b..ec94c7de4 100644 --- a/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_helper.c +++ b/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_helper.c @@ -79,6 +79,10 @@ #include "messagebus_interface_global.h" #include "slap_vco_internal_api.h" +#include +#include +#include + #if defined (_COSA_QCA_ARM_) static ULONG g_uMaxParamInResponse = 40000; /* DSLH_WMPDO_MAX_PARAM_VALUES_IN_RESPONSE */ #else @@ -112,6 +116,7 @@ CcspCcMbi_ValidateBoolean } + static int CcspCcMbi_ValidateINT ( const char * intStr, @@ -121,8 +126,7 @@ static int CcspCcMbi_ValidateINT int len = strlen(intStr); char* pNext; char c; - char buf[12]; - int num; + char buf[64] = {0}; if(len <= 0) return -1; @@ -146,15 +150,37 @@ static int CcspCcMbi_ValidateINT pNext++; } - num = _ansc_atoi(intStr); - if ( signedInt ) - snprintf(buf, sizeof(buf), "%d", num); + { + int num = _ansc_atoi(intStr); + _ansc_itoa(num, buf, 10); + } else - snprintf(buf, sizeof(buf), "%u", (unsigned int) num); + { + /* ULONG parse/format; unsignedLong uses CcspCcMbi_StringToUint64 */ + ULONG unum = (ULONG)_ansc_atol(intStr); + _ansc_ultoa(unum, buf, 10); + } + + if ( strcmp(buf, (char*)intStr) != 0 ) return -1; + + return 0; +} + +static int CcspCcMbi_StringToUint64(const char* value, SLAP_UINT64* result) +{ + char* end = NULL; + unsigned long long parsed; + + if ( value == NULL || *value == '\0' || *value == '-' ) + return -1; - if ( !strcmp(buf, (char*)intStr) == 0 ) return -1; + errno = 0; + parsed = strtoull(value, &end, 10); + if ( errno == ERANGE || end == value || *end != '\0' ) + return -1; + *result = (SLAP_UINT64)parsed; return 0; } @@ -318,6 +344,14 @@ CcspCcMbi_GetParameterValues ppReturnVal[i]->parameterValue = SlapVcoIntToString(NULL, 0); ppReturnVal[i]->type = ccsp_unsignedInt; } + else if ( pParamValueArray[i].Value->Syntax == SLAP_VAR_SYNTAX_uint64 ) + { + char ubuf[64]; + snprintf(ubuf, sizeof(ubuf), "%llu", + (unsigned long long)pParamValueArray[i].Value->Variant.varUint64); + ppReturnVal[i]->parameterValue = AnscCloneString(ubuf); + ppReturnVal[i]->type = ccsp_unsignedLong; + } else if ( pParamValueArray[i].Value->Syntax == SLAP_VAR_SYNTAX_uint32 ) { if ( pParamValueArray[i].Value->ContentType == SLAP_CONTENT_TYPE_IP4_ADDR ) @@ -325,6 +359,14 @@ CcspCcMbi_GetParameterValues ppReturnVal[i]->parameterValue = SlapVcoIp4AddrToString(NULL, pParamValueArray[i].Value->Variant.varUint32); ppReturnVal[i]->type = ccsp_string; } + else if ( pParamValueArray[i].Value->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG ) + { + char ubuf[64]; + snprintf(ubuf, sizeof(ubuf), "%llu", + (unsigned long long)pParamValueArray[i].Value->Variant.varUint32); + ppReturnVal[i]->parameterValue = AnscCloneString(ubuf); + ppReturnVal[i]->type = ccsp_unsignedLong; + } else { ppReturnVal[i]->parameterValue = SlapVcoUint32ToString(NULL, pParamValueArray[i].Value->Variant.varUint32); @@ -511,16 +553,30 @@ CcspCcMbi_SetParameterValues 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) ) + else if ( val[i].type == ccsp_unsignedLong ) { - if ( CcspCcMbi_ValidateINT(val[i].parameterValue, 0) != 0 ) + SLAP_UINT64 u64 = 0; + + if ( CcspCcMbi_StringToUint64(val[i].parameterValue, &u64) != 0 ) { returnStatus = CCSP_ERR_INVALID_PARAMETER_VALUE; - goto EXIT1; } - pSlapVariable->Syntax = SLAP_VAR_SYNTAX_uint32; + pSlapVariable->Syntax = SLAP_VAR_SYNTAX_uint64; + pSlapVariable->ContentType = SLAP_CONTENT_TYPE_UNSIGNED_LONG; + pSlapVariable->Variant.varUint64 = u64; + } + else if ( (val[i].type == ccsp_unsignedInt) || (val[i].type == ccsp_long) ) + { + /* ccsp_long historically shares the unsignedInt (uint32) set path. */ + 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 ) diff --git a/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c b/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c index d978badb8..c0fbf2206 100644 --- a/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c +++ b/source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c @@ -171,13 +171,25 @@ mbiIf_SendParameterValueChangeSignal if ( pOldValue ) { - if ( pOldValue->Syntax == SLAP_VAR_SYNTAX_uint32 ) + if ( pOldValue->Syntax == SLAP_VAR_SYNTAX_uint64 ) + { + char value[32]; + snprintf(value, sizeof(value), "%llu", (unsigned long long)pOldValue->Variant.varUint64); + pParamSignal->oldValue = AnscCloneString(value); + pParamSignal->type = ccsp_unsignedLong; + } + else if ( pOldValue->Syntax == SLAP_VAR_SYNTAX_uint32 ) { if ( pOldValue->ContentType == SLAP_CONTENT_TYPE_IP4_ADDR ) { pParamSignal->oldValue = SlapVcoIp4AddrToString(NULL, pOldValue->Variant.varUint32); pParamSignal->type = ccsp_string; } + else if ( pOldValue->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG ) + { + pParamSignal->oldValue = SlapVcoUint32ToString(NULL, pOldValue->Variant.varUint32); + pParamSignal->type = ccsp_unsignedLong; + } else { pParamSignal->oldValue = SlapVcoUint32ToString(NULL, pOldValue->Variant.varUint32); @@ -215,10 +227,24 @@ mbiIf_SendParameterValueChangeSignal if ( pNewValue ) { - if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_uint32 ) + if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_uint64 ) + { + char value[32]; + snprintf(value, sizeof(value), "%llu", (unsigned long long)pNewValue->Variant.varUint64); + pParamSignal->newValue = AnscCloneString(value); + pParamSignal->type = ccsp_unsignedLong; + } + else if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_uint32 ) { pParamSignal->newValue = SlapVcoUint32ToString(NULL, pNewValue->Variant.varUint32); - pParamSignal->type = ccsp_unsignedInt; + if ( pNewValue->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG ) + { + pParamSignal->type = ccsp_unsignedLong; + } + else + { + pParamSignal->type = ccsp_unsignedInt; + } } else if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_string ) { diff --git a/source/ccsp/components/include/dslh_definitions_database.h b/source/ccsp/components/include/dslh_definitions_database.h index b120dd46e..79697e0ac 100644 --- a/source/ccsp/components/include/dslh_definitions_database.h +++ b/source/ccsp/components/include/dslh_definitions_database.h @@ -140,6 +140,7 @@ #define DSLH_CWMP_DATA_TYPE_boolean 5 #define DSLH_CWMP_DATA_TYPE_dateTime 6 #define DSLH_CWMP_DATA_TYPE_base64 7 +#define DSLH_CWMP_DATA_TYPE_unsignedLong 8 #define DSLH_CWMP_DATA_NAME_object "object" #define DSLH_CWMP_DATA_NAME_string "string" @@ -148,6 +149,7 @@ #define DSLH_CWMP_DATA_NAME_boolean "boolean" #define DSLH_CWMP_DATA_NAME_dateTime "dateTime" #define DSLH_CWMP_DATA_NAME_base64 "base64" +#define DSLH_CWMP_DATA_NAME_unsignedLong "unsignedLong" #define DSLH_CWMP_DATA_INVALID_VALUE_TYPE 1 @@ -163,6 +165,7 @@ typedef SLAP_STRING (*PFN_DSLHPARAM_GET_STRING)(ANSC_HANDLE hThisObject); typedef SLAP_INT (*PFN_DSLHPARAM_GET_INT )(ANSC_HANDLE hThisObject); typedef SLAP_UINT32 (*PFN_DSLHPARAM_GET_UINT32)(ANSC_HANDLE hThisObject); +typedef SLAP_UINT64 (*PFN_DSLHPARAM_GET_UINT64)(ANSC_HANDLE hThisObject); typedef SLAP_BOOL (*PFN_DSLHPARAM_GET_BOOL )(ANSC_HANDLE hThisObject); typedef SLAP_HANDLE (*PFN_DSLHPARAM_GET_HANDLE)(ANSC_HANDLE hThisObject); typedef SLAP_UCHAR_ARRAY* (*PFN_DSLHPARAM_GET_BUFFER)(ANSC_HANDLE hThisObject); @@ -171,6 +174,7 @@ typedef SLAP_UINT32_ARRAY* (*PFN_DSLHPARAM_GET_ULLIST)(ANSC_HANDLE hThisObjec typedef BOOL (*PFN_DSLHPARAM_TST_STRING)(ANSC_HANDLE hThisObject, SLAP_STRING var_string); typedef BOOL (*PFN_DSLHPARAM_TST_INT )(ANSC_HANDLE hThisObject, SLAP_INT var_int ); typedef BOOL (*PFN_DSLHPARAM_TST_UINT32)(ANSC_HANDLE hThisObject, SLAP_UINT32 var_uint32); +typedef BOOL (*PFN_DSLHPARAM_TST_UINT64)(ANSC_HANDLE hThisObject, SLAP_UINT64 var_uint64); typedef BOOL (*PFN_DSLHPARAM_TST_BOOL )(ANSC_HANDLE hThisObject, SLAP_BOOL var_bool ); typedef BOOL (*PFN_DSLHPARAM_TST_HANDLE)(ANSC_HANDLE hThisObject, SLAP_HANDLE var_handle); typedef BOOL (*PFN_DSLHPARAM_TST_BUFFER)(ANSC_HANDLE hThisObject, SLAP_UCHAR_ARRAY* var_buffer); @@ -179,6 +183,7 @@ typedef BOOL (*PFN_DSLHPARAM_TST_ULLIST)(ANSC_HANDLE hThisObjec typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_STRING)(ANSC_HANDLE hThisObject, SLAP_STRING var_string); typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_INT )(ANSC_HANDLE hThisObject, SLAP_INT var_int ); typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_UINT32)(ANSC_HANDLE hThisObject, SLAP_UINT32 var_uint32); +typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_UINT64)(ANSC_HANDLE hThisObject, SLAP_UINT64 var_uint64); typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_BOOL )(ANSC_HANDLE hThisObject, SLAP_BOOL var_bool ); typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_HANDLE)(ANSC_HANDLE hThisObject, SLAP_HANDLE var_handle); typedef ANSC_STATUS (*PFN_DSLHPARAM_SET_BUFFER)(ANSC_HANDLE hThisObject, SLAP_UCHAR_ARRAY* var_buffer); diff --git a/source/ccsp/components/include/dslh_definitions_tr143.h b/source/ccsp/components/include/dslh_definitions_tr143.h index 6ebbb1e1b..4cb529a4a 100644 --- a/source/ccsp/components/include/dslh_definitions_tr143.h +++ b/source/ccsp/components/include/dslh_definitions_tr143.h @@ -71,6 +71,8 @@ #ifndef _DSLH_DEFINITIONS_TR143_H_ #define _DSLH_DEFINITIONS_TR143_H_ +#include + /* * Each status of diagnostic supported by the DSLH model must be uniquely identified */ #define DSLH_TR143_DIAGNOSTIC_None 0 @@ -85,6 +87,8 @@ #define DSLH_TR143_DIAGNOSTIC_Error_NoPASV 9 #define DSLH_TR143_DIAGNOSTIC_Error_IncorrectSize 10 #define DSLH_TR143_DIAGNOSTIC_Error_Timeout 11 +#define DSLH_TR143_DIAGNOSTIC_Canceled 12 +#define DSLH_TR143_DIAGNOSTIC_Error_Internal 13 #define DSLH_TR143_MAX_STRING_LENGTH 256 /*********************************************************** @@ -99,6 +103,8 @@ _DSLH_TR143_DOWNLOAD_DIAG_INFO char DownloadURL[DSLH_TR143_MAX_STRING_LENGTH]; ULONG DSCP; ULONG EthernetPriority; + ULONG TimeBasedTestDuration; + ULONG TimeBasedTestMeasurementOffset; ULONG DiagnosticsState; } DSLH_TR143_DOWNLOAD_DIAG_INFO, *PDSLH_TR143_DOWNLOAD_DIAG_INFO; @@ -109,6 +115,8 @@ DSLH_TR143_DOWNLOAD_DIAG_INFO, *PDSLH_TR143_DOWNLOAD_DIAG_INFO; AnscZeroMemory(d_info->DownloadURL, DSLH_TR143_MAX_STRING_LENGTH); \ d_info->DSCP = 0; \ d_info->EthernetPriority = 0; \ + d_info->TimeBasedTestDuration = 10; \ + d_info->TimeBasedTestMeasurementOffset = 2; \ d_info->DiagnosticsState = 0; \ } \ @@ -129,7 +137,9 @@ _DSLH_TR143_UPLOAD_DIAG_INFO char UploadURL[DSLH_TR143_MAX_STRING_LENGTH]; ULONG DSCP; ULONG EthernetPriority; - ULONG TestFileLength; + uint64_t TestFileLength; + ULONG TimeBasedTestDuration; + ULONG TimeBasedTestMeasurementOffset; ULONG DiagnosticsState; } DSLH_TR143_UPLOAD_DIAG_INFO, *PDSLH_TR143_UPLOAD_DIAG_INFO; @@ -141,6 +151,8 @@ DSLH_TR143_UPLOAD_DIAG_INFO, *PDSLH_TR143_UPLOAD_DIAG_INFO; u_info->DSCP = 0; \ u_info->EthernetPriority = 0; \ u_info->TestFileLength = 1000000; \ + u_info->TimeBasedTestDuration = 10; \ + u_info->TimeBasedTestMeasurementOffset = 2; \ u_info->DiagnosticsState = 0; \ } \ diff --git a/source/ccsp/components/include/dslh_dmagnt_interface.h b/source/ccsp/components/include/dslh_dmagnt_interface.h index bcacbc9eb..e988873db 100644 --- a/source/ccsp/components/include/dslh_dmagnt_interface.h +++ b/source/ccsp/components/include/dslh_dmagnt_interface.h @@ -142,6 +142,8 @@ #define COSA_XML_NODE_func_SetParamBoolValue "func_SetParamBoolValue" #define COSA_XML_NODE_func_SetParamIntValue "func_SetParamIntValue" #define COSA_XML_NODE_func_SetParamUlongValue "func_SetParamUlongValue" +#define COSA_XML_NODE_func_SetParamUint64Value "func_SetParamUint64Value" +#define COSA_XML_NODE_func_GetParamUint64Value "func_GetParamUint64Value" #define COSA_XML_NODE_func_SetParamStringValue "func_SetParamStringValue" #define COSA_XML_NODE_func_SetParamBulkValues "func_SetBulkParamValues" #define COSA_XML_NODE_func_Validate "func_Validate" diff --git a/source/ccsp/components/include/dslh_ifo_rvq.h b/source/ccsp/components/include/dslh_ifo_rvq.h index 027ce556c..d1202cc12 100644 --- a/source/ccsp/components/include/dslh_ifo_rvq.h +++ b/source/ccsp/components/include/dslh_ifo_rvq.h @@ -130,6 +130,13 @@ typedef int char* pParamName ); +typedef unsigned long long +(*PFN_DSLHRVQIF_GET_UINT64) + ( + ANSC_HANDLE hThisObject, + char* pParamName + ); + typedef ULONG (*PFN_DSLHRVQIF_GET_UINT32) ( @@ -186,6 +193,7 @@ typedef ANSC_HANDLE PFN_DSLHRVQIF_GET_STRING GetParamValueString; \ PFN_DSLHRVQIF_GET_INT GetParamValueInt; \ PFN_DSLHRVQIF_GET_UINT32 GetParamValueUint32; \ + PFN_DSLHRVQIF_GET_UINT64 GetParamValueUint64; \ PFN_DSLHRVQIF_GET_BOOL GetParamValueBool; \ PFN_DSLHRVQIF_GET_UINT32A GetParamValueUint32Array; \ PFN_DSLHRVQIF_GET_UCHARA GetParamValueUcharArray; \ diff --git a/source/ccsp/components/include/dslh_ifo_tr69.h b/source/ccsp/components/include/dslh_ifo_tr69.h index 5ce2a2cb5..305535458 100644 --- a/source/ccsp/components/include/dslh_ifo_tr69.h +++ b/source/ccsp/components/include/dslh_ifo_tr69.h @@ -149,6 +149,22 @@ typedef BOOL ULONG uValue ); +typedef BOOL +(*PFN_DSLHTR69_SET_UINT64) + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG64 uValue + ); + +typedef BOOL +(*PFN_DSLHTR69_GET_UINT64) + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG64* pValue + ); + typedef BOOL (*PFN_DSLHTR69_SET_BOOL) ( @@ -342,6 +358,8 @@ _DSLH_TR69_INTERFACE PFN_DSLHTR69_SET_BOOL SetEntryParamBool; PFN_DSLHTR69_SET_INT SetEntryParamInt; PFN_DSLHTR69_SET_ULONG SetEntryParamUlong; + PFN_DSLHTR69_SET_UINT64 SetEntryParamUint64; + PFN_DSLHTR69_GET_UINT64 GetEntryParamUint64; PFN_DSLHTR69_SET_STRING SetEntryParamString; PFN_DSLHTR69_GET_BULK GetEntryBulk; PFN_DSLHTR69_SET_BULK SetEntryBulk; diff --git a/source/ccsp/include/ccsp_base_api.h b/source/ccsp/include/ccsp_base_api.h index 24b502ebb..5238896f4 100644 --- a/source/ccsp/include/ccsp_base_api.h +++ b/source/ccsp/include/ccsp_base_api.h @@ -338,6 +338,8 @@ int CcspBaseIf_freeResources( int priority ); +void Notify_change(char *event_name, void *new_value); + //Data model parameters "set" APIs,caller free invalidParameterName int CcspBaseIf_setParameterValues( void* bus_handle, diff --git a/source/cosa/include/linux/user_base.h b/source/cosa/include/linux/user_base.h index 87aadfab1..32ad92d3b 100644 --- a/source/cosa/include/linux/user_base.h +++ b/source/cosa/include/linux/user_base.h @@ -172,6 +172,7 @@ typedef double DOUBLE, *PDOUBLE; typedef float FLOAT, *PFLOAT; typedef unsigned char BOOLEAN, *PBOOLEAN; typedef unsigned char *PBOOL; +/* Real 64-bit width for TR-181 unsignedLong / StatsCounter64 on ILP32 (OBDR-21600). */ typedef unsigned long long ULONG64, *PULONG64; #ifndef FALSE diff --git a/source/cosa/include/linux/user_runtime.h b/source/cosa/include/linux/user_runtime.h index 0b6c9f7db..1205e98d8 100644 --- a/source/cosa/include/linux/user_runtime.h +++ b/source/cosa/include/linux/user_runtime.h @@ -91,6 +91,14 @@ char *_ansc_itoa(int value, char *string, int radix); +char* +_ansc_ultoa + ( + ULONG value, + char* pBuf, + int radix + ); + #define _ansc_rand rand #define _ansc_srand srand diff --git a/source/cosa/include/linux/user_time.h b/source/cosa/include/linux/user_time.h index f359e6fec..54d365f74 100644 --- a/source/cosa/include/linux/user_time.h +++ b/source/cosa/include/linux/user_time.h @@ -96,6 +96,7 @@ _USER_SYSTEM_TIME USHORT Minute; USHORT Second; USHORT MilliSecond; + ULONG MicroSecond; } USER_SYSTEM_TIME, *PUSER_SYSTEM_TIME; diff --git a/source/cosa/package/slap/include/slap_definitions.h b/source/cosa/package/slap/include/slap_definitions.h index 77372010b..f7454ed93 100644 --- a/source/cosa/package/slap/include/slap_definitions.h +++ b/source/cosa/package/slap/include/slap_definitions.h @@ -75,6 +75,7 @@ #define _SLAP_DEFINITIONS_ #include "user_base.h" +#include #include "ansc_wrapper_base.h" #include "ansc_common_structures.h" #include "slap_vho_exported_api.h" @@ -141,6 +142,7 @@ #define SLAP_CONTENT_TYPE_IP6_ADDR 16 /* applies to ucharArray, rendered as a IPv6 address string */ #define SLAP_CONTENT_TYPE_IP6_ADDR_LIST 17 /* applies to ucharArray, rendered as an array of IPv6 addresses */ #define SLAP_CONTENT_TYPE_IP4_ADDR_RANGE_LIST 18 /* applies to ucharArray, rendered as an array of IPv4 addresses */ +#define SLAP_CONTENT_TYPE_UNSIGNED_LONG 19 /* applies to uint32/ULONG, TR-181 unsignedLong / StatsCounter64 */ #define SLAP_CONTENT_TYPE_TABLE_2D 10001 @@ -186,6 +188,7 @@ #define SLAP_VAR_SYNTAX_stringArray SLAP_VAR_SYNTAX_TYPE_stringArray #define SLAP_VAR_SYNTAX_ucharArray SLAP_VAR_SYNTAX_TYPE_ucharArray #define SLAP_VAR_SYNTAX_uint32 SLAP_VAR_SYNTAX_TYPE_uint32 +#define SLAP_VAR_SYNTAX_uint64 SLAP_VAR_SYNTAX_TYPE_uint64 #define SLAP_VAR_SYNTAX_uint32Array SLAP_VAR_SYNTAX_TYPE_uint32Array #define SLAP_VAR_SYNTAX_ptr SLAP_VAR_SYNTAX_TYPE_ptr #define SLAP_VAR_SYNTAX_ptrArray SLAP_VAR_SYNTAX_TYPE_ptrArray @@ -207,6 +210,7 @@ #define SLAP_VAR_SYNTAX_TYPE_ucharArray 8 #define SLAP_VAR_SYNTAX_TYPE_uint32 9 #define SLAP_VAR_SYNTAX_TYPE_uint32Array 10 +#define SLAP_VAR_SYNTAX_TYPE_uint64 17 #define SLAP_VAR_SYNTAX_TYPE_ptr 11 #define SLAP_VAR_SYNTAX_TYPE_ptrArray 12 #define SLAP_VAR_SYNTAX_TYPE_handle 13 @@ -226,6 +230,7 @@ #define SLAP_VAR_SYNTAX_NAME_stringArray "stringArray" #define SLAP_VAR_SYNTAX_NAME_ucharArray "ucharArray" #define SLAP_VAR_SYNTAX_NAME_uint32 "uint32" +#define SLAP_VAR_SYNTAX_NAME_uint64 "uint64" #define SLAP_VAR_SYNTAX_NAME_uint32Array "uint32Array" #define SLAP_VAR_SYNTAX_NAME_ptr "ptr" #define SLAP_VAR_SYNTAX_NAME_ptrArray "ptrArray" @@ -253,6 +258,7 @@ typedef char* SLAP_STRING, *PSLAP_STRING; typedef int SLAP_INT, *PSLAP_INT; typedef UCHAR SLAP_UCHAR, *PSLAP_UCHAR; typedef ULONG SLAP_UINT32, *PSLAP_UINT32; +typedef ULONG64 SLAP_UINT64, *PSLAP_UINT64; typedef void* SLAP_PTR, *PSLAP_PTR; typedef ANSC_HANDLE SLAP_HANDLE, *PSLAP_HANDLE; typedef ANSC_HANDLE SLAP_OBJECT, *PSLAP_OBJECT; @@ -549,6 +555,7 @@ _SLAP_VARIABLE SLAP_STRING_ARRAY* varStringArray; SLAP_UCHAR_ARRAY* varUcharArray; SLAP_UINT32 varUint32; + SLAP_UINT64 varUint64; SLAP_UINT32_ARRAY* varUint32Array; SLAP_PTR varPtr; SLAP_PTR_ARRAY* varPtrArray; diff --git a/source/cosa/package/slap/services/dslh/SlapDslhParamTree/slap_dslh_paramto_access.c b/source/cosa/package/slap/services/dslh/SlapDslhParamTree/slap_dslh_paramto_access.c index 3de13ceef..ed72f939d 100644 --- a/source/cosa/package/slap/services/dslh/SlapDslhParamTree/slap_dslh_paramto_access.c +++ b/source/cosa/package/slap/services/dslh/SlapDslhParamTree/slap_dslh_paramto_access.c @@ -104,6 +104,7 @@ #include "slap_dslh_paramto_global.h" +#include #include "safec_lib_common.h" #define TYPE_DSLH_PARAMETER_NAME 0 @@ -737,10 +738,14 @@ SlapDslhParamtoGetParamValue break; case ccsp_unsignedInt: - case ccsp_unsignedLong: pRetSlapVal->Syntax = SLAP_VAR_SYNTAX_uint32; pRetSlapVal->Variant.varUint32 = SlapVcoStringToUint32(NULL, ppParamVal[0]->parameterValue); break; + case ccsp_unsignedLong: + pRetSlapVal->Syntax = SLAP_VAR_SYNTAX_uint64; + pRetSlapVal->ContentType = SLAP_CONTENT_TYPE_UNSIGNED_LONG; + pRetSlapVal->Variant.varUint64 = (SLAP_UINT64)strtoull(ppParamVal[0]->parameterValue, NULL, 10); + break; case ccsp_boolean: pRetSlapVal->Syntax = SLAP_VAR_SYNTAX_bool; @@ -903,9 +908,11 @@ SlapDslhParamtoGetParamTypeAndValue break; case ccsp_unsignedInt: - case ccsp_unsignedLong: *ppType = AnscCloneString("unsignedInt"); break; + case ccsp_unsignedLong: + *ppType = AnscCloneString("unsignedLong"); + break; case ccsp_boolean: *ppType = AnscCloneString("boolean"); diff --git a/source/debug_api/include/linux/user_time.h b/source/debug_api/include/linux/user_time.h index e2045514f..81223f0dd 100644 --- a/source/debug_api/include/linux/user_time.h +++ b/source/debug_api/include/linux/user_time.h @@ -96,6 +96,7 @@ _USER_SYSTEM_TIME USHORT Minute; USHORT Second; USHORT MilliSecond; + ULONG MicroSecond; } USER_SYSTEM_TIME, *PUSER_SYSTEM_TIME; diff --git a/source/debug_api/user_time.h b/source/debug_api/user_time.h index e2045514f..81223f0dd 100644 --- a/source/debug_api/user_time.h +++ b/source/debug_api/user_time.h @@ -96,6 +96,7 @@ _USER_SYSTEM_TIME USHORT Minute; USHORT Second; USHORT MilliSecond; + ULONG MicroSecond; } USER_SYSTEM_TIME, *PUSER_SYSTEM_TIME; diff --git a/source/dm_pack/dm_pack_code_gen.py b/source/dm_pack/dm_pack_code_gen.py index 249aeb832..8cb6527d3 100644 --- a/source/dm_pack/dm_pack_code_gen.py +++ b/source/dm_pack/dm_pack_code_gen.py @@ -70,6 +70,9 @@ func_MemoryUsage=27 func_MemoryTable=28 func_IsObjSupported=29 +func_GetParamUint64Value=30 +func_SetParamUint64Value=31 +func_TestParamUint64Value=32 def initObjectNames(objectMap): objectMap["object"]=0 @@ -109,6 +112,9 @@ def initFuncNames(funcMap): funcMap["func_MemoryUsage"]=27 funcMap["func_MemoryTable"]=28 funcMap["func_IsObjSupported"]=29 + funcMap["func_GetParamUint64Value"]=30 + funcMap["func_SetParamUint64Value"]=31 + funcMap["func_TestParamUint64Value"]=32 #printElement is only for debugging that we know how to write code that walks the tree def printElement(elem,depth): diff --git a/source/dm_pack/dm_pack_xml_helper.c b/source/dm_pack/dm_pack_xml_helper.c index ab357d108..a21ff798d 100644 --- a/source/dm_pack/dm_pack_xml_helper.c +++ b/source/dm_pack/dm_pack_xml_helper.c @@ -85,7 +85,10 @@ typedef enum funcNameId { func_MemoryCheck, func_MemoryUsage, func_MemoryTable, - func_IsObjSupported + func_IsObjSupported, + func_GetParamUint64Value, + func_SetParamUint64Value, + func_TestParamUint64Value }funcNameId; static const char* funcName[] = { @@ -118,7 +121,10 @@ static const char* funcName[] = { "MemoryCheck", "MemoryUsage", "MemoryTable", - "IsObjSupported" + "IsObjSupported", + "GetParamUint64Value", + "SetParamUint64Value", + "TestParamUint64Value" }; static const unsigned char funcNameLen[] = { 13, @@ -150,7 +156,10 @@ static const unsigned char funcNameLen[] = { 11, 11, 11, - 14 + 14, + 19, + 19, + 20 }; typedef enum paramTypeId diff --git a/source/util_api/ansc/AnscPlatform/user_runtime.c b/source/util_api/ansc/AnscPlatform/user_runtime.c index 303aac0a2..071f3393e 100644 --- a/source/util_api/ansc/AnscPlatform/user_runtime.c +++ b/source/util_api/ansc/AnscPlatform/user_runtime.c @@ -49,6 +49,7 @@ library functions. * _ansc_itoa + * _ansc_ultoa --------------------------------------------------------------- @@ -115,3 +116,57 @@ _ansc_itoa return string; } + + +char* +_ansc_ultoa + ( + ULONG value, + char* pBuf, + int radix + ) +{ + /* ULONG so LP64 values > 2^32-1 convert correctly */ + ULONG counter = 0; + ULONG result = value; + ULONG length = 0; + + if( pBuf == NULL) + { + return NULL; + } + + /* Callers in this tree use decimal only; reject unsupported radices. */ + if ( radix != 10 ) + { + return NULL; + } + + while ( result ) + { + result = result / radix; + counter++; + } + + length = counter; + result = value; + + if ( length != 0 ) + { + for ( counter = 0; counter < length; counter++ ) + { + pBuf[length - 1 - counter] = (char)(result % radix) + '0'; + result = result / radix; + } + + pBuf[length] = 0; + } + else + { + pBuf[0] = '0'; + pBuf[1] = 0; + length = 1; + } + + return pBuf; +} diff --git a/source/util_api/ansc/AnscPlatform/user_time.c b/source/util_api/ansc/AnscPlatform/user_time.c index 2049c74e4..175f72eba 100644 --- a/source/util_api/ansc/AnscPlatform/user_time.c +++ b/source/util_api/ansc/AnscPlatform/user_time.c @@ -74,6 +74,7 @@ #include "user_base.h" #include "user_time.h" #include "safec_lib_common.h" +#include #define ZONE_NUM 38 @@ -214,12 +215,27 @@ void UserGetSystemTime(USER_SYSTEM_TIME* pSystemTime) { time_t timeNow; - struct tm Tm = {0}; - struct tm *ptm = NULL; + struct tm Tm = {0}; + struct tm *ptm = NULL; + struct timespec elapseTime = {0}; - UserGetNtpTime(&timeNow); + /* + * Use one clock sample for both calendar seconds and sub-second fields so a + * second boundary cannot leave Second from one sample and Milli/Micro from another. + * Fall back to UserGetNtpTime (time()) if clock_gettime fails. + */ + if ( clock_gettime(CLOCK_REALTIME, &elapseTime) == 0 ) + { + timeNow = (time_t)elapseTime.tv_sec; + } + else + { + UserGetNtpTime(&timeNow); + elapseTime.tv_sec = timeNow; + elapseTime.tv_nsec = 0; + } - ptm = gmtime_r(&timeNow,&Tm); + ptm = gmtime_r(&timeNow,&Tm); pSystemTime->Year = ptm->tm_year + 1900; pSystemTime->Month = ptm->tm_mon + 1; @@ -228,8 +244,9 @@ UserGetSystemTime(USER_SYSTEM_TIME* pSystemTime) pSystemTime->Hour = ptm->tm_hour; pSystemTime->Minute = ptm->tm_min; pSystemTime->Second = ptm->tm_sec; - pSystemTime->MilliSecond = 0; pSystemTime->bDayLightSaving= ptm->tm_isdst; + pSystemTime->MilliSecond = elapseTime.tv_nsec / (1000000L); + pSystemTime->MicroSecond = elapseTime.tv_nsec / (1000L); } @@ -255,6 +272,7 @@ UserGetLocalTime(USER_SYSTEM_TIME* pSystemTime) pSystemTime->Minute = ptm->tm_min; pSystemTime->Second = ptm->tm_sec; pSystemTime->MilliSecond = 0; + pSystemTime->MicroSecond = 0; pSystemTime->bDayLightSaving= ptm->tm_isdst; /* printf("Linux - GetLocalTime: H: %d M: %d S: %d isdst: %d \n", pSystemTime->Hour, pSystemTime->Minute, pSystemTime->Second, pSystemTime->bDayLightSaving ); */ diff --git a/source/util_api/ansc/include/user_time.h b/source/util_api/ansc/include/user_time.h index e2045514f..81223f0dd 100644 --- a/source/util_api/ansc/include/user_time.h +++ b/source/util_api/ansc/include/user_time.h @@ -96,6 +96,7 @@ _USER_SYSTEM_TIME USHORT Minute; USHORT Second; USHORT MilliSecond; + ULONG MicroSecond; } USER_SYSTEM_TIME, *PUSER_SYSTEM_TIME; diff --git a/source/util_api/ccsp_msg_bus/ccsp_base_api.c b/source/util_api/ccsp_msg_bus/ccsp_base_api.c index 44e535f34..e75c38731 100644 --- a/source/util_api/ccsp_msg_bus/ccsp_base_api.c +++ b/source/util_api/ccsp_msg_bus/ccsp_base_api.c @@ -74,6 +74,8 @@ typedef struct _component_info { int size; } component_info; +extern ANSC_HANDLE bus_handle; + int CcspBaseIf_timeout_seconds = 60; //seconds int CcspBaseIf_timeout_getval_seconds = 120; //seconds #define CcspBaseIf_timeout_rbus (CcspBaseIf_timeout_seconds * 1000) // in milliseconds @@ -1036,7 +1038,61 @@ int CcspBaseIf_setParameterAttributes( return CcspBaseIf_setParameterAttributes_rbus(bus_handle, dst_component_id, dbus_path, sessionId, val, size); } +#ifdef USE_NOTIFY_COMPONENT +void Notify_change(char *event_name, void *new_value) +{ + char str[512] = {0}; + parameterValStruct_t notif_val[1]; + char param_name[256] = "Device.NotifyComponent.SetNotifi_ParamName"; + char compo[256] = "eRT.com.cisco.spvtg.ccsp.notifycomponent"; + char bus[256] = "/com/cisco/spvtg/ccsp/notifycomponent"; + char *faultParam = NULL; + int ret = 0; + errno_t rc = -1; + + if (!event_name || !new_value || !bus_handle) + { + return; + } + /* Keep rc < EOK: matches this file and SAFEC_DUMMY parseFormat (returns len on success). */ + rc = sprintf_s(str, sizeof(str), "%s,%s", event_name, (char *)new_value); + if (rc < EOK) + { + ERR_CHK(rc); + return; + } + + notif_val[0].parameterName = param_name; + notif_val[0].parameterValue = str; + notif_val[0].type = ccsp_string; + ret = CcspBaseIf_setParameterValues( + bus_handle, + compo, + bus, + 0, + 0, + notif_val, + 1, + TRUE, + &faultParam); + if (ret != CCSP_SUCCESS) + { + CcspTraceError(("Set Parameter Values failed\n")); + } + if (faultParam) + { + CCSP_MESSAGE_BUS_INFO *bus_info = (CCSP_MESSAGE_BUS_INFO *)bus_handle; + bus_info->freefunc(faultParam); + } +} +#else +void Notify_change(char *event_name, void *new_value) +{ + UNREFERENCED_PARAMETER(event_name); + UNREFERENCED_PARAMETER(new_value); +} +#endif int CcspBaseIf_getParameterAttributes_rbus( void* bus_handle, diff --git a/source/util_api/slap/components/SlapVarHelper/slap_vho_variable.c b/source/util_api/slap/components/SlapVarHelper/slap_vho_variable.c index 45225636c..aca4c7747 100644 --- a/source/util_api/slap/components/SlapVarHelper/slap_vho_variable.c +++ b/source/util_api/slap/components/SlapVarHelper/slap_vho_variable.c @@ -226,6 +226,13 @@ SlapVhoEqualVariables break; + case SLAP_VAR_SYNTAX_uint64 : + + b_equal_var = + (var1->Variant.varUint64 == var2->Variant.varUint64); + + break; + case SLAP_VAR_SYNTAX_uint32Array : SlapEqualVarArrays @@ -479,6 +486,12 @@ SlapVhoCloneVariable break; + case SLAP_VAR_SYNTAX_uint64 : + + dst_var->Variant.varUint64 = src_var->Variant.varUint64; + + break; + case SLAP_VAR_SYNTAX_uint32Array : if ( src_var->Variant.varUint32Array ) @@ -687,6 +700,10 @@ SlapVhoCleanVariable break; + case SLAP_VAR_SYNTAX_uint64 : + + break; + case SLAP_VAR_SYNTAX_uint32Array : if ( tbc_var->Variant.varUint32Array )