xref: /freebsd/contrib/wpa/src/common/gas_server.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
185732ac8SCy Schubert /*
285732ac8SCy Schubert  * Generic advertisement service (GAS) server
385732ac8SCy Schubert  * Copyright (c) 2017, Qualcomm Atheros, Inc.
4c1d255d3SCy Schubert  * Copyright (c) 2020, The Linux Foundation
5*a90b9d01SCy Schubert  * Copyright (c) 2022, Qualcomm Innovation Center, Inc.
685732ac8SCy Schubert  *
785732ac8SCy Schubert  * This software may be distributed under the terms of the BSD license.
885732ac8SCy Schubert  * See README for more details.
985732ac8SCy Schubert  */
1085732ac8SCy Schubert 
1185732ac8SCy Schubert #ifndef GAS_SERVER_H
1285732ac8SCy Schubert #define GAS_SERVER_H
1385732ac8SCy Schubert 
1485732ac8SCy Schubert #ifdef CONFIG_GAS_SERVER
1585732ac8SCy Schubert 
1685732ac8SCy Schubert struct gas_server;
1785732ac8SCy Schubert 
1885732ac8SCy Schubert struct gas_server * gas_server_init(void *ctx,
1985732ac8SCy Schubert 				    void (*tx)(void *ctx, int freq,
2085732ac8SCy Schubert 					       const u8 *da,
2185732ac8SCy Schubert 					       struct wpabuf *buf,
2285732ac8SCy Schubert 					       unsigned int wait_time));
2385732ac8SCy Schubert void gas_server_deinit(struct gas_server *gas);
2485732ac8SCy Schubert int gas_server_register(struct gas_server *gas,
2585732ac8SCy Schubert 			const u8 *adv_proto_id, u8 adv_proto_id_len,
2685732ac8SCy Schubert 			struct wpabuf *
27c1d255d3SCy Schubert 			(*req_cb)(void *ctx, void *resp_ctx, const u8 *sa,
28c1d255d3SCy Schubert 				  const u8 *query, size_t query_len,
29*a90b9d01SCy Schubert 				  int *comeback_delay),
3085732ac8SCy Schubert 			void (*status_cb)(void *ctx, struct wpabuf *resp,
3185732ac8SCy Schubert 					  int ok),
3285732ac8SCy Schubert 			void *ctx);
3385732ac8SCy Schubert int gas_server_rx(struct gas_server *gas, const u8 *da, const u8 *sa,
3485732ac8SCy Schubert 		  const u8 *bssid, u8 categ, const u8 *data, size_t len,
3585732ac8SCy Schubert 		  int freq);
3685732ac8SCy Schubert void gas_server_tx_status(struct gas_server *gas, const u8 *dst, const u8 *data,
3785732ac8SCy Schubert 			  size_t data_len, int ack);
38*a90b9d01SCy Schubert int gas_server_set_comeback_delay(struct gas_server *gas, void *resp_ctx,
39*a90b9d01SCy Schubert 				  u16 comeback_delay);
40c1d255d3SCy Schubert int gas_server_set_resp(struct gas_server *gas, void *resp_ctx,
41c1d255d3SCy Schubert 			struct wpabuf *resp);
42c1d255d3SCy Schubert bool gas_server_response_sent(struct gas_server *gas, void *resp_ctx);
4385732ac8SCy Schubert 
4485732ac8SCy Schubert #else /* CONFIG_GAS_SERVER */
4585732ac8SCy Schubert 
gas_server_deinit(struct gas_server * gas)4685732ac8SCy Schubert static inline void gas_server_deinit(struct gas_server *gas)
4785732ac8SCy Schubert {
4885732ac8SCy Schubert }
4985732ac8SCy Schubert 
5085732ac8SCy Schubert #endif /* CONFIG_GAS_SERVER */
5185732ac8SCy Schubert 
5285732ac8SCy Schubert #endif /* GAS_SERVER_H */
53