Remove callback for getting the hardware address
[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_FLAG_RTNL           = (1 << 0),
41         CONNMAN_IFACE_FLAG_IPV4           = (1 << 1),
42         CONNMAN_IFACE_FLAG_IPV6           = (1 << 2),
43         CONNMAN_IFACE_FLAG_CARRIER_DETECT = (1 << 3),
44 };
45
46 enum connman_iface_state {
47         CONNMAN_IFACE_STATE_UNKNOWN   = 0,
48         CONNMAN_IFACE_STATE_ACTIVE    = 1,
49         CONNMAN_IFACE_STATE_CONNECTED = 2,
50         CONNMAN_IFACE_STATE_READY     = 3,
51 };
52
53 struct connman_ipv4 {
54         struct in_addr address;
55         struct in_addr netmask;
56         struct in_addr gateway;
57         struct in_addr network;
58         struct in_addr broadcast;
59         struct in_addr nameserver;
60 };
61
62 struct connman_network {
63 };
64
65 struct connman_iface {
66         char *path;
67         char *udi;
68         char *sysfs;
69         int index;
70         int carrier;
71         enum connman_iface_type type;
72         enum connman_iface_flags flags;
73         enum connman_iface_state state;
74         struct connman_ipv4 ipv4;
75
76         struct connman_iface_driver *driver;
77         void *driver_data;
78
79         struct {
80                 char *driver;
81                 char *vendor;
82                 char *product;
83         } device;
84 };
85
86 struct connman_iface_driver {
87         const char *name;
88         const char *capability;
89         int (*probe) (struct connman_iface *iface);
90         void (*remove) (struct connman_iface *iface);
91         int (*activate) (struct connman_iface *iface);
92         int (*shutdown) (struct connman_iface *iface);
93         int (*get_ipv4) (struct connman_iface *iface,
94                                         struct connman_ipv4 *ipv4);
95         int (*set_ipv4) (struct connman_iface *iface,
96                                         struct connman_ipv4 *ipv4);
97         int (*scan) (struct connman_iface *iface);
98         int (*connect) (struct connman_iface *iface,
99                                         struct connman_network *network);
100
101         void (*set_network) (struct connman_iface *iface,
102                                                 const char *network);
103         void (*set_passphrase) (struct connman_iface *iface,
104                                                 const char *passphrase);
105
106         void (*rtnl_carrier) (struct connman_iface *iface, int carrier);
107         void (*rtnl_wireless) (struct connman_iface *iface,
108                                         void *data, unsigned short len);
109 };
110
111 extern int connman_iface_register(struct connman_iface_driver *driver);
112 extern void connman_iface_unregister(struct connman_iface_driver *driver);
113
114 static inline void *connman_iface_get_data(struct connman_iface *iface)
115 {
116         return iface->driver_data;
117 }
118
119 static inline void connman_iface_set_data(struct connman_iface *iface,
120                                                                 void *data)
121 {
122         iface->driver_data = data;
123 }
124
125 extern int connman_iface_update(struct connman_iface *iface,
126                                         enum connman_iface_state state);
127
128 extern void connman_iface_indicate_carrier(struct connman_iface *iface,
129                                                         int carrier);
130
131 extern int connman_iface_get_ipv4(struct connman_iface *iface,
132                                                 struct connman_ipv4 *ipv4);
133 extern int connman_iface_set_ipv4(struct connman_iface *iface,
134                                                 struct connman_ipv4 *ipv4);
135 extern int connman_iface_clear_ipv4(struct connman_iface *iface);
136
137 #ifdef __cplusplus
138 }
139 #endif
140
141 #endif /* __CONNMAN_IFACE_H */