objc2_system_configuration/generated/
CaptiveNetwork.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2_core_foundation::*;
5
6use crate::*;
7
8/// Provides Captive Network Support with an updated list of
9/// SSIDs that this application will perform authentication on.
10///
11/// Captive Network Support suppresses showing the Web Sheet
12/// for a captive Wi-Fi network if that network's SSID is in the
13/// specified list.
14///
15/// On iOS, the registrations persist until the application is
16/// removed from the device.
17///
18/// On MacOSX, the registrations persist as long as the application
19/// is running.
20///
21///
22/// Parameter `ssidArray`: A CFArray of CFStrings of the SSIDs.
23///
24/// Returns: Returns TRUE if the operation succeeded, FALSE otherwise.
25///
26/// # Safety
27///
28/// `ssid_array` generic must be of the correct type.
29#[deprecated]
30#[inline]
31pub unsafe extern "C-unwind" fn CNSetSupportedSSIDs(ssid_array: &CFArray) -> bool {
32    extern "C-unwind" {
33        fn CNSetSupportedSSIDs(ssid_array: &CFArray) -> Boolean;
34    }
35    let ret = unsafe { CNSetSupportedSSIDs(ssid_array) };
36    ret != 0
37}
38
39/// Tells Captive Network Support that your application has
40/// authenticated the device to the network. Captive Network Support
41/// will notify the rest of the system that WiFi is now a viable
42/// interface.
43///
44/// Parameter `interfaceName`: Name of the interface that is now online.
45///
46/// Returns: Returns TRUE if the operation succeeded, FALSE otherwise.
47#[deprecated]
48#[inline]
49pub extern "C-unwind" fn CNMarkPortalOnline(interface_name: &CFString) -> bool {
50    extern "C-unwind" {
51        fn CNMarkPortalOnline(interface_name: &CFString) -> Boolean;
52    }
53    let ret = unsafe { CNMarkPortalOnline(interface_name) };
54    ret != 0
55}
56
57/// Tells Captive Network Support that the device is not
58/// authenticated on the given network interface.
59///
60/// Parameter `interfaceName`: Name of the interface that is still captive.
61///
62/// Returns: Returns TRUE if the operation succeeded, FALSE otherwise.
63#[deprecated]
64#[inline]
65pub extern "C-unwind" fn CNMarkPortalOffline(interface_name: &CFString) -> bool {
66    extern "C-unwind" {
67        fn CNMarkPortalOffline(interface_name: &CFString) -> Boolean;
68    }
69    let ret = unsafe { CNMarkPortalOffline(interface_name) };
70    ret != 0
71}
72
73/// copies a list of all interfaces CaptiveNetworkSupport is monitoring.
74///
75/// Returns: An array of CFStringRef- BSD interface names.
76/// Returns NULL if an error was encountered.
77/// You MUST release the returned value.
78#[inline]
79pub extern "C-unwind" fn CNCopySupportedInterfaces() -> Option<CFRetained<CFArray>> {
80    extern "C-unwind" {
81        fn CNCopySupportedInterfaces() -> Option<NonNull<CFArray>>;
82    }
83    let ret = unsafe { CNCopySupportedInterfaces() };
84    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
85}
86
87extern "C" {
88    /// NetworkInfo Dictionary key for SSID in CFData format
89    ///
90    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kcnnetworkinfokeyssiddata?language=objc)
91    pub static kCNNetworkInfoKeySSIDData: &'static CFString;
92}
93
94extern "C" {
95    /// NetworkInfo Dictionary key for SSID in CFString format
96    ///
97    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kcnnetworkinfokeyssid?language=objc)
98    pub static kCNNetworkInfoKeySSID: &'static CFString;
99}
100
101extern "C" {
102    /// NetworkInfo Dictionary key for BSSID in CFString format
103    ///
104    /// See also [Apple's documentation](https://developer.apple.com/documentation/systemconfiguration/kcnnetworkinfokeybssid?language=objc)
105    pub static kCNNetworkInfoKeyBSSID: &'static CFString;
106}
107
108/// Returns the network information for the specified interface when the requesting application meets one of following 4 requirements -.
109/// 1. application is using CoreLocation API and has the user's authorization to access location.
110/// 2. application has used the NEHotspotConfiguration API to configure the current Wi-Fi network.
111/// 3. application has active VPN configurations installed.
112/// 4. application has active NEDNSSettingsManager configurations installed.
113///
114/// - An application will receive NULL if it is linked against iOS 19.0 SDK (or newer) regardless of fulfillment of the above requirements.
115/// - An application that is linked against iOS 12.0 SDK and above must have the "com.apple.developer.networking.wifi-info" entitlement.
116/// - An application will receive a pseudo network information if it is linked against an SDK before iOS 13.0, and if it fails to meet any of the
117/// above requirements.
118/// - An application will receive NULL if it is linked against iOS 13.0 SDK (or newer), and if it fails to meet any of the above requirements.
119/// - On Mac Catalyst platform, to receive current Wi-Fi network information, an application must have "com.apple.developer.networking.wifi-info"
120/// entitlement and user's authorization to access location.
121///
122/// Network Information dictionary will contain the following keys, and values:
123/// <pre>
124///
125/// ```text
126///     Keys                      : Values
127///     =======================================
128///     kCNNetworkInfoKeySSIDData : CFDataRef
129///     kCNNetworkInfoKeySSID     : CFStringRef
130///     kCNNetworkInfoKeyBSSID    : CFStringRef
131/// ```
132///
133/// </pre>
134///
135/// Pseudo network information will contain "Wi-Fi" SSID and "00:00:00:00:00:00" BSSID. For China region, the SSID will be "WLAN".
136///
137/// Parameter `interfaceName`: Name of the interface you are interested in
138///
139/// Returns: Network Information dictionary associated with the interface.
140/// Returns NULL if an error was encountered.
141/// You MUST release the returned value.
142#[deprecated]
143#[inline]
144pub extern "C-unwind" fn CNCopyCurrentNetworkInfo(
145    interface_name: &CFString,
146) -> Option<CFRetained<CFDictionary>> {
147    extern "C-unwind" {
148        fn CNCopyCurrentNetworkInfo(interface_name: &CFString) -> Option<NonNull<CFDictionary>>;
149    }
150    let ret = unsafe { CNCopyCurrentNetworkInfo(interface_name) };
151    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
152}