82d15f7eb275423f97dc0f3d85daaccf6534d98c
[platform/core/connectivity/stc-manager.git] / src / monitor / include / stc-monitor-context.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_MONITOR_CONTEXT_H__
18 #define __STC_MONITOR_CONTEXT_H__
19
20 #include "stc-manager.h"
21
22 typedef struct {
23         time_t now;
24         time_t month_start_ts;
25         time_t week_start_ts;
26         time_t day_start_ts;
27         int is_updated;
28 } reset_time_limits_context_s;
29
30 typedef struct {
31         struct nfacct_rule *counter;
32         int64_t bytes;
33         gboolean data_limit_exceeded;
34 } classid_bytes_context_s;
35
36 /**
37  * @brief structure to store system info
38  */
39 typedef struct {
40         int contr_sock;  /**< socket used for getting kernel counters */
41         guint contr_timer_id;  /**< timer id for periodically getting kernel counters */
42         guint contr_gsource_id;
43         stc_data_counter_s du_curr;  /**< current data usage */
44         GHashTable *rstns;  /**< restriction rules */
45         gboolean rstns_updated;
46         GHashTable *apps;  /**< monitored applications */
47         gboolean apps_updated;
48         gboolean background_state;
49         time_t last_month_ts;
50         time_t last_week_ts;
51         time_t last_day_ts;
52         int month_start_date;
53 } stc_system_s;
54
55 #endif /* __STC_MONITOR_CONTEXT_H__ */