1/*
2 * Copyright 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.wifi.supplicant@1.4;
18
19import @1.0::ISupplicantStaIfaceCallback.AnqpData;
20import @1.0::ISupplicantStaIfaceCallback.Hs20AnqpData;
21import @1.3::ISupplicantStaIfaceCallback;
22import @1.0::ISupplicantStaIfaceCallback.State;
23import @1.0::ISupplicantStaIfaceCallback.StatusCode;
24import @1.0::Bssid;
25import @1.0::Ssid;
26
27/**
28 * Callback Interface exposed by the supplicant service
29 * for each station mode interface (ISupplicantStaIface).
30 *
31 * Clients need to host an instance of this HIDL interface object and
32 * pass a reference of the object to the supplicant via the
33 * corresponding |ISupplicantStaIface.registerCallback_1_4| method.
34 */
35interface ISupplicantStaIfaceCallback extends @1.3::ISupplicantStaIfaceCallback {
36    /**
37     *  MBO spec v1.2, 4.2.4 Table 14: MBO Association disallowed reason code attribute
38     *  values.
39     */
40    enum MboAssocDisallowedReasonCode : uint8_t {
41        RESERVED = 0,
42        UNSPECIFIED = 1,
43        MAX_NUM_STA_ASSOCIATED = 2,
44        AIR_INTERFACE_OVERLOADED = 3,
45        AUTH_SERVER_OVERLOADED = 4,
46        INSUFFICIENT_RSSI = 5,
47    };
48
49    /**
50     * ANQP data for IEEE Std 802.11-2016.
51     * The format of the data within these elements follows the IEEE
52     * Std 802.11-2016 standard, section 9.4.5.
53     */
54    struct AnqpData {
55        /**
56         * Baseline information as defined in HAL 1.0.
57         */
58        @1.0::ISupplicantStaIfaceCallback.AnqpData V1_0;
59
60        /*
61         * Container for v1.0 of this struct
62         */
63        vec<uint8_t> venueUrl;
64    };
65
66    /**
67     * OceRssiBasedAssocRejectAttr is extracted from (Re-)Association response
68     * frame from an OCE AP to indicate that the AP has rejected the
69     * (Re-)Association request on the basis of insufficient RSSI.
70     * Refer OCE spec v1.0 section 4.2.2 Table 7.
71     */
72    struct OceRssiBasedAssocRejectAttr {
73        /*
74         * Delta RSSI - The difference in dB between the minimum RSSI at which
75         * the AP would accept a (Re-)Association request from the STA before
76         * Retry Delay expires and the AP's measurement of the RSSI at which the
77         * (Re-)Association request was received.
78         */
79        uint32_t deltaRssi;
80
81        /*
82         * Retry Delay - The time period in seconds for which the AP will not
83         * accept any subsequent (Re-)Association requests from the STA, unless
84         * the received RSSI has improved by Delta RSSI.
85         */
86        uint32_t retryDelayS;
87    };
88
89    /**
90     * Association Rejection related information.
91     */
92    struct AssociationRejectionData {
93        /**
94         * SSID of the AP that rejected the association.
95         */
96        Ssid ssid;
97
98        /**
99         * BSSID of the AP that rejected the association.
100         */
101        Bssid bssid;
102
103        /*
104         * 802.11 code to indicate the reject reason.
105         * Refer to section 8.4.1.9 of IEEE 802.11 spec.
106         */
107        StatusCode statusCode;
108
109        /*
110         * Flag to indicate that failure is due to timeout rather than
111         * explicit rejection response from the AP.
112         */
113        bool timedOut;
114
115        /**
116         * Flag to indicate that MboAssocDisallowedReasonCode is present
117         * in the (Re-)Association response frame.
118         */
119        bool isMboAssocDisallowedReasonCodePresent;
120
121        /**
122         * mboAssocDisallowedReason is extracted from MBO association disallowed attribute
123         * in (Re-)Association response frame to indicate that the AP is not accepting new
124         * associations.
125         * Refer MBO spec v1.2 section 4.2.4 Table 13 for the details of reason code.
126         * The value is undefined if isMboAssocDisallowedReasonCodePresent is false.
127         */
128        MboAssocDisallowedReasonCode mboAssocDisallowedReason;
129
130        /**
131         * Flag to indicate that OceRssiBasedAssocRejectAttr is present
132         * in the (Re-)Association response frame.
133         */
134        bool isOceRssiBasedAssocRejectAttrPresent;
135
136        /*
137         * OCE RSSI-based (Re-)Association rejection attribute.
138         * The contents are undefined if isOceRssiBasedAssocRejectAttrPresent is false.
139         */
140        OceRssiBasedAssocRejectAttr oceRssiBasedAssocRejectData;
141    };
142
143    /**
144     * Used to indicate a Hotspot 2.0 terms and conditions acceptance is requested from the user
145     * before allowing the device to get internet access.
146     *
147     * @param bssid BSSID of the access point.
148     * @param url URL of the T&C server.
149     */
150    oneway onHs20TermsAndConditionsAcceptanceRequestedNotification(Bssid bssid, string url);
151
152    /**
153     * Used to indicate the result of ANQP (either for IEEE 802.11u Interworking
154     * or Hotspot 2.0) query.
155     *
156     * @param bssid BSSID of the access point.
157     * @param data ANQP data fetched from the access point.
158     *        All the fields in this struct must be empty if the query failed.
159     * @param hs20Data ANQP data fetched from the Hotspot 2.0 access point.
160     *        All the fields in this struct must be empty if the query failed.
161     */
162    oneway onAnqpQueryDone_1_4(Bssid bssid, AnqpData data, Hs20AnqpData hs20Data);
163
164    /**
165     * Used to indicate an association rejection received from the AP
166     * to which the connection is being attempted.
167     *
168     * @param assocRejectData Association Rejection related information.
169     */
170    oneway onAssociationRejected_1_4(AssociationRejectionData assocRejectData);
171
172    /**
173     * Used to indicate that the supplicant failed to find a network in scan result
174     * which matches with the network capabilities requested by upper layer
175     * for connection.
176     *
177     * @param ssid network name supplicant tried to connect.
178     */
179    oneway onNetworkNotFound(Ssid ssid);
180};
181