5 * Copyright (C) 2007 Intel Corporation. All rights reserved.
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.
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.
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
22 #ifndef __CONNMAN_IFACE_H
23 #define __CONNMAN_IFACE_H
29 #include <netinet/in.h>
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_MODEM = 4,
37 CONNMAN_IFACE_TYPE_BLUETOOTH = 5,
40 enum connman_iface_flags {
41 CONNMAN_IFACE_FLAG_RTNL = (1 << 0),
42 CONNMAN_IFACE_FLAG_IPV4 = (1 << 1),
43 CONNMAN_IFACE_FLAG_IPV6 = (1 << 2),
44 CONNMAN_IFACE_FLAG_SCANNING = (1 << 3),
47 enum connman_iface_state {
48 CONNMAN_IFACE_STATE_UNKNOWN = 0,
49 CONNMAN_IFACE_STATE_OFF = 1,
50 CONNMAN_IFACE_STATE_ENABLED = 2,
51 CONNMAN_IFACE_STATE_SCANNING = 3,
52 CONNMAN_IFACE_STATE_CONNECT = 4,
53 CONNMAN_IFACE_STATE_CONNECTED = 5,
54 CONNMAN_IFACE_STATE_CARRIER = 6,
55 CONNMAN_IFACE_STATE_CONFIGURE = 7,
56 CONNMAN_IFACE_STATE_READY = 8,
57 CONNMAN_IFACE_STATE_SHUTDOWN = 9,
60 enum connman_iface_policy {
61 CONNMAN_IFACE_POLICY_UNKNOWN = 0,
62 CONNMAN_IFACE_POLICY_OFF = 1,
63 CONNMAN_IFACE_POLICY_IGNORE = 2,
64 CONNMAN_IFACE_POLICY_AUTO = 3,
65 CONNMAN_IFACE_POLICY_ASK = 4,
68 enum connman_ipv4_method {
69 CONNMAN_IPV4_METHOD_UNKNOWN = 0,
70 CONNMAN_IPV4_METHOD_OFF = 1,
71 CONNMAN_IPV4_METHOD_STATIC = 2,
72 CONNMAN_IPV4_METHOD_DHCP = 3,
76 enum connman_ipv4_method method;
77 struct in_addr address;
78 struct in_addr netmask;
79 struct in_addr gateway;
80 struct in_addr network;
81 struct in_addr broadcast;
82 struct in_addr nameserver;
85 struct connman_network {
90 struct connman_iface {
96 enum connman_iface_type type;
97 enum connman_iface_flags flags;
98 enum connman_iface_state state;
99 enum connman_iface_policy policy;
100 struct connman_network network;
101 struct connman_ipv4 ipv4;
103 struct connman_iface_driver *driver;
115 struct connman_iface_driver {
117 const char *capability;
119 int (*probe) (struct connman_iface *iface);
120 void (*remove) (struct connman_iface *iface);
122 int (*start) (struct connman_iface *iface);
123 int (*stop) (struct connman_iface *iface);
125 int (*scan) (struct connman_iface *iface);
126 int (*connect) (struct connman_iface *iface,
127 struct connman_network *network);
128 int (*disconnect) (struct connman_iface *iface);
130 void (*set_network) (struct connman_iface *iface,
131 const char *network);
132 void (*set_passphrase) (struct connman_iface *iface,
133 const char *passphrase);
135 void (*rtnl_carrier) (struct connman_iface *iface, int carrier);
136 void (*rtnl_wireless) (struct connman_iface *iface,
137 void *data, unsigned short len);
140 extern int connman_iface_register(struct connman_iface_driver *driver);
141 extern void connman_iface_unregister(struct connman_iface_driver *driver);
143 static inline void *connman_iface_get_data(struct connman_iface *iface)
145 return iface->driver_data;
148 static inline void connman_iface_set_data(struct connman_iface *iface,
151 iface->driver_data = data;
154 extern void connman_iface_indicate_enabled(struct connman_iface *iface);
155 extern void connman_iface_indicate_disabled(struct connman_iface *iface);
156 extern void connman_iface_indicate_connected(struct connman_iface *iface);
157 extern void connman_iface_indicate_carrier_on(struct connman_iface *iface);
158 extern void connman_iface_indicate_carrier_off(struct connman_iface *iface);
159 extern void connman_iface_indicate_configured(struct connman_iface *iface);
161 extern void connman_iface_indicate_station(struct connman_iface *iface,
162 const char *name, int strength, int security);
164 extern int connman_iface_get_ipv4(struct connman_iface *iface,
165 struct connman_ipv4 *ipv4);
166 extern int connman_iface_set_ipv4(struct connman_iface *iface,
167 struct connman_ipv4 *ipv4);
168 extern int connman_iface_clear_ipv4(struct connman_iface *iface);
174 #endif /* __CONNMAN_IFACE_H */