3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

wscutil: Add wsc_build_p2p_attrs

Add a utility for building the simplified WSC IEs used in P2P action
frames and public action frames.  Only three types of WSC attributes are
mandatory in those frames (but different subsets are needed by different
frame types) so add a single utility for building those IEs.  We may
need to add some more optional attributes to those IEs later.
This commit is contained in:
Andrew Zaborowski 2019-07-08 18:59:36 +02:00 committed by Denis Kenzior
parent cc913a6ff6
commit 79dd14cb24
2 changed files with 36 additions and 0 deletions

View File

@ -2457,6 +2457,32 @@ done:
return ret;
}
uint8_t *wsc_build_p2p_attrs(const struct wsc_p2p_attrs *attrs, size_t *out_len)
{
struct wsc_attr_builder *builder;
uint8_t *ret;
builder = wsc_attr_builder_new(512);
if (attrs->version)
build_version(builder, 0x10);
if (attrs->device_password_id)
build_device_password_id(builder, attrs->device_password_id);
if (attrs->config_methods)
build_configuration_methods(builder, attrs->config_methods);
if (!attrs->version2)
goto done;
START_WFA_VENDOR_EXTENSION();
done:
ret = wsc_attr_builder_free(builder, false, out_len);
return ret;
}
bool wsc_uuid_from_addr(const uint8_t addr[], uint8_t *out_uuid)
{
/* Reuse the NSID from WPA Supplicant for compatibility */

View File

@ -642,6 +642,16 @@ uint8_t *wsc_build_wsc_nack(const struct wsc_nack *nack, size_t *out_len);
uint8_t *wsc_build_wsc_done(const struct wsc_done *done, size_t *out_len);
struct wsc_p2p_attrs {
bool version;
bool version2;
enum wsc_device_password_id device_password_id;
uint16_t config_methods;
};
uint8_t *wsc_build_p2p_attrs(const struct wsc_p2p_attrs *attrs,
size_t *out_len);
bool wsc_uuid_from_addr(const uint8_t addr[], uint8_t *out_uuid);
struct wsc_session_key {