64c3825466069e5bb1a0b010ad69bae70ecd7d70
[mech_eap.git] / wpa_supplicant / gas_query.h
1 /*
2  * Generic advertisement service (GAS) query
3  * Copyright (c) 2009, Atheros Communications
4  * Copyright (c) 2011, Qualcomm Atheros
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * Alternatively, this software may be distributed under the terms of BSD
11  * license.
12  *
13  * See README and COPYING for more details.
14  */
15
16 #ifndef GAS_QUERY_H
17 #define GAS_QUERY_H
18
19 struct gas_query;
20
21 #ifdef CONFIG_GAS
22
23 struct gas_query * gas_query_init(struct wpa_supplicant *wpa_s);
24 void gas_query_deinit(struct gas_query *gas);
25 int gas_query_rx(struct gas_query *gas, const u8 *da, const u8 *sa,
26                  const u8 *bssid, const u8 *data, size_t len, int freq);
27
28 enum gas_query_result {
29         GAS_QUERY_SUCCESS,
30         GAS_QUERY_FAILURE,
31         GAS_QUERY_TIMEOUT,
32         GAS_QUERY_PEER_ERROR,
33         GAS_QUERY_INTERNAL_ERROR,
34         GAS_QUERY_CANCELLED,
35         GAS_QUERY_DELETED_AT_DEINIT
36 };
37
38 int gas_query_req(struct gas_query *gas, const u8 *dst, int freq,
39                   struct wpabuf *req,
40                   void (*cb)(void *ctx, const u8 *dst, u8 dialog_token,
41                              enum gas_query_result result,
42                              const struct wpabuf *adv_proto,
43                              const struct wpabuf *resp, u16 status_code),
44                   void *ctx);
45 void gas_query_cancel(struct gas_query *gas, const u8 *dst, u8 dialog_token);
46
47 #else /* CONFIG_GAS */
48
49 static inline struct gas_query * gas_query_init(struct wpa_supplicant *wpa_s)
50 {
51         return (void *) 1;
52 }
53
54 static inline void gas_query_deinit(struct gas_query *gas)
55 {
56 }
57
58 #endif /* CONFIG_GAS */
59
60
61 #endif /* GAS_QUERY_H */