Lines Matching defs:hapd
23 gas_dialog_create(struct hostapd_data *hapd, const u8 *addr, u8 dialog_token)
29 sta = ap_get_sta(hapd, addr);
37 sta = ap_sta_add(hapd, addr);
48 ap_sta_session_timeout(hapd, sta, 5);
71 wpa_msg(hapd->msg_ctx, MSG_ERROR, "ANQP: Could not create dialog for "
80 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
86 sta = ap_get_sta(hapd, addr);
111 static void gas_serv_free_dialogs(struct hostapd_data *hapd,
117 sta = ap_get_sta(hapd, sta_addr);
132 static void anqp_add_hs_capab_list(struct hostapd_data *hapd,
143 if (hapd->conf->hs20_oper_friendly_name)
145 if (hapd->conf->hs20_wan_metrics)
147 if (hapd->conf->hs20_connection_capability)
149 if (hapd->conf->nai_realm_data)
151 if (hapd->conf->hs20_operating_class)
158 static void anqp_add_capab_list(struct hostapd_data *hapd,
165 if (hapd->conf->venue_name)
167 if (hapd->conf->network_auth_type)
169 if (hapd->conf->roaming_consortium)
171 if (hapd->conf->ipaddr_type_configured)
173 if (hapd->conf->nai_realm_data)
175 if (hapd->conf->anqp_3gpp_cell_net)
177 if (hapd->conf->domain_name)
180 anqp_add_hs_capab_list(hapd, buf);
186 static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf)
188 if (hapd->conf->venue_name) {
192 wpabuf_put_u8(buf, hapd->conf->venue_group);
193 wpabuf_put_u8(buf, hapd->conf->venue_type);
194 for (i = 0; i < hapd->conf->venue_name_count; i++) {
196 vn = &hapd->conf->venue_name[i];
206 static void anqp_add_network_auth_type(struct hostapd_data *hapd,
209 if (hapd->conf->network_auth_type) {
211 wpabuf_put_le16(buf, hapd->conf->network_auth_type_len);
212 wpabuf_put_data(buf, hapd->conf->network_auth_type,
213 hapd->conf->network_auth_type_len);
218 static void anqp_add_roaming_consortium(struct hostapd_data *hapd,
225 for (i = 0; i < hapd->conf->roaming_consortium_count; i++) {
227 rc = &hapd->conf->roaming_consortium[i];
235 static void anqp_add_ip_addr_type_availability(struct hostapd_data *hapd,
238 if (hapd->conf->ipaddr_type_configured) {
241 wpabuf_put_u8(buf, hapd->conf->ipaddr_type_availability);
284 static int hs20_add_nai_home_realm_matches(struct hostapd_data *hapd,
323 for (j = 0; j < hapd->conf->nai_realm_count &&
326 realm = &hapd->conf->nai_realm_data[j];
370 realm = &hapd->conf->nai_realm_data[matches[i].realm_data_idx];
378 static void anqp_add_nai_realm(struct hostapd_data *hapd, struct wpabuf *buf,
382 if (nai_realm && hapd->conf->nai_realm_data) {
386 wpabuf_put_le16(buf, hapd->conf->nai_realm_count);
387 for (i = 0; i < hapd->conf->nai_realm_count; i++) {
391 realm = &hapd->conf->nai_realm_data[i];
405 } else if (nai_home_realm && hapd->conf->nai_realm_data) {
406 hs20_add_nai_home_realm_matches(hapd, buf, home_realm,
412 static void anqp_add_3gpp_cellular_network(struct hostapd_data *hapd,
415 if (hapd->conf->anqp_3gpp_cell_net) {
418 hapd->conf->anqp_3gpp_cell_net_len);
419 wpabuf_put_data(buf, hapd->conf->anqp_3gpp_cell_net,
420 hapd->conf->anqp_3gpp_cell_net_len);
425 static void anqp_add_domain_name(struct hostapd_data *hapd, struct wpabuf *buf)
427 if (hapd->conf->domain_name) {
429 wpabuf_put_le16(buf, hapd->conf->domain_name_len);
430 wpabuf_put_data(buf, hapd->conf->domain_name,
431 hapd->conf->domain_name_len);
438 static void anqp_add_operator_friendly_name(struct hostapd_data *hapd,
441 if (hapd->conf->hs20_oper_friendly_name) {
449 for (i = 0; i < hapd->conf->hs20_oper_friendly_name_count; i++)
452 vn = &hapd->conf->hs20_oper_friendly_name[i];
462 static void anqp_add_wan_metrics(struct hostapd_data *hapd,
465 if (hapd->conf->hs20_wan_metrics) {
471 wpabuf_put_data(buf, hapd->conf->hs20_wan_metrics, 13);
477 static void anqp_add_connection_capability(struct hostapd_data *hapd,
480 if (hapd->conf->hs20_connection_capability) {
486 wpabuf_put_data(buf, hapd->conf->hs20_connection_capability,
487 hapd->conf->hs20_connection_capability_len);
493 static void anqp_add_operating_class(struct hostapd_data *hapd,
496 if (hapd->conf->hs20_operating_class) {
502 wpabuf_put_data(buf, hapd->conf->hs20_operating_class,
503 hapd->conf->hs20_operating_class_len);
512 gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
524 anqp_add_capab_list(hapd, buf);
526 anqp_add_venue_name(hapd, buf);
528 anqp_add_network_auth_type(hapd, buf);
530 anqp_add_roaming_consortium(hapd, buf);
532 anqp_add_ip_addr_type_availability(hapd, buf);
534 anqp_add_nai_realm(hapd, buf, home_realm, home_realm_len,
538 anqp_add_3gpp_cellular_network(hapd, buf);
540 anqp_add_domain_name(hapd, buf);
544 anqp_add_hs_capab_list(hapd, buf);
546 anqp_add_operator_friendly_name(hapd, buf);
548 anqp_add_wan_metrics(hapd, buf);
550 anqp_add_connection_capability(hapd, buf);
552 anqp_add_operating_class(hapd, buf);
597 static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
607 hapd->conf->venue_name != NULL, 0, 0, qi);
611 hapd->conf->network_auth_type != NULL,
616 hapd->conf->roaming_consortium != NULL, 0, 0, qi);
621 hapd->conf->ipaddr_type_configured,
626 hapd->conf->nai_realm_data != NULL,
632 hapd->conf->anqp_3gpp_cell_net != NULL,
637 hapd->conf->domain_name != NULL,
648 static void rx_anqp_query_list(struct hostapd_data *hapd,
656 rx_anqp_query_list_id(hapd, WPA_GET_LE16(pos), qi);
664 static void rx_anqp_hs_query_list(struct hostapd_data *hapd, u8 subtype,
675 hapd->conf->hs20_oper_friendly_name != NULL,
680 hapd->conf->hs20_wan_metrics != NULL,
686 hapd->conf->hs20_connection_capability != NULL,
691 hapd->conf->hs20_operating_class != NULL,
702 static void rx_anqp_hs_nai_home_realm(struct hostapd_data *hapd,
709 if (hapd->conf->nai_realm_data != NULL) {
719 static void rx_anqp_vendor_specific(struct hostapd_data *hapd,
756 rx_anqp_hs_query_list(hapd, *pos, qi);
761 rx_anqp_hs_nai_home_realm(hapd, pos, end, qi);
773 static void gas_serv_req_local_processing(struct hostapd_data *hapd,
779 buf = gas_serv_build_gas_resp_payload(hapd, qi->request, NULL,
787 if (wpabuf_len(buf) > hapd->gas_frag_limit ||
788 hapd->conf->gas_comeback_delay) {
792 if (hapd->conf->gas_comeback_delay) {
794 comeback_delay = hapd->conf->gas_comeback_delay;
799 di = gas_dialog_create(hapd, sa, dialog_token);
821 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
827 static void gas_serv_rx_gas_initial_req(struct hostapd_data *hapd,
845 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
850 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
859 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
867 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
879 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
914 rx_anqp_query_list(hapd, pos, pos + elen, &qi);
918 rx_anqp_vendor_specific(hapd, pos, pos + elen, &qi);
930 gas_serv_req_local_processing(hapd, sa, dialog_token, &qi);
934 void gas_serv_tx_gas_response(struct hostapd_data *hapd, const u8 *dst,
942 buf = gas_serv_build_gas_resp_payload(hapd,
953 if (frag_len > hapd->gas_frag_limit || dialog->comeback_delay ||
954 hapd->conf->gas_comeback_delay) {
959 if (hapd->conf->gas_comeback_delay) {
961 comeback_delay_tus = hapd->conf->gas_comeback_delay;
967 (unsigned int) hapd->gas_frag_limit,
974 wpa_msg(hapd->msg_ctx, MSG_DEBUG,
976 hostapd_drv_send_action(hapd, hapd->iface->freq, 0,
999 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Buffer allocation "
1008 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Tx GAS Initial "
1013 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, dst,
1021 static void gas_serv_rx_gas_comeback_req(struct hostapd_data *hapd,
1035 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Dialog Token: %u",
1038 dialog = gas_serv_dialog_find(hapd, sa, dialog_token);
1040 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: No pending SD "
1071 buf = gas_serv_build_gas_resp_payload(hapd,
1082 if (frag_len > hapd->gas_frag_limit) {
1083 frag_len = hapd->gas_frag_limit;
1086 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: resp frag_len %u",
1091 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Failed to allocate "
1102 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: Tx GAS Comeback Response "
1109 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: %d more bytes remain "
1114 wpa_msg(hapd->msg_ctx, MSG_DEBUG, "GAS: All fragments of "
1117 gas_serv_free_dialogs(hapd, sa);
1121 hostapd_drv_send_action(hapd, hapd->iface->freq, 0, sa,
1134 struct hostapd_data *hapd = ctx;
1150 gas_serv_rx_gas_initial_req(hapd, sa, data + 1, len - 1);
1153 gas_serv_rx_gas_comeback_req(hapd, sa, data + 1, len - 1);
1159 int gas_serv_init(struct hostapd_data *hapd)
1161 hapd->public_action_cb2 = gas_serv_rx_public_action;
1162 hapd->public_action_cb2_ctx = hapd;
1163 hapd->gas_frag_limit = 1400;
1164 if (hapd->conf->gas_frag_limit > 0)
1165 hapd->gas_frag_limit = hapd->conf->gas_frag_limit;
1170 void gas_serv_deinit(struct hostapd_data *hapd)