Lines Matching full:hapd
30 gas_dialog_create(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token)
36 sta = ap_get_sta(hapd, addr);
44 sta = ap_sta_add(hapd, addr);
55 ap_sta_session_timeout(hapd, sta, 5);
57 ap_sta_replenish_timeout(hapd, sta, 5);
79 wpa_msg(hapd->msg_ctx, MSG_ERROR, "ANQP: Could not create dialog for "
88 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
94 sta = ap_get_sta(hapd, addr);
104 ap_sta_replenish_timeout(hapd, sta, 5);
120 static void gas_serv_free_dialogs(struct hostapd_data *hapd,
126 sta = ap_get_sta(hapd, sta_addr);
141 static void anqp_add_hs_capab_list(struct hostapd_data *hapd,
152 if (hapd->conf->hs20_oper_friendly_name)
154 if (hapd->conf->hs20_wan_metrics)
156 if (hapd->conf->hs20_connection_capability)
158 if (hapd->conf->nai_realm_data)
160 if (hapd->conf->hs20_operating_class)
162 if (hapd->conf->hs20_osu_providers_count)
164 if (hapd->conf->hs20_icons_count)
171 static struct anqp_element * get_anqp_elem(struct hostapd_data *hapd,
176 dl_list_for_each(elem, &hapd->conf->anqp_elem, struct anqp_element,
186 static void anqp_add_elem(struct hostapd_data *hapd, struct wpabuf *buf,
191 elem = get_anqp_elem(hapd, infoid);
206 static int anqp_add_override(struct hostapd_data *hapd, struct wpabuf *buf,
209 if (get_anqp_elem(hapd, infoid)) {
210 anqp_add_elem(hapd, buf, infoid);
218 static void anqp_add_capab_list(struct hostapd_data *hapd,
224 if (anqp_add_override(hapd, buf, ANQP_CAPABILITY_LIST))
229 if (hapd->conf->venue_name || get_anqp_elem(hapd, ANQP_VENUE_NAME))
231 if (get_anqp_elem(hapd, ANQP_EMERGENCY_CALL_NUMBER))
233 if (hapd->conf->network_auth_type ||
234 get_anqp_elem(hapd, ANQP_NETWORK_AUTH_TYPE))
236 if (hapd->conf->roaming_consortium ||
237 get_anqp_elem(hapd, ANQP_ROAMING_CONSORTIUM))
239 if (hapd->conf->ipaddr_type_configured ||
240 get_anqp_elem(hapd, ANQP_IP_ADDR_TYPE_AVAILABILITY))
242 if (hapd->conf->nai_realm_data ||
243 get_anqp_elem(hapd, ANQP_NAI_REALM))
245 if (hapd->conf->anqp_3gpp_cell_net ||
246 get_anqp_elem(hapd, ANQP_3GPP_CELLULAR_NETWORK))
248 if (get_anqp_elem(hapd, ANQP_AP_GEOSPATIAL_LOCATION))
250 if (get_anqp_elem(hapd, ANQP_AP_CIVIC_LOCATION))
252 if (get_anqp_elem(hapd, ANQP_AP_LOCATION_PUBLIC_URI))
254 if (hapd->conf->domain_name || get_anqp_elem(hapd, ANQP_DOMAIN_NAME))
256 if (get_anqp_elem(hapd, ANQP_EMERGENCY_ALERT_URI))
258 if (get_anqp_elem(hapd, ANQP_EMERGENCY_NAI))
260 if (get_anqp_elem(hapd, ANQP_NEIGHBOR_REPORT))
263 if (get_anqp_elem(hapd, id))
266 if (get_anqp_elem(hapd, ANQP_VENUE_URL))
268 if (get_anqp_elem(hapd, ANQP_ADVICE_OF_CHARGE))
270 if (get_anqp_elem(hapd, ANQP_LOCAL_CONTENT))
273 anqp_add_hs_capab_list(hapd, buf);
279 static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf)
281 if (anqp_add_override(hapd, buf, ANQP_VENUE_NAME))
284 if (hapd->conf->venue_name) {
288 wpabuf_put_u8(buf, hapd->conf->venue_group);
289 wpabuf_put_u8(buf, hapd->conf->venue_type);
290 for (i = 0; i < hapd->conf->venue_name_count; i++) {
292 vn = &hapd->conf->venue_name[i];
302 static void anqp_add_network_auth_type(struct hostapd_data *hapd,
305 if (anqp_add_override(hapd, buf, ANQP_NETWORK_AUTH_TYPE))
308 if (hapd->conf->network_auth_type) {
310 wpabuf_put_le16(buf, hapd->conf->network_auth_type_len);
311 wpabuf_put_data(buf, hapd->conf->network_auth_type,
312 hapd->conf->network_auth_type_len);
317 static void anqp_add_roaming_consortium(struct hostapd_data *hapd,
323 if (anqp_add_override(hapd, buf, ANQP_ROAMING_CONSORTIUM))
327 for (i = 0; i < hapd->conf->roaming_consortium_count; i++) {
329 rc = &hapd->conf->roaming_consortium[i];
337 static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd,
340 if (anqp_add_override(hapd, buf, ANQP_IP_ADDR_TYPE_AVAILABILITY))
343 if (hapd->conf->ipaddr_type_configured) {
346 wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability);
389 static int hs20_add_nai_home_realm_matches(struct hostapd_data *hapd,
428 for (j = 0; j < hapd->conf->nai_realm_count &&
431 realm = &hapd->conf->nai_realm_data[j];
475 realm = &hapd->conf->nai_realm_data[matches[i].realm_data_idx];
483 static void anqp_add_nai_realm(struct hostapd_data *hapd, struct wpabuf *buf,
488 anqp_add_override(hapd, buf, ANQP_NAI_REALM))
491 if (nai_realm && hapd->conf->nai_realm_data) {
495 wpabuf_put_le16(buf, hapd->conf->nai_realm_count);
496 for (i = 0; i < hapd->conf->nai_realm_count; i++) {
500 realm = &hapd->conf->nai_realm_data[i];
514 } else if (nai_home_realm && hapd->conf->nai_realm_data && home_realm) {
515 hs20_add_nai_home_realm_matches(hapd, buf, home_realm,
521 static void anqp_add_3gpp_cellular_network(struct hostapd_data *hapd,
524 if (anqp_add_override(hapd, buf, ANQP_3GPP_CELLULAR_NETWORK))
527 if (hapd->conf->anqp_3gpp_cell_net) {
530 hapd->conf->anqp_3gpp_cell_net_len);
531 wpabuf_put_data(buf, hapd->conf->anqp_3gpp_cell_net,
532 hapd->conf->anqp_3gpp_cell_net_len);
537 static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf)
539 if (anqp_add_override(hapd, buf, ANQP_DOMAIN_NAME))
542 if (hapd->conf->domain_name) {
544 wpabuf_put_le16(buf, hapd->conf->domain_name_len);
545 wpabuf_put_data(buf, hapd->conf->domain_name,
546 hapd->conf->domain_name_len);
553 static void anqp_add_operator_friendly_name(struct hostapd_data *hapd,
556 if (hapd->conf->hs20_oper_friendly_name) {
564 for (i = 0; i < hapd->conf->hs20_oper_friendly_name_count; i++)
567 vn = &hapd->conf->hs20_oper_friendly_name[i];
577 static void anqp_add_wan_metrics(struct hostapd_data *hapd,
580 if (hapd->conf->hs20_wan_metrics) {
586 wpabuf_put_data(buf, hapd->conf->hs20_wan_metrics, 13);
592 static void anqp_add_connection_capability(struct hostapd_data *hapd,
595 if (hapd->conf->hs20_connection_capability) {
601 wpabuf_put_data(buf, hapd->conf->hs20_connection_capability,
602 hapd->conf->hs20_connection_capability_len);
608 static void anqp_add_operating_class(struct hostapd_data *hapd,
611 if (hapd->conf->hs20_operating_class) {
617 wpabuf_put_data(buf, hapd->conf->hs20_operating_class,
618 hapd->conf->hs20_operating_class_len);
701 static void anqp_add_osu_providers_list(struct hostapd_data *hapd,
704 if (hapd->conf->hs20_osu_providers_count) {
713 wpabuf_put_u8(buf, hapd->conf->osu_ssid_len);
714 wpabuf_put_data(buf, hapd->conf->osu_ssid,
715 hapd->conf->osu_ssid_len);
718 wpabuf_put_u8(buf, hapd->conf->hs20_osu_providers_count);
720 for (i = 0; i < hapd->conf->hs20_osu_providers_count; i++) {
722 buf, hapd->conf,
723 &hapd->conf->hs20_osu_providers[i]);
731 static void anqp_add_icon_binary_file(struct hostapd_data *hapd,
741 for (i = 0; i < hapd->conf->hs20_icons_count; i++) {
742 icon = &hapd->conf->hs20_icons[i];
748 if (i < hapd->conf->hs20_icons_count)
749 icon = &hapd->conf->hs20_icons[i];
789 static size_t anqp_get_required_len(struct hostapd_data *hapd,
797 struct anqp_element *elem = get_anqp_elem(hapd, infoid[i]);
808 gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
824 len += anqp_get_required_len(hapd, extra_req, num_extra_req);
831 anqp_add_capab_list(hapd, buf);
833 anqp_add_venue_name(hapd, buf);
835 anqp_add_elem(hapd, buf, ANQP_EMERGENCY_CALL_NUMBER);
837 anqp_add_network_auth_type(hapd, buf);
839 anqp_add_roaming_consortium(hapd, buf);
841 anqp_add_ip_addr_type_availability(hapd, buf);
843 anqp_add_nai_realm(hapd, buf, home_realm, home_realm_len,
847 anqp_add_3gpp_cellular_network(hapd, buf);
849 anqp_add_elem(hapd, buf, ANQP_AP_GEOSPATIAL_LOCATION);
851 anqp_add_elem(hapd, buf, ANQP_AP_CIVIC_LOCATION);
853 anqp_add_elem(hapd, buf, ANQP_AP_LOCATION_PUBLIC_URI);
855 anqp_add_domain_name(hapd, buf);
857 anqp_add_elem(hapd, buf, ANQP_EMERGENCY_ALERT_URI);
859 anqp_add_elem(hapd, buf, ANQP_TDLS_CAPABILITY);
861 anqp_add_elem(hapd, buf, ANQP_EMERGENCY_NAI);
864 anqp_add_elem(hapd, buf, extra_req[i]);
868 anqp_add_hs_capab_list(hapd, buf);
870 anqp_add_operator_friendly_name(hapd, buf);
872 anqp_add_wan_metrics(hapd, buf);
874 anqp_add_connection_capability(hapd, buf);
876 anqp_add_operating_class(hapd, buf);
878 anqp_add_osu_providers_list(hapd, buf);
880 anqp_add_icon_binary_file(hapd, buf, icon_name, icon_name_len);
913 static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
923 hapd->conf->venue_name != NULL, qi);
928 get_anqp_elem(hapd, info_id) != NULL, qi);
932 hapd->conf->network_auth_type != NULL, qi);
936 hapd->conf->roaming_consortium != NULL, qi);
941 hapd->conf->ipaddr_type_configured, qi);
945 hapd->conf->nai_realm_data != NULL, qi);
950 hapd->conf->anqp_3gpp_cell_net != NULL, qi);
955 get_anqp_elem(hapd, info_id) != NULL, qi);
960 get_anqp_elem(hapd, info_id) != NULL, qi);
965 get_anqp_elem(hapd, info_id) != NULL, qi);
969 hapd->conf->domain_name != NULL, qi);
974 get_anqp_elem(hapd, info_id) != NULL, qi);
979 get_anqp_elem(hapd, info_id) != NULL, qi);
984 get_anqp_elem(hapd, info_id) != NULL, qi);
987 if (!get_anqp_elem(hapd, info_id)) {
1006 static void rx_anqp_query_list(struct hostapd_data *hapd,
1014 rx_anqp_query_list_id(hapd, WPA_GET_LE16(pos), qi);
1022 static void rx_anqp_hs_query_list(struct hostapd_data *hapd, u8 subtype,
1033 hapd->conf->hs20_oper_friendly_name != NULL, qi);
1037 hapd->conf->hs20_wan_metrics != NULL, qi);
1042 hapd->conf->hs20_connection_capability != NULL,
1047 hapd->conf->hs20_operating_class != NULL, qi);
1051 hapd->conf->hs20_osu_providers_count, qi);
1061 static void rx_anqp_hs_nai_home_realm(struct hostapd_data *hapd,
1068 if (hapd->conf->nai_realm_data != NULL) {
1078 static void rx_anqp_hs_icon_request(struct hostapd_data *hapd,
1085 if (hapd->conf->hs20_icons_count) {
1095 static void rx_anqp_vendor_specific(struct hostapd_data *hapd,
1147 rx_anqp_hs_query_list(hapd, *pos, qi);
1152 rx_anqp_hs_nai_home_realm(hapd, pos, end, qi);
1155 rx_anqp_hs_icon_request(hapd, pos, end, qi);
1167 hapd,
1173 buf = gas_serv_build_gas_resp_payload(hapd, qi->request,
1191 if (wpabuf_len(buf) > hapd->gas_frag_limit ||
1192 hapd->conf->gas_comeback_delay) {
1196 if (hapd->conf->gas_comeback_delay) {
1198 comeback_delay = hapd->conf->gas_comeback_delay;
1203 di = gas_dialog_create(hapd, sa, dialog_token);
1230 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1236 static void gas_serv_rx_gas_initial_req(struct hostapd_data *hapd,
1254 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1259 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1267 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1276 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1290 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1325 rx_anqp_query_list(hapd, pos, pos + elen, &qi);
1329 rx_anqp_vendor_specific(hapd, pos, pos + elen, &qi);
1341 gas_serv_req_local_processing(hapd, sa, dialog_token, &qi, prot);
1345 static void gas_serv_rx_gas_comeback_req(struct hostapd_data *hapd,
1359 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Dialog Token: %u",
1362 dialog = gas_serv_dialog_find(hapd, sa, dialog_token);
1364 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: No pending SD "
1379 if (frag_len > hapd->gas_frag_limit) {
1380 frag_len = hapd->gas_frag_limit;
1383 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: resp frag_len %u",
1388 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Failed to allocate "
1402 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Tx GAS Comeback Response "
1409 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: %d more bytes remain "
1414 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: All fragments of "
1417 gas_serv_free_dialogs(hapd, sa);
1423 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1432 struct hostapd_data *hapd = ctx;
1454 gas_serv_rx_gas_initial_req(hapd, sa, data + 1, len - 1, prot);
1457 gas_serv_rx_gas_comeback_req(hapd, sa, data + 1, len - 1, prot);
1463 int gas_serv_init(struct hostapd_data *hapd)
1465 hapd->public_action_cb2 = gas_serv_rx_public_action;
1466 hapd->public_action_cb2_ctx = hapd;
1467 hapd->gas_frag_limit = 1400;
1468 if (hapd->conf->gas_frag_limit > 0)
1469 hapd->gas_frag_limit = hapd->conf->gas_frag_limit;
1474 void gas_serv_deinit(struct hostapd_data *hapd)