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
27 #include <arpa/inet.h>
29 #include <connman/plugin.h>
30 #include <connman/iface.h>
34 static int iface_probe(struct connman_iface *iface)
38 ifname = __net_ifname(iface->sysfs);
42 printf("[802.11] probe interface %s\n", ifname);
44 iface->type = CONNMAN_IFACE_TYPE_80211;
46 iface->flags = CONNMAN_IFACE_FLAG_IPV4;
53 static void iface_remove(struct connman_iface *iface)
55 printf("[802.11] remove interface\n");
57 __net_clear(iface->sysfs);
60 static int iface_get_ipv4(struct connman_iface *iface,
61 struct connman_ipv4 *ipv4)
63 if (__net_ifaddr(iface->sysfs, &ipv4->address) < 0)
66 printf("[802.11] get address %s\n", inet_ntoa(ipv4->address));
71 static int iface_set_ipv4(struct connman_iface *iface,
72 struct connman_ipv4 *ipv4)
74 printf("[802.11] set address %s\n", inet_ntoa(ipv4->address));
75 printf("[802.11] set netmask %s\n", inet_ntoa(ipv4->netmask));
76 printf("[802.11] set gateway %s\n", inet_ntoa(ipv4->gateway));
78 __net_set(iface->sysfs, &ipv4->address, &ipv4->netmask,
79 &ipv4->gateway, &ipv4->broadcast,
85 static struct connman_iface_driver iface_driver = {
87 .capability = "net.80211",
89 .remove = iface_remove,
90 .get_ipv4 = iface_get_ipv4,
91 .set_ipv4 = iface_set_ipv4,
94 static int plugin_init(void)
96 connman_iface_register(&iface_driver);
101 static void plugin_exit(void)
103 connman_iface_unregister(&iface_driver);
106 CONNMAN_PLUGIN_DEFINE("80211", "IEEE 802.11 interface plugin", VERSION,
107 plugin_init, plugin_exit)