Lines Matching refs:gas
34 struct gas_query *gas; member
85 struct gas_query *gas; in gas_query_init() local
87 gas = os_zalloc(sizeof(*gas)); in gas_query_init()
88 if (gas == NULL) in gas_query_init()
91 gas->wpa_s = wpa_s; in gas_query_init()
92 dl_list_init(&gas->pending); in gas_query_init()
94 return gas; in gas_query_init()
123 struct gas_query *gas = query->gas; in gas_query_free() local
128 if (gas->work && gas->work->ctx == query) { in gas_query_free()
129 radio_work_done(gas->work); in gas_query_free()
130 gas->work = NULL; in gas_query_free()
140 static void gas_query_done(struct gas_query *gas, in gas_query_done() argument
144 wpa_msg(gas->wpa_s, MSG_INFO, GAS_QUERY_DONE "addr=" MACSTR in gas_query_done()
148 if (gas->current == query) in gas_query_done()
149 gas->current = NULL; in gas_query_done()
151 offchannel_send_action_done(gas->wpa_s); in gas_query_done()
152 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query); in gas_query_done()
153 eloop_cancel_timeout(gas_query_timeout, gas, query); in gas_query_done()
165 void gas_query_deinit(struct gas_query *gas) in gas_query_deinit() argument
169 if (gas == NULL) in gas_query_deinit()
172 dl_list_for_each_safe(query, next, &gas->pending, in gas_query_deinit()
174 gas_query_done(gas, query, GAS_QUERY_DELETED_AT_DEINIT); in gas_query_deinit()
176 os_free(gas); in gas_query_deinit()
181 gas_query_get_pending(struct gas_query *gas, const u8 *addr, u8 dialog_token) in gas_query_get_pending() argument
184 dl_list_for_each(q, &gas->pending, struct gas_query_pending, list) { in gas_query_get_pending()
212 struct gas_query *gas = wpa_s->gas; in gas_query_tx_status() local
215 if (gas->current == NULL) { in gas_query_tx_status()
222 query = gas->current; in gas_query_tx_status()
235 eloop_cancel_timeout(gas_query_timeout, gas, query); in gas_query_tx_status()
237 gas_query_timeout, gas, query); in gas_query_tx_status()
240 eloop_cancel_timeout(gas_query_timeout, gas, query); in gas_query_tx_status()
241 eloop_register_timeout(0, 0, gas_query_timeout, gas, query); in gas_query_tx_status()
256 static int gas_query_tx(struct gas_query *gas, struct gas_query_pending *query, in gas_query_tx() argument
260 int res, prot = pmf_in_use(gas->wpa_s, query->addr); in gas_query_tx()
271 if (gas->wpa_s->max_remain_on_chan && in gas_query_tx()
272 wait_time > gas->wpa_s->max_remain_on_chan) in gas_query_tx()
273 wait_time = gas->wpa_s->max_remain_on_chan; in gas_query_tx()
274 res = offchannel_send_action(gas->wpa_s, query->freq, query->addr, in gas_query_tx()
275 gas->wpa_s->own_addr, query->addr, in gas_query_tx()
284 static void gas_query_tx_comeback_req(struct gas_query *gas, in gas_query_tx_comeback_req() argument
291 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR); in gas_query_tx_comeback_req()
295 if (gas_query_tx(gas, query, req) < 0) { in gas_query_tx_comeback_req()
298 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR); in gas_query_tx_comeback_req()
307 struct gas_query *gas = eloop_data; in gas_query_tx_comeback_timeout() local
312 gas_query_tx_comeback_req(gas, query); in gas_query_tx_comeback_timeout()
316 static void gas_query_tx_comeback_req_delay(struct gas_query *gas, in gas_query_tx_comeback_req_delay() argument
326 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query); in gas_query_tx_comeback_req_delay()
328 gas, query); in gas_query_tx_comeback_req_delay()
332 static void gas_query_rx_initial(struct gas_query *gas, in gas_query_rx_initial() argument
343 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR); in gas_query_rx_initial()
349 gas_query_tx_comeback_req_delay(gas, query, comeback_delay); in gas_query_rx_initial()
355 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR); in gas_query_rx_initial()
359 gas_query_done(gas, query, GAS_QUERY_SUCCESS); in gas_query_rx_initial()
363 static void gas_query_rx_comeback(struct gas_query *gas, in gas_query_rx_comeback() argument
381 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR); in gas_query_rx_comeback()
390 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR); in gas_query_rx_comeback()
393 gas_query_tx_comeback_req_delay(gas, query, comeback_delay); in gas_query_rx_comeback()
405 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR); in gas_query_rx_comeback()
411 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR); in gas_query_rx_comeback()
416 gas_query_tx_comeback_req(gas, query); in gas_query_rx_comeback()
420 gas_query_done(gas, query, GAS_QUERY_SUCCESS); in gas_query_rx_comeback()
436 int gas_query_rx(struct gas_query *gas, const u8 *da, const u8 *sa, in gas_query_rx() argument
447 if (gas == NULL || len < 4) in gas_query_rx()
451 pmf = pmf_in_use(gas->wpa_s, bssid); in gas_query_rx()
469 query = gas_query_get_pending(gas, sa, dialog_token); in gas_query_rx()
503 gas_query_done(gas, query, GAS_QUERY_FAILURE); in gas_query_rx()
561 gas_query_rx_comeback(gas, query, adv_proto, pos, resp_len, in gas_query_rx()
564 gas_query_rx_initial(gas, query, adv_proto, pos, resp_len, in gas_query_rx()
573 struct gas_query *gas = eloop_data; in gas_query_timeout() local
579 gas_query_done(gas, query, GAS_QUERY_TIMEOUT); in gas_query_timeout()
583 static int gas_query_dialog_token_available(struct gas_query *gas, in gas_query_dialog_token_available() argument
587 dl_list_for_each(q, &gas->pending, struct gas_query_pending, list) { in gas_query_dialog_token_available()
600 struct gas_query *gas = query->gas; in gas_query_start_cb() local
601 struct wpa_supplicant *wpa_s = gas->wpa_s; in gas_query_start_cb()
605 gas->work = NULL; in gas_query_start_cb()
606 gas_query_done(gas, query, GAS_QUERY_DELETED_AT_DEINIT); in gas_query_start_cb()
622 gas->work = work; in gas_query_start_cb()
624 if (gas_query_tx(gas, query, query->req) < 0) { in gas_query_start_cb()
630 gas->current = query; in gas_query_start_cb()
635 gas_query_timeout, gas, query); in gas_query_start_cb()
651 int gas_query_req(struct gas_query *gas, const u8 *dst, int freq, in gas_query_req() argument
668 gas, dst, (next_start + dialog_token) % 256)) in gas_query_req()
680 query->gas = gas; in gas_query_req()
687 dl_list_add(&gas->pending, &query->list); in gas_query_req()
691 wpa_msg(gas->wpa_s, MSG_INFO, GAS_QUERY_START "addr=" MACSTR in gas_query_req()
695 if (radio_add_work(gas->wpa_s, freq, "gas-query", 0, gas_query_start_cb, in gas_query_req()
711 void gas_query_cancel(struct gas_query *gas, const u8 *dst, u8 dialog_token) in gas_query_cancel() argument
715 query = gas_query_get_pending(gas, dst, dialog_token); in gas_query_cancel()
717 gas_query_done(gas, query, GAS_QUERY_CANCELLED); in gas_query_cancel()