diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-10-29 14:48:40 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-11-06 07:24:52 -0500 |
commit | 0ee453552f0b1ea87f6f50a077b0ed9d9ac7d6ac (patch) | |
tree | cd0940bf0378b56494a7d41d56d10c8e2209021f /include/net/cfg80211.h | |
parent | 37c73b5f323c973c1db6857494a6685260440be1 (diff) |
wireless: add utility function to get P2P attribute
Parsing the P2P attributes can be tricky as their
contents can be split across multiple (vendor) IEs.
Thus, it's not possible to parse them like IEs (by
returning a pointer to the data.) Instead, provide
a function that copies the attribute data into a
caller-provided buffer and returns the size needed
(useful in case the buffer was too small.)
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r-- | include/net/cfg80211.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 10c9fc68d1af..81d725038f97 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -3617,6 +3617,25 @@ u32 cfg80211_calculate_bitrate(struct rate_info *rate); | |||
3617 | */ | 3617 | */ |
3618 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); | 3618 | void cfg80211_unregister_wdev(struct wireless_dev *wdev); |
3619 | 3619 | ||
3620 | /** | ||
3621 | * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer | ||
3622 | * @ies: the input IE buffer | ||
3623 | * @len: the input length | ||
3624 | * @attr: the attribute ID to find | ||
3625 | * @buf: output buffer, can be %NULL if the data isn't needed, e.g. | ||
3626 | * if the function is only called to get the needed buffer size | ||
3627 | * @bufsize: size of the output buffer | ||
3628 | * | ||
3629 | * The function finds a given P2P attribute in the (vendor) IEs and | ||
3630 | * copies its contents to the given buffer. | ||
3631 | * | ||
3632 | * The return value is a negative error code (-%EILSEQ or -%ENOENT) if | ||
3633 | * the data is malformed or the attribute can't be found (respectively), | ||
3634 | * or the length of the found attribute (which can be zero). | ||
3635 | */ | ||
3636 | unsigned int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len, | ||
3637 | u8 attr, u8 *buf, unsigned int bufsize); | ||
3638 | |||
3620 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 3639 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
3621 | 3640 | ||
3622 | /* wiphy_printk helpers, similar to dev_printk */ | 3641 | /* wiphy_printk helpers, similar to dev_printk */ |