1 /*
2  * Generic advertisement service (GAS) server
3  * Copyright (c) 2011-2013, 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 #define ANQP_REQ_OSU_PROVIDERS_LIST \
41 	(0x10000 << HS20_STYPE_OSU_PROVIDERS_LIST)
42 #define ANQP_REQ_ICON_REQUEST \
43 	(0x10000 << HS20_STYPE_ICON_REQUEST)
44 
45 struct gas_dialog_info {
46 	u8 valid;
47 	struct wpabuf *sd_resp; /* Fragmented response */
48 	u8 dialog_token;
49 	size_t sd_resp_pos; /* Offset in sd_resp */
50 	u8 sd_frag_id;
51 	int prot; /* whether Protected Dual of Public Action frame is used */
52 };
53 
54 struct hostapd_data;
55 
56 struct gas_dialog_info *
57 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
58 		     u8 dialog_token);
59 void gas_serv_dialog_clear(struct gas_dialog_info *dialog);
60 
61 int gas_serv_init(struct hostapd_data *hapd);
62 void gas_serv_deinit(struct hostapd_data *hapd);
63 
64 #endif /* GAS_SERV_H */
65