From c264a36594e60ddccdcf66087ef36e9e800c410c Mon Sep 17 00:00:00 2001 From: Stanislav Kuchar Date: Fri, 21 Nov 2025 19:34:44 +0100 Subject: [PATCH 1/3] wfa-dataelements --- config/TR181-WiFi-USGv2.XML | 355 ++++++++ include/tr_181/ml/cosa_wifi_dml.h | 445 ++++++++++ source/dml/dml_webconfig/dml_onewifi_api.c | 10 + source/dml/dml_webconfig/dml_onewifi_api.h | 2 + source/dml/tr_181/ml/cosa_wifi_dml.c | 975 +++++++++++++++++++++ 5 files changed, 1787 insertions(+) diff --git a/config/TR181-WiFi-USGv2.XML b/config/TR181-WiFi-USGv2.XML index 3415467ec..7f0d6f11a 100644 --- a/config/TR181-WiFi-USGv2.XML +++ b/config/TR181-WiFi-USGv2.XML @@ -357,6 +357,361 @@ + + DataElements + object + + + + + Network + object + + + + + Device + object + + + + + + + Radio + staticTable + 128 + + MLO_Radio_GetEntryCount + MLO_Radio_GetEntry + + + + + + Capabilities + object + + + + + WiFi7APRole + object + + + WiFi7APRole_GetParamBoolValue + WiFi7APRole_SetParamBoolValue + + + + + EMLMRSupport + boolean + bool + true + + + EMLSRSupport + boolean + bool + true + + + STRSupport + boolean + bool + true + + + NSTRSupport + boolean + bool + true + + + + + WiFi7bSTARole + object + + + WiFi7bSTARole_GetParamBoolValue + WiFi7bSTARole_SetParamBoolValue + + + + + EMLMRSupport + boolean + bool + true + + + EMLSRSupport + boolean + bool + true + + + STRSupport + boolean + bool + true + + + NSTRSupport + boolean + bool + true + + + + + + + + + APMLD + staticTable + 128 + + APMLD_GetEntryCount + APMLD_GetEntry + APMLD_GetParamUlongValue + APMLD_GetParamStringValue + APMLD_SetParamUlongValue + APMLD_SetParamStringValue + APMLD_Validate + APMLD_Commit + APMLD_Rollback + + + + MLDMACAddress + string + string + true + + + AffiliatedAPNumberOfEntries + unsignedInt + uint32 + + + STAMLDNumberOfEntries + unsignedInt + uint32 + + + + + APMLDConfig + object + + + APMLDConfig_GetParamBoolValue + APMLDConfig_SetParamBoolValue + + + + + EMLMREnabled + boolean + bool + true + + + EMLSREnabled + boolean + bool + true + + + STREnabled + boolean + bool + true + + + NSTREnabled + boolean + bool + true + + + + + AffiliatedAP + staticTable + 128 + + AffiliatedAP_GetEntryCount + AffiliatedAP_GetEntry + AffiliatedAP_GetParamUlongValue + AffiliatedAP_GetParamStringValue + AffiliatedAP_SetParamUlongValue + AffiliatedAP_SetParamStringValue + + + + + BSSID + string + string + true + + + LinkID + unsignedInt + uint32 + + + DisabledSubChannels + unsignedInt + uint32 + + + + + STAMLD + staticTable + 128 + + STAMLD_GetEntryCount + STAMLD_GetEntry + STAMLD_GetParamStringValue + STAMLD_SetParamStringValue + + + + + MLDMACAddress + string + string + true + + + + + + + bSTAMLD + object + + + bSTAMLD_GetParamStringValue + bSTAMLD_SetParamStringValue + + + + + BSSID + string + string + true + + + MLDMACAddress + string + string + true + + + AffiliatedbSTAList + string + string + true + + + + + bSTAMLDConfig + object + + + bSTAMLDConfig_GetParamBoolValue + bSTAMLDConfig_SetParamBoolValue + + + + + EMLMREnabled + boolean + bool + true + + + EMLSREnabled + boolean + bool + true + + + STREnabled + boolean + bool + true + + + NSTREnabled + boolean + bool + true + + + + + + + + + + + X_RDKCENTRAL-COM_GASConfig dynamicTable diff --git a/include/tr_181/ml/cosa_wifi_dml.h b/include/tr_181/ml/cosa_wifi_dml.h index 1fc5ae0c8..49a577131 100644 --- a/include/tr_181/ml/cosa_wifi_dml.h +++ b/include/tr_181/ml/cosa_wifi_dml.h @@ -65,6 +65,451 @@ #ifndef _COSA_WIFI_DML_H #define _COSA_WIFI_DML_H + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}. + + * MLO_Radio_GetEntryCount + * MLO_Radio_GetEntry + +***********************************************************************/ +ULONG +MLO_Radio_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + +ANSC_HANDLE +MLO_Radio_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.WiFi7APRole + + * WiFi7APRole_GetParamBoolValue + * WiFi7APRole_SetParamBoolValue + +***********************************************************************/ + +BOOL +WiFi7APRole_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ); + +BOOL +WiFi7APRole_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.WiFi7bSTARole + + * WiFi7bSTARole_GetParamBoolValue + * WiFi7bSTARole_SetParamBoolValue + +***********************************************************************/ + +BOOL +WiFi7bSTARole_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ); + +BOOL +WiFi7bSTARole_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}. + + * APMLD_GetParamUlongValue + * APMLD_GetParamStringValue + * APMLD_SetParamUlongValue + * APMLD_SetParamStringValue + +***********************************************************************/ +/********************************************************************** + + caller: owner of this object + + prototype: + + ULONG + APMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + + description: + + This function is called to retrieve the count of the table. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + return: The count of the table + +**********************************************************************/ +ULONG +APMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + +/********************************************************************** + + caller: owner of this object + + prototype: + + ANSC_HANDLE + APMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + + description: + + This function is called to retrieve the entry specified by the index. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + ULONG nIndex, + The index of this entry; + + ULONG* pInsNumber + The output instance number; + + return: The handle to identify the entry + +**********************************************************************/ +ANSC_HANDLE +APMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + +BOOL +APMLD_GetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG* puLong + ); + +ULONG +APMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ); + +BOOL +APMLD_SetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG uValue + ); + +BOOL +APMLD_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ); + +BOOL +APMLD_Validate + ( + ANSC_HANDLE hInsContext, + char* pReturnParamName, + ULONG* puLength + ); + +ULONG +APMLD_Commit + ( + ANSC_HANDLE hInsContext + ); + +ULONG +APMLD_Rollback + ( + ANSC_HANDLE hInsContext + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.APMLDConfig. + + * APMLDConfig_GetParamBoolValue + * APMLDConfig_SetParamBoolValue + +***********************************************************************/ + +BOOL +APMLDConfig_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ); + +BOOL +APMLDConfig_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.AffiliatedAP.{i}. + + * AffiliatedAP_GetParamUlongValue + * AffiliatedAP_GetParamStringValue + * AffiliatedAP_SetParamUlongValue + * AffiliatedAP_SetParamStringValue + +***********************************************************************/ +/********************************************************************** + + caller: owner of this object + + prototype: + + ULONG + APMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + + description: + + This function is called to retrieve the count of the table. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + return: The count of the table + +**********************************************************************/ +ULONG +AffiliatedAP_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + +/********************************************************************** + + caller: owner of this object + + prototype: + + ANSC_HANDLE + APMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + + description: + + This function is called to retrieve the entry specified by the index. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + ULONG nIndex, + The index of this entry; + + ULONG* pInsNumber + The output instance number; + + return: The handle to identify the entry + +**********************************************************************/ +ANSC_HANDLE +AffiliatedAP_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + + +BOOL +AffiliatedAP_GetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG* puLong + ); + +ULONG +AffiliatedAP_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ); + +BOOL +AffiliatedAP_SetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG uValue + ); + +BOOL +AffiliatedAP_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.STAMLD.{i}. + + * STAMLD_GetParamStringValue + * STAMLD_SetParamStringValue + +***********************************************************************/ +ULONG +STAMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + +ANSC_HANDLE +STAMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + +ULONG +STAMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ); + +BOOL +STAMLD_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.bSTAMLD. + + * bSTAMLD_GetParamStringValue + * bSTAMLD_SetParamStringValue + +***********************************************************************/ + +ULONG +bSTAMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ); + +BOOL +bSTAMLD_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ); + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.bSTAMLD.bSTAMLDConfig. + + * bSTAMLDConfig_GetParamBoolValue + * bSTAMLDConfig_SetParamBoolValue + +***********************************************************************/ + +BOOL +bSTAMLDConfig_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ); + +BOOL +bSTAMLDConfig_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ); + /*********************************************************************** APIs for Object: diff --git a/source/dml/dml_webconfig/dml_onewifi_api.c b/source/dml/dml_webconfig/dml_onewifi_api.c index f84374021..3b3137bff 100644 --- a/source/dml/dml_webconfig/dml_onewifi_api.c +++ b/source/dml/dml_webconfig/dml_onewifi_api.c @@ -142,6 +142,16 @@ UINT get_num_radio_dml() } } +UINT get_total_num_affiliated_ap_dml() +{ + return 3; +} + +UINT get_total_num_apmld_dml() +{ + return 8; +} + UINT get_total_num_vap_dml() { webconfig_dml_t* pwebconfig = get_webconfig_dml(); diff --git a/source/dml/dml_webconfig/dml_onewifi_api.h b/source/dml/dml_webconfig/dml_onewifi_api.h index 646fe4b97..c4e0a7a9c 100644 --- a/source/dml/dml_webconfig/dml_onewifi_api.h +++ b/source/dml/dml_webconfig/dml_onewifi_api.h @@ -121,6 +121,8 @@ hash_map_t** get_dml_acl_hash_map(unsigned int radio_index, unsigned int vap_ind queue_t** get_dml_acl_new_entry_queue(unsigned int radio_index, unsigned int vap_index); void** get_acl_vap_context(); UINT get_num_radio_dml(); +UINT get_total_num_affiliated_ap_dml(); +UINT get_total_num_apmld_dml(); UINT get_total_num_vap_dml(); void get_associated_devices_data(unsigned int radio_index); unsigned long get_associated_devices_count(wifi_vap_info_t *vap_info); diff --git a/source/dml/tr_181/ml/cosa_wifi_dml.c b/source/dml/tr_181/ml/cosa_wifi_dml.c index 6c0f2b19a..af4e59f42 100755 --- a/source/dml/tr_181/ml/cosa_wifi_dml.c +++ b/source/dml/tr_181/ml/cosa_wifi_dml.c @@ -192,6 +192,981 @@ static inline bool is_enterprise_sec(wifi_security_modes_t mode) mode == wifi_security_mode_wpa3_enterprise; } +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}. + * MLO_Radio_GetEntryCount + * MLO_Radio_GetEntry + +***********************************************************************/ +ULONG +MLO_Radio_GetEntryCount + ( + ANSC_HANDLE hInsContext + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: Number of radio:%d\n",__func__, __LINE__, get_num_radio_dml()); + return get_num_radio_dml(); +} + +ANSC_HANDLE +MLO_Radio_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: nIndex:%ld\n",__func__, __LINE__, nIndex); + if ( nIndex < (UINT)get_num_radio_dml() ) + { + *pInsNumber = nIndex + 1; + g_radio_instance_num = nIndex + 1; + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: g_radio_instance_num:%d\n",__func__, __LINE__, g_radio_instance_num); + last_radio_change = AnscGetTickInSeconds(); + + return (ANSC_HANDLE)(nIndex + 1); + } + + return NULL; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.WiFi7APRole + + * WiFi7APRole_GetParamBoolValue + * WiFi7APRole_SetParamBoolValue + +***********************************************************************/ + +BOOL +WiFi7APRole_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ) +{ + ULONG radio_index = (ULONG)hInsContext - 1; + (void)radio_index; //Artem todo + // wifi_radio_capabilities_t radio_capab = ((webconfig_dml_t *)get_webconfig_dml())->hal_cap.wifi_prop.radiocap[radio_index]; + //ULONG capab_val = radio_capab.mu_mode; + ULONG capab_val = 0; //Artem todo + + if (AnscEqualString(ParamName, "EMLMRSupport", TRUE)) + { + if (capab_val & eMLMR) return TRUE; + + return FALSE; + } + if (AnscEqualString(ParamName, "EMLSRSupport", TRUE)) + { + if (capab_val & eMLSR) return TRUE; + + return FALSE; + } + if (AnscEqualString(ParamName, "STRSupport", TRUE)) + { + if (capab_val & STR) return TRUE; + + return FALSE; + } + if (AnscEqualString(ParamName, "NSTRSupport", TRUE)) + { + if (capab_val & NSTR) return TRUE; + + return FALSE; + } + + return FALSE; +} + +BOOL +WiFi7APRole_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ) +{ + if (AnscEqualString(ParamName, "EMLMRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTRSupport", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.Radio.{i}.Capabilities.WiFi7bSTARole + + * WiFi7bSTARole_GetParamBoolValue + * WiFi7bSTARole_SetParamBoolValue + +***********************************************************************/ + +BOOL +WiFi7bSTARole_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ) +{ + if (AnscEqualString(ParamName, "EMLMRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTRSupport", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +WiFi7bSTARole_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ) +{ + if (AnscEqualString(ParamName, "EMLMRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STRSupport", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTRSupport", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}. + + * APMLD_GetEntryCount + * APMLD_GetEntry + * APMLD_GetParamUlongValue + * APMLD_GetParamStringValue + * APMLD_SetParamUlongValue + * APMLD_SetParamStringValue + +***********************************************************************/ +/********************************************************************** + + caller: owner of this object + + prototype: + + ULONG + APMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + + description: + + This function is called to retrieve the count of the table. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + return: The count of the table + +**********************************************************************/ +ULONG +APMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: total number of apmld:%d\n",__func__, __LINE__, get_total_num_apmld_dml()); + return get_total_num_apmld_dml(); +} + +/********************************************************************** + + caller: owner of this object + + prototype: + + ANSC_HANDLE + APMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + + description: + + This function is called to retrieve the entry specified by the index. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + ULONG nIndex, + The index of this entry; + + ULONG* pInsNumber + The output instance number; + + return: The handle to identify the entry + +**********************************************************************/ +ANSC_HANDLE +APMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: total number of apmlds:%d nIndex:%d\n",__func__, __LINE__, get_total_num_apmld_dml(), nIndex); + if ( nIndex >= 0 && nIndex <= (UINT)get_total_num_apmld_dml() ) + { + *pInsNumber = nIndex + 1; + } + + return (ANSC_HANDLE)(nIndex + 1); +} + +BOOL +APMLD_GetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG* puLong + ) +{ + if (AnscEqualString(ParamName, "AffiliatedAPNumberOfEntries", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STAMLDNumberOfEntries", TRUE)) + { + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d STAMLDNumberOfEntries\n", __FUNCTION__,__LINE__); + return TRUE; + } + + return FALSE; +} + +ULONG +APMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ) +{ + + ULONG apmld_index = (ULONG)hInsContext - 1; + + if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) + {/* + char buff[24] = {0}; + if (get_mld_addr_by_id(apmld_index, buff) == 0) + { + memcpy(pValue, buff, strlen(buff) + 1); + + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d MLDADDR: %s apmld_index %u\n", __FUNCTION__,__LINE__, pValue, apmld_index); + return 0; + }*/ + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d MLDADDR: ERROR apmld_index %u\n", __FUNCTION__,__LINE__, apmld_index); + return -1; + } + + return -1; +} + +BOOL +APMLD_SetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG uValue + ) +{ + if (AnscEqualString(ParamName, "AffiliatedAPNumberOfEntries", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STAMLDNumberOfEntries", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +APMLD_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ) +{ + if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +APMLD_Validate + ( + ANSC_HANDLE hInsContext, + char* pReturnParamName, + ULONG* puLength + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + UNREFERENCED_PARAMETER(pReturnParamName); + UNREFERENCED_PARAMETER(puLength); + return TRUE; +} + +ULONG +APMLD_Commit + ( + ANSC_HANDLE hInsContext + ) +{ + return TRUE; +} + +ULONG +APMLD_Rollback + ( + ANSC_HANDLE hInsContext + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + return ANSC_STATUS_SUCCESS; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.APMLDConfig. + + * APMLDConfig_GetParamBoolValue + * APMLDConfig_SetParamBoolValue + +***********************************************************************/ + +BOOL +APMLDConfig_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ) +{ + if (AnscEqualString(ParamName, "EMLMREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTREnabled", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +APMLDConfig_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ) +{ + if (AnscEqualString(ParamName, "EMLMREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTREnabled", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.AffiliatedAP.{i}. + + * AffiliatedAP_GetEntryCount + * AffiliatedAP_GetEntry + * AffiliatedAP_GetParamUlongValue + * AffiliatedAP_GetParamStringValue + * AffiliatedAP_SetParamUlongValue + * AffiliatedAP_SetParamStringValue + +***********************************************************************/ +/********************************************************************** + + caller: owner of this object + + prototype: + + ULONG + APMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + + description: + + This function is called to retrieve the count of the table. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + return: The count of the table + +**********************************************************************/ +ULONG +AffiliatedAP_GetEntryCount + ( + ANSC_HANDLE hInsContext + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: get_total_num_affiliated_ap_dml():::%d\n",__func__, __LINE__, get_total_num_affiliated_ap_dml()); + + return get_total_num_affiliated_ap_dml(); +} + +/********************************************************************** + + caller: owner of this object + + prototype: + + ANSC_HANDLE + APMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + + description: + + This function is called to retrieve the entry specified by the index. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + ULONG nIndex, + The index of this entry; + + ULONG* pInsNumber + The output instance number; + + return: The handle to identify the entry + +**********************************************************************/ +static int get_vap_in_mld(unsigned int mld_id, unsigned int vap_id) +{ + switch (vap_id) + { + case 1: + case 2: + return mld_id * 2 + vap_id - 1; + case 3: + return mld_id + 16; + default: + return -1; + } + + return -1; +} + +ANSC_HANDLE +AffiliatedAP_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ) +{ + ULONG apmld_index = (ULONG)hInsContext - 1; + ULONG vap_index = get_vap_in_mld(apmld_index, nIndex + 1); + + if ( nIndex >= 0 && nIndex <= (UINT)get_total_num_affiliated_ap_dml() ) + { + *pInsNumber = nIndex + 1; + } + + return (ANSC_HANDLE)(vap_index + 1); +} + +BOOL +AffiliatedAP_GetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG* puLong + ) +{ + ULONG vap_index = (ULONG)hInsContext - 1; + + wifi_vap_info_t *vap = (wifi_vap_info_t *)get_dml_vap_parameters(vap_index); + + if (vap == NULL) { + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: vap is NULL\n", __func__, __LINE__); + return FALSE; + } + + if (AnscEqualString(ParamName, "LinkID", TRUE)) + { + if (isVapSTAMesh(vap_index)) + { + *puLong = vap->u.sta_info.mld_info.common_info.mld_link_id; + return TRUE; + } + + *puLong = vap->u.bss_info.mld_info.common_info.mld_link_id; + + return TRUE; + } + + if (AnscEqualString(ParamName, "DisabledSubChannels", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +ULONG +AffiliatedAP_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ) +{ + ULONG vap_index = (ULONG)hInsContext - 1; + + wifi_vap_info_t *vap = (wifi_vap_info_t *)get_dml_vap_parameters(vap_index); + + if (vap == NULL) { + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: vap is NULL\n", __func__, __LINE__); + return FALSE; + } + + if (AnscEqualString(ParamName, "BSSID", TRUE)) + { + char buff[24] = {0}; + + if (isVapSTAMesh(vap->vap_index)) { + _ansc_sprintf + ( + buff, + "%02X:%02X:%02X:%02X:%02X:%02X", + vap->u.sta_info.bssid[0], + vap->u.sta_info.bssid[1], + vap->u.sta_info.bssid[2], + vap->u.sta_info.bssid[3], + vap->u.sta_info.bssid[4], + vap->u.sta_info.bssid[5] + ); + } + else + { + _ansc_sprintf + ( + buff, + "%02X:%02X:%02X:%02X:%02X:%02X", + vap->u.bss_info.bssid[0], + vap->u.bss_info.bssid[1], + vap->u.bss_info.bssid[2], + vap->u.bss_info.bssid[3], + vap->u.bss_info.bssid[4], + vap->u.bss_info.bssid[5] + ); + } + + memcpy(pValue, buff, strlen(buff) + 1); + + return 0; + } + + return -1; +} + +BOOL +AffiliatedAP_SetParamUlongValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + ULONG uValue + ) +{ + if (AnscEqualString(ParamName, "LinkID", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "DisabledSubChannels", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +AffiliatedAP_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ) +{ + if (AnscEqualString(ParamName, "BSSID", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.STAMLD.{i}. + + * STAMLD_GetEntryCount + * STAMLD_GetEntry + * STAMLD_GetParamStringValue + * STAMLD_SetParamStringValue + +***********************************************************************/ +/********************************************************************** + + caller: owner of this object + + prototype: + + ULONG + STAMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ); + + description: + + This function is called to retrieve the count of the table. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + return: The count of the table + +**********************************************************************/ +ULONG +STAMLD_GetEntryCount + ( + ANSC_HANDLE hInsContext + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: total number of apmld:%d get_total_num_apmld_dml():::%d\n",__func__, __LINE__, get_num_radio_dml() * MAX_NUM_VAP_PER_RADIO, get_total_num_vap_dml()); + return 3; +} + +/********************************************************************** + + caller: owner of this object + + prototype: + + ANSC_HANDLE + STAMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ); + + description: + + This function is called to retrieve the entry specified by the index. + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + ULONG nIndex, + The index of this entry; + + ULONG* pInsNumber + The output instance number; + + return: The handle to identify the entry + +**********************************************************************/ +ANSC_HANDLE +STAMLD_GetEntry + ( + ANSC_HANDLE hInsContext, + ULONG nIndex, + ULONG* pInsNumber + ) +{ + UNREFERENCED_PARAMETER(hInsContext); + + if ( nIndex >= 0 && nIndex <= 3 ) + { + *pInsNumber = nIndex + 1; + } + + return (ANSC_HANDLE)(nIndex + 1); /* return the handle */ +} + +ULONG +STAMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ) +{ + if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +STAMLD_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ) +{ + if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.bSTAMLD. + + * bSTAMLD_GetParamStringValue + * bSTAMLD_SetParamStringValue + +***********************************************************************/ + +ULONG +bSTAMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ) +{ + if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "BSSID", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "AffiliatedbSTAList", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +bSTAMLD_SetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pString + ) +{ + if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "BSSID", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "AffiliatedbSTAList", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + + APIs for Object: + + Device.WiFi.DataElements.Network.Device.{i}.bSTAMLD.bSTAMLDConfig. + + * bSTAMLDConfig_GetParamBoolValue + * bSTAMLDConfig_SetParamBoolValue + +***********************************************************************/ + +BOOL +bSTAMLDConfig_GetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL* pBool + ) +{ + if (AnscEqualString(ParamName, "EMLMREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTREnabled", TRUE)) + { + return TRUE; + } + + return FALSE; +} + +BOOL +bSTAMLDConfig_SetParamBoolValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + BOOL bValue + ) +{ + if (AnscEqualString(ParamName, "EMLMREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "EMLSREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "STREnabled", TRUE)) + { + return TRUE; + } + if (AnscEqualString(ParamName, "NSTREnabled", TRUE)) + { + return TRUE; + } + + return FALSE; +} + /*********************************************************************** APIs for Object: From 0c79a372a03f047e606ba98dba143fc7bdc0a80f Mon Sep 17 00:00:00 2001 From: Stanislav Kuchar Date: Thu, 27 Nov 2025 23:20:12 +0100 Subject: [PATCH 2/3] wfa-dataelements 1 wfa-dataelements 2 --- config/TR181-WiFi-USGv2.XML | 12 ++-- include/tr_181/ml/cosa_wifi_dml.h | 18 ++++++ source/core/wifi_ctrl_queue_handlers.c | 4 +- source/dml/dml_webconfig/dml_onewifi_api.c | 71 +++++++++++++++++++++- source/dml/dml_webconfig/dml_onewifi_api.h | 1 + source/dml/tr_181/ml/cosa_wifi_dml.c | 67 +++++++++++++++----- source/stats/wifi_monitor.c | 9 ++- source/webconfig/wifi_decoder.c | 23 ++++++- source/webconfig/wifi_encoder.c | 9 +++ 9 files changed, 187 insertions(+), 27 deletions(-) diff --git a/config/TR181-WiFi-USGv2.XML b/config/TR181-WiFi-USGv2.XML index 7f0d6f11a..a80dd3d77 100644 --- a/config/TR181-WiFi-USGv2.XML +++ b/config/TR181-WiFi-USGv2.XML @@ -503,11 +503,12 @@ APMLD - staticTable + dynamicTable 128 APMLD_GetEntryCount APMLD_GetEntry + APMLD_IsUpdated APMLD_GetParamUlongValue APMLD_GetParamStringValue APMLD_SetParamUlongValue @@ -610,23 +611,20 @@ STAMLD - staticTable + dynamicTable 128 STAMLD_GetEntryCount STAMLD_GetEntry + STAMLD_IsUpdated + STAMLD_Synchronize STAMLD_GetParamStringValue - STAMLD_SetParamStringValue - MLDMACAddress string string - true diff --git a/include/tr_181/ml/cosa_wifi_dml.h b/include/tr_181/ml/cosa_wifi_dml.h index 49a577131..d27e66b61 100644 --- a/include/tr_181/ml/cosa_wifi_dml.h +++ b/include/tr_181/ml/cosa_wifi_dml.h @@ -2040,6 +2040,24 @@ AssociatedDevice1_IsUpdated ANSC_HANDLE hInsContext ); +BOOL +APMLD_IsUpdated + ( + ANSC_HANDLE hInsContext + ); + +BOOL +STAMLD_IsUpdated + ( + ANSC_HANDLE hInsContext + ); + +ULONG +STAMLD_Synchronize + ( + ANSC_HANDLE hInsContext + ); + ULONG AssociatedDevice1_Synchronize ( diff --git a/source/core/wifi_ctrl_queue_handlers.c b/source/core/wifi_ctrl_queue_handlers.c index 98dca158c..9660c6751 100644 --- a/source/core/wifi_ctrl_queue_handlers.c +++ b/source/core/wifi_ctrl_queue_handlers.c @@ -1783,7 +1783,7 @@ void process_disassoc_device_event(void *data) if (rdk_vap_info == NULL) { return; } - + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "process_disassoc_device_event \n"); fflush(out);fclose(out);} memset(mac_str, 0, sizeof(mac_str)); to_mac_str(assoc_data->dev_stats.cli_MACAddress, mac_str); @@ -1884,7 +1884,7 @@ void process_assoc_device_event(void *data) wifi_util_error_print(WIFI_CTRL,"%s:%d NULL rdk_vap_info pointer\n", __func__, __LINE__); return; } - + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "process_assoc_device_event \n"); fflush(out);fclose(out);} pthread_mutex_lock(rdk_vap_info->associated_devices_lock); if (rdk_vap_info->associated_devices_map == NULL) { pthread_mutex_unlock(rdk_vap_info->associated_devices_lock); diff --git a/source/dml/dml_webconfig/dml_onewifi_api.c b/source/dml/dml_webconfig/dml_onewifi_api.c index 3b3137bff..51089d955 100644 --- a/source/dml/dml_webconfig/dml_onewifi_api.c +++ b/source/dml/dml_webconfig/dml_onewifi_api.c @@ -561,7 +561,7 @@ webconfig_error_t webconfig_dml_apply(webconfig_dml_t *consumer, webconfig_subdo return webconfig_error_none; } -void get_associated_devices_data(unsigned int radio_index) +void get_associated_devices_data(unsigned int radio_index) //Stano why we have here radio index which is not used??? { int itr=0, itrj=0; webconfig_subdoc_data_t data; @@ -612,6 +612,75 @@ void get_associated_devices_data(unsigned int radio_index) webconfig_data_free(&data); } +//Stano: Todo: we will not need this function - will arrive from APMLD via get entry +void create_mld_map_for_mld_unit(wifi_vap_info_t *mlo_vaps[4], UINT mld_id) +{ + wifi_vap_info_map_t *mgr_vap_info_map = NULL; + unsigned int idx = 0; + + for (unsigned int r_idx = 0; r_idx < getNumberRadios(); r_idx++) { + + mgr_vap_info_map = get_wifidb_vap_map(r_idx); + if (mgr_vap_info_map == NULL) { + wifi_util_error_print(WIFI_DMCLI, "%s:%d get_wifidb_vap_map failed for radio: %d\n", __FUNCTION__, __LINE__, r_idx); + return; + } + + for (unsigned int k = 0; k < mgr_vap_info_map->num_vaps; k++) { + wifi_vap_info_t *vap_config = &mgr_vap_info_map->vap_array[k]; + wifi_mld_common_info_t *mld_info = &vap_config->u.bss_info.mld_info.common_info; + if (mld_info->mld_enable && mld_info->mld_id == mld_id) { + if (idx < 4) + mlo_vaps[idx++] = vap_config; + } + } + } +} + +int get_mld_associated_devices_count_vap(wifi_vap_info_t *vap_info) +{ + int count = 0; + assoc_dev_data_t *assoc_dev_data_temp = NULL; + + pthread_mutex_lock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); + + hash_map_t *assoc_vap_info_map = (hash_map_t *)get_associated_devices_hash_map(vap_info->vap_index); + if (assoc_vap_info_map == NULL) { + wifi_util_error_print(WIFI_DMCLI,"%s:%d NULL pointer\n", __func__, __LINE__); + pthread_mutex_unlock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); + return -1; + } + + assoc_dev_data_temp = hash_map_get_first(assoc_vap_info_map); + while (assoc_dev_data_temp != NULL) { + if (assoc_dev_data_temp->dev_stats.cli_MLDEnable) + count++; + assoc_dev_data_temp = hash_map_get_next(assoc_vap_info_map, assoc_dev_data_temp); + } + pthread_mutex_unlock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); + wifi_util_dbg_print(WIFI_DMCLI,"%s %d vap_index %d mlo associated devices count %d\n", + __func__, __LINE__, vap_info->vap_index, count); + return count; +} + +unsigned long get_mld_associated_devices_count(UINT mlo_id) +{ + int i, tmp_count; + unsigned long count = 0; + wifi_vap_info_t *mlo_vaps[4] = {0}; + create_mld_map_for_mld_unit(mlo_vaps, mlo_id); //Stano: Todo: this will be input parameter of the func + + for (i = 0; i < MAX_NUM_RADIOS; i++) { + wifi_vap_info_t *vap = mlo_vaps[i]; + if (vap == NULL) + continue;; + tmp_count = get_mld_associated_devices_count_vap(vap); + if (tmp_count > 0) + count += tmp_count; + } + return count; +} + unsigned long get_associated_devices_count(wifi_vap_info_t *vap_info) { unsigned long count = 0; diff --git a/source/dml/dml_webconfig/dml_onewifi_api.h b/source/dml/dml_webconfig/dml_onewifi_api.h index c4e0a7a9c..d9530923d 100644 --- a/source/dml/dml_webconfig/dml_onewifi_api.h +++ b/source/dml/dml_webconfig/dml_onewifi_api.h @@ -123,6 +123,7 @@ void** get_acl_vap_context(); UINT get_num_radio_dml(); UINT get_total_num_affiliated_ap_dml(); UINT get_total_num_apmld_dml(); +unsigned long get_mld_associated_devices_count(UINT mlo_id); UINT get_total_num_vap_dml(); void get_associated_devices_data(unsigned int radio_index); unsigned long get_associated_devices_count(wifi_vap_info_t *vap_info); diff --git a/source/dml/tr_181/ml/cosa_wifi_dml.c b/source/dml/tr_181/ml/cosa_wifi_dml.c index af4e59f42..f7c7913dd 100755 --- a/source/dml/tr_181/ml/cosa_wifi_dml.c +++ b/source/dml/tr_181/ml/cosa_wifi_dml.c @@ -489,15 +489,6 @@ APMLD_GetParamUlongValue ULONG* puLong ) { - if (AnscEqualString(ParamName, "AffiliatedAPNumberOfEntries", TRUE)) - { - return TRUE; - } - if (AnscEqualString(ParamName, "STAMLDNumberOfEntries", TRUE)) - { - wifi_util_dbg_print(WIFI_DMCLI,"%s:%d STAMLDNumberOfEntries\n", __FUNCTION__,__LINE__); - return TRUE; - } return FALSE; } @@ -953,10 +944,12 @@ STAMLD_GetEntryCount ANSC_HANDLE hInsContext ) { - UNREFERENCED_PARAMETER(hInsContext); + UNREFERENCED_PARAMETER(hInsContext); //Todo: Stano: hInsContext should be array of vaps in mld unit - Oleh: in progress - wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: total number of apmld:%d get_total_num_apmld_dml():::%d\n",__func__, __LINE__, get_num_radio_dml() * MAX_NUM_VAP_PER_RADIO, get_total_num_vap_dml()); - return 3; + UINT mld_id = 0; + unsigned long count = 0; + count = get_mld_associated_devices_count(mld_id); + return count; } /********************************************************************** @@ -998,7 +991,7 @@ STAMLD_GetEntry ) { UNREFERENCED_PARAMETER(hInsContext); - + //Todo: Stano: do it similary as AssociatedDevice1_GetEntry? if ( nIndex >= 0 && nIndex <= 3 ) { *pInsNumber = nIndex + 1; @@ -1018,6 +1011,7 @@ STAMLD_GetParamStringValue { if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) { + //todo: Stano return TRUE; } @@ -17196,6 +17190,39 @@ AssociatedDevice1_IsUpdated return TRUE; } +BOOL +APMLD_IsUpdated + ( + ANSC_HANDLE hInsContext + ) +{ + return TRUE; +} + +BOOL +STAMLD_IsUpdated + ( + ANSC_HANDLE hInsContext + ) +{ + return TRUE; +} + + + + +ULONG +STAMLD_Synchronize + ( + ANSC_HANDLE hInsContext + ) +{ + //here will be array of vap_info pointers which are part of MLO + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "XX sync\n"); fflush(out);fclose(out);} + get_associated_devices_data(0); + return ANSC_STATUS_SUCCESS; +} + /********************************************************************** caller: owner of this object @@ -17670,7 +17697,7 @@ AssociatedDevice1_GetParamStringValue char* pValue, ULONG* pUlSize ) -{ +{//why this code is not part of get entry, it is the same in all functions errno_t rc = -1; assoc_dev_data_t *assoc_dev_data_temp = NULL, *assoc_dev_data = NULL; unsigned long vap_index_mask = (unsigned long) hInsContext; @@ -17708,10 +17735,20 @@ AssociatedDevice1_GetParamStringValue memcpy(assoc_dev_data, assoc_dev_data_temp, sizeof(assoc_dev_data_t)); pthread_mutex_unlock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); - + //Todo: check for inspiration if( AnscEqualString(ParamName, "MACAddress", TRUE)) { char p_mac[18]; + mac_addr_str_t mac_str = {0}; + mac_addr_str_t mlo_mac_str = {0}; + + to_mac_str(assoc_dev_data->dev_stats.cli_MACAddress, mac_str); + to_mac_str(assoc_dev_data->dev_stats.cli_MLDAddr, mlo_mac_str); + + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "assoc dev: mac: %s mlo_mac:%s MLDEnable %d \n", + mac_str, mlo_mac_str,assoc_dev_data->dev_stats.cli_MLDEnable); fflush(out);fclose(out);} + + snprintf(p_mac, 18, "%02x:%02x:%02x:%02x:%02x:%02x", assoc_dev_data->dev_stats.cli_MACAddress[0], assoc_dev_data->dev_stats.cli_MACAddress[1], assoc_dev_data->dev_stats.cli_MACAddress[2], assoc_dev_data->dev_stats.cli_MACAddress[3], assoc_dev_data->dev_stats.cli_MACAddress[4], assoc_dev_data->dev_stats.cli_MACAddress[5]); if ( AnscSizeOfString(p_mac) < *pUlSize) diff --git a/source/stats/wifi_monitor.c b/source/stats/wifi_monitor.c index 8d4236191..6a9ea39dc 100644 --- a/source/stats/wifi_monitor.c +++ b/source/stats/wifi_monitor.c @@ -1031,9 +1031,14 @@ int get_sta_stats_info (assoc_dev_data_t *assoc_dev_data) { pthread_mutex_unlock(&g_monitor_module.data_lock); return -1; } + mac_addr_str_t mld_mac_str = { 0 }; + + to_mac_str(sta_data->dev_stats.cli_MLDAddr, mld_mac_str); assoc_dev_data->dev_stats.cli_AuthenticationState = sta_data->dev_stats.cli_AuthenticationState; assoc_dev_data->dev_stats.cli_LastDataDownlinkRate = sta_data->dev_stats.cli_LastDataDownlinkRate; + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "2x cli_LastDataDownlinkRate %u mld_mac %s\n", + assoc_dev_data->dev_stats.cli_LastDataDownlinkRate, mld_mac_str); fflush(out);fclose(out);} assoc_dev_data->dev_stats.cli_LastDataUplinkRate = sta_data->dev_stats.cli_LastDataUplinkRate; assoc_dev_data->dev_stats.cli_SignalStrength = sta_data->dev_stats.cli_SignalStrength; assoc_dev_data->dev_stats.cli_Retransmissions = sta_data->dev_stats.cli_Retransmissions; @@ -3275,7 +3280,7 @@ int device_associated(int ap_index, wifi_associated_dev_t *associated_dev) assoc_data.dev_stats.cli_RSSI = associated_dev->cli_RSSI; assoc_data.dev_stats.cli_AuthenticationState = associated_dev->cli_AuthenticationState; assoc_data.dev_stats.cli_LastDataDownlinkRate = associated_dev->cli_LastDataDownlinkRate; - + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "1x cli_LastDataDownlinkRate %u \n", assoc_data.dev_stats.cli_LastDataDownlinkRate); fflush(out);fclose(out);} assoc_data.dev_stats.cli_LastDataUplinkRate = associated_dev->cli_LastDataUplinkRate; assoc_data.dev_stats.cli_SignalStrength = associated_dev->cli_SignalStrength; assoc_data.dev_stats.cli_Retransmissions = associated_dev->cli_Retransmissions; @@ -3295,6 +3300,8 @@ int device_associated(int ap_index, wifi_associated_dev_t *associated_dev) assoc_data.dev_stats.cli_MaxRSSI = associated_dev->cli_MaxRSSI; assoc_data.dev_stats.cli_Disassociations = associated_dev->cli_Disassociations; assoc_data.dev_stats.cli_AuthenticationFailures = associated_dev->cli_AuthenticationFailures; + assoc_data.dev_stats.cli_MLDAddr[1]=0x55; + assoc_data.dev_stats.cli_MLDEnable = 1; snprintf(assoc_data.dev_stats.cli_OperatingStandard, sizeof(assoc_data.dev_stats.cli_OperatingStandard),"%s", associated_dev->cli_OperatingStandard); snprintf(assoc_data.dev_stats.cli_OperatingChannelBandwidth, sizeof(assoc_data.dev_stats.cli_OperatingChannelBandwidth),"%s", associated_dev->cli_OperatingChannelBandwidth); snprintf(assoc_data.dev_stats.cli_InterferenceSources, sizeof(assoc_data.dev_stats.cli_InterferenceSources),"%s", associated_dev->cli_InterferenceSources); diff --git a/source/webconfig/wifi_decoder.c b/source/webconfig/wifi_decoder.c index afc7da2f2..a4f65f835 100644 --- a/source/webconfig/wifi_decoder.c +++ b/source/webconfig/wifi_decoder.c @@ -3367,6 +3367,7 @@ webconfig_error_t decode_associated_clients_object(webconfig_subdoc_data_t *data { mac_address_t mac; + mac_address_t mlo_mac; cJSON *obj_vap; cJSON *obj_array, *assoc_client, *value_object; char *tmp_string; @@ -3478,6 +3479,26 @@ webconfig_error_t decode_associated_clients_object(webconfig_subdoc_data_t *data str_to_mac_bytes(tmp_string, mac); memcpy(assoc_dev_data.dev_stats.cli_MACAddress, mac, 6); + value_object = cJSON_GetObjectItem(assoc_client, "MLDAddr"); + if ((value_object == NULL) || (cJSON_IsString(value_object) == false)){ + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: Validation Failed\n", __func__, __LINE__); + return webconfig_error_decode; + } + tmp_string = cJSON_GetStringValue(value_object); + if (tmp_string == NULL) { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: NULL pointer \n", __func__, __LINE__); + return webconfig_error_decode; + } + str_to_mac_bytes(tmp_string, mlo_mac); + memcpy(assoc_dev_data.dev_stats.cli_MLDAddr, mlo_mac, 6); + //[0] = 0x22; + value_object = cJSON_GetObjectItem(assoc_client, "MLDEnable"); + if ((value_object == NULL) || (cJSON_IsBool(value_object) == false)) { + wifi_util_error_print(WIFI_WEBCONFIG, "%s:%d: Validation Failed\n", __func__, __LINE__); + return webconfig_error_decode; + } + assoc_dev_data.dev_stats.cli_MLDEnable = (value_object->type & cJSON_True) ? true:false; + if (assoclist_type == assoclist_type_remove) { assoc_dev_data.client_state = client_state_disconnected; } else { @@ -5421,7 +5442,7 @@ webconfig_error_t decode_assocdev_stats_object(wifi_provider_response_t **assoc_ decode_param_string(assoc_data, "cli_MACAddress", param); string_mac_to_uint8_mac(client_stats_data[count].cli_MACAddress, param->valuestring); - + client_stats_data[count].cli_MLDAddr[0] = 0x11; decode_param_bool(assoc_data, "cli_AuthenticationState", param); client_stats_data[count].cli_AuthenticationState = (param->type & cJSON_True) ? true : false; diff --git a/source/webconfig/wifi_encoder.c b/source/webconfig/wifi_encoder.c index 35a6868d2..9a59805d4 100644 --- a/source/webconfig/wifi_encoder.c +++ b/source/webconfig/wifi_encoder.c @@ -1742,6 +1742,7 @@ webconfig_error_t encode_associated_client_object(rdk_wifi_vap_info_t *rdk_vap_i if (associated_devices_lock != NULL) { pthread_mutex_lock(associated_devices_lock); } + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "assoclist_type %d \n",assoclist_type ); fflush(out);fclose(out);} switch (assoclist_type) { case assoclist_type_full: devices_map = rdk_vap_info->associated_devices_map; @@ -1778,10 +1779,18 @@ webconfig_error_t encode_associated_client_object(rdk_wifi_vap_info_t *rdk_vap_i cJSON_AddItemToArray(obj_array, obj_assoc_client); char mac_string[18] = {0}; + mac_addr_str_t mld_mac_str = { 0 }; to_mac_str(assoc_dev_data->dev_stats.cli_MACAddress, mac_string); + to_mac_str(assoc_dev_data->dev_stats.cli_MLDAddr, mld_mac_str); str_tolower(mac_string); + str_tolower(mld_mac_str); + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "encode %s %d \n", + mld_mac_str, assoc_dev_data->dev_stats.cli_MLDEnable); fflush(out);fclose(out);} + cJSON_AddStringToObject(obj_assoc_client, "MACAddress", mac_string); + cJSON_AddStringToObject(obj_assoc_client, "MLDAddr", mld_mac_str); + cJSON_AddBoolToObject(obj_assoc_client, "MLDEnable", assoc_dev_data->dev_stats.cli_MLDEnable); cJSON_AddStringToObject(obj_assoc_client, "WpaKeyMgmt", assoc_dev_data->conn_security.wpa_key_mgmt); cJSON_AddStringToObject(obj_assoc_client, "PairwiseCipher", assoc_dev_data->conn_security.pairwise_cipher); cJSON_AddBoolToObject(obj_assoc_client, "AuthenticationState", assoc_dev_data->dev_stats.cli_AuthenticationState); From 6a989d4dcc002385d5bc78a8177ddc9fc48bfb20 Mon Sep 17 00:00:00 2001 From: Stanislav Kuchar Date: Wed, 3 Dec 2025 15:43:04 +0100 Subject: [PATCH 3/3] wfa DataElements 2 --- config/TR181-WiFi-USGv2.XML | 8 +- include/tr_181/ml/cosa_wifi_dml.h | 9 -- source/dml/dml_webconfig/dml_onewifi_api.c | 71 ++++++++-- source/dml/dml_webconfig/dml_onewifi_api.h | 1 + source/dml/tr_181/ml/cosa_wifi_dml.c | 154 +++++++++++++-------- source/stats/wifi_monitor.c | 8 ++ 6 files changed, 177 insertions(+), 74 deletions(-) diff --git a/config/TR181-WiFi-USGv2.XML b/config/TR181-WiFi-USGv2.XML index a80dd3d77..6d5d6fcca 100644 --- a/config/TR181-WiFi-USGv2.XML +++ b/config/TR181-WiFi-USGv2.XML @@ -371,8 +371,12 @@ Device - object - + dynamicTable + 128 + + Device_GetEntryCount + Device_GetEntry + diff --git a/include/tr_181/ml/cosa_wifi_dml.h b/include/tr_181/ml/cosa_wifi_dml.h index d27e66b61..18a98ba78 100644 --- a/include/tr_181/ml/cosa_wifi_dml.h +++ b/include/tr_181/ml/cosa_wifi_dml.h @@ -421,7 +421,6 @@ AffiliatedAP_SetParamStringValue Device.WiFi.DataElements.Network.Device.{i}.APMLD.{i}.STAMLD.{i}. * STAMLD_GetParamStringValue - * STAMLD_SetParamStringValue ***********************************************************************/ ULONG @@ -447,14 +446,6 @@ STAMLD_GetParamStringValue ULONG* pUlSize ); -BOOL -STAMLD_SetParamStringValue - ( - ANSC_HANDLE hInsContext, - char* ParamName, - char* pString - ); - /*********************************************************************** APIs for Object: diff --git a/source/dml/dml_webconfig/dml_onewifi_api.c b/source/dml/dml_webconfig/dml_onewifi_api.c index 51089d955..5bf6ee407 100644 --- a/source/dml/dml_webconfig/dml_onewifi_api.c +++ b/source/dml/dml_webconfig/dml_onewifi_api.c @@ -585,6 +585,7 @@ void get_associated_devices_data(unsigned int radio_index) //Stano why we have h free(str); return; } + //{FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "assoc data **** %s\n", str); fflush(out);fclose(out);} pthread_mutex_lock(&webconfig_dml.assoc_dev_lock); for (itr=0; itr < (int)get_num_radio_dml(); itr++) { for (itrj=0; itrjvap_index, count); return count; -} +}*/ unsigned long get_mld_associated_devices_count(UINT mlo_id) { - int i, tmp_count; + int i; unsigned long count = 0; wifi_vap_info_t *mlo_vaps[4] = {0}; + assoc_dev_data_t *assoc_dev_data_temp = NULL; create_mld_map_for_mld_unit(mlo_vaps, mlo_id); //Stano: Todo: this will be input parameter of the func + pthread_mutex_lock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); for (i = 0; i < MAX_NUM_RADIOS; i++) { - wifi_vap_info_t *vap = mlo_vaps[i]; - if (vap == NULL) + wifi_vap_info_t *vap_info = mlo_vaps[i]; + if (vap_info == NULL) continue;; - tmp_count = get_mld_associated_devices_count_vap(vap); - if (tmp_count > 0) - count += tmp_count; + hash_map_t *assoc_vap_info_map = (hash_map_t *)get_associated_devices_hash_map(vap_info->vap_index); + if (assoc_vap_info_map == NULL) { + wifi_util_error_print(WIFI_DMCLI,"%s:%d assoc_vap_info_map NULL pointer for vap_index %d\n", + __func__, __LINE__, vap_info->vap_index); + continue; + } + + assoc_dev_data_temp = hash_map_get_first(assoc_vap_info_map); + while (assoc_dev_data_temp != NULL) { + if (assoc_dev_data_temp->dev_stats.cli_MLDEnable) + count++; + assoc_dev_data_temp = hash_map_get_next(assoc_vap_info_map, assoc_dev_data_temp); + } } + pthread_mutex_unlock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); return count; } +assoc_dev_data_t *get_mld_associated_device(UINT mlo_id, unsigned int dev_index) +{ + int i; + unsigned long idx = 0; /*indexed from value 1 - idx=0 is invalid value*/ + wifi_vap_info_t *mlo_vaps[4] = {0}; + assoc_dev_data_t *assoc_dev_data_temp = NULL, *assoc_dev_data = NULL; + create_mld_map_for_mld_unit(mlo_vaps, mlo_id); //Stano: Todo: this will be input parameter of the func + + pthread_mutex_lock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); + for (i = 0; i < MAX_NUM_RADIOS; i++) { + wifi_vap_info_t *vap_info = mlo_vaps[i]; + if (vap_info == NULL) + continue; + hash_map_t *assoc_vap_info_map = (hash_map_t *)get_associated_devices_hash_map(vap_info->vap_index); + if (assoc_vap_info_map == NULL) { + wifi_util_error_print(WIFI_DMCLI,"%s:%d assoc_vap_info_map NULL pointer for vap_index %d\n", + __func__, __LINE__, vap_info->vap_index); + continue; + } + + assoc_dev_data_temp = hash_map_get_first(assoc_vap_info_map); + while (assoc_dev_data_temp != NULL) { + if (assoc_dev_data_temp->dev_stats.cli_MLDEnable) + idx++; + if (idx == dev_index) + break; + assoc_dev_data_temp = hash_map_get_next(assoc_vap_info_map, assoc_dev_data_temp); + } + assoc_dev_data = (assoc_dev_data_t*) malloc(sizeof(assoc_dev_data_t)); + if (NULL == assoc_dev_data) { + wifi_util_error_print(WIFI_DMCLI,"%s:%d assoc_dev_data - allocation failed!\n", __func__, __LINE__); + pthread_mutex_unlock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); + return NULL; + } + memcpy(assoc_dev_data, assoc_dev_data_temp, sizeof(assoc_dev_data_t)); + } + pthread_mutex_unlock(&((webconfig_dml_t*) get_webconfig_dml())->assoc_dev_lock); + return assoc_dev_data; +} + + unsigned long get_associated_devices_count(wifi_vap_info_t *vap_info) { unsigned long count = 0; diff --git a/source/dml/dml_webconfig/dml_onewifi_api.h b/source/dml/dml_webconfig/dml_onewifi_api.h index d9530923d..7e1d4ba97 100644 --- a/source/dml/dml_webconfig/dml_onewifi_api.h +++ b/source/dml/dml_webconfig/dml_onewifi_api.h @@ -124,6 +124,7 @@ UINT get_num_radio_dml(); UINT get_total_num_affiliated_ap_dml(); UINT get_total_num_apmld_dml(); unsigned long get_mld_associated_devices_count(UINT mlo_id); +assoc_dev_data_t *get_mld_associated_device(UINT mlo_id, unsigned int dev_index); UINT get_total_num_vap_dml(); void get_associated_devices_data(unsigned int radio_index); unsigned long get_associated_devices_count(wifi_vap_info_t *vap_info); diff --git a/source/dml/tr_181/ml/cosa_wifi_dml.c b/source/dml/tr_181/ml/cosa_wifi_dml.c index f7c7913dd..67f38914a 100755 --- a/source/dml/tr_181/ml/cosa_wifi_dml.c +++ b/source/dml/tr_181/ml/cosa_wifi_dml.c @@ -707,36 +707,6 @@ AffiliatedAP_GetEntryCount return get_total_num_affiliated_ap_dml(); } -/********************************************************************** - - caller: owner of this object - - prototype: - - ANSC_HANDLE - APMLD_GetEntry - ( - ANSC_HANDLE hInsContext, - ULONG nIndex, - ULONG* pInsNumber - ); - - description: - - This function is called to retrieve the entry specified by the index. - - argument: ANSC_HANDLE hInsContext, - The instance handle; - - ULONG nIndex, - The index of this entry; - - ULONG* pInsNumber - The output instance number; - - return: The handle to identify the entry - -**********************************************************************/ static int get_vap_in_mld(unsigned int mld_id, unsigned int vap_id) { switch (vap_id) @@ -913,7 +883,6 @@ AffiliatedAP_SetParamStringValue * STAMLD_GetEntryCount * STAMLD_GetEntry * STAMLD_GetParamStringValue - * STAMLD_SetParamStringValue ***********************************************************************/ /********************************************************************** @@ -952,6 +921,26 @@ STAMLD_GetEntryCount return count; } +ULONG +Device_GetEntryCount + ( + ANSC_HANDLE hInsContext + ) +{ + UNREFERENCED_PARAMETER(hInsContext); //Todo: Stano: hInsContext should be array of vaps in mld unit - Oleh: in progress + + return 1; +} + +ANSC_HANDLE +Device_GetEntry(ANSC_HANDLE hInsContext, ULONG nIndex, ULONG *pInsNumber) +{ + UNREFERENCED_PARAMETER(hInsContext); + wifi_util_dbg_print(WIFI_DMCLI, "%s:%d: nIndex:%ld\n", __func__, __LINE__, nIndex); + + *pInsNumber = nIndex + 1; + return (ANSC_HANDLE) (*pInsNumber); +} /********************************************************************** caller: owner of this object @@ -991,15 +980,71 @@ STAMLD_GetEntry ) { UNREFERENCED_PARAMETER(hInsContext); - //Todo: Stano: do it similary as AssociatedDevice1_GetEntry? - if ( nIndex >= 0 && nIndex <= 3 ) + //Todo: Stano: implement hInsContext properly after finalizing previous things STAMLD + UINT mld_id = 0; + unsigned long count = 0; + unsigned long dev_index_mask = 0; + + count = get_mld_associated_devices_count(mld_id); + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: total number of STAMLD:%d nIndex:%d\n",__func__, __LINE__, count, nIndex); + if ( nIndex >= count ) { - *pInsNumber = nIndex + 1; + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d Index out of range\n", __func__, __LINE__); + return (ANSC_HANDLE) NULL; } + *pInsNumber = nIndex + 1; + dev_index_mask = (*pInsNumber << 8) + mld_id; + return (ANSC_HANDLE) dev_index_mask; /* return the handle */ + /* + assoc_dev_data_t *assoc_dev_data_temp = NULL, *assoc_dev_data = NULL; + unsigned long vap_index_mask = (unsigned long) hInsContext; + unsigned int dev_index = (vap_index_mask >> 8); + unsigned int vap_index = (0xff & vap_index_mask); + */ + + //return (ANSC_HANDLE)(nIndex + 1); /* return the handle */ - return (ANSC_HANDLE)(nIndex + 1); /* return the handle */ } + +/********************************************************************** + + caller: owner of this object + + prototype: + + ULONG + STAMLD_GetParamStringValue + ( + ANSC_HANDLE hInsContext, + char* ParamName, + char* pValue, + ULONG* pUlSize + ); + + description: + + This function is called to retrieve string parameter value; + + argument: ANSC_HANDLE hInsContext, + The instance handle; + + char* ParamName, + The parameter name; + + char* pValue, + The string value buffer; + + ULONG* pUlSize + The buffer of length of string value; + Usually size of 1023 will be used. + If it's not big enough, put required size here and return 1; + + return: 0 if succeeded; + 1 if short of buffer size; (*pUlSize = required size) + -1 if not supported. + +**********************************************************************/ ULONG STAMLD_GetParamStringValue ( @@ -1009,29 +1054,28 @@ STAMLD_GetParamStringValue ULONG* pUlSize ) { + unsigned long dev_index_mask = (unsigned long) hInsContext; + unsigned int dev_index = (dev_index_mask >> 8); + unsigned int mld_unit = (0xff & dev_index_mask); + assoc_dev_data_t *assoc_dev_data = NULL; + wifi_util_dbg_print(WIFI_DMCLI,"%s:%d: hInsContext:%d dev_index:%d\n",__func__, __LINE__, hInsContext, dev_index); + assoc_dev_data = get_mld_associated_device(mld_unit, dev_index); if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) { - //todo: Stano - return TRUE; - } - - return FALSE; -} - -BOOL -STAMLD_SetParamStringValue - ( - ANSC_HANDLE hInsContext, - char* ParamName, - char* pString - ) -{ - if (AnscEqualString(ParamName, "MLDMACAddress", TRUE)) - { - return TRUE; + mac_addr_str_t mac_str = {0}; + to_mac_str(assoc_dev_data->dev_stats.cli_MLDAddr, mac_str); + if ( AnscSizeOfString(mac_str) < *pUlSize) + { + AnscCopyString(pValue, mac_str); + free(assoc_dev_data); + return 0; + } + *pUlSize = AnscSizeOfString(mac_str)+1; + free(assoc_dev_data); + return 1; } - - return FALSE; + free(assoc_dev_data); + return -1; } /*********************************************************************** diff --git a/source/stats/wifi_monitor.c b/source/stats/wifi_monitor.c index 6a9ea39dc..e996a28c1 100644 --- a/source/stats/wifi_monitor.c +++ b/source/stats/wifi_monitor.c @@ -1014,6 +1014,7 @@ int get_sta_stats_info (assoc_dev_data_t *assoc_dev_data) { } hash_map_t *sta_map = NULL; + hash_map_t *sta_map1 = NULL; sta_data_t *sta_data = NULL; sta_key_t sta_key; @@ -1025,6 +1026,13 @@ int get_sta_stats_info (assoc_dev_data_t *assoc_dev_data) { str_tolower(sta_key); + for (int i = 0; i< 22; i++){ + sta_map1 = g_monitor_module.bssid_data[i].sta_map; + int c = hash_map_count(sta_map1); + sta_data = (sta_data_t *)hash_map_get(sta_map1, sta_key); + {FILE *out = fopen("/tmp/log12.txt", "a"); fprintf(out, "%d sta map count %d found %p\n", i,c, sta_data); fflush(out);fclose(out);} + } + sta_data = (sta_data_t *)hash_map_get(sta_map, sta_key); if (sta_data == NULL) { wifi_util_error_print(WIFI_MON, "%s:%d: NULL pointer\n", __func__, __LINE__);