RDK Documentation (Open Sourced RDK Components)
hostIf_EthernetClient_ReqHandler.cpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file hostIf_EthernetClient_ReqHandler.cpp
22  * @brief The header file provides HostIf Ethernet client request handler information APIs.
23  */
24 
25 /**
26 * @defgroup tr69hostif
27 * @{
28 * @defgroup hostif
29 * @{
30 **/
31 
32 //#define HAVE_VALUE_CHANGE_EVENT
33 
34 #include "hostIf_main.h"
38 #include "safec_lib.h"
39 
40 EthernetClientReqHandler* EthernetClientReqHandler::pInstance = NULL;
41 updateCallback EthernetClientReqHandler::mUpdateCallback = NULL;
42 int EthernetClientReqHandler::curNumOfDevices[10] = {0,};
43 
44 msgHandler* EthernetClientReqHandler::getInstance()
45 {
46 
47  if(!pInstance)
48  pInstance = new EthernetClientReqHandler();
49  return pInstance;
50 }
51 void EthernetClientReqHandler::reset()
52 {
53  hostIf_EthernetInterface::getLock();
54  memset(curNumOfDevices,0,sizeof(curNumOfDevices));
55  hostIf_EthernetInterface::releaseLock();
56 }
57 
58 /**
59  * @brief This function is used to initialize. Currently not implemented.
60  *
61  * @return Returns the status of the operation.
62  *
63  * @retval true if initialization is successful.
64  * @retval false if initialization is not successful.
65  * @ingroup TR-069HOSTIF_ETHERNETCLIENT_REQHANDLER_CLASSES
66  */
68 {
69 // RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
70 // RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
71  return true;
72 }
73 
74 /**
75  * @brief This function is used to close all the instances of ethernet interface
76  * and ethernet interface stats.
77  *
78  * @return Returns the status of the operation.
79  *
80  * @retval true if it successfully close all the instances.
81  * @retval false if not able to close all the instances.
82  * @ingroup TR-069HOSTIF_ETHERNETCLIENT_REQHANDLER_CLASSES
83  */
85 {
86  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Entering..\n", __FUNCTION__, __FILE__);
87 
88  hostIf_EthernetInterface::closeAllInstances();
89  hostIf_EthernetInterfaceStats::closeAllInstances();
90 
91  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s] Exiting..\n", __FUNCTION__, __FILE__);
92  return true;
93 }
94 
95 /**
96  * @brief This function is used to handle the set message request of ethernet interface
97  * attribute such as "Enable", "Alias", "LowerLayers", "MaxBitRate" and "DuplexMode".
98  *
99  * @param[out] stMsgData TR-069 Host interface message request.
100  *
101  * @return Returns the status of the operation.
102  *
103  * @retval OK if successful.
104  * @retval ERR_INTERNAL_ERROR if not able to set the data to the device.
105  * @ingroup TR-069HOSTIF_ETHERNETCLIENT_REQHANDLER_CLASSES
106  */
108 {
109  int ret = NOT_HANDLED;
110  const char *pSetting;
111  int instanceNumber;
112  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s:%d] Found string as %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->paramName);
113  if(matchComponent(stMsgData->paramName,
114  "Device.Ethernet.Interface",&pSetting,instanceNumber))
115  {
116  stMsgData->instanceNum = instanceNumber;
117  hostIf_EthernetInterface::getLock();
118 
120 
121  if(!pIface)
122  {
123  hostIf_EthernetInterface::releaseLock();
124  return NOK;
125  }
126  if (strcasecmp(pSetting,"Enable") == 0)
127  {
128  ret = pIface->set_Device_Ethernet_Interface_Enable(stMsgData);
129  }
130  else if (strcasecmp(pSetting,"Alias") == 0)
131  {
132  ret = pIface->set_Device_Ethernet_Interface_Alias(stMsgData);
133  }
134  else if (strcasecmp(pSetting,"LowerLayers") == 0)
135  {
136  ret = pIface->set_Device_Ethernet_Interface_LowerLayers(stMsgData);
137  }
138  else if (strcasecmp(pSetting,"MaxBitRate") == 0)
139  {
140  ret = pIface->set_Device_Ethernet_Interface_Enable(stMsgData);
141  }
142  else if (strcasecmp(pSetting,"DuplexMode") == 0)
143  {
144  ret = pIface->set_Device_Ethernet_Interface_DuplexMode(stMsgData);
145  }
146  else
147  {
148  ret = NOK;
149  stMsgData->faultCode = fcAttemptToSetaNonWritableParameter;
150  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s] Failed, since Attempt To Set a NonWritable Parameter \"%s\"\n", __FUNCTION__, stMsgData->paramName);
151  }
152  }
153  hostIf_EthernetInterface::releaseLock();
154  return ret;
155 }
156 
157 /**
158  * @brief This function is used to handle the get message request of ethernet interface
159  * attributes such as "Enable", "Status", "Name", "LastChange", "Upstream", "MACAddress"
160  * etc..
161  *
162  * @param[out] stMsgData TR-069 Host interface message request.
163  *
164  * @return Returns the status of the operation.
165  *
166  * @retval OK if it gets the data successfully.
167  * @retval ERR_INTERNAL_ERROR if not able to get the data from the device.
168  * @ingroup TR-069HOSTIF_ETHERNETCLIENT_REQHANDLER_CLASSES
169  */
171 {
172  int ret = NOT_HANDLED;
173  const char *pSetting;
174  int instanceNumber;
175  RDK_LOG(RDK_LOG_TRACE1,LOG_TR69HOSTIF,"[%s:%s:%d] Found string as %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->paramName);
176  hostIf_EthernetInterface::getLock();
177  if(strcasecmp(stMsgData->paramName,"Device.Ethernet.InterfaceNumberOfEntries") == 0)
178  {
180  }
181  else if(matchComponent(stMsgData->paramName,
182  "Device.Ethernet.Interface",&pSetting,instanceNumber))
183  {
184  if(!instanceNumber) {
185  hostIf_EthernetInterface::releaseLock();
186  return NOK;
187  }
188  HOSTIF_MsgData_t msgData;
189  memset(&msgData,0,sizeof(msgData));
191  {
192  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d] Get number of interfaces failed \n", __FUNCTION__, __LINE__);
193  hostIf_EthernetInterface::releaseLock();
194  return NOK;
195 
196  }
197  int tmpInterfaceCount = get_int(msgData.paramValue);
198  if(instanceNumber > tmpInterfaceCount)
199  {
200  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d] instanceNumber : \'%d\' is Not Supported. Total number of interfaces : \'%d\' \n", __FUNCTION__, __LINE__, \
201  instanceNumber,tmpInterfaceCount);
202  hostIf_EthernetInterface::releaseLock();
203  return NOK;
204  }
205  stMsgData->instanceNum = instanceNumber;
207  hostIf_EthernetInterfaceStats *pIfaceStats = hostIf_EthernetInterfaceStats::getInstance(instanceNumber);
208  if(!pIface)
209  {
210  hostIf_EthernetInterface::releaseLock();
211  return NOK;
212  }
213 
214  if (strcasecmp(pSetting,"Enable") == 0)
215  {
216  ret = pIface->get_Device_Ethernet_Interface_Enable(stMsgData);
217  }
218  else if (strcasecmp(pSetting,"Status") == 0)
219  {
220  ret = pIface->get_Device_Ethernet_Interface_Status(stMsgData);
221  }
222  else if (strcasecmp(pSetting,"Name") == 0)
223  {
224  ret = pIface->get_Device_Ethernet_Interface_Name(stMsgData);
225  }
226  else if (strcasecmp(pSetting,"LastChange") == 0)
227  {
228  ret = pIface->get_Device_Ethernet_Interface_LastChange(stMsgData);
229  }
230  else if (strcasecmp(pSetting,"Upstream") == 0)
231  {
232  ret = pIface->get_Device_Ethernet_Interface_Upstream(stMsgData);
233  }
234  else if (strcasecmp(pSetting,"MACAddress") == 0)
235  {
236  ret = pIface->get_Device_Ethernet_Interface_MACAddress(stMsgData);
237  }
238  else if (strcasecmp(pSetting,"LowerLayers") == 0)
239  {
240  ret = pIface->get_Device_Ethernet_Interface_LowerLayers(stMsgData);
241  }
242  else if (strcasecmp(pSetting,"MaxBitRate") == 0)
243  {
244  ret = pIface->get_Device_Ethernet_Interface_MaxBitRate(stMsgData);
245  }
246  else if (strcasecmp(pSetting,"DuplexMode") == 0)
247  {
248  ret = pIface->get_Device_Ethernet_Interface_DuplexMode(stMsgData);
249  }
250  else if (strcasecmp(pSetting,"Stats.BytesSent") == 0)
251  {
252  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_BytesSent(stMsgData);
253  }
254  else if (strcasecmp(pSetting,"Stats.BytesReceived") == 0)
255  {
256  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_BytesReceived(stMsgData);
257  }
258  else if (strcasecmp(pSetting,"Stats.PacketsSent") == 0)
259  {
260  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_PacketsSent(stMsgData);
261  }
262  else if (strcasecmp(pSetting,"Stats.PacketsReceived") == 0)
263  {
264  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_PacketsReceived(stMsgData);
265  }
266  else if (strcasecmp(pSetting,"Stats.ErrorsSent") == 0)
267  {
268  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_ErrorsSent(stMsgData);
269  }
270  else if (strcasecmp(pSetting,"Stats.ErrorsReceived") == 0)
271  {
272  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_ErrorsReceived(stMsgData);
273  }
274  else if (strcasecmp(pSetting,"Stats.UnicastPacketsSent") == 0)
275  {
276  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_UnicastPacketsSent(stMsgData);
277  }
278  else if (strcasecmp(pSetting,"Stats.UnicastPacketsReceived") == 0)
279  {
281  }
282  else if (strcasecmp(pSetting,"Stats.DiscardPacketsSent") == 0)
283  {
284  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_DiscardPacketsSent(stMsgData);
285  }
286  else if (strcasecmp(pSetting,"Stats.DiscardPacketsReceived") == 0)
287  {
289  }
290  else if (strcasecmp(pSetting,"Stats.MulticastPacketsSent") == 0)
291  {
292  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_MulticastPacketsSent(stMsgData);
293  }
294  else if (strcasecmp(pSetting,"Stats.MulticastPacketsReceived") == 0)
295  {
297  }
298  else if (strcasecmp(pSetting,"Stats.BroadcastPacketsSent") == 0)
299  {
300  ret = pIfaceStats->get_Device_Ethernet_Interface_Stats_BroadcastPacketsSent(stMsgData);
301  }
302  else if (strcasecmp(pSetting,"Stats.BroadcastPacketsReceived") == 0)
303  {
305  }
306  else if (strcasecmp(pSetting,"Stats.UnknownProtoPacketsReceived") == 0)
307  {
309  }
310  else
311  {
312  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%d] Parameter : \'%s\' is Not Supported \n", __FUNCTION__, __LINE__, stMsgData->paramName);
313  stMsgData->faultCode = fcInvalidParameterName;
314  ret = NOK;
315  }
316 
317  }
318  hostIf_EthernetInterface::releaseLock();
319  return ret;
320 }
321 
322 int EthernetClientReqHandler::handleGetAttributesMsg(HOSTIF_MsgData_t *stMsgData)
323 {
324  int ret = NOT_HANDLED;
325  int instanceNumber = 0;
326 
327  hostIf_EthernetInterface::getLock();
329  stMsgData->instanceNum = instanceNumber;
330  if(!pIface)
331  {
332  hostIf_EthernetInterface::releaseLock();
333  return NOK;
334  }
335 
336  GHashTable* notifyhash = pIface->getNotifyHash();
337  if(notifyhash != NULL)
338  {
339  int* notifyvalue = (int*) g_hash_table_lookup(notifyhash,stMsgData->paramName);
340  put_int(stMsgData->paramValue, *notifyvalue);
341  stMsgData->paramtype = hostIf_IntegerType;
342  ret = OK;
343  }
344  else
345  {
346  ret = NOK;
347  }
348  hostIf_EthernetInterface::releaseLock();
349  return ret;
350 }
351 
352 int EthernetClientReqHandler::handleSetAttributesMsg(HOSTIF_MsgData_t *stMsgData)
353 {
354  int ret = NOT_HANDLED;
355  int instanceNumber = 0;
356 
357  hostIf_EthernetInterface::getLock();
359  stMsgData->instanceNum = instanceNumber;
360  if(!pIface)
361  {
362  hostIf_EthernetInterface::releaseLock();
363  return NOK;
364  }
365  GHashTable* notifyhash = pIface->getNotifyHash();
366  if(notifyhash != NULL)
367  {
368  int *notifyValuePtr;
369  notifyValuePtr = (int*) malloc(1 * sizeof(int));
370 
371  // Inserting Notification parameter to Notify Hash Table,
372  // Note that neither keys nor values are copied when inserted into the GHashTable, so they must exist for the lifetime of the GHashTable
373  // There for allocating a memory for both Param name and param value. This should be freed whenever we disable Notification.
374  char *notifyKey = NULL;
375  notifyKey = (char*) calloc(sizeof(char),strlen(stMsgData->paramName)+1);
376  if((NULL != notifyValuePtr) && (NULL != notifyKey))
377  {
378  *notifyValuePtr = 1;
379  errno_t rc = -1;
380  rc=strcpy_s(notifyKey,strlen(stMsgData->paramName)+1,stMsgData->paramName);
381  if(rc!=EOK)
382  {
383  ERR_CHK(rc);
384  }
385  g_hash_table_insert(notifyhash,notifyKey,notifyValuePtr);
386  ret = OK;
387  }
388  else
389  {
390  ret = NOK;
391  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s:%d] EthernetClientReqHandler Not able to allocate Notify pointer %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->paramName);
392  }
393  free(notifyKey); //CID:87027 - Resource leak
394  free(notifyValuePtr);
395  }
396  else
397  {
398  ret = NOK;
399  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s:%d] EthernetClientReqHandler Not able to get notifyhash %s\n", __FUNCTION__, __FILE__, __LINE__, stMsgData->paramName);
400  }
401  hostIf_EthernetInterface::releaseLock();
402  return ret;
403 }
404 
405 void EthernetClientReqHandler::registerUpdateCallback(updateCallback cb)
406 {
407  mUpdateCallback = cb;
408  RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"[%s:%s] Callback Registered .. Exiting..\n", __FILE__, __FUNCTION__);
409 }
410 void EthernetClientReqHandler::checkForUpdates()
411 {
412  const char *pSetting;
413  int instanceNumber = 0;
414  GHashTable* notifyhash = NULL;
415 
416  HOSTIF_MsgData_t msgData;
417  int index = 1;
418  char tmp_buff[TR69HOSTIFMGR_MAX_PARAM_LEN];
419  hostIf_EthernetInterface::getLock();
420 
421  memset(&msgData,0,sizeof(msgData));
422  memset(tmp_buff,0,TR69HOSTIFMGR_MAX_PARAM_LEN);
424  {
425  int tmpNoDev = get_int(msgData.paramValue);
426  char tmp[TR69HOSTIFMGR_MAX_PARAM_LEN] = "";
427  sprintf(tmp_buff,"Device.Ethernet.Interface");
428  while(curNumOfDevices[index] > tmpNoDev)
429  {
430  sprintf(tmp,"%s.%d.",tmp_buff,tmpNoDev);
431  if(mUpdateCallback) mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_REMOVE,tmp, NULL, hostIf_IntegerType);
432  tmpNoDev++;
433  }
434  while(curNumOfDevices[index] < tmpNoDev)
435  {
436  sprintf(tmp,"%s.",tmp_buff);
437  if(mUpdateCallback) mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_ADD,tmp, NULL, hostIf_IntegerType);
438  tmpNoDev--;
439  }
440  curNumOfDevices[index] = get_int(msgData.paramValue);
441  }
442 
443 #ifdef HAVE_VALUE_CHANGE_EVENT
444  //Get Notify Hash from device Info
446  if(NULL != dIface)
447  {
448  notifyhash = dIface->getNotifyHash();
449  }
450  else
451  {
452  RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"[%s:%s] Unable to get Device Info Instance\n", __FUNCTION__, __FILE__);
453  }
454 
455  // Iterate through Ghash Table
456  if(NULL != notifyhash)
457  {
458  GHashTableIter notifyHashIterator;
459  gpointer paramName;
460  gpointer notifyEnable;
461  bool bChanged;
462 
463  g_hash_table_iter_init (&notifyHashIterator, notifyhash);
464  while (g_hash_table_iter_next (&notifyHashIterator, &paramName, &notifyEnable))
465  {
466  int* isNotifyEnabled = (int *)notifyEnable;
467  instanceNumber = 0;
468  if(matchComponent((const char*)paramName,"Device.Ethernet.Interface",&pSetting,instanceNumber))
469  {
470  if(!instanceNumber)
471  { // Ethernet settings not found in Notify Hash Table
472  hostIf_EthernetInterface::releaseLock();
473  continue;
474  }
476  if(pIface)
477  {
478  if (strcasecmp(pSetting,"Status") == 0)
479  {
480  memset(&msgData,0,sizeof(msgData));
481  bChanged = false;
482  pIface->get_Device_Ethernet_Interface_Status(&msgData,&bChanged);
483  if(bChanged)
484  {
485  if(mUpdateCallback && (*isNotifyEnabled == 1))
486  {
487  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
488  }
489  }
490  }
491  else if(strcasecmp(pSetting,"Enable") == 0)
492  {
493  memset(&msgData,0,sizeof(msgData));
494  bChanged = false;
495  pIface->get_Device_Ethernet_Interface_Enable(&msgData,&bChanged);
496  if(bChanged)
497  {
498  if(mUpdateCallback && (*isNotifyEnabled == 1))
499  {
500  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
501  }
502  }
503  }
504  else if(strcasecmp(pSetting,"Name") == 0)
505  {
506  memset(&msgData,0,sizeof(msgData));
507  bChanged = false;
508  pIface->get_Device_Ethernet_Interface_Name(&msgData,&bChanged);
509  if(bChanged)
510  {
511  if(mUpdateCallback && (*isNotifyEnabled == 1))
512  {
513  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
514  }
515  }
516  }
517  else if(strcasecmp(pSetting,"LastChange") == 0)
518  {
519  memset(&msgData,0,sizeof(msgData));
520  bChanged = false;
521  pIface->get_Device_Ethernet_Interface_LastChange(&msgData,&bChanged);
522  if(bChanged)
523  {
524  if(mUpdateCallback && (*isNotifyEnabled == 1))
525  {
526  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
527  }
528  }
529  }
530  else if (strcasecmp(pSetting,"Upstream") == 0)
531  {
532  memset(&msgData,0,sizeof(msgData));
533  bChanged = false;
534  pIface->get_Device_Ethernet_Interface_Upstream(&msgData,&bChanged);
535  if(bChanged)
536  {
537  if(mUpdateCallback && (*isNotifyEnabled == 1))
538  {
539  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
540  }
541  }
542  }
543  else if (strcasecmp(pSetting,"MACAddress") == 0)
544  {
545  memset(&msgData,0,sizeof(msgData));
546  bChanged = false;
547  pIface->get_Device_Ethernet_Interface_MACAddress(&msgData,&bChanged);
548  if(bChanged)
549  {
550  if(mUpdateCallback && (*isNotifyEnabled == 1))
551  {
552  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
553  }
554  }
555  }
556  else if (strcasecmp(pSetting,"LowerLayers") == 0)
557  {
558  memset(&msgData,0,sizeof(msgData));
559  bChanged = false;
560  pIface->get_Device_Ethernet_Interface_LowerLayers(&msgData,&bChanged);
561  if(bChanged)
562  {
563  if(mUpdateCallback && (*isNotifyEnabled == 1))
564  {
565  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
566  }
567  }
568  }
569  else if (strcasecmp(pSetting,"MaxBitRate") == 0)
570  {
571  memset(&msgData,0,sizeof(msgData));
572  bChanged = false;
573  pIface->get_Device_Ethernet_Interface_MaxBitRate(&msgData,&bChanged);
574  if(bChanged)
575  {
576  if(mUpdateCallback && (*isNotifyEnabled == 1))
577  {
578  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
579  }
580  }
581  }
582  else if (strcasecmp(pSetting,"DuplexMode") == 0)
583  {
584  memset(&msgData,0,sizeof(msgData));
585  bChanged = false;
586  pIface->get_Device_Ethernet_Interface_DuplexMode(&msgData,&bChanged);
587  if(bChanged)
588  {
589  if(mUpdateCallback && (*isNotifyEnabled == 1))
590  {
591  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
592  }
593  }
594  }
595  }
596  hostIf_EthernetInterfaceStats *pIfaceStats = hostIf_EthernetInterfaceStats::getInstance(instanceNumber);
597  if(pIfaceStats)
598  {
599  if (strcasecmp(pSetting,"Stats.BytesSent") == 0)
600  {
601  memset(&msgData,0,sizeof(msgData));
602  bChanged = false;
603  pIfaceStats->get_Device_Ethernet_Interface_Stats_BytesSent(&msgData,&bChanged);
604  if(bChanged)
605  {
606  if(mUpdateCallback && (*isNotifyEnabled == 1))
607  {
608  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
609  }
610  }
611  }
612  else if (strcasecmp(pSetting,"Stats.BytesReceived") == 0)
613  {
614  memset(&msgData,0,sizeof(msgData));
615  bChanged = false;
616  pIfaceStats->get_Device_Ethernet_Interface_Stats_BytesReceived(&msgData,&bChanged);
617  if(bChanged)
618  {
619  if(mUpdateCallback && (*isNotifyEnabled == 1))
620  {
621  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
622  }
623  }
624  }
625  else if (strcasecmp(pSetting,"Stats.PacketsSent") == 0)
626  {
627  memset(&msgData,0,sizeof(msgData));
628  bChanged = false;
629  pIfaceStats->get_Device_Ethernet_Interface_Stats_PacketsSent(&msgData,&bChanged);
630  if(bChanged)
631  {
632  if(mUpdateCallback && (*isNotifyEnabled == 1))
633  {
634  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
635  }
636  }
637  }
638  else if (strcasecmp(pSetting,"Stats.PacketsReceived") == 0)
639  {
640  memset(&msgData,0,sizeof(msgData));
641  bChanged = false;
642  pIfaceStats->get_Device_Ethernet_Interface_Stats_PacketsReceived(&msgData,&bChanged);
643  if(bChanged)
644  {
645  if(mUpdateCallback && (*isNotifyEnabled == 1))
646  {
647  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
648  }
649  }
650  }
651  else if (strcasecmp(pSetting,"Stats.ErrorsSent") == 0)
652  {
653  memset(&msgData,0,sizeof(msgData));
654  bChanged = false;
655  pIfaceStats->get_Device_Ethernet_Interface_Stats_ErrorsSent(&msgData,&bChanged);
656  if(bChanged)
657  {
658  if(mUpdateCallback && (*isNotifyEnabled == 1))
659  {
660  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
661  }
662  }
663  }
664  else if (strcasecmp(pSetting,"Stats.ErrorsReceived") == 0)
665  {
666  memset(&msgData,0,sizeof(msgData));
667  bChanged = false;
668  pIfaceStats->get_Device_Ethernet_Interface_Stats_ErrorsReceived(&msgData,&bChanged);
669  if(bChanged)
670  {
671  if(mUpdateCallback && (*isNotifyEnabled == 1))
672  {
673  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
674  }
675  }
676  }
677  else if (strcasecmp(pSetting,"Stats.UnicastPacketsSent") == 0)
678  {
679  memset(&msgData,0,sizeof(msgData));
680  bChanged = false;
681  pIfaceStats->get_Device_Ethernet_Interface_Stats_UnicastPacketsSent(&msgData,&bChanged);
682  if(bChanged)
683  {
684  if(mUpdateCallback && (*isNotifyEnabled == 1))
685  {
686  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
687  }
688  }
689  }
690  else if (strcasecmp(pSetting,"Stats.UnicastPacketsReceived") == 0)
691  {
692  memset(&msgData,0,sizeof(msgData));
693  bChanged = false;
694  pIfaceStats->get_Device_Ethernet_Interface_Stats_UnicastPacketsReceived(&msgData,&bChanged);
695  if(bChanged)
696  {
697  if(mUpdateCallback && (*isNotifyEnabled == 1))
698  {
699  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
700  }
701  }
702  }
703  else if (strcasecmp(pSetting,"Stats.DiscardPacketsSent") == 0)
704  {
705  memset(&msgData,0,sizeof(msgData));
706  bChanged = false;
707  pIfaceStats->get_Device_Ethernet_Interface_Stats_DiscardPacketsSent(&msgData,&bChanged);
708  if(bChanged)
709  {
710  if(mUpdateCallback && (*isNotifyEnabled == 1))
711  {
712  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
713  }
714  }
715  }
716  else if (strcasecmp(pSetting,"Stats.DiscardPacketsReceived") == 0)
717  {
718  memset(&msgData,0,sizeof(msgData));
719  bChanged = false;
720  pIfaceStats->get_Device_Ethernet_Interface_Stats_DiscardPacketsReceived(&msgData,&bChanged);
721  if(bChanged)
722  {
723  if(mUpdateCallback && (*isNotifyEnabled == 1))
724  {
725  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
726  }
727  }
728  }
729  else if (strcasecmp(pSetting,"Stats.MulticastPacketsSent") == 0)
730  {
731  memset(&msgData,0,sizeof(msgData));
732  bChanged = false;
733  pIfaceStats->get_Device_Ethernet_Interface_Stats_MulticastPacketsSent(&msgData,&bChanged);
734  if(bChanged)
735  {
736  if(mUpdateCallback && (*isNotifyEnabled == 1))
737  {
738  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
739  }
740  }
741  }
742  else if (strcasecmp(pSetting,"Stats.MulticastPacketsReceived") == 0)
743  {
744  memset(&msgData,0,sizeof(msgData));
745  bChanged = false;
746  pIfaceStats->get_Device_Ethernet_Interface_Stats_MulticastPacketsReceived(&msgData,&bChanged);
747  if(bChanged)
748  {
749  if(mUpdateCallback && (*isNotifyEnabled == 1))
750  {
751  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
752  }
753  }
754  }
755  else if (strcasecmp(pSetting,"Stats.BroadcastPacketsSent") == 0)
756  {
757  memset(&msgData,0,sizeof(msgData));
758  bChanged = false;
759  pIfaceStats->get_Device_Ethernet_Interface_Stats_BroadcastPacketsSent(&msgData,&bChanged);
760  if(bChanged)
761  {
762  if(mUpdateCallback && (*isNotifyEnabled == 1))
763  {
764  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
765  }
766  }
767  }
768  else if (strcasecmp(pSetting,"Stats.BroadcastPacketsReceived") == 0)
769  {
770  memset(&msgData,0,sizeof(msgData));
771  bChanged = false;
772  pIfaceStats->get_Device_Ethernet_Interface_Stats_BroadcastPacketsReceived(&msgData,&bChanged);
773  if(bChanged)
774  {
775  if(mUpdateCallback && (*isNotifyEnabled == 1))
776  {
777  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
778  }
779  }
780  }
781  else if (strcasecmp(pSetting,"Stats.UnknownProtoPacketsReceived") == 0)
782  {
783  memset(&msgData,0,sizeof(msgData));
784  bChanged = false;
786  if(bChanged)
787  {
788  if(mUpdateCallback && (*isNotifyEnabled == 1))
789  {
790  mUpdateCallback(IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED,(const char*)paramName, msgData.paramValue, msgData.paramtype);
791  }
792  }
793  }
794  }
795  }
796  }
797  }
798  else
799  {
800  RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"[%s:%s] Unable to get Notify Hash table\n", __FUNCTION__, __FILE__);
801  }
802 #endif /*HAVE_VALUE_CHANGE_EVENT */
803  hostIf_EthernetInterface::releaseLock();
804 
805 }
806 
807 
808 
809 /** @} */
810 /** @} */
IARM_BUS_TR69HOSTIFMGR_EVENT_REMOVE
@ IARM_BUS_TR69HOSTIFMGR_EVENT_REMOVE
Definition: hostIf_tr69ReqHandler.h:188
_HostIf_MsgData_t::instanceNum
short instanceNum
Definition: hostIf_tr69ReqHandler.h:176
hostIf_EthernetInterface::get_Device_Ethernet_InterfaceNumberOfEntries
static int get_Device_Ethernet_InterfaceNumberOfEntries(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the number of entries in the Interface table.
Definition: Device_Ethernet_Interface.cpp:486
hostIf_EthernetInterface::getInstance
static hostIf_EthernetInterface * getInstance(int dev_id)
Definition: Device_Ethernet_Interface.cpp:66
hostIf_EthernetInterface::get_Device_Ethernet_Interface_MaxBitRate
int get_Device_Ethernet_Interface_MaxBitRate(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the maximum upstream and downstream PHY bit rate supported by this Ethernet in...
Definition: Device_Ethernet_Interface.cpp:775
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_UnicastPacketsReceived
int get_Device_Ethernet_Interface_Stats_UnicastPacketsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the number of unicast packets received on an Ethernet Interface.
Definition: Device_Ethernet_Interface_Stats.cpp:585
hostIf_EthernetInterface::set_Device_Ethernet_Interface_Alias
int set_Device_Ethernet_Interface_Alias(HOSTIF_MsgData_t *)
This function sets a non-volatile handle used to reference this Ethernet interface instance....
Definition: Device_Ethernet_Interface.cpp:878
Device_Ethernet_Interface_Stats.h
The header file provides TR069 device ethernet interface stats information APIs.
hostIf_EthernetInterface::get_Device_Ethernet_Interface_Name
int get_Device_Ethernet_Interface_Name(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the textual name of the 'Ethernet' interface.
Definition: Device_Ethernet_Interface.cpp:622
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_UnknownProtoPacketsReceived
int get_Device_Ethernet_Interface_Stats_UnknownProtoPacketsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function get the number of Packets of unidentified protocol received on an Ethernet Interface....
Definition: Device_Ethernet_Interface_Stats.cpp:807
hostIf_EthernetInterface::set_Device_Ethernet_Interface_LowerLayers
int set_Device_Ethernet_Interface_LowerLayers(HOSTIF_MsgData_t *)
This function sets the 'Ethernet' interface 'LowerLayers'. Given a comma-separated list (maximum leng...
Definition: Device_Ethernet_Interface.cpp:897
hostIf_EthernetInterface::get_Device_Ethernet_Interface_Upstream
int get_Device_Ethernet_Interface_Upstream(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function indicates whether the interface points towards the Internet represent by 'true' or towa...
Definition: Device_Ethernet_Interface.cpp:705
hostIf_EthernetInterfaceStats
This class provides the interface for getting Device ethernet interface status information.
Definition: Device_Ethernet_Interface_Stats.h:174
IARM_BUS_TR69HOSTIFMGR_EVENT_ADD
@ IARM_BUS_TR69HOSTIFMGR_EVENT_ADD
Definition: hostIf_tr69ReqHandler.h:187
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_BytesReceived
int get_Device_Ethernet_Interface_Stats_BytesReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the total number of bytes received on this Ethernet interface,...
Definition: Device_Ethernet_Interface_Stats.cpp:416
hostIf_EthernetInterface::set_Device_Ethernet_Interface_Enable
int set_Device_Ethernet_Interface_Enable(HOSTIF_MsgData_t *)
This function sets the status of 'Ethernet' interface as enabled or disabled.
Definition: Device_Ethernet_Interface.cpp:838
hostIf_EthernetInterface::get_Device_Ethernet_Interface_LowerLayers
int get_Device_Ethernet_Interface_LowerLayers(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides a comma-separated list (maximum length 1024) of strings. Each list item MUST b...
Definition: Device_Ethernet_Interface.cpp:677
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_EthernetInterface::get_Device_Ethernet_Interface_DuplexMode
int get_Device_Ethernet_Interface_DuplexMode(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the Duplex Mode available on an Ethernet Interface.
Definition: Device_Ethernet_Interface.cpp:805
EthernetClientReqHandler::handleSetMsg
virtual int handleSetMsg(HOSTIF_MsgData_t *stMsgData)
This function is used to handle the set message request of ethernet interface attribute such as "Enab...
Definition: hostIf_EthernetClient_ReqHandler.cpp:107
hostIf_EthernetInterface::get_Device_Ethernet_Interface_LastChange
int get_Device_Ethernet_Interface_LastChange(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the time since an Ethernet interface's last change of status.
Definition: Device_Ethernet_Interface.cpp:655
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_MulticastPacketsReceived
int get_Device_Ethernet_Interface_Stats_MulticastPacketsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the number of Multicast Packets received on an Ethernet Interface.
Definition: Device_Ethernet_Interface_Stats.cpp:712
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_ErrorsSent
int get_Device_Ethernet_Interface_Stats_ErrorsSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the total number of outbound packets that could not be transmitted because of ...
Definition: Device_Ethernet_Interface_Stats.cpp:498
EthernetClientReqHandler::handleGetMsg
virtual int handleGetMsg(HOSTIF_MsgData_t *stMsgData)
This function is used to handle the get message request of ethernet interface attributes such as "Ena...
Definition: hostIf_EthernetClient_ReqHandler.cpp:170
hostIf_main.h
hostIf_main API.
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_ErrorsReceived
int get_Device_Ethernet_Interface_Stats_ErrorsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the total number of inbound packets that contained errors preventing them from...
Definition: Device_Ethernet_Interface_Stats.cpp:526
hostIf_EthernetInterface::set_Device_Ethernet_Interface_DuplexMode
int set_Device_Ethernet_Interface_DuplexMode(HOSTIF_MsgData_t *)
This function sets the 'Duplex Mode' available on an ethernet Interface. This function sets the strin...
Definition: Device_Ethernet_Interface.cpp:939
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_BroadcastPacketsSent
int get_Device_Ethernet_Interface_Stats_BroadcastPacketsSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function get the number of Broadcast Packets sent on an Ethernet Interface. This function provid...
Definition: Device_Ethernet_Interface_Stats.cpp:746
EthernetClientReqHandler
This class provides the interface for getting Ethernet client request handler information.
Definition: hostIf_EthernetClient_ReqHandler.h:56
_HostIf_MsgData_t::paramtype
HostIf_ParamType_t paramtype
Definition: hostIf_tr69ReqHandler.h:177
RDK_LOG
#define RDK_LOG
Definition: rdk_debug.h:258
_HostIf_MsgData_t::faultCode
faultCode_t faultCode
Definition: hostIf_tr69ReqHandler.h:179
hostIf_EthernetInterface
This class provides the interface for getting Device ethernet interface information.
Definition: Device_Ethernet_Interface.h:195
hostIf_EthernetInterface::get_Device_Ethernet_Interface_MACAddress
int get_Device_Ethernet_Interface_MACAddress(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the MAC Address of this Ethernet interface.
Definition: Device_Ethernet_Interface.cpp:738
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_DiscardPacketsReceived
int get_Device_Ethernet_Interface_Stats_DiscardPacketsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the number of discarded inbound packets on an Ethernet Interface.
Definition: Device_Ethernet_Interface_Stats.cpp:651
hostIf_EthernetInterface::get_Device_Ethernet_Interface_Enable
int get_Device_Ethernet_Interface_Enable(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the status (enabled/disabled) of an Ethernet interface.
Definition: Device_Ethernet_Interface.cpp:529
hostIf_EthernetInterface::get_Device_Ethernet_Interface_Status
int get_Device_Ethernet_Interface_Status(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the status of an Ethernet Interface.
Definition: Device_Ethernet_Interface.cpp:587
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_UnicastPacketsSent
int get_Device_Ethernet_Interface_Stats_UnicastPacketsSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function get the number of unicast packets for which a request is send on the IP Interface was r...
Definition: Device_Ethernet_Interface_Stats.cpp:556
_HostIf_MsgData_t::paramName
char paramName[(4 *1024)]
Definition: hostIf_tr69ReqHandler.h:171
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_BroadcastPacketsReceived
int get_Device_Ethernet_Interface_Stats_BroadcastPacketsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function get the number of Broadcast Packets received on an Ethernet Interface....
Definition: Device_Ethernet_Interface_Stats.cpp:778
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_BytesSent
int get_Device_Ethernet_Interface_Stats_BytesSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the total number of bytes transmitted out of this Ethernet interface,...
Definition: Device_Ethernet_Interface_Stats.cpp:388
_HostIf_MsgData_t::paramValue
char paramValue[(4 *1024)]
Definition: hostIf_tr69ReqHandler.h:172
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_DiscardPacketsSent
int get_Device_Ethernet_Interface_Stats_DiscardPacketsSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function get the number of discarded outbound packets on an Ethernet Interface....
Definition: Device_Ethernet_Interface_Stats.cpp:618
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_MulticastPacketsSent
int get_Device_Ethernet_Interface_Stats_MulticastPacketsSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
Get the number of Multicast Packets sent on an Ethernet Interface.
Definition: Device_Ethernet_Interface_Stats.cpp:682
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_PacketsSent
int get_Device_Ethernet_Interface_Stats_PacketsSent(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the total number of packets transmitted out of this Ethernet interface.
Definition: Device_Ethernet_Interface_Stats.cpp:443
EthernetClientReqHandler::unInit
virtual bool unInit()
This function is used to close all the instances of ethernet interface and ethernet interface stats.
Definition: hostIf_EthernetClient_ReqHandler.cpp:84
EthernetClientReqHandler::init
virtual bool init()
This function is used to initialize. Currently not implemented.
Definition: hostIf_EthernetClient_ReqHandler.cpp:67
msgHandler
Definition: hostIf_msgHandler.h:103
put_int
void put_int(char *ptr, int val)
This function converts the input data to integer type.
Definition: hostIf_utils.cpp:152
IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED
@ IARM_BUS_TR69HOSTIFMGR_EVENT_VALUECHANGED
Definition: hostIf_tr69ReqHandler.h:189
Device_Ethernet_Interface.h
The header file provides TR069 device ethernet interface information APIs.
hostIf_EthernetClient_ReqHandler.h
The header file provides HostIf Ethernet client request handler information APIs.
hostIf_EthernetInterfaceStats::get_Device_Ethernet_Interface_Stats_PacketsReceived
int get_Device_Ethernet_Interface_Stats_PacketsReceived(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the total number of packets received on this Ethernet interface.
Definition: Device_Ethernet_Interface_Stats.cpp:470