Lines Matching refs: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);
650 dl_list_init(&ap->sta);
746 struct wps_er_sta *sta = eloop_data;
748 dl_list_del(&sta->list);
749 wps_er_sta_free(sta);
758 struct wps_er_sta *sta = wps_er_sta_get(ap, addr, NULL);
764 if (sta == NULL) {
773 sta = os_zalloc(sizeof(*sta));
774 if (sta == NULL)
776 os_memcpy(sta->addr, addr, ETH_ALEN);
777 sta->ap = ap;
778 dl_list_add(&ap->sta, &sta->list);
783 sta->m1_received = 1;
785 if (attr->config_methods && (!probe_req || !sta->m1_received))
786 sta->config_methods = WPA_GET_BE16(attr->config_methods);
787 if (attr->uuid_e && (!probe_req || !sta->m1_received))
788 os_memcpy(sta->uuid, attr->uuid_e, WPS_UUID_LEN);
789 if (attr->primary_dev_type && (!probe_req || !sta->m1_received))
790 os_memcpy(sta->pri_dev_type, attr->primary_dev_type, 8);
791 if (attr->dev_password_id && (!probe_req || !sta->m1_received))
792 sta->dev_passwd_id = WPA_GET_BE16(attr->dev_password_id);
795 os_free(sta->manufacturer);
796 sta->manufacturer = os_malloc(attr->manufacturer_len + 1);
797 if (sta->manufacturer) {
798 os_memcpy(sta->manufacturer, attr->manufacturer,
800 sta->manufacturer[attr->manufacturer_len] = '\0';
805 os_free(sta->model_name);
806 sta->model_name = os_malloc(attr->model_name_len + 1);
807 if (sta->model_name) {
808 os_memcpy(sta->model_name, attr->model_name,
810 sta->model_name[attr->model_name_len] = '\0';
815 os_free(sta->model_number);
816 sta->model_number = os_malloc(attr->model_number_len + 1);
817 if (sta->model_number) {
818 os_memcpy(sta->model_number, attr->model_number,
820 sta->model_number[attr->model_number_len] = '\0';
825 os_free(sta->serial_number);
826 sta->serial_number = os_malloc(attr->serial_number_len + 1);
827 if (sta->serial_number) {
828 os_memcpy(sta->serial_number, attr->serial_number,
830 sta->serial_number[attr->serial_number_len] = '\0';
835 os_free(sta->dev_name);
836 sta->dev_name = os_malloc(attr->dev_name_len + 1);
837 if (sta->dev_name) {
838 os_memcpy(sta->dev_name, attr->dev_name,
840 sta->dev_name[attr->dev_name_len] = '\0';
844 eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
845 eloop_register_timeout(300, 0, wps_er_sta_timeout, sta, NULL);
848 wps_er_sta_event(ap->er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
850 return sta;
885 struct wps_er_sta *sta = ctx;
897 http_client_free(sta->http);
898 sta->http = NULL;
980 static void wps_er_sta_send_msg(struct wps_er_sta *sta, struct wpabuf *msg)
987 if (sta->http) {
994 if (sta->ap->control_url == NULL) {
1000 url = http_client_url_parse(sta->ap->control_url, &dst, &path);
1016 MAC2STR(sta->addr));
1020 sta->http = http_client_addr(&dst, buf, 1000,
1021 wps_er_http_put_wlan_response_cb, sta);
1022 if (sta->http == NULL)
1027 static void wps_er_sta_process(struct wps_er_sta *sta, struct wpabuf *msg,
1032 res = wps_process_msg(sta->wps, op_code, msg);
1034 struct wpabuf *next = wps_get_msg(sta->wps, &op_code);
1036 wps_er_sta_send_msg(sta, next);
1041 wps_deinit(sta->wps);
1042 sta->wps = NULL;
1045 eloop_cancel_timeout(wps_er_sta_timeout, sta, NULL);
1046 eloop_register_timeout(10, 0, wps_er_sta_timeout, sta,
1053 static void wps_er_sta_start(struct wps_er_sta *sta, struct wpabuf *msg)
1057 if (sta->wps)
1058 wps_deinit(sta->wps);
1061 cfg.wps = sta->ap->er->wps;
1063 cfg.peer_addr = sta->addr;
1065 sta->wps = wps_init(&cfg);
1066 if (sta->wps == NULL)
1068 sta->wps->er = 1;
1069 sta->wps->use_cred = sta->ap->ap_settings;
1070 if (sta->ap->ap_settings) {
1071 os_free(sta->cred);
1072 sta->cred = os_malloc(sizeof(*sta->cred));
1073 if (sta->cred) {
1074 os_memcpy(sta->cred, sta->ap->ap_settings,
1075 sizeof(*sta->cred));
1076 sta->cred->cred_attr = NULL;
1077 os_memcpy(sta->cred->mac_addr, sta->addr, ETH_ALEN);
1078 sta->wps->use_cred = sta->cred;
1082 wps_er_sta_process(sta, msg, WSC_MSG);
1090 struct wps_er_sta *sta;
1103 sta = wps_er_add_sta_data(ap, addr, &attr, 0);
1104 if (sta == NULL)
1108 wps_er_sta_start(sta, msg);
1109 else if (sta->wps) {
1124 wps_er_sta_process(sta, msg, op_code);
1335 struct wps_er_sta *sta;
1339 dl_list_for_each(sta, &ap->sta, struct wps_er_sta, list)
1340 wps_er_sta_event(er->wps, sta, WPS_EV_ER_ENROLLEE_ADD);
1574 struct wps_er_sta *sta = NULL;
1576 sta = wps_er_sta_get(ap, NULL, uuid);
1577 if (sta) {
1582 if (sta == NULL)