Separate monitoring function plugin
[platform/core/connectivity/stc-manager.git] / plugin / monitor / include / stc-plugin-monitor.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_PLUGIN_MONITOR_H__
18 #define __STC_PLUGIN_MONITOR_H__
19
20 #include <glib.h>
21 #include "stc-error.h"
22 #include "stc-manager.h"
23 #include "stc-manager-util.h"
24 #include "stc-plugin-monitor-context.h"
25 #include "stc-plugin-monitor-app.h"
26 #include "stc-plugin-monitor-proc.h"
27 #include "stc-plugin-monitor-rstn.h"
28 #include "helper-nl.h"
29
30 /* 1 seconds */
31 #define CONTR_TIMER_INTERVAL 1
32
33 #ifndef VCONFKEY_STC_BACKGROUND_STATE
34 #define VCONFKEY_STC_BACKGROUND_STATE "db/stc/background_state"
35 #endif
36
37 #ifndef VCONFKEY_SETAPPL_DATA_RESTRICTION_INT
38 #define VCONFKEY_SETAPPL_DATA_RESTRICTION_INT "db/setting/data_restriction"
39 #endif
40
41 typedef struct {
42         int (*initialize_plugin) (void);
43         int (*deinitialize_plugin) (void);
44
45         int (*add_application) (uint32_t classid,
46                                 const char *app_id,
47                                 const char *pkg_id,
48                                 const stc_app_value_s value);
49         int (*remove_application) (uint32_t classid,
50                                 const char *app_id);
51
52         int (*add_restriction) (const table_restrictions_info *info);
53         int (*remove_restriction) (const table_restrictions_info *info);
54         int (*lookup_application) (uint32_t classid);
55
56         int (*init_connection) (stc_s *stc);
57         int (*deinit_connection) (stc_s *stc);
58
59         int (*add_process) (uint32_t classid,
60                                 const char *app_id,
61                                 const stc_proc_value_s value);
62         int (*remove_process) (uint32_t classid, pid_t pid);
63         int (*move_process) (uint32_t from, uint32_t to);
64         int (*update_process_ground) (uint32_t classid,
65                                 const char *app_id,
66                                 const stc_proc_value_s value);
67
68         int (*check_excn_by_cmdline) (char *cmdline);
69 } stc_plugin_monitor_s;
70
71 stc_error_e stc_plugin_monitor_initialize(void);
72 stc_error_e stc_plugin_monitor_deinitialize(void);
73
74 GHashTable *stc_monitor_get_system_apps(void);
75 GHashTable *stc_monitor_get_system_rstns(void);
76 int stc_monitor_get_contr_sock(void);
77 time_t stc_monitor_get_last_month_ts(void);
78 void stc_monitor_set_last_month_ts(time_t time);
79 time_t stc_monitor_get_last_week_ts(void);
80 void stc_monitor_set_last_week_ts(time_t time);
81 time_t stc_monitor_get_last_day_ts(void);
82 void stc_monitor_set_last_day_ts(time_t time);
83 void stc_monitor_set_rstns_updated(gboolean value);
84 gboolean stc_monitor_get_rstns_updated(void);
85 void stc_monitor_set_apps_updated(gboolean value);
86 gboolean stc_monitor_get_apps_updated(void);
87 void stc_monitor_set_background_state(gboolean value);
88 gboolean stc_monitor_get_background_state(void);
89 void stc_monitor_update_by_connection(void *data);
90 void stc_monitor_add_by_connection(void *data);
91 void stc_monitor_remove_by_connection(void *data);
92
93 #endif /* __STC_PLUGIN_MONITOR_H__ */