Home | History | Annotate | Download | only in wpa_supplicant

Lines Matching defs:gas

2  * Generic advertisement service (GAS) query
15 #include "common/gas.h"
22 /** GAS query timeout in seconds */
27 * struct gas_query_pending - Pending GAS query
48 * struct gas_query - Internal GAS query data
61 * gas_query_init - Initialize GAS query component
63 * Returns: Pointer to GAS query data or %NULL on failure
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);
98 * gas_query_deinit - Deinitialize GAS query component
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) {
133 wpa_printf(MSG_DEBUG, "GAS: No memory to store the response");
141 static int gas_query_tx(struct gas_query *gas, struct gas_query_pending *query,
145 wpa_printf(MSG_DEBUG, "GAS: Send action frame to " MACSTR " len=%u "
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) {
170 wpa_printf(MSG_DEBUG, "GAS: Failed to send Action frame to "
172 gas_query_done(gas, query, GAS_QUERY_INTERNAL_ERROR);
181 struct gas_query *gas = eloop_data;
184 wpa_printf(MSG_DEBUG, "GAS: Comeback timeout for request to " MACSTR,
186 gas_query_tx_comeback_req(gas, query);
190 static void gas_query_tx_comeback_req_delay(struct gas_query *gas,
198 wpa_printf(MSG_DEBUG, "GAS: Send comeback request to " MACSTR
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,
211 wpa_printf(MSG_DEBUG, "GAS: Received initial response from "
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,
243 wpa_printf(MSG_DEBUG, "GAS: Received comeback response from "
252 wpa_printf(MSG_DEBUG, "GAS: Advertisement Protocol changed "
255 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR);
261 wpa_printf(MSG_DEBUG, "GAS: Invalid comeback response "
264 gas_query_done(gas, query, GAS_QUERY_PEER_ERROR);
267 gas_query_tx_comeback_req_delay(gas, query, comeback_delay);
272 wpa_printf(MSG_DEBUG, "GAS: Unexpected frag_id in response "
275 wpa_printf(MSG_DEBUG, "GAS: Drop frame as possible "
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()
307 * Returns: 0 if the Public Action frame was a GAS frame or -1 if not
309 int gas_query_rx(struct gas_query *gas, const u8 *da, const u8 *sa,
317 if (gas == NULL || len < 4)
326 return -1; /* Not a GAS response */
328 query = gas_query_get_pending(gas, sa, dialog_token);
330 wpa_printf(MSG_DEBUG, "GAS: No pending query found for " MACSTR
336 wpa_printf(MSG_DEBUG, "GAS: Unexpected initial response from "
343 wpa_printf(MSG_DEBUG, "GAS: Unexpected comeback response from "
353 wpa_printf(MSG_DEBUG, "GAS: Query to " MACSTR " dialog token "
356 gas_query_done(gas, query, GAS_QUERY_FAILURE);
376 wpa_printf(MSG_DEBUG, "GAS: No room for Advertisement "
383 wpa_printf(MSG_DEBUG, "GAS: Unexpected Advertisement "
394 wpa_printf(MSG_DEBUG, "GAS: No room for GAS Response Length");
401 wpa_printf(MSG_DEBUG, "GAS: Truncated Query Response in "
407 wpa_printf(MSG_DEBUG, "GAS: Ignore %u octets of extra data "
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;
429 wpa_printf(MSG_DEBUG, "GAS: No response received for query to " MACSTR,
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) {
450 * gas_query_req - Request a GAS query
451 * @gas: GAS query data from gas_query_init()
454 * @req: GAS query payload
455 * @cb: Callback function for reporting GAS query result and response
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);
497 wpa_printf(MSG_DEBUG, "GAS: Starting request for " MACSTR
499 if (gas_query_tx(gas, query, req) < 0) {
500 wpa_printf(MSG_DEBUG, "GAS: Failed to send Action frame to "
508 gas, query);
515 * gas_query_cancel - Cancel a pending 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);