From 641e71a02f98751e8e77a25895ff26c0a6abd0c7 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Fri, 31 Aug 2018 13:24:26 -0500 Subject: [PATCH] station: Add skeleton --- Makefile.am | 1 + src/iwd.h | 4 +++ src/main.c | 2 ++ src/station.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/station.h | 34 +++++++++++++++++++++++ 5 files changed, 116 insertions(+) create mode 100644 src/station.c create mode 100644 src/station.h diff --git a/Makefile.am b/Makefile.am index 8be24c66..e95c2ea5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -76,6 +76,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \ src/netdev.h src/netdev.c \ src/wiphy.h src/wiphy.c \ src/device.h src/device.c \ + src/station.h src/station.c \ src/ie.h src/ie.c \ src/dbus.h src/dbus.c \ src/crypto.h src/crypto.c \ diff --git a/src/iwd.h b/src/iwd.h index 7744554c..763e3cd5 100644 --- a/src/iwd.h +++ b/src/iwd.h @@ -24,6 +24,7 @@ struct l_genl_family; struct device; +struct station; typedef void (*iwd_device_foreach_func)(struct device *, void *data); @@ -52,3 +53,6 @@ void known_networks_exit(void); bool device_init(void); void device_exit(void); + +bool station_init(void); +void station_exit(void); diff --git a/src/main.c b/src/main.c index 110598f9..1ee33d0a 100644 --- a/src/main.c +++ b/src/main.c @@ -434,6 +434,7 @@ int main(int argc, char *argv[]) goto fail_device; adhoc_init(); + station_init(); wsc_init(); network_init(); known_networks_init(); @@ -448,6 +449,7 @@ int main(int argc, char *argv[]) known_networks_exit(); network_exit(); wsc_exit(); + station_exit(); adhoc_exit(); device_exit(); fail_device: diff --git a/src/station.c b/src/station.c new file mode 100644 index 00000000..91a580ba --- /dev/null +++ b/src/station.c @@ -0,0 +1,75 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2018 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include + +#include "src/util.h" +#include "src/iwd.h" +#include "src/common.h" +#include "src/scan.h" +#include "src/netdev.h" +#include "src/network.h" +#include "src/station.h" + +static struct l_queue *station_list; + +struct station *station_create(struct wiphy *wiphy, struct netdev *netdev) +{ + struct station *station; + + station = l_new(struct station, 1); + + station->wiphy = wiphy; + station->netdev = netdev; + + l_queue_push_head(station_list, station); + + return station; +} + +void station_free(struct station *station) +{ + l_debug(""); + + if (!l_queue_remove(station_list, station)) + return; + + l_free(station); +} + +bool station_init(void) +{ + station_list = l_queue_new(); + return true; +} + +void station_exit(void) +{ + l_queue_destroy(station_list, NULL); + station_list = NULL; +} diff --git a/src/station.h b/src/station.h new file mode 100644 index 00000000..fbb88a75 --- /dev/null +++ b/src/station.h @@ -0,0 +1,34 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2018 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#include + +struct wiphy; +struct netdev; + +struct station { + struct wiphy *wiphy; + struct netdev *netdev; +}; + +struct station *station_create(struct wiphy *wiphy, struct netdev *netdev); +void station_free(struct station *station);