xref: /freebsd/contrib/wpa/src/ap/gas_serv.h (revision a90b9d0159070121c221b966469c3e36d912bf82)
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 /* First 16 ANQP InfoIDs can be included in the optimized bitmap */
13 #define ANQP_REQ_CAPABILITY_LIST \
14 	(1 << (ANQP_CAPABILITY_LIST - ANQP_QUERY_LIST))
15 #define ANQP_REQ_VENUE_NAME \
16 	(1 << (ANQP_VENUE_NAME - ANQP_QUERY_LIST))
17 #define ANQP_REQ_EMERGENCY_CALL_NUMBER \
18 	(1 << (ANQP_EMERGENCY_CALL_NUMBER - ANQP_QUERY_LIST))
19 #define ANQP_REQ_NETWORK_AUTH_TYPE \
20 	(1 << (ANQP_NETWORK_AUTH_TYPE - ANQP_QUERY_LIST))
21 #define ANQP_REQ_ROAMING_CONSORTIUM \
22 	(1 << (ANQP_ROAMING_CONSORTIUM - ANQP_QUERY_LIST))
23 #define ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY \
24 	(1 << (ANQP_IP_ADDR_TYPE_AVAILABILITY - ANQP_QUERY_LIST))
25 #define ANQP_REQ_NAI_REALM \
26 	(1 << (ANQP_NAI_REALM - ANQP_QUERY_LIST))
27 #define ANQP_REQ_3GPP_CELLULAR_NETWORK \
28 	(1 << (ANQP_3GPP_CELLULAR_NETWORK - ANQP_QUERY_LIST))
29 #define ANQP_REQ_AP_GEOSPATIAL_LOCATION \
30 	(1 << (ANQP_AP_GEOSPATIAL_LOCATION - ANQP_QUERY_LIST))
31 #define ANQP_REQ_AP_CIVIC_LOCATION \
32 	(1 << (ANQP_AP_CIVIC_LOCATION - ANQP_QUERY_LIST))
33 #define ANQP_REQ_AP_LOCATION_PUBLIC_URI \
34 	(1 << (ANQP_AP_LOCATION_PUBLIC_URI - ANQP_QUERY_LIST))
35 #define ANQP_REQ_DOMAIN_NAME \
36 	(1 << (ANQP_DOMAIN_NAME - ANQP_QUERY_LIST))
37 #define ANQP_REQ_EMERGENCY_ALERT_URI \
38 	(1 << (ANQP_EMERGENCY_ALERT_URI - ANQP_QUERY_LIST))
39 #define ANQP_REQ_TDLS_CAPABILITY \
40 	(1 << (ANQP_TDLS_CAPABILITY - ANQP_QUERY_LIST))
41 #define ANQP_REQ_EMERGENCY_NAI \
42 	(1 << (ANQP_EMERGENCY_NAI - ANQP_QUERY_LIST))
43 /*
44  * First 15 Hotspot 2.0 vendor specific ANQP-elements can be included in the
45  * optimized bitmap.
46  */
47 #define ANQP_REQ_HS_CAPABILITY_LIST \
48 	(0x10000 << HS20_STYPE_CAPABILITY_LIST)
49 #define ANQP_REQ_OPERATOR_FRIENDLY_NAME \
50 	(0x10000 << HS20_STYPE_OPERATOR_FRIENDLY_NAME)
51 #define ANQP_REQ_WAN_METRICS \
52 	(0x10000 << HS20_STYPE_WAN_METRICS)
53 #define ANQP_REQ_CONNECTION_CAPABILITY \
54 	(0x10000 << HS20_STYPE_CONNECTION_CAPABILITY)
55 #define ANQP_REQ_NAI_HOME_REALM \
56 	(0x10000 << HS20_STYPE_NAI_HOME_REALM_QUERY)
57 #define ANQP_REQ_OPERATING_CLASS \
58 	(0x10000 << HS20_STYPE_OPERATING_CLASS)
59 #define ANQP_REQ_OSU_PROVIDERS_LIST \
60 	(0x10000 << HS20_STYPE_OSU_PROVIDERS_LIST)
61 #define ANQP_REQ_ICON_REQUEST \
62 	(0x10000 << HS20_STYPE_ICON_REQUEST)
63 #define ANQP_REQ_OPERATOR_ICON_METADATA \
64 	(0x10000 << HS20_STYPE_OPERATOR_ICON_METADATA)
65 #define ANQP_REQ_OSU_PROVIDERS_NAI_LIST \
66 	(0x10000 << HS20_STYPE_OSU_PROVIDERS_NAI_LIST)
67 /* The first MBO ANQP-element can be included in the optimized bitmap. */
68 #define ANQP_REQ_MBO_CELL_DATA_CONN_PREF \
69 	(BIT(29) << MBO_ANQP_SUBTYPE_CELL_CONN_PREF)
70 
71 struct gas_dialog_info {
72 	u8 valid;
73 	struct wpabuf *sd_resp; /* Fragmented response */
74 	u8 dialog_token;
75 	size_t sd_resp_pos; /* Offset in sd_resp */
76 	u8 sd_frag_id;
77 	int prot; /* whether Protected Dual of Public Action frame is used */
78 	int dpp; /* whether this is a DPP Config Response */
79 };
80 
81 struct hostapd_data;
82 
83 struct gas_dialog_info *
84 gas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
85 		     u8 dialog_token);
86 void gas_serv_dialog_clear(struct gas_dialog_info *dialog);
87 
88 int gas_serv_init(struct hostapd_data *hapd);
89 void gas_serv_deinit(struct hostapd_data *hapd);
90 
91 void gas_serv_req_dpp_processing(struct hostapd_data *hapd,
92 				 const u8 *sa, u8 dialog_token,
93 				 int prot, struct wpabuf *buf, int freq);
94 
95 #endif /* GAS_SERV_H */
96