Home | History | Annotate | Download | only in ap

Lines Matching defs: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);
56 ap_sta_session_timeout(hapd, sta,
57 hapd->conf->gas_comeback_delay / 1024 +
60 ap_sta_replenish_timeout(hapd, sta, 5);
82 wpa_msg(hapd->msg_ctx, MSG_ERROR, "ANQP: Could not create dialog for "
91 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
97 sta = ap_get_sta(hapd, addr);
107 ap_sta_replenish_timeout(hapd, sta, 5);
123 static void gas_serv_free_dialogs(struct hostapd_data *hapd,
129 sta = ap_get_sta(hapd, sta_addr);
144 static void anqp_add_hs_capab_list(struct hostapd_data *hapd,
155 if (hapd->conf->hs20_oper_friendly_name)
157 if (hapd->conf->hs20_wan_metrics)
159 if (hapd->conf->hs20_connection_capability)
161 if (hapd->conf->nai_realm_data)
163 if (hapd->conf->hs20_operating_class)
165 if (hapd->conf->hs20_osu_providers_count)
167 if (hapd->conf->hs20_icons_count)
174 static struct anqp_element * get_anqp_elem(struct hostapd_data *hapd,
179 dl_list_for_each(elem, &hapd->conf->anqp_elem, struct anqp_element,
189 static void anqp_add_elem(struct hostapd_data *hapd, struct wpabuf *buf,
194 elem = get_anqp_elem(hapd, infoid);
209 static int anqp_add_override(struct hostapd_data *hapd, struct wpabuf *buf,
212 if (get_anqp_elem(hapd, infoid)) {
213 anqp_add_elem(hapd, buf, infoid);
221 static void anqp_add_capab_list(struct hostapd_data *hapd,
227 if (anqp_add_override(hapd, buf, ANQP_CAPABILITY_LIST))
232 if (hapd->conf->venue_name || get_anqp_elem(hapd, ANQP_VENUE_NAME))
234 if (get_anqp_elem(hapd, ANQP_EMERGENCY_CALL_NUMBER))
236 if (hapd->conf->network_auth_type ||
237 get_anqp_elem(hapd, ANQP_NETWORK_AUTH_TYPE))
239 if (hapd->conf->roaming_consortium ||
240 get_anqp_elem(hapd, ANQP_ROAMING_CONSORTIUM))
242 if (hapd->conf->ipaddr_type_configured ||
243 get_anqp_elem(hapd, ANQP_IP_ADDR_TYPE_AVAILABILITY))
245 if (hapd->conf->nai_realm_data ||
246 get_anqp_elem(hapd, ANQP_NAI_REALM))
248 if (hapd->conf->anqp_3gpp_cell_net ||
249 get_anqp_elem(hapd, ANQP_3GPP_CELLULAR_NETWORK))
251 if (get_anqp_elem(hapd, ANQP_AP_GEOSPATIAL_LOCATION))
253 if (get_anqp_elem(hapd, ANQP_AP_CIVIC_LOCATION))
255 if (get_anqp_elem(hapd, ANQP_AP_LOCATION_PUBLIC_URI))
257 if (hapd->conf->domain_name || get_anqp_elem(hapd, ANQP_DOMAIN_NAME))
259 if (get_anqp_elem(hapd, ANQP_EMERGENCY_ALERT_URI))
261 if (get_anqp_elem(hapd, ANQP_TDLS_CAPABILITY))
263 if (get_anqp_elem(hapd, ANQP_EMERGENCY_NAI))
265 if (get_anqp_elem(hapd, ANQP_NEIGHBOR_REPORT))
268 if (!dl_list_empty(&hapd->conf->fils_realms) ||
269 get_anqp_elem(hapd, ANQP_FILS_REALM_INFO))
272 if (get_anqp_elem(hapd, ANQP_CAG))
274 if (get_anqp_elem(hapd, ANQP_VENUE_URL))
276 if (get_anqp_elem(hapd, ANQP_ADVICE_OF_CHARGE))
278 if (get_anqp_elem(hapd, ANQP_LOCAL_CONTENT))
281 if (get_anqp_elem(hapd, id))
285 anqp_add_hs_capab_list(hapd, buf);
291 static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf)
293 if (anqp_add_override(hapd, buf, ANQP_VENUE_NAME))
296 if (hapd->conf->venue_name) {
300 wpabuf_put_u8(buf, hapd->conf->venue_group);
301 wpabuf_put_u8(buf, hapd->conf->venue_type);
302 for (i = 0; i < hapd->conf->venue_name_count; i++) {
304 vn = &hapd->conf->venue_name[i];
314 static void anqp_add_network_auth_type(struct hostapd_data *hapd,
317 if (anqp_add_override(hapd, buf, ANQP_NETWORK_AUTH_TYPE))
320 if (hapd->conf->network_auth_type) {
322 wpabuf_put_le16(buf, hapd->conf->network_auth_type_len);
323 wpabuf_put_data(buf, hapd->conf->network_auth_type,
324 hapd->conf->network_auth_type_len);
329 static void anqp_add_roaming_consortium(struct hostapd_data *hapd,
335 if (anqp_add_override(hapd, buf, ANQP_ROAMING_CONSORTIUM))
339 for (i = 0; i < hapd->conf->roaming_consortium_count; i++) {
341 rc = &hapd->conf->roaming_consortium[i];
349 static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd,
352 if (anqp_add_override(hapd, buf, ANQP_IP_ADDR_TYPE_AVAILABILITY))
355 if (hapd->conf->ipaddr_type_configured) {
358 wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability);
401 static int hs20_add_nai_home_realm_matches(struct hostapd_data *hapd,
440 for (j = 0; j < hapd->conf->nai_realm_count &&
443 realm = &hapd->conf->nai_realm_data[j];
487 realm = &hapd->conf->nai_realm_data[matches[i].realm_data_idx];
495 static void anqp_add_nai_realm(struct hostapd_data *hapd, struct wpabuf *buf,
500 anqp_add_override(hapd, buf, ANQP_NAI_REALM))
503 if (nai_realm && hapd->conf->nai_realm_data) {
507 wpabuf_put_le16(buf, hapd->conf->nai_realm_count);
508 for (i = 0; i < hapd->conf->nai_realm_count; i++) {
512 realm = &hapd->conf->nai_realm_data[i];
526 } else if (nai_home_realm && hapd->conf->nai_realm_data && home_realm) {
527 hs20_add_nai_home_realm_matches(hapd, buf, home_realm,
533 static void anqp_add_3gpp_cellular_network(struct hostapd_data *hapd,
536 if (anqp_add_override(hapd, buf, ANQP_3GPP_CELLULAR_NETWORK))
539 if (hapd->conf->anqp_3gpp_cell_net) {
542 hapd->conf->anqp_3gpp_cell_net_len);
543 wpabuf_put_data(buf, hapd->conf->anqp_3gpp_cell_net,
544 hapd->conf->anqp_3gpp_cell_net_len);
549 static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf)
551 if (anqp_add_override(hapd, buf, ANQP_DOMAIN_NAME))
554 if (hapd->conf->domain_name) {
556 wpabuf_put_le16(buf, hapd->conf->domain_name_len);
557 wpabuf_put_data(buf, hapd->conf->domain_name,
558 hapd->conf->domain_name_len);
564 static void anqp_add_fils_realm_info(struct hostapd_data *hapd,
569 if (anqp_add_override(hapd, buf, ANQP_FILS_REALM_INFO))
572 count = dl_list_len(&hapd->conf->fils_realms);
581 dl_list_for_each(realm, &hapd->conf->fils_realms,
595 static void anqp_add_operator_friendly_name(struct hostapd_data *hapd,
598 if (hapd->conf->hs20_oper_friendly_name) {
606 for (i = 0; i < hapd->conf->hs20_oper_friendly_name_count; i++)
609 vn = &hapd->conf->hs20_oper_friendly_name[i];
619 static void anqp_add_wan_metrics(struct hostapd_data *hapd,
622 if (hapd->conf->hs20_wan_metrics) {
628 wpabuf_put_data(buf, hapd->conf->hs20_wan_metrics, 13);
634 static void anqp_add_connection_capability(struct hostapd_data *hapd,
637 if (hapd->conf->hs20_connection_capability) {
643 wpabuf_put_data(buf, hapd->conf->hs20_connection_capability,
644 hapd->conf->hs20_connection_capability_len);
650 static void anqp_add_operating_class(struct hostapd_data *hapd,
653 if (hapd->conf->hs20_operating_class) {
659 wpabuf_put_data(buf, hapd->conf->hs20_operating_class,
660 hapd->conf->hs20_operating_class_len);
743 static void anqp_add_osu_providers_list(struct hostapd_data *hapd,
746 if (hapd->conf->hs20_osu_providers_count) {
755 wpabuf_put_u8(buf, hapd->conf->osu_ssid_len);
756 wpabuf_put_data(buf, hapd->conf->osu_ssid,
757 hapd->conf->osu_ssid_len);
760 wpabuf_put_u8(buf, hapd->conf->hs20_osu_providers_count);
762 for (i = 0; i < hapd->conf->hs20_osu_providers_count; i++) {
764 buf, hapd->conf,
765 &hapd->conf->hs20_osu_providers[i]);
773 static void anqp_add_icon_binary_file(struct hostapd_data *hapd,
783 for (i = 0; i < hapd->conf->hs20_icons_count; i++) {
784 icon = &hapd->conf->hs20_icons[i];
790 if (i < hapd->conf->hs20_icons_count)
791 icon = &hapd->conf->hs20_icons[i];
831 static size_t anqp_get_required_len(struct hostapd_data *hapd,
839 struct anqp_element *elem = get_anqp_elem(hapd, infoid[i]);
850 gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
868 len += 2 * dl_list_len(&hapd->conf->fils_realms);
870 len += anqp_get_required_len(hapd, extra_req, num_extra_req);
877 anqp_add_capab_list(hapd, buf);
879 anqp_add_venue_name(hapd, buf);
881 anqp_add_elem(hapd, buf, ANQP_EMERGENCY_CALL_NUMBER);
883 anqp_add_network_auth_type(hapd, buf);
885 anqp_add_roaming_consortium(hapd, buf);
887 anqp_add_ip_addr_type_availability(hapd, buf);
889 anqp_add_nai_realm(hapd, buf, home_realm, home_realm_len,
893 anqp_add_3gpp_cellular_network(hapd, buf);
895 anqp_add_elem(hapd, buf, ANQP_AP_GEOSPATIAL_LOCATION);
897 anqp_add_elem(hapd, buf, ANQP_AP_CIVIC_LOCATION);
899 anqp_add_elem(hapd, buf, ANQP_AP_LOCATION_PUBLIC_URI);
901 anqp_add_domain_name(hapd, buf);
903 anqp_add_elem(hapd, buf, ANQP_EMERGENCY_ALERT_URI);
905 anqp_add_elem(hapd, buf, ANQP_TDLS_CAPABILITY);
907 anqp_add_elem(hapd, buf, ANQP_EMERGENCY_NAI);
912 anqp_add_fils_realm_info(hapd, buf);
916 anqp_add_elem(hapd, buf, extra_req[i]);
921 anqp_add_hs_capab_list(hapd, buf);
923 anqp_add_operator_friendly_name(hapd, buf);
925 anqp_add_wan_metrics(hapd, buf);
927 anqp_add_connection_capability(hapd, buf);
929 anqp_add_operating_class(hapd, buf);
931 anqp_add_osu_providers_list(hapd, buf);
933 anqp_add_icon_binary_file(hapd, buf, icon_name, icon_name_len);
966 static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
976 hapd->conf->venue_name != NULL, qi);
981 get_anqp_elem(hapd, info_id) != NULL, qi);
985 hapd->conf->network_auth_type != NULL, qi);
989 hapd->conf->roaming_consortium != NULL, qi);
994 hapd->conf->ipaddr_type_configured, qi);
998 hapd->conf->nai_realm_data != NULL, qi);
1003 hapd->conf->anqp_3gpp_cell_net != NULL, qi);
1008 get_anqp_elem(hapd, info_id) != NULL, qi);
1013 get_anqp_elem(hapd, info_id) != NULL, qi);
1018 get_anqp_elem(hapd, info_id) != NULL, qi);
1022 hapd->conf->domain_name != NULL, qi);
1027 get_anqp_elem(hapd, info_id) != NULL, qi);
1032 get_anqp_elem(hapd, info_id) != NULL, qi);
1037 get_anqp_elem(hapd, info_id) != NULL, qi);
1042 !dl_list_empty(&hapd->conf->fils_realms)) {
1047 if (!get_anqp_elem(hapd, info_id)) {
1066 static void rx_anqp_query_list(struct hostapd_data *hapd,
1074 rx_anqp_query_list_id(hapd, WPA_GET_LE16(pos), qi);
1082 static void rx_anqp_hs_query_list(struct hostapd_data *hapd, u8 subtype,
1093 hapd->conf->hs20_oper_friendly_name != NULL, qi);
1097 hapd->conf->hs20_wan_metrics != NULL, qi);
1102 hapd->conf->hs20_connection_capability != NULL,
1107 hapd->conf->hs20_operating_class != NULL, qi);
1111 hapd->conf->hs20_osu_providers_count, qi);
1121 static void rx_anqp_hs_nai_home_realm(struct hostapd_data *hapd,
1128 if (hapd->conf->nai_realm_data != NULL) {
1138 static void rx_anqp_hs_icon_request(struct hostapd_data *hapd,
1145 if (hapd->conf->hs20_icons_count) {
1155 static void rx_anqp_vendor_specific(struct hostapd_data *hapd,
1207 rx_anqp_hs_query_list(hapd, *pos, qi);
1212 rx_anqp_hs_nai_home_realm(hapd, pos, end, qi);
1215 rx_anqp_hs_icon_request(hapd, pos, end, qi);
1227 static void gas_serv_req_local_processing(struct hostapd_data *hapd,
1234 buf = gas_serv_build_gas_resp_payload(hapd, qi->request,
1252 if (wpabuf_len(buf) > hapd->conf->gas_frag_limit ||
1253 hapd->conf->gas_comeback_delay) {
1257 if (hapd->conf->gas_comeback_delay) {
1259 comeback_delay = hapd->conf->gas_comeback_delay;
1264 di = gas_dialog_create(hapd, sa, dialog_token);
1292 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1296 hostapd_drv_send_action_addr3_ap(hapd, hapd->iface->freq, 0, sa,
1303 static void gas_serv_rx_gas_initial_req(struct hostapd_data *hapd,
1322 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1327 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1335 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1344 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
1359 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1363 hostapd_drv_send_action_addr3_ap(hapd,
1364 hapd->iface->freq, 0,
1400 rx_anqp_query_list(hapd, pos, pos + elen, &qi);
1404 rx_anqp_vendor_specific(hapd, pos, pos + elen, &qi);
1416 gas_serv_req_local_processing(hapd, sa, dialog_token, &qi, prot,
1421 static void gas_serv_rx_gas_comeback_req(struct hostapd_data *hapd,
1436 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Dialog Token: %u",
1439 dialog = gas_serv_dialog_find(hapd, sa, dialog_token);
1441 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: No pending SD "
1456 if (frag_len > hapd->conf->gas_frag_limit) {
1457 frag_len = hapd->conf->gas_frag_limit;
1460 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: resp frag_len %u",
1465 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Failed to allocate "
1479 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Tx GAS Comeback Response "
1486 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: %d more bytes remain "
1491 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: All fragments of "
1494 gas_serv_free_dialogs(hapd, sa);
1501 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1505 hostapd_drv_send_action_addr3_ap(hapd, hapd->iface->freq, 0, sa,
1515 struct hostapd_data *hapd = ctx;
1533 if (hapd->conf->gas_address3 == 1)
1535 else if (hapd->conf->gas_address3 == 2)
1543 gas_serv_rx_gas_initial_req(hapd, sa, data + 1, len - 1, prot,
1547 gas_serv_rx_gas_comeback_req(hapd, sa, data + 1, len - 1, prot,
1554 int gas_serv_init(struct hostapd_data *hapd)
1556 hapd->public_action_cb2 = gas_serv_rx_public_action;
1557 hapd->public_action_cb2_ctx = hapd;
1562 void gas_serv_deinit(struct hostapd_data *hapd)