2 * Copyright (c) 2009-2016 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 <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 __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_8
, __MAC_NA
,
79 __IPHONE_4_0
, __IPHONE_9_0
,
80 "Replaced by <NetworkExtension/NEHotspotHelper.h>");
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 __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_8
, __MAC_NA
,
94 __IPHONE_4_0
, __IPHONE_9_0
,
95 "Replaced by <NetworkExtension/NEHotspotHelper.h>");
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 __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_8
, __MAC_NA
,
107 __IPHONE_4_0
, __IPHONE_9_0
,
108 "Replaced by <NetworkExtension/NEHotspotHelper.h>");
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) __OSX_AVAILABLE_STARTING(__MAC_10_8
,__IPHONE_4_1
);
121 @constant kCNNetworkInfoKeySSIDData
122 @discussion NetworkInfo Dictionary key for SSID in CFData format
124 extern const CFStringRef kCNNetworkInfoKeySSIDData
__OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
127 @constant kCNNetworkInfoKeySSID
128 @discussion NetworkInfo Dictionary key for SSID in CFString format
130 extern const CFStringRef kCNNetworkInfoKeySSID
__OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
133 @constant kCNNetworkInfoKeyBSSID
134 @discussion NetworkInfo Dictionary key for BSSID in CFString format
136 extern const CFStringRef kCNNetworkInfoKeyBSSID
__OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
139 @function CNCopyCurrentNetworkInfo
140 @discussion Returns the Network Info for the specified interface.
141 For example, Network Info dictionary will contain the following
146 =======================================
147 kCNNetworkInfoKeySSIDData : CFDataRef
148 kCNNetworkInfoKeySSID : CFStringRef
149 kCNNetworkInfoKeyBSSID : CFStringRef
152 @param interfaceName Name of the interface you are interested in
153 @result Network Info dictionary associated with the interface.
154 Returns NULL if an error was encountered.
155 You MUST release the returned value.
157 CFDictionaryRef __nullable
158 CNCopyCurrentNetworkInfo (CFStringRef interfaceName
) __OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
162 CF_ASSUME_NONNULL_END
163 CF_IMPLICIT_BRIDGING_DISABLED
165 #endif /* _CAPTIVENETWORK_H */