diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-02-10 15:25:55 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-02-13 13:45:49 -0500 |
commit | 2a5193119269062608582418deba7af82844159a (patch) | |
tree | 1f2fe8cffbeb7530dce7fa708310f6fb29ab0dd8 /include/net/cfg80211.h | |
parent | 849b7967818995a32c3017542e33eb3155944368 (diff) |
cfg80211/nl80211: scanning (and mac80211 update to use it)
This patch adds basic scan capability to cfg80211/nl80211 and
changes mac80211 to use it. The BSS list that cfg80211 maintains
is made driver-accessible with a private area in each BSS struct,
but mac80211 doesn't yet use it. That's another large project.
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 | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index dd1fd51638fc..09a0b268e5cf 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -4,6 +4,10 @@ | |||
4 | #include <linux/netlink.h> | 4 | #include <linux/netlink.h> |
5 | #include <linux/skbuff.h> | 5 | #include <linux/skbuff.h> |
6 | #include <linux/nl80211.h> | 6 | #include <linux/nl80211.h> |
7 | #include <linux/if_ether.h> | ||
8 | #include <linux/ieee80211.h> | ||
9 | #include <linux/wireless.h> | ||
10 | #include <net/iw_handler.h> | ||
7 | #include <net/genetlink.h> | 11 | #include <net/genetlink.h> |
8 | /* remove once we remove the wext stuff */ | 12 | /* remove once we remove the wext stuff */ |
9 | #include <net/iw_handler.h> | 13 | #include <net/iw_handler.h> |
@@ -505,6 +509,83 @@ struct wiphy; | |||
505 | struct ieee80211_channel; | 509 | struct ieee80211_channel; |
506 | 510 | ||
507 | /** | 511 | /** |
512 | * struct cfg80211_ssid - SSID description | ||
513 | * @ssid: the SSID | ||
514 | * @ssid_len: length of the ssid | ||
515 | */ | ||
516 | struct cfg80211_ssid { | ||
517 | u8 ssid[IEEE80211_MAX_SSID_LEN]; | ||
518 | u8 ssid_len; | ||
519 | }; | ||
520 | |||
521 | /** | ||
522 | * struct cfg80211_scan_request - scan request description | ||
523 | * | ||
524 | * @ssids: SSIDs to scan for (active scan only) | ||
525 | * @n_ssids: number of SSIDs | ||
526 | * @channels: channels to scan on. | ||
527 | * @n_channels: number of channels for each band | ||
528 | * @wiphy: the wiphy this was for | ||
529 | * @ifidx: the interface index | ||
530 | */ | ||
531 | struct cfg80211_scan_request { | ||
532 | struct cfg80211_ssid *ssids; | ||
533 | int n_ssids; | ||
534 | struct ieee80211_channel **channels; | ||
535 | u32 n_channels; | ||
536 | |||
537 | /* internal */ | ||
538 | struct wiphy *wiphy; | ||
539 | int ifidx; | ||
540 | }; | ||
541 | |||
542 | /** | ||
543 | * enum cfg80211_signal_type - signal type | ||
544 | * | ||
545 | * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available | ||
546 | * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm) | ||
547 | * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100 | ||
548 | */ | ||
549 | enum cfg80211_signal_type { | ||
550 | CFG80211_SIGNAL_TYPE_NONE, | ||
551 | CFG80211_SIGNAL_TYPE_MBM, | ||
552 | CFG80211_SIGNAL_TYPE_UNSPEC, | ||
553 | }; | ||
554 | |||
555 | /** | ||
556 | * struct cfg80211_bss - BSS description | ||
557 | * | ||
558 | * This structure describes a BSS (which may also be a mesh network) | ||
559 | * for use in scan results and similar. | ||
560 | * | ||
561 | * @bssid: BSSID of the BSS | ||
562 | * @tsf: timestamp of last received update | ||
563 | * @beacon_interval: the beacon interval as from the frame | ||
564 | * @capability: the capability field in host byte order | ||
565 | * @information_elements: the information elements (Note that there | ||
566 | * is no guarantee that these are well-formed!) | ||
567 | * @len_information_elements: total length of the information elements | ||
568 | * @signal: signal strength value | ||
569 | * @signal_type: signal type | ||
570 | * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes | ||
571 | */ | ||
572 | struct cfg80211_bss { | ||
573 | struct ieee80211_channel *channel; | ||
574 | |||
575 | u8 bssid[ETH_ALEN]; | ||
576 | u64 tsf; | ||
577 | u16 beacon_interval; | ||
578 | u16 capability; | ||
579 | u8 *information_elements; | ||
580 | size_t len_information_elements; | ||
581 | |||
582 | s32 signal; | ||
583 | enum cfg80211_signal_type signal_type; | ||
584 | |||
585 | u8 priv[0] __attribute__((__aligned__(sizeof(void *)))); | ||
586 | }; | ||
587 | |||
588 | /** | ||
508 | * struct cfg80211_ops - backend description for wireless configuration | 589 | * struct cfg80211_ops - backend description for wireless configuration |
509 | * | 590 | * |
510 | * This struct is registered by fullmac card drivers and/or wireless stacks | 591 | * This struct is registered by fullmac card drivers and/or wireless stacks |
@@ -571,6 +652,11 @@ struct ieee80211_channel; | |||
571 | * @set_channel: Set channel | 652 | * @set_channel: Set channel |
572 | * | 653 | * |
573 | * @set_mgmt_extra_ie: Set extra IE data for management frames | 654 | * @set_mgmt_extra_ie: Set extra IE data for management frames |
655 | * | ||
656 | * @scan: Request to do a scan. If returning zero, the scan request is given | ||
657 | * the driver, and will be valid until passed to cfg80211_scan_done(). | ||
658 | * For scan results, call cfg80211_inform_bss(); you can call this outside | ||
659 | * the scan/scan_done bracket too. | ||
574 | */ | 660 | */ |
575 | struct cfg80211_ops { | 661 | struct cfg80211_ops { |
576 | int (*suspend)(struct wiphy *wiphy); | 662 | int (*suspend)(struct wiphy *wiphy); |
@@ -648,6 +734,9 @@ struct cfg80211_ops { | |||
648 | int (*set_mgmt_extra_ie)(struct wiphy *wiphy, | 734 | int (*set_mgmt_extra_ie)(struct wiphy *wiphy, |
649 | struct net_device *dev, | 735 | struct net_device *dev, |
650 | struct mgmt_extra_ie_params *params); | 736 | struct mgmt_extra_ie_params *params); |
737 | |||
738 | int (*scan)(struct wiphy *wiphy, struct net_device *dev, | ||
739 | struct cfg80211_scan_request *request); | ||
651 | }; | 740 | }; |
652 | 741 | ||
653 | /* temporary wext handlers */ | 742 | /* temporary wext handlers */ |
@@ -658,5 +747,47 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, | |||
658 | u32 *mode, char *extra); | 747 | u32 *mode, char *extra); |
659 | int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, | 748 | int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, |
660 | u32 *mode, char *extra); | 749 | u32 *mode, char *extra); |
750 | int cfg80211_wext_siwscan(struct net_device *dev, | ||
751 | struct iw_request_info *info, | ||
752 | union iwreq_data *wrqu, char *extra); | ||
753 | int cfg80211_wext_giwscan(struct net_device *dev, | ||
754 | struct iw_request_info *info, | ||
755 | struct iw_point *data, char *extra); | ||
756 | |||
757 | /** | ||
758 | * cfg80211_scan_done - notify that scan finished | ||
759 | * | ||
760 | * @request: the corresponding scan request | ||
761 | * @aborted: set to true if the scan was aborted for any reason, | ||
762 | * userspace will be notified of that | ||
763 | */ | ||
764 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); | ||
765 | |||
766 | /** | ||
767 | * cfg80211_inform_bss - inform cfg80211 of a new BSS | ||
768 | * | ||
769 | * @wiphy: the wiphy reporting the BSS | ||
770 | * @bss: the found BSS | ||
771 | * @gfp: context flags | ||
772 | * | ||
773 | * This informs cfg80211 that BSS information was found and | ||
774 | * the BSS should be updated/added. | ||
775 | */ | ||
776 | struct cfg80211_bss* | ||
777 | cfg80211_inform_bss_frame(struct wiphy *wiphy, | ||
778 | struct ieee80211_channel *channel, | ||
779 | struct ieee80211_mgmt *mgmt, size_t len, | ||
780 | s32 signal, enum cfg80211_signal_type sigtype, | ||
781 | gfp_t gfp); | ||
782 | |||
783 | struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, | ||
784 | struct ieee80211_channel *channel, | ||
785 | const u8 *bssid, | ||
786 | const u8 *ssid, size_t ssid_len); | ||
787 | struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy, | ||
788 | struct ieee80211_channel *channel, | ||
789 | const u8 *meshid, size_t meshidlen, | ||
790 | const u8 *meshcfg); | ||
791 | void cfg80211_put_bss(struct cfg80211_bss *bss); | ||
661 | 792 | ||
662 | #endif /* __NET_CFG80211_H */ | 793 | #endif /* __NET_CFG80211_H */ |