int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *pin, size_t pin_len) { struct wps_er_ap *ap; if (er == NULL) return -1; ap = wps_er_ap_get(er, NULL, uuid); if (ap == NULL) { wpa_printf(MSG_DEBUG, "WPS ER: AP not found for learn " "request"); return -1; } if (ap->wps) { wpa_printf(MSG_DEBUG, "WPS ER: Pending operation ongoing " "with the AP - cannot start learn"); return -1; } if (wps_er_send_get_device_info(ap, wps_er_ap_learn_m1) < 0) return -1; er->skip_set_sel_reg = 1; wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0); er->skip_set_sel_reg = 0; return 0; }
int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *addr, const u8 *pin, size_t pin_len, const struct wps_credential *cred) { struct wps_er_ap *ap; if (er == NULL) return -1; ap = wps_er_ap_get(er, NULL, uuid, addr); if (ap == NULL) { wpa_printf(MSG_DEBUG, "WPS ER: AP not found for config " "request"); return -1; } if (uuid == NULL) uuid = ap->uuid; if (ap->wps) { wpa_printf(MSG_DEBUG, "WPS ER: Pending operation ongoing " "with the AP - cannot start config"); return -1; } os_free(ap->ap_settings); ap->ap_settings = os_malloc(sizeof(*cred)); if (ap->ap_settings == NULL) return -1; os_memcpy(ap->ap_settings, cred, sizeof(*cred)); ap->ap_settings->cred_attr = NULL; if (wps_er_send_get_device_info(ap, wps_er_ap_config_m1) < 0) return -1; er->skip_set_sel_reg = 1; wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0); er->skip_set_sel_reg = 0; return 0; }
static void wps_er_get_device_info(struct wps_er_ap *ap) { wps_er_send_get_device_info(ap, wps_er_ap_get_m1); }