Home | History | Annotate | Download | only in ap

Lines Matching refs:query

2  * Generic advertisement service (GAS) query (hostapd)
25 /** GAS query timeout in seconds */
28 /* GAS query wait-time / duration in ms */
33 * struct gas_query_pending - Pending GAS query
59 * struct gas_query_ap - Internal GAS query data
73 struct gas_query_pending *query);
88 * gas_query_ap_init - Initialize GAS query component
90 * Returns: Pointer to GAS query data or %NULL on failure
130 static void gas_query_free(struct gas_query_pending *query, int del_list)
133 dl_list_del(&query->list);
135 wpabuf_free(query->req);
136 wpabuf_free(query->adv_proto);
137 wpabuf_free(query->resp);
138 os_free(query);
143 struct gas_query_pending *query,
148 MAC2STR(query->addr), query->dialog_token, query->freq,
149 query->status_code, gas_result_txt(result));
150 if (gas->current == query)
152 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query);
153 eloop_cancel_timeout(gas_query_timeout, gas, query);
154 eloop_cancel_timeout(gas_query_rx_comeback_timeout, gas, query);
155 dl_list_del(&query->list);
156 query->cb(query->ctx, query->addr, query->dialog_token, result,
157 query->adv_proto, query->resp, query->status_code);
158 gas_query_free(query, 0);
163 * gas_query_ap_deinit - Deinitialize GAS query component
164 * @gas: GAS query data from gas_query_init()
168 struct gas_query_pending *query, *next;
173 dl_list_for_each_safe(query, next, &gas->pending,
175 gas_query_done(gas, query, GAS_QUERY_AP_DELETED_AT_DEINIT);
194 static int gas_query_append(struct gas_query_pending *query, const u8 *data,
197 if (wpabuf_resize(&query->resp, len) < 0) {
201 wpabuf_put_data(query->resp, data, len);
209 struct gas_query_pending *query;
214 " ok=%d - no query in progress", MAC2STR(dst), ok);
218 query = gas->current;
220 dur = ms_from_time(&query->last_oper);
222 " ok=%d query=%p dialog_token=%u dur=%d ms",
223 MAC2STR(dst), ok, query, query->dialog_token, dur);
224 if (os_memcmp(dst, query->addr, ETH_ALEN) != 0) {
228 os_get_reltime(&query->last_oper);
230 eloop_cancel_timeout(gas_query_timeout, gas, query);
234 gas, query);
237 gas_query_timeout, gas, query);
239 if (query->wait_comeback && !query->retry) {
241 gas, query);
244 gas_query_rx_comeback_timeout, gas, query);
259 struct gas_query_pending *query,
262 int res, prot = pmf_in_use(gas->hapd, query->addr);
266 MAC2STR(query->addr), (unsigned int) wpabuf_len(req),
267 query->freq, prot, MAC2STR(query->sa));
272 os_get_reltime(&query->last_oper);
273 res = hostapd_drv_send_action(gas->hapd, query->freq, wait_time,
274 query->addr, wpabuf_head(req),
281 struct gas_query_pending *query)
286 req = gas_build_comeback_req(query->dialog_token);
288 gas_query_done(gas, query, GAS_QUERY_AP_INTERNAL_ERROR);
292 wait_time = (query->retry || !query->offchannel_tx_started) ?
295 if (gas_query_tx(gas, query, req, wait_time) < 0) {
297 MACSTR, MAC2STR(query->addr));
298 gas_query_done(gas, query, GAS_QUERY_AP_INTERNAL_ERROR);
308 struct gas_query_pending *query = user_ctx;
313 query->retry);
314 if (gas->current != query || query->retry)
316 dialog_token = gas_query_new_dialog_token(gas, query->addr);
320 "GAS: Retry GAS query due to comeback response timeout");
321 query->retry = 1;
322 query->dialog_token = dialog_token;
323 *(wpabuf_mhead_u8(query->req) + 2) = dialog_token;
324 query->wait_comeback = 0;
325 query->next_frag_id = 0;
326 wpabuf_free(query->adv_proto);
327 query->adv_proto = NULL;
328 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query);
329 eloop_cancel_timeout(gas_query_timeout, gas, query);
330 gas_query_tx_initial_req(gas, query);
337 struct gas_query_pending *query = user_ctx;
340 MAC2STR(query->addr));
341 gas_query_tx_comeback_req(gas, query);
346 struct gas_query_pending *query,
354 " in %u secs %u usecs", MAC2STR(query->addr), secs, usecs);
355 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query);
357 gas, query);
362 struct gas_query_pending *query,
368 MAC2STR(query->addr), query->dialog_token, comeback_delay);
370 query->adv_proto = wpabuf_alloc_copy(adv_proto, 2 + adv_proto[1]);
371 if (query->adv_proto == NULL) {
372 gas_query_done(gas, query, GAS_QUERY_AP_INTERNAL_ERROR);
377 eloop_cancel_timeout(gas_query_timeout, gas, query);
378 query->wait_comeback = 1;
379 gas_query_tx_comeback_req_delay(gas, query, comeback_delay);
383 /* Query was completed without comeback mechanism */
384 if (gas_query_append(query, resp, len) < 0) {
385 gas_query_done(gas, query, GAS_QUERY_AP_INTERNAL_ERROR);
389 gas_query_done(gas, query, GAS_QUERY_AP_SUCCESS);
394 struct gas_query_pending *query,
402 MAC2STR(query->addr), query->dialog_token, frag_id,
404 eloop_cancel_timeout(gas_query_rx_comeback_timeout, gas, query);
406 if ((size_t) 2 + adv_proto[1] != wpabuf_len(query->adv_proto) ||
407 os_memcmp(adv_proto, wpabuf_head(query->adv_proto),
408 wpabuf_len(query->adv_proto)) != 0) {
411 MACSTR, MAC2STR(query->addr));
412 gas_query_done(gas, query, GAS_QUERY_AP_PEER_ERROR);
420 "from " MACSTR, MAC2STR(query->addr));
421 gas_query_done(gas, query, GAS_QUERY_AP_PEER_ERROR);
424 gas_query_tx_comeback_req_delay(gas, query, comeback_delay);
428 if (frag_id != query->next_frag_id) {
430 "from " MACSTR, MAC2STR(query->addr));
431 if (frag_id + 1 == query->next_frag_id) {
436 gas_query_done(gas, query, GAS_QUERY_AP_PEER_ERROR);
439 query->next_frag_id++;
441 if (gas_query_append(query, resp, len) < 0) {
442 gas_query_done(gas, query, GAS_QUERY_AP_INTERNAL_ERROR);
447 gas_query_tx_comeback_req(gas, query);
451 gas_query_done(gas, query, GAS_QUERY_AP_SUCCESS);
458 * @gas: GAS query data from gas_query_init()
469 struct gas_query_pending *query;
498 query = gas_query_get_pending(gas, sa, dialog_token);
499 if (query == NULL) {
500 wpa_printf(MSG_DEBUG, "GAS: No pending query found for " MACSTR
506 ms_from_time(&query->last_oper), MAC2STR(sa));
508 if (query->wait_comeback && action == WLAN_PA_GAS_INITIAL_RESP) {
515 if (!query->wait_comeback && action == WLAN_PA_GAS_COMEBACK_RESP) {
522 query->status_code = WPA_GET_LE16(pos);
525 if (query->status_code == WLAN_STATUS_QUERY_RESP_OUTSTANDING &&
528 } else if (query->status_code != WLAN_STATUS_SUCCESS) {
529 wpa_printf(MSG_DEBUG, "GAS: Query to " MACSTR " dialog token "
531 MAC2STR(sa), dialog_token, query->status_code);
532 gas_query_done(gas, query, GAS_QUERY_AP_FAILURE);
568 /* Query Response Length */
578 wpa_printf(MSG_DEBUG, "GAS: Truncated Query Response in "
585 Query Response from " MACSTR,
590 gas_query_rx_comeback(gas, query, adv_proto, pos, resp_len,
593 gas_query_rx_initial(gas, query, adv_proto, pos, resp_len,
603 struct gas_query_pending *query = user_ctx;
605 wpa_printf(MSG_DEBUG, "GAS: No response received for query to " MACSTR
607 MAC2STR(query->addr), query->dialog_token);
608 gas_query_done(gas, query, GAS_QUERY_AP_TIMEOUT);
627 struct gas_query_pending *query)
629 if (gas_query_tx(gas, query, query->req,
632 MACSTR, MAC2STR(query->addr));
633 gas_query_done(gas, query, GAS_QUERY_AP_INTERNAL_ERROR);
636 gas->current = query;
638 wpa_printf(MSG_DEBUG, "GAS: Starting query timeout for dialog token %u",
639 query->dialog_token);
641 gas_query_timeout, gas, query);
664 * gas_query_ap_req - Request a GAS query
665 * @gas: GAS query data from gas_query_init()
666 * @dst: Destination MAC address for the query
667 * @freq: Frequency (in MHz) for the channel on which to send the query
668 * @req: GAS query payload (to be freed by gas_query module in case of success
670 * @cb: Callback function for reporting GAS query result and response
682 struct gas_query_pending *query;
692 query = os_zalloc(sizeof(*query));
693 if (query == NULL)
696 query->gas = gas;
697 os_memcpy(query->addr, dst, ETH_ALEN);
698 query->dialog_token = dialog_token;
699 query->freq = freq;
700 query->cb = cb;
701 query->ctx = ctx;
702 query->req = req;
703 dl_list_add(&gas->pending, &query->list);
709 MAC2STR(query->addr), query->dialog_token, query->freq);
711 gas_query_tx_initial_req(gas, query);