···11+/*
22+ * Copyright (c) 2000-2005, 2007-2009, 2011, 2012 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 _SCPREFERENCESPRIVATE_H
2525+#define _SCPREFERENCESPRIVATE_H
2626+2727+2828+#include <Availability.h>
2929+#include <sys/cdefs.h>
3030+#include <CoreFoundation/CoreFoundation.h>
3131+#include <SystemConfiguration/SCPreferences.h>
3232+3333+3434+/*!
3535+ @header SCPreferencesPrivate
3636+ */
3737+3838+/*!
3939+ @defined kSCPreferencesOptionChangeNetworkSet
4040+ @abstract The SCPreferences "option" used to indicate that only the
4141+ current network set (location) is being changed.
4242+ */
4343+#define kSCPreferencesOptionChangeNetworkSet CFSTR("change-network-set") // CFBooleanRef
4444+4545+/*!
4646+ @defined kSCPreferencesOptionRemoveWhenEmpty
4747+ @abstract The SCPreferences "option" used to indicate that the .plist
4848+ file should be removed when/if all keys have been removed.
4949+ */
5050+#define kSCPreferencesOptionRemoveWhenEmpty CFSTR("remove-when-empty") // CFBooleanRef
5151+5252+/*!
5353+ @defined kSCPreferencesAuthorizationRight_network_set
5454+ @abstract The authorization right used to control whether the current
5555+ network set (location) can be changed.
5656+ */
5757+#define kSCPreferencesAuthorizationRight_network_set "system.preferences.location"
5858+5959+/*!
6060+ @defined kSCPreferencesAuthorizationRight_write
6161+ @abstract The authorization right used to control whether the network
6262+ configuration can be changed.
6363+ */
6464+#define kSCPreferencesAuthorizationRight_write "system.services.systemconfiguration.network"
6565+6666+/*!
6767+ @enum SCPreferencesKeyType
6868+ @discussion Used with the SCDynamicStoreKeyCreatePreferences() function
6969+ to describe the resulting CFStringRef argument.
7070+ @constant kSCPreferencesKeyCommit Key used when new preferences are
7171+ committed to the store
7272+ @constant kSCPreferencesKeyApply Key used when new preferences are
7373+ to be applied to the active system configuration.
7474+ */
7575+enum {
7676+ kSCPreferencesKeyLock = 1,
7777+ kSCPreferencesKeyCommit = 2,
7878+ kSCPreferencesKeyApply = 3
7979+};
8080+typedef int32_t SCPreferencesKeyType;
8181+8282+8383+__BEGIN_DECLS
8484+8585+/*!
8686+ @const kSCPreferencesUseEntitlementAuthorization
8787+ @discussion An authorization value that can be passed to
8888+ the SCPreferencesCreateWithAuthorization API (or
8989+ the SCPreferencesCreateWithOptions SPI) to indicate
9090+ that the entitlements of the current process should
9191+ be used for authorization purposes.
9292+9393+ This value can ONLY be used with the SCPreferences
9494+ APIs.
9595+ */
9696+extern const AuthorizationRef kSCPreferencesUseEntitlementAuthorization;
9797+9898+/*!
9999+ @function SCDynamicStoreKeyCreatePreferences
100100+ @discussion Creates a key that can be used by the SCDynamicStoreSetNotificationKeys()
101101+ function to receive notifications of changes to the saved
102102+ preferences.
103103+ @param allocator ...
104104+ @param prefsID A string that identifies the name of the
105105+ group of preferences to be accessed/updated.
106106+ @param keyType A kSCPreferencesKeyType indicating the type a notification
107107+ key to be returned.
108108+ @result A notification string for the specified preference identifier.
109109+ */
110110+CFStringRef
111111+SCDynamicStoreKeyCreatePreferences (
112112+ CFAllocatorRef allocator,
113113+ CFStringRef prefsID,
114114+ SCPreferencesKeyType keyType
115115+ ) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1,__MAC_10_4,__IPHONE_2_0,__IPHONE_2_0);
116116+117117+/*!
118118+ @function SCPreferencesCreateWithOptions
119119+ @discussion Initiates access to the per-system set of configuration
120120+ preferences.
121121+ @param allocator The CFAllocator that should be used to allocate
122122+ memory for this preferences session.
123123+ This parameter may be NULL in which case the current
124124+ default CFAllocator is used.
125125+ If this reference is not a valid CFAllocator, the behavior
126126+ is undefined.
127127+ @param name A string that describes the name of the calling
128128+ process.
129129+ @param prefsID A string that identifies the name of the
130130+ group of preferences to be accessed or updated.
131131+ @param authorization An authorization reference that is used to
132132+ authorize any access to the enhanced privileges needed
133133+ to manage the preferences session.
134134+ @param options A CFDictionary with options that affect the
135135+ configuration preferences and how the APIs interact
136136+ with the plist.
137137+ @result Returns a reference to the new SCPreferences.
138138+ You must release the returned value.
139139+ */
140140+SCPreferencesRef
141141+SCPreferencesCreateWithOptions (
142142+ CFAllocatorRef allocator,
143143+ CFStringRef name,
144144+ CFStringRef prefsID,
145145+ AuthorizationRef authorization,
146146+ CFDictionaryRef options
147147+ ) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
148148+149149+/*!
150150+ @function SCPreferencesRemoveAllValues
151151+ @discussion Removes all data associated with the preferences.
152152+153153+ This function removes all data associated with the preferences.
154154+ To commit these changes to permanent storage a call must be made
155155+ to the SCPreferencesCommitChanges function.
156156+ @param prefs The preferences session.
157157+ @result Returns TRUE if the value was removed;
158158+ FALSE if the key did not exist or if an error occurred.
159159+ */
160160+Boolean
161161+SCPreferencesRemoveAllValues (
162162+ SCPreferencesRef prefs
163163+ ) __OSX_AVAILABLE_STARTING(__MAC_10_7,__IPHONE_5_0/*SPI*/);
164164+165165+__END_DECLS
166166+167167+#endif /* _SCPREFERENCESPRIVATE_H */
···11+/*
22+ * Copyright (c) 2001, 2002, 2005 Apple Computer, 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 _SCVALIDATION_H
2525+#define _SCVALIDATION_H
2626+2727+#include <sys/cdefs.h>
2828+#include <CoreFoundation/CoreFoundation.h>
2929+3030+__BEGIN_DECLS
3131+3232+static __inline__ CFTypeRef
3333+isA_CFType(CFTypeRef obj, CFTypeID type)
3434+{
3535+ if (obj == NULL)
3636+ return (NULL);
3737+3838+ if (CFGetTypeID(obj) != type)
3939+ return (NULL);
4040+4141+ return (obj);
4242+}
4343+4444+static __inline__ CFTypeRef
4545+isA_CFArray(CFTypeRef obj)
4646+{
4747+ return (isA_CFType(obj, CFArrayGetTypeID()));
4848+}
4949+5050+static __inline__ CFTypeRef
5151+isA_CFBoolean(CFTypeRef obj)
5252+{
5353+ return (isA_CFType(obj, CFBooleanGetTypeID()));
5454+}
5555+5656+static __inline__ CFTypeRef
5757+isA_CFData(CFTypeRef obj)
5858+{
5959+ return (isA_CFType(obj, CFDataGetTypeID()));
6060+}
6161+6262+static __inline__ CFTypeRef
6363+isA_CFDate(CFTypeRef obj)
6464+{
6565+ return (isA_CFType(obj, CFDateGetTypeID()));
6666+}
6767+6868+static __inline__ CFTypeRef
6969+isA_CFDictionary(CFTypeRef obj)
7070+{
7171+ return (isA_CFType(obj, CFDictionaryGetTypeID()));
7272+}
7373+7474+static __inline__ CFTypeRef
7575+isA_CFNumber(CFTypeRef obj)
7676+{
7777+ return (isA_CFType(obj, CFNumberGetTypeID()));
7878+}
7979+8080+static __inline__ CFTypeRef
8181+isA_CFPropertyList(CFTypeRef obj)
8282+{
8383+ CFTypeID type;
8484+8585+ if (obj == NULL)
8686+ return (NULL);
8787+8888+ type = CFGetTypeID(obj);
8989+ if (type == CFArrayGetTypeID() ||
9090+ type == CFBooleanGetTypeID() ||
9191+ type == CFDataGetTypeID() ||
9292+ type == CFDateGetTypeID() ||
9393+ type == CFDictionaryGetTypeID() ||
9494+ type == CFNumberGetTypeID() ||
9595+ type == CFStringGetTypeID())
9696+ return (obj);
9797+9898+ return (NULL);
9999+}
100100+101101+102102+static __inline__ CFTypeRef
103103+isA_CFString(CFTypeRef obj)
104104+{
105105+ return (isA_CFType(obj, CFStringGetTypeID()));
106106+}
107107+108108+109109+Boolean
110110+_SC_stringIsValidDNSName (const char *name);
111111+112112+113113+Boolean
114114+_SC_CFStringIsValidDNSName (CFStringRef name);
115115+116116+117117+Boolean
118118+_SC_CFStringIsValidNetBIOSName (CFStringRef name);
119119+120120+121121+__END_DECLS
122122+123123+#endif /* _SCVALIDATION_H */
124124+