WPS: Add builder functions for AP Channel and RF Bands attributes

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-04-27 20:43:35 +03:00 committed by Jouni Malinen
parent ea43ad960b
commit 72403ecef7
3 changed files with 23 additions and 5 deletions

View file

@ -449,3 +449,23 @@ int wps_build_mac_addr(struct wpabuf *msg, const u8 *addr)
wpabuf_put_data(msg, addr, ETH_ALEN);
return 0;
}
int wps_build_rf_bands_attr(struct wpabuf *msg, u8 rf_bands)
{
wpa_printf(MSG_DEBUG, "WPS: * RF Bands (%x)", rf_bands);
wpabuf_put_be16(msg, ATTR_RF_BANDS);
wpabuf_put_be16(msg, 1);
wpabuf_put_u8(msg, rf_bands);
return 0;
}
int wps_build_ap_channel(struct wpabuf *msg, u16 ap_channel)
{
wpa_printf(MSG_DEBUG, "WPS: * AP Channel (%u)", ap_channel);
wpabuf_put_be16(msg, ATTR_AP_CHANNEL);
wpabuf_put_be16(msg, 2);
wpabuf_put_be16(msg, ap_channel);
return 0;
}

View file

@ -220,11 +220,7 @@ int wps_build_vendor_ext_m1(struct wps_device_data *dev, struct wpabuf *msg)
int wps_build_rf_bands(struct wps_device_data *dev, struct wpabuf *msg,
u8 rf_band)
{
wpa_printf(MSG_DEBUG, "WPS: * RF Bands (%x)", dev->rf_bands);
wpabuf_put_be16(msg, ATTR_RF_BANDS);
wpabuf_put_be16(msg, 1);
wpabuf_put_u8(msg, rf_band ? rf_band : dev->rf_bands);
return 0;
return wps_build_rf_bands_attr(msg, rf_band ? rf_band : dev->rf_bands);
}

View file

@ -173,6 +173,8 @@ int wps_build_oob_dev_pw(struct wpabuf *msg, u16 dev_pw_id,
size_t dev_pw_len);
struct wpabuf * wps_ie_encapsulate(struct wpabuf *data);
int wps_build_mac_addr(struct wpabuf *msg, const u8 *addr);
int wps_build_rf_bands_attr(struct wpabuf *msg, u8 rf_bands);
int wps_build_ap_channel(struct wpabuf *msg, u16 ap_channel);
/* wps_attr_process.c */
int wps_process_authenticator(struct wps_data *wps, const u8 *authenticator,