Merge "Added additional test cases for stc-manager firewall dbus methods" into tizen
[platform/core/connectivity/stc-manager.git] / unittest / statistics.h
1 /*
2  * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef __STC_MGR_STATISTICS_H__
17 #define __STC_MGR_STATISTICS_H__
18
19 #include "stcmgr.h"
20 #include "gdbus.h"
21
22 #define STATISTICS_RULE_APP_ID           "app_id"
23 #define STATISTICS_RULE_INTERVAL_FROM    "from"
24 #define STATISTICS_RULE_INTERVAL_TO      "to"
25 #define STATISTICS_RULE_IFTYPE           "iftype"
26 #define STATISTICS_RULE_TIME_PERIOD      "granularity"
27
28 #define RESET_RULE_SUBSCRIBER_ID         "subscriber_id"
29
30 typedef struct {
31         time_t from;
32         time_t to;
33 } time_interval_s;
34
35 class SRule {
36 private:
37 public:
38         char m_AppID[APP_ID_LEN];
39         char m_SubscriberID[SUBSCRIBER_ID_LEN];
40         iface_type_e m_IfaceType;
41         time_period_e m_TimePeriod;
42         time_interval_s m_Interval;
43
44         SRule();
45         ~SRule();
46 };
47
48 class Statistics : public GDbus {
49 private:
50         SRule m_Rule;
51 public:
52         Statistics();
53         ~Statistics();
54         error_e SetRule(const char *app_id,  const char *subscriber_id,
55                 iface_type_e iface_type, time_t from, time_t to, time_period_e time_period);
56         time_t MakeTime(int year, int mon, int day, int hour, int min);
57         void MakeRuleParams(GVariant **params, int mode);
58         error_e InitStatistics(void);
59         error_e GetStatistics(void);
60         error_e GetTotalStatistics(void);
61         error_e GetAllStatistics(void);
62         error_e ResetStatistics(void);
63 };
64
65
66 #endif /* __STC_MGR_STATISTICS_H__ */