iwd/src/wiphy.h

127 lines
4.8 KiB
C
Raw Normal View History

2014-07-29 21:25:01 +02:00
/*
*
* Wireless daemon for Linux
*
* Copyright (C) 2013-2019 Intel Corporation. All rights reserved.
2014-07-29 21:25:01 +02:00
*
* 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 <stdint.h>
2014-07-29 21:25:01 +02:00
#include <stdbool.h>
2016-05-16 19:21:26 +02:00
struct wiphy;
struct scan_bss;
2019-04-11 21:14:27 +02:00
struct scan_freq_set;
wiphy: introduce new radio management APIs These APIs will handle fairness and order in any operations which radios can only do sequentially (offchannel, scanning, connection etc.). Both scan and frame-xchg are complex modules (especially scanning) which is why the radio management APIs were implemented generic enough where the changes to both modules will be minimal. Any module that requires this kind of work can push a work item into the radio management work queue (wiphy_radio_work_insert) and when the work is ready to be started radio management will call back into the module. Once the work is completed (and this may be some time later e.g. in scan results or a frame watch) the module can signal back that the work is finished (wiphy_radio_work_done). Wiphy will then pop the queue and continue with the next work item. A concept of priority was added in order to allow important offchannel operations (e.g. ANQP) to take priority over other work items. The priority is an integer, where lower values are of a higher priority. The concept of priority cleanly solves a lot of the complexity that was added in order to support ANQP queries (suspending scanning and waiting for ANQP to finish before connecting). Instead ANQP queries can be queued at a higher priority than scanning which removes the need for suspending scans. In addition we can treat connections as radio management work and insert them at a lower priority than ANQP, but higher than scanning. This forces the connection to wait for ANQP without having to track any state.
2020-07-09 02:04:32 +02:00
struct wiphy_radio_work_item;
typedef bool (*wiphy_radio_work_func_t)(struct wiphy_radio_work_item *item);
typedef void (*wiphy_radio_work_destroy_func_t)(
struct wiphy_radio_work_item *item);
struct wiphy_radio_work_item_ops {
wiphy_radio_work_func_t do_work;
wiphy_radio_work_destroy_func_t destroy;
};
struct wiphy_radio_work_item {
uint32_t id;
int priority;
const struct wiphy_radio_work_item_ops *ops;
};
2014-10-24 04:47:38 +02:00
enum wiphy_state_watch_event {
WIPHY_STATE_WATCH_EVENT_POWERED,
WIPHY_STATE_WATCH_EVENT_RFKILLED,
};
typedef void (*wiphy_state_watch_func_t)(struct wiphy *wiphy,
enum wiphy_state_watch_event event,
void *user_data);
typedef void (*wiphy_destroy_func_t)(void *user_data);
2016-05-16 19:21:26 +02:00
enum ie_rsn_cipher_suite wiphy_select_cipher(struct wiphy *wiphy,
uint16_t mask);
enum ie_rsn_akm_suite wiphy_select_akm(struct wiphy *wiphy,
struct scan_bss *bss,
bool fils_capable_hint);
2016-05-16 19:21:26 +02:00
2016-06-01 22:20:33 +02:00
struct wiphy *wiphy_find(int wiphy_id);
#define wiphy_find_by_wdev(w) wiphy_find(w >> 32)
bool wiphy_is_blacklisted(const struct wiphy *wiphy);
2016-06-01 22:20:33 +02:00
struct wiphy *wiphy_create(uint32_t wiphy_id, const char *name);
void wiphy_update_name(struct wiphy *wiphy, const char *name);
void wiphy_create_complete(struct wiphy *wiphy);
bool wiphy_destroy(struct wiphy *wiphy);
void wiphy_update_from_genl(struct wiphy *wiphy, struct l_genl_msg *msg);
2019-04-11 21:14:27 +02:00
bool wiphy_constrain_freq_set(const struct wiphy *wiphy,
struct scan_freq_set *set);
2020-02-04 00:37:08 +01:00
uint32_t wiphy_get_id(struct wiphy *wiphy);
const char *wiphy_get_path(struct wiphy *wiphy);
2016-09-13 21:36:46 +02:00
uint32_t wiphy_get_supported_bands(struct wiphy *wiphy);
const struct scan_freq_set *wiphy_get_supported_freqs(
const struct wiphy *wiphy);
bool wiphy_can_connect(struct wiphy *wiphy, struct scan_bss *bss,
bool fils_hint);
bool wiphy_supports_cmds_auth_assoc(struct wiphy *wiphy);
bool wiphy_can_randomize_mac_addr(struct wiphy *wiphy);
2019-07-10 23:23:13 +02:00
bool wiphy_rrm_capable(struct wiphy *wiphy);
bool wiphy_has_feature(struct wiphy *wiphy, uint32_t feature);
bool wiphy_has_ext_feature(struct wiphy *wiphy, uint32_t feature);
uint8_t wiphy_get_max_num_ssids_per_scan(struct wiphy *wiphy);
uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy);
uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy);
bool wiphy_supports_iftype(struct wiphy *wiphy, uint32_t iftype);
const uint8_t *wiphy_get_supported_rates(struct wiphy *wiphy, unsigned int band,
unsigned int *out_num);
2018-08-07 18:15:23 +02:00
bool wiphy_supports_adhoc_rsn(struct wiphy *wiphy);
bool wiphy_can_offchannel_tx(struct wiphy *wiphy);
bool wiphy_supports_qos_set_map(struct wiphy *wiphy);
bool wiphy_supports_firmware_roam(struct wiphy *wiphy);
const char *wiphy_get_driver(struct wiphy *wiphy);
2019-07-02 01:28:07 +02:00
const char *wiphy_get_name(struct wiphy *wiphy);
const uint8_t *wiphy_get_permanent_address(struct wiphy *wiphy);
const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy,
uint32_t iftype);
const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy);
bool wiphy_get_rsnxe(const struct wiphy *wiphy, uint8_t *buf, size_t len);
void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out);
2018-08-07 18:15:23 +02:00
void wiphy_generate_random_address(struct wiphy *wiphy, uint8_t addr[static 6]);
void wiphy_generate_address_from_ssid(struct wiphy *wiphy, const char *ssid,
uint8_t addr[static 6]);
int wiphy_estimate_data_rate(struct wiphy *wiphy,
const void *ies, uint16_t ies_len,
const struct scan_bss *bss,
uint64_t *out_data_rate);
uint32_t wiphy_state_watch_add(struct wiphy *wiphy,
wiphy_state_watch_func_t func, void *user_data,
wiphy_destroy_func_t destroy);
bool wiphy_state_watch_remove(struct wiphy *wiphy, uint32_t id);
wiphy: introduce new radio management APIs These APIs will handle fairness and order in any operations which radios can only do sequentially (offchannel, scanning, connection etc.). Both scan and frame-xchg are complex modules (especially scanning) which is why the radio management APIs were implemented generic enough where the changes to both modules will be minimal. Any module that requires this kind of work can push a work item into the radio management work queue (wiphy_radio_work_insert) and when the work is ready to be started radio management will call back into the module. Once the work is completed (and this may be some time later e.g. in scan results or a frame watch) the module can signal back that the work is finished (wiphy_radio_work_done). Wiphy will then pop the queue and continue with the next work item. A concept of priority was added in order to allow important offchannel operations (e.g. ANQP) to take priority over other work items. The priority is an integer, where lower values are of a higher priority. The concept of priority cleanly solves a lot of the complexity that was added in order to support ANQP queries (suspending scanning and waiting for ANQP to finish before connecting). Instead ANQP queries can be queued at a higher priority than scanning which removes the need for suspending scans. In addition we can treat connections as radio management work and insert them at a lower priority than ANQP, but higher than scanning. This forces the connection to wait for ANQP without having to track any state.
2020-07-09 02:04:32 +02:00
uint32_t wiphy_radio_work_insert(struct wiphy *wiphy,
struct wiphy_radio_work_item *item,
int priority,
const struct wiphy_radio_work_item_ops *ops);
void wiphy_radio_work_done(struct wiphy *wiphy, uint32_t id);
bool wiphy_radio_work_is_running(struct wiphy *wiphy, uint32_t id);