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.3::ISupplicantStaNetwork;
20import ISupplicantStaNetworkCallback;
21
22/**
23 * Interface exposed by the supplicant for each station mode network
24 * configuration it controls.
25 */
26interface ISupplicantStaNetwork extends @1.3::ISupplicantStaNetwork {
27    /**
28     * Possible mask of values for KeyMgmt param.
29     */
30    enum KeyMgmtMask : @1.3::ISupplicantStaNetwork.KeyMgmtMask {
31        /**
32         * SAE PK mode
33         */
34        SAE_PK,
35    };
36
37    /**
38     * Possible mask of values for PairwiseCipher param.
39     */
40    enum PairwiseCipherMask : @1.3::ISupplicantStaNetwork.PairwiseCipherMask {
41        /**
42         * GCMP-128 Pairwise Cipher
43         */
44        GCMP_128 = 1 << 6,
45    };
46
47    /**
48     * Possible mask of values for GroupCipher param.
49     */
50    enum GroupCipherMask : @1.3::ISupplicantStaNetwork.GroupCipherMask {
51        /**
52         * GCMP-128 Group Cipher
53         */
54        GCMP_128 = 1 << 6,
55    };
56
57    /**
58     * SAE Hash-to-Element mode.
59     */
60    enum SaeH2eMode : uint8_t {
61        /**
62         * Hash-to-Element is disabled, only Hunting & Pecking is allowed.
63         */
64        DISABLED,
65        /**
66         * Both Hash-to-Element and Hunting & Pecking are allowed.
67         */
68        H2E_OPTIONAL,
69        /**
70         * Only Hash-to-Element is allowed.
71         */
72        H2E_MANDATORY,
73    };
74
75    /**
76     * Set group cipher mask for the network.
77     *
78     * @param groupCipherMask value to set.
79     *        Combination of |ProtoMask| values.
80     * @return status Status of the operation.
81     *         Possible status codes:
82     *         |SupplicantStatusCode.SUCCESS|,
83     *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
84     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|,
85     *         |SupplicantStatusCode.FAILURE_UNKNOWN|
86     */
87    setGroupCipher_1_4(bitfield<GroupCipherMask> groupCipherMask)
88        generates (SupplicantStatus status);
89
90    /**
91     * Get the group cipher mask set for the network.
92     *
93     * @return status Status of the operation.
94     *         Possible status codes:
95     *         |SupplicantStatusCode.SUCCESS|,
96     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|,
97     *         |SupplicantStatusCode.FAILURE_UNKNOWN|
98     * @return groupCipherMask Combination of |GroupCipherMask| values.
99     */
100    getGroupCipher_1_4()
101        generates (SupplicantStatus status, bitfield<GroupCipherMask> groupCipherMask);
102
103    /**
104     * Set pairwise cipher mask for the network.
105     *
106     * @param pairwiseCipherMask value to set.
107     *        Combination of |ProtoMask| values.
108     * @return status Status of the operation.
109     *         Possible status codes:
110     *         |SupplicantStatusCode.SUCCESS|,
111     *         |SupplicantStatusCode.FAILURE_ARGS_INVALID|,
112     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|,
113     *         |SupplicantStatusCode.FAILURE_UNKNOWN|
114     */
115    setPairwiseCipher_1_4(bitfield<PairwiseCipherMask> pairwiseCipherMask)
116        generates (SupplicantStatus status);
117
118    /**
119     * Get the pairwise cipher mask set for the network.
120     *
121     * @return status Status of the operation.
122     *         Possible status codes:
123     *         |SupplicantStatusCode.SUCCESS|,
124     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|,
125     *         |SupplicantStatusCode.FAILURE_UNKNOWN|
126     * @return pairwiseCipherMask Combination of |PairwiseCipherMask| values.
127     */
128    getPairwiseCipher_1_4()
129        generates (SupplicantStatus status, bitfield<PairwiseCipherMask> pairwiseCipherMask);
130
131    /**
132     * Set whether to enable enhanced directional multi-gigabit (802.11ay EDMG).
133     * Only allowed if hw mode is |HOSTAPD_MODE_IEEE80211AD|
134     *
135     * @param enable true to set, false otherwise.
136     * @return status Status of the operation.
137     *         Possible status codes:
138     *         |SupplicantStatusCode.SUCCESS|,
139     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
140     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
141     */
142    setEdmg(bool enable) generates (SupplicantStatus status);
143
144    /**
145     * Get whether enhanced directional multi-gigabit (802.11ay EDMG) is enabled for this network.
146     *
147     * @return status Status of the operation.
148     *         Possible status codes:
149     *         |SupplicantStatusCode.SUCCESS|,
150     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
151     * @return enabled true if set, false otherwise.
152     */
153    getEdmg() generates (SupplicantStatus status, bool enabled);
154
155    /**
156     * Register for callbacks from this network.
157     *
158     * These callbacks are invoked for events that are specific to this network.
159     * Registration of multiple callback objects is supported. These objects must
160     * be automatically deleted when the corresponding client process is dead or
161     * if this network is removed.
162     *
163     * @param callback An instance of the |ISupplicantStaNetworkCallback| HIDL
164     *        interface object.
165     * @return status Status of the operation.
166     *         Possible status codes:
167     *         |SupplicantStatusCode.SUCCESS|,
168     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
169     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
170     */
171    registerCallback_1_4(ISupplicantStaNetworkCallback callback)
172        generates (SupplicantStatus status);
173
174    /**
175     * Set SAE H2E (Hash-to-Element) mode.
176     *
177     * @param mode SAE H2E supporting mode.
178     * @return status Status of the operation.
179     *         Possible status codes:
180     *         |SupplicantStatusCode.SUCCESS|,
181     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
182     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|
183     */
184    setSaeH2eMode(SaeH2eMode mode) generates (SupplicantStatus status);
185
186    /**
187     * Set whether to enable SAE PK (Public Key) only mode to enable public AP validation.
188     * When enabled, only SAE PK network is allowed; otherwise PK is optional.
189     * If this API is not called before connecting to an SAE
190     * network, SAE PK mode depends on SAE PK config in wpa_supplicant configuration.
191     * If SAE PK config of wpa_supplicant configuration is not set,
192     * the default mode is optional (support for both PK and standard mode).
193     *
194     * @param enable true to set, false otherwise.
195     * @return status Status of the operation.
196     *         Possible status codes:
197     *         |SupplicantStatusCode.SUCCESS|,
198     *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
199     *         |SupplicantStatusCode.FAILURE_NETWORK_INVALID|,
200     *         |SupplicantStatusCode.FAILURE_UNSUPPORTED|
201     */
202    enableSaePkOnlyMode(bool enable) generates (SupplicantStatus status);
203};
204