3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

band: Add band.[ch]

Move the band definition out of wiphy.c and into band.[ch].  This is
done to make certain utilities that depend on band information capable
of being tested from unit tests.

The band concept will most likely grow over time.  For now, the only
user will be wiphy.c and unit tests, so the structures are kept public.
This commit is contained in:
Denis Kenzior 2021-06-02 10:50:08 -05:00
parent 46f6fb1bd1
commit e41bee377d
4 changed files with 64 additions and 16 deletions

View File

@ -244,6 +244,7 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \
src/wscutil.h src/wscutil.c \ src/wscutil.h src/wscutil.c \
src/diagnostic.h src/diagnostic.c \ src/diagnostic.h src/diagnostic.c \
src/ip-pool.h src/ip-pool.c \ src/ip-pool.h src/ip-pool.c \
src/band.h src/band.c \
$(eap_sources) \ $(eap_sources) \
$(builtin_sources) $(builtin_sources)

28
src/band.c Normal file
View File

@ -0,0 +1,28 @@
/*
*
* Wireless daemon for Linux
*
* Copyright (C) 2021 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 "band.h"
void band_free(struct band *band)
{
l_free(band);
}

34
src/band.h Normal file
View File

@ -0,0 +1,34 @@
/*
*
* Wireless daemon for Linux
*
* Copyright (C) 2021 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
*
*/
struct band {
uint8_t vht_mcs_set[8];
uint8_t vht_capabilities[4];
bool vht_supported : 1;
uint8_t ht_mcs_set[16];
uint8_t ht_capabilities[2];
bool ht_supported : 1;
uint16_t supported_rates_len;
uint8_t supported_rates[];
};
void band_free(struct band *band);

View File

@ -55,6 +55,7 @@
#include "src/watchlist.h" #include "src/watchlist.h"
#include "src/nl80211util.h" #include "src/nl80211util.h"
#include "src/nl80211cmd.h" #include "src/nl80211cmd.h"
#include "src/band.h"
#define EXT_CAP_LEN 10 #define EXT_CAP_LEN 10
@ -66,17 +67,6 @@ static int mac_randomize_bytes = 6;
static char regdom_country[2]; static char regdom_country[2];
static uint32_t work_ids; static uint32_t work_ids;
struct band {
uint8_t vht_mcs_set[8];
uint8_t vht_capabilities[4];
bool vht_supported : 1;
uint8_t ht_mcs_set[16];
uint8_t ht_capabilities[2];
bool ht_supported : 1;
uint16_t supported_rates_len;
uint8_t supported_rates[];
};
struct wiphy { struct wiphy {
uint32_t id; uint32_t id;
char name[20]; char name[20];
@ -138,11 +128,6 @@ enum ie_rsn_cipher_suite wiphy_select_cipher(struct wiphy *wiphy, uint16_t mask)
return 0; return 0;
} }
static void band_free(struct band *band)
{
l_free(band);
}
static bool wiphy_can_connect_sae(struct wiphy *wiphy) static bool wiphy_can_connect_sae(struct wiphy *wiphy)
{ {
/* /*