3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

station: Add skeleton

This commit is contained in:
Denis Kenzior 2018-08-31 13:24:26 -05:00
parent 839053c952
commit 641e71a02f
5 changed files with 116 additions and 0 deletions

View File

@ -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 \

View File

@ -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);

View File

@ -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:

75
src/station.c Normal file
View File

@ -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 <config.h>
#endif
#include <errno.h>
#include <ell/ell.h>
#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;
}

34
src/station.h Normal file
View File

@ -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 <stdbool.h>
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);