Home | History | Annotate | Download | only in wps

Lines Matching defs:sta

34 static void wps_er_sta_event(struct wps_context *wps, struct wps_er_sta *sta,
44 ev->uuid = sta->uuid;
45 ev->mac_addr = sta->addr;
46 ev->m1_received = sta->m1_received;
47 ev->config_methods = sta->config_methods;
48 ev->dev_passwd_id = sta->dev_passwd_id;
49 ev->pri_dev_type = sta->pri_dev_type;
50 ev->dev_name = sta->dev_name;
51 ev->manufacturer = sta->manufacturer;
52 ev->model_name = sta->model_name;
53 ev->model_number = sta->model_number;
54 ev->serial_number = sta->serial_number;
62 struct wps_er_sta *sta;
63 dl_list_for_each(sta, &ap->sta, struct wps_er_sta, list) {
65 os_memcmp(sta->addr, addr, ETH_ALEN) == 0) &&
67 os_memcmp(uuid, sta->uuid, WPS_UUID_LEN) == 0))
68 return sta;
74 static void wps_er_sta_free(struct wps_er_sta *sta)
76 wps_er_sta_event(sta->ap->er->wps, sta, WPS_EV_ER_ENROLLEE_REMOVE);
77 if (sta->wps)
78 wps_deinit(sta->wps);
79 os_free(sta->manufacturer);
80 os_free(sta->model_name);
81 os_free(sta->model_number);
82 os_free(sta->serial_number);
83 os_free(sta->dev_name);
84 http_client_free(sta->http);
85 eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
86 os_free(sta->cred);
87 os_free(sta);
93 struct wps_er_sta *prev, *sta;
94 dl_list_for_each_safe(sta, prev, &ap->sta, struct wps_er_sta, list)
95 wps_er_sta_free(sta);
654 dl_list_init(&ap->sta);
750 struct wps_er_sta *sta = eloop_data;
751 wpa_printf(MSG_DEBUG, "WPS ER: STA entry timed out");
752 dl_list_del(&sta->list);
753 wps_er_sta_free(sta);
762 struct wps_er_sta *sta = wps_er_sta_get(ap, addr, NULL);
768 if (sta == NULL) {
770 * Only allow new STA entry to be added based on Probe Request
777 sta = os_zalloc(sizeof(*sta));
778 if (sta == NULL)
780 os_memcpy(sta->addr, addr, ETH_ALEN);
781 sta->ap = ap;
782 dl_list_add(&ap->sta, &sta->list);
787 sta->m1_received = 1;
789 if (attr->config_methods && (!probe_req || !sta->m1_received))
790 sta->config_methods = WPA_GET_BE16(attr->config_methods);
791 if (attr->uuid_e && (!probe_req || !sta->m1_received))
792 os_memcpy(sta->uuid, attr->uuid_e, WPS_UUID_LEN);
793 if (attr->primary_dev_type && (!probe_req || !sta->m1_received))
794 os_memcpy(sta->pri_dev_type, attr->primary_dev_type, 8);
795 if (attr->dev_password_id && (!probe_req || !sta->m1_received))
796 sta->dev_passwd_id = WPA_GET_BE16(attr->dev_password_id);
799 os_free(sta->manufacturer);
800 sta->manufacturer = dup_binstr(attr->manufacturer,
805 os_free(sta->model_name);
806 sta->model_name = dup_binstr(attr->model_name,
811 os_free(sta->model_number);
812 sta->model_number = dup_binstr(attr->model_number,
817 os_free(sta->serial_number);
818 sta->serial_number = dup_binstr(attr->serial_number,
823 os_free(sta->dev_name);
824 sta->dev_name = dup_binstr(attr->dev_name, attr->dev_name_len);
827 eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
828 eloop_register_timeout(300, 0, wps_er_sta_timeout, sta, NULL);
831 wps_er_sta_event(ap->er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
833 return sta;
868 struct wps_er_sta *sta = ctx;
880 http_client_free(sta->http);
881 sta->http = NULL;
963 static void wps_er_sta_send_msg(struct wps_er_sta *sta, struct wpabuf *msg)
970 if (sta->http) {
971 wpa_printf(MSG_DEBUG, "WPS ER: Pending HTTP request for STA - "
977 if (sta->ap->control_url == NULL) {
983 url = http_client_url_parse(sta->ap->control_url, &dst, &path);
999 MAC2STR(sta->addr));
1003 sta->http = http_client_addr(&dst, buf, 1000,
1004 wps_er_http_put_wlan_response_cb, sta);
1005 if (sta->http == NULL)
1010 static void wps_er_sta_process(struct wps_er_sta *sta, struct wpabuf *msg,
1015 res = wps_process_msg(sta->wps, op_code, msg);
1017 struct wpabuf *next = wps_get_msg(sta->wps, &op_code);
1019 wps_er_sta_send_msg(sta, next);
1024 wps_deinit(sta->wps);
1025 sta->wps = NULL;
1027 /* Remove the STA entry after short timeout */
1028 eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
1029 eloop_register_timeout(10, 0, wps_er_sta_timeout, sta,
1036 static void wps_er_sta_start(struct wps_er_sta *sta, struct wpabuf *msg)
1040 if (sta->wps)
1041 wps_deinit(sta->wps);
1044 cfg.wps = sta->ap->er->wps;
1046 cfg.peer_addr = sta->addr;
1048 sta->wps = wps_init(&cfg);
1049 if (sta->wps == NULL)
1051 sta->wps->er = 1;
1052 sta->wps->use_cred = sta->ap->ap_settings;
1053 if (sta->ap->ap_settings) {
1054 os_free(sta->cred);
1055 sta->cred = os_malloc(sizeof(*sta->cred));
1056 if (sta->cred) {
1057 os_memcpy(sta->cred, sta->ap->ap_settings,
1058 sizeof(*sta->cred));
1059 sta->cred->cred_attr = NULL;
1060 os_memcpy(sta->cred->mac_addr, sta->addr, ETH_ALEN);
1061 sta->wps->use_cred = sta->cred;
1065 wps_er_sta_process(sta, msg, WSC_MSG);
1073 struct wps_er_sta *sta;
1086 sta = wps_er_add_sta_data(ap, addr, &attr, 0);
1087 if (sta == NULL)
1091 wps_er_sta_start(sta, msg);
1092 else if (sta->wps) {
1107 wps_er_sta_process(sta, msg, op_code);
1334 struct wps_er_sta *sta;
1338 dl_list_for_each(sta, &ap->sta, struct wps_er_sta, list)
1339 wps_er_sta_event(er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
1580 struct wps_er_sta *sta = NULL;
1582 sta = wps_er_sta_get(ap, addr, uuid);
1583 if (sta) {
1588 if (sta == NULL)
1632 struct wps_er_sta *sta;
1633 sta = wps_er_sta_get(ap, addr, NULL);
1634 if (sta)
1635 return sta->uuid;