wiphy.h (6554B)
1 /* 2 * 3 * Wireless daemon for Linux 4 * 5 * Copyright (C) 2013-2019 Intel Corporation. All rights reserved. 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 */ 22 23 #include <stdint.h> 24 #include <stdbool.h> 25 26 struct wiphy; 27 struct scan_bss; 28 struct scan_freq_set; 29 struct wiphy_radio_work_item; 30 struct ie_rsn_info; 31 struct band_freq_attrs; 32 enum security; 33 enum band_freq; 34 35 typedef bool (*wiphy_radio_work_func_t)(struct wiphy_radio_work_item *item); 36 typedef void (*wiphy_radio_work_destroy_func_t)( 37 struct wiphy_radio_work_item *item); 38 39 struct wiphy_radio_work_item_ops { 40 wiphy_radio_work_func_t do_work; 41 wiphy_radio_work_destroy_func_t destroy; 42 }; 43 44 struct wiphy_radio_work_item { 45 uint32_t id; 46 int priority; 47 const struct wiphy_radio_work_item_ops *ops; 48 }; 49 50 enum { 51 WIPHY_WORK_PRIORITY_FT = 0, 52 WIPHY_WORK_PRIORITY_FRAME = 1, 53 WIPHY_WORK_PRIORITY_OFFCHANNEL = 1, 54 WIPHY_WORK_PRIORITY_CONNECT = 2, 55 WIPHY_WORK_PRIORITY_SCAN = 3, 56 WIPHY_WORK_PRIORITY_PERIODIC_SCAN = 4, 57 }; 58 59 enum wiphy_state_watch_event { 60 WIPHY_STATE_WATCH_EVENT_POWERED, 61 WIPHY_STATE_WATCH_EVENT_RFKILLED, 62 WIPHY_STATE_WATCH_EVENT_REGDOM_STARTED, 63 WIPHY_STATE_WATCH_EVENT_REGDOM_DONE, 64 }; 65 66 typedef void (*wiphy_state_watch_func_t)(struct wiphy *wiphy, 67 enum wiphy_state_watch_event event, 68 void *user_data); 69 typedef void (*wiphy_destroy_func_t)(void *user_data); 70 71 enum ie_rsn_cipher_suite wiphy_select_cipher(struct wiphy *wiphy, 72 uint16_t mask); 73 uint16_t wiphy_get_supported_ciphers(struct wiphy *wiphy, uint16_t mask); 74 75 enum ie_rsn_akm_suite wiphy_select_akm(struct wiphy *wiphy, 76 const struct scan_bss *bss, 77 enum security security, 78 const struct ie_rsn_info *info, 79 bool fils_capable_hint); 80 81 struct wiphy *wiphy_find(int wiphy_id); 82 static inline struct wiphy *wiphy_find_by_wdev(uint64_t w) 83 { 84 return wiphy_find(w >> 32); 85 } 86 87 bool wiphy_is_blacklisted(const struct wiphy *wiphy); 88 89 struct wiphy *wiphy_create(uint32_t wiphy_id, const char *name); 90 void wiphy_update_name(struct wiphy *wiphy, const char *name); 91 void wiphy_create_complete(struct wiphy *wiphy); 92 bool wiphy_destroy(struct wiphy *wiphy); 93 void wiphy_update_from_genl(struct wiphy *wiphy, struct l_genl_msg *msg); 94 95 bool wiphy_constrain_freq_set(const struct wiphy *wiphy, 96 struct scan_freq_set *set); 97 98 uint32_t wiphy_get_id(struct wiphy *wiphy); 99 const char *wiphy_get_path(struct wiphy *wiphy); 100 uint32_t wiphy_get_supported_bands(struct wiphy *wiphy); 101 const struct scan_freq_set *wiphy_get_supported_freqs( 102 const struct wiphy *wiphy); 103 104 const struct band_freq_attrs *wiphy_get_frequency_info( 105 const struct wiphy *wiphy, 106 uint32_t freq); 107 const struct band_freq_attrs *wiphy_get_frequency_info_list( 108 const struct wiphy *wiphy, 109 enum band_freq band, 110 size_t *size); 111 112 int wiphy_band_is_disabled(const struct wiphy *wiphy, enum band_freq band); 113 114 bool wiphy_supports_probe_resp_offload(struct wiphy *wiphy); 115 bool wiphy_can_transition_disable(struct wiphy *wiphy); 116 bool wiphy_can_offload(struct wiphy *wiphy); 117 bool wiphy_supports_cmds_auth_assoc(struct wiphy *wiphy); 118 bool wiphy_can_randomize_mac_addr(struct wiphy *wiphy); 119 bool wiphy_rrm_capable(struct wiphy *wiphy); 120 bool wiphy_supports_ext_key_id(struct wiphy *wiphy); 121 bool wiphy_has_feature(struct wiphy *wiphy, uint32_t feature); 122 bool wiphy_has_ext_feature(const struct wiphy *wiphy, uint32_t feature); 123 uint8_t wiphy_get_max_num_ssids_per_scan(struct wiphy *wiphy); 124 uint16_t wiphy_get_max_scan_ie_len(struct wiphy *wiphy); 125 uint32_t wiphy_get_max_roc_duration(struct wiphy *wiphy); 126 bool wiphy_supports_iftype(struct wiphy *wiphy, uint32_t iftype); 127 const uint8_t *wiphy_get_supported_rates(struct wiphy *wiphy, 128 enum band_freq band, 129 unsigned int *out_num); 130 bool wiphy_supports_qos_set_map(struct wiphy *wiphy); 131 bool wiphy_supports_firmware_roam(struct wiphy *wiphy); 132 const char *wiphy_get_driver(struct wiphy *wiphy); 133 const char *wiphy_get_name(struct wiphy *wiphy); 134 bool wiphy_uses_default_if(struct wiphy *wiphy); 135 bool wiphy_control_port_enabled(struct wiphy *wiphy); 136 bool wiphy_power_save_disabled(struct wiphy *wiphy); 137 bool wiphy_owe_disabled(struct wiphy *wiphy); 138 const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy, 139 uint32_t iftype); 140 const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy); 141 bool wiphy_get_rsnxe(const struct wiphy *wiphy, uint8_t *buf, size_t len); 142 void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out); 143 bool wiphy_country_is_unknown(struct wiphy *wiphy); 144 bool wiphy_supports_uapsd(const struct wiphy *wiphy); 145 bool wiphy_supports_cmd_offchannel(const struct wiphy *wiphy); 146 bool wiphy_supports_multicast_rx(const struct wiphy *wiphy); 147 bool wiphy_supports_colocated_flag(const struct wiphy *wiphy); 148 149 const uint8_t *wiphy_get_ht_capabilities(const struct wiphy *wiphy, 150 enum band_freq band, 151 size_t *size); 152 void wiphy_generate_random_address(struct wiphy *wiphy, uint8_t addr[static 6]); 153 void wiphy_generate_address_from_ssid(struct wiphy *wiphy, 154 const uint8_t *ssid, size_t ssid_len, 155 uint8_t addr[static 6]); 156 157 int wiphy_estimate_data_rate(struct wiphy *wiphy, 158 const void *ies, uint16_t ies_len, 159 const struct scan_bss *bss, 160 uint64_t *out_data_rate); 161 bool wiphy_regdom_is_updating(struct wiphy *wiphy); 162 163 uint32_t wiphy_state_watch_add(struct wiphy *wiphy, 164 wiphy_state_watch_func_t func, void *user_data, 165 wiphy_destroy_func_t destroy); 166 bool wiphy_state_watch_remove(struct wiphy *wiphy, uint32_t id); 167 168 uint32_t wiphy_radio_work_insert(struct wiphy *wiphy, 169 struct wiphy_radio_work_item *item, 170 int priority, 171 const struct wiphy_radio_work_item_ops *ops); 172 void wiphy_radio_work_done(struct wiphy *wiphy, uint32_t id); 173 int wiphy_radio_work_is_running(struct wiphy *wiphy, uint32_t id); 174 uint32_t wiphy_radio_work_reschedule(struct wiphy *wiphy, 175 struct wiphy_radio_work_item *item);