···11+/*
22+ * Copyright (c) 2009-2016 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _CAPTIVENETWORK_H
2525+#define _CAPTIVENETWORK_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CoreFoundation.h>
3030+3131+CF_IMPLICIT_BRIDGING_ENABLED
3232+CF_ASSUME_NONNULL_BEGIN
3333+3434+/*!
3535+ @header CaptiveNetwork
3636+ @discussion The CaptiveNetwork API allows applications to interact
3737+ with Captive Network Support. Captive Network Support is a
3838+ system component responsible for detecting and help users
3939+ navigate networks that require interaction before providing
4040+ internet access. The most common Captive Networks are WiFi
4141+ Hotspots in places like airports, restaurants, and hotels.
4242+ Captive Network Support will attempt to authenticate if
4343+ possible or drop a user in to a web sheet if authentication
4444+ is not possible. In the web sheet the user has an opportunity
4545+ to authenticate or disassociate from the network.
4646+4747+ The following APIs are designed for third party applications
4848+ that may handle authentication on these networks on behalf of
4949+ the user.
5050+5151+ These APIs are treated as advisory only.
5252+ There is no guarantee or contract that the operating system
5353+ will take the intended action.
5454+ */
5555+5656+__BEGIN_DECLS
5757+5858+/*!
5959+ @function CNSetSupportedSSIDs
6060+ @discussion Provides Captive Network Support with an updated list of
6161+ SSIDs that this application will perform authentication on.
6262+6363+ Captive Network Support suppresses showing the Web Sheet
6464+ for a captive Wi-Fi network if that network's SSID is in the
6565+ specified list.
6666+6767+ On iOS, the registrations persist until the application is
6868+ removed from the device.
6969+7070+ On MacOSX, the registrations persist as long as the application
7171+ is running.
7272+7373+ @param ssidArray A CFArray of CFStrings of the SSIDs.
7474+ @result Returns TRUE if the operation succeeded, FALSE otherwise.
7575+ */
7676+Boolean
7777+CNSetSupportedSSIDs (CFArrayRef ssidArray)
7878+ __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_8, __MAC_NA,
7979+ __IPHONE_4_0, __IPHONE_9_0,
8080+ "Replaced by <NetworkExtension/NEHotspotHelper.h>");
8181+8282+/*!
8383+ @function CNMarkPortalOnline
8484+ @discussion Tells Captive Network Support that your application has
8585+ authenticated the device to the network. Captive Network Support
8686+ will notify the rest of the system that WiFi is now a viable
8787+ interface.
8888+ @param interfaceName Name of the interface that is now online.
8989+ @result Returns TRUE if the operation succeeded, FALSE otherwise.
9090+ */
9191+Boolean
9292+CNMarkPortalOnline (CFStringRef interfaceName)
9393+ __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_8, __MAC_NA,
9494+ __IPHONE_4_0, __IPHONE_9_0,
9595+ "Replaced by <NetworkExtension/NEHotspotHelper.h>");
9696+9797+/*!
9898+ @function CNMarkPortalOffline
9999+ @discussion Tells Captive Network Support that the device is not
100100+ authenticated on the given network interface.
101101+ @param interfaceName Name of the interface that is still captive.
102102+ @result Returns TRUE if the operation succeeded, FALSE otherwise.
103103+ */
104104+Boolean
105105+CNMarkPortalOffline (CFStringRef interfaceName)
106106+ __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_8, __MAC_NA,
107107+ __IPHONE_4_0, __IPHONE_9_0,
108108+ "Replaced by <NetworkExtension/NEHotspotHelper.h>");
109109+110110+/*!
111111+ @function CNCopySupportedInterfaces
112112+ @discussion copies a list of all interfaces CaptiveNetworkSupport is monitoring.
113113+ @result An array of CFStringRef- BSD interface names.
114114+ Returns NULL if an error was encountered.
115115+ You MUST release the returned value.
116116+ */
117117+CFArrayRef __nullable
118118+CNCopySupportedInterfaces (void) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_4_1);
119119+120120+/*!
121121+ @constant kCNNetworkInfoKeySSIDData
122122+ @discussion NetworkInfo Dictionary key for SSID in CFData format
123123+ */
124124+extern const CFStringRef kCNNetworkInfoKeySSIDData __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
125125+126126+/*!
127127+ @constant kCNNetworkInfoKeySSID
128128+ @discussion NetworkInfo Dictionary key for SSID in CFString format
129129+ */
130130+extern const CFStringRef kCNNetworkInfoKeySSID __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
131131+132132+/*!
133133+ @constant kCNNetworkInfoKeyBSSID
134134+ @discussion NetworkInfo Dictionary key for BSSID in CFString format
135135+ */
136136+extern const CFStringRef kCNNetworkInfoKeyBSSID __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
137137+138138+/*!
139139+ @function CNCopyCurrentNetworkInfo
140140+ @discussion Returns the Network Info for the specified interface.
141141+ For example, Network Info dictionary will contain the following
142142+ keys, and values:
143143+ <pre>
144144+ @textblock
145145+ Keys : Values
146146+ =======================================
147147+ kCNNetworkInfoKeySSIDData : CFDataRef
148148+ kCNNetworkInfoKeySSID : CFStringRef
149149+ kCNNetworkInfoKeyBSSID : CFStringRef
150150+ @/textblock
151151+ </pre>
152152+ @param interfaceName Name of the interface you are interested in
153153+ @result Network Info dictionary associated with the interface.
154154+ Returns NULL if an error was encountered.
155155+ You MUST release the returned value.
156156+ */
157157+CFDictionaryRef __nullable
158158+CNCopyCurrentNetworkInfo (CFStringRef interfaceName) __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_4_1);
159159+160160+__END_DECLS
161161+162162+CF_ASSUME_NONNULL_END
163163+CF_IMPLICIT_BRIDGING_DISABLED
164164+165165+#endif /* _CAPTIVENETWORK_H */
···11+/*
22+ * Copyright (c) 2001, 2004, 2005, 2008, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _DHCPCLIENTPREFERENCES_H
2525+#define _DHCPCLIENTPREFERENCES_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CFString.h>
3030+3131+CF_IMPLICIT_BRIDGING_ENABLED
3232+CF_ASSUME_NONNULL_BEGIN
3333+3434+/*!
3535+ @header DHCPClientPreferences
3636+ @discussion The DHCPClientPreferences API allows applications to get and update DHCP preferences.
3737+ DHCP preferences are in the form of DHCP option codes, which are defined in RFC 2132.
3838+ */
3939+4040+__BEGIN_DECLS
4141+4242+/*!
4343+ @function DHCPClientPreferencesSetApplicationOptions
4444+ @discussion Updates the DHCP client preferences to include the
4545+ given list of options for the given application ID.
4646+ @param applicationID The application's preference ID, for example:
4747+ "com.apple.SystemPreferences".
4848+ @param options An array of 8-bit values containing the
4949+ DHCP option codes (see RFC 2132) for this application ID.
5050+ A NULL value will clear the list of options for this
5151+ application ID.
5252+ @param count The number of elements in the options parameter.
5353+ @result Returns TRUE if the operation succeeded, FALSE otherwise.
5454+ */
5555+5656+Boolean
5757+DHCPClientPreferencesSetApplicationOptions (CFStringRef applicationID,
5858+ UInt8 * __nullable options,
5959+ CFIndex count) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
6060+6161+/*!
6262+ @function DHCPClientPreferencesCopyApplicationOptions
6363+ @discussion Copies the requested DHCP options for the
6464+ given application ID.
6565+ @param applicationID The application's preference ID, for example
6666+ "com.apple.SystemPreferences".
6767+ @param count The number of elements in the returned array.
6868+ @result Returns the list of options for the given application ID, or
6969+ NULL if no options are defined or an error occurred.
7070+7171+ When you are finished, use free() to release a non-NULL return value.
7272+ */
7373+7474+UInt8 * __nullable
7575+DHCPClientPreferencesCopyApplicationOptions (CFStringRef applicationID,
7676+ CFIndex *count) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
7777+7878+__END_DECLS
7979+8080+CF_ASSUME_NONNULL_END
8181+CF_IMPLICIT_BRIDGING_DISABLED
8282+8383+#endif /* _DHCPCLIENTPREFERENCES_H */
···11+/*
22+ * Copyright (c) 2000, 2001, 2003-2005, 2008-2010, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCDYNAMICSTORE_H
2525+#define _SCDYNAMICSTORE_H
2626+2727+#include <Availability.h>
2828+#include <TargetConditionals.h>
2929+#include <sys/cdefs.h>
3030+#include <dispatch/dispatch.h>
3131+#include <CoreFoundation/CoreFoundation.h>
3232+3333+CF_IMPLICIT_BRIDGING_ENABLED
3434+CF_ASSUME_NONNULL_BEGIN
3535+3636+/*!
3737+ @header SCDynamicStore
3838+ @discussion The SCDynamicStore API provides access to the key-value
3939+ pairs in the dynamic store of a running system. The dynamic
4040+ store contains, among other items, a copy of the configuration
4141+ settings for the currently active set (which is sometimes
4242+ refered to as the location) and information about the current
4343+ network state.
4444+4545+ The functions in the SCDynamicStore API allow you to find
4646+ key-value pairs, add or remove key-value pairs, add or change
4747+ values, and request notifications.
4848+4949+ To use the functions of the SCDynamicStore API, you must first
5050+ establish a dynamic store session using the SCDynamicStoreCreate
5151+ function. When you are finished with the session, use CFRelease
5252+ to close it.
5353+ */
5454+5555+5656+/*!
5757+ @typedef SCDynamicStoreRef
5858+ @discussion This is the handle to an open a dynamic store session
5959+ with the system configuration daemon.
6060+ */
6161+typedef const struct CF_BRIDGED_TYPE(id) __SCDynamicStore * SCDynamicStoreRef;
6262+6363+/*!
6464+ @typedef SCDynamicStoreContext
6565+ Structure containing user-specified data and callbacks for an
6666+ SCDynamicStore session.
6767+ @field version The version number of the structure type being passed
6868+ in as a parameter to the SCDynamicStore creation function.
6969+ This structure is version 0.
7070+ @field info A C pointer to a user-specified block of data.
7171+ @field retain The callback used to add a retain for the info field.
7272+ If this parameter is not a pointer to a function of the correct
7373+ prototype, the behavior is undefined. The value may be NULL.
7474+ @field release The calllback used to remove a retain previously added
7575+ for the info field. If this parameter is not a pointer to a
7676+ function of the correct prototype, the behavior is undefined.
7777+ The value may be NULL.
7878+ @field copyDescription The callback used to provide a description of
7979+ the info field.
8080+ */
8181+typedef struct {
8282+ CFIndex version;
8383+ void * __nullable info;
8484+ const void * __nonnull (* __nullable retain)(const void *info);
8585+ void (* __nullable release)(const void *info);
8686+ CFStringRef __nonnull (* __nullable copyDescription)(const void *info);
8787+} SCDynamicStoreContext;
8888+8989+/*!
9090+ @typedef SCDynamicStoreCallBack
9191+ @discussion Type of callback function used when notification of
9292+ changes to the dynamic store is delivered.
9393+ @param store The dynamic store session.
9494+ @param changedKeys The list of changed keys.
9595+9696+ The list includes any specific SCDynamicStore keys that
9797+ changed (add, update, remove, notify) since the last call
9898+ to SCDynamicStoreSetNotificationKeys or since the last
9999+ notification callback. The list also includes any specific
100100+ keys matching one of the pattern string(s) that changed.
101101+102102+ An empty list indicates that the SCDynamicStore server
103103+ restarted and that any assumptions based on prior content
104104+ of the SCDynamicStore should be disgarded.
105105+106106+ @param info A C pointer to a user-specified block of data.
107107+ */
108108+typedef void (*SCDynamicStoreCallBack) (
109109+ SCDynamicStoreRef store,
110110+ CFArrayRef changedKeys,
111111+ void * __nullable info
112112+ );
113113+114114+115115+__BEGIN_DECLS
116116+117117+/*!
118118+ @function SCDynamicStoreGetTypeID
119119+ @discussion Returns the type identifier of all SCDynamicStore instances.
120120+ */
121121+CFTypeID
122122+SCDynamicStoreGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
123123+124124+125125+/*!
126126+ @function SCDynamicStoreCreate
127127+ @discussion Creates a new session used to interact with the dynamic
128128+ store maintained by the System Configuration server.
129129+ @param allocator The CFAllocator that should be used to allocate
130130+ memory for the local dynamic store object.
131131+ This parameter may be NULL in which case the current
132132+ default CFAllocator is used. If this reference is not
133133+ a valid CFAllocator, the behavior is undefined.
134134+ @param name A string that describes the name of the calling
135135+ process or plug-in of the caller.
136136+ @param callout The function to be called when a watched value
137137+ in the dynamic store is changed.
138138+ A NULL value can be specified if no callouts are
139139+ desired.
140140+ @param context The SCDynamicStoreContext associated with the callout.
141141+ @result Returns a reference to the new SCDynamicStore session.
142142+ You must release the returned value.
143143+ */
144144+SCDynamicStoreRef __nullable
145145+SCDynamicStoreCreate (
146146+ CFAllocatorRef __nullable allocator,
147147+ CFStringRef name,
148148+ SCDynamicStoreCallBack __nullable callout,
149149+ SCDynamicStoreContext * __nullable context
150150+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
151151+152152+/*!
153153+ @function SCDynamicStoreCreateWithOptions
154154+ @discussion Creates a new session used to interact with the dynamic
155155+ store maintained by the System Configuration server.
156156+ @param allocator The CFAllocator that should be used to allocate
157157+ memory for the local dynamic store object.
158158+ This parameter may be NULL in which case the current
159159+ default CFAllocator is used. If this reference is not
160160+ a valid CFAllocator, the behavior is undefined.
161161+ @param name A string that describes the name of the calling
162162+ process or plug-in of the caller.
163163+ @param storeOptions A CFDictionary containing options for the
164164+ dynamic store session (such as whether all keys added or set
165165+ into the dynamic store should be per-session keys).
166166+167167+ Currently available options include:
168168+169169+ <TABLE BORDER>
170170+ <TR>
171171+ <TH>key</TD>
172172+ <TH>value</TD>
173173+ </TR>
174174+ <TR>
175175+ <TD>kSCDynamicStoreUseSessionKeys</TD>
176176+ <TD>CFBooleanRef</TD>
177177+ </TR>
178178+ </TABLE>
179179+180180+ A NULL value can be specified if no options are desired.
181181+ @param callout The function to be called when a watched value
182182+ in the dynamic store is changed.
183183+ A NULL value can be specified if no callouts are
184184+ desired.
185185+ @param context The SCDynamicStoreContext associated with the callout.
186186+ @result Returns a reference to the new SCDynamicStore session.
187187+ You must release the returned value.
188188+ */
189189+SCDynamicStoreRef __nullable
190190+SCDynamicStoreCreateWithOptions (
191191+ CFAllocatorRef __nullable allocator,
192192+ CFStringRef name,
193193+ CFDictionaryRef __nullable storeOptions,
194194+ SCDynamicStoreCallBack __nullable callout,
195195+ SCDynamicStoreContext * __nullable context
196196+ ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
197197+198198+extern const CFStringRef kSCDynamicStoreUseSessionKeys __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /* CFBoolean */
199199+200200+/*!
201201+ @function SCDynamicStoreCreateRunLoopSource
202202+ @discussion Creates a CFRunLoopSource object that can be added to the
203203+ application's run loop. All dynamic store notifications are
204204+ delivered using this run loop source.
205205+ @param allocator The CFAllocator that should be used to allocate
206206+ memory for this run loop source.
207207+ This parameter may be NULL in which case the current
208208+ default CFAllocator is used. If this reference is not
209209+ a valid CFAllocator, the behavior is undefined.
210210+ @param store A reference to the dynamic store session.
211211+ @param order On platforms which support it, for source versions
212212+ which support it, this parameter determines the order in
213213+ which the sources which are ready to be processed are
214214+ handled. A lower order number causes processing before
215215+ higher order number sources. It is inadvisable to depend
216216+ on the order number for any architectural or design aspect
217217+ of code. In the absence of any reason to do otherwise,
218218+ zero should be used.
219219+ @result A reference to the new CFRunLoopSource.
220220+ You must release the returned value.
221221+222222+ */
223223+CFRunLoopSourceRef __nullable
224224+SCDynamicStoreCreateRunLoopSource (
225225+ CFAllocatorRef __nullable allocator,
226226+ SCDynamicStoreRef store,
227227+ CFIndex order
228228+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
229229+230230+/*!
231231+ @function SCDynamicStoreSetDispatchQueue
232232+ @discussion Initiates notifications for the Notification
233233+ Keys in store to the callback contained in store.
234234+ @param store A reference to the dynamic store session.
235235+ @param queue The dispatch queue to run the callback function on.
236236+ Pass NULL to disable notifications, and release the queue.
237237+ @result Returns TRUE on success, FALSE on failure.
238238+239239+ */
240240+Boolean
241241+SCDynamicStoreSetDispatchQueue (
242242+ SCDynamicStoreRef store,
243243+ dispatch_queue_t __nullable queue
244244+ ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
245245+246246+/*!
247247+ @function SCDynamicStoreCopyKeyList
248248+ @discussion Returns an array of CFString keys representing the
249249+ current dynamic store entries that match a specified pattern.
250250+ @param store The dynamic store session.
251251+ @param pattern A regex(3) regular expression pattern
252252+ used to match the dynamic store keys.
253253+ @result Returns the list of matching keys; NULL if an error was
254254+ encountered.
255255+ You must release the returned value.
256256+ */
257257+CFArrayRef __nullable
258258+SCDynamicStoreCopyKeyList (
259259+ SCDynamicStoreRef __nullable store,
260260+ CFStringRef pattern
261261+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
262262+263263+/*!
264264+ @function SCDynamicStoreAddValue
265265+ @discussion Adds the key-value pair to the dynamic store if no
266266+ such key already exists.
267267+ @param store The dynamic store session.
268268+ @param key The key of the value to add to the dynamic store.
269269+ @param value The value to add to the dynamic store.
270270+ @result Returns TRUE if the key was added; FALSE if the key was already
271271+ present in the dynamic store or if an error was encountered.
272272+ */
273273+Boolean
274274+SCDynamicStoreAddValue (
275275+ SCDynamicStoreRef __nullable store,
276276+ CFStringRef key,
277277+ CFPropertyListRef value
278278+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
279279+280280+/*!
281281+ @function SCDynamicStoreAddTemporaryValue
282282+ @discussion Temporarily adds the key-value pair to the dynamic store
283283+ if no such key already exists. Unless the key is updated by another
284284+ session, the key-value pair will be removed automatically when the
285285+ session is closed.
286286+ @param store The dynamic store session.
287287+ @param key The key of the value to add to the dynamic store.
288288+ @param value The value to add to the dynamic store.
289289+ @result Returns TRUE if the key was added; FALSE if the key was already
290290+ present in the dynamic store or if an error was encountered.
291291+ */
292292+Boolean
293293+SCDynamicStoreAddTemporaryValue (
294294+ SCDynamicStoreRef store,
295295+ CFStringRef key,
296296+ CFPropertyListRef value
297297+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
298298+299299+/*!
300300+ @function SCDynamicStoreCopyValue
301301+ @discussion Gets the value of the specified key from the dynamic store.
302302+ @param store The dynamic store session.
303303+ @param key The key associated with the value you want to get.
304304+ @result Returns the value from the dynamic store that is associated with the given
305305+ key; NULL if no value was located or an error was encountered.
306306+ You must release the returned value.
307307+ */
308308+CFPropertyListRef __nullable
309309+SCDynamicStoreCopyValue (
310310+ SCDynamicStoreRef __nullable store,
311311+ CFStringRef key
312312+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
313313+314314+/*!
315315+ @function SCDynamicStoreCopyMultiple
316316+ @discussion Gets the values of multiple keys in the dynamic store.
317317+ @param store The dynamic store session.
318318+ @param keys The keys associated with the values you want to get; NULL if no specific
319319+ keys are requested.
320320+ @param patterns An array of regex(3) pattern strings used to match the keys; NULL
321321+ if no key patterns are requested.
322322+ @result Returns a dictionary containing the key-value pairs of specific keys and the
323323+ key-value pairs of keys that matched the specified patterns;
324324+ NULL if an error was encountered.
325325+ You must release the returned value.
326326+ */
327327+CFDictionaryRef __nullable
328328+SCDynamicStoreCopyMultiple (
329329+ SCDynamicStoreRef __nullable store,
330330+ CFArrayRef __nullable keys,
331331+ CFArrayRef __nullable patterns
332332+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
333333+334334+/*!
335335+ @function SCDynamicStoreSetValue
336336+ @discussion Adds or replaces a value in the dynamic store for
337337+ the specified key.
338338+ @param store The dynamic store session.
339339+ @param key The key you want to set.
340340+ @param value The value to add to or replace in the dynamic store.
341341+ @result Returns TRUE if the key was updated; FALSE if an error was encountered.
342342+ */
343343+Boolean
344344+SCDynamicStoreSetValue (
345345+ SCDynamicStoreRef __nullable store,
346346+ CFStringRef key,
347347+ CFPropertyListRef value
348348+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
349349+350350+/*!
351351+ @function SCDynamicStoreSetMultiple
352352+ @discussion Updates multiple values in the dynamic store.
353353+ @param store The dynamic store session.
354354+ @param keysToSet A dictionary of key-value pairs you want to set into the dynamic store.
355355+ @param keysToRemove An array of keys you want to remove from the dynamic store.
356356+ @param keysToNotify An array of keys to flag as changed (without changing their values).
357357+ @result Returns TRUE if the dynamic store updates were successful; FALSE if an error was encountered.
358358+ */
359359+Boolean
360360+SCDynamicStoreSetMultiple (
361361+ SCDynamicStoreRef __nullable store,
362362+ CFDictionaryRef __nullable keysToSet,
363363+ CFArrayRef __nullable keysToRemove,
364364+ CFArrayRef __nullable keysToNotify
365365+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
366366+367367+/*!
368368+ @function SCDynamicStoreRemoveValue
369369+ @discussion Removes the value of the specified key from the
370370+ dynamic store.
371371+ @param store The dynamic store session.
372372+ @param key The key of the value you want to remove.
373373+ @result Returns TRUE if the key was removed; FALSE if no value was
374374+ located or an error was encountered.
375375+ */
376376+Boolean
377377+SCDynamicStoreRemoveValue (
378378+ SCDynamicStoreRef __nullable store,
379379+ CFStringRef key
380380+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
381381+382382+/*!
383383+ @function SCDynamicStoreNotifyValue
384384+ @discussion Triggers a notification to be delivered for the
385385+ specified key in the dynamic store.
386386+ @param store The dynamic store session.
387387+ @param key The key that should be flagged as changed. Any dynamic store sessions
388388+ that are monitoring this key will received a notification. Note that the
389389+ key's value is not updated.
390390+ @result Returns TRUE if the notification was processed; FALSE if an error was encountered.
391391+ */
392392+Boolean
393393+SCDynamicStoreNotifyValue (
394394+ SCDynamicStoreRef __nullable store,
395395+ CFStringRef key
396396+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
397397+398398+/*!
399399+ @function SCDynamicStoreSetNotificationKeys
400400+ @discussion Specifies a set of specific keys and key patterns
401401+ that should be monitored for changes.
402402+ @param store The dynamic store session being watched.
403403+ @param keys An array of keys to be monitored; NULL if no specific keys
404404+ are to be monitored.
405405+ @param patterns An array of regex(3) pattern strings used to match keys to be monitored;
406406+ NULL if no key patterns are to be monitored.
407407+ @result Returns TRUE if the set of notification keys and patterns was successfully
408408+ updated; FALSE if an error was encountered.
409409+ */
410410+Boolean
411411+SCDynamicStoreSetNotificationKeys (
412412+ SCDynamicStoreRef store,
413413+ CFArrayRef __nullable keys,
414414+ CFArrayRef __nullable patterns
415415+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
416416+417417+/*!
418418+ @function SCDynamicStoreCopyNotifiedKeys
419419+ @discussion Returns an array of CFString keys representing the
420420+ dynamic store entries that have changed since this
421421+ function was last called. If possible, your application should
422422+ use the notification functions instead of polling for the list
423423+ of changed keys returned by this function.
424424+ @param store The dynamic store session.
425425+ @result Returns the list of changed keys;
426426+ NULL if an error was encountered.
427427+ You must release the returned value.
428428+ */
429429+CFArrayRef __nullable
430430+SCDynamicStoreCopyNotifiedKeys (
431431+ SCDynamicStoreRef store
432432+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
433433+434434+__END_DECLS
435435+436436+CF_ASSUME_NONNULL_END
437437+CF_IMPLICIT_BRIDGING_DISABLED
438438+439439+#endif /* _SCDYNAMICSTORE_H */
···11+/*
22+ * Copyright (c) 2001, 2002, 2004, 2005, 2008, 2012, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCDYNAMICSTORECOPYDHCPINFO_H
2525+#define _SCDYNAMICSTORECOPYDHCPINFO_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CoreFoundation.h>
3030+#include <SystemConfiguration/SCDynamicStore.h>
3131+3232+CF_IMPLICIT_BRIDGING_ENABLED
3333+CF_ASSUME_NONNULL_BEGIN
3434+3535+/*!
3636+ @header SCDynamicStoreCopyDHCPInfo
3737+ @discussion The functions of the SCDynamicStoreCopyDHCPInfo API
3838+ provide access to information returned by the DHCP or
3939+ BOOTP server.
4040+ */
4141+4242+4343+__BEGIN_DECLS
4444+4545+/*!
4646+ @function SCDynamicStoreCopyDHCPInfo
4747+ @discussion Copies the DHCP information for the requested serviceID,
4848+ or the primary service if serviceID == NULL.
4949+ @param store An SCDynamicStoreRef representing the dynamic store session
5050+ that should be used for communication with the server.
5151+ If NULL, a temporary session will be used.
5252+ @param serviceID A CFStringRef containing the requested service.
5353+ If NULL, returns information for the primary service.
5454+ @result Returns a dictionary containing DHCP information if successful;
5555+ NULL otherwise.
5656+ Use the DHCPInfoGetOption function to retrieve
5757+ individual options from the returned dictionary.
5858+5959+ A non-NULL return value must be released using CFRelease().
6060+ */
6161+CFDictionaryRef __nullable
6262+SCDynamicStoreCopyDHCPInfo (SCDynamicStoreRef __nullable store,
6363+ CFStringRef __nullable serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
6464+6565+/*!
6666+ @function DHCPInfoGetOptionData
6767+ @discussion Returns a non-NULL CFDataRef containing the DHCP
6868+ option data, if present.
6969+ @param info The non-NULL DHCP information dictionary returned by
7070+ calling SCDynamicStoreCopyDHCPInfo.
7171+ @param code The DHCP option code (see RFC 2132) to return
7272+ data for.
7373+ @result Returns a non-NULL CFDataRef containing the option data;
7474+ NULL if the requested option data is not present.
7575+7676+ The return value must NOT be released.
7777+ */
7878+CFDataRef __nullable
7979+DHCPInfoGetOptionData (CFDictionaryRef info,
8080+ UInt8 code) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
8181+8282+/*!
8383+ @function DHCPInfoGetLeaseStartTime
8484+ @discussion Returns a CFDateRef corresponding to the lease start time,
8585+ if present.
8686+ @param info The non-NULL DHCP information dictionary returned by
8787+ calling SCDynamicStoreCopyDHCPInfo.
8888+ @result Returns a non-NULL CFDateRef if lease start time information is
8989+ present; NULL if the information is not present or if the
9090+ configuration method is not DHCP.
9191+9292+ The return value must NOT be released.
9393+ */
9494+CFDateRef __nullable
9595+DHCPInfoGetLeaseStartTime (CFDictionaryRef info) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
9696+9797+9898+/*!
9999+ @function DHCPInfoGetLeaseExpirationTime
100100+ @discussion Returns a CFDateRef corresponding to the lease expiration time,
101101+ if present.
102102+ @param info The non-NULL DHCP information dictionary returned by
103103+ calling SCDynamicStoreCopyDHCPInfo.
104104+ @result Returns a non-NULL CFDateRef if the DHCP lease has an expiration;
105105+ NULL if the lease is infinite i.e. has no expiration, or the
106106+ configuration method is not DHCP. An infinite lease can be determined
107107+ by a non-NULL lease start time (see DHCPInfoGetLeaseStartTime above).
108108+109109+ The return value must NOT be released.
110110+*/
111111+CFDateRef __nullable
112112+DHCPInfoGetLeaseExpirationTime (CFDictionaryRef info) __OSX_AVAILABLE_STARTING(__MAC_10_8,__IPHONE_NA);
113113+114114+__END_DECLS
115115+116116+CF_ASSUME_NONNULL_END
117117+CF_IMPLICIT_BRIDGING_DISABLED
118118+119119+#endif /* _SCDYNAMICSTORECOPYDHCPINFO_H */
···11+/*
22+ * Copyright (c) 2000-2005, 2008, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCDYNAMICSTORECOPYSPECIFIC_H
2525+#define _SCDYNAMICSTORECOPYSPECIFIC_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <sys/types.h>
3030+#include <CoreFoundation/CoreFoundation.h>
3131+#include <SystemConfiguration/SCDynamicStore.h>
3232+3333+CF_IMPLICIT_BRIDGING_ENABLED
3434+CF_ASSUME_NONNULL_BEGIN
3535+3636+/*!
3737+ @header SCDynamicStoreCopySpecific
3838+ @discussion The functions of the SCDynamicStoreCopySpecific API
3939+ allow an application to determine specific configuration
4040+ information about the current system (for example, the
4141+ computer or sharing name, the currently logged-in user, etc.).
4242+ */
4343+4444+4545+__BEGIN_DECLS
4646+4747+/*!
4848+ @function SCDynamicStoreCopyComputerName
4949+ @discussion Gets the current computer name.
5050+ @param store An SCDynamicStoreRef representing the dynamic store
5151+ session that should be used for communication with the server.
5252+ If NULL, a temporary session will be used.
5353+ @param nameEncoding A pointer to memory that, if non-NULL, will be
5454+ filled with the encoding associated with the computer or
5555+ host name.
5656+ @result Returns the current computer name;
5757+ NULL if the name has not been set or if an error was encountered.
5858+ You must release the returned value.
5959+ */
6060+CFStringRef __nullable
6161+SCDynamicStoreCopyComputerName (
6262+ SCDynamicStoreRef __nullable store,
6363+ CFStringEncoding * __nullable nameEncoding
6464+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
6565+6666+/*!
6767+ @function SCDynamicStoreCopyConsoleUser
6868+ @discussion Gets the name, user ID, and group ID of the currently
6969+ logged-in user.
7070+7171+ Note: this function only provides information about the
7272+ primary console. It does not provide any details
7373+ about console sessions that have fast user switched
7474+ out or about other consoles.
7575+ @param store An SCDynamicStoreRef representing the dynamic store
7676+ session that should be used for communication with the server.
7777+ If NULL, a temporary session will be used.
7878+ @param uid A pointer to memory that will be filled with the user ID
7979+ of the current console user. If NULL, this value will not
8080+ be returned.
8181+ @param gid A pointer to memory that will be filled with the group ID
8282+ of the current console user. If NULL, this value will not be
8383+ returned.
8484+ @result Returns the user currently logged into the system;
8585+ NULL if no user is logged in or if an error was encountered.
8686+ You must release the returned value.
8787+ */
8888+CFStringRef __nullable
8989+SCDynamicStoreCopyConsoleUser (
9090+ SCDynamicStoreRef __nullable store,
9191+ uid_t * __nullable uid,
9292+ gid_t * __nullable gid
9393+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
9494+9595+/*!
9696+ @function SCDynamicStoreCopyLocalHostName
9797+ @discussion Gets the current local host name.
9898+ @param store An SCDynamicStoreRef representing the dynamic store
9999+ session that should be used for communication with the server.
100100+ If NULL, a temporary session will be used.
101101+ @result Returns the current local host name;
102102+ NULL if the name has not been set or if an error was encountered.
103103+ You must release the returned value.
104104+ */
105105+CFStringRef __nullable
106106+SCDynamicStoreCopyLocalHostName (
107107+ SCDynamicStoreRef __nullable store
108108+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
109109+110110+/*!
111111+ @function SCDynamicStoreCopyLocation
112112+ @discussion Gets the current location identifier.
113113+ @param store An SCDynamicStoreRef representing the dynamic store
114114+ session that should be used for communication with the server.
115115+ If NULL, a temporary session will be used.
116116+ @result Returns a string representing the current location identifier;
117117+ NULL if no location identifier has been defined or if an error
118118+ was encountered.
119119+ You must release the returned value.
120120+ */
121121+CFStringRef __nullable
122122+SCDynamicStoreCopyLocation (
123123+ SCDynamicStoreRef __nullable store
124124+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
125125+126126+/*!
127127+ @function SCDynamicStoreCopyProxies
128128+ @discussion Gets the current internet proxy settings.
129129+ The returned proxy settings dictionary includes:
130130+131131+ <TABLE BORDER>
132132+ <TR>
133133+ <TH>key</TD>
134134+ <TH>type</TD>
135135+ <TH>description</TD>
136136+ </TR>
137137+ <TR>
138138+ <TD>kSCPropNetProxiesExceptionsList</TD>
139139+ <TD>CFArray[CFString]</TD>
140140+ <TD>Host name patterns which should bypass the proxy</TD>
141141+ </TR>
142142+ <TR>
143143+ <TD>kSCPropNetProxiesHTTPEnable</TD>
144144+ <TD>CFNumber (0 or 1)</TD>
145145+ <TD>Enables/disables the use of an HTTP proxy</TD>
146146+ </TR>
147147+ <TR>
148148+ <TD>kSCPropNetProxiesHTTPProxy</TD>
149149+ <TD>CFString</TD>
150150+ <TD>The proxy host</TD>
151151+ </TR>
152152+ <TR>
153153+ <TD>kSCPropNetProxiesHTTPPort</TD>
154154+ <TD>CFNumber</TD>
155155+ <TD>The proxy port number</TD>
156156+ </TR>
157157+ <TR>
158158+ <TD>kSCPropNetProxiesHTTPSEnable</TD>
159159+ <TD>CFNumber (0 or 1)</TD>
160160+ <TD>Enables/disables the use of an HTTPS proxy</TD>
161161+ </TR>
162162+ <TR>
163163+ <TD>kSCPropNetProxiesHTTPSProxy</TD>
164164+ <TD>CFString</TD>
165165+ <TD>The proxy host</TD>
166166+ </TR>
167167+ <TR>
168168+ <TD>kSCPropNetProxiesHTTPSPort</TD>
169169+ <TD>CFNumber</TD>
170170+ <TD>The proxy port number</TD>
171171+ </TR>
172172+ <TR>
173173+ <TD>kSCPropNetProxiesFTPEnable</TD>
174174+ <TD>CFNumber (0 or 1)</TD>
175175+ <TD>Enables/disables the use of an FTP proxy</TD>
176176+ </TR>
177177+ <TR>
178178+ <TD>kSCPropNetProxiesFTPProxy</TD>
179179+ <TD>CFString</TD>
180180+ <TD>The proxy host</TD>
181181+ </TR>
182182+ <TR>
183183+ <TD>kSCPropNetProxiesFTPPort</TD>
184184+ <TD>CFNumber</TD>
185185+ <TD>The proxy port number</TD>
186186+ </TR>
187187+ <TR>
188188+ <TD>kSCPropNetProxiesFTPPassive</TD>
189189+ <TD>CFNumber (0 or 1)</TD>
190190+ <TD>Enable passive mode operation for use behind connection
191191+ filter-ing firewalls.</TD>
192192+ </TR>
193193+ </TABLE>
194194+195195+ Other key-value pairs are defined in the SCSchemaDefinitions.h
196196+ header file.
197197+ @param store An SCDynamicStoreRef representing the dynamic store
198198+ session that should be used for communication with the server.
199199+ If NULL, a temporary session will be used.
200200+ @result Returns a dictionary containing key-value pairs that represent
201201+ the current internet proxy settings;
202202+ NULL if no proxy settings have been defined or if an error
203203+ was encountered.
204204+ You must release the returned value.
205205+ */
206206+CFDictionaryRef __nullable
207207+SCDynamicStoreCopyProxies (
208208+ SCDynamicStoreRef __nullable store
209209+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
210210+211211+__END_DECLS
212212+213213+CF_ASSUME_NONNULL_END
214214+CF_IMPLICIT_BRIDGING_DISABLED
215215+216216+#endif /* _SCDYNAMICSTORECOPYSPECIFIC_H */
···11+/*
22+ * Copyright (c) 2000-2002, 2004, 2005, 2008, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCDYNAMICSTOREKEY_H
2525+#define _SCDYNAMICSTOREKEY_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CoreFoundation.h>
3030+3131+CF_IMPLICIT_BRIDGING_ENABLED
3232+CF_ASSUME_NONNULL_BEGIN
3333+3434+/*!
3535+ @header SCDynamicStoreKey
3636+ @discussion The SCDynamicStoreKey API provides convenience functions
3737+ that an application can use to create a correctly formatted
3838+ dynamic store key for accessing specific items in the dynamic
3939+ store. An application can then use the resulting string in
4040+ any function that requires a dynamic store key.
4141+ */
4242+4343+4444+__BEGIN_DECLS
4545+4646+/*
4747+ * SCDynamicStoreKeyCreate
4848+ * - convenience routines that create a CFString key for an item in the store
4949+ */
5050+5151+/*!
5252+ @function SCDynamicStoreKeyCreate
5353+ @discussion Creates a dynamic store key using the given format.
5454+ @param allocator The CFAllocator that should be used to allocate
5555+ memory for this key.
5656+ This parameter may be NULL in which case the current
5757+ default CFAllocator is used. If this reference is not
5858+ a valid CFAllocator, the behavior is undefined.
5959+ @param fmt A CFStringRef describing the format for this key.
6060+ @result Returns a string containing the formatted key.
6161+ */
6262+CFStringRef
6363+SCDynamicStoreKeyCreate (
6464+ CFAllocatorRef __nullable allocator,
6565+ CFStringRef fmt,
6666+ ...
6767+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
6868+6969+/*!
7070+ @function SCDynamicStoreKeyCreateNetworkGlobalEntity
7171+ @discussion Creates a dynamic store key that can be used to access
7272+ a specific global (as opposed to a per-service or per-interface)
7373+ network configuration entity.
7474+ @param allocator The CFAllocator that should be used to allocate
7575+ memory for this key.
7676+ This parameter may be NULL in which case the current
7777+ default CFAllocator is used. If this reference is not
7878+ a valid CFAllocator, the behavior is undefined.
7979+ @param domain A string specifying the desired domain, such as the
8080+ requested configuration (kSCDynamicStoreDomainSetup) or the
8181+ actual state (kSCDynamicStoreDomainState).
8282+ @param entity A string containing the specific global entity, such
8383+ as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
8484+ @result Returns a string containing the formatted key.
8585+8686+ */
8787+CFStringRef
8888+SCDynamicStoreKeyCreateNetworkGlobalEntity (
8989+ CFAllocatorRef __nullable allocator,
9090+ CFStringRef domain,
9191+ CFStringRef entity
9292+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
9393+9494+/*!
9595+ @function SCDynamicStoreKeyCreateNetworkInterface
9696+ @discussion Creates a dynamic store key that can be used to access
9797+ the network interface configuration information stored in
9898+ the dynamic store.
9999+ @param allocator The CFAllocator that should be used to allocate
100100+ memory for this key.
101101+ This parameter may be NULL in which case the current
102102+ default CFAllocator is used. If this reference is not
103103+ a valid CFAllocator, the behavior is undefined.
104104+ @param domain A string specifying the desired domain, such as the
105105+ requested configuration (kSCDynamicStoreDomainSetup) or the
106106+ actual state (kSCDynamicStoreDomainState).
107107+ @result Returns a string containing the formatted key.
108108+109109+ */
110110+CFStringRef
111111+SCDynamicStoreKeyCreateNetworkInterface (
112112+ CFAllocatorRef __nullable allocator,
113113+ CFStringRef domain
114114+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
115115+116116+/*!
117117+ @function SCDynamicStoreKeyCreateNetworkInterfaceEntity
118118+ @discussion Creates a dynamic store key that can be used to access
119119+ the per-interface network configuration information stored in
120120+ the dynamic store.
121121+ @param allocator The CFAllocator that should be used to allocate
122122+ memory for this key.
123123+ This parameter may be NULL in which case the current
124124+ default CFAllocator is used. If this reference is not
125125+ a valid CFAllocator, the behavior is undefined.
126126+ @param domain A string specifying the desired domain, such as the
127127+ requested configuration (kSCDynamicStoreDomainSetup) or the
128128+ actual state (kSCDynamicStoreDomainState).
129129+ @param ifname A string containing the interface name or a regular
130130+ expression pattern.
131131+ @param entity A string containing the specific global entity, such
132132+ as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
133133+ @result Returns a string containing the formatted key.
134134+135135+ */
136136+CFStringRef
137137+SCDynamicStoreKeyCreateNetworkInterfaceEntity (
138138+ CFAllocatorRef __nullable allocator,
139139+ CFStringRef domain,
140140+ CFStringRef ifname,
141141+ CFStringRef __nullable entity
142142+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
143143+144144+/*!
145145+ @function SCDynamicStoreKeyCreateNetworkServiceEntity
146146+ @discussion Creates a dynamic store key that can be used to access
147147+ the per-service network configuration information stored in
148148+ the dynamic store.
149149+ @param allocator The CFAllocator that should be used to allocate
150150+ memory for this key.
151151+ This parameter may be NULL in which case the current
152152+ default CFAllocator is used. If this reference is not
153153+ a valid CFAllocator, the behavior is undefined.
154154+ @param domain A string specifying the desired domain, such as the
155155+ requested configuration (kSCDynamicStoreDomainSetup) or the
156156+ actual state (kSCDynamicStoreDomainState).
157157+ @param serviceID A string containing the service ID or a regular
158158+ expression pattern.
159159+ @param entity A string containing the specific global entity, such
160160+ as IPv4 (kSCEntNetIPv4) or DNS (kSCEntNetDNS).
161161+ @result Returns a string containing the formatted key.
162162+163163+164164+ */
165165+CFStringRef
166166+SCDynamicStoreKeyCreateNetworkServiceEntity (
167167+ CFAllocatorRef __nullable allocator,
168168+ CFStringRef domain,
169169+ CFStringRef serviceID,
170170+ CFStringRef __nullable entity
171171+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
172172+173173+/*!
174174+ @function SCDynamicStoreKeyCreateComputerName
175175+ @discussion Creates a key that can be used in conjuntion with
176176+ SCDynamicStoreSetNotificationKeys function to receive
177177+ notifications when the current computer name changes.
178178+ @param allocator The CFAllocator that should be used to allocate
179179+ memory for this key.
180180+ This parameter may be NULL in which case the current
181181+ default CFAllocator is used. If this reference is not
182182+ a valid CFAllocator, the behavior is undefined.
183183+ @result Returns a notification string for the current computer or
184184+ host name.
185185+*/
186186+CFStringRef
187187+SCDynamicStoreKeyCreateComputerName (
188188+ CFAllocatorRef __nullable allocator
189189+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
190190+191191+/*!
192192+ @function SCDynamicStoreKeyCreateConsoleUser
193193+ @discussion Creates a key that can be used in conjunction with
194194+ SCDynamicStoreSetNotificationKeys function to receive
195195+ notifications when the current console user changes.
196196+ @param allocator The CFAllocator that should be used to allocate
197197+ memory for this key.
198198+ This parameter may be NULL in which case the current
199199+ default CFAllocator is used. If this reference is not
200200+ a valid CFAllocator, the behavior is undefined.
201201+ @result Returns a notification string for the current console user.
202202+*/
203203+CFStringRef
204204+SCDynamicStoreKeyCreateConsoleUser (
205205+ CFAllocatorRef __nullable allocator
206206+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
207207+208208+/*!
209209+ @function SCDynamicStoreKeyCreateHostNames
210210+ @discussion Creates a key that can be used in conjunction with the
211211+ SCDynamicStoreSetNotificationKeys function to receive
212212+ notifications when the HostNames entity changes. The
213213+ HostNames entity includes the local host name.
214214+ @param allocator The CFAllocator that should be used to allocate
215215+ memory for this key.
216216+ This parameter may be NULL in which case the current
217217+ default CFAllocator is used. If this reference is not
218218+ a valid CFAllocator, the behavior is undefined.
219219+ @result Returns a notification string for the HostNames entity.
220220+*/
221221+CFStringRef
222222+SCDynamicStoreKeyCreateHostNames (
223223+ CFAllocatorRef __nullable allocator
224224+ ) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA);
225225+226226+/*!
227227+ @function SCDynamicStoreKeyCreateLocation
228228+ @discussion Creates a key that can be used in conjunction with the
229229+ SCDynamicStoreSetNotificationKeys function to receive
230230+ notifications when the location identifier changes.
231231+ @param allocator The CFAllocator that should be used to allocate
232232+ memory for this key.
233233+ This parameter may be NULL in which case the current
234234+ default CFAllocator is used. If this reference is not
235235+ a valid CFAllocator, the behavior is undefined.
236236+ @result Returns a notification string for the current location
237237+ identifier.
238238+*/
239239+CFStringRef
240240+SCDynamicStoreKeyCreateLocation (
241241+ CFAllocatorRef __nullable allocator
242242+ ) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA);
243243+244244+/*!
245245+ @function SCDynamicStoreKeyCreateProxies
246246+ @discussion Creates a key that can be used in conjunction with
247247+ the SCDynamicStoreSetNotificationKeys function to receive
248248+ notifications when the current network proxy settings
249249+ (such as HTTP or FTP) are changed.
250250+ @param allocator The CFAllocator that should be used to allocate
251251+ memory for this key.
252252+ This parameter may be NULL in which case the current
253253+ default CFAllocator is used. If this reference is not
254254+ a valid CFAllocator, the behavior is undefined.
255255+ @result Returns a notification string for the current proxy settings.
256256+*/
257257+CFStringRef
258258+SCDynamicStoreKeyCreateProxies (
259259+ CFAllocatorRef __nullable allocator
260260+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
261261+262262+__END_DECLS
263263+264264+CF_ASSUME_NONNULL_END
265265+CF_IMPLICIT_BRIDGING_DISABLED
266266+267267+#endif /* _SCDYNAMICSTOREKEY_H */
···11+/*
22+ * Copyright (c) 2000, 2001, 2003-2009, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCNETWORK_H
2525+#define _SCNETWORK_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <sys/types.h>
3030+#include <sys/socket.h>
3131+#include <CoreFoundation/CoreFoundation.h>
3232+3333+CF_IMPLICIT_BRIDGING_ENABLED
3434+CF_ASSUME_NONNULL_BEGIN
3535+3636+/*!
3737+ @header SCNetwork
3838+ @discussion The SCNetwork API contains functions an application can
3939+ use to determine remote host reachability and notify the
4040+ system of configuration changes.
4141+4242+ The two SCNetworkCheckReachability functions allow an
4343+ application to determine the status of the system's current
4444+ network configuration and the reachability of a target host
4545+ or address.
4646+4747+ "Reachability" reflects whether a data packet, sent by an
4848+ application into the network stack, can leave the local
4949+ computer. Note that reachability does <i>not</i> guarantee
5050+ that the data packet will actually be received by the host.
5151+ */
5252+5353+/*!
5454+ @enum SCNetworkConnectionFlags
5555+ @discussion Flags that indicate whether the specified network
5656+ nodename or address is reachable, whether a connection is
5757+ required, and whether some user intervention may be required
5858+ when establishing a connection.
5959+6060+ Note: the SCNetworkConnection flags have been deprecated
6161+ in favor of the newer SCNetworkReachability flags defined
6262+ in SCNetworkReachability.h.
6363+ @constant kSCNetworkFlagsTransientConnection
6464+ This flag indicates that the specified nodename or address can
6565+ be reached via a transient connection, such as PPP.
6666+ @constant kSCNetworkFlagsReachable
6767+ This flag indicates that the specified nodename or address can
6868+ be reached using the current network configuration.
6969+ @constant kSCNetworkFlagsConnectionRequired
7070+ This flag indicates that the specified nodename or address can
7171+ be reached using the current network configuration, but a
7272+ connection must first be established.
7373+7474+ As an example, this status would be returned for a dialup
7575+ connection that was not currently active, but could handle
7676+ network traffic for the target system.
7777+ @constant kSCNetworkFlagsConnectionAutomatic
7878+ This flag indicates that the specified nodename or address can
7979+ be reached using the current network configuration, but a
8080+ connection must first be established. Any traffic directed
8181+ to the specified name or address will initiate the connection.
8282+ @constant kSCNetworkFlagsInterventionRequired
8383+ This flag indicates that the specified nodename or address can
8484+ be reached using the current network configuration, but a
8585+ connection must first be established. In addition, some
8686+ form of user intervention will be required to establish this
8787+ connection, such as providing a password, an authentication
8888+ token, etc.
8989+9090+ Note: At the present time, this flag will only be returned
9191+ in the case where you have a dial-on-traffic configuration
9292+ (ConnectionAutomatic), where an attempt to connect has
9393+ already been made, and where some error (e.g. no dial tone,
9494+ no answer, bad password, ...) was encountered during the
9595+ automatic connection attempt. In this case the PPP controller
9696+ will stop attempting to establish a connection until the user
9797+ has intervened.
9898+ @constant kSCNetworkFlagsIsLocalAddress
9999+ This flag indicates that the specified nodename or address
100100+ is one associated with a network interface on the current
101101+ system.
102102+ @constant kSCNetworkFlagsIsDirect
103103+ This flag indicates that network traffic to the specified
104104+ nodename or address will not go through a gateway, but is
105105+ routed directly to one of the interfaces in the system.
106106+ */
107107+enum {
108108+ kSCNetworkFlagsTransientConnection = 1<<0,
109109+ kSCNetworkFlagsReachable = 1<<1,
110110+ kSCNetworkFlagsConnectionRequired = 1<<2,
111111+ kSCNetworkFlagsConnectionAutomatic = 1<<3,
112112+ kSCNetworkFlagsInterventionRequired = 1<<4,
113113+ kSCNetworkFlagsIsLocalAddress = 1<<16,
114114+ kSCNetworkFlagsIsDirect = 1<<17,
115115+};
116116+typedef uint32_t SCNetworkConnectionFlags;
117117+118118+__BEGIN_DECLS
119119+120120+/*!
121121+ @function SCNetworkCheckReachabilityByAddress
122122+ @discussion Determines if the given network address is
123123+ reachable using the current network configuration.
124124+125125+ Note: this API has been deprecated but you can
126126+ get equivalent results with :
127127+<pre>
128128+ SCNetworkReachabilityRef target;
129129+ SCNetworkReachabilityFlags flags = 0;
130130+ Boolean ok;
131131+132132+ target = SCNetworkReachabilityCreateWithAddress(NULL, address);
133133+ ok = SCNetworkReachabilityGetFlags(target, &flags);
134134+ CFRelease(target);
135135+</pre>
136136+ @param address The network address of the desired host.
137137+ @param addrlen The length, in bytes, of the address.
138138+ @param flags A pointer to memory that will be filled with a
139139+ set of SCNetworkConnectionFlags detailing the reachability
140140+ of the specified address.
141141+ @result Returns TRUE if the network connection flags are valid;
142142+ FALSE if the status could not be determined.
143143+ */
144144+Boolean
145145+SCNetworkCheckReachabilityByAddress (
146146+ const struct sockaddr *address,
147147+ socklen_t addrlen,
148148+ SCNetworkConnectionFlags *flags
149149+ ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
150150+151151+/*!
152152+ @function SCNetworkCheckReachabilityByName
153153+ @discussion Determines if the given network host or node name is
154154+ reachable using the current network configuration.
155155+156156+ Note: this API has been deprecated but you can
157157+ get equivalent results with :
158158+<pre>
159159+ SCNetworkReachabilityRef target;
160160+ SCNetworkReachabilityFlags flags = 0;
161161+ Boolean ok;
162162+163163+ target = SCNetworkReachabilityCreateWithName(NULL, name);
164164+ ok = SCNetworkReachabilityGetFlags(target, &flags);
165165+ CFRelease(target);
166166+</pre>
167167+ @param nodename The node name of the desired host. This name would
168168+ be the same as that passed to the gethostbyname(3) or
169169+ getaddrinfo(3) functions.
170170+ @param flags A pointer to memory that will be filled with a
171171+ set of SCNetworkConnectionFlags detailing the reachability
172172+ of the specified node name.
173173+ @result Returns TRUE if the network connection flags are valid;
174174+ FALSE if the status could not be determined.
175175+ */
176176+Boolean
177177+SCNetworkCheckReachabilityByName (
178178+ const char *nodename,
179179+ SCNetworkConnectionFlags *flags
180180+ ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_6,__IPHONE_NA,__IPHONE_NA);
181181+182182+/*!
183183+ @function SCNetworkInterfaceRefreshConfiguration
184184+ @discussion Sends a notification to interested configuration agents
185185+ to have them immediately retry their configuration over a
186186+ particular network interface.
187187+188188+ Note: This function must be invoked by root (uid == 0).
189189+ @param ifName The BSD name of the network interface, such as
190190+ CFSTR("en0").
191191+ @result Returns TRUE if the notification was sent; FALSE otherwise.
192192+ @deprecated in version 10.4. Replaced with SCNetworkInterfaceForceConfigurationRefresh.
193193+ */
194194+Boolean
195195+SCNetworkInterfaceRefreshConfiguration (
196196+ CFStringRef ifName
197197+ ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_5,__IPHONE_NA,__IPHONE_NA);
198198+199199+__END_DECLS
200200+201201+CF_ASSUME_NONNULL_END
202202+CF_IMPLICIT_BRIDGING_DISABLED
203203+204204+#endif /* _SCNETWORK_H */
···11+/*
22+ * Copyright (c) 2004-2011, 2015, 2016 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCNETWORKCONFIGURATION_H
2525+#define _SCNETWORKCONFIGURATION_H
2626+2727+#include <Availability.h>
2828+#include <TargetConditionals.h>
2929+#include <sys/cdefs.h>
3030+#include <CoreFoundation/CoreFoundation.h>
3131+#include <SystemConfiguration/SystemConfiguration.h>
3232+3333+CF_IMPLICIT_BRIDGING_ENABLED
3434+CF_ASSUME_NONNULL_BEGIN
3535+3636+/*!
3737+ @header SCNetworkConfiguration
3838+ @discussion The SCNetworkConfiguration API provides access to the
3939+ stored network configuration. The functions include
4040+ providing access to the network capable devices on the
4141+ system, the network sets, network services, and network
4242+ protocols.
4343+4444+ Note: When using the SCNetworkConfiguraiton APIs you must
4545+ keep in mind that in order for any of your changes to be
4646+ committed to permanent storage a call must be made to the
4747+ SCPreferencesCommitChanges function.
4848+ */
4949+5050+5151+/*!
5252+ @group Interface configuration
5353+ */
5454+5555+#pragma mark -
5656+#pragma mark SCNetworkInterface configuration (typedefs, consts)
5757+5858+/*!
5959+ @typedef SCNetworkInterfaceRef
6060+ @discussion This is the type of a reference to an object that represents
6161+ a network interface.
6262+ */
6363+typedef const struct CF_BRIDGED_TYPE(id) __SCNetworkInterface * SCNetworkInterfaceRef;
6464+6565+/*!
6666+ @const kSCNetworkInterfaceType6to4
6767+ */
6868+extern const CFStringRef kSCNetworkInterfaceType6to4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
6969+7070+/*!
7171+ @const kSCNetworkInterfaceTypeBluetooth
7272+ */
7373+extern const CFStringRef kSCNetworkInterfaceTypeBluetooth __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
7474+7575+/*!
7676+ @const kSCNetworkInterfaceTypeBond
7777+ */
7878+extern const CFStringRef kSCNetworkInterfaceTypeBond __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
7979+8080+/*!
8181+ @const kSCNetworkInterfaceTypeEthernet
8282+ */
8383+extern const CFStringRef kSCNetworkInterfaceTypeEthernet __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
8484+8585+/*!
8686+ @const kSCNetworkInterfaceTypeFireWire
8787+ */
8888+extern const CFStringRef kSCNetworkInterfaceTypeFireWire __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
8989+9090+/*!
9191+ @const kSCNetworkInterfaceTypeIEEE80211
9292+ */
9393+extern const CFStringRef kSCNetworkInterfaceTypeIEEE80211 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); // IEEE 802.11, AirPort
9494+9595+/*!
9696+ @const kSCNetworkInterfaceTypeIPSec
9797+ */
9898+extern const CFStringRef kSCNetworkInterfaceTypeIPSec __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
9999+100100+/*!
101101+ @const kSCNetworkInterfaceTypeIrDA
102102+ */
103103+extern const CFStringRef kSCNetworkInterfaceTypeIrDA __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
104104+105105+/*!
106106+ @const kSCNetworkInterfaceTypeL2TP
107107+ */
108108+extern const CFStringRef kSCNetworkInterfaceTypeL2TP __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
109109+110110+/*!
111111+ @const kSCNetworkInterfaceTypeModem
112112+ */
113113+extern const CFStringRef kSCNetworkInterfaceTypeModem __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
114114+115115+/*!
116116+ @const kSCNetworkInterfaceTypePPP
117117+ */
118118+extern const CFStringRef kSCNetworkInterfaceTypePPP __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
119119+120120+/*!
121121+ @const kSCNetworkInterfaceTypePPTP
122122+ */
123123+extern const CFStringRef kSCNetworkInterfaceTypePPTP __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4,__MAC_10_12,__IPHONE_NA,__IPHONE_NA);
124124+125125+/*!
126126+ @const kSCNetworkInterfaceTypeSerial
127127+ */
128128+extern const CFStringRef kSCNetworkInterfaceTypeSerial __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
129129+130130+/*!
131131+ @const kSCNetworkInterfaceTypeVLAN
132132+ */
133133+extern const CFStringRef kSCNetworkInterfaceTypeVLAN __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
134134+135135+/*!
136136+ @const kSCNetworkInterfaceTypeWWAN
137137+ */
138138+extern const CFStringRef kSCNetworkInterfaceTypeWWAN __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
139139+140140+/* special network interfaces (and types) */
141141+142142+/*!
143143+ @const kSCNetworkInterfaceTypeIPv4
144144+ */
145145+extern const CFStringRef kSCNetworkInterfaceTypeIPv4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
146146+147147+/*!
148148+ @const kSCNetworkInterfaceIPv4
149149+ @discussion A network interface that can used for layering other
150150+ interfaces (e.g. 6to4, IPSec, PPTP, L2TP) over an existing
151151+ IPv4 network.
152152+ */
153153+extern const SCNetworkInterfaceRef kSCNetworkInterfaceIPv4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
154154+155155+/*!
156156+ @group Interface configuration (Bond)
157157+ */
158158+159159+#pragma mark -
160160+161161+/*!
162162+ @typedef SCBondInterfaceRef
163163+ @discussion This is the type of a reference to an object that represents
164164+ an Ethernet Bond interface.
165165+ */
166166+typedef SCNetworkInterfaceRef SCBondInterfaceRef;
167167+168168+/*!
169169+ @typedef SCBondStatusRef
170170+ @discussion This is the type of a reference to an object that represents
171171+ the status of an Ethernet Bond interface.
172172+ */
173173+typedef const struct CF_BRIDGED_TYPE(id) __SCBondStatus * SCBondStatusRef;
174174+175175+/*!
176176+ @enum Ethernet Bond Aggregation Status (kSCBondStatusDeviceAggregationStatus) codes
177177+ @discussion Returned status codes.
178178+ @constant kSCBondStatusOK Enabled, active, running, ...
179179+ @constant kSCBondStatusLinkInvalid The link state was not valid (i.e. down, half-duplex, wrong speed)
180180+ @constant kSCBondStatusNoPartner The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled
181181+ @constant kSCBondStatusNotInActiveGroup We're talking to a partner, but the link aggregation group is different from the one that's active
182182+ @constant kSCBondStatusUnknown Non-specific failure
183183+ */
184184+enum {
185185+ kSCBondStatusOK = 0, /* enabled, active, running, ... */
186186+ kSCBondStatusLinkInvalid = 1, /* The link state was not valid (i.e. down, half-duplex, wrong speed) */
187187+ kSCBondStatusNoPartner = 2, /* The port on the switch that the device is connected doesn't seem to have 802.3ad Link Aggregation enabled */
188188+ kSCBondStatusNotInActiveGroup = 3, /* We're talking to a partner, but the link aggregation group is different from the one that's active */
189189+ kSCBondStatusUnknown = 999 /* Non-specific failure */
190190+};
191191+192192+/*!
193193+ @const kSCBondStatusDeviceAggregationStatus
194194+ */
195195+extern const CFStringRef kSCBondStatusDeviceAggregationStatus /* CFNumber */ __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
196196+197197+/*!
198198+ @const kSCBondStatusDeviceCollecting
199199+ */
200200+extern const CFStringRef kSCBondStatusDeviceCollecting /* CFNumber (0 or 1) */ __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
201201+202202+/*!
203203+ @const kSCBondStatusDeviceDistributing
204204+ */
205205+extern const CFStringRef kSCBondStatusDeviceDistributing /* CFNumber (0 or 1) */ __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
206206+207207+/*!
208208+ @group Interface configuration (VLAN)
209209+ */
210210+211211+#pragma mark -
212212+213213+/*!
214214+ @typedef SCVLANInterfaceRef
215215+ @discussion This is the type of a reference to an object that represents
216216+ a Virtual LAN (VLAN) interface.
217217+ */
218218+typedef SCNetworkInterfaceRef SCVLANInterfaceRef;
219219+220220+221221+/*!
222222+ @group Protocol configuration
223223+ */
224224+225225+#pragma mark -
226226+#pragma mark SCNetworkProtocol configuration (typedefs, consts)
227227+228228+/*!
229229+ @typedef SCNetworkProtocolRef
230230+ @discussion This is the type of a reference to an object that represents
231231+ a network protocol.
232232+ */
233233+typedef const struct CF_BRIDGED_TYPE(id) __SCNetworkProtocol * SCNetworkProtocolRef;
234234+235235+/* network "protocol" types */
236236+237237+/*!
238238+ @const kSCNetworkProtocolTypeDNS
239239+ */
240240+extern const CFStringRef kSCNetworkProtocolTypeDNS __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
241241+242242+/*!
243243+ @const kSCNetworkProtocolTypeIPv4
244244+ */
245245+extern const CFStringRef kSCNetworkProtocolTypeIPv4 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
246246+247247+/*!
248248+ @const kSCNetworkProtocolTypeIPv6
249249+ */
250250+extern const CFStringRef kSCNetworkProtocolTypeIPv6 __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
251251+252252+/*!
253253+ @const kSCNetworkProtocolTypeProxies
254254+ */
255255+extern const CFStringRef kSCNetworkProtocolTypeProxies __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
256256+257257+/*!
258258+ @const kSCNetworkProtocolTypeSMB
259259+ */
260260+extern const CFStringRef kSCNetworkProtocolTypeSMB __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
261261+262262+/*!
263263+ @group Service configuration
264264+ */
265265+266266+#pragma mark -
267267+#pragma mark SCNetworkService configuration (typedefs, consts)
268268+269269+/*!
270270+ @typedef SCNetworkServiceRef
271271+ @discussion This is the type of a reference to an object that represents
272272+ a network service.
273273+ */
274274+typedef const struct CF_BRIDGED_TYPE(id) __SCNetworkService * SCNetworkServiceRef;
275275+276276+277277+/*!
278278+ @group Set configuration
279279+ */
280280+281281+#pragma mark -
282282+#pragma mark SCNetworkSet configuration (typedefs, consts)
283283+284284+/*!
285285+ @typedef SCNetworkSetRef
286286+ @discussion This is the type of a reference to an object that represents
287287+ a network set.
288288+ */
289289+typedef const struct CF_BRIDGED_TYPE(id) __SCNetworkSet * SCNetworkSetRef;
290290+291291+292292+__BEGIN_DECLS
293293+294294+295295+/* --------------------------------------------------------------------------------
296296+ * INTERFACES
297297+ * -------------------------------------------------------------------------------- */
298298+299299+/*!
300300+ @group Interface configuration
301301+ */
302302+303303+#pragma mark -
304304+#pragma mark SCNetworkInterface configuration (APIs)
305305+306306+/*!
307307+ @function SCNetworkInterfaceGetTypeID
308308+ @discussion Returns the type identifier of all SCNetworkInterface instances.
309309+ */
310310+CFTypeID
311311+SCNetworkInterfaceGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
312312+313313+/*!
314314+ @function SCNetworkInterfaceCopyAll
315315+ @discussion Returns all network capable interfaces on the system.
316316+ @result The list of interfaces on the system.
317317+ You must release the returned value.
318318+ */
319319+CFArrayRef /* of SCNetworkInterfaceRef's */
320320+SCNetworkInterfaceCopyAll (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
321321+322322+/*!
323323+ @function SCNetworkInterfaceGetSupportedInterfaceTypes
324324+ @discussion Identify all of the network interface types (e.g. PPP) that
325325+ can be layered on top of this interface.
326326+ @param interface The network interface.
327327+ @result The list of SCNetworkInterface types supported by the interface;
328328+ NULL if no interface types are supported.
329329+ */
330330+CFArrayRef /* of kSCNetworkInterfaceTypeXXX CFStringRef's */ __nullable
331331+SCNetworkInterfaceGetSupportedInterfaceTypes (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
332332+333333+/*!
334334+ @function SCNetworkInterfaceGetSupportedProtocolTypes
335335+ @discussion Identify all of the network protocol types (e.g. IPv4, IPv6) that
336336+ can be layered on top of this interface.
337337+ @param interface The network interface.
338338+ @result The list of SCNetworkProtocol types supported by the interface;
339339+ NULL if no protocol types are supported.
340340+ */
341341+CFArrayRef /* of kSCNetworkProtocolTypeXXX CFStringRef's */ __nullable
342342+SCNetworkInterfaceGetSupportedProtocolTypes (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
343343+344344+/*!
345345+ @function SCNetworkInterfaceCreateWithInterface
346346+ @discussion Create a new network interface layered on top of another. For
347347+ example, this function would be used to create a "PPP" interface
348348+ on top of a "modem".
349349+ @param interface The network interface.
350350+ @param interfaceType The type of SCNetworkInterface to be layered on
351351+ top of the provided interface.
352352+ @result A reference to the new SCNetworkInterface.
353353+ You must release the returned value.
354354+ */
355355+SCNetworkInterfaceRef __nullable
356356+SCNetworkInterfaceCreateWithInterface (SCNetworkInterfaceRef interface,
357357+ CFStringRef interfaceType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
358358+359359+/*!
360360+ @function SCNetworkInterfaceGetBSDName
361361+ @discussion Returns the BSD interface (en0) or device name (modem)
362362+ for the interface.
363363+ @param interface The network interface.
364364+ @result The BSD name associated with the interface (e.g. "en0");
365365+ NULL if no BSD name is available.
366366+ */
367367+CFStringRef __nullable
368368+SCNetworkInterfaceGetBSDName (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
369369+370370+/*!
371371+ @function SCNetworkInterfaceGetConfiguration
372372+ @discussion Returns the configuration settings associated with a interface.
373373+ @param interface The network interface.
374374+ @result The configuration settings associated with the interface;
375375+ NULL if no configuration settings are associated with the interface
376376+ or an error was encountered.
377377+ */
378378+CFDictionaryRef __nullable
379379+SCNetworkInterfaceGetConfiguration (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
380380+381381+/*!
382382+ @function SCNetworkInterfaceGetExtendedConfiguration
383383+ @discussion Returns the configuration settings associated with a interface.
384384+ @param interface The network interface.
385385+ @param extendedType A string representing the type of extended information (e.g. EAPOL).
386386+ @result The configuration settings associated with the interface;
387387+ NULL if no configuration settings are associated with the interface
388388+ or an error was encountered.
389389+ */
390390+CFDictionaryRef __nullable
391391+SCNetworkInterfaceGetExtendedConfiguration (SCNetworkInterfaceRef interface,
392392+ CFStringRef extendedType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
393393+394394+/*!
395395+ @function SCNetworkInterfaceGetHardwareAddressString
396396+ @discussion Returns a displayable link layer address for the interface.
397397+ @param interface The network interface.
398398+ @result A string representing the hardware (MAC) address for the interface.
399399+ */
400400+CFStringRef __nullable
401401+SCNetworkInterfaceGetHardwareAddressString (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
402402+403403+/*!
404404+ @function SCNetworkInterfaceGetInterface
405405+ @discussion For layered network interfaces, return the underlying interface.
406406+ @param interface The network interface.
407407+ @result The underlying network interface;
408408+ NULL if this is a leaf interface.
409409+ */
410410+SCNetworkInterfaceRef __nullable
411411+SCNetworkInterfaceGetInterface (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
412412+413413+/*!
414414+ @function SCNetworkInterfaceGetInterfaceType
415415+ @discussion Returns the associated network interface type.
416416+ @param interface The network interface.
417417+ @result The interface type.
418418+ */
419419+CFStringRef __nullable
420420+SCNetworkInterfaceGetInterfaceType (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
421421+422422+/*!
423423+ @function SCNetworkInterfaceGetLocalizedDisplayName
424424+ @discussion Returns the localized name (e.g. "Ethernet", "FireWire") for
425425+ the interface.
426426+ @param interface The network interface.
427427+ @result A localized, display name for the interface;
428428+ NULL if no name is available.
429429+ */
430430+CFStringRef __nullable
431431+SCNetworkInterfaceGetLocalizedDisplayName (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
432432+433433+/*!
434434+ @function SCNetworkInterfaceSetConfiguration
435435+ @discussion Stores the configuration settings for the interface.
436436+ @param interface The network interface.
437437+ @param config The configuration settings to associate with this interface.
438438+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
439439+ */
440440+Boolean
441441+SCNetworkInterfaceSetConfiguration (SCNetworkInterfaceRef interface,
442442+ CFDictionaryRef __nullable config) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
443443+444444+/*!
445445+ @function SCNetworkInterfaceSetExtendedConfiguration
446446+ @discussion Stores the configuration settings for the interface.
447447+ @param interface The network interface.
448448+ @param config The configuration settings to associate with this interface.
449449+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
450450+ */
451451+Boolean
452452+SCNetworkInterfaceSetExtendedConfiguration (SCNetworkInterfaceRef interface,
453453+ CFStringRef extendedType,
454454+ CFDictionaryRef __nullable config) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
455455+456456+#pragma mark -
457457+458458+/*!
459459+ @function SCNetworkInterfaceCopyMediaOptions
460460+ @discussion For the specified network interface, returns information
461461+ about the currently requested media options, the active media
462462+ options, and the media options which are available.
463463+ @param interface The desired network interface.
464464+ @param current A pointer to memory that will be filled with a CFDictionaryRef
465465+ representing the currently requested media options (subtype, options).
466466+ If NULL, the current options will not be returned.
467467+ @param active A pointer to memory that will be filled with a CFDictionaryRef
468468+ representing the active media options (subtype, options).
469469+ If NULL, the active options will not be returned.
470470+ @param available A pointer to memory that will be filled with a CFArrayRef
471471+ representing the possible media options (subtype, options).
472472+ If NULL, the available options will not be returned.
473473+ @param filter A boolean indicating whether the available options should be
474474+ filtered to exclude those options which would not normally be
475475+ requested by a user/admin (e.g. hw-loopback).
476476+ @result TRUE if requested information has been returned.
477477+ */
478478+Boolean
479479+SCNetworkInterfaceCopyMediaOptions (SCNetworkInterfaceRef interface,
480480+ CFDictionaryRef __nullable * __nullable current,
481481+ CFDictionaryRef __nullable * __nullable active,
482482+ CFArrayRef __nullable * __nullable available,
483483+ Boolean filter) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
484484+485485+/*!
486486+ @function SCNetworkInterfaceCopyMediaSubTypes
487487+ @discussion For the provided interface configuration options, return a list
488488+ of available media subtypes.
489489+ @param available The available options as returned by the
490490+ SCNetworkInterfaceCopyMediaOptions function.
491491+ @result An array of available media subtypes CFString's (e.g. 10BaseT/UTP,
492492+ 100baseTX, etc). NULL if no subtypes are available.
493493+ */
494494+CFArrayRef __nullable
495495+SCNetworkInterfaceCopyMediaSubTypes (CFArrayRef available) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
496496+497497+/*!
498498+ @function SCNetworkInterfaceCopyMediaSubTypeOptions
499499+ @discussion For the provided interface configuration options and specific
500500+ subtype, return a list of available media options.
501501+ @param available The available options as returned by the
502502+ SCNetworkInterfaceCopyMediaOptions function.
503503+ @param subType The subtype
504504+ @result An array of available media options. Each of the available options
505505+ is returned as an array of CFString's (e.g. <half-duplex>,
506506+ <full-duplex,flow-control>). NULL if no options are available.
507507+ */
508508+CFArrayRef __nullable
509509+SCNetworkInterfaceCopyMediaSubTypeOptions (CFArrayRef available,
510510+ CFStringRef subType) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
511511+512512+/*!
513513+ @function SCNetworkInterfaceCopyMTU
514514+ @discussion For the specified network interface, returns information
515515+ about the currently MTU setting and the range of allowable
516516+ values.
517517+ @param interface The desired network interface.
518518+ @param mtu_cur A pointer to memory that will be filled with the current
519519+ MTU setting for the interface.
520520+ @param mtu_min A pointer to memory that will be filled with the minimum
521521+ MTU setting for the interface. If negative, the minimum setting
522522+ could not be determined.
523523+ @param mtu_max A pointer to memory that will be filled with the maximum
524524+ MTU setting for the interface. If negative, the maximum setting
525525+ could not be determined.
526526+ @result TRUE if requested information has been returned.
527527+ */
528528+Boolean
529529+SCNetworkInterfaceCopyMTU (SCNetworkInterfaceRef interface,
530530+ int * __nullable mtu_cur,
531531+ int * __nullable mtu_min,
532532+ int * __nullable mtu_max) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
533533+534534+/*!
535535+ @function SCNetworkInterfaceSetMediaOptions
536536+ @discussion For the specified network interface, sets the requested
537537+ media subtype and options.
538538+ @param interface The desired network interface.
539539+ @param subtype The desired media subtype (e.g. "autoselect", "100baseTX", ...).
540540+ @param options The desired media options (e.g. "half-duplex", "full-duplex", ...).
541541+ @result TRUE if the configuration was updated; FALSE if an error was encountered.
542542+ */
543543+Boolean
544544+SCNetworkInterfaceSetMediaOptions (SCNetworkInterfaceRef interface,
545545+ CFStringRef subtype,
546546+ CFArrayRef options) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
547547+548548+/*!
549549+ @function SCNetworkInterfaceSetMTU
550550+ @discussion For the specified network interface, sets the
551551+ requested MTU setting.
552552+ @param interface The desired network interface.
553553+ @param mtu The desired MTU setting for the interface.
554554+ @result TRUE if the configuration was updated; FALSE if an error was encountered.
555555+ */
556556+Boolean
557557+SCNetworkInterfaceSetMTU (SCNetworkInterfaceRef interface,
558558+ int mtu) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
559559+560560+/*!
561561+ @function SCNetworkInterfaceForceConfigurationRefresh
562562+ @discussion Sends a notification to interested network configuration
563563+ agents to immediately retry their configuration. For example,
564564+ calling this function will cause the DHCP client to contact
565565+ the DHCP server immediately rather than waiting until its
566566+ timeout has expired. The utility of this function is to
567567+ allow the caller to give a hint to the system that the
568568+ network infrastructure or configuration has changed.
569569+570570+ Note: This function requires root (euid==0) privilege or,
571571+ alternatively, you may pass an SCNetworkInterface which
572572+ is derived from a sequence of calls to :
573573+574574+ SCPreferencesCreateWithAuthorization
575575+ SCNetworkSetCopy...
576576+ SCNetworkServiceGetInterface
577577+ @param interface The desired network interface.
578578+ @result Returns TRUE if the notification was sent; FALSE otherwise.
579579+ */
580580+Boolean
581581+SCNetworkInterfaceForceConfigurationRefresh (SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
582582+583583+/*!
584584+ @group Interface configuration (Bond)
585585+ */
586586+587587+#pragma mark -
588588+#pragma mark SCBondInterface configuration (APIs)
589589+590590+/*!
591591+ @function SCBondInterfaceCopyAll
592592+ @discussion Returns all Ethernet Bond interfaces on the system.
593593+ @param prefs The "preferences" session.
594594+ @result The list of Ethernet Bond interfaces on the system.
595595+ You must release the returned value.
596596+ */
597597+CFArrayRef /* of SCBondInterfaceRef's */
598598+SCBondInterfaceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
599599+600600+/*!
601601+ @function SCBondInterfaceCopyAvailableMemberInterfaces
602602+ @discussion Returns all network capable devices on the system
603603+ that can be added to an Ethernet Bond interface.
604604+ @param prefs The "preferences" session.
605605+ @result The list of interfaces.
606606+ You must release the returned value.
607607+ */
608608+CFArrayRef /* of SCNetworkInterfaceRef's */
609609+SCBondInterfaceCopyAvailableMemberInterfaces (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
610610+611611+/*!
612612+ @function SCBondInterfaceCreate
613613+ @discussion Create a new SCBondInterface interface.
614614+ @param prefs The "preferences" session.
615615+ @result A reference to the new SCBondInterface.
616616+ You must release the returned value.
617617+ */
618618+SCBondInterfaceRef __nullable
619619+SCBondInterfaceCreate (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
620620+621621+/*!
622622+ @function SCBondInterfaceRemove
623623+ @discussion Removes the SCBondInterface from the configuration.
624624+ @param bond The SCBondInterface interface.
625625+ @result TRUE if the interface was removed; FALSE if an error was encountered.
626626+ */
627627+Boolean
628628+SCBondInterfaceRemove (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
629629+630630+/*!
631631+ @function SCBondInterfaceGetMemberInterfaces
632632+ @discussion Returns the member interfaces for the specified Ethernet Bond interface.
633633+ @param bond The SCBondInterface interface.
634634+ @result The list of interfaces.
635635+ */
636636+CFArrayRef /* of SCNetworkInterfaceRef's */ __nullable
637637+SCBondInterfaceGetMemberInterfaces (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
638638+639639+/*!
640640+ @function SCBondInterfaceGetOptions
641641+ @discussion Returns the configuration settings associated with a Ethernet Bond interface.
642642+ @param bond The SCBondInterface interface.
643643+ @result The configuration settings associated with the Ethernet Bond interface;
644644+ NULL if no changes to the default configuration have been saved.
645645+ */
646646+CFDictionaryRef __nullable
647647+SCBondInterfaceGetOptions (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
648648+649649+/*!
650650+ @function SCBondInterfaceSetMemberInterfaces
651651+ @discussion Sets the member interfaces for the specified Ethernet Bond interface.
652652+ @param bond The SCBondInterface interface.
653653+ @param members The desired member interfaces.
654654+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
655655+ */
656656+Boolean
657657+SCBondInterfaceSetMemberInterfaces (SCBondInterfaceRef bond,
658658+ CFArrayRef members) /* of SCNetworkInterfaceRef's */
659659+ __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
660660+661661+/*!
662662+ @function SCBondInterfaceSetLocalizedDisplayName
663663+ @discussion Sets the localized display name for the specified Ethernet Bond interface.
664664+ @param bond The SCBondInterface interface.
665665+ @param newName The new display name.
666666+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
667667+ */
668668+Boolean
669669+SCBondInterfaceSetLocalizedDisplayName (SCBondInterfaceRef bond,
670670+ CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
671671+672672+/*!
673673+ @function SCBondInterfaceSetOptions
674674+ @discussion Sets the configuration settings for the specified Ethernet Bond interface.
675675+ @param bond The SCBondInterface interface.
676676+ @param newOptions The new configuration settings.
677677+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
678678+ */
679679+Boolean
680680+SCBondInterfaceSetOptions (SCBondInterfaceRef bond,
681681+ CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
682682+683683+#pragma mark -
684684+685685+/*!
686686+ @function SCBondInterfaceCopyStatus
687687+ @discussion Returns the status of the specified Ethernet Bond interface.
688688+ @param bond The SCBondInterface interface.
689689+ @result The status associated with the interface.
690690+ You must release the returned value.
691691+ */
692692+SCBondStatusRef __nullable
693693+SCBondInterfaceCopyStatus (SCBondInterfaceRef bond) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
694694+695695+/*!
696696+ @function SCBondStatusGetTypeID
697697+ @discussion Returns the type identifier of all SCBondStatus instances.
698698+ */
699699+CFTypeID
700700+SCBondStatusGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
701701+702702+/*!
703703+ @function SCBondStatusGetMemberInterfaces
704704+ @discussion Returns the member interfaces that are represented with the
705705+ Ethernet Bond interface.
706706+ @param bondStatus The Ethernet Bond status.
707707+ @result The list of interfaces.
708708+ */
709709+CFArrayRef __nullable /* of SCNetworkInterfaceRef's */
710710+SCBondStatusGetMemberInterfaces (SCBondStatusRef bondStatus) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
711711+712712+/*!
713713+ @function SCBondStatusGetInterfaceStatus
714714+ @discussion Returns the status of a specific member interface of an
715715+ Ethernet Bond or the status of the bond as a whole.
716716+ @param bondStatus The Ethernet Bond status.
717717+ @param interface The specific member interface; NULL if you want the
718718+ status of the Ethernet Bond.
719719+ @result The interface status.
720720+721721+ Note: at present, no information about the status of the Ethernet
722722+ Bond is returned. As long as one member interface is active
723723+ then the bond should be operational.
724724+ */
725725+CFDictionaryRef __nullable
726726+SCBondStatusGetInterfaceStatus (SCBondStatusRef bondStatus,
727727+ SCNetworkInterfaceRef __nullable interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
728728+729729+/*!
730730+ @group Interface configuration (VLAN)
731731+ */
732732+733733+#pragma mark -
734734+#pragma mark SCVLANInterface configuration (APIs)
735735+736736+/*!
737737+ @function SCVLANInterfaceCopyAll
738738+ @discussion Returns all VLAN interfaces on the system.
739739+ @result The list of VLAN interfaces on the system.
740740+ You must release the returned value.
741741+ */
742742+CFArrayRef /* of SCVLANInterfaceRef's */
743743+SCVLANInterfaceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
744744+745745+/*!
746746+ @function SCVLANInterfaceCopyAvailablePhysicalInterfaces
747747+ @discussion Returns the network capable devices on the system
748748+ that can be associated with a VLAN interface.
749749+ @result The list of interfaces.
750750+ You must release the returned value.
751751+ */
752752+CFArrayRef /* of SCNetworkInterfaceRef's */
753753+SCVLANInterfaceCopyAvailablePhysicalInterfaces (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
754754+755755+/*!
756756+ @function SCVLANInterfaceCreate
757757+ @discussion Create a new SCVLANInterface interface.
758758+ @param prefs The "preferences" session.
759759+ @param physical The physical interface to associate with the VLAN.
760760+ @param tag The tag to associate with the VLAN.
761761+ @result A reference to the new SCVLANInterface.
762762+ You must release the returned value.
763763+764764+ Note: the tag must be in the range (1 <= tag <= 4094)
765765+ */
766766+SCVLANInterfaceRef __nullable
767767+SCVLANInterfaceCreate (SCPreferencesRef prefs,
768768+ SCNetworkInterfaceRef physical,
769769+ CFNumberRef tag) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
770770+771771+/*!
772772+ @function SCVLANInterfaceRemove
773773+ @discussion Removes the SCVLANInterface from the configuration.
774774+ @param vlan The SCVLANInterface interface.
775775+ @result TRUE if the interface was removed; FALSE if an error was encountered.
776776+ */
777777+Boolean
778778+SCVLANInterfaceRemove (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
779779+780780+/*!
781781+ @function SCVLANInterfaceGetPhysicalInterface
782782+ @discussion Returns the physical interface for the specified VLAN interface.
783783+ @param vlan The SCVLANInterface interface.
784784+ @result The list of interfaces.
785785+ */
786786+SCNetworkInterfaceRef __nullable
787787+SCVLANInterfaceGetPhysicalInterface (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
788788+789789+/*!
790790+ @function SCVLANInterfaceGetTag
791791+ @discussion Returns the tag for the specified VLAN interface.
792792+ @param vlan The SCVLANInterface interface.
793793+ @result The tag.
794794+ */
795795+CFNumberRef __nullable
796796+SCVLANInterfaceGetTag (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
797797+798798+/*!
799799+ @function SCVLANInterfaceGetOptions
800800+ @discussion Returns the configuration settings associated with the VLAN interface.
801801+ @param vlan The SCVLANInterface interface.
802802+ @result The configuration settings associated with the VLAN interface;
803803+ NULL if no changes to the default configuration have been saved.
804804+ */
805805+CFDictionaryRef __nullable
806806+SCVLANInterfaceGetOptions (SCVLANInterfaceRef vlan) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
807807+808808+/*!
809809+ @function SCVLANInterfaceSetPhysicalInterfaceAndTag
810810+ @discussion Updates the specified VLAN interface.
811811+ @param vlan The SCVLANInterface interface.
812812+ @param physical The physical interface to associate with the VLAN.
813813+ @param tag The tag to associate with the VLAN.
814814+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
815815+816816+ Note: the tag must be in the range (1 <= tag <= 4094)
817817+ */
818818+Boolean
819819+SCVLANInterfaceSetPhysicalInterfaceAndTag (SCVLANInterfaceRef vlan,
820820+ SCNetworkInterfaceRef physical,
821821+ CFNumberRef tag) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
822822+823823+/*!
824824+ @function SCVLANInterfaceSetLocalizedDisplayName
825825+ @discussion Sets the localized display name for the specified VLAN interface.
826826+ @param vlan The SCVLANInterface interface.
827827+ @param newName The new display name.
828828+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
829829+ */
830830+Boolean
831831+SCVLANInterfaceSetLocalizedDisplayName (SCVLANInterfaceRef vlan,
832832+ CFStringRef newName) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
833833+834834+/*!
835835+ @function SCVLANInterfaceSetOptions
836836+ @discussion Sets the configuration settings for the specified VLAN interface.
837837+ @param vlan The SCVLANInterface interface.
838838+ @param newOptions The new configuration settings.
839839+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
840840+ */
841841+Boolean
842842+SCVLANInterfaceSetOptions (SCVLANInterfaceRef vlan,
843843+ CFDictionaryRef newOptions) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
844844+845845+846846+/* --------------------------------------------------------------------------------
847847+ * PROTOCOLS
848848+ * -------------------------------------------------------------------------------- */
849849+850850+/*!
851851+ @group Protocol configuration
852852+ */
853853+854854+#pragma mark -
855855+#pragma mark SCNetworkProtocol configuration (APIs)
856856+857857+/*!
858858+ @function SCNetworkProtocolGetTypeID
859859+ @discussion Returns the type identifier of all SCNetworkProtocol instances.
860860+ */
861861+CFTypeID
862862+SCNetworkProtocolGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
863863+864864+/*!
865865+ @function SCNetworkProtocolGetConfiguration
866866+ @discussion Returns the configuration settings associated with the protocol.
867867+ @param protocol The network protocol.
868868+ @result The configuration settings associated with the protocol;
869869+ NULL if no configuration settings are associated with the protocol
870870+ or an error was encountered.
871871+ */
872872+CFDictionaryRef __nullable
873873+SCNetworkProtocolGetConfiguration (SCNetworkProtocolRef protocol) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
874874+875875+/*!
876876+ @function SCNetworkProtocolGetEnabled
877877+ @discussion Returns whether this protocol has been enabled.
878878+ @param protocol The network protocol.
879879+ @result TRUE if the protocol is enabled.
880880+ */
881881+Boolean
882882+SCNetworkProtocolGetEnabled (SCNetworkProtocolRef protocol) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
883883+884884+/*!
885885+ @function SCNetworkProtocolGetProtocolType
886886+ @discussion Returns the associated network protocol type.
887887+ @param protocol The network protocol.
888888+ @result The protocol type.
889889+ */
890890+CFStringRef __nullable
891891+SCNetworkProtocolGetProtocolType (SCNetworkProtocolRef protocol) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
892892+893893+/*!
894894+ @function SCNetworkProtocolSetConfiguration
895895+ @discussion Stores the configuration settings for the protocol.
896896+ @param protocol The network protocol.
897897+ @param config The configuration settings to associate with this protocol.
898898+ @result TRUE if the configuration was stored; FALSE if an error was encountered.
899899+ */
900900+Boolean
901901+SCNetworkProtocolSetConfiguration (SCNetworkProtocolRef protocol,
902902+ CFDictionaryRef __nullable config) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
903903+904904+/*!
905905+ @function SCNetworkProtocolSetEnabled
906906+ @discussion Enables or disables the protocol.
907907+ @param protocol The network protocol.
908908+ @param enabled TRUE if the protocol should be enabled.
909909+ @result TRUE if the enabled status was saved; FALSE if an error was encountered.
910910+ */
911911+Boolean
912912+SCNetworkProtocolSetEnabled (SCNetworkProtocolRef protocol,
913913+ Boolean enabled) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
914914+915915+/* --------------------------------------------------------------------------------
916916+ * SERVICES
917917+ * -------------------------------------------------------------------------------- */
918918+919919+/*!
920920+ @group Service configuration
921921+ */
922922+923923+#pragma mark -
924924+#pragma mark SCNetworkService configuration (APIs)
925925+926926+/*!
927927+ @function SCNetworkServiceGetTypeID
928928+ @discussion Returns the type identifier of all SCNetworkService instances.
929929+ */
930930+CFTypeID
931931+SCNetworkServiceGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
932932+933933+/*!
934934+ @function SCNetworkServiceAddProtocolType
935935+ @discussion Adds a network protocol of the specified type to the
936936+ service. The protocal configuration is set to default values
937937+ that are appropriate for the interface associated with the
938938+ service.
939939+ @param service The network service.
940940+ @param protocolType The type of SCNetworkProtocol to be added to the service.
941941+ @result TRUE if the protocol was added to the service; FALSE if the
942942+ protocol was already present or an error was encountered.
943943+ */
944944+Boolean
945945+SCNetworkServiceAddProtocolType (SCNetworkServiceRef service,
946946+ CFStringRef protocolType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
947947+948948+/*!
949949+ @function SCNetworkServiceCopyAll
950950+ @discussion Returns all available network services for the specified preferences.
951951+ @param prefs The "preferences" session.
952952+ @result The list of SCNetworkService services associated with the preferences.
953953+ You must release the returned value.
954954+ */
955955+CFArrayRef /* of SCNetworkServiceRef's */ __nullable
956956+SCNetworkServiceCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
957957+958958+/*!
959959+ @function SCNetworkServiceCopyProtocols
960960+ @discussion Returns all network protocols associated with the service.
961961+ @param service The network service.
962962+ @result The list of SCNetworkProtocol protocols associated with the service.
963963+ You must release the returned value.
964964+ */
965965+CFArrayRef /* of SCNetworkProtocolRef's */ __nullable
966966+SCNetworkServiceCopyProtocols (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
967967+968968+/*!
969969+ @function SCNetworkServiceCreate
970970+ @discussion Create a new network service for the specified interface in the
971971+ configuration.
972972+ @param prefs The "preferences" session.
973973+ @result A reference to the new SCNetworkService.
974974+ You must release the returned value.
975975+ */
976976+SCNetworkServiceRef __nullable
977977+SCNetworkServiceCreate (SCPreferencesRef prefs,
978978+ SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
979979+980980+/*!
981981+ @function SCNetworkServiceCopy
982982+ @discussion Returns the network service with the specified identifier.
983983+ @param prefs The "preferences" session.
984984+ @param serviceID The unique identifier for the service.
985985+ @result A reference to the SCNetworkService from the associated preferences;
986986+ NULL if the serviceID does not exist in the preferences or if an
987987+ error was encountered.
988988+ You must release the returned value.
989989+ */
990990+SCNetworkServiceRef __nullable
991991+SCNetworkServiceCopy (SCPreferencesRef prefs,
992992+ CFStringRef serviceID) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
993993+994994+/*!
995995+ @function SCNetworkServiceEstablishDefaultConfiguration
996996+ @discussion Establishes the "default" configuration for a network
997997+ service. This configuration includes the addition of
998998+ network protocols for the service (with "default"
999999+ configuration options).
10001000+ @param service The network service.
10011001+ @result TRUE if the configuration was updated; FALSE if an error was encountered.
10021002+*/
10031003+Boolean
10041004+SCNetworkServiceEstablishDefaultConfiguration (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
10051005+10061006+/*!
10071007+ @function SCNetworkServiceGetEnabled
10081008+ @discussion Returns whether this service has been enabled.
10091009+ @param service The network service.
10101010+ @result TRUE if the service is enabled.
10111011+ */
10121012+Boolean
10131013+SCNetworkServiceGetEnabled (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10141014+10151015+/*!
10161016+ @function SCNetworkServiceGetInterface
10171017+ @discussion Returns the network interface associated with the service.
10181018+ @param service The network service.
10191019+ @result A reference to the SCNetworkInterface associated with the service;
10201020+ NULL if an error was encountered.
10211021+ */
10221022+SCNetworkInterfaceRef __nullable
10231023+SCNetworkServiceGetInterface (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10241024+10251025+/*!
10261026+ @function SCNetworkServiceGetName
10271027+ @discussion Returns the [user specified] name associated with the service.
10281028+ @param service The network service.
10291029+ @result The [user specified] name.
10301030+ */
10311031+CFStringRef __nullable
10321032+SCNetworkServiceGetName (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10331033+10341034+/*!
10351035+ @function SCNetworkServiceCopyProtocol
10361036+ @discussion Returns the network protocol of the specified type for
10371037+ the service.
10381038+ @param service The network service.
10391039+ @result A reference to the SCNetworkProtocol associated with the service;
10401040+ NULL if this protocol has not been added or if an error was encountered.
10411041+ You must release the returned value.
10421042+ */
10431043+SCNetworkProtocolRef __nullable
10441044+SCNetworkServiceCopyProtocol (SCNetworkServiceRef service,
10451045+ CFStringRef protocolType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10461046+10471047+/*!
10481048+ @function SCNetworkServiceGetServiceID
10491049+ @discussion Returns the identifier for the service.
10501050+ @param service The network service.
10511051+ @result The service identifier.
10521052+ */
10531053+CFStringRef __nullable
10541054+SCNetworkServiceGetServiceID (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10551055+10561056+/*!
10571057+ @function SCNetworkServiceRemove
10581058+ @discussion Removes the network service from the configuration.
10591059+ @param service The network service.
10601060+ @result TRUE if the service was removed; FALSE if an error was encountered.
10611061+ */
10621062+Boolean
10631063+SCNetworkServiceRemove (SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10641064+10651065+/*!
10661066+ @function SCNetworkServiceRemoveProtocolType
10671067+ @discussion Removes the network protocol of the specified type from the service.
10681068+ @param service The network service.
10691069+ @param protocolType The type of SCNetworkProtocol to be removed from the service.
10701070+ @result TRUE if the protocol was removed to the service; FALSE if the
10711071+ protocol was not configured or an error was encountered.
10721072+ */
10731073+Boolean
10741074+SCNetworkServiceRemoveProtocolType (SCNetworkServiceRef service,
10751075+ CFStringRef protocolType) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10761076+10771077+/*!
10781078+ @function SCNetworkServiceSetEnabled
10791079+ @discussion Enables or disables the service.
10801080+ @param service The network service.
10811081+ @param enabled TRUE if the service should be enabled.
10821082+ @result TRUE if the enabled status was saved; FALSE if an error was encountered.
10831083+ */
10841084+Boolean
10851085+SCNetworkServiceSetEnabled (SCNetworkServiceRef service,
10861086+ Boolean enabled) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
10871087+10881088+/*!
10891089+ @function SCNetworkServiceSetName
10901090+ @discussion Stores the [user specified] name for the service.
10911091+ @param service The network service.
10921092+ @param name The [user defined] name to associate with the service.
10931093+ @result TRUE if the name was saved; FALSE if an error was encountered.
10941094+10951095+ Note: although not technically required, the [user specified] names
10961096+ for all services within any given set should be unique. As such, an
10971097+ error will be returned if you attemp to name two services with the
10981098+ same string.
10991099+ */
11001100+Boolean
11011101+SCNetworkServiceSetName (SCNetworkServiceRef service,
11021102+ CFStringRef __nullable name) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11031103+11041104+11051105+/* --------------------------------------------------------------------------------
11061106+ * SETS
11071107+ * -------------------------------------------------------------------------------- */
11081108+11091109+/*!
11101110+ @group Set configuration
11111111+ */
11121112+11131113+#pragma mark -
11141114+#pragma mark SCNetworkSet configuration (APIs)
11151115+11161116+/*!
11171117+ @function SCNetworkSetGetTypeID
11181118+ @discussion Returns the type identifier of all SCNetworkSet instances.
11191119+ */
11201120+CFTypeID
11211121+SCNetworkSetGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11221122+11231123+/*!
11241124+ @function SCNetworkSetAddService
11251125+ @discussion Adds the network service to the set.
11261126+ @param set The network set.
11271127+ @param service The service to be added.
11281128+ @result TRUE if the service was added to the set; FALSE if the
11291129+ service was already present or an error was encountered.
11301130+11311131+ Note: prior to Mac OS X 10.5, the Network Preferences UI
11321132+ did not support having a single service being a member of
11331133+ more than one set. An error will be returned if you attempt
11341134+ to add a service to more than one set on a pre-10.5 system.
11351135+ */
11361136+Boolean
11371137+SCNetworkSetAddService (SCNetworkSetRef set,
11381138+ SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11391139+11401140+/*!
11411141+ @function SCNetworkSetContainsInterface
11421142+ @discussion Checks if an interface is represented by at least one
11431143+ network service in the specified set.
11441144+ @param set The network set.
11451145+ @param interface The network interface.
11461146+ @result TRUE if the interface is represented in the set; FALSE if not.
11471147+ */
11481148+Boolean
11491149+SCNetworkSetContainsInterface (SCNetworkSetRef set,
11501150+ SCNetworkInterfaceRef interface) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
11511151+11521152+/*!
11531153+ @function SCNetworkSetCopyAll
11541154+ @discussion Returns all available sets for the specified preferences.
11551155+ @param prefs The "preferences" session.
11561156+ @result The list of SCNetworkSet sets associated with the preferences.
11571157+ You must release the returned value.
11581158+ */
11591159+CFArrayRef /* of SCNetworkSetRef's */ __nullable
11601160+SCNetworkSetCopyAll (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11611161+11621162+/*!
11631163+ @function SCNetworkSetCopyCurrent
11641164+ @discussion Returns the "current" set.
11651165+ @param prefs The "preferences" session.
11661166+ @result The current set; NULL if no current set has been defined.
11671167+ */
11681168+SCNetworkSetRef __nullable
11691169+SCNetworkSetCopyCurrent (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11701170+11711171+/*!
11721172+ @function SCNetworkSetCopyServices
11731173+ @discussion Returns all network services associated with the set.
11741174+ @param set The network set.
11751175+ @result The list of SCNetworkService services associated with the set.
11761176+ You must release the returned value.
11771177+ */
11781178+CFArrayRef /* of SCNetworkServiceRef's */ __nullable
11791179+SCNetworkSetCopyServices (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11801180+11811181+/*!
11821182+ @function SCNetworkSetCreate
11831183+ @discussion Create a new set in the configuration.
11841184+ @param prefs The "preferences" session.
11851185+ @result A reference to the new SCNetworkSet.
11861186+ You must release the returned value.
11871187+ */
11881188+SCNetworkSetRef __nullable
11891189+SCNetworkSetCreate (SCPreferencesRef prefs) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
11901190+11911191+/*!
11921192+ @function SCNetworkSetCopy
11931193+ @discussion Returns the set with the specified identifier.
11941194+ @param prefs The "preferences" session.
11951195+ @param setID The unique identifier for the set.
11961196+ @result A reference to the SCNetworkSet from the associated preferences;
11971197+ NULL if the setID does not exist in the preferences or if an
11981198+ error was encountered.
11991199+ You must release the returned value.
12001200+ */
12011201+SCNetworkSetRef __nullable
12021202+SCNetworkSetCopy (SCPreferencesRef prefs,
12031203+ CFStringRef setID) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12041204+12051205+/*!
12061206+ @function SCNetworkSetGetName
12071207+ @discussion Returns the [user specified] name associated with the set.
12081208+ @param set The network set.
12091209+ @result The [user specified] name.
12101210+ */
12111211+CFStringRef __nullable
12121212+SCNetworkSetGetName (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12131213+12141214+/*!
12151215+ @function SCNetworkSetGetSetID
12161216+ @discussion Returns the identifier for the set.
12171217+ @param set The network set.
12181218+ @result The set identifier.
12191219+ */
12201220+CFStringRef __nullable
12211221+SCNetworkSetGetSetID (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12221222+12231223+/*!
12241224+ @function SCNetworkSetGetServiceOrder
12251225+ @discussion Returns the [user specified] ordering of network services
12261226+ within the set.
12271227+ @param set The network set.
12281228+ @result The ordered list of CFStringRef service identifiers associated
12291229+ with the set;
12301230+ NULL if no service order has been specified or if an error
12311231+ was encountered.
12321232+ */
12331233+CFArrayRef /* of serviceID CFStringRef's */ __nullable
12341234+SCNetworkSetGetServiceOrder (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12351235+12361236+/*!
12371237+ @function SCNetworkSetRemove
12381238+ @discussion Removes the set from the configuration.
12391239+ @param set The network set.
12401240+ @result TRUE if the set was removed; FALSE if an error was encountered.
12411241+ */
12421242+Boolean
12431243+SCNetworkSetRemove (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12441244+12451245+/*!
12461246+ @function SCNetworkSetRemoveService
12471247+ @discussion Removes the network service from the set.
12481248+ @param set The network set.
12491249+ @param service The service to be removed.
12501250+ @result TRUE if the service was removed from the set; FALSE if the
12511251+ service was not already present or an error was encountered.
12521252+ */
12531253+Boolean
12541254+SCNetworkSetRemoveService (SCNetworkSetRef set,
12551255+ SCNetworkServiceRef service) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12561256+12571257+/*!
12581258+ @function SCNetworkSetSetCurrent
12591259+ @discussion Specifies the set that should be the "current" set.
12601260+ @param set The network set.
12611261+ @result TRUE if the current set was updated;
12621262+ FALSE if an error was encountered.
12631263+ */
12641264+Boolean
12651265+SCNetworkSetSetCurrent (SCNetworkSetRef set) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12661266+12671267+/*!
12681268+ @function SCNetworkSetSetName
12691269+ @discussion Stores the [user specified] name for the set.
12701270+ @param set The network set.
12711271+ @param name The [user defined] name to associate with the set.
12721272+ @result TRUE if the name was saved; FALSE if an error was encountered.
12731273+12741274+ Note: although not technically required, the [user specified] names
12751275+ for all set should be unique. As such, an error will be returned if
12761276+ you attemp to name two sets with the same string.
12771277+ */
12781278+Boolean
12791279+SCNetworkSetSetName (SCNetworkSetRef set,
12801280+ CFStringRef __nullable name) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
12811281+12821282+/*!
12831283+ @function SCNetworkSetSetServiceOrder
12841284+ @discussion Stores the [user specified] ordering of network services for the set.
12851285+ @param set The network set.
12861286+ @param newOrder The ordered list of CFStringRef service identifiers for the set.
12871287+ @result TRUE if the new service order was saved; FALSE if an error was encountered.
12881288+ */
12891289+Boolean
12901290+SCNetworkSetSetServiceOrder (SCNetworkSetRef set,
12911291+ CFArrayRef newOrder) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA); /* serviceID CFStringRef's */
12921292+12931293+12941294+__END_DECLS
12951295+12961296+CF_ASSUME_NONNULL_END
12971297+CF_IMPLICIT_BRIDGING_DISABLED
12981298+12991299+#endif /* _SCNETWORKCONFIGURATION_H */
···11+/*
22+ * Copyright (c) 2003-2006, 2008-2010, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCNETWORKCONNECTION_H
2525+#define _SCNETWORKCONNECTION_H
2626+2727+#include <Availability.h>
2828+#include <TargetConditionals.h>
2929+#include <sys/cdefs.h>
3030+#include <dispatch/dispatch.h>
3131+#include <sys/types.h>
3232+#include <sys/socket.h>
3333+#include <CoreFoundation/CoreFoundation.h>
3434+#include <SystemConfiguration/SystemConfiguration.h>
3535+3636+CF_IMPLICIT_BRIDGING_ENABLED
3737+CF_ASSUME_NONNULL_BEGIN
3838+3939+/*!
4040+ @header SCNetworkConnection
4141+ @discussion The SCNetworkConnection API contains functions that allow
4242+ an application to control connection-oriented services defined
4343+ in the system and get connection-status information.
4444+4545+ The functions in the SCNetworkConnection API allow you to
4646+ control and get information about existing services only.
4747+ If you need to create, change, or remove services, you
4848+ should use the SCNetworkConfiguration API instead.
4949+5050+ Note: Currently, only PPP services can be controlled.
5151+ */
5252+5353+5454+/*!
5555+ @typedef SCNetworkConnectionRef
5656+ @discussion This is the handle to manage a connection-oriented service.
5757+ */
5858+typedef const struct CF_BRIDGED_TYPE(id) __SCNetworkConnection * SCNetworkConnectionRef;
5959+6060+6161+/*!
6262+ @typedef SCNetworkConnectionContext
6363+ @discussion Structure containing user-specified data and callbacks
6464+ for a SCNetworkConnection.
6565+ @field version The version number of the structure type being passed
6666+ in as a parameter to the SCNetworkConnectionCreateWithServiceID
6767+ function. This structure is version 0.
6868+ @field info A C pointer to a user-specified block of data.
6969+ @field retain The callback used to add a retain for the info field.
7070+ If this parameter is not a pointer to a function of the correct
7171+ prototype, the behavior is undefined. The value may be NULL.
7272+ @field release The calllback used to remove a retain previously added
7373+ for the info field. If this parameter is not a pointer to a
7474+ function of the correct prototype, the behavior is undefined.
7575+ The value may be NULL.
7676+ @field copyDescription The callback used to provide a description of
7777+ the info field.
7878+ */
7979+typedef struct {
8080+ CFIndex version;
8181+ void * __nullable info;
8282+ const void * __nonnull (* __nullable retain)(const void *info);
8383+ void (* __nullable release)(const void *info);
8484+ CFStringRef __nonnull (* __nullable copyDescription)(const void *info);
8585+} SCNetworkConnectionContext;
8686+8787+8888+8989+/*!
9090+ @enum SCNetworkConnectionStatus
9191+ @discussion Status of the network connection.
9292+ This status is intended to be generic and high level.
9393+ An extended status, specific to the type of network
9494+ connection is also available for applications that
9595+ need additonal information.
9696+ @constant kSCNetworkConnectionInvalid
9797+ The network connection refers to an invalid service.
9898+ @constant kSCNetworkConnectionDisconnected
9999+ The network connection is disconnected.
100100+ @constant kSCNetworkConnectionConnecting
101101+ The network connection is connecting.
102102+ @constant kSCNetworkConnectionConnected
103103+ The network connection is connected.
104104+ @constant kSCNetworkConnectionDisconnecting
105105+ The network connection is disconnecting.
106106+ */
107107+typedef CF_ENUM(int32_t, SCNetworkConnectionStatus) {
108108+ kSCNetworkConnectionInvalid = -1,
109109+ kSCNetworkConnectionDisconnected = 0,
110110+ kSCNetworkConnectionConnecting = 1,
111111+ kSCNetworkConnectionConnected = 2,
112112+ kSCNetworkConnectionDisconnecting = 3
113113+};
114114+115115+116116+/*!
117117+ @enum SCNetworkConnectionPPPStatus
118118+ @discussion PPP-specific status of the network connection.
119119+ This status is returned as part of the extended information
120120+ for a PPP service.
121121+ Note: additional status might be returned in the future.
122122+ Your application should be prepared to receive an unknown value.
123123+ @constant kSCNetworkConnectionPPPDisconnected
124124+ PPP is disconnected.
125125+ @constant kSCNetworkConnectionPPPInitializing
126126+ PPP is initializing.
127127+ @constant kSCNetworkConnectionPPPConnectingLink
128128+ PPP is connecting the lower connection layer (for example,
129129+ the modem is dialing out).
130130+ @constant kSCNetworkConnectionPPPDialOnTraffic
131131+ PPP is waiting for networking traffic to automatically
132132+ establish the connection.
133133+ @constant kSCNetworkConnectionPPPNegotiatingLink
134134+ The PPP lower layer is connected and PPP is negotiating the
135135+ link layer (LCP protocol).
136136+ @constant kSCNetworkConnectionPPPAuthenticating
137137+ PPP is authenticating to the server (PAP, CHAP, MS-CHAP or
138138+ EAP protocols).
139139+ @constant kSCNetworkConnectionPPPWaitingForCallBack
140140+ PPP is waiting for the server to call back.
141141+ @constant kSCNetworkConnectionPPPNegotiatingNetwork
142142+ PPP is now authenticated and negotiating the networking
143143+ layer (IPCP or IPv6CP protocols)
144144+ @constant kSCNetworkConnectionPPPConnected
145145+ PPP is now fully connected for at least one networking layer.
146146+ Additional networking protocol might still be negotiating.
147147+ @constant kSCNetworkConnectionPPPTerminating
148148+ PPP networking and link protocols are terminating.
149149+ @constant kSCNetworkConnectionPPPDisconnectingLink
150150+ PPP is disconnecting the lower level (for example, the modem
151151+ is hanging up).
152152+ @constant kSCNetworkConnectionPPPHoldingLinkOff
153153+ PPP is disconnected and maintaining the link temporarily off.
154154+ @constant kSCNetworkConnectionPPPSuspended
155155+ PPP is suspended as a result of the suspend command (for
156156+ example, when a V.92 Modem is On Hold).
157157+ @constant kSCNetworkConnectionPPPWaitingForRedial
158158+ PPP has found a busy server and is waiting for redial.
159159+ */
160160+typedef CF_ENUM(int32_t, SCNetworkConnectionPPPStatus) {
161161+ kSCNetworkConnectionPPPDisconnected = 0,
162162+ kSCNetworkConnectionPPPInitializing = 1,
163163+ kSCNetworkConnectionPPPConnectingLink = 2,
164164+ kSCNetworkConnectionPPPDialOnTraffic = 3,
165165+ kSCNetworkConnectionPPPNegotiatingLink = 4,
166166+ kSCNetworkConnectionPPPAuthenticating = 5,
167167+ kSCNetworkConnectionPPPWaitingForCallBack = 6,
168168+ kSCNetworkConnectionPPPNegotiatingNetwork = 7,
169169+ kSCNetworkConnectionPPPConnected = 8,
170170+ kSCNetworkConnectionPPPTerminating = 9,
171171+ kSCNetworkConnectionPPPDisconnectingLink = 10,
172172+ kSCNetworkConnectionPPPHoldingLinkOff = 11,
173173+ kSCNetworkConnectionPPPSuspended = 12,
174174+ kSCNetworkConnectionPPPWaitingForRedial = 13
175175+};
176176+177177+/*!
178178+ @typedef SCNetworkConnectionCallBack
179179+ @discussion Type of the callback function used when a
180180+ status event is delivered.
181181+ @param status The connection status.
182182+ @param connection The connection reference.
183183+ @param info Application-specific information.
184184+ */
185185+typedef void (*SCNetworkConnectionCallBack) (
186186+ SCNetworkConnectionRef connection,
187187+ SCNetworkConnectionStatus status,
188188+ void * __nullable info
189189+ );
190190+191191+192192+193193+/*
194194+ Keys for the statistics dictionary
195195+*/
196196+197197+#define kSCNetworkConnectionBytesIn CFSTR("BytesIn") /* CFNumber */
198198+#define kSCNetworkConnectionBytesOut CFSTR("BytesOut") /* CFNumber */
199199+#define kSCNetworkConnectionPacketsIn CFSTR("PacketsIn") /* CFNumber */
200200+#define kSCNetworkConnectionPacketsOut CFSTR("PacketsOut") /* CFNumber */
201201+#define kSCNetworkConnectionErrorsIn CFSTR("ErrorsIn") /* CFNumber */
202202+#define kSCNetworkConnectionErrorsOut CFSTR("ErrorsOut") /* CFNumber */
203203+204204+205205+/*
206206+ Keys for the SCNetworkConnectionCopyUserPreferences() "selectionOptions"
207207+ dictionary
208208+ */
209209+210210+/*!
211211+ @define kSCNetworkConnectionSelectionOptionOnDemandHostName
212212+ @discussion A host name that will be used to select the
213213+ "best" SCNetworkConnection.
214214+ */
215215+#define kSCNetworkConnectionSelectionOptionOnDemandHostName CFSTR("OnDemandHostName") // CFString
216216+ // __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
217217+218218+/*!
219219+ @define kSCNetworkConnectionSelectionOptionOnDemandRetry
220220+ @discussion A boolean value used to indicate whether a DNS query has
221221+ already been issued for the specified OnDemand host name.
222222+ */
223223+#define kSCNetworkConnectionSelectionOptionOnDemandRetry CFSTR("OnDemandRetry") // CFBoolean
224224+ // __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA)
225225+226226+__BEGIN_DECLS
227227+228228+/*!
229229+ @function SCNetworkConnectionGetTypeID
230230+ @discussion Returns the type identifier of all SCNetworkConnection
231231+ instances.
232232+ */
233233+CFTypeID
234234+SCNetworkConnectionGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
235235+236236+237237+/*!
238238+ @function SCNetworkConnectionCopyUserPreferences
239239+ @discussion Provides the default service ID and a dictionary of user
240240+ options for the connection. Applications can use the
241241+ returned serviceID and userOptions values to open a
242242+ connection on the fly.
243243+ @param selectionOptions Currently unimplemented. Pass NULL for this
244244+ version.
245245+ @param serviceID Reference to the default serviceID for starting
246246+ connections, this value will be returned by the function.
247247+ @param userOptions Reference to default userOptions for starting
248248+ connections, this will be returned by the function.
249249+ @result Returns TRUE if there is a valid service to dial;
250250+ FALSE if the function was unable to retrieve a service to dial.
251251+ */
252252+Boolean
253253+SCNetworkConnectionCopyUserPreferences (
254254+ CFDictionaryRef __nullable selectionOptions,
255255+ CFStringRef __nonnull * __nullable serviceID,
256256+ CFDictionaryRef __nonnull * __nullable userOptions
257257+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
258258+259259+260260+/*!
261261+ @function SCNetworkConnectionCreateWithServiceID
262262+ @discussion Creates a new connection reference to use for getting
263263+ the status or for connecting or disconnecting the associated
264264+ service.
265265+ @param allocator The CFAllocator that should be used to allocate
266266+ memory for the connection structure. This parameter may be
267267+ NULL in which case the current default CFAllocator is used.
268268+ If this reference is not a valid CFAllocator, the behavior
269269+ is undefined.
270270+ @param serviceID A string that defines the service identifier
271271+ of the connection. Service identifiers uniquely identify
272272+ services in the system configuration database.
273273+ @param callout The function to be called when the status
274274+ of the connection changes. If this parameter is NULL, the
275275+ application will not receive notifications of status change
276276+ and will need to poll for updates.
277277+ @param context The SCNetworkConnectionContext associated with the
278278+ callout.
279279+ @result Returns a reference to the new SCNetworkConnection.
280280+ */
281281+SCNetworkConnectionRef __nullable
282282+SCNetworkConnectionCreateWithServiceID (
283283+ CFAllocatorRef __nullable allocator,
284284+ CFStringRef serviceID,
285285+ SCNetworkConnectionCallBack __nullable callout,
286286+ SCNetworkConnectionContext * __nullable context
287287+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
288288+289289+290290+/*!
291291+ @function SCNetworkConnectionCopyServiceID
292292+ @discussion Returns the service ID associated with the SCNetworkConnection.
293293+ @param connection The SCNetworkConnection to obtain status from.
294294+ @result Returns the service ID associated with the SCNetworkConnection.
295295+ */
296296+CFStringRef __nullable
297297+SCNetworkConnectionCopyServiceID (
298298+ SCNetworkConnectionRef connection
299299+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
300300+301301+302302+/*!
303303+ @function SCNetworkConnectionGetStatus
304304+ @discussion Returns the status of the SCNetworkConnection.
305305+ A status is one of the following values:
306306+<pre>
307307+@textblock
308308+ 
309309+ kSCNetworkConnectionInvalid
310310+ kSCNetworkConnectionDisconnected
311311+ kSCNetworkConnectionConnecting
312312+ kSCNetworkConnectionDisconnecting
313313+ kSCNetworkConnectionConnected
314314+@/textblock
315315+</pre>
316316+ @param connection The SCNetworkConnection to obtain status from.
317317+ @result Returns the status value.
318318+*/
319319+SCNetworkConnectionStatus
320320+SCNetworkConnectionGetStatus (
321321+ SCNetworkConnectionRef connection
322322+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
323323+324324+325325+/*!
326326+ @function SCNetworkConnectionCopyExtendedStatus
327327+ @discussion Returns the extended status of the connection.
328328+ An extended status dictionary contains specific dictionaries
329329+ describing the status for each subcomponent of the service.
330330+331331+ For example, a status dictionary will contain the following
332332+ sub-dictionaries, keys, and values:
333333+<pre>
334334+@textblock
335335+ 
336336+ IPv4 : Addresses : the assigned IP address.
337337+ 
338338+ PPP : Status : the PPP-specific status of type
339339+ SCNetworkConnectionPPPStatus.
340340+ 
341341+ LastCause : Available when the status is "Disconnected"
342342+ and contains the last error associated with
343343+ connecting or disconnecting.
344344+ 
345345+ ConnectTime : the time when the connection was
346346+ established.
347347+ 
348348+ Modem : ConnectSpeed : the speed of the modem connection
349349+ in bits/second.
350350+ 
351351+ IPSec : Status : the IPSec-specific status of type
352352+ SCNetworkConnectionIPSecStatus
353353+ 
354354+ ConnectTime : the time when the connection was
355355+ established.
356356+357357+@/textblock
358358+</pre>
359359+ Other dictionaries could be present for PPPoE, PPTP, and L2TP.
360360+361361+ The status dictionary may be extended in the future to contain
362362+ additional information.
363363+ @param connection The SCNetworkConnection to obtain status from.
364364+ @result Returns the status dictionary.
365365+ If NULL is returned, the error can be retrieved using the SCError function.
366366+ */
367367+CFDictionaryRef __nullable
368368+SCNetworkConnectionCopyExtendedStatus (
369369+ SCNetworkConnectionRef connection
370370+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
371371+372372+373373+/*!
374374+ @function SCNetworkConnectionCopyStatistics
375375+ @discussion Returns the statistics of the SCNetworkConnection.
376376+ A statistic dictionary contains specific dictionaries
377377+ with statistics for each subcomponent of the service.
378378+379379+ For example, a statistics dictionary will contain the following
380380+ sub-dictionaries, keys, and values:
381381+<pre>
382382+@textblock
383383+ 
384384+ PPP : BytesIn :
385385+ PPP : BytesOut : Contains the number of bytes going up into
386386+ (or coming out of) the network stack for
387387+ any networking protocol without the PPP
388388+ headers and trailers.
389389+ 
390390+ PPP : PacketsIn :
391391+ PPP : PacketsOut : Contains the number of packets going up into
392392+ (or coming out of) the network stack for
393393+ any networking protocol without the PPP
394394+ headers and trailers.
395395+ 
396396+ PPP : ErrorsIn :
397397+ PPP : ErrorsOut : Contains the number of errors going up into
398398+ (or coming out of) the network stack for
399399+ any networking protocol without the PPP
400400+ headers and trailers.
401401+@/textblock
402402+</pre>
403403+ The statistics dictionary may be extended in the future to
404404+ contain additional information.
405405+ @param connection The SCNetworkConnection to obtained statistics from.
406406+ @result Returns the statistics dictionary.
407407+ If NULL is returned, the error can be retrieved using the SCError function.
408408+ */
409409+CFDictionaryRef __nullable
410410+SCNetworkConnectionCopyStatistics (
411411+ SCNetworkConnectionRef connection
412412+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
413413+414414+415415+/*!
416416+ @function SCNetworkConnectionStart
417417+ @discussion Starts the connection for the SCNetworkConnection.
418418+ The connection process is asynchronous and the function will
419419+ return immediately. The connection status can be obtained
420420+ by polling or by callback. The connection is made with the
421421+ default settings from the administrator. Some of the settings
422422+ can be overridden for the duration of the connection. These
423423+ are specified in an options dictionary. The options dictionary
424424+ uses the same format as a network service defined in the system
425425+ configuration preferences schema.
426426+427427+ Note: Starting and stopping of connections is implicitly
428428+ arbitrated. Calling SCNetworkConnectionStart on a connection
429429+ already started will indicate that the application has
430430+ interest in the connection and it shouldn't be stopped by
431431+ anyone else.
432432+ @param connection The SCNetworkConnection to start.
433433+ @param userOptions The options dictionary to start the connection with.
434434+ If userOptions is NULL, the default settings will be used.
435435+ If userOptions are specified, they must be in the same format
436436+ as network services stored in the system configuration
437437+ preferences schema. The options will override the default
438438+ settings defined for the service.
439439+440440+ For security reasons, not all options can be overridden; the
441441+ appropriate merging of all settings will be done before the
442442+ connection is established, and inappropriate options will be
443443+ ignored.
444444+ @param linger This parameter indicates whether or not the connection
445445+ can stay around when the application no longer has interest
446446+ in it. A typical application should pass FALSE, and the
447447+ connection will be automatically stopped when the reference
448448+ is released or if the application quits. If the application
449449+ passes TRUE, the application can release the reference or
450450+ exit and the connection will be maintained until a timeout
451451+ event, until a specific stop request occurs, or until an
452452+ error is encountered.
453453+ @result Returns TRUE if the connection was correctly started (the
454454+ actual connection is not established yet, and the connection
455455+ status needs to be periodically checked); FALSE if the
456456+ connection request was not started. The error must be
457457+ retrieved from the SCError function.
458458+ */
459459+Boolean
460460+SCNetworkConnectionStart (
461461+ SCNetworkConnectionRef connection,
462462+ CFDictionaryRef __nullable userOptions,
463463+ Boolean linger
464464+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
465465+466466+467467+/*!
468468+ @function SCNetworkConnectionStop
469469+ @discussion Stops the connection for the SCNetworkConnection.
470470+ The disconnection process is asynchronous and the function
471471+ will return immediately. The connection status can be
472472+ obtained by polling or by callback. This function performs
473473+ an arbitrated stop of the connection. If several applications
474474+ have marked their interest in the connection, by calling
475475+ SCNetworkConnectionStart, the call will succeed but the
476476+ actual connection will be maintained until the last interested
477477+ application calls SCNetworkConnectionStop.
478478+479479+ In certain cases, you might want to stop the connection anyway.
480480+ In these cases, you set the forceDisconnect argument to TRUE.
481481+ @param connection The SCNetworkConnection to stop.
482482+ @result Returns TRUE if the disconnection request succeeded;
483483+ FALSE if the disconnection request failed.
484484+ The error must be retrieved from the SCError function.
485485+ */
486486+Boolean
487487+SCNetworkConnectionStop (
488488+ SCNetworkConnectionRef connection,
489489+ Boolean forceDisconnect
490490+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
491491+492492+493493+/*!
494494+ @function SCNetworkConnectionCopyUserOptions
495495+ @discussion Copies the user options used to start the connection.
496496+ This is a mechanism a client can use to retrieve the user options
497497+ previously passed to the SCNetworkConnectionStart function.
498498+ @param connection The SCNetworkConnection to obtain options from.
499499+ @result Returns the service dictionary containing the connection options.
500500+ The dictionary can be empty if no user options were used.
501501+ If NULL is returned, the error can be retrieved using the SCError function.
502502+ */
503503+CFDictionaryRef __nullable
504504+SCNetworkConnectionCopyUserOptions (
505505+ SCNetworkConnectionRef connection
506506+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
507507+508508+509509+/*!
510510+ @function SCNetworkConnectionScheduleWithRunLoop
511511+ @discussion Schedules a connection with the run loop.
512512+ @param connection The SCNetworkConnection to schedule.
513513+ @param runLoop The run loop to schedule with.
514514+ @param runLoopMode The run loop mode.
515515+ @result Returns TRUE if the connection is scheduled successfully;
516516+ FALSE if the scheduling failed.
517517+ The error can be retrieved using the SCError function.
518518+ */
519519+Boolean
520520+SCNetworkConnectionScheduleWithRunLoop (
521521+ SCNetworkConnectionRef connection,
522522+ CFRunLoopRef runLoop,
523523+ CFStringRef runLoopMode
524524+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
525525+526526+527527+/*!
528528+ @function SCNetworkConnectionUnscheduleFromRunLoop
529529+ @discussion Unschedules a connection from the run loop.
530530+ @param connection The SCNetworkConnection to unschedule.
531531+ @param runLoop The run loop to unschedule from.
532532+ @param runLoopMode The run loop mode.
533533+ @result Returns TRUE if the connection is unscheduled successfully;
534534+ FALSE if the unscheduling failed.
535535+ The error can be retrieved using the SCError function.
536536+ */
537537+Boolean
538538+SCNetworkConnectionUnscheduleFromRunLoop (
539539+ SCNetworkConnectionRef connection,
540540+ CFRunLoopRef runLoop,
541541+ CFStringRef runLoopMode
542542+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_NA);
543543+544544+545545+/*!
546546+ @function SCNetworkConnectionSetDispatchQueue
547547+ @discussion Caller provides a dispatch queue on which the callback contained in connection will run.
548548+ @param connection The SCNetworkConnection to notify.
549549+ @param queue The libdispatch queue to run the callback on.
550550+ Pass NULL to disable notifications, and release queue.
551551+ @result Returns TRUE if the notifications have been enabled/disabled as desired;
552552+ FALSE if not.
553553+ The error can be retrieved using the SCError function.
554554+ */
555555+Boolean
556556+SCNetworkConnectionSetDispatchQueue (
557557+ SCNetworkConnectionRef connection,
558558+ dispatch_queue_t __nullable queue
559559+ ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
560560+561561+__END_DECLS
562562+563563+CF_ASSUME_NONNULL_END
564564+CF_IMPLICIT_BRIDGING_DISABLED
565565+566566+#endif /* _SCNETWORKCONNECTION_H */
···11+/*
22+ * Copyright (c) 2003-2005, 2008-2010, 2015-2016 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCNETWORKREACHABILITY_H
2525+#define _SCNETWORKREACHABILITY_H
2626+2727+#include <Availability.h>
2828+#include <TargetConditionals.h>
2929+#include <sys/cdefs.h>
3030+#include <sys/types.h>
3131+#include <sys/socket.h>
3232+#include <CoreFoundation/CoreFoundation.h>
3333+#include <SystemConfiguration/SCNetwork.h>
3434+#include <dispatch/dispatch.h>
3535+3636+CF_IMPLICIT_BRIDGING_ENABLED
3737+CF_ASSUME_NONNULL_BEGIN
3838+3939+/*!
4040+ @header SCNetworkReachability
4141+ @discussion The SCNetworkReachability API allows an application to
4242+ determine the status of a system's current network
4343+ configuration and the reachability of a target host.
4444+ In addition, reachability can be monitored with notifications
4545+ that are sent when the status has changed.
4646+4747+ "Reachability" reflects whether a data packet, sent by
4848+ an application into the network stack, can leave the local
4949+ computer.
5050+ Note that reachability does <i>not</i> guarantee that the data
5151+ packet will actually be received by the host.
5252+5353+ When reachability is used without scheduling updates on a runloop
5454+ or dispatch queue, the system will not generate DNS traffic and
5555+ will be optimistic about its reply - it will assume that the target
5656+ is reachable if there is a default route but a DNS query is
5757+ needed to learn the address. When scheduled, the first callback
5858+ will behave like an unscheduled call but subsequent calls will
5959+ leverage DNS results.
6060+6161+ When used on IPv6-only (NAT64+DNS64) networks, reachability checks
6262+ for IPv4 address literals (either a struct sockaddr_in * or textual
6363+ representations such as "192.0.2.1") will automatically give the
6464+ result for the corresponding synthesized IPv6 address.
6565+ On those networks, creating a CFSocketStream or NSURLSession
6666+ to that address will send packets but trying to connect using
6767+ BSD socket APIs will fail.
6868+ */
6969+7070+/*!
7171+ @typedef SCNetworkReachabilityRef
7272+ @discussion This is the handle to a network address or name.
7373+ */
7474+typedef const struct CF_BRIDGED_TYPE(id) __SCNetworkReachability * SCNetworkReachabilityRef;
7575+7676+7777+/*!
7878+ @typedef SCNetworkReachabilityContext
7979+ Structure containing user-specified data and callbacks for SCNetworkReachability.
8080+ @field version The version number of the structure type being passed
8181+ in as a parameter to the SCDynamicStore creation function.
8282+ This structure is version 0.
8383+ @field info A C pointer to a user-specified block of data.
8484+ @field retain The callback used to add a retain for the info field.
8585+ If this parameter is not a pointer to a function of the correct
8686+ prototype, the behavior is undefined. The value may be NULL.
8787+ @field release The calllback used to remove a retain previously added
8888+ for the info field. If this parameter is not a pointer to a
8989+ function of the correct prototype, the behavior is undefined.
9090+ The value may be NULL.
9191+ @field copyDescription The callback used to provide a description of
9292+ the info field.
9393+ */
9494+typedef struct {
9595+ CFIndex version;
9696+ void * __nullable info;
9797+ const void * __nonnull (* __nullable retain)(const void *info);
9898+ void (* __nullable release)(const void *info);
9999+ CFStringRef __nonnull (* __nullable copyDescription)(const void *info);
100100+} SCNetworkReachabilityContext;
101101+102102+/*!
103103+ @enum SCNetworkReachabilityFlags
104104+ @discussion Flags that indicate whether the specified network
105105+ nodename or address is reachable, whether a connection is
106106+ required, and whether some user intervention may be required
107107+ when establishing a connection.
108108+ @constant kSCNetworkReachabilityFlagsTransientConnection
109109+ This flag indicates that the specified nodename or address can
110110+ be reached via a transient connection, such as PPP.
111111+ @constant kSCNetworkReachabilityFlagsReachable
112112+ This flag indicates that the specified nodename or address can
113113+ be reached using the current network configuration.
114114+ @constant kSCNetworkReachabilityFlagsConnectionRequired
115115+ This flag indicates that the specified nodename or address can
116116+ be reached using the current network configuration, but a
117117+ connection must first be established.
118118+119119+ As an example, this status would be returned for a dialup
120120+ connection that was not currently active, but could handle
121121+ network traffic for the target system.
122122+ @constant kSCNetworkReachabilityFlagsConnectionOnTraffic
123123+ This flag indicates that the specified nodename or address can
124124+ be reached using the current network configuration, but a
125125+ connection must first be established. Any traffic directed
126126+ to the specified name or address will initiate the connection.
127127+128128+ Note: this flag was previously named kSCNetworkReachabilityFlagsConnectionAutomatic
129129+ @constant kSCNetworkReachabilityFlagsInterventionRequired
130130+ This flag indicates that the specified nodename or address can
131131+ be reached using the current network configuration, but a
132132+ connection must first be established. In addition, some
133133+ form of user intervention will be required to establish this
134134+ connection, such as providing a password, an authentication
135135+ token, etc.
136136+137137+ Note: At the present time, this flag will only be returned
138138+ in the case where you have a dial-on-traffic configuration
139139+ (ConnectionOnTraffic), where an attempt to connect has
140140+ already been made, and where some error (e.g. no dial tone,
141141+ no answer, bad password, ...) was encountered during the
142142+ automatic connection attempt. In this case the PPP controller
143143+ will stop attempting to establish a connection until the user
144144+ has intervened.
145145+ @constant kSCNetworkReachabilityFlagsConnectionOnDemand
146146+ This flag indicates that the specified nodename or address can
147147+ be reached using the current network configuration, but a
148148+ connection must first be established.
149149+ The connection will be established "On Demand" by the
150150+ CFSocketStream APIs.
151151+ Other APIs will not establish the connection.
152152+ @constant kSCNetworkReachabilityFlagsIsLocalAddress
153153+ This flag indicates that the specified nodename or address
154154+ is one associated with a network interface on the current
155155+ system.
156156+ @constant kSCNetworkReachabilityFlagsIsDirect
157157+ This flag indicates that network traffic to the specified
158158+ nodename or address will not go through a gateway, but is
159159+ routed directly to one of the interfaces in the system.
160160+#if TARGET_OS_IPHONE
161161+ @constant kSCNetworkReachabilityFlagsIsWWAN
162162+ This flag indicates that the specified nodename or address can
163163+ be reached via an EDGE, GPRS, or other "cell" connection.
164164+#endif // TARGET_OS_IPHONE
165165+ */
166166+typedef CF_OPTIONS(uint32_t, SCNetworkReachabilityFlags) {
167167+ kSCNetworkReachabilityFlagsTransientConnection = 1<<0,
168168+ kSCNetworkReachabilityFlagsReachable = 1<<1,
169169+ kSCNetworkReachabilityFlagsConnectionRequired = 1<<2,
170170+ kSCNetworkReachabilityFlagsConnectionOnTraffic = 1<<3,
171171+ kSCNetworkReachabilityFlagsInterventionRequired = 1<<4,
172172+ kSCNetworkReachabilityFlagsConnectionOnDemand = 1<<5, // __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_3_0)
173173+ kSCNetworkReachabilityFlagsIsLocalAddress = 1<<16,
174174+ kSCNetworkReachabilityFlagsIsDirect = 1<<17,
175175+#if TARGET_OS_IPHONE
176176+ kSCNetworkReachabilityFlagsIsWWAN = 1<<18,
177177+#endif // TARGET_OS_IPHONE
178178+179179+ kSCNetworkReachabilityFlagsConnectionAutomatic = kSCNetworkReachabilityFlagsConnectionOnTraffic
180180+};
181181+182182+/*!
183183+ @typedef SCNetworkReachabilityCallBack
184184+ @discussion Type of the callback function used when the
185185+ reachability of a network address or name changes.
186186+ @param target The SCNetworkReachability reference being monitored
187187+ for changes.
188188+ @param flags The new SCNetworkReachabilityFlags representing the
189189+ reachability status of the network address/name.
190190+ @param info A C pointer to a user-specified block of data.
191191+ */
192192+typedef void (*SCNetworkReachabilityCallBack) (
193193+ SCNetworkReachabilityRef target,
194194+ SCNetworkReachabilityFlags flags,
195195+ void * __nullable info
196196+ );
197197+198198+__BEGIN_DECLS
199199+200200+/*!
201201+ @function SCNetworkReachabilityCreateWithAddress
202202+ @discussion Creates a reference to the specified network
203203+ address. This reference can be used later to monitor the
204204+ reachability of the target host.
205205+ @param address The address of the desired host.
206206+ @result Returns a reference to the new immutable SCNetworkReachabilityRef.
207207+208208+ You must release the returned value.
209209+ */
210210+SCNetworkReachabilityRef __nullable
211211+SCNetworkReachabilityCreateWithAddress (
212212+ CFAllocatorRef __nullable allocator,
213213+ const struct sockaddr *address
214214+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
215215+216216+/*!
217217+ @function SCNetworkReachabilityCreateWithAddressPair
218218+ @discussion Creates a reference to the specified network
219219+ address. This reference can be used later to monitor the
220220+ reachability of the target host.
221221+ @param localAddress The local address associated with a network
222222+ connection. If NULL, only the remote address is of interest.
223223+ @param remoteAddress The remote address associated with a network
224224+ connection. If NULL, only the local address is of interest.
225225+ @result Returns a reference to the new immutable SCNetworkReachabilityRef.
226226+227227+ You must release the returned value.
228228+ */
229229+SCNetworkReachabilityRef __nullable
230230+SCNetworkReachabilityCreateWithAddressPair (
231231+ CFAllocatorRef __nullable allocator,
232232+ const struct sockaddr * __nullable localAddress,
233233+ const struct sockaddr * __nullable remoteAddress
234234+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
235235+236236+/*!
237237+ @function SCNetworkReachabilityCreateWithName
238238+ @discussion Creates a reference to the specified network host or node
239239+ name. This reference can be used later to monitor the
240240+ reachability of the target host.
241241+ @param nodename The node name of the desired host.
242242+ This name would be the same as that passed to the
243243+ gethostbyname(3) or getaddrinfo(3) functions.
244244+ @result Returns a reference to the new immutable SCNetworkReachabilityRef.
245245+246246+ You must release the returned value.
247247+ */
248248+SCNetworkReachabilityRef __nullable
249249+SCNetworkReachabilityCreateWithName (
250250+ CFAllocatorRef __nullable allocator,
251251+ const char *nodename
252252+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
253253+254254+/*!
255255+ @function SCNetworkReachabilityGetTypeID
256256+ @discussion Returns the type identifier of all SCNetworkReachability
257257+ instances.
258258+ */
259259+CFTypeID
260260+SCNetworkReachabilityGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
261261+262262+263263+/*!
264264+ @function SCNetworkReachabilityGetFlags
265265+ @discussion Determines if the given target is reachable using the
266266+ current network configuration.
267267+ @param target The network reference associated with the address or name
268268+ to be checked for reachability.
269269+ @param flags A pointer to memory that will be filled with the
270270+ SCNetworkReachabilityFlags detailing the reachability
271271+ of the specified target.
272272+ @result Returns TRUE if the network connection flags are valid;
273273+ FALSE if the status could not be determined.
274274+ */
275275+Boolean
276276+SCNetworkReachabilityGetFlags (
277277+ SCNetworkReachabilityRef target,
278278+ SCNetworkReachabilityFlags *flags
279279+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
280280+281281+/*!
282282+ @function SCNetworkReachabilitySetCallback
283283+ @discussion Assigns a client to a target, which receives callbacks
284284+ when the reachability of the target changes.
285285+ @param target The network reference associated with the address or
286286+ name to be checked for reachability.
287287+ @param callout The function to be called when the reachability of the
288288+ target changes. If NULL, the current client for the target
289289+ is removed.
290290+ @param context The SCNetworkReachabilityContext associated with
291291+ the callout. The value may be NULL.
292292+ @result Returns TRUE if the notification client was successfully set.
293293+ */
294294+Boolean
295295+SCNetworkReachabilitySetCallback (
296296+ SCNetworkReachabilityRef target,
297297+ SCNetworkReachabilityCallBack __nullable callout,
298298+ SCNetworkReachabilityContext * __nullable context
299299+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
300300+301301+/*!
302302+ @function SCNetworkReachabilityScheduleWithRunLoop
303303+ @discussion Schedules the given target with the given run loop and mode.
304304+ @param target The address or name that is set up for asynchronous
305305+ notifications. Must be non-NULL.
306306+ @param runLoop A reference to a run loop on which the target should
307307+ be scheduled. Must be non-NULL.
308308+ @param runLoopMode The mode on which to schedule the target.
309309+ Must be non-NULL.
310310+ @result Returns TRUE if the target is scheduled successfully;
311311+ FALSE otherwise.
312312+ */
313313+Boolean
314314+SCNetworkReachabilityScheduleWithRunLoop (
315315+ SCNetworkReachabilityRef target,
316316+ CFRunLoopRef runLoop,
317317+ CFStringRef runLoopMode
318318+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
319319+320320+/*!
321321+ @function SCNetworkReachabilityUnscheduleFromRunLoop
322322+ @discussion Unschedules the given target from the given run loop
323323+ and mode.
324324+ @param target The address or name that is set up for asynchronous
325325+ notifications. Must be non-NULL.
326326+ @param runLoop A reference to a run loop from which the target
327327+ should be unscheduled. Must be non-NULL.
328328+ @param runLoopMode The mode on which to unschedule the target.
329329+ Must be non-NULL.
330330+ @result Returns TRUE if the target is unscheduled successfully;
331331+ FALSE otherwise.
332332+ */
333333+Boolean
334334+SCNetworkReachabilityUnscheduleFromRunLoop (
335335+ SCNetworkReachabilityRef target,
336336+ CFRunLoopRef runLoop,
337337+ CFStringRef runLoopMode
338338+ ) __OSX_AVAILABLE_STARTING(__MAC_10_3,__IPHONE_2_0);
339339+340340+/*!
341341+ @function SCNetworkReachabilitySetDispatchQueue
342342+ @discussion Schedule or unschedule callbacks for the given target on the given
343343+ dispatch queue.
344344+ @param target The address or name that is set up for asynchronous
345345+ notifications. Must be non-NULL.
346346+ @param queue A libdispatch queue to run the callback on.
347347+ Pass NULL to unschedule callbacks.
348348+ @result Returns TRUE if the target is scheduled or unscheduled successfully;
349349+ FALSE otherwise.
350350+ */
351351+Boolean
352352+SCNetworkReachabilitySetDispatchQueue (
353353+ SCNetworkReachabilityRef target,
354354+ dispatch_queue_t __nullable queue
355355+ ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_4_0);
356356+357357+__END_DECLS
358358+359359+CF_ASSUME_NONNULL_END
360360+CF_IMPLICIT_BRIDGING_DISABLED
361361+362362+#endif /* _SCNETWORKREACHABILITY_H */
···11+/*
22+ * Copyright (c) 2000, 2001, 2004, 2005, 2007-2010, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCPREFERENCES_H
2525+#define _SCPREFERENCES_H
2626+2727+#include <Availability.h>
2828+#include <TargetConditionals.h>
2929+#include <sys/cdefs.h>
3030+#include <dispatch/dispatch.h>
3131+#include <CoreFoundation/CoreFoundation.h>
3232+#include <SystemConfiguration/SCDynamicStore.h>
3333+3434+//#if !TARGET_OS_IPHONE
3535+//#include <Security/Security.h>
3636+//#else // !TARGET_OS_IPHONE
3737+typedef const struct AuthorizationOpaqueRef * AuthorizationRef;
3838+//#endif // !TARGET_OS_IPHONE
3939+4040+CF_IMPLICIT_BRIDGING_ENABLED
4141+CF_ASSUME_NONNULL_BEGIN
4242+4343+/*!
4444+ @header SCPreferences
4545+ @discussion The SCPreferences API allows an application to load and
4646+ store XML configuration data in a controlled manner and provide
4747+ the necessary notifications to other applications that need to
4848+ be aware of configuration changes.
4949+5050+ To access configuration preferences, you must first establish a
5151+ preferences session using the SCPreferencesCreate function.
5252+ To identify a specific set of preferences to access, you pass a
5353+ value in the prefsID parameter.
5454+ A NULL value indicates that the default system preferences are
5555+ to be accessed.
5656+ A string that starts with a leading "/" character specifies
5757+ the absolute path to the file containing the preferences to
5858+ be accessed.
5959+ A string that does not start with a leading "/" character
6060+ specifies a file relative to the default system preferences
6161+ directory.
6262+6363+ When you are finished with the preferences session, use
6464+ CFRelease to close it.
6565+ */
6666+6767+6868+/*!
6969+ @typedef SCPreferencesRef
7070+ @discussion This is the handle to an open preferences session for
7171+ accessing system configuration preferences.
7272+ */
7373+typedef const struct CF_BRIDGED_TYPE(id) __SCPreferences * SCPreferencesRef;
7474+7575+/*!
7676+ @enum SCPreferencesNotification
7777+ @discussion Used with the SCPreferencesCallBack callback
7878+ to describe the type of notification.
7979+ @constant kSCPreferencesNotificationCommit Indicates when new
8080+ preferences have been saved.
8181+ @constant kSCPreferencesNotificationApply Key Indicates when a
8282+ request has been made to apply the currently saved
8383+ preferences to the active system configuration.
8484+ */
8585+typedef CF_OPTIONS(uint32_t, SCPreferencesNotification) {
8686+ kSCPreferencesNotificationCommit = 1<<0, // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA)
8787+ kSCPreferencesNotificationApply = 1<<1 // __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA)
8888+};
8989+9090+/*!
9191+ @typedef SCPreferencesContext
9292+ Structure containing user-specified data and callbacks for SCPreferences.
9393+ @field version The version number of the structure type being passed
9494+ in as a parameter to the SCPreferencesSetCallback function.
9595+ This structure is version 0.
9696+ @field info A C pointer to a user-specified block of data.
9797+ @field retain The callback used to add a retain for the info field.
9898+ If this parameter is not a pointer to a function of the correct
9999+ prototype, the behavior is undefined.
100100+ The value may be NULL.
101101+ @field release The calllback used to remove a retain previously added
102102+ for the info field.
103103+ If this parameter is not a pointer to a function of the
104104+ correct prototype, the behavior is undefined.
105105+ The value may be NULL.
106106+ @field copyDescription The callback used to provide a description of
107107+ the info field.
108108+ */
109109+typedef struct {
110110+ CFIndex version;
111111+ void * __nullable info;
112112+ const void * __nonnull (* __nullable retain)(const void *info);
113113+ void (* __nullable release)(const void *info);
114114+ CFStringRef __nonnull (* __nullable copyDescription)(const void *info);
115115+} SCPreferencesContext;
116116+117117+/*!
118118+ @typedef SCPreferencesCallBack
119119+ @discussion Type of the callback function used when the
120120+ preferences have been updated and/or applied.
121121+ @param prefs The preferences session.
122122+ @param notificationType The type of notification, such as changes
123123+ committed, changes applied, etc.
124124+ @param info A C pointer to a user-specified block of data.
125125+ */
126126+typedef void (*SCPreferencesCallBack) (
127127+ SCPreferencesRef prefs,
128128+ SCPreferencesNotification notificationType,
129129+ void * __nullable info
130130+ );
131131+132132+133133+__BEGIN_DECLS
134134+135135+/*!
136136+ @function SCPreferencesGetTypeID
137137+ @discussion Returns the type identifier of all SCPreferences instances.
138138+ */
139139+CFTypeID
140140+SCPreferencesGetTypeID (void) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
141141+142142+/*!
143143+ @function SCPreferencesCreate
144144+ @discussion Initiates access to the per-system set of configuration
145145+ preferences.
146146+ @param allocator The CFAllocator that should be used to allocate
147147+ memory for this preferences session.
148148+ This parameter may be NULL in which case the current
149149+ default CFAllocator is used.
150150+ If this reference is not a valid CFAllocator, the behavior
151151+ is undefined.
152152+ @param name A string that describes the name of the calling
153153+ process.
154154+ @param prefsID A string that identifies the name of the
155155+ group of preferences to be accessed or updated.
156156+ @result Returns a reference to the new SCPreferences.
157157+ You must release the returned value.
158158+ */
159159+SCPreferencesRef __nullable
160160+SCPreferencesCreate (
161161+ CFAllocatorRef __nullable allocator,
162162+ CFStringRef name,
163163+ CFStringRef __nullable prefsID
164164+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
165165+166166+167167+/*!
168168+ @function SCPreferencesCreateWithAuthorization
169169+ @discussion Initiates access to the per-system set of configuration
170170+ preferences.
171171+ @param allocator The CFAllocator that should be used to allocate
172172+ memory for this preferences session.
173173+ This parameter may be NULL in which case the current
174174+ default CFAllocator is used.
175175+ If this reference is not a valid CFAllocator, the behavior
176176+ is undefined.
177177+ @param name A string that describes the name of the calling
178178+ process.
179179+ @param prefsID A string that identifies the name of the
180180+ group of preferences to be accessed or updated.
181181+ @param authorization An authorization reference that is used to
182182+ authorize any access to the enhanced privileges needed
183183+ to manage the preferences session.
184184+ @result Returns a reference to the new SCPreferences.
185185+ You must release the returned value.
186186+ */
187187+SCPreferencesRef __nullable
188188+SCPreferencesCreateWithAuthorization (
189189+ CFAllocatorRef __nullable allocator,
190190+ CFStringRef name,
191191+ CFStringRef __nullable prefsID,
192192+ AuthorizationRef __nullable authorization
193193+ ) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_NA);
194194+195195+/*!
196196+ @function SCPreferencesLock
197197+ @discussion Locks access to the configuration preferences.
198198+199199+ This function obtains exclusive access to the configuration
200200+ preferences. Clients attempting to obtain exclusive access
201201+ to the preferences will either receive a kSCStatusPrefsBusy
202202+ error or block waiting for the lock to be released.
203203+ @param prefs The preferences session.
204204+ @param wait A boolean flag indicating whether the calling process
205205+ should block waiting for another process to complete its update
206206+ operation and release its lock.
207207+ @result Returns TRUE if the lock was obtained;
208208+ FALSE if an error occurred.
209209+ */
210210+Boolean
211211+SCPreferencesLock (
212212+ SCPreferencesRef prefs,
213213+ Boolean wait
214214+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
215215+216216+/*!
217217+ @function SCPreferencesCommitChanges
218218+ @discussion Commits changes made to the configuration preferences to
219219+ persistent storage.
220220+221221+ This function commits any changes to permanent storage.
222222+ Implicit calls to the SCPreferencesLock and SCPreferencesUnlock
223223+ functions will be made if exclusive access has not already been
224224+ established.
225225+226226+ Note: This routine commits changes to persistent storage.
227227+ Call the SCPreferencesApplyChanges function to apply the
228228+ changes to the running system.
229229+ @param prefs The preferences session.
230230+ @result Returns TRUE if the lock was obtained;
231231+ FALSE if an error occurred.
232232+ */
233233+Boolean
234234+SCPreferencesCommitChanges (
235235+ SCPreferencesRef prefs
236236+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
237237+238238+/*!
239239+ @function SCPreferencesApplyChanges
240240+ @discussion Requests that the currently stored configuration
241241+ preferences be applied to the active configuration.
242242+ @param prefs The preferences session.
243243+ @result Returns TRUE if the lock was obtained;
244244+ FALSE if an error occurred.
245245+ */
246246+Boolean
247247+SCPreferencesApplyChanges (
248248+ SCPreferencesRef prefs
249249+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
250250+251251+/*!
252252+ @function SCPreferencesUnlock
253253+ @discussion Releases exclusive access to the configuration preferences.
254254+255255+ This function releases the exclusive access lock to the
256256+ preferences. Other clients will be now be able to establish
257257+ exclusive access to the preferences.
258258+ @param prefs The preferences session.
259259+ @result Returns TRUE if the lock was obtained;
260260+ FALSE if an error occurred.
261261+ */
262262+Boolean
263263+SCPreferencesUnlock (
264264+ SCPreferencesRef prefs
265265+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
266266+267267+/*!
268268+ @function SCPreferencesGetSignature
269269+ @discussion Returns a sequence of bytes that can be used to determine
270270+ if the saved configuration preferences have changed.
271271+ @param prefs The preferences session.
272272+ @result Returns a CFDataRef that reflects the signature of the configuration
273273+ preferences at the time of the call to the SCPreferencesCreate function.
274274+ */
275275+CFDataRef __nullable
276276+SCPreferencesGetSignature (
277277+ SCPreferencesRef prefs
278278+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
279279+280280+/*!
281281+ @function SCPreferencesCopyKeyList
282282+ @discussion Returns an array of currently defined preference keys.
283283+ @param prefs The preferences session.
284284+ @result Returns the list of keys.
285285+ You must release the returned value.
286286+ */
287287+CFArrayRef __nullable
288288+SCPreferencesCopyKeyList (
289289+ SCPreferencesRef prefs
290290+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
291291+292292+/*!
293293+ @function SCPreferencesGetValue
294294+ @discussion Returns the data associated with a preference key.
295295+296296+ This function retrieves data associated with the specified
297297+ key.
298298+299299+ Note: To avoid inadvertantly reading stale data, first call
300300+ the SCPreferencesLock function.
301301+ @param prefs The preferences session.
302302+ @param key The preference key to be returned.
303303+ @result Returns the value associated with the specified preference key;
304304+ NULL if no value was located.
305305+ */
306306+CFPropertyListRef __nullable
307307+SCPreferencesGetValue (
308308+ SCPreferencesRef prefs,
309309+ CFStringRef key
310310+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
311311+312312+/*!
313313+ @function SCPreferencesAddValue
314314+ @discussion Adds data for a preference key.
315315+316316+ This function associates new data with the specified key.
317317+ To commit these changes to permanent storage, a call must
318318+ be made to the SCPreferencesCommitChanges function.
319319+ @param prefs The preferences session.
320320+ @param key The preference key to be updated.
321321+ @param value The CFPropertyListRef object containing the
322322+ value to be associated with the specified preference key.
323323+ @result Returns TRUE if the value was added;
324324+ FALSE if the key already exists or
325325+ if an error occurred.
326326+ */
327327+Boolean
328328+SCPreferencesAddValue (
329329+ SCPreferencesRef prefs,
330330+ CFStringRef key,
331331+ CFPropertyListRef value
332332+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
333333+334334+/*!
335335+ @function SCPreferencesSetValue
336336+ @discussion Updates the data associated with a preference key.
337337+338338+ This function adds or replaces the value associated with the
339339+ specified key. To commit these changes to permanent storage
340340+ a call must be made to the SCPreferencesCommitChanges function.
341341+ @param prefs The preferences session.
342342+ @param key The preference key to be updated.
343343+ @param value The CFPropertyListRef object containing the
344344+ data to be associated with the specified preference key.
345345+ @result Returns TRUE if the value was set;
346346+ FALSE if an error occurred.
347347+ */
348348+Boolean
349349+SCPreferencesSetValue (
350350+ SCPreferencesRef prefs,
351351+ CFStringRef key,
352352+ CFPropertyListRef value
353353+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
354354+355355+/*!
356356+ @function SCPreferencesRemoveValue
357357+ @discussion Removes the data associated with a preference key.
358358+359359+ This function removes the data associated with the specified
360360+ key. To commit these changes to permanent storage a call must
361361+ be made to the SCPreferencesCommitChanges function.
362362+ @param prefs The preferences session.
363363+ @param key The preference key to be removed.
364364+ @result Returns TRUE if the value was removed;
365365+ FALSE if the key did not exist or if an error occurred.
366366+ */
367367+Boolean
368368+SCPreferencesRemoveValue (
369369+ SCPreferencesRef prefs,
370370+ CFStringRef key
371371+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
372372+373373+/*!
374374+ @function SCPreferencesSetCallback
375375+ @discussion Assigns a callback to a preferences session. The function
376376+ is called when the changes to the preferences have been
377377+ committed or applied.
378378+ @param prefs The preferences session.
379379+ @param callout The function to be called when the preferences have
380380+ been changed or applied.
381381+ If NULL, the current callback is removed.
382382+ @param context The SCPreferencesContext associated with
383383+ the callout.
384384+ @result Returns TRUE if the notification client was successfully set.
385385+ */
386386+Boolean
387387+SCPreferencesSetCallback (
388388+ SCPreferencesRef prefs,
389389+ SCPreferencesCallBack __nullable callout,
390390+ SCPreferencesContext * __nullable context
391391+ ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
392392+393393+/*!
394394+ @function SCPreferencesScheduleWithRunLoop
395395+ @discussion Schedule commit and apply notifications for the specified
396396+ preferences session using the specified run loop and mode.
397397+ @param prefs The preferences session.
398398+ @param runLoop A reference to a run loop on which the notification
399399+ should be scheduled.
400400+ Must be non-NULL.
401401+ @param runLoopMode The mode on which to schedule the notification.
402402+ Must be non-NULL.
403403+ @result Returns TRUE if the notifications are successfully scheduled;
404404+ FALSE otherwise.
405405+ */
406406+Boolean
407407+SCPreferencesScheduleWithRunLoop (
408408+ SCPreferencesRef prefs,
409409+ CFRunLoopRef runLoop,
410410+ CFStringRef runLoopMode
411411+ ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
412412+413413+/*!
414414+ @function SCPreferencesUnscheduleFromRunLoop
415415+ @discussion Unschedule commit and apply notifications for the specified
416416+ preferences session from the specified run loop and mode.
417417+ @param prefs The preferences session.
418418+ @param runLoop A reference to a run loop from which the notification
419419+ should be unscheduled.
420420+ Must be non-NULL.
421421+ @param runLoopMode The mode on which to unschedule the notification.
422422+ Must be non-NULL.
423423+ @result Returns TRUE if the notifications are successfully unscheduled;
424424+ FALSE otherwise.
425425+ */
426426+Boolean
427427+SCPreferencesUnscheduleFromRunLoop (
428428+ SCPreferencesRef prefs,
429429+ CFRunLoopRef runLoop,
430430+ CFStringRef runLoopMode
431431+ ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
432432+433433+/*!
434434+ @function SCPreferencesSetDispatchQueue
435435+ @discussion Schedule commit and apply notifications for the specified
436436+ preferences session.
437437+ @param prefs The preferences session.
438438+ @param queue The dispatch queue to run the callback function on.
439439+ @result Returns TRUE if the notifications are successfully scheduled;
440440+ FALSE otherwise.
441441+ */
442442+Boolean
443443+SCPreferencesSetDispatchQueue (
444444+ SCPreferencesRef prefs,
445445+ dispatch_queue_t __nullable queue
446446+ ) __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA);
447447+448448+/*!
449449+ @function SCPreferencesSynchronize
450450+ @discussion Synchronizes accessed preferences with committed changes.
451451+452452+ Any references to preference values returned by calls to the
453453+ SCPreferencesGetValue function are no longer valid unless they
454454+ were explicitly retained or copied. Any preference values
455455+ that were updated (add, set, remove) but not committed will
456456+ be discarded.
457457+ @param prefs The preferences session.
458458+ */
459459+void
460460+SCPreferencesSynchronize (
461461+ SCPreferencesRef prefs
462462+ ) __OSX_AVAILABLE_STARTING(__MAC_10_4,__IPHONE_NA);
463463+464464+__END_DECLS
465465+466466+CF_ASSUME_NONNULL_END
467467+CF_IMPLICIT_BRIDGING_DISABLED
468468+469469+#endif /* _SCPREFERENCES_H */
···11+/*
22+ * Copyright (c) 2000, 2001, 2004, 2005, 2008, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCPREFERENCESPATH_H
2525+#define _SCPREFERENCESPATH_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CoreFoundation.h>
3030+#include <SystemConfiguration/SCPreferences.h>
3131+3232+CF_IMPLICIT_BRIDGING_ENABLED
3333+CF_ASSUME_NONNULL_BEGIN
3434+3535+/*!
3636+ @header SCPreferencesPath
3737+ @discussion The SCPreferencesPath API allows an application to
3838+ load and store XML configuration data in a controlled
3939+ manner and provide the necessary notifications to other
4040+ applications that need to be aware of configuration
4141+ changes.
4242+4343+ The functions in the SCPreferencesPath API make certain
4444+ assumptions about the layout of the preferences data.
4545+ These functions view the data as a collection of dictionaries
4646+ of key-value pairs and an associated path name.
4747+ The root path ("/") identifies the top-level dictionary.
4848+ Additional path components specify the keys for subdictionaries.
4949+5050+ For example, the following dictionary can be accessed via
5151+ two paths. The root ("/") path would return a dictionary
5252+ with all keys and values. The path "/path1" would only
5353+ return the dictionary with the "key3" and "key4" properties.
5454+5555+ <pre>
5656+ @textblock
5757+ <dict>
5858+ <key>key1</key>
5959+ <string>val1</string>
6060+ <key>key2</key>
6161+ <string>val2</string>
6262+ <key>path1</key>
6363+ <dict>
6464+ <key>key3</key>
6565+ <string>val3</string>
6666+ <key>key4</key>
6767+ <string>val4</string>
6868+ </dict>
6969+ </dict>
7070+ @/textblock
7171+ </pre>
7272+7373+ Each dictionary can also include the kSCResvLink ("__LINK__") key.
7474+ The value associated with this key is interpreted as a link to
7575+ another path. If this key is present, a call to the
7676+ SCPreferencesPathGetValue function returns the dictionary
7777+ specified by the link.
7878+ */
7979+8080+8181+__BEGIN_DECLS
8282+8383+/*!
8484+ @function SCPreferencesPathCreateUniqueChild
8585+ @discussion Creates a new path component within the dictionary
8686+ hierarchy.
8787+ @param prefs The preferences session.
8888+ @param prefix A string that represents the parent path.
8989+ @result Returns a string representing the new (unique) child path; NULL
9090+ if the specified path does not exist.
9191+ */
9292+CFStringRef __nullable
9393+SCPreferencesPathCreateUniqueChild (
9494+ SCPreferencesRef prefs,
9595+ CFStringRef prefix
9696+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
9797+9898+/*!
9999+ @function SCPreferencesPathGetValue
100100+ @discussion Returns the dictionary associated with the specified
101101+ path.
102102+ @param prefs The preferences session.
103103+ @param path A string that represents the path to be returned.
104104+ @result Returns the dictionary associated with the specified path; NULL
105105+ if the path does not exist.
106106+ */
107107+CFDictionaryRef __nullable
108108+SCPreferencesPathGetValue (
109109+ SCPreferencesRef prefs,
110110+ CFStringRef path
111111+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
112112+113113+/*!
114114+ @function SCPreferencesPathGetLink
115115+ @discussion Returns the link (if one exists) associated with the
116116+ specified path.
117117+ @param prefs The preferences session.
118118+ @param path A string that represents the path to be returned.
119119+ @result Returns the dictionary associated with the specified path; NULL
120120+ if the path is not a link or does not exist.
121121+ */
122122+CFStringRef __nullable
123123+SCPreferencesPathGetLink (
124124+ SCPreferencesRef prefs,
125125+ CFStringRef path
126126+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
127127+128128+/*!
129129+ @function SCPreferencesPathSetValue
130130+ @discussion Associates a dictionary with the specified path.
131131+ @param prefs The preferences session.
132132+ @param path A string that represents the path to be updated.
133133+ @param value A dictionary that represents the data to be
134134+ stored at the specified path.
135135+ @result Returns TRUE if successful; FALSE otherwise.
136136+ */
137137+Boolean
138138+SCPreferencesPathSetValue (
139139+ SCPreferencesRef prefs,
140140+ CFStringRef path,
141141+ CFDictionaryRef value
142142+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
143143+144144+/*!
145145+ @function SCPreferencesPathSetLink
146146+ @discussion Associates a link to a second dictionary at the
147147+ specified path.
148148+ @param prefs The preferences session.
149149+ @param path A string that represents the path to be updated.
150150+ @param link A string that represents the link to be stored
151151+ at the specified path.
152152+ @result Returns TRUE if successful; FALSE otherwise.
153153+ */
154154+Boolean
155155+SCPreferencesPathSetLink (
156156+ SCPreferencesRef prefs,
157157+ CFStringRef path,
158158+ CFStringRef link
159159+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
160160+161161+/*!
162162+ @function SCPreferencesPathRemoveValue
163163+ @discussion Removes the data associated with the specified path.
164164+ @param prefs The preferences session.
165165+ @param path A string that represents the path to be returned.
166166+ @result Returns TRUE if successful; FALSE otherwise.
167167+ */
168168+Boolean
169169+SCPreferencesPathRemoveValue (
170170+ SCPreferencesRef prefs,
171171+ CFStringRef path
172172+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
173173+174174+__END_DECLS
175175+176176+CF_ASSUME_NONNULL_END
177177+CF_IMPLICIT_BRIDGING_DISABLED
178178+179179+#endif /* _SCPREFERENCESPATH_H */
···11+/*
22+ * Copyright (c) 2000-2002, 2004, 2005, 2008, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SCPREFERENCESSETSPECIFIC_H
2525+#define _SCPREFERENCESSETSPECIFIC_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CoreFoundation.h>
3030+#include <SystemConfiguration/SCPreferences.h>
3131+3232+CF_IMPLICIT_BRIDGING_ENABLED
3333+CF_ASSUME_NONNULL_BEGIN
3434+3535+/*!
3636+ @header SCPreferencesSetSpecific
3737+ @discussion The functions in the SCPreferencesSetSpecific API allow
3838+ an application to set specific configuration information
3939+ about the current system (for example, the computer or
4040+ sharing name).
4141+4242+ To access configuration preferences, you must first establish
4343+ a preferences session using the SCPreferencesCreate function.
4444+ */
4545+4646+4747+__BEGIN_DECLS
4848+4949+/*!
5050+ @function SCPreferencesSetComputerName
5151+ @discussion Updates the computer name preference.
5252+5353+ Note: To commit these changes to permanent storage you must
5454+ call the SCPreferencesCommitChanges function.
5555+ In addition, you must call the SCPreferencesApplyChanges
5656+ function for the new name to become active.
5757+ @param prefs The preferences session.
5858+ @param name The computer name to be set.
5959+ @param nameEncoding The encoding associated with the computer name.
6060+ @result Returns TRUE if successful; FALSE otherwise.
6161+ */
6262+Boolean
6363+SCPreferencesSetComputerName (
6464+ SCPreferencesRef prefs,
6565+ CFStringRef __nullable name,
6666+ CFStringEncoding nameEncoding
6767+ ) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_NA);
6868+6969+/*!
7070+ @function SCPreferencesSetLocalHostName
7171+ @discussion Updates the local host name.
7272+7373+ Note: To commit these changes to permanent storage you must
7474+ call the SCPreferencesCommitChanges function.
7575+ In addition, you must call the SCPreferencesApplyChanges
7676+ function for the new name to become active.
7777+ @param prefs The preferences session.
7878+ @param name The local host name to be set.
7979+8080+ Note: this string must conform to the naming conventions of a DNS host
8181+ name as specified in RFC 1034 (section 3.5).
8282+ @result Returns TRUE if successful; FALSE otherwise.
8383+ */
8484+Boolean
8585+SCPreferencesSetLocalHostName (
8686+ SCPreferencesRef prefs,
8787+ CFStringRef __nullable name
8888+ ) __OSX_AVAILABLE_STARTING(__MAC_10_2,__IPHONE_NA);
8989+9090+__END_DECLS
9191+9292+CF_ASSUME_NONNULL_END
9393+CF_IMPLICIT_BRIDGING_DISABLED
9494+9595+#endif /* _SCPREFERENCESSETSPECIFIC_H */
···11+/*
22+ * Copyright (c) 2000-2004, 2006, 2008-2010, 2012, 2015 Apple Inc. All rights reserved.
33+ *
44+ * @APPLE_LICENSE_HEADER_START@
55+ *
66+ * This file contains Original Code and/or Modifications of Original Code
77+ * as defined in and that are subject to the Apple Public Source License
88+ * Version 2.0 (the 'License'). You may not use this file except in
99+ * compliance with the License. Please obtain a copy of the License at
1010+ * http://www.opensource.apple.com/apsl/ and read it before using this
1111+ * file.
1212+ *
1313+ * The Original Code and all software distributed under the License are
1414+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1515+ * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
1616+ * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
1717+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
1818+ * Please see the License for the specific language governing rights and
1919+ * limitations under the License.
2020+ *
2121+ * @APPLE_LICENSE_HEADER_END@
2222+ */
2323+2424+#ifndef _SYSTEMCONFIGURATION_H
2525+#define _SYSTEMCONFIGURATION_H
2626+2727+#include <Availability.h>
2828+#include <sys/cdefs.h>
2929+#include <CoreFoundation/CoreFoundation.h>
3030+3131+3232+/*!
3333+ @header SystemConfiguration
3434+ @discussion The System Configuration framework provides access to the
3535+ data used to configure a running system. The APIs provided
3636+ by this framework communicate with the configd daemon.
3737+3838+ The configd daemon manages a dynamic store reflecting the
3939+ desired configuration settings as well as the current state
4040+ of the system. The daemon provides a notification mechanism
4141+ for processes that need to be aware of changes made to the
4242+ data. Lastly, the daemon loads a number of bundles (or
4343+ plug-ins) that monitor low-level kernel events and, through
4444+ a set of policy modules, keep the state data up to date.
4545+ */
4646+4747+/*!
4848+ @enum Error codes
4949+ @discussion Returned error codes.
5050+ @constant kSCStatusOK Success
5151+ @constant kSCStatusFailed Non-specific Failure
5252+ @constant kSCStatusInvalidArgument Invalid argument
5353+ @constant kSCStatusAccessError Permission denied
5454+ @constant kSCStatusNoKey No such key
5555+ @constant kSCStatusKeyExists Data associated with key already defined
5656+ @constant kSCStatusLocked Lock already held
5757+ @constant kSCStatusNeedLock Lock required for this operation
5858+ @constant kSCStatusNoStoreSession Configuration daemon session not active
5959+ @constant kSCStatusNoStoreServer Configuration daemon not (or no longer) available
6060+ @constant kSCStatusNotifierActive Notifier is currently active
6161+ @constant kSCStatusNoPrefsSession Preferences session not active
6262+ @constant kSCStatusPrefsBusy Preferences update currently in progress
6363+ @constant kSCStatusNoConfigFile Configuration file not found
6464+ @constant kSCStatusNoLink No such link
6565+ @constant kSCStatusStale Write attempted on stale version of object
6666+ @constant kSCStatusMaxLink Maximum link count exceeded
6767+ @constant kSCStatusReachabilityUnknown
6868+ A determination could not be made regarding the reachability
6969+ of the specified nodename or address.
7070+ @constant kSCStatusConnectionNoService Network service for connection not available
7171+*/
7272+enum {
7373+ /*
7474+ * Generic error codes
7575+ */
7676+ kSCStatusOK = 0, /* Success */
7777+ kSCStatusFailed = 1001, /* Non-specific failure */
7878+ kSCStatusInvalidArgument = 1002, /* Invalid argument */
7979+ kSCStatusAccessError = 1003, /* Permission denied
8080+ - must be root to obtain lock
8181+ - could not create access/create preferences
8282+ */
8383+ kSCStatusNoKey = 1004, /* No such key */
8484+ kSCStatusKeyExists = 1005, /* Key already defined */
8585+ kSCStatusLocked = 1006, /* Lock already held */
8686+ kSCStatusNeedLock = 1007, /* Lock required for this operation */
8787+ /*
8888+ * SCDynamicStore error codes
8989+ */
9090+ kSCStatusNoStoreSession = 2001, /* Configuration daemon session not active */
9191+ kSCStatusNoStoreServer = 2002, /* Configuration daemon not (no longer) available */
9292+ kSCStatusNotifierActive = 2003, /* Notifier is currently active */
9393+ /*
9494+ * SCPreferences error codes
9595+ */
9696+ kSCStatusNoPrefsSession = 3001, /* Preference session not active */
9797+ kSCStatusPrefsBusy = 3002, /* Preferences update currently in progress */
9898+ kSCStatusNoConfigFile = 3003, /* Configuration file not found */
9999+ kSCStatusNoLink = 3004, /* No such link */
100100+ kSCStatusStale = 3005, /* Write attempted on stale version of object */
101101+ kSCStatusMaxLink = 3006, /* Maximum link count exceeded */
102102+ /*
103103+ * SCNetwork error codes
104104+ */
105105+ kSCStatusReachabilityUnknown = 4001, /* Network reachability cannot be determined */
106106+ /*
107107+ * SCNetworkConnection error codes
108108+ */
109109+ kSCStatusConnectionNoService = 5001, /* Network service for connection not available
110110+ __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_2_0)
111111+ */
112112+ kSCStatusConnectionIgnore = 5002, /* Network connection information not available at this time
113113+ __OSX_AVAILABLE_STARTING(__MAC_10_9,__IPHONE_6_0)
114114+ */
115115+};
116116+117117+118118+/* SCDynamicStore APIs */
119119+#include <SystemConfiguration/SCDynamicStore.h>
120120+#include <SystemConfiguration/SCDynamicStoreKey.h>
121121+#include <SystemConfiguration/SCDynamicStoreCopySpecific.h>
122122+123123+/* SCPreferences APIs */
124124+#include <SystemConfiguration/SCPreferences.h>
125125+#include <SystemConfiguration/SCPreferencesPath.h>
126126+#include <SystemConfiguration/SCPreferencesSetSpecific.h>
127127+128128+/* Schema Definitions (for SCDynamicStore and SCPreferences) */
129129+#include <SystemConfiguration/SCSchemaDefinitions.h>
130130+131131+/* SCNetworkConfiguration APIs */
132132+#include <SystemConfiguration/SCNetworkConfiguration.h>
133133+134134+/* SCNetworkReachability and SCNetworkConnection APIs */
135135+#include <SystemConfiguration/SCNetwork.h>
136136+#include <SystemConfiguration/SCNetworkReachability.h>
137137+#include <SystemConfiguration/SCNetworkConnection.h>
138138+139139+CF_IMPLICIT_BRIDGING_ENABLED
140140+CF_ASSUME_NONNULL_BEGIN
141141+142142+/*!
143143+ @const kCFErrorDomainSystemConfiguration
144144+ @discussion CFError domain associated with errors reported by
145145+ the SystemConfiguration.framework.
146146+ */
147147+extern const CFStringRef kCFErrorDomainSystemConfiguration __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
148148+149149+__BEGIN_DECLS
150150+151151+/*!
152152+ @function SCCopyLastError
153153+ @discussion Returns the most recent status or error code generated
154154+ as the result of calling a System Configuration framework API.
155155+ @result Returns the last error encountered.
156156+ */
157157+CFErrorRef SCCopyLastError (void) __OSX_AVAILABLE_STARTING(__MAC_10_5,__IPHONE_2_0);
158158+159159+/*!
160160+ @function SCError
161161+ @discussion Returns the most recent status or error code generated
162162+ as the result of calling a System Configuration framework API.
163163+ @result Returns the last error encountered.
164164+ */
165165+int SCError (void) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0);
166166+167167+/*!
168168+ @function SCErrorString
169169+ @discussion Returns a pointer to the message string
170170+ associated with the specified status or error.
171171+ @param status The SCDynamicStoreStatus to be returned.
172172+ @result Returns a pointer to the error message string.
173173+ */
174174+const char * SCErrorString (int status) __OSX_AVAILABLE_STARTING(__MAC_10_1,__IPHONE_2_0);
175175+176176+__END_DECLS
177177+178178+CF_ASSUME_NONNULL_END
179179+CF_IMPLICIT_BRIDGING_DISABLED
180180+181181+#endif /* _SYSTEMCONFIGURATION_H */