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