Lines Matching refs:er

76 	wps_er_sta_event(sta->ap->er->wps, sta, WPS_EV_ER_ENROLLEE_REMOVE);  in wps_er_sta_free()
99 static struct wps_er_ap * wps_er_ap_get(struct wps_er *er, in wps_er_ap_get() argument
104 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { 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()
181 static void wps_er_ap_unsubscribed(struct wps_er *er, struct wps_er_ap *ap) in wps_er_ap_unsubscribed() argument
188 if (er->deinitializing && dl_list_empty(&er->ap_unsubscribing)) in wps_er_ap_unsubscribed()
189 wps_er_deinit_finish(er, NULL); in wps_er_ap_unsubscribed()
217 wps_er_ap_unsubscribed(ap->er, ap); in wps_er_http_unsubscribe_cb()
221 static void wps_er_ap_unsubscribe(struct wps_er *er, struct wps_er_ap *ap) in wps_er_ap_unsubscribe() argument
274 wps_er_ap_unsubscribed(ap->er, ap); in wps_er_ap_unsubscribe()
278 static struct wps_er_ap_settings * wps_er_ap_get_settings(struct wps_er *er, in wps_er_ap_get_settings() argument
282 dl_list_for_each(s, &er->ap_settings, struct wps_er_ap_settings, list) in wps_er_ap_get_settings()
289 int wps_er_ap_cache_settings(struct wps_er *er, struct in_addr *addr) in wps_er_ap_cache_settings() argument
294 ap = wps_er_ap_get(er, addr, NULL, NULL); in wps_er_ap_cache_settings()
298 settings = wps_er_ap_get_settings(er, ap->uuid); in wps_er_ap_cache_settings()
304 dl_list_add(&er->ap_settings, &settings->list); in wps_er_ap_cache_settings()
313 static int wps_er_ap_use_cached_settings(struct wps_er *er, in wps_er_ap_use_cached_settings() argument
321 s = wps_er_ap_get_settings(ap->er, ap->uuid); in wps_er_ap_use_cached_settings()
335 static void wps_er_ap_remove_entry(struct wps_er *er, struct wps_er_ap *ap) in wps_er_ap_remove_entry() argument
339 eloop_cancel_timeout(wps_er_ap_timeout, er, ap); in wps_er_ap_remove_entry()
341 wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_REMOVE); in wps_er_ap_remove_entry()
351 dl_list_add(&er->ap_unsubscribing, &ap->list); in wps_er_ap_remove_entry()
352 wps_er_ap_unsubscribe(er, ap); in wps_er_ap_remove_entry()
360 struct wps_er *er = eloop_data; in wps_er_ap_timeout() local
363 wps_er_ap_remove_entry(er, ap); in wps_er_ap_timeout()
412 wps_er_ap_use_cached_settings(ap->er, ap); in wps_er_http_subscribe_cb()
413 wps_er_ap_event(ap->er->wps, ap, WPS_EV_ER_AP_ADD); in wps_er_http_subscribe_cb()
462 ap->er->ip_addr_text, ap->er->http_port, in wps_er_subscribe()
463 ap->er->event_id, ap->id, 1800); in wps_er_subscribe()
638 void wps_er_ap_add(struct wps_er *er, const u8 *uuid, struct in_addr *addr, in wps_er_ap_add() argument
643 ap = wps_er_ap_get(er, addr, uuid, NULL); in wps_er_ap_add()
646 eloop_cancel_timeout(wps_er_ap_timeout, er, ap); in wps_er_ap_add()
647 eloop_register_timeout(max_age, 0, wps_er_ap_timeout, er, ap); in wps_er_ap_add()
655 ap->er = er; in wps_er_ap_add()
656 ap->id = ++er->next_ap_id; in wps_er_ap_add()
662 dl_list_add(&er->ap, &ap->list); in wps_er_ap_add()
666 eloop_register_timeout(max_age, 0, wps_er_ap_timeout, er, ap); in wps_er_ap_add()
677 void wps_er_ap_remove(struct wps_er *er, struct in_addr *addr) in wps_er_ap_remove() argument
680 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_ap_remove()
682 wps_er_ap_remove_entry(er, ap); in wps_er_ap_remove()
689 static void wps_er_ap_remove_all(struct wps_er *er) in wps_er_ap_remove_all() argument
693 dl_list_for_each_safe(ap, prev, &er->ap, struct wps_er_ap, list) in wps_er_ap_remove_all()
694 wps_er_ap_remove_entry(er, ap); in wps_er_ap_remove_all()
695 dl_list_for_each_safe(s, prev_s, &er->ap_settings, in wps_er_ap_remove_all()
831 wps_er_sta_event(ap->er->wps, sta, WPS_EV_ER_ENROLLEE_ADD); in wps_er_add_sta_data()
861 wps_registrar_probe_req_rx(ap->er->wps->registrar, addr, msg, 0); in wps_er_process_wlanevent_probe_req()
1044 cfg.wps = sta->ap->er->wps; in wps_er_sta_start()
1051 sta->wps->er = 1; in wps_er_sta_start()
1152 static void wps_er_http_event(struct wps_er *er, struct http_request *req, in wps_er_http_event() argument
1155 struct wps_er_ap *ap = wps_er_ap_get_id(er, ap_id); in wps_er_http_event()
1188 static void wps_er_http_notify(struct wps_er *er, struct http_request *req) in wps_er_http_notify() argument
1196 if (event_id != er->event_id) { in wps_er_http_notify()
1205 wps_er_http_event(er, req, atoi(pos)); in wps_er_http_notify()
1216 struct wps_er *er = ctx; in wps_er_http_req() local
1228 wps_er_http_notify(er, req); in wps_er_http_req()
1252 struct wps_er *er; in wps_er_init() local
1255 er = os_zalloc(sizeof(*er)); in wps_er_init()
1256 if (er == NULL) in wps_er_init()
1258 dl_list_init(&er->ap); in wps_er_init()
1259 dl_list_init(&er->ap_unsubscribing); in wps_er_init()
1260 dl_list_init(&er->ap_settings); in wps_er_init()
1262 er->multicast_sd = -1; in wps_er_init()
1263 er->ssdp_sd = -1; in wps_er_init()
1265 os_strlcpy(er->ifname, ifname, sizeof(er->ifname)); in wps_er_init()
1266 er->wps = wps; in wps_er_init()
1267 if (os_get_random((unsigned char *) &er->event_id, in wps_er_init()
1268 sizeof(er->event_id)) < 0) { in wps_er_init()
1269 wps_er_deinit(er, NULL, NULL); in wps_er_init()
1273 er->event_id &= 0x0fffffff; in wps_er_init()
1281 os_strlcpy(er->ifname, pos, len < sizeof(er->ifname) ? in wps_er_init()
1282 len + 1 : sizeof(er->ifname)); in wps_er_init()
1285 os_strlcpy(er->ifname, pos, sizeof(er->ifname)); in wps_er_init()
1288 er->forced_ifname = 1; in wps_er_init()
1292 if (inet_aton(filter, &er->filter_addr) == 0) { in wps_er_init()
1295 wps_er_deinit(er, NULL, NULL); in wps_er_init()
1301 if (get_netif_info(er->ifname, &er->ip_addr, &er->ip_addr_text, in wps_er_init()
1302 er->mac_addr)) { in wps_er_init()
1304 "for %s. Does it have IP address?", er->ifname); in wps_er_init()
1305 wps_er_deinit(er, NULL, NULL); in wps_er_init()
1309 if (wps_er_ssdp_init(er) < 0) { in wps_er_init()
1311 wps_er_deinit(er, NULL, NULL); in wps_er_init()
1315 addr.s_addr = er->ip_addr; in wps_er_init()
1316 er->http_srv = http_server_init(&addr, -1, wps_er_http_req, er); in wps_er_init()
1317 if (er->http_srv == NULL) { in wps_er_init()
1319 wps_er_deinit(er, NULL, NULL); in wps_er_init()
1322 er->http_port = http_server_get_port(er->http_srv); in wps_er_init()
1325 er->ifname, er->ip_addr_text); in wps_er_init()
1327 return er; in wps_er_init()
1331 void wps_er_refresh(struct wps_er *er) in wps_er_refresh() argument
1336 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_refresh()
1337 wps_er_ap_event(er->wps, ap, WPS_EV_ER_AP_ADD); in wps_er_refresh()
1339 wps_er_sta_event(er->wps, sta, WPS_EV_ER_ENROLLEE_ADD); in wps_er_refresh()
1342 wps_er_send_ssdp_msearch(er); in wps_er_refresh()
1348 struct wps_er *er = eloop_data; in wps_er_deinit_finish() local
1355 dl_list_for_each_safe(ap, tmp, &er->ap_unsubscribing, struct wps_er_ap, in wps_er_deinit_finish()
1363 eloop_cancel_timeout(wps_er_deinit_finish, er, NULL); in wps_er_deinit_finish()
1364 deinit_done_cb = er->deinit_done_cb; in wps_er_deinit_finish()
1365 deinit_done_ctx = er->deinit_done_ctx; in wps_er_deinit_finish()
1366 os_free(er->ip_addr_text); in wps_er_deinit_finish()
1367 os_free(er); in wps_er_deinit_finish()
1374 void wps_er_deinit(struct wps_er *er, void (*cb)(void *ctx), void *ctx) in wps_er_deinit() argument
1376 if (er == NULL) in wps_er_deinit()
1378 http_server_deinit(er->http_srv); in wps_er_deinit()
1379 wps_er_ap_remove_all(er); in wps_er_deinit()
1380 wps_er_ssdp_deinit(er); in wps_er_deinit()
1381 eloop_register_timeout(dl_list_empty(&er->ap_unsubscribing) ? 0 : 5, 0, in wps_er_deinit()
1382 wps_er_deinit_finish, er, NULL); in wps_er_deinit()
1384 er->deinitializing = 1; in wps_er_deinit()
1385 er->deinit_done_cb = cb; in wps_er_deinit()
1386 er->deinit_done_ctx = ctx; in wps_er_deinit()
1416 ap->er->wps->event_cb(ap->er->wps->cb_ctx, in wps_er_http_set_sel_reg_cb()
1503 void wps_er_set_sel_reg(struct wps_er *er, int sel_reg, u16 dev_passwd_id, in wps_er_set_sel_reg() argument
1508 struct wps_registrar *reg = er->wps->registrar; in wps_er_set_sel_reg()
1514 if (er->skip_set_sel_reg) { in wps_er_set_sel_reg()
1535 wps_er_build_uuid_r(msg, er->wps->uuid)) { in wps_er_set_sel_reg()
1546 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_set_sel_reg()
1547 if (er->set_sel_reg_uuid_filter && in wps_er_set_sel_reg()
1548 os_memcmp(ap->uuid, er->set_sel_reg_uuid_filter, in wps_er_set_sel_reg()
1552 er->wps->event_cb(er->wps->cb_ctx, in wps_er_set_sel_reg()
1561 int wps_er_pbc(struct wps_er *er, const u8 *uuid, const u8 *addr) in wps_er_pbc() argument
1566 if (er == NULL || er->wps == NULL) in wps_er_pbc()
1569 if (wps_registrar_pbc_overlap(er->wps->registrar, NULL, NULL)) { in wps_er_pbc()
1576 ap = wps_er_ap_get(er, NULL, uuid, NULL); in wps_er_pbc()
1581 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_pbc()
1597 er->set_sel_reg_uuid_filter = uuid; in wps_er_pbc()
1598 res = wps_registrar_button_pushed(er->wps->registrar, NULL); in wps_er_pbc()
1599 er->set_sel_reg_uuid_filter = NULL; in wps_er_pbc()
1623 ap->er->wps->event_cb(ap->er->wps->cb_ctx, WPS_EV_ER_AP_SETTINGS, in wps_er_ap_settings_cb()
1628 const u8 * wps_er_get_sta_uuid(struct wps_er *er, const u8 *addr) in wps_er_get_sta_uuid() argument
1631 dl_list_for_each(ap, &er->ap, struct wps_er_ap, list) { in wps_er_get_sta_uuid()
1800 cfg.wps = ap->er->wps; in wps_er_ap_learn_m1()
1912 int wps_er_learn(struct wps_er *er, const u8 *uuid, const u8 *addr, in wps_er_learn() argument
1917 if (er == NULL) in wps_er_learn()
1920 ap = wps_er_ap_get(er, NULL, uuid, addr); in wps_er_learn()
1937 er->skip_set_sel_reg = 1; in wps_er_learn()
1938 wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0); in wps_er_learn()
1939 er->skip_set_sel_reg = 0; in wps_er_learn()
1945 int wps_er_set_config(struct wps_er *er, const u8 *uuid, const u8 *addr, in wps_er_set_config() argument
1950 if (er == NULL) in wps_er_set_config()
1953 ap = wps_er_ap_get(er, NULL, uuid, addr); in wps_er_set_config()
1984 cfg.wps = ap->er->wps; in wps_er_ap_config_m1()
1997 int wps_er_config(struct wps_er *er, const u8 *uuid, const u8 *addr, in wps_er_config() argument
2003 if (er == NULL) in wps_er_config()
2006 ap = wps_er_ap_get(er, NULL, uuid, addr); in wps_er_config()
2030 er->skip_set_sel_reg = 1; in wps_er_config()
2031 wps_registrar_add_pin(er->wps->registrar, NULL, uuid, pin, pin_len, 0); in wps_er_config()
2032 er->skip_set_sel_reg = 0; in wps_er_config()
2063 struct wpabuf * wps_er_nfc_config_token(struct wps_er *er, const u8 *uuid, in wps_er_nfc_config_token() argument
2068 if (er == NULL) in wps_er_nfc_config_token()
2071 ap = wps_er_ap_get(er, NULL, uuid, addr); in wps_er_nfc_config_token()
2080 return wps_er_config_token_from_cred(er->wps, ap->ap_settings); in wps_er_nfc_config_token()
2084 struct wpabuf * wps_er_nfc_handover_sel(struct wps_er *er, in wps_er_nfc_handover_sel() argument
2090 if (er == NULL) in wps_er_nfc_handover_sel()
2093 ap = wps_er_ap_get(er, NULL, uuid, addr); in wps_er_nfc_handover_sel()