Changed cur classid path and initialize
[platform/core/connectivity/stc-manager.git] / include / stc-manager.h
1 /*
2  * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
17 #ifndef __STC_MANAGER_H__
18 #define __STC_MANAGER_H__
19
20 #include "stc-error.h"
21 #include "stc-manager-util.h"
22
23 #define NET_RELEASE_AGENT "/usr/bin/net-cls-release"
24 #define NET_CLS_SUBSYS "net_cls"
25
26 #define STC_BACKGROUND_APP_SUFFIX "_BACKGROUND"
27 #define STC_BACKGROUND_APP_ID "BACKGROUND"
28 #define STC_TOTAL_DATACALL "TOTAL_DATACALL"
29 #define STC_TOTAL_WIFI "TOTAL_WIFI"
30 #define STC_TOTAL_BLUETOOTH "TOTAL_BLUETOOTH"
31 #define STC_TOTAL_IPV4 "TOTAL_IPV4"
32 #define STC_TOTAL_IPV6 "TOTAL_IPV6"
33
34 typedef enum {
35         STC_CANCEL = 0,    /**< cancel */
36         STC_CONTINUE = 1,  /**< continue */
37 } stc_cb_ret_e;
38
39 typedef enum {
40         STC_CMD_NONE,
41         STC_CMD_SET_FOREGRD,
42         STC_CMD_SET_BACKGRD,
43         STC_CMD_SET_APP_LAUNCHED,
44         STC_CMD_SET_SERVICE_LAUNCHED,
45         STC_CMD_SET_TERMINATED,
46         STC_CMD_MAX_ELEM
47 } stc_cmd_type_e;
48
49 /**
50  * @brief Monitored application types
51  */
52 typedef enum {
53         STC_APP_TYPE_NONE,
54         STC_APP_TYPE_READY,
55         STC_APP_TYPE_GUI,
56         STC_APP_TYPE_SERVICE,
57         STC_APP_TYPE_GROUP,
58         STC_APP_TYPE_WATCH,
59         STC_APP_TYPE_WIDGET,
60         STC_APP_TYPE_MAX,
61 } stc_app_type_e;
62
63 /**
64  * @brief State of the statisticsed process
65  */
66 typedef enum {
67         STC_APP_STATE_UNKNOWN = 0,
68         STC_APP_STATE_FOREGROUND = 1 << 1,  /** < foreground state */
69         STC_APP_STATE_BACKGROUND = 1 << 2,  /** < background state */
70         STC_APP_STATE_LAST_ELEM = 1 << 3
71 } stc_app_state_e;
72
73 /**
74  * @brief Network restriction states
75  */
76 typedef enum {
77         STC_RESTRICTION_UNKNOWN,
78         STC_RESTRICTION_ACTIVATED,  /** < restriction has been activated */
79         STC_RESTRICTION_REMOVED,    /** < restriction has been removed */
80         STC_RESTRICTION_EXCLUDED,   /** < restriction has been excluded */
81         STC_RESTRICTION_LAST_ELEM
82 } stc_restriction_state_e;
83
84 /**
85  * @brief Network interface types
86  */
87 typedef enum {
88         STC_IFACE_UNKNOWN,    /**< undefined iface */
89         STC_IFACE_DATACALL,   /**< mobile data */
90         STC_IFACE_WIFI,       /**< wifi data */
91         STC_IFACE_WIRED,      /**< wired interface */
92         STC_IFACE_BLUETOOTH,  /**< bluetooth interface */
93         STC_IFACE_IPV4,       /**< ipv4 interface */
94         STC_IFACE_IPV6,       /**< ipv6 interface */
95         STC_IFACE_ALL,        /**< enumerate all network interface types */
96         STC_IFACE_LAST_ELEM
97 } stc_iface_type_e;
98
99 /**
100  * @brief Network roaming type
101  */
102 typedef enum {
103         STC_ROAMING_UNKNOWN,   /**< can't define roaming - roaming unknown */
104         STC_ROAMING_ENABLE,    /**< in roaming */
105         STC_ROAMING_DISABLE,   /**< not in roaming */
106         STC_ROAMING_LAST_ELEM,
107 } stc_roaming_type_e;
108
109 /**
110  * @brief Hardware network protocol types
111  */
112 typedef enum {
113         STC_PROTOCOL_NONE,                /**< Network unknown */
114         STC_PROTOCOL_DATACALL_NOSVC,      /**< Network no service */
115         STC_PROTOCOL_DATACALL_EMERGENCY,  /**< Network emergency */
116         STC_PROTOCOL_DATACALL_SEARCH,     /**< Network search 1900 */
117         STC_PROTOCOL_DATACALL_2G,         /**< Network 2G */
118         STC_PROTOCOL_DATACALL_2_5G,       /**< Network 2.5G */
119         STC_PROTOCOL_DATACALL_2_5G_EDGE,  /**< Network EDGE */
120         STC_PROTOCOL_DATACALL_3G,         /**< Network UMTS */
121         STC_PROTOCOL_DATACALL_HSDPA,      /**< Network HSDPA */
122         STC_PROTOCOL_DATACALL_LTE,        /**< Network LTE */
123         STC_PROTOCOL_MAX_ELEM
124 } stc_hw_net_protocol_type_e;
125
126 /**
127  * @desc Description of the boolean option for enabling/disabling
128  *     network interfaces and enabling/disabling some behaviar
129  */
130 typedef enum {
131         STC_DB_OPTION_UNDEF,
132         STC_DB_OPTION_ENABLE,
133         STC_DB_OPTION_DISABLE
134 } stc_option_state_e;
135
136 /**
137  * @desc Set of the options.
138  * version - contains structure version
139  * wifi - enable/disable wifi, STC_DB_OPTION_UNDEF to leave option as is
140  * datacall - enable/disable datacall, STC_DB_OPTION_UNDEF to leave option as is
141  * datausage_timer - set period of the updating data from the kernel,
142  *     0 to leave option as is
143  * datacall_logging - enable/disable datacall_logging,
144  *     STC_DB_OPTION_UNDEF to leave option as is
145  */
146 typedef struct {
147         unsigned char version;
148         stc_option_state_e wifi;
149         stc_option_state_e datacall;
150         time_t datausage_timer;
151         stc_option_state_e datacall_logging;
152 } stc_options_s;
153
154 /**
155  * @brief datausage in bytes
156  */
157 typedef struct {
158         int64_t in_bytes;  /**< incoming bytes */
159         int64_t out_bytes;  /**< outgoing bytes */
160 } stc_data_counter_s;
161
162 typedef struct {
163         GMainLoop *main_loop;
164
165         gpointer statistics_obj;
166         gpointer restriction_obj;
167
168         GDBusObjectManagerServer *obj_mgr;
169         GDBusConnection *connection;
170         guint gdbus_owner_id;
171
172         void *system; /* stc_system_s */
173         struct counter_arg *carg;
174 } stc_s;
175
176 stc_s *stc_get_manager(void);
177
178 #endif /* __STC_MANAGER__ */