X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=src%2Fdrivers%2Fdriver.h;h=96dec770efd44a36c85feea62760467deb746f08;hb=0e2e565a44ab7b073491cab00847f7bc62731483;hp=f492f9fd19e5f8b2ff4d74ec7d59f81b3fe551e8;hpb=af47308823091df79acd44b14635b871e53124f0;p=libeap.git diff --git a/src/drivers/driver.h b/src/drivers/driver.h index f492f9f..96dec77 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -132,6 +132,7 @@ struct hostapd_hw_modes { * @age: Age of the information in milliseconds (i.e., how many milliseconds * ago the last Beacon or Probe Response frame was received) * @ie_len: length of the following IE field in octets + * @beacon_ie_len: length of the following Beacon IE field in octets * * This structure is used as a generic format for scan results from the * driver. Each driver interface implementation is responsible for converting @@ -154,7 +155,14 @@ struct wpa_scan_res { u64 tsf; unsigned int age; size_t ie_len; - /* followed by ie_len octets of IEs */ + size_t beacon_ie_len; + /* + * Followed by ie_len octets of IEs from Probe Response frame (or if + * the driver does not indicate source of IEs, these may also be from + * Beacon frame). After the first set of IEs, another set of IEs may + * follow (with beacon_ie_len octets of data) if the driver provides + * both IE sets. + */ }; /** @@ -229,6 +237,30 @@ struct wpa_driver_scan_params { * The frequency is set in MHz. The array is zero-terminated. */ int *freqs; + + /** + * filter_ssids - Filter for reporting SSIDs + * + * This optional parameter can be used to request the driver wrapper to + * filter scan results to include only the specified SSIDs. %NULL + * indicates that no filtering is to be done. This can be used to + * reduce memory needs for scan results in environments that have large + * number of APs with different SSIDs. + * + * The driver wrapper is allowed to take this allocated buffer into its + * own use by setting the pointer to %NULL. In that case, the driver + * wrapper is responsible for freeing the buffer with os_free() once it + * is not needed anymore. + */ + struct wpa_driver_scan_filter { + u8 ssid[32]; + size_t ssid_len; + } *filter_ssids; + + /** + * num_filter_ssids - Number of entries in filter_ssids array + */ + size_t num_filter_ssids; }; /** @@ -246,6 +278,14 @@ struct wpa_driver_auth_params { const u8 *wep_key[4]; size_t wep_key_len[4]; int wep_tx_keyidx; + int local_state_change; +}; + +enum wps_mode { + WPS_MODE_NONE /* no WPS provisioning being used */, + WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */, + WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection + */ }; /** @@ -427,6 +467,28 @@ struct wpa_driver_associate_params { * association. */ const u8 *prev_bssid; + + /** + * wps - WPS mode + * + * If the driver needs to do special configuration for WPS association, + * this variable provides more information on what type of association + * is being requested. Most drivers should not need ot use this. + */ + enum wps_mode wps; + + /** + * p2p - Whether this connection is a P2P group + */ + int p2p; + + /** + * uapsd - UAPSD parameters for the network + * -1 = do not change defaults + * AP mode: 1 = enabled, 0 = disabled + * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE + */ + int uapsd; }; /** @@ -469,9 +531,31 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_AP 0x00000040 /* Driver needs static WEP key setup after association has been completed */ #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080 +/* Driver takes care of P2P management operations */ +#define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100 +/* Driver supports concurrent P2P operations */ +#define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200 +/* + * Driver uses the initial interface as a dedicated management interface, i.e., + * it cannot be used for P2P group operations. + */ +#define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400 +/* This interface is P2P capable (P2P Device, GO, or P2P Client */ +#define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800 unsigned int flags; int max_scan_ssids; + + /** + * max_remain_on_chan - Maximum remain-on-channel duration in msec + */ + unsigned int max_remain_on_chan; + + /** + * max_stations - Maximum number of associated stations the driver + * supports in AP mode + */ + unsigned int max_stations; }; @@ -529,6 +613,22 @@ enum wpa_driver_if_type { * This interface has its own address and Beacon frame. */ WPA_IF_AP_BSS, + + /** + * WPA_IF_P2P_GO - P2P Group Owner + */ + WPA_IF_P2P_GO, + + /** + * WPA_IF_P2P_CLIENT - P2P Client + */ + WPA_IF_P2P_CLIENT, + + /** + * WPA_IF_P2P_GROUP - P2P Group interface (will become either + * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known) + */ + WPA_IF_P2P_GROUP }; struct wpa_init_params { @@ -1127,7 +1227,6 @@ struct wpa_driver_ops { /** * set_beacon - Set Beacon frame template - * @iface: Interface name (main interface or virtual BSS) * @priv: Private driver interface data * @head: Beacon head from IEEE 802.11 header to IEs before TIM IE * @head_len: Length of the head buffer in octets @@ -1142,8 +1241,7 @@ struct wpa_driver_ops { * frame by concatenating the head part with TIM IE generated by the * driver/firmware and finishing with the tail part. */ - int (*set_beacon)(const char *ifname, void *priv, - const u8 *head, size_t head_len, + int (*set_beacon)(void *priv, const u8 *head, size_t head_len, const u8 *tail, size_t tail_len, int dtim_period, int beacon_int); @@ -1189,7 +1287,7 @@ struct wpa_driver_ops { * kernel driver for Beacon frames. This can be left undefined (set to * %NULL) if the driver uses the Beacon template from set_beacon(). */ - int (*set_privacy)(const char *ifname, void *priv, int enabled); + int (*set_privacy)(void *priv, int enabled); /** * get_seqnum - Fetch the current TSC/packet number (AP only) @@ -1221,7 +1319,6 @@ struct wpa_driver_ops { /** * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP) - * @ifname: The interface name (main or virtual BSS) * @priv: Private driver interface data * @elem: Information elements * @elem_len: Length of the elem buffer in octets @@ -1232,8 +1329,7 @@ struct wpa_driver_ops { * undefined (set to %NULL) if the driver uses the Beacon template from * set_beacon(). */ - int (*set_generic_elem)(const char *ifname, void *priv, const u8 *elem, - size_t elem_len); + int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len); /** * read_sta_data - Fetch station data (AP only) @@ -1298,7 +1394,6 @@ struct wpa_driver_ops { /** * hapd_get_ssid - Get the current SSID (AP only) - * @ifname: Interface (master or virtual BSS) * @priv: Private driver interface data * @buf: Buffer for returning the SSID * @len: Maximum length of the buffer @@ -1308,18 +1403,17 @@ struct wpa_driver_ops { * template from set_beacon() and does not reply to Probe Request * frames. */ - int (*hapd_get_ssid)(const char *ifname, void *priv, u8 *buf, int len); + int (*hapd_get_ssid)(void *priv, u8 *buf, int len); /** * hapd_set_ssid - Set SSID (AP only) - * @ifname: Interface (master or virtual BSS) * @priv: Private driver interface data * @buf: SSID * @len: Length of the SSID in octets * Returns: 0 on success, -1 on failure */ - int (*hapd_set_ssid)(const char *ifname, void *priv, const u8 *buf, - int len); + int (*hapd_set_ssid)(void *priv, const u8 *buf, int len); + /** * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP) * @priv: Private driver interface data @@ -1333,7 +1427,6 @@ struct wpa_driver_ops { /** * sta_add - Add a station entry - * @ifname: Interface (master or virtual) * @priv: Private driver interface data * @params: Station parameters * Returns: 0 on success, -1 on failure @@ -1342,8 +1435,7 @@ struct wpa_driver_ops { * station has completed association. This is only used if the driver * does not take care of association processing. */ - int (*sta_add)(const char *ifname, void *priv, - struct hostapd_sta_add_params *params); + int (*sta_add)(void *priv, struct hostapd_sta_add_params *params); /** * get_inact_sec - Get station inactivity duration (AP only) @@ -1457,18 +1549,24 @@ struct wpa_driver_ops { /** * if_add - Add a virtual interface - * @iface: Parent interface name * @priv: Private driver interface data * @type: Interface type * @ifname: Interface name for the new virtual interface * @addr: Local address to use for the interface or %NULL to use the * parent interface address * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces + * @drv_priv: Pointer for overwriting the driver context or %NULL if + * not allowed (applies only to %WPA_IF_AP_BSS type) + * @force_ifname: Buffer for returning an interface name that the + * driver ended up using if it differs from the requested ifname + * @if_addr: Buffer for returning the allocated interface address + * (this may differ from the requested addr if the driver cannot + * change interface address) * Returns: 0 on success, -1 on failure */ - int (*if_add)(const char *iface, void *priv, - enum wpa_driver_if_type type, const char *ifname, - const u8 *addr, void *bss_ctx); + int (*if_add)(void *priv, enum wpa_driver_if_type type, + const char *ifname, const u8 *addr, void *bss_ctx, + void **drv_priv, char *force_ifname, u8 *if_addr); /** * if_remove - Remove a virtual interface @@ -1543,7 +1641,6 @@ struct wpa_driver_ops { /** * set_ht_params - Set HT parameters (AP only) - * @ifname: The interface name (main or virtual BSS) * @priv: Private driver interface data * @ht_capab: HT Capabilities IE * @ht_capab_len: Length of ht_capab in octets @@ -1551,26 +1648,39 @@ struct wpa_driver_ops { * @ht_oper_len: Length of ht_oper in octets * Returns: 0 on success, -1 on failure */ - int (*set_ht_params)(const char *ifname, void *priv, + int (*set_ht_params)(void *priv, const u8 *ht_capab, size_t ht_capab_len, const u8 *ht_oper, size_t ht_oper_len); /** - * set_ap_wps_ie - Add WPS IE into Beacon/Probe Response frames (AP) - * @ifname: The interface name (main or virtual BSS) + * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP) * @priv: Private driver interface data - * @beacon: WPS IE for Beacon frames - * @proberesp: WPS IE for Probe Response frames + * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s) + * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove + * extra IE(s) + * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL + * to remove extra IE(s) * Returns: 0 on success, -1 on failure * * This is an optional function to add WPS IE in the kernel driver for * Beacon and Probe Response frames. This can be left undefined (set * to %NULL) if the driver uses the Beacon template from set_beacon() - * and does not process Probe Request frames. + * and does not process Probe Request frames. If the driver takes care + * of (Re)Association frame processing, the assocresp buffer includes + * WPS IE(s) that need to be added to (Re)Association Response frames + * whenever a (Re)Association Request frame indicated use of WPS. + * + * This will also be used to add P2P IE(s) into Beacon/Probe Response + * frames when operating as a GO. The driver is responsible for adding + * timing related attributes (e.g., NoA) in addition to the IEs + * included here by appending them after these buffers. This call is + * also used to provide Probe Response IEs for P2P Listen state + * operations for drivers that generate the Probe Response frames + * internally. */ - int (*set_ap_wps_ie)(const char *ifname, void *priv, - const struct wpabuf *beacon, - const struct wpabuf *proberesp); + int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon, + const struct wpabuf *proberesp, + const struct wpabuf *assocresp); /** * set_supp_port - Set IEEE 802.1X Supplicant Port status @@ -1613,36 +1723,6 @@ struct wpa_driver_ops { const u8 *data, size_t data_len); /** - * alloc_interface_addr - Allocate a virtual interface address - * @priv: Private driver interface data - * @addr: Buffer for returning the address - * Returns: 0 on success, -1 on failure - * - * This command pre-allocates an interface address for a new virtual - * interface. This can be used before creating a virtual interface if - * the interface mode (e.g., AP vs. station) is not yet known, but the - * address of the virtual interface is already needed. This helps with - * drivers that cannot change interface mode without destroying and - * re-creating the interface. - * - * The allocated address can be used in a bss_add() call to request a - * specific bssid. - */ - int (*alloc_interface_addr)(void *priv, u8 *addr); - - /** - * release_interface_addr - Release a virtual interface address - * @priv: Private driver interface data - * @addr: Address to be freed from alloc_interface_addr() - * - * This command is used to release a virtual interface address that was - * allocated with alloc_interface_addr(), but has not yet been used - * with bss_add() to actually create the interface. This allows the - * driver to release the pending allocation for a new interface. - */ - void (*release_interface_addr)(void *priv, const u8 *addr); - - /** * remain_on_channel - Remain awake on a channel * @priv: Private driver interface data * @freq: Frequency (in MHz) of the channel @@ -1719,6 +1799,111 @@ struct wpa_driver_ops { * normal station operations like scanning to be completed. */ int (*deinit_ap)(void *priv); + + /** + * suspend - Notification on system suspend/hibernate event + * @priv: Private driver interface data + */ + void (*suspend)(void *priv); + + /** + * resume - Notification on system resume/thaw event + * @priv: Private driver interface data + */ + void (*resume)(void *priv); + + /** + * signal_monitor - Set signal monitoring parameters + * @priv: Private driver interface data + * @threshold: Threshold value for signal change events; 0 = disabled + * @hysteresis: Minimum change in signal strength before indicating a + * new event + * Returns: 0 on success, -1 on failure (or if not supported) + * + * This function can be used to configure monitoring of signal strength + * with the current AP. Whenever signal strength drops below the + * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event + * should be generated assuming the signal strength has changed at + * least %hysteresis from the previously indicated signal change event. + */ + int (*signal_monitor)(void *priv, int threshold, int hysteresis); + + /** + * send_frame - Send IEEE 802.11 frame (testing use only) + * @priv: Private driver interface data + * @data: IEEE 802.11 frame with IEEE 802.11 header + * @data_len: Size of the frame + * @encrypt: Whether to encrypt the frame (if keys are set) + * Returns: 0 on success, -1 on failure + * + * This function is only used for debugging purposes and is not + * required to be implemented for normal operations. + */ + int (*send_frame)(void *priv, const u8 *data, size_t data_len, + int encrypt); + + /** + * shared_freq - Get operating frequency of shared interface(s) + * @priv: Private driver interface data + * Returns: Operating frequency in MHz, 0 if no shared operation in + * use, or -1 on failure + * + * This command can be used to request the current operating frequency + * of any virtual interface that shares the same radio to provide + * information for channel selection for other virtual interfaces. + */ + int (*shared_freq)(void *priv); + + /** + * get_noa - Get current Notice of Absence attribute payload + * @priv: Private driver interface data + * @buf: Buffer for returning NoA + * @buf_len: Buffer length in octets + * Returns: Number of octets used in buf, 0 to indicate no NoA is being + * advertized, or -1 on failure + * + * This function is used to fetch the current Notice of Absence + * attribute value from GO. + */ + int (*get_noa)(void *priv, u8 *buf, size_t buf_len); + + /** + * set_noa - Set Notice of Absence parameters for GO (testing) + * @priv: Private driver interface data + * @count: Count + * @start: Start time in ms from next TBTT + * @duration: Duration in ms + * Returns: 0 on success or -1 on failure + * + * This function is used to set Notice of Absence parameters for GO. It + * is used only for testing. To disable NoA, all parameters are set to + * 0. + */ + int (*set_noa)(void *priv, u8 count, int start, int duration); + + /** + * set_p2p_powersave - Set P2P power save options + * @priv: Private driver interface data + * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change + * @opp_ps: 0 = disable, 1 = enable, -1 = no change + * @ctwindow: 0.. = change (msec), -1 = no change + * Returns: 0 on success or -1 on failure + */ + int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps, + int ctwindow); + + /** + * ampdu - Enable/disable aggregation + * @priv: Private driver interface data + * @ampdu: 1/0 = enable/disable A-MPDU aggregation + * Returns: 0 on success or -1 on failure + */ + int (*ampdu)(void *priv, int ampdu); + + /** + * set_intra_bss - Enables/Disables intra BSS bridging + */ + int (*set_intra_bss)(void *priv, int enabled); }; @@ -1991,7 +2176,32 @@ enum wpa_event_type { * %wpa_supplicant, this event is used only if the send_eapol() handler * is used to override the use of l2_packet for EAPOL frame TX. */ - EVENT_EAPOL_RX + EVENT_EAPOL_RX, + + /** + * EVENT_SIGNAL_CHANGE - Indicate change in signal strength + * + * This event is used to indicate changes in the signal strength + * observed in frames received from the current AP if signal strength + * monitoring has been enabled with signal_monitor(). + */ + EVENT_SIGNAL_CHANGE, + + /** + * EVENT_INTERFACE_ENABLED - Notify that interface was enabled + * + * This event is used to indicate that the interface was enabled after + * having been previously disabled, e.g., due to rfkill. + */ + EVENT_INTERFACE_ENABLED, + + /** + * EVENT_INTERFACE_DISABLED - Notify that interface was disabled + * + * This event is used to indicate that the interface was disabled, + * e.g., due to rfkill. + */ + EVENT_INTERFACE_DISABLED }; @@ -2085,6 +2295,22 @@ union wpa_event_data { * addr - Station address (for AP mode) */ const u8 *addr; + + /** + * reason_code - Reason Code (host byte order) used in + * Deauthentication frame + */ + u16 reason_code; + + /** + * ie - Optional IE(s) in Disassociation frame + */ + const u8 *ie; + + /** + * ie_len - Length of ie buffer in octets + */ + size_t ie_len; } disassoc_info; /** @@ -2095,6 +2321,22 @@ union wpa_event_data { * addr - Station address (for AP mode) */ const u8 *addr; + + /** + * reason_code - Reason Code (host byte order) used in + * Deauthentication frame + */ + u16 reason_code; + + /** + * ie - Optional IE(s) in Deauthentication frame + */ + const u8 *ie; + + /** + * ie_len - Length of ie buffer in octets + */ + size_t ie_len; } deauth_info; /** @@ -2363,6 +2605,14 @@ union wpa_event_data { const u8 *data; size_t data_len; } eapol_rx; + + /** + * struct signal_change - Data for EVENT_SIGNAL_CHANGE events + */ + struct signal_change { + int above_threshold; + int current_signal; + } signal_change; }; /**