1/*
2 * Copyright 2019 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.hostapd@1.2;
18
19import @1.0::IHostapd.EncryptionType;
20import @1.0::IHostapd.NetworkParams;
21import @1.1::IHostapd;
22import HostapdStatus;
23import MacAddress;
24import Ieee80211ReasonCode;
25import DebugLevel;
26
27/**
28 * Top-level object for managing SoftAPs.
29 */
30interface IHostapd extends @1.1::IHostapd {
31    /** Possible Security types. */
32    enum EncryptionType : @1.0::IHostapd.EncryptionType {
33        WPA3_SAE_TRANSITION,
34        WPA3_SAE,
35    };
36
37    /**
38     * Band bitmMask to use for the SoftAp operations.
39     * A combinatoin of these bits are used to identify the allowed bands
40     * to start the softAp
41     */
42    enum BandMask : uint32_t {
43        /**
44         * 2.4 GHz band.
45         */
46        BAND_2_GHZ = 1 << 0,
47        /**
48         * 5 GHz band.
49         */
50        BAND_5_GHZ = 1 << 1,
51        /**
52         * 6 GHz band.
53         */
54        BAND_6_GHZ = 1 << 2,
55    };
56
57    /**
58     * Parameters to control the HW mode for the interface.
59     */
60    struct HwModeParams {
61        /**
62         * Whether IEEE 802.11ax (HE) is enabled or not.
63         * Note: hw_mode=a is used to specify that 5 GHz band or 6 GHz band is
64         * used with HE.
65         */
66        bool enable80211AX;
67
68        /**
69         * Whether 6GHz band enabled or not on softAp.
70         * Note: hw_mode=a is used to specify that 5 GHz band or 6 GHz band is
71         * used.
72         */
73        bool enable6GhzBand;
74
75        /**
76         * Whether HE single user beamformer in enabled or not on softAp.
77         * Note: this is only applicable if 802.11ax is supported for softAp
78         */
79        bool enableHeSingleUserBeamformer;
80
81        /**
82         * Whether HE single user beamformee is enabled or not on softAp.
83         * Note: this is only applicable if 802.11ax is supported for softAp
84         */
85        bool enableHeSingleUserBeamformee;
86
87        /**
88         * Whether HE multiple user beamformer is enabled or not on softAp.
89         * Note: this is only applicable if 802.11ax is supported for softAp
90         */
91        bool enableHeMultiUserBeamformer;
92
93        /**
94         * Whether HE Target Wait Time (TWT) is enabled or not on softAp.
95         * Note: this is only applicable if 802.11ax is supported for softAp
96         */
97        bool enableHeTargetWakeTime;
98    };
99
100    /**
101     * Parameters to specify the channel frequency range for ACS.
102     */
103    struct AcsFrequencyRange {
104        /**
105         * Channel Frequency (in MHz) at the start of the range.
106         */
107        uint32_t start;
108
109        /**
110         * Channel Frequency (in MHz) at the end of the range.
111         */
112        uint32_t end;
113    };
114
115    /**
116     * Parameters to control the channel selection for the interface.
117     */
118    struct ChannelParams {
119        /**
120         * Band to use for the SoftAp operations.
121         */
122        bitfield<BandMask> bandMask;
123
124        /**
125         * This option can be used to specify the channel frequencies (in MHz) selected by ACS.
126         * If this is an empty list, all channels allowed in selected HW mode
127         * are specified implicitly.
128         * Note: channels may be overridden by firmware.
129         * Note: this option is ignored if ACS is disabled.
130         */
131        vec<AcsFrequencyRange> acsChannelFreqRangesMhz;
132    };
133
134    /**
135     * Parameters to use for setting up the access point interface.
136     */
137    struct IfaceParams {
138        /**
139         * Baseline information as defined in HAL 1.1.
140         */
141        @1.1::IHostapd.IfaceParams V1_1;
142
143        /**
144         * Additional Hw mode params for the interface
145         */
146        HwModeParams hwModeParams;
147
148        /**
149         * Additional Channel params for the interface
150         */
151        ChannelParams channelParams;
152    };
153
154    /**
155     * Parameters to use for setting up the access point network.
156     */
157    struct NetworkParams {
158        /**
159         * Baseline information as defined in HAL 1.0.
160         */
161        @1.0::IHostapd.NetworkParams V1_0;
162        /** Key management mask for the replace V1_0.encryptionType. */
163        EncryptionType encryptionType;
164        /**
165         * Passphrase for WPA3_SAE network, WPA3_SAE_TRANSITION and
166         * WPA2_PSK. Replaces @1.0::IHostapd.NetworkParams.pskPassphrase.
167         */
168        string passphrase;
169    };
170
171
172    /**
173     * Adds a new access point for hostapd to control.
174     *
175     * This should trigger the setup of an access point with the specified
176     * interface and network params.
177     *
178     * @param ifaceParams AccessPoint Params for the access point.
179     * @param nwParams Network Params for the access point.
180     * @return status Status of the operation.
181     *         Possible status codes:
182     *         |HostapdStatusCode.SUCCESS|,
183     *         |HostapdStatusCode.FAILURE_ARGS_INVALID|,
184     *         |HostapdStatusCode.FAILURE_UNKNOWN|,
185     *         |HostapdStatusCode.FAILURE_IFACE_EXISTS|
186     */
187    addAccessPoint_1_2(IfaceParams ifaceParams, NetworkParams nwParams)
188        generates (HostapdStatus status);
189
190    /**
191     * force one of the hotspot clients disconnect..
192     *
193     * @param ifaceName Name of the interface.
194     * @param clientAddress Mac Address of the hotspot client.
195     * @param reasonCode One of disconnect reason code which defined by 802.11.
196     * @return status Status of the operation.
197     *         Possible status codes:
198     *         |HostapdStatusCode.SUCCESS|,
199     *         |HostapdStatusCode.FAILURE_IFACE_UNKNOWN|
200     *         |HostapdStatusCode.FAILURE_CLIENT_UNKNOWN|
201     */
202    forceClientDisconnect(string ifaceName, MacAddress clientAddress,
203        Ieee80211ReasonCode reasonCode) generates (HostapdStatus status);
204
205    /**
206     * Set debug parameters for the hostapd.
207     *
208     * @param level Debug logging level for the hostapd.
209     *        (one of |DebugLevel| values).
210     * @return status Status of the operation.
211     *         Possible status codes:
212     *         |HostapdStatusCode.SUCCESS|,
213     *         |HostapdStatusCode.FAILURE_UNKNOWN|
214     */
215    setDebugParams(DebugLevel level)
216        generates (HostapdStatus status);
217};
218