RDK Documentation (Open Sourced RDK Components)
Device_WiFi_SSID_Stats.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 2018 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 /**
22  * @file Device_WiFi_SSID_Stats.cpp
23  *
24  * @brief Device_WiFi_SSID API Implementation.
25  *
26  * This is the implementation of the WiFi API.
27  *
28  * @par Document
29  */
30 /** @addtogroup TR-069 WiFi Implementation
31  * This is the implementation of the Device Public API.
32  * @{
33  */
34 
35 /*****************************************************************************
36  * STANDARD INCLUDE FILES
37  *****************************************************************************/
38 #ifdef USE_WIFI_PROFILE
39 #include "Device_WiFi_SSID_Stats.h"
40 
41 GHashTable* hostIf_WiFi_SSID_Stats::ifHash = NULL;
42 
43 hostIf_WiFi_SSID_Stats* hostIf_WiFi_SSID_Stats::getInstance(int dev_id)
44 {
45  hostIf_WiFi_SSID_Stats* pRet = NULL;
46 
47  if(ifHash)
48  {
49  pRet = (hostIf_WiFi_SSID_Stats *)g_hash_table_lookup(ifHash,(gpointer) dev_id);
50  }
51  else
52  {
53  ifHash = g_hash_table_new(NULL,NULL);
54  }
55 
56  if(!pRet)
57  {
58  try {
59  pRet = new hostIf_WiFi_SSID_Stats(dev_id);
60  } catch(int e)
61  {
62  RDK_LOG(RDK_LOG_WARN,LOG_TR69HOSTIF,"Caught exception, not able create hostIf_WiFi_SSID_Stats instance..\n");
63  }
64  g_hash_table_insert(ifHash, (gpointer)dev_id, pRet);
65  }
66  return pRet;
67 }
68 
69 GList* hostIf_WiFi_SSID_Stats::getAllInstances()
70 {
71  if(ifHash)
72  return g_hash_table_get_keys(ifHash);
73  return NULL;
74 }
75 
76 void hostIf_WiFi_SSID_Stats::closeInstance(hostIf_WiFi_SSID_Stats *pDev)
77 {
78  if(pDev)
79  {
80  g_hash_table_remove(ifHash, (gconstpointer)pDev->dev_id);
81  delete pDev;
82  }
83 }
84 
85 void hostIf_WiFi_SSID_Stats::closeAllInstances()
86 {
87  if(ifHash)
88  {
89  GList* tmp_list = g_hash_table_get_values (ifHash);
90 
91  while(tmp_list)
92  {
93  hostIf_WiFi_SSID_Stats* pDev = (hostIf_WiFi_SSID_Stats *)tmp_list->data;
94  tmp_list = tmp_list->next;
95  closeInstance(pDev);
96  }
97  }
98 }
99 
100 
101 hostIf_WiFi_SSID_Stats::hostIf_WiFi_SSID_Stats(int dev_id):
102  bytesSent(0),
103  bytesReceived(0),
104  packetsSent(0),
105  packetsReceived(0),
106  ErrorsSent(0),
107  ErrorsReceived(0),
108  UnicastPacketsSent(0),
109  UnicastPacketsReceived(0),
110  DiscardPacketsSent(0),
111  DiscardPacketsReceived(0),
112  MulticastPacketsSent(0),
113  MulticastPacketsReceived(0),
114  BroadcastPacketsSent(0),
115  BroadcastPacketsReceived(0),
116  UnknownProtoPacketsReceived(0)
117 {
118 
119 }
120 
121 /**
122  * @brief Get the MAC Address of an Associated Device of a MoCA Interface.
123  *
124  * This function provides the MAC address of the MoCA interface of the device associated
125  * with this MoCA interface.
126  *
127  * See @ref dev_moca_if_assocdev_getter
128  *
129  */
130 
132 {
133  return OK;
134 }
136 {
137  return OK;
138 }
140 {
141  return OK;
142 }
144 {
145  return OK;
146 }
148 {
149  return OK;
150 }
152 {
153  return OK;
154 }
156 {
157  return OK;
158 }
160 {
161  return OK;
162 }
164 {
165  return OK;
166 }
168 {
169  return OK;
170 }
172 {
173  return OK;
174 }
176 {
177  return OK;
178 }
180 {
181  return OK;
182 }
184 {
185  return OK;
186 }
188 {
189  return OK;
190 }
191 
192 #endif /* #ifdef USE_WIFI_PROFILE */
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_DiscardPacketsSent
int get_Device_WiFi_SSID_Stats_DiscardPacketsSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of outbound packets which were chosen to be discarded even though no errors had ...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_MulticastPacketsSent
int get_Device_WiFi_SSID_Stats_MulticastPacketsSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of packets that higher-level protocols requested for transmission and which were...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_DiscardPacketsReceived
int get_Device_WiFi_SSID_Stats_DiscardPacketsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of inbound packets which were chosen to be discarded even though no errors had b...
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_MulticastPacketsReceived
int get_Device_WiFi_SSID_Stats_MulticastPacketsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of received packets, delivered by this layer to a higher layer,...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_BytesSent
int get_Device_WiFi_SSID_Stats_BytesSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of bytes transmitted out of the interface, including framing characters.
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_PacketsSent
int get_Device_WiFi_SSID_Stats_PacketsSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of packets transmitted out of the interface.
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_UnicastPacketsSent
int get_Device_WiFi_SSID_Stats_UnicastPacketsSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of packets requested for transmission which were not addressed to a multicast or...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_ErrorsReceived
int get_Device_WiFi_SSID_Stats_ErrorsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of inbound packets that contained errors preventing them from being delivered to...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_BroadcastPacketsSent
int get_Device_WiFi_SSID_Stats_BroadcastPacketsSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of packets that higher-level protocols requested for transmission and which were...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_ErrorsSent
int get_Device_WiFi_SSID_Stats_ErrorsSent(HOSTIF_MsgData_t *stMsgData)
Get the total number of outbound packets that could not be transmitted because of errors.
RDK_LOG
#define RDK_LOG
Definition: rdk_debug.h:258
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_BytesReceived
int get_Device_WiFi_SSID_Stats_BytesReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of bytes received on the interface, including framing characters.
hostIf_WiFi_SSID_Stats
Definition: Device_WiFi_SSID_Stats.h:52
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_UnknownProtoPacketsReceived
int get_Device_WiFi_SSID_Stats_UnknownProtoPacketsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of packets received via the interface which were discarded because of an unknown...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_PacketsReceived
int get_Device_WiFi_SSID_Stats_PacketsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of packets received on the interface.
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_UnicastPacketsReceived
int get_Device_WiFi_SSID_Stats_UnicastPacketsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of received packets, delivered by this layer to a higher layer,...
hostIf_WiFi_SSID_Stats::get_Device_WiFi_SSID_Stats_BroadcastPacketsReceived
int get_Device_WiFi_SSID_Stats_BroadcastPacketsReceived(HOSTIF_MsgData_t *stMsgData)
Get the total number of received packets, delivered by this layer to a higher layer,...