RDK Documentation (Open Sourced RDK Components)
Device_Ethernet_Interface_Stats.h
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  * @file Device_Ethernet_Interface_Stats.h
21  * @brief The header file provides TR069 device ethernet interface stats information APIs.
22  */
23 
24 /**
25  * @defgroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS TR-069 Object (Device.Ethernet.Interface.{i}.Stats)
26  * Throughput statistics for this interface. The CPE MUST reset the interface's Stats parameters
27  * unless otherwise stated in individual object or parameter descriptions either when the interface
28  * becomes operationally down due to a
29  * - Previous administrative down
30  * i.e. the interface's Status parameter transitions to a down state after the interface is disabled
31  * or when the interface
32  * - Becomes administratively up
33  * i.e. the interface's Enable parameter transitions from false to true.
34  * @ingroup TR69_HOSTIF_ETHERNET_INTERFACE
35  *
36  * @defgroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS_API TR-069 Object (Device.Ethernet.Interface.{i}.Stats) Public APIs
37  * Describe the details about TR-069 Device ethernet interface stats APIs specifications.
38  * @ingroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS
39  *
40  * @defgroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS_CLASSES TR-069 Object (Device.Ethernet.Interface.{i}.Stats) Public Classes
41  * Describe the details about classes used in TR-069 Device ethernet interface stats.
42  * @ingroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS
43  *
44  * @defgroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS_DSSTRUCT TR-069 Object (Device.Ethernet.Interface.{i}.Stats) Public DataStructure
45  * Describe the details about structure used in TR069 Device ethernet interface.
46  * @ingroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS
47  *
48  */
49 
50 /**
51 * @defgroup tr69hostif
52 * @{
53 * @defgroup hostif
54 * @{
55 **/
56 
57 
58 #ifndef DEVICE_ETHERNET_INTERFACE_STATS_H_
59 #define DEVICE_ETHERNET_INTERFACE_STATS_H_
60 
61 /*****************************************************************************
62  * TR069-SPECIFIC INCLUDE FILES
63  *****************************************************************************/
64 
65 #include "hostIf_main.h"
66 #include "hostIf_tr69ReqHandler.h"
67 #include "hostIf_utils.h"
68 #include "hostIf_updateHandler.h"
69 
70 
71 
72 #define LENGTH_PARAMETER 64
73 
74 /**
75  * @addtogroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS_DSSTRUCT
76  * @{
77  */
78 /**
79  * @enum EEthInterfaceStatsMembers
80  * @brief These values are the members of the EEthInterfaceStatsMembers enum.
81  */
82 typedef enum
83 {
84  eBytesSent=0,
85  eBytesReceived,
86  ePacketsSent,
87  ePacketsReceived,
88  eErrorsSent,
89  eErrorsReceived,
90  eUnicastPacketsSent,
91  eUnicastPacketsReceived,
92  eDiscardPacketsSent,
93  eDiscardPacketsReceived,
94  eMulticastPacketsSent,
95  eMulticastPacketsReceived,
96  eBroadcastPacketsSent,
97  eBroadcastPacketsReceived,
98  eUnknownProtoPacketsReceived
99 }
101 
102 /**
103  * @struct EthernetInterfaceStats
104  * @brief It contains the members variables of the EthernetInterfaceStats structure.
105  */
107 {
108  unsigned long bytesSent;
109  unsigned long bytesReceived;
110  unsigned long packetsSent;
111  unsigned long packetsReceived;
112  unsigned int errorsSent;
113  unsigned int errorsReceived;
114  unsigned long unicastPacketsSent;
115  unsigned long unicastPacketsReceived;
116  unsigned int discardPacketsSent;
117  unsigned int discardPacketsReceived;
118  unsigned long multicastPacketsSent;
119  unsigned long multicastPacketsReceived;
120  unsigned long broadcastPacketsSent;
121  unsigned long broadcastPacketsReceived;
122  unsigned int unknownProtoPacketsReceived;
123 
125 /** @} */ //End of the Doxygen tag TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS_DSSTRUCT
126 
127 /** @defgroup TR_069_DEVICE_ETHERNET_INTERFACE_STATS_API TR-069 Device.Ethernet.Interface.Stats object API.
128  * @ingroup TR_069_DEVICE_ETHERNET_INTERFACE_API
129  *
130  * The Device.Ethernet.Interface.Stats is the throughput statistics for this interface.
131  *
132  * The CPE MUST reset the interface's Stats parameters (unless otherwise stated in
133  * individual object or parameter descriptions) either when the interface becomes
134  * operationally down due to a previous administrative down (i.e. the interface's
135  * Status parameter transitions to a down state after the interface is disabled) or
136  * when the interface becomes administratively up (i.e. the interface's Enable
137  * parameter transitions from false to true).
138  *
139  */
140 
141 /** @addtogroup TR_069_DEVICE_ETHERNET_INTERFACE_STATS_GETTER_API TR-069 Device.Ethernet.Interface.Stats Getter API.
142  * @ingroup TR_069_DEVICE_ETHERNET_INTERFACE_STATS_API
143  *
144  * \section dev_ethernet_interface_stats_getter TR-069 Device.Ethernet.Interface.Stats object Getter API.
145  *
146  * This is the getter group of API for the <b>Device.Ethernet.Interface.{i}.Stats</b> object.
147  *
148  * The interface for all functions is identical and is described here.
149  *
150  * @param[in] *name This is the complete path name of the parameter extracted from
151  * soap message, e.g. ::get_Device_Ethernet_Interface_Stats_BytesSent.
152  * In this case, the path is "Device.Ethernet.Interface.{i}.Stats.BytesSent".
153  * @param[in] *type Data type of parameter defined for TR-069. This is same as the
154  * data type used in the Xi3 data-model.xml file.
155  * (see parameter.h)
156  * @param[out] *value This is the value of the parameter requested by the ACS.
157  * (see paramaccess.h)
158  *
159  * @return The status of the operation.
160  * @retval OK If parameter requested was successfully fetched. (Same as <b>NO_ERROR</b>).
161  * @retval NO_ERROR If parameter requested was successfully fetched. (Same as <b>OK</b>).
162  * @retval DIAG_ERROR Diagnostic error.
163  * @retval ERR_??? Appropriate error value otherwise (see dimark_globals.h).
164  *
165  * @todo Clarify description of DIAG_ERROR.
166  *
167  * @{
168  */
169 
170 /**
171  * @brief This class provides the interface for getting Device ethernet interface status information.
172  * @ingroup TR69_HOSTIF_ETHERNET_INTERFACE_DEVICE_STATS_CLASSES
173  */
175 
176  static GHashTable *ifHash;
177 
178  static GMutex *m_mutex;
179 
180  hostIf_EthernetInterfaceStats(int dev_id);
181 
183 
184 
185  int dev_id;
186 
187  int backupBytesSent;
188  int backupBytesReceived;
189  int backupPacketsSent;
190  int backupPacketsReceived;
191  int backupUnicastPacketsSent;
192  int backupUnicastPacketsReceived;
193  int backupMulticastPacketsReceived;
194  int backupBroadcastPacketsSent;
195  int backupBroadcastPacketsReceived;
196  int backupMulticastPacketsSent;
197  int backupErrorSent;
198  int backupErrorsReceived;
199  int backupErrorsSent;
200  int backupDiscardPacketsReceived;
201 
202  bool bCalledBytesSent ;
203  bool bCalledBytesReceived ;
204  bool bCalledPacketsSent ;
205  bool bCalledPacketsReceived ;
206  bool bCalledErrorSent ;
207  bool bCalledErrorsReceived ;
208  bool bCalledErrorsSent ;
209  bool bCalledUnicastPacketsSent ;
210  bool bCalledDiscardPacketsReceived ;
211  bool bCalledDiscardPacketsSent;
212  bool bCalledUnicastPacketsReceived ;
213  bool bCalledMulticastPacketsReceived ;
214  bool bCalledBroadcastPacketsSent ;
215  bool bCalledBroadcastPacketsReceived ;
216  bool bCalledMulticastPacketsSent ;
217  bool bCalledUnknownProtoPacketsReceived;
218 public:
219 
220  static hostIf_EthernetInterfaceStats *getInstance(int dev_id);
221 
222  static void closeInstance(hostIf_EthernetInterfaceStats *);
223 
224  static GList* getAllInstances();
225 
226  static void closeAllInstances();
227 
228  static void getLock();
229 
230  static void releaseLock();
231 
232  static EthernetInterfaceStats stEthInterfaceStats;
233 
234 
236 
237 
239 
240 
242 
243 
245 
246 
248 
249 
251 
252 
254 
255  /**
256  * @brief Get the number of unicast packets received on an Ethernet Interface.
257  *
258  * This function provides the total number of received packets, delivered by this layer to
259  * a higher layer, which were not addressed to a multicast or broadcast address at this layer.
260  *
261  * See @ref dev_ethernet_interface_stats_getter
262  *
263  */
264 
266 
267 
269 
270  /**
271  * @brief Get the number of discarded inbound packets on an Ethernet Interface.
272  *
273  * This function provides the total number of inbound packets which were chosen to be
274  * discarded even though no errors had been detected to prevent their being delivered.
275  *
276  * @note One possible reason for discarding such a packet could be to free up buffer
277  * space.
278  *
279  * See @ref dev_ethernet_interface_stats_getter
280  *
281  */
282 
284 
285  /**
286  * @brief Get the number of Multicast Packets sent on an Ethernet Interface.
287  *
288  * This function provides the total number of packets that higher-level protocols
289  * requested for transmission and which were addressed to a multicast address at
290  * this layer, including those that were discarded or not sent.
291  *
292  * See @ref dev_ethernet_interface_stats_getter
293  *
294  */
295 
297 
298  /**
299  * @brief Get the number of Multicast Packets received on an Ethernet Interface.
300  *
301  * This function provides the total number of received packets, delivered by this layer
302  * to a higher layer, which were addressed to a multicast address at this layer.
303  *
304  * See @ref dev_ethernet_interface_stats_getter
305  *
306  */
307 
309 
310 
312 
313 
315 
316 
318 
319  /* End of TR_069_DEVICE_ETHERNET_INTERFACE_STATS_GETTER_API doxygen group */
320  /**
321  * @}
322  */
323 };
324 
325 #endif /* DEVICE_ETHERNET_INTERFACE_STATS_H_ */
326 
327 
328 /** @} */
329 /** @} */
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
Device_Ethernet_Interface_Stats
Definition: Device_Ethernet_Interface_Stats.h:106
EthernetInterfaceStats
It contains the members variables of the EthernetInterfaceStats structure.
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_EthernetInterfaceStats
This class provides the interface for getting Device ethernet interface status information.
Definition: Device_Ethernet_Interface_Stats.h:174
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_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
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
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_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
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_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_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_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::hostIf_EthernetInterfaceStats
hostIf_EthernetInterfaceStats(int dev_id)
Class Constructor of the class hostIf_EthernetInterfaceStats.
Definition: Device_Ethernet_Interface_Stats.cpp:335
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
EEthInterfaceStatsMembers
EEthInterfaceStatsMembers
These values are the members of the EEthInterfaceStatsMembers enum.
Definition: Device_Ethernet_Interface_Stats.h:82
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