Add hdr and tlv of nflog for pcap
[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 #define RESTRICTION_RULE_MAC                "mac"
33
34 typedef enum {
35         RESTRICTION_UNKNOWN,
36         RESTRICTION_ACTIVATED,
37         RESTRICTION_REMOVED,
38         RESTRICTION_EXCLUDED,
39         RESTRICTION_BACKGROUND,
40         RESTRICTION_LAST_ELEM,
41 } restriction_status_e;
42
43 class RRule {
44 private:
45 public:
46         char m_AppID[APP_ID_LEN];
47         char m_IfaceName[IFNAME_LEN];
48         char m_SubscriberID[SUBSCRIBER_ID_LEN];
49         char m_Mac[MAC_LEN];
50         iface_type_e m_IfaceType;
51         int64_t m_DataLimit;
52         int64_t m_DataWarnLimit;
53         roaming_type_e m_RoamingType;
54
55         RRule();
56         ~RRule();
57 };
58
59 class Restriction : public GDbus {
60 private:
61         RRule m_Rule;
62 public:
63         Restriction();
64         ~Restriction();
65         error_e SetRule(const char *app_id, const char *iface_name,
66                 const char *subscriber_id, iface_type_e iface_type,
67                 int64_t data_limit, int64_t data_warn_limit,
68                 roaming_type_e roaming_type, const char *mac);
69         void MakeRuleParams(GVariant **params);
70         void MakeGetParams(GVariant **params);
71         void MakeStatusParams(GVariant **params);
72         error_e SetRstriction(void);
73         error_e ExcludeRstriction(void);
74         error_e UnsetRstriction(void);
75         error_e GetRstrictionStatus(restriction_status_e *status);
76         error_e GetRstriction(void);
77         error_e GetAllRstriction(void);
78 };
79
80 #endif /* __STC_MGR_RESTRICTION_H__ */