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"
29 STC_CANCEL = 0, /**< cancel */
30 STC_CONTINUE = 1, /**< continue */
34 * @brief Monitored application types
48 * @brief State of the statisticsed process
51 STC_APP_STATE_UNKNOWN = 0,
52 STC_APP_STATE_FOREGROUND = 1 << 1, /** < foreground state */
53 STC_APP_STATE_BACKGROUND = 1 << 2, /** < background state */
54 STC_APP_STATE_LAST_ELEM = 1 << 3
58 * @brief Network restriction states
61 STC_RESTRICTION_UNKNOWN,
62 STC_RESTRICTION_ACTIVATED, /** < restriction has been activated */
63 STC_RESTRICTION_REMOVED, /** < restriction has been removed */
64 STC_RESTRICTION_EXCLUDED, /** < restriction has been excluded */
65 STC_RESTRICTION_LAST_ELEM
66 } stc_restriction_state_e;
69 * @brief Network interface types
72 STC_IFACE_UNKNOWN, /**< undefined iface */
73 STC_IFACE_DATACALL, /**< mobile data */
74 STC_IFACE_WIFI, /**< wifi data */
75 STC_IFACE_WIRED, /**< wired interface */
76 STC_IFACE_BLUETOOTH, /**< bluetooth interface */
77 STC_IFACE_ALL, /**< enumerate all network interface types */
82 * @brief Network roaming type
85 STC_ROAMING_UNKNOWN, /**< can't define roaming - roaming unknown */
86 STC_ROAMING_ENABLE, /**< in roaming */
87 STC_ROAMING_DISABLE, /**< not in roaming */
88 STC_ROAMING_LAST_ELEM,
92 * @brief Hardware network protocol types
95 STC_PROTOCOL_NONE, /**< Network unknown */
96 STC_PROTOCOL_DATACALL_NOSVC, /**< Network no service */
97 STC_PROTOCOL_DATACALL_EMERGENCY, /**< Network emergency */
98 STC_PROTOCOL_DATACALL_SEARCH, /**< Network search 1900 */
99 STC_PROTOCOL_DATACALL_2G, /**< Network 2G */
100 STC_PROTOCOL_DATACALL_2_5G, /**< Network 2.5G */
101 STC_PROTOCOL_DATACALL_2_5G_EDGE, /**< Network EDGE */
102 STC_PROTOCOL_DATACALL_3G, /**< Network UMTS */
103 STC_PROTOCOL_DATACALL_HSDPA, /**< Network HSDPA */
104 STC_PROTOCOL_DATACALL_LTE, /**< Network LTE */
105 STC_PROTOCOL_MAX_ELEM
106 } stc_hw_net_protocol_type_e;
109 * @desc Description of the boolean option for enabling/disabling
110 * network interfaces and enabling/disabling some behaviar
114 STC_DB_OPTION_ENABLE,
115 STC_DB_OPTION_DISABLE
116 } stc_option_state_e;
119 * @desc Set of the options.
120 * version - contains structure version
121 * wifi - enable/disable wifi, STC_DB_OPTION_UNDEF to leave option as is
122 * datacall - enable/disable datacall, STC_DB_OPTION_UNDEF to leave option as is
123 * datausage_timer - set period of the updating data from the kernel,
124 * 0 to leave option as is
125 * datacall_logging - enable/disable datacall_logging,
126 * STC_DB_OPTION_UNDEF to leave option as is
129 unsigned char version;
130 stc_option_state_e wifi;
131 stc_option_state_e datacall;
132 time_t datausage_timer;
133 stc_option_state_e datacall_logging;
137 * @brief datausage in bytes
140 int64_t in_bytes; /**< incoming bytes */
141 int64_t out_bytes; /**< outgoing bytes */
142 } stc_data_counter_s;
145 GMainLoop *main_loop;
147 gpointer statistics_obj;
148 gpointer restriction_obj;
150 GDBusObjectManagerServer *obj_mgr;
151 GDBusConnection *connection;
152 guint gdbus_owner_id;
154 void *system; /* stc_system_s */
155 struct counter_arg *carg;
158 stc_s *stc_get_manager(void);
160 #endif /* __STC_MANAGER__ */