Add experimental IPv4 support
[connman] / include / iface.h
1 /*
2  *
3  *  Connection Manager
4  *
5  *  Copyright (C) 2007  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifndef __CONNMAN_IFACE_H
23 #define __CONNMAN_IFACE_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <netinet/in.h>
30
31 enum connman_iface_type {
32         CONNMAN_IFACE_TYPE_UNKNOWN   = 0,
33         CONNMAN_IFACE_TYPE_80203     = 1,
34         CONNMAN_IFACE_TYPE_80211     = 2,
35         CONNMAN_IFACE_TYPE_WIMAX     = 3,
36         CONNMAN_IFACE_TYPE_BLUETOOTH = 4,
37 };
38
39 enum connman_iface_flags {
40         CONNMAN_IFACE_FLAGS_CARRIER_DETECT      = (1 << 0),
41         CONNMAN_IFACE_FLAGS_IPV4                = (1 << 1),
42         CONNMAN_IFACE_FLAGS_IPV6                = (1 << 2),
43 };
44
45 struct connman_ipv4 {
46         struct in_addr address;
47         struct in_addr netmask;
48         struct in_addr gateway;
49         struct in_addr network;
50         struct in_addr broadcast;
51         struct in_addr nameserver;
52 };
53
54 struct connman_iface {
55         struct connman_iface_driver *driver;
56         char *path;
57         char *udi;
58         char *sysfs;
59         enum connman_iface_type type;
60         enum connman_iface_flags flags;
61         struct connman_ipv4 ipv4;
62 };
63
64 struct connman_iface_driver {
65         const char *name;
66         const char *capability;
67         int (*probe) (struct connman_iface *iface);
68         void (*remove) (struct connman_iface *iface);
69         int (*get_ipv4) (struct connman_iface *iface,
70                                         struct connman_ipv4 *ipv4);
71         int (*set_ipv4) (struct connman_iface *iface,
72                                         struct connman_ipv4 *ipv4);
73 };
74
75 extern int connman_iface_register(struct connman_iface_driver *driver);
76 extern void connman_iface_unregister(struct connman_iface_driver *driver);
77
78 #ifdef __cplusplus
79 }
80 #endif
81
82 #endif /* __CONNMAN_IFACE_H */