tizen 2.3 release
[kernel/api/system-resource.git] / src / network / include / datausage-common.h
1 /*
2  * resourced
3  *
4  * Copyright (c) 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  * @file netstat-common.h
21  *
22  * @desc Datausage module control structures
23  *
24  * Copyright (c) 2013 Samsung Electronics Co., Ltd. All rights reserved.
25  *
26  */
27
28 #ifndef __RESOURCED_NETSTAT_COMMON_H__
29 #define __RESOURCED_NETSTAT_COMMON_H__
30
31 #include <stdint.h>
32
33 #include <resourced.h>
34
35 #include "iface.h"
36
37 enum netstat_control_type {
38         NET_CTRL_TYPE_UNKNOWN,
39         JOIN_NET_CLS,
40         NET_CTRL_TYPE_LAST_ELEM,
41 };
42
43 struct netstat_data_type
44 {
45         enum netstat_control_type op_type;
46         uint32_t *args;
47 };
48
49 /**
50  * @brief It creates an appropriate cgroup,
51  *   it generates classid for the network performance control.
52  *   This function uses module's control callback interface to
53  *   invoke join_app_performance
54  * @param app_id[in] - application identifier, it's package name now
55  * @param pid - pid to put in to cgroup, or self pid of 0
56  * @return 0 if success or error code
57  */
58 resourced_ret_c join_net_cls(const char *app_id, const pid_t pid);
59
60 iface_callback *create_counter_callback(void);
61
62 struct nfacct_rule;
63 void keep_counter(struct nfacct_rule *counter);
64
65 #endif /* __RESOURCED_NETSTAT_COMMON_H__ */