Lines Matching defs:gas

15 #include "common/gas.h"
67 struct gas_query *gas;
69 gas = os_zalloc(sizeof(*gas));
70 if (gas == NULL)
73 gas->wpa_s = wpa_s;
74 dl_list_init(&gas->pending);
76 return gas;
80 static void gas_query_done(struct gas_query *gas,
85 offchannel_send_action_done(gas->wpa_s);
86 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query);
87 eloop_cancel_timeout(gas_query_timeout, gas, query);
99 * @gas: GAS query data from gas_query_init()
101 void gas_query_deinit(struct gas_query *gas)
105 if (gas == NULL)
108 dl_list_for_each_safe(query, next, &gas->pending,
110 gas_query_done(gas, query, GAS_QUERY_DELETED_AT_DEINIT);
112 os_free(gas);
117 gas_query_get_pending(struct gas_query *gas, const u8 *addr, u8 dialog_token)
120 dl_list_for_each(q, &gas->pending, struct gas_query_pending, list) {
141 static int gas_query_tx(struct gas_query *gas, struct gas_query_pending *query,
148 res = offchannel_send_action(gas->wpa_s, query->freq, query->addr,
149 gas->wpa_s->own_addr, query->addr,
158 static void gas_query_tx_comeback_req(struct gas_query *gas,
165 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR);
169 if (gas_query_tx(gas, query, req) < 0) {
172 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR);
181 struct gas_query *gas = eloop_data;
186 gas_query_tx_comeback_req(gas, query);
190 static void gas_query_tx_comeback_req_delay(struct gas_query *gas,
200 eloop_cancel_timeout(gas_query_tx_comeback_timeout, gas, query);
202 gas, query);
206 static void gas_query_rx_initial(struct gas_query *gas,
217 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR);
223 gas_query_tx_comeback_req_delay(gas, query, comeback_delay);
229 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR);
233 gas_query_done(gas, query, GAS_QUERY_SUCCESS);
237 static void gas_query_rx_comeback(struct gas_query *gas,
255 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR);
264 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR);
267 gas_query_tx_comeback_req_delay(gas, query, comeback_delay);
279 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR);
285 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR);
290 gas_query_tx_comeback_req(gas, query);
294 gas_query_done(gas, query, GAS_QUERY_SUCCESS);
300 * @gas: GAS query data from gas_query_init()
309 int gas_query_rx(struct gas_query *gas, const u8 *da, const u8 *sa,
317 if (gas == NULL || len < 4)
328 query = gas_query_get_pending(gas, sa, dialog_token);
356 gas_query_done(gas, query, GAS_QUERY_FAILURE);
414 gas_query_rx_comeback(gas, query, adv_proto, pos, resp_len,
417 gas_query_rx_initial(gas, query, adv_proto, pos, resp_len,
426 struct gas_query *gas = eloop_data;
431 gas_query_done(gas, query, GAS_QUERY_TIMEOUT);
435 static int gas_query_dialog_token_available(struct gas_query *gas,
439 dl_list_for_each(q, &gas->pending, struct gas_query_pending, list) {
451 * @gas: GAS query data from gas_query_init()
459 int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
476 gas, dst, (next_start + dialog_token) % 256))
493 dl_list_add(&gas->pending, &query->list);
499 if (gas_query_tx(gas, query, req) < 0) {
508 gas, query);
516 * @gas: GAS query data from gas_query_init()
520 void gas_query_cancel(struct gas_query *gas, const u8 *dst, u8 dialog_token)
524 query = gas_query_get_pending(gas, dst, dialog_token);
526 gas_query_done(gas, query, GAS_QUERY_CANCELLED);