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 int wps_build_application_ext(struct wps_device_data *dev, struct wpabuf *msg) in wps_build_application_ext() argument
247 if (!dev->application_ext) in wps_build_application_ext()
251 dev->application_ext); in wps_build_application_ext()
253 wpabuf_put_be16(msg, wpabuf_len(dev->application_ext)); in wps_build_application_ext()
254 wpabuf_put_buf(msg, dev->application_ext); in wps_build_application_ext()
260 static int wps_process_manufacturer(struct wps_device_data *dev, const u8 *str, in wps_process_manufacturer() argument
270 os_free(dev->manufacturer); in wps_process_manufacturer()
271 dev->manufacturer = dup_binstr(str, str_len); in wps_process_manufacturer()
272 if (dev->manufacturer == NULL) in wps_process_manufacturer()
279 static int wps_process_model_name(struct wps_device_data *dev, const u8 *str, in wps_process_model_name() argument
289 os_free(dev->model_name); in wps_process_model_name()
290 dev->model_name = dup_binstr(str, str_len); in wps_process_model_name()
291 if (dev->model_name == NULL) in wps_process_model_name()
298 static int wps_process_model_number(struct wps_device_data *dev, const u8 *str, in wps_process_model_number() argument
308 os_free(dev->model_number); in wps_process_model_number()
309 dev->model_number = dup_binstr(str, str_len); in wps_process_model_number()
310 if (dev->model_number == NULL) in wps_process_model_number()
317 static int wps_process_serial_number(struct wps_device_data *dev, in wps_process_serial_number() argument
327 os_free(dev->serial_number); in wps_process_serial_number()
328 dev->serial_number = dup_binstr(str, str_len); in wps_process_serial_number()
329 if (dev->serial_number == NULL) in wps_process_serial_number()
336 static int wps_process_dev_name(struct wps_device_data *dev, const u8 *str, in wps_process_dev_name() argument
346 os_free(dev->device_name); in wps_process_dev_name()
347 dev->device_name = dup_binstr(str, str_len); in wps_process_dev_name()
348 if (dev->device_name == NULL) in wps_process_dev_name()
355 static int wps_process_primary_dev_type(struct wps_device_data *dev, in wps_process_primary_dev_type() argument
367 os_memcpy(dev->pri_dev_type, dev_type, WPS_DEV_TYPE_LEN); in wps_process_primary_dev_type()
369 wps_dev_type_bin2str(dev->pri_dev_type, devtype, in wps_process_primary_dev_type()
376 int wps_process_device_attrs(struct wps_device_data *dev, in wps_process_device_attrs() argument
379 if (wps_process_manufacturer(dev, attr->manufacturer, in wps_process_device_attrs()
381 wps_process_model_name(dev, attr->model_name, in wps_process_device_attrs()
383 wps_process_model_number(dev, attr->model_number, in wps_process_device_attrs()
385 wps_process_serial_number(dev, attr->serial_number, in wps_process_device_attrs()
387 wps_process_primary_dev_type(dev, attr->primary_dev_type) || in wps_process_device_attrs()
388 wps_process_dev_name(dev, attr->dev_name, attr->dev_name_len)) in wps_process_device_attrs()
394 int wps_process_os_version(struct wps_device_data *dev, const u8 *ver) in wps_process_os_version() argument
401 dev->os_version = WPA_GET_BE32(ver); in wps_process_os_version()
402 wpa_printf(MSG_DEBUG, "WPS: OS Version %08x", dev->os_version); in wps_process_os_version()
408 void wps_process_vendor_ext_m1(struct wps_device_data *dev, const u8 ext) in wps_process_vendor_ext_m1() argument
410 dev->multi_ap_ext = ext; in wps_process_vendor_ext_m1()
412 dev->multi_ap_ext); in wps_process_vendor_ext_m1()
416 int wps_process_rf_bands(struct wps_device_data *dev, const u8 *bands) in wps_process_rf_bands() argument
423 dev->rf_bands = *bands; in wps_process_rf_bands()
424 wpa_printf(MSG_DEBUG, "WPS: Enrollee RF Bands 0x%x", dev->rf_bands); in wps_process_rf_bands()
430 void wps_device_data_free(struct wps_device_data *dev) in wps_device_data_free() argument
432 os_free(dev->device_name); in wps_device_data_free()
433 dev->device_name = NULL; in wps_device_data_free()
434 os_free(dev->manufacturer); in wps_device_data_free()
435 dev->manufacturer = NULL; in wps_device_data_free()
436 os_free(dev->model_name); in wps_device_data_free()
437 dev->model_name = NULL; in wps_device_data_free()
438 os_free(dev->model_number); in wps_device_data_free()
439 dev->model_number = NULL; in wps_device_data_free()
440 os_free(dev->serial_number); in wps_device_data_free()
441 dev->serial_number = NULL; in wps_device_data_free()
442 wpabuf_free(dev->application_ext); in wps_device_data_free()
443 dev->application_ext = NULL; in wps_device_data_free()