2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __STC_MANAGER_H__
18 #define __STC_MANAGER_H__
20 #include "stc-error.h"
21 #include "stc-manager-util.h"
23 #define NET_RELEASE_AGENT "/usr/bin/net-cls-release"
24 #define NET_CLS_SUBSYS "net_cls"
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"
34 #define STC_DEBUG_LOG (stc_util_get_debuglog())
37 STC_CANCEL = 0, /**< cancel */
38 STC_CONTINUE = 1, /**< continue */
45 STC_CMD_SET_APP_LAUNCHED,
46 STC_CMD_SET_SERVICE_LAUNCHED,
47 STC_CMD_SET_TERMINATED,
52 * @brief Monitored application types
66 * @brief State of the statisticsed process
69 STC_APP_STATE_UNKNOWN = 0,
70 STC_APP_STATE_FOREGROUND = 1 << 1, /** < foreground state */
71 STC_APP_STATE_BACKGROUND = 1 << 2, /** < background state */
72 STC_APP_STATE_LAST_ELEM = 1 << 3
76 * @brief Network restriction states
79 STC_RESTRICTION_UNKNOWN,
80 STC_RESTRICTION_ACTIVATED, /** < restriction has been activated */
81 STC_RESTRICTION_REMOVED, /** < restriction has been removed */
82 STC_RESTRICTION_EXCLUDED, /** < restriction has been excluded */
83 STC_RESTRICTION_LAST_ELEM
84 } stc_restriction_state_e;
87 * @brief Network interface types
90 STC_IFACE_UNKNOWN, /**< undefined iface */
91 STC_IFACE_DATACALL, /**< mobile data */
92 STC_IFACE_WIFI, /**< wifi data */
93 STC_IFACE_WIRED, /**< wired interface */
94 STC_IFACE_BLUETOOTH, /**< bluetooth interface */
95 STC_IFACE_IPV4, /**< ipv4 interface */
96 STC_IFACE_IPV6, /**< ipv6 interface */
97 STC_IFACE_ALL, /**< enumerate all network interface types */
102 * @brief Network roaming type
105 STC_ROAMING_UNKNOWN, /**< can't define roaming - roaming unknown */
106 STC_ROAMING_ENABLE, /**< in roaming */
107 STC_ROAMING_DISABLE, /**< not in roaming */
108 STC_ROAMING_LAST_ELEM,
109 } stc_roaming_type_e;
112 * @brief Hardware network protocol types
115 STC_PROTOCOL_NONE, /**< Network unknown */
116 STC_PROTOCOL_DATACALL_NOSVC, /**< Network no service */
117 STC_PROTOCOL_DATACALL_EMERGENCY, /**< Network emergency */
118 STC_PROTOCOL_DATACALL_SEARCH, /**< Network search 1900 */
119 STC_PROTOCOL_DATACALL_2G, /**< Network 2G */
120 STC_PROTOCOL_DATACALL_2_5G, /**< Network 2.5G */
121 STC_PROTOCOL_DATACALL_2_5G_EDGE, /**< Network EDGE */
122 STC_PROTOCOL_DATACALL_3G, /**< Network UMTS */
123 STC_PROTOCOL_DATACALL_HSDPA, /**< Network HSDPA */
124 STC_PROTOCOL_DATACALL_LTE, /**< Network LTE */
125 STC_PROTOCOL_MAX_ELEM
126 } stc_hw_net_protocol_type_e;
129 * @desc Description of the boolean option for enabling/disabling
130 * network interfaces and enabling/disabling some behaviar
134 STC_DB_OPTION_ENABLE,
135 STC_DB_OPTION_DISABLE
136 } stc_option_state_e;
139 * @desc Set of the options.
140 * wifi - enable/disable wifi, STC_DB_OPTION_UNDEF to leave option as is
141 * datacall - enable/disable datacall, STC_DB_OPTION_UNDEF to leave option as is
142 * datausage_timer - set period of the updating data from the kernel,
143 * 0 to leave option as is
144 * datacall_logging - enable/disable datacall_logging,
145 * STC_DB_OPTION_UNDEF to leave option as is
148 stc_option_state_e wifi;
149 stc_option_state_e datacall;
150 time_t datausage_timer;
151 stc_option_state_e datacall_logging;
155 * @brief datausage in bytes
158 int64_t in_bytes; /**< incoming bytes */
159 int64_t out_bytes; /**< outgoing bytes */
160 } stc_data_counter_s;
163 GMainLoop *main_loop;
165 gpointer statistics_obj;
166 gpointer restriction_obj;
167 gpointer manager_obj;
169 GDBusObjectManagerServer *obj_mgr;
170 GDBusConnection *connection;
171 guint gdbus_owner_id;
173 void *system; /* stc_system_s */
174 struct counter_arg *carg;
177 stc_s *stc_get_manager(void);
178 void stc_stop_manager(void);
180 #endif /* __STC_MANAGER__ */