]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Add builder functions for AP Channel and RF Bands attributes
authorJouni Malinen <jouni@qca.qualcomm.com>
Sat, 27 Apr 2013 17:43:35 +0000 (20:43 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jan 2014 19:10:55 +0000 (21:10 +0200)
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/wps/wps_attr_build.c
src/wps/wps_dev_attr.c
src/wps/wps_i.h

index 336246eaf42a8fcf9e6e8ad37acab0746ef8dc7d..666c98d20d5b9c34f04d2d809b8827843613c528 100644 (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;
+}
index fe736f32fbe38bd123c46cf8dc77ab4c888480e0..87910b071a3db70fe47a49dd44f6ec1de499ca71 100644 (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);
 }
 
 
index dac12508669102bd1c4de64b6c1d3cd95f7f835a..aa8a6fadb0eae5c325f29b9095769d311fcbe2b0 100644 (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,