tizen 2.3 release
[kernel/api/system-resource.git] / src / network / include / iface.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  *
22  * @file iface.h
23  *
24  * @desc Utility for working with network interfaces
25  */
26
27 #ifndef TRESOURCED_LIBS_NET_IFACE_H_
28 #define TRESOURCED_LIBS_NET_IFACE_H_
29
30 #include <glib.h>
31 #include <stdbool.h>
32
33 #include "data_usage.h"
34
35 /**
36  * @desc Storage now create an instance of this structure
37  */
38 typedef struct {
39         void(*handle_iface_up)(int ifindex);
40         void(*handle_iface_down)(int ifindex);
41 } iface_callback;
42
43 int init_iftype(void);
44 void finalize_iftypes(void);
45
46 int is_allowed_ifindex(int ifindex);
47
48 resourced_iface_type get_iftype(int ifindex);
49 char *get_iftype_name(resourced_iface_type iftype);
50 bool is_address_exists(const char *name);
51
52 resourced_iface_type convert_iftype(const char *buffer);
53
54 void set_wifi_allowance(const resourced_option_state wifi_option);
55 void set_datacall_allowance(const resourced_option_state datacall_option);
56
57 typedef int(*ifindex_iterator)(int ifindex,
58         resourced_iface_type iftype, void *data);
59
60 void for_each_ifindex(ifindex_iterator iter, void(*empty_func)(void *),
61         void *data);
62
63 typedef GList iface_callbacks;
64
65 #endif /*TRESOURCED_LIBS_NET_IFACE_H_*/