Lines Matching +full:manufacturer +full:- +full:id
2 * Wi-Fi Protected Setup - External Registrar
3 * Copyright (c) 2009-2013, Jouni Malinen <j@w1.fi>
40 if (wps->event_cb == NULL) in wps_er_sta_event()
44 ev->uuid = sta->uuid; in wps_er_sta_event()
45 ev->mac_addr = sta->addr; in wps_er_sta_event()
46 ev->m1_received = sta->m1_received; in wps_er_sta_event()
47 ev->config_methods = sta->config_methods; in wps_er_sta_event()
48 ev->dev_passwd_id = sta->dev_passwd_id; in wps_er_sta_event()
49 ev->pri_dev_type = sta->pri_dev_type; in wps_er_sta_event()
50 ev->dev_name = sta->dev_name; in wps_er_sta_event()
51 ev->manufacturer = sta->manufacturer; in wps_er_sta_event()
52 ev->model_name = sta->model_name; in wps_er_sta_event()
53 ev->model_number = sta->model_number; in wps_er_sta_event()
54 ev->serial_number = sta->serial_number; in wps_er_sta_event()
55 wps->event_cb(wps->cb_ctx, event, &data); in wps_er_sta_event()
63 dl_list_for_each(sta, &ap->sta, struct wps_er_sta, list) { in wps_er_sta_get()
65 ether_addr_equal(sta->addr, addr)) && in wps_er_sta_get()
67 os_memcmp(uuid, sta->uuid, WPS_UUID_LEN) == 0)) in wps_er_sta_get()
76 wps_er_sta_event(sta->ap->er->wps, sta, WPS_EV_ER_ENROLLEE_REMOVE); in wps_er_sta_free()
77 if (sta->wps) in wps_er_sta_free()
78 wps_deinit(sta->wps); in wps_er_sta_free()
79 os_free(sta->manufacturer); in wps_er_sta_free()
80 os_free(sta->model_name); in wps_er_sta_free()
81 os_free(sta->model_number); in wps_er_sta_free()
82 os_free(sta->serial_number); in wps_er_sta_free()
83 os_free(sta->dev_name); in wps_er_sta_free()
84 http_client_free(sta->http); in wps_er_sta_free()
86 os_free(sta->cred); in wps_er_sta_free()
94 dl_list_for_each_safe(sta, prev, &ap->sta, struct wps_er_sta, list) in wps_er_sta_remove_all()
104 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_ap_get()
105 if ((addr == NULL || ap->addr.s_addr == addr->s_addr) && in wps_er_ap_get()
107 os_memcmp(uuid, ap->uuid, WPS_UUID_LEN) == 0) && in wps_er_ap_get()
109 ether_addr_equal(mac_addr, ap->mac_addr))) in wps_er_ap_get()
116 static struct wps_er_ap * wps_er_ap_get_id(struct wps_er *er, unsigned int id) in wps_er_ap_get_id() argument
119 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_ap_get_id()
120 if (ap->id == id) in wps_er_ap_get_id()
133 if (wps->event_cb == NULL) in wps_er_ap_event()
137 evap->uuid = ap->uuid; in wps_er_ap_event()
138 evap->friendly_name = ap->friendly_name; in wps_er_ap_event()
139 evap->manufacturer = ap->manufacturer; in wps_er_ap_event()
140 evap->manufacturer_url = ap->manufacturer_url; in wps_er_ap_event()
141 evap->model_description = ap->model_description; in wps_er_ap_event()
142 evap->model_name = ap->model_name; in wps_er_ap_event()
143 evap->model_number = ap->model_number; in wps_er_ap_event()
144 evap->model_url = ap->model_url; in wps_er_ap_event()
145 evap->serial_number = ap->serial_number; in wps_er_ap_event()
146 evap->upc = ap->upc; in wps_er_ap_event()
147 evap->pri_dev_type = ap->pri_dev_type; in wps_er_ap_event()
148 evap->wps_state = ap->wps_state; in wps_er_ap_event()
149 evap->mac_addr = ap->mac_addr; in wps_er_ap_event()
150 wps->event_cb(wps->cb_ctx, event, &data); in wps_er_ap_event()
156 http_client_free(ap->http); in wps_er_ap_free()
157 ap->http = NULL; in wps_er_ap_free()
159 os_free(ap->location); in wps_er_ap_free()
160 os_free(ap->friendly_name); in wps_er_ap_free()
161 os_free(ap->manufacturer); in wps_er_ap_free()
162 os_free(ap->manufacturer_url); in wps_er_ap_free()
163 os_free(ap->model_description); in wps_er_ap_free()
164 os_free(ap->model_name); in wps_er_ap_free()
165 os_free(ap->model_number); in wps_er_ap_free()
166 os_free(ap->model_url); in wps_er_ap_free()
167 os_free(ap->serial_number); in wps_er_ap_free()
168 os_free(ap->udn); in wps_er_ap_free()
169 os_free(ap->upc); in wps_er_ap_free()
171 os_free(ap->scpd_url); in wps_er_ap_free()
172 os_free(ap->control_url); in wps_er_ap_free()
173 os_free(ap->event_sub_url); in wps_er_ap_free()
175 os_free(ap->ap_settings); in wps_er_ap_free()
184 inet_ntoa(ap->addr), ap->location); in wps_er_ap_unsubscribed()
185 dl_list_del(&ap->list); in wps_er_ap_unsubscribed()
188 if (er->deinitializing && dl_list_empty(&er->ap_unsubscribing)) in wps_er_ap_unsubscribed()
201 ap->subscribed = 0; in wps_er_http_unsubscribe_cb()
210 http_client_free(ap->http); in wps_er_http_unsubscribe_cb()
211 ap->http = NULL; in wps_er_http_unsubscribe_cb()
217 wps_er_ap_unsubscribed(ap->er, ap); in wps_er_http_unsubscribe_cb()
228 if (ap->event_sub_url == NULL) { in wps_er_ap_unsubscribe()
229 wpa_printf(MSG_DEBUG, "WPS ER: No eventSubURL - cannot " in wps_er_ap_unsubscribe()
233 if (ap->http) { in wps_er_ap_unsubscribe()
234 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request - cannot " in wps_er_ap_unsubscribe()
239 url = http_client_url_parse(ap->event_sub_url, &dst, &path); in wps_er_ap_unsubscribe()
245 req = wpabuf_alloc(os_strlen(ap->event_sub_url) + 1000); in wps_er_ap_unsubscribe()
250 uuid_bin2str(ap->sid, sid, sizeof(sid)); in wps_er_ap_unsubscribe()
261 ap->http = http_client_addr(&dst, req, 1000, in wps_er_ap_unsubscribe()
263 if (ap->http == NULL) { in wps_er_ap_unsubscribe()
274 wps_er_ap_unsubscribed(ap->er, ap); in wps_er_ap_unsubscribe()
282 dl_list_for_each(s, &er->ap_settings, struct wps_er_ap_settings, list) in wps_er_ap_get_settings()
283 if (os_memcmp(uuid, s->uuid, WPS_UUID_LEN) == 0) in wps_er_ap_get_settings()
295 if (ap == NULL || ap->ap_settings == NULL) in wps_er_ap_cache_settings()
296 return -1; in wps_er_ap_cache_settings()
298 settings = wps_er_ap_get_settings(er, ap->uuid); in wps_er_ap_cache_settings()
302 return -1; in wps_er_ap_cache_settings()
303 os_memcpy(settings->uuid, ap->uuid, WPS_UUID_LEN); in wps_er_ap_cache_settings()
304 dl_list_add(&er->ap_settings, &settings->list); in wps_er_ap_cache_settings()
306 os_memcpy(&settings->ap_settings, ap->ap_settings, in wps_er_ap_cache_settings()
318 if (ap->ap_settings) in wps_er_ap_use_cached_settings()
321 s = wps_er_ap_get_settings(ap->er, ap->uuid); in wps_er_ap_use_cached_settings()
323 return -1; in wps_er_ap_use_cached_settings()
325 ap->ap_settings = os_memdup(&s->ap_settings, sizeof(*ap->ap_settings)); in wps_er_ap_use_cached_settings()
326 if (ap->ap_settings == NULL) in wps_er_ap_use_cached_settings()
327 return -1; in wps_er_ap_use_cached_settings()
337 inet_ntoa(ap->addr), ap->location); in wps_er_ap_remove_entry()
340 wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_REMOVE); in wps_er_ap_remove_entry()
341 http_client_free(ap->http); in wps_er_ap_remove_entry()
342 ap->http = NULL; in wps_er_ap_remove_entry()
343 if (ap->wps) { in wps_er_ap_remove_entry()
344 wps_deinit(ap->wps); in wps_er_ap_remove_entry()
345 ap->wps = NULL; in wps_er_ap_remove_entry()
348 dl_list_del(&ap->list); in wps_er_ap_remove_entry()
349 if (ap->subscribed) { in wps_er_ap_remove_entry()
350 dl_list_add(&er->ap_unsubscribing, &ap->list); in wps_er_ap_remove_entry()
373 inet_ntoa(ap->addr), ap->location); in wps_er_get_sid()
374 return -1; in wps_er_get_sid()
380 "%s (%s): '%s'", inet_ntoa(ap->addr), ap->location, in wps_er_get_sid()
382 return -1; in wps_er_get_sid()
386 if (uuid_str2bin(pos, ap->sid) < 0) { in wps_er_get_sid()
388 "%s (%s): '%s'", inet_ntoa(ap->addr), ap->location, in wps_er_get_sid()
390 return -1; in wps_er_get_sid()
393 uuid_bin2str(ap->sid, txt, sizeof(txt)); in wps_er_get_sid()
395 inet_ntoa(ap->addr), ap->location, txt); in wps_er_get_sid()
409 ap->subscribed = 1; in wps_er_http_subscribe_cb()
411 wps_er_ap_use_cached_settings(ap->er, ap); in wps_er_http_subscribe_cb()
412 wps_er_ap_event(ap->er->wps, ap, WPS_EV_ER_AP_ADD); in wps_er_http_subscribe_cb()
420 http_client_free(ap->http); in wps_er_http_subscribe_cb()
421 ap->http = NULL; in wps_er_http_subscribe_cb()
431 if (ap->event_sub_url == NULL) { in wps_er_subscribe()
432 wpa_printf(MSG_DEBUG, "WPS ER: No eventSubURL - cannot " in wps_er_subscribe()
436 if (ap->http) { in wps_er_subscribe()
437 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request - cannot " in wps_er_subscribe()
442 url = http_client_url_parse(ap->event_sub_url, &dst, &path); in wps_er_subscribe()
448 req = wpabuf_alloc(os_strlen(ap->event_sub_url) + 1000); in wps_er_subscribe()
458 "TIMEOUT: Second-%d\r\n" in wps_er_subscribe()
461 ap->er->ip_addr_text, ap->er->http_port, in wps_er_subscribe()
462 ap->er->event_id, ap->id, 1800); in wps_er_subscribe()
467 ap->http = http_client_addr(&dst, req, 1000, wps_er_http_subscribe_cb, in wps_er_subscribe()
469 if (ap->http == NULL) in wps_er_subscribe()
483 os_memcpy(ap->pri_dev_type, attr.primary_dev_type, 8); in wps_er_ap_get_m1()
485 ap->wps_state = *attr.wps_state; in wps_er_ap_get_m1()
487 os_memcpy(ap->mac_addr, attr.mac_addr, ETH_ALEN); in wps_er_ap_get_m1()
523 found = os_strcasecmp(val, "urn:schemas-wifialliance-org:" in wps_er_find_wfadevice()
549 wpa_printf(MSG_DEBUG, "WPS ER: WFADevice:1 device not found - " in wps_er_parse_device_description()
554 ap->friendly_name = xml_get_first_item(data, "friendlyName"); in wps_er_parse_device_description()
555 wpa_printf(MSG_DEBUG, "WPS ER: friendlyName='%s'", ap->friendly_name); in wps_er_parse_device_description()
557 ap->manufacturer = xml_get_first_item(data, "manufacturer"); in wps_er_parse_device_description()
558 wpa_printf(MSG_DEBUG, "WPS ER: manufacturer='%s'", ap->manufacturer); in wps_er_parse_device_description()
560 ap->manufacturer_url = xml_get_first_item(data, "manufacturerURL"); in wps_er_parse_device_description()
562 ap->manufacturer_url); in wps_er_parse_device_description()
564 ap->model_description = xml_get_first_item(data, "modelDescription"); in wps_er_parse_device_description()
566 ap->model_description); in wps_er_parse_device_description()
568 ap->model_name = xml_get_first_item(data, "modelName"); in wps_er_parse_device_description()
569 wpa_printf(MSG_DEBUG, "WPS ER: modelName='%s'", ap->model_name); in wps_er_parse_device_description()
571 ap->model_number = xml_get_first_item(data, "modelNumber"); in wps_er_parse_device_description()
572 wpa_printf(MSG_DEBUG, "WPS ER: modelNumber='%s'", ap->model_number); in wps_er_parse_device_description()
574 ap->model_url = xml_get_first_item(data, "modelURL"); in wps_er_parse_device_description()
575 wpa_printf(MSG_DEBUG, "WPS ER: modelURL='%s'", ap->model_url); in wps_er_parse_device_description()
577 ap->serial_number = xml_get_first_item(data, "serialNumber"); in wps_er_parse_device_description()
578 wpa_printf(MSG_DEBUG, "WPS ER: serialNumber='%s'", ap->serial_number); in wps_er_parse_device_description()
580 ap->udn = xml_get_first_item(data, "UDN"); in wps_er_parse_device_description()
581 if (ap->udn) { in wps_er_parse_device_description()
582 wpa_printf(MSG_DEBUG, "WPS ER: UDN='%s'", ap->udn); in wps_er_parse_device_description()
583 pos = os_strstr(ap->udn, "uuid:"); in wps_er_parse_device_description()
586 if (uuid_str2bin(pos, ap->uuid) < 0) in wps_er_parse_device_description()
592 ap->upc = xml_get_first_item(data, "UPC"); in wps_er_parse_device_description()
593 wpa_printf(MSG_DEBUG, "WPS ER: UPC='%s'", ap->upc); in wps_er_parse_device_description()
595 ap->scpd_url = http_link_update( in wps_er_parse_device_description()
596 xml_get_first_item(data, "SCPDURL"), ap->location); in wps_er_parse_device_description()
597 wpa_printf(MSG_DEBUG, "WPS ER: SCPDURL='%s'", ap->scpd_url); in wps_er_parse_device_description()
599 ap->control_url = http_link_update( in wps_er_parse_device_description()
600 xml_get_first_item(data, "controlURL"), ap->location); in wps_er_parse_device_description()
601 wpa_printf(MSG_DEBUG, "WPS ER: controlURL='%s'", ap->control_url); in wps_er_parse_device_description()
603 ap->event_sub_url = http_link_update( in wps_er_parse_device_description()
604 xml_get_first_item(data, "eventSubURL"), ap->location); in wps_er_parse_device_description()
605 wpa_printf(MSG_DEBUG, "WPS ER: eventSubURL='%s'", ap->event_sub_url); in wps_er_parse_device_description()
630 http_client_free(ap->http); in wps_er_http_dev_desc_cb()
631 ap->http = NULL; in wps_er_http_dev_desc_cb()
653 dl_list_init(&ap->sta); in wps_er_ap_add()
654 ap->er = er; in wps_er_ap_add()
655 ap->id = ++er->next_ap_id; in wps_er_ap_add()
656 ap->location = os_strdup(location); in wps_er_ap_add()
657 if (ap->location == NULL) { in wps_er_ap_add()
661 dl_list_add(&er->ap, &ap->list); in wps_er_ap_add()
663 ap->addr.s_addr = addr->s_addr; in wps_er_ap_add()
664 os_memcpy(ap->uuid, uuid, WPS_UUID_LEN); in wps_er_ap_add()
668 inet_ntoa(ap->addr), ap->location); in wps_er_ap_add()
671 ap->http = http_client_url(ap->location, NULL, 10000, in wps_er_ap_add()
679 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_ap_remove()
680 if (ap->addr.s_addr == addr->s_addr) { in wps_er_ap_remove()
692 dl_list_for_each_safe(ap, prev, &er->ap, struct wps_er_ap, list) in wps_er_ap_remove_all()
694 dl_list_for_each_safe(s, prev_s, &er->ap_settings, in wps_er_ap_remove_all()
740 "Content-Length: 0\r\n"); in wps_er_http_resp_ok()
751 dl_list_del(&sta->list); in wps_er_sta_timeout()
765 m1 = !probe_req && attr->msg_type && *attr->msg_type == WPS_M1; in wps_er_add_sta_data()
779 os_memcpy(sta->addr, addr, ETH_ALEN); in wps_er_add_sta_data()
780 sta->ap = ap; in wps_er_add_sta_data()
781 dl_list_add(&ap->sta, &sta->list); in wps_er_add_sta_data()
786 sta->m1_received = 1; in wps_er_add_sta_data()
788 if (attr->config_methods && (!probe_req || !sta->m1_received)) in wps_er_add_sta_data()
789 sta->config_methods = WPA_GET_BE16(attr->config_methods); in wps_er_add_sta_data()
790 if (attr->uuid_e && (!probe_req || !sta->m1_received)) in wps_er_add_sta_data()
791 os_memcpy(sta->uuid, attr->uuid_e, WPS_UUID_LEN); in wps_er_add_sta_data()
792 if (attr->primary_dev_type && (!probe_req || !sta->m1_received)) in wps_er_add_sta_data()
793 os_memcpy(sta->pri_dev_type, attr->primary_dev_type, 8); in wps_er_add_sta_data()
794 if (attr->dev_password_id && (!probe_req || !sta->m1_received)) in wps_er_add_sta_data()
795 sta->dev_passwd_id = WPA_GET_BE16(attr->dev_password_id); in wps_er_add_sta_data()
797 if (attr->manufacturer) { in wps_er_add_sta_data()
798 os_free(sta->manufacturer); in wps_er_add_sta_data()
799 sta->manufacturer = dup_binstr(attr->manufacturer, in wps_er_add_sta_data()
800 attr->manufacturer_len); in wps_er_add_sta_data()
803 if (attr->model_name) { in wps_er_add_sta_data()
804 os_free(sta->model_name); in wps_er_add_sta_data()
805 sta->model_name = dup_binstr(attr->model_name, in wps_er_add_sta_data()
806 attr->model_name_len); in wps_er_add_sta_data()
809 if (attr->model_number) { in wps_er_add_sta_data()
810 os_free(sta->model_number); in wps_er_add_sta_data()
811 sta->model_number = dup_binstr(attr->model_number, in wps_er_add_sta_data()
812 attr->model_number_len); in wps_er_add_sta_data()
815 if (attr->serial_number) { in wps_er_add_sta_data()
816 os_free(sta->serial_number); in wps_er_add_sta_data()
817 sta->serial_number = dup_binstr(attr->serial_number, in wps_er_add_sta_data()
818 attr->serial_number_len); in wps_er_add_sta_data()
821 if (attr->dev_name) { in wps_er_add_sta_data()
822 os_free(sta->dev_name); in wps_er_add_sta_data()
823 sta->dev_name = dup_binstr(attr->dev_name, attr->dev_name_len); in wps_er_add_sta_data()
830 wps_er_sta_event(ap->er->wps, sta, WPS_EV_ER_ENROLLEE_ADD); in wps_er_add_sta_data()
842 wpa_printf(MSG_DEBUG, "WPS ER: WLANEvent - Probe Request - from " in wps_er_process_wlanevent_probe_req()
844 wpa_hexdump_buf(MSG_MSGDUMP, "WPS ER: WLANEvent - Enrollee's message " in wps_er_process_wlanevent_probe_req()
848 wpa_printf(MSG_INFO, "WPS-STRICT: ER: Ignore invalid proxied " in wps_er_process_wlanevent_probe_req()
860 wps_registrar_probe_req_rx(ap->er->wps->registrar, addr, msg, 0); in wps_er_process_wlanevent_probe_req()
879 http_client_free(sta->http); in wps_er_http_put_wlan_response_cb()
880 sta->http = NULL; in wps_er_http_put_wlan_response_cb()
892 "urn:schemas-wifialliance-org:service:WFAWLANConfig:1";
923 "Content-Type: text/xml; charset=\"utf-8\"\r\n" in wps_er_soap_hdr()
924 "Content-Length: ", in wps_er_soap_hdr()
925 path, inet_ntoa(dst->sin_addr), ntohs(dst->sin_port)); in wps_er_soap_hdr()
957 (int) ((char *) wpabuf_put(buf, 0) - body_ptr)); in wps_er_soap_end()
969 if (sta->http) { in wps_er_sta_send_msg()
970 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request for STA - " in wps_er_sta_send_msg()
976 if (sta->ap->control_url == NULL) { in wps_er_sta_send_msg()
982 url = http_client_url_parse(sta->ap->control_url, &dst, &path); in wps_er_sta_send_msg()
998 MAC2STR(sta->addr)); in wps_er_sta_send_msg()
1002 sta->http = http_client_addr(&dst, buf, 1000, in wps_er_sta_send_msg()
1004 if (sta->http == NULL) in wps_er_sta_send_msg()
1014 res = wps_process_msg(sta->wps, op_code, msg); in wps_er_sta_process()
1016 struct wpabuf *next = wps_get_msg(sta->wps, &op_code); in wps_er_sta_process()
1023 wps_deinit(sta->wps); in wps_er_sta_process()
1024 sta->wps = NULL; in wps_er_sta_process()
1039 if (sta->wps) in wps_er_sta_start()
1040 wps_deinit(sta->wps); in wps_er_sta_start()
1043 cfg.wps = sta->ap->er->wps; in wps_er_sta_start()
1045 cfg.peer_addr = sta->addr; in wps_er_sta_start()
1047 sta->wps = wps_init(&cfg); in wps_er_sta_start()
1048 if (sta->wps == NULL) in wps_er_sta_start()
1050 sta->wps->er = 1; in wps_er_sta_start()
1051 sta->wps->use_cred = sta->ap->ap_settings; in wps_er_sta_start()
1052 if (sta->ap->ap_settings) { in wps_er_sta_start()
1053 os_free(sta->cred); in wps_er_sta_start()
1054 sta->cred = os_malloc(sizeof(*sta->cred)); in wps_er_sta_start()
1055 if (sta->cred) { in wps_er_sta_start()
1056 os_memcpy(sta->cred, sta->ap->ap_settings, in wps_er_sta_start()
1057 sizeof(*sta->cred)); in wps_er_sta_start()
1058 sta->cred->cred_attr = NULL; in wps_er_sta_start()
1059 os_memcpy(sta->cred->mac_addr, sta->addr, ETH_ALEN); in wps_er_sta_start()
1060 sta->wps->use_cred = sta->cred; in wps_er_sta_start()
1074 wpa_printf(MSG_DEBUG, "WPS ER: WLANEvent - EAP - from " MACSTR, in wps_er_process_wlanevent_eap()
1076 wpa_hexdump_buf(MSG_MSGDUMP, "WPS ER: WLANEvent - Enrollee's message " in wps_er_process_wlanevent_eap()
1077 "(TLVs from EAP-WSC)", msg); in wps_er_process_wlanevent_eap()
1091 else if (sta->wps) { in wps_er_process_wlanevent_eap()
1134 wpabuf_set(&msg, data + 1 + 17, wpabuf_len(event) - (1 + 17)); in wps_er_process_wlanevent()
1159 wpa_printf(MSG_DEBUG, "WPS ER: HTTP event from unknown AP id " in wps_er_http_event()
1164 wpa_printf(MSG_MSGDUMP, "WPS ER: HTTP event from AP id %u: %s", in wps_er_http_event()
1195 if (event_id != er->event_id) { in wps_er_http_notify()
1197 "unknown event id %u", event_id); in wps_er_http_notify()
1223 inet_ntoa(cli->sin_addr), ntohs(cli->sin_port)); in wps_er_http_req()
1257 dl_list_init(&er->ap); in wps_er_init()
1258 dl_list_init(&er->ap_unsubscribing); in wps_er_init()
1259 dl_list_init(&er->ap_settings); in wps_er_init()
1261 er->multicast_sd = -1; in wps_er_init()
1262 er->ssdp_sd = -1; in wps_er_init()
1264 os_strlcpy(er->ifname, ifname, sizeof(er->ifname)); in wps_er_init()
1265 er->wps = wps; in wps_er_init()
1266 if (os_get_random((unsigned char *) &er->event_id, in wps_er_init()
1267 sizeof(er->event_id)) < 0) { in wps_er_init()
1272 er->event_id &= 0x0fffffff; in wps_er_init()
1279 size_t len = end - pos; in wps_er_init()
1280 os_strlcpy(er->ifname, pos, len < sizeof(er->ifname) ? in wps_er_init()
1281 len + 1 : sizeof(er->ifname)); in wps_er_init()
1284 os_strlcpy(er->ifname, pos, sizeof(er->ifname)); in wps_er_init()
1287 er->forced_ifname = 1; in wps_er_init()
1291 if (inet_aton(filter, &er->filter_addr) == 0) { in wps_er_init()
1300 if (get_netif_info(er->ifname, &er->ip_addr, &er->ip_addr_text, in wps_er_init()
1301 NULL, er->mac_addr)) { in wps_er_init()
1303 "for %s. Does it have IP address?", er->ifname); in wps_er_init()
1314 addr.s_addr = er->ip_addr; in wps_er_init()
1315 er->http_srv = http_server_init(&addr, -1, wps_er_http_req, er); in wps_er_init()
1316 if (er->http_srv == NULL) { in wps_er_init()
1321 er->http_port = http_server_get_port(er->http_srv); in wps_er_init()
1324 er->ifname, er->ip_addr_text); in wps_er_init()
1335 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_refresh()
1336 wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_ADD); in wps_er_refresh()
1337 dl_list_for_each(sta, &ap->sta, struct wps_er_sta, list) in wps_er_refresh()
1338 wps_er_sta_event(er->wps, sta, WPS_EV_ER_ENROLLEE_ADD); in wps_er_refresh()
1354 dl_list_for_each_safe(ap, tmp, &er->ap_unsubscribing, struct wps_er_ap, in wps_er_deinit_finish()
1356 wpa_printf(MSG_DEBUG, "WPS ER: AP entry for %s (%s) still in ap_unsubscribing list - free it", in wps_er_deinit_finish()
1357 inet_ntoa(ap->addr), ap->location); in wps_er_deinit_finish()
1358 dl_list_del(&ap->list); in wps_er_deinit_finish()
1363 deinit_done_cb = er->deinit_done_cb; in wps_er_deinit_finish()
1364 deinit_done_ctx = er->deinit_done_ctx; in wps_er_deinit_finish()
1365 os_free(er->ip_addr_text); in wps_er_deinit_finish()
1377 http_server_deinit(er->http_srv); in wps_er_deinit()
1380 eloop_register_timeout(dl_list_empty(&er->ap_unsubscribing) ? 0 : 5, 0, in wps_er_deinit()
1383 er->deinitializing = 1; in wps_er_deinit()
1384 er->deinit_done_cb = cb; in wps_er_deinit()
1385 er->deinit_done_ctx = ctx; in wps_er_deinit()
1401 data.set_sel_reg.uuid = ap->uuid; in wps_er_http_set_sel_reg_cb()
1408 data.set_sel_reg.uuid = ap->uuid; in wps_er_http_set_sel_reg_cb()
1411 http_client_free(ap->http); in wps_er_http_set_sel_reg_cb()
1412 ap->http = NULL; in wps_er_http_set_sel_reg_cb()
1415 ap->er->wps->event_cb(ap->er->wps->cb_ctx, in wps_er_http_set_sel_reg_cb()
1427 if (ap->control_url == NULL) { in wps_er_send_set_sel_reg()
1432 if (ap->http) { in wps_er_send_set_sel_reg()
1433 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request for AP - " in wps_er_send_set_sel_reg()
1438 if (ap->wps) { in wps_er_send_set_sel_reg()
1439 wpa_printf(MSG_DEBUG, "WPS ER: Pending WPS operation for AP - " in wps_er_send_set_sel_reg()
1444 url = http_client_url_parse(ap->control_url, &dst, &path); in wps_er_send_set_sel_reg()
1458 ap->http = http_client_addr(&dst, buf, 1000, in wps_er_send_set_sel_reg()
1460 if (ap->http == NULL) in wps_er_send_set_sel_reg()
1507 struct wps_registrar *reg = er->wps->registrar; in wps_er_set_sel_reg()
1513 if (er->skip_set_sel_reg) { in wps_er_set_sel_reg()
1534 wps_er_build_uuid_r(msg, er->wps->uuid)) { in wps_er_set_sel_reg()
1545 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_set_sel_reg()
1546 if (er->set_sel_reg_uuid_filter && in wps_er_set_sel_reg()
1547 os_memcmp(ap->uuid, er->set_sel_reg_uuid_filter, in wps_er_set_sel_reg()
1550 data.set_sel_reg.uuid = ap->uuid; in wps_er_set_sel_reg()
1551 er->wps->event_cb(er->wps->cb_ctx, in wps_er_set_sel_reg()
1565 if (er == NULL || er->wps == NULL) in wps_er_pbc()
1566 return -1; in wps_er_pbc()
1568 if (wps_registrar_pbc_overlap(er->wps->registrar, NULL, NULL)) { in wps_er_pbc()
1569 wpa_printf(MSG_DEBUG, "WPS ER: PBC overlap - do not start PBC " in wps_er_pbc()
1571 return -2; in wps_er_pbc()
1580 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_pbc()
1583 uuid = ap->uuid; in wps_er_pbc()
1588 return -3; /* Unknown UUID */ in wps_er_pbc()
1591 if (ap->ap_settings == NULL) { in wps_er_pbc()
1593 return -4; in wps_er_pbc()
1596 er->set_sel_reg_uuid_filter = uuid; in wps_er_pbc()
1597 res = wps_registrar_button_pushed(er->wps->registrar, NULL); in wps_er_pbc()
1598 er->set_sel_reg_uuid_filter = NULL; in wps_er_pbc()
1600 return -1; in wps_er_pbc()
1612 os_free(ap->ap_settings); in wps_er_ap_settings_cb()
1613 ap->ap_settings = os_malloc(sizeof(*cred)); in wps_er_ap_settings_cb()
1614 if (ap->ap_settings) { in wps_er_ap_settings_cb()
1615 os_memcpy(ap->ap_settings, cred, sizeof(*cred)); in wps_er_ap_settings_cb()
1616 ap->ap_settings->cred_attr = NULL; in wps_er_ap_settings_cb()
1620 data.ap_settings.uuid = ap->uuid; in wps_er_ap_settings_cb()
1622 ap->er->wps->event_cb(ap->er->wps->cb_ctx, WPS_EV_ER_AP_SETTINGS, in wps_er_ap_settings_cb()
1630 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_get_sta_uuid()
1634 return sta->uuid; in wps_er_get_sta_uuid()
1654 if (ap->wps) { in wps_er_http_put_message_cb()
1655 wps_deinit(ap->wps); in wps_er_http_put_message_cb()
1656 ap->wps = NULL; in wps_er_http_put_message_cb()
1666 if (ap->wps) { in wps_er_http_put_message_cb()
1667 wps_deinit(ap->wps); in wps_er_http_put_message_cb()
1668 ap->wps = NULL; in wps_er_http_put_message_cb()
1672 http_client_free(ap->http); in wps_er_http_put_message_cb()
1673 ap->http = NULL; in wps_er_http_put_message_cb()
1683 wps_deinit(ap->wps); in wps_er_http_put_message_cb()
1684 ap->wps = NULL; in wps_er_http_put_message_cb()
1701 if (ap->http) { in wps_er_ap_put_message()
1703 "with the AP - cannot continue learn"); in wps_er_ap_put_message()
1707 if (ap->control_url == NULL) { in wps_er_ap_put_message()
1712 url = http_client_url_parse(ap->control_url, &dst, &path); in wps_er_ap_put_message()
1726 ap->http = http_client_addr(&dst, buf, 10000, in wps_er_ap_put_message()
1728 if (ap->http == NULL) { in wps_er_ap_put_message()
1735 if (ap->wps) { in wps_er_ap_put_message()
1736 wps_deinit(ap->wps); in wps_er_ap_put_message()
1737 ap->wps = NULL; in wps_er_ap_put_message()
1763 res = wps_process_msg(ap->wps, op_code, msg); in wps_er_ap_process()
1765 struct wpabuf *next = wps_get_msg(ap->wps, &op_code); in wps_er_ap_process()
1772 wps_deinit(ap->wps); in wps_er_ap_process()
1773 ap->wps = NULL; in wps_er_ap_process()
1777 wps_deinit(ap->wps); in wps_er_ap_process()
1778 ap->wps = NULL; in wps_er_ap_process()
1782 wps_deinit(ap->wps); in wps_er_ap_process()
1783 ap->wps = NULL; in wps_er_ap_process()
1792 if (ap->wps) { in wps_er_ap_learn_m1()
1799 cfg.wps = ap->er->wps; in wps_er_ap_learn_m1()
1801 ap->wps = wps_init(&cfg); in wps_er_ap_learn_m1()
1802 if (ap->wps == NULL) in wps_er_ap_learn_m1()
1804 ap->wps->ap_settings_cb = wps_er_ap_settings_cb; in wps_er_ap_learn_m1()
1805 ap->wps->ap_settings_cb_ctx = ap; in wps_er_ap_learn_m1()
1825 ap->m1_handler(ap, info); in wps_er_ap_learn()
1854 http_client_free(ap->http); in wps_er_http_get_dev_info_cb()
1855 ap->http = NULL; in wps_er_http_get_dev_info_cb()
1873 if (ap->http) { in wps_er_send_get_device_info()
1875 "with the AP - cannot get device info"); in wps_er_send_get_device_info()
1876 return -1; in wps_er_send_get_device_info()
1879 if (ap->control_url == NULL) { in wps_er_send_get_device_info()
1881 return -1; in wps_er_send_get_device_info()
1884 url = http_client_url_parse(ap->control_url, &dst, &path); in wps_er_send_get_device_info()
1887 return -1; in wps_er_send_get_device_info()
1894 return -1; in wps_er_send_get_device_info()
1898 ap->http = http_client_addr(&dst, buf, 10000, in wps_er_send_get_device_info()
1900 if (ap->http == NULL) { in wps_er_send_get_device_info()
1902 return -1; in wps_er_send_get_device_info()
1905 ap->m1_handler = m1_handler; in wps_er_send_get_device_info()
1917 return -1; in wps_er_learn()
1923 return -1; in wps_er_learn()
1926 uuid = ap->uuid; in wps_er_learn()
1927 if (ap->wps) { in wps_er_learn()
1929 "with the AP - cannot start learn"); in wps_er_learn()
1930 return -1; in wps_er_learn()
1934 return -1; in wps_er_learn()
1936 er->skip_set_sel_reg = 1; in wps_er_learn()
1937 wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0); in wps_er_learn()
1938 er->skip_set_sel_reg = 0; in wps_er_learn()
1950 return -1; in wps_er_set_config()
1956 return -1; in wps_er_set_config()
1959 os_free(ap->ap_settings); in wps_er_set_config()
1960 ap->ap_settings = os_memdup(cred, sizeof(*cred)); in wps_er_set_config()
1961 if (ap->ap_settings == NULL) in wps_er_set_config()
1962 return -1; in wps_er_set_config()
1963 ap->ap_settings->cred_attr = NULL; in wps_er_set_config()
1975 if (ap->wps) { in wps_er_ap_config_m1()
1982 cfg.wps = ap->er->wps; in wps_er_ap_config_m1()
1984 cfg.new_ap_settings = ap->ap_settings; in wps_er_ap_config_m1()
1985 ap->wps = wps_init(&cfg); in wps_er_ap_config_m1()
1986 if (ap->wps == NULL) in wps_er_ap_config_m1()
1988 ap->wps->ap_settings_cb = NULL; in wps_er_ap_config_m1()
1989 ap->wps->ap_settings_cb_ctx = NULL; in wps_er_ap_config_m1()
2002 return -1; in wps_er_config()
2008 return -1; in wps_er_config()
2011 uuid = ap->uuid; in wps_er_config()
2012 if (ap->wps) { in wps_er_config()
2014 "with the AP - cannot start config"); in wps_er_config()
2015 return -1; in wps_er_config()
2018 os_free(ap->ap_settings); in wps_er_config()
2019 ap->ap_settings = os_memdup(cred, sizeof(*cred)); in wps_er_config()
2020 if (ap->ap_settings == NULL) in wps_er_config()
2021 return -1; in wps_er_config()
2022 ap->ap_settings->cred_attr = NULL; in wps_er_config()
2025 return -1; in wps_er_config()
2027 er->skip_set_sel_reg = 1; in wps_er_config()
2028 wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0); in wps_er_config()
2029 er->skip_set_sel_reg = 0; in wps_er_config()
2071 if (ap->ap_settings == NULL) { in wps_er_nfc_config_token()
2077 return wps_er_config_token_from_cred(er->wps, ap->ap_settings); in wps_er_nfc_config_token()
2093 if (ap->ap_settings == NULL) { in wps_er_nfc_handover_sel()
2099 os_memcpy(wps->ssid, ap->ap_settings->ssid, ap->ap_settings->ssid_len); in wps_er_nfc_handover_sel()
2100 wps->ssid_len = ap->ap_settings->ssid_len; in wps_er_nfc_handover_sel()