1 /*
2  * Generic advertisement service (GAS) server
3  * Copyright (c) 2017, Qualcomm Atheros, Inc.
4  * Copyright (c) 2020, The Linux Foundation
5  * Copyright (c) 2022, Qualcomm Innovation Center, Inc.
6  *
7  * This software may be distributed under the terms of the BSD license.
8  * See README for more details.
9  */
10 
11 #ifndef GAS_SERVER_H
12 #define GAS_SERVER_H
13 
14 #ifdef CONFIG_GAS_SERVER
15 
16 struct gas_server;
17 
18 struct gas_server * gas_server_init(void *ctx,
19 				    void (*tx)(void *ctx, int freq,
20 					       const u8 *da,
21 					       struct wpabuf *buf,
22 					       unsigned int wait_time));
23 void gas_server_deinit(struct gas_server *gas);
24 int gas_server_register(struct gas_server *gas,
25 			const u8 *adv_proto_id, u8 adv_proto_id_len,
26 			struct wpabuf *
27 			(*req_cb)(void *ctx, void *resp_ctx, const u8 *sa,
28 				  const u8 *query, size_t query_len,
29 				  int *comeback_delay),
30 			void (*status_cb)(void *ctx, struct wpabuf *resp,
31 					  int ok),
32 			void *ctx);
33 int gas_server_rx(struct gas_server *gas, const u8 *da, const u8 *sa,
34 		  const u8 *bssid, u8 categ, const u8 *data, size_t len,
35 		  int freq);
36 void gas_server_tx_status(struct gas_server *gas, const u8 *dst, const u8 *data,
37 			  size_t data_len, int ack);
38 int gas_server_set_comeback_delay(struct gas_server *gas, void *resp_ctx,
39 				  u16 comeback_delay);
40 int gas_server_set_resp(struct gas_server *gas, void *resp_ctx,
41 			struct wpabuf *resp);
42 bool gas_server_response_sent(struct gas_server *gas, void *resp_ctx);
43 
44 #else /* CONFIG_GAS_SERVER */
45 
gas_server_deinit(struct gas_server * gas)46 static inline void gas_server_deinit(struct gas_server *gas)
47 {
48 }
49 
50 #endif /* CONFIG_GAS_SERVER */
51 
52 #endif /* GAS_SERVER_H */
53