diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2009-07-01 15:26:54 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:51 -0400 |
commit | b23aa676ab9d54469cda9f7151f51a2851c6f36e (patch) | |
tree | dd4af5fa38dbfec362ded1d655ed584bbcf60a53 /include/net/cfg80211.h | |
parent | 6a669e65c5ec393a650362874e13f7d3365a7827 (diff) |
cfg80211: connect/disconnect API
This patch introduces the cfg80211 connect/disconnect API.
The goal here is to run the AUTH and ASSOC steps in one call.
This is needed for some fullmac cards that run both steps
directly from the target, after the host driver sends a
connect command.
Additionally, all the new crypto parameters for connect()
are now also valid for associate() -- although associate
requires the IEs to be used, the information can be useful
for drivers and should be given.
Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r-- | include/net/cfg80211.h | 135 |
1 files changed, 129 insertions, 6 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 885d4e5bc4b5..68e11321ed74 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -605,6 +605,30 @@ struct cfg80211_bss { | |||
605 | }; | 605 | }; |
606 | 606 | ||
607 | /** | 607 | /** |
608 | * struct cfg80211_crypto_settings - Crypto settings | ||
609 | * @wpa_versions: indicates which, if any, WPA versions are enabled | ||
610 | * (from enum nl80211_wpa_versions) | ||
611 | * @cipher_group: group key cipher suite (or 0 if unset) | ||
612 | * @n_ciphers_pairwise: number of AP supported unicast ciphers | ||
613 | * @ciphers_pairwise: unicast key cipher suites | ||
614 | * @n_akm_suites: number of AKM suites | ||
615 | * @akm_suites: AKM suites | ||
616 | * @control_port: Whether user space controls IEEE 802.1X port, i.e., | ||
617 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | ||
618 | * required to assume that the port is unauthorized until authorized by | ||
619 | * user space. Otherwise, port is marked authorized by default. | ||
620 | */ | ||
621 | struct cfg80211_crypto_settings { | ||
622 | u32 wpa_versions; | ||
623 | u32 cipher_group; | ||
624 | int n_ciphers_pairwise; | ||
625 | u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES]; | ||
626 | int n_akm_suites; | ||
627 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; | ||
628 | bool control_port; | ||
629 | }; | ||
630 | |||
631 | /** | ||
608 | * struct cfg80211_auth_request - Authentication request data | 632 | * struct cfg80211_auth_request - Authentication request data |
609 | * | 633 | * |
610 | * This structure provides information needed to complete IEEE 802.11 | 634 | * This structure provides information needed to complete IEEE 802.11 |
@@ -658,10 +682,7 @@ struct cfg80211_auth_request { | |||
658 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL | 682 | * @ie: Extra IEs to add to (Re)Association Request frame or %NULL |
659 | * @ie_len: Length of ie buffer in octets | 683 | * @ie_len: Length of ie buffer in octets |
660 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association | 684 | * @use_mfp: Use management frame protection (IEEE 802.11w) in this association |
661 | * @control_port: Whether user space controls IEEE 802.1X port, i.e., | 685 | * @crypto: crypto settings |
662 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | ||
663 | * required to assume that the port is unauthorized until authorized by | ||
664 | * user space. Otherwise, port is marked authorized by default. | ||
665 | */ | 686 | */ |
666 | struct cfg80211_assoc_request { | 687 | struct cfg80211_assoc_request { |
667 | struct ieee80211_channel *chan; | 688 | struct ieee80211_channel *chan; |
@@ -671,7 +692,7 @@ struct cfg80211_assoc_request { | |||
671 | const u8 *ie; | 692 | const u8 *ie; |
672 | size_t ie_len; | 693 | size_t ie_len; |
673 | bool use_mfp; | 694 | bool use_mfp; |
674 | bool control_port; | 695 | struct cfg80211_crypto_settings crypto; |
675 | }; | 696 | }; |
676 | 697 | ||
677 | /** | 698 | /** |
@@ -738,6 +759,36 @@ struct cfg80211_ibss_params { | |||
738 | }; | 759 | }; |
739 | 760 | ||
740 | /** | 761 | /** |
762 | * struct cfg80211_connect_params - Connection parameters | ||
763 | * | ||
764 | * This structure provides information needed to complete IEEE 802.11 | ||
765 | * authentication and association. | ||
766 | * | ||
767 | * @channel: The channel to use or %NULL if not specified (auto-select based | ||
768 | * on scan results) | ||
769 | * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan | ||
770 | * results) | ||
771 | * @ssid: SSID | ||
772 | * @ssid_len: Length of ssid in octets | ||
773 | * @auth_type: Authentication type (algorithm) | ||
774 | * @assoc_ie: IEs for association request | ||
775 | * @assoc_ie_len: Length of assoc_ie in octets | ||
776 | * @privacy: indicates whether privacy-enabled APs should be used | ||
777 | * @crypto: crypto settings | ||
778 | */ | ||
779 | struct cfg80211_connect_params { | ||
780 | struct ieee80211_channel *channel; | ||
781 | u8 *bssid; | ||
782 | u8 *ssid; | ||
783 | size_t ssid_len; | ||
784 | enum nl80211_auth_type auth_type; | ||
785 | u8 *ie; | ||
786 | size_t ie_len; | ||
787 | bool privacy; | ||
788 | struct cfg80211_crypto_settings crypto; | ||
789 | }; | ||
790 | |||
791 | /** | ||
741 | * enum wiphy_params_flags - set_wiphy_params bitfield values | 792 | * enum wiphy_params_flags - set_wiphy_params bitfield values |
742 | * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed | 793 | * WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed |
743 | * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed | 794 | * WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed |
@@ -841,6 +892,12 @@ enum tx_power_setting { | |||
841 | * @deauth: Request to deauthenticate from the specified peer | 892 | * @deauth: Request to deauthenticate from the specified peer |
842 | * @disassoc: Request to disassociate from the specified peer | 893 | * @disassoc: Request to disassociate from the specified peer |
843 | * | 894 | * |
895 | * @connect: Connect to the ESS with the specified parameters. When connected, | ||
896 | * call cfg80211_connect_result() with status code %WLAN_STATUS_SUCCESS. | ||
897 | * If the connection fails for some reason, call cfg80211_connect_result() | ||
898 | * with the status from the AP. | ||
899 | * @disconnect: Disconnect from the BSS/ESS. | ||
900 | * | ||
844 | * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call | 901 | * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call |
845 | * cfg80211_ibss_joined(), also call that function when changing BSSID due | 902 | * cfg80211_ibss_joined(), also call that function when changing BSSID due |
846 | * to a merge. | 903 | * to a merge. |
@@ -946,6 +1003,11 @@ struct cfg80211_ops { | |||
946 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, | 1003 | int (*disassoc)(struct wiphy *wiphy, struct net_device *dev, |
947 | struct cfg80211_disassoc_request *req); | 1004 | struct cfg80211_disassoc_request *req); |
948 | 1005 | ||
1006 | int (*connect)(struct wiphy *wiphy, struct net_device *dev, | ||
1007 | struct cfg80211_connect_params *sme); | ||
1008 | int (*disconnect)(struct wiphy *wiphy, struct net_device *dev, | ||
1009 | u16 reason_code); | ||
1010 | |||
949 | int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, | 1011 | int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev, |
950 | struct cfg80211_ibss_params *params); | 1012 | struct cfg80211_ibss_params *params); |
951 | int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); | 1013 | int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev); |
@@ -1174,10 +1236,15 @@ struct wireless_dev { | |||
1174 | struct list_head list; | 1236 | struct list_head list; |
1175 | struct net_device *netdev; | 1237 | struct net_device *netdev; |
1176 | 1238 | ||
1177 | /* currently used for IBSS - might be rearranged in the future */ | 1239 | /* currently used for IBSS and SME - might be rearranged later */ |
1178 | struct cfg80211_bss *current_bss; | 1240 | struct cfg80211_bss *current_bss; |
1179 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | 1241 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
1180 | u8 ssid_len; | 1242 | u8 ssid_len; |
1243 | enum { | ||
1244 | CFG80211_SME_IDLE, | ||
1245 | CFG80211_SME_CONNECTING, /* ->connect called */ | ||
1246 | CFG80211_SME_CONNECTED, | ||
1247 | } sme_state; | ||
1181 | 1248 | ||
1182 | #ifdef CONFIG_WIRELESS_EXT | 1249 | #ifdef CONFIG_WIRELESS_EXT |
1183 | /* wext data */ | 1250 | /* wext data */ |
@@ -1788,4 +1855,60 @@ void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp); | |||
1788 | #define CFG80211_TESTMODE_CMD(cmd) | 1855 | #define CFG80211_TESTMODE_CMD(cmd) |
1789 | #endif | 1856 | #endif |
1790 | 1857 | ||
1858 | /** | ||
1859 | * cfg80211_connect_result - notify cfg80211 of connection result | ||
1860 | * | ||
1861 | * @dev: network device | ||
1862 | * @bssid: the BSSID of the AP | ||
1863 | * @req_ie: association request IEs (maybe be %NULL) | ||
1864 | * @req_ie_len: association request IEs length | ||
1865 | * @resp_ie: association response IEs (may be %NULL) | ||
1866 | * @resp_ie_len: assoc response IEs length | ||
1867 | * @status: status code, 0 for successful connection, use | ||
1868 | * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you | ||
1869 | * the real status code for failures. | ||
1870 | * @gfp: allocation flags | ||
1871 | * | ||
1872 | * It should be called by the underlying driver whenever connect() has | ||
1873 | * succeeded. | ||
1874 | */ | ||
1875 | void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | ||
1876 | const u8 *req_ie, size_t req_ie_len, | ||
1877 | const u8 *resp_ie, size_t resp_ie_len, | ||
1878 | u16 status, gfp_t gfp); | ||
1879 | |||
1880 | /** | ||
1881 | * cfg80211_roamed - notify cfg80211 of roaming | ||
1882 | * | ||
1883 | * @dev: network device | ||
1884 | * @bssid: the BSSID of the new AP | ||
1885 | * @req_ie: association request IEs (maybe be %NULL) | ||
1886 | * @req_ie_len: association request IEs length | ||
1887 | * @resp_ie: association response IEs (may be %NULL) | ||
1888 | * @resp_ie_len: assoc response IEs length | ||
1889 | * @gfp: allocation flags | ||
1890 | * | ||
1891 | * It should be called by the underlying driver whenever it roamed | ||
1892 | * from one AP to another while connected. | ||
1893 | */ | ||
1894 | void cfg80211_roamed(struct net_device *dev, const u8 *bssid, | ||
1895 | const u8 *req_ie, size_t req_ie_len, | ||
1896 | const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp); | ||
1897 | |||
1898 | /** | ||
1899 | * cfg80211_disconnected - notify cfg80211 that connection was dropped | ||
1900 | * | ||
1901 | * @dev: network device | ||
1902 | * @ie: information elements of the deauth/disassoc frame (may be %NULL) | ||
1903 | * @ie_len: length of IEs | ||
1904 | * @reason: reason code for the disconnection, set it to 0 if unknown | ||
1905 | * @gfp: allocation flags | ||
1906 | * | ||
1907 | * After it calls this function, the driver should enter an idle state | ||
1908 | * and not try to connect to any AP any more. | ||
1909 | */ | ||
1910 | void cfg80211_disconnected(struct net_device *dev, u16 reason, | ||
1911 | u8 *ie, size_t ie_len, gfp_t gfp); | ||
1912 | |||
1913 | |||
1791 | #endif /* __NET_CFG80211_H */ | 1914 | #endif /* __NET_CFG80211_H */ |