1e5b75505Sopenharmony_ci/*
2e5b75505Sopenharmony_ci * Generic advertisement service (GAS) server
3e5b75505Sopenharmony_ci * Copyright (c) 2011-2013, Qualcomm Atheros, Inc.
4e5b75505Sopenharmony_ci *
5e5b75505Sopenharmony_ci * This software may be distributed under the terms of the BSD license.
6e5b75505Sopenharmony_ci * See README for more details.
7e5b75505Sopenharmony_ci */
8e5b75505Sopenharmony_ci
9e5b75505Sopenharmony_ci#ifndef GAS_SERV_H
10e5b75505Sopenharmony_ci#define GAS_SERV_H
11e5b75505Sopenharmony_ci
12e5b75505Sopenharmony_ci/* First 16 ANQP InfoIDs can be included in the optimized bitmap */
13e5b75505Sopenharmony_ci#define ANQP_REQ_CAPABILITY_LIST \
14e5b75505Sopenharmony_ci	(1 << (ANQP_CAPABILITY_LIST - ANQP_QUERY_LIST))
15e5b75505Sopenharmony_ci#define ANQP_REQ_VENUE_NAME \
16e5b75505Sopenharmony_ci	(1 << (ANQP_VENUE_NAME - ANQP_QUERY_LIST))
17e5b75505Sopenharmony_ci#define ANQP_REQ_EMERGENCY_CALL_NUMBER \
18e5b75505Sopenharmony_ci	(1 << (ANQP_EMERGENCY_CALL_NUMBER - ANQP_QUERY_LIST))
19e5b75505Sopenharmony_ci#define ANQP_REQ_NETWORK_AUTH_TYPE \
20e5b75505Sopenharmony_ci	(1 << (ANQP_NETWORK_AUTH_TYPE - ANQP_QUERY_LIST))
21e5b75505Sopenharmony_ci#define ANQP_REQ_ROAMING_CONSORTIUM \
22e5b75505Sopenharmony_ci	(1 << (ANQP_ROAMING_CONSORTIUM - ANQP_QUERY_LIST))
23e5b75505Sopenharmony_ci#define ANQP_REQ_IP_ADDR_TYPE_AVAILABILITY \
24e5b75505Sopenharmony_ci	(1 << (ANQP_IP_ADDR_TYPE_AVAILABILITY - ANQP_QUERY_LIST))
25e5b75505Sopenharmony_ci#define ANQP_REQ_NAI_REALM \
26e5b75505Sopenharmony_ci	(1 << (ANQP_NAI_REALM - ANQP_QUERY_LIST))
27e5b75505Sopenharmony_ci#define ANQP_REQ_3GPP_CELLULAR_NETWORK \
28e5b75505Sopenharmony_ci	(1 << (ANQP_3GPP_CELLULAR_NETWORK - ANQP_QUERY_LIST))
29e5b75505Sopenharmony_ci#define ANQP_REQ_AP_GEOSPATIAL_LOCATION \
30e5b75505Sopenharmony_ci	(1 << (ANQP_AP_GEOSPATIAL_LOCATION - ANQP_QUERY_LIST))
31e5b75505Sopenharmony_ci#define ANQP_REQ_AP_CIVIC_LOCATION \
32e5b75505Sopenharmony_ci	(1 << (ANQP_AP_CIVIC_LOCATION - ANQP_QUERY_LIST))
33e5b75505Sopenharmony_ci#define ANQP_REQ_AP_LOCATION_PUBLIC_URI \
34e5b75505Sopenharmony_ci	(1 << (ANQP_AP_LOCATION_PUBLIC_URI - ANQP_QUERY_LIST))
35e5b75505Sopenharmony_ci#define ANQP_REQ_DOMAIN_NAME \
36e5b75505Sopenharmony_ci	(1 << (ANQP_DOMAIN_NAME - ANQP_QUERY_LIST))
37e5b75505Sopenharmony_ci#define ANQP_REQ_EMERGENCY_ALERT_URI \
38e5b75505Sopenharmony_ci	(1 << (ANQP_EMERGENCY_ALERT_URI - ANQP_QUERY_LIST))
39e5b75505Sopenharmony_ci#define ANQP_REQ_TDLS_CAPABILITY \
40e5b75505Sopenharmony_ci	(1 << (ANQP_TDLS_CAPABILITY - ANQP_QUERY_LIST))
41e5b75505Sopenharmony_ci#define ANQP_REQ_EMERGENCY_NAI \
42e5b75505Sopenharmony_ci	(1 << (ANQP_EMERGENCY_NAI - ANQP_QUERY_LIST))
43e5b75505Sopenharmony_ci/*
44e5b75505Sopenharmony_ci * First 15 Hotspot 2.0 vendor specific ANQP-elements can be included in the
45e5b75505Sopenharmony_ci * optimized bitmap.
46e5b75505Sopenharmony_ci */
47e5b75505Sopenharmony_ci#define ANQP_REQ_HS_CAPABILITY_LIST \
48e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_CAPABILITY_LIST)
49e5b75505Sopenharmony_ci#define ANQP_REQ_OPERATOR_FRIENDLY_NAME \
50e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_OPERATOR_FRIENDLY_NAME)
51e5b75505Sopenharmony_ci#define ANQP_REQ_WAN_METRICS \
52e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_WAN_METRICS)
53e5b75505Sopenharmony_ci#define ANQP_REQ_CONNECTION_CAPABILITY \
54e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_CONNECTION_CAPABILITY)
55e5b75505Sopenharmony_ci#define ANQP_REQ_NAI_HOME_REALM \
56e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_NAI_HOME_REALM_QUERY)
57e5b75505Sopenharmony_ci#define ANQP_REQ_OPERATING_CLASS \
58e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_OPERATING_CLASS)
59e5b75505Sopenharmony_ci#define ANQP_REQ_OSU_PROVIDERS_LIST \
60e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_OSU_PROVIDERS_LIST)
61e5b75505Sopenharmony_ci#define ANQP_REQ_ICON_REQUEST \
62e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_ICON_REQUEST)
63e5b75505Sopenharmony_ci#define ANQP_REQ_OPERATOR_ICON_METADATA \
64e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_OPERATOR_ICON_METADATA)
65e5b75505Sopenharmony_ci#define ANQP_REQ_OSU_PROVIDERS_NAI_LIST \
66e5b75505Sopenharmony_ci	(0x10000 << HS20_STYPE_OSU_PROVIDERS_NAI_LIST)
67e5b75505Sopenharmony_ci/* The first MBO ANQP-element can be included in the optimized bitmap. */
68e5b75505Sopenharmony_ci#define ANQP_REQ_MBO_CELL_DATA_CONN_PREF \
69e5b75505Sopenharmony_ci	(BIT(29) << MBO_ANQP_SUBTYPE_CELL_CONN_PREF)
70e5b75505Sopenharmony_ci
71e5b75505Sopenharmony_cistruct gas_dialog_info {
72e5b75505Sopenharmony_ci	u8 valid;
73e5b75505Sopenharmony_ci	struct wpabuf *sd_resp; /* Fragmented response */
74e5b75505Sopenharmony_ci	u8 dialog_token;
75e5b75505Sopenharmony_ci	size_t sd_resp_pos; /* Offset in sd_resp */
76e5b75505Sopenharmony_ci	u8 sd_frag_id;
77e5b75505Sopenharmony_ci	int prot; /* whether Protected Dual of Public Action frame is used */
78e5b75505Sopenharmony_ci	int dpp; /* whether this is a DPP Config Response */
79e5b75505Sopenharmony_ci};
80e5b75505Sopenharmony_ci
81e5b75505Sopenharmony_cistruct hostapd_data;
82e5b75505Sopenharmony_ci
83e5b75505Sopenharmony_cistruct gas_dialog_info *
84e5b75505Sopenharmony_cigas_serv_dialog_find(struct hostapd_data *hapd, const u8 *addr,
85e5b75505Sopenharmony_ci		     u8 dialog_token);
86e5b75505Sopenharmony_civoid gas_serv_dialog_clear(struct gas_dialog_info *dialog);
87e5b75505Sopenharmony_ci
88e5b75505Sopenharmony_ciint gas_serv_init(struct hostapd_data *hapd);
89e5b75505Sopenharmony_civoid gas_serv_deinit(struct hostapd_data *hapd);
90e5b75505Sopenharmony_ci
91e5b75505Sopenharmony_civoid gas_serv_req_dpp_processing(struct hostapd_data *hapd,
92e5b75505Sopenharmony_ci				 const u8 *sa, u8 dialog_token,
93e5b75505Sopenharmony_ci				 int prot, struct wpabuf *buf);
94e5b75505Sopenharmony_ci
95e5b75505Sopenharmony_ci#endif /* GAS_SERV_H */
96