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