28 #define MAX_CMD_LEN 128
29 #define MAX_BUF_LEN 256
33 GHashTable *hostIf_StorageSrvc::storageSrvHash = NULL;
34 GMutex *hostIf_StorageSrvc::m_mutex = NULL;
46 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"Inside constructor for dev_id:%d\n", dev_id);
49 void hostIf_StorageSrvc::getLock()
53 m_mutex = g_mutex_new();
55 g_mutex_lock(m_mutex);
58 void hostIf_StorageSrvc::releaseLock()
60 g_mutex_unlock(m_mutex);
65 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"Entering [%s]\n", __FUNCTION__);
69 if(NULL==storageSrvHash)
71 get_Device_StorageSrvc_ClientNumberOfEntries(&stMsgData);
78 GList* hostIf_StorageSrvc::getAllInstances()
81 return g_hash_table_get_keys(storageSrvHash);
90 g_hash_table_remove(storageSrvHash, (gconstpointer)pDev->dev_id);
96 void hostIf_StorageSrvc::closeAllInstances()
100 GList* val_list = g_hash_table_get_values (storageSrvHash);
101 GList* tmp_list = val_list;
105 tmp_list = tmp_list->next;
108 g_list_free(val_list);
113 unsigned int hostIf_StorageSrvc :: get_Device_StorageSrvc_ClientNumberOfEntries(
HOSTIF_MsgData_t* stMsgData)
116 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"Entring :%s\n",__FUNCTION__);
117 int numberOfEntries = 1;
119 stMsgData->
paramtype = hostIf_UnsignedIntType;
120 stMsgData->
paramLen =
sizeof(
unsigned int);
122 if(NULL != storageSrvHash)
128 storageSrvHash = g_hash_table_new(NULL, NULL);
130 for(
int index=1;index<=numberOfEntries; index++)
135 g_hash_table_insert(storageSrvHash, (gpointer)(index), pRet);
139 RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,
"Caught exception, not able create physical medium instance..\n");
160 RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,
"Entring:%s\n",__FUNCTION__);
163 const char* psettings;
164 const char* pSubSettings;
165 int instanceNumber = 0;
166 char dev_str[MAX_DEV_STR]={
'\0'};
172 param.assign(
"Device.Services.StorageService");
173 snprintf(dev_str, MAX_DEV_STR,
".%d",dev_id);
174 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"Param Name:%s param:%s\n",stMsgData->
paramName,param.c_str());
175 if(matchComponent(stMsgData->
paramName, param.c_str(), &psettings, instanceNumber))
177 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"psettings:%s\n",psettings);
178 if(strcasecmp(psettings,
"PhysicalMediumNumberOfEntries")==0)
180 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"Getting the number of physical medium number of entries\n");
181 retVal = hostIf_PhysicalMedium::get_Device_Service_StorageMedium_ClientNumberOfEntries(stMsgData, dev_id);
183 else if(strncasecmp(psettings,
"PhysicalMedium.",strlen(
"PhysicalMedium."))==0)
185 param.append(dev_str);
186 param.append(
".PhysicalMedium");
187 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"Getting the param value for Physical Medium:%s from param name:%s\n",param.c_str(), stMsgData->
paramName);
188 if(matchComponent(stMsgData->
paramName, param.c_str(), &pSubSettings, instanceNumber))
190 F(
"Sub param:%s\n",pSubSettings);
191 pPhyMed = hostIf_PhysicalMedium :: getInstance(dev_id,instanceNumber);
194 if(0 == strcasecmp(pSubSettings,
"Name"))
198 else if(0 == strcasecmp(pSubSettings,
"SmartCapable"))
202 else if(0 == strcasecmp(pSubSettings,
"Health"))
208 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
209 stMsgData->
faultCode = fcInvalidParameterName;
217 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"Failed to match component\n");
218 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
219 stMsgData->
faultCode = fcInvalidParameterName;
225 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"%s not implemented\n",stMsgData->
paramName);
226 RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,
"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->
paramName);
227 stMsgData->
faultCode = fcInvalidParameterName;
233 RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,
"Not able to get component:%s %s %d",stMsgData->
paramName, __FUNCTION__, __LINE__);
234 stMsgData->
faultCode = fcInvalidParameterName;