46 #include "rdk_moca_hal.h"
48 #define MOCA_INTERFACE_NUMBER_OF_ENTRIES 1
49 #define MAX_WAIT_FOR_RMH_SECONDS 10
50 #define HIGHEST_MOCA_VERSION 0X20
53 std::mutex MoCADevice::m_mutex;
64 void* MoCADevice::getRmhContext()
66 std::lock_guard<std::mutex> lock(m_mutex);
69 uint32_t waitedSeconds = 0;
70 bool alwayRecreate =
true;
72 if (alwayRecreate && rmhContext) {
79 RMH_Result ret = RMH_ValidateHandle(rmhContext);
80 if (ret == RMH_UNIMPLEMENTED || ret == RMH_NOT_SUPPORTED) {
81 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"RMH_ValidateHandle returned %s. We will not be able to monitor to make sure the handle remains valid\n",
RMH_ResultToString(ret));
83 else if (ret != RMH_SUCCESS) {
84 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"The RMH handle %p seems to no longer be valid. Closing\n", rmhContext);
91 while (rmhContext == NULL) {
93 if(NULL != rmhContext) {
94 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"Created RMH handle %p\n", rmhContext);
98 if (waitedSeconds >= MAX_WAIT_FOR_RMH_SECONDS) {
99 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"(%s) Maximum wait for MoCA reached. Skipping RMH Initialization.!\n", __FUNCTION__);
104 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"(%s)Failed in RMH_Initialize. Assuming MoCA isn't ready. Waiting...\n", __FUNCTION__);
112 void* MoCADevice::closeRmhContext() {
121 void MoCADevice::closeInstance()
126 int MoCAInterface::get_Associated_Device_NumberOfEntries(
int &numDevices)
136 if (ret != RMH_SUCCESS) {
137 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetAssociatedIds failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
141 for (
int nodeId = 0; nodeId < RMH_MAX_MOCA_NODES; nodeId++) {
142 if (
true ==response.nodePresent[nodeId]) {
149 numDevices = nodeCount;
150 m_ui32AssociatedDeviceNumberOfEntries = nodeCount;
157 int MoCAInterface::get_MoCA_Mesh_NumberOfEntries(
int &numOfEntries)
167 if (ret != RMH_SUCCESS) {
168 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeIds failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
172 for (
int nodeId = 0; nodeId < RMH_MAX_MOCA_NODES; nodeId++) {
173 if (
true ==response.nodePresent[nodeId]) {
181 m_ui32X_RDKCENTRAL_COM_MeshTableNumberOfEntries = (int)((
int)pow(nodeCount, 2) - (nodeCount));
182 numOfEntries = m_ui32X_RDKCENTRAL_COM_MeshTableNumberOfEntries;
186 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%s] MoCA Mesh number of entries : [%u]\n", __FILE__, __FUNCTION__, numOfEntries);
187 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exit \n", __FILE__, __FUNCTION__);
191 GHashTable* MoCAInterface::m_notifyHash = NULL;
192 GMutex* MoCAInterface::m_mutex = NULL;
195 MoCAInterface::MoCAInterface(
int dev_id):
197 m_i32CurNumOfDevices(0),
202 m_ui32MaxIngressBW(0),
203 m_ui32MaxEgressBW(0),
205 m_ui32NetworkCoordinator(0),
208 m_bPreferredNC(false),
210 m_bPrivacyEnabledSetting(false),
211 m_bPrivacyEnabled(false),
212 m_ui32CurrentOperFreq(0),
213 m_ui32LastOperFreq(0),
214 m_ui32TxPowerLimit(0),
215 m_ui32PowerCntlPhyTarget(0),
216 m_ui32BeaconPowerLimit(0),
217 m_ui32TxBcastRate(0),
218 m_ui32TxBcastPowerReduction(0),
219 m_bQAM256Capable(false),
220 m_ui32PacketAggregationCapability(0),
221 m_ui32AssociatedDeviceNumberOfEntries(0),
222 m_ui32X_RDKCENTRAL_COM_MeshTableNumberOfEntries(0)
224 memset(m_i8Alias, 0,N_LENGTH);
225 memset(m_i8Name, 0, N_LENGTH);
226 memset(m_i8LowerLayers, 0,LL_LENGTH);
227 memset(m_i8FreqCapabilityMask, 0, FREQ_LENGTH);
228 memset(m_i8NetworkTabooMask, 0, FREQ_LENGTH);
229 memset(m_i8NodeTabooMask, 0, FREQ_LENGTH);
234 if(NULL == Instance) {
240 void MoCAInterface::closeInstance()
247 void MoCAInterface::getLock()
251 m_mutex = g_mutex_new();
253 g_mutex_lock(m_mutex);
256 void MoCAInterface::releaseLock()
258 g_mutex_unlock(m_mutex);
261 GHashTable* MoCAInterface::getNotifyHash()
269 return m_notifyHash = g_hash_table_new(g_str_hash, g_str_equal);
280 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
283 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%s] MOCA_INTERFACE_NUMBER_OF_ENTRIES :%d\n", __FUNCTION__, __FILE__, MOCA_INTERFACE_NUMBER_OF_ENTRIES);
284 stMsgData->
paramLen=
sizeof(
unsigned int);
291 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
293 stMsgData->
paramtype = hostIf_BooleanType;
300 if (ret == RMH_SUCCESS) {
303 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetLinkStatus success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), enable );
306 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
312 stMsgData->
paramtype = hostIf_StringType;
315 RMH_LinkStatus status;
317 if (ret == RMH_SUCCESS) {
320 case RMH_LINK_STATUS_DISABLED:
321 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s",
"Disable");
323 case RMH_LINK_STATUS_NO_LINK:
324 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s",
"LowerLayerDown");
326 case RMH_LINK_STATUS_INTERFACE_DOWN:
327 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s",
"Down");
329 case RMH_LINK_STATUS_UP:
330 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s",
"Up");
333 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s",
"Dormant");
341 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetLinkStatus failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
350 snprintf(stMsgData->
paramValue, N_LENGTH-1,
"cpe-%s", m_i8Alias);
360 char responseBuf[resBufSize];
363 if (ret == RMH_SUCCESS) {
364 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s", responseBuf );
366 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Interface_GetName success with result %s value %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), responseBuf);
369 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Interface_GetName failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
373 stMsgData->
paramtype = hostIf_StringType;
380 stMsgData->
paramtype = hostIf_UnsignedIntType;
381 stMsgData->
paramLen=
sizeof(
unsigned int);
384 uint32_t ui32Response = 0;
386 if (ret == RMH_SUCCESS) {
387 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetLinkUptime success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
392 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetLinkUptime failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
415 bool bUpsteam =
false;
416 bUpsteam = (m_bEnable)?
true:
false;
418 stMsgData->
paramtype = hostIf_BooleanType;
430 RMH_MacAddress_t response;
433 if (ret == RMH_SUCCESS) {
434 char macBuff[18] = {
'\0'};
436 RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,
"[%s:%u] RMH_Interface_GetMac success with result %s value %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), macBuff);
437 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s", macBuff);
438 stMsgData->
paramLen = strlen(macBuff);
442 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Interface_GetMac failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
445 stMsgData->
paramtype = hostIf_StringType;
455 char responseBuf[resBufSize];
458 if (ret == RMH_SUCCESS) {
459 snprintf(stMsgData->
paramValue, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%s", responseBuf );
461 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetSoftwareVersion success with result %s value %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), responseBuf );
465 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetSoftwareVersion failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
468 stMsgData->
paramtype = hostIf_StringType;
474 stMsgData->
paramtype = hostIf_UnsignedIntType;
475 stMsgData->
paramLen=
sizeof(
unsigned int);
478 uint32_t ui32Response = 0;
480 if (ret == RMH_SUCCESS) {
481 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetMaxBitrate success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
486 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetMaxBitrate failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
494 stMsgData->
paramtype = hostIf_UnsignedIntType;
495 stMsgData->
paramLen=
sizeof(
unsigned int);
498 uint32_t ui32Response = 0;
501 if (ret == RMH_SUCCESS) {
502 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_PQOS_GetMaxIngressFlows success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
507 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_PQOS_GetMaxIngressFlows failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
516 stMsgData->
paramtype = hostIf_UnsignedIntType;
517 stMsgData->
paramLen=
sizeof(
unsigned int);
520 uint32_t ui32Response;
523 if (ret == RMH_SUCCESS) {
524 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_PQoS_GetMaxEgressBandwidth success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
529 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_PQoS_GetMaxEgressBandwidth failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
537 stMsgData->
paramtype = hostIf_StringType;
540 RMH_MoCAVersion hVer;
543 if (ret == RMH_SUCCESS) {
544 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetHighestSupportedMoCAVersion success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), hVer);
545 m_HighestVersion = hVer;
551 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetHighestSupportedMoCAVersion failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
560 stMsgData->
paramtype = hostIf_StringType;
563 RMH_MoCAVersion response;
566 if (ret == RMH_SUCCESS) {
567 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetMoCAVersion success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
573 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetMoCAVersion failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
581 stMsgData->
paramtype = hostIf_UnsignedIntType;
582 stMsgData->
paramLen=
sizeof(
unsigned int);
586 uint32_t ui32Response;
589 if (ret == RMH_SUCCESS) {
590 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNCNodeId success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
595 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNCNodeId failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
603 stMsgData->
paramtype = hostIf_UnsignedIntType;
604 stMsgData->
paramLen=
sizeof(
unsigned int);
608 uint32_t ui32Response;
611 if (ret == RMH_SUCCESS) {
612 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeId success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
617 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeId failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
624 bool maxNodes = (m_HighestVersion == HIGHEST_MOCA_VERSION)?
true :
false;
626 stMsgData->
paramtype = hostIf_BooleanType;
632 stMsgData->
paramtype = hostIf_BooleanType;
640 if (ret == RMH_SUCCESS) {
641 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeId success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), enable);
645 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeId failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
654 stMsgData->
paramtype = hostIf_UnsignedIntType;
655 stMsgData->
paramLen=
sizeof(
unsigned int);
662 if (ret == RMH_SUCCESS) {
663 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeId success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), backupNC);
667 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetNodeId failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
675 bool bEnable =
false;
676 stMsgData->
paramtype = hostIf_BooleanType;
683 if (ret == RMH_SUCCESS) {
687 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetPrivacyEnabled failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
695 bool bEnable =
false;
696 stMsgData->
paramtype = hostIf_BooleanType;
703 if (ret == RMH_SUCCESS) {
704 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetPrivacyEnabled success with result %s and value as %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), bEnable);
708 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetPrivacyEnabled failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
716 stMsgData->
paramtype = hostIf_StringType;
719 size_t responseBufUsed;
720 const size_t bufLen = 256;
721 uint32_t responseBuf[bufLen] = {
'\0'};
725 if (ret == RMH_SUCCESS) {
727 length += snprintf(stMsgData->
paramValue + length, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"0x" );
729 for (
int i=0; i < responseBufUsed; i++) {
730 length += snprintf(stMsgData->
paramValue + length, TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"%02X", responseBuf[i] );
732 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetSupportedFrequencies success with result %s and value as %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret),stMsgData->
paramValue);
736 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u]RMH_Self_GetSupportedFrequencies failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
746 stMsgData->
paramtype = hostIf_StringType;
749 memset(stMsgData->
paramValue,
'\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
755 if (ret == RMH_SUCCESS) {
756 snprintf(stMsgData->
paramValue, (TR69HOSTIFMGR_MAX_PARAM_LEN-1),
"0x%08x", response);
757 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetFrequencyMask success with result %s value %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), stMsgData->
paramValue);
760 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetFrequencyMask failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
770 stMsgData->
paramtype = hostIf_StringType;
773 memset(stMsgData->
paramValue,
'\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
779 if (ret == RMH_SUCCESS) {
780 snprintf(stMsgData->
paramValue, (TR69HOSTIFMGR_MAX_PARAM_LEN-1),
"0x%08x", response);
781 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetFrequencyMask success with result %s value %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), stMsgData->
paramValue);
784 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetFrequencyMask failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
794 stMsgData->
paramtype = hostIf_IntegerType;
802 if (ret == RMH_SUCCESS) {
803 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetRFChannelFreq success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
807 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetRFChannelFreq failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
816 stMsgData->
paramtype = hostIf_IntegerType;
824 if (ret == RMH_SUCCESS) {
825 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetLOF success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
829 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetLOF failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
837 stMsgData->
paramtype = hostIf_StringType;
840 memset(stMsgData->
paramValue, 0, TR69HOSTIFMGR_MAX_PARAM_LEN);
847 stMsgData->
paramtype = hostIf_IntegerType;
850 memset(stMsgData->
paramValue,
'\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
855 if (ret == RMH_SUCCESS) {
857 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetTxPowerLimit success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
860 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetTxPowerLimit failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
864 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s:%u] Failed in RMH_Initialize. Not updating cache.\n", __FUNCTION__, __LINE__);
872 stMsgData->
paramtype = hostIf_UnsignedIntType;
873 stMsgData->
paramLen=
sizeof(
unsigned int);
876 memset(stMsgData->
paramValue,
'\0', TR69HOSTIFMGR_MAX_PARAM_LEN);
879 uint32_t response = 0;
880 RMH_Result ret = RMH_Self_GetPrimaryChannelTargetPhyRate(rmh, &response);
881 if (ret == RMH_SUCCESS) {
883 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u]RMH_Self_GetPrimaryChannelTargetPhyRate success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
886 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u]RMH_Self_GetPrimaryChannelTargetPhyRate failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
896 stMsgData->
paramtype = hostIf_UnsignedIntType;
897 stMsgData->
paramLen=
sizeof(
unsigned int);
899 unsigned int response;
903 if (ret == RMH_SUCCESS) {
905 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Power_GetTxBeaconPowerReduction success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
908 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Power_GetTxBeaconPowerReduction failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
912 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"[%s:%u] Failed in RMH_Initialize. Not updating cache.\n", __FUNCTION__, __LINE__);
920 stMsgData->
paramtype = hostIf_StringType;
927 if (ret == RMH_SUCCESS) {
928 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetTabooChannels success with result %s and value as 0x%08x. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), mask);
929 snprintf(stMsgData->
paramValue,TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"0x%08x", mask );
933 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u]RMH_Network_GetTabooChannels failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
942 stMsgData->
paramtype = hostIf_StringType;
949 if (ret == RMH_SUCCESS) {
950 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u]RMH_Self_GetTabooChannels success with result %s and value as 0x%08x. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), mask);
951 snprintf(stMsgData->
paramValue,TR69HOSTIFMGR_MAX_PARAM_LEN-1,
"0x%08x", mask );
955 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u]RMH_Self_GetTabooChannels failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
965 stMsgData->
paramtype = hostIf_UnsignedIntType;
966 stMsgData->
paramLen=
sizeof(
unsigned int);
969 uint32_t ui32Response;
971 if (ret == RMH_SUCCESS) {
973 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetTxBroadcastPhyRate success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), ui32Response);
976 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetTxBroadcastPhyRate failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
984 stMsgData->
paramtype = hostIf_UnsignedIntType;
985 stMsgData->
paramLen=
sizeof(
unsigned int);
991 if (ret == RMH_SUCCESS) {
993 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Power_GetTxBeaconPowerReduction success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
996 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Power_GetTxBeaconPowerReduction failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1005 stMsgData->
paramtype = hostIf_BooleanType;
1010 bool response =
false;
1012 if (ret == RMH_SUCCESS) {
1014 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetQAM256Enabled success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
1017 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_GetQAM256Enabled failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1026 stMsgData->
paramtype = hostIf_UnsignedIntType;
1027 stMsgData->
paramLen=
sizeof(
unsigned int);
1030 uint32_t response = 0;
1032 if (ret == RMH_SUCCESS) {
1034 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_RemoteNode_GetMaxPacketAggregation success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
1037 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_RemoteNode_GetMaxPacketAggregation failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1046 int ret = get_Associated_Device_NumberOfEntries(num_entries);
1048 stMsgData->
paramtype = hostIf_UnsignedIntType;
1049 stMsgData->
paramLen=
sizeof(
unsigned int);
1056 int ret = get_MoCA_Mesh_NumberOfEntries(num_entries);
1058 stMsgData->
paramtype = hostIf_UnsignedIntType;
1059 stMsgData->
paramLen=
sizeof(
unsigned int);
1066 stMsgData->
paramtype = hostIf_UnsignedIntType;
1067 stMsgData->
paramLen=
sizeof(
unsigned int);
1071 uint32_t response = 0;
1073 if (ret == RMH_SUCCESS) {
1075 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetPrimaryChannelFreq success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
1078 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetPrimaryChannelFreq failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1087 stMsgData->
paramtype = hostIf_UnsignedIntType;
1088 stMsgData->
paramLen=
sizeof(
unsigned int);
1092 uint32_t response = 0;
1094 if (ret == RMH_SUCCESS) {
1096 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetSecondaryChannelFreq success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
1099 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetSecondaryChannelFreq failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1108 stMsgData->
paramtype = hostIf_UnsignedIntType;
1109 stMsgData->
paramLen=
sizeof(
unsigned int);
1112 RMH_PowerMode response;
1114 if (ret == RMH_SUCCESS) {
1116 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u]RMH_Power_GetMode success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
1119 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u]RMH_Power_GetMode failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1128 stMsgData->
paramtype = hostIf_BooleanType;
1129 stMsgData->
paramLen=
sizeof(
unsigned int);
1135 if (ret == RMH_SUCCESS) {
1137 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetSecondaryChannelFreq success with result %s value %d. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret), response);
1140 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Network_GetSecondaryChannelFreq failed with result %s.\n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1150 RMH_LinkStatus status;
1153 if (ret == RMH_SUCCESS) {
1156 if (status != RMH_LINK_STATUS_UP)
1158 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] Coax connection failed, MoCA disabled.\n", __FILE__, __FUNCTION__);
1162 sprintf(statusBuf,
"%s",
"Coax connection confirmed, MoCA enabled");
1163 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Status: %s\n", __FILE__, __FUNCTION__, statusBuf);
1168 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] Failed to discovering MoCA Network Coordinator.\n", __FILE__, __FUNCTION__);
1172 RMH_MacAddress_t ncMac;
1174 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] Failed to discovering MoCA Network Coordinator.\n", __FILE__, __FUNCTION__);
1178 char macBuff[20] = {
'\0'};
1180 RDK_LOG(RDK_LOG_DEBUG, LOG_TR69HOSTIF,
"[%s:%u] RMH_Interface_GetMac success with Mac Address : %s. \n", __FUNCTION__, __LINE__, macBuff);
1181 sprintf(statusBuf,
"%s %d %s %s",
"Discovering MoCA Network Coordinator:", ncId,
" MoCA MAC: ", macBuff);
1185 if(OK == get_MoCA_Mesh_NumberOfEntries(numOfNodes))
1189 sprintf(statusBuf,
"%s",
"Joined MoCA Network");
1190 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%s] Status: %s\n", __FILE__, __FUNCTION__, statusBuf);
1194 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s]",
"Failed to Join MoCA Network.\n", __FILE__, __FUNCTION__);
1209 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
1211 if(stMsgData->
paramtype == hostIf_BooleanType) {
1212 stMsgData->
faultCode = fcInvalidParameterType;
1213 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] Failed due to wrong data type. This should be boolean.\n", __FUNCTION__, __FILE__);
1219 const bool value = get_boolean(stMsgData->
paramValue);
1221 if (ret == RMH_SUCCESS) {
1223 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetEnabled successfully set. \n", __FUNCTION__, __LINE__);
1227 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetEnabled failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1231 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1239 stMsgData->
paramtype = hostIf_StringType;
1240 const char* alias = stMsgData->
paramName;
1242 snprintf(m_i8Alias, N_LENGTH-1,
"cpe-%s", alias);
1257 if(stMsgData->
paramtype == hostIf_BooleanType) {
1258 stMsgData->
faultCode = fcInvalidParameterType;
1259 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%s] Failed due to wrong data type. This should be boolean.\n", __FUNCTION__, __FILE__);
1265 const bool value = get_boolean(stMsgData->
paramValue);
1267 if (ret == RMH_SUCCESS) {
1268 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPreferredNCEnabled successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1272 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPreferredNCEnabled failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1277 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1286 const bool value = get_boolean(stMsgData->
paramValue);
1288 if (ret == RMH_SUCCESS) {
1289 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPrivacyEnabled successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1293 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPrivacyEnabled failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1298 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1307 const uint32_t value = atoi(stMsgData->
paramValue);
1309 if (ret == RMH_SUCCESS) {
1310 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetFrequencyMask successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1314 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetFrequencyMask failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1319 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1330 if (ret == RMH_SUCCESS) {
1331 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPrivacyPassword successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1332 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"[%s,%d] KeyPassphrase set Complete \n",__FUNCTION__,__LINE__);
1336 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPrivacyPassword failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1341 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1349 const int32_t value = get_int(stMsgData->
paramValue);
1351 if (ret == RMH_SUCCESS) {
1352 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetTxPowerLimit successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1356 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetTxPowerLimit failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1361 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1369 const int32_t value = get_int(stMsgData->
paramValue);
1370 RMH_Result ret = RMH_Self_SetPrimaryChannelTargetPhyRate(rmh, value);
1371 if (ret == RMH_SUCCESS) {
1372 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u]RMH_Self_SetPrimaryChannelTargetPhyRate successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1376 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Self_SetPrimaryChannelTargetPhyRate failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1381 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
1389 const uint32_t value = get_int(stMsgData->
paramValue);
1391 if (ret == RMH_SUCCESS) {
1392 RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,
"[%s:%u] RMH_Power_SetTxBeaconPowerReduction successfully set with value %d. \n", __FUNCTION__, __LINE__, value);
1396 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%u] RMH_Power_SetTxBeaconPowerReduction failed with result %s. \n", __FUNCTION__, __LINE__,
RMH_ResultToString(ret));
1401 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);