Lines Matching refs:dev

16 int wps_build_manufacturer(struct wps_device_data *dev, struct wpabuf *msg)  in wps_build_manufacturer()  argument
21 len = dev->manufacturer ? os_strlen(dev->manufacturer) : 0; in wps_build_manufacturer()
35 wpabuf_put_data(msg, dev->manufacturer, len); in wps_build_manufacturer()
40 int wps_build_model_name(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_model_name() argument
45 len = dev->model_name ? os_strlen(dev->model_name) : 0; in wps_build_model_name()
59 wpabuf_put_data(msg, dev->model_name, len); in wps_build_model_name()
64 int wps_build_model_number(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_model_number() argument
69 len = dev->model_number ? os_strlen(dev->model_number) : 0; in wps_build_model_number()
83 wpabuf_put_data(msg, dev->model_number, len); in wps_build_model_number()
88 int wps_build_serial_number(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_serial_number() argument
93 len = dev->serial_number ? os_strlen(dev->serial_number) : 0; in wps_build_serial_number()
107 wpabuf_put_data(msg, dev->serial_number, len); in wps_build_serial_number()
112 int wps_build_primary_dev_type(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_primary_dev_type() argument
117 wpabuf_put_data(msg, dev->pri_dev_type, WPS_DEV_TYPE_LEN); in wps_build_primary_dev_type()
122 int wps_build_secondary_dev_type(struct wps_device_data *dev, in wps_build_secondary_dev_type() argument
125 if (!dev->num_sec_dev_types) in wps_build_secondary_dev_type()
130 wpabuf_put_be16(msg, WPS_DEV_TYPE_LEN * dev->num_sec_dev_types); in wps_build_secondary_dev_type()
131 wpabuf_put_data(msg, dev->sec_dev_type, in wps_build_secondary_dev_type()
132 WPS_DEV_TYPE_LEN * dev->num_sec_dev_types); in wps_build_secondary_dev_type()
138 int wps_build_req_dev_type(struct wps_device_data *dev, struct wpabuf *msg, in wps_build_req_dev_type() argument
158 int wps_build_dev_name(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_dev_name() argument
163 len = dev->device_name ? os_strlen(dev->device_name) : 0; in wps_build_dev_name()
177 wpabuf_put_data(msg, dev->device_name, len); in wps_build_dev_name()
182 int wps_build_device_attrs(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_device_attrs() argument
184 if (wps_build_manufacturer(dev, msg) || in wps_build_device_attrs()
185 wps_build_model_name(dev, msg) || in wps_build_device_attrs()
186 wps_build_model_number(dev, msg) || in wps_build_device_attrs()
187 wps_build_serial_number(dev, msg) || in wps_build_device_attrs()
188 wps_build_primary_dev_type(dev, msg) || in wps_build_device_attrs()
189 wps_build_dev_name(dev, msg)) in wps_build_device_attrs()
195 int wps_build_os_version(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_os_version() argument
200 wpabuf_put_be32(msg, 0x80000000 | dev->os_version); in wps_build_os_version()
205 int wps_build_vendor_ext_m1(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_vendor_ext_m1() argument
207 if (dev->vendor_ext_m1 != NULL) { in wps_build_vendor_ext_m1()
209 wpabuf_head_u8(dev->vendor_ext_m1), in wps_build_vendor_ext_m1()
210 wpabuf_len(dev->vendor_ext_m1)); in wps_build_vendor_ext_m1()
212 wpabuf_put_be16(msg, wpabuf_len(dev->vendor_ext_m1)); in wps_build_vendor_ext_m1()
213 wpabuf_put_buf(msg, dev->vendor_ext_m1); in wps_build_vendor_ext_m1()
219 int wps_build_rf_bands(struct wps_device_data *dev, struct wpabuf *msg, in wps_build_rf_bands() argument
222 return wps_build_rf_bands_attr(msg, rf_band ? rf_band : dev->rf_bands); in wps_build_rf_bands()
226 int wps_build_vendor_ext(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_vendor_ext() argument
231 if (dev->vendor_ext[i] == NULL) in wps_build_vendor_ext()
234 wpabuf_head_u8(dev->vendor_ext[i]), in wps_build_vendor_ext()
235 wpabuf_len(dev->vendor_ext[i])); in wps_build_vendor_ext()
237 wpabuf_put_be16(msg, wpabuf_len(dev->vendor_ext[i])); in wps_build_vendor_ext()
238 wpabuf_put_buf(msg, dev->vendor_ext[i]); in wps_build_vendor_ext()
245 static int wps_process_manufacturer(struct wps_device_data *dev, const u8 *str, in wps_process_manufacturer() argument
255 os_free(dev->manufacturer); in wps_process_manufacturer()
256 dev->manufacturer = dup_binstr(str, str_len); in wps_process_manufacturer()
257 if (dev->manufacturer == NULL) in wps_process_manufacturer()
264 static int wps_process_model_name(struct wps_device_data *dev, const u8 *str, in wps_process_model_name() argument
274 os_free(dev->model_name); in wps_process_model_name()
275 dev->model_name = dup_binstr(str, str_len); in wps_process_model_name()
276 if (dev->model_name == NULL) in wps_process_model_name()
283 static int wps_process_model_number(struct wps_device_data *dev, const u8 *str, in wps_process_model_number() argument
293 os_free(dev->model_number); in wps_process_model_number()
294 dev->model_number = dup_binstr(str, str_len); in wps_process_model_number()
295 if (dev->model_number == NULL) in wps_process_model_number()
302 static int wps_process_serial_number(struct wps_device_data *dev, in wps_process_serial_number() argument
312 os_free(dev->serial_number); in wps_process_serial_number()
313 dev->serial_number = dup_binstr(str, str_len); in wps_process_serial_number()
314 if (dev->serial_number == NULL) in wps_process_serial_number()
321 static int wps_process_dev_name(struct wps_device_data *dev, const u8 *str, in wps_process_dev_name() argument
331 os_free(dev->device_name); in wps_process_dev_name()
332 dev->device_name = dup_binstr(str, str_len); in wps_process_dev_name()
333 if (dev->device_name == NULL) in wps_process_dev_name()
340 static int wps_process_primary_dev_type(struct wps_device_data *dev, in wps_process_primary_dev_type() argument
352 os_memcpy(dev->pri_dev_type, dev_type, WPS_DEV_TYPE_LEN); in wps_process_primary_dev_type()
354 wps_dev_type_bin2str(dev->pri_dev_type, devtype, in wps_process_primary_dev_type()
361 int wps_process_device_attrs(struct wps_device_data *dev, in wps_process_device_attrs() argument
364 if (wps_process_manufacturer(dev, attr->manufacturer, in wps_process_device_attrs()
366 wps_process_model_name(dev, attr->model_name, in wps_process_device_attrs()
368 wps_process_model_number(dev, attr->model_number, in wps_process_device_attrs()
370 wps_process_serial_number(dev, attr->serial_number, in wps_process_device_attrs()
372 wps_process_primary_dev_type(dev, attr->primary_dev_type) || in wps_process_device_attrs()
373 wps_process_dev_name(dev, attr->dev_name, attr->dev_name_len)) in wps_process_device_attrs()
379 int wps_process_os_version(struct wps_device_data *dev, const u8 *ver) in wps_process_os_version() argument
386 dev->os_version = WPA_GET_BE32(ver); in wps_process_os_version()
387 wpa_printf(MSG_DEBUG, "WPS: OS Version %08x", dev->os_version); in wps_process_os_version()
393 void wps_process_vendor_ext_m1(struct wps_device_data *dev, const u8 ext) in wps_process_vendor_ext_m1() argument
395 dev->multi_ap_ext = ext; in wps_process_vendor_ext_m1()
397 dev->multi_ap_ext); in wps_process_vendor_ext_m1()
401 int wps_process_rf_bands(struct wps_device_data *dev, const u8 *bands) in wps_process_rf_bands() argument
408 dev->rf_bands = *bands; in wps_process_rf_bands()
409 wpa_printf(MSG_DEBUG, "WPS: Enrollee RF Bands 0x%x", dev->rf_bands); in wps_process_rf_bands()
415 void wps_device_data_free(struct wps_device_data *dev) in wps_device_data_free() argument
417 os_free(dev->device_name); in wps_device_data_free()
418 dev->device_name = NULL; in wps_device_data_free()
419 os_free(dev->manufacturer); in wps_device_data_free()
420 dev->manufacturer = NULL; in wps_device_data_free()
421 os_free(dev->model_name); in wps_device_data_free()
422 dev->model_name = NULL; in wps_device_data_free()
423 os_free(dev->model_number); in wps_device_data_free()
424 dev->model_number = NULL; in wps_device_data_free()
425 os_free(dev->serial_number); in wps_device_data_free()
426 dev->serial_number = NULL; in wps_device_data_free()