xref: /freebsd/contrib/wpa/src/ap/gas_serv.h (revision 57718be8fa0bd5edc11ab9a72e68cc71982939a6)
1 /*
2  * Generic advertisement service (GAS) server
3  * Copyright (c) 2011-2012, Qualcomm Atheros, Inc.
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef GAS_SERV_H
10 #define GAS_SERV_H
11 
12 #define ANQP_REQ_CAPABILITY_LIST \
13 	(1 << (ANQP_CAPABILITY_LIST - ANQP_QUERY_LIST))
14 #define ANQP_REQ_VENUE_NAME \
15 	(1 << (ANQP_VENUE_NAME - ANQP_QUERY_LIST))
16 #define ANQP_REQ_NETWORK_AUTH_TYPE \
17 	(1 << (ANQP_NETWORK_AUTH_TYPE - ANQP_QUERY_LIST))
18 #define ANQP_REQ_ROAMING_CONSORTIUM \
19 	(1 << (ANQP_ROAMING_CONSORTIUM - ANQP_QUERY_LIST))
20 #define ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY \
21 	(1 << (ANQP_IP_ADDR_TYPE_AVAILABILITY - ANQP_QUERY_LIST))
22 #define ANQP_REQ_NAI_REALM \
23 	(1 << (ANQP_NAI_REALM - ANQP_QUERY_LIST))
24 #define ANQP_REQ_3GPP_CELLULAR_NETWORK \
25 	(1 << (ANQP_3GPP_CELLULAR_NETWORK - ANQP_QUERY_LIST))
26 #define ANQP_REQ_DOMAIN_NAME \
27 	(1 << (ANQP_DOMAIN_NAME - ANQP_QUERY_LIST))
28 #define ANQP_REQ_HS_CAPABILITY_LIST \
29 	(0x10000 << HS20_STYPE_CAPABILITY_LIST)
30 #define ANQP_REQ_OPERATOR_FRIENDLY_NAME \
31 	(0x10000 << HS20_STYPE_OPERATOR_FRIENDLY_NAME)
32 #define ANQP_REQ_WAN_METRICS \
33 	(0x10000 << HS20_STYPE_WAN_METRICS)
34 #define ANQP_REQ_CONNECTION_CAPABILITY \
35 	(0x10000 << HS20_STYPE_CONNECTION_CAPABILITY)
36 #define ANQP_REQ_NAI_HOME_REALM \
37 	(0x10000 << HS20_STYPE_NAI_HOME_REALM_QUERY)
38 #define ANQP_REQ_OPERATING_CLASS \
39 	(0x10000 << HS20_STYPE_OPERATING_CLASS)
40 
41 /* To account for latencies between hostapd and external ANQP processor */
42 #define GAS_SERV_COMEBACK_DELAY_FUDGE 10
43 #define GAS_SERV_MIN_COMEBACK_DELAY 100 /* in TU */
44 
45 struct gas_dialog_info {
46 	u8 valid;
47 	u8 index;
48 	struct wpabuf *sd_resp; /* Fragmented response */
49 	u8 dialog_token;
50 	size_t sd_resp_pos; /* Offset in sd_resp */
51 	u8 sd_frag_id;
52 	u16 comeback_delay;
53 
54 	unsigned int requested;
55 	unsigned int received;
56 	unsigned int all_requested;
57 };
58 
59 struct hostapd_data;
60 
61 void gas_serv_tx_gas_response(struct hostapd_data *hapd, const u8 *dst,
62 			      struct gas_dialog_info *dialog);
63 struct gas_dialog_info *
64 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
65 		     u8 dialog_token);
66 void gas_serv_dialog_clear(struct gas_dialog_info *dialog);
67 
68 int gas_serv_init(struct hostapd_data *hapd);
69 void gas_serv_deinit(struct hostapd_data *hapd);
70 
71 #endif /* GAS_SERV_H */
72