fb62bb918faf41bf13c06dcebe47e6878dd9a38e
[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         char *mac;
25         stc_iface_type_e iftype;
26         stc_rstn_type_e rstn_type;
27         stc_roaming_type_e roaming;
28         int64_t data_limit;
29         int64_t data_warn_limit;
30         int64_t monthly_limit;
31         int64_t weekly_limit;
32         int64_t daily_limit;
33         int month_start_date;
34         uint64_t restriction_id;
35 } table_restrictions_info;
36
37 typedef stc_cb_ret_e
38 (*table_restrictions_info_cb)(const table_restrictions_info *info,
39                               void *user_data);
40
41 stc_error_e table_restrictions_foreach(table_restrictions_info_cb info_cb,
42                                        void *user_data);
43
44 stc_error_e table_restrictions_per_app(const gchar *app_id,
45                                        table_restrictions_info_cb info_cb,
46                                        void *user_data);
47
48
49 stc_error_e table_restrictions_get_restriction_type_subscriber_id(const char *app_id,
50                                                           stc_iface_type_e iftype,
51                                                           const char *subscriber_id,
52                                                           stc_rstn_type_e *type);
53
54 stc_error_e table_restrictions_get_restriction_type(const char *app_id,
55                                                      stc_iface_type_e iftype,
56                                                      stc_rstn_type_e *type);
57
58 stc_error_e table_restrictions_update(table_restrictions_info *info);
59
60 stc_error_e table_restrictions_delete(const char *app_id,
61                                       const stc_iface_type_e iftype,
62                                       const char *subscriber_id);
63
64 stc_error_e table_restrictions_prepare(sqlite3 *db);
65
66 void table_restrictions_finalize(void);
67
68 #endif /*__TABLE_RESTRICTIONS_H__ */