tizen 2.3 release
[kernel/api/system-resource.git] / src / network / include / datausage-restriction.h
1 /*
2  * resourced
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 /*
21  * @file restriction.h
22  *
23  * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
24  *
25  */
26
27 #ifndef _RESOURCED_RESTRICTION_H_
28 #define _RESOURCED_RESTRICTION_H_
29
30 #include <sqlite3.h>
31 #include "resourced.h"
32 #include "data_usage.h"
33 #include "transmission.h"
34
35 void finalize_datausage_restriction(void);
36
37 /**
38  * @desc Update restriction database
39  **/
40 resourced_ret_c update_restriction_db(
41         const char *app_id, const resourced_iface_type iftype,
42         const int rcv_limit, const int snd_limit,
43         const resourced_restriction_state rst_state,
44         const int quota_id,
45         const resourced_roaming_type roaming);
46
47 /**
48  * @desc Get restriction info from database
49  *      Now it filles only quota_id, send_limit,
50  *      rcv_limit, rst_state
51  *
52  * @param app_id - binpath database field, currently pkgid
53  * @param iftype - iftype database field
54  **/
55 resourced_ret_c get_restriction_info(const char *app_id,
56                                 const resourced_iface_type iftype,
57                                 resourced_restriction_info *rst);
58
59 resourced_ret_c process_kernel_restriction(
60         const u_int32_t classid,
61         const resourced_net_restrictions *rst,
62         const enum traffic_restriction_type rst_type);
63
64 resourced_ret_c proc_keep_restriction(
65         const char *app_id, int quota_id, const resourced_net_restrictions *rst,
66         const enum traffic_restriction_type rst_type);
67
68 resourced_ret_c remove_restriction_local(const char *app_id,
69                                          const resourced_iface_type iftype);
70
71 resourced_ret_c exclude_restriction_local(const char *app_id,
72                                           const int quota_id,
73                                           const resourced_iface_type iftype);
74
75 #endif /* _RESOURCED_RESTRICTION_H_ */