Fixed document comment
[platform/core/api/smart-traffic-control.git] / include / stc.h
1 /*
2  * Smart Traffic Control (STC)
3  *
4  * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __TIZEN_STC_H__
21 #define __TIZEN_STC_H__
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file stc.h
29  */
30
31 /*****************************************************************************
32  *  Standard headers
33  *****************************************************************************/
34 #include <tizen.h>
35 #include <time.h>
36 #include <inttypes.h>
37
38 /*****************************************************************************
39  *  Macros and Typedefs
40  *****************************************************************************/
41
42 /**
43  * @addtogroup CAPI_NETWORK_STC_MODULE
44  * @{
45  */
46
47 /**
48  * @brief The smart traffic control handle.
49  * @since_tizen 4.0
50  */
51 typedef void *stc_h;
52
53 /**
54  * @}
55  */
56
57 /**
58  * @addtogroup CAPI_NETWORK_STC_STATISTICS_MODULE
59  * @{
60  */
61
62 /**
63  * @brief The statistics rule handle.
64  * @since_tizen 4.0
65  */
66 typedef void *stc_stats_rule_h;
67
68 /**
69  * @brief The statistics information handle.
70  * @since_tizen 4.0
71  */
72 typedef void *stc_stats_info_h;
73
74 /**
75  * @}
76  */
77
78 /*****************************************************************************
79  *  Enumeration
80  *****************************************************************************/
81
82 /**
83  * @addtogroup CAPI_NETWORK_STC_MODULE
84  * @{
85  */
86
87 #ifndef TIZEN_ERROR_STC
88 #define TIZEN_ERROR_STC -0x02F80000
89 #endif
90
91 /**
92  * @brief Enumeration for Smart Traffic Control (STC) error type.
93  * @since_tizen 4.0
94  */
95 typedef enum {
96         STC_ERROR_NONE = TIZEN_ERROR_NONE,                           /**< Successful */
97         STC_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED,         /**< Operation not permitted(1) */
98         STC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,         /**< Out of memory(12) */
99         STC_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied(13) */
100         STC_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,         /**< Device or resource busy(16) */
101         STC_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation(38) */
102         STC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid function parameter(22) */
103         STC_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,         /**< Not supported */
104
105         STC_ERROR_OPERATION_FAILED = TIZEN_ERROR_STC|0x01,           /**< Operation failed */
106         STC_ERROR_NOT_INITIALIZED = TIZEN_ERROR_STC|0x02,            /**< Not initialized */
107         STC_ERROR_ALREADY_INITIALIZED = TIZEN_ERROR_STC|0x03,        /**< Already initialized */
108         STC_ERROR_IN_PROGRESS = TIZEN_ERROR_STC|0x04,                /**< In progress */
109 } stc_error_e;
110
111
112 /**
113  * @}
114  */
115
116 /**
117  * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE
118  * @{
119  */
120
121 /**
122  * @brief Enumeration for time period.
123  * @since_tizen 4.0
124  */
125 typedef enum {
126         STC_TIME_PERIOD_UNKNOWN = 0,          /**< Unknown */
127         STC_TIME_PERIOD_HOUR = 3600,          /**< Hour */
128         STC_TIME_PERIOD_DAY = 86400,          /**< Day */
129         STC_TIME_PERIOD_WEEK = 604800,        /**< Week */
130         STC_TIME_PERIOD_MONTH = 2419200,      /**< Month */
131 } stc_time_period_e;
132
133 /**
134  * @brief Enumeration for network interface type.
135  * @since_tizen 4.0
136  */
137 typedef enum {
138         STC_IFACE_UNKNOWN,      /**< Unknown interface */
139         STC_IFACE_DATACALL,     /**< Mobile data */
140         STC_IFACE_WIFI,         /**< Wifi data */
141         STC_IFACE_WIRED,        /**< Wired interface */
142         STC_IFACE_BLUETOOTH,    /**< Bluetooth interface */
143         STC_IFACE_ALL,          /**< Enumerate all network interface types */
144 } stc_iface_type_e;
145
146 /**
147  * @brief Enumeration for network roaming type.
148  * @since_tizen 4.0
149  */
150 typedef enum {
151         STC_ROAMING_UNKNOWN,     /**< Roaming unknown */
152         STC_ROAMING_ENABLED,     /**< In roaming */
153         STC_ROAMING_DISABLED,    /**< Not in roaming */
154 } stc_roaming_type_e;
155
156 /**
157  * @brief Enumeration for hardware network protocol type.
158  * @since_tizen 4.0
159  */
160 typedef enum {
161         STC_PROTOCOL_UNKNOWN,               /**< Network unknown */
162         STC_PROTOCOL_DATACALL_NOSVC,        /**< Network no service */
163         STC_PROTOCOL_DATACALL_EMERGENCY,    /**< Network emergency */
164         STC_PROTOCOL_DATACALL_SEARCH,       /**< Network search 1900 */
165         STC_PROTOCOL_DATACALL_2G,           /**< Network 2G */
166         STC_PROTOCOL_DATACALL_2_5G,         /**< Network 2.5G */
167         STC_PROTOCOL_DATACALL_2_5G_EDGE,    /**< Network EDGE */
168         STC_PROTOCOL_DATACALL_3G,           /**< Network UMTS */
169         STC_PROTOCOL_DATACALL_HSDPA,        /**< Network HSDPA */
170         STC_PROTOCOL_DATACALL_LTE,          /**< Network LTE */
171 } stc_protocol_type_e;
172
173 /**
174  * @brief Enumeration for monitored process state.
175  * @since_tizen 4.0
176  */
177 typedef enum {
178         STC_PROCESS_STATE_UNKNOWN,         /**< Unknown state */
179         STC_PROCESS_STATE_FOREGROUND,      /**< Foreground state */
180         STC_PROCESS_STATE_BACKGROUND,      /**< Background state */
181 } stc_process_state_e;
182
183 /**
184  * @brief Enumeration for network connection period type.
185  * @details Last received/sent mean counting data from the first connection of each interface.
186  * @since_tizen 4.0
187  */
188 typedef enum {
189         STC_CONN_PERIOD_UNKNOWN,                /**< Unknown period */
190         STC_CONN_PERIOD_LAST_RECEIVED_DATA,     /**< Last received data */
191         STC_CONN_PERIOD_LAST_SENT_DATA,         /**< Last sent data */
192         STC_CONN_PERIOD_TOTAL_RECEIVED_DATA,    /**< Total received data */
193         STC_CONN_PERIOD_TOTAL_SENT_DATA,        /**< Total sent data */
194 } stc_conn_period_e;
195
196 /**
197  * @brief Enumeration for return type of the callback.
198  * @since_tizen 4.0
199  */
200 typedef enum {
201         STC_CALLBACK_CANCEL,        /**< Cancel */
202         STC_CALLBACK_CONTINUE,      /**< Continue */
203 } stc_callback_ret_e;
204
205 /**
206  * @}
207  */
208
209 /*****************************************************************************
210  *  Callback functions
211  *****************************************************************************/
212
213 /**
214  * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE
215  * @{
216  */
217
218 /**
219  * @brief Called for each available statistics information.
220  * @since_tizen 4.0
221  *
222  * @param[in] result        The result, one of:\n
223  *   #STC_ERROR_INVALID_OPERATION   No reply\n
224  *   #STC_ERROR_OPERATION_FAILED    Operation failed\n
225  *   #STC_ERROR_PERMISSION_DENIED   Access or permission denied
226  * @param[in] info          The statistics information handle
227  * @param[in] user_data     The user data passed from the statistics provider function
228  * @return  #STC_CALLBACK_CONTINUE to continue with the next iteration of the loop,
229  * otherwise #STC_CALLBACK_CANCEL to break out of the loop
230  *
231  * @pre stc_get_stats() will invoke this callback.
232  * @pre stc_foreach_stats() will invoke this callback.
233  * @pre stc_get_total_stats() will invoke this callback.
234  * @see stc_stats_info_get_app_id()
235  * @see stc_stats_info_get_iface_name()
236  * @see stc_stats_info_get_time_interval()
237  * @see stc_stats_info_get_iface_type()
238  * @see stc_stats_info_get_counter()
239  * @see stc_stats_info_get_roaming_type()
240  * @see stc_stats_info_get_protocol_type()
241  * @see stc_stats_info_get_process_state()
242  * @see stc_get_stats()
243  * @see stc_foreach_stats()
244  * @see stc_get_total_stats()
245  */
246 typedef stc_callback_ret_e (*stc_stats_info_cb)(
247                 stc_error_e result, stc_stats_info_h info, void *user_data);
248
249 /**
250  * @}
251  */
252
253
254 /*****************************************************************************
255  *  Core API functions
256  *****************************************************************************/
257
258
259 /**
260  * @addtogroup CAPI_NETWORK_STC_MODULE
261  * @{
262  */
263
264 /**
265  * @brief Initializes STC (Smart Traffic Control).
266  * @since_tizen 4.0
267  * @privlevel public
268  * @privilege %http://tizen.org/privilege/network.get
269  * @remarks You must release @a handle using stc_deinitialize().
270  *
271  * @param[out] stc The STC handle
272  *
273  * @return 0 on success, otherwise a negative error value
274  * @retval #STC_ERROR_NONE                    Successful
275  * @retval #STC_ERROR_OPERATION_FAILED        General error
276  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
277  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
278  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
279  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
280  * @retval #STC_ERROR_PERMISSION_DENIED       Permission denied
281  *
282  * @see stc_h
283  * @see stc_deinitialize()
284  */
285 int stc_initialize(stc_h *stc);
286
287 /**
288  * @brief Deinitializes STC.
289  * @since_tizen 4.0
290  *
291  * @param[in] stc The STC handle
292  *
293  * @return 0 on success, otherwise a negative error value
294  * @retval #STC_ERROR_NONE                    Successful
295  * @retval #STC_ERROR_OPERATION_FAILED        General error
296  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
297  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
298  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
299  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
300  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
301  *
302  * @see stc_h
303  * @see stc_initialize()
304  */
305 int stc_deinitialize(stc_h stc);
306
307
308 /**
309  * @}
310  */
311
312 /**
313  * @addtogroup CAPI_NETWORK_STC_MANAGER_MODULE
314  * @{
315  */
316
317 /**
318  * @brief Gets the statistics information an application matched rule asynchronously.
319  * @since_tizen 4.0
320  * @privlevel public
321  * @privilege %http://tizen.org/privilege/network.get
322  *
323  * @param[in] stc           The STC handle
324  * @param[in] rule          The statistics rule handle
325  * @param[in] info_cb       The callback is called for each application
326  * that used network in between timestamps specified
327  * @param[in] user_data     The user data passed to the callback function
328  *
329  * @return 0 on success, otherwise a negative error value
330  * @retval #STC_ERROR_NONE                    Successful
331  * @retval #STC_ERROR_OPERATION_FAILED        General error
332  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
333  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
334  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
335  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
336  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
337  * @retval #STC_ERROR_PERMISSION_DENIED       Permission denied
338  *
339  * @see stc_h
340  * @see stc_stats_rule_h
341  * @see stc_initialize()
342  * @see stc_stats_rule_create()
343  * @see stc_stats_rule_destroy()
344  * @see stc_stats_rule_set_app_id()
345  * @see stc_stats_rule_set_time_interval()
346  * @see stc_stats_rule_set_iface_type()
347  * @see stc_stats_rule_set_time_period()
348  * @see stc_stats_rule_get_app_id()
349  * @see stc_stats_rule_get_time_interval()
350  * @see stc_stats_rule_get_iface_type()
351  * @see stc_stats_rule_get_time_period()
352  * @see stc_stats_info_cb()
353  * @see stc_foreach_stats()
354  * @see stc_get_total_stats()
355  */
356 int stc_get_stats(stc_h stc, stc_stats_rule_h rule,
357                   stc_stats_info_cb info_cb, void *user_data);
358
359 /**
360  * @brief Gets the statistics information of each application asynchronously.
361  * @details The callback is called for each application that used network
362  * in between timestamps specified.
363  * If interface name is not specified, each application will only appear
364  * once with the total traffic used over all interfaces.
365  *
366  * @since_tizen 4.0
367  * @privlevel public
368  * @privilege %http://tizen.org/privilege/network.get
369  *
370  * @param[in] stc           The STC handle
371  * @param[in] rule          The statistics rule handle
372  * @param[in] info_cb The callback is called for each application
373  * that used network in between timestamps specified
374  * @param[in] user_data     The user data passed to the callback function
375  *
376  * @return 0 on success, otherwise a negative error value
377  * @retval #STC_ERROR_NONE                    Successful
378  * @retval #STC_ERROR_OPERATION_FAILED        General error
379  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
380  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
381  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
382  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
383  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
384  * @retval #STC_ERROR_PERMISSION_DENIED       Permission denied
385  *
386  * @see stc_h
387  * @see stc_stats_rule_h
388  * @see stc_initialize()
389  * @see stc_stats_rule_create()
390  * @see stc_stats_rule_destroy()
391  * @see stc_stats_rule_set_app_id()
392  * @see stc_stats_rule_set_time_interval()
393  * @see stc_stats_rule_set_iface_type()
394  * @see stc_stats_rule_set_time_period()
395  * @see stc_stats_rule_get_app_id()
396  * @see stc_stats_rule_get_time_interval()
397  * @see stc_stats_rule_get_iface_type()
398  * @see stc_stats_rule_get_time_period()
399  * @see stc_stats_info_cb()
400  * @see stc_get_stats()
401  * @see stc_get_total_stats()
402  */
403 int stc_foreach_stats(stc_h stc, stc_stats_rule_h rule,
404                 stc_stats_info_cb info_cb, void *user_data);
405
406 /**
407  * @brief Gets the total statistics information by interface type asynchronously.
408  * @since_tizen 4.0
409  * @privlevel public
410  * @privilege %http://tizen.org/privilege/network.get
411  *
412  * @param[in] stc           The STC handle
413  * @param[in] rule          The statistics rule handle
414  * @param[in] info_cb       The callback is called for each application
415  * that used network in between timestamps specified
416  * @param[in] user_data     The user data passed to the callback function
417  *
418  * @return 0 on success, otherwise a negative error value
419  * @retval #STC_ERROR_NONE                    Successful
420  * @retval #STC_ERROR_OPERATION_FAILED        General error
421  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
422  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
423  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
424  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
425  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
426  * @retval #STC_ERROR_PERMISSION_DENIED       Permission denied
427  *
428  * @see stc_h
429  * @see stc_stats_rule_h
430  * @see stc_initialize()
431  * @see stc_stats_rule_create()
432  * @see stc_stats_rule_destroy()
433  * @see stc_stats_rule_set_app_id()
434  * @see stc_stats_rule_set_time_interval()
435  * @see stc_stats_rule_set_iface_type()
436  * @see stc_stats_rule_set_time_period()
437  * @see stc_stats_rule_get_app_id()
438  * @see stc_stats_rule_get_time_interval()
439  * @see stc_stats_rule_get_iface_type()
440  * @see stc_stats_rule_get_time_period()
441  * @see stc_stats_info_cb()
442  * @see stc_get_stats()
443  * @see stc_foreach_stats()
444  */
445 int stc_get_total_stats(stc_h stc, stc_stats_rule_h rule,
446                 stc_stats_info_cb info_cb,      void *user_data);
447
448 /**
449  * @}
450  */
451
452 /**
453  * @addtogroup CAPI_NETWORK_STC_STATISTICS_MODULE
454  * @{
455  */
456
457
458 /**
459  * @brief Creates the statistics rule handle.
460  * @since_tizen 4.0
461  * @remarks You must release @a handle using stc_stats_rule_destroy().
462  *
463  * @param[in] stc           The STC handle
464  * @param[out] rule         The statistics rule handle
465  *
466  * @return 0 on success, otherwise a negative error value
467  * @retval #STC_ERROR_NONE                    Successful
468  * @retval #STC_ERROR_OPERATION_FAILED        General error
469  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
470  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
471  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
472  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
473  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
474  *
475  * @see stc_h
476  * @see stc_stats_rule_h
477  * @see stc_initialize()
478  * @see stc_stats_rule_destroy()
479  */
480 int stc_stats_rule_create(stc_h stc, stc_stats_rule_h *rule);
481
482 /**
483  * @brief Destroys the statistics rule handle.
484  * @since_tizen 4.0
485  *
486  * @param[in] rule          The statistics rule handle
487  *
488  * @return 0 on success, otherwise a negative error value
489  * @retval #STC_ERROR_NONE                    Successful
490  * @retval #STC_ERROR_OPERATION_FAILED        General error
491  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
492  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
493  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
494  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
495  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
496  *
497  * @see stc_stats_rule_h
498  * @see stc_stats_rule_create()
499  */
500 int stc_stats_rule_destroy(stc_stats_rule_h rule);
501
502 /**
503  * @brief Sets the application ID for statistics rule.
504  * @since_tizen 4.0
505  *
506  * @param[in] rule          The statistics rule handle
507  * @param[in] app_id        The application ID
508  *
509  * @return 0 on success, otherwise a negative error value
510  * @retval #STC_ERROR_NONE                    Successful
511  * @retval #STC_ERROR_OPERATION_FAILED        General error
512  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
513  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
514  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
515  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
516  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
517  *
518  * @see stc_stats_rule_h
519  * @see stc_stats_rule_create()
520  * @see stc_stats_rule_destroy()
521  * @see stc_stats_rule_get_app_id()
522  */
523 int stc_stats_rule_set_app_id(stc_stats_rule_h rule,
524                 const char *app_id);
525
526 /**
527  * @brief Sets the time interval for statistics rule.
528  * @since_tizen 4.0
529  *
530  * @param[in] rule          The statistics rule handle
531  * @param[in] from          The beginning of the time interval
532  * @param[in] to            The end of the time interval
533  *
534  * @return 0 on success, otherwise a negative error value
535  * @retval #STC_ERROR_NONE                    Successful
536  * @retval #STC_ERROR_OPERATION_FAILED        General error
537  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
538  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
539  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
540  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
541  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
542  *
543  * @see stc_stats_rule_h
544  * @see stc_stats_rule_create()
545  * @see stc_stats_rule_destroy()
546  * @see stc_stats_rule_get_time_interval()
547  */
548 int stc_stats_rule_set_time_interval(stc_stats_rule_h rule,
549                 time_t from, time_t to);
550
551 /**
552  * @brief Sets the interface type for statistics rule.
553  * @since_tizen 4.0
554  *
555  * @param[in] rule          The stats rule handle
556  * @param[in] iface_type    The interface type
557  *
558  * @return 0 on success, otherwise a negative error value
559  * @retval #STC_ERROR_NONE                    Successful
560  * @retval #STC_ERROR_OPERATION_FAILED        General error
561  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
562  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
563  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
564  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
565  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
566  *
567  * @see stc_stats_rule_h
568  * @see stc_iface_type_e
569  * @see stc_stats_rule_create()
570  * @see stc_stats_rule_destroy()
571  * @see stc_stats_rule_get_iface_type()
572  */
573 int stc_stats_rule_set_iface_type(stc_stats_rule_h rule,
574                 stc_iface_type_e iface_type);
575
576 /**
577  * @brief Sets the time period for statistics rule.
578  * @since_tizen 4.0
579  *
580  * @param[in] rule          The statistics rule handle
581  * @param[in] time_period   The time period
582  *
583  * @return 0 on success, otherwise a negative error value
584  * @retval #STC_ERROR_NONE                    Successful
585  * @retval #STC_ERROR_OPERATION_FAILED        General error
586  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
587  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
588  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
589  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
590  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
591  *
592  * @see stc_stats_rule_h
593  * @see stc_time_period_e
594  * @see stc_stats_rule_create()
595  * @see stc_stats_rule_destroy()
596  * @see stc_stats_rule_get_time_period()
597  */
598 int stc_stats_rule_set_time_period(stc_stats_rule_h rule,
599                 stc_time_period_e time_period);
600
601 /**
602  * @brief Gets the application ID for statistics rule.
603  * @since_tizen 4.0
604  * @remarks You must release @a app_id using free().
605  *
606  * @param[in] rule          The statistics rule handle
607  * @param[out] app_id       The application ID
608  *
609  * @return 0 on success, otherwise a negative error value
610  * @retval #STC_ERROR_NONE                    Successful
611  * @retval #STC_ERROR_OPERATION_FAILED        General error
612  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
613  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
614  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
615  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
616  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
617  *
618  * @see stc_stats_rule_h
619  * @see stc_stats_rule_create()
620  * @see stc_stats_rule_destroy()
621  * @see stc_stats_rule_set_app_id()
622  */
623 int stc_stats_rule_get_app_id(stc_stats_rule_h rule, char **app_id);
624
625 /**
626  * @brief Gets the time interval for statistics rule.
627  * @since_tizen 4.0
628  *
629  * @param[in] rule          The statistics rule handle
630  * @param[out] from         The beginning of the time interval
631  * @param[out] to           The end of the time interval
632  *
633  * @return 0 on success, otherwise a negative error value
634  * @retval #STC_ERROR_NONE                    Successful
635  * @retval #STC_ERROR_OPERATION_FAILED        General error
636  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
637  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
638  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
639  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
640  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
641  *
642  * @see stc_stats_rule_h
643  * @see stc_stats_rule_create()
644  * @see stc_stats_rule_destroy()
645  * @see stc_stats_rule_set_time_interval()
646  */
647 int stc_stats_rule_get_time_interval(stc_stats_rule_h rule,
648                 time_t *from, time_t *to);
649
650 /**
651  * @brief Gets the interface type for statistics rule.
652  * @since_tizen 4.0
653  *
654  * @param[in] rule          The statistics rule handle
655  * @param[out] iface_type   The interface type
656  *
657  * @return 0 on success, otherwise a negative error value
658  * @retval #STC_ERROR_NONE                    Successful
659  * @retval #STC_ERROR_OPERATION_FAILED        General error
660  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
661  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
662  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
663  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
664  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
665  *
666  * @see stc_stats_rule_h
667  * @see stc_iface_type_e
668  * @see stc_stats_rule_create()
669  * @see stc_stats_rule_destroy()
670  * @see stc_stats_rule_set_iface_type()
671  */
672 int stc_stats_rule_get_iface_type(stc_stats_rule_h rule,
673                 stc_iface_type_e *iface_type);
674
675 /**
676  * @brief Gets the time period for statistics rule.
677  * @since_tizen 4.0
678  *
679  * @param[in] rule          The statistics rule handle
680  * @param[out] time_period  The time period
681  *
682  * @return 0 on success, otherwise a negative error value
683  * @retval #STC_ERROR_NONE                    Successful
684  * @retval #STC_ERROR_OPERATION_FAILED        General error
685  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
686  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
687  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
688  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
689  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
690  *
691  * @see stc_stats_rule_h
692  * @see stc_time_period_e
693  * @see stc_stats_rule_create()
694  * @see stc_stats_rule_destroy()
695  * @see stc_stats_rule_set_time_period()
696  */
697 int stc_stats_rule_get_time_period(stc_stats_rule_h rule,
698                 stc_time_period_e *time_period);
699
700 /**
701  * @brief Gets the application ID from statistics information.
702  * @since_tizen 4.0
703  * @remarks You must release @a app_id using free().
704  *
705  * @param[in] info          The statistics information handle
706  * @param[out] app_id       The application ID
707  *
708  * @return 0 on success, otherwise a negative error value
709  * @retval #STC_ERROR_NONE                    Successful
710  * @retval #STC_ERROR_OPERATION_FAILED        General error
711  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
712  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
713  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
714  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
715  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
716  *
717  * @see stc_stats_info_h
718  * @see stc_stats_info_cb()
719  */
720 int stc_stats_info_get_app_id(stc_stats_info_h info, char **app_id);
721
722 /**
723  * @brief Gets the interface name from statistics information.
724  * @since_tizen 4.0
725  * @remarks You must release @a iface_name using free().
726  *
727  * @param[in] info          The statistics information handle
728  * @param[out] iface_name   The interface name
729  *
730  * @return 0 on success, otherwise a negative error value
731  * @retval #STC_ERROR_NONE                    Successful
732  * @retval #STC_ERROR_OPERATION_FAILED        General error
733  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
734  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
735  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
736  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
737  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
738  *
739  * @see stc_stats_info_h
740  * @see stc_stats_info_cb()
741  */
742 int stc_stats_info_get_iface_name(stc_stats_info_h info, char **iface_name);
743
744 /**
745  * @brief Gets the time interval from statistics information.
746  * @since_tizen 4.0
747  *
748  * @param[in] info          The statistics information handle
749  * @param[out] from         The beginning of the time interval
750  * @param[out] to           The end of the time interval
751  *
752  * @return 0 on success, otherwise a negative error value
753  * @retval #STC_ERROR_NONE                    Successful
754  * @retval #STC_ERROR_OPERATION_FAILED        General error
755  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
756  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
757  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
758  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
759  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
760  *
761  * @see stc_stats_info_h
762  * @see stc_stats_info_cb()
763  */
764 int stc_stats_info_get_time_interval(stc_stats_info_h info,
765                 time_t *from, time_t *to);
766
767 /**
768  * @brief Gets the interface type from statistics information.
769  * @since_tizen 4.0
770  *
771  * @param[in] info          The statistics information handle
772  * @param[out] iface_type   The interface type
773  *
774  * @return 0 on success, otherwise a negative error value
775  * @retval #STC_ERROR_NONE                    Successful
776  * @retval #STC_ERROR_OPERATION_FAILED        General error
777  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
778  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
779  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
780  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
781  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
782  *
783  * @see stc_stats_info_h
784  * @see stc_iface_type_e
785  * @see stc_stats_info_cb()
786  */
787 int stc_stats_info_get_iface_type(stc_stats_info_h info,
788                 stc_iface_type_e *iface_type);
789
790 /**
791  * @brief Gets the counters from statistics information.
792  * @since_tizen 4.0
793  *
794  * @param[in] info          The statistics information handle
795  * @param[out] incoming     The incoming counter
796  * @param[out] outgoing     The outgoing counter
797  *
798  * @return 0 on success, otherwise a negative error value
799  * @retval #STC_ERROR_NONE                    Successful
800  * @retval #STC_ERROR_OPERATION_FAILED        General error
801  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
802  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
803  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
804  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
805  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
806  *
807  * @see stc_stats_info_h
808  * @see stc_stats_info_cb()
809  */
810 int stc_stats_info_get_counter(stc_stats_info_h info,
811                 int64_t *incoming, int64_t *outgoing);
812
813 /**
814  * @brief Gets the roaming type from statistics information.
815  * @since_tizen 4.0
816  *
817  * @param[in] info          The statistics information handle
818  * @param[out] roaming_type The roaming type
819  *
820  * @return 0 on success, otherwise a negative error value
821  * @retval #STC_ERROR_NONE                    Successful
822  * @retval #STC_ERROR_OPERATION_FAILED        General error
823  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
824  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
825  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
826  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
827  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
828  *
829  * @see stc_stats_info_h
830  * @see stc_roaming_type_e
831  * @see stc_stats_info_cb()
832  */
833 int stc_stats_info_get_roaming_type(stc_stats_info_h info,
834                 stc_roaming_type_e *roaming_type);
835
836 /**
837  * @brief Gets the protocol type from statistics information.
838  * @since_tizen 4.0
839  *
840  * @param[in] info          The statistics information handle
841  * @param[out] protocol     The protocol type
842  *
843  * @return 0 on success, otherwise a negative error value
844  * @retval #STC_ERROR_NONE                    Successful
845  * @retval #STC_ERROR_OPERATION_FAILED        General error
846  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
847  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
848  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
849  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
850  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
851  *
852  * @see stc_stats_info_h
853  * @see stc_protocol_type_e
854  * @see stc_stats_info_cb()
855  */
856 int stc_stats_info_get_protocol_type(stc_stats_info_h info,
857                 stc_protocol_type_e *protocol);
858
859 /**
860  * @brief Gets the process state from statistics information.
861  * @since_tizen 4.0
862  *
863  * @param[in] info          The statistics information handle
864  * @param[out] state        The process state
865  *
866  * @return 0 on success, otherwise a negative error value
867  * @retval #STC_ERROR_NONE                    Successful
868  * @retval #STC_ERROR_OPERATION_FAILED        General error
869  * @retval #STC_ERROR_OUT_OF_MEMORY           Out of memory
870  * @retval #STC_ERROR_INVALID_PARAMETER       Invalid parameter
871  * @retval #STC_ERROR_INVALID_OPERATION       Invalid operation
872  * @retval #STC_ERROR_NOT_INITIALIZED         Not initialized
873  * @retval #STC_ERROR_NOT_SUPPORTED           Not supported
874  *
875  * @see stc_stats_info_h
876  * @see stc_process_state_e
877  * @see stc_stats_info_cb()
878  */
879 int stc_stats_info_get_process_state(stc_stats_info_h info,
880                 stc_process_state_e *state);
881
882
883 /**
884  * @}
885  */
886
887 #ifdef __cplusplus
888 }
889 #endif
890
891 #endif /* __TIZEN_STC_H__ */