2 * Copyright (c) 2009-2016, 2018 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _CAPTIVENETWORK_H
25 #define _CAPTIVENETWORK_H
27 #include <os/availability.h>
28 #include <sys/cdefs.h>
29 #include <CoreFoundation/CoreFoundation.h>
31 CF_IMPLICIT_BRIDGING_ENABLED
32 CF_ASSUME_NONNULL_BEGIN
35 @header CaptiveNetwork
36 @discussion The CaptiveNetwork API allows applications to interact
37 with Captive Network Support. Captive Network Support is a
38 system component responsible for detecting and help users
39 navigate networks that require interaction before providing
40 internet access. The most common Captive Networks are WiFi
41 Hotspots in places like airports, restaurants, and hotels.
42 Captive Network Support will attempt to authenticate if
43 possible or drop a user in to a web sheet if authentication
44 is not possible. In the web sheet the user has an opportunity
45 to authenticate or disassociate from the network.
47 The following APIs are designed for third party applications
48 that may handle authentication on these networks on behalf of
51 These APIs are treated as advisory only.
52 There is no guarantee or contract that the operating system
53 will take the intended action.
59 @function CNSetSupportedSSIDs
60 @discussion Provides Captive Network Support with an updated list of
61 SSIDs that this application will perform authentication on.
63 Captive Network Support suppresses showing the Web Sheet
64 for a captive Wi-Fi network if that network's SSID is in the
67 On iOS, the registrations persist until the application is
68 removed from the device.
70 On MacOSX, the registrations persist as long as the application
73 @param ssidArray A CFArray of CFStrings of the SSIDs.
74 @result Returns TRUE if the operation succeeded, FALSE otherwise.
77 CNSetSupportedSSIDs (CFArrayRef ssidArray
)
78 API_AVAILABLE(macos(10.8))
79 API_DEPRECATED_WITH_REPLACEMENT("Replaced by <NetworkExtension/NEHotspotHelper.h>", ios(4.0,9.0))
80 SPI_AVAILABLE(tvos(9.0), watchos(1.0), bridgeos(1.0));
83 @function CNMarkPortalOnline
84 @discussion Tells Captive Network Support that your application has
85 authenticated the device to the network. Captive Network Support
86 will notify the rest of the system that WiFi is now a viable
88 @param interfaceName Name of the interface that is now online.
89 @result Returns TRUE if the operation succeeded, FALSE otherwise.
92 CNMarkPortalOnline (CFStringRef interfaceName
)
93 API_AVAILABLE(macos(10.8))
94 API_DEPRECATED_WITH_REPLACEMENT("Replaced by <NetworkExtension/NEHotspotHelper.h>", ios(4.0,9.0))
95 SPI_AVAILABLE(tvos(9.0), watchos(1.0), bridgeos(1.0));
98 @function CNMarkPortalOffline
99 @discussion Tells Captive Network Support that the device is not
100 authenticated on the given network interface.
101 @param interfaceName Name of the interface that is still captive.
102 @result Returns TRUE if the operation succeeded, FALSE otherwise.
105 CNMarkPortalOffline (CFStringRef interfaceName
)
106 API_AVAILABLE(macos(10.8))
107 API_DEPRECATED_WITH_REPLACEMENT("Replaced by <NetworkExtension/NEHotspotHelper.h>", ios(4.0,9.0))
108 SPI_AVAILABLE(tvos(9.0), watchos(1.0), bridgeos(1.0));
111 @function CNCopySupportedInterfaces
112 @discussion copies a list of all interfaces CaptiveNetworkSupport is monitoring.
113 @result An array of CFStringRef- BSD interface names.
114 Returns NULL if an error was encountered.
115 You MUST release the returned value.
117 CFArrayRef __nullable
118 CNCopySupportedInterfaces (void)
119 API_AVAILABLE(macos(10.8), ios(4.1))
120 SPI_AVAILABLE(tvos(9.0), watchos(1.0), bridgeos(1.0));
123 @constant kCNNetworkInfoKeySSIDData
124 @discussion NetworkInfo Dictionary key for SSID in CFData format
126 extern const CFStringRef kCNNetworkInfoKeySSIDData
127 API_AVAILABLE(ios(4.1))
128 SPI_AVAILABLE(macos(10.6), tvos(9.0), watchos(1.0), bridgeos(1.0));
131 @constant kCNNetworkInfoKeySSID
132 @discussion NetworkInfo Dictionary key for SSID in CFString format
134 extern const CFStringRef kCNNetworkInfoKeySSID
135 API_AVAILABLE(ios(4.1))
136 SPI_AVAILABLE(macos(10.6), tvos(9.0), watchos(1.0), bridgeos(1.0));
139 @constant kCNNetworkInfoKeyBSSID
140 @discussion NetworkInfo Dictionary key for BSSID in CFString format
142 extern const CFStringRef kCNNetworkInfoKeyBSSID
143 API_AVAILABLE(ios(4.1))
144 SPI_AVAILABLE(macos(10.6), tvos(9.0), watchos(1.0), bridgeos(1.0));
147 @function CNCopyCurrentNetworkInfo
148 @discussion Returns the Network Info for the specified interface.
149 For example, Network Info dictionary will contain the following
154 =======================================
155 kCNNetworkInfoKeySSIDData : CFDataRef
156 kCNNetworkInfoKeySSID : CFStringRef
157 kCNNetworkInfoKeyBSSID : CFStringRef
160 @param interfaceName Name of the interface you are interested in
161 @result Network Info dictionary associated with the interface.
162 Returns NULL if an error was encountered.
163 You MUST release the returned value.
165 CFDictionaryRef __nullable
166 CNCopyCurrentNetworkInfo (CFStringRef interfaceName
)
167 API_AVAILABLE(ios(4.1))
168 SPI_AVAILABLE(macos(10.6), tvos(9.0), watchos(1.0), bridgeos(1.0));
172 CF_ASSUME_NONNULL_END
173 CF_IMPLICIT_BRIDGING_DISABLED
175 #endif /* _CAPTIVENETWORK_H */