[Fix] Use localtime_r() instead of localtime()
[platform/core/connectivity/stc-manager.git] / unittest / restriction.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_RESTRICTION_H__
17 #define __STC_MGR_RESTRICTION_H__
18
19 #include <glib.h>
20 #include <gio/gio.h>
21
22 #include "stcmgr.h"
23 #include "gdbus.h"
24
25 #define RESTRICTION_RULE_APP_ID             "app_id"
26 #define RESTRICTION_RULE_IFNAME             "ifname"
27 #define RESTRICTION_RULE_IFTYPE             "iftype"
28 #define RESTRICTION_RULE_ROAMING            "roaming"
29 #define RESTRICTION_RULE_SUBSCRIBER_ID      "subscriber_id"
30 #define RESTRICTION_RULE_DATA_LIMIT         "data_limit"
31 #define RESTRICTION_RULE_DATA_WARN_LIMIT    "data_warn_limit"
32
33 typedef enum {
34         RESTRICTION_UNKNOWN,
35         RESTRICTION_ACTIVATED,
36         RESTRICTION_REMOVED,
37         RESTRICTION_EXCLUDED,
38         RESTRICTION_BACKGROUND,
39         RESTRICTION_LAST_ELEM,
40 } restriction_status_e;
41
42 class RRule {
43 private:
44 public:
45         char m_AppID[APP_ID_LEN];
46         char m_IfaceName[IFNAME_LEN];
47         char m_SubscriberID[SUBSCRIBER_ID_LEN];
48         iface_type_e m_IfaceType;
49         int64_t m_DataLimit;
50         int64_t m_DataWarnLimit;
51         roaming_type_e m_RoamingType;
52
53         RRule();
54         ~RRule();
55 };
56
57 class Restriction : public GDbus {
58 private:
59         RRule m_Rule;
60 public:
61         Restriction();
62         ~Restriction();
63         error_e SetRule(const char *app_id, const char *iface_name,
64                 const char *subscriber_id, iface_type_e iface_type,
65                 int64_t data_limit, int64_t data_warn_limit,
66                 roaming_type_e roaming_type);
67         void MakeRuleParams(GVariant **params);
68         void MakeGetParams(GVariant **params);
69         void MakeStatusParams(GVariant **params);
70         error_e SetRstriction(void);
71         error_e ExcludeRstriction(void);
72         error_e UnsetRstriction(void);
73         error_e GetRstrictionStatus(restriction_status_e *status);
74         error_e GetRstriction(void);
75         error_e GetAllRstriction(void);
76 };
77
78 #endif /* __STC_MGR_RESTRICTION_H__ */