objc2_core_wlan/generated/CoreWLANUtil.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8#[cfg(feature = "objc2-security")]
9use objc2_security::*;
10
11use crate::*;
12
13extern "C-unwind" {
14 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
15 ///
16 ///
17 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
18 ///
19 ///
20 /// Parameter `password`: An NSString passed by reference, which upon return will contain the Wi-Fi keychain password for the specified SSID.
21 /// This parameter is optional.
22 ///
23 ///
24 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
25 /// <i>
26 /// errSecSuccess
27 /// </i>
28 /// indicates no error occurred.
29 ///
30 ///
31 /// Finds and returns (by reference) the password for the specified SSID and keychain domain.
32 #[cfg(feature = "CoreWLANTypes")]
33 pub fn CWKeychainFindWiFiPassword(
34 domain: CWKeychainDomain,
35 ssid: &NSData,
36 password: *mut *mut NSString,
37 ) -> OSStatus;
38}
39
40extern "C-unwind" {
41 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
42 ///
43 ///
44 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
45 ///
46 ///
47 /// Parameter `password`: The Wi-Fi network password.
48 ///
49 ///
50 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
51 /// <i>
52 /// errSecSuccess
53 /// </i>
54 /// indicates no error occurred.
55 ///
56 ///
57 /// Sets the Wi-Fi network keychain password for the specified SSID and keychain domain.
58 #[cfg(feature = "CoreWLANTypes")]
59 pub fn CWKeychainSetWiFiPassword(
60 domain: CWKeychainDomain,
61 ssid: &NSData,
62 password: &NSString,
63 ) -> OSStatus;
64}
65
66extern "C-unwind" {
67 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
68 ///
69 ///
70 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
71 ///
72 ///
73 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
74 /// <i>
75 /// errSecSuccess
76 /// </i>
77 /// indicates no error occurred.
78 ///
79 ///
80 /// Deletes the password for the specified SSID and keychain domain.
81 #[cfg(feature = "CoreWLANTypes")]
82 pub fn CWKeychainDeleteWiFiPassword(domain: CWKeychainDomain, ssid: &NSData) -> OSStatus;
83}
84
85extern "C-unwind" {
86 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
87 ///
88 ///
89 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
90 ///
91 ///
92 /// Parameter `username`: An NSString passed by reference, which upon return will contain the 802.1X username for the specified SSID.
93 /// This parameter is optional.
94 ///
95 ///
96 /// Parameter `password`: An NSString passed by reference, which upon return will contain the 802.1X password for the specified SSID.
97 /// This parameter is optional.
98 ///
99 ///
100 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
101 /// <i>
102 /// errSecSuccess
103 /// </i>
104 /// indicates no error occurred.
105 ///
106 ///
107 /// Finds and returns the 802.1X username and password stored for the specified SSID and keychain domain.
108 #[cfg(feature = "CoreWLANTypes")]
109 pub fn CWKeychainFindWiFiEAPUsernameAndPassword(
110 domain: CWKeychainDomain,
111 ssid: &NSData,
112 username: *mut *mut NSString,
113 password: *mut *mut NSString,
114 ) -> OSStatus;
115}
116
117extern "C-unwind" {
118 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
119 ///
120 ///
121 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
122 ///
123 ///
124 /// Parameter `username`: The 802.1X username.
125 ///
126 ///
127 /// Parameter `password`: The 802.1X password. This parameter is optional.
128 ///
129 ///
130 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
131 /// <i>
132 /// errSecSuccess
133 /// </i>
134 /// indicates no error occurred.
135 ///
136 ///
137 /// Sets the 802.1X username and password for the specified SSID and keychain domain.
138 #[cfg(feature = "CoreWLANTypes")]
139 pub fn CWKeychainSetWiFiEAPUsernameAndPassword(
140 domain: CWKeychainDomain,
141 ssid: &NSData,
142 username: Option<&NSString>,
143 password: Option<&NSString>,
144 ) -> OSStatus;
145}
146
147extern "C-unwind" {
148 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
149 ///
150 ///
151 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
152 ///
153 ///
154 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
155 /// <i>
156 /// errSecSuccess
157 /// </i>
158 /// indicates no error occurred.
159 ///
160 ///
161 /// Deletes the 802.1X username and password for the specified SSID and keychain domain.
162 #[cfg(feature = "CoreWLANTypes")]
163 pub fn CWKeychainDeleteWiFiEAPUsernameAndPassword(
164 domain: CWKeychainDomain,
165 ssid: &NSData,
166 ) -> OSStatus;
167}
168
169extern "C-unwind" {
170 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
171 ///
172 ///
173 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
174 ///
175 ///
176 /// Parameter `identity`: A SecIdentityRef passed by reference, which upon return will contain the SecIdentityRef associated with the specified SSID.
177 /// This parameter is optional. The returned value must be released by the caller.
178 ///
179 ///
180 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
181 /// <i>
182 /// errSecSuccess
183 /// </i>
184 /// indicates no error occurred.
185 ///
186 ///
187 /// Finds and returns the identity stored for the specified SSID and keychain domain.
188 #[cfg(all(feature = "CoreWLANTypes", feature = "objc2-security"))]
189 pub fn CWKeychainCopyWiFiEAPIdentity(
190 domain: CWKeychainDomain,
191 ssid: &NSData,
192 identity: *mut *mut SecIdentity,
193 ) -> OSStatus;
194}
195
196extern "C-unwind" {
197 /// Parameter `domain`: The keychain domain, which determines which keychain will be used.
198 ///
199 ///
200 /// Parameter `ssid`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
201 ///
202 ///
203 /// Parameter `identity`: The identity containing the certificate to use for 802.1X authentication.
204 /// Passing nil clears any identity association for the specified SSID.
205 ///
206 ///
207 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
208 /// <i>
209 /// errSecSuccess
210 /// </i>
211 /// indicates no error occurred.
212 ///
213 ///
214 /// Associates an identity to the specified SSID and keychain domain.
215 #[cfg(all(feature = "CoreWLANTypes", feature = "objc2-security"))]
216 pub fn CWKeychainSetWiFiEAPIdentity(
217 domain: CWKeychainDomain,
218 ssid: &NSData,
219 identity: Option<&SecIdentity>,
220 ) -> OSStatus;
221}
222
223extern "C-unwind" {
224 /// Parameter `identityList`: A CFArrayRef passed by reference, which upon return will be populated with a list of SecIdentityRef objects.
225 /// This parameter is optional. The returned value must be released by the caller.
226 ///
227 ///
228 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
229 /// <i>
230 /// errSecSuccess
231 /// </i>
232 /// indicates no error occurred.
233 ///
234 ///
235 /// Finds and returns all available identities.
236 #[cfg(feature = "objc2-core-foundation")]
237 pub fn CWKeychainCopyEAPIdentityList(list: *mut *const CFArray) -> OSStatus;
238}
239
240extern "C-unwind" {
241 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
242 ///
243 ///
244 /// Parameter `username`: A CFStringRef passed by reference, which upon return will contain the 802.1X username for the specified SSID.
245 /// This parameter is optional. The returned value must be released by the caller.
246 ///
247 ///
248 /// Parameter `password`: A CFStringRef passed by reference, which upon return will contain the 802.1X password for the specified SSID.
249 /// This parameter is optional. The returned value must be released by the caller.
250 ///
251 ///
252 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
253 /// <i>
254 /// errSecSuccess
255 /// </i>
256 /// indicates no error occurred.
257 ///
258 ///
259 /// Finds and returns the 802.1X username and password stored for the specified SSID.
260 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
261 #[cfg(feature = "objc2-core-foundation")]
262 #[deprecated = "Use CWKeychainFindWiFiEAPUsernameAndPassword() instead"]
263 pub fn CWKeychainCopyEAPUsernameAndPassword(
264 ssid_data: &CFData,
265 username: *mut *const CFString,
266 password: *mut *const CFString,
267 ) -> OSStatus;
268}
269
270extern "C-unwind" {
271 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
272 ///
273 ///
274 /// Parameter `username`: The 802.1X username.
275 ///
276 ///
277 /// Parameter `password`: The 802.1X password. This parameter is optional.
278 ///
279 ///
280 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
281 /// <i>
282 /// errSecSuccess
283 /// </i>
284 /// indicates no error occurred.
285 ///
286 ///
287 /// Sets the 802.1X username and password for the specified SSID.
288 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
289 #[cfg(feature = "objc2-core-foundation")]
290 #[deprecated = "Use CWKeychainSetWiFiEAPUsernameAndPassword() instead"]
291 pub fn CWKeychainSetEAPUsernameAndPassword(
292 ssid_data: &CFData,
293 username: Option<&CFString>,
294 password: Option<&CFString>,
295 ) -> OSStatus;
296}
297
298extern "C-unwind" {
299 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
300 ///
301 ///
302 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
303 /// <i>
304 /// errSecSuccess
305 /// </i>
306 /// indicates no error occurred.
307 ///
308 ///
309 /// Deletes the 802.1X username and password for the specified SSID.
310 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
311 #[cfg(feature = "objc2-core-foundation")]
312 #[deprecated = "Use CWKeychainDeleteWiFiEAPUsernameAndPassword() instead"]
313 pub fn CWKeychainDeleteEAPUsernameAndPassword(ssid_data: &CFData) -> OSStatus;
314}
315
316extern "C-unwind" {
317 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
318 ///
319 ///
320 /// Parameter `identity`: A SecIdentityRef passed by reference, which upon return will contain the SecIdentityRef associated with the specified SSID.
321 /// This parameter is optional. The returned value must be released by the caller.
322 ///
323 ///
324 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
325 /// <i>
326 /// errSecSuccess
327 /// </i>
328 /// indicates no error occurred.
329 ///
330 ///
331 /// Finds and returns the identity stored for the specified SSID and keychain domain.
332 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
333 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-security"))]
334 #[deprecated = "Use CWKeychainCopyWiFiEAPIdentity() instead"]
335 pub fn CWKeychainCopyEAPIdentity(
336 ssid_data: &CFData,
337 identity: *mut *mut SecIdentity,
338 ) -> OSStatus;
339}
340
341extern "C-unwind" {
342 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
343 ///
344 ///
345 /// Parameter `identity`: The identity containing the certificate to use for 802.1X authentication.
346 /// Passing nil clears any identity association for the specified SSID.
347 ///
348 ///
349 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
350 /// <i>
351 /// errSecSuccess
352 /// </i>
353 /// indicates no error occurred.
354 ///
355 ///
356 /// Associates an identity to the specified SSID.
357 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
358 #[cfg(all(feature = "objc2-core-foundation", feature = "objc2-security"))]
359 #[deprecated = "Use CWKeychainSetWiFiEAPIdentity() instead"]
360 pub fn CWKeychainSetEAPIdentity(ssid_data: &CFData, identity: Option<&SecIdentity>)
361 -> OSStatus;
362}
363
364extern "C-unwind" {
365 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
366 ///
367 ///
368 /// Parameter `password`: The Wi-Fi network password.
369 ///
370 ///
371 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
372 /// <i>
373 /// errSecSuccess
374 /// </i>
375 /// indicates no error occurred.
376 ///
377 ///
378 /// Sets the Wi-Fi network keychain password for the specified SSID.
379 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
380 #[cfg(feature = "objc2-core-foundation")]
381 #[deprecated = "Use CWKeychainSetWiFiPassword() instead"]
382 pub fn CWKeychainSetPassword(ssid_data: &CFData, password: &CFString) -> OSStatus;
383}
384
385extern "C-unwind" {
386 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
387 ///
388 ///
389 /// Parameter `password`: A CFStringRef passed by reference, which upon return will contain the Wi-Fi keychain password for the specified SSID.
390 /// This parameter is optional. The returned value must be released by the caller.
391 ///
392 ///
393 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
394 /// <i>
395 /// errSecSuccess
396 /// </i>
397 /// indicates no error occurred.
398 ///
399 ///
400 /// Finds and returns (by reference) the password for the specified SSID.
401 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
402 #[cfg(feature = "objc2-core-foundation")]
403 #[deprecated = "Use CWKeychainFindWiFiPassword() instead"]
404 pub fn CWKeychainCopyPassword(ssid_data: &CFData, password: *mut *const CFString) -> OSStatus;
405}
406
407extern "C-unwind" {
408 /// Parameter `ssidData`: The service set identifier (SSID) which is used to uniquely identify the keychain item.
409 ///
410 ///
411 /// Returns: An OSStatus error code indicating whether or not a failure occurred.
412 /// <i>
413 /// errSecSuccess
414 /// </i>
415 /// indicates no error occurred.
416 ///
417 ///
418 /// Deletes the password for the specified SSID and keychain domain.
419 /// The keychain used is determined by the SecPreferencesDomain of the caller as returned by SecKeychainGetPreferenceDomain().
420 #[cfg(feature = "objc2-core-foundation")]
421 #[deprecated = "Use CWKeychainDeleteWiFiPassword() instead"]
422 pub fn CWKeychainDeletePassword(ssid_data: &CFData) -> OSStatus;
423}
424
425/// Parameter `networks`: The set of networks to merge.
426///
427///
428/// Merges the specified set of CWNetwork objects.
429///
430///
431/// Duplicate networks are defined as networks with the same SSID, security type, and BSS type (IBSS or Infrastructure).
432/// When duplicate networks exist, the network with the best RSSI value will be chosen.
433#[cfg(feature = "CWNetwork")]
434#[inline]
435pub unsafe extern "C-unwind" fn CWMergeNetworks(
436 networks: &NSSet<CWNetwork>,
437) -> Retained<NSSet<CWNetwork>> {
438 extern "C-unwind" {
439 fn CWMergeNetworks(networks: &NSSet<CWNetwork>) -> *mut NSSet<CWNetwork>;
440 }
441 let ret = unsafe { CWMergeNetworks(networks) };
442 unsafe { Retained::retain_autoreleased(ret) }
443 .expect("function was marked as returning non-null, but actually returned NULL")
444}