2 * Copyright (c) 2009, 2010 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>
32 @header CaptiveNetwork
33 @discussion The CaptiveNetwork API allows applications to interact
34 with Captive Network Support. Captive Network Support is a
35 system component responsible for detecting and help users
36 navigate networks that require interaction before providing
37 internet access. The most common Captive Networks are WiFi
38 Hotspots in places like airports, restaurants, and hotels.
39 Captive Network Support will attempt to authenticate if
40 possible or drop a user in to a web sheet if authentication
41 is not possible. In the web sheet the user has an opportunity
42 to authenticate or disassociate from the network.
44 The following APIs are designed for third party applications
45 that may handle authentication on these networks on behalf of
48 These APIs are treated as advisory only.
49 There is no guarantee or contract that the operating system
50 will take the intended action.
56 @function CNSetSupportedSSIDs
57 @discussion Provides Captive Network Support with an updated list of
58 SSIDs that this application will perform authentication on.
59 When Captive Network Support would show the Web Sheet for a
60 network with an SSID the application has registered for, it
61 will suppress showing the Web Sheet if the application is
63 @param ssidArray A CFArray of CFStrings of the SSIDs.
64 @result Returns TRUE if the operation succeeded, FALSE otherwise.
67 CNSetSupportedSSIDs (CFArrayRef ssidArray
) __OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_0
);
70 @function CNMarkPortalOnline
71 @discussion Tells Captive Network Support that your application has
72 authenticated the device to the network. Captive Network Support
73 will notify the rest of the system that WiFi is now a viable
75 @param interfaceName Name of the interface that is now online.
76 @result Returns TRUE if the operation succeeded, FALSE otherwise.
79 CNMarkPortalOnline (CFStringRef interfaceName
) __OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_0
);
82 @function CNMarkPortalOffline
83 @discussion Tells Captive Network Support that the device is not
84 authenticated on the given network interface.
85 @param interfaceName Name of the interface that is still captive.
86 @result Returns TRUE if the operation succeeded, FALSE otherwise.
89 CNMarkPortalOffline (CFStringRef interfaceName
) __OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_0
);
93 @function CNCopySupportedInterfaces
94 @discussion copies a list of all interfaces CaptiveNetworkSupport is monitoring.
95 @result An array of CFStringRef- BSD interface names.
96 Returns NULL if an error was encountered.
97 You MUST release the returned value.
100 CNCopySupportedInterfaces (void) __OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
103 @constant kCNNetworkInfoKeySSIDData
104 @discussion NetworkInfo Dictionary key for SSID in CFData format
106 extern const CFStringRef kCNNetworkInfoKeySSIDData
__OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
109 @constant kCNNetworkInfoKeySSID
110 @discussion NetworkInfo Dictionary key for SSID in CFString format
112 extern const CFStringRef kCNNetworkInfoKeySSID
__OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
115 @constant kCNNetworkInfoKeyBSSID
116 @discussion NetworkInfo Dictionary key for BSSID in CFString format
118 extern const CFStringRef kCNNetworkInfoKeyBSSID
__OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
121 @function CNCopyCurrentNetworkInfo
122 @discussion Returns the Network Info for the specified interface.
123 For example, Network Info dictionary will contain the following
128 =======================================
129 kCNNetworkInfoKeySSIDData : CFDataRef
130 kCNNetworkInfoKeySSID : CFStringRef
131 kCNNetworkInfoKeyBSSID : CFStringRef
134 @param interfaceName Name of the interface you are interested in
135 @result Network Info dictionary associated with the interface.
136 Returns NULL if an error was encountered.
137 You MUST release the returned value.
140 CNCopyCurrentNetworkInfo (CFStringRef interfaceName
) __OSX_AVAILABLE_STARTING(__MAC_NA
,__IPHONE_4_1
);
144 #endif /* _CAPTIVENETWORK_H */