Home | History | Annotate | Download | only in wps

Lines Matching defs:er

76 	wps_er_sta_event(sta->ap->er->wps, sta, WPS_EV_ER_ENROLLEE_REMOVE);
99 static struct wps_er_ap * wps_er_ap_get(struct wps_er *er,
104 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
116 static struct wps_er_ap * wps_er_ap_get_id(struct wps_er *er, unsigned int id)
119 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
181 static void wps_er_ap_unsubscribed(struct wps_er *er, struct wps_er_ap *ap)
183 wpa_printf(MSG_DEBUG, "WPS ER: Unsubscribed from AP %s (%s)",
188 if (er->deinitializing && dl_list_empty(&er->ap_unsubscribing)) {
189 eloop_cancel_timeout(wps_er_deinit_finish, er, NULL);
190 wps_er_deinit_finish(er, NULL);
202 wpa_printf(MSG_DEBUG, "WPS ER: Unsubscribed from events");
208 wpa_printf(MSG_DEBUG, "WPS ER: Failed to unsubscribe from "
219 wps_er_ap_unsubscribed(ap->er, ap);
223 static void wps_er_ap_unsubscribe(struct wps_er *er, struct wps_er_ap *ap)
231 wpa_printf(MSG_DEBUG, "WPS ER: No eventSubURL - cannot "
236 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request - cannot "
243 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse eventSubURL");
260 wpa_hexdump_ascii(MSG_MSGDUMP, "WPS ER: Unsubscription request",
276 wps_er_ap_unsubscribed(ap->er, ap);
280 static struct wps_er_ap_settings * wps_er_ap_get_settings(struct wps_er *er,
284 dl_list_for_each(s, &er->ap_settings, struct wps_er_ap_settings, list)
291 int wps_er_ap_cache_settings(struct wps_er *er, struct in_addr *addr)
296 ap = wps_er_ap_get(er, addr, NULL, NULL);
300 settings = wps_er_ap_get_settings(er, ap->uuid);
306 dl_list_add(&er->ap_settings, &settings->list);
315 static int wps_er_ap_use_cached_settings(struct wps_er *er,
323 s = wps_er_ap_get_settings(ap->er, ap->uuid);
332 wpa_printf(MSG_DEBUG, "WPS ER: Use cached AP settings");
337 static void wps_er_ap_remove_entry(struct wps_er *er, struct wps_er_ap *ap)
339 wpa_printf(MSG_DEBUG, "WPS ER: Removing AP entry for %s (%s)",
341 eloop_cancel_timeout(wps_er_ap_timeout, er, ap);
343 wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_REMOVE);
353 dl_list_add(&er->ap_unsubscribing, &ap->list);
354 wps_er_ap_unsubscribe(er, ap);
362 struct wps_er *er = eloop_data;
364 wpa_printf(MSG_DEBUG, "WPS ER: AP advertisement timed out");
365 wps_er_ap_remove_entry(er, ap);
375 wpa_printf(MSG_DEBUG, "WPS ER: No SID received from %s (%s)",
382 wpa_printf(MSG_DEBUG, "WPS ER: Invalid SID received from "
390 wpa_printf(MSG_DEBUG, "WPS ER: Invalid SID received from "
397 wpa_printf(MSG_DEBUG, "WPS ER: SID for subscription with %s (%s): %s",
411 wpa_printf(MSG_DEBUG, "WPS ER: Subscribed to events");
414 wps_er_ap_use_cached_settings(ap->er, ap);
415 wps_er_ap_event(ap->er->wps, ap, WPS_EV_ER_AP_ADD);
420 wpa_printf(MSG_DEBUG, "WPS ER: Failed to subscribe to events");
435 wpa_printf(MSG_DEBUG, "WPS ER: No eventSubURL - cannot "
440 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request - cannot "
447 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse eventSubURL");
464 ap->er->ip_addr_text, ap->er->http_port,
465 ap->er->event_id, ap->id, 1800);
467 wpa_hexdump_ascii(MSG_MSGDUMP, "WPS ER: Subscription request",
482 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse M1");
525 wpa_printf(MSG_DEBUG, "WPS ER: Found deviceType '%s'", val);
542 wpa_hexdump_ascii(MSG_MSGDUMP, "WPS ER: Device info",
552 wpa_printf(MSG_DEBUG, "WPS ER: WFADevice:1 device not found - "
558 wpa_printf(MSG_DEBUG, "WPS ER: friendlyName='%s'", ap->friendly_name);
561 wpa_printf(MSG_DEBUG, "WPS ER: manufacturer='%s'", ap->manufacturer);
564 wpa_printf(MSG_DEBUG, "WPS ER: manufacturerURL='%s'",
568 wpa_printf(MSG_DEBUG, "WPS ER: modelDescription='%s'",
572 wpa_printf(MSG_DEBUG, "WPS ER: modelName='%s'", ap->model_name);
575 wpa_printf(MSG_DEBUG, "WPS ER: modelNumber='%s'", ap->model_number);
578 wpa_printf(MSG_DEBUG, "WPS ER: modelURL='%s'", ap->model_url);
581 wpa_printf(MSG_DEBUG, "WPS ER: serialNumber='%s'", ap->serial_number);
584 wpa_printf(MSG_DEBUG, "WPS ER: UDN='%s'", ap->udn);
589 wpa_printf(MSG_DEBUG, "WPS ER: Invalid UUID in UDN");
593 wpa_printf(MSG_DEBUG, "WPS ER: UPC='%s'", ap->upc);
597 wpa_printf(MSG_DEBUG, "WPS ER: SCPDURL='%s'", ap->scpd_url);
601 wpa_printf(MSG_DEBUG, "WPS ER: controlURL='%s'", ap->control_url);
605 wpa_printf(MSG_DEBUG, "WPS ER: eventSubURL='%s'", ap->event_sub_url);
627 wpa_printf(MSG_DEBUG, "WPS ER: Failed to fetch device info");
637 void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr,
642 ap = wps_er_ap_get(er, addr, uuid, NULL);
645 eloop_cancel_timeout(wps_er_ap_timeout, er, ap);
646 eloop_register_timeout(max_age, 0, wps_er_ap_timeout, er, ap);
654 ap->er = er;
655 ap->id = ++er->next_ap_id;
661 dl_list_add(&er->ap, &ap->list);
665 eloop_register_timeout(max_age, 0, wps_er_ap_timeout, er, ap);
667 wpa_printf(MSG_DEBUG, "WPS ER: Added AP entry for %s (%s)",
676 void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr)
679 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
681 wps_er_ap_remove_entry(er, ap);
688 static void wps_er_ap_remove_all(struct wps_er *er)
692 dl_list_for_each_safe(ap, prev, &er->ap, struct wps_er_ap, list)
693 wps_er_ap_remove_entry(er, ap);
694 dl_list_for_each_safe(s, prev_s, &er->ap_settings,
750 wpa_printf(MSG_DEBUG, "WPS ER: STA entry timed out");
771 * may have been ongoing at the time ER subscribed for events.
830 wps_er_sta_event(ap->er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
842 wpa_printf(MSG_DEBUG, "WPS ER: WLANEvent - Probe Request - from "
844 wpa_hexdump_buf(MSG_MSGDUMP, "WPS ER: WLANEvent - Enrollee's message "
848 wpa_printf(MSG_INFO, "WPS-STRICT: ER: Ignore invalid proxied "
854 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse TLVs in "
860 wps_registrar_probe_req_rx(ap->er->wps->registrar, addr, msg, 0);
871 wpa_printf(MSG_DEBUG, "WPS ER: PutWLANResponse OK");
876 wpa_printf(MSG_DEBUG, "WPS ER: PutWLANResponse failed");
970 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request for STA - "
977 wpa_printf(MSG_DEBUG, "WPS ER: No controlURL for AP");
984 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse controlURL");
1020 wpa_printf(MSG_DEBUG, "WPS ER: Protocol run %s with the "
1043 cfg.wps = sta->ap->er->wps;
1050 sta->wps->er = 1;
1074 wpa_printf(MSG_DEBUG, "WPS ER: WLANEvent - EAP - from " MACSTR,
1076 wpa_hexdump_buf(MSG_MSGDUMP, "WPS ER: WLANEvent - Enrollee's message "
1080 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse TLVs in "
1119 wpa_hexdump(MSG_MSGDUMP, "WPS ER: Received WLANEvent",
1122 wpa_printf(MSG_DEBUG, "WPS ER: Too short WLANEvent");
1129 wpa_printf(MSG_DEBUG, "WPS ER: Invalid WLANEventMAC in "
1144 wpa_printf(MSG_DEBUG, "WPS ER: Unknown WLANEventType %d",
1151 static void wps_er_http_event(struct wps_er *er, struct http_request *req,
1154 struct wps_er_ap *ap = wps_er_ap_get_id(er, ap_id);
1159 wpa_printf(MSG_DEBUG, "WPS ER: HTTP event from unknown AP id "
1164 wpa_printf(MSG_MSGDUMP, "WPS ER: HTTP event from AP id %u: %s",
1170 wpa_printf(MSG_DEBUG, "WPS ER: Could not extract WLANEvent "
1187 static void wps_er_http_notify(struct wps_er *er, struct http_request *req)
1195 if (event_id != er->event_id) {
1196 wpa_printf(MSG_DEBUG, "WPS ER: HTTP event for an "
1204 wps_er_http_event(er, req, atoi(pos));
1206 wpa_printf(MSG_DEBUG, "WPS ER: Unknown HTTP NOTIFY for '%s'",
1215 struct wps_er *er = ctx;
1220 wpa_printf(MSG_DEBUG, "WPS ER: HTTP request: '%s' (type %d) from "
1227 wps_er_http_notify(er, req);
1230 wpa_printf(MSG_DEBUG, "WPS ER: Unsupported HTTP request type "
1251 struct wps_er *er;
1254 er = os_zalloc(sizeof(*er));
1255 if (er == NULL)
1257 dl_list_init(&er->ap);
1258 dl_list_init(&er->ap_unsubscribing);
1259 dl_list_init(&er->ap_settings);
1261 er->multicast_sd = -1;
1262 er->ssdp_sd = -1;
1264 os_strlcpy(er->ifname, ifname, sizeof(er->ifname));
1265 er->wps = wps;
1266 if (os_get_random((unsigned char *) &er->event_id,
1267 sizeof(er->event_id)) < 0) {
1268 wps_er_deinit(er, NULL, NULL);
1272 er->event_id &= 0x0fffffff;
1280 os_strlcpy(er->ifname, pos, len < sizeof(er->ifname) ?
1281 len + 1 : sizeof(er->ifname));
1284 os_strlcpy(er->ifname, pos, sizeof(er->ifname));
1287 er->forced_ifname = 1;
1291 if (inet_aton(filter, &er->filter_addr) == 0) {
1294 wps_er_deinit(er, NULL, NULL);
1300 if (get_netif_info(er->ifname, &er->ip_addr, &er->ip_addr_text,
1301 er->mac_addr)) {
1303 "for %s. Does it have IP address?", er->ifname);
1304 wps_er_deinit(er, NULL, NULL);
1308 if (wps_er_ssdp_init(er) < 0) {
1310 wps_er_deinit(er, NULL, NULL);
1314 addr.s_addr = er->ip_addr;
1315 er->http_srv = http_server_init(&addr, -1, wps_er_http_req, er);
1316 if (er->http_srv == NULL) {
1318 wps_er_deinit(er, NULL, NULL);
1321 er->http_port = http_server_get_port(er->http_srv);
1323 wpa_printf(MSG_DEBUG, "WPS ER: Start (ifname=%s ip_addr=%s)",
1324 er->ifname, er->ip_addr_text);
1326 return er;
1330 void wps_er_refresh(struct wps_er *er)
1335 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
1336 wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_ADD);
1338 wps_er_sta_event(er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
1341 wps_er_send_ssdp_msearch(er);
1347 struct wps_er *er = eloop_data;
1351 wpa_printf(MSG_DEBUG, "WPS ER: Finishing deinit");
1353 deinit_done_cb = er->deinit_done_cb;
1354 deinit_done_ctx = er->deinit_done_ctx;
1355 os_free(er->ip_addr_text);
1356 os_free(er);
1363 void wps_er_deinit(struct wps_er *er, void (*cb)(void *ctx), void *ctx)
1365 if (er == NULL)
1367 http_server_deinit(er->http_srv);
1368 wps_er_ap_remove_all(er);
1369 wps_er_ssdp_deinit(er);
1370 eloop_register_timeout(dl_list_empty(&er->ap_unsubscribing) ? 0 : 5, 0,
1371 wps_er_deinit_finish, er, NULL);
1372 wpa_printf(MSG_DEBUG, "WPS ER: Finish deinit from timeout");
1373 er->deinitializing = 1;
1374 er->deinit_done_cb = cb;
1375 er->deinit_done_ctx = ctx;
1389 wpa_printf(MSG_DEBUG, "WPS ER: SetSelectedRegistrar OK");
1396 wpa_printf(MSG_DEBUG, "WPS ER: SetSelectedRegistrar failed");
1405 ap->er->wps->event_cb(ap->er->wps->cb_ctx,
1418 wpa_printf(MSG_DEBUG, "WPS ER: No controlURL for AP");
1423 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request for AP - "
1429 wpa_printf(MSG_DEBUG, "WPS ER: Pending WPS operation for AP - "
1436 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse controlURL");
1494 void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id,
1499 struct wps_registrar *reg = er->wps->registrar;
1507 if (er->skip_set_sel_reg) {
1508 wpa_printf(MSG_DEBUG, "WPS ER: Skip SetSelectedRegistrar");
1530 wps_er_build_uuid_r(msg, er->wps->uuid)) {
1541 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
1542 if (er->set_sel_reg_uuid_filter &&
1543 os_memcmp(ap->uuid, er->set_sel_reg_uuid_filter,
1547 er->wps->event_cb(er->wps->cb_ctx,
1556 int wps_er_pbc(struct wps_er *er, const u8 *uuid, const u8 *addr)
1561 if (er == NULL || er->wps == NULL)
1564 if (wps_registrar_pbc_overlap(er->wps->registrar, NULL, NULL)) {
1565 wpa_printf(MSG_DEBUG, "WPS ER: PBC overlap - do not start PBC "
1571 ap = wps_er_ap_get(er, NULL, uuid, NULL);
1576 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
1588 wpa_printf(MSG_DEBUG, "WPS ER: AP settings not known");
1592 er->set_sel_reg_uuid_filter = uuid;
1593 res = wps_registrar_button_pushed(er->wps->registrar, NULL);
1594 er->set_sel_reg_uuid_filter = NULL;
1607 wpa_printf(MSG_DEBUG, "WPS ER: AP Settings received");
1618 ap->er->wps->event_cb(ap->er->wps->cb_ctx, WPS_EV_ER_AP_SETTINGS,
1623 const u8 * wps_er_get_sta_uuid(struct wps_er *er, const u8 *addr)
1626 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) {
1645 wpa_printf(MSG_DEBUG, "WPS ER: PutMessage OK");
1657 wpa_printf(MSG_DEBUG, "WPS ER: PutMessage failed");
1673 wpa_printf(MSG_DEBUG, "WPS ER: Could not extract "
1694 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP operation ongoing "
1700 wpa_printf(MSG_DEBUG, "WPS ER: No controlURL for AP");
1706 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse controlURL");
1753 wpa_printf(MSG_DEBUG, "WPS ER: Failed to build "
1759 wpa_printf(MSG_DEBUG, "WPS ER: Protocol run done");
1763 wpa_printf(MSG_DEBUG, "WPS ER: Failed to process message from "
1776 wpa_printf(MSG_DEBUG, "WPS ER: Protocol run already in "
1782 cfg.wps = ap->er->wps;
1799 wpa_printf(MSG_DEBUG, "WPS ER: Received GetDeviceInfo response (M1) "
1803 wpa_printf(MSG_DEBUG, "WPS ER: Could not extract "
1822 wpa_printf(MSG_DEBUG, "WPS ER: GetDeviceInfo OK");
1834 wpa_printf(MSG_DEBUG, "WPS ER: GetDeviceInfo failed");
1857 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP operation ongoing "
1863 wpa_printf(MSG_DEBUG, "WPS ER: No controlURL for AP");
1869 wpa_printf(MSG_DEBUG, "WPS ER: Failed to parse controlURL");
1894 int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *addr,
1899 if (er == NULL)
1902 ap = wps_er_ap_get(er, NULL, uuid, addr);
1904 wpa_printf(MSG_DEBUG, "WPS ER: AP not found for learn "
1911 wpa_printf(MSG_DEBUG, "WPS ER: Pending operation ongoing "
1919 er->skip_set_sel_reg = 1;
1920 wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0);
1921 er->skip_set_sel_reg = 0;
1927 int wps_er_set_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
1932 if (er == NULL)
1935 ap = wps_er_ap_get(er, NULL, uuid, addr);
1937 wpa_printf(MSG_DEBUG, "WPS ER: AP not found for set config "
1948 wpa_printf(MSG_DEBUG, "WPS ER: Updated local AP settings based set "
1960 wpa_printf(MSG_DEBUG, "WPS ER: Protocol run already in "
1966 cfg.wps = ap->er->wps;
1979 int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *addr,
1985 if (er == NULL)
1988 ap = wps_er_ap_get(er, NULL, uuid, addr);
1990 wpa_printf(MSG_DEBUG, "WPS ER: AP not found for config "
1997 wpa_printf(MSG_DEBUG, "WPS ER: Pending operation ongoing "
2012 er->skip_set_sel_reg = 1;
2013 wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0);
2014 er->skip_set_sel_reg = 0;
2046 struct wpabuf * wps_er_nfc_config_token(struct wps_er *er, const u8 *uuid,
2051 if (er == NULL)
2054 ap = wps_er_ap_get(er, NULL, uuid, addr);
2058 wpa_printf(MSG_DEBUG, "WPS ER: No settings known for the "
2063 return wps_er_config_token_from_cred(er->wps, ap->ap_settings);