station.h (4175B)
1 /* 2 * 3 * Wireless daemon for Linux 4 * 5 * Copyright (C) 2018-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 <stdbool.h> 24 25 struct wiphy; 26 struct netdev; 27 struct station; 28 enum security; 29 struct scan_bss; 30 struct scan_freq_set; 31 struct network; 32 33 enum station_state { 34 /* Disconnected, no auto-connect */ 35 STATION_STATE_DISCONNECTED, 36 /* Disconnected, try auto-connect with quick scan */ 37 STATION_STATE_AUTOCONNECT_QUICK, 38 /* Disconnected, try auto-connect with full scan */ 39 STATION_STATE_AUTOCONNECT_FULL, 40 /* Connecting */ 41 STATION_STATE_CONNECTING, 42 STATION_STATE_CONNECTING_AUTO, 43 STATION_STATE_CONNECTED, 44 STATION_STATE_DISCONNECTING, 45 STATION_STATE_ROAMING, /* Reassociation */ 46 STATION_STATE_FT_ROAMING, /* Fast transition */ 47 STATION_STATE_FW_ROAMING, /* Firmware roamed by itself */ 48 STATION_STATE_NETCONFIG, 49 }; 50 51 enum station_event { 52 STATION_EVENT_ANQP_STARTED, 53 STATION_EVENT_ANQP_FINISHED, 54 STATION_EVENT_OWE_HIDDEN_STARTED, 55 STATION_EVENT_OWE_HIDDEN_FINISHED, 56 }; 57 58 typedef void (*station_foreach_func_t)(struct station *, void *data); 59 typedef void (*station_state_watch_func_t)(enum station_state, void *userdata); 60 typedef void (*station_event_watch_func_t)(enum station_event, 61 struct network *network, 62 void *user_data); 63 typedef void (*station_destroy_func_t)(void *userdata); 64 typedef void (*station_network_foreach_func_t)(struct network *, void *data); 65 66 struct wiphy *station_get_wiphy(struct station *station); 67 struct netdev *station_get_netdev(struct station *station); 68 struct network *station_get_connected_network(struct station *station); 69 bool station_is_busy(struct station *station); 70 71 struct network *station_network_find(struct station *station, const char *ssid, 72 enum security security); 73 74 void station_set_scan_results(struct station *station, struct l_queue *bss_list, 75 const struct scan_freq_set *freqs, 76 bool add_to_autoconnect); 77 78 enum station_state station_get_state(struct station *station); 79 uint32_t station_add_state_watch(struct station *station, 80 station_state_watch_func_t func, 81 void *user_data, 82 station_destroy_func_t destroy); 83 bool station_remove_state_watch(struct station *station, uint32_t id); 84 85 uint32_t station_add_event_watch(station_event_watch_func_t func, 86 void *user_data, 87 station_destroy_func_t destroy); 88 void station_remove_event_watch(uint32_t id); 89 90 bool station_set_autoconnect(struct station *station, bool autoconnect); 91 bool station_get_autoconnect(struct station *station); 92 93 int __station_connect_network(struct station *station, struct network *network, 94 struct scan_bss *bss, enum station_state state); 95 void station_connect_network(struct station *station, struct network *network, 96 struct scan_bss *bss, 97 struct l_dbus_message *message); 98 int station_disconnect(struct station *station); 99 100 struct station *station_find(uint32_t ifindex); 101 void station_foreach(station_foreach_func_t func, void *user_data); 102 103 void station_network_foreach(struct station *station, 104 station_network_foreach_func_t func, 105 void *user_data); 106 struct l_queue *station_get_bss_list(struct station *station); 107 /* the networks seen by the station, strongest first */ 108 void station_foreach_network(struct station *station, 109 void (*func)(struct network *, void *), 110 void *user_data); 111 struct scan_bss *station_get_connected_bss(struct station *station); 112 113 int station_hide_network(struct station *station, struct network *network);