Added data limits monitoring for daily, weekly and monthly
[platform/core/connectivity/stc-manager.git] / src / database / include / table-restrictions.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 __TABLE_RESTRICTIONS_H__
18 #define __TABLE_RESTRICTIONS_H__
19
20 typedef struct {
21         char *app_id;
22         char *ifname;
23         char *subscriber_id;
24         stc_iface_type_e iftype;
25         stc_rstn_type_e rstn_type;
26         stc_roaming_type_e roaming;
27         int64_t data_limit;
28         int64_t data_warn_limit;
29         int64_t monthly_limit;
30         int64_t weekly_limit;
31         int64_t daily_limit;
32         int month_start_date;
33         uint64_t restriction_id;
34 } table_restrictions_info;
35
36 typedef stc_cb_ret_e
37 (*table_restrictions_info_cb)(const table_restrictions_info *info,
38                               void *user_data);
39
40 stc_error_e table_restrictions_foreach(table_restrictions_info_cb info_cb,
41                                        void *user_data);
42
43 stc_error_e table_restrictions_per_app(const gchar *app_id,
44                                        table_restrictions_info_cb info_cb,
45                                        void *user_data);
46
47
48 stc_error_e table_restrictions_get_restriction_type_subscriber_id(const char *app_id,
49                                                           stc_iface_type_e iftype,
50                                                           const char *subscriber_id,
51                                                           stc_rstn_type_e *type);
52
53 stc_error_e table_restrictions_get_restriction_type(const char *app_id,
54                                                      stc_iface_type_e iftype,
55                                                      stc_rstn_type_e *type);
56
57 stc_error_e table_restrictions_update(table_restrictions_info *info);
58
59 stc_error_e table_restrictions_delete(const char *app_id,
60                                       const stc_iface_type_e iftype,
61                                       const char *subscriber_id);
62
63 stc_error_e table_restrictions_prepare(sqlite3 *db);
64
65 void table_restrictions_finalize(void);
66
67 #endif /*__TABLE_RESTRICTIONS_H__ */